Skip to content

AppClient

High-level client for interacting with a specific Algorand smart contract application.

const appClient = algorand.client.getAppClientById({
appId: 1234n,
appSpec: myAppSpec,
});
const appClient = algorand.client.getAppClientByCreatorAndName({
creatorAddress: creator.addr,
appSpec: myAppSpec,
});

Calls a method on the smart contract.

ParameterTypeDescription
params.methodstringABI method name
params.argsany[]Method arguments
params.senderTransactionSignerAccountTransaction sender
const result = await appClient.send.call({
method: 'hello',
args: ['World'],
sender: myAccount,
});
console.log(result.return); // "Hello, World"

Opts the sender into the application.

await appClient.send.optIn({ sender: myAccount });

Closes out the sender from the application.

await appClient.send.closeOut({ sender: myAccount });

Gets the current global state of the application.

const state = await appClient.getGlobalState();

Gets the local state for a specific account.

const state = await appClient.getLocalState(myAccount.addr);