@algorandfoundation/algokit-utils 6.2.1 → 7.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (465) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -26
  3. package/account/account.d.ts +21 -11
  4. package/account/get-account-config-from-environment.d.ts +0 -1
  5. package/account/get-account.d.ts +6 -7
  6. package/account/get-dispenser-account.d.ts +2 -3
  7. package/account/index.d.ts +0 -1
  8. package/account/mnemonic-account.d.ts +1 -2
  9. package/amount.d.ts +41 -9
  10. package/app-client.d.ts +19 -5
  11. package/app-deploy.d.ts +18 -2
  12. package/app.d.ts +39 -3
  13. package/asset.d.ts +10 -1
  14. package/config.d.ts +0 -1
  15. package/debugging/debugging.d.ts +3 -5
  16. package/debugging/index.d.ts +0 -2
  17. package/dispenser-client.d.ts +1 -2
  18. package/index.d.ts +8 -6
  19. package/index.js +61 -48
  20. package/index.js.map +1 -1
  21. package/index.mjs +27 -24
  22. package/index.mjs.map +1 -1
  23. package/indexer-lookup.d.ts +10 -9
  24. package/localnet/get-kmd-wallet-account.d.ts +1 -2
  25. package/localnet/get-localnet-dispenser-account.d.ts +1 -2
  26. package/localnet/get-or-create-kmd-wallet-account.d.ts +2 -3
  27. package/localnet/index.d.ts +0 -1
  28. package/localnet/is-localnet.d.ts +1 -2
  29. package/network-client.d.ts +3 -10
  30. package/package.json +5 -5
  31. package/{account → src/account}/account.js +38 -15
  32. package/src/account/account.js.map +1 -0
  33. package/{account → src/account}/account.mjs +39 -16
  34. package/src/account/account.mjs.map +1 -0
  35. package/src/account/get-account-config-from-environment.js.map +1 -0
  36. package/src/account/get-account-config-from-environment.mjs.map +1 -0
  37. package/{account → src/account}/get-account.js +5 -5
  38. package/src/account/get-account.js.map +1 -0
  39. package/{account → src/account}/get-account.mjs +5 -5
  40. package/src/account/get-account.mjs.map +1 -0
  41. package/{account → src/account}/get-dispenser-account.js +3 -3
  42. package/src/account/get-dispenser-account.js.map +1 -0
  43. package/{account → src/account}/get-dispenser-account.mjs +3 -3
  44. package/src/account/get-dispenser-account.mjs.map +1 -0
  45. package/{account → src/account}/mnemonic-account.js +1 -1
  46. package/src/account/mnemonic-account.js.map +1 -0
  47. package/{account → src/account}/mnemonic-account.mjs +1 -1
  48. package/src/account/mnemonic-account.mjs.map +1 -0
  49. package/src/amount.js +61 -0
  50. package/src/amount.js.map +1 -0
  51. package/src/amount.mjs +54 -0
  52. package/src/amount.mjs.map +1 -0
  53. package/{app-client.js → src/app-client.js} +20 -5
  54. package/src/app-client.js.map +1 -0
  55. package/{app-client.mjs → src/app-client.mjs} +20 -5
  56. package/src/app-client.mjs.map +1 -0
  57. package/src/app-deploy.js +285 -0
  58. package/src/app-deploy.js.map +1 -0
  59. package/src/app-deploy.mjs +276 -0
  60. package/src/app-deploy.mjs.map +1 -0
  61. package/src/app.js +349 -0
  62. package/src/app.js.map +1 -0
  63. package/src/app.mjs +329 -0
  64. package/src/app.mjs.map +1 -0
  65. package/src/asset.js +142 -0
  66. package/src/asset.js.map +1 -0
  67. package/src/asset.mjs +136 -0
  68. package/src/asset.mjs.map +1 -0
  69. package/{config.js → src/config.js} +1 -1
  70. package/src/config.js.map +1 -0
  71. package/{config.mjs → src/config.mjs} +1 -1
  72. package/src/config.mjs.map +1 -0
  73. package/src/debugging/debugging.js +15 -0
  74. package/src/debugging/debugging.js.map +1 -0
  75. package/src/debugging/debugging.mjs +13 -0
  76. package/src/debugging/debugging.mjs.map +1 -0
  77. package/{dispenser-client.js → src/dispenser-client.js} +3 -3
  78. package/src/dispenser-client.js.map +1 -0
  79. package/{dispenser-client.mjs → src/dispenser-client.mjs} +3 -3
  80. package/src/dispenser-client.mjs.map +1 -0
  81. package/{indexer-lookup.js → src/indexer-lookup.js} +14 -10
  82. package/src/indexer-lookup.js.map +1 -0
  83. package/{indexer-lookup.mjs → src/indexer-lookup.mjs} +14 -10
  84. package/src/indexer-lookup.mjs.map +1 -0
  85. package/{localnet → src/localnet}/get-kmd-wallet-account.js +3 -3
  86. package/src/localnet/get-kmd-wallet-account.js.map +1 -0
  87. package/{localnet → src/localnet}/get-kmd-wallet-account.mjs +3 -3
  88. package/src/localnet/get-kmd-wallet-account.mjs.map +1 -0
  89. package/{localnet → src/localnet}/get-localnet-dispenser-account.js +3 -3
  90. package/src/localnet/get-localnet-dispenser-account.js.map +1 -0
  91. package/{localnet → src/localnet}/get-localnet-dispenser-account.mjs +3 -3
  92. package/src/localnet/get-localnet-dispenser-account.mjs.map +1 -0
  93. package/{localnet → src/localnet}/get-or-create-kmd-wallet-account.js +4 -4
  94. package/src/localnet/get-or-create-kmd-wallet-account.js.map +1 -0
  95. package/{localnet → src/localnet}/get-or-create-kmd-wallet-account.mjs +4 -4
  96. package/src/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -0
  97. package/{localnet → src/localnet}/is-localnet.js +2 -2
  98. package/src/localnet/is-localnet.js.map +1 -0
  99. package/{localnet → src/localnet}/is-localnet.mjs +2 -2
  100. package/src/localnet/is-localnet.mjs.map +1 -0
  101. package/{network-client.js → src/network-client.js} +5 -12
  102. package/src/network-client.js.map +1 -0
  103. package/{network-client.mjs → src/network-client.mjs} +5 -12
  104. package/src/network-client.mjs.map +1 -0
  105. package/{testing → src/testing}/account.js +16 -4
  106. package/src/testing/account.js.map +1 -0
  107. package/{testing → src/testing}/account.mjs +17 -5
  108. package/src/testing/account.mjs.map +1 -0
  109. package/src/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  110. package/src/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -0
  111. package/{testing → src/testing}/fixtures/algorand-fixture.js +18 -14
  112. package/src/testing/fixtures/algorand-fixture.js.map +1 -0
  113. package/{testing → src/testing}/fixtures/algorand-fixture.mjs +18 -14
  114. package/src/testing/fixtures/algorand-fixture.mjs.map +1 -0
  115. package/src/testing/indexer.js.map +1 -0
  116. package/src/testing/indexer.mjs.map +1 -0
  117. package/{testing → src/testing}/test-logger.js +7 -3
  118. package/src/testing/test-logger.js.map +1 -0
  119. package/{testing → src/testing}/test-logger.mjs +7 -3
  120. package/src/testing/test-logger.mjs.map +1 -0
  121. package/src/testing/transaction-logger.js.map +1 -0
  122. package/src/testing/transaction-logger.mjs.map +1 -0
  123. package/src/transaction/legacy-bridge.js +129 -0
  124. package/src/transaction/legacy-bridge.js.map +1 -0
  125. package/src/transaction/legacy-bridge.mjs +124 -0
  126. package/src/transaction/legacy-bridge.mjs.map +1 -0
  127. package/{transaction → src/transaction}/perform-atomic-transaction-composer-simulate.js +14 -9
  128. package/src/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -0
  129. package/{transaction → src/transaction}/perform-atomic-transaction-composer-simulate.mjs +15 -10
  130. package/src/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -0
  131. package/{transaction → src/transaction}/transaction.js +221 -141
  132. package/src/transaction/transaction.js.map +1 -0
  133. package/{transaction → src/transaction}/transaction.mjs +222 -142
  134. package/src/transaction/transaction.mjs.map +1 -0
  135. package/src/transfer/transfer-algos.js +31 -0
  136. package/src/transfer/transfer-algos.js.map +1 -0
  137. package/src/transfer/transfer-algos.mjs +29 -0
  138. package/src/transfer/transfer-algos.mjs.map +1 -0
  139. package/src/transfer/transfer.js +112 -0
  140. package/src/transfer/transfer.js.map +1 -0
  141. package/src/transfer/transfer.mjs +108 -0
  142. package/src/transfer/transfer.mjs.map +1 -0
  143. package/{util.js → src/util.js} +33 -7
  144. package/src/util.js.map +1 -0
  145. package/{util.mjs → src/util.mjs} +31 -7
  146. package/src/util.mjs.map +1 -0
  147. package/testing/_asset.d.ts +3 -5
  148. package/testing/account.d.ts +4 -4
  149. package/testing/fixtures/algokit-log-capture-fixture.d.ts +0 -1
  150. package/testing/fixtures/algorand-fixture.d.ts +1 -2
  151. package/testing/fixtures/index.d.ts +0 -1
  152. package/testing/index.d.ts +0 -1
  153. package/testing/index.js +6 -6
  154. package/testing/index.mjs +6 -6
  155. package/testing/indexer.d.ts +0 -1
  156. package/testing/test-logger.d.ts +0 -1
  157. package/testing/transaction-logger.d.ts +0 -1
  158. package/transaction/index.d.ts +0 -1
  159. package/transaction/legacy-bridge.d.ts +35 -0
  160. package/transaction/perform-atomic-transaction-composer-simulate.d.ts +4 -2
  161. package/transaction/transaction.d.ts +39 -20
  162. package/transfer/index.d.ts +0 -1
  163. package/transfer/transfer-algos.d.ts +4 -3
  164. package/transfer/transfer.d.ts +8 -2
  165. package/types/account-manager.d.ts +165 -40
  166. package/types/account-manager.js +255 -59
  167. package/types/account-manager.js.map +1 -1
  168. package/types/account-manager.mjs +255 -59
  169. package/types/account-manager.mjs.map +1 -1
  170. package/types/account.d.ts +137 -14
  171. package/types/account.js +2 -2
  172. package/types/account.js.map +1 -1
  173. package/types/account.mjs +3 -3
  174. package/types/account.mjs.map +1 -1
  175. package/types/algo-http-client-with-retry.d.ts +1 -3
  176. package/types/algo-http-client-with-retry.js +34 -4
  177. package/types/algo-http-client-with-retry.js.map +1 -1
  178. package/types/algo-http-client-with-retry.mjs +33 -3
  179. package/types/algo-http-client-with-retry.mjs.map +1 -1
  180. package/types/algorand-client-interface.d.ts +28 -0
  181. package/types/algorand-client-interface.js +3 -0
  182. package/types/algorand-client-interface.js.map +1 -0
  183. package/types/algorand-client-interface.mjs +2 -0
  184. package/types/algorand-client-interface.mjs.map +1 -0
  185. package/types/algorand-client-transaction-creator.d.ts +718 -0
  186. package/types/algorand-client-transaction-creator.js +683 -0
  187. package/types/algorand-client-transaction-creator.js.map +1 -0
  188. package/types/algorand-client-transaction-creator.mjs +681 -0
  189. package/types/algorand-client-transaction-creator.mjs.map +1 -0
  190. package/types/algorand-client-transaction-sender.d.ts +1158 -0
  191. package/types/algorand-client-transaction-sender.js +852 -0
  192. package/types/algorand-client-transaction-sender.js.map +1 -0
  193. package/types/algorand-client-transaction-sender.mjs +850 -0
  194. package/types/algorand-client-transaction-sender.mjs.map +1 -0
  195. package/types/algorand-client.d.ts +48 -91
  196. package/types/algorand-client.js +53 -132
  197. package/types/algorand-client.js.map +1 -1
  198. package/types/algorand-client.mjs +55 -131
  199. package/types/algorand-client.mjs.map +1 -1
  200. package/types/amount.d.ts +23 -12
  201. package/types/amount.js +33 -10
  202. package/types/amount.js.map +1 -1
  203. package/types/amount.mjs +33 -10
  204. package/types/amount.mjs.map +1 -1
  205. package/types/app-arc56.d.ts +359 -0
  206. package/types/app-arc56.js +184 -0
  207. package/types/app-arc56.js.map +1 -0
  208. package/types/app-arc56.mjs +175 -0
  209. package/types/app-arc56.mjs.map +1 -0
  210. package/types/app-client.d.ts +1511 -15
  211. package/types/app-client.js +1029 -43
  212. package/types/app-client.js.map +1 -1
  213. package/types/app-client.mjs +1030 -45
  214. package/types/app-client.mjs.map +1 -1
  215. package/types/app-deployer.d.ts +126 -0
  216. package/types/app-deployer.js +353 -0
  217. package/types/app-deployer.js.map +1 -0
  218. package/types/app-deployer.mjs +351 -0
  219. package/types/app-deployer.mjs.map +1 -0
  220. package/types/app-factory.d.ts +846 -0
  221. package/types/app-factory.js +410 -0
  222. package/types/app-factory.js.map +1 -0
  223. package/types/app-factory.mjs +408 -0
  224. package/types/app-factory.mjs.map +1 -0
  225. package/types/app-manager.d.ts +244 -0
  226. package/types/app-manager.js +423 -0
  227. package/types/app-manager.js.map +1 -0
  228. package/types/app-manager.mjs +421 -0
  229. package/types/app-manager.mjs.map +1 -0
  230. package/types/app-spec.d.ts +2 -1
  231. package/types/app-spec.js +127 -0
  232. package/types/app-spec.js.map +1 -1
  233. package/types/app-spec.mjs +126 -0
  234. package/types/app-spec.mjs.map +1 -1
  235. package/types/app.d.ts +57 -18
  236. package/types/app.js +1 -1
  237. package/types/app.js.map +1 -1
  238. package/types/app.mjs +1 -1
  239. package/types/app.mjs.map +1 -1
  240. package/types/asset-manager.d.ts +205 -0
  241. package/types/asset-manager.js +176 -0
  242. package/types/asset-manager.js.map +1 -0
  243. package/types/asset-manager.mjs +174 -0
  244. package/types/asset-manager.mjs.map +1 -0
  245. package/types/asset.d.ts +4 -5
  246. package/types/async-event-emitter.d.ts +14 -0
  247. package/types/async-event-emitter.js +50 -0
  248. package/types/async-event-emitter.js.map +1 -0
  249. package/types/async-event-emitter.mjs +48 -0
  250. package/types/async-event-emitter.mjs.map +1 -0
  251. package/types/client-manager.d.ts +171 -58
  252. package/types/client-manager.js +198 -43
  253. package/types/client-manager.js.map +1 -1
  254. package/types/client-manager.mjs +199 -44
  255. package/types/client-manager.mjs.map +1 -1
  256. package/types/composer.d.ts +474 -132
  257. package/types/composer.js +461 -167
  258. package/types/composer.js.map +1 -1
  259. package/types/composer.mjs +461 -168
  260. package/types/composer.mjs.map +1 -1
  261. package/types/config.d.ts +3 -6
  262. package/types/config.js +5 -44
  263. package/types/config.js.map +1 -1
  264. package/types/config.mjs +5 -27
  265. package/types/config.mjs.map +1 -1
  266. package/types/debugging.d.ts +29 -101
  267. package/types/debugging.js +16 -109
  268. package/types/debugging.js.map +1 -1
  269. package/types/debugging.mjs +12 -107
  270. package/types/debugging.mjs.map +1 -1
  271. package/types/dispenser-client.d.ts +14 -6
  272. package/types/dispenser-client.js +19 -14
  273. package/types/dispenser-client.js.map +1 -1
  274. package/types/dispenser-client.mjs +19 -14
  275. package/types/dispenser-client.mjs.map +1 -1
  276. package/types/expand.d.ts +7 -0
  277. package/types/expand.js +3 -0
  278. package/types/expand.js.map +1 -0
  279. package/types/expand.mjs +2 -0
  280. package/types/expand.mjs.map +1 -0
  281. package/types/indexer.d.ts +74 -756
  282. package/types/indexer.js.map +1 -1
  283. package/types/indexer.mjs.map +1 -1
  284. package/types/kmd-account-manager.d.ts +5 -6
  285. package/types/kmd-account-manager.js +9 -9
  286. package/types/kmd-account-manager.js.map +1 -1
  287. package/types/kmd-account-manager.mjs +10 -10
  288. package/types/kmd-account-manager.mjs.map +1 -1
  289. package/types/lifecycle-events.d.ts +10 -0
  290. package/types/lifecycle-events.js +8 -0
  291. package/types/lifecycle-events.js.map +1 -0
  292. package/types/lifecycle-events.mjs +8 -0
  293. package/types/lifecycle-events.mjs.map +1 -0
  294. package/types/logging.d.ts +0 -1
  295. package/types/logging.js.map +1 -1
  296. package/types/logging.mjs.map +1 -1
  297. package/types/logic-error.d.ts +2 -4
  298. package/types/logic-error.js +3 -3
  299. package/types/logic-error.js.map +1 -1
  300. package/types/logic-error.mjs +3 -3
  301. package/types/logic-error.mjs.map +1 -1
  302. package/types/network-client.d.ts +21 -3
  303. package/types/network-client.js +10 -0
  304. package/types/network-client.js.map +1 -1
  305. package/types/network-client.mjs +9 -0
  306. package/types/network-client.mjs.map +1 -1
  307. package/types/testing.d.ts +9 -11
  308. package/types/transaction.d.ts +17 -4
  309. package/types/transfer.d.ts +8 -8
  310. package/util.d.ts +15 -2
  311. package/account/account.d.ts.map +0 -1
  312. package/account/account.js.map +0 -1
  313. package/account/account.mjs.map +0 -1
  314. package/account/get-account-config-from-environment.d.ts.map +0 -1
  315. package/account/get-account-config-from-environment.js.map +0 -1
  316. package/account/get-account-config-from-environment.mjs.map +0 -1
  317. package/account/get-account.d.ts.map +0 -1
  318. package/account/get-account.js.map +0 -1
  319. package/account/get-account.mjs.map +0 -1
  320. package/account/get-dispenser-account.d.ts.map +0 -1
  321. package/account/get-dispenser-account.js.map +0 -1
  322. package/account/get-dispenser-account.mjs.map +0 -1
  323. package/account/index.d.ts.map +0 -1
  324. package/account/mnemonic-account.d.ts.map +0 -1
  325. package/account/mnemonic-account.js.map +0 -1
  326. package/account/mnemonic-account.mjs.map +0 -1
  327. package/amount.d.ts.map +0 -1
  328. package/amount.js +0 -34
  329. package/amount.js.map +0 -1
  330. package/amount.mjs +0 -30
  331. package/amount.mjs.map +0 -1
  332. package/app-client.d.ts.map +0 -1
  333. package/app-client.js.map +0 -1
  334. package/app-client.mjs.map +0 -1
  335. package/app-deploy.d.ts.map +0 -1
  336. package/app-deploy.js +0 -468
  337. package/app-deploy.js.map +0 -1
  338. package/app-deploy.mjs +0 -459
  339. package/app-deploy.mjs.map +0 -1
  340. package/app.d.ts.map +0 -1
  341. package/app.js +0 -599
  342. package/app.js.map +0 -1
  343. package/app.mjs +0 -579
  344. package/app.mjs.map +0 -1
  345. package/asset.d.ts.map +0 -1
  346. package/asset.js +0 -272
  347. package/asset.js.map +0 -1
  348. package/asset.mjs +0 -266
  349. package/asset.mjs.map +0 -1
  350. package/config.d.ts.map +0 -1
  351. package/config.js.map +0 -1
  352. package/config.mjs.map +0 -1
  353. package/debugging/debugging.d.ts.map +0 -1
  354. package/debugging/debugging.js +0 -139
  355. package/debugging/debugging.js.map +0 -1
  356. package/debugging/debugging.mjs +0 -118
  357. package/debugging/debugging.mjs.map +0 -1
  358. package/debugging/index.d.ts.map +0 -1
  359. package/debugging/simulate-and-persist-response.d.ts +0 -20
  360. package/debugging/simulate-and-persist-response.d.ts.map +0 -1
  361. package/debugging/simulate-and-persist-response.js +0 -108
  362. package/debugging/simulate-and-persist-response.js.map +0 -1
  363. package/debugging/simulate-and-persist-response.mjs +0 -89
  364. package/debugging/simulate-and-persist-response.mjs.map +0 -1
  365. package/dispenser-client.d.ts.map +0 -1
  366. package/dispenser-client.js.map +0 -1
  367. package/dispenser-client.mjs.map +0 -1
  368. package/index.d.ts.map +0 -1
  369. package/indexer-lookup.d.ts.map +0 -1
  370. package/indexer-lookup.js.map +0 -1
  371. package/indexer-lookup.mjs.map +0 -1
  372. package/localnet/get-kmd-wallet-account.d.ts.map +0 -1
  373. package/localnet/get-kmd-wallet-account.js.map +0 -1
  374. package/localnet/get-kmd-wallet-account.mjs.map +0 -1
  375. package/localnet/get-localnet-dispenser-account.d.ts.map +0 -1
  376. package/localnet/get-localnet-dispenser-account.js.map +0 -1
  377. package/localnet/get-localnet-dispenser-account.mjs.map +0 -1
  378. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +0 -1
  379. package/localnet/get-or-create-kmd-wallet-account.js.map +0 -1
  380. package/localnet/get-or-create-kmd-wallet-account.mjs.map +0 -1
  381. package/localnet/index.d.ts.map +0 -1
  382. package/localnet/is-localnet.d.ts.map +0 -1
  383. package/localnet/is-localnet.js.map +0 -1
  384. package/localnet/is-localnet.mjs.map +0 -1
  385. package/network-client.d.ts.map +0 -1
  386. package/network-client.js.map +0 -1
  387. package/network-client.mjs.map +0 -1
  388. package/testing/_asset.d.ts.map +0 -1
  389. package/testing/account.d.ts.map +0 -1
  390. package/testing/account.js.map +0 -1
  391. package/testing/account.mjs.map +0 -1
  392. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
  393. package/testing/fixtures/algokit-log-capture-fixture.js.map +0 -1
  394. package/testing/fixtures/algokit-log-capture-fixture.mjs.map +0 -1
  395. package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
  396. package/testing/fixtures/algorand-fixture.js.map +0 -1
  397. package/testing/fixtures/algorand-fixture.mjs.map +0 -1
  398. package/testing/fixtures/index.d.ts.map +0 -1
  399. package/testing/index.d.ts.map +0 -1
  400. package/testing/indexer.d.ts.map +0 -1
  401. package/testing/indexer.js.map +0 -1
  402. package/testing/indexer.mjs.map +0 -1
  403. package/testing/test-logger.d.ts.map +0 -1
  404. package/testing/test-logger.js.map +0 -1
  405. package/testing/test-logger.mjs.map +0 -1
  406. package/testing/transaction-logger.d.ts.map +0 -1
  407. package/testing/transaction-logger.js.map +0 -1
  408. package/testing/transaction-logger.mjs.map +0 -1
  409. package/transaction/index.d.ts.map +0 -1
  410. package/transaction/perform-atomic-transaction-composer-simulate.d.ts.map +0 -1
  411. package/transaction/perform-atomic-transaction-composer-simulate.js.map +0 -1
  412. package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +0 -1
  413. package/transaction/transaction.d.ts.map +0 -1
  414. package/transaction/transaction.js.map +0 -1
  415. package/transaction/transaction.mjs.map +0 -1
  416. package/transfer/index.d.ts.map +0 -1
  417. package/transfer/transfer-algos.d.ts.map +0 -1
  418. package/transfer/transfer-algos.js +0 -40
  419. package/transfer/transfer-algos.js.map +0 -1
  420. package/transfer/transfer-algos.mjs +0 -38
  421. package/transfer/transfer-algos.mjs.map +0 -1
  422. package/transfer/transfer.d.ts.map +0 -1
  423. package/transfer/transfer.js +0 -147
  424. package/transfer/transfer.js.map +0 -1
  425. package/transfer/transfer.mjs +0 -143
  426. package/transfer/transfer.mjs.map +0 -1
  427. package/types/account-manager.d.ts.map +0 -1
  428. package/types/account.d.ts.map +0 -1
  429. package/types/algo-http-client-with-retry.d.ts.map +0 -1
  430. package/types/algorand-client.d.ts.map +0 -1
  431. package/types/amount.d.ts.map +0 -1
  432. package/types/app-client.d.ts.map +0 -1
  433. package/types/app-spec.d.ts.map +0 -1
  434. package/types/app.d.ts.map +0 -1
  435. package/types/asset.d.ts.map +0 -1
  436. package/types/client-manager.d.ts.map +0 -1
  437. package/types/composer.d.ts.map +0 -1
  438. package/types/config.d.ts.map +0 -1
  439. package/types/debugging.d.ts.map +0 -1
  440. package/types/dispenser-client.d.ts.map +0 -1
  441. package/types/indexer.d.ts.map +0 -1
  442. package/types/kmd-account-manager.d.ts.map +0 -1
  443. package/types/logging.d.ts.map +0 -1
  444. package/types/logic-error.d.ts.map +0 -1
  445. package/types/network-client.d.ts.map +0 -1
  446. package/types/testing.d.ts.map +0 -1
  447. package/types/transaction.d.ts.map +0 -1
  448. package/types/transfer.d.ts.map +0 -1
  449. package/types/urlTokenBaseHTTPClient.d.ts +0 -41
  450. package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
  451. package/types/urlTokenBaseHTTPClient.js +0 -153
  452. package/types/urlTokenBaseHTTPClient.js.map +0 -1
  453. package/types/urlTokenBaseHTTPClient.mjs +0 -151
  454. package/types/urlTokenBaseHTTPClient.mjs.map +0 -1
  455. package/util.d.ts.map +0 -1
  456. package/util.js.map +0 -1
  457. package/util.mjs.map +0 -1
  458. /package/{account → src/account}/get-account-config-from-environment.js +0 -0
  459. /package/{account → src/account}/get-account-config-from-environment.mjs +0 -0
  460. /package/{testing → src/testing}/fixtures/algokit-log-capture-fixture.js +0 -0
  461. /package/{testing → src/testing}/fixtures/algokit-log-capture-fixture.mjs +0 -0
  462. /package/{testing → src/testing}/indexer.js +0 -0
  463. /package/{testing → src/testing}/indexer.mjs +0 -0
  464. /package/{testing → src/testing}/transaction-logger.js +0 -0
  465. /package/{testing → src/testing}/transaction-logger.mjs +0 -0
