stx_deployContract
Deploy a Clarity smart contract on the Stacks blockchain.
Method name
stx_deployContract
Parameters
Parameter
Description
Required
Type
name
The name of the contract.
✅
string
clarityCode
Clarity contract code
✅
string
clarityVersion
Version of the Clarity language (defaut: 3)
❌
number
Example request
try {
// Deploy contract
const response = await window.LeatherProvider.request("stx_deployContract", {
name: "my-smart-contract",
clarityCode: "(define-public (say-hi) (ok \"Hello, world!\"))",
clarityVersion: 2,
});
console.log("Response:", response);
} catch (error) {
console.log("Request error:", error.error.code, error.error.message);
}
Example response
{
"jsonrpc": "2.0",
"id": "d70e6f71-3ecf-4c4d-b555-80d1e4102d01",
"result": {
"txid": "0x1234abcd5678ef90123456789abcdef0123456789abcdef0123456789abcdef",
"transaction": "0xf86a808504a817c80083015f9094029a224a5f1c3e99..."
}
}
Last updated