@algorandfoundation/algokit-utils 9.2.1-beta.2 → 9.2.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.mjs","names":[],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import algosdk, {\n ABIMethod,\n ABIReturnType,\n Address,\n ApplicationTransactionFields,\n stringifyJSON,\n TransactionBoxReference,\n TransactionType,\n} from 'algosdk'\nimport { Buffer } from 'buffer'\nimport { Config } from '../config'\nimport { AlgoAmount } from '../types/amount'\nimport { ABIReturn } from '../types/app'\nimport { EventType } from '../types/lifecycle-events'\nimport {\n AdditionalAtomicTransactionComposerContext,\n AtomicTransactionComposerToSend,\n SendAtomicTransactionComposerResults,\n SendParams,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionGroupToSend,\n TransactionNote,\n TransactionToSign,\n} from '../types/transaction'\nimport { asJson, convertAbiByteArrays, convertABIDecodedBigIntToNumber, toNumber } from '../util'\nimport { performAtomicTransactionComposerSimulate } from './perform-atomic-transaction-composer-simulate'\nimport Algodv2 = algosdk.Algodv2\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport modelsv2 = algosdk.modelsv2\nimport SuggestedParams = algosdk.SuggestedParams\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\nimport TransactionWithSigner = algosdk.TransactionWithSigner\n\nexport const MAX_TRANSACTION_GROUP_SIZE = 16\nexport const MAX_APP_CALL_FOREIGN_REFERENCES = 8\nexport const MAX_APP_CALL_ACCOUNT_REFERENCES = 8\n\n/**\n * @deprecated Convert your data to a `string` or `Uint8Array`, if using ARC-2 use `TransactionComposer.arc2Note`.\n *\n * Encodes a transaction note into a byte array ready to be included in an Algorand transaction.\n *\n * @param note The transaction note\n * @returns the transaction note ready for inclusion in a transaction\n *\n * Case on the value of `data` this either be:\n * * `null` | `undefined`: `undefined`\n * * `string`: The string value\n * * Uint8Array: passthrough\n * * Arc2TransactionNote object: ARC-0002 compatible transaction note\n * * Else: The object/value converted into a JSON string representation\n */\nexport function encodeTransactionNote(note?: TransactionNote): Uint8Array | undefined {\n if (note == null || typeof note === 'undefined') {\n return undefined\n } else if (typeof note === 'object' && note.constructor === Uint8Array) {\n return note\n } else if (typeof note === 'object' && 'dAppName' in note) {\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 } else {\n const n = typeof note === 'string' ? note : asJson(note)\n const encoder = new TextEncoder()\n return encoder.encode(n)\n }\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `algorand.client` to interact with accounts, and use `.addr` to get the address\n * and/or move from using `SendTransactionFrom` to `TransactionSignerAccount` and use `.addr` instead.\n *\n * Returns the public address of the given transaction sender.\n * @param sender A transaction sender\n * @returns The public address\n */\nexport const getSenderAddress = function (sender: string | SendTransactionFrom): string {\n return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr.toString() : sender.address().toString()\n}\n\n/**\n * @deprecated Use `AlgorandClient` / `TransactionComposer` to construct transactions instead or\n * construct an `algosdk.TransactionWithSigner` manually instead.\n *\n * Given a transaction in a variety of supported formats, returns a TransactionWithSigner object ready to be passed to an\n * AtomicTransactionComposer's addTransaction method.\n * @param transaction One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the\n * signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by\n * one of algokit utils' helpers (signer is obtained from the defaultSender parameter)\n * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not\n * include a signer.\n * @returns A TransactionWithSigner object.\n */\nexport const getTransactionWithSigner = async (\n transaction: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>,\n defaultSender?: SendTransactionFrom,\n): Promise<TransactionWithSigner> => {\n if ('txn' in transaction) return transaction\n if (defaultSender === undefined)\n throw new Error('Default sender must be provided when passing in a transaction object that does not contain its own signer')\n return transaction instanceof Promise\n ? {\n txn: (await transaction).transaction,\n signer: getSenderTransactionSigner(defaultSender),\n }\n : 'transaction' in transaction\n ? {\n txn: transaction.transaction,\n signer: getSenderTransactionSigner(transaction.signer),\n }\n : {\n txn: transaction,\n signer: getSenderTransactionSigner(defaultSender),\n }\n}\n\nconst memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\n/**\n * @deprecated Use `TransactionSignerAccount` instead of `SendTransactionFrom` or use\n * `algosdk.makeBasicAccountTransactionSigner` / `algosdk.makeLogicSigAccountTransactionSigner`.\n *\n * Returns a `TransactionSigner` for the given transaction sender.\n * This function has memoization, so will return the same transaction signer for a given sender.\n * @param sender A transaction sender\n * @returns A transaction signer\n */\nexport const getSenderTransactionSigner = memoize(function (sender: SendTransactionFrom): TransactionSigner {\n return 'signer' in sender\n ? sender.signer\n : 'lsig' in sender\n ? algosdk.makeLogicSigAccountTransactionSigner(sender)\n : algosdk.makeBasicAccountTransactionSigner(sender)\n})\n\n/**\n * @deprecated Use `AlgorandClient` / `TransactionComposer` to sign transactions\n * or use the relevant underlying `account.signTxn` / `algosdk.signLogicSigTransactionObject`\n * / `multiSigAccount.sign` / `TransactionSigner` methods directly.\n *\n * Signs a single transaction by the given signer.\n * @param transaction The transaction to sign\n * @param signer The signer to sign\n * @returns The signed transaction as a `Uint8Array`\n */\nexport const signTransaction = async (transaction: Transaction, signer: SendTransactionFrom) => {\n return 'sk' in signer\n ? transaction.signTxn(signer.sk)\n : 'lsig' in signer\n ? algosdk.signLogicSigTransactionObject(transaction, signer).blob\n : 'sign' in signer\n ? signer.sign(transaction)\n : (await signer.signer([transaction], [0]))[0]\n}\n\n/**\n * @deprecated Use `AlgorandClient` / `TransactionComposer` to send transactions.\n *\n * Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.\n *\n * @param send The details for the transaction to prepare/send, including:\n * * `transaction`: The unsigned transaction\n * * `from`: The account to sign the transaction with: either an account with private key loaded or a logic signature account\n * * `config`: The sending configuration for this transaction\n * @param algod An algod client\n *\n * @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or `undefined`) confirmation (`confirmation`)\n */\nexport const sendTransaction = async function (\n send: {\n transaction: Transaction\n from: SendTransactionFrom\n sendParams?: SendTransactionParams\n },\n algod: Algodv2,\n): Promise<SendTransactionResult> {\n const { transaction, from, sendParams } = send\n const { skipSending, skipWaiting, fee, maxFee, suppressLog, maxRoundsToWaitForConfirmation, atc } = sendParams ?? {}\n\n controlFees(transaction, { fee, maxFee })\n\n if (atc) {\n atc.addTransaction({ txn: transaction, signer: getSenderTransactionSigner(from) })\n return { transaction }\n }\n\n if (skipSending) {\n return { transaction }\n }\n\n let txnToSend = transaction\n\n const populateAppCallResources = sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n\n // Populate resources if the transaction is an appcall and populateAppCallResources wasn't explicitly set to false\n if (txnToSend.type === algosdk.TransactionType.appl && populateAppCallResources) {\n const newAtc = new AtomicTransactionComposer()\n newAtc.addTransaction({ txn: txnToSend, signer: getSenderTransactionSigner(from) })\n const atc = await prepareGroupForSending(newAtc, algod, { ...sendParams, populateAppCallResources })\n txnToSend = atc.buildGroup()[0].txn\n }\n\n const signedTransaction = await signTransaction(txnToSend, from)\n\n await algod.sendRawTransaction(signedTransaction).do()\n\n Config.getLogger(suppressLog).verbose(`Sent transaction ID ${txnToSend.txID()} ${txnToSend.type} from ${getSenderAddress(from)}`)\n\n let confirmation: modelsv2.PendingTransactionResponse | undefined = undefined\n if (!skipWaiting) {\n confirmation = await waitForConfirmation(txnToSend.txID(), maxRoundsToWaitForConfirmation ?? 5, algod)\n }\n\n return { transaction: txnToSend, confirmation }\n}\n\n/**\n * Get the execution info of a transaction group for the given ATC\n * The function uses the simulate endpoint and depending on the sendParams can return the following:\n * - The unnamed resources accessed by the group\n * - The unnamed resources accessed by each transaction in the group\n * - The required fee delta for each transaction in the group. A positive value indicates a fee deficit, a negative value indicates a surplus.\n *\n * @param atc The ATC containing the txn group\n * @param algod The algod client to use for the simulation\n * @param sendParams The send params for the transaction group\n * @param additionalAtcContext Additional ATC context used to determine how best to alter transactions in the group\n * @returns The execution info for the group\n */\nasync function getGroupExecutionInfo(\n atc: algosdk.AtomicTransactionComposer,\n algod: algosdk.Algodv2,\n sendParams: SendParams,\n additionalAtcContext?: AdditionalAtomicTransactionComposerContext,\n) {\n const simulateRequest = new algosdk.modelsv2.SimulateRequest({\n txnGroups: [],\n allowUnnamedResources: true,\n allowEmptySignatures: true,\n fixSigners: true,\n })\n\n const nullSigner = algosdk.makeEmptyTransactionSigner()\n\n const emptySignerAtc = atc.clone()\n\n const appCallIndexesWithoutMaxFees: number[] = []\n emptySignerAtc['transactions'].forEach((t: algosdk.TransactionWithSigner, i: number) => {\n t.signer = nullSigner\n\n if (sendParams.coverAppCallInnerTransactionFees && t.txn.type === TransactionType.appl) {\n if (!additionalAtcContext?.suggestedParams) {\n throw Error(`Please provide additionalAtcContext.suggestedParams when coverAppCallInnerTransactionFees is enabled`)\n }\n\n const maxFee = additionalAtcContext?.maxFees?.get(i)?.microAlgo\n if (maxFee === undefined) {\n appCallIndexesWithoutMaxFees.push(i)\n } else {\n t.txn.fee = maxFee\n }\n }\n })\n\n if (sendParams.coverAppCallInnerTransactionFees && appCallIndexesWithoutMaxFees.length > 0) {\n throw Error(\n `Please provide a maxFee for each app call transaction when coverAppCallInnerTransactionFees is enabled. Required for transaction ${appCallIndexesWithoutMaxFees.join(', ')}`,\n )\n }\n\n const perByteTxnFee = BigInt(additionalAtcContext?.suggestedParams.fee ?? 0n)\n const minTxnFee = BigInt(additionalAtcContext?.suggestedParams.minFee ?? 1000n)\n\n const result = await emptySignerAtc.simulate(algod, simulateRequest)\n\n const groupResponse = result.simulateResponse.txnGroups[0]\n\n if (groupResponse.failureMessage) {\n if (sendParams.coverAppCallInnerTransactionFees && groupResponse.failureMessage.match(/fee ([\\w.]+\\s+)?too small/)) {\n throw Error(`Fees were too small to resolve execution info via simulate. You may need to increase an app call transaction maxFee.`)\n }\n\n throw Error(`Error resolving execution info via simulate in transaction ${groupResponse.failedAt}: ${groupResponse.failureMessage}`)\n }\n\n const sortedResources = groupResponse.unnamedResourcesAccessed\n\n // NOTE: We explicitly want to avoid localeCompare as that can lead to different results in different environments\n const compare = (a: string | bigint, b: string | bigint) => (a < b ? -1 : a > b ? 1 : 0)\n\n if (sortedResources) {\n sortedResources.accounts?.sort((a, b) => compare(a.toString(), b.toString()))\n sortedResources.assets?.sort(compare)\n sortedResources.apps?.sort(compare)\n sortedResources.boxes?.sort((a, b) => {\n const aStr = `${a.app}-${a.name}`\n const bStr = `${b.app}-${b.name}`\n return compare(aStr, bStr)\n })\n sortedResources.appLocals?.sort((a, b) => {\n const aStr = `${a.app}-${a.account}`\n const bStr = `${b.app}-${b.account}`\n return compare(aStr, bStr)\n })\n sortedResources.assetHoldings?.sort((a, b) => {\n const aStr = `${a.asset}-${a.account}`\n const bStr = `${b.asset}-${b.account}`\n return compare(aStr, bStr)\n })\n }\n\n return {\n groupUnnamedResourcesAccessed: sendParams.populateAppCallResources ? sortedResources : undefined,\n txns: groupResponse.txnResults.map((txn, i) => {\n const originalTxn = atc['transactions'][i].txn as algosdk.Transaction\n\n let requiredFeeDelta = 0n\n if (sendParams.coverAppCallInnerTransactionFees) {\n // Min fee calc is lifted from algosdk https://github.com/algorand/js-algorand-sdk/blob/6973ff583b243ddb0632e91f4c0383021430a789/src/transaction.ts#L710\n // 75 is the number of bytes added to a txn after signing it\n const parentPerByteFee = perByteTxnFee * BigInt(originalTxn.toByte().length + 75)\n const parentMinFee = parentPerByteFee < minTxnFee ? minTxnFee : parentPerByteFee\n const parentFeeDelta = parentMinFee - originalTxn.fee\n if (originalTxn.type === TransactionType.appl) {\n const calculateInnerFeeDelta = (itxns: algosdk.modelsv2.PendingTransactionResponse[], acc: bigint = 0n): bigint => {\n // Surplus inner transaction fees do not pool up to the parent transaction.\n // Additionally surplus inner transaction fees only pool from sibling transactions that are sent prior to a given inner transaction, hence why we iterate in reverse order.\n return itxns.reverse().reduce((acc, itxn) => {\n const currentFeeDelta =\n (itxn.innerTxns && itxn.innerTxns.length > 0 ? calculateInnerFeeDelta(itxn.innerTxns, acc) : acc) +\n (minTxnFee - itxn.txn.txn.fee) // Inner transactions don't require per byte fees\n return currentFeeDelta < 0n ? 0n : currentFeeDelta\n }, acc)\n }\n\n const innerFeeDelta = calculateInnerFeeDelta(txn.txnResult.innerTxns ?? [])\n requiredFeeDelta = innerFeeDelta + parentFeeDelta\n } else {\n requiredFeeDelta = parentFeeDelta\n }\n }\n\n return {\n unnamedResourcesAccessed: sendParams.populateAppCallResources ? txn.unnamedResourcesAccessed : undefined,\n requiredFeeDelta,\n }\n }),\n }\n}\n\n/**\n * Take an existing Atomic Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param atc The ATC containing the txn group\n * @returns A new ATC with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(atc: algosdk.AtomicTransactionComposer, algod: algosdk.Algodv2) {\n return await prepareGroupForSending(atc, algod, { populateAppCallResources: true })\n}\n\n/**\n * Take an existing Atomic Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n * Please note, that before calling `.execute()` on the returned ATC, you must call `.buildGroup()`.\n *\n * @param algod The algod client to use for the simulation\n * @param atc The ATC containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalAtcContext Additional ATC context used to determine how best to change the transactions in the group\n * @returns A new ATC with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n atc: algosdk.AtomicTransactionComposer,\n algod: algosdk.Algodv2,\n sendParams: SendParams,\n additionalAtcContext?: AdditionalAtomicTransactionComposerContext,\n) {\n const executionInfo = await getGroupExecutionInfo(atc, algod, sendParams, additionalAtcContext)\n const group = atc.buildGroup()\n\n const [_, additionalTransactionFees] = sendParams.coverAppCallInnerTransactionFees\n ? executionInfo.txns\n .map((txn, i) => {\n const groupIndex = i\n const txnInGroup = group[groupIndex].txn\n const maxFee = additionalAtcContext?.maxFees?.get(i)?.microAlgo\n const immutableFee = maxFee !== undefined && maxFee === txnInGroup.fee\n // Because we don't alter non app call transaction, they take priority\n const priorityMultiplier =\n txn.requiredFeeDelta > 0n && (immutableFee || txnInGroup.type !== algosdk.TransactionType.appl) ? 1_000n : 1n\n\n return {\n ...txn,\n groupIndex,\n // Measures the priority level of covering the transaction fee using the surplus group fees. The higher the number, the higher the priority.\n surplusFeePriorityLevel: txn.requiredFeeDelta > 0n ? txn.requiredFeeDelta * priorityMultiplier : -1n,\n }\n })\n .sort((a, b) => {\n return a.surplusFeePriorityLevel > b.surplusFeePriorityLevel ? -1 : a.surplusFeePriorityLevel < b.surplusFeePriorityLevel ? 1 : 0\n })\n .reduce(\n (acc, { groupIndex, requiredFeeDelta }) => {\n if (requiredFeeDelta > 0n) {\n // There is a fee deficit on the transaction\n let surplusGroupFees = acc[0]\n const additionalTransactionFees = acc[1]\n const additionalFeeDelta = requiredFeeDelta - surplusGroupFees\n if (additionalFeeDelta <= 0n) {\n // The surplus group fees fully cover the required fee delta\n surplusGroupFees = -additionalFeeDelta\n } else {\n // The surplus group fees do not fully cover the required fee delta, use what is available\n additionalTransactionFees.set(groupIndex, additionalFeeDelta)\n surplusGroupFees = 0n\n }\n return [surplusGroupFees, additionalTransactionFees] as const\n }\n return acc\n },\n [\n executionInfo.txns.reduce((acc, { requiredFeeDelta }) => {\n if (requiredFeeDelta < 0n) {\n return acc + -requiredFeeDelta\n }\n return acc\n }, 0n),\n new Map<number, bigint>(),\n ] as const,\n )\n : [0n, new Map<number, bigint>()]\n\n const appCallHasAccessReferences = (txn: algosdk.Transaction) => {\n return txn.type === TransactionType.appl && txn.applicationCall?.access && txn.applicationCall?.access.length > 0\n }\n\n const indexesWithAccessReferences: number[] = []\n\n executionInfo.txns.forEach(({ unnamedResourcesAccessed: r }, i) => {\n // Populate Transaction App Call Resources\n if (sendParams.populateAppCallResources && group[i].txn.type === TransactionType.appl) {\n const hasAccessReferences = appCallHasAccessReferences(group[i].txn)\n\n if (hasAccessReferences && (r || executionInfo.groupUnnamedResourcesAccessed)) {\n indexesWithAccessReferences.push(i)\n }\n\n if (r && !hasAccessReferences) {\n if (r.boxes || r.extraBoxRefs) throw Error('Unexpected boxes at the transaction level')\n if (r.appLocals) throw Error('Unexpected app local at the transaction level')\n if (r.assetHoldings)\n throw Error('Unexpected asset holding at the transaction level')\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(group[i].txn as any)['applicationCall'] = {\n ...group[i].txn.applicationCall,\n accounts: [...(group[i].txn?.applicationCall?.accounts ?? []), ...(r.accounts ?? [])],\n foreignApps: [...(group[i].txn?.applicationCall?.foreignApps ?? []), ...(r.apps ?? [])],\n foreignAssets: [...(group[i].txn?.applicationCall?.foreignAssets ?? []), ...(r.assets ?? [])],\n boxes: [...(group[i].txn?.applicationCall?.boxes ?? []), ...(r.boxes ?? [])],\n } satisfies Partial<ApplicationTransactionFields>\n\n const accounts = group[i].txn.applicationCall?.accounts?.length ?? 0\n if (accounts > MAX_APP_CALL_ACCOUNT_REFERENCES)\n throw Error(`Account reference limit of ${MAX_APP_CALL_ACCOUNT_REFERENCES} exceeded in transaction ${i}`)\n const assets = group[i].txn.applicationCall?.foreignAssets?.length ?? 0\n const apps = group[i].txn.applicationCall?.foreignApps?.length ?? 0\n const boxes = group[i].txn.applicationCall?.boxes?.length ?? 0\n if (accounts + assets + apps + boxes > MAX_APP_CALL_FOREIGN_REFERENCES) {\n throw Error(`Resource reference limit of ${MAX_APP_CALL_FOREIGN_REFERENCES} exceeded in transaction ${i}`)\n }\n }\n }\n\n // Cover App Call Inner Transaction Fees\n if (sendParams.coverAppCallInnerTransactionFees) {\n const additionalTransactionFee = additionalTransactionFees.get(i)\n\n if (additionalTransactionFee !== undefined) {\n if (group[i].txn.type !== algosdk.TransactionType.appl) {\n throw Error(`An additional fee of ${additionalTransactionFee} µALGO is required for non app call transaction ${i}`)\n }\n const transactionFee = group[i].txn.fee + additionalTransactionFee\n const maxFee = additionalAtcContext?.maxFees?.get(i)?.microAlgo\n if (maxFee === undefined || transactionFee > maxFee) {\n throw Error(\n `Calculated transaction fee ${transactionFee} µALGO is greater than max of ${maxFee ?? 'undefined'} for transaction ${i}`,\n )\n }\n group[i].txn.fee = transactionFee\n }\n }\n })\n\n // Populate Group App Call Resources\n if (sendParams.populateAppCallResources) {\n if (indexesWithAccessReferences.length > 0) {\n Config.logger.warn(\n `Resource population will be skipped for transaction indexes ${indexesWithAccessReferences.join(', ')} as they use access references.`,\n )\n }\n\n const populateGroupResource = (\n txns: algosdk.TransactionWithSigner[],\n reference:\n | string\n | algosdk.modelsv2.BoxReference\n | algosdk.modelsv2.ApplicationLocalReference\n | algosdk.modelsv2.AssetHoldingReference\n | bigint\n | number\n | Address,\n type: 'account' | 'assetHolding' | 'appLocal' | 'app' | 'box' | 'asset',\n ): void => {\n const isApplBelowLimit = (t: algosdk.TransactionWithSigner) => {\n if (t.txn.type !== algosdk.TransactionType.appl) return false\n if (appCallHasAccessReferences(t.txn)) return false\n\n const accounts = t.txn.applicationCall?.accounts?.length ?? 0\n const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0\n const apps = t.txn.applicationCall?.foreignApps?.length ?? 0\n const boxes = t.txn.applicationCall?.boxes?.length ?? 0\n\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES\n }\n\n // If this is a asset holding or app local, first try to find a transaction that already has the account available\n if (type === 'assetHolding' || type === 'appLocal') {\n const { account } = reference as algosdk.modelsv2.ApplicationLocalReference | algosdk.modelsv2.AssetHoldingReference\n\n let txnIndex = txns.findIndex((t) => {\n if (!isApplBelowLimit(t)) return false\n\n return (\n // account is in the foreign accounts array\n t.txn.applicationCall?.accounts?.map((a) => a.toString()).includes(account.toString()) ||\n // account is available as an app account\n t.txn.applicationCall?.foreignApps?.map((a) => algosdk.getApplicationAddress(a).toString()).includes(account.toString()) ||\n // account is available since it's in one of the fields\n Object.values(t.txn).some((f) =>\n stringifyJSON(f, (_, v) => (v instanceof Address ? v.toString() : v))?.includes(account.toString()),\n )\n )\n })\n\n if (txnIndex > -1) {\n if (type === 'assetHolding') {\n const { asset } = reference as algosdk.modelsv2.AssetHoldingReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],\n } satisfies Partial<ApplicationTransactionFields>\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],\n } satisfies Partial<ApplicationTransactionFields>\n }\n return\n }\n\n // Now try to find a txn that already has that app or asset available\n txnIndex = txns.findIndex((t) => {\n if (!isApplBelowLimit(t)) return false\n\n // check if there is space in the accounts array\n if ((t.txn.applicationCall?.accounts?.length ?? 0) >= MAX_APP_CALL_ACCOUNT_REFERENCES) return false\n\n if (type === 'assetHolding') {\n const { asset } = reference as algosdk.modelsv2.AssetHoldingReference\n return t.txn.applicationCall?.foreignAssets?.includes(asset)\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app\n }\n })\n\n if (txnIndex > -1) {\n const { account } = reference as algosdk.modelsv2.AssetHoldingReference | algosdk.modelsv2.ApplicationLocalReference\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],\n } satisfies Partial<ApplicationTransactionFields>\n\n return\n }\n }\n\n // If this is a box, first try to find a transaction that already has the app available\n if (type === 'box') {\n const { app, name } = reference as algosdk.modelsv2.BoxReference\n\n const txnIndex = txns.findIndex((t) => {\n if (!isApplBelowLimit(t)) return false\n\n // If the app is in the foreign array OR the app being called, then we know it's available\n return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app\n })\n\n if (txnIndex > -1) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name } satisfies TransactionBoxReference]],\n } satisfies Partial<ApplicationTransactionFields>\n\n return\n }\n }\n\n // Find the txn index to put the reference(s)\n const txnIndex = txns.findIndex((t) => {\n if (t.txn.type !== algosdk.TransactionType.appl) return false\n if (appCallHasAccessReferences(t.txn)) return false\n\n const accounts = t.txn.applicationCall?.accounts?.length ?? 0\n const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0\n const apps = t.txn.applicationCall?.foreignApps?.length ?? 0\n const boxes = t.txn.applicationCall?.boxes?.length ?? 0\n\n if (type === 'account')\n return accounts < MAX_APP_CALL_ACCOUNT_REFERENCES && accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES\n\n // If we're adding local state or asset holding, we need space for the acocunt and the other reference\n if (type === 'assetHolding' || type === 'appLocal') {\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES - 1 && accounts < MAX_APP_CALL_ACCOUNT_REFERENCES\n }\n\n // If we're adding a box, we need space for both the box ref and the app ref\n if (type === 'box' && BigInt((reference as algosdk.modelsv2.BoxReference).app) !== BigInt(0)) {\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES - 1\n }\n\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES\n })\n\n if (txnIndex === -1) {\n throw Error('No more transactions below reference limit. Add another app call to the group.')\n }\n\n if (type === 'account') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[reference as Address]],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'app') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [\n ...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []),\n ...[typeof reference === 'bigint' ? reference : BigInt(reference as number)],\n ],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'box') {\n const { app, name } = reference as algosdk.modelsv2.BoxReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name } satisfies TransactionBoxReference]],\n } satisfies Partial<ApplicationTransactionFields>\n\n if (app.toString() !== '0') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],\n } satisfies Partial<ApplicationTransactionFields>\n }\n } else if (type === 'assetHolding') {\n const { asset, account } = reference as algosdk.modelsv2.AssetHoldingReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'appLocal') {\n const { app, account } = reference as algosdk.modelsv2.ApplicationLocalReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'asset') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignAssets: [\n ...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []),\n ...[typeof reference === 'bigint' ? reference : BigInt(reference as number)],\n ],\n } satisfies Partial<ApplicationTransactionFields>\n }\n }\n\n const g = executionInfo.groupUnnamedResourcesAccessed\n\n if (g) {\n // Do cross-reference resources first because they are the most restrictive in terms\n // of which transactions can be used\n g.appLocals?.forEach((a) => {\n populateGroupResource(group, a, 'appLocal')\n\n // Remove resources from the group if we're adding them here\n g.accounts = g.accounts?.filter((acc) => acc !== a.account)\n g.apps = g.apps?.filter((app) => BigInt(app) !== BigInt(a.app))\n })\n\n g.assetHoldings?.forEach((a) => {\n populateGroupResource(group, a, 'assetHolding')\n\n // Remove resources from the group if we're adding them here\n g.accounts = g.accounts?.filter((acc) => acc !== a.account)\n g.assets = g.assets?.filter((asset) => BigInt(asset) !== BigInt(a.asset))\n })\n\n // Do accounts next because the account limit is 4\n g.accounts?.forEach((a) => {\n populateGroupResource(group, a, 'account')\n })\n\n g.boxes?.forEach((b) => {\n populateGroupResource(group, b, 'box')\n\n // Remove apps as resource from the group if we're adding it here\n g.apps = g.apps?.filter((app) => BigInt(app) !== BigInt(b.app))\n })\n\n g.assets?.forEach((a) => {\n populateGroupResource(group, a, 'asset')\n })\n\n g.apps?.forEach((a) => {\n populateGroupResource(group, a, 'app')\n })\n\n if (g.extraBoxRefs) {\n for (let i = 0; i < g.extraBoxRefs; i += 1) {\n const ref = new algosdk.modelsv2.BoxReference({ app: 0, name: new Uint8Array(0) })\n populateGroupResource(group, ref, 'box')\n }\n }\n }\n }\n\n const newAtc = new algosdk.AtomicTransactionComposer()\n\n group.forEach((t) => {\n t.txn.group = undefined\n newAtc.addTransaction(t)\n })\n\n newAtc['methodCalls'] = atc['methodCalls']\n return newAtc\n}\n\n/**\n * Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `AtomicTransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendAtomicTransactionComposer = async function (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) {\n const { atc: givenAtc, sendParams, additionalAtcContext, ...executeParams } = atcSend\n\n let atc: AtomicTransactionComposer\n\n atc = givenAtc\n try {\n const transactionsWithSigner = atc.buildGroup()\n\n // If populateAppCallResources is true OR if populateAppCallResources is undefined and there are app calls, then populate resources\n const populateAppCallResources =\n executeParams?.populateAppCallResources ?? sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n const coverAppCallInnerTransactionFees = executeParams?.coverAppCallInnerTransactionFees\n\n if (\n (populateAppCallResources || coverAppCallInnerTransactionFees) &&\n transactionsWithSigner.map((t) => t.txn.type).includes(algosdk.TransactionType.appl)\n ) {\n atc = await prepareGroupForSending(\n givenAtc,\n algod,\n { ...executeParams, populateAppCallResources, coverAppCallInnerTransactionFees },\n additionalAtcContext,\n )\n }\n\n // atc.buildGroup() is needed to ensure that any changes made by prepareGroupForSending are reflected and the group id is set\n const transactionsToSend = atc.buildGroup().map((t) => {\n return t.txn\n })\n let groupId: string | undefined = undefined\n if (transactionsToSend.length > 1) {\n groupId = transactionsToSend[0].group ? Buffer.from(transactionsToSend[0].group).toString('base64') : ''\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(\n `Sending group of ${transactionsToSend.length} transactions (${groupId})`,\n {\n transactionsToSend,\n },\n )\n\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).debug(\n `Transaction IDs (${groupId})`,\n transactionsToSend.map((t) => t.txID()),\n )\n }\n\n if (Config.debug && Config.traceAll) {\n // Emit the simulate response for use with AlgoKit AVM debugger\n const simulateResponse = await performAtomicTransactionComposerSimulate(atc, algod)\n await Config.events.emitAsync(EventType.TxnGroupSimulated, {\n simulateResponse,\n })\n }\n const result = await atc.execute(\n algod,\n executeParams?.maxRoundsToWaitForConfirmation ?? sendParams?.maxRoundsToWaitForConfirmation ?? 5,\n )\n\n if (transactionsToSend.length > 1) {\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(\n `Group transaction (${groupId}) sent with ${transactionsToSend.length} transactions`,\n )\n } else {\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(\n `Sent transaction ID ${transactionsToSend[0].txID()} ${transactionsToSend[0].type} from ${transactionsToSend[0].sender.toString()}`,\n )\n }\n\n let confirmations: modelsv2.PendingTransactionResponse[] | undefined = undefined\n if (!sendParams?.skipWaiting) {\n confirmations = await Promise.all(transactionsToSend.map(async (t) => await algod.pendingTransactionInformation(t.txID()).do()))\n }\n\n const methodCalls = [...(atc['methodCalls'] as Map<number, ABIMethod>).values()]\n\n return {\n groupId,\n confirmations,\n txIds: transactionsToSend.map((t) => t.txID()),\n transactions: transactionsToSend,\n returns: result.methodResults.map((r, i) => getABIReturnValue(r, methodCalls[i]!.returns.type)),\n } as SendAtomicTransactionComposerResults\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n // Create a new error object so the stack trace is correct (algosdk throws an error with a more limited stack trace)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const err = new Error(typeof e === 'object' ? e?.message : 'Received error executing Atomic Transaction Composer') as any as any\n err.cause = e\n if (typeof e === 'object') {\n // Remove headers as it doesn't have anything useful.\n delete e.response?.headers\n err.response = e.response\n // body property very noisy\n if (e.response && 'body' in e.response) delete err.response.body\n err.name = e.name\n }\n\n if (Config.debug && typeof e === 'object') {\n err.traces = []\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).error(\n 'Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information',\n err,\n )\n const simulate = await performAtomicTransactionComposerSimulate(atc, algod)\n if (Config.debug && !Config.traceAll) {\n // Emit the event only if traceAll: false, as it should have already been emitted above\n await Config.events.emitAsync(EventType.TxnGroupSimulated, {\n simulateResponse: simulate,\n })\n }\n\n if (simulate && simulate.txnGroups[0].failedAt) {\n for (const txn of simulate.txnGroups[0].txnResults) {\n err.traces.push({\n trace: txn.execTrace?.toEncodingData(),\n appBudget: txn.appBudgetConsumed,\n logicSigBudget: txn.logicSigBudgetConsumed,\n logs: txn.txnResult.logs,\n message: simulate.txnGroups[0].failureMessage,\n })\n }\n }\n } else {\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).error(\n 'Received error executing Atomic Transaction Composer, for more information enable the debug flag',\n err,\n )\n }\n\n // Attach the sent transactions so we can use them in error transformers\n err.sentTransactions = atc.buildGroup().map((t) => t.txn)\n throw err\n }\n}\n\n/**\n * Takes an algosdk `ABIResult` and converts it to an `ABIReturn`.\n * Converts `bigint`'s for Uint's < 64 to `number` for easier use.\n * @param result The `ABIReturn`\n */\nexport function getABIReturnValue(result: algosdk.ABIResult, type: ABIReturnType): ABIReturn {\n if (result.decodeError) {\n return {\n decodeError: result.decodeError,\n }\n }\n\n const returnValue = convertAbiByteArrays(\n result.returnValue !== undefined && result.method.returns.type !== 'void'\n ? convertABIDecodedBigIntToNumber(result.returnValue, result.method.returns.type)\n : result.returnValue!,\n type,\n )\n\n return {\n method: result.method,\n rawReturnValue: result.rawReturnValue,\n decodeError: undefined,\n returnValue,\n }\n}\n\n/**\n * @deprecated Use `TransactionComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.\n *\n * Signs and sends a group of [up to 16](https://dev.algorand.co/concepts/transactions/atomic-txn-groups/#create-transactions) transactions to the chain\n *\n * @param groupSend The group details to send, with:\n * * `transactions`: The array of transactions to send along with their signing account\n * * `sendParams`: The parameters to dictate how the group is sent\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendGroupOfTransactions = async function (groupSend: TransactionGroupToSend, algod: Algodv2) {\n const { transactions, signer, sendParams } = groupSend\n\n const defaultTransactionSigner = signer ? getSenderTransactionSigner(signer) : undefined\n\n const transactionsWithSigner = await Promise.all(\n transactions.map(async (t) => {\n if ('signer' in t)\n return {\n txn: t.transaction,\n signer: getSenderTransactionSigner(t.signer),\n sender: t.signer,\n }\n\n const txn = 'then' in t ? (await t).transaction : t\n if (!signer) {\n throw new Error(`Attempt to send transaction ${txn.txID()} as part of a group transaction, but no signer parameter was provided.`)\n }\n\n return {\n txn,\n signer: defaultTransactionSigner!,\n sender: signer,\n }\n }),\n )\n\n const atc = new AtomicTransactionComposer()\n transactionsWithSigner.forEach((txn) => atc.addTransaction(txn))\n\n return (await sendAtomicTransactionComposer({ atc, sendParams }, algod)) as Omit<SendAtomicTransactionComposerResults, 'returns'>\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: Algodv2,\n): Promise<modelsv2.PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status().do()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId).do()\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n } catch (e: unknown) {\n if ((e as Error).name === 'URLTokenBaseHTTPError') {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound)).do()\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n\n/**\n * @deprecated Use `TransactionComposer` and the `maxFee` field in the transaction params instead.\n *\n * Limit the acceptable fee to a defined amount of µAlgo.\n * This also sets the transaction to be flatFee to ensure the transaction only succeeds at\n * the estimated rate.\n * @param transaction The transaction to cap or suggested params object about to be used to create a transaction\n * @param maxAcceptableFee The maximum acceptable fee to pay\n */\nexport function capTransactionFee(transaction: algosdk.Transaction | SuggestedParams, maxAcceptableFee: AlgoAmount) {\n // If a flat fee hasn't already been defined\n if (!('flatFee' in transaction) || !transaction.flatFee) {\n // Once a transaction has been constructed by algosdk, transaction.fee indicates what the total transaction fee\n // Will be based on the current suggested fee-per-byte value.\n if (transaction.fee > maxAcceptableFee.microAlgo) {\n throw new Error(\n `Cancelled transaction due to high network congestion fees. Algorand suggested fees would cause this transaction to cost ${transaction.fee} µALGO. Cap for this transaction is ${maxAcceptableFee.microAlgo} µALGO.`,\n )\n } else if (transaction.fee > 1_000_000) {\n Config.logger.warn(`Algorand network congestion fees are in effect. This transaction will incur a fee of ${transaction.fee} µALGO.`)\n }\n\n // Now set the flat on the transaction. Otherwise the network may increase the fee above our cap and perform the transaction.\n if ('flatFee' in transaction) {\n transaction.flatFee = true\n }\n }\n}\n\n/**\n * @deprecated Use `TransactionComposer` and the `maxFee` and `staticFee` fields in the transaction params instead.\n *\n * Allows for control of fees on a `Transaction` or `SuggestedParams` object\n * @param transaction The transaction or suggested params\n * @param feeControl The fee control parameters\n */\nexport function controlFees<T extends SuggestedParams | Transaction>(\n transaction: T,\n feeControl: { fee?: AlgoAmount; maxFee?: AlgoAmount },\n) {\n const { fee, maxFee } = feeControl\n if (fee) {\n transaction.fee = Number(fee.microAlgo)\n if ('flatFee' in transaction) {\n transaction.flatFee = true\n }\n }\n\n if (maxFee !== undefined) {\n capTransactionFee(transaction, maxFee)\n }\n\n return transaction\n}\n\n/**\n * @deprecated Use `suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()` instead\n *\n * Returns suggested transaction parameters from algod unless some are already provided.\n * @param params Optionally provide parameters to use\n * @param algod Algod algod\n * @returns The suggested transaction parameters\n */\nexport async function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<SuggestedParams> {\n if (params) {\n return { ...params }\n }\n const p = await algod.getTransactionParams().do()\n return {\n fee: p.fee,\n firstValid: p.firstValid,\n lastValid: p.lastValid,\n genesisID: p.genesisID,\n genesisHash: p.genesisHash,\n minFee: p.minFee,\n }\n}\n\n/**\n * @deprecated Use `atc.clone().buildGroup()` instead.\n *\n * Returns the array of transactions currently present in the given `AtomicTransactionComposer`\n * @param atc The atomic transaction composer\n * @returns The array of transactions with signers\n */\nexport function getAtomicTransactionComposerTransactions(atc: AtomicTransactionComposer) {\n try {\n return atc.clone().buildGroup()\n } catch {\n return []\n }\n}\n"],"mappings":";;;;;;;AA6BO,IAAA,4BAA4B,QAAQ;AAO3C,MAAa,6BAA6B;AAC1C,MAAa,kCAAkC;AAC/C,MAAa,kCAAkC;;;;;;;;;;;;;;;;AAiB/C,SAAgB,sBAAsB,MAAgD;CACpF,IAAI,QAAQ,QAAQ,OAAO,SAAS,aAClC;MACK,IAAI,OAAO,SAAS,YAAY,KAAK,gBAAgB,YAC1D,OAAO;MACF,IAAI,OAAO,SAAS,YAAY,cAAc,MA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B,QAAqC,OAA0C;CACxH,IAAI,QACF,OAAO,EAAE,GAAG,OAAO;CAErB,MAAM,IAAI,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG;CAChD,OAAO;EACL,KAAK,EAAE;EACP,YAAY,EAAE;EACd,WAAW,EAAE;EACb,WAAW,EAAE;EACb,aAAa,EAAE;EACf,QAAQ,EAAE;CACZ;AACF;;;;;;;;AASA,SAAgB,yCAAyC,KAAgC;CACvF,IAAI;EACF,OAAO,IAAI,MAAM,CAAC,CAAC,WAAW;CAChC,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
1
+ {"version":3,"file":"transaction.mjs","names":[],"sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import algosdk, {\n ABIMethod,\n ABIReturnType,\n Address,\n ApplicationTransactionFields,\n stringifyJSON,\n TransactionBoxReference,\n TransactionType,\n} from 'algosdk'\nimport { Buffer } from 'buffer'\nimport { Config } from '../config'\nimport { AlgoAmount } from '../types/amount'\nimport { ABIReturn } from '../types/app'\nimport { EventType } from '../types/lifecycle-events'\nimport {\n AdditionalAtomicTransactionComposerContext,\n AtomicTransactionComposerToSend,\n SendAtomicTransactionComposerResults,\n SendParams,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionGroupToSend,\n TransactionNote,\n TransactionToSign,\n} from '../types/transaction'\nimport { asJson, convertAbiByteArrays, convertABIDecodedBigIntToNumber, toNumber } from '../util'\nimport { performAtomicTransactionComposerSimulate } from './perform-atomic-transaction-composer-simulate'\nimport { resolveSignedTransactions } from './resolve-signed-transactions'\nimport Algodv2 = algosdk.Algodv2\nimport AtomicTransactionComposer = algosdk.AtomicTransactionComposer\nimport modelsv2 = algosdk.modelsv2\nimport SuggestedParams = algosdk.SuggestedParams\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\nimport TransactionWithSigner = algosdk.TransactionWithSigner\n\nexport const MAX_TRANSACTION_GROUP_SIZE = 16\nexport const MAX_APP_CALL_FOREIGN_REFERENCES = 8\nexport const MAX_APP_CALL_ACCOUNT_REFERENCES = 8\n\n/**\n * @deprecated Convert your data to a `string` or `Uint8Array`, if using ARC-2 use `TransactionComposer.arc2Note`.\n *\n * Encodes a transaction note into a byte array ready to be included in an Algorand transaction.\n *\n * @param note The transaction note\n * @returns the transaction note ready for inclusion in a transaction\n *\n * Case on the value of `data` this either be:\n * * `null` | `undefined`: `undefined`\n * * `string`: The string value\n * * Uint8Array: passthrough\n * * Arc2TransactionNote object: ARC-0002 compatible transaction note\n * * Else: The object/value converted into a JSON string representation\n */\nexport function encodeTransactionNote(note?: TransactionNote): Uint8Array | undefined {\n if (note == null || typeof note === 'undefined') {\n return undefined\n } else if (typeof note === 'object' && note.constructor === Uint8Array) {\n return note\n } else if (typeof note === 'object' && 'dAppName' in note) {\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 } else {\n const n = typeof note === 'string' ? note : asJson(note)\n const encoder = new TextEncoder()\n return encoder.encode(n)\n }\n}\n\n/** Encodes a transaction lease into a 32-byte array ready to be included in an Algorand transaction.\n *\n * @param lease The transaction lease as a string or binary array or null/undefined if there is no lease\n * @returns the transaction lease ready for inclusion in a transaction or `undefined` if there is no lease\n * @throws if the length of the data is > 32 bytes or empty\n * @example algokit.encodeLease('UNIQUE_ID')\n * @example algokit.encodeLease(new Uint8Array([1, 2, 3]))\n */\nexport function encodeLease(lease?: string | Uint8Array): Uint8Array | undefined {\n if (lease === null || typeof lease === 'undefined') {\n return undefined\n } else if (typeof lease === 'object' && lease.constructor === Uint8Array) {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received bytes with length ${lease.length}`,\n )\n }\n if (lease.length === 32) return lease\n const lease32 = new Uint8Array(32)\n lease32.set(lease, 0)\n return lease32\n } else if (typeof lease === 'string') {\n if (lease.length === 0 || lease.length > 32) {\n throw new Error(\n `Received invalid lease; expected something with length between 1 and 32, but received '${lease}' with length ${lease.length}`,\n )\n }\n const encoder = new TextEncoder()\n const lease32 = new Uint8Array(32)\n lease32.set(encoder.encode(lease), 0)\n return lease32\n } else {\n throw new Error(`Unknown lease type received of ${typeof lease}`)\n }\n}\n\n/**\n * @deprecated Use `algorand.client` to interact with accounts, and use `.addr` to get the address\n * and/or move from using `SendTransactionFrom` to `TransactionSignerAccount` and use `.addr` instead.\n *\n * Returns the public address of the given transaction sender.\n * @param sender A transaction sender\n * @returns The public address\n */\nexport const getSenderAddress = function (sender: string | SendTransactionFrom): string {\n return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr.toString() : sender.address().toString()\n}\n\n/**\n * @deprecated Use `AlgorandClient` / `TransactionComposer` to construct transactions instead or\n * construct an `algosdk.TransactionWithSigner` manually instead.\n *\n * Given a transaction in a variety of supported formats, returns a TransactionWithSigner object ready to be passed to an\n * AtomicTransactionComposer's addTransaction method.\n * @param transaction One of: A TransactionWithSigner object (returned as is), a TransactionToSign object (signer is obtained from the\n * signer property), a Transaction object (signer is extracted from the defaultSender parameter), an async SendTransactionResult returned by\n * one of algokit utils' helpers (signer is obtained from the defaultSender parameter)\n * @param defaultSender The default sender to be used to obtain a signer where the object provided to the transaction parameter does not\n * include a signer.\n * @returns A TransactionWithSigner object.\n */\nexport const getTransactionWithSigner = async (\n transaction: TransactionWithSigner | TransactionToSign | Transaction | Promise<SendTransactionResult>,\n defaultSender?: SendTransactionFrom,\n): Promise<TransactionWithSigner> => {\n if ('txn' in transaction) return transaction\n if (defaultSender === undefined)\n throw new Error('Default sender must be provided when passing in a transaction object that does not contain its own signer')\n return transaction instanceof Promise\n ? {\n txn: (await transaction).transaction,\n signer: getSenderTransactionSigner(defaultSender),\n }\n : 'transaction' in transaction\n ? {\n txn: transaction.transaction,\n signer: getSenderTransactionSigner(transaction.signer),\n }\n : {\n txn: transaction,\n signer: getSenderTransactionSigner(defaultSender),\n }\n}\n\nconst memoize = <T = unknown, R = unknown>(fn: (val: T) => R) => {\n const cache = new Map()\n const cached = function (this: unknown, val: T) {\n return cache.has(val) ? cache.get(val) : cache.set(val, fn.call(this, val)) && cache.get(val)\n }\n cached.cache = cache\n return cached as (val: T) => R\n}\n\n/**\n * @deprecated Use `TransactionSignerAccount` instead of `SendTransactionFrom` or use\n * `algosdk.makeBasicAccountTransactionSigner` / `algosdk.makeLogicSigAccountTransactionSigner`.\n *\n * Returns a `TransactionSigner` for the given transaction sender.\n * This function has memoization, so will return the same transaction signer for a given sender.\n * @param sender A transaction sender\n * @returns A transaction signer\n */\nexport const getSenderTransactionSigner = memoize(function (sender: SendTransactionFrom): TransactionSigner {\n return 'signer' in sender\n ? sender.signer\n : 'lsig' in sender\n ? algosdk.makeLogicSigAccountTransactionSigner(sender)\n : algosdk.makeBasicAccountTransactionSigner(sender)\n})\n\n/**\n * @deprecated Use `AlgorandClient` / `TransactionComposer` to sign transactions\n * or use the relevant underlying `account.signTxn` / `algosdk.signLogicSigTransactionObject`\n * / `multiSigAccount.sign` / `TransactionSigner` methods directly.\n *\n * Signs a single transaction by the given signer.\n * @param transaction The transaction to sign\n * @param signer The signer to sign\n * @returns The signed transaction as a `Uint8Array`\n */\nexport const signTransaction = async (transaction: Transaction, signer: SendTransactionFrom) => {\n return 'sk' in signer\n ? transaction.signTxn(signer.sk)\n : 'lsig' in signer\n ? algosdk.signLogicSigTransactionObject(transaction, signer).blob\n : 'sign' in signer\n ? signer.sign(transaction)\n : (await signer.signer([transaction], [0]))[0]\n}\n\n/**\n * @deprecated Use `AlgorandClient` / `TransactionComposer` to send transactions.\n *\n * Prepares a transaction for sending and then (if instructed) signs and sends the given transaction to the chain.\n *\n * @param send The details for the transaction to prepare/send, including:\n * * `transaction`: The unsigned transaction\n * * `from`: The account to sign the transaction with: either an account with private key loaded or a logic signature account\n * * `config`: The sending configuration for this transaction\n * @param algod An algod client\n *\n * @returns An object with transaction (`transaction`) and (if `skipWaiting` is `false` or `undefined`) confirmation (`confirmation`)\n */\nexport const sendTransaction = async function (\n send: {\n transaction: Transaction\n from: SendTransactionFrom\n sendParams?: SendTransactionParams\n },\n algod: Algodv2,\n): Promise<SendTransactionResult> {\n const { transaction, from, sendParams } = send\n const { skipSending, skipWaiting, fee, maxFee, suppressLog, maxRoundsToWaitForConfirmation, atc } = sendParams ?? {}\n\n controlFees(transaction, { fee, maxFee })\n\n if (atc) {\n atc.addTransaction({ txn: transaction, signer: getSenderTransactionSigner(from) })\n return { transaction }\n }\n\n if (skipSending) {\n return { transaction }\n }\n\n let txnToSend = transaction\n\n const populateAppCallResources = sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n\n // Populate resources if the transaction is an appcall and populateAppCallResources wasn't explicitly set to false\n if (txnToSend.type === algosdk.TransactionType.appl && populateAppCallResources) {\n const newAtc = new AtomicTransactionComposer()\n newAtc.addTransaction({ txn: txnToSend, signer: getSenderTransactionSigner(from) })\n const atc = await prepareGroupForSending(newAtc, algod, { ...sendParams, populateAppCallResources })\n txnToSend = atc.buildGroup()[0].txn\n }\n\n const signedTransaction = await signTransaction(txnToSend, from)\n\n // Signers (e.g. wallets) can mutate the transaction they sign, so the signed transaction is the source of truth for\n // what is actually sent to the network\n txnToSend = resolveSignedTransactions([txnToSend], [signedTransaction])[0]\n\n await algod.sendRawTransaction(signedTransaction).do()\n\n Config.getLogger(suppressLog).verbose(`Sent transaction ID ${txnToSend.txID()} ${txnToSend.type} from ${getSenderAddress(from)}`)\n\n let confirmation: modelsv2.PendingTransactionResponse | undefined = undefined\n if (!skipWaiting) {\n confirmation = await waitForConfirmation(txnToSend.txID(), maxRoundsToWaitForConfirmation ?? 5, algod)\n }\n\n return { transaction: txnToSend, confirmation }\n}\n\n/**\n * Get the execution info of a transaction group for the given ATC\n * The function uses the simulate endpoint and depending on the sendParams can return the following:\n * - The unnamed resources accessed by the group\n * - The unnamed resources accessed by each transaction in the group\n * - The required fee delta for each transaction in the group. A positive value indicates a fee deficit, a negative value indicates a surplus.\n *\n * @param atc The ATC containing the txn group\n * @param algod The algod client to use for the simulation\n * @param sendParams The send params for the transaction group\n * @param additionalAtcContext Additional ATC context used to determine how best to alter transactions in the group\n * @returns The execution info for the group\n */\nasync function getGroupExecutionInfo(\n atc: algosdk.AtomicTransactionComposer,\n algod: algosdk.Algodv2,\n sendParams: SendParams,\n additionalAtcContext?: AdditionalAtomicTransactionComposerContext,\n) {\n const simulateRequest = new algosdk.modelsv2.SimulateRequest({\n txnGroups: [],\n allowUnnamedResources: true,\n allowEmptySignatures: true,\n fixSigners: true,\n })\n\n const nullSigner = algosdk.makeEmptyTransactionSigner()\n\n const emptySignerAtc = atc.clone()\n\n const appCallIndexesWithoutMaxFees: number[] = []\n emptySignerAtc['transactions'].forEach((t: algosdk.TransactionWithSigner, i: number) => {\n t.signer = nullSigner\n\n if (sendParams.coverAppCallInnerTransactionFees && t.txn.type === TransactionType.appl) {\n if (!additionalAtcContext?.suggestedParams) {\n throw Error(`Please provide additionalAtcContext.suggestedParams when coverAppCallInnerTransactionFees is enabled`)\n }\n\n const maxFee = additionalAtcContext?.maxFees?.get(i)?.microAlgo\n if (maxFee === undefined) {\n appCallIndexesWithoutMaxFees.push(i)\n } else {\n t.txn.fee = maxFee\n }\n }\n })\n\n if (sendParams.coverAppCallInnerTransactionFees && appCallIndexesWithoutMaxFees.length > 0) {\n throw Error(\n `Please provide a maxFee for each app call transaction when coverAppCallInnerTransactionFees is enabled. Required for transaction ${appCallIndexesWithoutMaxFees.join(', ')}`,\n )\n }\n\n const perByteTxnFee = BigInt(additionalAtcContext?.suggestedParams.fee ?? 0n)\n const minTxnFee = BigInt(additionalAtcContext?.suggestedParams.minFee ?? 1000n)\n\n const result = await emptySignerAtc.simulate(algod, simulateRequest)\n\n const groupResponse = result.simulateResponse.txnGroups[0]\n\n if (groupResponse.failureMessage) {\n if (sendParams.coverAppCallInnerTransactionFees && groupResponse.failureMessage.match(/fee ([\\w.]+\\s+)?too small/)) {\n throw Error(`Fees were too small to resolve execution info via simulate. You may need to increase an app call transaction maxFee.`)\n }\n\n throw Error(`Error resolving execution info via simulate in transaction ${groupResponse.failedAt}: ${groupResponse.failureMessage}`)\n }\n\n const sortedResources = groupResponse.unnamedResourcesAccessed\n\n // NOTE: We explicitly want to avoid localeCompare as that can lead to different results in different environments\n const compare = (a: string | bigint, b: string | bigint) => (a < b ? -1 : a > b ? 1 : 0)\n\n if (sortedResources) {\n sortedResources.accounts?.sort((a, b) => compare(a.toString(), b.toString()))\n sortedResources.assets?.sort(compare)\n sortedResources.apps?.sort(compare)\n sortedResources.boxes?.sort((a, b) => {\n const aStr = `${a.app}-${a.name}`\n const bStr = `${b.app}-${b.name}`\n return compare(aStr, bStr)\n })\n sortedResources.appLocals?.sort((a, b) => {\n const aStr = `${a.app}-${a.account}`\n const bStr = `${b.app}-${b.account}`\n return compare(aStr, bStr)\n })\n sortedResources.assetHoldings?.sort((a, b) => {\n const aStr = `${a.asset}-${a.account}`\n const bStr = `${b.asset}-${b.account}`\n return compare(aStr, bStr)\n })\n }\n\n return {\n groupUnnamedResourcesAccessed: sendParams.populateAppCallResources ? sortedResources : undefined,\n txns: groupResponse.txnResults.map((txn, i) => {\n const originalTxn = atc['transactions'][i].txn as algosdk.Transaction\n\n let requiredFeeDelta = 0n\n if (sendParams.coverAppCallInnerTransactionFees) {\n // Min fee calc is lifted from algosdk https://github.com/algorand/js-algorand-sdk/blob/6973ff583b243ddb0632e91f4c0383021430a789/src/transaction.ts#L710\n // 75 is the number of bytes added to a txn after signing it\n const parentPerByteFee = perByteTxnFee * BigInt(originalTxn.toByte().length + 75)\n const parentMinFee = parentPerByteFee < minTxnFee ? minTxnFee : parentPerByteFee\n const parentFeeDelta = parentMinFee - originalTxn.fee\n if (originalTxn.type === TransactionType.appl) {\n const calculateInnerFeeDelta = (itxns: algosdk.modelsv2.PendingTransactionResponse[], acc: bigint = 0n): bigint => {\n // Surplus inner transaction fees do not pool up to the parent transaction.\n // Additionally surplus inner transaction fees only pool from sibling transactions that are sent prior to a given inner transaction, hence why we iterate in reverse order.\n return itxns.reverse().reduce((acc, itxn) => {\n const currentFeeDelta =\n (itxn.innerTxns && itxn.innerTxns.length > 0 ? calculateInnerFeeDelta(itxn.innerTxns, acc) : acc) +\n (minTxnFee - itxn.txn.txn.fee) // Inner transactions don't require per byte fees\n return currentFeeDelta < 0n ? 0n : currentFeeDelta\n }, acc)\n }\n\n const innerFeeDelta = calculateInnerFeeDelta(txn.txnResult.innerTxns ?? [])\n requiredFeeDelta = innerFeeDelta + parentFeeDelta\n } else {\n requiredFeeDelta = parentFeeDelta\n }\n }\n\n return {\n unnamedResourcesAccessed: sendParams.populateAppCallResources ? txn.unnamedResourcesAccessed : undefined,\n requiredFeeDelta,\n }\n }),\n }\n}\n\n/**\n * Take an existing Atomic Transaction Composer and return a new one with the required\n * app call resources populated into it\n *\n * @param algod The algod client to use for the simulation\n * @param atc The ATC containing the txn group\n * @returns A new ATC with the resources populated into the transactions\n *\n * @privateRemarks\n *\n * This entire function will eventually be implemented in simulate upstream in algod. The simulate endpoint will return\n * an array of refference arrays for each transaction, so this eventually will eventually just call simulate and set the\n * reference arrays in the transactions to the reference arrays returned by simulate.\n *\n * See https://github.com/algorand/go-algorand/pull/5684\n *\n */\nexport async function populateAppCallResources(atc: algosdk.AtomicTransactionComposer, algod: algosdk.Algodv2) {\n return await prepareGroupForSending(atc, algod, { populateAppCallResources: true })\n}\n\n/**\n * Take an existing Atomic Transaction Composer and return a new one with changes applied to the transactions\n * based on the supplied sendParams to prepare it for sending.\n * Please note, that before calling `.execute()` on the returned ATC, you must call `.buildGroup()`.\n *\n * @param algod The algod client to use for the simulation\n * @param atc The ATC containing the txn group\n * @param sendParams The send params for the transaction group\n * @param additionalAtcContext Additional ATC context used to determine how best to change the transactions in the group\n * @returns A new ATC with the changes applied\n *\n * @privateRemarks\n * Parts of this function will eventually be implemented in algod. Namely:\n * - Simulate will return information on how to populate reference arrays, see https://github.com/algorand/go-algorand/pull/6015\n */\nexport async function prepareGroupForSending(\n atc: algosdk.AtomicTransactionComposer,\n algod: algosdk.Algodv2,\n sendParams: SendParams,\n additionalAtcContext?: AdditionalAtomicTransactionComposerContext,\n) {\n const executionInfo = await getGroupExecutionInfo(atc, algod, sendParams, additionalAtcContext)\n const group = atc.buildGroup()\n\n const [_, additionalTransactionFees] = sendParams.coverAppCallInnerTransactionFees\n ? executionInfo.txns\n .map((txn, i) => {\n const groupIndex = i\n const txnInGroup = group[groupIndex].txn\n const maxFee = additionalAtcContext?.maxFees?.get(i)?.microAlgo\n const immutableFee = maxFee !== undefined && maxFee === txnInGroup.fee\n // Because we don't alter non app call transaction, they take priority\n const priorityMultiplier =\n txn.requiredFeeDelta > 0n && (immutableFee || txnInGroup.type !== algosdk.TransactionType.appl) ? 1_000n : 1n\n\n return {\n ...txn,\n groupIndex,\n // Measures the priority level of covering the transaction fee using the surplus group fees. The higher the number, the higher the priority.\n surplusFeePriorityLevel: txn.requiredFeeDelta > 0n ? txn.requiredFeeDelta * priorityMultiplier : -1n,\n }\n })\n .sort((a, b) => {\n return a.surplusFeePriorityLevel > b.surplusFeePriorityLevel ? -1 : a.surplusFeePriorityLevel < b.surplusFeePriorityLevel ? 1 : 0\n })\n .reduce(\n (acc, { groupIndex, requiredFeeDelta }) => {\n if (requiredFeeDelta > 0n) {\n // There is a fee deficit on the transaction\n let surplusGroupFees = acc[0]\n const additionalTransactionFees = acc[1]\n const additionalFeeDelta = requiredFeeDelta - surplusGroupFees\n if (additionalFeeDelta <= 0n) {\n // The surplus group fees fully cover the required fee delta\n surplusGroupFees = -additionalFeeDelta\n } else {\n // The surplus group fees do not fully cover the required fee delta, use what is available\n additionalTransactionFees.set(groupIndex, additionalFeeDelta)\n surplusGroupFees = 0n\n }\n return [surplusGroupFees, additionalTransactionFees] as const\n }\n return acc\n },\n [\n executionInfo.txns.reduce((acc, { requiredFeeDelta }) => {\n if (requiredFeeDelta < 0n) {\n return acc + -requiredFeeDelta\n }\n return acc\n }, 0n),\n new Map<number, bigint>(),\n ] as const,\n )\n : [0n, new Map<number, bigint>()]\n\n const appCallHasAccessReferences = (txn: algosdk.Transaction) => {\n return txn.type === TransactionType.appl && txn.applicationCall?.access && txn.applicationCall?.access.length > 0\n }\n\n const indexesWithAccessReferences: number[] = []\n\n executionInfo.txns.forEach(({ unnamedResourcesAccessed: r }, i) => {\n // Populate Transaction App Call Resources\n if (sendParams.populateAppCallResources && group[i].txn.type === TransactionType.appl) {\n const hasAccessReferences = appCallHasAccessReferences(group[i].txn)\n\n if (hasAccessReferences && (r || executionInfo.groupUnnamedResourcesAccessed)) {\n indexesWithAccessReferences.push(i)\n }\n\n if (r && !hasAccessReferences) {\n if (r.boxes || r.extraBoxRefs) throw Error('Unexpected boxes at the transaction level')\n if (r.appLocals) throw Error('Unexpected app local at the transaction level')\n if (r.assetHoldings)\n throw Error('Unexpected asset holding at the transaction level')\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(group[i].txn as any)['applicationCall'] = {\n ...group[i].txn.applicationCall,\n accounts: [...(group[i].txn?.applicationCall?.accounts ?? []), ...(r.accounts ?? [])],\n foreignApps: [...(group[i].txn?.applicationCall?.foreignApps ?? []), ...(r.apps ?? [])],\n foreignAssets: [...(group[i].txn?.applicationCall?.foreignAssets ?? []), ...(r.assets ?? [])],\n boxes: [...(group[i].txn?.applicationCall?.boxes ?? []), ...(r.boxes ?? [])],\n } satisfies Partial<ApplicationTransactionFields>\n\n const accounts = group[i].txn.applicationCall?.accounts?.length ?? 0\n if (accounts > MAX_APP_CALL_ACCOUNT_REFERENCES)\n throw Error(`Account reference limit of ${MAX_APP_CALL_ACCOUNT_REFERENCES} exceeded in transaction ${i}`)\n const assets = group[i].txn.applicationCall?.foreignAssets?.length ?? 0\n const apps = group[i].txn.applicationCall?.foreignApps?.length ?? 0\n const boxes = group[i].txn.applicationCall?.boxes?.length ?? 0\n if (accounts + assets + apps + boxes > MAX_APP_CALL_FOREIGN_REFERENCES) {\n throw Error(`Resource reference limit of ${MAX_APP_CALL_FOREIGN_REFERENCES} exceeded in transaction ${i}`)\n }\n }\n }\n\n // Cover App Call Inner Transaction Fees\n if (sendParams.coverAppCallInnerTransactionFees) {\n const additionalTransactionFee = additionalTransactionFees.get(i)\n\n if (additionalTransactionFee !== undefined) {\n if (group[i].txn.type !== algosdk.TransactionType.appl) {\n throw Error(`An additional fee of ${additionalTransactionFee} µALGO is required for non app call transaction ${i}`)\n }\n const transactionFee = group[i].txn.fee + additionalTransactionFee\n const maxFee = additionalAtcContext?.maxFees?.get(i)?.microAlgo\n if (maxFee === undefined || transactionFee > maxFee) {\n throw Error(\n `Calculated transaction fee ${transactionFee} µALGO is greater than max of ${maxFee ?? 'undefined'} for transaction ${i}`,\n )\n }\n group[i].txn.fee = transactionFee\n }\n }\n })\n\n // Populate Group App Call Resources\n if (sendParams.populateAppCallResources) {\n if (indexesWithAccessReferences.length > 0) {\n Config.logger.warn(\n `Resource population will be skipped for transaction indexes ${indexesWithAccessReferences.join(', ')} as they use access references.`,\n )\n }\n\n const populateGroupResource = (\n txns: algosdk.TransactionWithSigner[],\n reference:\n | string\n | algosdk.modelsv2.BoxReference\n | algosdk.modelsv2.ApplicationLocalReference\n | algosdk.modelsv2.AssetHoldingReference\n | bigint\n | number\n | Address,\n type: 'account' | 'assetHolding' | 'appLocal' | 'app' | 'box' | 'asset',\n ): void => {\n const isApplBelowLimit = (t: algosdk.TransactionWithSigner) => {\n if (t.txn.type !== algosdk.TransactionType.appl) return false\n if (appCallHasAccessReferences(t.txn)) return false\n\n const accounts = t.txn.applicationCall?.accounts?.length ?? 0\n const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0\n const apps = t.txn.applicationCall?.foreignApps?.length ?? 0\n const boxes = t.txn.applicationCall?.boxes?.length ?? 0\n\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES\n }\n\n // If this is a asset holding or app local, first try to find a transaction that already has the account available\n if (type === 'assetHolding' || type === 'appLocal') {\n const { account } = reference as algosdk.modelsv2.ApplicationLocalReference | algosdk.modelsv2.AssetHoldingReference\n\n let txnIndex = txns.findIndex((t) => {\n if (!isApplBelowLimit(t)) return false\n\n return (\n // account is in the foreign accounts array\n t.txn.applicationCall?.accounts?.map((a) => a.toString()).includes(account.toString()) ||\n // account is available as an app account\n t.txn.applicationCall?.foreignApps?.map((a) => algosdk.getApplicationAddress(a).toString()).includes(account.toString()) ||\n // account is available since it's in one of the fields\n Object.values(t.txn).some((f) =>\n stringifyJSON(f, (_, v) => (v instanceof Address ? v.toString() : v))?.includes(account.toString()),\n )\n )\n })\n\n if (txnIndex > -1) {\n if (type === 'assetHolding') {\n const { asset } = reference as algosdk.modelsv2.AssetHoldingReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],\n } satisfies Partial<ApplicationTransactionFields>\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],\n } satisfies Partial<ApplicationTransactionFields>\n }\n return\n }\n\n // Now try to find a txn that already has that app or asset available\n txnIndex = txns.findIndex((t) => {\n if (!isApplBelowLimit(t)) return false\n\n // check if there is space in the accounts array\n if ((t.txn.applicationCall?.accounts?.length ?? 0) >= MAX_APP_CALL_ACCOUNT_REFERENCES) return false\n\n if (type === 'assetHolding') {\n const { asset } = reference as algosdk.modelsv2.AssetHoldingReference\n return t.txn.applicationCall?.foreignAssets?.includes(asset)\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app\n }\n })\n\n if (txnIndex > -1) {\n const { account } = reference as algosdk.modelsv2.AssetHoldingReference | algosdk.modelsv2.ApplicationLocalReference\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],\n } satisfies Partial<ApplicationTransactionFields>\n\n return\n }\n }\n\n // If this is a box, first try to find a transaction that already has the app available\n if (type === 'box') {\n const { app, name } = reference as algosdk.modelsv2.BoxReference\n\n const txnIndex = txns.findIndex((t) => {\n if (!isApplBelowLimit(t)) return false\n\n // If the app is in the foreign array OR the app being called, then we know it's available\n return t.txn.applicationCall?.foreignApps?.includes(app) || t.txn.applicationCall?.appIndex === app\n })\n\n if (txnIndex > -1) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name } satisfies TransactionBoxReference]],\n } satisfies Partial<ApplicationTransactionFields>\n\n return\n }\n }\n\n // Find the txn index to put the reference(s)\n const txnIndex = txns.findIndex((t) => {\n if (t.txn.type !== algosdk.TransactionType.appl) return false\n if (appCallHasAccessReferences(t.txn)) return false\n\n const accounts = t.txn.applicationCall?.accounts?.length ?? 0\n const assets = t.txn.applicationCall?.foreignAssets?.length ?? 0\n const apps = t.txn.applicationCall?.foreignApps?.length ?? 0\n const boxes = t.txn.applicationCall?.boxes?.length ?? 0\n\n if (type === 'account')\n return accounts < MAX_APP_CALL_ACCOUNT_REFERENCES && accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES\n\n // If we're adding local state or asset holding, we need space for the acocunt and the other reference\n if (type === 'assetHolding' || type === 'appLocal') {\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES - 1 && accounts < MAX_APP_CALL_ACCOUNT_REFERENCES\n }\n\n // If we're adding a box, we need space for both the box ref and the app ref\n if (type === 'box' && BigInt((reference as algosdk.modelsv2.BoxReference).app) !== BigInt(0)) {\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES - 1\n }\n\n return accounts + assets + apps + boxes < MAX_APP_CALL_FOREIGN_REFERENCES\n })\n\n if (txnIndex === -1) {\n throw Error('No more transactions below reference limit. Add another app call to the group.')\n }\n\n if (type === 'account') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[reference as Address]],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'app') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [\n ...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []),\n ...[typeof reference === 'bigint' ? reference : BigInt(reference as number)],\n ],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'box') {\n const { app, name } = reference as algosdk.modelsv2.BoxReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n boxes: [...(txns[txnIndex].txn?.applicationCall?.boxes ?? []), ...[{ appIndex: app, name } satisfies TransactionBoxReference]],\n } satisfies Partial<ApplicationTransactionFields>\n\n if (app.toString() !== '0') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],\n } satisfies Partial<ApplicationTransactionFields>\n }\n } else if (type === 'assetHolding') {\n const { asset, account } = reference as algosdk.modelsv2.AssetHoldingReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignAssets: [...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []), ...[asset]],\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'appLocal') {\n const { app, account } = reference as algosdk.modelsv2.ApplicationLocalReference\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignApps: [...(txns[txnIndex].txn?.applicationCall?.foreignApps ?? []), ...[app]],\n accounts: [...(txns[txnIndex].txn?.applicationCall?.accounts ?? []), ...[account]],\n } satisfies Partial<ApplicationTransactionFields>\n } else if (type === 'asset') {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(txns[txnIndex].txn as any)['applicationCall'] = {\n ...txns[txnIndex].txn.applicationCall,\n foreignAssets: [\n ...(txns[txnIndex].txn?.applicationCall?.foreignAssets ?? []),\n ...[typeof reference === 'bigint' ? reference : BigInt(reference as number)],\n ],\n } satisfies Partial<ApplicationTransactionFields>\n }\n }\n\n const g = executionInfo.groupUnnamedResourcesAccessed\n\n if (g) {\n // Do cross-reference resources first because they are the most restrictive in terms\n // of which transactions can be used\n g.appLocals?.forEach((a) => {\n populateGroupResource(group, a, 'appLocal')\n\n // Remove resources from the group if we're adding them here\n g.accounts = g.accounts?.filter((acc) => acc !== a.account)\n g.apps = g.apps?.filter((app) => BigInt(app) !== BigInt(a.app))\n })\n\n g.assetHoldings?.forEach((a) => {\n populateGroupResource(group, a, 'assetHolding')\n\n // Remove resources from the group if we're adding them here\n g.accounts = g.accounts?.filter((acc) => acc !== a.account)\n g.assets = g.assets?.filter((asset) => BigInt(asset) !== BigInt(a.asset))\n })\n\n // Do accounts next because the account limit is 4\n g.accounts?.forEach((a) => {\n populateGroupResource(group, a, 'account')\n })\n\n g.boxes?.forEach((b) => {\n populateGroupResource(group, b, 'box')\n\n // Remove apps as resource from the group if we're adding it here\n g.apps = g.apps?.filter((app) => BigInt(app) !== BigInt(b.app))\n })\n\n g.assets?.forEach((a) => {\n populateGroupResource(group, a, 'asset')\n })\n\n g.apps?.forEach((a) => {\n populateGroupResource(group, a, 'app')\n })\n\n if (g.extraBoxRefs) {\n for (let i = 0; i < g.extraBoxRefs; i += 1) {\n const ref = new algosdk.modelsv2.BoxReference({ app: 0, name: new Uint8Array(0) })\n populateGroupResource(group, ref, 'box')\n }\n }\n }\n }\n\n const newAtc = new algosdk.AtomicTransactionComposer()\n\n group.forEach((t) => {\n t.txn.group = undefined\n newAtc.addTransaction(t)\n })\n\n newAtc['methodCalls'] = atc['methodCalls']\n return newAtc\n}\n\n/**\n * Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.\n * @param atcSend The parameters controlling the send, including `atc` The `AtomicTransactionComposer` and params to control send behaviour\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendAtomicTransactionComposer = async function (atcSend: AtomicTransactionComposerToSend, algod: Algodv2) {\n const { atc: givenAtc, sendParams, additionalAtcContext, ...executeParams } = atcSend\n\n let atc: AtomicTransactionComposer\n\n atc = givenAtc\n try {\n const transactionsWithSigner = atc.buildGroup()\n\n // If populateAppCallResources is true OR if populateAppCallResources is undefined and there are app calls, then populate resources\n const populateAppCallResources =\n executeParams?.populateAppCallResources ?? sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n const coverAppCallInnerTransactionFees = executeParams?.coverAppCallInnerTransactionFees\n\n if (\n (populateAppCallResources || coverAppCallInnerTransactionFees) &&\n transactionsWithSigner.map((t) => t.txn.type).includes(algosdk.TransactionType.appl)\n ) {\n atc = await prepareGroupForSending(\n givenAtc,\n algod,\n { ...executeParams, populateAppCallResources, coverAppCallInnerTransactionFees },\n additionalAtcContext,\n )\n }\n\n // atc.buildGroup() is needed to ensure that any changes made by prepareGroupForSending are reflected and the group id is set\n const transactionsToSend = atc.buildGroup().map((t) => {\n return t.txn\n })\n let groupId: string | undefined = undefined\n if (transactionsToSend.length > 1) {\n groupId = transactionsToSend[0].group ? Buffer.from(transactionsToSend[0].group).toString('base64') : ''\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(\n `Sending group of ${transactionsToSend.length} transactions (${groupId})`,\n {\n transactionsToSend,\n },\n )\n\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).debug(\n `Transaction IDs (${groupId})`,\n transactionsToSend.map((t) => t.txID()),\n )\n }\n\n if (Config.debug && Config.traceAll) {\n // Emit the simulate response for use with AlgoKit AVM debugger\n const simulateResponse = await performAtomicTransactionComposerSimulate(atc, algod)\n await Config.events.emitAsync(EventType.TxnGroupSimulated, {\n simulateResponse,\n })\n }\n const result = await atc.execute(\n algod,\n executeParams?.maxRoundsToWaitForConfirmation ?? sendParams?.maxRoundsToWaitForConfirmation ?? 5,\n )\n\n // Signers (e.g. wallets) can mutate the transactions they sign, so the signed transactions are the source of truth\n // for what was actually sent to the network. The signatures were gathered by `execute` above, so they are returned\n // from the composer's cache rather than being requested from the signers again.\n const sentTransactions = resolveSignedTransactions(transactionsToSend, await atc.gatherSignatures())\n\n if (sentTransactions.length > 1) {\n groupId = sentTransactions[0].group ? Buffer.from(sentTransactions[0].group).toString('base64') : ''\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(\n `Group transaction (${groupId}) sent with ${sentTransactions.length} transactions`,\n )\n } else {\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).verbose(\n `Sent transaction ID ${sentTransactions[0].txID()} ${sentTransactions[0].type} from ${sentTransactions[0].sender.toString()}`,\n )\n }\n\n let confirmations: modelsv2.PendingTransactionResponse[] | undefined = undefined\n if (!sendParams?.skipWaiting) {\n confirmations = await Promise.all(sentTransactions.map(async (t) => await algod.pendingTransactionInformation(t.txID()).do()))\n }\n\n const methodCalls = [...(atc['methodCalls'] as Map<number, ABIMethod>).values()]\n\n return {\n groupId,\n confirmations,\n txIds: sentTransactions.map((t) => t.txID()),\n transactions: sentTransactions,\n returns: result.methodResults.map((r, i) => getABIReturnValue(r, methodCalls[i]!.returns.type)),\n } as SendAtomicTransactionComposerResults\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n // Create a new error object so the stack trace is correct (algosdk throws an error with a more limited stack trace)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const err = new Error(typeof e === 'object' ? e?.message : 'Received error executing Atomic Transaction Composer') as any as any\n err.cause = e\n if (typeof e === 'object') {\n // Remove headers as it doesn't have anything useful.\n delete e.response?.headers\n err.response = e.response\n // body property very noisy\n if (e.response && 'body' in e.response) delete err.response.body\n err.name = e.name\n }\n\n if (Config.debug && typeof e === 'object') {\n err.traces = []\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).error(\n 'Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information',\n err,\n )\n const simulate = await performAtomicTransactionComposerSimulate(atc, algod)\n if (Config.debug && !Config.traceAll) {\n // Emit the event only if traceAll: false, as it should have already been emitted above\n await Config.events.emitAsync(EventType.TxnGroupSimulated, {\n simulateResponse: simulate,\n })\n }\n\n if (simulate && simulate.txnGroups[0].failedAt) {\n for (const txn of simulate.txnGroups[0].txnResults) {\n err.traces.push({\n trace: txn.execTrace?.toEncodingData(),\n appBudget: txn.appBudgetConsumed,\n logicSigBudget: txn.logicSigBudgetConsumed,\n logs: txn.txnResult.logs,\n message: simulate.txnGroups[0].failureMessage,\n })\n }\n }\n } else {\n Config.getLogger(executeParams?.suppressLog ?? sendParams?.suppressLog).error(\n 'Received error executing Atomic Transaction Composer, for more information enable the debug flag',\n err,\n )\n }\n\n // Attach the sent transactions so we can use them in error transformers\n let sentTransactions = atc.buildGroup().map((t) => t.txn)\n if (atc.getStatus() >= algosdk.AtomicTransactionComposerStatus.SIGNED) {\n // Reflect any mutations made by the signers, so these are the transactions that were actually sent\n sentTransactions = resolveSignedTransactions(sentTransactions, await atc.gatherSignatures())\n }\n err.sentTransactions = sentTransactions\n throw err\n }\n}\n\n/**\n * Takes an algosdk `ABIResult` and converts it to an `ABIReturn`.\n * Converts `bigint`'s for Uint's < 64 to `number` for easier use.\n * @param result The `ABIReturn`\n */\nexport function getABIReturnValue(result: algosdk.ABIResult, type: ABIReturnType): ABIReturn {\n if (result.decodeError) {\n return {\n decodeError: result.decodeError,\n }\n }\n\n const returnValue = convertAbiByteArrays(\n result.returnValue !== undefined && result.method.returns.type !== 'void'\n ? convertABIDecodedBigIntToNumber(result.returnValue, result.method.returns.type)\n : result.returnValue!,\n type,\n )\n\n return {\n method: result.method,\n rawReturnValue: result.rawReturnValue,\n decodeError: undefined,\n returnValue,\n }\n}\n\n/**\n * @deprecated Use `TransactionComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.\n *\n * Signs and sends a group of [up to 16](https://dev.algorand.co/concepts/transactions/atomic-txn-groups/#create-transactions) transactions to the chain\n *\n * @param groupSend The group details to send, with:\n * * `transactions`: The array of transactions to send along with their signing account\n * * `sendParams`: The parameters to dictate how the group is sent\n * @param algod An algod client\n * @returns An object with transaction IDs, transactions, group transaction ID (`groupTransactionId`) if more than 1 transaction sent, and (if `skipWaiting` is `false` or unset) confirmation (`confirmation`)\n */\nexport const sendGroupOfTransactions = async function (groupSend: TransactionGroupToSend, algod: Algodv2) {\n const { transactions, signer, sendParams } = groupSend\n\n const defaultTransactionSigner = signer ? getSenderTransactionSigner(signer) : undefined\n\n const transactionsWithSigner = await Promise.all(\n transactions.map(async (t) => {\n if ('signer' in t)\n return {\n txn: t.transaction,\n signer: getSenderTransactionSigner(t.signer),\n sender: t.signer,\n }\n\n const txn = 'then' in t ? (await t).transaction : t\n if (!signer) {\n throw new Error(`Attempt to send transaction ${txn.txID()} as part of a group transaction, but no signer parameter was provided.`)\n }\n\n return {\n txn,\n signer: defaultTransactionSigner!,\n sender: signer,\n }\n }),\n )\n\n const atc = new AtomicTransactionComposer()\n transactionsWithSigner.forEach((txn) => atc.addTransaction(txn))\n\n return (await sendAtomicTransactionComposer({ atc, sendParams }, algod)) as Omit<SendAtomicTransactionComposerResults, 'returns'>\n}\n\n/**\n * Wait until the transaction is confirmed or rejected, or until `timeout`\n * number of rounds have passed.\n *\n * @param algod An algod client\n * @param transactionId The transaction ID to wait for\n * @param maxRoundsToWait Maximum number of rounds to wait\n *\n * @return Pending transaction information\n * @throws Throws an error if the transaction is not confirmed or rejected in the next `timeout` rounds\n */\nexport const waitForConfirmation = async function (\n transactionId: string,\n maxRoundsToWait: number | bigint,\n algod: Algodv2,\n): Promise<modelsv2.PendingTransactionResponse> {\n if (maxRoundsToWait < 0) {\n throw new Error(`Invalid timeout, received ${maxRoundsToWait}, expected > 0`)\n }\n\n // Get current round\n const status = await algod.status().do()\n if (status === undefined) {\n throw new Error('Unable to get node status')\n }\n\n // Loop for up to `timeout` rounds looking for a confirmed transaction\n const startRound = BigInt(status.lastRound) + 1n\n let currentRound = startRound\n while (currentRound < startRound + BigInt(maxRoundsToWait)) {\n try {\n const pendingInfo = await algod.pendingTransactionInformation(transactionId).do()\n\n if (pendingInfo !== undefined) {\n const confirmedRound = pendingInfo.confirmedRound\n if (confirmedRound && confirmedRound > 0) {\n return pendingInfo\n } else {\n const poolError = pendingInfo.poolError\n if (poolError != null && poolError.length > 0) {\n // If there was a pool error, then the transaction has been rejected!\n throw new Error(`Transaction ${transactionId} was rejected; pool error: ${poolError}`)\n }\n }\n }\n } catch (e: unknown) {\n if ((e as Error).name === 'URLTokenBaseHTTPError') {\n currentRound++\n continue\n }\n }\n\n await algod.statusAfterBlock(toNumber(currentRound)).do()\n currentRound++\n }\n\n throw new Error(`Transaction ${transactionId} not confirmed after ${maxRoundsToWait} rounds`)\n}\n\n/**\n * @deprecated Use `TransactionComposer` and the `maxFee` field in the transaction params instead.\n *\n * Limit the acceptable fee to a defined amount of µAlgo.\n * This also sets the transaction to be flatFee to ensure the transaction only succeeds at\n * the estimated rate.\n * @param transaction The transaction to cap or suggested params object about to be used to create a transaction\n * @param maxAcceptableFee The maximum acceptable fee to pay\n */\nexport function capTransactionFee(transaction: algosdk.Transaction | SuggestedParams, maxAcceptableFee: AlgoAmount) {\n // If a flat fee hasn't already been defined\n if (!('flatFee' in transaction) || !transaction.flatFee) {\n // Once a transaction has been constructed by algosdk, transaction.fee indicates what the total transaction fee\n // Will be based on the current suggested fee-per-byte value.\n if (transaction.fee > maxAcceptableFee.microAlgo) {\n throw new Error(\n `Cancelled transaction due to high network congestion fees. Algorand suggested fees would cause this transaction to cost ${transaction.fee} µALGO. Cap for this transaction is ${maxAcceptableFee.microAlgo} µALGO.`,\n )\n } else if (transaction.fee > 1_000_000) {\n Config.logger.warn(`Algorand network congestion fees are in effect. This transaction will incur a fee of ${transaction.fee} µALGO.`)\n }\n\n // Now set the flat on the transaction. Otherwise the network may increase the fee above our cap and perform the transaction.\n if ('flatFee' in transaction) {\n transaction.flatFee = true\n }\n }\n}\n\n/**\n * @deprecated Use `TransactionComposer` and the `maxFee` and `staticFee` fields in the transaction params instead.\n *\n * Allows for control of fees on a `Transaction` or `SuggestedParams` object\n * @param transaction The transaction or suggested params\n * @param feeControl The fee control parameters\n */\nexport function controlFees<T extends SuggestedParams | Transaction>(\n transaction: T,\n feeControl: { fee?: AlgoAmount; maxFee?: AlgoAmount },\n) {\n const { fee, maxFee } = feeControl\n if (fee) {\n transaction.fee = Number(fee.microAlgo)\n if ('flatFee' in transaction) {\n transaction.flatFee = true\n }\n }\n\n if (maxFee !== undefined) {\n capTransactionFee(transaction, maxFee)\n }\n\n return transaction\n}\n\n/**\n * @deprecated Use `suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()` instead\n *\n * Returns suggested transaction parameters from algod unless some are already provided.\n * @param params Optionally provide parameters to use\n * @param algod Algod algod\n * @returns The suggested transaction parameters\n */\nexport async function getTransactionParams(params: SuggestedParams | undefined, algod: Algodv2): Promise<SuggestedParams> {\n if (params) {\n return { ...params }\n }\n const p = await algod.getTransactionParams().do()\n return {\n fee: p.fee,\n firstValid: p.firstValid,\n lastValid: p.lastValid,\n genesisID: p.genesisID,\n genesisHash: p.genesisHash,\n minFee: p.minFee,\n }\n}\n\n/**\n * @deprecated Use `atc.clone().buildGroup()` instead.\n *\n * Returns the array of transactions currently present in the given `AtomicTransactionComposer`\n * @param atc The atomic transaction composer\n * @returns The array of transactions with signers\n */\nexport function getAtomicTransactionComposerTransactions(atc: AtomicTransactionComposer) {\n try {\n return atc.clone().buildGroup()\n } catch {\n return []\n }\n}\n"],"mappings":";;;;;;;;AA8BO,IAAA,4BAA4B,QAAQ;AAO3C,MAAa,6BAA6B;AAC1C,MAAa,kCAAkC;AAC/C,MAAa,kCAAkC;;;;;;;;;;;;;;;;AAiB/C,SAAgB,sBAAsB,MAAgD;CACpF,IAAI,QAAQ,QAAQ,OAAO,SAAS,aAClC;MACK,IAAI,OAAO,SAAS,YAAY,KAAK,gBAAgB,YAC1D,OAAO;MACF,IAAI,OAAO,SAAS,YAAY,cAAc,MAAM;EACzD,MAAM,cAAc,GAAG,KAAK,SAAS,GAAG,KAAK,SAAS,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,OAAO,KAAK,IAAI;EAElH,OAAO,IADa,YACP,CAAC,CAAC,OAAO,WAAW;CACnC,OAAO;EACL,MAAM,IAAI,OAAO,SAAS,WAAW,OAAO,OAAO,IAAI;EAEvD,OAAO,IADa,YACP,CAAC,CAAC,OAAO,CAAC;CACzB;AACF;;;;;;;;;AAUA,SAAgB,YAAY,OAAqD;CAC/E,IAAI,UAAU,QAAQ,OAAO,UAAU,aACrC;MACK,IAAI,OAAO,UAAU,YAAY,MAAM,gBAAgB,YAAY;EACxE,IAAI,MAAM,WAAW,KAAK,MAAM,SAAS,IACvC,MAAM,IAAI,MACR,2GAA2G,MAA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AC,GAAG;CAChD,OAAO;EACL,KAAK,EAAE;EACP,YAAY,EAAE;EACd,WAAW,EAAE;EACb,WAAW,EAAE;EACb,aAAa,EAAE;EACf,QAAQ,EAAE;CACZ;AACF;;;;;;;;AASA,SAAgB,yCAAyC,KAAgC;CACvF,IAAI;EACF,OAAO,IAAI,MAAM,CAAC,CAAC,WAAW;CAChC,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
@@ -25,7 +25,7 @@ interface EnsureFundedResult {
25
25
  * const signer = getAccountTransactionSigner(account)
26
26
  * ```
27
27
  */
28
- declare const getAccountTransactionSigner: (val: MultisigAccount | SigningAccount | TransactionSignerAccount | algosdk.Account | algosdk.LogicSigAccount) => algosdk.TransactionSigner;
28
+ declare const getAccountTransactionSigner: (val: TransactionSignerAccount | algosdk.Account | SigningAccount | algosdk.LogicSigAccount | MultisigAccount) => algosdk.TransactionSigner;
29
29
  /** Creates and keeps track of signing accounts that can sign transactions for a sending address. */
30
30
  declare class AccountManager {
31
31
  private _clientManager;
@@ -337,8 +337,8 @@ declare class AlgorandClientTransactionCreator {
337
337
  * @returns The application create transaction
338
338
  */
339
339
  appCreate: (params: {
340
- sender: string | algosdk.Address;
341
340
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
341
+ sender: string | algosdk.Address;
342
342
  rekeyTo?: (string | algosdk.Address) | undefined;
343
343
  note?: (Uint8Array | string) | undefined;
344
344
  lease?: (Uint8Array | string) | undefined;
@@ -467,8 +467,8 @@ declare class AlgorandClientTransactionSender {
467
467
  * @returns The result of the app create transaction and the transaction that was sent
468
468
  */
469
469
  appCreate: (params: {
470
- sender: string | Address;
471
470
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
471
+ sender: string | Address;
472
472
  rekeyTo?: (string | Address) | undefined;
473
473
  note?: (Uint8Array | string) | undefined;
474
474
  lease?: (Uint8Array | string) | undefined;
@@ -739,8 +739,8 @@ declare class AlgorandClientTransactionSender {
739
739
  * @returns The result of the application ABI method create transaction and the transaction that was sent
740
740
  */
741
741
  appCreateMethodCall: (params: {
742
- sender: string | Address;
743
742
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
743
+ sender: string | Address;
744
744
  rekeyTo?: (string | Address) | undefined;
745
745
  note?: (Uint8Array | string) | undefined;
746
746
  lease?: (Uint8Array | string) | undefined;
@@ -827,9 +827,8 @@ declare class AlgorandClientTransactionSender {
827
827
  * @returns The result of the application ABI method update transaction and the transaction that was sent
828
828
  */
829
829
  appUpdateMethodCall: (params: {
830
- appId: bigint;
831
- sender: string | Address;
832
830
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
831
+ sender: string | Address;
833
832
  rekeyTo?: (string | Address) | undefined;
834
833
  note?: (Uint8Array | string) | undefined;
835
834
  lease?: (Uint8Array | string) | undefined;
@@ -839,6 +838,7 @@ declare class AlgorandClientTransactionSender {
839
838
  validityWindow?: number | bigint | undefined;
840
839
  firstValidRound?: bigint | undefined;
841
840
  lastValidRound?: bigint | undefined;
841
+ appId: bigint;
842
842
  onComplete?: algosdk.OnApplicationComplete.UpdateApplicationOC | undefined;
843
843
  accountReferences?: (string | Address)[] | undefined;
844
844
  appReferences?: bigint[] | undefined;
@@ -907,9 +907,8 @@ declare class AlgorandClientTransactionSender {
907
907
  * @returns The result of the application ABI method delete transaction and the transaction that was sent
908
908
  */
909
909
  appDeleteMethodCall: (params: {
910
- appId: bigint;
911
- sender: string | Address;
912
910
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
911
+ sender: string | Address;
913
912
  rekeyTo?: (string | Address) | undefined;
914
913
  note?: (Uint8Array | string) | undefined;
915
914
  lease?: (Uint8Array | string) | undefined;
@@ -919,6 +918,7 @@ declare class AlgorandClientTransactionSender {
919
918
  validityWindow?: number | bigint | undefined;
920
919
  firstValidRound?: bigint | undefined;
921
920
  lastValidRound?: bigint | undefined;
921
+ appId: bigint;
922
922
  onComplete?: algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
923
923
  accountReferences?: (string | Address)[] | undefined;
924
924
  appReferences?: bigint[] | undefined;
@@ -985,9 +985,8 @@ declare class AlgorandClientTransactionSender {
985
985
  * @returns The result of the application ABI method call transaction and the transaction that was sent
986
986
  */
987
987
  appCallMethodCall: (params: {
988
- appId: bigint;
989
- sender: string | Address;
990
988
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
989
+ sender: string | Address;
991
990
  rekeyTo?: (string | Address) | undefined;
992
991
  note?: (Uint8Array | string) | undefined;
993
992
  lease?: (Uint8Array | string) | undefined;
@@ -997,6 +996,7 @@ declare class AlgorandClientTransactionSender {
997
996
  validityWindow?: number | bigint | undefined;
998
997
  firstValidRound?: bigint | undefined;
999
998
  lastValidRound?: bigint | undefined;
999
+ appId: bigint;
1000
1000
  onComplete?: algosdk.OnApplicationComplete.NoOpOC | algosdk.OnApplicationComplete.OptInOC | algosdk.OnApplicationComplete.CloseOutOC | algosdk.OnApplicationComplete.DeleteApplicationOC | undefined;
1001
1001
  accountReferences?: (string | Address)[] | undefined;
1002
1002
  appReferences?: bigint[] | undefined;
@@ -362,7 +362,7 @@ declare class AppClient {
362
362
  */
363
363
  fundAppAccount: (params: FundAppParams) => {
364
364
  sender: algosdk.Address;
365
- signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
365
+ signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
366
366
  receiver: algosdk.Address;
367
367
  rekeyTo?: (string | Address) | undefined;
368
368
  note?: (Uint8Array | string) | undefined;
@@ -416,12 +416,12 @@ declare class AppClient {
416
416
  } & {
417
417
  appId: bigint;
418
418
  sender: algosdk.Address;
419
- signer: algosdk.TransactionSigner | TransactionSignerAccount | undefined;
419
+ signer: TransactionSignerAccount | algosdk.TransactionSigner | undefined;
420
420
  method: Arc56Method;
421
421
  onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC;
422
- args: (algosdk.TransactionWithSigner | algosdk.ABIValue | algosdk.Transaction | Promise<algosdk.Transaction> | AppMethodCall<{
423
- sender: string | Address;
422
+ args: (algosdk.Transaction | algosdk.ABIValue | algosdk.TransactionWithSigner | Promise<algosdk.Transaction> | AppMethodCall<{
424
423
  signer?: (algosdk.TransactionSigner | TransactionSignerAccount) | undefined;
424
+ sender: string | Address;
425
425
  rekeyTo?: (string | Address) | undefined;
426
426
  note?: (Uint8Array | string) | undefined;
427
427
  lease?: (Uint8Array | string) | undefined;
@@ -588,7 +588,7 @@ declare class AppClient {
588
588
  transactions: algosdk.Transaction[];
589
589
  confirmation: algosdk.modelsv2.PendingTransactionResponse;
590
590
  transaction: algosdk.Transaction;
591
- return?: algosdk.ABIValue | Uint8Array<ArrayBufferLike> | ABIStruct | undefined;
591
+ return?: Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined;
592
592
  }>;
593
593
  /**
594
594
  * Sign and send transactions for an opt-in ABI call
@@ -604,7 +604,7 @@ declare class AppClient {
604
604
  confirmation: algosdk.modelsv2.PendingTransactionResponse;
605
605
  transaction: algosdk.Transaction;
606
606
  return?: ABIReturn | undefined;
607
- }, "return"> & AppReturn<algosdk.ABIValue | Uint8Array<ArrayBufferLike> | ABIStruct | undefined>>;
607
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
608
608
  /**
609
609
  * Sign and send transactions for a delete ABI call
610
610
  * @param params The parameters for the delete ABI method call
@@ -619,7 +619,7 @@ declare class AppClient {
619
619
  confirmation: algosdk.modelsv2.PendingTransactionResponse;
620
620
  transaction: algosdk.Transaction;
621
621
  return?: ABIReturn | undefined;
622
- }, "return"> & AppReturn<algosdk.ABIValue | Uint8Array<ArrayBufferLike> | ABIStruct | undefined>>;
622
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
623
623
  /**
624
624
  * Sign and send transactions for a close out ABI call
625
625
  * @param params The parameters for the close out ABI method call
@@ -634,7 +634,7 @@ declare class AppClient {
634
634
  confirmation: algosdk.modelsv2.PendingTransactionResponse;
635
635
  transaction: algosdk.Transaction;
636
636
  return?: ABIReturn | undefined;
637
- }, "return"> & AppReturn<algosdk.ABIValue | Uint8Array<ArrayBufferLike> | ABIStruct | undefined>>;
637
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
638
638
  /**
639
639
  * Sign and send transactions for a call (defaults to no-op)
640
640
  * @param params The parameters for the ABI method call
@@ -649,7 +649,7 @@ declare class AppClient {
649
649
  confirmation: algosdk.modelsv2.PendingTransactionResponse;
650
650
  transaction: algosdk.Transaction;
651
651
  return?: ABIReturn | undefined;
652
- }, "return"> & AppReturn<algosdk.ABIValue | Uint8Array<ArrayBufferLike> | ABIStruct | undefined>>;
652
+ }, "return"> & AppReturn<Uint8Array<ArrayBufferLike> | algosdk.ABIValue | ABIStruct | undefined>>;
653
653
  } & {
654
654
  /** Interact with bare (raw) calls */bare: ReturnType<AppClient["getBareSendMethods"]>;
655
655
  };