Wallet Suite

Table of Contents:

  1. getBalance

  2. setProviderAndSigner

  3. signMessage

  4. verifySignatureOffChain

  5. getConnectedChainId

  6. getConnectedChainName

  7. transfer


getBalance

Retrieves the balance of a wallet address on a specific chain.

getBalance(address: string, chainId: number): Promise<string>

Parameters:

  • address (string): The wallet address for which to retrieve the balance.

  • chainId (number): The ID of the blockchain network.

Returns: A Promise resolving to a string representing the wallet balance.

setProviderAndSigner

Sets the provider and signer for the wallet using a private key.

setProviderAndSigner(privateKey: string, chainId: number): Promise<{ provider: ethers.providers.JsonRpcProvider, signer: ethers.Signer }>

Parameters:

  • privateKey (string): The private key associated with the wallet.

  • chainId (number): The ID of the blockchain network.

Returns: A Promise resolving to an object with the provider and signer instances.

signMessage

Signs a message using the wallet's private key.

signMessage(message: string): Promise<string>

Parameters:

  • message (string): The message to sign.

Returns: A Promise resolving to a string representing the signature.

verifySignatureOffChain

Verifies the authenticity of a signature for an off-chain message.

verifySignatureOffChain(message: string, signature: string, address: string): Promise<boolean>

Parameters:

  • message (string): The original message.

  • signature (string): The signature to verify.

  • address (string): The address associated with the signature.

Returns: A Promise resolving to a boolean value indicating the verification status.

getConnectedChainId

Retrieves the ID of the currently connected blockchain network.

getConnectedChainId(): Promise<number>

Returns: A Promise resolving to a number representing the chain ID.

getConnectedChainName

Retrieves the name of the currently connected blockchain network.

getConnectedChainName(): Promise<string>

Returns: A Promise resolving to a string representing the chain name.

transfer

Transfers a certain amount of a specific token to the specified address.

transfer(to: string, amount: string): Promise<string>

Parameters:

  • to (string): The recipient's address.

  • amount (string): The amount of tokens to transfer.

Returns: A Promise resolving to a string representing the transaction hash.


Last updated