@algorandfoundation/algokit-utils 7.0.0-beta.6 → 7.0.0-beta.7

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.
Files changed (98) hide show
  1. package/app.d.ts +6 -6
  2. package/app.js +6 -6
  3. package/app.js.map +1 -1
  4. package/app.mjs +6 -6
  5. package/app.mjs.map +1 -1
  6. package/asset.d.ts +3 -3
  7. package/asset.js +3 -3
  8. package/asset.js.map +1 -1
  9. package/asset.mjs +3 -3
  10. package/asset.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/testing/fixtures/algorand-fixture.js +1 -1
  13. package/testing/fixtures/algorand-fixture.js.map +1 -1
  14. package/testing/fixtures/algorand-fixture.mjs +1 -1
  15. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  16. package/transaction/legacy-bridge.d.ts +3 -3
  17. package/transaction/legacy-bridge.js.map +1 -1
  18. package/transaction/legacy-bridge.mjs.map +1 -1
  19. package/transaction/transaction.d.ts +1 -3
  20. package/transaction/transaction.js +17 -11
  21. package/transaction/transaction.js.map +1 -1
  22. package/transaction/transaction.mjs +17 -11
  23. package/transaction/transaction.mjs.map +1 -1
  24. package/transfer/transfer-algos.d.ts +1 -1
  25. package/transfer/transfer-algos.js +1 -1
  26. package/transfer/transfer-algos.js.map +1 -1
  27. package/transfer/transfer-algos.mjs +1 -1
  28. package/transfer/transfer-algos.mjs.map +1 -1
  29. package/transfer/transfer.d.ts +1 -1
  30. package/transfer/transfer.js +1 -1
  31. package/transfer/transfer.js.map +1 -1
  32. package/transfer/transfer.mjs +1 -1
  33. package/transfer/transfer.mjs.map +1 -1
  34. package/types/account-manager.d.ts +13 -4
  35. package/types/account-manager.js +17 -3
  36. package/types/account-manager.js.map +1 -1
  37. package/types/account-manager.mjs +17 -3
  38. package/types/account-manager.mjs.map +1 -1
  39. package/types/algorand-client-interface.d.ts +1 -1
  40. package/types/algorand-client-transaction-creator.d.ts +30 -30
  41. package/types/algorand-client-transaction-creator.js +30 -30
  42. package/types/algorand-client-transaction-creator.js.map +1 -1
  43. package/types/algorand-client-transaction-creator.mjs +30 -30
  44. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  45. package/types/algorand-client-transaction-sender.d.ts +18 -18
  46. package/types/algorand-client-transaction-sender.js +1 -1
  47. package/types/algorand-client-transaction-sender.js.map +1 -1
  48. package/types/algorand-client-transaction-sender.mjs +1 -1
  49. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  50. package/types/algorand-client.d.ts +8 -8
  51. package/types/algorand-client.js +8 -8
  52. package/types/algorand-client.js.map +1 -1
  53. package/types/algorand-client.mjs +8 -8
  54. package/types/algorand-client.mjs.map +1 -1
  55. package/types/app-arc56.d.ts +60 -37
  56. package/types/app-arc56.js +37 -16
  57. package/types/app-arc56.js.map +1 -1
  58. package/types/app-arc56.mjs +37 -16
  59. package/types/app-arc56.mjs.map +1 -1
  60. package/types/app-client.d.ts +101 -78
  61. package/types/app-client.js +145 -84
  62. package/types/app-client.js.map +1 -1
  63. package/types/app-client.mjs +145 -84
  64. package/types/app-client.mjs.map +1 -1
  65. package/types/app-deployer.d.ts +2 -2
  66. package/types/app-deployer.js +24 -24
  67. package/types/app-deployer.js.map +1 -1
  68. package/types/app-deployer.mjs +24 -24
  69. package/types/app-deployer.mjs.map +1 -1
  70. package/types/app-factory.d.ts +141 -86
  71. package/types/app-factory.js +106 -34
  72. package/types/app-factory.js.map +1 -1
  73. package/types/app-factory.mjs +107 -35
  74. package/types/app-factory.mjs.map +1 -1
  75. package/types/app-spec.js +15 -9
  76. package/types/app-spec.js.map +1 -1
  77. package/types/app-spec.mjs +15 -9
  78. package/types/app-spec.mjs.map +1 -1
  79. package/types/asset-manager.d.ts +3 -3
  80. package/types/asset-manager.js +2 -2
  81. package/types/asset-manager.js.map +1 -1
  82. package/types/asset-manager.mjs +2 -2
  83. package/types/asset-manager.mjs.map +1 -1
  84. package/types/client-manager.d.ts +30 -8
  85. package/types/client-manager.js +6 -0
  86. package/types/client-manager.js.map +1 -1
  87. package/types/client-manager.mjs +6 -0
  88. package/types/client-manager.mjs.map +1 -1
  89. package/types/composer.d.ts +29 -4
  90. package/types/composer.js +24 -7
  91. package/types/composer.js.map +1 -1
  92. package/types/composer.mjs +24 -7
  93. package/types/composer.mjs.map +1 -1
  94. package/types/kmd-account-manager.js +1 -1
  95. package/types/kmd-account-manager.js.map +1 -1
  96. package/types/kmd-account-manager.mjs +1 -1
  97. package/types/kmd-account-manager.mjs.map +1 -1
  98. package/types/transaction.d.ts +4 -6
@@ -471,14 +471,12 @@ async function populateAppCallResources(atc, algod) {
471
471
  }
472
472
  /**
473
473
  * Signs and sends transactions that have been collected by an `AtomicTransactionComposer`.
474
- * @param atcSend The parameters controlling the send, including:
475
- * * `atc` The `AtomicTransactionComposer`
476
- * * `executeParams` The parameters to control the send behaviour
474
+ * @param atcSend The parameters controlling the send, including `atc` The `AtomicTransactionComposer` and params to control send behaviour
477
475
  * @param algod An algod client
478
476
  * @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`)
479
477
  */
