cnft.createContract(CreateContract)
Create a Contract NFT draft by initializing the contract with counterparties and content, and paying the setup fee (ERC20). This sends a transaction from the contract controller.
CreateContract Type Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contractController | Signer | Required | Signer that controls the contract and submits the transaction. Must be connected to a provider. |
| erc20 | string | Required | ERC20 token address used to pay the setup fee. |
| tokenDecimals | number | Required | ERC20 token decimals for human-readable fee amounts. |
| counterparties | string[] | Required | Array of counterparty EOA addresses that must sign the contract. |
| contractNft | string | Required | Contract NFT contract address. |
| contractHash | string | Required | Content hash (e.g., keccak256 of the contract content). |
| url | string | Required | URL pointing to the contract content/metadata. |
Returns
| Field | Type | Description |
|---|---|---|
| status | created | Status of the operation. |
| contractNft | string | Contract NFT contract address. |
| contractId | string | Contract ID for the draft. |
| contractController | string | Controller EOA address. |
| counterparties | string[] | Counterparty addresses included in the draft. |
| content | { hash: string; url: string } | Content hash and URL. |
| fee | { token: string; tokenDecimals: number; setupAmount: bigint; balanceBefore: bigint; balanceAfter: bigint; humanTokenDelta: string } | Fee and ERC20 balance details for the setup. |
| receipt | TransactionReceipt | Transaction receipt for the creation call. |

