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

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 (298) hide show
  1. package/README.md +2 -24
  2. package/account/account.d.ts +1 -2
  3. package/account/account.js.map +1 -1
  4. package/account/account.mjs.map +1 -1
  5. package/account/get-account-config-from-environment.d.ts +0 -1
  6. package/account/get-account-config-from-environment.js.map +1 -1
  7. package/account/get-account-config-from-environment.mjs.map +1 -1
  8. package/account/get-account.d.ts +0 -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.d.ts +0 -1
  12. package/account/get-dispenser-account.js.map +1 -1
  13. package/account/get-dispenser-account.mjs.map +1 -1
  14. package/account/index.d.ts +0 -1
  15. package/account/mnemonic-account.d.ts +0 -1
  16. package/account/mnemonic-account.js.map +1 -1
  17. package/account/mnemonic-account.mjs.map +1 -1
  18. package/amount.d.ts +0 -1
  19. package/amount.js.map +1 -1
  20. package/amount.mjs.map +1 -1
  21. package/app-client.d.ts +0 -1
  22. package/app-client.js.map +1 -1
  23. package/app-client.mjs.map +1 -1
  24. package/app-deploy.d.ts +0 -1
  25. package/app-deploy.js.map +1 -1
  26. package/app-deploy.mjs.map +1 -1
  27. package/app.d.ts +0 -1
  28. package/app.js.map +1 -1
  29. package/app.mjs.map +1 -1
  30. package/asset.d.ts +0 -1
  31. package/asset.js.map +1 -1
  32. package/asset.mjs.map +1 -1
  33. package/config.d.ts +0 -1
  34. package/config.js.map +1 -1
  35. package/config.mjs.map +1 -1
  36. package/debugging/debugging.d.ts +3 -5
  37. package/debugging/debugging.js +4 -127
  38. package/debugging/debugging.js.map +1 -1
  39. package/debugging/debugging.mjs +4 -108
  40. package/debugging/debugging.mjs.map +1 -1
  41. package/debugging/index.d.ts +0 -2
  42. package/dispenser-client.d.ts +0 -1
  43. package/dispenser-client.js.map +1 -1
  44. package/dispenser-client.mjs.map +1 -1
  45. package/index.d.ts +1 -1
  46. package/index.js +6 -2
  47. package/index.js.map +1 -1
  48. package/index.mjs +1 -1
  49. package/indexer-lookup.d.ts +0 -1
  50. package/indexer-lookup.js.map +1 -1
  51. package/indexer-lookup.mjs.map +1 -1
  52. package/localnet/get-kmd-wallet-account.d.ts +0 -1
  53. package/localnet/get-kmd-wallet-account.js.map +1 -1
  54. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  55. package/localnet/get-localnet-dispenser-account.d.ts +0 -1
  56. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  57. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  58. package/localnet/get-or-create-kmd-wallet-account.d.ts +0 -1
  59. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  60. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  61. package/localnet/index.d.ts +0 -1
  62. package/localnet/is-localnet.d.ts +0 -1
  63. package/localnet/is-localnet.js.map +1 -1
  64. package/localnet/is-localnet.mjs.map +1 -1
  65. package/network-client.d.ts +0 -1
  66. package/network-client.js.map +1 -1
  67. package/network-client.mjs.map +1 -1
  68. package/package.json +1 -1
  69. package/testing/_asset.d.ts +0 -1
  70. package/testing/account.d.ts +0 -1
  71. package/testing/account.js.map +1 -1
  72. package/testing/account.mjs.map +1 -1
  73. package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
  74. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
  75. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
  76. package/testing/fixtures/algorand-fixture.d.ts +0 -1
  77. package/testing/fixtures/algorand-fixture.js.map +1 -1
  78. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  79. package/testing/fixtures/index.d.ts +0 -1
  80. package/testing/index.d.ts +0 -1
  81. package/testing/indexer.d.ts +0 -1
  82. package/testing/indexer.js.map +1 -1
  83. package/testing/indexer.mjs.map +1 -1
  84. package/testing/test-logger.d.ts +0 -1
  85. package/testing/test-logger.js.map +1 -1
  86. package/testing/test-logger.mjs.map +1 -1
  87. package/testing/transaction-logger.d.ts +0 -1
  88. package/testing/transaction-logger.js.map +1 -1
  89. package/testing/transaction-logger.mjs.map +1 -1
  90. package/transaction/index.d.ts +0 -1
  91. package/transaction/legacy-bridge.d.ts +0 -1
  92. package/transaction/legacy-bridge.js.map +1 -1
  93. package/transaction/legacy-bridge.mjs.map +1 -1
  94. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +0 -1
  95. package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
  96. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
  97. package/transaction/transaction.d.ts +0 -1
  98. package/transaction/transaction.js +9 -20
  99. package/transaction/transaction.js.map +1 -1
  100. package/transaction/transaction.mjs +9 -20
  101. package/transaction/transaction.mjs.map +1 -1
  102. package/transfer/index.d.ts +0 -1
  103. package/transfer/transfer-algos.d.ts +0 -1
  104. package/transfer/transfer-algos.js.map +1 -1
  105. package/transfer/transfer-algos.mjs.map +1 -1
  106. package/transfer/transfer.d.ts +0 -1
  107. package/transfer/transfer.js.map +1 -1
  108. package/transfer/transfer.mjs.map +1 -1
  109. package/types/account-manager.d.ts +0 -1
  110. package/types/account-manager.js.map +1 -1
  111. package/types/account-manager.mjs.map +1 -1
  112. package/types/account.d.ts +0 -1
  113. package/types/account.js.map +1 -1
  114. package/types/account.mjs.map +1 -1
  115. package/types/algo-http-client-with-retry.d.ts +0 -1
  116. package/types/algo-http-client-with-retry.js.map +1 -1
  117. package/types/algo-http-client-with-retry.mjs.map +1 -1
  118. package/types/algorand-client-interface.d.ts +0 -1
  119. package/types/algorand-client-transaction-creator.d.ts +0 -1
  120. package/types/algorand-client-transaction-creator.js.map +1 -1
  121. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  122. package/types/algorand-client-transaction-sender.d.ts +1 -2
  123. package/types/algorand-client-transaction-sender.js +1 -1
  124. package/types/algorand-client-transaction-sender.js.map +1 -1
  125. package/types/algorand-client-transaction-sender.mjs +1 -1
  126. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  127. package/types/algorand-client.d.ts +0 -1
  128. package/types/algorand-client.js.map +1 -1
  129. package/types/algorand-client.mjs.map +1 -1
  130. package/types/amount.d.ts +0 -1
  131. package/types/amount.js.map +1 -1
  132. package/types/amount.mjs.map +1 -1
  133. package/types/app-arc56.d.ts +0 -1
  134. package/types/app-arc56.js.map +1 -1
  135. package/types/app-arc56.mjs.map +1 -1
  136. package/types/app-client.d.ts +4 -2
  137. package/types/app-client.js +9 -17
  138. package/types/app-client.js.map +1 -1
  139. package/types/app-client.mjs +9 -17
  140. package/types/app-client.mjs.map +1 -1
  141. package/types/app-deployer.d.ts +0 -1
  142. package/types/app-deployer.js.map +1 -1
  143. package/types/app-deployer.mjs.map +1 -1
  144. package/types/app-factory.d.ts +0 -1
  145. package/types/app-factory.js.map +1 -1
  146. package/types/app-factory.mjs.map +1 -1
  147. package/types/app-manager.d.ts +0 -1
  148. package/types/app-manager.js.map +1 -1
  149. package/types/app-manager.mjs.map +1 -1
  150. package/types/app-spec.d.ts +0 -1
  151. package/types/app-spec.js.map +1 -1
  152. package/types/app-spec.mjs.map +1 -1
  153. package/types/app.d.ts +0 -1
  154. package/types/app.js.map +1 -1
  155. package/types/app.mjs.map +1 -1
  156. package/types/asset-manager.d.ts +0 -1
  157. package/types/asset-manager.js +1 -1
  158. package/types/asset-manager.js.map +1 -1
  159. package/types/asset-manager.mjs +1 -1
  160. package/types/asset-manager.mjs.map +1 -1
  161. package/types/asset.d.ts +0 -1
  162. package/types/async-event-emitter.d.ts +23 -0
  163. package/types/async-event-emitter.js +55 -0
  164. package/types/async-event-emitter.js.map +1 -0
  165. package/types/async-event-emitter.mjs +53 -0
  166. package/types/async-event-emitter.mjs.map +1 -0
  167. package/types/client-manager.d.ts +0 -1
  168. package/types/client-manager.js.map +1 -1
  169. package/types/client-manager.mjs.map +1 -1
  170. package/types/composer.d.ts +28 -1
  171. package/types/composer.js +6 -7
  172. package/types/composer.js.map +1 -1
  173. package/types/composer.mjs +6 -7
  174. package/types/composer.mjs.map +1 -1
  175. package/types/config.d.ts +3 -6
  176. package/types/config.js +5 -44
  177. package/types/config.js.map +1 -1
  178. package/types/config.mjs +5 -27
  179. package/types/config.mjs.map +1 -1
  180. package/types/debugging.d.ts +29 -102
  181. package/types/debugging.js +16 -109
  182. package/types/debugging.js.map +1 -1
  183. package/types/debugging.mjs +12 -107
  184. package/types/debugging.mjs.map +1 -1
  185. package/types/dispenser-client.d.ts +0 -1
  186. package/types/dispenser-client.js +5 -4
  187. package/types/dispenser-client.js.map +1 -1
  188. package/types/dispenser-client.mjs +5 -4
  189. package/types/dispenser-client.mjs.map +1 -1
  190. package/types/expand.d.ts +0 -1
  191. package/types/indexer.d.ts +0 -1
  192. package/types/indexer.js.map +1 -1
  193. package/types/indexer.mjs.map +1 -1
  194. package/types/kmd-account-manager.d.ts +0 -1
  195. package/types/kmd-account-manager.js +1 -1
  196. package/types/kmd-account-manager.js.map +1 -1
  197. package/types/kmd-account-manager.mjs +1 -1
  198. package/types/kmd-account-manager.mjs.map +1 -1
  199. package/types/logging.d.ts +0 -1
  200. package/types/logging.js.map +1 -1
  201. package/types/logging.mjs.map +1 -1
  202. package/types/logic-error.d.ts +0 -1
  203. package/types/logic-error.js.map +1 -1
  204. package/types/logic-error.mjs.map +1 -1
  205. package/types/network-client.d.ts +0 -1
  206. package/types/network-client.js.map +1 -1
  207. package/types/network-client.mjs.map +1 -1
  208. package/types/testing.d.ts +0 -1
  209. package/types/transaction.d.ts +0 -1
  210. package/types/transfer.d.ts +0 -1
  211. package/types/urlTokenBaseHTTPClient.d.ts +0 -1
  212. package/types/urlTokenBaseHTTPClient.js +1 -1
  213. package/types/urlTokenBaseHTTPClient.js.map +1 -1
  214. package/types/urlTokenBaseHTTPClient.mjs +1 -1
  215. package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
  216. package/util.d.ts +0 -1
  217. package/util.js +0 -9
  218. package/util.js.map +1 -1
  219. package/util.mjs +1 -9
  220. package/util.mjs.map +1 -1
  221. package/account/account.d.ts.map +0 -1
  222. package/account/get-account-config-from-environment.d.ts.map +0 -1
  223. package/account/get-account.d.ts.map +0 -1
  224. package/account/get-dispenser-account.d.ts.map +0 -1
  225. package/account/index.d.ts.map +0 -1
  226. package/account/mnemonic-account.d.ts.map +0 -1
  227. package/amount.d.ts.map +0 -1
  228. package/app-client.d.ts.map +0 -1
  229. package/app-deploy.d.ts.map +0 -1
  230. package/app.d.ts.map +0 -1
  231. package/asset.d.ts.map +0 -1
  232. package/config.d.ts.map +0 -1
  233. package/debugging/debugging.d.ts.map +0 -1
  234. package/debugging/index.d.ts.map +0 -1
  235. package/debugging/simulate-and-persist-response.d.ts +0 -20
  236. package/debugging/simulate-and-persist-response.d.ts.map +0 -1
  237. package/debugging/simulate-and-persist-response.js +0 -108
  238. package/debugging/simulate-and-persist-response.js.map +0 -1
  239. package/debugging/simulate-and-persist-response.mjs +0 -89
  240. package/debugging/simulate-and-persist-response.mjs.map +0 -1
  241. package/dispenser-client.d.ts.map +0 -1
  242. package/index.d.ts.map +0 -1
  243. package/indexer-lookup.d.ts.map +0 -1
  244. package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
  245. package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
  246. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
  247. package/localnet/index.d.ts.map +0 -1
  248. package/localnet/is-localnet.d.ts.map +0 -1
  249. package/network-client.d.ts.map +0 -1
  250. package/testing/_asset.d.ts.map +0 -1
  251. package/testing/account.d.ts.map +0 -1
  252. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  253. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  254. package/testing/fixtures/index.d.ts.map +0 -1
  255. package/testing/index.d.ts.map +0 -1
  256. package/testing/indexer.d.ts.map +0 -1
  257. package/testing/test-logger.d.ts.map +0 -1
  258. package/testing/transaction-logger.d.ts.map +0 -1
  259. package/transaction/index.d.ts.map +0 -1
  260. package/transaction/legacy-bridge.d.ts.map +0 -1
  261. package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
  262. package/transaction/transaction.d.ts.map +0 -1
  263. package/transfer/index.d.ts.map +0 -1
  264. package/transfer/transfer-algos.d.ts.map +0 -1
  265. package/transfer/transfer.d.ts.map +0 -1
  266. package/types/account-manager.d.ts.map +0 -1
  267. package/types/account.d.ts.map +0 -1
  268. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  269. package/types/algorand-client-interface.d.ts.map +0 -1
  270. package/types/algorand-client-transaction-creator.d.ts.map +0 -1
  271. package/types/algorand-client-transaction-sender.d.ts.map +0 -1
  272. package/types/algorand-client.d.ts.map +0 -1
  273. package/types/amount.d.ts.map +0 -1
  274. package/types/app-arc56.d.ts.map +0 -1
  275. package/types/app-client.d.ts.map +0 -1
  276. package/types/app-deployer.d.ts.map +0 -1
  277. package/types/app-factory.d.ts.map +0 -1
  278. package/types/app-manager.d.ts.map +0 -1
  279. package/types/app-spec.d.ts.map +0 -1
  280. package/types/app.d.ts.map +0 -1
  281. package/types/asset-manager.d.ts.map +0 -1
  282. package/types/asset.d.ts.map +0 -1
  283. package/types/client-manager.d.ts.map +0 -1
  284. package/types/composer.d.ts.map +0 -1
  285. package/types/config.d.ts.map +0 -1
  286. package/types/debugging.d.ts.map +0 -1
  287. package/types/dispenser-client.d.ts.map +0 -1
  288. package/types/expand.d.ts.map +0 -1
  289. package/types/indexer.d.ts.map +0 -1
  290. package/types/kmd-account-manager.d.ts.map +0 -1
  291. package/types/logging.d.ts.map +0 -1
  292. package/types/logic-error.d.ts.map +0 -1
  293. package/types/network-client.d.ts.map +0 -1
  294. package/types/testing.d.ts.map +0 -1
  295. package/types/transaction.d.ts.map +0 -1
  296. package/types/transfer.d.ts.map +0 -1
  297. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  298. package/util.d.ts.map +0 -1
