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
Name | Type | Description |
---|---|---|
algod | AlgodClient | An algod client |
newGroup | () => TransactionComposer | A function that creates a new TransactionComposer transaction group |
Returns
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
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
Name | Type | Description |
---|---|---|
account | string | Address | The account to opt-in |
assetIds | bigint [] | The list of asset IDs to opt-in to |
options? | Omit <CommonTransactionParams , "sender" > & SendParams | 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 exampleassetManager.bulkOptIn('ACCOUNTADDRESS', [12345n, 67890n]);// With configurationassetManager.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
Name | Type | Description |
---|---|---|
account | string | Address | The account to opt-in |
assetIds | bigint [] | 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 exampleassetManager.bulkOptOut('ACCOUNTADDRESS', [12345n, 67890n]);// With configurationassetManager.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
Name | Type | Description |
---|---|---|
sender | string | Address | The address of the sender/account to look up |
assetId | bigint | The 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);
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
Name | Type | Description |
---|---|---|
assetId | bigint | The ID of the asset |
Returns
Promise
<AssetInformation
>
The asset information
Example
const assetInfo = await assetManager.getById(12353n);