Skip to content

Commit

Permalink
v0.4.14
Browse files Browse the repository at this point in the history
  • Loading branch information
containerman17 committed Nov 10, 2024
1 parent bb46a65 commit 89babaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ To use the HyperSDK Client, make sure you have the latest version installed. You

## Changelog

### 0.4.14
- Added support for the new 4-byte hash suffix for addresses

### 0.4.13
- TS to JS compilation

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hypersdk-client",
"version": "0.4.13",
"version": "0.4.14",
"description": "Sample client for HyperSDK",
"repository": {
"type": "git",
Expand Down
6 changes: 4 additions & 2 deletions src/Marshaler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { sha256 } from '@noble/hashes/sha256';
import { parse } from 'lossless-json'
import { base64 } from '@scure/base';
Expand Down Expand Up @@ -468,7 +467,10 @@ export function addressBytesFromPubKey(pubKey: Uint8Array): Uint8Array {
}

export function addressHexFromPubKey(pubKey: Uint8Array): string {
return "0x" + bytesToHex(addressBytesFromPubKey(pubKey))
const addressBytes = addressBytesFromPubKey(pubKey)
const hash = sha256(addressBytes)
const checksum = hash.slice(-4) // Take last 4 bytes
return "0x" + bytesToHex(addressBytes) + bytesToHex(checksum)
}

export function encodeNumber(type: string, value: number | string): Uint8Array {
Expand Down

0 comments on commit 89babaf

Please sign in to comment.