@@ -1 +1 @@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KAAK;oBACvD,CAAC,CAAC,CAAC,CAAC;AACJ,oBAAA;AACE,wBAAA,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AACtD,wBAAA,OAAO,EAAE,OAAO;AAChB,wBAAA,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;AACpB,wBAAA,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;AACI,qBAAA;AACvB,iBAAA,CAAC,CACH;AACD,gBAAA,GAAG,EAAE,EAAE;AACR,aAAA;AACD,YAAA,IAAI,EAAE;AACJ,gBAAA,MAAM,EAAE,EAAE;AACV,gBAAA,KAAK,EAAE,EAAE;AACT,gBAAA,GAAG,EAAE,EAAE;AACR,aAAA;AACF,SAAA;QACD,MAAM,EAAE,OAAO,CAAC,MAAM;AACtB,QAAA,WAAW,EAAE;AACX,YAAA,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAsD;AAClF,YAAA,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC;AAC1B,SAAA;AACD,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,gBAAgB,EAAE,SAAS;AAC3B,QAAA,UAAU,EAAE,SAAS;AACrB,QAAA,iBAAiB,EAAE,SAAS;KACL,CAAA;AAC3B;;;;"}
1
+ {"version":3,"file":"app-spec.mjs","sources":["../../src/types/app-spec.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Arc56Contract, Method as Arc56Method, StorageKey, StructFields, getABIEncodedValue } from './app-arc56'\nimport ABIContractParams = algosdk.ABIContractParams\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIMethod = algosdk.ABIMethod\n\nexport function arc32ToArc56(appSpec: AppSpec): Arc56Contract {\n const arc32Structs = Object.values(appSpec.hints).flatMap((hint) => Object.entries(hint.structs ?? {}))\n const structs = Object.fromEntries(\n arc32Structs.map(([_, struct]) => {\n const fields = Object.fromEntries(struct.elements.map((e) => [e[0], e[1]]))\n return [struct.name, fields satisfies StructFields]\n }),\n ) satisfies { [structName: string]: StructFields }\n const hint = (m: ABIMethodParams) => appSpec.hints[new ABIMethod(m).getSignature()] as Hint | undefined\n const actions = (m: ABIMethodParams, type: 'CREATE' | 'CALL') => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain\n return hint(m)?.call_config !== undefined ? callConfigToActions(hint(m)?.call_config!, type) : []\n }\n const bareActions = (type: 'CREATE' | 'CALL') => {\n return callConfigToActions(appSpec.bare_call_config, type)\n }\n const callConfigToActions = (c: CallConfig, type: 'CREATE' | 'CALL') => {\n const actions: ('NoOp' | 'OptIn' | 'CloseOut' | 'ClearState' | 'UpdateApplication' | 'DeleteApplication')[] = []\n if (c.close_out && ['ALL', type].includes(c.close_out)) actions.push('CloseOut')\n if (c.delete_application && ['ALL', type].includes(c.delete_application)) actions.push('DeleteApplication')\n if (c.no_op && ['ALL', type].includes(c.no_op)) actions.push('NoOp')\n if (c.opt_in && ['ALL', type].includes(c.opt_in)) actions.push('OptIn')\n if (c.update_application && ['ALL', type].includes(c.update_application)) actions.push('UpdateApplication')\n return actions\n }\n\n return {\n arcs: [],\n name: appSpec.contract.name,\n desc: appSpec.contract.desc,\n structs: structs,\n methods: appSpec.contract.methods.map(\n (m) =>\n ({\n name: m.name,\n desc: m.desc,\n args: m.args.map((a) => ({\n name: a.name,\n type: a.type,\n desc: a.desc,\n struct: a.name ? hint(m)?.structs?.[a.name]?.name : undefined,\n defaultValue:\n a.name && hint(m)?.default_arguments?.[a.name].source === 'constant'\n ? Buffer.from(getABIEncodedValue(hint(m)!.default_arguments![a.name].data as string | number, a.type, structs)).toString(\n 'base64',\n )\n : undefined,\n })),\n returns: {\n type: m.returns.type,\n desc: m.returns.desc,\n struct: hint(m)?.structs?.output?.name,\n },\n events: [],\n readonly: hint(m)?.read_only,\n actions: {\n create: actions(m, 'CREATE') as Arc56Method['actions']['create'],\n call: actions(m, 'CALL'),\n },\n }) satisfies Arc56Method,\n ),\n state: {\n schema: {\n global: {\n ints: appSpec.state.global.num_uints,\n bytes: appSpec.state.global.num_byte_slices,\n },\n local: {\n ints: appSpec.state.local.num_uints,\n bytes: appSpec.state.local.num_byte_slices,\n },\n },\n keys: {\n global: Object.fromEntries(\n Object.entries(appSpec.schema.global.declared).map((s) => [\n s[0],\n {\n key: Buffer.from(s[1].key, 'utf-8').toString('base64'),\n keyType: 'bytes',\n valueType: s[1].type,\n desc: s[1].descr,\n } satisfies StorageKey,\n ]),\n ),\n local: Object.fromEntries(\n Object.entries(appSpec.schema.local.declared).map((s) => [\n s[0],\n {\n key: Buffer.from(s[1].key, 'utf-8').toString('base64'),\n keyType: 'bytes',\n valueType: s[1].type,\n desc: s[1].descr,\n } satisfies StorageKey,\n ]),\n ),\n box: {},\n },\n maps: {\n global: {},\n local: {},\n box: {},\n },\n },\n source: appSpec.source,\n bareActions: {\n create: bareActions('CREATE') as unknown as Arc56Contract['bareActions']['create'],\n call: bareActions('CALL'),\n },\n byteCode: undefined,\n compilerInfo: undefined,\n events: undefined,\n networks: undefined,\n scratchVariables: undefined,\n sourceInfo: undefined,\n templateVariables: undefined,\n } satisfies Arc56Contract\n}\n\n/** An ARC-0032 Application Specification see https://github.com/algorandfoundation/ARCs/pull/150 */\nexport interface AppSpec {\n /** Method call hints */\n hints: HintSpec\n /** The TEAL source */\n source: AppSources\n /** The ABI-0004 contract definition see https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0004.md */\n contract: ABIContractParams\n /** The values that make up the local and global state */\n schema: SchemaSpec\n /** The rolled-up schema allocation values for local and global state */\n state: StateSchemaSpec\n /** The config of all BARE calls (i.e. non ABI calls with no args) */\n bare_call_config: CallConfig\n}\n\n/** A lookup of encoded method call spec to hint */\nexport type HintSpec = Record<string, Hint>\n\n/** The TEAL source of a contract */\nexport interface AppSources {\n /** The TEAL source of the approval program */\n approval: string\n /** The TEAL source of the clear program */\n clear: string\n}\n\n/** The various call configs:\n * * `NEVER`: Will not be called\n * * `CALL`: Can be called during a non-create call i.e. app id != 0\n * * `CREATE`: Can be called during a create call i.e. app id = 0\n * * `ALL`: Can be during a create OR non-create call\n **/\nexport type CallConfigValue = 'NEVER' | 'CALL' | 'CREATE' | 'ALL'\n\n/** Call configuration for a method */\nexport interface CallConfig {\n /** NoOp call config */\n no_op?: CallConfigValue\n /** Opt-in call config */\n opt_in?: CallConfigValue\n /** Close out call config */\n close_out?: CallConfigValue\n /** Update call config */\n update_application?: CallConfigValue\n /** Delete call config */\n delete_application?: CallConfigValue\n}\n\n/** Hint information for a given method call to allow client generation */\nexport interface Hint {\n /** Any user-defined struct/tuple types used in the method call, keyed by parameter name or `output` for return type */\n structs?: Record<string, Struct>\n read_only?: boolean\n default_arguments?: Record<string, DefaultArgument>\n call_config: CallConfig\n}\n\n/** The name of a field */\nexport type FieldName = string\n\n/** The string name of an ABI type */\nexport type ABIType = string\n\n/** The elements of the struct/tuple: `FieldName`, `ABIType` */\nexport type StructElement = [FieldName, ABIType]\n\n/** A user-defined struct/tuple type */\nexport interface Struct {\n /** The name of the type */\n name: string\n /** The elements (in order) that make up the struct/tuple */\n elements: StructElement[]\n}\n\n/**\n * Defines a strategy for obtaining a default value for a given ABI arg.\n */\nexport type DefaultArgument =\n | {\n /**\n * The default value should be fetched by invoking an ABI method\n */\n source: 'abi-method'\n data: ABIMethodParams\n }\n | {\n /**\n * The default value should be fetched from global state\n */\n source: 'global-state'\n /**\n * The key of the state variable\n */\n data: string\n }\n | {\n /**\n * The default value should be fetched from the local state of the sender user\n */\n source: 'local-state'\n /**\n * The key of the state variable\n */\n data: string\n }\n | {\n /**\n * The default value is a constant.\n */\n source: 'constant'\n /**\n * The static default value to use.\n */\n data: string | number\n }\n\n/** AVM data type */\nexport type AVMType = 'uint64' | 'bytes'\n\n/** Declared schema value specification */\nexport interface DeclaredSchemaValueSpec {\n /** The type of value */\n type: AVMType\n /** The name of the key */\n key: string\n /** A description of the variable */\n descr?: string\n /** Whether or not the value is set statically (at create time only) or dynamically */\n static?: boolean\n}\n\n/** Reserved schema value specification */\nexport interface ReservedSchemaValueSpec {\n /** The type of value */\n type: AVMType\n /** The description of the reserved storage space */\n descr: string\n /** The maximum number of slots to reserve */\n max_keys: number\n}\n\n/** The schema for global and local storage */\nexport interface SchemaSpec {\n /** The local storage schema */\n local: Schema\n /** The global storage schema */\n global: Schema\n}\n\n/** The storage schema definition */\nexport interface Schema {\n /** Declared storage schema */\n declared: Record<string, DeclaredSchemaValueSpec>\n /** Reserved storage schema */\n reserved: Record<string, ReservedSchemaValueSpec>\n}\n\n/** The rolled-up schema allocation specification for local and global state */\nexport interface StateSchemaSpec {\n /** Global storage spec */\n global: StateSchema\n /** Local storage spec */\n local: StateSchema\n}\n\n/** Schema spec summary for global or local storage */\nexport type StateSchema = {\n /** Number of uint slots */\n num_uints: number\n /** Number of byte slots */\n num_byte_slices: number\n}\n"],"names":[],"mappings":";;;AAIA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAE9B,SAAU,YAAY,CAAC,OAAgB,EAAA;AAC3C,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAA;AACvG,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAI;AAC/B,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CA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EAAE;AACX,YAAA,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAsD;AAClF,YAAA,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC;AAC1B,SAAA;AACD,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,YAAY,EAAE,SAAS;AACvB,QAAA,MAAM,EAAE,SAAS;AACjB,QAAA,QAAQ,EAAE,SAAS;AACnB,QAAA,gBAAgB,EAAE,SAAS;AAC3B,QAAA,UAAU,EAAE,SAAS;AACrB,QAAA,iBAAiB,EAAE,SAAS;KACL,CAAA;AAC3B;;;;"}
package/types/app.d.ts CHANGED
@@ -359,4 +359,3 @@ export interface BoxValuesRequestParams {
359
359
  type: ABIType;
360
360
  }
