node_client_package
TypeScript icon, indicating that this package has built-in type declarations

3.1.3 • Public • Published

node-client-package

Node Client

Node Client is the api client package that communicate with [Abstrxn SDK] backend node to fetch needed smart contract wallet data i.e supported chains list, transaction history, balances e.t.c

Installation

yarn add node-client-package

OR

npm install node-client-package

Usage

// import package
import NodeClient from 'node-client-package'

// initialisation

const nodeClient = new NodeClient({ txServiceUrl: 'https://sdk-backend.staging.biconomy.io/v1' })

Fetch Supported Chains List

const supportedChainsList = await nodeClient.getAllSupportedChains()
console.log('supportedChainsList ', supportedChainsList)

Fetch Transactions By Address

const chainId = 80001
const address = '0xabc......'
const trxHistory = await nodeClient.getTransactionByAddress(chainId, address)
console.log('trxHistory ', trxHistory)

Get Transaction By Hash

const txHash = '0x........'
const trxDetail = await nodeClient.getTransactionByHash(txHash)
console.log('trxDetail ', trxDetail)

Get Smart Contract Wallet Balances

import { BalancesDto } from 'node-client-package'

import { ChainId } from 'core_types_package'

const address = '0xabc......'

const balanceParams: BalancesDto =
      {
          // if no chainId is supplied, SDK will automatically pick active one that
         //  is being supplied for initialization

        chainId: ChainId.MAINNET, // chainId of your choice
        address: address,
        // If empty string you receive balances of all tokens watched by Indexer
        // you can only whitelist token addresses that are listed in token respository
        // specified above ^
        tokenAddresses: [],
      };

const balFromSdk = await nodeClient.getAllTokenBalances(balanceParams);
console.info("balFromSdk ", balFromSdk);

const usdBalFromSdk = await nodeClient.getTotalBalanceInUsd(balanceParams);
console.info("usdBalFromSdk ", usdBalFromSdk)

Package Sidebar

Install

npm i node_client_package

Weekly Downloads

0

Version

3.1.3

License

MIT

Unpacked Size

18.9 kB

Total Files

10

Last publish

Collaborators

  • rakeshxyz