@@ -1,5 +1,11 @@
1
- import algosdk from 'algosdk';
2
- import AccountInformationModel = algosdk.modelsv2.Account;
1
+ import algosdk, { Address } from 'algosdk';
2
+ import { AlgoAmount } from './amount';
3
+ import ApplicationLocalState = algosdk.modelsv2.ApplicationLocalState;
4
+ import ApplicationStateSchema = algosdk.modelsv2.ApplicationStateSchema;
5
+ import AssetHolding = algosdk.modelsv2.AssetHolding;
6
+ import Application = algosdk.modelsv2.Application;
7
+ import Asset = algosdk.modelsv2.Asset;
8
+ import AccountParticipation = algosdk.modelsv2.AccountParticipation;
3
9
  import Account = algosdk.Account;
4
10
  import MultisigMetadata = algosdk.MultisigMetadata;
5
11
  import Transaction = algosdk.Transaction;
@@ -12,14 +18,14 @@ export declare const DISPENSER_ACCOUNT = "DISPENSER";
12
18
  export declare class MultisigAccount {
13
19
  _params: algosdk.MultisigMetadata;
14
20
  _signingAccounts: (algosdk.Account | SigningAccount)[];
15
- _addr: string;
21
+ _addr: Address;
16
22
  _signer: TransactionSigner;
17
23
  /** The parameters for the multisig account */
18
24
  get params(): Readonly<algosdk.MultisigMetadata>;
19
25
  /** The list of accounts that are present to sign */
20
26
  get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]>;