361
361
  export {};
362
- //# sourceMappingURL=app.d.ts.map
package/types/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sources":["../../src/types/app.ts"],"sourcesContent":[null],"names":["OnUpdate","OnSchemaBreak"],"mappings":";;AAsBA;AACO,MAAM,uBAAuB,GAAG,iBAAgB;AAEvD;AACO,MAAM,uBAAuB,GAAG,iBAAgB;AAEvD;AACO,MAAM,oBAAoB,GAAG,mBAAkB;AAEtD;AACO,MAAM,iBAAiB,GAAG,KAAI;AAErC;AACa,MAAA,iBAAiB,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AA2PnE;AACYA,0BASX;AATD,CAAA,UAAY,QAAQ,EAAA;;AAElB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;;AAEJ,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;;AAET,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;;AAEV,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACX,CAAC,EATWA,gBAAQ,KAARA,gBAAQ,GASnB,EAAA,CAAA,CAAA,CAAA;AAED;AACYC,+BAOX;AAPD,CAAA,UAAY,aAAa,EAAA;;AAEvB,IAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;;AAEJ,IAAA,aAAA,CAAA,aAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;;AAEV,IAAA,aAAA,CAAA,aAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACX,CAAC,EAPWA,qBAAa,KAAbA,qBAAa,GAOxB,EAAA,CAAA,CAAA;;;;;;;;"}
1
+ {"version":3,"file":"app.js","sources":["../../src/types/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Expand } from './expand'\nimport {\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n SendTransactionResults,\n TransactionNote,\n TransactionToSign,\n} from './transaction'\nimport ABIArgument = algosdk.ABIArgument\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIType = algosdk.ABIType\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport OnApplicationComplete = algosdk.OnApplicationComplete\nimport SourceMap = algosdk.SourceMap\nimport SuggestedParams = algosdk.SuggestedParams\nimport Transaction = algosdk.Transaction\n\n/** The name of the TEAL template variable for deploy-time immutability control */\nexport const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE'\n\n/** The name of the TEAL template variable for deploy-time permanence control */\nexport const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE'\n\n/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */\nexport const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER'\n\n/** The maximum number of bytes in a single app code page */\nexport const APP_PAGE_MAX_SIZE = 2048\n\n/** First 4 bytes of SHA-512/256 hash of \"return\" for retrieving ABI return values */\nexport const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117])\n\n/** Information about an Algorand app */\nexport interface AppReference {\n /** The id of the app */\n appId: number | bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxReference` instead.\n *\n * A grouping of the app ID and name of the box in an Uint8Array\n */\nexport interface BoxReference {\n /**\n * A unique application id\n */\n appId: number | bigint\n /**\n * Name of box to reference\n */\n name: BoxIdentifier\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxIdentifier` instead.\n *\n * Something that identifies a box name - either a:\n * * `Uint8Array`\n * * `string` (that will be encoded to a Uint8Array)\n * * `SendTransactionFrom` (encoded into the public key address of the corresponding account)\n */\nexport type BoxIdentifier = string | Uint8Array | SendTransactionFrom\n\n/** Common app call arguments for ABI and non-ABI (raw) calls */\nexport interface CoreAppCallArgs {\n /** The optional lease for the transaction */\n lease?: string | Uint8Array\n /** Any box references to load */\n boxes?: (algosdk.BoxReference | BoxReference | BoxIdentifier)[]\n /** The address of any accounts to load in */\n accounts?: (string | Address)[]\n /** IDs of any apps to load into the foreignApps array */\n apps?: number[]\n /** IDs of any assets to load into the foreignAssets array */\n assets?: number[]\n /** Optional account / account address that should be authorised to transact on behalf of the from account the app call is sent from after this transaction.\n *\n * **Note:** Use with extreme caution and review the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/) first.\n */\n rekeyTo?: SendTransactionFrom | string\n}\n\n/**\n * App call args with non-ABI (raw) values (minus some processing like encoding strings as binary)\n */\nexport interface RawAppCallArgs extends CoreAppCallArgs {\n /** Any application arguments to pass through */\n appArgs?: (Uint8Array | string)[]\n /** Property to aid intellisense */\n method?: undefined\n}\n\n/** An argument for an ABI method, either a primitive value, or a transaction with or without signer, or the unawaited async return value of an algokit method that returns a `SendTransactionResult` */\nexport type ABIAppCallArg =\n | ABIArgument\n | TransactionToSign\n | Transaction\n | Promise<SendTransactionResult>\n | SendTransactionResult\n | undefined\n\n/**\n * App call args for an ABI call\n */\nexport type ABIAppCallArgs = CoreAppCallArgs & {\n /** The ABI method to call */\n method: ABIMethodParams | ABIMethod\n /** The ABI method args to pass in */\n methodArgs: ABIAppCallArg[]\n}\n\n/** Arguments to pass to an app call either:\n * * The raw app call values to pass through into the transaction (after processing); or\n * * An ABI method definition (method and args)\n **/\nexport type AppCallArgs = RawAppCallArgs | ABIAppCallArgs\n\n/**\n * @deprecated Use `AlgoKitComposer` to construct create app transactions instead.\n *\n * Base interface for common data passed to an app create or update.\n */\ninterface CreateOrUpdateAppParams extends SendTransactionParams {\n /** The account (with private key loaded) that will send the transaction */\n from: SendTransactionFrom\n /** The approval program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */\n approvalProgram: Uint8Array | string\n /** The clear state program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */\n clearStateProgram: Uint8Array | string\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` to construct create app transactions instead.\n *\n * Parameters that are passed in when creating an app. */\nexport interface CreateAppParams extends CreateOrUpdateAppParams {\n /** The storage schema to request for the created app */\n schema: AppStorageSchema\n /** Override the on-completion action for the create call; defaults to NoOp */\n onCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` to construct update app transactions instead.\n *\n * Parameters that are passed in when updating an app. */\nexport interface UpdateAppParams extends CreateOrUpdateAppParams {\n /** The id of the app to update */\n appId: number | bigint\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * The type of call / [on-completion action](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#the-lifecycle-of-a-smart-contract) for a smart contract call.\n *\n * Equivalent of `algosdk.OnApplicationComplete`, but as a more convenient string enum.\n *\n * * `no_op`: Normal smart contract call, no special on-complete action\n * * `opt_in`: Opt-in to smart contract local storage\n * * `close_out`: Close-out local storage storage\n * * `clear_state`: Clear local storage state\n * * `update_application`: Update the smart contract\n * * `delete_application`: Delete the smart contract\n */\nexport type AppCallType = 'no_op' | 'opt_in' | 'close_out' | 'clear_state' | 'update_application' | 'delete_application'\n\n/** Parameters representing a call to an app. */\nexport interface AppCallParams extends SendTransactionParams {\n /** The id of the app to call */\n appId: number | bigint\n /** The type of call, everything except create (see `createApp`) and update (see `updateApp`) */\n callType: Exclude<AppCallType, 'update_application'> | Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplicationOC>\n /** The account to make the call from */\n from: SendTransactionFrom\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/** Parameters representing the storage schema of an app. */\nexport interface AppStorageSchema {\n /** Restricts number of ints in per-user local state */\n localInts: number\n /** Restricts number of byte slices in per-user local state */\n localByteSlices: number\n /** Restricts number of ints in global state */\n globalInts: number\n /** Restricts number of byte slices in global state */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */\n extraPages?: number\n}\n\n/** Information about a compiled teal program */\nexport interface CompiledTeal {\n /** Original TEAL code */\n teal: string\n /** The compiled code */\n compiled: string\n /** The has returned by the compiler */\n compiledHash: string\n /** The base64 encoded code as a byte array */\n compiledBase64ToBytes: Uint8Array\n /** Source map from the compilation */\n sourceMap: SourceMap\n}\n\nexport interface AppCallTransactionResultOfType<T> extends SendTransactionResults, SendTransactionResult {\n /** If an ABI method was called the processed return value */\n return?: T\n}\n\n/** Result from calling an app */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AppCallTransactionResult extends AppCallTransactionResultOfType<ABIReturn> {}\n\n/** The return value of an ABI method call */\nexport type ABIReturn =\n | {\n rawReturnValue: Uint8Array\n returnValue: ABIValue\n decodeError: undefined\n }\n | { rawReturnValue: undefined; returnValue: undefined; decodeError: Error }\n\n/**\n * The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with `APP_DEPLOY_NOTE_PREFIX`.\n */\nexport interface AppDeployMetadata {\n /** The unique name identifier of the app within the creator account */\n name: string\n /** The version of app that is / will be deployed */\n version: string\n /** Whether or not the app is deletable / permanent / unspecified */\n deletable?: boolean\n /** Whether or not the app is updatable / immutable / unspecified */\n updatable?: boolean\n}\n\n/** The metadata that can be collected about a deployed app */\nexport interface AppMetadata extends AppReference, AppDeployMetadata {\n /** The round the app was created */\n createdRound: number\n /** The last round that the app was updated */\n updatedRound: number\n /** The metadata when the app was created */\n createdMetadata: AppDeployMetadata\n /** Whether or not the app is deleted */\n deleted: boolean\n}\n\n/** A lookup of name -> Algorand app for a creator */\nexport interface AppLookup {\n creator: Readonly<string>\n apps: Readonly<{\n [name: string]: AppMetadata\n }>\n}\n\n/** Dictionary of deploy-time parameters to replace in a teal template.\n *\n * Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.\n *\n */\nexport interface TealTemplateParams {\n [key: string]: string | bigint | number | Uint8Array\n}\n\n/** What action to perform when deploying an app and an update is detected in the TEAL code */\nexport enum OnUpdate {\n /** Fail the deployment */\n Fail,\n /** Update the app */\n UpdateApp,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** What action to perform when deploying an app and a breaking schema change is detected */\nexport enum OnSchemaBreak {\n /** Fail the deployment */\n Fail,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** The parameters to deploy an app */\nexport interface AppDeploymentParams\n extends Omit<CreateAppParams, 'onCompleteAction' | 'args' | 'note' | 'skipSending' | 'skipWaiting' | 'atc'> {\n /** The deployment metadata */\n metadata: AppDeployMetadata\n /** Any deploy-time parameters to replace in the TEAL code */\n deployTimeParams?: TealTemplateParams\n /** What action to perform if a schema break is detected */\n onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak\n /** What action to perform if a TEAL update is detected */\n onUpdate?: 'update' | 'replace' | 'fail' | 'append' | OnUpdate\n /** Optional cached value of the existing apps for the given creator */\n existingDeployments?: AppLookup\n /** Any args to pass to any create transaction that is issued as part of deployment */\n createArgs?: AppCallArgs\n /** Override the on-completion action for the create call; defaults to NoOp */\n createOnCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>\n /** Any args to pass to any update transaction that is issued as part of deployment */\n updateArgs?: AppCallArgs\n /** Any args to pass to any delete transaction that is issued as part of deployment */\n deleteArgs?: AppCallArgs\n}\n\n/** The result of compiling the approval and clear state TEAL programs for an app */\nexport interface AppCompilationResult {\n /** The compilation result of approval */\n compiledApproval: CompiledTeal\n /** The compilation result of clear */\n compiledClear: CompiledTeal\n}\n\nexport type AppReturn<TReturn> = {\n /** The ABI method call return value */\n return?: TReturn\n}\n\n/** Result from sending a single app transaction. */\nexport type SendAppTransactionResult = Expand<\n SendSingleTransactionResult & {\n /** If an ABI method was called the processed return value */\n return?: ABIReturn\n }\n>\n\n/** Result from sending a single app transaction. */\nexport type SendAppUpdateTransactionResult = Expand<SendAppTransactionResult & Partial<AppCompilationResult>>\n\n/** Result from sending a single app transaction. */\nexport type SendAppCreateTransactionResult = Expand<\n SendAppUpdateTransactionResult & {\n /** The id of the created app */\n appId: bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n }\n>\n\n/** Object holding app state values */\nexport interface AppState {\n [key: string]:\n | {\n value: bigint\n keyRaw: Uint8Array\n keyBase64: string\n }\n | {\n value: string\n valueRaw: Uint8Array\n valueBase64: string\n keyRaw: Uint8Array\n keyBase64: string\n }\n}\n\n/**\n * The name of a box storage box */\nexport interface BoxName {\n /** Name in UTF-8 */\n name: string\n /** Name in binary bytes */\n nameRaw: Uint8Array\n /** Name in Base64 */\n nameBase64: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValueRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: number | bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: string | Uint8Array | BoxName\n /** The ABI type to decode the value using */\n type: ABIType\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: number\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: (string | Uint8Array | BoxName)[]\n /** The ABI type to decode the value using */\n type: ABIType\n}\n"],"names":["OnUpdate","OnSchemaBreak"],"mappings":";;AAsBA;AACO,MAAM,uBAAuB,GAAG,iBAAgB;AAEvD;AACO,MAAM,uBAAuB,GAAG,iBAAgB;AAEvD;AACO,MAAM,oBAAoB,GAAG,mBAAkB;AAEtD;AACO,MAAM,iBAAiB,GAAG,KAAI;AAErC;AACa,MAAA,iBAAiB,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AA2PnE;AACYA,0BASX;AATD,CAAA,UAAY,QAAQ,EAAA;;AAElB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;;AAEJ,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;;AAET,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;;AAEV,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACX,CAAC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AAR,QAAQ,GASnB,EAAA,CAAA,CAAA,CAAA;AAED;IACY,cAOX;AAPD,CAAA,UAAY,aAAa,EAAA;;AAEvB,IAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;;AAEJ,IAAA,aAAA,CAAA,aAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;;AAEV,IAAA,aAAA,CAAA,aAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACX,CAAC,EAPW,aAAa,KAAb,aAAa,GAOxB,EAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"app.mjs","sources":["../../src/types/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Expand } from './expand'\nimport {\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n SendTransactionResults,\n TransactionNote,\n TransactionToSign,\n} from './transaction'\nimport ABIArgument = algosdk.ABIArgument\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIType = algosdk.ABIType\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport OnApplicationComplete = algosdk.OnApplicationComplete\nimport SourceMap = algosdk.SourceMap\nimport SuggestedParams = algosdk.SuggestedParams\nimport Transaction = algosdk.Transaction\n\n/** The name of the TEAL template variable for deploy-time immutability control */\nexport const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE'\n\n/** The name of the TEAL template variable for deploy-time permanence control */\nexport const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE'\n\n/** The app create/update [ARC-2](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0002.md) transaction note prefix */\nexport const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER'\n\n/** The maximum number of bytes in a single app code page */\nexport const APP_PAGE_MAX_SIZE = 2048\n\n/** First 4 bytes of SHA-512/256 hash of \"return\" for retrieving ABI return values */\nexport const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117])\n\n/** Information about an Algorand app */\nexport interface AppReference {\n /** The id of the app */\n appId: number | bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxReference` instead.\n *\n * A grouping of the app ID and name of the box in an Uint8Array\n */\nexport interface BoxReference {\n /**\n * A unique application id\n */\n appId: number | bigint\n /**\n * Name of box to reference\n */\n name: BoxIdentifier\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxIdentifier` instead.\n *\n * Something that identifies a box name - either a:\n * * `Uint8Array`\n * * `string` (that will be encoded to a Uint8Array)\n * * `SendTransactionFrom` (encoded into the public key address of the corresponding account)\n */\nexport type BoxIdentifier = string | Uint8Array | SendTransactionFrom\n\n/** Common app call arguments for ABI and non-ABI (raw) calls */\nexport interface CoreAppCallArgs {\n /** The optional lease for the transaction */\n lease?: string | Uint8Array\n /** Any box references to load */\n boxes?: (algosdk.BoxReference | BoxReference | BoxIdentifier)[]\n /** The address of any accounts to load in */\n accounts?: (string | Address)[]\n /** IDs of any apps to load into the foreignApps array */\n apps?: number[]\n /** IDs of any assets to load into the foreignAssets array */\n assets?: number[]\n /** Optional account / account address that should be authorised to transact on behalf of the from account the app call is sent from after this transaction.\n *\n * **Note:** Use with extreme caution and review the [official rekey guidance](https://developer.algorand.org/docs/get-details/accounts/rekey/) first.\n */\n rekeyTo?: SendTransactionFrom | string\n}\n\n/**\n * App call args with non-ABI (raw) values (minus some processing like encoding strings as binary)\n */\nexport interface RawAppCallArgs extends CoreAppCallArgs {\n /** Any application arguments to pass through */\n appArgs?: (Uint8Array | string)[]\n /** Property to aid intellisense */\n method?: undefined\n}\n\n/** An argument for an ABI method, either a primitive value, or a transaction with or without signer, or the unawaited async return value of an algokit method that returns a `SendTransactionResult` */\nexport type ABIAppCallArg =\n | ABIArgument\n | TransactionToSign\n | Transaction\n | Promise<SendTransactionResult>\n | SendTransactionResult\n | undefined\n\n/**\n * App call args for an ABI call\n */\nexport type ABIAppCallArgs = CoreAppCallArgs & {\n /** The ABI method to call */\n method: ABIMethodParams | ABIMethod\n /** The ABI method args to pass in */\n methodArgs: ABIAppCallArg[]\n}\n\n/** Arguments to pass to an app call either:\n * * The raw app call values to pass through into the transaction (after processing); or\n * * An ABI method definition (method and args)\n **/\nexport type AppCallArgs = RawAppCallArgs | ABIAppCallArgs\n\n/**\n * @deprecated Use `AlgoKitComposer` to construct create app transactions instead.\n *\n * Base interface for common data passed to an app create or update.\n */\ninterface CreateOrUpdateAppParams extends SendTransactionParams {\n /** The account (with private key loaded) that will send the transaction */\n from: SendTransactionFrom\n /** The approval program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */\n approvalProgram: Uint8Array | string\n /** The clear state program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */\n clearStateProgram: Uint8Array | string\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` to construct create app transactions instead.\n *\n * Parameters that are passed in when creating an app. */\nexport interface CreateAppParams extends CreateOrUpdateAppParams {\n /** The storage schema to request for the created app */\n schema: AppStorageSchema\n /** Override the on-completion action for the create call; defaults to NoOp */\n onCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` to construct update app transactions instead.\n *\n * Parameters that are passed in when updating an app. */\nexport interface UpdateAppParams extends CreateOrUpdateAppParams {\n /** The id of the app to update */\n appId: number | bigint\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * The type of call / [on-completion action](https://developer.algorand.org/docs/get-details/dapps/smart-contracts/apps/#the-lifecycle-of-a-smart-contract) for a smart contract call.\n *\n * Equivalent of `algosdk.OnApplicationComplete`, but as a more convenient string enum.\n *\n * * `no_op`: Normal smart contract call, no special on-complete action\n * * `opt_in`: Opt-in to smart contract local storage\n * * `close_out`: Close-out local storage storage\n * * `clear_state`: Clear local storage state\n * * `update_application`: Update the smart contract\n * * `delete_application`: Delete the smart contract\n */\nexport type AppCallType = 'no_op' | 'opt_in' | 'close_out' | 'clear_state' | 'update_application' | 'delete_application'\n\n/** Parameters representing a call to an app. */\nexport interface AppCallParams extends SendTransactionParams {\n /** The id of the app to call */\n appId: number | bigint\n /** The type of call, everything except create (see `createApp`) and update (see `updateApp`) */\n callType: Exclude<AppCallType, 'update_application'> | Exclude<OnApplicationComplete, OnApplicationComplete.UpdateApplicationOC>\n /** The account to make the call from */\n from: SendTransactionFrom\n /** Optional transaction parameters */\n transactionParams?: SuggestedParams\n /** The (optional) transaction note */\n note?: TransactionNote\n /** The arguments passed in to the app call */\n args?: AppCallArgs\n}\n\n/** Parameters representing the storage schema of an app. */\nexport interface AppStorageSchema {\n /** Restricts number of ints in per-user local state */\n localInts: number\n /** Restricts number of byte slices in per-user local state */\n localByteSlices: number\n /** Restricts number of ints in global state */\n globalInts: number\n /** Restricts number of byte slices in global state */\n globalByteSlices: number\n /** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */\n extraPages?: number\n}\n\n/** Information about a compiled teal program */\nexport interface CompiledTeal {\n /** Original TEAL code */\n teal: string\n /** The compiled code */\n compiled: string\n /** The has returned by the compiler */\n compiledHash: string\n /** The base64 encoded code as a byte array */\n compiledBase64ToBytes: Uint8Array\n /** Source map from the compilation */\n sourceMap: SourceMap\n}\n\nexport interface AppCallTransactionResultOfType<T> extends SendTransactionResults, SendTransactionResult {\n /** If an ABI method was called the processed return value */\n return?: T\n}\n\n/** Result from calling an app */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface AppCallTransactionResult extends AppCallTransactionResultOfType<ABIReturn> {}\n\n/** The return value of an ABI method call */\nexport type ABIReturn =\n | {\n rawReturnValue: Uint8Array\n returnValue: ABIValue\n decodeError: undefined\n }\n | { rawReturnValue: undefined; returnValue: undefined; decodeError: Error }\n\n/**\n * The payload of the metadata to add to the transaction note when deploying an app, noting it will be prefixed with `APP_DEPLOY_NOTE_PREFIX`.\n */\nexport interface AppDeployMetadata {\n /** The unique name identifier of the app within the creator account */\n name: string\n /** The version of app that is / will be deployed */\n version: string\n /** Whether or not the app is deletable / permanent / unspecified */\n deletable?: boolean\n /** Whether or not the app is updatable / immutable / unspecified */\n updatable?: boolean\n}\n\n/** The metadata that can be collected about a deployed app */\nexport interface AppMetadata extends AppReference, AppDeployMetadata {\n /** The round the app was created */\n createdRound: number\n /** The last round that the app was updated */\n updatedRound: number\n /** The metadata when the app was created */\n createdMetadata: AppDeployMetadata\n /** Whether or not the app is deleted */\n deleted: boolean\n}\n\n/** A lookup of name -> Algorand app for a creator */\nexport interface AppLookup {\n creator: Readonly<string>\n apps: Readonly<{\n [name: string]: AppMetadata\n }>\n}\n\n/** Dictionary of deploy-time parameters to replace in a teal template.\n *\n * Note: Looks for `TMPL_{parameter}` for template replacements i.e. you can leave out the `TMPL_`.\n *\n */\nexport interface TealTemplateParams {\n [key: string]: string | bigint | number | Uint8Array\n}\n\n/** What action to perform when deploying an app and an update is detected in the TEAL code */\nexport enum OnUpdate {\n /** Fail the deployment */\n Fail,\n /** Update the app */\n UpdateApp,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** What action to perform when deploying an app and a breaking schema change is detected */\nexport enum OnSchemaBreak {\n /** Fail the deployment */\n Fail,\n /** Delete the app and create a new one in its place */\n ReplaceApp,\n /** Create a new app */\n AppendApp,\n}\n\n/** The parameters to deploy an app */\nexport interface AppDeploymentParams\n extends Omit<CreateAppParams, 'onCompleteAction' | 'args' | 'note' | 'skipSending' | 'skipWaiting' | 'atc'> {\n /** The deployment metadata */\n metadata: AppDeployMetadata\n /** Any deploy-time parameters to replace in the TEAL code */\n deployTimeParams?: TealTemplateParams\n /** What action to perform if a schema break is detected */\n onSchemaBreak?: 'replace' | 'fail' | 'append' | OnSchemaBreak\n /** What action to perform if a TEAL update is detected */\n onUpdate?: 'update' | 'replace' | 'fail' | 'append' | OnUpdate\n /** Optional cached value of the existing apps for the given creator */\n existingDeployments?: AppLookup\n /** Any args to pass to any create transaction that is issued as part of deployment */\n createArgs?: AppCallArgs\n /** Override the on-completion action for the create call; defaults to NoOp */\n createOnCompleteAction?: Exclude<AppCallType, 'clear_state'> | Exclude<OnApplicationComplete, OnApplicationComplete.ClearStateOC>\n /** Any args to pass to any update transaction that is issued as part of deployment */\n updateArgs?: AppCallArgs\n /** Any args to pass to any delete transaction that is issued as part of deployment */\n deleteArgs?: AppCallArgs\n}\n\n/** The result of compiling the approval and clear state TEAL programs for an app */\nexport interface AppCompilationResult {\n /** The compilation result of approval */\n compiledApproval: CompiledTeal\n /** The compilation result of clear */\n compiledClear: CompiledTeal\n}\n\nexport type AppReturn<TReturn> = {\n /** The ABI method call return value */\n return?: TReturn\n}\n\n/** Result from sending a single app transaction. */\nexport type SendAppTransactionResult = Expand<\n SendSingleTransactionResult & {\n /** If an ABI method was called the processed return value */\n return?: ABIReturn\n }\n>\n\n/** Result from sending a single app transaction. */\nexport type SendAppUpdateTransactionResult = Expand<SendAppTransactionResult & Partial<AppCompilationResult>>\n\n/** Result from sending a single app transaction. */\nexport type SendAppCreateTransactionResult = Expand<\n SendAppUpdateTransactionResult & {\n /** The id of the created app */\n appId: bigint\n /** The Algorand address of the account associated with the app */\n appAddress: string\n }\n>\n\n/** Object holding app state values */\nexport interface AppState {\n [key: string]:\n | {\n value: bigint\n keyRaw: Uint8Array\n keyBase64: string\n }\n | {\n value: string\n valueRaw: Uint8Array\n valueBase64: string\n keyRaw: Uint8Array\n keyBase64: string\n }\n}\n\n/**\n * The name of a box storage box */\nexport interface BoxName {\n /** Name in UTF-8 */\n name: string\n /** Name in binary bytes */\n nameRaw: Uint8Array\n /** Name in Base64 */\n nameBase64: string\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValueRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValueRequestParams {\n /** The ID of the app return box names for */\n appId: number | bigint\n /** The name of the box to return either as a string, binary array or `BoxName` */\n boxName: string | Uint8Array | BoxName\n /** The ABI type to decode the value using */\n type: ABIType\n}\n\n/**\n * @deprecated Use `types/app-manager/BoxValuesRequestParams` instead.\n * Parameters to get and decode a box value as an ABI type.\n */\nexport interface BoxValuesRequestParams {\n /** The ID of the app return box names for */\n appId: number\n /** The names of the boxes to return either as a string, binary array or BoxName` */\n boxNames: (string | Uint8Array | BoxName)[]\n /** The ABI type to decode the value using */\n type: ABIType\n}\n"],"names":[],"mappings":"AAsBA;AACO,MAAM,uBAAuB,GAAG,iBAAgB;AAEvD;AACO,MAAM,uBAAuB,GAAG,iBAAgB;AAEvD;AACO,MAAM,oBAAoB,GAAG,mBAAkB;AAEtD;AACO,MAAM,iBAAiB,GAAG,KAAI;AAErC;AACa,MAAA,iBAAiB,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,EAAC;AA2PnE;IACY,SASX;AATD,CAAA,UAAY,QAAQ,EAAA;;AAElB,IAAA,QAAA,CAAA,QAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;;AAEJ,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;;AAET,IAAA,QAAA,CAAA,QAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;;AAEV,IAAA,QAAA,CAAA,QAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACX,CAAC,EATW,QAAQ,KAAR,QAAQ,GASnB,EAAA,CAAA,CAAA,CAAA;AAED;IACY,cAOX;AAPD,CAAA,UAAY,aAAa,EAAA;;AAEvB,IAAA,aAAA,CAAA,aAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI,CAAA;;AAEJ,IAAA,aAAA,CAAA,aAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU,CAAA;;AAEV,IAAA,aAAA,CAAA,aAAA,CAAA,WAAA,CAAA,GAAA,CAAA,CAAA,GAAA,WAAS,CAAA;AACX,CAAC,EAPW,aAAa,KAAb,aAAa,GAOxB,EAAA,CAAA,CAAA;;;;"}
@@ -203,4 +203,3 @@ export declare class AssetManager {
203
203
  ensureZeroBalance?: boolean;
204
204
  }): Promise<BulkAssetOptInOutResult[]>;
