Deploy a smart contract on a specified blockchain using the contract's ABI and bytecode. The deployment will originate from one of your Circle Programmable Wallets.
Represents the input parameters for deploying a contract.
The contract's ABI in a JSON stringified format.
The blockchain network that the resource is to be created on or is currently on. Required along with sourceAddress
if you don't provide walletId
. The blockchain
and walletId
fields are mutually exclusive.
Bytecode of the contract being deployed.
A list of arguments to pass to the contract's constructor function. Must be an empty array if there are no constructor parameters.
The description for the contract.
Represents the configuration for setting fees. It can be either FeeLevelInput, GasInput, or FeeInput.
The maximum gas units for the transaction, required if feeLevel isn't provided. Use the Estimate Fee methods for this limit's estimation.
The maximum price per gas unit (see gasLimit), in gwei. Requires priorityFee, and gasLimit, but incompatible with feeLevel or gasPrice. Use the Estimate Fee methods to get this fee's estimates.
Requires maxFee, and gasLimit but incompatible with feeLevel or gasPrice. Use the Estimate Fee methods for fee estimates.
The maximum gas units for the transaction, required if feeLevel is not provided. Use the Estimate Fee methods for this limit's estimation.
For EIP-1559 supported blockchains, it's the max gas price per gas unit (see gasLimit), in gwei. Requires gasLimit and incompatible with feeLevel, priorityFee, or maxFee. Use the Estimate Fee methods for fee estimates.
A dynamic blockchain fee level setting (LOW
, MEDIUM
, or HIGH
) that will be used to pay gas for the transaction. Calculated based on network traffic, supply of validators, and demand for transaction verification. Cannot be used with gasPrice
, priorityFee
, or maxFee
. Estimates for each fee level can be obtained through the POST /transactions/transfer/estimateFee
API.
The contract's name.
The reference ID for the operation, to ensure idempotency.
Unique identifier of the wallet that will deploy the contract.
The optional idempotency key. An idempotency key is a unique identifier used to identify and handle duplicate requests in order to ensure idempotent behavior, where multiple identical requests have the same effect as a single request.
We will generate one if you do not provide it.
1const response = await client.deployContract({
2 name: 'First Contract',
3 description: 'My first hello world contract',
4 blockchain: 'ETH-SEPOLIA',
5 walletId: '004735f6-d9fc-44f8-933c-672cdf3d240d',
6 abiJson: '[\n\t{\n\t\t\'inputs\': [],\n\t\t\'stateMutability\': \'nonpayable\',\n\t\t\'type\': \'constructor\'\n\t},\n\t...',
7 bytecode: '0x60806040523480156200001157600080fd5b50604051806040...',
8 constructorParameters: ['TICK',10000],
9 fee: {
10 type: 'level',
11 config: {
12 feeLevel: 'HIGH',
13 },
14 },
15})
16console.log(response.data)
1{
2 "data": {
3 "contractId": "676f83a8-81a1-4dd5-b738-e2509b8f5460",
4 "transactionId": "36790743-b78d-4061-9558-1af9a9c837bd"
5 }
6}