@biconomy/node-client

中文文档
3.1.4发布于 2024/10/11MITTypeScriptCommonJS近 30 天下载 1908

Node Client that comminucates with indexer service to fetch necessary details for the Smart Account

原始使用文档

@biconomy/node-client

Biconomy SDK Node Client

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

Installation

yarn add @biconomy/node-client

OR

npm install @biconomy/node-client

Usage

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

// 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 '@biconomy/node-client'

import { ChainId } from '@biconomy/core-types'

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)

版本与发布记录

@biconomy/node-client 共发布 15 个版本,首次发布于 2022/11/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.1.4latest2024/10/112 年前
3.1.32024/01/162 年前
3.1.22024/01/042 年前
3.1.12023/11/162 年前
3.1.02023/09/213 年前
3.0.02023/08/293 年前

关于 @biconomy/node-client 的常见问题

@biconomy/node-client 是什么?

Node Client that comminucates with indexer service to fetch necessary details for the Smart Account

如何安装 @biconomy/node-client?

在项目目录运行 npm install @biconomy/node-client,或使用 pnpm add / yarn add / bun add。

@biconomy/node-client 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@biconomy/node-client 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@biconomy/node-client 可以商用吗?

@biconomy/node-client 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@biconomy/node-client 的下载量有多少?

根据 npm 官方下载统计,@biconomy/node-client 在 2026/10/08 – 2026/11/06 这 30 天内被下载 1,908 次,日均约 64 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@biconomy/node-client 还在维护吗?

最新版本 3.1.4 发布于 2024/10/11(2 年前);至今共发布 15 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/11/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。