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
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AssetManager(
algod,newGroup):AssetManager
Defined in: src/asset-manager.ts:155
Create a new asset manager.
Parameters
Section titled “Parameters”An algod client
newGroup
Section titled “newGroup”(config?) => TransactionComposer
A function that creates a new TransactionComposer transaction group
Returns
Section titled “Returns”AssetManager
Example
Section titled “Example”const assetManager = new AssetManager(algod, () => new TransactionComposer({algod, () => signer, () => suggestedParams}))Methods
Section titled “Methods”bulkOptIn()
Section titled “bulkOptIn()”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.
Parameters
Section titled “Parameters”account
Section titled “account”The account to opt-in
string | Address
assetIds
Section titled “assetIds”bigint[]
The list of asset IDs to opt-in to
options?
Section titled “options?”Omit<CommonTransactionParams, "sender"> & SendParams
Any parameters to control the transaction or execution of the transaction
Returns
Section titled “Returns”Promise<BulkAssetOptInOutResult[]>
An array of records matching asset ID to transaction ID of the opt in
Example
Section titled “Example”// Basic exampleassetManager.bulkOptIn("ACCOUNTADDRESS", [12345n, 67890n])// With configurationassetManager.bulkOptIn("ACCOUNTADDRESS", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })bulkOptOut()
Section titled “bulkOptOut()”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.
Parameters
Section titled “Parameters”account
Section titled “account”The account to opt-in
string | Address
assetIds
Section titled “assetIds”bigint[]
The list of asset IDs to opt-out of
options?
Section titled “options?”Omit<CommonTransactionParams, "sender"> & SendParams & object
Any parameters to control the transaction or execution of the transaction
Returns
Section titled “Returns”Promise<BulkAssetOptInOutResult[]>
An array of records matching asset ID to transaction ID of the opt in
Example
Section titled “Example”// Basic exampleassetManager.bulkOptOut("ACCOUNTADDRESS", [12345n, 67890n])// With configurationassetManager.bulkOptOut("ACCOUNTADDRESS", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })getAccountInformation()
Section titled “getAccountInformation()”getAccountInformation(
sender,assetId):Promise<AccountAssetInformation>
Defined in: src/asset-manager.ts:209
Returns the given sender account’s asset holding for a given asset.
Parameters
Section titled “Parameters”sender
Section titled “sender”The address of the sender/account to look up
string | Address
assetId
Section titled “assetId”bigint
The ID of the asset to return a holding for
Returns
Section titled “Returns”Promise<AccountAssetInformation>
The account asset holding information
Example
Section titled “Example”const address = "XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA";const assetId = 123345n;const accountInfo = await assetManager.getAccountInformation(address, assetId);getById()
Section titled “getById()”getById(
assetId):Promise<AssetInformation>
Defined in: src/asset-manager.ts:171
Returns the current asset information for the asset with the given ID.
Parameters
Section titled “Parameters”assetId
Section titled “assetId”bigint
The ID of the asset
Returns
Section titled “Returns”Promise<AssetInformation>
The asset information
Example
Section titled “Example”const assetInfo = await assetManager.getById(12353n);