205
205
  }
206
- //# sourceMappingURL=asset-manager.d.ts.map
@@ -146,7 +146,7 @@ class AssetManager {
146
146
  nonZeroBalanceAssetIds.push(BigInt(assetId));
147
147
  }
148
148
  }
149
- catch (e) {
149
+ catch {
150
150
  notOptedInAssetIds.push(BigInt(assetId));
151
151
  }
152
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"asset-manager.js","sources":["../../src/types/asset-manager.ts"],"sourcesContent":[null],"names":["chunkArray","MAX_TRANSACTION_GROUP_SIZE","Config"],"mappings":";;;;;;;AAMA,IAAO,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;AAmI1C;MACa,YAAY,CAAA;AAIvB;;;;;;;;AAQG;IACH,WAAY,CAAA,KAAsB,EAAE,QAA+B,EAAA;AACjE,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC1B;AAED;;;;;;;;;;AAUG;IACI,MAAM,OAAO,CAAC,OAAe,EAAA;QAClC,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEpG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CAAA,kBAAA,EAAqB,MAAM,CAAC,OAAO,CAAA,UAAA,EAAa,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,EAAE,cAAc,CAAA,CAAA,CAAG,CAC/F,CAAA;YAED,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,KAAI;gBACpC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAChF,aAAC,CAAC,CAAA;SACH;AAED,QAAA,OAAO,OAAO,CAAA;KACf;AACF;;;;"}
1
+ {"version":3,"file":"asset-manager.js","sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation, TransactionSignerAccount } from './account'\nimport AlgoKitComposer, { CommonTransactionParams, MAX_TRANSACTION_GROUP_SIZE } from './composer'\nimport { ExecuteParams } from './transaction'\nimport AssetModel = algosdk.modelsv2.Asset\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set the field is permanently empty.\n */\n reserve?: string\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * The clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: algosdk.Algodv2\n private _newGroup: () => AlgoKitComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `AlgoKitComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new AlgoKitComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: algosdk.Algodv2, newGroup: () => AlgoKitComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = AssetModel.from_obj_for_encoding(await this._algod.getAssetByID(Number(assetId)).do())\n\n return {\n assetId: BigInt(asset.index),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\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 = 123345n;\n * const accountInfo = await algorand.asset.getAccountInformation(address, assetId);\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 * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | TransactionSignerAccount, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(typeof sender === 'string' ? sender : sender.addr, Number(assetId)).do()\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info['asset-holding']['amount']),\n frozen: info['asset-holding']['is-frozen'] === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * algorand.asset.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * algorand.asset.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | TransactionSignerAccount,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & ExecuteParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: typeof account === 'string' ? account : account.addr,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.execute(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * algorand.asset.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * algorand.asset.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | TransactionSignerAccount,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n ExecuteParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n const sender = typeof account === 'string' ? account : account.addr\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(sender, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${sender}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.execute(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n}\n"],"names":["chunkArray","MAX_TRANSACTION_GROUP_SIZE","Config"],"mappings":";;;;;;;AAMA,IAAO,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;AAmI1C;MACa,YAAY,CAAA;AAIvB;;;;;;;;AAQG;IACH,WAAY,CAAA,KAAsB,EAAE,QAA+B,EAAA;AACjE,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC1B;AAED;;;;;;;;;;AAUG;IACI,MAAM,OAAO,CAAC,OAAe,EAAA;QAClC,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEpG,OAAO;AACL,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvC,YAAA,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;AAC5B,YAAA,gBAAgB,EAAE,KAAK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AC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAChF,aAAC,CAAC,CAAA;SACH;AAED,QAAA,OAAO,OAAO,CAAA;KACf;AACF;;;;"}
@@ -144,7 +144,7 @@ class AssetManager {
144
144
  nonZeroBalanceAssetIds.push(BigInt(assetId));
145
145
  }
