@circle-fin/user-controlled-wallets
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

Circle's User Controlled Wallets NodeJS SDK

This SDK provides convenient access to Circle's User Controlled Wallets APIs for applications written in NodeJS. For the API reference, see the Circle Web3 API docs.

Installation

Install the package with:

npm install @circle-fin/user-controlled-wallets --save

or

yarn add @circle-fin/user-controlled-wallets

Usage

  1. Generate an API key, if you haven't already, in the Web3 Services Console. This API key will be used for authentication and authorization when making requests to Circle's APIs.

  2. Follow our User-Controlled QuickStart. This step ensures that you fully grasp the concept of Circle's User-Controlled Wallets.

  3. In your code, import the factory initiateUserControlledWalletsClient from the SDK and initialize the client using your API key and entity secret:

    const { initiateUserControlledWalletsClient } = require('@circle-fin/user-controlled-wallets')
    
    const client = initiateUserControlledWalletsClient({
      apiKey: '<your-api-key>'
    })

    or

    import { initiateUserControlledWalletsClient } from '@circle-fin/user-controlled-wallets'
    
    const client = initiateUserControlledWalletsClient({
      apiKey: '<your-api-key>'
    })
  4. Interact with the client:

    const response = await client.createTransaction({
      userToken: 'dummy-user-token',
      amount: ['0.01'],
      destinationAddress: '0xa51c9c604b79a0fadbfed35dd576ca1bce71da0a',
      tokenId: '738c8a6d-8896-46d1-b2cb-083600c1c69b',
      walletId: 'a635d679-4207-4e37-b12e-766afb9b3892',
      fee: {
        type: 'level',
        config: {
          feeLevel: 'HIGH',
        },
      },
    })
    console.log(response.data?.challengeId)

    We recommend reading through the official documentation and QuickStart guides mentioned above to ensure a smooth setup and usage experience.

Configuration

The client accepts the following configuration parameters:

Option Required Description
apiKey [x] Api Key that is used to authenticate against Circle APIs.
baseUrl [ ] Optional base URL to override the default: https://api.circle.com.
storage [ ] Optional custom storage solution for persisting data. We will fallback to InMemoryStorage if none was provided.
userAgent [ ] Optional custom user agent request header. We will prepend it to default user agent header if provided.

Need help or have questions?

Here are some helpful links, if you encounter any issues or have questions about this SDK:

Happy coding!

Readme

Keywords

none

Package Sidebar

Install

npm i @circle-fin/user-controlled-wallets

Weekly Downloads

344

Version

3.0.0

License

none

Unpacked Size

1.39 MB

Total Files

10

Last publish

Collaborators

  • tomleicircle
  • elvin-circle
  • circle-smartin
  • ashuk-circle
  • deepakgummi-circle
  • prakashb-circle