480
478
  const sendAtomicTransactionComposer = async function (atcSend, algod) {
481
- const { atc: givenAtc, sendParams, executeParams } = atcSend;
479
+ const { atc: givenAtc, sendParams, ...executeParams } = atcSend;
482
480
  let atc;
483
481
  // const hasAppCalls = () =>
484
482
  // givenAtc
@@ -537,11 +535,19 @@ const sendAtomicTransactionComposer = async function (atcSend, algod) {
537
535
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
538
536
  }
539
537
  catch (e) {
540
- // Remove headers as it doesn't have anything useful.
541
- delete e.response?.headers;
538
+ // Create a new error object so the stack trace is correct (algosdk throws an error with a more limited stack trace)
539
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
540
+ const err = new Error(typeof e === 'object' ? e?.message : 'Received error executing Atomic Transaction Composer');
541
+ err.cause = e;
542
+ if (typeof e === 'object') {
543
+ // Remove headers as it doesn't have anything useful.
544
+ delete e.response?.headers;
545
+ err.response = e.response;
546
+ err.name = e.name;
547
+ }
542
548
  if (Config.debug && typeof e === 'object') {
543
- e.traces = [];
544
- Config.logger.error('Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information', e);
549
+ err.traces = [];
550
+ Config.logger.error('Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information', err);
545
551
  const simulate = await performAtomicTransactionComposerSimulate(atc, algod);
546
552
  if (Config.debug && !Config.traceAll) {
547
553
  await Config.events.emitAsync(EventType.TxnGroupSimulated, {
@@ -550,7 +556,7 @@ const sendAtomicTransactionComposer = async function (atcSend, algod) {
550
556
  }
551
557
  if (simulate && simulate.txnGroups[0].failedAt) {
552
558
  for (const txn of simulate.txnGroups[0].txnResults) {
553
- e.traces.push({
559
+ err.traces.push({
554
560
  trace: txn.execTrace?.get_obj_for_encoding(),
555
561
  appBudget: txn.appBudgetConsumed,
556
562
  logicSigBudget: txn.logicSigBudgetConsumed,
@@ -561,9 +567,9 @@ const sendAtomicTransactionComposer = async function (atcSend, algod) {
561
567
  }
562
568
  }
563
569
  else {
564
- Config.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', e);
570
+ Config.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', err);
565
571
  }
566
- throw e;
572
+ throw err;
567
573
  }
568
574
  };
569
575
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.mjs","sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Buffer } from 'buffer'\nimport { Config } from '../config'\nimport { AlgoAmount } from '../types/amount'\nimport { ABIReturn } from '../types/app'\nimport { EventType } from '../types/async-event-emitter'\nimport {\n AtomicTransactionComposerToSend,\n SendAtomicTransactionComposerResults,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionGroupToSend,\n TransactionNote,\n TransactionToSign,\n} from '../types/transaction'\nimport { 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 = 4\n\n/**\n * @deprecated Convert your data to a `string` or `Uint8Array`, if using ARC-2 use `AlgoKitComposer.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 : JSON.stringify(note.data)}`\n const encoder = new TextEncoder()\n return encoder.encode(arc2Payload)\n } else {\n const n = typeof note === 'string' ? note : JSON.stringify(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) {\n return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr : sender.address()\n}\n\n/**\n * @deprecated Use `AlgorandClient` / `AlgoKitComposer` 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` / `AlgoKitComposer` 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` / `AlgoKitComposer` 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 populateResources = sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n\n // Populate resources if the transaction is an appcall and populateAppCallResources wasn't explicitly set to false\n // NOTE: Temporary false by default until this algod bug is fixed: https://github.com/algorand/go-algorand/issues/5914\n if (txnToSend.type === algosdk.TransactionType.appl && populateResources) {\n const newAtc = new AtomicTransactionComposer()\n newAtc.addTransaction({ txn: txnToSend, signer: getSenderTransactionSigner(from) })\n const packed = await populateAppCallResources(newAtc, algod)\n txnToSend = packed.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 all of the unamed resources used by the group in the given ATC\n *\n * @param algod The algod client to use for the simulation\n * @param atc The ATC containing the txn group\n * @returns The unnamed resources accessed by the group and by each transaction in the group\n */\nasync function getUnnamedAppCallResourcesAccessed(atc: algosdk.AtomicTransactionComposer, algod: algosdk.Algodv2) {\n const simReq = new algosdk.modelsv2.SimulateRequest({\n txnGroups: [],\n allowUnnamedResources: true,\n allowEmptySignatures: true,\n })\n\n const signerWithFixedSgnr: algosdk.TransactionSigner = async (txns: algosdk.Transaction[], indexes: number[]) => {\n const stxns = await algosdk.makeEmptyTransactionSigner()(txns, indexes)\n return Promise.all(\n stxns.map(async (stxn) => {\n const decodedStxn = algosdk.decodeSignedTransaction(stxn)\n const sender = algosdk.encodeAddress(decodedStxn.txn.from.publicKey)\n\n const authAddr = (await algod.accountInformation(sender).do())['auth-addr']\n\n const stxnObj: { txn: algosdk.EncodedTransaction; sgnr?: Buffer } = { txn: decodedStxn.txn.get_obj_for_encoding() }\n\n if (authAddr !== undefined) {\n stxnObj.sgnr = Buffer.from(algosdk.decodeAddress(authAddr).publicKey)\n }\n\n return algosdk.encodeObj(stxnObj)\n }),\n )\n }\n\n const emptySignerAtc = atc.clone()\n emptySignerAtc['transactions'].forEach((t: algosdk.TransactionWithSigner) => {\n t.signer = signerWithFixedSgnr\n })\n\n const result = await emptySignerAtc.simulate(algod, simReq)\n\n const groupResponse = result.simulateResponse.txnGroups[0]\n\n if (groupResponse.failureMessage) {\n throw Error(`Error during resource population simulation in transaction ${groupResponse.failedAt}: ${groupResponse.failureMessage}`)\n }\n\n return {\n group: groupResponse.unnamedResourcesAccessed,\n txns: groupResponse.txnResults.map(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (t: any) => t.unnamedResourcesAccessed,\n ) as algosdk.modelsv2.SimulateUnnamedResourcesAccessed[],\n }\n}\n\n/**\n * Take an existing Atomic Transaction Composer and return a new one with the required\n * app call resources packed 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 packed 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 const unnamedResourcesAccessed = await getUnnamedAppCallResourcesAccessed(atc, algod)\n const group = atc.buildGroup()\n\n unnamedResourcesAccessed.txns.forEach((r, i) => {\n if (r === undefined) return\n\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) throw Error('Unexpected asset holding at the transaction level')\n\n // Do accounts first because the account limit is 4\n r.accounts?.forEach((a) => {\n group[i].txn.appAccounts = [...(group[i].txn.appAccounts ?? []), algosdk.decodeAddress(a)]\n })\n\n r.apps?.forEach((a) => {\n group[i].txn.appForeignApps = [...(group[i].txn.appForeignApps ?? []), Number(a)]\n })\n\n r.assets?.forEach((a) => {\n group[i].txn.appForeignAssets = [...(group[i].txn.appForeignAssets ?? []), Number(a)]\n })\n\n const accounts = group[i].txn.appAccounts?.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\n const assets = group[i].txn.appForeignAssets?.length || 0\n const apps = group[i].txn.appForeignApps?.length || 0\n const boxes = group[i].txn.boxes?.length || 0\n\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 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 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\n const accounts = t.txn.appAccounts?.length || 0\n const assets = t.txn.appForeignAssets?.length || 0\n const apps = t.txn.appForeignApps?.length || 0\n const boxes = t.txn.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.appAccounts?.map((a) => algosdk.encodeAddress(a.publicKey)).includes(account) ||\n // account is available as an app account\n t.txn.appForeignApps?.map((a) => algosdk.getApplicationAddress(a)).includes(account) ||\n // account is available since it's in one of the fields\n Object.values(t.txn)\n .map((f) => JSON.stringify(f))\n .includes(JSON.stringify(algosdk.decodeAddress(account)))\n )\n })\n\n if (txnIndex > -1) {\n if (type === 'assetHolding') {\n const { asset } = reference as algosdk.modelsv2.AssetHoldingReference\n txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(asset)]\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)]\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.appAccounts?.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.appForeignAssets?.includes(Number(asset))\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n return t.txn.appForeignApps?.includes(Number(app)) || t.txn.appIndex === Number(app)\n }\n })\n\n if (txnIndex > -1) {\n const { account } = reference as algosdk.modelsv2.AssetHoldingReference | algosdk.modelsv2.ApplicationLocalReference\n\n txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)]\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.appForeignApps?.includes(Number(app)) || t.txn.appIndex === Number(app)\n })\n\n if (txnIndex > -1) {\n txns[txnIndex].txn.boxes = [...(txns[txnIndex].txn.boxes ?? []), { appIndex: Number(app), name }]\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\n const accounts = t.txn.appAccounts?.length || 0\n if (type === 'account') return accounts < MAX_APP_CALL_ACCOUNT_REFERENCES\n\n const assets = t.txn.appForeignAssets?.length || 0\n const apps = t.txn.appForeignApps?.length || 0\n const boxes = t.txn.boxes?.length || 0\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 txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(reference as string)]\n } else if (type === 'app') {\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(reference)]\n } else if (type === 'box') {\n const { app, name } = reference as algosdk.modelsv2.BoxReference\n txns[txnIndex].txn.boxes = [...(txns[txnIndex].txn.boxes ?? []), { appIndex: Number(app), name }]\n\n if (app.toString() !== '0') {\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)]\n }\n } else if (type === 'assetHolding') {\n const { asset, account } = reference as algosdk.modelsv2.AssetHoldingReference\n txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(asset)]\n txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)]\n } else if (type === 'appLocal') {\n const { app, account } = reference as algosdk.modelsv2.ApplicationLocalReference\n txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)]\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)]\n } else if (type === 'asset') {\n txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(reference)]\n }\n }\n\n const g = unnamedResourcesAccessed.group\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 const newAtc = new algosdk.AtomicTransactionComposer()\n\n group.forEach((t) => {\n // eslint-disable-next-line no-param-reassign\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:\n * * `atc` The `AtomicTransactionComposer`\n * * `executeParams` The parameters to control the 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, executeParams } = atcSend\n\n let atc: AtomicTransactionComposer\n\n // const hasAppCalls = () =>\n // givenAtc\n // .buildGroup()\n // .map((t) => t.txn.type)\n // .includes(algosdk.TransactionType.appl)\n\n atc = givenAtc\n try {\n // If populateAppCallResources is true OR if populateAppCallResources is undefined and there are app calls, then populate resources\n // NOTE: Temporary false by default until this algod bug is fixed: https://github.com/algorand/go-algorand/issues/5914\n const populateResources =\n executeParams?.populateAppCallResources ?? sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n\n if (populateResources) {\n atc = await populateAppCallResources(givenAtc, algod)\n }\n\n const transactionsWithSigner = atc.buildGroup()\n\n const transactionsToSend = transactionsWithSigner.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 // Dump the traces to a file 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 ${algosdk.encodeAddress(\n transactionsToSend[0].from.publicKey,\n )}`,\n )\n }\n\n let confirmations: modelsv2.PendingTransactionResponse[] | undefined = undefined\n if (!sendParams?.skipWaiting) {\n confirmations = await Promise.all(\n transactionsToSend.map(async (t) =>\n modelsv2.PendingTransactionResponse.from_obj_for_encoding(await algod.pendingTransactionInformation(t.txID()).do()),\n ),\n )\n }\n\n return {\n groupId,\n confirmations,\n txIds: transactionsToSend.map((t) => t.txID()),\n transactions: transactionsToSend,\n returns: result.methodResults.map(\n (r) =>\n ({\n decodeError: r.decodeError,\n returnValue: r.returnValue,\n rawReturnValue: r.rawReturnValue,\n }) as ABIReturn,\n ),\n } as SendAtomicTransactionComposerResults\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (e: any) {\n // Remove headers as it doesn't have anything useful.\n delete e.response?.headers\n\n if (Config.debug && typeof e === 'object') {\n e.traces = []\n Config.logger.error(\n 'Received error executing Atomic Transaction Composer and debug flag enabled; attempting simulation to get more information',\n e,\n )\n const simulate = await performAtomicTransactionComposerSimulate(atc, algod)\n if (Config.debug && !Config.traceAll) {\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 e.traces.push({\n trace: txn.execTrace?.get_obj_for_encoding(),\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.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', e)\n }\n throw e\n }\n}\n\n/**\n * @deprecated Use `performAtomicTransactionComposerSimulate`, dry-run is a deprecated Algorand feature.\n *\n * Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`\n * @param atc The AtomicTransactionComposer` with transaction(s) loaded\n * @param algod An Algod client\n * @returns The dryrun result\n */\nexport async function performAtomicTransactionComposerDryrun(atc: AtomicTransactionComposer, algod: Algodv2) {\n const signedTransactions = await atc.gatherSignatures()\n const txns = signedTransactions.map((t) => {\n return algosdk.decodeSignedTransaction(t)\n })\n const dryrun = await algosdk.createDryrun({ client: algod, txns })\n return new algosdk.DryrunResult(await algod.dryrun(dryrun).do())\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.\n *\n * Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#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 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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 = modelsv2.NodeStatusResponse.from_obj_for_encoding(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 = modelsv2.PendingTransactionResponse.from_obj_for_encoding(\n 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 `AlgoKitComposer` 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 (!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 > algosdk.ALGORAND_MIN_TX_FEE) {\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 transaction.flatFee = true\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` 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 transaction.flatFee = true\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) {\n return params ? { ...params } : await algod.getTransactionParams().do()\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"],"names":[],"mappings":";;;;;;;AAmBA,IAAO,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAA;AACpE,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAM3B,MAAM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AM;AACN,QAAA,OAAO,EAAE,CAAA;KACV;AACH;;;;"}
1
+ {"version":3,"file":"transaction.mjs","sources":["../../src/transaction/transaction.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Buffer } from 'buffer'\nimport { Config } from '../config'\nimport { AlgoAmount } from '../types/amount'\nimport { ABIReturn } from '../types/app'\nimport { EventType } from '../types/async-event-emitter'\nimport {\n AtomicTransactionComposerToSend,\n SendAtomicTransactionComposerResults,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionGroupToSend,\n TransactionNote,\n TransactionToSign,\n} from '../types/transaction'\nimport { 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 = 4\n\n/**\n * @deprecated Convert your data to a `string` or `Uint8Array`, if using ARC-2 use `AlgoKitComposer.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 : JSON.stringify(note.data)}`\n const encoder = new TextEncoder()\n return encoder.encode(arc2Payload)\n } else {\n const n = typeof note === 'string' ? note : JSON.stringify(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) {\n return typeof sender === 'string' ? sender : 'addr' in sender ? sender.addr : sender.address()\n}\n\n/**\n * @deprecated Use `AlgorandClient` / `AlgoKitComposer` 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` / `AlgoKitComposer` 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` / `AlgoKitComposer` 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 populateResources = sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n\n // Populate resources if the transaction is an appcall and populateAppCallResources wasn't explicitly set to false\n // NOTE: Temporary false by default until this algod bug is fixed: https://github.com/algorand/go-algorand/issues/5914\n if (txnToSend.type === algosdk.TransactionType.appl && populateResources) {\n const newAtc = new AtomicTransactionComposer()\n newAtc.addTransaction({ txn: txnToSend, signer: getSenderTransactionSigner(from) })\n const packed = await populateAppCallResources(newAtc, algod)\n txnToSend = packed.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 all of the unamed resources used by the group in the given ATC\n *\n * @param algod The algod client to use for the simulation\n * @param atc The ATC containing the txn group\n * @returns The unnamed resources accessed by the group and by each transaction in the group\n */\nasync function getUnnamedAppCallResourcesAccessed(atc: algosdk.AtomicTransactionComposer, algod: algosdk.Algodv2) {\n const simReq = new algosdk.modelsv2.SimulateRequest({\n txnGroups: [],\n allowUnnamedResources: true,\n allowEmptySignatures: true,\n })\n\n const signerWithFixedSgnr: algosdk.TransactionSigner = async (txns: algosdk.Transaction[], indexes: number[]) => {\n const stxns = await algosdk.makeEmptyTransactionSigner()(txns, indexes)\n return Promise.all(\n stxns.map(async (stxn) => {\n const decodedStxn = algosdk.decodeSignedTransaction(stxn)\n const sender = algosdk.encodeAddress(decodedStxn.txn.from.publicKey)\n\n const authAddr = (await algod.accountInformation(sender).do())['auth-addr']\n\n const stxnObj: { txn: algosdk.EncodedTransaction; sgnr?: Buffer } = { txn: decodedStxn.txn.get_obj_for_encoding() }\n\n if (authAddr !== undefined) {\n stxnObj.sgnr = Buffer.from(algosdk.decodeAddress(authAddr).publicKey)\n }\n\n return algosdk.encodeObj(stxnObj)\n }),\n )\n }\n\n const emptySignerAtc = atc.clone()\n emptySignerAtc['transactions'].forEach((t: algosdk.TransactionWithSigner) => {\n t.signer = signerWithFixedSgnr\n })\n\n const result = await emptySignerAtc.simulate(algod, simReq)\n\n const groupResponse = result.simulateResponse.txnGroups[0]\n\n if (groupResponse.failureMessage) {\n throw Error(`Error during resource population simulation in transaction ${groupResponse.failedAt}: ${groupResponse.failureMessage}`)\n }\n\n return {\n group: groupResponse.unnamedResourcesAccessed,\n txns: groupResponse.txnResults.map(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (t: any) => t.unnamedResourcesAccessed,\n ) as algosdk.modelsv2.SimulateUnnamedResourcesAccessed[],\n }\n}\n\n/**\n * Take an existing Atomic Transaction Composer and return a new one with the required\n * app call resources packed 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 packed 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 const unnamedResourcesAccessed = await getUnnamedAppCallResourcesAccessed(atc, algod)\n const group = atc.buildGroup()\n\n unnamedResourcesAccessed.txns.forEach((r, i) => {\n if (r === undefined) return\n\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) throw Error('Unexpected asset holding at the transaction level')\n\n // Do accounts first because the account limit is 4\n r.accounts?.forEach((a) => {\n group[i].txn.appAccounts = [...(group[i].txn.appAccounts ?? []), algosdk.decodeAddress(a)]\n })\n\n r.apps?.forEach((a) => {\n group[i].txn.appForeignApps = [...(group[i].txn.appForeignApps ?? []), Number(a)]\n })\n\n r.assets?.forEach((a) => {\n group[i].txn.appForeignAssets = [...(group[i].txn.appForeignAssets ?? []), Number(a)]\n })\n\n const accounts = group[i].txn.appAccounts?.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\n const assets = group[i].txn.appForeignAssets?.length || 0\n const apps = group[i].txn.appForeignApps?.length || 0\n const boxes = group[i].txn.boxes?.length || 0\n\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 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 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\n const accounts = t.txn.appAccounts?.length || 0\n const assets = t.txn.appForeignAssets?.length || 0\n const apps = t.txn.appForeignApps?.length || 0\n const boxes = t.txn.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.appAccounts?.map((a) => algosdk.encodeAddress(a.publicKey)).includes(account) ||\n // account is available as an app account\n t.txn.appForeignApps?.map((a) => algosdk.getApplicationAddress(a)).includes(account) ||\n // account is available since it's in one of the fields\n Object.values(t.txn)\n .map((f) => JSON.stringify(f))\n .includes(JSON.stringify(algosdk.decodeAddress(account)))\n )\n })\n\n if (txnIndex > -1) {\n if (type === 'assetHolding') {\n const { asset } = reference as algosdk.modelsv2.AssetHoldingReference\n txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(asset)]\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)]\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.appAccounts?.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.appForeignAssets?.includes(Number(asset))\n } else {\n const { app } = reference as algosdk.modelsv2.ApplicationLocalReference\n return t.txn.appForeignApps?.includes(Number(app)) || t.txn.appIndex === Number(app)\n }\n })\n\n if (txnIndex > -1) {\n const { account } = reference as algosdk.modelsv2.AssetHoldingReference | algosdk.modelsv2.ApplicationLocalReference\n\n txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)]\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.appForeignApps?.includes(Number(app)) || t.txn.appIndex === Number(app)\n })\n\n if (txnIndex > -1) {\n txns[txnIndex].txn.boxes = [...(txns[txnIndex].txn.boxes ?? []), { appIndex: Number(app), name }]\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\n const accounts = t.txn.appAccounts?.length || 0\n if (type === 'account') return accounts < MAX_APP_CALL_ACCOUNT_REFERENCES\n\n const assets = t.txn.appForeignAssets?.length || 0\n const apps = t.txn.appForeignApps?.length || 0\n const boxes = t.txn.boxes?.length || 0\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 txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(reference as string)]\n } else if (type === 'app') {\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(reference)]\n } else if (type === 'box') {\n const { app, name } = reference as algosdk.modelsv2.BoxReference\n txns[txnIndex].txn.boxes = [...(txns[txnIndex].txn.boxes ?? []), { appIndex: Number(app), name }]\n\n if (app.toString() !== '0') {\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)]\n }\n } else if (type === 'assetHolding') {\n const { asset, account } = reference as algosdk.modelsv2.AssetHoldingReference\n txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(asset)]\n txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)]\n } else if (type === 'appLocal') {\n const { app, account } = reference as algosdk.modelsv2.ApplicationLocalReference\n txns[txnIndex].txn.appAccounts = [...(txns[txnIndex].txn.appAccounts ?? []), algosdk.decodeAddress(account)]\n txns[txnIndex].txn.appForeignApps = [...(txns[txnIndex].txn.appForeignApps ?? []), Number(app)]\n } else if (type === 'asset') {\n txns[txnIndex].txn.appForeignAssets = [...(txns[txnIndex].txn.appForeignAssets ?? []), Number(reference)]\n }\n }\n\n const g = unnamedResourcesAccessed.group\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 const newAtc = new algosdk.AtomicTransactionComposer()\n\n group.forEach((t) => {\n // eslint-disable-next-line no-param-reassign\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, ...executeParams } = atcSend\n\n let atc: AtomicTransactionComposer\n\n // const hasAppCalls = () =>\n // givenAtc\n // .buildGroup()\n // .map((t) => t.txn.type)\n // .includes(algosdk.TransactionType.appl)\n\n atc = givenAtc\n try {\n // If populateAppCallResources is true OR if populateAppCallResources is undefined and there are app calls, then populate resources\n // NOTE: Temporary false by default until this algod bug is fixed: https://github.com/algorand/go-algorand/issues/5914\n const populateResources =\n executeParams?.populateAppCallResources ?? sendParams?.populateAppCallResources ?? Config.populateAppCallResources\n\n if (populateResources) {\n atc = await populateAppCallResources(givenAtc, algod)\n }\n\n const transactionsWithSigner = atc.buildGroup()\n\n const transactionsToSend = transactionsWithSigner.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 // Dump the traces to a file 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 ${algosdk.encodeAddress(\n transactionsToSend[0].from.publicKey,\n )}`,\n )\n }\n\n let confirmations: modelsv2.PendingTransactionResponse[] | undefined = undefined\n if (!sendParams?.skipWaiting) {\n confirmations = await Promise.all(\n transactionsToSend.map(async (t) =>\n modelsv2.PendingTransactionResponse.from_obj_for_encoding(await algod.pendingTransactionInformation(t.txID()).do()),\n ),\n )\n }\n\n return {\n groupId,\n confirmations,\n txIds: transactionsToSend.map((t) => t.txID()),\n transactions: transactionsToSend,\n returns: result.methodResults.map(\n (r) =>\n ({\n decodeError: r.decodeError,\n returnValue: r.returnValue,\n rawReturnValue: r.rawReturnValue,\n }) as ABIReturn,\n ),\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 err.name = e.name\n }\n\n if (Config.debug && typeof e === 'object') {\n err.traces = []\n Config.logger.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 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?.get_obj_for_encoding(),\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.logger.error('Received error executing Atomic Transaction Composer, for more information enable the debug flag', err)\n }\n throw err\n }\n}\n\n/**\n * @deprecated Use `performAtomicTransactionComposerSimulate`, dry-run is a deprecated Algorand feature.\n *\n * Performs a dry run of the transactions loaded into the given AtomicTransactionComposer`\n * @param atc The AtomicTransactionComposer` with transaction(s) loaded\n * @param algod An Algod client\n * @returns The dryrun result\n */\nexport async function performAtomicTransactionComposerDryrun(atc: AtomicTransactionComposer, algod: Algodv2) {\n const signedTransactions = await atc.gatherSignatures()\n const txns = signedTransactions.map((t) => {\n return algosdk.decodeSignedTransaction(t)\n })\n const dryrun = await algosdk.createDryrun({ client: algod, txns })\n return new algosdk.DryrunResult(await algod.dryrun(dryrun).do())\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` (`algorand.newGroup()`) or `AtomicTransactionComposer` to construct and send group transactions instead.\n *\n * Signs and sends a group of [up to 16](https://developer.algorand.org/docs/get-details/atomic_transfers/#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 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\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 = modelsv2.NodeStatusResponse.from_obj_for_encoding(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 = modelsv2.PendingTransactionResponse.from_obj_for_encoding(\n 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 `AlgoKitComposer` 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 (!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 > algosdk.ALGORAND_MIN_TX_FEE) {\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 transaction.flatFee = true\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` 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 transaction.flatFee = true\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) {\n return params ? { ...params } : await algod.getTransactionParams().do()\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"],"names":[],"mappings":";;;;;;;AAmBA,IAAO,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAA;AACpE,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAM3B,MAAM,0BAA0B,GAAG,GAAE;AACrC,MAAM,+BAA+B,GAAG,EAAC;AACzC,MAAM,+BAA+B,GAAG,EAAC;AAEhD;;;;;;;;;;;;;;AAcG;AACG,SAAU,qBAAqB,CAAC,IAAsB,EAAA;IAC1D,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;AAC/C,QAAA,OAAO,SAAS,CAAA;KACjB;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE;AACtE,QAAA,OAAO,IAAI,CAAA;KACZ;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,UAAU,IAAI,IAAI,EAAE;AACzD,QAAA,MAAM,WAAW,GAAG,CAAG,EAAA,IAAI,CAAC,QAAQ,CAAA,CAAA,EAAI,IAAI,CAAC,MAAM,CAAG,EAAA,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI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AC,CAAwF,qFAAA,EAAA,WAAW,CAAC,GAAG,CAAS,OAAA,CAAA,CAAC,CAAA;SACrI;;AAGD,QAAA,WAAW,CAAC,OAAO,GAAG,IAAI,CAAA;KAC3B;AACH,CAAC;AAED;;;;;;AAMG;AACa,SAAA,WAAW,CACzB,WAAc,EACd,UAAqD,EAAA;AAErD,IAAA,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,UAAU,CAAA;IAClC,IAAI,GAAG,EAAE;QACP,WAAW,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AACvC,QAAA,WAAW,CAAC,OAAO,GAAG,IAAI,CAAA;KAC3B;AAED,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;AACxB,QAAA,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;KACvC;AAED,IAAA,OAAO,WAAW,CAAA;AACpB,CAAC;AAED;;;;;;;AAOG;AACI,eAAe,oBAAoB,CAAC,MAAmC,EAAE,KAAc,EAAA;AAC5F,IAAA,OAAO,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;AACzE,CAAC;AAED;;;;;;AAMG;AACG,SAAU,wCAAwC,CAAC,GAA8B,EAAA;AACrF,IAAA,IAAI;AACF,QAAA,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,CAAA;KAChC;AAAC,IAAA,MAAM;AACN,QAAA,OAAO,EAAE,CAAA;KACV;AACH;;;;"}
@@ -3,7 +3,7 @@ import { SendTransactionResult } from '../types/transaction';
3
3
  import { AlgoTransferParams } from '../types/transfer';
4
4
  import Algodv2 = algosdk.Algodv2;
5
5
  /**
6
- * @deprecated Use `algorand.send.payment()` / `algorand.transactions.payment()` instead
6
+ * @deprecated Use `algorand.send.payment()` / `algorand.createTransaction.payment()` instead
7
7
  *
8
8
  * Transfer Algo between two accounts.
9
9
  * @param transfer The transfer definition
@@ -4,7 +4,7 @@ var legacyBridge = require('../transaction/legacy-bridge.js');
4
4
  var transaction = require('../transaction/transaction.js');
5
5
 
6
6
  /**
7
- * @deprecated Use `algorand.send.payment()` / `algorand.transactions.payment()` instead
7
+ * @deprecated Use `algorand.send.payment()` / `algorand.createTransaction.payment()` instead
8
8
  *
9
9
  * Transfer Algo between two accounts.
10
10
  * @param transfer The transfer definition
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-algos.js","sources":["../../src/transfer/transfer-algos.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { PaymentParams } from '../types/composer'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoTransferParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `algorand.send.payment()` / `algorand.transactions.payment()` instead\n *\n * Transfer Algo between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAlgos({ from, to, amount: algokit.algo(1) }, algod)\n * ```\n */\nexport async function transferAlgos(transfer: AlgoTransferParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: PaymentParams = {\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n amount: transfer.amount,\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n }\n\n return await legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n params,\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":["getSenderAddress","encodeTransactionNote","legacySendTransactionBridge"],"mappings":";;;;;AAQA;;;;;;;;;;;;AAYG;AACI,eAAe,aAAa,CAAC,QAA4B,EAAE,KAAc,EAAA;AAC9E,IAAA,MAAM,MAAM,GAAkB;AAC5B,QAAA,MAAM,EAAEA,4BAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvC,QAAA,QAAQ,EAAEA,4BAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;AACvB,QAAA,IAAI,EAAEC,iCAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;KACtB,CAAA;AAED,IAAA,OAAO,MAAMC,wCAA2B,CACtC,KAAK,EACL,QAAQ,CAAC,IAAI,EACb,QAAQ,EACR,MAAM,EACN,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"transfer-algos.js","sources":["../../src/transfer/transfer-algos.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { PaymentParams } from '../types/composer'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoTransferParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `algorand.send.payment()` / `algorand.createTransaction.payment()` instead\n *\n * Transfer Algo between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAlgos({ from, to, amount: algokit.algo(1) }, algod)\n * ```\n */\nexport async function transferAlgos(transfer: AlgoTransferParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: PaymentParams = {\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n amount: transfer.amount,\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n }\n\n return await legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n params,\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":["getSenderAddress","encodeTransactionNote","legacySendTransactionBridge"],"mappings":";;;;;AAQA;;;;;;;;;;;;AAYG;AACI,eAAe,aAAa,CAAC,QAA4B,EAAE,KAAc,EAAA;AAC9E,IAAA,MAAM,MAAM,GAAkB;AAC5B,QAAA,MAAM,EAAEA,4BAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvC,QAAA,QAAQ,EAAEA,4BAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;AACvB,QAAA,IAAI,EAAEC,iCAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;KACtB,CAAA;AAED,IAAA,OAAO,MAAMC,wCAA2B,CACtC,KAAK,EACL,QAAQ,CAAC,IAAI,EACb,QAAQ,EACR,MAAM,EACN,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;"}
@@ -2,7 +2,7 @@ import { legacySendTransactionBridge } from '../transaction/legacy-bridge.mjs';
2
2
  import { getSenderAddress, encodeTransactionNote } from '../transaction/transaction.mjs';
3
3
 
4
4
  /**
5
- * @deprecated Use `algorand.send.payment()` / `algorand.transactions.payment()` instead
5
+ * @deprecated Use `algorand.send.payment()` / `algorand.createTransaction.payment()` instead
6
6
  *
7
7
  * Transfer Algo between two accounts.
8
8
  * @param transfer The transfer definition
@@ -1 +1 @@
1
- {"version":3,"file":"transfer-algos.mjs","sources":["../../src/transfer/transfer-algos.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { PaymentParams } from '../types/composer'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoTransferParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `algorand.send.payment()` / `algorand.transactions.payment()` instead\n *\n * Transfer Algo between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAlgos({ from, to, amount: algokit.algo(1) }, algod)\n * ```\n */\nexport async function transferAlgos(transfer: AlgoTransferParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: PaymentParams = {\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n amount: transfer.amount,\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n }\n\n return await legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n params,\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;AAYG;AACI,eAAe,aAAa,CAAC,QAA4B,EAAE,KAAc,EAAA;AAC9E,IAAA,MAAM,MAAM,GAAkB;AAC5B,QAAA,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvC,QAAA,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;AACvB,QAAA,IAAI,EAAE,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;KACtB,CAAA;AAED,IAAA,OAAO,MAAM,2BAA2B,CACtC,KAAK,EACL,QAAQ,CAAC,IAAI,EACb,QAAQ,EACR,MAAM,EACN,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"transfer-algos.mjs","sources":["../../src/transfer/transfer-algos.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { PaymentParams } from '../types/composer'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoTransferParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `algorand.send.payment()` / `algorand.createTransaction.payment()` instead\n *\n * Transfer Algo between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAlgos({ from, to, amount: algokit.algo(1) }, algod)\n * ```\n */\nexport async function transferAlgos(transfer: AlgoTransferParams, algod: Algodv2): Promise<SendTransactionResult> {\n const params: PaymentParams = {\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n amount: transfer.amount,\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n }\n\n return await legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n params,\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;AAYG;AACI,eAAe,aAAa,CAAC,QAA4B,EAAE,KAAc,EAAA;AAC9E,IAAA,MAAM,MAAM,GAAkB;AAC5B,QAAA,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;AACvC,QAAA,QAAQ,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;AACvB,QAAA,IAAI,EAAE,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;KACtB,CAAA;AAED,IAAA,OAAO,MAAM,2BAA2B,CACtC,KAAK,EACL,QAAQ,CAAC,IAAI,EACb,QAAQ,EACR,MAAM,EACN,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;"}
@@ -20,7 +20,7 @@ import Kmd = algosdk.Kmd;
20
20
  */
21
21
  export declare function ensureFunded<T extends EnsureFundedParams>(funding: T, algod: Algodv2, kmd?: Kmd): Promise<EnsureFundedReturnType | undefined>;
22
22
  /**
23
- * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead
23
+ * @deprecated Use `algorand.send.assetTransfer()` / `algorand.createTransaction.assetTransfer()` instead
24
24
  *
25
25
  * Transfer asset between two accounts.
26
26
  * @param transfer The transfer definition
@@ -54,7 +54,7 @@ async function ensureFunded(funding, algod, kmd) {
54
54
  }
55
55
  }
56
56
  /**
57
- * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead
57
+ * @deprecated Use `algorand.send.assetTransfer()` / `algorand.createTransaction.assetTransfer()` instead
58
58
  *
59
59
  * Transfer asset between two accounts.
60
60
  * @param transfer The transfer definition
@@ -1 +1 @@
1
- {"version":3,"file":"transfer.js","sources":["../../src/transfer/transfer.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { TestNetDispenserApiClient } from '../types/dispenser-client'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoRekeyParams, EnsureFundedParams, EnsureFundedReturnType, TransferAssetParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.ensureFunded()` / `algorand.account.ensureFundedFromEnvironment()`\n * / `algorand.account.ensureFundedFromTestNetDispenserApi()` instead\n *\n * Funds a given account using a funding source such that it has a certain amount of Algo free to spend (accounting for Algo locked in minimum balance requirement).\n *\n * https://developer.algorand.org/docs/get-details/accounts/#minimum-balance\n *\n * @param funding The funding configuration of type `EnsureFundedParams`, including the account to fund, minimum spending balance, and optional parameters. If you set `useDispenserApi` to true, you must also set `ALGOKIT_DISPENSER_ACCESS_TOKEN` in your environment variables.\n * @param algod An instance of the Algodv2 client.\n * @param kmd An optional instance of the Kmd client.\n * @returns\n * - `EnsureFundedReturnType` if funds were transferred.\n * - `undefined` if no funds were needed.\n */\nexport async function ensureFunded<T extends EnsureFundedParams>(\n funding: T,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<EnsureFundedReturnType | undefined> {\n const algorand = AlgorandClient.fromClients({ algod, kmd })\n\n if (funding.fundingSource instanceof TestNetDispenserApiClient) {\n const result = await algorand.account.ensureFundedFromTestNetDispenserApi(\n getSenderAddress(funding.accountToFund),\n funding.fundingSource,\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n },\n )\n if (!result) return undefined\n return {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.transactionId,\n }\n } else {\n const sender = funding.fundingSource ?? (await algorand.account.dispenserFromEnvironment())\n algorand.setSignerFromAccount(sender)\n\n const result = await algorand.account.ensureFunded(\n getSenderAddress(funding.accountToFund),\n getSenderAddress(sender),\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n note: encodeTransactionNote(funding.note),\n staticFee: funding.fee,\n lease: funding.lease,\n maxFee: funding.maxFee,\n maxRoundsToWaitForConfirmation: funding.maxRoundsToWaitForConfirmation,\n suppressLog: funding.suppressLog,\n },\n )\n\n return result\n ? {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.txIds[0],\n }\n : undefined\n }\n}\n\n/**\n * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead\n *\n * Transfer asset between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAsset({ from, to, assetId, amount }, algod)\n * ```\n */\nexport async function transferAsset(transfer: TransferAssetParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n {\n assetId: BigInt(transfer.assetId),\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n clawbackTarget: transfer.clawbackFrom ? getSenderAddress(transfer.clawbackFrom) : undefined,\n amount: BigInt(transfer.amount),\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n },\n (c) => c.assetTransfer,\n (c) => c.assetTransfer,\n )\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyAccount()` instead\n *\n * Rekey an account to a new address.\n *\n * **Note:** Please be careful with this function and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n *\n * @param rekey The rekey definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.rekeyAccount({ from, rekeyTo }, algod)\n * ```\n */\nexport async function rekeyAccount(rekey: AlgoRekeyParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n rekey.from,\n rekey,\n {\n sender: getSenderAddress(rekey.from),\n receiver: getSenderAddress(rekey.from),\n amount: (0).microAlgo(),\n rekeyTo: typeof rekey.rekeyTo === 'string' ? rekey.rekeyTo : getSenderAddress(rekey.rekeyTo),\n note: encodeTransactionNote(rekey.note),\n lease: rekey.lease,\n },\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":["AlgorandClient","TestNetDispenserApiClient","getSenderAddress","encodeTransactionNote","legacySendTransactionBridge"],"mappings":";;;;;;;AAUA;;;;;;;;;;;;;;AAcG;AACI,eAAe,YAAY,CAChC,OAAU,EACV,KAAc,EACd,GAAS,EAAA;AAET,IAAA,MAAM,QAAQ,GAAGA,mCAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AAE3D,IAAA,IAAI,OAAO,CAAC,aAAa,YAAYC,+CAAyB,EAAE;QAC9D,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO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,KAAK,CAAC,IAAI,CAAC;QACvC,KAAK,EAAE,KAAK,CAAC,KAAK;AACnB,KAAA,EACD,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;;;"}
1
+ {"version":3,"file":"transfer.js","sources":["../../src/transfer/transfer.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { TestNetDispenserApiClient } from '../types/dispenser-client'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoRekeyParams, EnsureFundedParams, EnsureFundedReturnType, TransferAssetParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.ensureFunded()` / `algorand.account.ensureFundedFromEnvironment()`\n * / `algorand.account.ensureFundedFromTestNetDispenserApi()` instead\n *\n * Funds a given account using a funding source such that it has a certain amount of Algo free to spend (accounting for Algo locked in minimum balance requirement).\n *\n * https://developer.algorand.org/docs/get-details/accounts/#minimum-balance\n *\n * @param funding The funding configuration of type `EnsureFundedParams`, including the account to fund, minimum spending balance, and optional parameters. If you set `useDispenserApi` to true, you must also set `ALGOKIT_DISPENSER_ACCESS_TOKEN` in your environment variables.\n * @param algod An instance of the Algodv2 client.\n * @param kmd An optional instance of the Kmd client.\n * @returns\n * - `EnsureFundedReturnType` if funds were transferred.\n * - `undefined` if no funds were needed.\n */\nexport async function ensureFunded<T extends EnsureFundedParams>(\n funding: T,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<EnsureFundedReturnType | undefined> {\n const algorand = AlgorandClient.fromClients({ algod, kmd })\n\n if (funding.fundingSource instanceof TestNetDispenserApiClient) {\n const result = await algorand.account.ensureFundedFromTestNetDispenserApi(\n getSenderAddress(funding.accountToFund),\n funding.fundingSource,\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n },\n )\n if (!result) return undefined\n return {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.transactionId,\n }\n } else {\n const sender = funding.fundingSource ?? (await algorand.account.dispenserFromEnvironment())\n algorand.setSignerFromAccount(sender)\n\n const result = await algorand.account.ensureFunded(\n getSenderAddress(funding.accountToFund),\n getSenderAddress(sender),\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n note: encodeTransactionNote(funding.note),\n staticFee: funding.fee,\n lease: funding.lease,\n maxFee: funding.maxFee,\n maxRoundsToWaitForConfirmation: funding.maxRoundsToWaitForConfirmation,\n suppressLog: funding.suppressLog,\n },\n )\n\n return result\n ? {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.txIds[0],\n }\n : undefined\n }\n}\n\n/**\n * @deprecated Use `algorand.send.assetTransfer()` / `algorand.createTransaction.assetTransfer()` instead\n *\n * Transfer asset between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAsset({ from, to, assetId, amount }, algod)\n * ```\n */\nexport async function transferAsset(transfer: TransferAssetParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n {\n assetId: BigInt(transfer.assetId),\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n clawbackTarget: transfer.clawbackFrom ? getSenderAddress(transfer.clawbackFrom) : undefined,\n amount: BigInt(transfer.amount),\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n },\n (c) => c.assetTransfer,\n (c) => c.assetTransfer,\n )\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyAccount()` instead\n *\n * Rekey an account to a new address.\n *\n * **Note:** Please be careful with this function and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n *\n * @param rekey The rekey definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.rekeyAccount({ from, rekeyTo }, algod)\n * ```\n */\nexport async function rekeyAccount(rekey: AlgoRekeyParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n rekey.from,\n rekey,\n {\n sender: getSenderAddress(rekey.from),\n receiver: getSenderAddress(rekey.from),\n amount: (0).microAlgo(),\n rekeyTo: typeof rekey.rekeyTo === 'string' ? rekey.rekeyTo : getSenderAddress(rekey.rekeyTo),\n note: encodeTransactionNote(rekey.note),\n lease: rekey.lease,\n },\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":["AlgorandClient","TestNetDispenserApiClient","getSenderAddress","encodeTransactionNote","legacySendTransactionBridge"],"mappings":";;;;;;;AAUA;;;;;;;;;;;;;;AAcG;AACI,eAAe,YAAY,CAChC,OAAU,EACV,KAAc,EACd,GAAS,EAAA;AAET,IAAA,MAAM,QAAQ,GAAGA,mCAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AAE3D,IAAA,IAAI,OAAO,CAAC,aAAa,YAAYC,+CAAyB,EAAE;QAC9D,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,mCAAmC,CACvEC,4BAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,EACvC,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,kBAAkB,EAC1B;YACE,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;AACjD,SAAA,CACF,CAAA;AACD,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,SAAS,CAAA;QAC7B,OAAO;YACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;YAC7C,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAA;KAC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AE,QAAQ,CAAC,YAAY,GAAGA,4BAAgB,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,SAAS;AAC3F,QAAA,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC/B,QAAA,IAAI,EAAEC,iCAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;AACtB,KAAA,EACD,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,EACtB,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CACvB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;AAeG;AACI,eAAe,YAAY,CAAC,KAAsB,EAAE,KAAc,EAAA;IACvE,OAAOC,wCAA2B,CAChC,KAAK,EACL,KAAK,CAAC,IAAI,EACV,KAAK,EACL;AACE,QAAA,MAAM,EAAEF,4BAAgB,CAAC,KAAK,CAAC,IAAI,CAAC;AACpC,QAAA,QAAQ,EAAEA,4BAAgB,CAAC,KAAK,CAAC,IAAI,CAAC;AACtC,QAAA,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE;QACvB,OAAO,EAAE,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAGA,4BAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5F,QAAA,IAAI,EAAEC,iCAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;QACvC,KAAK,EAAE,KAAK,CAAC,KAAK;AACnB,KAAA,EACD,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;;;"}
@@ -52,7 +52,7 @@ async function ensureFunded(funding, algod, kmd) {
52
52
  }
53
53
  }
54
54
  /**
55
- * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead
55
+ * @deprecated Use `algorand.send.assetTransfer()` / `algorand.createTransaction.assetTransfer()` instead
56
56
  *
57
57
  * Transfer asset between two accounts.
58
58
  * @param transfer The transfer definition
@@ -1 +1 @@
1
- {"version":3,"file":"transfer.mjs","sources":["../../src/transfer/transfer.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { TestNetDispenserApiClient } from '../types/dispenser-client'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoRekeyParams, EnsureFundedParams, EnsureFundedReturnType, TransferAssetParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.ensureFunded()` / `algorand.account.ensureFundedFromEnvironment()`\n * / `algorand.account.ensureFundedFromTestNetDispenserApi()` instead\n *\n * Funds a given account using a funding source such that it has a certain amount of Algo free to spend (accounting for Algo locked in minimum balance requirement).\n *\n * https://developer.algorand.org/docs/get-details/accounts/#minimum-balance\n *\n * @param funding The funding configuration of type `EnsureFundedParams`, including the account to fund, minimum spending balance, and optional parameters. If you set `useDispenserApi` to true, you must also set `ALGOKIT_DISPENSER_ACCESS_TOKEN` in your environment variables.\n * @param algod An instance of the Algodv2 client.\n * @param kmd An optional instance of the Kmd client.\n * @returns\n * - `EnsureFundedReturnType` if funds were transferred.\n * - `undefined` if no funds were needed.\n */\nexport async function ensureFunded<T extends EnsureFundedParams>(\n funding: T,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<EnsureFundedReturnType | undefined> {\n const algorand = AlgorandClient.fromClients({ algod, kmd })\n\n if (funding.fundingSource instanceof TestNetDispenserApiClient) {\n const result = await algorand.account.ensureFundedFromTestNetDispenserApi(\n getSenderAddress(funding.accountToFund),\n funding.fundingSource,\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n },\n )\n if (!result) return undefined\n return {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.transactionId,\n }\n } else {\n const sender = funding.fundingSource ?? (await algorand.account.dispenserFromEnvironment())\n algorand.setSignerFromAccount(sender)\n\n const result = await algorand.account.ensureFunded(\n getSenderAddress(funding.accountToFund),\n getSenderAddress(sender),\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n note: encodeTransactionNote(funding.note),\n staticFee: funding.fee,\n lease: funding.lease,\n maxFee: funding.maxFee,\n maxRoundsToWaitForConfirmation: funding.maxRoundsToWaitForConfirmation,\n suppressLog: funding.suppressLog,\n },\n )\n\n return result\n ? {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.txIds[0],\n }\n : undefined\n }\n}\n\n/**\n * @deprecated Use `algorand.send.assetTransfer()` / `algorand.transactions.assetTransfer()` instead\n *\n * Transfer asset between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAsset({ from, to, assetId, amount }, algod)\n * ```\n */\nexport async function transferAsset(transfer: TransferAssetParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n {\n assetId: BigInt(transfer.assetId),\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n clawbackTarget: transfer.clawbackFrom ? getSenderAddress(transfer.clawbackFrom) : undefined,\n amount: BigInt(transfer.amount),\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n },\n (c) => c.assetTransfer,\n (c) => c.assetTransfer,\n )\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyAccount()` instead\n *\n * Rekey an account to a new address.\n *\n * **Note:** Please be careful with this function and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n *\n * @param rekey The rekey definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.rekeyAccount({ from, rekeyTo }, algod)\n * ```\n */\nexport async function rekeyAccount(rekey: AlgoRekeyParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n rekey.from,\n rekey,\n {\n sender: getSenderAddress(rekey.from),\n receiver: getSenderAddress(rekey.from),\n amount: (0).microAlgo(),\n rekeyTo: typeof rekey.rekeyTo === 'string' ? rekey.rekeyTo : getSenderAddress(rekey.rekeyTo),\n note: encodeTransactionNote(rekey.note),\n lease: rekey.lease,\n },\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":[],"mappings":";;;;;AAUA;;;;;;;;;;;;;;AAcG;AACI,eAAe,YAAY,CAChC,OAAU,EACV,KAAc,EACd,GAAS,EAAA;AAET,IAAA,MAAM,QAAQ,GAAG,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AAE3D,IAAA,IAAI,OAAO,CAAC,aAAa,YAAY,yBAAyB,EAAE;QAC9D,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,mCAAmC,CACvE,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,EACvC,OAAO,CAAC,aAAa,EACrB,OAAO,CAAC,kBAAkB,EAC1B;YACE,mBAAmB,EAAE,OAAO,CAAC,mBAAmB;AACjD,SAAA,CACF,CAAA;AACD,QAAA,IAAI,CAAC,MAAM;AAAE,YAAA,OAAO,SAAS,CAAA;QAC7B,OAAO;YACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC;YAC7C,aAAa,EAAE,MAAM,CAAC,aAAa;SACpC,CAAA;KACF;SAAM;AACL,QAAA,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,KAAK,MAAM,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAA;AAC3F,QAAA,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAErC,M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AC,IAAI,CAAC;QAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;AACtB,KAAA,EACD,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,EACtB,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CACvB,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;AAeG;AACI,eAAe,YAAY,CAAC,KAAsB,EAAE,KAAc,EAAA;IACvE,OAAO,2BAA2B,CAChC,KAAK,EACL,KAAK,CAAC,IAAI,EACV,KAAK,EACL;AACE,QAAA,MAAM,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC;AACpC,QAAA,QAAQ,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC;AACtC,QAAA,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE;QACvB,OAAO,EAAE,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5F,QAAA,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;QACvC,KAAK,EAAE,KAAK,CAAC,KAAK;AACnB,KAAA,EACD,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"transfer.mjs","sources":["../../src/transfer/transfer.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { legacySendTransactionBridge } from '../transaction/legacy-bridge'\nimport { encodeTransactionNote, getSenderAddress } from '../transaction/transaction'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { TestNetDispenserApiClient } from '../types/dispenser-client'\nimport { SendTransactionResult } from '../types/transaction'\nimport { AlgoRekeyParams, EnsureFundedParams, EnsureFundedReturnType, TransferAssetParams } from '../types/transfer'\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.ensureFunded()` / `algorand.account.ensureFundedFromEnvironment()`\n * / `algorand.account.ensureFundedFromTestNetDispenserApi()` instead\n *\n * Funds a given account using a funding source such that it has a certain amount of Algo free to spend (accounting for Algo locked in minimum balance requirement).\n *\n * https://developer.algorand.org/docs/get-details/accounts/#minimum-balance\n *\n * @param funding The funding configuration of type `EnsureFundedParams`, including the account to fund, minimum spending balance, and optional parameters. If you set `useDispenserApi` to true, you must also set `ALGOKIT_DISPENSER_ACCESS_TOKEN` in your environment variables.\n * @param algod An instance of the Algodv2 client.\n * @param kmd An optional instance of the Kmd client.\n * @returns\n * - `EnsureFundedReturnType` if funds were transferred.\n * - `undefined` if no funds were needed.\n */\nexport async function ensureFunded<T extends EnsureFundedParams>(\n funding: T,\n algod: Algodv2,\n kmd?: Kmd,\n): Promise<EnsureFundedReturnType | undefined> {\n const algorand = AlgorandClient.fromClients({ algod, kmd })\n\n if (funding.fundingSource instanceof TestNetDispenserApiClient) {\n const result = await algorand.account.ensureFundedFromTestNetDispenserApi(\n getSenderAddress(funding.accountToFund),\n funding.fundingSource,\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n },\n )\n if (!result) return undefined\n return {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.transactionId,\n }\n } else {\n const sender = funding.fundingSource ?? (await algorand.account.dispenserFromEnvironment())\n algorand.setSignerFromAccount(sender)\n\n const result = await algorand.account.ensureFunded(\n getSenderAddress(funding.accountToFund),\n getSenderAddress(sender),\n funding.minSpendingBalance,\n {\n minFundingIncrement: funding.minFundingIncrement,\n note: encodeTransactionNote(funding.note),\n staticFee: funding.fee,\n lease: funding.lease,\n maxFee: funding.maxFee,\n maxRoundsToWaitForConfirmation: funding.maxRoundsToWaitForConfirmation,\n suppressLog: funding.suppressLog,\n },\n )\n\n return result\n ? {\n amount: Number(result.amountFunded.microAlgo),\n transactionId: result.txIds[0],\n }\n : undefined\n }\n}\n\n/**\n * @deprecated Use `algorand.send.assetTransfer()` / `algorand.createTransaction.assetTransfer()` instead\n *\n * Transfer asset between two accounts.\n * @param transfer The transfer definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.transferAsset({ from, to, assetId, amount }, algod)\n * ```\n */\nexport async function transferAsset(transfer: TransferAssetParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n transfer.from,\n transfer,\n {\n assetId: BigInt(transfer.assetId),\n sender: getSenderAddress(transfer.from),\n receiver: getSenderAddress(transfer.to),\n clawbackTarget: transfer.clawbackFrom ? getSenderAddress(transfer.clawbackFrom) : undefined,\n amount: BigInt(transfer.amount),\n note: encodeTransactionNote(transfer.note),\n lease: transfer.lease,\n },\n (c) => c.assetTransfer,\n (c) => c.assetTransfer,\n )\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyAccount()` instead\n *\n * Rekey an account to a new address.\n *\n * **Note:** Please be careful with this function and be sure to read the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/).\n *\n * @param rekey The rekey definition\n * @param algod An algod client\n * @returns The transaction object and optionally the confirmation if it was sent to the chain (`skipSending` is `false` or unset)\n *\n * @example Usage example\n * ```typescript\n * await algokit.rekeyAccount({ from, rekeyTo }, algod)\n * ```\n */\nexport async function rekeyAccount(rekey: AlgoRekeyParams, algod: Algodv2): Promise<SendTransactionResult> {\n return legacySendTransactionBridge(\n algod,\n rekey.from,\n rekey,\n {\n sender: getSenderAddress(rekey.from),\n receiver: getSenderAddress(rekey.from),\n amount: (0).microAlgo(),\n rekeyTo: typeof rekey.rekeyTo === 'string' ? rekey.rekeyTo : getSenderAddress(rekey.rekeyTo),\n note: encodeTransactionNote(rekey.note),\n lease: rekey.lease,\n },\n (c) => c.payment,\n (c) => c.payment,\n )\n}\n"],"names":[],"mappings":";;;;;AAUA;;;;;;;;;;;;;;AAcG;AACI,eAAe,YAAY,CAChC,OAAU,EACV,KAA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,MAAM,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE;QACvB,OAAO,EAAE,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,GAAG,KAAK,CAAC,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;AAC5F,QAAA,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;QACvC,KAAK,EAAE,KAAK,CAAC,KAAK;AACnB,KAAA,EACD,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAChB,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CACjB,CAAA;AACH;;;;"}
@@ -5,7 +5,7 @@ import { ClientManager } from './client-manager';
5
5
  import { CommonTransactionParams } from './composer';
6
6
  import { TestNetDispenserApiClient } from './dispenser-client';
7
7
  import { KmdAccountManager } from './kmd-account-manager';
8
- import { ExecuteParams, SendSingleTransactionResult } from './transaction';
8
+ import { SendParams, SendSingleTransactionResult } from './transaction';
9
9
  import LogicSigAccount = algosdk.LogicSigAccount;
10
10
  import Account = algosdk.Account;
11
11
  /** Result from performing an ensureFunded call. */
@@ -93,6 +93,15 @@ export declare class AccountManager {
93
93
  * @returns The `AccountManager` instance for method chaining
94
94
  */
95
95
  setSigner(sender: string, signer: algosdk.TransactionSigner): this;
96
+ /**
97
+ * Takes all registered signers from the given `AccountManager` and adds them to this `AccountManager`.
98
+ *
99
+ * This is useful for situations where you have multiple contexts you are building accounts in such as unit tests.
100
+ * @param anotherAccountManager Another account manager with signers registered
101
+ * @param overwriteExisting Whether or not to overwrite any signers that have the same sender address with the ones in the other account manager or not (default: true)
102
+ * @returns The `AccountManager` instance for method chaining
103
+ */
104
+ setSigners(anotherAccountManager: AccountManager, overwriteExisting?: boolean): void;
96
105
  /**
97
106
  * Returns the `TransactionSigner` for the given sender address, ready to sign a transaction for that sender.
98
107
  *
@@ -328,7 +337,7 @@ export declare class AccountManager {
328
337
  * ```
329
338
  * @returns The result of the transaction and the transaction that was sent
330
339
  */
331
- rekeyAccount(account: string | TransactionSignerAccount, rekeyTo: string | TransactionSignerAccount, options?: Omit<CommonTransactionParams, 'sender'> & ExecuteParams): Promise<SendSingleTransactionResult>;
340
+ rekeyAccount(account: string | TransactionSignerAccount, rekeyTo: string | TransactionSignerAccount, options?: Omit<CommonTransactionParams, 'sender'> & SendParams): Promise<SendSingleTransactionResult>;
332
341
  private _getEnsureFundedAmount;
333
342
  /**
334
343
  * Funds a given account using a dispenser account as a funding source such that
@@ -356,7 +365,7 @@ export declare class AccountManager {
356
365
  */
357
366
  ensureFunded(accountToFund: string | TransactionSignerAccount, dispenserAccount: string | TransactionSignerAccount, minSpendingBalance: AlgoAmount, options?: {
358
367
  minFundingIncrement?: AlgoAmount;
359
- } & ExecuteParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
368
+ } & SendParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
360
369
  /**
361
370
  * Funds a given account using a dispenser account retrieved from the environment,
362
371
  * per the `dispenserFromEnvironment` method, as a funding source such that
@@ -389,7 +398,7 @@ export declare class AccountManager {
389
398
  */
390
399
  ensureFundedFromEnvironment(accountToFund: string | TransactionSignerAccount, minSpendingBalance: AlgoAmount, options?: {
391
400
  minFundingIncrement?: AlgoAmount;
392
- } & ExecuteParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
401
+ } & SendParams & Omit<CommonTransactionParams, 'sender'>): Promise<(SendSingleTransactionResult & EnsureFundedResult) | undefined>;
393
402
  /**
394
403
  * Funds a given account using the TestNet Dispenser API as a funding source such that
395
404
  * the account has a certain amount of Algo free to spend (accounting for Algo locked