Trigger a Stacks smart contract function using the user's Leather wallet.
This method wraps stx_signTransaction
, handling function call formatting and signature flow automatically.
Method name
stx_callContract
Parameters
contract
(string, required): The fully qualified identifier for the target contract, including the Stacks address and contract name. Example:SP3FBR2AGK5X3Y5D0X6MYB6Z3R9Y3WNRJY9ZTV8PV.my-contract
functionName
(string, required): The name of the function in the contract to call.functionArgs
(string[], required): The list of Clarity-compatible arguments to be passed to the contract function. Each argument must be properly encoded as a string.
Usage
This method simplifies the process of calling smart contracts by abstracting the construction and signing of transactions. When invoked, Leather presents the user with a prompt to approve the contract call, then signs and broadcasts the transaction to the network.
This is ideal for developers who want a streamlined interface for interacting with contract functions in a user-authorized and secure manner.
Use case
Use stx_callContract
when:
Your app needs to interact with deployed Clarity contracts (e.g., minting, transferring, or voting)
You want Leather to handle signing and broadcasting the call transaction
Reducing boilerplate around stx_signTransaction for function calls
Example use cases:
NFT minting flows
DAO proposals or executions
Smart contract interaction in DeFi dApps
Security notes
The user will see the full transaction request and must approve it in Leather.
Ensure that argument encoding is correct and matches the Clarity function signature.
Leather handles the signing and broadcasting once approved.