Function: decodeAddress()
decodeAddress(
address:BytesLike,family:ChainFamily):string
Defined in: utils.ts:296
Decode address from a 32-byte hex string.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
address | BytesLike | undefined | Address bytes to decode (hex string or Uint8Array) |
family | ChainFamily | ChainFamily.EVM | Chain family for address format (defaults to EVM) |
Returns
string
Decoded address string
Throws
CCIPChainFamilyUnsupportedError if chain family is not supported
Example
TypeScript
import { decodeAddress, ChainFamily } from '@chainlink/ccip-sdk'
// Decode EVM address from 32-byte hex
const evmAddr = decodeAddress('0x000000000000000000000000abc123...', ChainFamily.EVM)
console.log(evmAddr) // '0xABC123...'
// Decode Solana address
const solAddr = decodeAddress(bytes, ChainFamily.Solana)
console.log(solAddr) // Base58 encoded address