21
27
  /** The address of the multisig account */
22
- get addr(): Readonly<string>;
28
+ get addr(): Readonly<Address>;
23
29
  get signer(): TransactionSigner;
24
30
  constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]);
25
31
  /**
@@ -37,7 +43,7 @@ export declare class SigningAccount implements Account {
37
43
  /**
38
44
  * Algorand address of the sender
39
45
  */
40
- get addr(): Readonly<string>;
46
+ get addr(): Readonly<Address>;
41
47
  /**
42
48
  * Secret key belonging to the signer
43
49
  */
@@ -50,19 +56,138 @@ export declare class SigningAccount implements Account {
50
56
  * Algorand account of the sender address and signer private key
51
57
  */
52
58
  get sender(): Account;
53
- constructor(account: Account, sender: string | undefined);
59
+ constructor(account: Account, sender: string | Address | undefined);
54
60
  }
55
61
  /** A wrapper around `TransactionSigner` that also has the sender address. */
56
62
  export interface TransactionSignerAccount {
57
- addr: Readonly<string>;
63
+ addr: Readonly<Address>;
58
64
  signer: TransactionSigner;
59
65
  }
60
- type NumberConverter<T extends AccountInformationModel> = {
61
- [key in keyof T]: ToNumberIfExtends<T[key], number | bigint>;
62
- };
63
- type ToNumberIfExtends<K, E> = K extends E ? number : K;
64
66
  /** Account information at a given round. */
