@algorandfoundation/algokit-utils 8.2.1 → 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "**"
7
7
  ],
8
8
  "name": "@algorandfoundation/algokit-utils",
9
- "version": "8.2.1",
9
+ "version": "8.2.2",
10
10
  "private": false,
11
11
  "description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
12
12
  "author": "Algorand Foundation",
package/types/composer.js CHANGED
@@ -1222,13 +1222,14 @@ class TransactionComposer {
1222
1222
  : txn.type === 'methodCall'
1223
1223
  ? await this.buildMethodCall(txn, suggestedParams, false)
1224
1224
  : [];
1225
- transactionsWithSigner.forEach((ts, idx) => {
1225
+ transactionsWithSigner.forEach((ts) => {
1226
1226
  transactions.push(ts.txn);
1227
+ const groupIdx = transactions.length - 1;
1227
1228
  if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {
1228
- signers.set(idx, ts.signer);
1229
+ signers.set(groupIdx, ts.signer);
1229
1230
  }
1230
1231
  if ('context' in ts && ts.context.abiMethod) {
1231
- methodCalls.set(idx, ts.context.abiMethod);
1232
+ methodCalls.set(groupIdx, ts.context.abiMethod);
1232
1233
  }
1233
1234
  });
1234
1235
  }
@@ -1 +1 @@
1
- {"version":3,"file":"composer.js","sources":["../../src/types/composer.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { Config } from '../config'\nimport { encodeLease, getABIReturnValue, sendAtomicTransactionComposer } from '../transaction/transaction'\nimport { asJson, calculateExtraProgramPages } from '../util'\nimport { TransactionSignerAccount } from './account'\nimport { AlgoAmount } from './amount'\nimport { AppManager, BoxIdentifier, BoxReference } from './app-manager'\nimport { Expand } from './expand'\nimport { EventType } from './lifecycle-events'\nimport { genesisIdIsLocalNet } from './network-client'\nimport { Arc2TransactionNote, SendAtomicTransactionComposerResults, SendParams } from './transaction'\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\nimport TransactionWithSigner = algosdk.TransactionWithSigner\nimport isTransactionWithSigner = algosdk.isTransactionWithSigner\nimport SimulateResponse = algosdk.modelsv2.SimulateResponse\nimport modelsv2 = algosdk.modelsv2\n\nconst address = (address: string | Address): Address => {\n return typeof address === 'string' ? Address.fromString(address) : address\n}\n\nexport const MAX_TRANSACTION_GROUP_SIZE = 16\n\n/** Options to control a simulate request, that does not require transaction signing */\nexport type SkipSignaturesSimulateOptions = Expand<\n Omit<RawSimulateOptions, 'fixSigners' | 'allowEmptySignatures'> & {\n /** Whether or not to skip signatures for all built transactions and use an empty signer instead.\n * This will set `fixSigners` and `allowEmptySignatures` when sending the request to the algod API.\n */\n skipSignatures: boolean\n }\n>\n\n/** The raw API options to control a simulate request.\n * See algod API docs for more information: https://developer.algorand.org/docs/rest-apis/algod/#simulaterequest\n */\nexport type RawSimulateOptions = Expand<Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>>\n\n/** All options to control a simulate request */\nexport type SimulateOptions = Expand<Partial<SkipSignaturesSimulateOptions> & RawSimulateOptions>\n\n/** Common parameters for defining a transaction. */\nexport type CommonTransactionParams = {\n /** The address of the account sending the transaction. */\n sender: string | Address\n /** The function used to sign transaction(s); if not specified then\n * an attempt will be made to find a registered signer for the\n * given `sender` or use a default signer (if configured).\n */\n signer?: algosdk.TransactionSigner | TransactionSignerAccount\n /** Change the signing key of the sender to the given address.\n *\n * **Warning:** Please be careful with this parameter and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n */\n rekeyTo?: string | Address\n /** Note to attach to the transaction. Max of 1000 bytes. */\n note?: Uint8Array | string\n /** Prevent multiple transactions with the same lease being included within the validity window.\n *\n * A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/)\n * enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).\n */\n lease?: Uint8Array | string\n /** The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. */\n staticFee?: AlgoAmount\n /** The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees. */\n extraFee?: AlgoAmount\n /** Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. */\n maxFee?: AlgoAmount\n /** How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. */\n validityWindow?: number | bigint\n /**\n * Set the first round this transaction is valid.\n * If left undefined, the value from algod will be used.\n *\n * We recommend you only set this when you intentionally want this to be some time in the future.\n */\n firstValidRound?: bigint\n /** The last round this transaction is valid. It is recommended to use `validityWindow` instead. */\n lastValidRound?: bigint\n}\n\n/** Parameters to define a payment transaction. */\nexport type PaymentParams = CommonTransactionParams & {\n /** The address of the account that will receive the Algo */\n receiver: string | Address\n /** Amount to send */\n amount: AlgoAmount\n /** If given, close the sender account and send the remaining balance to this address\n *\n * *Warning:* Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeRemainderTo?: string | Address\n}\n\n/** Parameters to define an asset create transaction.\n *\n * The account that sends this transaction will automatically be opted in to the asset and will hold all units after creation.\n */\nexport type AssetCreateParams = CommonTransactionParams & {\n /** The total amount of the smallest divisible (decimal) unit to create.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there would be 1 whole unit.\n *\n * This field can only be specified upon asset creation.\n */\n total: bigint\n\n /** The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /** Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /** 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: string | Uint8Array\n\n /** Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the `manager` the asset becomes permanently immutable.\n */\n manager?: string | Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n reserve?: string | Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n freeze?: string | Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset reconfiguration transaction.\n *\n * **Note:** The manager, reserve, freeze, and clawback addresses\n * are immutably empty if they are not set. If manager is not set then\n * all fields are immutable from that point forward.\n */\nexport type AssetConfigParams = CommonTransactionParams & {\n /** ID of the asset to reconfigure */\n assetId: bigint\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) the asset will become permanently immutable.\n */\n manager: string | Address | undefined\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n reserve?: string | Address\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n freeze?: string | Address\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset freeze transaction. */\nexport type AssetFreezeParams = CommonTransactionParams & {\n /** The ID of the asset to freeze/unfreeze */\n assetId: bigint\n /** The address of the account to freeze or unfreeze */\n account: string | Address\n /** Whether the assets in the account should be frozen */\n frozen: boolean\n}\n\n/** Parameters to define an asset destroy transaction.\n *\n * Created assets can be destroyed only by the asset manager account. All of the assets must be owned by the creator of the asset before the asset can be deleted.\n */\nexport type AssetDestroyParams = CommonTransactionParams & {\n /** ID of the asset to destroy */\n assetId: bigint\n}\n\n/** Parameters to define an asset transfer transaction. */\nexport type AssetTransferParams = CommonTransactionParams & {\n /** ID of the asset to transfer. */\n assetId: bigint\n /** Amount of the asset to transfer (in smallest divisible (decimal) units). */\n amount: bigint\n /** The address of the account that will receive the asset unit(s). */\n receiver: string | Address\n /** Optional address of an account to clawback the asset from.\n *\n * Requires the sender to be the clawback account.\n *\n * **Warning:** Be careful with this parameter as it can lead to unexpected loss of funds if not used correctly.\n */\n clawbackTarget?: string | Address\n /** Optional address of an account to close the asset position to.\n *\n * **Warning:** Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeAssetTo?: string | Address\n}\n\n/** Parameters to define an asset opt-in transaction. */\nexport type AssetOptInParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-in to. */\n assetId: bigint\n}\n\n/** Parameters to define an asset opt-out transaction. */\nexport type AssetOptOutParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-out of. */\n assetId: bigint\n /**\n * The address of the asset creator account to close the asset\n * position to (any remaining asset units will be sent to this account).\n */\n creator: string | Address\n}\n\n/** Parameters to define an online key registration transaction. */\nexport type OnlineKeyRegistrationParams = CommonTransactionParams & {\n /** The root participation public key */\n voteKey: Uint8Array\n /** The VRF public key */\n selectionKey: Uint8Array\n /** The first round that the participation key is valid. Not to be confused with the `firstValid` round of the keyreg transaction */\n voteFirst: bigint\n /** The last round that the participation key is valid. Not to be confused with the `lastValid` round of the keyreg transaction */\n voteLast: bigint\n /** This is the dilution for the 2-level participation key. It determines the interval (number of rounds) for generating new ephemeral keys */\n voteKeyDilution: bigint\n /** The 64 byte state proof public key commitment */\n stateProofKey?: Uint8Array\n}\n\n/** Parameters to define an offline key registration transaction. */\nexport type OfflineKeyRegistrationParams = CommonTransactionParams & {\n /** Prevent this account from ever participating again. The account will also no longer earn rewards */\n preventAccountFromEverParticipatingAgain?: boolean\n}\n\n/** Common parameters for defining an application call transaction. */\nexport type CommonAppCallParams = CommonTransactionParams & {\n /** ID of the application; 0 if the application is being created. */\n appId: bigint\n /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call; defaults to no-op. */\n onComplete?: algosdk.OnApplicationComplete\n /** Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). */\n args?: Uint8Array[]\n /** Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n accountReferences?: (string | Address)[]\n /** The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n appReferences?: bigint[]\n /** The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n assetReferences?: bigint[]\n /** Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays).\n *\n * Either the name identifier (which will be set against app ID of `0` i.e.\n * the current app), or a box identifier with the name identifier and app ID.\n */\n boxReferences?: (BoxReference | BoxIdentifier)[]\n}\n\n/** Parameters to define an app create transaction */\nexport type AppCreateParams = Expand<\n Omit<CommonAppCallParams, 'appId'> & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.ClearStateOC>\n /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n clearStateProgram: string | Uint8Array\n /** The state schema for the app. This is immutable once the app is created. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n }\n>\n\n/** Parameters to define an app update transaction */\nexport type AppUpdateParams = Expand<\n CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC\n /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n clearStateProgram: string | Uint8Array\n }\n>\n\n/** Parameters to define an application call transaction. */\nexport type AppCallParams = CommonAppCallParams & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.UpdateApplicationOC>\n}\n\n/** Common parameters to define an ABI method call transaction. */\nexport type AppMethodCallParams = CommonAppCallParams & {\n onComplete?: Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.ClearStateOC\n >\n}\n\n/** Parameters to define an application delete call transaction. */\nexport type AppDeleteParams = CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC\n}\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = AppMethodCall<AppCreateParams>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = AppMethodCall<AppUpdateParams>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = AppMethodCall<AppDeleteParams>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = AppMethodCall<AppMethodCallParams>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: algosdk.ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | algosdk.ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\nexport type Txn =\n | (PaymentParams & { type: 'pay' })\n | (AssetCreateParams & { type: 'assetCreate' })\n | (AssetConfigParams & { type: 'assetConfig' })\n | (AssetFreezeParams & { type: 'assetFreeze' })\n | (AssetDestroyParams & { type: 'assetDestroy' })\n | (AssetTransferParams & { type: 'assetTransfer' })\n | (AssetOptInParams & { type: 'assetOptIn' })\n | (AssetOptOutParams & { type: 'assetOptOut' })\n | ((AppCallParams | AppCreateParams | AppUpdateParams) & { type: 'appCall' })\n | ((OnlineKeyRegistrationParams | OfflineKeyRegistrationParams) & { type: 'keyReg' })\n | (algosdk.TransactionWithSigner & { type: 'txnWithSigner' })\n | { atc: algosdk.AtomicTransactionComposer; type: 'atc' }\n | ((AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall) & { type: 'methodCall' })\n\n/** Parameters to create an `TransactionComposer`. */\nexport type TransactionComposerParams = {\n /** The algod client to use to get suggestedParams and send the transaction group */\n algod: algosdk.Algodv2\n /** The function used to get the TransactionSigner for a given address */\n getSigner: (address: string | Address) => algosdk.TransactionSigner\n /** The method used to get SuggestedParams for transactions in the group */\n getSuggestedParams?: () => Promise<algosdk.SuggestedParams>\n /** How many rounds a transaction should be valid for by default; if not specified\n * then will be 10 rounds (or 1000 rounds if issuing transactions to LocalNet).\n */\n defaultValidityWindow?: bigint\n /** An existing `AppManager` to use to manage app compilation and cache compilation results.\n *\n * If not specified than an ephemeral one will be created.\n */\n appManager?: AppManager\n}\n\n/** Represents a Transaction with additional context that was used to build that transaction. */\ninterface TransactionWithContext {\n txn: Transaction\n context: {\n /* The logical max fee for the transaction, if one was supplied. */\n maxFee?: AlgoAmount\n /* The ABI method, if the app call transaction is an ABI method call. */\n abiMethod?: algosdk.ABIMethod\n }\n}\n\n/** Represents a TransactionWithSigner with additional context that was used to build that transaction. */\ntype TransactionWithSignerAndContext = algosdk.TransactionWithSigner & TransactionWithContext\n\n/** Set of transactions built by `TransactionComposer`. */\nexport interface BuiltTransactions {\n /** The built transactions */\n transactions: algosdk.Transaction[]\n /** Any `ABIMethod` objects associated with any of the transactions in a map keyed by transaction index. */\n methodCalls: Map<number, algosdk.ABIMethod>\n /** Any `TransactionSigner` objects associated with any of the transactions in a map keyed by transaction index. */\n signers: Map<number, algosdk.TransactionSigner>\n}\n\n/** TransactionComposer helps you compose and execute transactions as a transaction group. */\nexport class TransactionComposer {\n /** Signer used to represent a lack of signer */\n private static NULL_SIGNER: algosdk.TransactionSigner = algosdk.makeEmptyTransactionSigner()\n\n /** The ATC used to compose the group */\n private atc = new algosdk.AtomicTransactionComposer()\n\n /** Map of transaction index in the atc to a max logical fee.\n * This is set using the value of either maxFee or staticFee.\n */\n private txnMaxFees: Map<number, AlgoAmount> = new Map()\n\n /** Transactions that have not yet been composed */\n private txns: Txn[] = []\n\n /** The algod client used by the composer. */\n private algod: algosdk.Algodv2\n\n /** An async function that will return suggested params for the transaction. */\n private getSuggestedParams: () => Promise<algosdk.SuggestedParams>\n\n /** A function that takes in an address and return a signer function for that address. */\n private getSigner: (address: string | Address) => algosdk.TransactionSigner\n\n /** The default transaction validity window */\n private defaultValidityWindow = 10n\n\n /** Whether the validity window was explicitly set on construction */\n private defaultValidityWindowIsExplicit = false\n\n private appManager: AppManager\n\n /**\n * Create a `TransactionComposer`.\n * @param params The configuration for this composer\n * @returns The `TransactionComposer` instance\n */\n constructor(params: TransactionComposerParams) {\n this.algod = params.algod\n const defaultGetSuggestedParams = () => params.algod.getTransactionParams().do()\n this.getSuggestedParams = params.getSuggestedParams ?? defaultGetSuggestedParams\n this.getSigner = params.getSigner\n this.defaultValidityWindow = params.defaultValidityWindow ?? this.defaultValidityWindow\n this.defaultValidityWindowIsExplicit = params.defaultValidityWindow !== undefined\n this.appManager = params.appManager ?? new AppManager(params.algod)\n }\n\n /**\n * Add a pre-built transaction to the transaction group.\n * @param transaction The pre-built transaction\n * @param signer Optional signer override for the transaction\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * composer.addTransaction(txn)\n * ```\n */\n addTransaction(transaction: Transaction, signer?: TransactionSigner): TransactionComposer {\n this.txns.push({\n txn: transaction,\n signer: signer ?? this.getSigner(transaction.sender),\n type: 'txnWithSigner',\n })\n\n return this\n }\n\n /**\n * Add a payment transaction to the transaction group.\n * @param params The payment transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addPayment({\n * sender: 'SENDERADDRESS',\n * receiver: 'RECEIVERADDRESS',\n * amount: (4).algo(),\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addPayment({\n * amount: (4).algo(),\n * receiver: 'RECEIVERADDRESS',\n * sender: 'SENDERADDRESS',\n * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addPayment(params: PaymentParams): TransactionComposer {\n this.txns.push({ ...params, type: 'pay' })\n\n return this\n }\n\n /**\n * Add an asset create transaction to the transaction group.\n * @param params The asset create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetCreate({ sender: \"CREATORADDRESS\", total: 100n})\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetCreate({\n * sender: 'CREATORADDRESS',\n * total: 100n,\n * decimals: 2,\n * assetName: 'asset',\n * unitName: 'unit',\n * url: 'url',\n * metadataHash: 'metadataHash',\n * defaultFrozen: false,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetCreate(params: AssetCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetCreate' })\n\n return this\n }\n\n /**\n * Add an asset config transaction to the transaction group.\n * @param params The asset config transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetConfig({ sender: \"MANAGERADDRESS\", assetId: 123456n, manager: \"MANAGERADDRESS\" })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetConfig({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetConfig(params: AssetConfigParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetConfig' })\n\n return this\n }\n\n /**\n * Add an asset freeze transaction to the transaction group.\n * @param params The asset freeze transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetFreeze({ sender: \"MANAGERADDRESS\", assetId: 123456n, account: \"ACCOUNTADDRESS\", frozen: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetFreeze({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * account: 'ACCOUNTADDRESS',\n * frozen: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetFreeze(params: AssetFreezeParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetFreeze' })\n\n return this\n }\n\n /**\n * Add an asset destroy transaction to the transaction group.\n * @param params The asset destroy transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetDestroy({ sender: \"MANAGERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetDestroy({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetDestroy(params: AssetDestroyParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetDestroy' })\n\n return this\n }\n\n /**\n * Add an asset transfer transaction to the transaction group.\n * @param params The asset transfer transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetTransfer({ sender: \"HOLDERADDRESS\", assetId: 123456n, amount: 1n, receiver: \"RECEIVERADDRESS\" })\n * ```\n * @example Advanced example (with clawback)\n * ```typescript\n * composer.addAssetTransfer({\n * sender: 'CLAWBACKADDRESS',\n * assetId: 123456n,\n * amount: 1n,\n * receiver: 'RECEIVERADDRESS',\n * clawbackTarget: 'HOLDERADDRESS',\n * // This field needs to be used with caution\n * closeAssetTo: 'ADDRESSTOCLOSETO'\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetTransfer(params: AssetTransferParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetTransfer' })\n\n return this\n }\n\n /**\n * Add an asset opt-in transaction to the transaction group.\n * @param params The asset opt-in transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetOptIn({ sender: \"SENDERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptIn({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptIn(params: AssetOptInParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptIn' })\n\n return this\n }\n\n /**\n * Add an asset opt-out transaction to the transaction group.\n * @param params The asset opt-out transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example (without creator, will be retrieved from algod)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Basic example (with creator)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", creator: \"CREATORADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptOut({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * creator: 'CREATORADDRESS',\n * ensureZeroBalance: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptOut(params: AssetOptOutParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptOut' })\n\n return this\n }\n\n /**\n * Add an application create transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCreate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * // Signer only needed if you want to provide one,\n * // generally you'd register it with AlgorandClient\n * // against the sender and not need to pass it in\n * signer: transactionSigner,\n * maxRoundsToWaitForConfirmation: 5,\n * suppressLog: true,\n *})\n * ```\n */\n addAppCreate(params: AppCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an application update transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application update transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppUpdate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdate(params: AppUpdateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n\n return this\n }\n\n /**\n * Add an application delete transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application delete transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppDelete({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppDelete({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDelete(params: AppDeleteParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n\n return this\n }\n\n /**\n * Add an application call transaction to the transaction group.\n *\n * If you want to create or update an app use `addAppCreate` or `addAppUpdate`.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCall({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCall({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCall(params: AppCallParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an ABI method create application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI create method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCreateMethodCall(params: AppCreateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an ABI method update application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI update method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdateMethodCall(params: AppUpdateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n return this\n }\n\n /**\n * Add an ABI method delete application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI delete method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDeleteMethodCall(params: AppDeleteMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n return this\n }\n\n /**\n * Add a non-create/non-update ABI method application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCallMethodCall(params: AppCallMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an online key registration transaction to the transaction group.\n * @param params The online key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add an offline key registration transaction to the transaction group.\n * @param params The offline key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOfflineKeyRegistration(params: OfflineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add the transactions within an `AtomicTransactionComposer` to the transaction group.\n * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * const atc = new AtomicTransactionComposer()\n * .addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })\n * composer.addAtc(atc)\n * ```\n */\n addAtc(atc: algosdk.AtomicTransactionComposer): TransactionComposer {\n this.txns.push({ atc, type: 'atc' })\n return this\n }\n\n /** Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing */\n private buildAtc(atc: algosdk.AtomicTransactionComposer): TransactionWithSignerAndContext[] {\n const group = atc.buildGroup()\n\n const txnWithSigners = group.map((ts, idx) => {\n // Remove underlying group ID from the transaction since it will be re-grouped when this TransactionComposer is built\n ts.txn.group = undefined\n // If this was a method call return the ABIMethod for later\n if (atc['methodCalls'].get(idx)) {\n return {\n ...ts,\n context: { abiMethod: atc['methodCalls'].get(idx) as algosdk.ABIMethod },\n }\n }\n return {\n ...ts,\n context: {},\n }\n })\n\n return txnWithSigners\n }\n\n private commonTxnBuildStep<TParams extends algosdk.CommonTransactionParams>(\n buildTxn: (params: TParams) => Transaction,\n params: CommonTransactionParams,\n txnParams: TParams,\n ): TransactionWithContext {\n // We are going to mutate suggested params, let's create a clone first\n txnParams.suggestedParams = { ...txnParams.suggestedParams }\n\n if (params.lease) txnParams.lease = encodeLease(params.lease)! satisfies algosdk.Transaction['lease']\n if (params.rekeyTo) txnParams.rekeyTo = address(params.rekeyTo) satisfies algosdk.Transaction['rekeyTo']\n const encoder = new TextEncoder()\n if (params.note)\n txnParams.note = (typeof params.note === 'string' ? encoder.encode(params.note) : params.note) satisfies algosdk.Transaction['note']\n\n if (params.firstValidRound) {\n txnParams.suggestedParams.firstValid = params.firstValidRound\n }\n\n if (params.lastValidRound) {\n txnParams.suggestedParams.lastValid = params.lastValidRound\n } else {\n // If the validity window isn't set in this transaction or by default and we are pointing at\n // LocalNet set a bigger window to avoid dead transactions\n const window = params.validityWindow\n ? BigInt(params.validityWindow)\n : !this.defaultValidityWindowIsExplicit && genesisIdIsLocalNet(txnParams.suggestedParams.genesisID ?? 'unknown')\n ? 1000n\n : this.defaultValidityWindow\n txnParams.suggestedParams.lastValid = BigInt(txnParams.suggestedParams.firstValid) + window\n }\n\n if (params.staticFee !== undefined && params.extraFee !== undefined) {\n throw Error('Cannot set both staticFee and extraFee')\n }\n\n if (params.staticFee !== undefined) {\n txnParams.suggestedParams.fee = params.staticFee.microAlgo\n txnParams.suggestedParams.flatFee = true\n }\n\n const txn = buildTxn(txnParams)\n\n if (params.extraFee) txn.fee += params.extraFee.microAlgo\n if (params.maxFee !== undefined && txn.fee > params.maxFee.microAlgo) {\n throw Error(`Transaction fee ${txn.fee} µALGO is greater than maxFee ${params.maxFee}`)\n }\n\n const logicalMaxFee =\n params.maxFee !== undefined && params.maxFee.microAlgo > (params.staticFee?.microAlgo ?? 0n) ? params.maxFee : params.staticFee\n\n return { txn, context: { maxFee: logicalMaxFee } }\n }\n\n /**\n * Builds an ABI method call transaction and any other associated transactions represented in the ABI args.\n * @param includeSigner Whether to include the actual signer for the transactions.\n * If you are just building transactions without signers yet then set this to `false`.\n */\n private async buildMethodCall(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall,\n suggestedParams: algosdk.SuggestedParams,\n includeSigner: boolean,\n ): Promise<TransactionWithSignerAndContext[]> {\n const methodArgs: (algosdk.ABIArgument | TransactionWithSignerAndContext)[] = []\n const transactionsForGroup: TransactionWithSignerAndContext[] = []\n\n const isAbiValue = (x: unknown): x is algosdk.ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array\n }\n\n for (let i = (params.args ?? []).length - 1; i >= 0; i--) {\n const arg = params.args![i]\n if (arg === undefined) {\n // An undefined transaction argument signals that the value will be supplied by a method call argument\n if (algosdk.abiTypeIsTransaction(params.method.args[i].type) && transactionsForGroup.length > 0) {\n // Move the last transaction from the group to the method call arguments to appease algosdk\n const placeholderTransaction = transactionsForGroup.splice(-1, 1)[0]\n methodArgs.push(placeholderTransaction)\n continue\n }\n\n throw Error(`No value provided for argument ${i + 1} within call to ${params.method.name}`)\n }\n\n if (isAbiValue(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if (isTransactionWithSigner(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if ('method' in arg) {\n const tempTxnWithSigners = await this.buildMethodCall(arg, suggestedParams, includeSigner)\n // If there is any transaction args, add to the atc\n // Everything else should be added as method args\n\n methodArgs.push(...tempTxnWithSigners.slice(-1)) // Add the method call itself as a method arg\n transactionsForGroup.push(...tempTxnWithSigners.slice(0, -1).reverse()) // Add any transaction arguments to the atc\n continue\n }\n\n const txn = await arg\n methodArgs.push({\n txn,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(txn.sender)\n : TransactionComposer.NULL_SIGNER,\n })\n }\n\n const methodAtc = new algosdk.AtomicTransactionComposer()\n const maxFees = new Map<number, AlgoAmount>()\n\n transactionsForGroup.reverse().forEach(({ context, ...txnWithSigner }) => {\n methodAtc.addTransaction(txnWithSigner)\n const atcIndex = methodAtc.count() - 1\n if (context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, context.abiMethod)\n }\n if (context.maxFee !== undefined) {\n maxFees.set(atcIndex, context.maxFee)\n }\n })\n\n // If any of the args are method call transactions, add that info to the methodAtc\n methodArgs\n .filter((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return isTransactionWithSigner(txnWithSigner)\n }\n return isTransactionWithSigner(arg)\n })\n .reverse()\n .forEach((arg, idx) => {\n if (typeof arg === 'object' && 'context' in arg && arg.context) {\n const atcIndex = methodAtc.count() + idx\n if (arg.context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, arg.context.abiMethod)\n }\n if (arg.context.maxFee !== undefined) {\n maxFees.set(atcIndex, arg.context.maxFee)\n }\n }\n })\n\n const appId = Number('appId' in params ? params.appId : 0n)\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const txnParams = {\n appID: appId,\n sender: params.sender,\n suggestedParams,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n appAccounts: params.accountReferences,\n appForeignApps: params.appReferences?.map((x) => Number(x)),\n appForeignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n extraPages:\n appId === 0\n ? 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : approvalProgram\n ? calculateExtraProgramPages(approvalProgram, clearStateProgram)\n : 0\n : undefined,\n numLocalInts: appId === 0 ? ('schema' in params ? (params.schema?.localInts ?? 0) : 0) : undefined,\n numLocalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.localByteSlices ?? 0) : 0) : undefined,\n numGlobalInts: appId === 0 ? ('schema' in params ? (params.schema?.globalInts ?? 0) : 0) : undefined,\n numGlobalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0) : undefined,\n method: params.method,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(params.sender)\n : TransactionComposer.NULL_SIGNER,\n methodArgs: methodArgs\n .map((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return txnWithSigner\n }\n return arg\n })\n .reverse(),\n // note, lease, and rekeyTo are set in the common build step\n note: undefined,\n lease: undefined,\n rekeyTo: undefined,\n }\n\n // Build the transaction\n const result = this.commonTxnBuildStep(\n (txnParams) => {\n methodAtc.addMethodCall(txnParams)\n return methodAtc.buildGroup()[methodAtc.count() - 1].txn\n },\n params,\n txnParams,\n )\n\n // Process the ATC to get a set of transactions ready for broader grouping\n return this.buildAtc(methodAtc).map(({ context: _context, ...txnWithSigner }, idx) => {\n const maxFee = idx === methodAtc.count() - 1 ? result.context.maxFee : maxFees.get(idx)\n const context = {\n ..._context, // Adds method context info\n maxFee,\n }\n\n return {\n ...txnWithSigner,\n context,\n }\n })\n }\n\n private buildPayment(params: PaymentParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makePaymentTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n amount: params.amount.microAlgo,\n closeRemainderTo: params.closeRemainderTo,\n suggestedParams,\n })\n }\n\n private buildAssetCreate(params: AssetCreateParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n total: params.total,\n decimals: params.decimals ?? 0,\n assetName: params.assetName,\n unitName: params.unitName,\n assetURL: params.url,\n defaultFrozen: params.defaultFrozen ?? false,\n assetMetadataHash: typeof params.metadataHash === 'string' ? Buffer.from(params.metadataHash, 'utf-8') : params.metadataHash,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n suggestedParams,\n })\n }\n\n private buildAssetConfig(params: AssetConfigParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n strictEmptyAddressChecking: false,\n })\n }\n\n private buildAssetDestroy(params: AssetDestroyParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n })\n }\n\n private buildAssetFreeze(params: AssetFreezeParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetFreezeTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n freezeTarget: params.account,\n frozen: params.frozen,\n suggestedParams,\n })\n }\n\n private buildAssetTransfer(params: AssetTransferParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n assetIndex: params.assetId,\n amount: params.amount,\n suggestedParams,\n closeRemainderTo: params.closeAssetTo,\n assetSender: params.clawbackTarget,\n })\n }\n\n private async buildAppCall(params: AppCallParams | AppUpdateParams | AppCreateParams, suggestedParams: algosdk.SuggestedParams) {\n const appId = 'appId' in params ? params.appId : 0n\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const sdkParams = {\n sender: params.sender,\n suggestedParams,\n appArgs: params.args,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n accounts: params.accountReferences,\n foreignApps: params.appReferences?.map((x) => Number(x)),\n foreignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n }\n\n if (appId === 0n) {\n if (sdkParams.approvalProgram === undefined || sdkParams.clearProgram === undefined) {\n throw new Error('approvalProgram and clearStateProgram are required for application creation')\n }\n\n return this.commonTxnBuildStep(algosdk.makeApplicationCreateTxnFromObject, params, {\n ...sdkParams,\n extraPages:\n 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : calculateExtraProgramPages(approvalProgram!, clearStateProgram!),\n numLocalInts: 'schema' in params ? (params.schema?.localInts ?? 0) : 0,\n numLocalByteSlices: 'schema' in params ? (params.schema?.localByteSlices ?? 0) : 0,\n numGlobalInts: 'schema' in params ? (params.schema?.globalInts ?? 0) : 0,\n numGlobalByteSlices: 'schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0,\n approvalProgram: approvalProgram!,\n clearProgram: clearStateProgram!,\n })\n } else {\n return this.commonTxnBuildStep(algosdk.makeApplicationCallTxnFromObject, params, { ...sdkParams, appIndex: appId })\n }\n }\n\n private buildKeyReg(params: OnlineKeyRegistrationParams | OfflineKeyRegistrationParams, suggestedParams: algosdk.SuggestedParams) {\n if ('voteKey' in params) {\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n voteKey: params.voteKey,\n selectionKey: params.selectionKey,\n voteFirst: params.voteFirst,\n voteLast: params.voteLast,\n voteKeyDilution: params.voteKeyDilution,\n suggestedParams,\n nonParticipation: false,\n stateProofKey: params.stateProofKey,\n })\n }\n\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n suggestedParams,\n nonParticipation: params.preventAccountFromEverParticipatingAgain,\n })\n }\n\n /** Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. */\n private async buildTxn(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithContext[]> {\n switch (txn.type) {\n case 'pay':\n return [this.buildPayment(txn, suggestedParams)]\n case 'assetCreate':\n return [this.buildAssetCreate(txn, suggestedParams)]\n case 'appCall':\n return [await this.buildAppCall(txn, suggestedParams)]\n case 'assetConfig':\n return [this.buildAssetConfig(txn, suggestedParams)]\n case 'assetDestroy':\n return [this.buildAssetDestroy(txn, suggestedParams)]\n case 'assetFreeze':\n return [this.buildAssetFreeze(txn, suggestedParams)]\n case 'assetTransfer':\n return [this.buildAssetTransfer(txn, suggestedParams)]\n case 'assetOptIn':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n }, suggestedParams)]\n case 'assetOptOut':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n, closeAssetTo: txn.creator }, suggestedParams)]\n case 'keyReg':\n return [this.buildKeyReg(txn, suggestedParams)]\n default:\n throw Error(`Unsupported txn type`)\n }\n }\n\n private async buildTxnWithSigner(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithSignerAndContext[]> {\n if (txn.type === 'txnWithSigner') {\n return [\n {\n ...txn,\n context: {},\n },\n ]\n }\n\n if (txn.type === 'atc') {\n return this.buildAtc(txn.atc)\n }\n\n if (txn.type === 'methodCall') {\n return await this.buildMethodCall(txn, suggestedParams, true)\n }\n\n const signer = txn.signer ? ('signer' in txn.signer ? txn.signer.signer : txn.signer) : this.getSigner(txn.sender)\n\n return (await this.buildTxn(txn, suggestedParams)).map(({ txn, context }) => ({ txn, signer, context }))\n }\n\n /**\n * Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls.\n *\n * @returns The array of built transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { transactions, methodCalls, signers } = await composer.buildTransactions()\n * ```\n */\n async buildTransactions(): Promise<BuiltTransactions> {\n const suggestedParams = await this.getSuggestedParams()\n\n const transactions: algosdk.Transaction[] = []\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n const signers = new Map<number, algosdk.TransactionSigner>()\n\n for (const txn of this.txns) {\n if (!['txnWithSigner', 'atc', 'methodCall'].includes(txn.type)) {\n transactions.push(...(await this.buildTxn(txn, suggestedParams)).map((txn) => txn.txn))\n } else {\n const transactionsWithSigner =\n txn.type === 'txnWithSigner'\n ? [txn]\n : txn.type === 'atc'\n ? this.buildAtc(txn.atc)\n : txn.type === 'methodCall'\n ? await this.buildMethodCall(txn, suggestedParams, false)\n : []\n\n transactionsWithSigner.forEach((ts, idx) => {\n transactions.push(ts.txn)\n\n if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {\n signers.set(idx, ts.signer)\n }\n if ('context' in ts && ts.context.abiMethod) {\n methodCalls.set(idx, ts.context.abiMethod)\n }\n })\n }\n }\n\n return { transactions, methodCalls, signers }\n }\n\n /**\n * Get the number of transactions currently added to this composer.\n * @returns The number of transactions currently added to this composer\n */\n async count() {\n return (await this.buildTransactions()).transactions.length\n }\n\n /**\n * Compose all of the transactions in a single atomic transaction group and an atomic transaction composer.\n *\n * You can then use the transactions standalone, or use the composer to execute or simulate the transactions.\n *\n * Once this method is called, no further transactions will be able to be added.\n * You can safely call this method multiple times to get the same result.\n * @returns The built atomic transaction composer, the transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.build()\n * ```\n */\n async build() {\n if (this.atc.getStatus() === algosdk.AtomicTransactionComposerStatus.BUILDING) {\n const suggestedParams = await this.getSuggestedParams()\n\n // Build all of the transactions\n const txnWithSigners: TransactionWithSignerAndContext[] = []\n for (const txn of this.txns) {\n txnWithSigners.push(...(await this.buildTxnWithSigner(txn, suggestedParams)))\n }\n\n // Add all of the transactions to the underlying ATC\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n txnWithSigners.forEach(({ context, ...ts }, idx) => {\n this.atc.addTransaction(ts)\n\n // Populate consolidated set of all ABI method calls\n if (context.abiMethod) {\n methodCalls.set(idx, context.abiMethod)\n }\n\n if (context.maxFee !== undefined) {\n this.txnMaxFees.set(idx, context.maxFee)\n }\n })\n this.atc['methodCalls'] = methodCalls\n }\n\n return { atc: this.atc, transactions: this.atc.buildGroup(), methodCalls: this.atc['methodCalls'] }\n }\n\n /**\n * Rebuild the group, discarding any previously built transactions.\n * This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.\n * @returns The newly built atomic transaction composer and the transactions\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.rebuild()\n * ```\n */\n async rebuild() {\n this.atc = new algosdk.AtomicTransactionComposer()\n return await this.build()\n }\n\n /**\n * Compose the atomic transaction group and send it to the network.\n * @param params The parameters to control execution with\n * @returns The execution result\n * @example\n * ```typescript\n * const result = await composer.send({\n * populateAppCallResources: true,\n * })\n * ```\n */\n async send(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n const group = (await this.build()).transactions\n\n let waitRounds = params?.maxRoundsToWaitForConfirmation\n\n const suggestedParams =\n waitRounds === undefined || params?.coverAppCallInnerTransactionFees ? await this.getSuggestedParams() : undefined\n\n if (waitRounds === undefined) {\n const lastRound = group.reduce((max, txn) => (txn.txn.lastValid > max ? txn.txn.lastValid : BigInt(max)), 0n)\n const { firstValid: firstRound } = suggestedParams!\n waitRounds = Number(BigInt(lastRound) - BigInt(firstRound)) + 1\n }\n\n return await sendAtomicTransactionComposer(\n {\n atc: this.atc,\n suppressLog: params?.suppressLog,\n maxRoundsToWaitForConfirmation: waitRounds,\n populateAppCallResources: params?.populateAppCallResources,\n coverAppCallInnerTransactionFees: params?.coverAppCallInnerTransactionFees,\n additionalAtcContext: params?.coverAppCallInnerTransactionFees\n ? {\n maxFees: this.txnMaxFees,\n suggestedParams: suggestedParams!,\n }\n : undefined,\n },\n this.algod,\n )\n }\n\n /**\n * @deprecated Use `send` instead.\n *\n * Compose the atomic transaction group and send it to the network\n *\n * An alias for `composer.send(params)`.\n * @param params The parameters to control execution with\n * @returns The execution result\n */\n async execute(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n return this.send(params)\n }\n\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate()\n * ```\n */\n async simulate(): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * skipSignatures: true,\n * })\n * ```\n */\n async simulate(\n options: SkipSignaturesSimulateOptions,\n ): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * extraOpcodeBudget: 1000,\n * })\n * ```\n */\n async simulate(options: RawSimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n async simulate(options?: SimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }> {\n const { skipSignatures = false, ...rawOptions } = options ?? {}\n const atc = skipSignatures ? new AtomicTransactionComposer() : this.atc\n\n // Build the transactions\n if (skipSignatures) {\n rawOptions.allowEmptySignatures = true\n rawOptions.fixSigners = true\n // Build transactions uses empty signers\n const transactions = await this.buildTransactions()\n for (const txn of transactions.transactions) {\n atc.addTransaction({ txn, signer: TransactionComposer.NULL_SIGNER })\n }\n atc['methodCalls'] = transactions.methodCalls\n } else {\n // Build creates real signatures\n await this.build()\n }\n\n const { methodResults, simulateResponse } = await atc.simulate(\n this.algod,\n new modelsv2.SimulateRequest({\n txnGroups: [],\n ...rawOptions,\n ...(Config.debug\n ? {\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: new modelsv2.SimulateTraceConfig({\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n }),\n }\n : undefined),\n }),\n )\n\n const failedGroup = simulateResponse?.txnGroups[0]\n if (failedGroup?.failureMessage) {\n const errorMessage = `Transaction failed at transaction(s) ${failedGroup.failedAt?.join(', ') || 'unknown'} in the group. ${failedGroup.failureMessage}`\n const error = new Error(errorMessage)\n\n if (Config.debug) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(error as any).simulateResponse = simulateResponse\n throw error\n }\n\n if (Config.debug && Config.traceAll) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n const transactions = atc.buildGroup().map((t) => t.txn)\n return {\n confirmations: simulateResponse.txnGroups[0].txnResults.map((t) => t.txnResult),\n transactions: transactions,\n txIds: transactions.map((t) => t.txID()),\n groupId: Buffer.from(transactions[0].group ?? new Uint8Array()).toString('base64'),\n simulateResponse,\n returns: methodResults.map(getABIReturnValue),\n }\n }\n\n /**\n * Create an encoded transaction note that follows the ARC-2 spec.\n *\n * https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md\n * @param note The ARC-2 transaction note data\n * @returns The binary encoded transaction note\n */\n static arc2Note(note: Arc2TransactionNote): Uint8Array {\n const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : asJson(note.data)}`\n const encoder = new TextEncoder()\n return encoder.encode(arc2Payload)\n }\n}\n"],"names":["Address","AppManager","encodeLease","genesisIdIsLocalNet","calculateExtraProgramPages","sendAtomicTransactionComposer","Config","EventType","getABIReturnValue","asJson"],"mappings":";;;;;;;;;;AAWA,IAAO,yBAAyB,GAAG,OAAO,CAAC,yBAAyB;AAIpE,IAAO,uBAAuB,GAAG,OAAO,CAAC,uBAAuB;AAEhE,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ;AAElC,MAAM,OAAO,GAAG,CAAC,OAAyB,KAAa;AACrD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAGA,eAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;AAC5E,CAAC;AAEM,MAAM,0BAA0B,GAAG;AAif1C;MACa,mBAAmB,CAAA;AAgC9B;;;;AAIG;AACH,IAAA,WAAA,CAAY,MAAiC,EAAA;;AAhCrC,QAAA,IAAA,CAAA,GAAG,GAAG,IAAI,OAAO,CAAC,yBAAyB,EAAE;AAErD;;AAEG;AACK,QAAA,IAAA,CAAA,UAAU,GAA4B,IAAI,GAAG,EAAE;;QAG/C,IAAI,CAAA,IAAA,GAAU,EAAE;;QAYhB,IAAqB,CAAA,qBAAA,GAAG,GAAG;;QAG3B,IAA+B,CAAA,+BAAA,GAAG,KAAK;AAU7C,QAAA,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;AACzB,QAAA,MAAM,yBAAyB,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAChF,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,IAAI,yBAAyB;AAChF,QAAA,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS;QACjC,IAAI,CAAC,qBAAqB,GAAG,MAAM,CAAC,qBAAqB,IAAI,IAAI,CAAC,qBAAqB;QACvF,IAAI,CAAC,+BAA+B,GAAG,MAAM,CAAC,qBAAqB,KAAK,SAAS;AACjF,QAAA,IAAI,CAAC,UAAU,GAAG,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6BAAiB,CAAC;SAC9C;;AAGH;;;;;;AAMG;IACH,OAAO,QAAQ,CAAC,IAAyB,EAAA;AACvC,QAAA,MAAM,WAAW,GAAG,CAAG,EAAA,IAAI,CAAC,QAAQ,CAAA,CAAA,EAAI,IAAI,CAAC,MAAM,CAAA,EAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,GAAGC,WAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACrH,QAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;;;AAtiDpC;AACe,mBAAA,CAAA,WAAW,GAA8B,OAAO,CAAC,0BAA0B,EAAE;;;;;"}
1
+ {"version":3,"file":"composer.js","sources":["../../src/types/composer.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { Config } from '../config'\nimport { encodeLease, getABIReturnValue, sendAtomicTransactionComposer } from '../transaction/transaction'\nimport { asJson, calculateExtraProgramPages } from '../util'\nimport { TransactionSignerAccount } from './account'\nimport { AlgoAmount } from './amount'\nimport { AppManager, BoxIdentifier, BoxReference } from './app-manager'\nimport { Expand } from './expand'\nimport { EventType } from './lifecycle-events'\nimport { genesisIdIsLocalNet } from './network-client'\nimport { Arc2TransactionNote, SendAtomicTransactionComposerResults, SendParams } from './transaction'\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\nimport TransactionWithSigner = algosdk.TransactionWithSigner\nimport isTransactionWithSigner = algosdk.isTransactionWithSigner\nimport SimulateResponse = algosdk.modelsv2.SimulateResponse\nimport modelsv2 = algosdk.modelsv2\n\nconst address = (address: string | Address): Address => {\n return typeof address === 'string' ? Address.fromString(address) : address\n}\n\nexport const MAX_TRANSACTION_GROUP_SIZE = 16\n\n/** Options to control a simulate request, that does not require transaction signing */\nexport type SkipSignaturesSimulateOptions = Expand<\n Omit<RawSimulateOptions, 'fixSigners' | 'allowEmptySignatures'> & {\n /** Whether or not to skip signatures for all built transactions and use an empty signer instead.\n * This will set `fixSigners` and `allowEmptySignatures` when sending the request to the algod API.\n */\n skipSignatures: boolean\n }\n>\n\n/** The raw API options to control a simulate request.\n * See algod API docs for more information: https://developer.algorand.org/docs/rest-apis/algod/#simulaterequest\n */\nexport type RawSimulateOptions = Expand<Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>>\n\n/** All options to control a simulate request */\nexport type SimulateOptions = Expand<Partial<SkipSignaturesSimulateOptions> & RawSimulateOptions>\n\n/** Common parameters for defining a transaction. */\nexport type CommonTransactionParams = {\n /** The address of the account sending the transaction. */\n sender: string | Address\n /** The function used to sign transaction(s); if not specified then\n * an attempt will be made to find a registered signer for the\n * given `sender` or use a default signer (if configured).\n */\n signer?: algosdk.TransactionSigner | TransactionSignerAccount\n /** Change the signing key of the sender to the given address.\n *\n * **Warning:** Please be careful with this parameter and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n */\n rekeyTo?: string | Address\n /** Note to attach to the transaction. Max of 1000 bytes. */\n note?: Uint8Array | string\n /** Prevent multiple transactions with the same lease being included within the validity window.\n *\n * A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/)\n * enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).\n */\n lease?: Uint8Array | string\n /** The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. */\n staticFee?: AlgoAmount\n /** The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees. */\n extraFee?: AlgoAmount\n /** Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. */\n maxFee?: AlgoAmount\n /** How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. */\n validityWindow?: number | bigint\n /**\n * Set the first round this transaction is valid.\n * If left undefined, the value from algod will be used.\n *\n * We recommend you only set this when you intentionally want this to be some time in the future.\n */\n firstValidRound?: bigint\n /** The last round this transaction is valid. It is recommended to use `validityWindow` instead. */\n lastValidRound?: bigint\n}\n\n/** Parameters to define a payment transaction. */\nexport type PaymentParams = CommonTransactionParams & {\n /** The address of the account that will receive the Algo */\n receiver: string | Address\n /** Amount to send */\n amount: AlgoAmount\n /** If given, close the sender account and send the remaining balance to this address\n *\n * *Warning:* Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeRemainderTo?: string | Address\n}\n\n/** Parameters to define an asset create transaction.\n *\n * The account that sends this transaction will automatically be opted in to the asset and will hold all units after creation.\n */\nexport type AssetCreateParams = CommonTransactionParams & {\n /** The total amount of the smallest divisible (decimal) unit to create.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there would be 1 whole unit.\n *\n * This field can only be specified upon asset creation.\n */\n total: bigint\n\n /** The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /** Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /** 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: string | Uint8Array\n\n /** Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the `manager` the asset becomes permanently immutable.\n */\n manager?: string | Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n reserve?: string | Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n freeze?: string | Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset reconfiguration transaction.\n *\n * **Note:** The manager, reserve, freeze, and clawback addresses\n * are immutably empty if they are not set. If manager is not set then\n * all fields are immutable from that point forward.\n */\nexport type AssetConfigParams = CommonTransactionParams & {\n /** ID of the asset to reconfigure */\n assetId: bigint\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) the asset will become permanently immutable.\n */\n manager: string | Address | undefined\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n reserve?: string | Address\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n freeze?: string | Address\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset freeze transaction. */\nexport type AssetFreezeParams = CommonTransactionParams & {\n /** The ID of the asset to freeze/unfreeze */\n assetId: bigint\n /** The address of the account to freeze or unfreeze */\n account: string | Address\n /** Whether the assets in the account should be frozen */\n frozen: boolean\n}\n\n/** Parameters to define an asset destroy transaction.\n *\n * Created assets can be destroyed only by the asset manager account. All of the assets must be owned by the creator of the asset before the asset can be deleted.\n */\nexport type AssetDestroyParams = CommonTransactionParams & {\n /** ID of the asset to destroy */\n assetId: bigint\n}\n\n/** Parameters to define an asset transfer transaction. */\nexport type AssetTransferParams = CommonTransactionParams & {\n /** ID of the asset to transfer. */\n assetId: bigint\n /** Amount of the asset to transfer (in smallest divisible (decimal) units). */\n amount: bigint\n /** The address of the account that will receive the asset unit(s). */\n receiver: string | Address\n /** Optional address of an account to clawback the asset from.\n *\n * Requires the sender to be the clawback account.\n *\n * **Warning:** Be careful with this parameter as it can lead to unexpected loss of funds if not used correctly.\n */\n clawbackTarget?: string | Address\n /** Optional address of an account to close the asset position to.\n *\n * **Warning:** Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeAssetTo?: string | Address\n}\n\n/** Parameters to define an asset opt-in transaction. */\nexport type AssetOptInParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-in to. */\n assetId: bigint\n}\n\n/** Parameters to define an asset opt-out transaction. */\nexport type AssetOptOutParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-out of. */\n assetId: bigint\n /**\n * The address of the asset creator account to close the asset\n * position to (any remaining asset units will be sent to this account).\n */\n creator: string | Address\n}\n\n/** Parameters to define an online key registration transaction. */\nexport type OnlineKeyRegistrationParams = CommonTransactionParams & {\n /** The root participation public key */\n voteKey: Uint8Array\n /** The VRF public key */\n selectionKey: Uint8Array\n /** The first round that the participation key is valid. Not to be confused with the `firstValid` round of the keyreg transaction */\n voteFirst: bigint\n /** The last round that the participation key is valid. Not to be confused with the `lastValid` round of the keyreg transaction */\n voteLast: bigint\n /** This is the dilution for the 2-level participation key. It determines the interval (number of rounds) for generating new ephemeral keys */\n voteKeyDilution: bigint\n /** The 64 byte state proof public key commitment */\n stateProofKey?: Uint8Array\n}\n\n/** Parameters to define an offline key registration transaction. */\nexport type OfflineKeyRegistrationParams = CommonTransactionParams & {\n /** Prevent this account from ever participating again. The account will also no longer earn rewards */\n preventAccountFromEverParticipatingAgain?: boolean\n}\n\n/** Common parameters for defining an application call transaction. */\nexport type CommonAppCallParams = CommonTransactionParams & {\n /** ID of the application; 0 if the application is being created. */\n appId: bigint\n /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call; defaults to no-op. */\n onComplete?: algosdk.OnApplicationComplete\n /** Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). */\n args?: Uint8Array[]\n /** Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n accountReferences?: (string | Address)[]\n /** The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n appReferences?: bigint[]\n /** The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n assetReferences?: bigint[]\n /** Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays).\n *\n * Either the name identifier (which will be set against app ID of `0` i.e.\n * the current app), or a box identifier with the name identifier and app ID.\n */\n boxReferences?: (BoxReference | BoxIdentifier)[]\n}\n\n/** Parameters to define an app create transaction */\nexport type AppCreateParams = Expand<\n Omit<CommonAppCallParams, 'appId'> & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.ClearStateOC>\n /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n clearStateProgram: string | Uint8Array\n /** The state schema for the app. This is immutable once the app is created. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n }\n>\n\n/** Parameters to define an app update transaction */\nexport type AppUpdateParams = Expand<\n CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC\n /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n clearStateProgram: string | Uint8Array\n }\n>\n\n/** Parameters to define an application call transaction. */\nexport type AppCallParams = CommonAppCallParams & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.UpdateApplicationOC>\n}\n\n/** Common parameters to define an ABI method call transaction. */\nexport type AppMethodCallParams = CommonAppCallParams & {\n onComplete?: Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.ClearStateOC\n >\n}\n\n/** Parameters to define an application delete call transaction. */\nexport type AppDeleteParams = CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC\n}\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = AppMethodCall<AppCreateParams>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = AppMethodCall<AppUpdateParams>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = AppMethodCall<AppDeleteParams>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = AppMethodCall<AppMethodCallParams>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: algosdk.ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | algosdk.ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\nexport type Txn =\n | (PaymentParams & { type: 'pay' })\n | (AssetCreateParams & { type: 'assetCreate' })\n | (AssetConfigParams & { type: 'assetConfig' })\n | (AssetFreezeParams & { type: 'assetFreeze' })\n | (AssetDestroyParams & { type: 'assetDestroy' })\n | (AssetTransferParams & { type: 'assetTransfer' })\n | (AssetOptInParams & { type: 'assetOptIn' })\n | (AssetOptOutParams & { type: 'assetOptOut' })\n | ((AppCallParams | AppCreateParams | AppUpdateParams) & { type: 'appCall' })\n | ((OnlineKeyRegistrationParams | OfflineKeyRegistrationParams) & { type: 'keyReg' })\n | (algosdk.TransactionWithSigner & { type: 'txnWithSigner' })\n | { atc: algosdk.AtomicTransactionComposer; type: 'atc' }\n | ((AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall) & { type: 'methodCall' })\n\n/** Parameters to create an `TransactionComposer`. */\nexport type TransactionComposerParams = {\n /** The algod client to use to get suggestedParams and send the transaction group */\n algod: algosdk.Algodv2\n /** The function used to get the TransactionSigner for a given address */\n getSigner: (address: string | Address) => algosdk.TransactionSigner\n /** The method used to get SuggestedParams for transactions in the group */\n getSuggestedParams?: () => Promise<algosdk.SuggestedParams>\n /** How many rounds a transaction should be valid for by default; if not specified\n * then will be 10 rounds (or 1000 rounds if issuing transactions to LocalNet).\n */\n defaultValidityWindow?: bigint\n /** An existing `AppManager` to use to manage app compilation and cache compilation results.\n *\n * If not specified than an ephemeral one will be created.\n */\n appManager?: AppManager\n}\n\n/** Represents a Transaction with additional context that was used to build that transaction. */\ninterface TransactionWithContext {\n txn: Transaction\n context: {\n /* The logical max fee for the transaction, if one was supplied. */\n maxFee?: AlgoAmount\n /* The ABI method, if the app call transaction is an ABI method call. */\n abiMethod?: algosdk.ABIMethod\n }\n}\n\n/** Represents a TransactionWithSigner with additional context that was used to build that transaction. */\ntype TransactionWithSignerAndContext = algosdk.TransactionWithSigner & TransactionWithContext\n\n/** Set of transactions built by `TransactionComposer`. */\nexport interface BuiltTransactions {\n /** The built transactions */\n transactions: algosdk.Transaction[]\n /** Any `ABIMethod` objects associated with any of the transactions in a map keyed by transaction index. */\n methodCalls: Map<number, algosdk.ABIMethod>\n /** Any `TransactionSigner` objects associated with any of the transactions in a map keyed by transaction index. */\n signers: Map<number, algosdk.TransactionSigner>\n}\n\n/** TransactionComposer helps you compose and execute transactions as a transaction group. */\nexport class TransactionComposer {\n /** Signer used to represent a lack of signer */\n private static NULL_SIGNER: algosdk.TransactionSigner = algosdk.makeEmptyTransactionSigner()\n\n /** The ATC used to compose the group */\n private atc = new algosdk.AtomicTransactionComposer()\n\n /** Map of transaction index in the atc to a max logical fee.\n * This is set using the value of either maxFee or staticFee.\n */\n private txnMaxFees: Map<number, AlgoAmount> = new Map()\n\n /** Transactions that have not yet been composed */\n private txns: Txn[] = []\n\n /** The algod client used by the composer. */\n private algod: algosdk.Algodv2\n\n /** An async function that will return suggested params for the transaction. */\n private getSuggestedParams: () => Promise<algosdk.SuggestedParams>\n\n /** A function that takes in an address and return a signer function for that address. */\n private getSigner: (address: string | Address) => algosdk.TransactionSigner\n\n /** The default transaction validity window */\n private defaultValidityWindow = 10n\n\n /** Whether the validity window was explicitly set on construction */\n private defaultValidityWindowIsExplicit = false\n\n private appManager: AppManager\n\n /**\n * Create a `TransactionComposer`.\n * @param params The configuration for this composer\n * @returns The `TransactionComposer` instance\n */\n constructor(params: TransactionComposerParams) {\n this.algod = params.algod\n const defaultGetSuggestedParams = () => params.algod.getTransactionParams().do()\n this.getSuggestedParams = params.getSuggestedParams ?? defaultGetSuggestedParams\n this.getSigner = params.getSigner\n this.defaultValidityWindow = params.defaultValidityWindow ?? this.defaultValidityWindow\n this.defaultValidityWindowIsExplicit = params.defaultValidityWindow !== undefined\n this.appManager = params.appManager ?? new AppManager(params.algod)\n }\n\n /**\n * Add a pre-built transaction to the transaction group.\n * @param transaction The pre-built transaction\n * @param signer Optional signer override for the transaction\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * composer.addTransaction(txn)\n * ```\n */\n addTransaction(transaction: Transaction, signer?: TransactionSigner): TransactionComposer {\n this.txns.push({\n txn: transaction,\n signer: signer ?? this.getSigner(transaction.sender),\n type: 'txnWithSigner',\n })\n\n return this\n }\n\n /**\n * Add a payment transaction to the transaction group.\n * @param params The payment transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addPayment({\n * sender: 'SENDERADDRESS',\n * receiver: 'RECEIVERADDRESS',\n * amount: (4).algo(),\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addPayment({\n * amount: (4).algo(),\n * receiver: 'RECEIVERADDRESS',\n * sender: 'SENDERADDRESS',\n * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addPayment(params: PaymentParams): TransactionComposer {\n this.txns.push({ ...params, type: 'pay' })\n\n return this\n }\n\n /**\n * Add an asset create transaction to the transaction group.\n * @param params The asset create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetCreate({ sender: \"CREATORADDRESS\", total: 100n})\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetCreate({\n * sender: 'CREATORADDRESS',\n * total: 100n,\n * decimals: 2,\n * assetName: 'asset',\n * unitName: 'unit',\n * url: 'url',\n * metadataHash: 'metadataHash',\n * defaultFrozen: false,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetCreate(params: AssetCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetCreate' })\n\n return this\n }\n\n /**\n * Add an asset config transaction to the transaction group.\n * @param params The asset config transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetConfig({ sender: \"MANAGERADDRESS\", assetId: 123456n, manager: \"MANAGERADDRESS\" })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetConfig({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetConfig(params: AssetConfigParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetConfig' })\n\n return this\n }\n\n /**\n * Add an asset freeze transaction to the transaction group.\n * @param params The asset freeze transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetFreeze({ sender: \"MANAGERADDRESS\", assetId: 123456n, account: \"ACCOUNTADDRESS\", frozen: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetFreeze({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * account: 'ACCOUNTADDRESS',\n * frozen: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetFreeze(params: AssetFreezeParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetFreeze' })\n\n return this\n }\n\n /**\n * Add an asset destroy transaction to the transaction group.\n * @param params The asset destroy transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetDestroy({ sender: \"MANAGERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetDestroy({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetDestroy(params: AssetDestroyParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetDestroy' })\n\n return this\n }\n\n /**\n * Add an asset transfer transaction to the transaction group.\n * @param params The asset transfer transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetTransfer({ sender: \"HOLDERADDRESS\", assetId: 123456n, amount: 1n, receiver: \"RECEIVERADDRESS\" })\n * ```\n * @example Advanced example (with clawback)\n * ```typescript\n * composer.addAssetTransfer({\n * sender: 'CLAWBACKADDRESS',\n * assetId: 123456n,\n * amount: 1n,\n * receiver: 'RECEIVERADDRESS',\n * clawbackTarget: 'HOLDERADDRESS',\n * // This field needs to be used with caution\n * closeAssetTo: 'ADDRESSTOCLOSETO'\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetTransfer(params: AssetTransferParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetTransfer' })\n\n return this\n }\n\n /**\n * Add an asset opt-in transaction to the transaction group.\n * @param params The asset opt-in transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetOptIn({ sender: \"SENDERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptIn({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptIn(params: AssetOptInParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptIn' })\n\n return this\n }\n\n /**\n * Add an asset opt-out transaction to the transaction group.\n * @param params The asset opt-out transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example (without creator, will be retrieved from algod)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Basic example (with creator)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", creator: \"CREATORADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptOut({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * creator: 'CREATORADDRESS',\n * ensureZeroBalance: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptOut(params: AssetOptOutParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptOut' })\n\n return this\n }\n\n /**\n * Add an application create transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCreate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * // Signer only needed if you want to provide one,\n * // generally you'd register it with AlgorandClient\n * // against the sender and not need to pass it in\n * signer: transactionSigner,\n * maxRoundsToWaitForConfirmation: 5,\n * suppressLog: true,\n *})\n * ```\n */\n addAppCreate(params: AppCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an application update transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application update transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppUpdate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdate(params: AppUpdateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n\n return this\n }\n\n /**\n * Add an application delete transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application delete transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppDelete({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppDelete({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDelete(params: AppDeleteParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n\n return this\n }\n\n /**\n * Add an application call transaction to the transaction group.\n *\n * If you want to create or update an app use `addAppCreate` or `addAppUpdate`.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCall({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCall({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCall(params: AppCallParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an ABI method create application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI create method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCreateMethodCall(params: AppCreateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an ABI method update application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI update method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdateMethodCall(params: AppUpdateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n return this\n }\n\n /**\n * Add an ABI method delete application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI delete method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDeleteMethodCall(params: AppDeleteMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n return this\n }\n\n /**\n * Add a non-create/non-update ABI method application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCallMethodCall(params: AppCallMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an online key registration transaction to the transaction group.\n * @param params The online key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add an offline key registration transaction to the transaction group.\n * @param params The offline key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOfflineKeyRegistration(params: OfflineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add the transactions within an `AtomicTransactionComposer` to the transaction group.\n * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * const atc = new AtomicTransactionComposer()\n * .addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })\n * composer.addAtc(atc)\n * ```\n */\n addAtc(atc: algosdk.AtomicTransactionComposer): TransactionComposer {\n this.txns.push({ atc, type: 'atc' })\n return this\n }\n\n /** Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing */\n private buildAtc(atc: algosdk.AtomicTransactionComposer): TransactionWithSignerAndContext[] {\n const group = atc.buildGroup()\n\n const txnWithSigners = group.map((ts, idx) => {\n // Remove underlying group ID from the transaction since it will be re-grouped when this TransactionComposer is built\n ts.txn.group = undefined\n // If this was a method call return the ABIMethod for later\n if (atc['methodCalls'].get(idx)) {\n return {\n ...ts,\n context: { abiMethod: atc['methodCalls'].get(idx) as algosdk.ABIMethod },\n }\n }\n return {\n ...ts,\n context: {},\n }\n })\n\n return txnWithSigners\n }\n\n private commonTxnBuildStep<TParams extends algosdk.CommonTransactionParams>(\n buildTxn: (params: TParams) => Transaction,\n params: CommonTransactionParams,\n txnParams: TParams,\n ): TransactionWithContext {\n // We are going to mutate suggested params, let's create a clone first\n txnParams.suggestedParams = { ...txnParams.suggestedParams }\n\n if (params.lease) txnParams.lease = encodeLease(params.lease)! satisfies algosdk.Transaction['lease']\n if (params.rekeyTo) txnParams.rekeyTo = address(params.rekeyTo) satisfies algosdk.Transaction['rekeyTo']\n const encoder = new TextEncoder()\n if (params.note)\n txnParams.note = (typeof params.note === 'string' ? encoder.encode(params.note) : params.note) satisfies algosdk.Transaction['note']\n\n if (params.firstValidRound) {\n txnParams.suggestedParams.firstValid = params.firstValidRound\n }\n\n if (params.lastValidRound) {\n txnParams.suggestedParams.lastValid = params.lastValidRound\n } else {\n // If the validity window isn't set in this transaction or by default and we are pointing at\n // LocalNet set a bigger window to avoid dead transactions\n const window = params.validityWindow\n ? BigInt(params.validityWindow)\n : !this.defaultValidityWindowIsExplicit && genesisIdIsLocalNet(txnParams.suggestedParams.genesisID ?? 'unknown')\n ? 1000n\n : this.defaultValidityWindow\n txnParams.suggestedParams.lastValid = BigInt(txnParams.suggestedParams.firstValid) + window\n }\n\n if (params.staticFee !== undefined && params.extraFee !== undefined) {\n throw Error('Cannot set both staticFee and extraFee')\n }\n\n if (params.staticFee !== undefined) {\n txnParams.suggestedParams.fee = params.staticFee.microAlgo\n txnParams.suggestedParams.flatFee = true\n }\n\n const txn = buildTxn(txnParams)\n\n if (params.extraFee) txn.fee += params.extraFee.microAlgo\n if (params.maxFee !== undefined && txn.fee > params.maxFee.microAlgo) {\n throw Error(`Transaction fee ${txn.fee} µALGO is greater than maxFee ${params.maxFee}`)\n }\n\n const logicalMaxFee =\n params.maxFee !== undefined && params.maxFee.microAlgo > (params.staticFee?.microAlgo ?? 0n) ? params.maxFee : params.staticFee\n\n return { txn, context: { maxFee: logicalMaxFee } }\n }\n\n /**\n * Builds an ABI method call transaction and any other associated transactions represented in the ABI args.\n * @param includeSigner Whether to include the actual signer for the transactions.\n * If you are just building transactions without signers yet then set this to `false`.\n */\n private async buildMethodCall(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall,\n suggestedParams: algosdk.SuggestedParams,\n includeSigner: boolean,\n ): Promise<TransactionWithSignerAndContext[]> {\n const methodArgs: (algosdk.ABIArgument | TransactionWithSignerAndContext)[] = []\n const transactionsForGroup: TransactionWithSignerAndContext[] = []\n\n const isAbiValue = (x: unknown): x is algosdk.ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array\n }\n\n for (let i = (params.args ?? []).length - 1; i >= 0; i--) {\n const arg = params.args![i]\n if (arg === undefined) {\n // An undefined transaction argument signals that the value will be supplied by a method call argument\n if (algosdk.abiTypeIsTransaction(params.method.args[i].type) && transactionsForGroup.length > 0) {\n // Move the last transaction from the group to the method call arguments to appease algosdk\n const placeholderTransaction = transactionsForGroup.splice(-1, 1)[0]\n methodArgs.push(placeholderTransaction)\n continue\n }\n\n throw Error(`No value provided for argument ${i + 1} within call to ${params.method.name}`)\n }\n\n if (isAbiValue(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if (isTransactionWithSigner(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if ('method' in arg) {\n const tempTxnWithSigners = await this.buildMethodCall(arg, suggestedParams, includeSigner)\n // If there is any transaction args, add to the atc\n // Everything else should be added as method args\n\n methodArgs.push(...tempTxnWithSigners.slice(-1)) // Add the method call itself as a method arg\n transactionsForGroup.push(...tempTxnWithSigners.slice(0, -1).reverse()) // Add any transaction arguments to the atc\n continue\n }\n\n const txn = await arg\n methodArgs.push({\n txn,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(txn.sender)\n : TransactionComposer.NULL_SIGNER,\n })\n }\n\n const methodAtc = new algosdk.AtomicTransactionComposer()\n const maxFees = new Map<number, AlgoAmount>()\n\n transactionsForGroup.reverse().forEach(({ context, ...txnWithSigner }) => {\n methodAtc.addTransaction(txnWithSigner)\n const atcIndex = methodAtc.count() - 1\n if (context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, context.abiMethod)\n }\n if (context.maxFee !== undefined) {\n maxFees.set(atcIndex, context.maxFee)\n }\n })\n\n // If any of the args are method call transactions, add that info to the methodAtc\n methodArgs\n .filter((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return isTransactionWithSigner(txnWithSigner)\n }\n return isTransactionWithSigner(arg)\n })\n .reverse()\n .forEach((arg, idx) => {\n if (typeof arg === 'object' && 'context' in arg && arg.context) {\n const atcIndex = methodAtc.count() + idx\n if (arg.context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, arg.context.abiMethod)\n }\n if (arg.context.maxFee !== undefined) {\n maxFees.set(atcIndex, arg.context.maxFee)\n }\n }\n })\n\n const appId = Number('appId' in params ? params.appId : 0n)\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const txnParams = {\n appID: appId,\n sender: params.sender,\n suggestedParams,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n appAccounts: params.accountReferences,\n appForeignApps: params.appReferences?.map((x) => Number(x)),\n appForeignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n extraPages:\n appId === 0\n ? 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : approvalProgram\n ? calculateExtraProgramPages(approvalProgram, clearStateProgram)\n : 0\n : undefined,\n numLocalInts: appId === 0 ? ('schema' in params ? (params.schema?.localInts ?? 0) : 0) : undefined,\n numLocalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.localByteSlices ?? 0) : 0) : undefined,\n numGlobalInts: appId === 0 ? ('schema' in params ? (params.schema?.globalInts ?? 0) : 0) : undefined,\n numGlobalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0) : undefined,\n method: params.method,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(params.sender)\n : TransactionComposer.NULL_SIGNER,\n methodArgs: methodArgs\n .map((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return txnWithSigner\n }\n return arg\n })\n .reverse(),\n // note, lease, and rekeyTo are set in the common build step\n note: undefined,\n lease: undefined,\n rekeyTo: undefined,\n }\n\n // Build the transaction\n const result = this.commonTxnBuildStep(\n (txnParams) => {\n methodAtc.addMethodCall(txnParams)\n return methodAtc.buildGroup()[methodAtc.count() - 1].txn\n },\n params,\n txnParams,\n )\n\n // Process the ATC to get a set of transactions ready for broader grouping\n return this.buildAtc(methodAtc).map(({ context: _context, ...txnWithSigner }, idx) => {\n const maxFee = idx === methodAtc.count() - 1 ? result.context.maxFee : maxFees.get(idx)\n const context = {\n ..._context, // Adds method context info\n maxFee,\n }\n\n return {\n ...txnWithSigner,\n context,\n }\n })\n }\n\n private buildPayment(params: PaymentParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makePaymentTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n amount: params.amount.microAlgo,\n closeRemainderTo: params.closeRemainderTo,\n suggestedParams,\n })\n }\n\n private buildAssetCreate(params: AssetCreateParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n total: params.total,\n decimals: params.decimals ?? 0,\n assetName: params.assetName,\n unitName: params.unitName,\n assetURL: params.url,\n defaultFrozen: params.defaultFrozen ?? false,\n assetMetadataHash: typeof params.metadataHash === 'string' ? Buffer.from(params.metadataHash, 'utf-8') : params.metadataHash,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n suggestedParams,\n })\n }\n\n private buildAssetConfig(params: AssetConfigParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n strictEmptyAddressChecking: false,\n })\n }\n\n private buildAssetDestroy(params: AssetDestroyParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n })\n }\n\n private buildAssetFreeze(params: AssetFreezeParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetFreezeTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n freezeTarget: params.account,\n frozen: params.frozen,\n suggestedParams,\n })\n }\n\n private buildAssetTransfer(params: AssetTransferParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n assetIndex: params.assetId,\n amount: params.amount,\n suggestedParams,\n closeRemainderTo: params.closeAssetTo,\n assetSender: params.clawbackTarget,\n })\n }\n\n private async buildAppCall(params: AppCallParams | AppUpdateParams | AppCreateParams, suggestedParams: algosdk.SuggestedParams) {\n const appId = 'appId' in params ? params.appId : 0n\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const sdkParams = {\n sender: params.sender,\n suggestedParams,\n appArgs: params.args,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n accounts: params.accountReferences,\n foreignApps: params.appReferences?.map((x) => Number(x)),\n foreignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n }\n\n if (appId === 0n) {\n if (sdkParams.approvalProgram === undefined || sdkParams.clearProgram === undefined) {\n throw new Error('approvalProgram and clearStateProgram are required for application creation')\n }\n\n return this.commonTxnBuildStep(algosdk.makeApplicationCreateTxnFromObject, params, {\n ...sdkParams,\n extraPages:\n 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : calculateExtraProgramPages(approvalProgram!, clearStateProgram!),\n numLocalInts: 'schema' in params ? (params.schema?.localInts ?? 0) : 0,\n numLocalByteSlices: 'schema' in params ? (params.schema?.localByteSlices ?? 0) : 0,\n numGlobalInts: 'schema' in params ? (params.schema?.globalInts ?? 0) : 0,\n numGlobalByteSlices: 'schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0,\n approvalProgram: approvalProgram!,\n clearProgram: clearStateProgram!,\n })\n } else {\n return this.commonTxnBuildStep(algosdk.makeApplicationCallTxnFromObject, params, { ...sdkParams, appIndex: appId })\n }\n }\n\n private buildKeyReg(params: OnlineKeyRegistrationParams | OfflineKeyRegistrationParams, suggestedParams: algosdk.SuggestedParams) {\n if ('voteKey' in params) {\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n voteKey: params.voteKey,\n selectionKey: params.selectionKey,\n voteFirst: params.voteFirst,\n voteLast: params.voteLast,\n voteKeyDilution: params.voteKeyDilution,\n suggestedParams,\n nonParticipation: false,\n stateProofKey: params.stateProofKey,\n })\n }\n\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n suggestedParams,\n nonParticipation: params.preventAccountFromEverParticipatingAgain,\n })\n }\n\n /** Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. */\n private async buildTxn(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithContext[]> {\n switch (txn.type) {\n case 'pay':\n return [this.buildPayment(txn, suggestedParams)]\n case 'assetCreate':\n return [this.buildAssetCreate(txn, suggestedParams)]\n case 'appCall':\n return [await this.buildAppCall(txn, suggestedParams)]\n case 'assetConfig':\n return [this.buildAssetConfig(txn, suggestedParams)]\n case 'assetDestroy':\n return [this.buildAssetDestroy(txn, suggestedParams)]\n case 'assetFreeze':\n return [this.buildAssetFreeze(txn, suggestedParams)]\n case 'assetTransfer':\n return [this.buildAssetTransfer(txn, suggestedParams)]\n case 'assetOptIn':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n }, suggestedParams)]\n case 'assetOptOut':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n, closeAssetTo: txn.creator }, suggestedParams)]\n case 'keyReg':\n return [this.buildKeyReg(txn, suggestedParams)]\n default:\n throw Error(`Unsupported txn type`)\n }\n }\n\n private async buildTxnWithSigner(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithSignerAndContext[]> {\n if (txn.type === 'txnWithSigner') {\n return [\n {\n ...txn,\n context: {},\n },\n ]\n }\n\n if (txn.type === 'atc') {\n return this.buildAtc(txn.atc)\n }\n\n if (txn.type === 'methodCall') {\n return await this.buildMethodCall(txn, suggestedParams, true)\n }\n\n const signer = txn.signer ? ('signer' in txn.signer ? txn.signer.signer : txn.signer) : this.getSigner(txn.sender)\n\n return (await this.buildTxn(txn, suggestedParams)).map(({ txn, context }) => ({ txn, signer, context }))\n }\n\n /**\n * Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls.\n *\n * @returns The array of built transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { transactions, methodCalls, signers } = await composer.buildTransactions()\n * ```\n */\n async buildTransactions(): Promise<BuiltTransactions> {\n const suggestedParams = await this.getSuggestedParams()\n\n const transactions: algosdk.Transaction[] = []\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n const signers = new Map<number, algosdk.TransactionSigner>()\n\n for (const txn of this.txns) {\n if (!['txnWithSigner', 'atc', 'methodCall'].includes(txn.type)) {\n transactions.push(...(await this.buildTxn(txn, suggestedParams)).map((txn) => txn.txn))\n } else {\n const transactionsWithSigner =\n txn.type === 'txnWithSigner'\n ? [txn]\n : txn.type === 'atc'\n ? this.buildAtc(txn.atc)\n : txn.type === 'methodCall'\n ? await this.buildMethodCall(txn, suggestedParams, false)\n : []\n\n transactionsWithSigner.forEach((ts) => {\n transactions.push(ts.txn)\n const groupIdx = transactions.length - 1\n\n if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {\n signers.set(groupIdx, ts.signer)\n }\n if ('context' in ts && ts.context.abiMethod) {\n methodCalls.set(groupIdx, ts.context.abiMethod)\n }\n })\n }\n }\n\n return { transactions, methodCalls, signers }\n }\n\n /**\n * Get the number of transactions currently added to this composer.\n * @returns The number of transactions currently added to this composer\n */\n async count() {\n return (await this.buildTransactions()).transactions.length\n }\n\n /**\n * Compose all of the transactions in a single atomic transaction group and an atomic transaction composer.\n *\n * You can then use the transactions standalone, or use the composer to execute or simulate the transactions.\n *\n * Once this method is called, no further transactions will be able to be added.\n * You can safely call this method multiple times to get the same result.\n * @returns The built atomic transaction composer, the transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.build()\n * ```\n */\n async build() {\n if (this.atc.getStatus() === algosdk.AtomicTransactionComposerStatus.BUILDING) {\n const suggestedParams = await this.getSuggestedParams()\n\n // Build all of the transactions\n const txnWithSigners: TransactionWithSignerAndContext[] = []\n for (const txn of this.txns) {\n txnWithSigners.push(...(await this.buildTxnWithSigner(txn, suggestedParams)))\n }\n\n // Add all of the transactions to the underlying ATC\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n txnWithSigners.forEach(({ context, ...ts }, idx) => {\n this.atc.addTransaction(ts)\n\n // Populate consolidated set of all ABI method calls\n if (context.abiMethod) {\n methodCalls.set(idx, context.abiMethod)\n }\n\n if (context.maxFee !== undefined) {\n this.txnMaxFees.set(idx, context.maxFee)\n }\n })\n this.atc['methodCalls'] = methodCalls\n }\n\n return { atc: this.atc, transactions: this.atc.buildGroup(), methodCalls: this.atc['methodCalls'] }\n }\n\n /**\n * Rebuild the group, discarding any previously built transactions.\n * This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.\n * @returns The newly built atomic transaction composer and the transactions\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.rebuild()\n * ```\n */\n async rebuild() {\n this.atc = new algosdk.AtomicTransactionComposer()\n return await this.build()\n }\n\n /**\n * Compose the atomic transaction group and send it to the network.\n * @param params The parameters to control execution with\n * @returns The execution result\n * @example\n * ```typescript\n * const result = await composer.send({\n * populateAppCallResources: true,\n * })\n * ```\n */\n async send(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n const group = (await this.build()).transactions\n\n let waitRounds = params?.maxRoundsToWaitForConfirmation\n\n const suggestedParams =\n waitRounds === undefined || params?.coverAppCallInnerTransactionFees ? await this.getSuggestedParams() : undefined\n\n if (waitRounds === undefined) {\n const lastRound = group.reduce((max, txn) => (txn.txn.lastValid > max ? txn.txn.lastValid : BigInt(max)), 0n)\n const { firstValid: firstRound } = suggestedParams!\n waitRounds = Number(BigInt(lastRound) - BigInt(firstRound)) + 1\n }\n\n return await sendAtomicTransactionComposer(\n {\n atc: this.atc,\n suppressLog: params?.suppressLog,\n maxRoundsToWaitForConfirmation: waitRounds,\n populateAppCallResources: params?.populateAppCallResources,\n coverAppCallInnerTransactionFees: params?.coverAppCallInnerTransactionFees,\n additionalAtcContext: params?.coverAppCallInnerTransactionFees\n ? {\n maxFees: this.txnMaxFees,\n suggestedParams: suggestedParams!,\n }\n : undefined,\n },\n this.algod,\n )\n }\n\n /**\n * @deprecated Use `send` instead.\n *\n * Compose the atomic transaction group and send it to the network\n *\n * An alias for `composer.send(params)`.\n * @param params The parameters to control execution with\n * @returns The execution result\n */\n async execute(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n return this.send(params)\n }\n\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate()\n * ```\n */\n async simulate(): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * skipSignatures: true,\n * })\n * ```\n */\n async simulate(\n options: SkipSignaturesSimulateOptions,\n ): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * extraOpcodeBudget: 1000,\n * })\n * ```\n */\n async simulate(options: RawSimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n async simulate(options?: SimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }> {\n const { skipSignatures = false, ...rawOptions } = options ?? {}\n const atc = skipSignatures ? new AtomicTransactionComposer() : this.atc\n\n // Build the transactions\n if (skipSignatures) {\n rawOptions.allowEmptySignatures = true\n rawOptions.fixSigners = true\n // Build transactions uses empty signers\n const transactions = await this.buildTransactions()\n for (const txn of transactions.transactions) {\n atc.addTransaction({ txn, signer: TransactionComposer.NULL_SIGNER })\n }\n atc['methodCalls'] = transactions.methodCalls\n } else {\n // Build creates real signatures\n await this.build()\n }\n\n const { methodResults, simulateResponse } = await atc.simulate(\n this.algod,\n new modelsv2.SimulateRequest({\n txnGroups: [],\n ...rawOptions,\n ...(Config.debug\n ? {\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: new modelsv2.SimulateTraceConfig({\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n }),\n }\n : undefined),\n }),\n )\n\n const failedGroup = simulateResponse?.txnGroups[0]\n if (failedGroup?.failureMessage) {\n const errorMessage = `Transaction failed at transaction(s) ${failedGroup.failedAt?.join(', ') || 'unknown'} in the group. ${failedGroup.failureMessage}`\n const error = new Error(errorMessage)\n\n if (Config.debug) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(error as any).simulateResponse = simulateResponse\n throw error\n }\n\n if (Config.debug && Config.traceAll) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n const transactions = atc.buildGroup().map((t) => t.txn)\n return {\n confirmations: simulateResponse.txnGroups[0].txnResults.map((t) => t.txnResult),\n transactions: transactions,\n txIds: transactions.map((t) => t.txID()),\n groupId: Buffer.from(transactions[0].group ?? new Uint8Array()).toString('base64'),\n simulateResponse,\n returns: methodResults.map(getABIReturnValue),\n }\n }\n\n /**\n * Create an encoded transaction note that follows the ARC-2 spec.\n *\n * https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md\n * @param note The ARC-2 transaction note data\n * @returns The binary encoded transaction note\n */\n static arc2Note(note: Arc2TransactionNote): Uint8Array {\n const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : asJson(note.data)}`\n const encoder = new TextEncoder()\n return encoder.encode(arc2Payload)\n }\n}\n"],"names":["Address","AppManager","encodeLease","genesisIdIsLocalNet","calculateExtraProgramPages","sendAtomicTransactionComposer","Config","EventType","getABIReturnValue","asJson"],"mappings":";;;;;;;;;;AAWA,IAAO,yBAAyB,GAAG,OAAO,CAAC,yBAAyB;AAIpE,IAAO,uBAAuB,GAAG,OAAO,CAAC,uBAAuB;AAEhE,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ;AAElC,MAAM,OAAO,GAAG,CAAC,OAAyB,KAAa;AACrD,IAAA,OAAO,OAAO,OAAO,KAAK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,IAAI,CAAC,EAAE;AACrH,QAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;;;AAviDpC;AACe,mBAAA,CAAA,WAAW,GAA8B,OAAO,CAAC,0BAA0B,EAAE;;;;;"}
@@ -1220,13 +1220,14 @@ class TransactionComposer {
1220
1220
  : txn.type === 'methodCall'
1221
1221
  ? await this.buildMethodCall(txn, suggestedParams, false)
1222
1222
  : [];
1223
- transactionsWithSigner.forEach((ts, idx) => {
1223
+ transactionsWithSigner.forEach((ts) => {
1224
1224
  transactions.push(ts.txn);
1225
+ const groupIdx = transactions.length - 1;
1225
1226
  if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {
1226
- signers.set(idx, ts.signer);
1227
+ signers.set(groupIdx, ts.signer);
1227
1228
  }
1228
1229
  if ('context' in ts && ts.context.abiMethod) {
1229
- methodCalls.set(idx, ts.context.abiMethod);
1230
+ methodCalls.set(groupIdx, ts.context.abiMethod);
1230
1231
  }
1231
1232
  });
1232
1233
  }
@@ -1 +1 @@
1
- {"version":3,"file":"composer.mjs","sources":["../../src/types/composer.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { Config } from '../config'\nimport { encodeLease, getABIReturnValue, sendAtomicTransactionComposer } from '../transaction/transaction'\nimport { asJson, calculateExtraProgramPages } from '../util'\nimport { TransactionSignerAccount } from './account'\nimport { AlgoAmount } from './amount'\nimport { AppManager, BoxIdentifier, BoxReference } from './app-manager'\nimport { Expand } from './expand'\nimport { EventType } from './lifecycle-events'\nimport { genesisIdIsLocalNet } from './network-client'\nimport { Arc2TransactionNote, SendAtomicTransactionComposerResults, SendParams } from './transaction'\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\nimport TransactionWithSigner = algosdk.TransactionWithSigner\nimport isTransactionWithSigner = algosdk.isTransactionWithSigner\nimport SimulateResponse = algosdk.modelsv2.SimulateResponse\nimport modelsv2 = algosdk.modelsv2\n\nconst address = (address: string | Address): Address => {\n return typeof address === 'string' ? Address.fromString(address) : address\n}\n\nexport const MAX_TRANSACTION_GROUP_SIZE = 16\n\n/** Options to control a simulate request, that does not require transaction signing */\nexport type SkipSignaturesSimulateOptions = Expand<\n Omit<RawSimulateOptions, 'fixSigners' | 'allowEmptySignatures'> & {\n /** Whether or not to skip signatures for all built transactions and use an empty signer instead.\n * This will set `fixSigners` and `allowEmptySignatures` when sending the request to the algod API.\n */\n skipSignatures: boolean\n }\n>\n\n/** The raw API options to control a simulate request.\n * See algod API docs for more information: https://developer.algorand.org/docs/rest-apis/algod/#simulaterequest\n */\nexport type RawSimulateOptions = Expand<Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>>\n\n/** All options to control a simulate request */\nexport type SimulateOptions = Expand<Partial<SkipSignaturesSimulateOptions> & RawSimulateOptions>\n\n/** Common parameters for defining a transaction. */\nexport type CommonTransactionParams = {\n /** The address of the account sending the transaction. */\n sender: string | Address\n /** The function used to sign transaction(s); if not specified then\n * an attempt will be made to find a registered signer for the\n * given `sender` or use a default signer (if configured).\n */\n signer?: algosdk.TransactionSigner | TransactionSignerAccount\n /** Change the signing key of the sender to the given address.\n *\n * **Warning:** Please be careful with this parameter and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n */\n rekeyTo?: string | Address\n /** Note to attach to the transaction. Max of 1000 bytes. */\n note?: Uint8Array | string\n /** Prevent multiple transactions with the same lease being included within the validity window.\n *\n * A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/)\n * enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).\n */\n lease?: Uint8Array | string\n /** The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. */\n staticFee?: AlgoAmount\n /** The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees. */\n extraFee?: AlgoAmount\n /** Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. */\n maxFee?: AlgoAmount\n /** How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. */\n validityWindow?: number | bigint\n /**\n * Set the first round this transaction is valid.\n * If left undefined, the value from algod will be used.\n *\n * We recommend you only set this when you intentionally want this to be some time in the future.\n */\n firstValidRound?: bigint\n /** The last round this transaction is valid. It is recommended to use `validityWindow` instead. */\n lastValidRound?: bigint\n}\n\n/** Parameters to define a payment transaction. */\nexport type PaymentParams = CommonTransactionParams & {\n /** The address of the account that will receive the Algo */\n receiver: string | Address\n /** Amount to send */\n amount: AlgoAmount\n /** If given, close the sender account and send the remaining balance to this address\n *\n * *Warning:* Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeRemainderTo?: string | Address\n}\n\n/** Parameters to define an asset create transaction.\n *\n * The account that sends this transaction will automatically be opted in to the asset and will hold all units after creation.\n */\nexport type AssetCreateParams = CommonTransactionParams & {\n /** The total amount of the smallest divisible (decimal) unit to create.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there would be 1 whole unit.\n *\n * This field can only be specified upon asset creation.\n */\n total: bigint\n\n /** The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /** Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /** 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: string | Uint8Array\n\n /** Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the `manager` the asset becomes permanently immutable.\n */\n manager?: string | Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n reserve?: string | Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n freeze?: string | Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset reconfiguration transaction.\n *\n * **Note:** The manager, reserve, freeze, and clawback addresses\n * are immutably empty if they are not set. If manager is not set then\n * all fields are immutable from that point forward.\n */\nexport type AssetConfigParams = CommonTransactionParams & {\n /** ID of the asset to reconfigure */\n assetId: bigint\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) the asset will become permanently immutable.\n */\n manager: string | Address | undefined\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n reserve?: string | Address\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n freeze?: string | Address\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset freeze transaction. */\nexport type AssetFreezeParams = CommonTransactionParams & {\n /** The ID of the asset to freeze/unfreeze */\n assetId: bigint\n /** The address of the account to freeze or unfreeze */\n account: string | Address\n /** Whether the assets in the account should be frozen */\n frozen: boolean\n}\n\n/** Parameters to define an asset destroy transaction.\n *\n * Created assets can be destroyed only by the asset manager account. All of the assets must be owned by the creator of the asset before the asset can be deleted.\n */\nexport type AssetDestroyParams = CommonTransactionParams & {\n /** ID of the asset to destroy */\n assetId: bigint\n}\n\n/** Parameters to define an asset transfer transaction. */\nexport type AssetTransferParams = CommonTransactionParams & {\n /** ID of the asset to transfer. */\n assetId: bigint\n /** Amount of the asset to transfer (in smallest divisible (decimal) units). */\n amount: bigint\n /** The address of the account that will receive the asset unit(s). */\n receiver: string | Address\n /** Optional address of an account to clawback the asset from.\n *\n * Requires the sender to be the clawback account.\n *\n * **Warning:** Be careful with this parameter as it can lead to unexpected loss of funds if not used correctly.\n */\n clawbackTarget?: string | Address\n /** Optional address of an account to close the asset position to.\n *\n * **Warning:** Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeAssetTo?: string | Address\n}\n\n/** Parameters to define an asset opt-in transaction. */\nexport type AssetOptInParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-in to. */\n assetId: bigint\n}\n\n/** Parameters to define an asset opt-out transaction. */\nexport type AssetOptOutParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-out of. */\n assetId: bigint\n /**\n * The address of the asset creator account to close the asset\n * position to (any remaining asset units will be sent to this account).\n */\n creator: string | Address\n}\n\n/** Parameters to define an online key registration transaction. */\nexport type OnlineKeyRegistrationParams = CommonTransactionParams & {\n /** The root participation public key */\n voteKey: Uint8Array\n /** The VRF public key */\n selectionKey: Uint8Array\n /** The first round that the participation key is valid. Not to be confused with the `firstValid` round of the keyreg transaction */\n voteFirst: bigint\n /** The last round that the participation key is valid. Not to be confused with the `lastValid` round of the keyreg transaction */\n voteLast: bigint\n /** This is the dilution for the 2-level participation key. It determines the interval (number of rounds) for generating new ephemeral keys */\n voteKeyDilution: bigint\n /** The 64 byte state proof public key commitment */\n stateProofKey?: Uint8Array\n}\n\n/** Parameters to define an offline key registration transaction. */\nexport type OfflineKeyRegistrationParams = CommonTransactionParams & {\n /** Prevent this account from ever participating again. The account will also no longer earn rewards */\n preventAccountFromEverParticipatingAgain?: boolean\n}\n\n/** Common parameters for defining an application call transaction. */\nexport type CommonAppCallParams = CommonTransactionParams & {\n /** ID of the application; 0 if the application is being created. */\n appId: bigint\n /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call; defaults to no-op. */\n onComplete?: algosdk.OnApplicationComplete\n /** Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). */\n args?: Uint8Array[]\n /** Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n accountReferences?: (string | Address)[]\n /** The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n appReferences?: bigint[]\n /** The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n assetReferences?: bigint[]\n /** Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays).\n *\n * Either the name identifier (which will be set against app ID of `0` i.e.\n * the current app), or a box identifier with the name identifier and app ID.\n */\n boxReferences?: (BoxReference | BoxIdentifier)[]\n}\n\n/** Parameters to define an app create transaction */\nexport type AppCreateParams = Expand<\n Omit<CommonAppCallParams, 'appId'> & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.ClearStateOC>\n /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n clearStateProgram: string | Uint8Array\n /** The state schema for the app. This is immutable once the app is created. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n }\n>\n\n/** Parameters to define an app update transaction */\nexport type AppUpdateParams = Expand<\n CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC\n /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n clearStateProgram: string | Uint8Array\n }\n>\n\n/** Parameters to define an application call transaction. */\nexport type AppCallParams = CommonAppCallParams & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.UpdateApplicationOC>\n}\n\n/** Common parameters to define an ABI method call transaction. */\nexport type AppMethodCallParams = CommonAppCallParams & {\n onComplete?: Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.ClearStateOC\n >\n}\n\n/** Parameters to define an application delete call transaction. */\nexport type AppDeleteParams = CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC\n}\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = AppMethodCall<AppCreateParams>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = AppMethodCall<AppUpdateParams>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = AppMethodCall<AppDeleteParams>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = AppMethodCall<AppMethodCallParams>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: algosdk.ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | algosdk.ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\nexport type Txn =\n | (PaymentParams & { type: 'pay' })\n | (AssetCreateParams & { type: 'assetCreate' })\n | (AssetConfigParams & { type: 'assetConfig' })\n | (AssetFreezeParams & { type: 'assetFreeze' })\n | (AssetDestroyParams & { type: 'assetDestroy' })\n | (AssetTransferParams & { type: 'assetTransfer' })\n | (AssetOptInParams & { type: 'assetOptIn' })\n | (AssetOptOutParams & { type: 'assetOptOut' })\n | ((AppCallParams | AppCreateParams | AppUpdateParams) & { type: 'appCall' })\n | ((OnlineKeyRegistrationParams | OfflineKeyRegistrationParams) & { type: 'keyReg' })\n | (algosdk.TransactionWithSigner & { type: 'txnWithSigner' })\n | { atc: algosdk.AtomicTransactionComposer; type: 'atc' }\n | ((AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall) & { type: 'methodCall' })\n\n/** Parameters to create an `TransactionComposer`. */\nexport type TransactionComposerParams = {\n /** The algod client to use to get suggestedParams and send the transaction group */\n algod: algosdk.Algodv2\n /** The function used to get the TransactionSigner for a given address */\n getSigner: (address: string | Address) => algosdk.TransactionSigner\n /** The method used to get SuggestedParams for transactions in the group */\n getSuggestedParams?: () => Promise<algosdk.SuggestedParams>\n /** How many rounds a transaction should be valid for by default; if not specified\n * then will be 10 rounds (or 1000 rounds if issuing transactions to LocalNet).\n */\n defaultValidityWindow?: bigint\n /** An existing `AppManager` to use to manage app compilation and cache compilation results.\n *\n * If not specified than an ephemeral one will be created.\n */\n appManager?: AppManager\n}\n\n/** Represents a Transaction with additional context that was used to build that transaction. */\ninterface TransactionWithContext {\n txn: Transaction\n context: {\n /* The logical max fee for the transaction, if one was supplied. */\n maxFee?: AlgoAmount\n /* The ABI method, if the app call transaction is an ABI method call. */\n abiMethod?: algosdk.ABIMethod\n }\n}\n\n/** Represents a TransactionWithSigner with additional context that was used to build that transaction. */\ntype TransactionWithSignerAndContext = algosdk.TransactionWithSigner & TransactionWithContext\n\n/** Set of transactions built by `TransactionComposer`. */\nexport interface BuiltTransactions {\n /** The built transactions */\n transactions: algosdk.Transaction[]\n /** Any `ABIMethod` objects associated with any of the transactions in a map keyed by transaction index. */\n methodCalls: Map<number, algosdk.ABIMethod>\n /** Any `TransactionSigner` objects associated with any of the transactions in a map keyed by transaction index. */\n signers: Map<number, algosdk.TransactionSigner>\n}\n\n/** TransactionComposer helps you compose and execute transactions as a transaction group. */\nexport class TransactionComposer {\n /** Signer used to represent a lack of signer */\n private static NULL_SIGNER: algosdk.TransactionSigner = algosdk.makeEmptyTransactionSigner()\n\n /** The ATC used to compose the group */\n private atc = new algosdk.AtomicTransactionComposer()\n\n /** Map of transaction index in the atc to a max logical fee.\n * This is set using the value of either maxFee or staticFee.\n */\n private txnMaxFees: Map<number, AlgoAmount> = new Map()\n\n /** Transactions that have not yet been composed */\n private txns: Txn[] = []\n\n /** The algod client used by the composer. */\n private algod: algosdk.Algodv2\n\n /** An async function that will return suggested params for the transaction. */\n private getSuggestedParams: () => Promise<algosdk.SuggestedParams>\n\n /** A function that takes in an address and return a signer function for that address. */\n private getSigner: (address: string | Address) => algosdk.TransactionSigner\n\n /** The default transaction validity window */\n private defaultValidityWindow = 10n\n\n /** Whether the validity window was explicitly set on construction */\n private defaultValidityWindowIsExplicit = false\n\n private appManager: AppManager\n\n /**\n * Create a `TransactionComposer`.\n * @param params The configuration for this composer\n * @returns The `TransactionComposer` instance\n */\n constructor(params: TransactionComposerParams) {\n this.algod = params.algod\n const defaultGetSuggestedParams = () => params.algod.getTransactionParams().do()\n this.getSuggestedParams = params.getSuggestedParams ?? defaultGetSuggestedParams\n this.getSigner = params.getSigner\n this.defaultValidityWindow = params.defaultValidityWindow ?? this.defaultValidityWindow\n this.defaultValidityWindowIsExplicit = params.defaultValidityWindow !== undefined\n this.appManager = params.appManager ?? new AppManager(params.algod)\n }\n\n /**\n * Add a pre-built transaction to the transaction group.\n * @param transaction The pre-built transaction\n * @param signer Optional signer override for the transaction\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * composer.addTransaction(txn)\n * ```\n */\n addTransaction(transaction: Transaction, signer?: TransactionSigner): TransactionComposer {\n this.txns.push({\n txn: transaction,\n signer: signer ?? this.getSigner(transaction.sender),\n type: 'txnWithSigner',\n })\n\n return this\n }\n\n /**\n * Add a payment transaction to the transaction group.\n * @param params The payment transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addPayment({\n * sender: 'SENDERADDRESS',\n * receiver: 'RECEIVERADDRESS',\n * amount: (4).algo(),\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addPayment({\n * amount: (4).algo(),\n * receiver: 'RECEIVERADDRESS',\n * sender: 'SENDERADDRESS',\n * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addPayment(params: PaymentParams): TransactionComposer {\n this.txns.push({ ...params, type: 'pay' })\n\n return this\n }\n\n /**\n * Add an asset create transaction to the transaction group.\n * @param params The asset create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetCreate({ sender: \"CREATORADDRESS\", total: 100n})\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetCreate({\n * sender: 'CREATORADDRESS',\n * total: 100n,\n * decimals: 2,\n * assetName: 'asset',\n * unitName: 'unit',\n * url: 'url',\n * metadataHash: 'metadataHash',\n * defaultFrozen: false,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetCreate(params: AssetCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetCreate' })\n\n return this\n }\n\n /**\n * Add an asset config transaction to the transaction group.\n * @param params The asset config transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetConfig({ sender: \"MANAGERADDRESS\", assetId: 123456n, manager: \"MANAGERADDRESS\" })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetConfig({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetConfig(params: AssetConfigParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetConfig' })\n\n return this\n }\n\n /**\n * Add an asset freeze transaction to the transaction group.\n * @param params The asset freeze transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetFreeze({ sender: \"MANAGERADDRESS\", assetId: 123456n, account: \"ACCOUNTADDRESS\", frozen: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetFreeze({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * account: 'ACCOUNTADDRESS',\n * frozen: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetFreeze(params: AssetFreezeParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetFreeze' })\n\n return this\n }\n\n /**\n * Add an asset destroy transaction to the transaction group.\n * @param params The asset destroy transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetDestroy({ sender: \"MANAGERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetDestroy({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetDestroy(params: AssetDestroyParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetDestroy' })\n\n return this\n }\n\n /**\n * Add an asset transfer transaction to the transaction group.\n * @param params The asset transfer transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetTransfer({ sender: \"HOLDERADDRESS\", assetId: 123456n, amount: 1n, receiver: \"RECEIVERADDRESS\" })\n * ```\n * @example Advanced example (with clawback)\n * ```typescript\n * composer.addAssetTransfer({\n * sender: 'CLAWBACKADDRESS',\n * assetId: 123456n,\n * amount: 1n,\n * receiver: 'RECEIVERADDRESS',\n * clawbackTarget: 'HOLDERADDRESS',\n * // This field needs to be used with caution\n * closeAssetTo: 'ADDRESSTOCLOSETO'\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetTransfer(params: AssetTransferParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetTransfer' })\n\n return this\n }\n\n /**\n * Add an asset opt-in transaction to the transaction group.\n * @param params The asset opt-in transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetOptIn({ sender: \"SENDERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptIn({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptIn(params: AssetOptInParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptIn' })\n\n return this\n }\n\n /**\n * Add an asset opt-out transaction to the transaction group.\n * @param params The asset opt-out transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example (without creator, will be retrieved from algod)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Basic example (with creator)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", creator: \"CREATORADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptOut({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * creator: 'CREATORADDRESS',\n * ensureZeroBalance: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptOut(params: AssetOptOutParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptOut' })\n\n return this\n }\n\n /**\n * Add an application create transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCreate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * // Signer only needed if you want to provide one,\n * // generally you'd register it with AlgorandClient\n * // against the sender and not need to pass it in\n * signer: transactionSigner,\n * maxRoundsToWaitForConfirmation: 5,\n * suppressLog: true,\n *})\n * ```\n */\n addAppCreate(params: AppCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an application update transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application update transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppUpdate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdate(params: AppUpdateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n\n return this\n }\n\n /**\n * Add an application delete transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application delete transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppDelete({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppDelete({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDelete(params: AppDeleteParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n\n return this\n }\n\n /**\n * Add an application call transaction to the transaction group.\n *\n * If you want to create or update an app use `addAppCreate` or `addAppUpdate`.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCall({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCall({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCall(params: AppCallParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an ABI method create application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI create method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCreateMethodCall(params: AppCreateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an ABI method update application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI update method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdateMethodCall(params: AppUpdateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n return this\n }\n\n /**\n * Add an ABI method delete application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI delete method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDeleteMethodCall(params: AppDeleteMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n return this\n }\n\n /**\n * Add a non-create/non-update ABI method application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCallMethodCall(params: AppCallMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an online key registration transaction to the transaction group.\n * @param params The online key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add an offline key registration transaction to the transaction group.\n * @param params The offline key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOfflineKeyRegistration(params: OfflineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add the transactions within an `AtomicTransactionComposer` to the transaction group.\n * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * const atc = new AtomicTransactionComposer()\n * .addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })\n * composer.addAtc(atc)\n * ```\n */\n addAtc(atc: algosdk.AtomicTransactionComposer): TransactionComposer {\n this.txns.push({ atc, type: 'atc' })\n return this\n }\n\n /** Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing */\n private buildAtc(atc: algosdk.AtomicTransactionComposer): TransactionWithSignerAndContext[] {\n const group = atc.buildGroup()\n\n const txnWithSigners = group.map((ts, idx) => {\n // Remove underlying group ID from the transaction since it will be re-grouped when this TransactionComposer is built\n ts.txn.group = undefined\n // If this was a method call return the ABIMethod for later\n if (atc['methodCalls'].get(idx)) {\n return {\n ...ts,\n context: { abiMethod: atc['methodCalls'].get(idx) as algosdk.ABIMethod },\n }\n }\n return {\n ...ts,\n context: {},\n }\n })\n\n return txnWithSigners\n }\n\n private commonTxnBuildStep<TParams extends algosdk.CommonTransactionParams>(\n buildTxn: (params: TParams) => Transaction,\n params: CommonTransactionParams,\n txnParams: TParams,\n ): TransactionWithContext {\n // We are going to mutate suggested params, let's create a clone first\n txnParams.suggestedParams = { ...txnParams.suggestedParams }\n\n if (params.lease) txnParams.lease = encodeLease(params.lease)! satisfies algosdk.Transaction['lease']\n if (params.rekeyTo) txnParams.rekeyTo = address(params.rekeyTo) satisfies algosdk.Transaction['rekeyTo']\n const encoder = new TextEncoder()\n if (params.note)\n txnParams.note = (typeof params.note === 'string' ? encoder.encode(params.note) : params.note) satisfies algosdk.Transaction['note']\n\n if (params.firstValidRound) {\n txnParams.suggestedParams.firstValid = params.firstValidRound\n }\n\n if (params.lastValidRound) {\n txnParams.suggestedParams.lastValid = params.lastValidRound\n } else {\n // If the validity window isn't set in this transaction or by default and we are pointing at\n // LocalNet set a bigger window to avoid dead transactions\n const window = params.validityWindow\n ? BigInt(params.validityWindow)\n : !this.defaultValidityWindowIsExplicit && genesisIdIsLocalNet(txnParams.suggestedParams.genesisID ?? 'unknown')\n ? 1000n\n : this.defaultValidityWindow\n txnParams.suggestedParams.lastValid = BigInt(txnParams.suggestedParams.firstValid) + window\n }\n\n if (params.staticFee !== undefined && params.extraFee !== undefined) {\n throw Error('Cannot set both staticFee and extraFee')\n }\n\n if (params.staticFee !== undefined) {\n txnParams.suggestedParams.fee = params.staticFee.microAlgo\n txnParams.suggestedParams.flatFee = true\n }\n\n const txn = buildTxn(txnParams)\n\n if (params.extraFee) txn.fee += params.extraFee.microAlgo\n if (params.maxFee !== undefined && txn.fee > params.maxFee.microAlgo) {\n throw Error(`Transaction fee ${txn.fee} µALGO is greater than maxFee ${params.maxFee}`)\n }\n\n const logicalMaxFee =\n params.maxFee !== undefined && params.maxFee.microAlgo > (params.staticFee?.microAlgo ?? 0n) ? params.maxFee : params.staticFee\n\n return { txn, context: { maxFee: logicalMaxFee } }\n }\n\n /**\n * Builds an ABI method call transaction and any other associated transactions represented in the ABI args.\n * @param includeSigner Whether to include the actual signer for the transactions.\n * If you are just building transactions without signers yet then set this to `false`.\n */\n private async buildMethodCall(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall,\n suggestedParams: algosdk.SuggestedParams,\n includeSigner: boolean,\n ): Promise<TransactionWithSignerAndContext[]> {\n const methodArgs: (algosdk.ABIArgument | TransactionWithSignerAndContext)[] = []\n const transactionsForGroup: TransactionWithSignerAndContext[] = []\n\n const isAbiValue = (x: unknown): x is algosdk.ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array\n }\n\n for (let i = (params.args ?? []).length - 1; i >= 0; i--) {\n const arg = params.args![i]\n if (arg === undefined) {\n // An undefined transaction argument signals that the value will be supplied by a method call argument\n if (algosdk.abiTypeIsTransaction(params.method.args[i].type) && transactionsForGroup.length > 0) {\n // Move the last transaction from the group to the method call arguments to appease algosdk\n const placeholderTransaction = transactionsForGroup.splice(-1, 1)[0]\n methodArgs.push(placeholderTransaction)\n continue\n }\n\n throw Error(`No value provided for argument ${i + 1} within call to ${params.method.name}`)\n }\n\n if (isAbiValue(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if (isTransactionWithSigner(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if ('method' in arg) {\n const tempTxnWithSigners = await this.buildMethodCall(arg, suggestedParams, includeSigner)\n // If there is any transaction args, add to the atc\n // Everything else should be added as method args\n\n methodArgs.push(...tempTxnWithSigners.slice(-1)) // Add the method call itself as a method arg\n transactionsForGroup.push(...tempTxnWithSigners.slice(0, -1).reverse()) // Add any transaction arguments to the atc\n continue\n }\n\n const txn = await arg\n methodArgs.push({\n txn,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(txn.sender)\n : TransactionComposer.NULL_SIGNER,\n })\n }\n\n const methodAtc = new algosdk.AtomicTransactionComposer()\n const maxFees = new Map<number, AlgoAmount>()\n\n transactionsForGroup.reverse().forEach(({ context, ...txnWithSigner }) => {\n methodAtc.addTransaction(txnWithSigner)\n const atcIndex = methodAtc.count() - 1\n if (context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, context.abiMethod)\n }\n if (context.maxFee !== undefined) {\n maxFees.set(atcIndex, context.maxFee)\n }\n })\n\n // If any of the args are method call transactions, add that info to the methodAtc\n methodArgs\n .filter((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return isTransactionWithSigner(txnWithSigner)\n }\n return isTransactionWithSigner(arg)\n })\n .reverse()\n .forEach((arg, idx) => {\n if (typeof arg === 'object' && 'context' in arg && arg.context) {\n const atcIndex = methodAtc.count() + idx\n if (arg.context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, arg.context.abiMethod)\n }\n if (arg.context.maxFee !== undefined) {\n maxFees.set(atcIndex, arg.context.maxFee)\n }\n }\n })\n\n const appId = Number('appId' in params ? params.appId : 0n)\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const txnParams = {\n appID: appId,\n sender: params.sender,\n suggestedParams,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n appAccounts: params.accountReferences,\n appForeignApps: params.appReferences?.map((x) => Number(x)),\n appForeignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n extraPages:\n appId === 0\n ? 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : approvalProgram\n ? calculateExtraProgramPages(approvalProgram, clearStateProgram)\n : 0\n : undefined,\n numLocalInts: appId === 0 ? ('schema' in params ? (params.schema?.localInts ?? 0) : 0) : undefined,\n numLocalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.localByteSlices ?? 0) : 0) : undefined,\n numGlobalInts: appId === 0 ? ('schema' in params ? (params.schema?.globalInts ?? 0) : 0) : undefined,\n numGlobalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0) : undefined,\n method: params.method,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(params.sender)\n : TransactionComposer.NULL_SIGNER,\n methodArgs: methodArgs\n .map((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return txnWithSigner\n }\n return arg\n })\n .reverse(),\n // note, lease, and rekeyTo are set in the common build step\n note: undefined,\n lease: undefined,\n rekeyTo: undefined,\n }\n\n // Build the transaction\n const result = this.commonTxnBuildStep(\n (txnParams) => {\n methodAtc.addMethodCall(txnParams)\n return methodAtc.buildGroup()[methodAtc.count() - 1].txn\n },\n params,\n txnParams,\n )\n\n // Process the ATC to get a set of transactions ready for broader grouping\n return this.buildAtc(methodAtc).map(({ context: _context, ...txnWithSigner }, idx) => {\n const maxFee = idx === methodAtc.count() - 1 ? result.context.maxFee : maxFees.get(idx)\n const context = {\n ..._context, // Adds method context info\n maxFee,\n }\n\n return {\n ...txnWithSigner,\n context,\n }\n })\n }\n\n private buildPayment(params: PaymentParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makePaymentTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n amount: params.amount.microAlgo,\n closeRemainderTo: params.closeRemainderTo,\n suggestedParams,\n })\n }\n\n private buildAssetCreate(params: AssetCreateParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n total: params.total,\n decimals: params.decimals ?? 0,\n assetName: params.assetName,\n unitName: params.unitName,\n assetURL: params.url,\n defaultFrozen: params.defaultFrozen ?? false,\n assetMetadataHash: typeof params.metadataHash === 'string' ? Buffer.from(params.metadataHash, 'utf-8') : params.metadataHash,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n suggestedParams,\n })\n }\n\n private buildAssetConfig(params: AssetConfigParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n strictEmptyAddressChecking: false,\n })\n }\n\n private buildAssetDestroy(params: AssetDestroyParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n })\n }\n\n private buildAssetFreeze(params: AssetFreezeParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetFreezeTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n freezeTarget: params.account,\n frozen: params.frozen,\n suggestedParams,\n })\n }\n\n private buildAssetTransfer(params: AssetTransferParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n assetIndex: params.assetId,\n amount: params.amount,\n suggestedParams,\n closeRemainderTo: params.closeAssetTo,\n assetSender: params.clawbackTarget,\n })\n }\n\n private async buildAppCall(params: AppCallParams | AppUpdateParams | AppCreateParams, suggestedParams: algosdk.SuggestedParams) {\n const appId = 'appId' in params ? params.appId : 0n\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const sdkParams = {\n sender: params.sender,\n suggestedParams,\n appArgs: params.args,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n accounts: params.accountReferences,\n foreignApps: params.appReferences?.map((x) => Number(x)),\n foreignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n }\n\n if (appId === 0n) {\n if (sdkParams.approvalProgram === undefined || sdkParams.clearProgram === undefined) {\n throw new Error('approvalProgram and clearStateProgram are required for application creation')\n }\n\n return this.commonTxnBuildStep(algosdk.makeApplicationCreateTxnFromObject, params, {\n ...sdkParams,\n extraPages:\n 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : calculateExtraProgramPages(approvalProgram!, clearStateProgram!),\n numLocalInts: 'schema' in params ? (params.schema?.localInts ?? 0) : 0,\n numLocalByteSlices: 'schema' in params ? (params.schema?.localByteSlices ?? 0) : 0,\n numGlobalInts: 'schema' in params ? (params.schema?.globalInts ?? 0) : 0,\n numGlobalByteSlices: 'schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0,\n approvalProgram: approvalProgram!,\n clearProgram: clearStateProgram!,\n })\n } else {\n return this.commonTxnBuildStep(algosdk.makeApplicationCallTxnFromObject, params, { ...sdkParams, appIndex: appId })\n }\n }\n\n private buildKeyReg(params: OnlineKeyRegistrationParams | OfflineKeyRegistrationParams, suggestedParams: algosdk.SuggestedParams) {\n if ('voteKey' in params) {\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n voteKey: params.voteKey,\n selectionKey: params.selectionKey,\n voteFirst: params.voteFirst,\n voteLast: params.voteLast,\n voteKeyDilution: params.voteKeyDilution,\n suggestedParams,\n nonParticipation: false,\n stateProofKey: params.stateProofKey,\n })\n }\n\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n suggestedParams,\n nonParticipation: params.preventAccountFromEverParticipatingAgain,\n })\n }\n\n /** Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. */\n private async buildTxn(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithContext[]> {\n switch (txn.type) {\n case 'pay':\n return [this.buildPayment(txn, suggestedParams)]\n case 'assetCreate':\n return [this.buildAssetCreate(txn, suggestedParams)]\n case 'appCall':\n return [await this.buildAppCall(txn, suggestedParams)]\n case 'assetConfig':\n return [this.buildAssetConfig(txn, suggestedParams)]\n case 'assetDestroy':\n return [this.buildAssetDestroy(txn, suggestedParams)]\n case 'assetFreeze':\n return [this.buildAssetFreeze(txn, suggestedParams)]\n case 'assetTransfer':\n return [this.buildAssetTransfer(txn, suggestedParams)]\n case 'assetOptIn':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n }, suggestedParams)]\n case 'assetOptOut':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n, closeAssetTo: txn.creator }, suggestedParams)]\n case 'keyReg':\n return [this.buildKeyReg(txn, suggestedParams)]\n default:\n throw Error(`Unsupported txn type`)\n }\n }\n\n private async buildTxnWithSigner(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithSignerAndContext[]> {\n if (txn.type === 'txnWithSigner') {\n return [\n {\n ...txn,\n context: {},\n },\n ]\n }\n\n if (txn.type === 'atc') {\n return this.buildAtc(txn.atc)\n }\n\n if (txn.type === 'methodCall') {\n return await this.buildMethodCall(txn, suggestedParams, true)\n }\n\n const signer = txn.signer ? ('signer' in txn.signer ? txn.signer.signer : txn.signer) : this.getSigner(txn.sender)\n\n return (await this.buildTxn(txn, suggestedParams)).map(({ txn, context }) => ({ txn, signer, context }))\n }\n\n /**\n * Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls.\n *\n * @returns The array of built transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { transactions, methodCalls, signers } = await composer.buildTransactions()\n * ```\n */\n async buildTransactions(): Promise<BuiltTransactions> {\n const suggestedParams = await this.getSuggestedParams()\n\n const transactions: algosdk.Transaction[] = []\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n const signers = new Map<number, algosdk.TransactionSigner>()\n\n for (const txn of this.txns) {\n if (!['txnWithSigner', 'atc', 'methodCall'].includes(txn.type)) {\n transactions.push(...(await this.buildTxn(txn, suggestedParams)).map((txn) => txn.txn))\n } else {\n const transactionsWithSigner =\n txn.type === 'txnWithSigner'\n ? [txn]\n : txn.type === 'atc'\n ? this.buildAtc(txn.atc)\n : txn.type === 'methodCall'\n ? await this.buildMethodCall(txn, suggestedParams, false)\n : []\n\n transactionsWithSigner.forEach((ts, idx) => {\n transactions.push(ts.txn)\n\n if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {\n signers.set(idx, ts.signer)\n }\n if ('context' in ts && ts.context.abiMethod) {\n methodCalls.set(idx, ts.context.abiMethod)\n }\n })\n }\n }\n\n return { transactions, methodCalls, signers }\n }\n\n /**\n * Get the number of transactions currently added to this composer.\n * @returns The number of transactions currently added to this composer\n */\n async count() {\n return (await this.buildTransactions()).transactions.length\n }\n\n /**\n * Compose all of the transactions in a single atomic transaction group and an atomic transaction composer.\n *\n * You can then use the transactions standalone, or use the composer to execute or simulate the transactions.\n *\n * Once this method is called, no further transactions will be able to be added.\n * You can safely call this method multiple times to get the same result.\n * @returns The built atomic transaction composer, the transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.build()\n * ```\n */\n async build() {\n if (this.atc.getStatus() === algosdk.AtomicTransactionComposerStatus.BUILDING) {\n const suggestedParams = await this.getSuggestedParams()\n\n // Build all of the transactions\n const txnWithSigners: TransactionWithSignerAndContext[] = []\n for (const txn of this.txns) {\n txnWithSigners.push(...(await this.buildTxnWithSigner(txn, suggestedParams)))\n }\n\n // Add all of the transactions to the underlying ATC\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n txnWithSigners.forEach(({ context, ...ts }, idx) => {\n this.atc.addTransaction(ts)\n\n // Populate consolidated set of all ABI method calls\n if (context.abiMethod) {\n methodCalls.set(idx, context.abiMethod)\n }\n\n if (context.maxFee !== undefined) {\n this.txnMaxFees.set(idx, context.maxFee)\n }\n })\n this.atc['methodCalls'] = methodCalls\n }\n\n return { atc: this.atc, transactions: this.atc.buildGroup(), methodCalls: this.atc['methodCalls'] }\n }\n\n /**\n * Rebuild the group, discarding any previously built transactions.\n * This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.\n * @returns The newly built atomic transaction composer and the transactions\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.rebuild()\n * ```\n */\n async rebuild() {\n this.atc = new algosdk.AtomicTransactionComposer()\n return await this.build()\n }\n\n /**\n * Compose the atomic transaction group and send it to the network.\n * @param params The parameters to control execution with\n * @returns The execution result\n * @example\n * ```typescript\n * const result = await composer.send({\n * populateAppCallResources: true,\n * })\n * ```\n */\n async send(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n const group = (await this.build()).transactions\n\n let waitRounds = params?.maxRoundsToWaitForConfirmation\n\n const suggestedParams =\n waitRounds === undefined || params?.coverAppCallInnerTransactionFees ? await this.getSuggestedParams() : undefined\n\n if (waitRounds === undefined) {\n const lastRound = group.reduce((max, txn) => (txn.txn.lastValid > max ? txn.txn.lastValid : BigInt(max)), 0n)\n const { firstValid: firstRound } = suggestedParams!\n waitRounds = Number(BigInt(lastRound) - BigInt(firstRound)) + 1\n }\n\n return await sendAtomicTransactionComposer(\n {\n atc: this.atc,\n suppressLog: params?.suppressLog,\n maxRoundsToWaitForConfirmation: waitRounds,\n populateAppCallResources: params?.populateAppCallResources,\n coverAppCallInnerTransactionFees: params?.coverAppCallInnerTransactionFees,\n additionalAtcContext: params?.coverAppCallInnerTransactionFees\n ? {\n maxFees: this.txnMaxFees,\n suggestedParams: suggestedParams!,\n }\n : undefined,\n },\n this.algod,\n )\n }\n\n /**\n * @deprecated Use `send` instead.\n *\n * Compose the atomic transaction group and send it to the network\n *\n * An alias for `composer.send(params)`.\n * @param params The parameters to control execution with\n * @returns The execution result\n */\n async execute(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n return this.send(params)\n }\n\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate()\n * ```\n */\n async simulate(): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * skipSignatures: true,\n * })\n * ```\n */\n async simulate(\n options: SkipSignaturesSimulateOptions,\n ): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * extraOpcodeBudget: 1000,\n * })\n * ```\n */\n async simulate(options: RawSimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n async simulate(options?: SimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }> {\n const { skipSignatures = false, ...rawOptions } = options ?? {}\n const atc = skipSignatures ? new AtomicTransactionComposer() : this.atc\n\n // Build the transactions\n if (skipSignatures) {\n rawOptions.allowEmptySignatures = true\n rawOptions.fixSigners = true\n // Build transactions uses empty signers\n const transactions = await this.buildTransactions()\n for (const txn of transactions.transactions) {\n atc.addTransaction({ txn, signer: TransactionComposer.NULL_SIGNER })\n }\n atc['methodCalls'] = transactions.methodCalls\n } else {\n // Build creates real signatures\n await this.build()\n }\n\n const { methodResults, simulateResponse } = await atc.simulate(\n this.algod,\n new modelsv2.SimulateRequest({\n txnGroups: [],\n ...rawOptions,\n ...(Config.debug\n ? {\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: new modelsv2.SimulateTraceConfig({\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n }),\n }\n : undefined),\n }),\n )\n\n const failedGroup = simulateResponse?.txnGroups[0]\n if (failedGroup?.failureMessage) {\n const errorMessage = `Transaction failed at transaction(s) ${failedGroup.failedAt?.join(', ') || 'unknown'} in the group. ${failedGroup.failureMessage}`\n const error = new Error(errorMessage)\n\n if (Config.debug) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(error as any).simulateResponse = simulateResponse\n throw error\n }\n\n if (Config.debug && Config.traceAll) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n const transactions = atc.buildGroup().map((t) => t.txn)\n return {\n confirmations: simulateResponse.txnGroups[0].txnResults.map((t) => t.txnResult),\n transactions: transactions,\n txIds: transactions.map((t) => t.txID()),\n groupId: Buffer.from(transactions[0].group ?? new Uint8Array()).toString('base64'),\n simulateResponse,\n returns: methodResults.map(getABIReturnValue),\n }\n }\n\n /**\n * Create an encoded transaction note that follows the ARC-2 spec.\n *\n * https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md\n * @param note The ARC-2 transaction note data\n * @returns The binary encoded transaction note\n */\n static arc2Note(note: Arc2TransactionNote): Uint8Array {\n const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : asJson(note.data)}`\n const encoder = new TextEncoder()\n return encoder.encode(arc2Payload)\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAWA,IAAO,yBAAyB,GAAG,OAAO,CAAC,yBAAyB;AAIpE,IAAO,uBAAuB,GAAG,OAAO,CAAC,uBAAuB;AAEhE,IAAO,QAAQ,GAAG,OA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AAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACrH,QAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;;;AAtiDpC;AACe,mBAAA,CAAA,WAAW,GAA8B,OAAO,CAAC,0BAA0B,EAAE;;;;"}
1
+ {"version":3,"file":"composer.mjs","sources":["../../src/types/composer.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { Config } from '../config'\nimport { encodeLease, getABIReturnValue, sendAtomicTransactionComposer } from '../transaction/transaction'\nimport { asJson, calculateExtraProgramPages } from '../util'\nimport { TransactionSignerAccount } from './account'\nimport { AlgoAmount } from './amount'\nimport { AppManager, BoxIdentifier, BoxReference } from './app-manager'\nimport { Expand } from './expand'\nimport { EventType } from './lifecycle-events'\nimport { genesisIdIsLocalNet } from './network-client'\nimport { Arc2TransactionNote, SendAtomicTransactionComposerResults, SendParams } from './transaction'\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\nimport TransactionWithSigner = algosdk.TransactionWithSigner\nimport isTransactionWithSigner = algosdk.isTransactionWithSigner\nimport SimulateResponse = algosdk.modelsv2.SimulateResponse\nimport modelsv2 = algosdk.modelsv2\n\nconst address = (address: string | Address): Address => {\n return typeof address === 'string' ? Address.fromString(address) : address\n}\n\nexport const MAX_TRANSACTION_GROUP_SIZE = 16\n\n/** Options to control a simulate request, that does not require transaction signing */\nexport type SkipSignaturesSimulateOptions = Expand<\n Omit<RawSimulateOptions, 'fixSigners' | 'allowEmptySignatures'> & {\n /** Whether or not to skip signatures for all built transactions and use an empty signer instead.\n * This will set `fixSigners` and `allowEmptySignatures` when sending the request to the algod API.\n */\n skipSignatures: boolean\n }\n>\n\n/** The raw API options to control a simulate request.\n * See algod API docs for more information: https://developer.algorand.org/docs/rest-apis/algod/#simulaterequest\n */\nexport type RawSimulateOptions = Expand<Omit<ConstructorParameters<typeof modelsv2.SimulateRequest>[0], 'txnGroups'>>\n\n/** All options to control a simulate request */\nexport type SimulateOptions = Expand<Partial<SkipSignaturesSimulateOptions> & RawSimulateOptions>\n\n/** Common parameters for defining a transaction. */\nexport type CommonTransactionParams = {\n /** The address of the account sending the transaction. */\n sender: string | Address\n /** The function used to sign transaction(s); if not specified then\n * an attempt will be made to find a registered signer for the\n * given `sender` or use a default signer (if configured).\n */\n signer?: algosdk.TransactionSigner | TransactionSignerAccount\n /** Change the signing key of the sender to the given address.\n *\n * **Warning:** Please be careful with this parameter and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n */\n rekeyTo?: string | Address\n /** Note to attach to the transaction. Max of 1000 bytes. */\n note?: Uint8Array | string\n /** Prevent multiple transactions with the same lease being included within the validity window.\n *\n * A [lease](https://developer.algorand.org/articles/leased-transactions-securing-advanced-smart-contract-design/)\n * enforces a mutually exclusive transaction (useful to prevent double-posting and other scenarios).\n */\n lease?: Uint8Array | string\n /** The static transaction fee. In most cases you want to use `extraFee` unless setting the fee to 0 to be covered by another transaction. */\n staticFee?: AlgoAmount\n /** The fee to pay IN ADDITION to the suggested fee. Useful for manually covering inner transaction fees. */\n extraFee?: AlgoAmount\n /** Throw an error if the fee for the transaction is more than this amount; prevents overspending on fees during high congestion periods. */\n maxFee?: AlgoAmount\n /** How many rounds the transaction should be valid for, if not specified then the registered default validity window will be used. */\n validityWindow?: number | bigint\n /**\n * Set the first round this transaction is valid.\n * If left undefined, the value from algod will be used.\n *\n * We recommend you only set this when you intentionally want this to be some time in the future.\n */\n firstValidRound?: bigint\n /** The last round this transaction is valid. It is recommended to use `validityWindow` instead. */\n lastValidRound?: bigint\n}\n\n/** Parameters to define a payment transaction. */\nexport type PaymentParams = CommonTransactionParams & {\n /** The address of the account that will receive the Algo */\n receiver: string | Address\n /** Amount to send */\n amount: AlgoAmount\n /** If given, close the sender account and send the remaining balance to this address\n *\n * *Warning:* Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeRemainderTo?: string | Address\n}\n\n/** Parameters to define an asset create transaction.\n *\n * The account that sends this transaction will automatically be opted in to the asset and will hold all units after creation.\n */\nexport type AssetCreateParams = CommonTransactionParams & {\n /** The total amount of the smallest divisible (decimal) unit to create.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there would be 1 whole unit.\n *\n * This field can only be specified upon asset creation.\n */\n total: bigint\n\n /** The amount of decimal places the asset should have.\n *\n * If unspecified then the asset will be in whole units (i.e. `0`).\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n *\n * This field can only be specified upon asset creation.\n */\n decimals?: number\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n assetName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n unitName?: string\n\n /** Specifies an optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n *\n * This field can only be specified upon asset creation.\n */\n url?: string\n\n /** 32-byte hash of some metadata that is relevant to your asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n *\n * This field can only be specified upon asset creation.\n */\n metadataHash?: string | Uint8Array\n\n /** Whether the asset is frozen by default for all accounts.\n * Defaults to `false`.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account, which must be set on creation.\n *\n * This field can only be specified upon asset creation.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the `manager` the asset becomes permanently immutable.\n */\n manager?: string | Address\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n reserve?: string | Address\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n freeze?: string | Address\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) at asset creation or subsequently set to empty by the manager the field is permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset reconfiguration transaction.\n *\n * **Note:** The manager, reserve, freeze, and clawback addresses\n * are immutably empty if they are not set. If manager is not set then\n * all fields are immutable from that point forward.\n */\nexport type AssetConfigParams = CommonTransactionParams & {\n /** ID of the asset to reconfigure */\n assetId: bigint\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * The configuration fields it can change are `manager`, `reserve`, `clawback`, and `freeze`.\n *\n * If not set (`undefined` or `\"\"`) the asset will become permanently immutable.\n */\n manager: string | Address | undefined\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n reserve?: string | Address\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n freeze?: string | Address\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * **This field should be used with caution** as the clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set (`undefined` or `\"\"`) the field will become permanently empty.\n */\n clawback?: string | Address\n}\n\n/** Parameters to define an asset freeze transaction. */\nexport type AssetFreezeParams = CommonTransactionParams & {\n /** The ID of the asset to freeze/unfreeze */\n assetId: bigint\n /** The address of the account to freeze or unfreeze */\n account: string | Address\n /** Whether the assets in the account should be frozen */\n frozen: boolean\n}\n\n/** Parameters to define an asset destroy transaction.\n *\n * Created assets can be destroyed only by the asset manager account. All of the assets must be owned by the creator of the asset before the asset can be deleted.\n */\nexport type AssetDestroyParams = CommonTransactionParams & {\n /** ID of the asset to destroy */\n assetId: bigint\n}\n\n/** Parameters to define an asset transfer transaction. */\nexport type AssetTransferParams = CommonTransactionParams & {\n /** ID of the asset to transfer. */\n assetId: bigint\n /** Amount of the asset to transfer (in smallest divisible (decimal) units). */\n amount: bigint\n /** The address of the account that will receive the asset unit(s). */\n receiver: string | Address\n /** Optional address of an account to clawback the asset from.\n *\n * Requires the sender to be the clawback account.\n *\n * **Warning:** Be careful with this parameter as it can lead to unexpected loss of funds if not used correctly.\n */\n clawbackTarget?: string | Address\n /** Optional address of an account to close the asset position to.\n *\n * **Warning:** Be careful with this parameter as it can lead to loss of funds if not used correctly.\n */\n closeAssetTo?: string | Address\n}\n\n/** Parameters to define an asset opt-in transaction. */\nexport type AssetOptInParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-in to. */\n assetId: bigint\n}\n\n/** Parameters to define an asset opt-out transaction. */\nexport type AssetOptOutParams = CommonTransactionParams & {\n /** ID of the asset that will be opted-out of. */\n assetId: bigint\n /**\n * The address of the asset creator account to close the asset\n * position to (any remaining asset units will be sent to this account).\n */\n creator: string | Address\n}\n\n/** Parameters to define an online key registration transaction. */\nexport type OnlineKeyRegistrationParams = CommonTransactionParams & {\n /** The root participation public key */\n voteKey: Uint8Array\n /** The VRF public key */\n selectionKey: Uint8Array\n /** The first round that the participation key is valid. Not to be confused with the `firstValid` round of the keyreg transaction */\n voteFirst: bigint\n /** The last round that the participation key is valid. Not to be confused with the `lastValid` round of the keyreg transaction */\n voteLast: bigint\n /** This is the dilution for the 2-level participation key. It determines the interval (number of rounds) for generating new ephemeral keys */\n voteKeyDilution: bigint\n /** The 64 byte state proof public key commitment */\n stateProofKey?: Uint8Array\n}\n\n/** Parameters to define an offline key registration transaction. */\nexport type OfflineKeyRegistrationParams = CommonTransactionParams & {\n /** Prevent this account from ever participating again. The account will also no longer earn rewards */\n preventAccountFromEverParticipatingAgain?: boolean\n}\n\n/** Common parameters for defining an application call transaction. */\nexport type CommonAppCallParams = CommonTransactionParams & {\n /** ID of the application; 0 if the application is being created. */\n appId: bigint\n /** The [on-complete](https://developer.algorand.org/docs/get-details/dapps/avm/teal/specification/#oncomplete) action of the call; defaults to no-op. */\n onComplete?: algosdk.OnApplicationComplete\n /** Any [arguments to pass to the smart contract call](https://developer.algorand.org/docs/get-details/dapps/avm/teal/#argument-passing). */\n args?: Uint8Array[]\n /** Any account addresses to add to the [accounts array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n accountReferences?: (string | Address)[]\n /** The ID of any apps to load to the [foreign apps array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n appReferences?: bigint[]\n /** The ID of any assets to load to the [foreign assets array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays). */\n assetReferences?: bigint[]\n /** Any boxes to load to the [boxes array](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#reference-arrays).\n *\n * Either the name identifier (which will be set against app ID of `0` i.e.\n * the current app), or a box identifier with the name identifier and app ID.\n */\n boxReferences?: (BoxReference | BoxIdentifier)[]\n}\n\n/** Parameters to define an app create transaction */\nexport type AppCreateParams = Expand<\n Omit<CommonAppCallParams, 'appId'> & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.ClearStateOC>\n /** The program to execute for all OnCompletes other than ClearState as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal that will be compiled (string) or compiled teal (encoded as a byte array (Uint8Array)). */\n clearStateProgram: string | Uint8Array\n /** The state schema for the app. This is immutable once the app is created. */\n schema?: {\n /** The number of integers saved in global state. */\n globalInts: number\n /** The number of byte slices saved in global state. */\n globalByteSlices: number\n /** The number of integers saved in local state. */\n localInts: number\n /** The number of byte slices saved in local state. */\n localByteSlices: number\n }\n /** Number of extra pages required for the programs.\n * Defaults to the number needed for the programs in this call if not specified.\n * This is immutable once the app is created. */\n extraProgramPages?: number\n }\n>\n\n/** Parameters to define an app update transaction */\nexport type AppUpdateParams = Expand<\n CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC\n /** The program to execute for all OnCompletes other than ClearState as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n approvalProgram: string | Uint8Array\n /** The program to execute for ClearState OnComplete as raw teal (string) or compiled teal (base 64 encoded as a byte array (Uint8Array)) */\n clearStateProgram: string | Uint8Array\n }\n>\n\n/** Parameters to define an application call transaction. */\nexport type AppCallParams = CommonAppCallParams & {\n onComplete?: Exclude<algosdk.OnApplicationComplete, algosdk.OnApplicationComplete.UpdateApplicationOC>\n}\n\n/** Common parameters to define an ABI method call transaction. */\nexport type AppMethodCallParams = CommonAppCallParams & {\n onComplete?: Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.UpdateApplicationOC | algosdk.OnApplicationComplete.ClearStateOC\n >\n}\n\n/** Parameters to define an application delete call transaction. */\nexport type AppDeleteParams = CommonAppCallParams & {\n onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC\n}\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = AppMethodCall<AppCreateParams>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = AppMethodCall<AppUpdateParams>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = AppMethodCall<AppDeleteParams>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = AppMethodCall<AppMethodCallParams>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: algosdk.ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | algosdk.ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\nexport type Txn =\n | (PaymentParams & { type: 'pay' })\n | (AssetCreateParams & { type: 'assetCreate' })\n | (AssetConfigParams & { type: 'assetConfig' })\n | (AssetFreezeParams & { type: 'assetFreeze' })\n | (AssetDestroyParams & { type: 'assetDestroy' })\n | (AssetTransferParams & { type: 'assetTransfer' })\n | (AssetOptInParams & { type: 'assetOptIn' })\n | (AssetOptOutParams & { type: 'assetOptOut' })\n | ((AppCallParams | AppCreateParams | AppUpdateParams) & { type: 'appCall' })\n | ((OnlineKeyRegistrationParams | OfflineKeyRegistrationParams) & { type: 'keyReg' })\n | (algosdk.TransactionWithSigner & { type: 'txnWithSigner' })\n | { atc: algosdk.AtomicTransactionComposer; type: 'atc' }\n | ((AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall) & { type: 'methodCall' })\n\n/** Parameters to create an `TransactionComposer`. */\nexport type TransactionComposerParams = {\n /** The algod client to use to get suggestedParams and send the transaction group */\n algod: algosdk.Algodv2\n /** The function used to get the TransactionSigner for a given address */\n getSigner: (address: string | Address) => algosdk.TransactionSigner\n /** The method used to get SuggestedParams for transactions in the group */\n getSuggestedParams?: () => Promise<algosdk.SuggestedParams>\n /** How many rounds a transaction should be valid for by default; if not specified\n * then will be 10 rounds (or 1000 rounds if issuing transactions to LocalNet).\n */\n defaultValidityWindow?: bigint\n /** An existing `AppManager` to use to manage app compilation and cache compilation results.\n *\n * If not specified than an ephemeral one will be created.\n */\n appManager?: AppManager\n}\n\n/** Represents a Transaction with additional context that was used to build that transaction. */\ninterface TransactionWithContext {\n txn: Transaction\n context: {\n /* The logical max fee for the transaction, if one was supplied. */\n maxFee?: AlgoAmount\n /* The ABI method, if the app call transaction is an ABI method call. */\n abiMethod?: algosdk.ABIMethod\n }\n}\n\n/** Represents a TransactionWithSigner with additional context that was used to build that transaction. */\ntype TransactionWithSignerAndContext = algosdk.TransactionWithSigner & TransactionWithContext\n\n/** Set of transactions built by `TransactionComposer`. */\nexport interface BuiltTransactions {\n /** The built transactions */\n transactions: algosdk.Transaction[]\n /** Any `ABIMethod` objects associated with any of the transactions in a map keyed by transaction index. */\n methodCalls: Map<number, algosdk.ABIMethod>\n /** Any `TransactionSigner` objects associated with any of the transactions in a map keyed by transaction index. */\n signers: Map<number, algosdk.TransactionSigner>\n}\n\n/** TransactionComposer helps you compose and execute transactions as a transaction group. */\nexport class TransactionComposer {\n /** Signer used to represent a lack of signer */\n private static NULL_SIGNER: algosdk.TransactionSigner = algosdk.makeEmptyTransactionSigner()\n\n /** The ATC used to compose the group */\n private atc = new algosdk.AtomicTransactionComposer()\n\n /** Map of transaction index in the atc to a max logical fee.\n * This is set using the value of either maxFee or staticFee.\n */\n private txnMaxFees: Map<number, AlgoAmount> = new Map()\n\n /** Transactions that have not yet been composed */\n private txns: Txn[] = []\n\n /** The algod client used by the composer. */\n private algod: algosdk.Algodv2\n\n /** An async function that will return suggested params for the transaction. */\n private getSuggestedParams: () => Promise<algosdk.SuggestedParams>\n\n /** A function that takes in an address and return a signer function for that address. */\n private getSigner: (address: string | Address) => algosdk.TransactionSigner\n\n /** The default transaction validity window */\n private defaultValidityWindow = 10n\n\n /** Whether the validity window was explicitly set on construction */\n private defaultValidityWindowIsExplicit = false\n\n private appManager: AppManager\n\n /**\n * Create a `TransactionComposer`.\n * @param params The configuration for this composer\n * @returns The `TransactionComposer` instance\n */\n constructor(params: TransactionComposerParams) {\n this.algod = params.algod\n const defaultGetSuggestedParams = () => params.algod.getTransactionParams().do()\n this.getSuggestedParams = params.getSuggestedParams ?? defaultGetSuggestedParams\n this.getSigner = params.getSigner\n this.defaultValidityWindow = params.defaultValidityWindow ?? this.defaultValidityWindow\n this.defaultValidityWindowIsExplicit = params.defaultValidityWindow !== undefined\n this.appManager = params.appManager ?? new AppManager(params.algod)\n }\n\n /**\n * Add a pre-built transaction to the transaction group.\n * @param transaction The pre-built transaction\n * @param signer Optional signer override for the transaction\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * composer.addTransaction(txn)\n * ```\n */\n addTransaction(transaction: Transaction, signer?: TransactionSigner): TransactionComposer {\n this.txns.push({\n txn: transaction,\n signer: signer ?? this.getSigner(transaction.sender),\n type: 'txnWithSigner',\n })\n\n return this\n }\n\n /**\n * Add a payment transaction to the transaction group.\n * @param params The payment transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addPayment({\n * sender: 'SENDERADDRESS',\n * receiver: 'RECEIVERADDRESS',\n * amount: (4).algo(),\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addPayment({\n * amount: (4).algo(),\n * receiver: 'RECEIVERADDRESS',\n * sender: 'SENDERADDRESS',\n * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addPayment(params: PaymentParams): TransactionComposer {\n this.txns.push({ ...params, type: 'pay' })\n\n return this\n }\n\n /**\n * Add an asset create transaction to the transaction group.\n * @param params The asset create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetCreate({ sender: \"CREATORADDRESS\", total: 100n})\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetCreate({\n * sender: 'CREATORADDRESS',\n * total: 100n,\n * decimals: 2,\n * assetName: 'asset',\n * unitName: 'unit',\n * url: 'url',\n * metadataHash: 'metadataHash',\n * defaultFrozen: false,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetCreate(params: AssetCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetCreate' })\n\n return this\n }\n\n /**\n * Add an asset config transaction to the transaction group.\n * @param params The asset config transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetConfig({ sender: \"MANAGERADDRESS\", assetId: 123456n, manager: \"MANAGERADDRESS\" })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetConfig({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n */\n addAssetConfig(params: AssetConfigParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetConfig' })\n\n return this\n }\n\n /**\n * Add an asset freeze transaction to the transaction group.\n * @param params The asset freeze transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetFreeze({ sender: \"MANAGERADDRESS\", assetId: 123456n, account: \"ACCOUNTADDRESS\", frozen: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetFreeze({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * account: 'ACCOUNTADDRESS',\n * frozen: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetFreeze(params: AssetFreezeParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetFreeze' })\n\n return this\n }\n\n /**\n * Add an asset destroy transaction to the transaction group.\n * @param params The asset destroy transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetDestroy({ sender: \"MANAGERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetDestroy({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetDestroy(params: AssetDestroyParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetDestroy' })\n\n return this\n }\n\n /**\n * Add an asset transfer transaction to the transaction group.\n * @param params The asset transfer transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetTransfer({ sender: \"HOLDERADDRESS\", assetId: 123456n, amount: 1n, receiver: \"RECEIVERADDRESS\" })\n * ```\n * @example Advanced example (with clawback)\n * ```typescript\n * composer.addAssetTransfer({\n * sender: 'CLAWBACKADDRESS',\n * assetId: 123456n,\n * amount: 1n,\n * receiver: 'RECEIVERADDRESS',\n * clawbackTarget: 'HOLDERADDRESS',\n * // This field needs to be used with caution\n * closeAssetTo: 'ADDRESSTOCLOSETO'\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetTransfer(params: AssetTransferParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetTransfer' })\n\n return this\n }\n\n /**\n * Add an asset opt-in transaction to the transaction group.\n * @param params The asset opt-in transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAssetOptIn({ sender: \"SENDERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptIn({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptIn(params: AssetOptInParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptIn' })\n\n return this\n }\n\n /**\n * Add an asset opt-out transaction to the transaction group.\n * @param params The asset opt-out transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example (without creator, will be retrieved from algod)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Basic example (with creator)\n * ```typescript\n * composer.addAssetOptOut({ sender: \"SENDERADDRESS\", creator: \"CREATORADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAssetOptOut({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * creator: 'CREATORADDRESS',\n * ensureZeroBalance: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addAssetOptOut(params: AssetOptOutParams): TransactionComposer {\n this.txns.push({ ...params, type: 'assetOptOut' })\n\n return this\n }\n\n /**\n * Add an application create transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application create transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCreate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * // Signer only needed if you want to provide one,\n * // generally you'd register it with AlgorandClient\n * // against the sender and not need to pass it in\n * signer: transactionSigner,\n * maxRoundsToWaitForConfirmation: 5,\n * suppressLog: true,\n *})\n * ```\n */\n addAppCreate(params: AppCreateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an application update transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application update transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppUpdate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdate(params: AppUpdateParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n\n return this\n }\n\n /**\n * Add an application delete transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application delete transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppDelete({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppDelete({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDelete(params: AppDeleteParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n\n return this\n }\n\n /**\n * Add an application call transaction to the transaction group.\n *\n * If you want to create or update an app use `addAppCreate` or `addAppUpdate`.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addAppCall({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addAppCall({\n * sender: 'CREATORADDRESS',\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCall(params: AppCallParams): TransactionComposer {\n this.txns.push({ ...params, type: 'appCall' })\n\n return this\n }\n\n /**\n * Add an ABI method create application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI create method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCreateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCreateMethodCall(params: AppCreateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an ABI method update application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI update method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppUpdateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppUpdateMethodCall(params: AppUpdateMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC })\n return this\n }\n\n /**\n * Add an ABI method delete application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI delete method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppDeleteMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppDeleteMethodCall(params: AppDeleteMethodCall) {\n this.txns.push({ ...params, type: 'methodCall', onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC })\n return this\n }\n\n /**\n * Add a non-create/non-update ABI method application call transaction to the transaction group.\n *\n * Note: we recommend using app clients to make it easier to make app calls.\n * @param params The ABI method application call transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * composer.addAppCallMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: algosdk.OnApplicationComplete.OptInOC,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n *})\n * ```\n */\n addAppCallMethodCall(params: AppCallMethodCall) {\n this.txns.push({ ...params, type: 'methodCall' })\n return this\n }\n\n /**\n * Add an online key registration transaction to the transaction group.\n * @param params The online key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOnlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOnlineKeyRegistration(params: OnlineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add an offline key registration transaction to the transaction group.\n * @param params The offline key registration transaction parameters\n * @returns The composer so you can chain method calls\n * @example Basic example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * composer.addOfflineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n */\n addOfflineKeyRegistration(params: OfflineKeyRegistrationParams): TransactionComposer {\n this.txns.push({ ...params, type: 'keyReg' })\n\n return this\n }\n\n /**\n * Add the transactions within an `AtomicTransactionComposer` to the transaction group.\n * @param atc The `AtomicTransactionComposer` to build transactions from and add to the group\n * @returns The composer so you can chain method calls\n * @example\n * ```typescript\n * const atc = new AtomicTransactionComposer()\n * .addPayment({ sender: 'SENDERADDRESS', receiver: 'RECEIVERADDRESS', amount: 1000n })\n * composer.addAtc(atc)\n * ```\n */\n addAtc(atc: algosdk.AtomicTransactionComposer): TransactionComposer {\n this.txns.push({ atc, type: 'atc' })\n return this\n }\n\n /** Build an ATC and return transactions ready to be incorporated into a broader set of transactions this composer is composing */\n private buildAtc(atc: algosdk.AtomicTransactionComposer): TransactionWithSignerAndContext[] {\n const group = atc.buildGroup()\n\n const txnWithSigners = group.map((ts, idx) => {\n // Remove underlying group ID from the transaction since it will be re-grouped when this TransactionComposer is built\n ts.txn.group = undefined\n // If this was a method call return the ABIMethod for later\n if (atc['methodCalls'].get(idx)) {\n return {\n ...ts,\n context: { abiMethod: atc['methodCalls'].get(idx) as algosdk.ABIMethod },\n }\n }\n return {\n ...ts,\n context: {},\n }\n })\n\n return txnWithSigners\n }\n\n private commonTxnBuildStep<TParams extends algosdk.CommonTransactionParams>(\n buildTxn: (params: TParams) => Transaction,\n params: CommonTransactionParams,\n txnParams: TParams,\n ): TransactionWithContext {\n // We are going to mutate suggested params, let's create a clone first\n txnParams.suggestedParams = { ...txnParams.suggestedParams }\n\n if (params.lease) txnParams.lease = encodeLease(params.lease)! satisfies algosdk.Transaction['lease']\n if (params.rekeyTo) txnParams.rekeyTo = address(params.rekeyTo) satisfies algosdk.Transaction['rekeyTo']\n const encoder = new TextEncoder()\n if (params.note)\n txnParams.note = (typeof params.note === 'string' ? encoder.encode(params.note) : params.note) satisfies algosdk.Transaction['note']\n\n if (params.firstValidRound) {\n txnParams.suggestedParams.firstValid = params.firstValidRound\n }\n\n if (params.lastValidRound) {\n txnParams.suggestedParams.lastValid = params.lastValidRound\n } else {\n // If the validity window isn't set in this transaction or by default and we are pointing at\n // LocalNet set a bigger window to avoid dead transactions\n const window = params.validityWindow\n ? BigInt(params.validityWindow)\n : !this.defaultValidityWindowIsExplicit && genesisIdIsLocalNet(txnParams.suggestedParams.genesisID ?? 'unknown')\n ? 1000n\n : this.defaultValidityWindow\n txnParams.suggestedParams.lastValid = BigInt(txnParams.suggestedParams.firstValid) + window\n }\n\n if (params.staticFee !== undefined && params.extraFee !== undefined) {\n throw Error('Cannot set both staticFee and extraFee')\n }\n\n if (params.staticFee !== undefined) {\n txnParams.suggestedParams.fee = params.staticFee.microAlgo\n txnParams.suggestedParams.flatFee = true\n }\n\n const txn = buildTxn(txnParams)\n\n if (params.extraFee) txn.fee += params.extraFee.microAlgo\n if (params.maxFee !== undefined && txn.fee > params.maxFee.microAlgo) {\n throw Error(`Transaction fee ${txn.fee} µALGO is greater than maxFee ${params.maxFee}`)\n }\n\n const logicalMaxFee =\n params.maxFee !== undefined && params.maxFee.microAlgo > (params.staticFee?.microAlgo ?? 0n) ? params.maxFee : params.staticFee\n\n return { txn, context: { maxFee: logicalMaxFee } }\n }\n\n /**\n * Builds an ABI method call transaction and any other associated transactions represented in the ABI args.\n * @param includeSigner Whether to include the actual signer for the transactions.\n * If you are just building transactions without signers yet then set this to `false`.\n */\n private async buildMethodCall(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall,\n suggestedParams: algosdk.SuggestedParams,\n includeSigner: boolean,\n ): Promise<TransactionWithSignerAndContext[]> {\n const methodArgs: (algosdk.ABIArgument | TransactionWithSignerAndContext)[] = []\n const transactionsForGroup: TransactionWithSignerAndContext[] = []\n\n const isAbiValue = (x: unknown): x is algosdk.ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n return typeof x === 'bigint' || typeof x === 'boolean' || typeof x === 'number' || typeof x === 'string' || x instanceof Uint8Array\n }\n\n for (let i = (params.args ?? []).length - 1; i >= 0; i--) {\n const arg = params.args![i]\n if (arg === undefined) {\n // An undefined transaction argument signals that the value will be supplied by a method call argument\n if (algosdk.abiTypeIsTransaction(params.method.args[i].type) && transactionsForGroup.length > 0) {\n // Move the last transaction from the group to the method call arguments to appease algosdk\n const placeholderTransaction = transactionsForGroup.splice(-1, 1)[0]\n methodArgs.push(placeholderTransaction)\n continue\n }\n\n throw Error(`No value provided for argument ${i + 1} within call to ${params.method.name}`)\n }\n\n if (isAbiValue(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if (isTransactionWithSigner(arg)) {\n methodArgs.push(arg)\n continue\n }\n\n if ('method' in arg) {\n const tempTxnWithSigners = await this.buildMethodCall(arg, suggestedParams, includeSigner)\n // If there is any transaction args, add to the atc\n // Everything else should be added as method args\n\n methodArgs.push(...tempTxnWithSigners.slice(-1)) // Add the method call itself as a method arg\n transactionsForGroup.push(...tempTxnWithSigners.slice(0, -1).reverse()) // Add any transaction arguments to the atc\n continue\n }\n\n const txn = await arg\n methodArgs.push({\n txn,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(txn.sender)\n : TransactionComposer.NULL_SIGNER,\n })\n }\n\n const methodAtc = new algosdk.AtomicTransactionComposer()\n const maxFees = new Map<number, AlgoAmount>()\n\n transactionsForGroup.reverse().forEach(({ context, ...txnWithSigner }) => {\n methodAtc.addTransaction(txnWithSigner)\n const atcIndex = methodAtc.count() - 1\n if (context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, context.abiMethod)\n }\n if (context.maxFee !== undefined) {\n maxFees.set(atcIndex, context.maxFee)\n }\n })\n\n // If any of the args are method call transactions, add that info to the methodAtc\n methodArgs\n .filter((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return isTransactionWithSigner(txnWithSigner)\n }\n return isTransactionWithSigner(arg)\n })\n .reverse()\n .forEach((arg, idx) => {\n if (typeof arg === 'object' && 'context' in arg && arg.context) {\n const atcIndex = methodAtc.count() + idx\n if (arg.context.abiMethod) {\n methodAtc['methodCalls'].set(atcIndex, arg.context.abiMethod)\n }\n if (arg.context.maxFee !== undefined) {\n maxFees.set(atcIndex, arg.context.maxFee)\n }\n }\n })\n\n const appId = Number('appId' in params ? params.appId : 0n)\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const txnParams = {\n appID: appId,\n sender: params.sender,\n suggestedParams,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n appAccounts: params.accountReferences,\n appForeignApps: params.appReferences?.map((x) => Number(x)),\n appForeignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n extraPages:\n appId === 0\n ? 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : approvalProgram\n ? calculateExtraProgramPages(approvalProgram, clearStateProgram)\n : 0\n : undefined,\n numLocalInts: appId === 0 ? ('schema' in params ? (params.schema?.localInts ?? 0) : 0) : undefined,\n numLocalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.localByteSlices ?? 0) : 0) : undefined,\n numGlobalInts: appId === 0 ? ('schema' in params ? (params.schema?.globalInts ?? 0) : 0) : undefined,\n numGlobalByteSlices: appId === 0 ? ('schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0) : undefined,\n method: params.method,\n signer: includeSigner\n ? params.signer\n ? 'signer' in params.signer\n ? params.signer.signer\n : params.signer\n : this.getSigner(params.sender)\n : TransactionComposer.NULL_SIGNER,\n methodArgs: methodArgs\n .map((arg) => {\n if (typeof arg === 'object' && 'context' in arg) {\n const { context, ...txnWithSigner } = arg\n return txnWithSigner\n }\n return arg\n })\n .reverse(),\n // note, lease, and rekeyTo are set in the common build step\n note: undefined,\n lease: undefined,\n rekeyTo: undefined,\n }\n\n // Build the transaction\n const result = this.commonTxnBuildStep(\n (txnParams) => {\n methodAtc.addMethodCall(txnParams)\n return methodAtc.buildGroup()[methodAtc.count() - 1].txn\n },\n params,\n txnParams,\n )\n\n // Process the ATC to get a set of transactions ready for broader grouping\n return this.buildAtc(methodAtc).map(({ context: _context, ...txnWithSigner }, idx) => {\n const maxFee = idx === methodAtc.count() - 1 ? result.context.maxFee : maxFees.get(idx)\n const context = {\n ..._context, // Adds method context info\n maxFee,\n }\n\n return {\n ...txnWithSigner,\n context,\n }\n })\n }\n\n private buildPayment(params: PaymentParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makePaymentTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n amount: params.amount.microAlgo,\n closeRemainderTo: params.closeRemainderTo,\n suggestedParams,\n })\n }\n\n private buildAssetCreate(params: AssetCreateParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetCreateTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n total: params.total,\n decimals: params.decimals ?? 0,\n assetName: params.assetName,\n unitName: params.unitName,\n assetURL: params.url,\n defaultFrozen: params.defaultFrozen ?? false,\n assetMetadataHash: typeof params.metadataHash === 'string' ? Buffer.from(params.metadataHash, 'utf-8') : params.metadataHash,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n suggestedParams,\n })\n }\n\n private buildAssetConfig(params: AssetConfigParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetConfigTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n manager: params.manager,\n reserve: params.reserve,\n freeze: params.freeze,\n clawback: params.clawback,\n strictEmptyAddressChecking: false,\n })\n }\n\n private buildAssetDestroy(params: AssetDestroyParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetDestroyTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n suggestedParams,\n })\n }\n\n private buildAssetFreeze(params: AssetFreezeParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetFreezeTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n assetIndex: params.assetId,\n freezeTarget: params.account,\n frozen: params.frozen,\n suggestedParams,\n })\n }\n\n private buildAssetTransfer(params: AssetTransferParams, suggestedParams: algosdk.SuggestedParams) {\n return this.commonTxnBuildStep(algosdk.makeAssetTransferTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n receiver: params.receiver,\n assetIndex: params.assetId,\n amount: params.amount,\n suggestedParams,\n closeRemainderTo: params.closeAssetTo,\n assetSender: params.clawbackTarget,\n })\n }\n\n private async buildAppCall(params: AppCallParams | AppUpdateParams | AppCreateParams, suggestedParams: algosdk.SuggestedParams) {\n const appId = 'appId' in params ? params.appId : 0n\n const approvalProgram =\n 'approvalProgram' in params\n ? typeof params.approvalProgram === 'string'\n ? (await this.appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n : undefined\n const clearStateProgram =\n 'clearStateProgram' in params\n ? typeof params.clearStateProgram === 'string'\n ? (await this.appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n : undefined\n\n const sdkParams = {\n sender: params.sender,\n suggestedParams,\n appArgs: params.args,\n onComplete: params.onComplete ?? algosdk.OnApplicationComplete.NoOpOC,\n accounts: params.accountReferences,\n foreignApps: params.appReferences?.map((x) => Number(x)),\n foreignAssets: params.assetReferences?.map((x) => Number(x)),\n boxes: params.boxReferences?.map(AppManager.getBoxReference),\n approvalProgram,\n clearProgram: clearStateProgram,\n }\n\n if (appId === 0n) {\n if (sdkParams.approvalProgram === undefined || sdkParams.clearProgram === undefined) {\n throw new Error('approvalProgram and clearStateProgram are required for application creation')\n }\n\n return this.commonTxnBuildStep(algosdk.makeApplicationCreateTxnFromObject, params, {\n ...sdkParams,\n extraPages:\n 'extraProgramPages' in params && params.extraProgramPages !== undefined\n ? params.extraProgramPages\n : calculateExtraProgramPages(approvalProgram!, clearStateProgram!),\n numLocalInts: 'schema' in params ? (params.schema?.localInts ?? 0) : 0,\n numLocalByteSlices: 'schema' in params ? (params.schema?.localByteSlices ?? 0) : 0,\n numGlobalInts: 'schema' in params ? (params.schema?.globalInts ?? 0) : 0,\n numGlobalByteSlices: 'schema' in params ? (params.schema?.globalByteSlices ?? 0) : 0,\n approvalProgram: approvalProgram!,\n clearProgram: clearStateProgram!,\n })\n } else {\n return this.commonTxnBuildStep(algosdk.makeApplicationCallTxnFromObject, params, { ...sdkParams, appIndex: appId })\n }\n }\n\n private buildKeyReg(params: OnlineKeyRegistrationParams | OfflineKeyRegistrationParams, suggestedParams: algosdk.SuggestedParams) {\n if ('voteKey' in params) {\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n voteKey: params.voteKey,\n selectionKey: params.selectionKey,\n voteFirst: params.voteFirst,\n voteLast: params.voteLast,\n voteKeyDilution: params.voteKeyDilution,\n suggestedParams,\n nonParticipation: false,\n stateProofKey: params.stateProofKey,\n })\n }\n\n return this.commonTxnBuildStep(algosdk.makeKeyRegistrationTxnWithSuggestedParamsFromObject, params, {\n sender: params.sender,\n suggestedParams,\n nonParticipation: params.preventAccountFromEverParticipatingAgain,\n })\n }\n\n /** Builds all transaction types apart from `txnWithSigner`, `atc` and `methodCall` since those ones can have custom signers that need to be retrieved. */\n private async buildTxn(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithContext[]> {\n switch (txn.type) {\n case 'pay':\n return [this.buildPayment(txn, suggestedParams)]\n case 'assetCreate':\n return [this.buildAssetCreate(txn, suggestedParams)]\n case 'appCall':\n return [await this.buildAppCall(txn, suggestedParams)]\n case 'assetConfig':\n return [this.buildAssetConfig(txn, suggestedParams)]\n case 'assetDestroy':\n return [this.buildAssetDestroy(txn, suggestedParams)]\n case 'assetFreeze':\n return [this.buildAssetFreeze(txn, suggestedParams)]\n case 'assetTransfer':\n return [this.buildAssetTransfer(txn, suggestedParams)]\n case 'assetOptIn':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n }, suggestedParams)]\n case 'assetOptOut':\n return [this.buildAssetTransfer({ ...txn, receiver: txn.sender, amount: 0n, closeAssetTo: txn.creator }, suggestedParams)]\n case 'keyReg':\n return [this.buildKeyReg(txn, suggestedParams)]\n default:\n throw Error(`Unsupported txn type`)\n }\n }\n\n private async buildTxnWithSigner(txn: Txn, suggestedParams: algosdk.SuggestedParams): Promise<TransactionWithSignerAndContext[]> {\n if (txn.type === 'txnWithSigner') {\n return [\n {\n ...txn,\n context: {},\n },\n ]\n }\n\n if (txn.type === 'atc') {\n return this.buildAtc(txn.atc)\n }\n\n if (txn.type === 'methodCall') {\n return await this.buildMethodCall(txn, suggestedParams, true)\n }\n\n const signer = txn.signer ? ('signer' in txn.signer ? txn.signer.signer : txn.signer) : this.getSigner(txn.sender)\n\n return (await this.buildTxn(txn, suggestedParams)).map(({ txn, context }) => ({ txn, signer, context }))\n }\n\n /**\n * Compose all of the transactions without signers and return the transaction objects directly along with any ABI method calls.\n *\n * @returns The array of built transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { transactions, methodCalls, signers } = await composer.buildTransactions()\n * ```\n */\n async buildTransactions(): Promise<BuiltTransactions> {\n const suggestedParams = await this.getSuggestedParams()\n\n const transactions: algosdk.Transaction[] = []\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n const signers = new Map<number, algosdk.TransactionSigner>()\n\n for (const txn of this.txns) {\n if (!['txnWithSigner', 'atc', 'methodCall'].includes(txn.type)) {\n transactions.push(...(await this.buildTxn(txn, suggestedParams)).map((txn) => txn.txn))\n } else {\n const transactionsWithSigner =\n txn.type === 'txnWithSigner'\n ? [txn]\n : txn.type === 'atc'\n ? this.buildAtc(txn.atc)\n : txn.type === 'methodCall'\n ? await this.buildMethodCall(txn, suggestedParams, false)\n : []\n\n transactionsWithSigner.forEach((ts) => {\n transactions.push(ts.txn)\n const groupIdx = transactions.length - 1\n\n if (ts.signer && ts.signer !== TransactionComposer.NULL_SIGNER) {\n signers.set(groupIdx, ts.signer)\n }\n if ('context' in ts && ts.context.abiMethod) {\n methodCalls.set(groupIdx, ts.context.abiMethod)\n }\n })\n }\n }\n\n return { transactions, methodCalls, signers }\n }\n\n /**\n * Get the number of transactions currently added to this composer.\n * @returns The number of transactions currently added to this composer\n */\n async count() {\n return (await this.buildTransactions()).transactions.length\n }\n\n /**\n * Compose all of the transactions in a single atomic transaction group and an atomic transaction composer.\n *\n * You can then use the transactions standalone, or use the composer to execute or simulate the transactions.\n *\n * Once this method is called, no further transactions will be able to be added.\n * You can safely call this method multiple times to get the same result.\n * @returns The built atomic transaction composer, the transactions and any corresponding method calls\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.build()\n * ```\n */\n async build() {\n if (this.atc.getStatus() === algosdk.AtomicTransactionComposerStatus.BUILDING) {\n const suggestedParams = await this.getSuggestedParams()\n\n // Build all of the transactions\n const txnWithSigners: TransactionWithSignerAndContext[] = []\n for (const txn of this.txns) {\n txnWithSigners.push(...(await this.buildTxnWithSigner(txn, suggestedParams)))\n }\n\n // Add all of the transactions to the underlying ATC\n const methodCalls = new Map<number, algosdk.ABIMethod>()\n txnWithSigners.forEach(({ context, ...ts }, idx) => {\n this.atc.addTransaction(ts)\n\n // Populate consolidated set of all ABI method calls\n if (context.abiMethod) {\n methodCalls.set(idx, context.abiMethod)\n }\n\n if (context.maxFee !== undefined) {\n this.txnMaxFees.set(idx, context.maxFee)\n }\n })\n this.atc['methodCalls'] = methodCalls\n }\n\n return { atc: this.atc, transactions: this.atc.buildGroup(), methodCalls: this.atc['methodCalls'] }\n }\n\n /**\n * Rebuild the group, discarding any previously built transactions.\n * This will potentially cause new signers and suggested params to be used if the callbacks return a new value compared to the first build.\n * @returns The newly built atomic transaction composer and the transactions\n * @example\n * ```typescript\n * const { atc, transactions, methodCalls } = await composer.rebuild()\n * ```\n */\n async rebuild() {\n this.atc = new algosdk.AtomicTransactionComposer()\n return await this.build()\n }\n\n /**\n * Compose the atomic transaction group and send it to the network.\n * @param params The parameters to control execution with\n * @returns The execution result\n * @example\n * ```typescript\n * const result = await composer.send({\n * populateAppCallResources: true,\n * })\n * ```\n */\n async send(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n const group = (await this.build()).transactions\n\n let waitRounds = params?.maxRoundsToWaitForConfirmation\n\n const suggestedParams =\n waitRounds === undefined || params?.coverAppCallInnerTransactionFees ? await this.getSuggestedParams() : undefined\n\n if (waitRounds === undefined) {\n const lastRound = group.reduce((max, txn) => (txn.txn.lastValid > max ? txn.txn.lastValid : BigInt(max)), 0n)\n const { firstValid: firstRound } = suggestedParams!\n waitRounds = Number(BigInt(lastRound) - BigInt(firstRound)) + 1\n }\n\n return await sendAtomicTransactionComposer(\n {\n atc: this.atc,\n suppressLog: params?.suppressLog,\n maxRoundsToWaitForConfirmation: waitRounds,\n populateAppCallResources: params?.populateAppCallResources,\n coverAppCallInnerTransactionFees: params?.coverAppCallInnerTransactionFees,\n additionalAtcContext: params?.coverAppCallInnerTransactionFees\n ? {\n maxFees: this.txnMaxFees,\n suggestedParams: suggestedParams!,\n }\n : undefined,\n },\n this.algod,\n )\n }\n\n /**\n * @deprecated Use `send` instead.\n *\n * Compose the atomic transaction group and send it to the network\n *\n * An alias for `composer.send(params)`.\n * @param params The parameters to control execution with\n * @returns The execution result\n */\n async execute(params?: SendParams): Promise<SendAtomicTransactionComposerResults> {\n return this.send(params)\n }\n\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate()\n * ```\n */\n async simulate(): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * skipSignatures: true,\n * })\n * ```\n */\n async simulate(\n options: SkipSignaturesSimulateOptions,\n ): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n /**\n * Compose the atomic transaction group and simulate sending it to the network\n * @returns The simulation result\n * @example\n * ```typescript\n * const result = await composer.simulate({\n * extraOpcodeBudget: 1000,\n * })\n * ```\n */\n async simulate(options: RawSimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }>\n async simulate(options?: SimulateOptions): Promise<SendAtomicTransactionComposerResults & { simulateResponse: SimulateResponse }> {\n const { skipSignatures = false, ...rawOptions } = options ?? {}\n const atc = skipSignatures ? new AtomicTransactionComposer() : this.atc\n\n // Build the transactions\n if (skipSignatures) {\n rawOptions.allowEmptySignatures = true\n rawOptions.fixSigners = true\n // Build transactions uses empty signers\n const transactions = await this.buildTransactions()\n for (const txn of transactions.transactions) {\n atc.addTransaction({ txn, signer: TransactionComposer.NULL_SIGNER })\n }\n atc['methodCalls'] = transactions.methodCalls\n } else {\n // Build creates real signatures\n await this.build()\n }\n\n const { methodResults, simulateResponse } = await atc.simulate(\n this.algod,\n new modelsv2.SimulateRequest({\n txnGroups: [],\n ...rawOptions,\n ...(Config.debug\n ? {\n allowEmptySignatures: true,\n fixSigners: true,\n allowMoreLogging: true,\n execTraceConfig: new modelsv2.SimulateTraceConfig({\n enable: true,\n scratchChange: true,\n stackChange: true,\n stateChange: true,\n }),\n }\n : undefined),\n }),\n )\n\n const failedGroup = simulateResponse?.txnGroups[0]\n if (failedGroup?.failureMessage) {\n const errorMessage = `Transaction failed at transaction(s) ${failedGroup.failedAt?.join(', ') || 'unknown'} in the group. ${failedGroup.failureMessage}`\n const error = new Error(errorMessage)\n\n if (Config.debug) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(error as any).simulateResponse = simulateResponse\n throw error\n }\n\n if (Config.debug && Config.traceAll) {\n await Config.events.emitAsync(EventType.TxnGroupSimulated, { simulateResponse })\n }\n\n const transactions = atc.buildGroup().map((t) => t.txn)\n return {\n confirmations: simulateResponse.txnGroups[0].txnResults.map((t) => t.txnResult),\n transactions: transactions,\n txIds: transactions.map((t) => t.txID()),\n groupId: Buffer.from(transactions[0].group ?? new Uint8Array()).toString('base64'),\n simulateResponse,\n returns: methodResults.map(getABIReturnValue),\n }\n }\n\n /**\n * Create an encoded transaction note that follows the ARC-2 spec.\n *\n * https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md\n * @param note The ARC-2 transaction note data\n * @returns The binary encoded transaction note\n */\n static arc2Note(note: Arc2TransactionNote): Uint8Array {\n const arc2Payload = `${note.dAppName}:${note.format}${typeof note.data === 'string' ? note.data : asJson(note.data)}`\n const encoder = new TextEncoder()\n return encoder.encode(arc2Payload)\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAWA,IAAO,yBAAyB,GAAG,OAAO,CAAC,yBAAyB;AAIpE,IAAO,uBAAuB,GAAG,OAAO,CAAC,uBAAuB;AAEhE,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ;AAElC,MAAM,OAAO,GAAG,CAAC,OAAyB,KAAa;AACrD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO;AAC5E,CAAC;AAEM,MAAM,0BAA0B,GAAG;AAif1C;MACa,mBAAmB,CAAA;AAgC9B;;;;AAIG;AACH,IAAA,WAAA,CAAY,MAAiC,EAAA;;AAhCrC,QAAA,IAAA,CAAA,GAAG,GAAG,IAAI,OAAO,CAAC,yBAAyB,EAAE;AAErD;;AAEG;AACK,QAAA,IAAA,CAAA,UAAU,GAA4B,IAAI,GAAG,EAAE;;QAG/C,IAAI,CAAA,IAAA,GAA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