Deploy a smart contract using a template.
Represents the input parameters for deploying a contract using a template.
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.
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 template's ID.
The contract's name.
The reference ID for the operation, to ensure idempotency.
JSON object that contains the template deployment parameters used to initialize the contract(s) on-chain.
The wallet's ID that will be used as the source for the contract deployment.
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.deployContractTemplate({
2 id: 'cf930871-bc29-43f0-9abb-0af6e66bd8db',
3 blockchain: 'MATIC-AMOY',
4 templateParameters: {},
5 walletId: '3962046c-4bd3-43ca-bb84-0c8f7dbfa798',
6 fee: {
7 type: 'level',
8 config: {
9 feeLevel: 'HIGH',
10 },
11 },
12 name: 'Contract name',
13})
14console.log(response.data)
1{
2 "data": {
3 "contractIds": [
4 ""
5 ],
6 "transactionId": ""
7 }
8}