65
- export type AccountInformation = Omit<NumberConverter<AccountInformationModel>, 'get_obj_for_encoding'>;
67
+ export type AccountInformation = {
68
+ /**
69
+ * The account public key
70
+ */
71
+ address: Address;
72
+ /** The balance of Algo currently held by the account. */
73
+ balance: AlgoAmount;
74
+ /**
75
+ * The amount of Algo in the account, without the pending rewards.
76
+ */
77
+ amountWithoutPendingRewards: AlgoAmount;
78
+ /**
79
+ * Algo balance required to be held by the account.
80
+ *
81
+ * The requirement grows based on asset and application usage.
82
+ */
83
+ minBalance: AlgoAmount;
84
+ /**
85
+ * Amount of Algo of pending rewards in this account.
86
+ */
87
+ pendingRewards: AlgoAmount;
88
+ /**
89
+ * Total rewards of Algo the account has received, including pending
90
+ * rewards.
91
+ */
92
+ rewards: AlgoAmount;
93
+ /**
94
+ * The round number for which this information is relevant.
95
+ */
96
+ validAsOfRound: bigint;
97
+ /**
98
+ * Delegation status of the account's Algo:
99
+ * * Offline - indicates that the associated account is delegated.
100
+ * * Online - indicates that the associated account used as part of the delegation pool.
101
+ * * NotParticipating - indicates that the associated account is neither a delegator nor a delegate.
102
+ */
103
+ status: string;
104
+ /**
105
+ * The count of all applications that have been opted in, equivalent to the count
106
+ * of application local data (AppLocalState objects) stored in this account.
107
+ */
108
+ totalAppsOptedIn: number;
109
+ /**
110
+ * The count of all assets that have been opted in, equivalent to the count of
111
+ * AssetHolding objects held by this account.
112
+ */
113
+ totalAssetsOptedIn: number;
114
+ /**
115
+ * The count of all apps (AppParams objects) created by this account.
116
+ */
117
+ totalCreatedApps: number;
118
+ /**
119
+ * The count of all assets (AssetParams objects) created by this account.
120
+ */
121
+ totalCreatedAssets: number;
122
+ /**
123
+ * Applications local data stored in this account.
124
+ */
125
+ appsLocalState?: ApplicationLocalState[];
126
+ /**
127
+ * The sum of all extra application program pages for this account.
128
+ */
129
+ appsTotalExtraPages?: number;
130
+ /**
131
+ * (tsch) stores the sum of all of the local schemas and global schemas in this
132
+ * account.
133
+ * Note: the raw account uses `StateSchema` for this type.
134
+ */
135
+ appsTotalSchema?: ApplicationStateSchema;
136
+ /**
137
+ * Assets held by this account.
138
+ */
139
+ assets?: AssetHolding[];
140
+ /**
141
+ * The address against which signing should be checked. If empty, the
142
+ * address of the current account is used. This field can be updated in any
143
+ * transaction by setting the `RekeyTo` field.
144
+ */
145
+ authAddress?: Address;
146
+ /**
147
+ * Parameters of applications created by this account including app global data.
148
+ */
149
+ createdApps?: Application[];
150
+ /**
151
+ * (apar) parameters of assets created by this account.
152
+ * Note: the raw account uses `map[int] -> Asset` for this type.
153
+ */
154
+ createdAssets?: Asset[];
155
+ /**
156
+ * AccountParticipation describes the parameters used by this account in consensus
157
+ * protocol.
158
+ */
159
+ participation?: AccountParticipation;
160
+ /**
161
+ * Used as part of the rewards computation. Only applicable to accounts
162
+ * which are participating.
163
+ */
164
+ rewardBase?: number;
165
+ /**
166
+ * Indicates what type of signature is used by this account, must be one of:
167
+ * * sig
168
+ * * msig
169
+ * * lsig
170
+ */
171
+ sigType?: string;
172
+ /**
173
+ * The total number of bytes used by this account's app's box keys and
174
+ * values.
175
+ */
176
+ totalBoxBytes?: number;
177
+ /**
178
+ * The number of existing boxes created by this account's app.
179
+ */
180
+ totalBoxes?: number;
181
+ /**
182
+ * The round in which this account last went online, or explicitly renewed their
183
+ * online status.
184
+ */
185
+ lastHeartbeatRound?: bigint;
186
+ /**
187
+ * The round in which this account last proposed the block.
188
+ */
189
+ lastProposedRound?: bigint;
190
+ };
66
191
  /** Account asset holding information at a given round. */
