5.0.0 • Published 9 months ago

@circle-fin/smart-contract-platform v5.0.0

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

Circle's Smart Contract Platform NodeJS SDK

This SDK provides convenient access to Circle's Smart Contract Platform 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/smart-contract-platform --save

or

yarn add @circle-fin/smart-contract-platform

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. Register an entity secret following Circle's Developer-Controlled QuickStart. This step ensures that your account is correctly set up to interact with Circle's APIs.

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

    const { initiateSmartContractPlatformClient } = require('@circle-fin/smart-contract-platform')
    
    const client = initiateSmartContractPlatformClient({
      apiKey: '<your-api-key>',
      entitySecret: '<your-entity-secret>',
    })

    or

    import { initiateSmartContractPlatformClient } from '@circle-fin/smart-contract-platform'
    
    const client = initiateSmartContractPlatformClient({
      apiKey: '<your-api-key>',
      entitySecret: '<your-entity-secret>',
    })
  4. Interact with the client:

    const response = await client.deployContract({
      name: 'First Contract',
      description: 'My first hello world contract',
      walletId: '004735f6-d9fc-44f8-933c-672cdf3d240d',
      abiJson: "[\n\t{\n\t\t'inputs': [],\n\t\t'stateMutability': 'nonpayable',\n\t\t'type': 'constructor'\n\t},\n\t...",
      bytecode: '0x60806040523480156200001157600080fd5b50604051806040...',
      constructorParameters: ['TICK', 10000],
      feeLevel: 'MEDIUM',
    })
    console.log(response.data)

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:

OptionRequiredDescription
apiKeyxApi Key that is used to authenticate against Circle APIs.
entitySecretxYour configured entity secret. You can follow the QuickStart to set it up.
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!

5.0.0

9 months ago

4.3.0

10 months ago

4.1.0

1 year ago

4.0.0

1 year ago

4.2.1

11 months ago

4.2.0

12 months ago

4.1.1

1 year ago

3.1.0

1 year ago

3.0.0

1 year ago

2.0.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

2 years ago

1.0.1

2 years ago