Skip to content

AssetManager

Defined in: src/asset-manager.ts:142

Allows management of asset information.

AlgorandClient for the main entry point that provides access to this manager

new AssetManager(algod, newGroup): AssetManager

Defined in: src/asset-manager.ts:155

Create a new asset manager.

AlgodClient

An algod client

(config?) => TransactionComposer

A function that creates a new TransactionComposer transaction group

AssetManager

const assetManager = new AssetManager(algod, () => new TransactionComposer({algod, () => signer, () => suggestedParams}))

bulkOptIn(account, assetIds, options?): Promise<BulkAssetOptInOutResult[]>

Defined in: src/asset-manager.ts:237

Opt an account in to a list of Algorand Standard Assets.

Transactions will be sent in batches of 16 as transaction groups.

The account to opt-in

string | Address

bigint[]

The list of asset IDs to opt-in to

Omit<CommonTransactionParams, "sender"> & SendParams

Any parameters to control the transaction or execution of the transaction

Promise<BulkAssetOptInOutResult[]>

An array of records matching asset ID to transaction ID of the opt in

// Basic example
assetManager.bulkOptIn("ACCOUNTADDRESS", [12345n, 67890n])
// With configuration
assetManager.bulkOptIn("ACCOUNTADDRESS", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })

bulkOptOut(account, assetIds, options?): Promise<BulkAssetOptInOutResult[]>

Defined in: src/asset-manager.ts:287

Opt an account out of a list of Algorand Standard Assets.

Transactions will be sent in batches of 16 as transaction groups.

The account to opt-in

string | Address

bigint[]

The list of asset IDs to opt-out of

Omit<CommonTransactionParams, "sender"> & SendParams & object

Any parameters to control the transaction or execution of the transaction

Promise<BulkAssetOptInOutResult[]>

An array of records matching asset ID to transaction ID of the opt in

// Basic example
assetManager.bulkOptOut("ACCOUNTADDRESS", [12345n, 67890n])
// With configuration
assetManager.bulkOptOut("ACCOUNTADDRESS", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })

getAccountInformation(sender, assetId): Promise<AccountAssetInformation>

Defined in: src/asset-manager.ts:209

Returns the given sender account’s asset holding for a given asset.

The address of the sender/account to look up

string | Address

bigint

The ID of the asset to return a holding for

Promise<AccountAssetInformation>

The account asset holding information

const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";
const assetId = 123345n;
const accountInfo = await assetManager.getAccountInformation(address, assetId);

Response data schema details


getById(assetId): Promise<AssetInformation>

Defined in: src/asset-manager.ts:171

Returns the current asset information for the asset with the given ID.

bigint

The ID of the asset

Promise<AssetInformation>

The asset information

const assetInfo = await assetManager.getById(12353n);