Skip to content

AssetManager

@algorandfoundation/algokit-utils / types/asset-manager / AssetManager

types/asset-manager.AssetManager

Allows management of asset information.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new AssetManager(algod, newGroup): AssetManager

Create a new asset manager.

Parameters

NameTypeDescription
algodAlgodClientAn algod client
newGroup() => TransactionComposerA function that creates a new TransactionComposer transaction group

Returns

AssetManager

Example

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

Defined in

src/types/asset-manager.ts:151

Properties

_algod

Private _algod: AlgodClient

Defined in

src/types/asset-manager.ts:139


_newGroup

Private _newGroup: () => TransactionComposer

Type declaration

▸ (): TransactionComposer

Returns

TransactionComposer

Defined in

src/types/asset-manager.ts:140

Methods

bulkOptIn

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

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

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

Parameters

NameTypeDescription
accountstring | AddressThe account to opt-in
assetIdsbigint[]The list of asset IDs to opt-in to
options?Omit<CommonTransactionParams, "sender"> & SendParamsAny parameters to control the transaction or execution of the transaction

Returns

Promise<BulkAssetOptInOutResult[]>

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

Example

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

Defined in

src/types/asset-manager.ts:233


bulkOptOut

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

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

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

Parameters

NameTypeDescription
accountstring | AddressThe account to opt-in
assetIdsbigint[]The list of asset IDs to opt-out of
options?Omit<CommonTransactionParams, "sender"> & SendParams & { ensureZeroBalance?: boolean }Any parameters to control the transaction or execution of the transaction

Returns

Promise<BulkAssetOptInOutResult[]>

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

Example

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

Defined in

src/types/asset-manager.ts:283


getAccountInformation

getAccountInformation(sender, assetId): Promise<AccountAssetInformation>

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

Parameters

NameTypeDescription
senderstring | AddressThe address of the sender/account to look up
assetIdbigintThe ID of the asset to return a holding for

Returns

Promise<AccountAssetInformation>

The account asset holding information

Example

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

Response data schema details

Defined in

src/types/asset-manager.ts:205


getById

getById(assetId): Promise<AssetInformation>

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

Parameters

NameTypeDescription
assetIdbigintThe ID of the asset

Returns

Promise<AssetInformation>

The asset information

Example

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

Defined in

src/types/asset-manager.ts:167