Skip to content

AlgorandClient

Defined in: src/types/algorand-client.ts:19

A client that brokers easy access to Algorand functionality.

Implements

  • AlgorandClientInterface

Accessors

account

Get Signature

get account(): AccountManager

Defined in: src/types/algorand-client.ts:141

Get or create accounts that can sign transactions.

Returns

AccountManager


app

Get Signature

get app(): AppManager

Defined in: src/types/algorand-client.ts:151

Methods for interacting with apps.

Returns

AppManager

Implementation of

AlgorandClientInterface.app


appDeployer

Get Signature

get appDeployer(): AppDeployer

Defined in: src/types/algorand-client.ts:156

Methods for deploying apps and managing app deployment metadata.

Returns

AppDeployer

Implementation of

AlgorandClientInterface.appDeployer


asset

Get Signature

get asset(): AssetManager

Defined in: src/types/algorand-client.ts:146

Methods for interacting with assets.

Returns

AssetManager


client

Get Signature

get client(): ClientManager

Defined in: src/types/algorand-client.ts:136

Get clients, including algosdk clients and app clients.

Returns

ClientManager

Implementation of

AlgorandClientInterface.client


createTransaction

Get Signature

get createTransaction(): AlgorandClientTransactionCreator

Defined in: src/types/algorand-client.ts:181

Methods for creating a transaction.

Returns

AlgorandClientTransactionCreator

Implementation of

AlgorandClientInterface.createTransaction


send

Get Signature

get send(): AlgorandClientTransactionSender

Defined in: src/types/algorand-client.ts:174

Methods for sending a transaction.

Returns

AlgorandClientTransactionSender

Implementation of

AlgorandClientInterface.send

Methods

getSuggestedParams()

getSuggestedParams(): Promise<SuggestedParams>

Defined in: src/types/algorand-client.ts:120

Get suggested params for a transaction (either cached or from algod if the cache is stale or empty)

Returns

Promise<SuggestedParams>


newGroup()

newGroup(): TransactionComposer

Defined in: src/types/algorand-client.ts:161

Start a new TransactionComposer transaction group

Returns

TransactionComposer

Implementation of

AlgorandClientInterface.newGroup


setDefaultSigner()

setDefaultSigner(signer): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:59

Sets the default signer to use if no other signer is specified.

Parameters

signer

The signer to use, either a TransactionSigner or a TransactionSignerAccount

TransactionSigner | TransactionSignerAccount

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient so method calls can be chained


setDefaultValidityWindow()

setDefaultValidityWindow(validityWindow): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:49

Sets the default validity window for transactions.

Parameters

validityWindow

The number of rounds between the first and last valid rounds

number | bigint

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient so method calls can be chained


setSigner()

setSigner(sender, signer): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:92

Tracks the given signer against the given sender for later signing.

Parameters

sender

The sender address to use this signer for

string | Address

signer

TransactionSigner

The signer to sign transactions with for the given sender

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient so method calls can be chained


setSignerFromAccount()

setSignerFromAccount(account): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:79

Tracks the given account (object that encapsulates an address and a signer) for later signing.

Parameters

account

The account to register, which can be a TransactionSignerAccount or a algosdk.Account, algosdk.LogicSigAccount, SigningAccount or MultisigAccount

MultisigAccount | Account | SigningAccount | TransactionSignerAccount | LogicSigAccount

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient so method calls can be chained

Example

const accountManager = AlgorandClient.mainnet()
.setSignerFromAccount(algosdk.generateAccount())
.setSignerFromAccount(new algosdk.LogicSigAccount(program, args))
.setSignerFromAccount(new SigningAccount(mnemonic, sender))
.setSignerFromAccount(new MultisigAccount({version: 1, threshold: 1, addrs: ["ADDRESS1...", "ADDRESS2..."]}, [account1, account2]))
.setSignerFromAccount({addr: "SENDERADDRESS", signer: transactionSigner})

setSuggestedParamsCache()

setSuggestedParamsCache(suggestedParams, until?): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:103

Sets a cache value to use for suggested transaction params.

Parameters

suggestedParams

SuggestedParams

The suggested params to use

until?

Date

A date until which to cache, or if not specified then the timeout is used

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient so method calls can be chained


setSuggestedParamsCacheTimeout()

setSuggestedParamsCacheTimeout(timeout): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:114

Sets the timeout for caching suggested params.

Parameters

timeout

number

The timeout in milliseconds

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient so method calls can be chained


defaultLocalNet()

static defaultLocalNet(): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:191

Returns an AlgorandClient pointing at default LocalNet ports and API token.

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient


fromClients()

static fromClients(clients): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:228

Returns an AlgorandClient pointing to the given client(s).

Parameters

clients

AlgoSdkClients

The clients to use

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient


fromConfig()

static fromConfig(config): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:258

Returns an AlgorandClient from the given config.

Parameters

config

AlgoConfig

The config to use

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient


fromEnvironment()

static fromEnvironment(): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:249

Returns an AlgorandClient loading the configuration from environment variables.

Retrieve configurations from environment variables when defined or get default LocalNet configuration if they aren’t defined.

Expects to be called from a Node.js environment.

If process.env.ALGOD_SERVER is defined it will use that along with optional process.env.ALGOD_PORT and process.env.ALGOD_TOKEN.

If process.env.INDEXER_SERVER is defined it will use that along with optional process.env.INDEXER_PORT and process.env.INDEXER_TOKEN.

If either aren’t defined it will use the default LocalNet config.

It will return a KMD configuration that uses process.env.KMD_PORT (or port 4002) if process.env.ALGOD_SERVER is defined, otherwise it will use the default LocalNet config unless it detects testnet or mainnet.

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient


mainNet()

static mainNet(): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:215

Returns an AlgorandClient pointing at MainNet using AlgoNode.

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient


testNet()

static testNet(): [AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

Defined in: src/types/algorand-client.ts:203

Returns an AlgorandClient pointing at TestNet using AlgoNode.

Returns

[AlgorandClient](/reference/algokit-utils-ts/API Reference/classes/algorandclient/)

The AlgorandClient