@stacks/transactions

Construct, decode transactions and work with Clarity smart contracts on the Stacks blockchain.

callReadOnlyFunction

Read-only contract functions can be called without generating or broadcasting a transaction. Instead it works via a direct API call to a Stacks node.

Properties

contractAddress
Required
string

The principal of the contract address you are calling, starts with SP for mainnet and ST for testnet.

contractName
Required
string

The name of the contract address you are calling, comes after the . on the contract address.

functionName
Required
string

The name of the read-only function you are calling.

functionArgs
Required
array

An array of arguments that need to be passed to the read-only function. If no arguments are needed, you must pass an empty array.

network
Required
object

The network instance that the contract exists on.

Example: new StacksTestnet()

senderAddress
Required
string

The principal address that the call is being made from.

postConditionsarray

A set of conditions that can optionally be passed along in the transaction to prevent any unwanted asset movement.

const isPending = userSession.isSignInPending();

if (isPending) {
  userSession.handlePendingSignIn().then(userData => {
    // Do something with userData
  });
}

Last updated on