nativeToHexString()

To convert an address in a chain's native representation into a 32-byte hex string

Method Parameters

address: string | undefined

Destination address

chain: ChainId | ChainName

Destination chain

Returns

Returns hex address string

Usage

import { ethers } from "ethers";
import { nativeToHexString, CHAIN_ID_ETH } from "@algo-foundry/messina-sdk";

const provider = new ethers.providers.WebSocketProvider(
      <ETH_NODE_URL>
    ) as any;   
const signer = new ethers.Wallet(<ETH_PRIVATE_KEY>, provider);

const hexStr = nativeToHexString(
      signer.address,
      CHAIN_ID_ETH
    );

Last updated