You can use the stx_callContract
method to request the signature of any contract call transaction from the user's wallet. The method lets you specify the contract to call, the function to execute on the contract and the arguments to pass to the function.
Request parameters | Description |
---|---|
The user will see a Stacks contract call transaction signing request prompt in the wallet.
The transaction will be signed and broadcasted upon user approval.
The stx_callContract
method returns a Promise that resolves to the CallContractResult
object:
Property | Description |
---|---|
txid
a hex-encoded string representing the ID of the Stacks contract call transaction signed
transaction
a hex-encoded string representing the Stacks contract call transaction signed
contract
a string representing the contract's Crockford base-32 encoded Stacks address, and the contract name, separated by a .
Example: ST000000000000000000002AMW42H.pox-3
functionName
a string representing the name of the contract function to call
arguments
an array of strings representing the arguments to pass to the function called. The arguments are expected as hex-encoded strings of Clarity values.
To convert Clarity values to their hex representation, you can use the cvToString
helper from the @stacks/transactions
package.