@circle-fin/usdckit

中文文档
0.25.4发布于 2026/06/29Apache-2.0TypeScriptESM + CJS近 30 天下载 3395

⚠️ Important: We have upgraded the product to App Kit and recommend using it for all production deployments. USDCKit will remain available as a private beta product. Thank you.

原始使用文档
文档目录18 节
  1. Introduction
  2. Benefits of Using USDCKit
  3. Quickstart Steps
  4. Setup
  5. Installation
  6. Initialization
  7. Usage
  8. Create Account
  9. Query for accounts
  10. Fund Account with Testnet Tokens
  11. Transfer tokens
  12. Swap tokens
  13. Get Account Balance
  14. Enable Logging
  15. Samples
  16. Sample Code to run Stablecoin Acquiring Flow
  17. Future Plans
  18. Feedback & Support

USDCKit

⚠️ Important: We have upgraded the product to App Kit and recommend using it for all production deployments. USDCKit will remain available as a private beta product. Thank you.

Introduction

USDCKit is a Node.js SDK that streamlines interactions with USDC. With USDCKit, you can integrate USDC into your applications and enable secure and efficient blockchain transactions. USDCKit aims to provide multi-chain fund orchestration features to enable USDC payment use cases like crypto acquiring (C2B), payroll (B2C), remittance (C2C), and B2B cross-border payments.

The SDK is built with TypeScript and supports high-level use cases involving stablecoins, making it an important tool for developers working with digital currencies.

This guide will help you get started quickly and efficiently, whether you're building a wallet, a payment gateway, or anything in between. It covers the following items:

Benefits of Using USDCKit

  • Faster time-to-market. USDCKit simplifies accepting and managing stablecoin payments with minimal code. It provides reusable payment modules and removes technical complexities for faster integration.
  • Payment Focused. USDCKit is built to offer all the features and tools required to create a complete end-to-end stablecoin payment flow, with functionalities tailored for payment use cases. It also includes sample code for specific payment products, making it easier to develop your own. The focus of the current release is Stablecoin Acquiring use case.
  • Scalable payments without bottlenecks. Process millions of transactions efficiently with USDCKit’s high-performance infrastructure.‍
  • Enterprise-grade compliance management. Adhere to global regulatory standards with real-time transaction screening through Compliance Engine.‍

Key features

Besides basic wallet management, transfers, and balance queries, here are some of the other highlighted features that USDCKit supports that facilitate the orchestration of on-chain fund flow:

  • Fund sweeping: Automate fund aggregation with many-to-1 transfers and optimize gas efficiency.
  • Cross-chain transfer: Transfer funds between wallets on different chains.
  • Token Swap: Convert one token type into another seamlessly.
  • Transaction screening: Prevent wallets from transacting with OFAC sanctioned addresses.

Quickstart Steps

Setup

USDCKit is built on top of Circle Wallets’ Dev-controlled wallets. You will need to set up a Circle Developer Console account before using the service. Please follow these steps:

  1. Sign Up

    Go to the Circle Developer Console and sign up for an account. This account will be used to manage your access to Circle’s Developer Services such as Dev-controlled wallets and smart contract platform. Follow the instructions for more details.

  2. Generate API Key

    Navigate to the API & Client Keys section of your project and generate a new API Key. Make sure to store the API Key securely as it will be used to authenticate your requests. Follow the instructions for more details.

  3. Register Entity Secret

    Run the following command to create and register an Entity Secret. The command will prompt you to enter the API Key generated from the previous step.

    npx @circle-fin/usdckit register-entity-secret
    

    After running the command, your new Entity Secret will be displayed in the console and saved to an environment file (.env by default). A Recovery File is also stored (recovery.dat by default).

    A UI-based approach for setting up the Entity Secret is also available.

Installation

To install USDCKit from NPM, run the following command in your project directory:

npm install @circle-fin/usdckit

Initialization

To get started with USDCKit, initialize a client with the API Key and Entity Secret from Setup

import { createCircleClient } from '@circle-fin/usdckit'
import { ETH_SEPOLIA } from '@circle-fin/usdckit/chains'

const client = createCircleClient({
  apiKey: 'CIRCLE_API_KEY',
  entitySecret: 'CIRCLE_ENTITY_SECRET',

  // Optional.  Defaults to `ETH_SEPOLIA`
  chain: ETH_SEPOLIA,
})

Usage

Create Account

To create a new account (also known as wallet), use the createAccount method. This will generate a new account that you can use for various operations such as transferring tokens and retrieving balances.

USDCKit currently supports the creation of EOA (Externally-Owned-Account) and SCA (Smart-Contract-Account). Refer to this page to understand more and select the most appropriate account type for your business.

// Creates an account on the default chain ETH_SEPOLIA (EOA)
const account = await client.createAccount()

// Creates an account on the ARB_SEPOLIA (SCA)
const account = await client.createAccount({ accountType: 'SCA', chain: ARB_SEPOLIA })

Query for accounts

To query for existing accounts, use the getAccounts method. This will return the account details associated with the provided account query.

// Query by Address
const account = await client.getAccounts({ address: '0xabc123...def456' })

// Query by refId
const account = await client.getAccounts({ refId: 'user-1' })

// Query by balance greater or equal to
const account = await client.getAccounts({ amountGte: 1000 })

Fund Account with Testnet Tokens