146
146
  }
147
- catch (e) {
147
+ catch {
148
148
  notOptedInAssetIds.push(BigInt(assetId));
149
149
  }
150
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"asset-manager.mjs","sources":["../../src/types/asset-manager.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAMA,IAAO,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;AAmI1C;MACa,YAAY,CAAA;AAIvB;;;;;;;;AAQG;IACH,WAAY,CAAA,KAAsB,EAAE,QAA+B,EAAA;AACjE,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;KAC1B;AAED;;;;;;;;;;AAUG;IACI,MAAM,OAAO,CAAC,OAAe,EAAA;QAClC,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAEpG,OAAO;AACL,YAAA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;YAC5B,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;YACjC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AACvC,YAAA,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI;AAC5B,YAAA,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO;AACtC,YAAA,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ;AAC/B,YAAA,eA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AAA;KACf;AACF;;;;"}
1
+ {"version":3,"file":"asset-manager.mjs","sources":["../../src/types/asset-manager.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { Config } from '../config'\nimport { chunkArray } from '../util'\nimport { AccountAssetInformation, TransactionSignerAccount } from './account'\nimport AlgoKitComposer, { CommonTransactionParams, MAX_TRANSACTION_GROUP_SIZE } from './composer'\nimport { ExecuteParams } from './transaction'\nimport AssetModel = algosdk.modelsv2.Asset\n\n/** Individual result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. */\nexport interface BulkAssetOptInOutResult {\n /** The ID of the asset opted into / out of */\n assetId: bigint\n /** The transaction ID of the resulting opt in / out */\n transactionId: string\n}\n\n/** Information about an asset. */\nexport interface AssetInformation {\n /** The ID of the asset. */\n assetId: bigint\n\n /** The address of the account that created the asset.\n *\n * This is the address where the parameters for this asset can be found,\n * and also the address where unwanted asset units can be sent when\n * closing out an asset position and opting-out of the asset.\n */\n creator: string\n\n /** The total amount of the smallest divisible (decimal) units that were created of the asset.\n *\n * For example, if `decimals` is, say, 2, then for every 100 `total` there is 1 whole unit.\n */\n total: bigint\n\n /** The amount of decimal places the asset was created with.\n *\n * * If 0, the asset is not divisible;\n * * If 1, the base unit of the asset is in tenths;\n * * If 2, the base unit of the asset is in hundredths;\n * * If 3, the base unit of the asset is in thousandths;\n * * and so on up to 19 decimal places.\n */\n decimals: number\n\n /** Whether the asset was frozen by default for all accounts.\n *\n * If `true` then for anyone apart from the creator to hold the\n * asset it needs to be unfrozen per account using an asset freeze\n * transaction from the `freeze` account.\n */\n defaultFrozen?: boolean\n\n /** The address of the optional account that can manage the configuration of the asset and destroy it.\n *\n * If not set the asset is permanently immutable.\n */\n manager?: string\n\n /**\n * The address of the optional account that holds the reserve (uncirculated supply) units of the asset.\n *\n * This address has no specific authority in the protocol itself and is informational only.\n *\n * Some standards like [ARC-19](https://github.com/algorandfoundation/ARCs/blob/main/ARCs/arc-0019.md)\n * rely on this field to hold meaningful data.\n *\n * It can be used in the case where you want to signal to holders of your asset that the uncirculated units\n * of the asset reside in an account that is different from the default creator account.\n *\n * If not set the field is permanently empty.\n */\n reserve?: string\n\n /**\n * The address of the optional account that can be used to freeze or unfreeze holdings of this asset for any account.\n *\n * If empty, freezing is not permitted.\n *\n * If not set the field is permanently empty.\n */\n freeze?: string\n\n /**\n * The address of the optional account that can clawback holdings of this asset from any account.\n *\n * The clawback account has the ability to **unconditionally take assets from any account**.\n *\n * If empty, clawback is not permitted.\n *\n * If not set the field is permanently empty.\n */\n clawback?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitName?: string\n\n /** The optional name of the unit of this asset (e.g. ticker name).\n *\n * Max size is 8 bytes.\n */\n unitNameAsBytes?: Uint8Array\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetName?: string\n\n /** The optional name of the asset.\n *\n * Max size is 32 bytes.\n */\n assetNameAsBytes?: Uint8Array\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n url?: string\n\n /** Optional URL where more information about the asset can be retrieved (e.g. metadata).\n *\n * Max size is 96 bytes.\n */\n urlAsBytes?: Uint8Array\n\n /** 32-byte hash of some metadata that is relevant to the asset and/or asset holders.\n *\n * The format of this metadata is up to the application.\n */\n metadataHash?: Uint8Array\n}\n\n/** Allows management of asset information. */\nexport class AssetManager {\n private _algod: algosdk.Algodv2\n private _newGroup: () => AlgoKitComposer\n\n /**\n * Create a new asset manager.\n * @param algod An algod client\n * @param newGroup A function that creates a new `AlgoKitComposer` transaction group\n * @example Create a new asset manager\n * ```typescript\n * const assetManager = new AssetManager(algod, () => new AlgoKitComposer({algod, () => signer, () => suggestedParams}))\n * ```\n */\n constructor(algod: algosdk.Algodv2, newGroup: () => AlgoKitComposer) {\n this._algod = algod\n this._newGroup = newGroup\n }\n\n /**\n * Returns the current asset information for the asset with the given ID.\n *\n * @example\n * ```typescript\n * const assetInfo = await assetManager.getById(12353n);\n * ```\n *\n * @param assetId The ID of the asset\n * @returns The asset information\n */\n public async getById(assetId: bigint): Promise<AssetInformation> {\n const asset = AssetModel.from_obj_for_encoding(await this._algod.getAssetByID(Number(assetId)).do())\n\n return {\n assetId: BigInt(asset.index),\n total: BigInt(asset.params.total),\n decimals: Number(asset.params.decimals),\n assetName: asset.params.name,\n assetNameAsBytes: asset.params.nameB64,\n unitName: asset.params.unitName,\n unitNameAsBytes: asset.params.unitNameB64,\n url: asset.params.url,\n urlAsBytes: asset.params.urlB64,\n creator: asset.params.creator,\n manager: asset.params.manager,\n clawback: asset.params.clawback,\n freeze: asset.params.freeze,\n reserve: asset.params.reserve,\n defaultFrozen: asset.params.defaultFrozen,\n metadataHash: asset.params.metadataHash,\n }\n }\n\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 = 123345n;\n * const accountInfo = await algorand.asset.getAccountInformation(address, assetId);\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 * @returns The account asset holding information\n */\n public async getAccountInformation(sender: string | TransactionSignerAccount, assetId: bigint): Promise<AccountAssetInformation> {\n const info = await this._algod.accountAssetInformation(typeof sender === 'string' ? sender : sender.addr, Number(assetId)).do()\n\n return {\n assetId: BigInt(assetId),\n balance: BigInt(info['asset-holding']['amount']),\n frozen: info['asset-holding']['is-frozen'] === true,\n round: BigInt(info['round']),\n }\n }\n\n /**\n * Opt an account in to a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-in to\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * algorand.asset.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * algorand.asset.bulkOptIn(\"ACCOUNTADDRESS\", [12345n, 67890n], { maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptIn(\n account: string | TransactionSignerAccount,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> & ExecuteParams,\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n for (const assetId of assetGroup) {\n composer.addAssetOptIn({\n ...options,\n sender: typeof account === 'string' ? account : account.addr,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.execute(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted in ${account} for assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })\n }\n\n return results\n }\n\n /**\n * Opt an account out of a list of Algorand Standard Assets.\n *\n * Transactions will be sent in batches of 16 as transaction groups.\n *\n * @param account The account to opt-in\n * @param assetIds The list of asset IDs to opt-out of\n * @param options Any parameters to control the transaction or execution of the transaction\n * @example Example using AlgorandClient\n * ```typescript\n * // Basic example\n * algorand.asset.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n])\n * // With configuration\n * algorand.asset.bulkOptOut(\"ACCOUNTADDRESS\", [12345n, 67890n], { ensureZeroBalance: true, maxFee: (1000).microAlgo(), suppressLog: true })\n * ```\n * @returns An array of records matching asset ID to transaction ID of the opt in\n */\n async bulkOptOut(\n account: string | TransactionSignerAccount,\n assetIds: bigint[],\n options?: Omit<CommonTransactionParams, 'sender'> &\n ExecuteParams & {\n /** Whether or not to check if the account has a zero balance for each asset first or not.\n *\n * Defaults to `true`.\n *\n * If this is set to `true` and the account has an asset balance it will throw an error.\n *\n * If this is set to `false` and the account has an asset balance it will lose those assets to the asset creator.\n */\n ensureZeroBalance?: boolean\n },\n ): Promise<BulkAssetOptInOutResult[]> {\n const results: BulkAssetOptInOutResult[] = []\n\n const sender = typeof account === 'string' ? account : account.addr\n\n for (const assetGroup of chunkArray(assetIds, MAX_TRANSACTION_GROUP_SIZE)) {\n const composer = this._newGroup()\n\n const notOptedInAssetIds: bigint[] = []\n const nonZeroBalanceAssetIds: bigint[] = []\n for (const assetId of assetGroup) {\n if (options?.ensureZeroBalance !== false) {\n try {\n const accountAssetInfo = await this.getAccountInformation(sender, assetId)\n if (accountAssetInfo.balance !== 0n) {\n nonZeroBalanceAssetIds.push(BigInt(assetId))\n }\n } catch {\n notOptedInAssetIds.push(BigInt(assetId))\n }\n }\n }\n\n if (notOptedInAssetIds.length > 0 || nonZeroBalanceAssetIds.length > 0) {\n throw new Error(\n `Account ${sender}${notOptedInAssetIds.length > 0 ? ` is not opted-in to Asset${notOptedInAssetIds.length > 1 ? 's' : ''} ${notOptedInAssetIds.join(', ')}` : ''}${\n nonZeroBalanceAssetIds.length > 0\n ? ` has non-zero balance for Asset${nonZeroBalanceAssetIds.length > 1 ? 's' : ''} ${nonZeroBalanceAssetIds.join(', ')}`\n : ''\n }; can't opt-out.`,\n )\n }\n\n for (const assetId of assetGroup) {\n composer.addAssetOptOut({\n ...options,\n creator: (await this.getById(BigInt(assetId))).creator,\n sender,\n assetId: BigInt(assetId),\n })\n }\n\n const result = await composer.execute(options)\n\n Config.getLogger(options?.suppressLog).info(\n `Successfully opted ${account} out of assets ${assetGroup.join(', ')} with transaction IDs ${result.txIds.join(', ')}` +\n `\\n Grouped under ${result.groupId} in round ${result.confirmations?.[0]?.confirmedRound}.`,\n )\n\n assetGroup.forEach((assetId, index) => {\n results.push({ assetId: BigInt(assetId), transactionId: result.txIds[index] })\n })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E,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO;oBACtD,MAAM;AACN,oBAAA,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;AACzB,iBAAA,CAAC,CAAA;aACH;YAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAE9C,YAAA,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,IAAI,CACzC,CAAsB,mBAAA,EAAA,OAAO,CAAkB,eAAA,EAAA,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAE,CAAA;AACpH,gBAAA,CAAA,kBAAA,EAAqB,MAAM,CAAC,OAAO,CAAA,UAAA,EAAa,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC,EAAE,cAAc,CAAA,CAAA,CAAG,CAC/F,CAAA;YAED,UAAU,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,KAAK,KAAI;gBACpC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAChF,aAAC,CAAC,CAAA;SACH;AAED,QAAA,OAAO,OAAO,CAAA;KACf;AACF;;;;"}
package/types/asset.d.ts CHANGED
@@ -97,4 +97,3 @@ export interface AssetBulkOptInOutParams {
97
97
  /** Whether to suppress log messages from transaction send, default: do not suppress */
98
98
  suppressLog?: boolean;
99
99
  }
100
- //# sourceMappingURL=asset.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging';
2
+ export declare enum EventType {
3
+ TxnGroupSimulated = "TxnGroupSimulated",
4
+ AppCompiled = "AppCompiled"
5
+ }
6
+ export type EventDataMap = {
7
+ [EventType.TxnGroupSimulated]: AVMTracesEventData;
8
+ [EventType.AppCompiled]: TealSourcesDebugEventData;
9
+ [key: string]: unknown;
10
+ };
11
+ export type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void;
12
+ export declare class AsyncEventEmitter {
13
+ private listenerWrapperMap;
14
+ private listenerMap;
15
+ emitAsync<K extends EventType>(eventName: K, event: EventDataMap[K]): Promise<void>;
16
+ emitAsync(eventName: string | symbol, event: unknown): Promise<void>;
17
+ on<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter;
18
+ on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter;
19
+ once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter;
20
+ once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter;
21
+ removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter;
22
+ off: (eventName: string | symbol, listener: AsyncEventListener) => AsyncEventEmitter;
23
+ }
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ exports.EventType = void 0;
4
+ (function (EventType) {
5
+ EventType["TxnGroupSimulated"] = "TxnGroupSimulated";
6
+ EventType["AppCompiled"] = "AppCompiled";
7
+ })(exports.EventType || (exports.EventType = {}));
8
+ class AsyncEventEmitter {
9
+ constructor() {
10
+ this.listenerWrapperMap = new WeakMap();
11
+ this.listenerMap = {};
12
+ this.off = this.removeListener;
13
+ }
14
+ async emitAsync(eventName, event) {
15
+ for (const listener of this.listenerMap[eventName] ?? []) {
16
+ await listener(event, eventName);
17
+ }
18
+ }
19
+ on(eventName, listener) {
20
+ if (!this.listenerMap[eventName])
21
+ this.listenerMap[eventName] = [];
22
+ this.listenerMap[eventName].push(listener);
23
+ return this;
24
+ }
25
+ once(eventName, listener) {
26
+ const wrappedListener = async (event, eventName) => {
27
+ try {
28
+ return await listener(event, eventName);
29
+ }
30
+ finally {
31
+ this.removeListener(eventName, wrappedListener);
32
+ }
33
+ };
34
+ this.listenerWrapperMap.set(listener, wrappedListener);
35
+ return this.on(eventName, wrappedListener);
36
+ }
37
+ removeListener(eventName, listener) {
38
+ const wrappedListener = this.listenerWrapperMap.get(listener);
39
+ if (wrappedListener) {
40
+ this.listenerWrapperMap.delete(listener);
41
+ if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {
42
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1);
43
+ }
44
+ }
45
+ else {
46
+ if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {
47
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1);
48
+ }
49
+ }
50
+ return this;
51
+ }
52
+ }
53
+
54
+ exports.AsyncEventEmitter = AsyncEventEmitter;
55
+ //# sourceMappingURL=async-event-emitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-event-emitter.js","sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging'\n\nexport enum EventType {\n TxnGroupSimulated = 'TxnGroupSimulated',\n AppCompiled = 'AppCompiled',\n}\n\nexport type EventDataMap = {\n [EventType.TxnGroupSimulated]: AVMTracesEventData\n [EventType.AppCompiled]: TealSourcesDebugEventData\n [key: string]: unknown\n}\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends EventType>(eventName: K, event: EventDataMap[K]): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void> {\n for (const listener of this.listenerMap[eventName] ?? []) {\n await listener(event, eventName)\n }\n }\n\n on<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n on(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n if (!this.listenerMap[eventName]) this.listenerMap[eventName] = []\n this.listenerMap[eventName].push(listener as AsyncEventListener)\n return this\n }\n\n once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n once(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener: AsyncEventListener = async (event, eventName) => {\n try {\n return await listener(event, eventName)\n } finally {\n this.removeListener(eventName, wrappedListener)\n }\n }\n this.listenerWrapperMap.set(listener, wrappedListener)\n return this.on(eventName, wrappedListener)\n }\n\n removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener = this.listenerWrapperMap.get(listener)\n if (wrappedListener) {\n this.listenerWrapperMap.delete(listener)\n if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1)\n }\n } else {\n if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1)\n }\n }\n\n return this\n }\n\n off = this.removeListener\n}\n"],"names":["EventType"],"mappings":";;AAEYA,2BAGX;AAHD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AACvC,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B,CAAA;AAC7B,CAAC,EAHWA,iBAAS,KAATA,iBAAS,GAGpB,EAAA,CAAA,CAAA,CAAA;MAUY,iBAAiB,CAAA;AAA9B,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,kBAAkB,GAAG,IAAI,OAAO,EAA0C,CAAA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BAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACxC,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;aAC5F;SACF;aAAM;AACL,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;gBACzD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;aACrF;SACF;AAED,QAAA,OAAO,IAAI,CAAA;KACZ;AAGF;;;;"}
@@ -0,0 +1,53 @@
1
+ var EventType;
2
+ (function (EventType) {
3
+ EventType["TxnGroupSimulated"] = "TxnGroupSimulated";
4
+ EventType["AppCompiled"] = "AppCompiled";
5
+ })(EventType || (EventType = {}));
6
+ class AsyncEventEmitter {
7
+ constructor() {
8
+ this.listenerWrapperMap = new WeakMap();
9
+ this.listenerMap = {};
10
+ this.off = this.removeListener;
11
+ }
12
+ async emitAsync(eventName, event) {
13
+ for (const listener of this.listenerMap[eventName] ?? []) {
14
+ await listener(event, eventName);
15
+ }
16
+ }
17
+ on(eventName, listener) {
18
+ if (!this.listenerMap[eventName])
19
+ this.listenerMap[eventName] = [];
20
+ this.listenerMap[eventName].push(listener);
21
+ return this;
22
+ }
23
+ once(eventName, listener) {
24
+ const wrappedListener = async (event, eventName) => {
25
+ try {
26
+ return await listener(event, eventName);
27
+ }
28
+ finally {
29
+ this.removeListener(eventName, wrappedListener);
30
+ }
31
+ };
32
+ this.listenerWrapperMap.set(listener, wrappedListener);
33
+ return this.on(eventName, wrappedListener);
34
+ }
35
+ removeListener(eventName, listener) {
36
+ const wrappedListener = this.listenerWrapperMap.get(listener);
37
+ if (wrappedListener) {
38
+ this.listenerWrapperMap.delete(listener);
39
+ if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {
40
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1);
41
+ }
42
+ }
43
+ else {
44
+ if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {
45
+ this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1);
46
+ }
47
+ }
48
+ return this;
49
+ }
50
+ }
51
+
52
+ export { AsyncEventEmitter, EventType };
53
+ //# sourceMappingURL=async-event-emitter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"async-event-emitter.mjs","sources":["../../src/types/async-event-emitter.ts"],"sourcesContent":["import { AVMTracesEventData, TealSourcesDebugEventData } from './debugging'\n\nexport enum EventType {\n TxnGroupSimulated = 'TxnGroupSimulated',\n AppCompiled = 'AppCompiled',\n}\n\nexport type EventDataMap = {\n [EventType.TxnGroupSimulated]: AVMTracesEventData\n [EventType.AppCompiled]: TealSourcesDebugEventData\n [key: string]: unknown\n}\n\nexport type AsyncEventListener<T = unknown> = (event: T, eventName: string | symbol) => Promise<void> | void\n\nexport class AsyncEventEmitter {\n private listenerWrapperMap = new WeakMap<AsyncEventListener, AsyncEventListener>()\n private listenerMap: Record<string | symbol, AsyncEventListener[]> = {}\n\n async emitAsync<K extends EventType>(eventName: K, event: EventDataMap[K]): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void>\n async emitAsync(eventName: string | symbol, event: unknown): Promise<void> {\n for (const listener of this.listenerMap[eventName] ?? []) {\n await listener(event, eventName)\n }\n }\n\n on<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n on<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n on(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n if (!this.listenerMap[eventName]) this.listenerMap[eventName] = []\n this.listenerMap[eventName].push(listener as AsyncEventListener)\n return this\n }\n\n once<K extends EventType>(eventName: K, listener: AsyncEventListener<EventDataMap[K]>): AsyncEventEmitter\n once<T = unknown>(eventName: string | symbol, listener: AsyncEventListener<T>): AsyncEventEmitter\n once(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener: AsyncEventListener = async (event, eventName) => {\n try {\n return await listener(event, eventName)\n } finally {\n this.removeListener(eventName, wrappedListener)\n }\n }\n this.listenerWrapperMap.set(listener, wrappedListener)\n return this.on(eventName, wrappedListener)\n }\n\n removeListener(eventName: string | symbol, listener: AsyncEventListener): AsyncEventEmitter {\n const wrappedListener = this.listenerWrapperMap.get(listener)\n if (wrappedListener) {\n this.listenerWrapperMap.delete(listener)\n if (this.listenerMap[eventName]?.indexOf(wrappedListener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(wrappedListener), 1)\n }\n } else {\n if (this.listenerMap[eventName]?.indexOf(listener) !== -1) {\n this.listenerMap[eventName].splice(this.listenerMap[eventName].indexOf(listener), 1)\n }\n }\n\n return this\n }\n\n off = this.removeListener\n}\n"],"names":[],"mappings":"IAEY,UAGX;AAHD,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,mBAAA,CAAA,GAAA,mBAAuC,CAAA;AACvC,IAAA,SAAA,CAAA,aAAA,CAAA,GAAA,aAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA,CAAA;MAUY,iBAAiB,CAAA;AAA9B,IAAA,WAAA,GAAA;AACU,QAAA,IAAA,CAAA,kBAAkB,GAAG,IAAI,OAAO,EAA0C,CAAA;QAC1E,IAAW,CAAA,WAAA,GAAkD,EAAE,CAAA;AAgDvE,QAAA,IAAA,CAAA,GAAG,GAA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AAC,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAE;gBAChE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAA;aAC5F;SACF;aAAM;AACL,YAAA,IAAI,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;gBACzD,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;aACrF;SACF;AAED,QAAA,OAAO,IAAI,CAAA;KACZ;AAGF;;;;"}
@@ -393,4 +393,3 @@ export interface TypedAppClient<TClient> {
393
393
  export interface TypedAppFactory<TClient> {
394
394
  new (params: Omit<AppFactoryParams, 'appSpec'>): TClient;
395
395
  }
396
- //# sourceMappingURL=client-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-manager.js","sources":["../../src/types/client-manager.ts"],"sourcesContent":[null],"names":["genesisIdIsLocalNet","TestNetDispenserApiClient","AppFactory","AppClient","AlgoHttpClientWithRetry"],"mappings":";;;;;;;;;AASA,IAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AACxB,IAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAEhC,IAAO,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;AAYxC;MACa,aAAa,CAAA;AAMxB;;;;;;;;;;;;;;;;;;;AAmBG;IACH,WAAY,CAAA,eAA4C,EAAE,cAAwC,EAAA;AAChG,QAAA,MAAM,QAAQ,GACZ,OAAO,IAAI,eAAe;AACxB,cAAE,eAAe;AACjB,cAAE;gBACE,KAAK,EAAE,aAAa,CAAC,cAA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;;AAUG;IACI,OAAO,YAAY,CAAC,MAAwB,EAAA;QACjD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAA;QACtC,OAAO,IAAI,GAAG,CAAC,KAAe,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;KAC9C;AAED;;;;;;;;AAQG;AACI,IAAA,OAAO,2BAA2B,GAAA;;;QAGvC,OAAO,aAAa,CAAC,YAAY,CAAC,EAAE,GAAG,aAAa,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAA;KAChI;AACF;;;;"}
1
+ {"version":3,"file":"client-manager.js","sources":["../../src/types/client-manager.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { SuggestedParamsWithMinFee } from 'algosdk/dist/types/types/transactions/base'\nimport { AlgoHttpClientWithRetry } from './algo-http-client-with-retry'\nimport { AlgorandClientInterface } from './algorand-client-interface'\nimport { AppClient, AppClientParams, ResolveAppClientByCreatorAndName } from './app-client'\nimport { AppFactory, AppFactoryParams } from './app-factory'\nimport { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from './dispenser-client'\nimport { Expand } from './expand'\nimport { AlgoClientConfig, AlgoConfig, NetworkDetails, genesisIdIsLocalNet } from './network-client'\nimport Kmd = algosdk.Kmd\nimport Indexer = algosdk.Indexer\nimport Algodv2 = algosdk.Algodv2\nimport IntDecoding = algosdk.IntDecoding\n\n/** Clients from algosdk that interact with the official Algorand APIs */\nexport interface AlgoSdkClients {\n /** Algod client, see https://developer.algorand.org/docs/rest-apis/algod/ */\n algod: algosdk.Algodv2\n /** Optional indexer client, see https://developer.algorand.org/docs/rest-apis/indexer/ */\n indexer?: algosdk.Indexer\n /** Optional KMD client, see https://developer.algorand.org/docs/rest-apis/kmd/ */\n kmd?: algosdk.Kmd\n}\n\n/** Exposes access to various API clients. */\nexport class ClientManager {\n private _algod: algosdk.Algodv2\n private _indexer?: algosdk.Indexer\n private _kmd?: algosdk.Kmd\n private _algorand?: AlgorandClientInterface\n\n /**\n * algosdk clients or config for interacting with the official Algorand APIs.\n * @param clientsOrConfig The clients or config to use\n * @example Algod client only\n * ```typescript\n * const clientManager = new ClientManager({ algod: algodClient })\n * ```\n * @example All clients\n * ```typescript\n * const clientManager = new ClientManager({ algod: algodClient, indexer: indexerClient, kmd: kmdClient })\n * ```\n * @example Algod config only\n * ```typescript\n * const clientManager = new ClientManager({ algodConfig })\n * ```\n * @example All client configs\n * ```typescript\n * const clientManager = new ClientManager({ algodConfig, indexerConfig, kmdConfig })\n * ```\n */\n constructor(clientsOrConfig: AlgoConfig | AlgoSdkClients, algorandClient?: AlgorandClientInterface) {\n const _clients =\n 'algod' in clientsOrConfig\n ? clientsOrConfig\n : {\n algod: ClientManager.getAlgodClient(clientsOrConfig.algodConfig),\n indexer: clientsOrConfig.indexerConfig ? ClientManager.getIndexerClient(clientsOrConfig.indexerConfig) : undefined,\n kmd: clientsOrConfig.kmdConfig ? ClientManager.getKmdClient(clientsOrConfig.kmdConfig) : undefined,\n }\n this._algod = _clients.algod\n this._indexer = _clients.indexer\n this._kmd = _clients.kmd\n this._algorand = algorandClient\n }\n\n /** Returns an algosdk Algod API client. */\n public get algod(): algosdk.Algodv2 {\n return this._algod\n }\n\n /** Returns an algosdk Indexer API client or throws an error if it's not been provided. */\n public get indexer(): algosdk.Indexer {\n if (!this._indexer) throw new Error('Attempt to use Indexer client in AlgoKit instance with no Indexer configured')\n return this._indexer\n }\n\n /** Returns an algosdk Indexer API client or `undefined` if it's not been provided. */\n public get indexerIfPresent(): algosdk.Indexer | undefined {\n return this._indexer\n }\n\n /** Returns an algosdk KMD API client or throws an error if it's not been provided. */\n public get kmd(): algosdk.Kmd {\n if (!this._kmd) throw new Error('Attempt to use Kmd client in AlgoKit instance with no Kmd configured')\n return this._kmd\n }\n\n private _getNetworkPromise: Promise<SuggestedParamsWithMinFee> | undefined\n /**\n * Get details about the current network.\n * @example Getting genesis ID\n * ```typescript\n * const network = await networkClient.network()\n * const genesisId = network.genesisId\n * ```\n * @returns The current network details\n */\n public async network(): Promise<NetworkDetails> {\n if (!this._getNetworkPromise) {\n this._getNetworkPromise = this._algod.getTransactionParams().do()\n }\n\n const params = await this._getNetworkPromise\n return {\n isTestNet: ['testnet-v1.0', 'testnet-v1', 'testnet'].includes(params.genesisID),\n isMainNet: ['mainnet-v1.0', 'mainnet-v1', 'mainnet'].includes(params.genesisID),\n isLocalNet: ClientManager.genesisIdIsLocalNet(params.genesisID),\n genesisId: params.genesisID,\n genesisHash: params.genesisHash,\n }\n }\n\n /**\n * Returns true if the given network genesisId is associated with a LocalNet network.\n * @param genesisId The network genesis ID\n * @returns Whether the given genesis ID is associated with a LocalNet network\n */\n public static genesisIdIsLocalNet(genesisId: string) {\n return genesisIdIsLocalNet(genesisId)\n }\n\n /**\n * Returns true if the current network is LocalNet.\n * @returns True if the current network is LocalNet.\n */\n public async isLocalNet() {\n return (await this.network()).isLocalNet\n }\n\n /**\n * Returns true if the current network is TestNet.\n * @returns True if the current network is TestNet.\n */\n public async isTestNet() {\n return (await this.network()).isTestNet\n }\n\n /**\n * Returns true if the current network is MainNet.\n * @returns True if the current network is MainNet.\n */\n public async isMainNet() {\n return (await this.network()).isMainNet\n }\n\n /**\n * Returns a TestNet Dispenser API client.\n *\n * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.\n *\n * @param params An object containing parameters for the TestNetDispenserApiClient class.\n * @example\n * const client = clientManager.getTestNetDispenser(\n * {\n * authToken: 'your_auth_token',\n * requestTimeout: 15,\n * }\n * )\n *\n * @returns An instance of the TestNetDispenserApiClient class.\n */\n public getTestNetDispenser(params: TestNetDispenserApiClientParams) {\n return new TestNetDispenserApiClient(params)\n }\n\n /**\n * Returns a TestNet Dispenser API client, loading the auth token from `process.env.ALGOKIT_DISPENSER_ACCESS_TOKEN`.\n *\n * Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.\n *\n * @param params An object containing parameters for the TestNetDispenserApiClient class.\n * @example\n * const client = clientManager.getTestNetDispenserFromEnvironment(\n * {\n * requestTimeout: 15,\n * }\n * )\n *\n * @returns An instance of the TestNetDispenserApiClient class.\n */\n public getTestNetDispenserFromEnvironment(params?: Omit<TestNetDispenserApiClientParams, 'authToken'>) {\n return new TestNetDispenserApiClient(params ? { ...params, authToken: '' } : undefined)\n }\n\n /**\n * Returns a new `AppFactory` client\n * @example Basic example\n * ```typescript\n * const factory = algorand.client.getAppFactory({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\/}',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * const factory = algorand.client.getAppFactory({\n * appSpec: parsedAppSpec_AppSpec_or_Arc56Contract,\n * defaultSender: \"SENDERADDRESS\",\n * appName: \"OverriddenAppName\",\n * version: \"2.0.0\",\n * updatable: true,\n * deletable: false,\n * deployTimeParams: { ONE: 1, TWO: 'value' }\n * })\n * ```\n */\n public getAppFactory(params: Expand<Omit<AppFactoryParams, 'algorand'>>) {\n if (!this._algorand) {\n throw new Error('Attempt to get app factory from a ClientManager without an Algorand client')\n }\n\n return new AppFactory({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.\n * This method resolves the app ID by looking up the creator address and name\n * using AlgoKit app deployment semantics (i.e. looking for the app creation transaction note).\n * @param params The parameters to create the app client\n * @example Basic\n * const appClient = algorand.client.getAppClientByCreatorAndName({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\}',\n * // appId resolved by looking for app ID of named app by this creator\n * creatorAddress: 'CREATORADDRESS',\n * })\n * @returns The `AppClient`\n */\n public getAppClientByCreatorAndName(params: Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand'>>) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return AppClient.fromCreatorAndName({\n ...params,\n algorand: this._algorand,\n })\n }\n\n /**\n * Returns a new `AppClient` client for managing calls and state for an ARC-32/ARC-56 app.\n * @param params The parameters to create the app client\n * @example Basic\n * const appClient = algorand.client.getAppClientById({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\}',\n * appId: 12345n,\n * })\n * @returns The `AppClient`\n */\n public getAppClientById(params: Expand<Omit<AppClientParams, 'algorand'>>) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n return new AppClient({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new `AppClient` client for managing calls and state for an ARC-56 app.\n * This method resolves the app ID for the current network based on\n * pre-determined network-specific app IDs specified in the ARC-56 app spec.\n *\n * If no IDs are in the app spec or the network isn't recognised, an error is thrown.\n * @param params The parameters to create the app client\n * @example Basic\n * const appClient = algorand.client.getAppClientByNetwork({\n * appSpec: '{/* ARC-56 or ARC-32 compatible JSON *\\}',\n * // appId resolved by using ARC-56 spec to find app ID for current network\n * })\n * @returns The `AppClient`\n */\n public async getAppClientByNetwork(params: Expand<Omit<AppClientParams, 'algorand' | 'appId'>>) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n return AppClient.fromNetwork({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed client, resolving the app by creator address and name.\n * @param typedClient The typed client type to use\n * @param params The params to resolve the app by creator address and name\n * @example Use name in ARC-32 / ARC-56 app spec\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {\n * creatorAddress: \"CREATORADDRESS\",\n * defaultSender: alice,\n * })\n * ```\n * @example Specify name\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientByCreatorAndName(MyContractClient, {\n * creatorAddress: \"CREATORADDRESS\",\n * name: \"contract-name\",\n * defaultSender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public async getTypedAppClientByCreatorAndName<TClient extends TypedAppClient<InstanceType<TClient>>>(\n typedClient: TClient,\n params: Expand<Omit<ResolveAppClientByCreatorAndName, 'algorand' | 'appSpec'>>,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return typedClient.fromCreatorAndName({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed client, resolving the app by app ID.\n * @param typedClient The typed client type to use\n * @param params The params to resolve the app by ID\n * @example\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientById(MyContractClient, {\n * appId: 12345n,\n * defaultSender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public getTypedAppClientById<TClient extends TypedAppClient<InstanceType<TClient>>>(\n typedClient: TClient,\n params: Expand<Omit<AppClientParams, 'algorand' | 'appSpec'>>,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return new typedClient({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed client, resolves the app ID for the current network based on\n * pre-determined network-specific app IDs specified in the ARC-56 app spec.\n *\n * If no IDs are in the app spec or the network isn't recognised, an error is thrown.\n * @param typedClient The typed client type to use\n * @param params The params to resolve the app by network\n * @example\n * ```typescript\n * const appClient = algorand.client.getTypedAppClientByNetwork(MyContractClient, {\n * defaultSender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public getTypedAppClientByNetwork<TClient extends TypedAppClient<InstanceType<TClient>>>(\n typedClient: TClient,\n params?: Expand<Omit<AppClientParams, 'algorand' | 'appSpec' | 'appId'>>,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app client from a ClientManager without an Algorand client')\n }\n\n return typedClient.fromNetwork({ ...params, algorand: this._algorand })\n }\n\n /**\n * Returns a new typed app factory.\n * @param typedFactory The typed factory type to use\n * @param params The params to resolve the factory by\n * @example\n * ```typescript\n * const appFactory = algorand.client.getTypedAppFactory(MyContractClient, {\n * sender: alice,\n * })\n * ```\n * @returns The typed client instance\n */\n public getTypedAppFactory<TClient>(\n typedFactory: TypedAppFactory<TClient>,\n params?: Expand<Omit<AppFactoryParams, 'algorand' | 'appSpec'>>,\n ) {\n if (!this._algorand) {\n throw new Error('Attempt to get app factory from a ClientManager without an Algorand client')\n }\n\n return new typedFactory({ ...params, algorand: this._algorand })\n }\n\n /**\n * Retrieve client configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment)\n *\n * If both `process.env.INDEXER_SERVER` and `process.env.ALGOD_SERVER` is defined it will use both along with optional `process.env.ALGOD_PORT`, `process.env.ALGOD_TOKEN`, `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.\n *\n * If only `process.env.ALGOD_SERVER` is defined it will use this along with optional `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN` and leave indexer as `undefined`.\n *\n * If only `process.env.INDEXER_SERVER` is defined it will use the default (LocalNet) configuration for both algod and indexer.\n *\n * It will return a KMD configuration that uses `process.env.KMD_PORT` (or port 4002) if `process.env.ALGOD_SERVER` is defined,\n * otherwise it will use the default LocalNet config unless it detects testnet or mainnet.\n * @example\n * ```typescript\n * const config = ClientManager.getConfigFromEnvironmentOrLocalNet()\n * ```\n * @returns The config for algod, indexer and kmd\n */\n public static getConfigFromEnvironmentOrLocalNet(): AlgoConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get default client configuration from a non Node.js context; supply the config instead')\n }\n const [algodConfig, indexerConfig, kmdConfig] = process.env.ALGOD_SERVER\n ? [\n ClientManager.getAlgodConfigFromEnvironment(),\n process.env.INDEXER_SERVER ? ClientManager.getIndexerConfigFromEnvironment() : undefined,\n !process.env.ALGOD_SERVER.includes('mainnet') && !process.env.ALGOD_SERVER.includes('testnet')\n ? { ...ClientManager.getAlgodConfigFromEnvironment(), port: process?.env?.KMD_PORT ?? '4002' }\n : undefined,\n ]\n : [\n ClientManager.getDefaultLocalNetConfig('algod'),\n ClientManager.getDefaultLocalNetConfig('indexer'),\n ClientManager.getDefaultLocalNetConfig('kmd'),\n ]\n\n return {\n algodConfig,\n indexerConfig,\n kmdConfig,\n }\n }\n\n /** Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment)\n *\n * Expects `process.env.ALGOD_SERVER` to be defined, and you can also specify `process.env.ALGOD_PORT` and `process.env.ALGOD_TOKEN`.\n */\n public static getAlgodConfigFromEnvironment(): AlgoClientConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get default algod configuration from a non Node.js context; supply the config instead')\n }\n\n if (!process.env.ALGOD_SERVER) {\n throw new Error('Attempt to get default algod configuration without specifying ALGOD_SERVER in the environment variables')\n }\n\n return {\n server: process.env.ALGOD_SERVER,\n port: process.env.ALGOD_PORT,\n token: process.env.ALGOD_TOKEN,\n }\n }\n\n /**\n * Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment).\n *\n * Expects `process.env.INDEXER_SERVER` to be defined, and you can also specify `process.env.INDEXER_PORT` and `process.env.INDEXER_TOKEN`.\n */\n public static getIndexerConfigFromEnvironment(): AlgoClientConfig {\n if (!process || !process.env) {\n throw new Error('Attempt to get default indexer configuration from a non Node.js context; supply the config instead')\n }\n\n if (!process.env.INDEXER_SERVER) {\n throw new Error('Attempt to get default indexer configuration without specifying INDEXER_SERVER in the environment variables')\n }\n\n return {\n server: process.env.INDEXER_SERVER,\n port: process.env.INDEXER_PORT,\n token: process.env.INDEXER_TOKEN,\n }\n }\n\n /** Returns the Algorand configuration to point to the free tier of the AlgoNode service.\n *\n * @param network Which network to connect to - TestNet or MainNet\n * @param config Which algod config to return - Algod or Indexer\n */\n public static getAlgoNodeConfig(network: 'testnet' | 'mainnet', config: 'algod' | 'indexer'): AlgoClientConfig {\n return {\n server: `https://${network}-${config === 'algod' ? 'api' : 'idx'}.algonode.cloud/`,\n port: 443,\n }\n }\n\n /** Returns the Algorand configuration to point to the default LocalNet.\n *\n * @param configOrPort Which algod config to return - algod, kmd, or indexer OR a port number\n */\n public static getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexer' | 'kmd' | number): AlgoClientConfig {\n return {\n server: `http://localhost`,\n port: configOrPort === 'algod' ? 4001 : configOrPort === 'indexer' ? 8980 : configOrPort === 'kmd' ? 4002 : configOrPort,\n token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',\n }\n }\n\n /**\n * Returns an algod SDK client that automatically retries on idempotent calls.\n *\n * @param config The config of the client\n * @example AlgoNode (testnet)\n * ```typescript\n * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('testnet', 'algod'))\n * await algod.healthCheck().do()\n * ```\n * @example AlgoNode (mainnet)\n * ```typescript\n * const algod = ClientManager.getAlgodClient(ClientManager.getAlgoNodeConfig('mainnet', 'algod'))\n * await algod.healthCheck().do()\n * ```\n * @example Custom (e.g. default LocalNet)\n * ```typescript\n * const algod = ClientManager.getAlgodClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})\n * await algod.healthCheck().do()\n * ```\n */\n public static getAlgodClient(config: AlgoClientConfig): Algodv2 {\n const { token, server, port } = config\n const tokenHeader = typeof token === 'string' ? { 'X-Algo-API-Token': token } : token ?? {}\n const httpClientWithRetry = new AlgoHttpClientWithRetry(tokenHeader, server, port)\n return new algosdk.Algodv2(httpClientWithRetry, server)\n }\n\n /**\n * Returns an algod SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).\n *\n * @example\n * ```typescript\n * // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN\n * const algod = ClientManager.getAlgodClientFromEnvironment()\n * await algod.healthCheck().do()\n * ```\n */\n public static getAlgodClientFromEnvironment(): Algodv2 {\n return ClientManager.getAlgodClient(ClientManager.getAlgodConfigFromEnvironment())\n }\n\n /**\n * Returns an indexer SDK client that automatically retries on idempotent calls\n *\n * @param config The config of the client\n * @param overrideIntDecoding Override the default int decoding for responses, uses MIXED by default to avoid lost precision for big integers\n * @example AlgoNode (testnet)\n * ```typescript\n * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('testnet', 'indexer'))\n * await indexer.makeHealthCheck().do()\n * ```\n * @example AlgoNode (mainnet)\n * ```typescript\n * const indexer = ClientManager.getIndexerClient(ClientManager.getAlgoNodeConfig('mainnet', 'indexer'))\n * await indexer.makeHealthCheck().do()\n * ```\n * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)\n * ```typescript\n * const indexer = ClientManager.getIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})\n * await indexer.makeHealthCheck().do()\n * ```\n * @example Override int decoding for responses\n * ```typescript\n * const indexer = ClientManager.getIndexerClient(config, IntDecoding.BIGINT)\n * ```\n */\n public static getIndexerClient(config: AlgoClientConfig, overrideIntDecoding?: IntDecoding): Indexer {\n const { token, server, port } = config\n const tokenHeader = typeof token === 'string' ? { 'X-Indexer-API-Token': token } : token ?? {}\n const httpClientWithRetry = new AlgoHttpClientWithRetry(tokenHeader, server, port)\n const indexer = new Indexer(httpClientWithRetry)\n // Use mixed int decoding by default so bigints don't have lost precision\n indexer.setIntEncoding(overrideIntDecoding ?? IntDecoding.MIXED)\n return indexer\n }\n\n /**\n * Returns an indexer SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).\n *\n * @param overrideIntDecoding Override the default int decoding for responses, uses MIXED by default to avoid lost precision for big integers\n * @example\n *\n * ```typescript\n * // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN\n * const indexer = ClientManager.getIndexerClientFromEnvironment()\n * await indexer.makeHealthCheck().do()\n * ```\n */\n public static getIndexerClientFromEnvironment(overrideIntDecoding?: IntDecoding): Indexer {\n return ClientManager.getIndexerClient(ClientManager.getIndexerConfigFromEnvironment(), overrideIntDecoding)\n }\n\n /**\n * Returns a KMD SDK client.\n *\n * KMD client allows you to export private keys, which is useful to (for instance) get the default account in a LocalNet network.\n *\n * @param config The config for the client\n * @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)\n * ```typescript\n * const kmd = ClientManager.getKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})\n * ```\n */\n public static getKmdClient(config: AlgoClientConfig): Kmd {\n const { token, server, port } = config\n return new Kmd(token as string, server, port)\n }\n\n /**\n * Returns a KMD SDK client that automatically retries on idempotent calls loaded from environment variables (expects to be called from a Node.js environment).\n *\n * @example\n * ```typescript\n * // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN\n * const kmd = ClientManager.getKmdClientFromEnvironment()\n * ```\n */\n public static getKmdClientFromEnvironment(): Kmd {\n // We can only use Kmd on the LocalNet otherwise it's not exposed so this makes some assumptions\n // (e.g. same token and server as algod and port 4002 by default)\n return ClientManager.getKmdClient({ ...ClientManager.getAlgodConfigFromEnvironment(), port: process?.env?.KMD_PORT ?? '4002' })\n }\n}\n\n/**\n * Interface to identify a typed client that can be used to interact with an application.\n */\nexport interface TypedAppClient<TClient> {\n new (params: Omit<AppClientParams, 'appSpec'>): TClient\n fromNetwork(params: Omit<AppClientParams, 'appId' | 'appSpec'>): Promise<TClient>\n fromCreatorAndName(params: Omit<ResolveAppClientByCreatorAndName, 'appSpec'>): Promise<TClient>\n}\n\n/**\n * Interface to identify a typed factory that can be used to create and deploy an application.\n */\nexport interface TypedAppFactory<TClient> {\n new (params: Omit<AppFactoryParams, 'appSpec'>): TClient\n}\n"],"names":["genesisIdIsLocalNet","TestNetDispenserApiClient","AppFactory","AppClient","AlgoHttpClientWithRetry"],"mappings":";;;;;;;;;AASA,IAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AACxB,IAAO,OAAO,GAAG,OAAO,CAAC,OA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