Loading...
Loading...
Clarity smart contract deployment and interaction — deploy contracts from source files, call public functions with post conditions, and call read-only functions.
npx skill4agent add aibtcdev/skills contract.clarbun run contract/contract.ts <subcommand> [options].clarsmart_contractbun run contract/contract.ts deploy \
--source <path-to-file.clar> \
--name <contract-name> \
[--fee <fee>]--source.clar--name--feelow|medium|high{
"success": true,
"txid": "abc123...",
"contractId": "SP2...deployer.my-contract",
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/abc123...?chain=mainnet"
}contract_callbun run contract/contract.ts call \
--contract <contractId> \
--function <functionName> \
--args <json-array> \
[--post-condition-mode <deny|allow>] \
[--post-conditions <json-array>] \
[--fee <fee>]--contractADDRESS.contract-name--function--args[]{"type":"uint","value":100}--post-condition-modedenyallow--post-conditions--feelow|medium|high{
"success": true,
"txid": "abc123...",
"contract": "SP2...deployer.my-contract",
"function": "set-value",
"args": [42],
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/abc123...?chain=mainnet"
}bun run contract/contract.ts read \
--contract <contractId> \
--function <functionName> \
[--args <json-array>] \
[--sender <address>]--contractADDRESS.contract-name--function--args[]--sender{
"contract": "SP2...deployer.my-contract",
"function": "get-value",
"okay": true,
"result": "(ok u42)",
"network": "mainnet"
}| Subcommand | Option | Required | Description |
|---|---|---|---|
| | yes | Path to |
| | yes | Contract name |
| | no | Fee preset or micro-STX amount |
| | yes | Full contract ID ( |
| | yes | Public function name |
| | no | JSON array of function arguments |
| | no | |
| | no | JSON array of post condition objects |
| | no | Fee preset or micro-STX amount |
| | yes | Full contract ID ( |
| | yes | Read-only function name |
| | no | JSON array of function arguments |
| | no | Sender address for the read-only call |
{"type":"stx","principal":"SP2...","conditionCode":"eq","amount":"1000000"}{"type":"ft","principal":"SP2...","asset":"SP2....my-token","assetName":"my-token","conditionCode":"eq","amount":"100"}{"type":"nft","principal":"SP2...","asset":"SP2....my-nft","assetName":"my-nft","tokenId":1}conditionCode"notSend":true--post-condition-mode allowbun run wallet/wallet.ts unlock --password <password>