stx_callContract
Wrapper method for `stx_signTransaction` that calls a Stacks contract
Method name
stx_callContract
Parameters
Parameter
Description
Required
Type
contract
Fully qualified contract identifier, including Stacks address and contract name.
✅
string
functionName
Name of the function to call.
✅
string
functionArgs
Arguments to pass to the contract function, encoded as strings.
✅
string[]
Example request
try {
// Call a read-only contract function
const response = await window.LeatherProvider.request("stx_callContract", {
contract: "SP3FBR2AGK5X3Y5D0X6MYB6Z3R9Y3WNRJY9ZTV8PV.my-contract",
functionName: "get-balance",
functionArgs: [],
});
console.log("Response:", response);
} catch (error) {
console.log("Request error:", error.error.code, error.error.message);
}Example response
Last updated