Biconomy SDK
Search…
⌃K

Using Packages

Biconomy SDK exports several packages which can aid your development.
Node Client Package
This package is responsible for communication among client SDK and backend node. you can use following methods of it to be able to benefit from it.
yarn add @biconomy/node-client
or
npm install @biconomy/node-client
Initialisation
import NodeClient from "@biconomy/node-client"
const nodeClient = new NodeClient({ txServiceUrl: 'https://sdk-backend.prod.biconomy.io/v1/' })
Get all Supported Chains
const supportedChainList = await nodeClient.getAllSupportedChains()
console.log(supportedChainList)
Get all Supported Token
const supportedTokensList = await nodeClient.getAllTokens()
console.log(supportedTokensList)
Get all Smart Accounts By Owner
import { SmartAccountByOwnerDto } from "@biconomy/node-client"
const smartAccountByOwnerDto: SmartAccountByOwnerDto {
chainId: 1, // network of your choice
owner: 'abcxxx....' // eoa address from whom you want to know smart wallet address
}
const smartAccountsByOwner = await nodeClient.getSmartAccountsByOwner(smartAccountByOwnerDto)
console.log(smartAccountsByOwner)
Get Smart Account Balances
import { BalancesDto } from '@biconomy/node-client'
import { ChainId } from '@biconomy/core-types'
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
eoaAddress: smartAccount.address,
// If empty string you receive balances of all tokens watched by Indexer
// you can only whitelist token addresses that are listed in token respostory
// specified above ^
tokenAddresses: [],
};
const balFromSdk = await smartAccount.getAlltokenBalances(balanceParams);
console.info(balFromSdk);
const usdBalFromSdk = await smartAccount.getTotalBalanceInUsd(balanceParams);
console.info(usdBalFromSdk);