@algorandfoundation/algokit-utils 7.0.0-beta.8 → 7.0.0

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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/account/account.js +6 -4
  4. package/account/account.js.map +1 -1
  5. package/account/account.mjs +6 -4
  6. package/account/account.mjs.map +1 -1
  7. package/account/get-account-config-from-environment.js.map +1 -1
  8. package/account/get-account-config-from-environment.mjs.map +1 -1
  9. package/account/get-account.js.map +1 -1
  10. package/account/get-account.mjs.map +1 -1
  11. package/account/get-dispenser-account.js.map +1 -1
  12. package/account/get-dispenser-account.mjs.map +1 -1
  13. package/account/mnemonic-account.js.map +1 -1
  14. package/account/mnemonic-account.mjs.map +1 -1
  15. package/amount.js.map +1 -1
  16. package/amount.mjs.map +1 -1
  17. package/app-client.js.map +1 -1
  18. package/app-client.mjs.map +1 -1
  19. package/app-deploy.js +2 -10
  20. package/app-deploy.js.map +1 -1
  21. package/app-deploy.mjs +3 -11
  22. package/app-deploy.mjs.map +1 -1
  23. package/app.d.ts +2 -2
  24. package/app.js +2 -2
  25. package/app.js.map +1 -1
  26. package/app.mjs +2 -2
  27. package/app.mjs.map +1 -1
  28. package/asset.js.map +1 -1
  29. package/asset.mjs.map +1 -1
  30. package/debugging/debugging.js.map +1 -1
  31. package/debugging/debugging.mjs.map +1 -1
  32. package/dispenser-client.js.map +1 -1
  33. package/dispenser-client.mjs.map +1 -1
  34. package/index.d.ts +1 -0
  35. package/index.js +6 -0
  36. package/index.js.map +1 -1
  37. package/index.mjs +2 -1
  38. package/index.mjs.map +1 -1
  39. package/indexer-lookup.js.map +1 -1
  40. package/indexer-lookup.mjs.map +1 -1
  41. package/localnet/get-kmd-wallet-account.js.map +1 -1
  42. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  43. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  44. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  45. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  46. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  47. package/localnet/is-localnet.js.map +1 -1
  48. package/localnet/is-localnet.mjs.map +1 -1
  49. package/network-client.js.map +1 -1
  50. package/network-client.mjs.map +1 -1
  51. package/package.json +5 -5
  52. package/testing/account.js.map +1 -1
  53. package/testing/account.mjs.map +1 -1
  54. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  55. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  56. package/testing/fixtures/algorand-fixture.js.map +1 -1
  57. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  58. package/testing/indexer.js.map +1 -1
  59. package/testing/indexer.mjs.map +1 -1
  60. package/testing/test-logger.js.map +1 -1
  61. package/testing/test-logger.mjs.map +1 -1
  62. package/testing/transaction-logger.js.map +1 -1
  63. package/testing/transaction-logger.mjs.map +1 -1
  64. package/transaction/legacy-bridge.js +2 -2
  65. package/transaction/legacy-bridge.js.map +1 -1
  66. package/transaction/legacy-bridge.mjs +3 -3
  67. package/transaction/legacy-bridge.mjs.map +1 -1
  68. package/transaction/perform-atomic-transaction-composer-simulate.js +1 -0
  69. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  70. package/transaction/perform-atomic-transaction-composer-simulate.mjs +1 -0
  71. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  72. package/transaction/transaction.d.ts +14 -7
  73. package/transaction/transaction.js +57 -31
  74. package/transaction/transaction.js.map +1 -1
  75. package/transaction/transaction.mjs +55 -30
  76. package/transaction/transaction.mjs.map +1 -1
  77. package/transfer/transfer-algos.js.map +1 -1
  78. package/transfer/transfer-algos.mjs.map +1 -1
  79. package/transfer/transfer.js.map +1 -1
  80. package/transfer/transfer.mjs.map +1 -1
  81. package/types/account-manager.d.ts +1 -1
  82. package/types/account-manager.js +10 -8
  83. package/types/account-manager.js.map +1 -1
  84. package/types/account-manager.mjs +11 -9
  85. package/types/account-manager.mjs.map +1 -1
  86. package/types/account.d.ts +9 -0
  87. package/types/account.js.map +1 -1
  88. package/types/account.mjs.map +1 -1
  89. package/types/algo-http-client-with-retry.js.map +1 -1
  90. package/types/algo-http-client-with-retry.mjs.map +1 -1
  91. package/types/algorand-client-interface.d.ts +2 -2
  92. package/types/algorand-client-transaction-creator.d.ts +5 -3
  93. package/types/algorand-client-transaction-creator.js +3 -1
  94. package/types/algorand-client-transaction-creator.js.map +1 -1
  95. package/types/algorand-client-transaction-creator.mjs +3 -1
  96. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  97. package/types/algorand-client-transaction-sender.d.ts +12 -8
  98. package/types/algorand-client-transaction-sender.js +6 -2
  99. package/types/algorand-client-transaction-sender.js.map +1 -1
  100. package/types/algorand-client-transaction-sender.mjs +6 -2
  101. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  102. package/types/algorand-client.d.ts +3 -4
  103. package/types/algorand-client.js +2 -5
  104. package/types/algorand-client.js.map +1 -1
  105. package/types/algorand-client.mjs +4 -4
  106. package/types/algorand-client.mjs.map +1 -1
  107. package/types/amount.js.map +1 -1
  108. package/types/amount.mjs.map +1 -1
  109. package/types/app-arc56.d.ts +31 -20
  110. package/types/app-arc56.js.map +1 -1
  111. package/types/app-arc56.mjs.map +1 -1
  112. package/types/app-client.d.ts +97 -78
  113. package/types/app-client.js +171 -54
  114. package/types/app-client.js.map +1 -1
  115. package/types/app-client.mjs +169 -52
  116. package/types/app-client.mjs.map +1 -1
  117. package/types/app-deployer.js +1 -1
  118. package/types/app-deployer.js.map +1 -1
  119. package/types/app-deployer.mjs +2 -2
  120. package/types/app-deployer.mjs.map +1 -1
  121. package/types/app-factory.d.ts +30 -10
  122. package/types/app-factory.js +26 -20
  123. package/types/app-factory.js.map +1 -1
  124. package/types/app-factory.mjs +26 -20
  125. package/types/app-factory.mjs.map +1 -1
  126. package/types/app-manager.js +105 -23
  127. package/types/app-manager.js.map +1 -1
  128. package/types/app-manager.mjs +105 -23
  129. package/types/app-manager.mjs.map +1 -1
  130. package/types/app-spec.js +8 -2
  131. package/types/app-spec.js.map +1 -1
  132. package/types/app-spec.mjs +8 -2
  133. package/types/app-spec.mjs.map +1 -1
  134. package/types/app.d.ts +8 -7
  135. package/types/app.js.map +1 -1
  136. package/types/app.mjs.map +1 -1
  137. package/types/asset-manager.d.ts +4 -4
  138. package/types/asset-manager.js +2 -2
  139. package/types/asset-manager.js.map +1 -1
  140. package/types/asset-manager.mjs +2 -2
  141. package/types/asset-manager.mjs.map +1 -1
  142. package/types/async-event-emitter.d.ts +1 -10
  143. package/types/async-event-emitter.js +0 -5
  144. package/types/async-event-emitter.js.map +1 -1
  145. package/types/async-event-emitter.mjs +1 -6
  146. package/types/async-event-emitter.mjs.map +1 -1
  147. package/types/client-manager.js +2 -2
  148. package/types/client-manager.js.map +1 -1
  149. package/types/client-manager.mjs +2 -2
  150. package/types/client-manager.mjs.map +1 -1
  151. package/types/composer.d.ts +40 -25
  152. package/types/composer.js +114 -40
  153. package/types/composer.js.map +1 -1
  154. package/types/composer.mjs +115 -39
  155. package/types/composer.mjs.map +1 -1
  156. package/types/config.js.map +1 -1
  157. package/types/config.mjs.map +1 -1
  158. package/types/debugging.d.ts +1 -1
  159. package/types/debugging.js +1 -1
  160. package/types/debugging.js.map +1 -1
  161. package/types/debugging.mjs +1 -1
  162. package/types/debugging.mjs.map +1 -1
  163. package/types/dispenser-client.js.map +1 -1
  164. package/types/dispenser-client.mjs.map +1 -1
  165. package/types/indexer.js.map +1 -1
  166. package/types/indexer.mjs.map +1 -1
  167. package/types/kmd-account-manager.js +1 -1
  168. package/types/kmd-account-manager.js.map +1 -1
  169. package/types/kmd-account-manager.mjs +2 -2
  170. package/types/kmd-account-manager.mjs.map +1 -1
  171. package/types/lifecycle-events.d.ts +10 -0
  172. package/types/lifecycle-events.js +8 -0
  173. package/types/lifecycle-events.js.map +1 -0
  174. package/types/lifecycle-events.mjs +8 -0
  175. package/types/lifecycle-events.mjs.map +1 -0
  176. package/types/logging.js.map +1 -1
  177. package/types/logging.mjs.map +1 -1
  178. package/types/logic-error.d.ts +2 -3
  179. package/types/logic-error.js +3 -3
  180. package/types/logic-error.js.map +1 -1
  181. package/types/logic-error.mjs +3 -3
  182. package/types/logic-error.mjs.map +1 -1
  183. package/types/network-client.js.map +1 -1
  184. package/types/network-client.mjs.map +1 -1
  185. package/types/testing.d.ts +1 -1
  186. package/types/urlTokenBaseHTTPClient.js.map +1 -1
  187. package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
  188. package/util.js.map +1 -1
  189. package/util.mjs.map +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Algorand Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -24,6 +24,13 @@ import { AlgorandClient, Config } from '@algorandfoundation/algokit-utils'
24
24
 
