stx_deployContract
You can use the stx_deployContract
method to request the signature of any contract deployment transaction from the user's wallet. The method lets you specify the contract code and the contract name:
name
a string representing the name under which to deploy the contract
Example: ST000000000000000000002AMW42H.pox-3
clarityCode
a string representing the code of the contract to deploy, in Clarity language
clarityVersion
postConditions?
an array of strings representing the post conditions to be applied on the transaction. post conditions are expected as hex-encoded strings
To convert post conditions values to their hex representation, you can use the postConditionToHex
helper from the @stacks/transactions
package.
postConditionMode?
'allow' | 'deny'
You can use any Stacks library to construct these transaction. See examples using helpers from the @stacks/transactions
package
The user will see a Stacks contract deployment transaction signing request prompt in the wallet.
The transaction will be signed and broadcasted upon user approval.
The stx_deployContract
method returns a Promise that resolves to the DeployContractResult
object:
txid
a hex-encoded string representing the ID of the Stacks contract deployment transaction signed
transaction
a hex-encoded string representing the Stacks contract deployment transaction signed
Last updated