67
192
  export type AccountAssetInformation = {
68
193
  /** The ID of the asset held. */
@@ -87,5 +212,3 @@ export interface AccountConfig {
87
212
  /** @deprecated Renamed to senderAddress in 2.3.1 */
88
213
  senderMnemonic?: string;
89
214
  }
90
- export {};
91
- //# sourceMappingURL=account.d.ts.map
package/types/account.js CHANGED
@@ -35,7 +35,7 @@ class MultisigAccount {
35
35
  * @returns The transaction signed by the present signers
36
36
  */
37
37
  sign(transaction) {
38
- let signedTxn = 'from' in transaction ? undefined : transaction;
38
+ let signedTxn = 'sender' in transaction ? undefined : transaction;
39
39
  for (const signer of this._signingAccounts) {
40
40
  if (signedTxn) {
41
41
  signedTxn = algosdk.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob;
@@ -79,7 +79,7 @@ class SigningAccount {
79
79
  }
80
80
  constructor(account, sender) {
81
81
  this._account = account;
82
- this._sender = sender ?? account.addr;
82
+ this._sender = typeof sender === 'string' ? algosdk.Address.fromString(sender) : (sender ?? account.addr);
83
83
  this._signer = algosdk.makeBasicAccountTransactionSigner(account);
84
84
  }
85
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"account.js","sources":["../../src/types/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAOA;;AAEG;AACI,MAAM,iBAAiB,GAAG,YAAW;AAE5C;MACa,eAAe,CAAA;;AAO1B,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;;AAGD,IAAA,IAAI,eAAe,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;KAC7B;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;KAClB;AAED,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;IAED,WAAY,CAAA,cAAgC,E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YACL,IAAI,EAAE,IAAI,CAAC,OAAO;AAClB,YAAA,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;SACrB,CAAA;KACF;IAED,WAAY,CAAA,OAAgB,EAAE,MAA0B,EAAA;AACtD,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;KAClE;AACF;;;;;;"}
1
+ {"version":3,"file":"account.js","sources":["../../src/types/account.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgoAmount } from './amount'\nimport ApplicationLocalState = algosdk.modelsv2.ApplicationLocalState\nimport ApplicationStateSchema = algosdk.modelsv2.ApplicationStateSchema\nimport AssetHolding = algosdk.modelsv2.AssetHolding\nimport Application = algosdk.modelsv2.Application\nimport Asset = algosdk.modelsv2.Asset\nimport AccountParticipation = algosdk.modelsv2.AccountParticipation\nimport Account = algosdk.Account\nimport MultisigMetadata = algosdk.MultisigMetadata\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\n\n/**\n * The account name identifier used for fund dispensing in test environments\n */\nexport const DISPENSER_ACCOUNT = 'DISPENSER'\n\n/** Account wrapper that supports partial or full multisig signing. */\nexport class MultisigAccount {\n _params: algosdk.MultisigMetadata\n _signingAccounts: (algosdk.Account | SigningAccount)[]\n _addr: Address\n _signer: TransactionSigner\n\n /** The parameters for the multisig account */\n get params(): Readonly<algosdk.MultisigMetadata> {\n return this._params\n }\n\n /** The list of accounts that are present to sign */\n get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]> {\n return this._signingAccounts\n }\n\n /** The address of the multisig account */\n get addr(): Readonly<Address> {\n return this._addr\n }\n\n get signer(): TransactionSigner {\n return this._signer\n }\n\n constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]) {\n this._params = multisigParams\n this._signingAccounts = signingAccounts\n this._addr = algosdk.multisigAddress(multisigParams)\n this._signer = algosdk.makeMultiSigAccountTransactionSigner(\n multisigParams,\n signingAccounts.map((a) => a.sk),\n )\n }\n\n /**\n * Sign the given transaction\n * @param transaction Either a transaction object or a raw, partially signed transaction\n * @returns The transaction signed by the present signers\n */\n public sign(transaction: Transaction | Uint8Array): Uint8Array {\n let signedTxn = 'sender' in transaction ? undefined : transaction\n for (const signer of this._signingAccounts) {\n if (signedTxn) {\n signedTxn = algosdk.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob\n } else {\n signedTxn = algosdk.signMultisigTransaction(transaction as Transaction, this._params, signer.sk).blob\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return signedTxn!\n }\n}\n\n/** Account wrapper that supports a rekeyed account */\nexport class SigningAccount implements Account {\n private _account: Account\n private _signer: TransactionSigner\n private _sender: Address\n\n /**\n * Algorand address of the sender\n */\n get addr(): Readonly<Address> {\n return this._sender\n }\n\n /**\n * Secret key belonging to the signer\n */\n get sk(): Readonly<Uint8Array> {\n return this._account.sk\n }\n\n /**\n * Transaction signer for the underlying signing account\n */\n get signer(): TransactionSigner {\n return this._signer\n }\n\n /**\n * Algorand account of the sender address and signer private key\n */\n get sender(): Account {\n return {\n addr: this._sender,\n sk: this._account.sk,\n }\n }\n\n constructor(account: Account, sender: string | Address | undefined) {\n this._account = account\n this._sender = typeof sender === 'string' ? Address.fromString(sender) : (sender ?? account.addr)\n this._signer = algosdk.makeBasicAccountTransactionSigner(account)\n }\n}\n\n/** A wrapper around `TransactionSigner` that also has the sender address. */\nexport interface TransactionSignerAccount {\n addr: Readonly<Address>\n signer: TransactionSigner\n}\n\n/** Account information at a given round. */\nexport type AccountInformation = {\n /**\n * The account public key\n */\n address: Address\n\n /** The balance of Algo currently held by the account. */\n balance: AlgoAmount\n\n /**\n * The amount of Algo in the account, without the pending rewards.\n */\n amountWithoutPendingRewards: AlgoAmount\n\n /**\n * Algo balance required to be held by the account.\n *\n * The requirement grows based on asset and application usage.\n */\n minBalance: AlgoAmount\n /**\n * Amount of Algo of pending rewards in this account.\n */\n pendingRewards: AlgoAmount\n\n /**\n * Total rewards of Algo the account has received, including pending\n * rewards.\n */\n rewards: AlgoAmount\n\n /**\n * The round number for which this information is relevant.\n */\n validAsOfRound: bigint\n\n /**\n * Delegation status of the account's Algo:\n * * Offline - indicates that the associated account is delegated.\n * * Online - indicates that the associated account used as part of the delegation pool.\n * * NotParticipating - indicates that the associated account is neither a delegator nor a delegate.\n */\n status: string\n\n /**\n * The count of all applications that have been opted in, equivalent to the count\n * of application local data (AppLocalState objects) stored in this account.\n */\n totalAppsOptedIn: number\n\n /**\n * The count of all assets that have been opted in, equivalent to the count of\n * AssetHolding objects held by this account.\n */\n totalAssetsOptedIn: number\n\n /**\n * The count of all apps (AppParams objects) created by this account.\n */\n totalCreatedApps: number\n\n /**\n * The count of all assets (AssetParams objects) created by this account.\n */\n totalCreatedAssets: number\n\n /**\n * Applications local data stored in this account.\n */\n appsLocalState?: ApplicationLocalState[]\n\n /**\n * The sum of all extra application program pages for this account.\n */\n appsTotalExtraPages?: number\n /**\n * (tsch) stores the sum of all of the local schemas and global schemas in this\n * account.\n * Note: the raw account uses `StateSchema` for this type.\n */\n appsTotalSchema?: ApplicationStateSchema\n\n /**\n * Assets held by this account.\n */\n assets?: AssetHolding[]\n\n /**\n * The address against which signing should be checked. If empty, the\n * address of the current account is used. This field can be updated in any\n * transaction by setting the `RekeyTo` field.\n */\n authAddress?: Address\n\n /**\n * Parameters of applications created by this account including app global data.\n */\n createdApps?: Application[]\n\n /**\n * (apar) parameters of assets created by this account.\n * Note: the raw account uses `map[int] -> Asset` for this type.\n */\n createdAssets?: Asset[]\n\n /**\n * AccountParticipation describes the parameters used by this account in consensus\n * protocol.\n */\n participation?: AccountParticipation\n\n /**\n * Used as part of the rewards computation. Only applicable to accounts\n * which are participating.\n */\n rewardBase?: number\n\n /**\n * Indicates what type of signature is used by this account, must be one of:\n * * sig\n * * msig\n * * lsig\n */\n sigType?: string\n\n /**\n * The total number of bytes used by this account's app's box keys and\n * values.\n */\n totalBoxBytes?: number\n\n /**\n * The number of existing boxes created by this account's app.\n */\n totalBoxes?: number\n\n /**\n * The round in which this account last went online, or explicitly renewed their\n * online status.\n */\n lastHeartbeatRound?: bigint\n\n /**\n * The round in which this account last proposed the block.\n */\n lastProposedRound?: bigint\n}\n\n/** Account asset holding information at a given round. */\nexport type AccountAssetInformation = {\n /** The ID of the asset held. */\n assetId: bigint\n /** The current balance of that asset holding. */\n balance: bigint\n /** Whether or not the asset is frozen for the account. */\n frozen: boolean\n /** The round as at which the holding was correct. */\n round: bigint\n}\n\n/**\n * @deprecated The methods that use this can be achieved using `AccountManager` instead.\n * Config for an account config */\nexport interface AccountConfig {\n /** Mnemonic for an account */\n accountMnemonic: string\n /** Address of a rekeyed account */\n senderAddress?: string\n /** Account name used to retrieve config */\n accountName: string\n\n /** @deprecated Renamed to senderAddress in 2.3.1 */\n senderMnemonic?: string\n}\n"],"names":["Address"],"mappings":";;;;AAaA;;AAEG;AACI,MAAM,iBAAiB,GAAG,YAAW;AAE5C;MACa,eAAe,CAAA;;AAO1B,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;;AAGD,IAAA,IAAI,eAAe,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;KAC7B;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;KAClB;AAED,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;IAED,WAAY,CAAA,cAAgC,EAAE,eAA6C,EAAA;AACzF,QAAA,IAAI,CAAC,OAAO,GAAG,cAAc,CAAA;AAC7B,QAAA,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAA;QACvC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,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A,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAGA,eAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;QACjG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;KAClE;AACF;;;;;;"}
package/types/account.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import algosdk from 'algosdk';
1
+ import algosdk, { Address } from 'algosdk';
2
2
 
3
3
  /**
4
4
  * The account name identifier used for fund dispensing in test environments
@@ -33,7 +33,7 @@ class MultisigAccount {
33
33
  * @returns The transaction signed by the present signers
34
34
  */
35
35
  sign(transaction) {
36
- let signedTxn = 'from' in transaction ? undefined : transaction;
36
+ let signedTxn = 'sender' in transaction ? undefined : transaction;
37
37
  for (const signer of this._signingAccounts) {
38
38
  if (signedTxn) {
39
39
  signedTxn = algosdk.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob;
@@ -77,7 +77,7 @@ class SigningAccount {
77
77
  }
78
78
  constructor(account, sender) {
79
79
  this._account = account;
80
- this._sender = sender ?? account.addr;
80
+ this._sender = typeof sender === 'string' ? Address.fromString(sender) : (sender ?? account.addr);
81
81
  this._signer = algosdk.makeBasicAccountTransactionSigner(account);
82
82
  }
83
83
  }
@@ -1 +1 @@
1
- {"version":3,"file":"account.mjs","sources":["../../src/types/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAOA;;AAEG;AACI,MAAM,iBAAiB,GAAG,YAAW;AAE5C;MACa,eAAe,CAAA;;AAO1B,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;;AAGD,IAAA,IAAI,eAAe,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;KAC7B;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAA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AAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;AAED;;AAEG;AACH,IAAA,IAAI,MAAM,GAAA;QACR,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,OAAO;AAClB,YAAA,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;SACrB,CAAA;KACF;IAED,WAAY,CAAA,OAAgB,EAAE,MAA0B,EAAA;AACtD,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAA;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;KAClE;AACF;;;;"}
1
+ {"version":3,"file":"account.mjs","sources":["../../src/types/account.ts"],"sourcesContent":["import algosdk, { Address } from 'algosdk'\nimport { AlgoAmount } from './amount'\nimport ApplicationLocalState = algosdk.modelsv2.ApplicationLocalState\nimport ApplicationStateSchema = algosdk.modelsv2.ApplicationStateSchema\nimport AssetHolding = algosdk.modelsv2.AssetHolding\nimport Application = algosdk.modelsv2.Application\nimport Asset = algosdk.modelsv2.Asset\nimport AccountParticipation = algosdk.modelsv2.AccountParticipation\nimport Account = algosdk.Account\nimport MultisigMetadata = algosdk.MultisigMetadata\nimport Transaction = algosdk.Transaction\nimport TransactionSigner = algosdk.TransactionSigner\n\n/**\n * The account name identifier used for fund dispensing in test environments\n */\nexport const DISPENSER_ACCOUNT = 'DISPENSER'\n\n/** Account wrapper that supports partial or full multisig signing. */\nexport class MultisigAccount {\n _params: algosdk.MultisigMetadata\n _signingAccounts: (algosdk.Account | SigningAccount)[]\n _addr: Address\n _signer: TransactionSigner\n\n /** The parameters for the multisig account */\n get params(): Readonly<algosdk.MultisigMetadata> {\n return this._params\n }\n\n /** The list of accounts that are present to sign */\n get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]> {\n return this._signingAccounts\n }\n\n /** The address of the multisig account */\n get addr(): Readonly<Address> {\n return this._addr\n }\n\n get signer(): TransactionSigner {\n return this._signer\n }\n\n constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]) {\n this._params = multisigParams\n this._signingAccounts = signingAccounts\n this._addr = algosdk.multisigAddress(multisigParams)\n this._signer = algosdk.makeMultiSigAccountTransactionSigner(\n multisigParams,\n signingAccounts.map((a) => a.sk),\n )\n }\n\n /**\n * Sign the given transaction\n * @param transaction Either a transaction object or a raw, partially signed transaction\n * @returns The transaction signed by the present signers\n */\n public sign(transaction: Transaction | Uint8Array): Uint8Array {\n let signedTxn = 'sender' in transaction ? undefined : transaction\n for (const signer of this._signingAccounts) {\n if (signedTxn) {\n signedTxn = algosdk.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob\n } else {\n signedTxn = algosdk.signMultisigTransaction(transaction as Transaction, this._params, signer.sk).blob\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return signedTxn!\n }\n}\n\n/** Account wrapper that supports a rekeyed account */\nexport class SigningAccount implements Account {\n private _account: Account\n private _signer: TransactionSigner\n private _sender: Address\n\n /**\n * Algorand address of the sender\n */\n get addr(): Readonly<Address> {\n return this._sender\n }\n\n /**\n * Secret key belonging to the signer\n */\n get sk(): Readonly<Uint8Array> {\n return this._account.sk\n }\n\n /**\n * Transaction signer for the underlying signing account\n */\n get signer(): TransactionSigner {\n return this._signer\n }\n\n /**\n * Algorand account of the sender address and signer private key\n */\n get sender(): Account {\n return {\n addr: this._sender,\n sk: this._account.sk,\n }\n }\n\n constructor(account: Account, sender: string | Address | undefined) {\n this._account = account\n this._sender = typeof sender === 'string' ? Address.fromString(sender) : (sender ?? account.addr)\n this._signer = algosdk.makeBasicAccountTransactionSigner(account)\n }\n}\n\n/** A wrapper around `TransactionSigner` that also has the sender address. */\nexport interface TransactionSignerAccount {\n addr: Readonly<Address>\n signer: TransactionSigner\n}\n\n/** Account information at a given round. */\nexport type AccountInformation = {\n /**\n * The account public key\n */\n address: Address\n\n /** The balance of Algo currently held by the account. */\n balance: AlgoAmount\n\n /**\n * The amount of Algo in the account, without the pending rewards.\n */\n amountWithoutPendingRewards: AlgoAmount\n\n /**\n * Algo balance required to be held by the account.\n *\n * The requirement grows based on asset and application usage.\n */\n minBalance: AlgoAmount\n /**\n * Amount of Algo of pending rewards in this account.\n */\n pendingRewards: AlgoAmount\n\n /**\n * Total rewards of Algo the account has received, including pending\n * rewards.\n */\n rewards: AlgoAmount\n\n /**\n * The round number for which this information is relevant.\n */\n validAsOfRound: bigint\n\n /**\n * Delegation status of the account's Algo:\n * * Offline - indicates that the associated account is delegated.\n * * Online - indicates that the associated account used as part of the delegation pool.\n * * NotParticipating - indicates that the associated account is neither a delegator nor a delegate.\n */\n status: string\n\n /**\n * The count of all applications that have been opted in, equivalent to the count\n * of application local data (AppLocalState objects) stored in this account.\n */\n totalAppsOptedIn: number\n\n /**\n * The count of all assets that have been opted in, equivalent to the count of\n * AssetHolding objects held by this account.\n */\n totalAssetsOptedIn: number\n\n /**\n * The count of all apps (AppParams objects) created by this account.\n */\n totalCreatedApps: number\n\n /**\n * The count of all assets (AssetParams objects) created by this account.\n */\n totalCreatedAssets: number\n\n /**\n * Applications local data stored in this account.\n */\n appsLocalState?: ApplicationLocalState[]\n\n /**\n * The sum of all extra application program pages for this account.\n */\n appsTotalExtraPages?: number\n /**\n * (tsch) stores the sum of all of the local schemas and global schemas in this\n * account.\n * Note: the raw account uses `StateSchema` for this type.\n */\n appsTotalSchema?: ApplicationStateSchema\n\n /**\n * Assets held by this account.\n */\n assets?: AssetHolding[]\n\n /**\n * The address against which signing should be checked. If empty, the\n * address of the current account is used. This field can be updated in any\n * transaction by setting the `RekeyTo` field.\n */\n authAddress?: Address\n\n /**\n * Parameters of applications created by this account including app global data.\n */\n createdApps?: Application[]\n\n /**\n * (apar) parameters of assets created by this account.\n * Note: the raw account uses `map[int] -> Asset` for this type.\n */\n createdAssets?: Asset[]\n\n /**\n * AccountParticipation describes the parameters used by this account in consensus\n * protocol.\n */\n participation?: AccountParticipation\n\n /**\n * Used as part of the rewards computation. Only applicable to accounts\n * which are participating.\n */\n rewardBase?: number\n\n /**\n * Indicates what type of signature is used by this account, must be one of:\n * * sig\n * * msig\n * * lsig\n */\n sigType?: string\n\n /**\n * The total number of bytes used by this account's app's box keys and\n * values.\n */\n totalBoxBytes?: number\n\n /**\n * The number of existing boxes created by this account's app.\n */\n totalBoxes?: number\n\n /**\n * The round in which this account last went online, or explicitly renewed their\n * online status.\n */\n lastHeartbeatRound?: bigint\n\n /**\n * The round in which this account last proposed the block.\n */\n lastProposedRound?: bigint\n}\n\n/** Account asset holding information at a given round. */\nexport type AccountAssetInformation = {\n /** The ID of the asset held. */\n assetId: bigint\n /** The current balance of that asset holding. */\n balance: bigint\n /** Whether or not the asset is frozen for the account. */\n frozen: boolean\n /** The round as at which the holding was correct. */\n round: bigint\n}\n\n/**\n * @deprecated The methods that use this can be achieved using `AccountManager` instead.\n * Config for an account config */\nexport interface AccountConfig {\n /** Mnemonic for an account */\n accountMnemonic: string\n /** Address of a rekeyed account */\n senderAddress?: string\n /** Account name used to retrieve config */\n accountName: string\n\n /** @deprecated Renamed to senderAddress in 2.3.1 */\n senderMnemonic?: string\n}\n"],"names":[],"mappings":";;AAaA;;AAEG;AACI,MAAM,iBAAiB,GAAG,YAAW;AAE5C;MACa,eAAe,CAAA;;AAO1B,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;;AAGD,IAAA,IAAI,eAAe,GAAA;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;KAC7B;;AAGD,IAAA,IAAI,IAAI,GAAA;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;KAClB;AAED,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;KACpB;IAED,WAAY,CAAA,cAAgC,EAAE,eAA6C,EAAA;AACzF,QAAA,IAAI,CAAC,OAAO,GA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E,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE;SACrB,CAAA;KACF;IAED,WAAY,CAAA,OAAgB,EAAE,MAAoC,EAAA;AAChE,QAAA,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,MAAM,KAAK,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;QACjG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,iCAAiC,CAAC,OAAO,CAAC,CAAA;KAClE;AACF;;;;"}
@@ -1,5 +1,4 @@
1
- import type { BaseHTTPClientResponse, Query } from 'algosdk/dist/types/client/baseHTTPClient';
2
- import { URLTokenBaseHTTPClient } from './urlTokenBaseHTTPClient';
1
+ import { BaseHTTPClientResponse, Query, URLTokenBaseHTTPClient } from 'algosdk/client';
3
2
  /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
4
3
  export declare class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {
5
4
  private static readonly MAX_TRIES;
@@ -11,4 +10,3 @@ export declare class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {
11
10
  post(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
12
11
  delete(relativePath: string, data: Uint8Array, query?: Query<string>, requestHeaders?: Record<string, string>): Promise<BaseHTTPClientResponse>;
13
12
  }
14
- //# sourceMappingURL=algo-http-client-with-retry.d.ts.map
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var config = require('../config.js');
4
- var types_urlTokenBaseHTTPClient = require('./urlTokenBaseHTTPClient.js');
3
+ var algosdk = require('algosdk');
4
+ var config = require('../src/config.js');
5
+ var urlTokenBaseHTTPClient = require('../node_modules/algosdk/dist/esm/client/urlTokenBaseHTTPClient.js');
5
6
 
6
7
  /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
7
- class AlgoHttpClientWithRetry extends types_urlTokenBaseHTTPClient.URLTokenBaseHTTPClient {
8
+ class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient.URLTokenBaseHTTPClient {
8
9
  async callWithRetry(func) {
9
10
  let response;
10
11
  let numTries = 1;
@@ -35,7 +36,36 @@ class AlgoHttpClientWithRetry extends types_urlTokenBaseHTTPClient.URLTokenBaseH
35
36
  return response;
36
37
  }
37
38
  async get(relativePath, query, requestHeaders = {}) {
38
- return await this.callWithRetry(() => super.get(relativePath, query, requestHeaders));
39
+ const response = await this.callWithRetry(() => super.get(relativePath, query, requestHeaders));
40
+ if (relativePath.startsWith('/v2/accounts/') &&
41
+ relativePath.endsWith('/created-applications') &&
42
+ response.status === 200 &&
43
+ query?.['include-all']?.toString() === 'true') {
44
+ // todo: Temporary hack
45
+ // Indexer get created applications by account returns approvalProgram and clearStateProgram as null, which breaks the algosdk@3 decoder
46
+ // instead we will detect this call and set them to empty byte arrays
47
+ try {
48
+ const json = algosdk.parseJSON(Buffer.from(response.body).toString(), { intDecoding: algosdk.IntDecoding.MIXED });
49
+ if (json.applications) {
50
+ for (const app of json.applications) {
51
+ if (app.params) {
52
+ if (app.params['approval-program'] === null) {
53
+ app.params['approval-program'] = '';
54
+ }
55
+ if (app.params['clear-state-program'] === null) {
56
+ app.params['clear-state-program'] = '';
57
+ }
58
+ }
59
+ }
60
+ response.body = Buffer.from(algosdk.stringifyJSON(json));
61
+ }
62
+ }
63
+ catch (e) {
64
+ // Make this hack resilient so we never break the app
65
+ config.Config.logger.warn('Failed to fix indexer response for created applications', e);
66
+ }
67
+ }
68
+ return response;
39
69
  }
40
70
  async post(relativePath, data, query, requestHeaders = {}) {
41
71
  return await this.callWithRetry(() => super.post(relativePath, data, query, requestHeaders));
@@ -1 +1 @@
1
- {"version":3,"file":"algo-http-client-with-retry.js","sources":["../../src/types/algo-http-client-with-retry.ts"],"sourcesContent":[null],"names":["URLTokenBaseHTTPClient","Config"],"mappings":";;;;;AAI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sourcesContent":["import { IntDecoding, parseJSON, stringifyJSON } from 'algosdk'\nimport { BaseHTTPClientResponse, Query, URLTokenBaseHTTPClient } from 'algosdk/client'\nimport { Config } from '../config'\n\n/** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */\nexport class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {\n private static readonly MAX_TRIES = 5\n private static readonly MAX_BACKOFF_MS = 10000\n\n // These lists come from https://visionmedia.github.io/superagent/#retrying-requests\n // which is the underlying library used by algosdk - but the CloudFlare specific 52X status codes have been removed\n private static readonly RETRY_STATUS_CODES = [408, 413, 429, 500, 502, 503, 504]\n private static readonly RETRY_ERROR_CODES = [\n 'ETIMEDOUT',\n 'ECONNRESET',\n 'EADDRINUSE',\n 'ECONNREFUSED',\n 'EPIPE',\n 'ENOTFOUND',\n 'ENETUNREACH',\n 'EAI_AGAIN',\n 'EPROTO', // We get this intermittently with AlgoNode API\n ]\n\n private async callWithRetry(func: () => Promise<BaseHTTPClientResponse>): Promise<BaseHTTPClientResponse> {\n let response: BaseHTTPClientResponse | undefined\n let numTries = 1\n do {\n try {\n response = await func()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n if (numTries >= AlgoHttpClientWithRetry.MAX_TRIES) {\n throw err\n }\n // Only retry for one of the hardcoded conditions\n if (\n !(\n AlgoHttpClientWithRetry.RETRY_ERROR_CODES.includes(err.code) ||\n AlgoHttpClientWithRetry.RETRY_STATUS_CODES.includes(Number(err.status)) ||\n ('response' in err && AlgoHttpClientWithRetry.RETRY_STATUS_CODES.includes(Number(err.response.status)))\n )\n ) {\n throw err\n }\n // Retry immediately the first time, then exponentially backoff.\n const delayTimeMs = numTries == 1 ? 0 : Math.min(1000 * Math.pow(2, numTries - 1), AlgoHttpClientWithRetry.MAX_BACKOFF_MS)\n if (delayTimeMs > 0) {\n await new Promise((r) => setTimeout(r, delayTimeMs))\n }\n Config.logger.warn(`algosdk request failed ${numTries} times. Retrying in ${delayTimeMs}ms: ${err}`)\n }\n } while (!response && ++numTries <= AlgoHttpClientWithRetry.MAX_TRIES)\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return response!\n }\n\n async get(relativePath: string, query?: Query<string>, requestHeaders: Record<string, string> = {}): Promise<BaseHTTPClientResponse> {\n const response = await this.callWithRetry(() => super.get(relativePath, query, requestHeaders))\n if (\n relativePath.startsWith('/v2/accounts/') &&\n relativePath.endsWith('/created-applications') &&\n response.status === 200 &&\n query?.['include-all']?.toString() === 'true'\n ) {\n // todo: Temporary hack\n // Indexer get created applications by account returns approvalProgram and clearStateProgram as null, which breaks the algosdk@3 decoder\n // instead we will detect this call and set them to empty byte arrays\n try {\n const json = parseJSON(Buffer.from(response.body).toString(), { intDecoding: IntDecoding.MIXED })\n if (json.applications) {\n for (const app of json.applications) {\n if (app.params) {\n if (app.params['approval-program'] === null) {\n app.params['approval-program'] = ''\n }\n if (app.params['clear-state-program'] === null) {\n app.params['clear-state-program'] = ''\n }\n }\n }\n response.body = Buffer.from(stringifyJSON(json))\n }\n } catch (e) {\n // Make this hack resilient so we never break the app\n Config.logger.warn('Failed to fix indexer response for created applications', e)\n }\n }\n return response\n }\n\n async post(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n return await this.callWithRetry(() => super.post(relativePath, data, query, requestHeaders))\n }\n\n async delete(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n return await this.callWithRetry(() => super.delete(relativePath, data, query, requestHeaders))\n }\n}\n"],"names":["URLTokenBaseHTTPClient","Config","parseJSON","IntDecoding","stringifyJSON"],"mappings":";;;;;;AAIA;AACM,MAAO,uBAAwB,SAAQA,6CAAsB,CAAA;IAmBzD,MAAM,aAAa,CAAC,IAA2C,EAAA;AACrE,QAAA,IAAI,QAA4C,CAAA;QAChD,IAAI,QAAQ,GAAG,CAAC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E,CAAC,CAAC,CAAA;aACjF;SACF;AACD,QAAA,OAAO,QAAQ,CAAA;KAChB;IAED,MAAM,IAAI,CACR,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,cAAA,GAAyC,EAAE,EAAA;QAE3C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;KAC7F;IAED,MAAM,MAAM,CACV,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,cAAA,GAAyC,EAAE,EAAA;QAE3C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;KAC/F;;AArGuB,uBAAS,CAAA,SAAA,GAAG,CAAC,CAAA;AACb,uBAAc,CAAA,cAAA,GAAG,KAAK,CAAA;AAE9C;AACA;AACwB,uBAAA,CAAA,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACxD,uBAAA,CAAA,iBAAiB,GAAG;IAC1C,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,OAAO;IACP,WAAW;IACX,aAAa;IACb,WAAW;AACX,IAAA,QAAQ;CACT;;;;"}
@@ -1,5 +1,6 @@
1
- import { Config } from '../config.mjs';
2
- import { URLTokenBaseHTTPClient } from './urlTokenBaseHTTPClient.mjs';
1
+ import { parseJSON, IntDecoding, stringifyJSON } from 'algosdk';
2
+ import { Config } from '../src/config.mjs';
3
+ import { URLTokenBaseHTTPClient } from '../node_modules/algosdk/dist/esm/client/urlTokenBaseHTTPClient.mjs';
3
4
 
4
5
  /** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
5
6
  class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {
@@ -33,7 +34,36 @@ class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {
33
34
  return response;
34
35
  }
35
36
  async get(relativePath, query, requestHeaders = {}) {
36
- return await this.callWithRetry(() => super.get(relativePath, query, requestHeaders));
37
+ const response = await this.callWithRetry(() => super.get(relativePath, query, requestHeaders));
38
+ if (relativePath.startsWith('/v2/accounts/') &&
39
+ relativePath.endsWith('/created-applications') &&
40
+ response.status === 200 &&
41
+ query?.['include-all']?.toString() === 'true') {
42
+ // todo: Temporary hack
43
+ // Indexer get created applications by account returns approvalProgram and clearStateProgram as null, which breaks the algosdk@3 decoder
44
+ // instead we will detect this call and set them to empty byte arrays
45
+ try {
46
+ const json = parseJSON(Buffer.from(response.body).toString(), { intDecoding: IntDecoding.MIXED });
47
+ if (json.applications) {
48
+ for (const app of json.applications) {
49
+ if (app.params) {
50
+ if (app.params['approval-program'] === null) {
51
+ app.params['approval-program'] = '';
52
+ }
53
+ if (app.params['clear-state-program'] === null) {
54
+ app.params['clear-state-program'] = '';
55
+ }
56
+ }
57
+ }
58
+ response.body = Buffer.from(stringifyJSON(json));
59
+ }
60
+ }
61
+ catch (e) {
62
+ // Make this hack resilient so we never break the app
63
+ Config.logger.warn('Failed to fix indexer response for created applications', e);
64
+ }
65
+ }
66
+ return response;
37
67
  }
38
68
  async post(relativePath, data, query, requestHeaders = {}) {
39
69
  return await this.callWithRetry(() => super.post(relativePath, data, query, requestHeaders));
@@ -1 +1 @@
1
- {"version":3,"file":"algo-http-client-with-retry.mjs","sources":["../../src/types/algo-http-client-with-retry.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;AACM,MAAO,uBAAwB,SAAQ,sBAAsB,CAAA;IAmBzD,MAAM,aAAa,CAAC,IAA2C,EAAA;AACrE,QAAA,IAAI,QAA4C,CAAA;QAChD,IAAI,QAAQ,GAAG,CAAC,CAAA;AAChB,QAAA,GAAG;AACD,YAAA,IAAI;AACF,gBAAA,QAAQ,GAAG,MAAM,IA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,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;KACtF;IAED,MAAM,IAAI,CACR,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,cAAA,GAAyC,EAAE,EAAA;QAE3C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;KAC7F;IAED,MAAM,MAAM,CACV,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,cAAA,GAAyC,EAAE,EAAA;QAE3C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;KAC/F;;AAvEuB,uBAAS,CAAA,SAAA,GAAG,CAAC,CAAA;AACb,uBAAc,CAAA,cAAA,GAAG,KAAK,CAAA;AAE9C;AACA;AACwB,uBAAA,CAAA,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACxD,uBAAA,CAAA,iBAAiB,GAAG;IAC1C,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,OAAO;IACP,WAAW;IACX,aAAa;IACb,WAAW;AACX,IAAA,QAAQ;CACT;;;;"}
1
+ {"version":3,"file":"algo-http-client-with-retry.mjs","sources":["../../src/types/algo-http-client-with-retry.ts"],"sourcesContent":["import { IntDecoding, parseJSON, stringifyJSON } from 'algosdk'\nimport { BaseHTTPClientResponse, Query, URLTokenBaseHTTPClient } from 'algosdk/client'\nimport { Config } from '../config'\n\n/** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */\nexport class AlgoHttpClientWithRetry extends URLTokenBaseHTTPClient {\n private static readonly MAX_TRIES = 5\n private static readonly MAX_BACKOFF_MS = 10000\n\n // These lists come from https://visionmedia.github.io/superagent/#retrying-requests\n // which is the underlying library used by algosdk - but the CloudFlare specific 52X status codes have been removed\n private static readonly RETRY_STATUS_CODES = [408, 413, 429, 500, 502, 503, 504]\n private static readonly RETRY_ERROR_CODES = [\n 'ETIMEDOUT',\n 'ECONNRESET',\n 'EADDRINUSE',\n 'ECONNREFUSED',\n 'EPIPE',\n 'ENOTFOUND',\n 'ENETUNREACH',\n 'EAI_AGAIN',\n 'EPROTO', // We get this intermittently with AlgoNode API\n ]\n\n private async callWithRetry(func: () => Promise<BaseHTTPClientResponse>): Promise<BaseHTTPClientResponse> {\n let response: BaseHTTPClientResponse | undefined\n let numTries = 1\n do {\n try {\n response = await func()\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (err: any) {\n if (numTries >= AlgoHttpClientWithRetry.MAX_TRIES) {\n throw err\n }\n // Only retry for one of the hardcoded conditions\n if (\n !(\n AlgoHttpClientWithRetry.RETRY_ERROR_CODES.includes(err.code) ||\n AlgoHttpClientWithRetry.RETRY_STATUS_CODES.includes(Number(err.status)) ||\n ('response' in err && AlgoHttpClientWithRetry.RETRY_STATUS_CODES.includes(Number(err.response.status)))\n )\n ) {\n throw err\n }\n // Retry immediately the first time, then exponentially backoff.\n const delayTimeMs = numTries == 1 ? 0 : Math.min(1000 * Math.pow(2, numTries - 1), AlgoHttpClientWithRetry.MAX_BACKOFF_MS)\n if (delayTimeMs > 0) {\n await new Promise((r) => setTimeout(r, delayTimeMs))\n }\n Config.logger.warn(`algosdk request failed ${numTries} times. Retrying in ${delayTimeMs}ms: ${err}`)\n }\n } while (!response && ++numTries <= AlgoHttpClientWithRetry.MAX_TRIES)\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return response!\n }\n\n async get(relativePath: string, query?: Query<string>, requestHeaders: Record<string, string> = {}): Promise<BaseHTTPClientResponse> {\n const response = await this.callWithRetry(() => super.get(relativePath, query, requestHeaders))\n if (\n relativePath.startsWith('/v2/accounts/') &&\n relativePath.endsWith('/created-applications') &&\n response.status === 200 &&\n query?.['include-all']?.toString() === 'true'\n ) {\n // todo: Temporary hack\n // Indexer get created applications by account returns approvalProgram and clearStateProgram as null, which breaks the algosdk@3 decoder\n // instead we will detect this call and set them to empty byte arrays\n try {\n const json = parseJSON(Buffer.from(response.body).toString(), { intDecoding: IntDecoding.MIXED })\n if (json.applications) {\n for (const app of json.applications) {\n if (app.params) {\n if (app.params['approval-program'] === null) {\n app.params['approval-program'] = ''\n }\n if (app.params['clear-state-program'] === null) {\n app.params['clear-state-program'] = ''\n }\n }\n }\n response.body = Buffer.from(stringifyJSON(json))\n }\n } catch (e) {\n // Make this hack resilient so we never break the app\n Config.logger.warn('Failed to fix indexer response for created applications', e)\n }\n }\n return response\n }\n\n async post(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n return await this.callWithRetry(() => super.post(relativePath, data, query, requestHeaders))\n }\n\n async delete(\n relativePath: string,\n data: Uint8Array,\n query?: Query<string>,\n requestHeaders: Record<string, string> = {},\n ): Promise<BaseHTTPClientResponse> {\n return await this.callWithRetry(() => super.delete(relativePath, data, query, requestHeaders))\n }\n}\n"],"names":[],"mappings":";;;;AAIA;AACM,MAAO,uBAAwB,SAAQ,sBAAsB,CAAA;IAmBzD,MAAM,aAAa,CAAC,IAA2C,EAAA;AACrE,QAAA,IAAI,QAA4C,CAAA;QAChD,IAAI,QAAQ,GAAG,CAAC,CAAA;AAChB,QAAA,GAAG;AACD,YAAA,IAAI;AACF,gBAAA,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAA;;aAExB;YAAC,OAAO,GAAQ,EAAE;AACjB,gBAAA,IAAI,QAAQ,IAAI,uBAAuB,CAAC,SAAS,EAAE;AACjD,oBAAA,MAAM,GAAG,CAAA;iBACV;;gBAED,IACE,EACE,uBAAuB,CAAC,iBAAiB,CAAC,QA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AAC,CAAA;KAC7F;IAED,MAAM,MAAM,CACV,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,cAAA,GAAyC,EAAE,EAAA;QAE3C,OAAO,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;KAC/F;;AArGuB,uBAAS,CAAA,SAAA,GAAG,CAAC,CAAA;AACb,uBAAc,CAAA,cAAA,GAAG,KAAK,CAAA;AAE9C;AACA;AACwB,uBAAA,CAAA,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACxD,uBAAA,CAAA,iBAAiB,GAAG;IAC1C,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,OAAO;IACP,WAAW;IACX,aAAa;IACb,WAAW;AACX,IAAA,QAAQ;CACT;;;;"}
@@ -0,0 +1,28 @@
1
+ import algosdk from 'algosdk';
2
+ import { AlgorandClientTransactionCreator } from './algorand-client-transaction-creator';
3
+ import { AlgorandClientTransactionSender } from './algorand-client-transaction-sender';
4
+ import { AppDeployer } from './app-deployer';
5
+ import { AppManager } from './app-manager';
6
+ import { TransactionComposer } from './composer';
7
+ import { NetworkDetails } from './network-client';
8
+ import Algodv2 = algosdk.Algodv2;
9
+ import Indexer = algosdk.Indexer;
10
+ /** Interface for the bulk of the `AlgorandClient` functionality.
11
+ *
12
+ * Used to take a dependency on AlgorandClient without generating a circular dependency.
13
+ */
14
+ export interface AlgorandClientInterface {
15
+ app: AppManager;
16
+ appDeployer: AppDeployer;
17
+ send: AlgorandClientTransactionSender;
18
+ createTransaction: AlgorandClientTransactionCreator;
19
+ newGroup(): TransactionComposer;
20
+ client: {
21
+ algod: Algodv2;
22
+ indexer?: Indexer;
23
+ network(): Promise<NetworkDetails>;
24
+ isLocalNet(): Promise<boolean>;
25
+ isTestNet(): Promise<boolean>;
26
+ isMainNet(): Promise<boolean>;
27
+ };
28
+ }
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=algorand-client-interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algorand-client-interface.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=algorand-client-interface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"algorand-client-interface.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}