-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
export function ss58ToH160(accountSS58Address: string): Binary {
// Decode the SS58 address to a Uint8Array public key
const publicKey = decodeAddress(accountSS58Address);
// Step 2: Hash with keccak256
const hashed = keccak256(publicKey); // hex string (0x-prefixed, 64 chars)
// Step 3: Take last 20 bytes (40 hex characters)
const ethAddress = "0x" + hashed.slice(-40); // Ethereum H160 address
return new Binary(ethers.getBytes(ethAddress));
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels