⛏️testChainBalances

Description

The testChainBalances function is an asynchronous function used for testing purposes to retrieve the balances of various cryptocurrencies on different blockchain networks. It takes a mnemonic (a string representing a mnemonic phrase), an environment (a string indicating the blockchain network environment), and an ecc parameter (presumably representing an elliptic curve cryptography library).

Parameters

Parameter
Data Type
Description

mnemonic

string

A mnemonic phrase used for generating the wallet's private key.

env

string

A string indicating the blockchain network environment.

ecc

any

An elliptic curve cryptography library or object.

Response

Field
Data Type
Description

code

number

Indicates the status code. 1 for success, 0 for error.

balances

object

Contains the balances of various cryptocurrencies on different blockchain networks.

error

any

(Optional) Contains the error object if an error occurred during the process.

message

string

(Optional) Provides additional information about the error, typically indicating an inappropriate mnemonic.

Example Request and Response

Prerequisites

Before making requests with Nest SDK, you must have it installed.

You can install Nest SDK using either npm or yarn. Use the following commands to install Nest SDK:

npm install @nest25/wallet-lib
OR
yarn add @nest25/wallet-lib

Request

Here is an example of how to make a testChainBalancesrequest using the Nest SDK:

const { Wallet } = require('@nest25/wallet-lib');

const wallet = new Wallet('');

async function main() {
    const response = await wallet.testChainBalances('fun mixed elevator laundry length trap script boost purchase genuine arrest')
    console.log("response --> ", response);
}

main();

Response

   response -->  {
        code: 1,
        balances: { AVA: 0, BNB: 0, ETH: 0, KLAY: 0, MATIC: 0, VLRY: 0, SOL: 0 }
      }

Use Cases

  • Testing chain balances: By invoking this function with a mnemonic and an environment, you can retrieve the balances of various cryptocurrencies on different blockchain networks.

  • Error handling: If there is an error during the execution of the function, an error object is returned with the appropriate error message, indicating an inappropriate mnemonic.

Last updated