To fund an account with testnet tokens, you can use the drip method. This method provides native tokens, USDC, and EURC for testing purposes.

// Receive native tokens, USDC, and EURC
await client.drip({ account })

// Receive native
await client.drip({ account, token: null })

// Receive USDC
await client.drip({ account, token: client.chain.contracts.USDC })

Transfer tokens

The transfer method allows the transferring of native or ERC-20 tokens between accounts. Multiple source accounts can be transferred with a single call. Fees can be controllable using the fees parameter. USDC can be transferred between accounts across chains via CCTP. Below are examples of how to use the transfer() method for each type of token.

// Create Transfer - Native Tokens
const transaction_native = await client.transfer({
  from: account,
  to: anotherAccount,
  amount: '0.00000001', // or use base units `1n`
})

// Create Transfer - USDC
const transaction_usdc = await client.transfer({
  from: account,
  to: anotherAccount,
  token: ETH_SEPOLIA.contracts.USDC,
  amount: '0.01',
  chain: ETH_SEPOLIA,
})

// Create Transfer - EURC
const transaction_eurc = await client.transfer({
  from: account,
  to: anotherAccount,
  token: ETH_SEPOLIA.contracts.EURC,
  amount: '0.01',
  chain: ETH_SEPOLIA,
})

// Create Transfer - USDT
const transaction_usdt = await client.transfer({
  from: account,
  to: anotherAccount,
  token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
  amount: '0.01',
  chain: ETH,
})

// Create Transfer - Cross chain transfer (only supported for USDC)
const transaction_usdc = await client.transfer({
  from: accountOnETH_SEPOLIA,
  to: accountOnMATIC_AMOY,
  token: ETH_SEPOLIA.contracts.USDC,
  amount: '0.01',
})

Batch Transfer

Transfer from multiple source accounts to a single destination account

// Create Transfer - Batch transfer
const transaction_batch = await client.transfer({
  from: [account_1, account_2],
  to: account_3,
  token: client.chain.contracts.USDC,
  amount: '0.01',
})

Sweep Tokens

sweep function transfers all specified tokens from one account to another. In this example, it transfers all USDC tokens from account_1 to account_2.

const [tx] = await client.sweep({
  from: account_1,
  to: account_2,
  token: client.chain.contracts.USDC,
})

Swap tokens

The swap action swaps one ERC-20 token for another

// Get the quote for the swap
const quote = await client.getSwapQuote({
  tokenIn: client.chain.contracts.USDC,
  tokenInAmount: '100',
  tokenOut: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
})
// Verify the quote
if (quote.tokenInAmount < 9_500_000n) throw new Error('Quote is invalid')

// Swap 100 USDC for WETH
const txHash = await client.swap({ ...quote, account })

Directly swap without getting a quote

// Swap 100 USDC for WETH
const txHash = await client.swap({
  tokenIn: client.chain.contracts.USDC,
  tokenInAmount: '100',
  tokenOut: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14',
  account,
})

Get Account Balance

Use getTokenBalances to retrieve the token balances for a specified account.

const balance = await client.getTokenBalances({ account: account_2 })

Enable Logging

Logging is enabled by configuring the logLevel parameter when creating the client. This allows you to see detailed logs of the operations performed by USDCKit, which can be helpful for debugging and monitoring purposes.

See createCircleClient for more details.

const client = createClient({
  ...,
  logLevel: 'debug',
})

Samples

Sample Code to run Stablecoin Acquiring Flow

Our sample code on the Stablecoin Acquiring Flow demonstrates the architecture and technical implementation of a typical acquiring platform. It guides you through the process to set up different wallets to collect stablecoin payments, and also to use different SDK methods to orchestrate the fund flow.

Future Plans

The current private release marks the first version of USDCKit, and we recognize that additional tools are needed to create a smooth stablecoin payment experience. As such, we are actively working on several modules and would greatly appreciate your feedback. Our roadmap includes, but is not limited to, the following:

  • Gas Efficiency Enhancement
  • Mass Payout of Funds
  • Pull Payment/Subscription Payment

Feedback & Support

If you have any questions or need assistance, don't hesitate to reach out to the team directly([email protected]). We're here to support you every step of the way.

Happy coding!

版本与发布记录

@circle-fin/usdckit 共发布 27 个版本,首次发布于 2025/03/24;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.25.4latest2026/06/294 个月前
0.25.32026/06/244 个月前
0.25.12026/05/046 个月前
0.24.22026/04/136 个月前
0.24.12026/01/269 个月前
0.23.22025/12/0911 个月前

关于 @circle-fin/usdckit 的常见问题

@circle-fin/usdckit 是什么?

⚠️ Important: We have upgraded the product to App Kit and recommend using it for all production deployments. USDCKit will remain available as a private beta product. Thank you.

如何安装 @circle-fin/usdckit?

在项目目录运行 npm install @circle-fin/usdckit,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 usdckit,可以用 npx usdckit 直接运行。

@circle-fin/usdckit 支持 TypeScript 吗?

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

@circle-fin/usdckit 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@circle-fin/usdckit 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@circle-fin/usdckit 可以商用吗?

@circle-fin/usdckit 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@circle-fin/usdckit 的下载量有多少?

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

@circle-fin/usdckit 还在维护吗?

最新版本 0.25.4 发布于 2026/06/29(4 个月前);至今共发布 27 个版本,其中过去 12 个月发布了 7 个;首次发布于 2025/03/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。