25
25
  See [usage](./docs/README.md#usage) for more details.
26
26
 
27
+ ## Migration
28
+
29
+ Whilst we aim to minimise breaking changes, there are situations where they are required.
30
+ JSDoc deprecations should guide you through most migration paths inside your IDE, however the migration guides will provide more detailed information should you need it.
31
+
32
+ If you're targetting v7, please refer to the [v7 migration guide](./docs/v7-migration.md).
33
+
27
34
  ## Guiding principles
28
35
 
29
36
  This library follows the [Guiding Principles of AlgoKit](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/algokit.md#guiding-principles).
@@ -139,10 +139,12 @@ async function getAccountInformation(sender, algod) {
139
139
  totalAssetsOptedIn: Number(account.totalAssetsOptedIn),
140
140
  totalCreatedApps: Number(account.totalCreatedApps),
141
141
  totalCreatedAssets: Number(account.totalCreatedAssets),
142
- appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,
143
- rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,
144
- totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,
145
- totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,
142
+ appsTotalExtraPages: account.appsTotalExtraPages !== undefined ? Number(account.appsTotalExtraPages) : undefined,
143
+ rewardBase: account.rewardBase !== undefined ? Number(account.rewardBase) : undefined,
144
+ totalBoxBytes: account.totalBoxBytes !== undefined ? Number(account.totalBoxBytes) : undefined,
145
+ totalBoxes: account.totalBoxes !== undefined ? Number(account.totalBoxes) : undefined,
146
+ lastHeartbeat: account.lastHeartbeat !== undefined ? Number(account.lastHeartbeat) : undefined,
147
+ lastProposed: account.lastProposed !== undefined ? Number(account.lastProposed) : undefined,
146
148
  };
147
149
  }
148
150
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sources":["../../src/account/account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { getSenderAddress } from '../transaction/transaction'\nimport { AccountAssetInformation, MultisigAccount, SigningAccount, TransactionSignerAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { SendTransactionFrom } from '../types/transaction'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\nimport MultisigMetadata = algosdk.MultisigMetadata\nimport TransactionSigner = algosdk.TransactionSigner\nimport AccountInformationModel = algosdk.modelsv2.Account\n\n/**\n * @deprecated Use `algorand.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.\n *\n * Returns an account wrapper that supports partial or full multisig signing.\n * @param multisigParams The parameters that define the multisig account\n * @param signingAccounts The signers that are currently present\n * @returns A multisig account wrapper\n */\nexport function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]) {\n return new MultisigAccount(multisigParams, signingAccounts)\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.\n *\n * Returns an account wrapper that supports a rekeyed account.\n * @param signer The account, with private key loaded, that is signing\n * @param sender The address of the rekeyed account that will act as a sender\n * @returns The SigningAccount wrapper\n */\nexport function rekeyedAccount(signer: Account, sender: string) {\n return new SigningAccount(signer, sender)\n}\n\n/**\n * @deprecated Use `algorand.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead.\n *\n * Returns an account wrapper that supports a transaction signer with associated sender address.\n * @param signer The transaction signer\n * @param sender The address of sender account\n * @returns The SigningAccount wrapper\n */\nexport function transactionSignerAccount(signer: TransactionSigner, sender: string): TransactionSignerAccount {\n return { addr: sender, signer }\n}\n\n/**\n * @deprecated Use `algorand.account.random()` or `algosdk.generateAccount()` instead.\n *\n * Returns a new, random Algorand account with secret key loaded.\n *\n * This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.\n *\n */\nexport function randomAccount(): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.generateAccount()\n}\n\n/**\n * @deprecated Use `algorand.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead.\n *\n * Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n * If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: string: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function mnemonicAccountFromEnvironment(\n account: string | { name: string; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n return (\n await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(\n typeof account === 'string' ? account : account.name,\n typeof account === 'string' ? undefined : account.fundWith,\n )\n ).account\n}\n\n/**\n * @deprecated Use `algosdk.decodeAddress` instead.\n *\n * Returns an account's address as a byte array\n *\n * @param account Either an account (with private key loaded) or the string address of an account\n */\nexport function getAccountAddressAsUint8Array(account: SendTransactionFrom | string) {\n return algosdk.decodeAddress(typeof account === 'string' ? account : getSenderAddress(account)).publicKey\n}\n\n/**\n * @deprecated Use `algosdk.encodeAddress` instead.\n *\n * Returns the string address of an Algorand account from a base64 encoded version of the underlying byte array of the address public key\n *\n * @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key\n */\nexport function getAccountAddressAsString(addressEncodedInB64: string): string {\n return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'))\n}\n\nexport type NumberConverter<T extends AccountInformationModel> = { [key in keyof T]: ToNumberIfExtends<T[key], number | bigint> }\ntype ToNumberIfExtends<K, E> = K extends E ? number : K\n/** @deprecated Account information at a given round. */\nexport type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>\n\n/**\n * @deprecated Use `algorand.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead.\n *\n * Returns the given sender account's current status, balance and spendable amounts.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const accountInfo = await account.getInformation(address, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)\n * @param sender The address of the sender/account to look up\n * @param algod The algod instance\n * @returns The account information\n */\nexport async function getAccountInformation(sender: string | SendTransactionFrom, algod: Algodv2): Promise<AccountInformation> {\n const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(getSenderAddress(sender)).do())\n\n return {\n ...account,\n // None of these can practically overflow 2^53\n amount: Number(account.amount),\n amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),\n minBalance: Number(account.minBalance),\n pendingRewards: Number(account.pendingRewards),\n rewards: Number(account.rewards),\n round: Number(account.round),\n totalAppsOptedIn: Number(account.totalAppsOptedIn),\n totalAssetsOptedIn: Number(account.totalAssetsOptedIn),\n totalCreatedApps: Number(account.totalCreatedApps),\n totalCreatedAssets: Number(account.totalCreatedAssets),\n appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,\n rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,\n totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,\n totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,\n }\n}\n\n/**\n * @deprecated Use `algorand.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.\n *\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345;\n * const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @param algod The algod instance\n * @returns The account asset holding information\n */\nexport async function getAccountAssetInformation(\n sender: string | SendTransactionFrom,\n assetId: number | bigint,\n algod: Algodv2,\n): Promise<AccountAssetInformation> {\n return AlgorandClient.fromClients({ algod }).asset.getAccountInformation(getSenderAddress(sender), BigInt(assetId))\n}\n"],"names":["MultisigAccount","SigningAccount","AccountManager","ClientManager","getSenderAddress","AlgorandClient"],"mappings":";;;;;;;;;AAaA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAEzD;;;;;;;AAOG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAIA,6BAAe,CAAC,cAA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AAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;KACxE,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;AAiBG;AACI,eAAe,0BAA0B,CAC9C,MAAoC,EACpC,OAAwB,EACxB,KAAc,EAAA;IAEd,OAAOC,mCAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAACD,4BAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;AACrH;;;;;;;;;;;;"}
1
+ {"version":3,"file":"account.js","sources":["../../src/account/account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { getSenderAddress } from '../transaction/transaction'\nimport { AccountAssetInformation, MultisigAccount, SigningAccount, TransactionSignerAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { SendTransactionFrom } from '../types/transaction'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\nimport MultisigMetadata = algosdk.MultisigMetadata\nimport TransactionSigner = algosdk.TransactionSigner\nimport AccountInformationModel = algosdk.modelsv2.Account\n\n/**\n * @deprecated Use `algorand.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.\n *\n * Returns an account wrapper that supports partial or full multisig signing.\n * @param multisigParams The parameters that define the multisig account\n * @param signingAccounts The signers that are currently present\n * @returns A multisig account wrapper\n */\nexport function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]) {\n return new MultisigAccount(multisigParams, signingAccounts)\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.\n *\n * Returns an account wrapper that supports a rekeyed account.\n * @param signer The account, with private key loaded, that is signing\n * @param sender The address of the rekeyed account that will act as a sender\n * @returns The SigningAccount wrapper\n */\nexport function rekeyedAccount(signer: Account, sender: string) {\n return new SigningAccount(signer, sender)\n}\n\n/**\n * @deprecated Use `algorand.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead.\n *\n * Returns an account wrapper that supports a transaction signer with associated sender address.\n * @param signer The transaction signer\n * @param sender The address of sender account\n * @returns The SigningAccount wrapper\n */\nexport function transactionSignerAccount(signer: TransactionSigner, sender: string): TransactionSignerAccount {\n return { addr: sender, signer }\n}\n\n/**\n * @deprecated Use `algorand.account.random()` or `algosdk.generateAccount()` instead.\n *\n * Returns a new, random Algorand account with secret key loaded.\n *\n * This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.\n *\n */\nexport function randomAccount(): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.generateAccount()\n}\n\n/**\n * @deprecated Use `algorand.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead.\n *\n * Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n * If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: string: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function mnemonicAccountFromEnvironment(\n account: string | { name: string; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n return (\n await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(\n typeof account === 'string' ? account : account.name,\n typeof account === 'string' ? undefined : account.fundWith,\n )\n ).account\n}\n\n/**\n * @deprecated Use `algosdk.decodeAddress` instead.\n *\n * Returns an account's address as a byte array\n *\n * @param account Either an account (with private key loaded) or the string address of an account\n */\nexport function getAccountAddressAsUint8Array(account: SendTransactionFrom | string) {\n return algosdk.decodeAddress(typeof account === 'string' ? account : getSenderAddress(account)).publicKey\n}\n\n/**\n * @deprecated Use `algosdk.encodeAddress` instead.\n *\n * Returns the string address of an Algorand account from a base64 encoded version of the underlying byte array of the address public key\n *\n * @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key\n */\nexport function getAccountAddressAsString(addressEncodedInB64: string): string {\n return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'))\n}\n\nexport type NumberConverter<T extends AccountInformationModel> = { [key in keyof T]: ToNumberIfExtends<T[key], number | bigint> }\ntype ToNumberIfExtends<K, E> = K extends E ? number : K\n/** @deprecated Account information at a given round. */\nexport type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>\n\n/**\n * @deprecated Use `algorand.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead.\n *\n * Returns the given sender account's current status, balance and spendable amounts.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const accountInfo = await account.getInformation(address, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)\n * @param sender The address of the sender/account to look up\n * @param algod The algod instance\n * @returns The account information\n */\nexport async function getAccountInformation(sender: string | SendTransactionFrom, algod: Algodv2): Promise<AccountInformation> {\n const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(getSenderAddress(sender)).do())\n\n return {\n ...account,\n // None of these can practically overflow 2^53\n amount: Number(account.amount),\n amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),\n minBalance: Number(account.minBalance),\n pendingRewards: Number(account.pendingRewards),\n rewards: Number(account.rewards),\n round: Number(account.round),\n totalAppsOptedIn: Number(account.totalAppsOptedIn),\n totalAssetsOptedIn: Number(account.totalAssetsOptedIn),\n totalCreatedApps: Number(account.totalCreatedApps),\n totalCreatedAssets: Number(account.totalCreatedAssets),\n appsTotalExtraPages: account.appsTotalExtraPages !== undefined ? Number(account.appsTotalExtraPages) : undefined,\n rewardBase: account.rewardBase !== undefined ? Number(account.rewardBase) : undefined,\n totalBoxBytes: account.totalBoxBytes !== undefined ? Number(account.totalBoxBytes) : undefined,\n totalBoxes: account.totalBoxes !== undefined ? Number(account.totalBoxes) : undefined,\n lastHeartbeat: account.lastHeartbeat !== undefined ? Number(account.lastHeartbeat) : undefined,\n lastProposed: account.lastProposed !== undefined ? Number(account.lastProposed) : undefined,\n }\n}\n\n/**\n * @deprecated Use `algorand.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.\n *\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345;\n * const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @param algod The algod instance\n * @returns The account asset holding information\n */\nexport async function getAccountAssetInformation(\n sender: string | SendTransactionFrom,\n assetId: number | bigint,\n algod: Algodv2,\n): Promise<AccountAssetInformation> {\n return AlgorandClient.fromClients({ algod }).asset.getAccountInformation(getSenderAddress(sender), BigInt(assetId))\n}\n"],"names":["MultisigAccount","SigningAccount","AccountManager","ClientManager","getSenderAddress","AlgorandClient"],"mappings":";;;;;;;;;AAaA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO;AAEzD;;;;;;;AAOG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAIA,6BAAe,CAAC,cAAc,EAAE,eAAe,CAAC;AAC7D;AAEA;;;;;;;AAOG;AACa,SAAA,cAAc,CAAC,MAAe,EAAE,MAAc,EAAA;AAC5D,IAAA,OAAO,IAAIC,4BAAc,CAAC,MAAM,EAAE,MAAM,CAAC;AAC3C;AAEA;;;;;;;AAOG;AACa,SAAA,wBAAwB,CAAC,MAAyB,EAAE,MAAc,EAAA;AAChF,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE;AACjC;AAEA;;;;;;;AAOG;SACa,aAAa,GAAA;;AAE3B,IAAA,OAAO,OAAO,CAAC,eAAe,EAAE;AAClC;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACI,eAAe,8BAA8B,CAClD,OAAyD,EACzD,KAAc,EACd,SAAe,EAAA;IAEf,OAAO,CACL,MAAM,IAAIC,mCAAc,CAAC,IAAIC,iCAAa,CAAC,EAAE,KA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ptedIn: Number(account.totalAssetsOptedIn),
138
138
  totalCreatedApps: Number(account.totalCreatedApps),
139
139
  totalCreatedAssets: Number(account.totalCreatedAssets),
140
- appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,
141
- rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,
142
- totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,
143
- totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,
140
+ appsTotalExtraPages: account.appsTotalExtraPages !== undefined ? Number(account.appsTotalExtraPages) : undefined,
141
+ rewardBase: account.rewardBase !== undefined ? Number(account.rewardBase) : undefined,
142
+ totalBoxBytes: account.totalBoxBytes !== undefined ? Number(account.totalBoxBytes) : undefined,
143
+ totalBoxes: account.totalBoxes !== undefined ? Number(account.totalBoxes) : undefined,
144
+ lastHeartbeat: account.lastHeartbeat !== undefined ? Number(account.lastHeartbeat) : undefined,
145
+ lastProposed: account.lastProposed !== undefined ? Number(account.lastProposed) : undefined,
144
146
  };
145
147
  }
146
148
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"account.mjs","sources":["../../src/account/account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { getSenderAddress } from '../transaction/transaction'\nimport { AccountAssetInformation, MultisigAccount, SigningAccount, TransactionSignerAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { SendTransactionFrom } from '../types/transaction'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\nimport MultisigMetadata = algosdk.MultisigMetadata\nimport TransactionSigner = algosdk.TransactionSigner\nimport AccountInformationModel = algosdk.modelsv2.Account\n\n/**\n * @deprecated Use `algorand.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.\n *\n * Returns an account wrapper that supports partial or full multisig signing.\n * @param multisigParams The parameters that define the multisig account\n * @param signingAccounts The signers that are currently present\n * @returns A multisig account wrapper\n */\nexport function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]) {\n return new MultisigAccount(multisigParams, signingAccounts)\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.\n *\n * Returns an account wrapper that supports a rekeyed account.\n * @param signer The account, with private key loaded, that is signing\n * @param sender The address of the rekeyed account that will act as a sender\n * @returns The SigningAccount wrapper\n */\nexport function rekeyedAccount(signer: Account, sender: string) {\n return new SigningAccount(signer, sender)\n}\n\n/**\n * @deprecated Use `algorand.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead.\n *\n * Returns an account wrapper that supports a transaction signer with associated sender address.\n * @param signer The transaction signer\n * @param sender The address of sender account\n * @returns The SigningAccount wrapper\n */\nexport function transactionSignerAccount(signer: TransactionSigner, sender: string): TransactionSignerAccount {\n return { addr: sender, signer }\n}\n\n/**\n * @deprecated Use `algorand.account.random()` or `algosdk.generateAccount()` instead.\n *\n * Returns a new, random Algorand account with secret key loaded.\n *\n * This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.\n *\n */\nexport function randomAccount(): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.generateAccount()\n}\n\n/**\n * @deprecated Use `algorand.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead.\n *\n * Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n * If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: string: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function mnemonicAccountFromEnvironment(\n account: string | { name: string; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n return (\n await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(\n typeof account === 'string' ? account : account.name,\n typeof account === 'string' ? undefined : account.fundWith,\n )\n ).account\n}\n\n/**\n * @deprecated Use `algosdk.decodeAddress` instead.\n *\n * Returns an account's address as a byte array\n *\n * @param account Either an account (with private key loaded) or the string address of an account\n */\nexport function getAccountAddressAsUint8Array(account: SendTransactionFrom | string) {\n return algosdk.decodeAddress(typeof account === 'string' ? account : getSenderAddress(account)).publicKey\n}\n\n/**\n * @deprecated Use `algosdk.encodeAddress` instead.\n *\n * Returns the string address of an Algorand account from a base64 encoded version of the underlying byte array of the address public key\n *\n * @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key\n */\nexport function getAccountAddressAsString(addressEncodedInB64: string): string {\n return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'))\n}\n\nexport type NumberConverter<T extends AccountInformationModel> = { [key in keyof T]: ToNumberIfExtends<T[key], number | bigint> }\ntype ToNumberIfExtends<K, E> = K extends E ? number : K\n/** @deprecated Account information at a given round. */\nexport type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>\n\n/**\n * @deprecated Use `algorand.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead.\n *\n * Returns the given sender account's current status, balance and spendable amounts.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const accountInfo = await account.getInformation(address, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)\n * @param sender The address of the sender/account to look up\n * @param algod The algod instance\n * @returns The account information\n */\nexport async function getAccountInformation(sender: string | SendTransactionFrom, algod: Algodv2): Promise<AccountInformation> {\n const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(getSenderAddress(sender)).do())\n\n return {\n ...account,\n // None of these can practically overflow 2^53\n amount: Number(account.amount),\n amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),\n minBalance: Number(account.minBalance),\n pendingRewards: Number(account.pendingRewards),\n rewards: Number(account.rewards),\n round: Number(account.round),\n totalAppsOptedIn: Number(account.totalAppsOptedIn),\n totalAssetsOptedIn: Number(account.totalAssetsOptedIn),\n totalCreatedApps: Number(account.totalCreatedApps),\n totalCreatedAssets: Number(account.totalCreatedAssets),\n appsTotalExtraPages: account.appsTotalExtraPages ? Number(account.appsTotalExtraPages) : undefined,\n rewardBase: account.rewardBase ? Number(account.rewardBase) : undefined,\n totalBoxBytes: account.totalBoxBytes ? Number(account.totalBoxBytes) : undefined,\n totalBoxes: account.totalBoxes ? Number(account.totalBoxes) : undefined,\n }\n}\n\n/**\n * @deprecated Use `algorand.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.\n *\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345;\n * const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @param algod The algod instance\n * @returns The account asset holding information\n */\nexport async function getAccountAssetInformation(\n sender: string | SendTransactionFrom,\n assetId: number | bigint,\n algod: Algodv2,\n): Promise<AccountAssetInformation> {\n return AlgorandClient.fromClients({ algod }).asset.getAccountInformation(getSenderAddress(sender), BigInt(assetId))\n}\n"],"names":[],"mappings":";;;;;;;AAaA,IAAO,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;AAEzD;;;;;;;AAOG;AACa,SAAA,eAAe,CAAC,cAAgC,EAAE,eAA6C,EAAA;AAC7G,IAAA,OAAO,IAAI,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,cAAc,CAAC,MAAe,EAAE,MAAc,EAAA;AAC5D,IAAA,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;AAOG;AACa,SAAA,wBAAwB,CAAC,MAAyB,EAAE,MAAc,EAAA;AAChF,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAED;;;;;;;AAOG;SACa,aAAa,GAAA;;AAE3B,IAAA,OAAO,OAAO,CAAC,eAAe,EAAE,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CAAC,UAAU,CAAC;AACtC,QAAA,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;AAC9C,QAAA,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;AAChC,QAAA,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;AAC5B,QAAA,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAClD,QAAA,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;AACtD,QAAA,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;AAClD,QAAA,kBAAkB,EAAE,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC;AACtD,QAAA,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,GAAG,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS;AAClG,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;AACvE,QAAA,aAAa,EAAE,OAAO,CAAC,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS;AAChF,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;KACxE,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;AAiBG;AACI,eAAe,0BAA0B,CAC9C,MAAoC,EACpC,OAAwB,EACxB,KAAc,EAAA;IAEd,OAAO,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;AACrH;;;;"}
1
+ {"version":3,"file":"account.mjs","sources":["../../src/account/account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { getSenderAddress } from '../transaction/transaction'\nimport { AccountAssetInformation, MultisigAccount, SigningAccount, TransactionSignerAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgorandClient } from '../types/algorand-client'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { SendTransactionFrom } from '../types/transaction'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\nimport MultisigMetadata = algosdk.MultisigMetadata\nimport TransactionSigner = algosdk.TransactionSigner\nimport AccountInformationModel = algosdk.modelsv2.Account\n\n/**\n * @deprecated Use `algorand.account.multisig(multisigParams, signingAccounts)` or `new MultisigAccount(multisigParams, signingAccounts)` instead.\n *\n * Returns an account wrapper that supports partial or full multisig signing.\n * @param multisigParams The parameters that define the multisig account\n * @param signingAccounts The signers that are currently present\n * @returns A multisig account wrapper\n */\nexport function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]) {\n return new MultisigAccount(multisigParams, signingAccounts)\n}\n\n/**\n * @deprecated Use `algorand.account.rekeyed(sender, account)` or `new SigningAccount(account, sender)` instead.\n *\n * Returns an account wrapper that supports a rekeyed account.\n * @param signer The account, with private key loaded, that is signing\n * @param sender The address of the rekeyed account that will act as a sender\n * @returns The SigningAccount wrapper\n */\nexport function rekeyedAccount(signer: Account, sender: string) {\n return new SigningAccount(signer, sender)\n}\n\n/**\n * @deprecated Use `algorand.account.getSigner(sender)` (after previously registering the signer with `setSigner`) or `{ addr: sender, signer }` instead.\n *\n * Returns an account wrapper that supports a transaction signer with associated sender address.\n * @param signer The transaction signer\n * @param sender The address of sender account\n * @returns The SigningAccount wrapper\n */\nexport function transactionSignerAccount(signer: TransactionSigner, sender: string): TransactionSignerAccount {\n return { addr: sender, signer }\n}\n\n/**\n * @deprecated Use `algorand.account.random()` or `algosdk.generateAccount()` instead.\n *\n * Returns a new, random Algorand account with secret key loaded.\n *\n * This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.\n *\n */\nexport function randomAccount(): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.generateAccount()\n}\n\n/**\n * @deprecated Use `algorand.account.fromEnvironment(name, fundWith)` or `new AccountManager(clientManager).fromEnvironment()` instead.\n *\n * Returns an Algorand account with private key loaded by convention from environment variables based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.MY_ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await mnemonicAccountFromEnvironment('MY_ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `MY_ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n * If not running against LocalNet then it will use proces.env.MY_ACCOUNT_MNEMONIC as the private key and (if present) process.env.MY_ACCOUNT_SENDER as the sender address.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: string: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function mnemonicAccountFromEnvironment(\n account: string | { name: string; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n return (\n await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(\n typeof account === 'string' ? account : account.name,\n typeof account === 'string' ? undefined : account.fundWith,\n )\n ).account\n}\n\n/**\n * @deprecated Use `algosdk.decodeAddress` instead.\n *\n * Returns an account's address as a byte array\n *\n * @param account Either an account (with private key loaded) or the string address of an account\n */\nexport function getAccountAddressAsUint8Array(account: SendTransactionFrom | string) {\n return algosdk.decodeAddress(typeof account === 'string' ? account : getSenderAddress(account)).publicKey\n}\n\n/**\n * @deprecated Use `algosdk.encodeAddress` instead.\n *\n * Returns the string address of an Algorand account from a base64 encoded version of the underlying byte array of the address public key\n *\n * @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key\n */\nexport function getAccountAddressAsString(addressEncodedInB64: string): string {\n return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'))\n}\n\nexport type NumberConverter<T extends AccountInformationModel> = { [key in keyof T]: ToNumberIfExtends<T[key], number | bigint> }\ntype ToNumberIfExtends<K, E> = K extends E ? number : K\n/** @deprecated Account information at a given round. */\nexport type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>\n\n/**\n * @deprecated Use `algorand.account.getInformation(sender)` or `new AccountManager(clientManager).getInformation(sender)` instead.\n *\n * Returns the given sender account's current status, balance and spendable amounts.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const accountInfo = await account.getInformation(address, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddress)\n * @param sender The address of the sender/account to look up\n * @param algod The algod instance\n * @returns The account information\n */\nexport async function getAccountInformation(sender: string | SendTransactionFrom, algod: Algodv2): Promise<AccountInformation> {\n const account = AccountInformationModel.from_obj_for_encoding(await algod.accountInformation(getSenderAddress(sender)).do())\n\n return {\n ...account,\n // None of these can practically overflow 2^53\n amount: Number(account.amount),\n amountWithoutPendingRewards: Number(account.amountWithoutPendingRewards),\n minBalance: Number(account.minBalance),\n pendingRewards: Number(account.pendingRewards),\n rewards: Number(account.rewards),\n round: Number(account.round),\n totalAppsOptedIn: Number(account.totalAppsOptedIn),\n totalAssetsOptedIn: Number(account.totalAssetsOptedIn),\n totalCreatedApps: Number(account.totalCreatedApps),\n totalCreatedAssets: Number(account.totalCreatedAssets),\n appsTotalExtraPages: account.appsTotalExtraPages !== undefined ? Number(account.appsTotalExtraPages) : undefined,\n rewardBase: account.rewardBase !== undefined ? Number(account.rewardBase) : undefined,\n totalBoxBytes: account.totalBoxBytes !== undefined ? Number(account.totalBoxBytes) : undefined,\n totalBoxes: account.totalBoxes !== undefined ? Number(account.totalBoxes) : undefined,\n lastHeartbeat: account.lastHeartbeat !== undefined ? Number(account.lastHeartbeat) : undefined,\n lastProposed: account.lastProposed !== undefined ? Number(account.lastProposed) : undefined,\n }\n}\n\n/**\n * @deprecated Use `algorand.asset.getAccountInformation(sender, assetId)` or `new AssetManager(...).getAccountInformation(sender, assetId)` instead.\n *\n * Returns the given sender account's asset holding for a given asset.\n *\n * @example\n * ```typescript\n * const address = \"XBYLS2E6YI6XXL5BWCAMOA4GTWHXWENZMX5UHXMRNWWUQ7BXCY5WC5TEPA\";\n * const assetId = 123345;\n * const accountInfo = await account.getAccountAssetInformation(address, assetId, algod);\n * ```\n *\n * [Response data schema details](https://developer.algorand.org/docs/rest-apis/algod/#get-v2accountsaddressassetsasset-id)\n * @param sender The address of the sender/account to look up\n * @param assetId The ID of the asset to return a holding for\n * @param algod The algod instance\n * @returns The account asset holding information\n */\nexport async function getAccountAssetInformation(\n sender: string | SendTransactionFrom,\n assetId: number | bigint,\n algod: Algodv2,\n): Promise<AccountAssetInformation> {\n return AlgorandClient.fromClients({ algod }).asset.getAccountInformation(getSenderAddress(sender), BigInt(assetId))\n}\n"],"names":[],"mappings":";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AAK,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS;AAC9F,QAAA,UAAU,EAAE,OAAO,CAAC,UAAU,KAAK,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS;AACrF,QAAA,aAAa,EAAE,OAAO,CAAC,aAAa,KAAK,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS;AAC9F,QAAA,YAAY,EAAE,OAAO,CAAC,YAAY,KAAK,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,SAAS;KAC5F;AACH;AAEA;;;;;;;;;;;;;;;;;AAiBG;AACI,eAAe,0BAA0B,CAC9C,MAAoC,EACpC,OAAwB,EACxB,KAAc,EAAA;IAEd,OAAO,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;AACrH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-account-config-from-environment.js","sources":["../../src/account/get-account-config-from-environment.ts"],"sourcesContent":["import { AccountConfig } from '../types/account'\n\n/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function\n * Returns the Account configuration from environment variables\n *\n * @param accountName account name\n *\n * @example environment variables\n * {accountName}_MNEMONIC\n * {accountName}_SENDER\n *\n */\nexport function getAccountConfigFromEnvironment(accountName: string): AccountConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get account with private key from a non Node.js context; not supported!')\n }\n\n return {\n accountMnemonic: process.env[`${accountName.toUpperCase()}_MNEMONIC`] || '',\n senderAddress: process.env[`${accountName.toUpperCase()}_SENDER`],\n accountName,\n }\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;AASG;AACG,SAAU,+BAA+B,CAAC,WAAmB,EAAA;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAC5B,QAAA,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;KACtG;IAED,OAAO;AACL,QAAA,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,WAAW,CAAC,WAAW,EAAE,CAAW,SAAA,CAAA,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAG,EAAA,WAAW,CAAC,WAAW,EAAE,CAAA,OAAA,CAAS,CAAC;QACjE,WAAW;KACZ,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"get-account-config-from-environment.js","sources":["../../src/account/get-account-config-from-environment.ts"],"sourcesContent":["import { AccountConfig } from '../types/account'\n\n/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function\n * Returns the Account configuration from environment variables\n *\n * @param accountName account name\n *\n * @example environment variables\n * {accountName}_MNEMONIC\n * {accountName}_SENDER\n *\n */\nexport function getAccountConfigFromEnvironment(accountName: string): AccountConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get account with private key from a non Node.js context; not supported!')\n }\n\n return {\n accountMnemonic: process.env[`${accountName.toUpperCase()}_MNEMONIC`] || '',\n senderAddress: process.env[`${accountName.toUpperCase()}_SENDER`],\n accountName,\n }\n}\n"],"names":[],"mappings":";;AAEA;;;;;;;;;AASG;AACG,SAAU,+BAA+B,CAAC,WAAmB,EAAA;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAC5B,QAAA,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC;;IAGvG,OAAO;AACL,QAAA,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,WAAW,CAAC,WAAW,EAAE,CAAW,SAAA,CAAA,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAG,EAAA,WAAW,CAAC,WAAW,EAAE,CAAA,OAAA,CAAS,CAAC;QACjE,WAAW;KACZ;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-account-config-from-environment.mjs","sources":["../../src/account/get-account-config-from-environment.ts"],"sourcesContent":["import { AccountConfig } from '../types/account'\n\n/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function\n * Returns the Account configuration from environment variables\n *\n * @param accountName account name\n *\n * @example environment variables\n * {accountName}_MNEMONIC\n * {accountName}_SENDER\n *\n */\nexport function getAccountConfigFromEnvironment(accountName: string): AccountConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get account with private key from a non Node.js context; not supported!')\n }\n\n return {\n accountMnemonic: process.env[`${accountName.toUpperCase()}_MNEMONIC`] || '',\n senderAddress: process.env[`${accountName.toUpperCase()}_SENDER`],\n accountName,\n }\n}\n"],"names":[],"mappings":"AAEA;;;;;;;;;AASG;AACG,SAAU,+BAA+B,CAAC,WAAmB,EAAA;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAC5B,QAAA,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;KACtG;IAED,OAAO;AACL,QAAA,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,WAAW,CAAC,WAAW,EAAE,CAAW,SAAA,CAAA,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAG,EAAA,WAAW,CAAC,WAAW,EAAE,CAAA,OAAA,CAAS,CAAC;QACjE,WAAW;KACZ,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"get-account-config-from-environment.mjs","sources":["../../src/account/get-account-config-from-environment.ts"],"sourcesContent":["import { AccountConfig } from '../types/account'\n\n/** @deprecated Use algokit.mnemonicAccountFromEnvironment, which doesn't need this function\n * Returns the Account configuration from environment variables\n *\n * @param accountName account name\n *\n * @example environment variables\n * {accountName}_MNEMONIC\n * {accountName}_SENDER\n *\n */\nexport function getAccountConfigFromEnvironment(accountName: string): AccountConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get account with private key from a non Node.js context; not supported!')\n }\n\n return {\n accountMnemonic: process.env[`${accountName.toUpperCase()}_MNEMONIC`] || '',\n senderAddress: process.env[`${accountName.toUpperCase()}_SENDER`],\n accountName,\n }\n}\n"],"names":[],"mappings":"AAEA;;;;;;;;;AASG;AACG,SAAU,+BAA+B,CAAC,WAAmB,EAAA;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAC5B,QAAA,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC;;IAGvG,OAAO;AACL,QAAA,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAA,EAAG,WAAW,CAAC,WAAW,EAAE,CAAW,SAAA,CAAA,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,CAAG,EAAA,WAAW,CAAC,WAAW,EAAE,CAAA,OAAA,CAAS,CAAC;QACjE,WAAW;KACZ;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-account.js","sources":["../../src/account/get-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountConfig, SigningAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { getAccountConfigFromEnvironment } from './get-account-config-from-environment'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n *\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount('ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { config: AccountConfig; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR\n * * `name`: string: The name identifier of the account (deprecated)\n * And optionally\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | { config: AccountConfig; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n let name: string\n let fundWith: AlgoAmount | undefined = undefined\n let config: AccountConfig\n\n if (typeof account === 'string') {\n name = account\n config = getAccountConfigFromEnvironment(name)\n } else if ('name' in account) {\n name = account.name\n config = getAccountConfigFromEnvironment(name)\n fundWith = account.fundWith\n } else if ('config' in account) {\n config = account.config\n name = config.accountName\n fundWith = account.fundWith\n } else {\n throw new Error('Missing name or account config')\n }\n\n return (await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(name, fundWith)).account\n}\n"],"names":["getAccountConfigFromEnvironment","AccountManager","ClientManager"],"mappings":";;;;;;AAyEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACI,eAAe,UAAU,CAC9B,OAA4G,EAC5G,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,IAAI,IAAY,CAAA;IAChB,IAAI,QAAQ,GAA2B,SAAS,CAAA;AAChD,IAAA,IAAI,MAAqB,CAAA;AAEzB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,IAAI,GAAG,OAAO,CAAA;AACd,QAAA,MAAM,GAAGA,+DAA+B,CAAC,IAAI,CAAC,CAAA;KAC/C;AAAM,SAAA,IAAI,MAAM,IAAI,OAAO,EAAE;AAC5B,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,MAAM,GAAGA,+DAA+B,CAAC,IAAI,CAAC,CAAA;AAC9C,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;KAC5B;AAAM,SAAA,IAAI,QAAQ,IAAI,OAAO,EAAE;AAC9B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAA;AACzB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;KAC5B;SAAM;AACL,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;KAClD;IAED,OAAO,CAAC,MAAM,IAAIC,mCAAc,CAAC,IAAIC,iCAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;AACzH;;;;"}
1
+ {"version":3,"file":"get-account.js","sources":["../../src/account/get-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountConfig, SigningAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { getAccountConfigFromEnvironment } from './get-account-config-from-environment'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n *\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount('ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { config: AccountConfig; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR\n * * `name`: string: The name identifier of the account (deprecated)\n * And optionally\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | { config: AccountConfig; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n let name: string\n let fundWith: AlgoAmount | undefined = undefined\n let config: AccountConfig\n\n if (typeof account === 'string') {\n name = account\n config = getAccountConfigFromEnvironment(name)\n } else if ('name' in account) {\n name = account.name\n config = getAccountConfigFromEnvironment(name)\n fundWith = account.fundWith\n } else if ('config' in account) {\n config = account.config\n name = config.accountName\n fundWith = account.fundWith\n } else {\n throw new Error('Missing name or account config')\n }\n\n return (await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(name, fundWith)).account\n}\n"],"names":["getAccountConfigFromEnvironment","AccountManager","ClientManager"],"mappings":";;;;;;AAyEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACI,eAAe,UAAU,CAC9B,OAA4G,EAC5G,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,IAAI,IAAY;IAChB,IAAI,QAAQ,GAA2B,SAAS;AAChD,IAAA,IAAI,MAAqB;AAEzB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,IAAI,GAAG,OAAO;AACd,QAAA,MAAM,GAAGA,+DAA+B,CAAC,IAAI,CAAC;;AACzC,SAAA,IAAI,MAAM,IAAI,OAAO,EAAE;AAC5B,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI;AACnB,QAAA,MAAM,GAAGA,+DAA+B,CAAC,IAAI,CAAC;AAC9C,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ;;AACtB,SAAA,IAAI,QAAQ,IAAI,OAAO,EAAE;AAC9B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM;AACvB,QAAA,IAAI,GAAG,MAAM,CAAC,WAAW;AACzB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ;;SACtB;AACL,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC;;IAGnD,OAAO,CAAC,MAAM,IAAIC,mCAAc,CAAC,IAAIC,iCAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO;AACzH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-account.mjs","sources":["../../src/account/get-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountConfig, SigningAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { getAccountConfigFromEnvironment } from './get-account-config-from-environment'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n *\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount('ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { config: AccountConfig; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR\n * * `name`: string: The name identifier of the account (deprecated)\n * And optionally\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | { config: AccountConfig; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n let name: string\n let fundWith: AlgoAmount | undefined = undefined\n let config: AccountConfig\n\n if (typeof account === 'string') {\n name = account\n config = getAccountConfigFromEnvironment(name)\n } else if ('name' in account) {\n name = account.name\n config = getAccountConfigFromEnvironment(name)\n fundWith = account.fundWith\n } else if ('config' in account) {\n config = account.config\n name = config.accountName\n fundWith = account.fundWith\n } else {\n throw new Error('Missing name or account config')\n }\n\n return (await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(name, fundWith)).account\n}\n"],"names":[],"mappings":";;;;AAyEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACI,eAAe,UAAU,CAC9B,OAA4G,EAC5G,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,IAAI,IAAY,CAAA;IAChB,IAAI,QAAQ,GAA2B,SAAS,CAAA;AAChD,IAAA,IAAI,MAAqB,CAAA;AAEzB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,IAAI,GAAG,OAAO,CAAA;AACd,QAAA,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAA;KAC/C;AAAM,SAAA,IAAI,MAAM,IAAI,OAAO,EAAE;AAC5B,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;AACnB,QAAA,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC,CAAA;AAC9C,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;KAC5B;AAAM,SAAA,IAAI,QAAQ,IAAI,OAAO,EAAE;AAC9B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;AACvB,QAAA,IAAI,GAAG,MAAM,CAAC,WAAW,CAAA;AACzB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;KAC5B;SAAM;AACL,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;KAClD;IAED,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;AACzH;;;;"}
1
+ {"version":3,"file":"get-account.mjs","sources":["../../src/account/get-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountConfig, SigningAccount } from '../types/account'\nimport { AccountManager } from '../types/account-manager'\nimport { AlgoAmount } from '../types/amount'\nimport { ClientManager } from '../types/client-manager'\nimport { getAccountConfigFromEnvironment } from './get-account-config-from-environment'\nimport Account = algosdk.Account\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n *\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount('ACCOUNT', algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `name`: The name identifier of the account\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { config: AccountConfig; fundWith?: AlgoAmount },\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount>\n\n/** @deprecated use `algorand.account.fromEnvironment()` instead\n * Returns an Algorand account with private key loaded by convention based on the given name identifier.\n *\n * Note: This function expects to run in a Node.js environment.\n *\n * ## Convention:\n * * **Non-LocalNet:** will load process.env['\\{NAME\\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it via a secret storage service rather than the file system.\n * If process.env['\\{NAME\\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)\n * * **LocalNet:** will load the account from a KMD wallet called \\{NAME\\} and if that wallet doesn't exist it will create it and fund the account for you\n *\n * This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).\n *\n * @example Default\n *\n * If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:\n * ```typescript\n * const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)\n * ```\n *\n * If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.\n *\n * @param account The details of the account to get, either the name identifier (string) or an object with:\n * * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR\n * * `name`: string: The name identifier of the account (deprecated)\n * And optionally\n * * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account\n * @param algod An algod client\n * @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables\n * @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)\n */\nexport async function getAccount(\n account: { name: string; fundWith?: AlgoAmount } | { config: AccountConfig; fundWith?: AlgoAmount } | string,\n algod: Algodv2,\n kmdClient?: Kmd,\n): Promise<Account | SigningAccount> {\n let name: string\n let fundWith: AlgoAmount | undefined = undefined\n let config: AccountConfig\n\n if (typeof account === 'string') {\n name = account\n config = getAccountConfigFromEnvironment(name)\n } else if ('name' in account) {\n name = account.name\n config = getAccountConfigFromEnvironment(name)\n fundWith = account.fundWith\n } else if ('config' in account) {\n config = account.config\n name = config.accountName\n fundWith = account.fundWith\n } else {\n throw new Error('Missing name or account config')\n }\n\n return (await new AccountManager(new ClientManager({ algod, kmd: kmdClient })).fromEnvironment(name, fundWith)).account\n}\n"],"names":[],"mappings":";;;;AAyEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BG;AACI,eAAe,UAAU,CAC9B,OAA4G,EAC5G,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,IAAI,IAAY;IAChB,IAAI,QAAQ,GAA2B,SAAS;AAChD,IAAA,IAAI,MAAqB;AAEzB,IAAA,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,IAAI,GAAG,OAAO;AACd,QAAA,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC;;AACzC,SAAA,IAAI,MAAM,IAAI,OAAO,EAAE;AAC5B,QAAA,IAAI,GAAG,OAAO,CAAC,IAAI;AACnB,QAAA,MAAM,GAAG,+BAA+B,CAAC,IAAI,CAAC;AAC9C,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ;;AACtB,SAAA,IAAI,QAAQ,IAAI,OAAO,EAAE;AAC9B,QAAA,MAAM,GAAG,OAAO,CAAC,MAAM;AACvB,QAAA,IAAI,GAAG,MAAM,CAAC,WAAW;AACzB,QAAA,QAAQ,GAAG,OAAO,CAAC,QAAQ;;SACtB;AACL,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC;;IAGnD,OAAO,CAAC,MAAM,IAAI,cAAc,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO;AACzH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-dispenser-account.js","sources":["../../src/account/get-dispenser-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountManager } from '../types/account-manager'\nimport { ClientManager } from '../types/client-manager'\n\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead\n *\n * Returns an account (with private key loaded) that can act as a dispenser\n *\n * If running on LocalNet then it will return the default dispenser account automatically,\n * otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC\n *\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables\n */\nexport async function getDispenserAccount(algod: Algodv2, kmd?: Kmd) {\n return new AccountManager(new ClientManager({ algod, kmd })).dispenserFromEnvironment()\n}\n"],"names":["AccountManager","ClientManager"],"mappings":";;;;;AAOA;;;;;;;;;;AAUG;AACI,eAAe,mBAAmB,CAAC,KAAc,EAAE,GAAS,EAAA;AACjE,IAAA,OAAO,IAAIA,mCAAc,CAAC,IAAIC,iCAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAA;AACzF;;;;"}
1
+ {"version":3,"file":"get-dispenser-account.js","sources":["../../src/account/get-dispenser-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountManager } from '../types/account-manager'\nimport { ClientManager } from '../types/client-manager'\n\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead\n *\n * Returns an account (with private key loaded) that can act as a dispenser\n *\n * If running on LocalNet then it will return the default dispenser account automatically,\n * otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC\n *\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables\n */\nexport async function getDispenserAccount(algod: Algodv2, kmd?: Kmd) {\n return new AccountManager(new ClientManager({ algod, kmd })).dispenserFromEnvironment()\n}\n"],"names":["AccountManager","ClientManager"],"mappings":";;;;;AAOA;;;;;;;;;;AAUG;AACI,eAAe,mBAAmB,CAAC,KAAc,EAAE,GAAS,EAAA;AACjE,IAAA,OAAO,IAAIA,mCAAc,CAAC,IAAIC,iCAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,wBAAwB,EAAE;AACzF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-dispenser-account.mjs","sources":["../../src/account/get-dispenser-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountManager } from '../types/account-manager'\nimport { ClientManager } from '../types/client-manager'\n\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead\n *\n * Returns an account (with private key loaded) that can act as a dispenser\n *\n * If running on LocalNet then it will return the default dispenser account automatically,\n * otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC\n *\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables\n */\nexport async function getDispenserAccount(algod: Algodv2, kmd?: Kmd) {\n return new AccountManager(new ClientManager({ algod, kmd })).dispenserFromEnvironment()\n}\n"],"names":[],"mappings":";;;AAOA;;;;;;;;;;AAUG;AACI,eAAe,mBAAmB,CAAC,KAAc,EAAE,GAAS,EAAA;AACjE,IAAA,OAAO,IAAI,cAAc,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,wBAAwB,EAAE,CAAA;AACzF;;;;"}
1
+ {"version":3,"file":"get-dispenser-account.mjs","sources":["../../src/account/get-dispenser-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AccountManager } from '../types/account-manager'\nimport { ClientManager } from '../types/client-manager'\n\nimport Algodv2 = algosdk.Algodv2\nimport Kmd = algosdk.Kmd\n\n/**\n * @deprecated Use `algorand.account.dispenserFromEnvironment()` or `new AccountManager(clientManager).dispenserFromEnvironment()` instead\n *\n * Returns an account (with private key loaded) that can act as a dispenser\n *\n * If running on LocalNet then it will return the default dispenser account automatically,\n * otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC\n *\n * @param algod An algod client\n * @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables\n */\nexport async function getDispenserAccount(algod: Algodv2, kmd?: Kmd) {\n return new AccountManager(new ClientManager({ algod, kmd })).dispenserFromEnvironment()\n}\n"],"names":[],"mappings":";;;AAOA;;;;;;;;;;AAUG;AACI,eAAe,mBAAmB,CAAC,KAAc,EAAE,GAAS,EAAA;AACjE,IAAA,OAAO,IAAI,cAAc,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,wBAAwB,EAAE;AACzF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mnemonic-account.js","sources":["../../src/account/mnemonic-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport Account = algosdk.Account\n\n/**\n * @deprecated Use `algorand.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead.\n *\n * Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.\n *\n * This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.\n *\n * @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.\n */\nexport function mnemonicAccount(mnemonicSecret: string): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.mnemonicToSecretKey(mnemonicSecret)\n}\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;AASG;AACG,SAAU,eAAe,CAAC,cAAsB,EAAA;;AAEpD,IAAA,OAAO,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAA;AACpD;;;;"}
1
+ {"version":3,"file":"mnemonic-account.js","sources":["../../src/account/mnemonic-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport Account = algosdk.Account\n\n/**\n * @deprecated Use `algorand.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead.\n *\n * Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.\n *\n * This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.\n *\n * @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.\n */\nexport function mnemonicAccount(mnemonicSecret: string): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.mnemonicToSecretKey(mnemonicSecret)\n}\n"],"names":[],"mappings":";;;;AAGA;;;;;;;;;AASG;AACG,SAAU,eAAe,CAAC,cAAsB,EAAA;;AAEpD,IAAA,OAAO,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC;AACpD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mnemonic-account.mjs","sources":["../../src/account/mnemonic-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport Account = algosdk.Account\n\n/**\n * @deprecated Use `algorand.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead.\n *\n * Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.\n *\n * This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.\n *\n * @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.\n */\nexport function mnemonicAccount(mnemonicSecret: string): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.mnemonicToSecretKey(mnemonicSecret)\n}\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACG,SAAU,eAAe,CAAC,cAAsB,EAAA;;AAEpD,IAAA,OAAO,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAA;AACpD;;;;"}
1
+ {"version":3,"file":"mnemonic-account.mjs","sources":["../../src/account/mnemonic-account.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport Account = algosdk.Account\n\n/**\n * @deprecated Use `algorand.account.fromMnemonic(mnemonicSecret)` or `algosdk.mnemonicToSecretKey(mnemonicSecret)` instead.\n *\n * Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.\n *\n * This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.\n *\n * @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,\n * never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.\n */\nexport function mnemonicAccount(mnemonicSecret: string): Account {\n // This method is confusingly named, so this function provides a more dev friendly \"wrapper\" name\n return algosdk.mnemonicToSecretKey(mnemonicSecret)\n}\n"],"names":[],"mappings":";;AAGA;;;;;;;;;AASG;AACG,SAAU,eAAe,CAAC,cAAsB,EAAA;;AAEpD,IAAA,OAAO,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC;AACpD;;;;"}
package/amount.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"amount.js","sources":["../src/amount.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgoAmount } from './types/amount'\n\ndeclare global {\n interface Number {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: number): AlgoAmount\n }\n interface BigInt {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: bigint): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: bigint): AlgoAmount\n }\n}\n\nNumber.prototype.microAlgos = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algos = function () {\n return AlgoAmount.Algo(this)\n}\n\nNumber.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\nBigInt.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nBigInt.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algos = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algo = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgos = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgo = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount\n * @param numberOfTransactions The of standard transaction fees to return the amount of Algo\n */\nexport const transactionFees = (numberOfTransactions: number) => {\n return AlgoAmount.MicroAlgo(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE)\n}\n"],"names":["AlgoAm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AI;AACvD,IAAA,OAAOA,uBAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACzC,EAAC;AAED;;AAEG;AACU,MAAA,eAAe,GAAG,CAAC,oBAA4B,KAAI;IAC9D,OAAOA,uBAAU,CAAC,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AACjF;;;;;;;;"}
1
+ {"version":3,"file":"amount.js","sources":["../src/amount.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgoAmount } from './types/amount'\n\ndeclare global {\n interface Number {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: number): AlgoAmount\n }\n interface BigInt {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: bigint): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: bigint): AlgoAmount\n }\n}\n\nNumber.prototype.microAlgos = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algos = function () {\n return AlgoAmount.Algo(this)\n}\n\nNumber.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\nBigInt.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nBigInt.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algos = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algo = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgos = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgo = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount\n * @param numberOfTransactions The of standard transaction fees to return the amount of Algo\n */\nexport const transactionFees = (numberOfTransactions: number) => {\n return AlgoAmount.MicroAlgo(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE)\n}\n"],"names":["AlgoAmount"],"mappings":";;;;;AAkCA,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,YAAA;AAC5B,IAAA,OAAOA,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,YAAA;AACvB,IAAA,OAAOA,uBAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,YAAA;AAC3B,IAAA,OAAOA,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,YAAA;AACtB,IAAA,OAAOA,uBAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,YAAA;AAC3B,IAAA,OAAOA,uBAAU,CAAC,SAAS,CAAC,IAAI,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,YAAA;AACtB,IAAA,OAAOA,uBAAU,CAAC,IAAI,CAAC,IAAI,CAAC;AAC9B,CAAC;AAED;;AAEG;AACU,MAAA,KAAK,GAAG,CAAC,KAAsB,KAAI;AAC9C,IAAA,OAAOA,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC;AAC/B;AAEA;;AAEG;AACU,MAAA,IAAI,GAAG,CAAC,KAAsB,KAAI;AAC7C,IAAA,OAAOA,uBAAU,CAAC,IAAI,CAAC,KAAK,CAAC;AAC/B;AAEA;;AAEG;AACU,MAAA,UAAU,GAAG,CAAC,UAA2B,KAAI;AACxD,IAAA,OAAOA,uBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;AACzC;AAEA;;AAEG;AACU,MAAA,SAAS,GAAG,CAAC,UAA2B,KAAI;AACvD,IAAA,OAAOA,uBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;AACzC;AAEA;;AAEG;AACU,MAAA,eAAe,GAAG,CAAC,oBAA4B,KAAI;IAC9D,OAAOA,uBAAU,CAAC,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACjF;;;;;;;;"}
package/amount.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"amount.mjs","sources":["../src/amount.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgoAmount } from './types/amount'\n\ndeclare global {\n interface Number {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: number): AlgoAmount\n }\n interface BigInt {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: bigint): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: bigint): AlgoAmount\n }\n}\n\nNumber.prototype.microAlgos = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algos = function () {\n return AlgoAmount.Algo(this)\n}\n\nNumber.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\nBigInt.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nBigInt.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algos = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algo = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgos = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgo = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount\n * @param numberOfTransactions The of standard transaction fees to return the amount of Algo\n */\nexport const transactionFees = (numberOfTransactions: number) => {\n return AlgoAmount.MicroAlgo(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE)\n}\n"],"names":[],"mappings":";;;AAkCA,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,YAAA;AAC5B,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG,YAAA;AACvB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,YAAA;AAC3B,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,YAAA;AACtB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG,YAAA;AAC3B,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AACnC,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,IAAI,GAAG,YAAA;AACtB,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC,CAAA;AAED;;AAEG;AACU,MAAA,KAAK,GAAG,CAAC,KAAsB,KAAI;AAC9C,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC/B,EAAC;AAED;;AAEG;AACU,MAAA,IAAI,GAAG,CAAC,KAAsB,KAAI;AAC7C,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC/B,EAAC;AAED;;AAEG;AACU,MAAA,UAAU,GAAG,CAAC,UAA2B,KAAI;AACxD,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACzC,EAAC;AAED;;AAEG;AACU,MAAA,SAAS,GAAG,CAAC,UAA2B,KAAI;AACvD,IAAA,OAAO,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;AACzC,EAAC;AAED;;AAEG;AACU,MAAA,eAAe,GAAG,CAAC,oBAA4B,KAAI;IAC9D,OAAO,UAAU,CAAC,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AACjF;;;;"}
1
+ {"version":3,"file":"amount.mjs","sources":["../src/amount.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgoAmount } from './types/amount'\n\ndeclare global {\n interface Number {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algos(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: number): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: number): AlgoAmount\n }\n interface BigInt {\n /**\n * Returns an `AlgoAmount` using this number of microAlgo.\n */\n microAlgo(this: bigint): AlgoAmount\n /**\n * Returns an `AlgoAmount` using this number of Algo.\n */\n algo(this: bigint): AlgoAmount\n }\n}\n\nNumber.prototype.microAlgos = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algos = function () {\n return AlgoAmount.Algo(this)\n}\n\nNumber.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nNumber.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\nBigInt.prototype.microAlgo = function () {\n return AlgoAmount.MicroAlgo(this)\n}\n\nBigInt.prototype.algo = function () {\n return AlgoAmount.Algo(this)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algos = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of Algo using AlgoAmount\n * @param algos The amount of Algo\n */\nexport const algo = (algos: number | bigint) => {\n return AlgoAmount.Algo(algos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgos = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo using AlgoAmount\n * @param microAlgos The amount of µAlgo\n */\nexport const microAlgo = (microAlgos: number | bigint) => {\n return AlgoAmount.MicroAlgo(microAlgos)\n}\n\n/** Returns an amount of µAlgo to cover standard fees for the given number of transactions using AlgoAmount\n * @param numberOfTransactions The of standard transaction fees to return the amount of Algo\n */\nexport const transactionFees = (numberOfTransactions: number) => {\n return AlgoAmount.MicroAlgo(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE)\n}\n"],"names":[],"mappings":";;;AAkCA,MAAM,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C,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC;AACjF;;;;"}
package/app-client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app-client.js","sources":["../src/app-client.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AppSpecAppDetails, AppSpecAppDetailsByCreatorAndName, AppSpecAppDetailsById, ApplicationClient } from './types/app-client'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or\n * `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n * Create a new ApplicationClient instance\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example Resolve by creator and name\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'creatorAndName',\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {creator},\n * findExistingUsing: indexerClient,\n * },\n * algodClient,\n * )\n *\n * @example Resolve by id:\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'id',\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClient(appDetails: AppSpecAppDetails, algod: Algodv2) {\n return new ApplicationClient(appDetails, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by id\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientById(\n * {\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientById(appDetails: AppSpecAppDetailsById, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'id' }, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by creator and name\n * @param appDetails The details of the app by creator and name\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientByCreatorAndName(\n * {\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {account.addr},\n * findExistingUsing: {indexerClient},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientByCreatorAndName(appDetails: AppSpecAppDetailsByCreatorAndName, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'creatorAndName' }, algod)\n}\n"],"names":["ApplicationClient"],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACa,SAAA,YAAY,CAAC,UAA6B,EAAE,KAAc,EAAA;AACxE,IAAA,OAAO,IAAIA,iCAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;AAqBG;AACa,SAAA,gBAAgB,CAAC,UAAiC,EAAE,KAAc,EAAA;AAChF,IAAA,OAAO,IAAIA,iCAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACa,SAAA,4BAA4B,CAAC,UAA6C,EAAE,KAAc,EAAA;AACxG,IAAA,OAAO,IAAIA,iCAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAA;AACrF;;;;;;"}
1
+ {"version":3,"file":"app-client.js","sources":["../src/app-client.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AppSpecAppDetails, AppSpecAppDetailsByCreatorAndName, AppSpecAppDetailsById, ApplicationClient } from './types/app-client'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or\n * `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n * Create a new ApplicationClient instance\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example Resolve by creator and name\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'creatorAndName',\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {creator},\n * findExistingUsing: indexerClient,\n * },\n * algodClient,\n * )\n *\n * @example Resolve by id:\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'id',\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClient(appDetails: AppSpecAppDetails, algod: Algodv2) {\n return new ApplicationClient(appDetails, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by id\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientById(\n * {\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientById(appDetails: AppSpecAppDetailsById, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'id' }, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by creator and name\n * @param appDetails The details of the app by creator and name\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientByCreatorAndName(\n * {\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {account.addr},\n * findExistingUsing: {indexerClient},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientByCreatorAndName(appDetails: AppSpecAppDetailsByCreatorAndName, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'creatorAndName' }, algod)\n}\n"],"names":["ApplicationClient"],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACa,SAAA,YAAY,CAAC,UAA6B,EAAE,KAAc,EAAA;AACxE,IAAA,OAAO,IAAIA,iCAAiB,CAAC,UAAU,EAAE,KAAK,CAAC;AACjD;AAEA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACa,SAAA,gBAAgB,CAAC,UAAiC,EAAE,KAAc,EAAA;AAChF,IAAA,OAAO,IAAIA,iCAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC;AACzE;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACa,SAAA,4BAA4B,CAAC,UAA6C,EAAE,KAAc,EAAA;AACxG,IAAA,OAAO,IAAIA,iCAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC;AACrF;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"app-client.mjs","sources":["../src/app-client.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AppSpecAppDetails, AppSpecAppDetailsByCreatorAndName, AppSpecAppDetailsById, ApplicationClient } from './types/app-client'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or\n * `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n * Create a new ApplicationClient instance\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example Resolve by creator and name\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'creatorAndName',\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {creator},\n * findExistingUsing: indexerClient,\n * },\n * algodClient,\n * )\n *\n * @example Resolve by id:\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'id',\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClient(appDetails: AppSpecAppDetails, algod: Algodv2) {\n return new ApplicationClient(appDetails, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by id\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientById(\n * {\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientById(appDetails: AppSpecAppDetailsById, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'id' }, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by creator and name\n * @param appDetails The details of the app by creator and name\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientByCreatorAndName(\n * {\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {account.addr},\n * findExistingUsing: {indexerClient},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientByCreatorAndName(appDetails: AppSpecAppDetailsByCreatorAndName, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'creatorAndName' }, algod)\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACa,SAAA,YAAY,CAAC,UAA6B,EAAE,KAAc,EAAA;AACxE,IAAA,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;AAqBG;AACa,SAAA,gBAAgB,CAAC,UAAiC,EAAE,KAAc,EAAA;AAChF,IAAA,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACa,SAAA,4BAA4B,CAAC,UAA6C,EAAE,KAAc,EAAA;AACxG,IAAA,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAA;AACrF;;;;"}
1
+ {"version":3,"file":"app-client.mjs","sources":["../src/app-client.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AppSpecAppDetails, AppSpecAppDetailsByCreatorAndName, AppSpecAppDetailsById, ApplicationClient } from './types/app-client'\nimport Algodv2 = algosdk.Algodv2\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById` or\n * `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n * Create a new ApplicationClient instance\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example Resolve by creator and name\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'creatorAndName',\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {creator},\n * findExistingUsing: indexerClient,\n * },\n * algodClient,\n * )\n *\n * @example Resolve by id:\n * const client = algokit.getAppClient(\n * {\n * resolveBy: 'id',\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClient(appDetails: AppSpecAppDetails, algod: Algodv2) {\n return new ApplicationClient(appDetails, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientById`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by id\n * @param appDetails The details of the app\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientById(\n * {\n * app: {appSpec},\n * sender: {account},\n * id: {id},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientById(appDetails: AppSpecAppDetailsById, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'id' }, algod)\n}\n\n/**\n * @deprecated Use `AppClient` instead e.g. via `algorand.client.getAppClientByCreatorAndName`.\n * If you want to `create` or `deploy` then use `AppFactory` e.g. via `algorand.client.getAppFactory`,\n * which will in turn give you an `AppClient` instance against the created/deployed app to make other calls.\n *\n *\n * Create a new ApplicationClient instance by creator and name\n * @param appDetails The details of the app by creator and name\n * @param algod An algod instance\n *\n * @example\n * const client = algokit.getAppClientByCreatorAndName(\n * {\n * app: {appSpec},\n * sender: {account},\n * creatorAddress: {account.addr},\n * findExistingUsing: {indexerClient},\n * },\n * algodClient,\n * )\n *\n * @returns The application client\n */\nexport function getAppClientByCreatorAndName(appDetails: AppSpecAppDetailsByCreatorAndName, algod: Algodv2) {\n return new ApplicationClient({ ...appDetails, resolveBy: 'creatorAndName' }, algod)\n}\n"],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCG;AACa,SAAA,YAAY,CAAC,UAA6B,EAAE,KAAc,EAAA;AACxE,IAAA,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC;AACjD;AAEA;;;;;;;;;;;;;;;;;;;;;AAqBG;AACa,SAAA,gBAAgB,CAAC,UAAiC,EAAE,KAAc,EAAA;AAChF,IAAA,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC;AACzE;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACa,SAAA,4BAA4B,CAAC,UAA6C,EAAE,KAAc,EAAA;AACxG,IAAA,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC;AACrF;;;;"}
package/app-deploy.js CHANGED
@@ -30,7 +30,7 @@ var types_composer = require('./types/composer.js');
30
30
  */
31
31
  async function deployApp(deployment, algod, indexer) {
32
32
  const appManager = new types_appManager.AppManager(algod);
33
- const newGroup = () => new types_composer.default({
33
+ const newGroup = () => new types_composer.TransactionComposer({
34
34
  algod,
35
35
  getSigner: () => transaction.getSenderTransactionSigner(deployment.from),
36
36
  getSuggestedParams: async () => deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),
@@ -253,15 +253,7 @@ async function performTemplateSubstitutionAndCompile(tealCode, algod, templatePa
253
253
  * @returns The TEAL without comments
254
254
  */
255
255
  function stripTealComments(tealCode) {
256
- // find // outside quotes, i.e. won't pick up "//not a comment"
257
- const regex = /\/\/(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)/;
258
- tealCode = tealCode
259
- .split('\n')
260
- .map((tealCodeLine) => {
261
- return tealCodeLine.split(regex)[0].trim();
262
- })
263
- .join('\n');
264
- return tealCode;
256
+ return types_appManager.AppManager.stripTealComments(tealCode);
265
257
  }
266
258
 
267
259
  exports.deployApp = deployApp;
package/app-deploy.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app-deploy.js","sources":["../src/app-deploy.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { compileTeal, getAppOnCompleteAction } from './app'\nimport { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge'\nimport { getSenderAddress, getSenderTransactionSigner } from './transaction/transaction'\nimport { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender'\nimport {\n ABIReturn,\n APP_DEPLOY_NOTE_DAPP,\n AppCompilationResult,\n AppDeployMetadata,\n AppDeploymentParams,\n AppLookup,\n AppMetadata,\n CompiledTeal,\n TealTemplateParams,\n} from './types/app'\nimport { AppDeployer } from './types/app-deployer'\nimport { AppManager, BoxReference } from './types/app-manager'\nimport { AssetManager } from './types/asset-manager'\nimport AlgoKitComposer, {\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n} from './types/composer'\nimport { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Indexer = algosdk.Indexer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * @deprecated Use `algorand.appDeployer.deploy` instead.\n *\n * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.\n *\n * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param deployment The arguments to control the app deployment\n * @param algod An algod client\n * @param indexer An indexer client, needed if `existingDeployments` not passed in\n * @returns The app reference of the new/existing app\n */\nexport async function deployApp(\n deployment: AppDeploymentParams,\n algod: Algodv2,\n indexer?: Indexer,\n): Promise<\n Partial<AppCompilationResult> &\n (\n | (ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' | 'update' })\n | (ConfirmedTransactionResults &\n AppMetadata & {\n return?: ABIReturn\n deleteReturn?: ABIReturn\n deleteResult: ConfirmedTransactionResult\n operationPerformed: 'replace'\n })\n | (AppMetadata & { operationPerformed: 'nothing' })\n )\n> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new AlgoKitComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(deployment.from),\n getSuggestedParams: async () =>\n deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),\n appManager,\n })\n const deployer = new AppDeployer(\n appManager,\n new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager),\n indexer,\n )\n\n const createParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.createArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.createArgs?.lease,\n rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n extraProgramPages: deployment.schema.extraPages,\n onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.ClearStateOC\n >,\n schema: deployment.schema,\n } satisfies Partial<AppCreateParams>\n\n const updateParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.updateArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.updateArgs?.lease,\n rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n } satisfies Partial<AppUpdateParams>\n\n const deleteParams = {\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.deleteArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.deleteArgs?.lease,\n rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n } satisfies Partial<AppDeleteParams>\n\n const encoder = new TextEncoder()\n\n const result = await deployer.deploy({\n createParams: deployment.createArgs?.method\n ? ({\n ...createParams,\n method:\n 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method),\n args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs,\n } satisfies AppCreateMethodCall)\n : ({\n ...createParams,\n args:\n 'appArgs' in (deployment?.createArgs ?? {})\n ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies AppCreateParams),\n updateParams: deployment.updateArgs?.method\n ? ({\n ...updateParams,\n method:\n 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method),\n args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppUpdateMethodCall, 'appId'>)\n : ({\n ...updateParams,\n args:\n 'appArgs' in (deployment?.updateArgs ?? {})\n ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppUpdateParams, 'appId'>),\n deleteParams: deployment.deleteArgs?.method\n ? ({\n ...deleteParams,\n method:\n 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method),\n args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppDeleteMethodCall, 'appId'>)\n : ({\n ...deleteParams,\n args:\n 'appArgs' in (deployment?.deleteArgs ?? {})\n ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppDeleteParams, 'appId'>),\n metadata: deployment.metadata,\n deployTimeParams: deployment.deployTimeParams,\n onSchemaBreak: deployment.onSchemaBreak,\n onUpdate: deployment.onUpdate,\n existingDeployments: deployment.existingDeployments\n ? {\n creator: deployment.existingDeployments.creator,\n apps: Object.fromEntries(\n Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [\n name,\n { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) },\n ]),\n ),\n }\n : undefined,\n maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,\n populateAppCallResources: deployment.populateAppCallResources,\n suppressLog: deployment.suppressLog,\n })\n\n return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) }\n}\n\n/**\n * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.\n *\n * Returns true is there is a breaking change in the application state schema from before to after.\n * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.\n * Otherwise, there is no error, the app just doesn't store data in the extra schema :(\n *\n * @param before The existing schema\n * @param after The new schema\n * @returns Whether or not there is a breaking change\n */\nexport function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: modelsv2.ApplicationStateSchema) {\n return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint\n}\n\n/**\n * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.\n *\n * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction.\n *\n * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).\n *\n * @param creatorAccount The account (with private key loaded) or string address of an account that is the creator of the apps you want to search for\n * @param indexer An indexer client\n * @returns A name-based lookup of the app information (id, address)\n */\nexport async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup> {\n const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount))\n\n return {\n creator: lookup.creator,\n apps: Object.fromEntries(\n Object.entries(lookup.apps).map(([name, app]) => [\n name,\n { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) },\n ]),\n ),\n }\n}\n\n/**\n * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.\n *\n * Return the transaction note for an app deployment.\n * @param metadata The metadata of the deployment\n * @returns The transaction note as a utf-8 string\n */\nexport function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Arc2TransactionNote {\n return {\n dAppName: APP_DEPLOY_NOTE_DAPP,\n data: metadata,\n format: 'j',\n }\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead\n *\n * Replaces deploy-time deployment control parameters within the given teal code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are not undefined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealCode The TEAL code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n */\nexport function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params)\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateParams` instead\n *\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @returns The TEAL code with replacements\n */\nexport function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) {\n return AppManager.replaceTealTemplateParams(tealCode, templateParams)\n}\n\n/**\n * @deprecated Use `algorand.appManager.compileTealTemplate` instead.\n *\n * Performs template substitution of a teal file and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param algod An algod client\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n */\nexport async function performTemplateSubstitutionAndCompile(\n tealCode: string,\n algod: Algodv2,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: AppDeployMetadata,\n): Promise<CompiledTeal> {\n tealCode = stripTealComments(tealCode)\n\n tealCode = performTemplateSubstitution(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await compileTeal(tealCode, algod)\n}\n\n/**\n * @deprecated Use `AppManager.stripTealComments` instead.\n *\n * Remove comments from TEAL Code\n *\n * @param tealCode The TEAL logic to compile\n * @returns The TEAL without comments\n */\nexport function stripTealComments(tealCode: string) {\n // find // outside quotes, i.e. won't pick up \"//not a comment\"\n const regex = /\\/\\/(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)/\n\n tealCode = tealCode\n .split('\\n')\n .map((tealCodeLine) => {\n return tealCodeLine.split(regex)[0].trim()\n })\n .join('\\n')\n\n return tealCode\n}\n"],"names":["AppManager","AlgoKitComposer","getSenderTransactionSigner","AppDeployer","AlgorandClientTransactionSender","AssetManager","getSenderAddress","_getBoxReference","getAppOnCompleteAction","_getAppArgsForABICall","APP_DEPLOY_NOTE_DAPP","compileTeal"],"mappings":";;;;;;;;;;;;;AAgCA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB,EAAA;AAejB,IAAA,MAAM,UAAU,GAAG,IAAIA,2BAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAIC,sBAAe,CAAC;QAClB,KAAK;QACL,SAAS,EAAE,MAAMC,sCAA0B,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5D,kBAAkB,EAAE,YAClB,UAAU,CAAC,iBAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAC9G,UAAU;AACX,KAAA,CAAC,CAAA;IACJ,MAAM,QAAQ,GAAG,IAAIC,6BAAW,CAC9B,UAAU,EACV,IAAIC,qEAA+B,CAAC,QAAQ,EAAE,IAAIC,+BAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,EAC5F,OAAO,CACR,CAAA;AAED,IAAA,MAAM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DAAsD,CAAA;AAEpE,IAAA,QAAQ,GAAG,QAAQ;SAChB,KAAK,CAAC,IAAI,CAAC;AACX,SAAA,GAAG,CAAC,CAAC,YAAY,KAAI;AACpB,QAAA,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAC5C,KAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AAEb,IAAA,OAAO,QAAQ,CAAA;AACjB;;;;;;;;;;;"}
1
+ {"version":3,"file":"app-deploy.js","sources":["../src/app-deploy.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { compileTeal, getAppOnCompleteAction } from './app'\nimport { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge'\nimport { getSenderAddress, getSenderTransactionSigner } from './transaction/transaction'\nimport { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender'\nimport {\n ABIReturn,\n APP_DEPLOY_NOTE_DAPP,\n AppCompilationResult,\n AppDeployMetadata,\n AppDeploymentParams,\n AppLookup,\n AppMetadata,\n CompiledTeal,\n TealTemplateParams,\n} from './types/app'\nimport { AppDeployer } from './types/app-deployer'\nimport { AppManager, BoxReference } from './types/app-manager'\nimport { AssetManager } from './types/asset-manager'\nimport {\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n TransactionComposer,\n} from './types/composer'\nimport { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Indexer = algosdk.Indexer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * @deprecated Use `algorand.appDeployer.deploy` instead.\n *\n * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.\n *\n * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param deployment The arguments to control the app deployment\n * @param algod An algod client\n * @param indexer An indexer client, needed if `existingDeployments` not passed in\n * @returns The app reference of the new/existing app\n */\nexport async function deployApp(\n deployment: AppDeploymentParams,\n algod: Algodv2,\n indexer?: Indexer,\n): Promise<\n Partial<AppCompilationResult> &\n (\n | (ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' | 'update' })\n | (ConfirmedTransactionResults &\n AppMetadata & {\n return?: ABIReturn\n deleteReturn?: ABIReturn\n deleteResult: ConfirmedTransactionResult\n operationPerformed: 'replace'\n })\n | (AppMetadata & { operationPerformed: 'nothing' })\n )\n> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(deployment.from),\n getSuggestedParams: async () =>\n deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),\n appManager,\n })\n const deployer = new AppDeployer(\n appManager,\n new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager),\n indexer,\n )\n\n const createParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.createArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.createArgs?.lease,\n rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n extraProgramPages: deployment.schema.extraPages,\n onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.ClearStateOC\n >,\n schema: deployment.schema,\n } satisfies Partial<AppCreateParams>\n\n const updateParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.updateArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.updateArgs?.lease,\n rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n } satisfies Partial<AppUpdateParams>\n\n const deleteParams = {\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.deleteArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.deleteArgs?.lease,\n rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n } satisfies Partial<AppDeleteParams>\n\n const encoder = new TextEncoder()\n\n const result = await deployer.deploy({\n createParams: deployment.createArgs?.method\n ? ({\n ...createParams,\n method:\n 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method),\n args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs,\n } satisfies AppCreateMethodCall)\n : ({\n ...createParams,\n args:\n 'appArgs' in (deployment?.createArgs ?? {})\n ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies AppCreateParams),\n updateParams: deployment.updateArgs?.method\n ? ({\n ...updateParams,\n method:\n 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method),\n args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppUpdateMethodCall, 'appId'>)\n : ({\n ...updateParams,\n args:\n 'appArgs' in (deployment?.updateArgs ?? {})\n ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppUpdateParams, 'appId'>),\n deleteParams: deployment.deleteArgs?.method\n ? ({\n ...deleteParams,\n method:\n 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method),\n args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppDeleteMethodCall, 'appId'>)\n : ({\n ...deleteParams,\n args:\n 'appArgs' in (deployment?.deleteArgs ?? {})\n ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppDeleteParams, 'appId'>),\n metadata: deployment.metadata,\n deployTimeParams: deployment.deployTimeParams,\n onSchemaBreak: deployment.onSchemaBreak,\n onUpdate: deployment.onUpdate,\n existingDeployments: deployment.existingDeployments\n ? {\n creator: deployment.existingDeployments.creator,\n apps: Object.fromEntries(\n Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [\n name,\n { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) },\n ]),\n ),\n }\n : undefined,\n maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,\n populateAppCallResources: deployment.populateAppCallResources,\n suppressLog: deployment.suppressLog,\n })\n\n return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) }\n}\n\n/**\n * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.\n *\n * Returns true is there is a breaking change in the application state schema from before to after.\n * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.\n * Otherwise, there is no error, the app just doesn't store data in the extra schema :(\n *\n * @param before The existing schema\n * @param after The new schema\n * @returns Whether or not there is a breaking change\n */\nexport function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: modelsv2.ApplicationStateSchema) {\n return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint\n}\n\n/**\n * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.\n *\n * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction.\n *\n * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).\n *\n * @param creatorAccount The account (with private key loaded) or string address of an account that is the creator of the apps you want to search for\n * @param indexer An indexer client\n * @returns A name-based lookup of the app information (id, address)\n */\nexport async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup> {\n const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount))\n\n return {\n creator: lookup.creator,\n apps: Object.fromEntries(\n Object.entries(lookup.apps).map(([name, app]) => [\n name,\n { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) },\n ]),\n ),\n }\n}\n\n/**\n * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.\n *\n * Return the transaction note for an app deployment.\n * @param metadata The metadata of the deployment\n * @returns The transaction note as a utf-8 string\n */\nexport function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Arc2TransactionNote {\n return {\n dAppName: APP_DEPLOY_NOTE_DAPP,\n data: metadata,\n format: 'j',\n }\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead\n *\n * Replaces deploy-time deployment control parameters within the given teal code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are not undefined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealCode The TEAL code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n */\nexport function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params)\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateParams` instead\n *\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @returns The TEAL code with replacements\n */\nexport function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) {\n return AppManager.replaceTealTemplateParams(tealCode, templateParams)\n}\n\n/**\n * @deprecated Use `algorand.appManager.compileTealTemplate` instead.\n *\n * Performs template substitution of a teal file and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param algod An algod client\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n */\nexport async function performTemplateSubstitutionAndCompile(\n tealCode: string,\n algod: Algodv2,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: AppDeployMetadata,\n): Promise<CompiledTeal> {\n tealCode = stripTealComments(tealCode)\n\n tealCode = performTemplateSubstitution(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await compileTeal(tealCode, algod)\n}\n\n/**\n * @deprecated Use `AppManager.stripTealComments` instead.\n *\n * Remove comments from TEAL Code\n *\n * @param tealCode The TEAL logic to compile\n * @returns The TEAL without comments\n */\nexport function stripTealComments(tealCode: string) {\n return AppManager.stripTealComments(tealCode)\n}\n"],"names":["AppManager","TransactionComposer","getSenderTransactionSigner","AppDeployer","AlgorandClientTransactionSender","AssetManager","getSenderAddress","_getBoxReference","getAppOnCompleteAction","_getAppArgsForABICall","APP_DEPLOY_NOTE_DAPP","compileTeal"],"mappings":";;;;;;;;;;;;;AAiCA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB,EAAA;AAejB,IAAA,MAAM,UAAU,GAAG,IAAIA,2BAAU,CAAC,KAAK,CAAC;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAIC,kCAAmB,CAAC;QACtB,KAAK;QACL,SAAS,EAAE,MAAMC,sCAA0B,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5D,kBAAkB,EAAE,YAClB,UAAU,CAAC,iBAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAC9G,UAAU;AACX,KAAA,CAAC;IACJ,MAAM,QAAQ,GAAG,IAAIC,6BAAW,CAC9B,UAAU,EACV,IAAIC,qEAA+B,CAAC,QAAQ,EAAE,IAAIC,+BAAY,CAAC,KAAK,EAAE,QAAQ,CA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