@algorandfoundation/algokit-utils 10.0.0-alpha.2 → 10.0.0-alpha.21

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 (462) hide show
  1. package/_virtual/rolldown_runtime.js +10 -15
  2. package/algo25/index.d.ts +2 -0
  3. package/algo25/index.js +9 -0
  4. package/algo25/index.mjs +3 -0
  5. package/algod-client/index.d.ts +3 -7
  6. package/algod-client/index.js +2 -5
  7. package/algod-client/index.mjs +2 -2
  8. package/index.d.ts +1 -2
  9. package/index.js +0 -7
  10. package/index.mjs +1 -2
  11. package/indexer-client/index.d.ts +2 -2
  12. package/indexer-client/index.js +6 -6
  13. package/indexer-client/index.mjs +2 -2
  14. package/{indexer-lookup.d.ts → indexer-client/indexer-lookup.d.ts} +8 -11
  15. package/{indexer-lookup.mjs → indexer-client/indexer-lookup.js} +6 -10
  16. package/indexer-client/indexer-lookup.js.map +1 -0
  17. package/{indexer-lookup.js → indexer-client/indexer-lookup.mjs} +3 -18
  18. package/indexer-client/indexer-lookup.mjs.map +1 -0
  19. package/kmd-client/index.d.ts +1 -2
  20. package/kmd-client/index.js +0 -5
  21. package/kmd-client/index.mjs +1 -2
  22. package/package.json +1 -6
  23. package/packages/abi/src/abi-method.d.ts +1 -1
  24. package/packages/abi/src/abi-method.js +1 -1
  25. package/packages/abi/src/abi-method.js.map +1 -1
  26. package/packages/abi/src/abi-method.mjs +1 -1
  27. package/packages/abi/src/abi-method.mjs.map +1 -1
  28. package/packages/abi/src/abi-type.d.ts +1 -1
  29. package/packages/abi/src/abi-type.js +4 -2
  30. package/packages/abi/src/abi-type.js.map +1 -1
  31. package/packages/abi/src/abi-type.mjs +4 -2
  32. package/packages/abi/src/abi-type.mjs.map +1 -1
  33. package/packages/abi/src/arc56-contract.js +1 -0
  34. package/packages/abi/src/arc56-contract.js.map +1 -1
  35. package/packages/abi/src/arc56-contract.mjs +1 -0
  36. package/packages/abi/src/arc56-contract.mjs.map +1 -1
  37. package/packages/algo25/src/index.d.ts +40 -0
  38. package/packages/algo25/src/index.js +45 -1
  39. package/packages/algo25/src/index.js.map +1 -1
  40. package/packages/algo25/src/index.mjs +40 -2
  41. package/packages/algo25/src/index.mjs.map +1 -1
  42. package/packages/algod_client/src/apis/api-service.d.ts +44 -44
  43. package/packages/algod_client/src/apis/api-service.js +155 -155
  44. package/packages/algod_client/src/apis/api-service.js.map +1 -1
  45. package/packages/algod_client/src/apis/api-service.mjs +155 -155
  46. package/packages/algod_client/src/apis/api-service.mjs.map +1 -1
  47. package/packages/algod_client/src/core/api-error.js +3 -1
  48. package/packages/algod_client/src/core/api-error.js.map +1 -1
  49. package/packages/algod_client/src/core/api-error.mjs +3 -1
  50. package/packages/algod_client/src/core/api-error.mjs.map +1 -1
  51. package/packages/algod_client/src/core/model-runtime.js +6 -6
  52. package/packages/algod_client/src/core/model-runtime.js.map +1 -1
  53. package/packages/algod_client/src/core/model-runtime.mjs +8 -8
  54. package/packages/algod_client/src/core/model-runtime.mjs.map +1 -1
  55. package/packages/algod_client/src/models/account-participation.js +4 -4
  56. package/packages/algod_client/src/models/account-participation.js.map +1 -1
  57. package/packages/algod_client/src/models/account-participation.mjs +4 -4
  58. package/packages/algod_client/src/models/account-participation.mjs.map +1 -1
  59. package/packages/algod_client/src/models/application-state-schema.d.ts +2 -2
  60. package/packages/algod_client/src/models/application-state-schema.js +2 -2
  61. package/packages/algod_client/src/models/application-state-schema.js.map +1 -1
  62. package/packages/algod_client/src/models/application-state-schema.mjs +2 -2
  63. package/packages/algod_client/src/models/application-state-schema.mjs.map +1 -1
  64. package/packages/algod_client/src/models/asset-params.js +2 -1
  65. package/packages/algod_client/src/models/asset-params.js.map +1 -1
  66. package/packages/algod_client/src/models/asset-params.mjs +2 -1
  67. package/packages/algod_client/src/models/asset-params.mjs.map +1 -1
  68. package/packages/algod_client/src/models/block-response.js +1 -2
  69. package/packages/algod_client/src/models/block-response.js.map +1 -1
  70. package/packages/algod_client/src/models/block-response.mjs +2 -3
  71. package/packages/algod_client/src/models/block-response.mjs.map +1 -1
  72. package/packages/algod_client/src/models/block.d.ts +60 -40
  73. package/packages/algod_client/src/models/block.js +184 -108
  74. package/packages/algod_client/src/models/block.js.map +1 -1
  75. package/packages/algod_client/src/models/block.mjs +184 -108
  76. package/packages/algod_client/src/models/block.mjs.map +1 -1
  77. package/packages/algod_client/src/models/ledger-state-delta.js +1 -1
  78. package/packages/algod_client/src/models/ledger-state-delta.js.map +1 -1
  79. package/packages/algod_client/src/models/ledger-state-delta.mjs +2 -2
  80. package/packages/algod_client/src/models/ledger-state-delta.mjs.map +1 -1
  81. package/packages/algod_client/src/models/simulate-request.js +1 -1
  82. package/packages/algod_client/src/models/simulate-request.mjs +1 -1
  83. package/packages/algod_client/src/models/simulate-response.d.ts +2 -1
  84. package/packages/algod_client/src/models/simulate-response.js +6 -1
  85. package/packages/algod_client/src/models/simulate-response.js.map +1 -1
  86. package/packages/algod_client/src/models/simulate-response.mjs +6 -2
  87. package/packages/algod_client/src/models/simulate-response.mjs.map +1 -1
  88. package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.d.ts +3 -5
  89. package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js +4 -6
  90. package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.js.map +1 -1
  91. package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs +3 -5
  92. package/packages/algod_client/src/models/simulate-unnamed-resources-accessed.mjs.map +1 -1
  93. package/packages/algod_client/src/models/transaction-parameters-response.js +2 -2
  94. package/packages/algod_client/src/models/transaction-parameters-response.js.map +1 -1
  95. package/packages/algod_client/src/models/transaction-parameters-response.mjs +2 -2
  96. package/packages/algod_client/src/models/transaction-parameters-response.mjs.map +1 -1
  97. package/packages/common/src/address.js +0 -14
  98. package/packages/common/src/address.js.map +1 -1
  99. package/packages/common/src/address.mjs +1 -14
  100. package/packages/common/src/address.mjs.map +1 -1
  101. package/packages/common/src/codecs/composite/map.js +7 -4
  102. package/packages/common/src/codecs/composite/map.js.map +1 -1
  103. package/packages/common/src/codecs/composite/map.mjs +7 -4
  104. package/packages/common/src/codecs/composite/map.mjs.map +1 -1
  105. package/packages/common/src/codecs/composite/record.js +0 -1
  106. package/packages/common/src/codecs/composite/record.js.map +1 -1
  107. package/packages/common/src/codecs/primitives/address.js +0 -1
  108. package/packages/common/src/codecs/primitives/address.js.map +1 -1
  109. package/packages/common/src/codecs/primitives/bytes.js +0 -1
  110. package/packages/common/src/codecs/primitives/bytes.js.map +1 -1
  111. package/packages/common/src/codecs/primitives/fixed-bytes.js +0 -1
  112. package/packages/common/src/codecs/primitives/fixed-bytes.js.map +1 -1
  113. package/packages/common/src/codecs/wire.js +0 -1
  114. package/packages/common/src/codecs/wire.js.map +1 -1
  115. package/packages/common/src/json.mjs +2 -2
  116. package/packages/common/src/json.mjs.map +1 -1
  117. package/packages/common/src/msgpack.js +0 -1
  118. package/packages/common/src/msgpack.js.map +1 -1
  119. package/packages/{sdk/src/logic → common/src}/sourcemap.d.ts +2 -2
  120. package/packages/{sdk/src/logic → common/src}/sourcemap.js +2 -2
  121. package/packages/{sdk/src/logic → common/src}/sourcemap.js.map +1 -1
  122. package/packages/{sdk/src/logic → common/src}/sourcemap.mjs +1 -1
  123. package/packages/{sdk/src/logic → common/src}/sourcemap.mjs.map +1 -1
  124. package/packages/indexer_client/src/apis/api-service.d.ts +1 -1
  125. package/packages/indexer_client/src/apis/api-service.js +12 -12
  126. package/packages/indexer_client/src/apis/api-service.js.map +1 -1
  127. package/packages/indexer_client/src/apis/api-service.mjs +12 -12
  128. package/packages/indexer_client/src/apis/api-service.mjs.map +1 -1
  129. package/packages/indexer_client/src/core/api-error.js +3 -1
  130. package/packages/indexer_client/src/core/api-error.js.map +1 -1
  131. package/packages/indexer_client/src/core/api-error.mjs +3 -1
  132. package/packages/indexer_client/src/core/api-error.mjs.map +1 -1
  133. package/packages/indexer_client/src/core/model-runtime.js +0 -15
  134. package/packages/indexer_client/src/core/model-runtime.js.map +1 -1
  135. package/packages/indexer_client/src/core/model-runtime.mjs +1 -13
  136. package/packages/indexer_client/src/core/model-runtime.mjs.map +1 -1
  137. package/packages/indexer_client/src/models/account-participation.js +4 -4
  138. package/packages/indexer_client/src/models/account-participation.js.map +1 -1
  139. package/packages/indexer_client/src/models/account-participation.mjs +4 -4
  140. package/packages/indexer_client/src/models/account-participation.mjs.map +1 -1
  141. package/packages/indexer_client/src/models/application-state-schema.d.ts +2 -2
  142. package/packages/indexer_client/src/models/application-state-schema.js +2 -2
  143. package/packages/indexer_client/src/models/application-state-schema.js.map +1 -1
  144. package/packages/indexer_client/src/models/application-state-schema.mjs +2 -2
  145. package/packages/indexer_client/src/models/application-state-schema.mjs.map +1 -1
  146. package/packages/indexer_client/src/models/asset-params.js +2 -1
  147. package/packages/indexer_client/src/models/asset-params.js.map +1 -1
  148. package/packages/indexer_client/src/models/asset-params.mjs +2 -1
  149. package/packages/indexer_client/src/models/asset-params.mjs.map +1 -1
  150. package/packages/indexer_client/src/models/block.d.ts +5 -5
  151. package/packages/indexer_client/src/models/block.js +13 -13
  152. package/packages/indexer_client/src/models/block.js.map +1 -1
  153. package/packages/indexer_client/src/models/block.mjs +13 -13
  154. package/packages/indexer_client/src/models/block.mjs.map +1 -1
  155. package/packages/indexer_client/src/models/eval-delta-key-value.d.ts +1 -1
  156. package/packages/indexer_client/src/models/eval-delta-key-value.js +2 -2
  157. package/packages/indexer_client/src/models/eval-delta-key-value.js.map +1 -1
  158. package/packages/indexer_client/src/models/eval-delta-key-value.mjs +2 -2
  159. package/packages/indexer_client/src/models/eval-delta-key-value.mjs.map +1 -1
  160. package/packages/indexer_client/src/models/eval-delta.d.ts +1 -1
  161. package/packages/indexer_client/src/models/eval-delta.js +2 -2
  162. package/packages/indexer_client/src/models/eval-delta.js.map +1 -1
  163. package/packages/indexer_client/src/models/eval-delta.mjs +2 -2
  164. package/packages/indexer_client/src/models/eval-delta.mjs.map +1 -1
  165. package/packages/indexer_client/src/models/hb-proof-fields.js +6 -6
  166. package/packages/indexer_client/src/models/hb-proof-fields.js.map +1 -1
  167. package/packages/indexer_client/src/models/hb-proof-fields.mjs +6 -6
  168. package/packages/indexer_client/src/models/hb-proof-fields.mjs.map +1 -1
  169. package/packages/indexer_client/src/models/participation-updates.d.ts +2 -2
  170. package/packages/indexer_client/src/models/participation-updates.js +2 -2
  171. package/packages/indexer_client/src/models/participation-updates.js.map +1 -1
  172. package/packages/indexer_client/src/models/participation-updates.mjs +2 -2
  173. package/packages/indexer_client/src/models/participation-updates.mjs.map +1 -1
  174. package/packages/indexer_client/src/models/state-proof-verifier.js +2 -2
  175. package/packages/indexer_client/src/models/state-proof-verifier.js.map +1 -1
  176. package/packages/indexer_client/src/models/state-proof-verifier.mjs +2 -2
  177. package/packages/indexer_client/src/models/state-proof-verifier.mjs.map +1 -1
  178. package/packages/indexer_client/src/models/state-schema.d.ts +2 -2
  179. package/packages/indexer_client/src/models/state-schema.js +2 -2
  180. package/packages/indexer_client/src/models/state-schema.js.map +1 -1
  181. package/packages/indexer_client/src/models/state-schema.mjs +2 -2
  182. package/packages/indexer_client/src/models/state-schema.mjs.map +1 -1
  183. package/packages/indexer_client/src/models/teal-key-value.d.ts +1 -1
  184. package/packages/indexer_client/src/models/teal-key-value.js +2 -2
  185. package/packages/indexer_client/src/models/teal-key-value.js.map +1 -1
  186. package/packages/indexer_client/src/models/teal-key-value.mjs +2 -2
  187. package/packages/indexer_client/src/models/teal-key-value.mjs.map +1 -1
  188. package/packages/indexer_client/src/models/transaction-heartbeat.js +2 -1
  189. package/packages/indexer_client/src/models/transaction-heartbeat.js.map +1 -1
  190. package/packages/indexer_client/src/models/transaction-heartbeat.mjs +2 -1
  191. package/packages/indexer_client/src/models/transaction-heartbeat.mjs.map +1 -1
  192. package/packages/indexer_client/src/models/transaction-keyreg.js +4 -4
  193. package/packages/indexer_client/src/models/transaction-keyreg.js.map +1 -1
  194. package/packages/indexer_client/src/models/transaction-keyreg.mjs +4 -4
  195. package/packages/indexer_client/src/models/transaction-keyreg.mjs.map +1 -1
  196. package/packages/indexer_client/src/models/transaction-signature-logicsig.js +2 -1
  197. package/packages/indexer_client/src/models/transaction-signature-logicsig.js.map +1 -1
  198. package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs +2 -1
  199. package/packages/indexer_client/src/models/transaction-signature-logicsig.mjs.map +1 -1
  200. package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js +3 -3
  201. package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.js.map +1 -1
  202. package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs +3 -3
  203. package/packages/indexer_client/src/models/transaction-signature-multisig-subsignature.mjs.map +1 -1
  204. package/packages/indexer_client/src/models/transaction.d.ts +2 -2
  205. package/packages/indexer_client/src/models/transaction.js +6 -5
  206. package/packages/indexer_client/src/models/transaction.js.map +1 -1
  207. package/packages/indexer_client/src/models/transaction.mjs +6 -5
  208. package/packages/indexer_client/src/models/transaction.mjs.map +1 -1
  209. package/packages/kmd_client/src/apis/api-service.d.ts +5 -5
  210. package/packages/kmd_client/src/apis/api-service.js +32 -32
  211. package/packages/kmd_client/src/apis/api-service.js.map +1 -1
  212. package/packages/kmd_client/src/apis/api-service.mjs +32 -32
  213. package/packages/kmd_client/src/apis/api-service.mjs.map +1 -1
  214. package/packages/kmd_client/src/core/api-error.js +3 -1
  215. package/packages/kmd_client/src/core/api-error.js.map +1 -1
  216. package/packages/kmd_client/src/core/api-error.mjs +3 -1
  217. package/packages/kmd_client/src/core/api-error.mjs.map +1 -1
  218. package/packages/kmd_client/src/core/model-runtime.js +2 -12
  219. package/packages/kmd_client/src/core/model-runtime.js.map +1 -1
  220. package/packages/kmd_client/src/core/model-runtime.mjs +3 -11
  221. package/packages/kmd_client/src/core/model-runtime.mjs.map +1 -1
  222. package/packages/transact/src/logicsig.d.ts +3 -15
  223. package/packages/transact/src/logicsig.js +16 -36
  224. package/packages/transact/src/logicsig.js.map +1 -1
  225. package/packages/transact/src/logicsig.mjs +18 -36
  226. package/packages/transact/src/logicsig.mjs.map +1 -1
  227. package/packages/transact/src/multisig.d.ts +7 -115
  228. package/packages/transact/src/multisig.js +86 -136
  229. package/packages/transact/src/multisig.js.map +1 -1
  230. package/packages/transact/src/multisig.mjs +87 -117
  231. package/packages/transact/src/multisig.mjs.map +1 -1
  232. package/packages/transact/src/transactions/app-call.d.ts +10 -15
  233. package/packages/transact/src/transactions/app-call.js.map +1 -1
  234. package/packages/transact/src/transactions/app-call.mjs.map +1 -1
  235. package/packages/transact/src/transactions/asset-config.d.ts +1 -6
  236. package/packages/transact/src/transactions/asset-config.js.map +1 -1
  237. package/packages/transact/src/transactions/asset-config.mjs.map +1 -1
  238. package/packages/transact/src/transactions/asset-freeze.d.ts +1 -6
  239. package/packages/transact/src/transactions/asset-transfer.d.ts +1 -6
  240. package/packages/transact/src/transactions/key-registration.d.ts +1 -8
  241. package/packages/transact/src/transactions/reference-types-meta.d.ts +26 -0
  242. package/packages/transact/src/transactions/reference-types-meta.js +71 -0
  243. package/packages/transact/src/transactions/reference-types-meta.js.map +1 -0
  244. package/packages/transact/src/transactions/reference-types-meta.mjs +69 -0
  245. package/packages/transact/src/transactions/reference-types-meta.mjs.map +1 -0
  246. package/packages/transact/src/transactions/signed-transaction-meta.js +2 -3
  247. package/packages/transact/src/transactions/signed-transaction-meta.js.map +1 -1
  248. package/packages/transact/src/transactions/signed-transaction-meta.mjs +3 -3
  249. package/packages/transact/src/transactions/signed-transaction-meta.mjs.map +1 -1
  250. package/packages/transact/src/transactions/signed-transaction.d.ts +7 -3
  251. package/packages/transact/src/transactions/signed-transaction.js +1 -1
  252. package/packages/transact/src/transactions/signed-transaction.js.map +1 -1
  253. package/packages/transact/src/transactions/signed-transaction.mjs +1 -2
  254. package/packages/transact/src/transactions/signed-transaction.mjs.map +1 -1
  255. package/packages/transact/src/transactions/transaction-meta.js +29 -23
  256. package/packages/transact/src/transactions/transaction-meta.js.map +1 -1
  257. package/packages/transact/src/transactions/transaction-meta.mjs +29 -23
  258. package/packages/transact/src/transactions/transaction-meta.mjs.map +1 -1
  259. package/packages/transact/src/transactions/transaction.d.ts +5 -1
  260. package/packages/transact/src/transactions/transaction.js +1 -1
  261. package/packages/transact/src/transactions/transaction.js.map +1 -1
  262. package/packages/transact/src/transactions/transaction.mjs +1 -1
  263. package/packages/transact/src/transactions/transaction.mjs.map +1 -1
  264. package/testing/account.js +2 -5
  265. package/testing/account.js.map +1 -1
  266. package/testing/account.mjs +2 -5
  267. package/testing/account.mjs.map +1 -1
  268. package/testing/fixtures/algorand-fixture.d.ts +3 -3
  269. package/testing/fixtures/algorand-fixture.js.map +1 -1
  270. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  271. package/testing/transaction-logger.js +1 -1
  272. package/testing/transaction-logger.mjs +1 -1
  273. package/transact/index.d.ts +11 -10
  274. package/transact/index.js +7 -32
  275. package/transact/index.mjs +7 -10
  276. package/transaction/transaction.js +2 -2
  277. package/transaction/transaction.js.map +1 -1
  278. package/transaction/transaction.mjs +2 -2
  279. package/transaction/transaction.mjs.map +1 -1
  280. package/transactions/app-call.d.ts +5 -4
  281. package/transactions/app-call.js +16 -16
  282. package/transactions/app-call.js.map +1 -1
  283. package/transactions/app-call.mjs +16 -16
  284. package/transactions/app-call.mjs.map +1 -1
  285. package/transactions/asset-config.d.ts +1 -1
  286. package/transactions/asset-config.js +1 -1
  287. package/transactions/asset-config.js.map +1 -1
  288. package/transactions/asset-config.mjs +1 -1
  289. package/transactions/asset-config.mjs.map +1 -1
  290. package/transactions/key-registration.d.ts +1 -1
  291. package/transactions/key-registration.js.map +1 -1
  292. package/transactions/key-registration.mjs.map +1 -1
  293. package/transactions/method-call.d.ts +1 -1
  294. package/transactions/method-call.js +70 -78
  295. package/transactions/method-call.js.map +1 -1
  296. package/transactions/method-call.mjs +70 -78
  297. package/transactions/method-call.mjs.map +1 -1
  298. package/types/account-manager.d.ts +1 -1
  299. package/types/account-manager.js +5 -5
  300. package/types/account-manager.js.map +1 -1
  301. package/types/account-manager.mjs +5 -5
  302. package/types/account-manager.mjs.map +1 -1
  303. package/types/algorand-client-transaction-creator.d.ts +74 -60
  304. package/types/algorand-client-transaction-creator.js +8 -0
  305. package/types/algorand-client-transaction-creator.js.map +1 -1
  306. package/types/algorand-client-transaction-creator.mjs +8 -0
  307. package/types/algorand-client-transaction-creator.mjs.map +1 -1
  308. package/types/algorand-client-transaction-sender.d.ts +79 -65
  309. package/types/algorand-client-transaction-sender.js +8 -1
  310. package/types/algorand-client-transaction-sender.js.map +1 -1
  311. package/types/algorand-client-transaction-sender.mjs +8 -0
  312. package/types/algorand-client-transaction-sender.mjs.map +1 -1
  313. package/types/amount.js +23 -4
  314. package/types/amount.js.map +1 -1
  315. package/types/amount.mjs +20 -2
  316. package/types/amount.mjs.map +1 -1
  317. package/types/app-client.d.ts +174 -169
  318. package/types/app-client.js +2 -3
  319. package/types/app-client.js.map +1 -1
  320. package/types/app-client.mjs +2 -2
  321. package/types/app-client.mjs.map +1 -1
  322. package/types/app-deployer.d.ts +1 -1
  323. package/types/app-deployer.js +3 -3
  324. package/types/app-deployer.js.map +1 -1
  325. package/types/app-deployer.mjs +3 -3
  326. package/types/app-deployer.mjs.map +1 -1
  327. package/types/app-factory.d.ts +70 -67
  328. package/types/app-factory.js +2 -2
  329. package/types/app-factory.js.map +1 -1
  330. package/types/app-factory.mjs +2 -2
  331. package/types/app-factory.mjs.map +1 -1
  332. package/types/app-manager.d.ts +3 -1
  333. package/types/app-manager.js +17 -11
  334. package/types/app-manager.js.map +1 -1
  335. package/types/app-manager.mjs +17 -11
  336. package/types/app-manager.mjs.map +1 -1
  337. package/types/app-spec.js +12 -5
  338. package/types/app-spec.js.map +1 -1
  339. package/types/app-spec.mjs +12 -5
  340. package/types/app-spec.mjs.map +1 -1
  341. package/types/app.d.ts +2 -2
  342. package/types/app.js.map +1 -1
  343. package/types/app.mjs.map +1 -1
  344. package/types/asset-manager.js +1 -1
  345. package/types/asset-manager.js.map +1 -1
  346. package/types/asset-manager.mjs +1 -1
  347. package/types/asset-manager.mjs.map +1 -1
  348. package/types/async-event-emitter.d.ts +3 -6
  349. package/types/async-event-emitter.js.map +1 -1
  350. package/types/async-event-emitter.mjs.map +1 -1
  351. package/types/client-manager.d.ts +1 -1
  352. package/types/client-manager.js.map +1 -1
  353. package/types/client-manager.mjs.map +1 -1
  354. package/types/composer.d.ts +9 -1
  355. package/types/composer.js +49 -37
  356. package/types/composer.js.map +1 -1
  357. package/types/composer.mjs +40 -27
  358. package/types/composer.mjs.map +1 -1
  359. package/types/debugging.d.ts +13 -9
  360. package/types/debugging.js.map +1 -1
  361. package/types/debugging.mjs.map +1 -1
  362. package/types/expand.d.ts +2 -9
  363. package/types/kmd-account-manager.d.ts +1 -0
  364. package/types/kmd-account-manager.js +22 -11
  365. package/types/kmd-account-manager.js.map +1 -1
  366. package/types/kmd-account-manager.mjs +23 -12
  367. package/types/kmd-account-manager.mjs.map +1 -1
  368. package/types/lifecycle-events.d.ts +0 -1
  369. package/types/lifecycle-events.js.map +1 -1
  370. package/types/lifecycle-events.mjs.map +1 -1
  371. package/types/testing.d.ts +2 -2
  372. package/types/transaction.d.ts +1 -1
  373. package/_virtual/rolldown_runtime.mjs +0 -13
  374. package/indexer-lookup.js.map +0 -1
  375. package/indexer-lookup.mjs.map +0 -1
  376. package/packages/algod_client/src/core/model-runtime.d.ts +0 -10
  377. package/packages/algod_client/src/models/application-local-reference.d.ts +0 -20
  378. package/packages/algod_client/src/models/application-local-reference.js +0 -23
  379. package/packages/algod_client/src/models/application-local-reference.js.map +0 -1
  380. package/packages/algod_client/src/models/application-local-reference.mjs +0 -23
  381. package/packages/algod_client/src/models/application-local-reference.mjs.map +0 -1
  382. package/packages/algod_client/src/models/asset-holding-reference.d.ts +0 -20
  383. package/packages/algod_client/src/models/asset-holding-reference.js +0 -23
  384. package/packages/algod_client/src/models/asset-holding-reference.js.map +0 -1
  385. package/packages/algod_client/src/models/asset-holding-reference.mjs +0 -23
  386. package/packages/algod_client/src/models/asset-holding-reference.mjs.map +0 -1
  387. package/packages/algod_client/src/models/box-reference.d.ts +0 -17
  388. package/packages/algod_client/src/models/box-reference.js +0 -23
  389. package/packages/algod_client/src/models/box-reference.js.map +0 -1
  390. package/packages/algod_client/src/models/box-reference.mjs +0 -23
  391. package/packages/algod_client/src/models/box-reference.mjs.map +0 -1
  392. package/packages/indexer_client/src/core/model-runtime.d.ts +0 -10
  393. package/packages/kmd_client/src/core/model-runtime.d.ts +0 -10
  394. package/packages/sdk/src/convert.d.ts +0 -17
  395. package/packages/sdk/src/convert.js +0 -28
  396. package/packages/sdk/src/convert.js.map +0 -1
  397. package/packages/sdk/src/convert.mjs +0 -25
  398. package/packages/sdk/src/convert.mjs.map +0 -1
  399. package/packages/sdk/src/encoding/binarydata.d.ts +0 -34
  400. package/packages/sdk/src/encoding/binarydata.js +0 -65
  401. package/packages/sdk/src/encoding/binarydata.js.map +0 -1
  402. package/packages/sdk/src/encoding/binarydata.mjs +0 -60
  403. package/packages/sdk/src/encoding/binarydata.mjs.map +0 -1
  404. package/packages/sdk/src/encoding/encoding.d.ts +0 -237
  405. package/packages/sdk/src/encoding/encoding.js +0 -302
  406. package/packages/sdk/src/encoding/encoding.js.map +0 -1
  407. package/packages/sdk/src/encoding/encoding.mjs +0 -287
  408. package/packages/sdk/src/encoding/encoding.mjs.map +0 -1
  409. package/packages/sdk/src/encoding/schema/array.js +0 -35
  410. package/packages/sdk/src/encoding/schema/array.js.map +0 -1
  411. package/packages/sdk/src/encoding/schema/array.mjs +0 -35
  412. package/packages/sdk/src/encoding/schema/array.mjs.map +0 -1
  413. package/packages/sdk/src/encoding/schema/bytearray.js +0 -49
  414. package/packages/sdk/src/encoding/schema/bytearray.js.map +0 -1
  415. package/packages/sdk/src/encoding/schema/bytearray.mjs +0 -49
  416. package/packages/sdk/src/encoding/schema/bytearray.mjs.map +0 -1
  417. package/packages/sdk/src/encoding/schema/map.d.ts +0 -58
  418. package/packages/sdk/src/encoding/schema/map.js +0 -110
  419. package/packages/sdk/src/encoding/schema/map.js.map +0 -1
  420. package/packages/sdk/src/encoding/schema/map.mjs +0 -107
  421. package/packages/sdk/src/encoding/schema/map.mjs.map +0 -1
  422. package/packages/sdk/src/encoding/schema/optional.js +0 -46
  423. package/packages/sdk/src/encoding/schema/optional.js.map +0 -1
  424. package/packages/sdk/src/encoding/schema/optional.mjs +0 -46
  425. package/packages/sdk/src/encoding/schema/optional.mjs.map +0 -1
  426. package/packages/sdk/src/encoding/schema/uint64.js +0 -30
  427. package/packages/sdk/src/encoding/schema/uint64.js.map +0 -1
  428. package/packages/sdk/src/encoding/schema/uint64.mjs +0 -30
  429. package/packages/sdk/src/encoding/schema/uint64.mjs.map +0 -1
  430. package/packages/sdk/src/encoding/uint64.d.ts +0 -34
  431. package/packages/sdk/src/encoding/uint64.js +0 -34
  432. package/packages/sdk/src/encoding/uint64.js.map +0 -1
  433. package/packages/sdk/src/encoding/uint64.mjs +0 -33
  434. package/packages/sdk/src/encoding/uint64.mjs.map +0 -1
  435. package/packages/sdk/src/index.d.ts +0 -44
  436. package/packages/sdk/src/index.js +0 -62
  437. package/packages/sdk/src/index.js.map +0 -1
  438. package/packages/sdk/src/index.mjs +0 -58
  439. package/packages/sdk/src/index.mjs.map +0 -1
  440. package/packages/sdk/src/nacl/naclWrappers.js +0 -14
  441. package/packages/sdk/src/nacl/naclWrappers.js.map +0 -1
  442. package/packages/sdk/src/nacl/naclWrappers.mjs +0 -11
  443. package/packages/sdk/src/nacl/naclWrappers.mjs.map +0 -1
  444. package/packages/sdk/src/types/intDecoding.d.ts +0 -28
  445. package/packages/sdk/src/types/intDecoding.js +0 -32
  446. package/packages/sdk/src/types/intDecoding.js.map +0 -1
  447. package/packages/sdk/src/types/intDecoding.mjs +0 -31
  448. package/packages/sdk/src/types/intDecoding.mjs.map +0 -1
  449. package/packages/sdk/src/types/transactions/encoded.d.ts +0 -40
  450. package/packages/sdk/src/types/transactions/encoded.js +0 -64
  451. package/packages/sdk/src/types/transactions/encoded.js.map +0 -1
  452. package/packages/sdk/src/types/transactions/encoded.mjs +0 -59
  453. package/packages/sdk/src/types/transactions/encoded.mjs.map +0 -1
  454. package/packages/sdk/src/utils/utils.d.ts +0 -64
  455. package/packages/sdk/src/utils/utils.js +0 -140
  456. package/packages/sdk/src/utils/utils.js.map +0 -1
  457. package/packages/sdk/src/utils/utils.mjs +0 -128
  458. package/packages/sdk/src/utils/utils.mjs.map +0 -1
  459. package/packages/transact/src/transactions/common.d.ts +0 -37
  460. package/sdk/index.d.ts +0 -10
  461. package/sdk/index.js +0 -59
  462. package/sdk/index.mjs +0 -11
@@ -1 +1 @@
1
- {"version":3,"file":"simulate-unnamed-resources-accessed.mjs","names":["SimulateUnnamedResourcesAccessedMeta: ObjectModelMetadata<SimulateUnnamedResourcesAccessed>"],"sources":["../../../../../packages/algod_client/src/models/simulate-unnamed-resources-accessed.ts"],"sourcesContent":["import type { Address, ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec, ArrayCodec, bigIntArrayCodec, addressArrayCodec, ObjectModelCodec } from '@algorandfoundation/algokit-common'\nimport type { ApplicationLocalReference } from './application-local-reference'\nimport { ApplicationLocalReferenceMeta } from './application-local-reference'\nimport type { AssetHoldingReference } from './asset-holding-reference'\nimport { AssetHoldingReferenceMeta } from './asset-holding-reference'\nimport type { BoxReference } from './box-reference'\nimport { BoxReferenceMeta } from './box-reference'\n\n/**\n * These are resources that were accessed by this group that would normally have caused failure, but were allowed in simulation. Depending on where this object is in the response, the unnamed resources it contains may or may not qualify for group resource sharing. If this is a field in SimulateTransactionGroupResult, the resources do qualify, but if this is a field in SimulateTransactionResult, they do not qualify. In order to make this group valid for actual submission, resources that qualify for group sharing can be made available by any transaction of the group; otherwise, resources must be placed in the same transaction which accessed them.\n */\nexport type SimulateUnnamedResourcesAccessed = {\n /**\n * The unnamed accounts that were referenced. The order of this array is arbitrary.\n */\n accounts?: Address[]\n\n /**\n * The unnamed assets that were referenced. The order of this array is arbitrary.\n */\n assets?: bigint[]\n\n /**\n * The unnamed applications that were referenced. The order of this array is arbitrary.\n */\n apps?: bigint[]\n\n /**\n * The unnamed boxes that were referenced. The order of this array is arbitrary.\n */\n boxes?: BoxReference[]\n\n /**\n * The number of extra box references used to increase the IO budget. This is in addition to the references defined in the input transaction group and any referenced to unnamed boxes.\n */\n extraBoxRefs?: number\n\n /**\n * The unnamed asset holdings that were referenced. The order of this array is arbitrary.\n */\n assetHoldings?: AssetHoldingReference[]\n\n /**\n * The unnamed application local states that were referenced. The order of this array is arbitrary.\n */\n appLocals?: ApplicationLocalReference[]\n}\n\nexport const SimulateUnnamedResourcesAccessedMeta: ObjectModelMetadata<SimulateUnnamedResourcesAccessed> = {\n name: 'SimulateUnnamedResourcesAccessed',\n kind: 'object',\n fields: [\n {\n name: 'accounts',\n wireKey: 'accounts',\n optional: true,\n codec: addressArrayCodec,\n },\n {\n name: 'assets',\n wireKey: 'assets',\n optional: true,\n codec: bigIntArrayCodec,\n },\n {\n name: 'apps',\n wireKey: 'apps',\n optional: true,\n codec: bigIntArrayCodec,\n },\n {\n name: 'boxes',\n wireKey: 'boxes',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(BoxReferenceMeta)),\n },\n {\n name: 'extraBoxRefs',\n wireKey: 'extra-box-refs',\n optional: true,\n codec: numberCodec,\n },\n {\n name: 'assetHoldings',\n wireKey: 'asset-holdings',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(AssetHoldingReferenceMeta)),\n },\n {\n name: 'appLocals',\n wireKey: 'app-locals',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(ApplicationLocalReferenceMeta)),\n },\n ],\n}\n"],"mappings":";;;;;;;;AAiDA,MAAaA,uCAA8F;CACzG,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,iBAAiB,CAAC;GAC9D;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,0BAA0B,CAAC;GACvE;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,8BAA8B,CAAC;GAC3E;EACF;CACF"}
1
+ {"version":3,"file":"simulate-unnamed-resources-accessed.mjs","names":["SimulateUnnamedResourcesAccessedMeta: ObjectModelMetadata<SimulateUnnamedResourcesAccessed>"],"sources":["../../../../../packages/algod_client/src/models/simulate-unnamed-resources-accessed.ts"],"sourcesContent":["import type { Address, ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { numberCodec, ArrayCodec, bigIntArrayCodec, addressArrayCodec, ObjectModelCodec } from '@algorandfoundation/algokit-common'\nimport type { BoxReference, HoldingReference, LocalsReference } from '@algorandfoundation/algokit-transact'\nimport { BoxReferenceMeta, HoldingReferenceMeta, LocalsReferenceMeta } from '@algorandfoundation/algokit-transact'\n\n/**\n * These are resources that were accessed by this group that would normally have caused failure, but were allowed in simulation. Depending on where this object is in the response, the unnamed resources it contains may or may not qualify for group resource sharing. If this is a field in SimulateTransactionGroupResult, the resources do qualify, but if this is a field in SimulateTransactionResult, they do not qualify. In order to make this group valid for actual submission, resources that qualify for group sharing can be made available by any transaction of the group; otherwise, resources must be placed in the same transaction which accessed them.\n */\nexport type SimulateUnnamedResourcesAccessed = {\n /**\n * The unnamed accounts that were referenced. The order of this array is arbitrary.\n */\n accounts?: Address[]\n\n /**\n * The unnamed assets that were referenced. The order of this array is arbitrary.\n */\n assets?: bigint[]\n\n /**\n * The unnamed applications that were referenced. The order of this array is arbitrary.\n */\n apps?: bigint[]\n\n /**\n * The unnamed boxes that were referenced. The order of this array is arbitrary.\n */\n boxes?: BoxReference[]\n\n /**\n * The number of extra box references used to increase the IO budget. This is in addition to the references defined in the input transaction group and any referenced to unnamed boxes.\n */\n extraBoxRefs?: number\n\n /**\n * The unnamed asset holdings that were referenced. The order of this array is arbitrary.\n */\n assetHoldings?: HoldingReference[]\n\n /**\n * The unnamed application local states that were referenced. The order of this array is arbitrary.\n */\n appLocals?: LocalsReference[]\n}\n\nexport const SimulateUnnamedResourcesAccessedMeta: ObjectModelMetadata<SimulateUnnamedResourcesAccessed> = {\n name: 'SimulateUnnamedResourcesAccessed',\n kind: 'object',\n fields: [\n {\n name: 'accounts',\n wireKey: 'accounts',\n optional: true,\n codec: addressArrayCodec,\n },\n {\n name: 'assets',\n wireKey: 'assets',\n optional: true,\n codec: bigIntArrayCodec,\n },\n {\n name: 'apps',\n wireKey: 'apps',\n optional: true,\n codec: bigIntArrayCodec,\n },\n {\n name: 'boxes',\n wireKey: 'boxes',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(BoxReferenceMeta)),\n },\n {\n name: 'extraBoxRefs',\n wireKey: 'extra-box-refs',\n optional: true,\n codec: numberCodec,\n },\n {\n name: 'assetHoldings',\n wireKey: 'asset-holdings',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(HoldingReferenceMeta)),\n },\n {\n name: 'appLocals',\n wireKey: 'app-locals',\n optional: true,\n codec: new ArrayCodec(new ObjectModelCodec(LocalsReferenceMeta)),\n },\n ],\n}\n"],"mappings":";;;;;;AA6CA,MAAaA,uCAA8F;CACzG,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,iBAAiB,CAAC;GAC9D;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,qBAAqB,CAAC;GAClE;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO,IAAI,WAAW,IAAI,iBAAiB,oBAAoB,CAAC;GACjE;EACF;CACF"}
@@ -1,5 +1,5 @@
1
1
  const require_bigint = require('../../../common/src/codecs/primitives/bigint.js');
2
- const require_bytes = require('../../../common/src/codecs/primitives/bytes.js');
2
+ const require_fixed_bytes = require('../../../common/src/codecs/primitives/fixed-bytes.js');
3
3
  const require_string = require('../../../common/src/codecs/primitives/string.js');
4
4
 
5
5
  //#region packages/algod_client/src/models/transaction-parameters-response.ts
@@ -23,7 +23,7 @@ const TransactionParametersResponseMeta = {
23
23
  name: "genesisHash",
24
24
  wireKey: "genesis-hash",
25
25
  optional: false,
26
- codec: require_bytes.bytesCodec
26
+ codec: require_fixed_bytes.fixedBytes32Codec
27
27
  },
28
28
  {
29
29
  name: "genesisId",
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-parameters-response.js","names":["TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse>","stringCodec","bigIntCodec","bytesCodec"],"sources":["../../../../../packages/algod_client/src/models/transaction-parameters-response.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { stringCodec, bigIntCodec, bytesCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * TransactionParams contains the parameters that help a client construct\n * a new transaction.\n */\nexport type TransactionParametersResponse = {\n /**\n * ConsensusVersion indicates the consensus protocol version\n * as of LastRound.\n */\n consensusVersion: string\n\n /**\n * Fee is the suggested transaction fee\n * Fee is in units of micro-Algos per byte.\n * Fee may fall to zero but transactions must still have a fee of\n * at least MinTxnFee for the current network protocol.\n */\n fee: bigint\n\n /**\n * GenesisHash is the hash of the genesis block.\n */\n genesisHash: Uint8Array\n\n /**\n * GenesisID is an ID listed in the genesis block.\n */\n genesisId: string\n\n /**\n * LastRound indicates the last round seen\n */\n lastRound: bigint\n\n /**\n * The minimum transaction fee (not per byte) required for the\n * txn to validate for the current network protocol.\n */\n minFee: bigint\n}\n\nexport const TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse> = {\n name: 'TransactionParametersResponse',\n kind: 'object',\n fields: [\n {\n name: 'consensusVersion',\n wireKey: 'consensus-version',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'fee',\n wireKey: 'fee',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'genesisHash',\n wireKey: 'genesis-hash',\n optional: false,\n codec: bytesCodec,\n },\n {\n name: 'genesisId',\n wireKey: 'genesis-id',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'lastRound',\n wireKey: 'last-round',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'minFee',\n wireKey: 'min-fee',\n optional: false,\n codec: bigIntCodec,\n },\n ],\n}\n"],"mappings":";;;;;AA4CA,MAAaA,oCAAwF;CACnG,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOF;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACF;CACF"}
1
+ {"version":3,"file":"transaction-parameters-response.js","names":["TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse>","stringCodec","bigIntCodec","fixedBytes32Codec"],"sources":["../../../../../packages/algod_client/src/models/transaction-parameters-response.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { stringCodec, bigIntCodec, fixedBytes32Codec } from '@algorandfoundation/algokit-common'\n\n/**\n * TransactionParams contains the parameters that help a client construct\n * a new transaction.\n */\nexport type TransactionParametersResponse = {\n /**\n * ConsensusVersion indicates the consensus protocol version\n * as of LastRound.\n */\n consensusVersion: string\n\n /**\n * Fee is the suggested transaction fee\n * Fee is in units of micro-Algos per byte.\n * Fee may fall to zero but transactions must still have a fee of\n * at least MinTxnFee for the current network protocol.\n */\n fee: bigint\n\n /**\n * GenesisHash is the hash of the genesis block.\n */\n genesisHash: Uint8Array\n\n /**\n * GenesisID is an ID listed in the genesis block.\n */\n genesisId: string\n\n /**\n * LastRound indicates the last round seen\n */\n lastRound: bigint\n\n /**\n * The minimum transaction fee (not per byte) required for the\n * txn to validate for the current network protocol.\n */\n minFee: bigint\n}\n\nexport const TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse> = {\n name: 'TransactionParametersResponse',\n kind: 'object',\n fields: [\n {\n name: 'consensusVersion',\n wireKey: 'consensus-version',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'fee',\n wireKey: 'fee',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'genesisHash',\n wireKey: 'genesis-hash',\n optional: false,\n codec: fixedBytes32Codec,\n },\n {\n name: 'genesisId',\n wireKey: 'genesis-id',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'lastRound',\n wireKey: 'last-round',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'minFee',\n wireKey: 'min-fee',\n optional: false,\n codec: bigIntCodec,\n },\n ],\n}\n"],"mappings":";;;;;AA4CA,MAAaA,oCAAwF;CACnG,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOF;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOC;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAOA;GACR;EACF;CACF"}
@@ -1,5 +1,5 @@
1
1
  import { bigIntCodec } from "../../../common/src/codecs/primitives/bigint.mjs";
2
- import { bytesCodec } from "../../../common/src/codecs/primitives/bytes.mjs";
2
+ import { fixedBytes32Codec } from "../../../common/src/codecs/primitives/fixed-bytes.mjs";
3
3
  import { stringCodec } from "../../../common/src/codecs/primitives/string.mjs";
4
4
 
5
5
  //#region packages/algod_client/src/models/transaction-parameters-response.ts
@@ -23,7 +23,7 @@ const TransactionParametersResponseMeta = {
23
23
  name: "genesisHash",
24
24
  wireKey: "genesis-hash",
25
25
  optional: false,
26
- codec: bytesCodec
26
+ codec: fixedBytes32Codec
27
27
  },
28
28
  {
29
29
  name: "genesisId",
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-parameters-response.mjs","names":["TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse>"],"sources":["../../../../../packages/algod_client/src/models/transaction-parameters-response.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { stringCodec, bigIntCodec, bytesCodec } from '@algorandfoundation/algokit-common'\n\n/**\n * TransactionParams contains the parameters that help a client construct\n * a new transaction.\n */\nexport type TransactionParametersResponse = {\n /**\n * ConsensusVersion indicates the consensus protocol version\n * as of LastRound.\n */\n consensusVersion: string\n\n /**\n * Fee is the suggested transaction fee\n * Fee is in units of micro-Algos per byte.\n * Fee may fall to zero but transactions must still have a fee of\n * at least MinTxnFee for the current network protocol.\n */\n fee: bigint\n\n /**\n * GenesisHash is the hash of the genesis block.\n */\n genesisHash: Uint8Array\n\n /**\n * GenesisID is an ID listed in the genesis block.\n */\n genesisId: string\n\n /**\n * LastRound indicates the last round seen\n */\n lastRound: bigint\n\n /**\n * The minimum transaction fee (not per byte) required for the\n * txn to validate for the current network protocol.\n */\n minFee: bigint\n}\n\nexport const TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse> = {\n name: 'TransactionParametersResponse',\n kind: 'object',\n fields: [\n {\n name: 'consensusVersion',\n wireKey: 'consensus-version',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'fee',\n wireKey: 'fee',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'genesisHash',\n wireKey: 'genesis-hash',\n optional: false,\n codec: bytesCodec,\n },\n {\n name: 'genesisId',\n wireKey: 'genesis-id',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'lastRound',\n wireKey: 'last-round',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'minFee',\n wireKey: 'min-fee',\n optional: false,\n codec: bigIntCodec,\n },\n ],\n}\n"],"mappings":";;;;;AA4CA,MAAaA,oCAAwF;CACnG,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACF;CACF"}
1
+ {"version":3,"file":"transaction-parameters-response.mjs","names":["TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse>"],"sources":["../../../../../packages/algod_client/src/models/transaction-parameters-response.ts"],"sourcesContent":["import type { ObjectModelMetadata } from '@algorandfoundation/algokit-common'\nimport { stringCodec, bigIntCodec, fixedBytes32Codec } from '@algorandfoundation/algokit-common'\n\n/**\n * TransactionParams contains the parameters that help a client construct\n * a new transaction.\n */\nexport type TransactionParametersResponse = {\n /**\n * ConsensusVersion indicates the consensus protocol version\n * as of LastRound.\n */\n consensusVersion: string\n\n /**\n * Fee is the suggested transaction fee\n * Fee is in units of micro-Algos per byte.\n * Fee may fall to zero but transactions must still have a fee of\n * at least MinTxnFee for the current network protocol.\n */\n fee: bigint\n\n /**\n * GenesisHash is the hash of the genesis block.\n */\n genesisHash: Uint8Array\n\n /**\n * GenesisID is an ID listed in the genesis block.\n */\n genesisId: string\n\n /**\n * LastRound indicates the last round seen\n */\n lastRound: bigint\n\n /**\n * The minimum transaction fee (not per byte) required for the\n * txn to validate for the current network protocol.\n */\n minFee: bigint\n}\n\nexport const TransactionParametersResponseMeta: ObjectModelMetadata<TransactionParametersResponse> = {\n name: 'TransactionParametersResponse',\n kind: 'object',\n fields: [\n {\n name: 'consensusVersion',\n wireKey: 'consensus-version',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'fee',\n wireKey: 'fee',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'genesisHash',\n wireKey: 'genesis-hash',\n optional: false,\n codec: fixedBytes32Codec,\n },\n {\n name: 'genesisId',\n wireKey: 'genesis-id',\n optional: false,\n codec: stringCodec,\n },\n {\n name: 'lastRound',\n wireKey: 'last-round',\n optional: false,\n codec: bigIntCodec,\n },\n {\n name: 'minFee',\n wireKey: 'min-fee',\n optional: false,\n codec: bigIntCodec,\n },\n ],\n}\n"],"mappings":";;;;;AA4CA,MAAaA,oCAAwF;CACnG,MAAM;CACN,MAAM;CACN,QAAQ;EACN;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACD;GACE,MAAM;GACN,SAAS;GACT,UAAU;GACV,OAAO;GACR;EACF;CACF"}
@@ -102,19 +102,6 @@ function getOptionalAddress(addr) {
102
102
  if (addr === void 0) return;
103
103
  return getAddress(addr);
104
104
  }
105
- /**
106
- * isValidAddress checks if a string is a valid Algorand address.
107
- * @param address - an Algorand address with checksum.
108
- * @returns true if valid, false otherwise
109
- */
110
- function isValidAddress(address) {
111
- try {
112
- Address.fromString(address);
113
- } catch {
114
- return false;
115
- }
116
- return true;
117
- }
118
105
  const APP_ID_PREFIX = new TextEncoder().encode("appID");
119
106
  /**
120
107
  * Get the escrow address of an application.
@@ -152,5 +139,4 @@ exports.encodeAddress = encodeAddress;
152
139
  exports.getAddress = getAddress;
153
140
  exports.getApplicationAddress = getApplicationAddress;
154
141
  exports.getOptionalAddress = getOptionalAddress;
155
- exports.isValidAddress = isValidAddress;
156
142
  //# sourceMappingURL=address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.js","names":["sha512","HASH_BYTES_LENGTH","CHECKSUM_BYTE_LENGTH","arrayEqual","base32","concatArrays"],"sources":["../../../../packages/common/src/address.ts"],"sourcesContent":["import base32 from 'hi-base32'\nimport sha512 from 'js-sha512'\nimport { arrayEqual, concatArrays } from './array'\nimport { CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH } from './constants'\n\nexport const ALGORAND_ADDRESS_BYTE_LENGTH = 36\nexport const ALGORAND_CHECKSUM_BYTE_LENGTH = 4\nexport const ALGORAND_ADDRESS_LENGTH = 58\nexport const ALGORAND_ZERO_ADDRESS_STRING = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ'\n\nexport const MALFORMED_ADDRESS_ERROR_MSG = 'address seems to be malformed'\nexport const CHECKSUM_ADDRESS_ERROR_MSG = 'wrong checksum for address'\n\nexport function checksumFromPublicKey(publicKey: Uint8Array): Uint8Array {\n return Uint8Array.from(sha512.sha512_256.array(publicKey).slice(HASH_BYTES_LENGTH - CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH))\n}\n\nfunction genericHash(arr: sha512.Message) {\n return sha512.sha512_256.array(arr)\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nexport function encodeUint64(num: number | bigint) {\n const isInteger = typeof num === 'bigint' || Number.isInteger(num)\n\n if (!isInteger || num < 0 || num > BigInt('0xffffffffffffffff')) {\n throw new Error('Input is not a 64-bit unsigned integer')\n }\n\n const encoding = new Uint8Array(8)\n const view = new DataView(encoding.buffer)\n view.setBigUint64(0, BigInt(num))\n\n return encoding\n}\n\n/** Symbol used for instanceof checks across packages (CJS/ESM) */\nconst ADDR_SYMBOL = Symbol.for('algokit_common:Address')\n\n/**\n * Represents an Algorand address\n */\nexport class Address {\n /**\n * The binary form of the address. For standard accounts, this is the public key.\n */\n public readonly publicKey: Uint8Array;\n\n /** @internal */\n [ADDR_SYMBOL]: boolean\n\n /**\n * Create a new Address object from its binary form.\n * @param publicKey - The binary form of the address. Must be 32 bytes.\n */\n constructor(publicKey: Uint8Array) {\n this[ADDR_SYMBOL] = true\n if (publicKey.length !== ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: 0x${bytesToHex(publicKey)}, length ${publicKey.length}`)\n this.publicKey = publicKey\n }\n\n /**\n * Check if the address is equal to another address.\n */\n equals(other: Address): boolean {\n return other instanceof Address && arrayEqual(this.publicKey, other.publicKey)\n }\n\n /**\n * Compute the 4 byte checksum of the address.\n */\n checksum(): Uint8Array {\n return checksumFromPublicKey(this.publicKey)\n }\n\n /**\n * Encode the address into a string form.\n */\n toString(): string {\n const addr = base32.encode(concatArrays(this.publicKey, this.checksum()))\n return addr.slice(0, ALGORAND_ADDRESS_LENGTH) // removing the extra '===='\n }\n\n /**\n * Decode an address from a string.\n * @param address - The address to decode. Must be 58 characters long.\n * @returns An Address object corresponding to the input string.\n */\n static fromString(address: string): Address {\n if (typeof address !== 'string') throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected string, got ${typeof address}, ${address}`)\n if (address.length !== ALGORAND_ADDRESS_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected length ${ALGORAND_ADDRESS_LENGTH}, got ${address.length}: ${address}`)\n\n // try to decode\n const decoded = base32.decode.asBytes(address)\n // Sanity check\n if (decoded.length !== ALGORAND_ADDRESS_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected byte length ${ALGORAND_ADDRESS_BYTE_LENGTH}, got ${decoded.length}`)\n\n // Find publickey and checksum\n const pk = new Uint8Array(decoded.slice(0, ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n const cs = new Uint8Array(decoded.slice(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH, ALGORAND_ADDRESS_BYTE_LENGTH))\n const checksum = checksumFromPublicKey(pk)\n // Check if the checksum and the address are equal\n if (!arrayEqual(checksum, cs)) throw new Error(`${CHECKSUM_ADDRESS_ERROR_MSG}: ${address} (${cs}, ${checksum})`)\n\n return new Address(pk)\n }\n\n /**\n * Get the zero address.\n */\n static zeroAddress(): Address {\n return new Address(new Uint8Array(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n }\n\n static [Symbol.hasInstance](obj: unknown) {\n return Boolean(obj && typeof obj === 'object' && ADDR_SYMBOL in obj && obj[ADDR_SYMBOL as keyof typeof obj])\n }\n}\n\nexport interface Addressable {\n addr: Readonly<Address>\n}\n\nexport type ReadableAddress = Addressable | Address | string\n\nexport function getAddress(addr: ReadableAddress): Address {\n if (typeof addr == 'string') {\n return Address.fromString(addr)\n } else if ('addr' in addr) {\n return addr.addr\n } else {\n return addr\n }\n}\n\nexport function getOptionalAddress(addr: ReadableAddress | undefined): Address | undefined {\n if (addr === undefined) {\n return undefined\n }\n return getAddress(addr)\n}\n\n/**\n * isValidAddress checks if a string is a valid Algorand address.\n * @param address - an Algorand address with checksum.\n * @returns true if valid, false otherwise\n */\nexport function isValidAddress(address: string): boolean {\n // Try to decode\n try {\n Address.fromString(address)\n } catch {\n return false\n }\n return true\n}\n\nconst APP_ID_PREFIX = new TextEncoder().encode('appID')\n\n/**\n * Get the escrow address of an application.\n * @param appID - The ID of the application.\n * @returns The address corresponding to that application's escrow account.\n */\nexport function getApplicationAddress(appID: number | bigint): Address {\n const toBeSigned = concatArrays(APP_ID_PREFIX, encodeUint64(appID))\n const hash = genericHash(toBeSigned)\n return new Address(Uint8Array.from(hash))\n}\n\n/**\n * decodeAddress takes an Algorand address in string form and decodes it into a Uint8Array.\n * @param address - an Algorand address with checksum.\n * @returns the decoded form of the address's public key and checksum\n */\nexport function decodeAddress(address: string): Address {\n return Address.fromString(address)\n}\n\n/**\n * encodeAddress takes an Algorand address as a Uint8Array and encodes it into a string with checksum.\n * @param address - a raw Algorand address\n * @returns the address and checksum encoded as a string.\n */\nexport function encodeAddress(address: Uint8Array): string {\n return new Address(address).toString()\n}\n"],"mappings":";;;;;;;;;AAKA,MAAa,+BAA+B;AAC5C,MAAa,gCAAgC;AAC7C,MAAa,0BAA0B;AACvC,MAAa,+BAA+B;AAE5C,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;AAE1C,SAAgB,sBAAsB,WAAmC;AACvE,QAAO,WAAW,KAAKA,kBAAO,WAAW,MAAM,UAAU,CAAC,MAAMC,sCAAoBC,wCAAsBD,oCAAkB,CAAC;;AAG/H,SAAS,YAAY,KAAqB;AACxC,QAAOD,kBAAO,WAAW,MAAM,IAAI;;AAGrC,SAAS,WAAW,OAA2B;AAC7C,QAAO,OAAO,KAAK,MAAM,CAAC,SAAS,MAAM;;AAG3C,SAAgB,aAAa,KAAsB;AAGjD,KAAI,EAFc,OAAO,QAAQ,YAAY,OAAO,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AK,IAAI,WAAW,QAAQ,MAAM,+BAA+B,+BAA+B,6BAA6B,CAAC;EACpI,MAAM,WAAW,sBAAsB,GAAG;AAE1C,MAAI,CAACD,yBAAW,UAAU,GAAG,CAAE,OAAM,IAAI,MAAM,GAAG,2BAA2B,IAAI,QAAQ,IAAI,GAAG,IAAI,SAAS,GAAG;AAEhH,SAAO,IAAI,QAAQ,GAAG;;;;;CAMxB,OAAO,cAAuB;AAC5B,SAAO,IAAI,QAAQ,IAAI,WAAW,+BAA+B,8BAA8B,CAAC;;CAGlG,QAAQ,OAAO,aAAa,KAAc;AACxC,SAAO,QAAQ,OAAO,OAAO,QAAQ,YAAY,eAAe,OAAO,IAAI,aAAiC;;;AAUhH,SAAgB,WAAW,MAAgC;AACzD,KAAI,OAAO,QAAQ,SACjB,QAAO,QAAQ,WAAW,KAAK;UACtB,UAAU,KACnB,QAAO,KAAK;KAEZ,QAAO;;AAIX,SAAgB,mBAAmB,MAAwD;AACzF,KAAI,SAAS,OACX;AAEF,QAAO,WAAW,KAAK;;;;;;;AAQzB,SAAgB,eAAe,SAA0B;AAEvD,KAAI;AACF,UAAQ,WAAW,QAAQ;SACrB;AACN,SAAO;;AAET,QAAO;;AAGT,MAAM,gBAAgB,IAAI,aAAa,CAAC,OAAO,QAAQ;;;;;;AAOvD,SAAgB,sBAAsB,OAAiC;CAErE,MAAM,OAAO,YADME,2BAAa,eAAe,aAAa,MAAM,CAAC,CAC/B;AACpC,QAAO,IAAI,QAAQ,WAAW,KAAK,KAAK,CAAC;;;;;;;AAQ3C,SAAgB,cAAc,SAA0B;AACtD,QAAO,QAAQ,WAAW,QAAQ;;;;;;;AAQpC,SAAgB,cAAc,SAA6B;AACzD,QAAO,IAAI,QAAQ,QAAQ,CAAC,UAAU"}
1
+ {"version":3,"file":"address.js","names":["sha512","HASH_BYTES_LENGTH","CHECKSUM_BYTE_LENGTH","arrayEqual","base32","concatArrays"],"sources":["../../../../packages/common/src/address.ts"],"sourcesContent":["import base32 from 'hi-base32'\nimport sha512 from 'js-sha512'\nimport { arrayEqual, concatArrays } from './array'\nimport { CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH } from './constants'\n\nexport const ALGORAND_ADDRESS_BYTE_LENGTH = 36\nexport const ALGORAND_CHECKSUM_BYTE_LENGTH = 4\nexport const ALGORAND_ADDRESS_LENGTH = 58\nexport const ALGORAND_ZERO_ADDRESS_STRING = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ'\n\nexport const MALFORMED_ADDRESS_ERROR_MSG = 'address seems to be malformed'\nexport const CHECKSUM_ADDRESS_ERROR_MSG = 'wrong checksum for address'\n\nexport function checksumFromPublicKey(publicKey: Uint8Array): Uint8Array {\n return Uint8Array.from(sha512.sha512_256.array(publicKey).slice(HASH_BYTES_LENGTH - CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH))\n}\n\nfunction genericHash(arr: sha512.Message) {\n return sha512.sha512_256.array(arr)\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nexport function encodeUint64(num: number | bigint) {\n const isInteger = typeof num === 'bigint' || Number.isInteger(num)\n\n if (!isInteger || num < 0 || num > BigInt('0xffffffffffffffff')) {\n throw new Error('Input is not a 64-bit unsigned integer')\n }\n\n const encoding = new Uint8Array(8)\n const view = new DataView(encoding.buffer)\n view.setBigUint64(0, BigInt(num))\n\n return encoding\n}\n\n/** Symbol used for instanceof checks across packages (CJS/ESM) */\nconst ADDR_SYMBOL = Symbol.for('algokit_common:Address')\n\n/**\n * Represents an Algorand address\n */\nexport class Address {\n /**\n * The binary form of the address. For standard accounts, this is the public key.\n */\n public readonly publicKey: Uint8Array;\n\n /** @internal */\n [ADDR_SYMBOL]: boolean\n\n /**\n * Create a new Address object from its binary form.\n * @param publicKey - The binary form of the address. Must be 32 bytes.\n */\n constructor(publicKey: Uint8Array) {\n this[ADDR_SYMBOL] = true\n if (publicKey.length !== ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: 0x${bytesToHex(publicKey)}, length ${publicKey.length}`)\n this.publicKey = publicKey\n }\n\n /**\n * Check if the address is equal to another address.\n */\n equals(other: Address): boolean {\n return other instanceof Address && arrayEqual(this.publicKey, other.publicKey)\n }\n\n /**\n * Compute the 4 byte checksum of the address.\n */\n checksum(): Uint8Array {\n return checksumFromPublicKey(this.publicKey)\n }\n\n /**\n * Encode the address into a string form.\n */\n toString(): string {\n const addr = base32.encode(concatArrays(this.publicKey, this.checksum()))\n return addr.slice(0, ALGORAND_ADDRESS_LENGTH) // removing the extra '===='\n }\n\n /**\n * Decode an address from a string.\n * @param address - The address to decode. Must be 58 characters long.\n * @returns An Address object corresponding to the input string.\n */\n static fromString(address: string): Address {\n if (typeof address !== 'string') throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected string, got ${typeof address}, ${address}`)\n if (address.length !== ALGORAND_ADDRESS_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected length ${ALGORAND_ADDRESS_LENGTH}, got ${address.length}: ${address}`)\n\n // try to decode\n const decoded = base32.decode.asBytes(address)\n // Sanity check\n if (decoded.length !== ALGORAND_ADDRESS_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected byte length ${ALGORAND_ADDRESS_BYTE_LENGTH}, got ${decoded.length}`)\n\n // Find publickey and checksum\n const pk = new Uint8Array(decoded.slice(0, ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n const cs = new Uint8Array(decoded.slice(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH, ALGORAND_ADDRESS_BYTE_LENGTH))\n const checksum = checksumFromPublicKey(pk)\n // Check if the checksum and the address are equal\n if (!arrayEqual(checksum, cs)) throw new Error(`${CHECKSUM_ADDRESS_ERROR_MSG}: ${address} (${cs}, ${checksum})`)\n\n return new Address(pk)\n }\n\n /**\n * Get the zero address.\n */\n static zeroAddress(): Address {\n return new Address(new Uint8Array(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n }\n\n static [Symbol.hasInstance](obj: unknown) {\n return Boolean(obj && typeof obj === 'object' && ADDR_SYMBOL in obj && obj[ADDR_SYMBOL as keyof typeof obj])\n }\n}\n\nexport interface Addressable {\n addr: Readonly<Address>\n}\n\nexport type ReadableAddress = Addressable | Address | string\n\nexport function getAddress(addr: ReadableAddress): Address {\n if (typeof addr == 'string') {\n return Address.fromString(addr)\n } else if ('addr' in addr) {\n return addr.addr\n } else {\n return addr\n }\n}\n\nexport function getOptionalAddress(addr: ReadableAddress | undefined): Address | undefined {\n if (addr === undefined) {\n return undefined\n }\n return getAddress(addr)\n}\n\n/**\n * isValidAddress checks if a string is a valid Algorand address.\n * @param address - an Algorand address with checksum.\n * @returns true if valid, false otherwise\n */\nexport function isValidAddress(address: string): boolean {\n // Try to decode\n try {\n Address.fromString(address)\n } catch {\n return false\n }\n return true\n}\n\nconst APP_ID_PREFIX = new TextEncoder().encode('appID')\n\n/**\n * Get the escrow address of an application.\n * @param appID - The ID of the application.\n * @returns The address corresponding to that application's escrow account.\n */\nexport function getApplicationAddress(appID: number | bigint): Address {\n const toBeSigned = concatArrays(APP_ID_PREFIX, encodeUint64(appID))\n const hash = genericHash(toBeSigned)\n return new Address(Uint8Array.from(hash))\n}\n\n/**\n * decodeAddress takes an Algorand address in string form and decodes it into a Uint8Array.\n * @param address - an Algorand address with checksum.\n * @returns the decoded form of the address's public key and checksum\n */\nexport function decodeAddress(address: string): Address {\n return Address.fromString(address)\n}\n\n/**\n * encodeAddress takes an Algorand address as a Uint8Array and encodes it into a string with checksum.\n * @param address - a raw Algorand address\n * @returns the address and checksum encoded as a string.\n */\nexport function encodeAddress(address: Uint8Array): string {\n return new Address(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AiC;CAErE,MAAM,OAAO,YADME,2BAAa,eAAe,aAAa,MAAM,CAAC,CAC/B;AACpC,QAAO,IAAI,QAAQ,WAAW,KAAK,KAAK,CAAC;;;;;;;AAQ3C,SAAgB,cAAc,SAA0B;AACtD,QAAO,QAAQ,WAAW,QAAQ;;;;;;;AAQpC,SAAgB,cAAc,SAA6B;AACzD,QAAO,IAAI,QAAQ,QAAQ,CAAC,UAAU"}
@@ -99,19 +99,6 @@ function getOptionalAddress(addr) {
99
99
  if (addr === void 0) return;
100
100
  return getAddress(addr);
101
101
  }
102
- /**
103
- * isValidAddress checks if a string is a valid Algorand address.
104
- * @param address - an Algorand address with checksum.
105
- * @returns true if valid, false otherwise
106
- */
107
- function isValidAddress(address) {
108
- try {
109
- Address.fromString(address);
110
- } catch {
111
- return false;
112
- }
113
- return true;
114
- }
115
102
  const APP_ID_PREFIX = new TextEncoder().encode("appID");
116
103
  /**
117
104
  * Get the escrow address of an application.
@@ -140,5 +127,5 @@ function encodeAddress(address) {
140
127
  }
141
128
 
142
129
  //#endregion
143
- export { ALGORAND_ADDRESS_BYTE_LENGTH, ALGORAND_CHECKSUM_BYTE_LENGTH, ALGORAND_ZERO_ADDRESS_STRING, Address, decodeAddress, encodeAddress, getAddress, getApplicationAddress, getOptionalAddress, isValidAddress };
130
+ export { ALGORAND_ADDRESS_BYTE_LENGTH, ALGORAND_CHECKSUM_BYTE_LENGTH, ALGORAND_ZERO_ADDRESS_STRING, Address, decodeAddress, encodeAddress, getAddress, getApplicationAddress, getOptionalAddress };
144
131
  //# sourceMappingURL=address.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"address.mjs","names":[],"sources":["../../../../packages/common/src/address.ts"],"sourcesContent":["import base32 from 'hi-base32'\nimport sha512 from 'js-sha512'\nimport { arrayEqual, concatArrays } from './array'\nimport { CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH } from './constants'\n\nexport const ALGORAND_ADDRESS_BYTE_LENGTH = 36\nexport const ALGORAND_CHECKSUM_BYTE_LENGTH = 4\nexport const ALGORAND_ADDRESS_LENGTH = 58\nexport const ALGORAND_ZERO_ADDRESS_STRING = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ'\n\nexport const MALFORMED_ADDRESS_ERROR_MSG = 'address seems to be malformed'\nexport const CHECKSUM_ADDRESS_ERROR_MSG = 'wrong checksum for address'\n\nexport function checksumFromPublicKey(publicKey: Uint8Array): Uint8Array {\n return Uint8Array.from(sha512.sha512_256.array(publicKey).slice(HASH_BYTES_LENGTH - CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH))\n}\n\nfunction genericHash(arr: sha512.Message) {\n return sha512.sha512_256.array(arr)\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nexport function encodeUint64(num: number | bigint) {\n const isInteger = typeof num === 'bigint' || Number.isInteger(num)\n\n if (!isInteger || num < 0 || num > BigInt('0xffffffffffffffff')) {\n throw new Error('Input is not a 64-bit unsigned integer')\n }\n\n const encoding = new Uint8Array(8)\n const view = new DataView(encoding.buffer)\n view.setBigUint64(0, BigInt(num))\n\n return encoding\n}\n\n/** Symbol used for instanceof checks across packages (CJS/ESM) */\nconst ADDR_SYMBOL = Symbol.for('algokit_common:Address')\n\n/**\n * Represents an Algorand address\n */\nexport class Address {\n /**\n * The binary form of the address. For standard accounts, this is the public key.\n */\n public readonly publicKey: Uint8Array;\n\n /** @internal */\n [ADDR_SYMBOL]: boolean\n\n /**\n * Create a new Address object from its binary form.\n * @param publicKey - The binary form of the address. Must be 32 bytes.\n */\n constructor(publicKey: Uint8Array) {\n this[ADDR_SYMBOL] = true\n if (publicKey.length !== ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: 0x${bytesToHex(publicKey)}, length ${publicKey.length}`)\n this.publicKey = publicKey\n }\n\n /**\n * Check if the address is equal to another address.\n */\n equals(other: Address): boolean {\n return other instanceof Address && arrayEqual(this.publicKey, other.publicKey)\n }\n\n /**\n * Compute the 4 byte checksum of the address.\n */\n checksum(): Uint8Array {\n return checksumFromPublicKey(this.publicKey)\n }\n\n /**\n * Encode the address into a string form.\n */\n toString(): string {\n const addr = base32.encode(concatArrays(this.publicKey, this.checksum()))\n return addr.slice(0, ALGORAND_ADDRESS_LENGTH) // removing the extra '===='\n }\n\n /**\n * Decode an address from a string.\n * @param address - The address to decode. Must be 58 characters long.\n * @returns An Address object corresponding to the input string.\n */\n static fromString(address: string): Address {\n if (typeof address !== 'string') throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected string, got ${typeof address}, ${address}`)\n if (address.length !== ALGORAND_ADDRESS_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected length ${ALGORAND_ADDRESS_LENGTH}, got ${address.length}: ${address}`)\n\n // try to decode\n const decoded = base32.decode.asBytes(address)\n // Sanity check\n if (decoded.length !== ALGORAND_ADDRESS_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected byte length ${ALGORAND_ADDRESS_BYTE_LENGTH}, got ${decoded.length}`)\n\n // Find publickey and checksum\n const pk = new Uint8Array(decoded.slice(0, ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n const cs = new Uint8Array(decoded.slice(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH, ALGORAND_ADDRESS_BYTE_LENGTH))\n const checksum = checksumFromPublicKey(pk)\n // Check if the checksum and the address are equal\n if (!arrayEqual(checksum, cs)) throw new Error(`${CHECKSUM_ADDRESS_ERROR_MSG}: ${address} (${cs}, ${checksum})`)\n\n return new Address(pk)\n }\n\n /**\n * Get the zero address.\n */\n static zeroAddress(): Address {\n return new Address(new Uint8Array(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n }\n\n static [Symbol.hasInstance](obj: unknown) {\n return Boolean(obj && typeof obj === 'object' && ADDR_SYMBOL in obj && obj[ADDR_SYMBOL as keyof typeof obj])\n }\n}\n\nexport interface Addressable {\n addr: Readonly<Address>\n}\n\nexport type ReadableAddress = Addressable | Address | string\n\nexport function getAddress(addr: ReadableAddress): Address {\n if (typeof addr == 'string') {\n return Address.fromString(addr)\n } else if ('addr' in addr) {\n return addr.addr\n } else {\n return addr\n }\n}\n\nexport function getOptionalAddress(addr: ReadableAddress | undefined): Address | undefined {\n if (addr === undefined) {\n return undefined\n }\n return getAddress(addr)\n}\n\n/**\n * isValidAddress checks if a string is a valid Algorand address.\n * @param address - an Algorand address with checksum.\n * @returns true if valid, false otherwise\n */\nexport function isValidAddress(address: string): boolean {\n // Try to decode\n try {\n Address.fromString(address)\n } catch {\n return false\n }\n return true\n}\n\nconst APP_ID_PREFIX = new TextEncoder().encode('appID')\n\n/**\n * Get the escrow address of an application.\n * @param appID - The ID of the application.\n * @returns The address corresponding to that application's escrow account.\n */\nexport function getApplicationAddress(appID: number | bigint): Address {\n const toBeSigned = concatArrays(APP_ID_PREFIX, encodeUint64(appID))\n const hash = genericHash(toBeSigned)\n return new Address(Uint8Array.from(hash))\n}\n\n/**\n * decodeAddress takes an Algorand address in string form and decodes it into a Uint8Array.\n * @param address - an Algorand address with checksum.\n * @returns the decoded form of the address's public key and checksum\n */\nexport function decodeAddress(address: string): Address {\n return Address.fromString(address)\n}\n\n/**\n * encodeAddress takes an Algorand address as a Uint8Array and encodes it into a string with checksum.\n * @param address - a raw Algorand address\n * @returns the address and checksum encoded as a string.\n */\nexport function encodeAddress(address: Uint8Array): string {\n return new Address(address).toString()\n}\n"],"mappings":";;;;;;AAKA,MAAa,+BAA+B;AAC5C,MAAa,gCAAgC;AAC7C,MAAa,0BAA0B;AACvC,MAAa,+BAA+B;AAE5C,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;AAE1C,S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Q,WAAW,KAAK,KAAK,CAAC;;;;;;;AAQ3C,SAAgB,cAAc,SAA0B;AACtD,QAAO,QAAQ,WAAW,QAAQ;;;;;;;AAQpC,SAAgB,cAAc,SAA6B;AACzD,QAAO,IAAI,QAAQ,QAAQ,CAAC,UAAU"}
1
+ {"version":3,"file":"address.mjs","names":[],"sources":["../../../../packages/common/src/address.ts"],"sourcesContent":["import base32 from 'hi-base32'\nimport sha512 from 'js-sha512'\nimport { arrayEqual, concatArrays } from './array'\nimport { CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH } from './constants'\n\nexport const ALGORAND_ADDRESS_BYTE_LENGTH = 36\nexport const ALGORAND_CHECKSUM_BYTE_LENGTH = 4\nexport const ALGORAND_ADDRESS_LENGTH = 58\nexport const ALGORAND_ZERO_ADDRESS_STRING = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ'\n\nexport const MALFORMED_ADDRESS_ERROR_MSG = 'address seems to be malformed'\nexport const CHECKSUM_ADDRESS_ERROR_MSG = 'wrong checksum for address'\n\nexport function checksumFromPublicKey(publicKey: Uint8Array): Uint8Array {\n return Uint8Array.from(sha512.sha512_256.array(publicKey).slice(HASH_BYTES_LENGTH - CHECKSUM_BYTE_LENGTH, HASH_BYTES_LENGTH))\n}\n\nfunction genericHash(arr: sha512.Message) {\n return sha512.sha512_256.array(arr)\n}\n\nfunction bytesToHex(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nexport function encodeUint64(num: number | bigint) {\n const isInteger = typeof num === 'bigint' || Number.isInteger(num)\n\n if (!isInteger || num < 0 || num > BigInt('0xffffffffffffffff')) {\n throw new Error('Input is not a 64-bit unsigned integer')\n }\n\n const encoding = new Uint8Array(8)\n const view = new DataView(encoding.buffer)\n view.setBigUint64(0, BigInt(num))\n\n return encoding\n}\n\n/** Symbol used for instanceof checks across packages (CJS/ESM) */\nconst ADDR_SYMBOL = Symbol.for('algokit_common:Address')\n\n/**\n * Represents an Algorand address\n */\nexport class Address {\n /**\n * The binary form of the address. For standard accounts, this is the public key.\n */\n public readonly publicKey: Uint8Array;\n\n /** @internal */\n [ADDR_SYMBOL]: boolean\n\n /**\n * Create a new Address object from its binary form.\n * @param publicKey - The binary form of the address. Must be 32 bytes.\n */\n constructor(publicKey: Uint8Array) {\n this[ADDR_SYMBOL] = true\n if (publicKey.length !== ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: 0x${bytesToHex(publicKey)}, length ${publicKey.length}`)\n this.publicKey = publicKey\n }\n\n /**\n * Check if the address is equal to another address.\n */\n equals(other: Address): boolean {\n return other instanceof Address && arrayEqual(this.publicKey, other.publicKey)\n }\n\n /**\n * Compute the 4 byte checksum of the address.\n */\n checksum(): Uint8Array {\n return checksumFromPublicKey(this.publicKey)\n }\n\n /**\n * Encode the address into a string form.\n */\n toString(): string {\n const addr = base32.encode(concatArrays(this.publicKey, this.checksum()))\n return addr.slice(0, ALGORAND_ADDRESS_LENGTH) // removing the extra '===='\n }\n\n /**\n * Decode an address from a string.\n * @param address - The address to decode. Must be 58 characters long.\n * @returns An Address object corresponding to the input string.\n */\n static fromString(address: string): Address {\n if (typeof address !== 'string') throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected string, got ${typeof address}, ${address}`)\n if (address.length !== ALGORAND_ADDRESS_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected length ${ALGORAND_ADDRESS_LENGTH}, got ${address.length}: ${address}`)\n\n // try to decode\n const decoded = base32.decode.asBytes(address)\n // Sanity check\n if (decoded.length !== ALGORAND_ADDRESS_BYTE_LENGTH)\n throw new Error(`${MALFORMED_ADDRESS_ERROR_MSG}: expected byte length ${ALGORAND_ADDRESS_BYTE_LENGTH}, got ${decoded.length}`)\n\n // Find publickey and checksum\n const pk = new Uint8Array(decoded.slice(0, ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n const cs = new Uint8Array(decoded.slice(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH, ALGORAND_ADDRESS_BYTE_LENGTH))\n const checksum = checksumFromPublicKey(pk)\n // Check if the checksum and the address are equal\n if (!arrayEqual(checksum, cs)) throw new Error(`${CHECKSUM_ADDRESS_ERROR_MSG}: ${address} (${cs}, ${checksum})`)\n\n return new Address(pk)\n }\n\n /**\n * Get the zero address.\n */\n static zeroAddress(): Address {\n return new Address(new Uint8Array(ALGORAND_ADDRESS_BYTE_LENGTH - ALGORAND_CHECKSUM_BYTE_LENGTH))\n }\n\n static [Symbol.hasInstance](obj: unknown) {\n return Boolean(obj && typeof obj === 'object' && ADDR_SYMBOL in obj && obj[ADDR_SYMBOL as keyof typeof obj])\n }\n}\n\nexport interface Addressable {\n addr: Readonly<Address>\n}\n\nexport type ReadableAddress = Addressable | Address | string\n\nexport function getAddress(addr: ReadableAddress): Address {\n if (typeof addr == 'string') {\n return Address.fromString(addr)\n } else if ('addr' in addr) {\n return addr.addr\n } else {\n return addr\n }\n}\n\nexport function getOptionalAddress(addr: ReadableAddress | undefined): Address | undefined {\n if (addr === undefined) {\n return undefined\n }\n return getAddress(addr)\n}\n\n/**\n * isValidAddress checks if a string is a valid Algorand address.\n * @param address - an Algorand address with checksum.\n * @returns true if valid, false otherwise\n */\nexport function isValidAddress(address: string): boolean {\n // Try to decode\n try {\n Address.fromString(address)\n } catch {\n return false\n }\n return true\n}\n\nconst APP_ID_PREFIX = new TextEncoder().encode('appID')\n\n/**\n * Get the escrow address of an application.\n * @param appID - The ID of the application.\n * @returns The address corresponding to that application's escrow account.\n */\nexport function getApplicationAddress(appID: number | bigint): Address {\n const toBeSigned = concatArrays(APP_ID_PREFIX, encodeUint64(appID))\n const hash = genericHash(toBeSigned)\n return new Address(Uint8Array.from(hash))\n}\n\n/**\n * decodeAddress takes an Algorand address in string form and decodes it into a Uint8Array.\n * @param address - an Algorand address with checksum.\n * @returns the decoded form of the address's public key and checksum\n */\nexport function decodeAddress(address: string): Address {\n return Address.fromString(address)\n}\n\n/**\n * encodeAddress takes an Algorand address as a Uint8Array and encodes it into a string with checksum.\n * @param address - a raw Algorand address\n * @returns the address and checksum encoded as a string.\n */\nexport function encodeAddress(address: Uint8Array): string {\n return new Address(address).toString()\n}\n"],"mappings":";;;;;;AAKA,MAAa,+BAA+B;AAC5C,MAAa,gCAAgC;AAC7C,MAAa,0BAA0B;AACvC,MAAa,+BAA+B;AAE5C,MAAa,8BAA8B;AAC3C,MAAa,6BAA6B;AAE1C,SAAgB,sBAAsB,WAAmC;AACvE,QAAO,WAAW,KAAK,OAAO,WAAW,MAAM,UAAU,CAAC,MAAM,oBAAoB,sBAAsB,kBAAkB,CAAC;;AAG/H,SAAS,YAAY,KAAqB;AACxC,QAAO,OAAO,WAAW,MAAM,IAAI;;AAGrC,SAAS,WAAW,OAA2B;AAC7C,QAAO,OAAO,KAAK,MAAM,CAAC,SAAS,MAAM;;AAG3C,SAAgB,aAAa,KAAsB;AAGjD,KAAI,EAFc,OAAO,QAAQ,YAAY,OAAO,UAAU,IAAI,KAEhD,MAAM,KAAK,MAAM,OAAO,qBAAqB,CAC7D,OAAM,IAAI,MAAM,yCAAyC;CAG3D,MAAM,WAAW,IAAI,WAAW,EAAE;AAElC,CADa,IAAI,SAAS,SAAS,OAAO,CACrC,aAAa,GAAG,OAAO,IAAI,CAAC;AAEjC,QAAO;;;AAIT,MAAM,cAAc,OAAO,IAAI,yBAAyB;;;;AAKxD,IAAa,UAAb,MAAa,QAAQ;;;;CAInB,AAAgB;;CAGhB,CAAC;;;;;CAMD,YAAY,WAAuB;AACjC,OAAK,eAAe;AACpB,MAAI,UAAU,WAAW,+BAA+B,8BACtD,OAAM,IAAI,MAAM,GAAG,4BAA4B,MAAM,WAAW,UAAU,CAAC,WAAW,UAAU,SAAS;AAC3G,OAAK,YAA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AO,QAAQ,WAAW,KAAK;UACtB,UAAU,KACnB,QAAO,KAAK;KAEZ,QAAO;;AAIX,SAAgB,mBAAmB,MAAwD;AACzF,KAAI,SAAS,OACX;AAEF,QAAO,WAAW,KAAK;;AAkBzB,MAAM,gBAAgB,IAAI,aAAa,CAAC,OAAO,QAAQ;;;;;;AAOvD,SAAgB,sBAAsB,OAAiC;CAErE,MAAM,OAAO,YADM,aAAa,eAAe,aAAa,MAAM,CAAC,CAC/B;AACpC,QAAO,IAAI,QAAQ,WAAW,KAAK,KAAK,CAAC;;;;;;;AAQ3C,SAAgB,cAAc,SAA0B;AACtD,QAAO,QAAQ,WAAW,QAAQ;;;;;;;AAQpC,SAAgB,cAAc,SAA6B;AACzD,QAAO,IAAI,QAAQ,QAAQ,CAAC,UAAU"}
@@ -4,8 +4,9 @@ const require_codec = require('../codec.js');
4
4
  /**
5
5
  * Map codec - handles Maps with any key type (including Uint8Array, bigint, number)
6
6
  * Depending on the encoding format, the map is encoded differently:
7
- * - json: Only supports string keys and is represented as an object when encoding.
8
- * An exception is thrown upon encountering a non-string key.
7
+ * - json: Supports string and bigint keys. The map is represented as an object when encoding.
8
+ * Bigint keys are converted to/from strings (e.g., 1n becomes "1").
9
+ * An exception is thrown upon encountering an unsupported key type.
9
10
  * - msgpack: Preserves key types and is represented as a Map when encoding.
10
11
  */
11
12
  var MapCodec = class extends require_codec.Codec {
@@ -22,7 +23,7 @@ var MapCodec = class extends require_codec.Codec {
22
23
  }
23
24
  ensureKeyIsSupported(format) {
24
25
  if (format === "msgpack") return true;
25
- if (this.keyType !== "string") throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`);
26
+ if (this.keyType !== "string" && this.keyType !== "bigint") throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`);
26
27
  }
27
28
  toEncoded(value, format) {
28
29
  this.ensureKeyIsSupported(format);
@@ -49,7 +50,9 @@ var MapCodec = class extends require_codec.Codec {
49
50
  if (value instanceof Map) entries = Array.from(value.entries());
50
51
  else entries = Object.entries(value);
51
52
  for (const [encodedKey, encodedValue] of entries) {
52
- const key = this.keyCodec.decode(encodedKey, format);
53
+ let keyToDecode = encodedKey;
54
+ if (format === "json" && this.keyType === "bigint" && typeof encodedKey === "string") keyToDecode = BigInt(encodedKey);
55
+ const key = this.keyCodec.decode(keyToDecode, format);
53
56
  const val = this.valueCodec.decode(encodedValue, format);
54
57
  result.set(key, val);
55
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"map.js","names":["Codec","keyCodec: Codec<K, KEncoded>","valueCodec: Codec<V, VEncoded>","entries: Array<[KEncoded, VEncoded]>","obj: Record<string, VEncoded>"],"sources":["../../../../../../packages/common/src/codecs/composite/map.ts"],"sourcesContent":["import { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\n\n/**\n * Map codec - handles Maps with any key type (including Uint8Array, bigint, number)\n * Depending on the encoding format, the map is encoded differently:\n * - json: Only supports string keys and is represented as an object when encoding.\n * An exception is thrown upon encountering a non-string key.\n * - msgpack: Preserves key types and is represented as a Map when encoding.\n */\nexport class MapCodec<K, V, KEncoded = K, VEncoded = V> extends Codec<Map<K, V>, Map<KEncoded, VEncoded> | Record<string, VEncoded>> {\n private keyType: string\n\n constructor(\n private readonly keyCodec: Codec<K, KEncoded>,\n private readonly valueCodec: Codec<V, VEncoded>,\n ) {\n super()\n const defaultKeyValue = this.keyCodec.defaultValue()\n this.keyType = defaultKeyValue instanceof Uint8Array ? 'Uint8Array' : typeof defaultKeyValue\n }\n\n public defaultValue(): Map<K, V> {\n return new Map()\n }\n\n private ensureKeyIsSupported(format: EncodingFormat) {\n if (format === 'msgpack') {\n return true\n }\n if (this.keyType !== 'string') {\n throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`)\n }\n }\n\n protected toEncoded(value: Map<K, V>, format: EncodingFormat): Map<KEncoded, VEncoded> | Record<string, VEncoded> {\n this.ensureKeyIsSupported(format)\n\n const entries: Array<[KEncoded, VEncoded]> = []\n\n for (const [k, v] of value.entries()) {\n const encodedKey = this.keyCodec.encode(k, format)\n const encodedValue = this.valueCodec.encode(v, format)\n entries.push([encodedKey, encodedValue])\n }\n if (format === 'json') {\n const obj: Record<string, VEncoded> = {}\n for (const [k, v] of entries) {\n const keyStr = typeof k === 'string' ? k : String(k)\n obj[keyStr] = v\n }\n return obj\n }\n\n return new Map(entries)\n }\n\n protected fromEncoded(value: Map<KEncoded, VEncoded> | Record<string, VEncoded>, format: EncodingFormat): Map<K, V> {\n this.ensureKeyIsSupported(format)\n\n const result = new Map<K, V>()\n\n let entries: Array<[KEncoded, VEncoded]>\n if (value instanceof Map) {\n entries = Array.from(value.entries())\n } else {\n entries = Object.entries(value) as Array<[KEncoded, VEncoded]>\n }\n\n for (const [encodedKey, encodedValue] of entries) {\n const key = this.keyCodec.decode(encodedKey as KEncoded, format)\n const val = this.valueCodec.decode(encodedValue, format)\n result.set(key, val)\n }\n\n return result\n }\n\n public isDefaultValue(value: Map<K, V>): boolean {\n return value.size === 0\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAa,WAAb,cAAgEA,oBAAqE;CACnI,AAAQ;CAER,YACE,AAAiBC,UACjB,AAAiBC,YACjB;AACA,SAAO;EAHU;EACA;EAGjB,MAAM,kBAAkB,KAAK,SAAS,cAAc;AACpD,OAAK,UAAU,2BAA2B,aAAa,eAAe,OAAO;;CAG/E,AAAO,eAA0B;AAC/B,yBAAO,IAAI,KAAK;;CAGlB,AAAQ,qBAAqB,QAAwB;AACnD,MAAI,WAAW,UACb,QAAO;AAET,MAAI,KAAK,YAAY,SACnB,OAAM,IAAI,MAAM,oBAAoB,KAAK,QAAQ,wBAAwB,OAAO,SAAS;;CAI7F,AAAU,UAAU,OAAkB,QAA4E;AAChH,OAAK,qBAAqB,OAAO;EAEjC,MAAMC,UAAuC,EAAE;AAE/C,OAAK,MAAM,CAAC,GAAG,MAAM,MAAM,SAAS,EAAE;GACpC,MAAM,aAAa,KAAK,SAAS,OAAO,GAAG,OAAO;GAClD,MAAM,eAAe,KAAK,WAAW,OAAO,GAAG,OAAO;AACtD,WAAQ,KAAK,CAAC,YAAY,aAAa,CAAC;;AAE1C,MAAI,WAAW,QAAQ;GACrB,MAAMC,MAAgC,EAAE;AACxC,QAAK,MAAM,CAAC,GAAG,MAAM,SAAS;IAC5B,MAAM,SAAS,OAAO,MAAM,WAAW,IAAI,OAAO,EAAE;AACpD,QAAI,UAAU;;AAEhB,UAAO;;AAGT,SAAO,IAAI,IAAI,QAAQ;;CAGzB,AAAU,YAAY,OAA2D,QAAmC;AAClH,OAAK,qBAAqB,OAAO;EAEjC,MAAM,yBAAS,IAAI,KAAW;EAE9B,IAAID;AACJ,MAAI,iBAAiB,IACnB,WAAU,MAAM,KAAK,MAAM,SAAS,CAAC;MAErC,WAAU,OAAO,QAAQ,MAAM;AAGjC,OAAK,MAAM,CAAC,YAAY,iBAAiB,SAAS;GAChD,MAAM,MAAM,KAAK,SAAS,OAAO,YAAwB,OAAO;GAChE,MAAM,MAAM,KAAK,WAAW,OAAO,cAAc,OAAO;AACxD,UAAO,IAAI,KAAK,IAAI;;AAGtB,SAAO;;CAGT,AAAO,eAAe,OAA2B;AAC/C,SAAO,MAAM,SAAS"}
1
+ {"version":3,"file":"map.js","names":["Codec","keyCodec: Codec<K, KEncoded>","valueCodec: Codec<V, VEncoded>","entries: Array<[KEncoded, VEncoded]>","obj: Record<string, VEncoded>"],"sources":["../../../../../../packages/common/src/codecs/composite/map.ts"],"sourcesContent":["import { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\n\n/**\n * Map codec - handles Maps with any key type (including Uint8Array, bigint, number)\n * Depending on the encoding format, the map is encoded differently:\n * - json: Supports string and bigint keys. The map is represented as an object when encoding.\n * Bigint keys are converted to/from strings (e.g., 1n becomes \"1\").\n * An exception is thrown upon encountering an unsupported key type.\n * - msgpack: Preserves key types and is represented as a Map when encoding.\n */\nexport class MapCodec<K, V, KEncoded = K, VEncoded = V> extends Codec<Map<K, V>, Map<KEncoded, VEncoded> | Record<string, VEncoded>> {\n private keyType: string\n\n constructor(\n private readonly keyCodec: Codec<K, KEncoded>,\n private readonly valueCodec: Codec<V, VEncoded>,\n ) {\n super()\n const defaultKeyValue = this.keyCodec.defaultValue()\n this.keyType = defaultKeyValue instanceof Uint8Array ? 'Uint8Array' : typeof defaultKeyValue\n }\n\n public defaultValue(): Map<K, V> {\n return new Map()\n }\n\n private ensureKeyIsSupported(format: EncodingFormat) {\n if (format === 'msgpack') {\n return true\n }\n if (this.keyType !== 'string' && this.keyType !== 'bigint') {\n throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`)\n }\n }\n\n protected toEncoded(value: Map<K, V>, format: EncodingFormat): Map<KEncoded, VEncoded> | Record<string, VEncoded> {\n this.ensureKeyIsSupported(format)\n\n const entries: Array<[KEncoded, VEncoded]> = []\n\n for (const [k, v] of value.entries()) {\n const encodedKey = this.keyCodec.encode(k, format)\n const encodedValue = this.valueCodec.encode(v, format)\n entries.push([encodedKey, encodedValue])\n }\n if (format === 'json') {\n const obj: Record<string, VEncoded> = {}\n for (const [k, v] of entries) {\n const keyStr = typeof k === 'string' ? k : String(k)\n obj[keyStr] = v\n }\n return obj\n }\n\n return new Map(entries)\n }\n\n protected fromEncoded(value: Map<KEncoded, VEncoded> | Record<string, VEncoded>, format: EncodingFormat): Map<K, V> {\n this.ensureKeyIsSupported(format)\n\n const result = new Map<K, V>()\n\n let entries: Array<[KEncoded, VEncoded]>\n if (value instanceof Map) {\n entries = Array.from(value.entries())\n } else {\n entries = Object.entries(value) as Array<[KEncoded, VEncoded]>\n }\n\n for (const [encodedKey, encodedValue] of entries) {\n let keyToDecode = encodedKey as KEncoded\n if (format === 'json' && this.keyType === 'bigint' && typeof encodedKey === 'string') {\n keyToDecode = BigInt(encodedKey) as KEncoded\n }\n const key = this.keyCodec.decode(keyToDecode, format)\n const val = this.valueCodec.decode(encodedValue, format)\n result.set(key, val)\n }\n\n return result\n }\n\n public isDefaultValue(value: Map<K, V>): boolean {\n return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AU,KAAK,YAAY,YAAY,OAAO,eAAe,SAC1E,eAAc,OAAO,WAAW;GAElC,MAAM,MAAM,KAAK,SAAS,OAAO,aAAa,OAAO;GACrD,MAAM,MAAM,KAAK,WAAW,OAAO,cAAc,OAAO;AACxD,UAAO,IAAI,KAAK,IAAI;;AAGtB,SAAO;;CAGT,AAAO,eAAe,OAA2B;AAC/C,SAAO,MAAM,SAAS"}
@@ -4,8 +4,9 @@ import { Codec } from "../codec.mjs";
4
4
  /**
5
5
  * Map codec - handles Maps with any key type (including Uint8Array, bigint, number)
6
6
  * Depending on the encoding format, the map is encoded differently:
7
- * - json: Only supports string keys and is represented as an object when encoding.
8
- * An exception is thrown upon encountering a non-string key.
7
+ * - json: Supports string and bigint keys. The map is represented as an object when encoding.
8
+ * Bigint keys are converted to/from strings (e.g., 1n becomes "1").
9
+ * An exception is thrown upon encountering an unsupported key type.
9
10
  * - msgpack: Preserves key types and is represented as a Map when encoding.
10
11
  */
11
12
  var MapCodec = class extends Codec {
@@ -22,7 +23,7 @@ var MapCodec = class extends Codec {
22
23
  }
23
24
  ensureKeyIsSupported(format) {
24
25
  if (format === "msgpack") return true;
25
- if (this.keyType !== "string") throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`);
26
+ if (this.keyType !== "string" && this.keyType !== "bigint") throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`);
26
27
  }
27
28
  toEncoded(value, format) {
28
29
  this.ensureKeyIsSupported(format);
@@ -49,7 +50,9 @@ var MapCodec = class extends Codec {
49
50
  if (value instanceof Map) entries = Array.from(value.entries());
50
51
  else entries = Object.entries(value);
51
52
  for (const [encodedKey, encodedValue] of entries) {
52
- const key = this.keyCodec.decode(encodedKey, format);
53
+ let keyToDecode = encodedKey;
54
+ if (format === "json" && this.keyType === "bigint" && typeof encodedKey === "string") keyToDecode = BigInt(encodedKey);
55
+ const key = this.keyCodec.decode(keyToDecode, format);
53
56
  const val = this.valueCodec.decode(encodedValue, format);
54
57
  result.set(key, val);
55
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"map.mjs","names":["keyCodec: Codec<K, KEncoded>","valueCodec: Codec<V, VEncoded>","entries: Array<[KEncoded, VEncoded]>","obj: Record<string, VEncoded>"],"sources":["../../../../../../packages/common/src/codecs/composite/map.ts"],"sourcesContent":["import { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\n\n/**\n * Map codec - handles Maps with any key type (including Uint8Array, bigint, number)\n * Depending on the encoding format, the map is encoded differently:\n * - json: Only supports string keys and is represented as an object when encoding.\n * An exception is thrown upon encountering a non-string key.\n * - msgpack: Preserves key types and is represented as a Map when encoding.\n */\nexport class MapCodec<K, V, KEncoded = K, VEncoded = V> extends Codec<Map<K, V>, Map<KEncoded, VEncoded> | Record<string, VEncoded>> {\n private keyType: string\n\n constructor(\n private readonly keyCodec: Codec<K, KEncoded>,\n private readonly valueCodec: Codec<V, VEncoded>,\n ) {\n super()\n const defaultKeyValue = this.keyCodec.defaultValue()\n this.keyType = defaultKeyValue instanceof Uint8Array ? 'Uint8Array' : typeof defaultKeyValue\n }\n\n public defaultValue(): Map<K, V> {\n return new Map()\n }\n\n private ensureKeyIsSupported(format: EncodingFormat) {\n if (format === 'msgpack') {\n return true\n }\n if (this.keyType !== 'string') {\n throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`)\n }\n }\n\n protected toEncoded(value: Map<K, V>, format: EncodingFormat): Map<KEncoded, VEncoded> | Record<string, VEncoded> {\n this.ensureKeyIsSupported(format)\n\n const entries: Array<[KEncoded, VEncoded]> = []\n\n for (const [k, v] of value.entries()) {\n const encodedKey = this.keyCodec.encode(k, format)\n const encodedValue = this.valueCodec.encode(v, format)\n entries.push([encodedKey, encodedValue])\n }\n if (format === 'json') {\n const obj: Record<string, VEncoded> = {}\n for (const [k, v] of entries) {\n const keyStr = typeof k === 'string' ? k : String(k)\n obj[keyStr] = v\n }\n return obj\n }\n\n return new Map(entries)\n }\n\n protected fromEncoded(value: Map<KEncoded, VEncoded> | Record<string, VEncoded>, format: EncodingFormat): Map<K, V> {\n this.ensureKeyIsSupported(format)\n\n const result = new Map<K, V>()\n\n let entries: Array<[KEncoded, VEncoded]>\n if (value instanceof Map) {\n entries = Array.from(value.entries())\n } else {\n entries = Object.entries(value) as Array<[KEncoded, VEncoded]>\n }\n\n for (const [encodedKey, encodedValue] of entries) {\n const key = this.keyCodec.decode(encodedKey as KEncoded, format)\n const val = this.valueCodec.decode(encodedValue, format)\n result.set(key, val)\n }\n\n return result\n }\n\n public isDefaultValue(value: Map<K, V>): boolean {\n return value.size === 0\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAa,WAAb,cAAgE,MAAqE;CACnI,AAAQ;CAER,YACE,AAAiBA,UACjB,AAAiBC,YACjB;AACA,SAAO;EAHU;EACA;EAGjB,MAAM,kBAAkB,KAAK,SAAS,cAAc;AACpD,OAAK,UAAU,2BAA2B,aAAa,eAAe,OAAO;;CAG/E,AAAO,eAA0B;AAC/B,yBAAO,IAAI,KAAK;;CAGlB,AAAQ,qBAAqB,QAAwB;AACnD,MAAI,WAAW,UACb,QAAO;AAET,MAAI,KAAK,YAAY,SACnB,OAAM,IAAI,MAAM,oBAAoB,KAAK,QAAQ,wBAAwB,OAAO,SAAS;;CAI7F,AAAU,UAAU,OAAkB,QAA4E;AAChH,OAAK,qBAAqB,OAAO;EAEjC,MAAMC,UAAuC,EAAE;AAE/C,OAAK,MAAM,CAAC,GAAG,MAAM,MAAM,SAAS,EAAE;GACpC,MAAM,aAAa,KAAK,SAAS,OAAO,GAAG,OAAO;GAClD,MAAM,eAAe,KAAK,WAAW,OAAO,GAAG,OAAO;AACtD,WAAQ,KAAK,CAAC,YAAY,aAAa,CAAC;;AAE1C,MAAI,WAAW,QAAQ;GACrB,MAAMC,MAAgC,EAAE;AACxC,QAAK,MAAM,CAAC,GAAG,MAAM,SAAS;IAC5B,MAAM,SAAS,OAAO,MAAM,WAAW,IAAI,OAAO,EAAE;AACpD,QAAI,UAAU;;AAEhB,UAAO;;AAGT,SAAO,IAAI,IAAI,QAAQ;;CAGzB,AAAU,YAAY,OAA2D,QAAmC;AAClH,OAAK,qBAAqB,OAAO;EAEjC,MAAM,yBAAS,IAAI,KAAW;EAE9B,IAAID;AACJ,MAAI,iBAAiB,IACnB,WAAU,MAAM,KAAK,MAAM,SAAS,CAAC;MAErC,WAAU,OAAO,QAAQ,MAAM;AAGjC,OAAK,MAAM,CAAC,YAAY,iBAAiB,SAAS;GAChD,MAAM,MAAM,KAAK,SAAS,OAAO,YAAwB,OAAO;GAChE,MAAM,MAAM,KAAK,WAAW,OAAO,cAAc,OAAO;AACxD,UAAO,IAAI,KAAK,IAAI;;AAGtB,SAAO;;CAGT,AAAO,eAAe,OAA2B;AAC/C,SAAO,MAAM,SAAS"}
1
+ {"version":3,"file":"map.mjs","names":["keyCodec: Codec<K, KEncoded>","valueCodec: Codec<V, VEncoded>","entries: Array<[KEncoded, VEncoded]>","obj: Record<string, VEncoded>"],"sources":["../../../../../../packages/common/src/codecs/composite/map.ts"],"sourcesContent":["import { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\n\n/**\n * Map codec - handles Maps with any key type (including Uint8Array, bigint, number)\n * Depending on the encoding format, the map is encoded differently:\n * - json: Supports string and bigint keys. The map is represented as an object when encoding.\n * Bigint keys are converted to/from strings (e.g., 1n becomes \"1\").\n * An exception is thrown upon encountering an unsupported key type.\n * - msgpack: Preserves key types and is represented as a Map when encoding.\n */\nexport class MapCodec<K, V, KEncoded = K, VEncoded = V> extends Codec<Map<K, V>, Map<KEncoded, VEncoded> | Record<string, VEncoded>> {\n private keyType: string\n\n constructor(\n private readonly keyCodec: Codec<K, KEncoded>,\n private readonly valueCodec: Codec<V, VEncoded>,\n ) {\n super()\n const defaultKeyValue = this.keyCodec.defaultValue()\n this.keyType = defaultKeyValue instanceof Uint8Array ? 'Uint8Array' : typeof defaultKeyValue\n }\n\n public defaultValue(): Map<K, V> {\n return new Map()\n }\n\n private ensureKeyIsSupported(format: EncodingFormat) {\n if (format === 'msgpack') {\n return true\n }\n if (this.keyType !== 'string' && this.keyType !== 'bigint') {\n throw new Error(`Map key of type '${this.keyType}' is not supported in ${format} format`)\n }\n }\n\n protected toEncoded(value: Map<K, V>, format: EncodingFormat): Map<KEncoded, VEncoded> | Record<string, VEncoded> {\n this.ensureKeyIsSupported(format)\n\n const entries: Array<[KEncoded, VEncoded]> = []\n\n for (const [k, v] of value.entries()) {\n const encodedKey = this.keyCodec.encode(k, format)\n const encodedValue = this.valueCodec.encode(v, format)\n entries.push([encodedKey, encodedValue])\n }\n if (format === 'json') {\n const obj: Record<string, VEncoded> = {}\n for (const [k, v] of entries) {\n const keyStr = typeof k === 'string' ? k : String(k)\n obj[keyStr] = v\n }\n return obj\n }\n\n return new Map(entries)\n }\n\n protected fromEncoded(value: Map<KEncoded, VEncoded> | Record<string, VEncoded>, format: EncodingFormat): Map<K, V> {\n this.ensureKeyIsSupported(format)\n\n const result = new Map<K, V>()\n\n let entries: Array<[KEncoded, VEncoded]>\n if (value instanceof Map) {\n entries = Array.from(value.entries())\n } else {\n entries = Object.entries(value) as Array<[KEncoded, VEncoded]>\n }\n\n for (const [encodedKey, encodedValue] of entries) {\n let keyToDecode = encodedKey as KEncoded\n if (format === 'json' && this.keyType === 'bigint' && typeof encodedKey === 'string') {\n keyToDecode = BigInt(encodedKey) as KEncoded\n }\n const key = this.keyCodec.decode(keyToDecode, format)\n const val = this.valueCodec.decode(encodedValue, format)\n result.set(key, val)\n }\n\n return result\n }\n\n public isDefaultValue(value: Map<K, V>): boolean {\n return value.size === 0\n }\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,WAAb,cAAgE,MAAqE;CACnI,AAAQ;CAER,YACE,AAAiBA,UACjB,AAAiBC,YACjB;AACA,SAAO;EAHU;EACA;EAGjB,MAAM,kBAAkB,KAAK,SAAS,cAAc;AACpD,OAAK,UAAU,2BAA2B,aAAa,eAAe,OAAO;;CAG/E,AAAO,eAA0B;AAC/B,yBAAO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,6 @@
1
1
  const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.js');
2
2
  const require_codec = require('../codec.js');
3
3
  let buffer = require("buffer");
4
- buffer = require_rolldown_runtime.__toESM(buffer);
5
4
 
6
5
  //#region packages/common/src/codecs/composite/record.ts
7
6
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","names":["Codec","valueCodec: Codec<V, VEncoded>","result: Record<string, VEncoded>","result: Record<string, V>","Buffer"],"sources":["../../../../../../packages/common/src/codecs/composite/record.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireObject } from '../wire'\n\n/**\n * Record codec - for string-keyed objects with homogeneous values\n */\nexport class RecordCodec<V, VEncoded = V> extends Codec<Record<string, V>, Record<string, VEncoded>, WireObject<VEncoded>> {\n constructor(private readonly valueCodec: Codec<V, VEncoded>) {\n super()\n }\n\n public defaultValue(): Record<string, V> {\n return {}\n }\n\n protected toEncoded(value: Record<string, V>, format: EncodingFormat): Record<string, VEncoded> {\n const result: Record<string, VEncoded> = {}\n\n for (const [key, val] of Object.entries(value)) {\n const encoded = this.valueCodec.encode(val, format)\n result[key] = encoded\n }\n\n return result\n }\n\n protected fromEncoded(value: WireObject<VEncoded>, format: EncodingFormat): Record<string, V> {\n const result: Record<string, V> = {}\n if (value instanceof Map) {\n for (const [_key, val] of value.entries()) {\n const keyType = typeof _key\n if (keyType === 'number' || keyType === 'bigint') {\n throw new Error(`RecordCodec received a non-string key of type ${keyType}`)\n }\n const key = _key instanceof Uint8Array ? Buffer.from(_key).toString('utf-8') : String(_key)\n result[key] = this.valueCodec.decode(val, format)\n }\n } else {\n for (const [key, val] of Object.entries(value)) {\n result[key] = this.valueCodec.decode(val, format)\n }\n }\n\n return result\n }\n\n public isDefaultValue(value: Record<string, V>): boolean {\n return Object.keys(value).length === 0\n }\n}\n"],"mappings":";;;;;;;;;AAQA,IAAa,cAAb,cAAkDA,oBAAyE;CACzH,YAAY,AAAiBC,YAAgC;AAC3D,SAAO;EADoB;;CAI7B,AAAO,eAAkC;AACvC,SAAO,EAAE;;CAGX,AAAU,UAAU,OAA0B,QAAkD;EAC9F,MAAMC,SAAmC,EAAE;AAE3C,OAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAE5C,QAAO,OADS,KAAK,WAAW,OAAO,KAAK,OAAO;AAIrD,SAAO;;CAGT,AAAU,YAAY,OAA6B,QAA2C;EAC5F,MAAMC,SAA4B,EAAE;AACpC,MAAI,iBAAiB,IACnB,MAAK,MAAM,CAAC,MAAM,QAAQ,MAAM,SAAS,EAAE;GACzC,MAAM,UAAU,OAAO;AACvB,OAAI,YAAY,YAAY,YAAY,SACtC,OAAM,IAAI,MAAM,iDAAiD,UAAU;GAE7E,MAAM,MAAM,gBAAgB,aAAaC,cAAO,KAAK,KAAK,CAAC,SAAS,QAAQ,GAAG,OAAO,KAAK;AAC3F,UAAO,OAAO,KAAK,WAAW,OAAO,KAAK,OAAO;;MAGnD,MAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAC5C,QAAO,OAAO,KAAK,WAAW,OAAO,KAAK,OAAO;AAIrD,SAAO;;CAGT,AAAO,eAAe,OAAmC;AACvD,SAAO,OAAO,KAAK,MAAM,CAAC,WAAW"}
1
+ {"version":3,"file":"record.js","names":["Codec","valueCodec: Codec<V, VEncoded>","result: Record<string, VEncoded>","result: Record<string, V>","Buffer"],"sources":["../../../../../../packages/common/src/codecs/composite/record.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireObject } from '../wire'\n\n/**\n * Record codec - for string-keyed objects with homogeneous values\n */\nexport class RecordCodec<V, VEncoded = V> extends Codec<Record<string, V>, Record<string, VEncoded>, WireObject<VEncoded>> {\n constructor(private readonly valueCodec: Codec<V, VEncoded>) {\n super()\n }\n\n public defaultValue(): Record<string, V> {\n return {}\n }\n\n protected toEncoded(value: Record<string, V>, format: EncodingFormat): Record<string, VEncoded> {\n const result: Record<string, VEncoded> = {}\n\n for (const [key, val] of Object.entries(value)) {\n const encoded = this.valueCodec.encode(val, format)\n result[key] = encoded\n }\n\n return result\n }\n\n protected fromEncoded(value: WireObject<VEncoded>, format: EncodingFormat): Record<string, V> {\n const result: Record<string, V> = {}\n if (value instanceof Map) {\n for (const [_key, val] of value.entries()) {\n const keyType = typeof _key\n if (keyType === 'number' || keyType === 'bigint') {\n throw new Error(`RecordCodec received a non-string key of type ${keyType}`)\n }\n const key = _key instanceof Uint8Array ? Buffer.from(_key).toString('utf-8') : String(_key)\n result[key] = this.valueCodec.decode(val, format)\n }\n } else {\n for (const [key, val] of Object.entries(value)) {\n result[key] = this.valueCodec.decode(val, format)\n }\n }\n\n return result\n }\n\n public isDefaultValue(value: Record<string, V>): boolean {\n return Object.keys(value).length === 0\n }\n}\n"],"mappings":";;;;;;;;AAQA,IAAa,cAAb,cAAkDA,oBAAyE;CACzH,YAAY,AAAiBC,YAAgC;AAC3D,SAAO;EADoB;;CAI7B,AAAO,eAAkC;AACvC,SAAO,EAAE;;CAGX,AAAU,UAAU,OAA0B,QAAkD;EAC9F,MAAMC,SAAmC,EAAE;AAE3C,OAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAE5C,QAAO,OADS,KAAK,WAAW,OAAO,KAAK,OAAO;AAIrD,SAAO;;CAGT,AAAU,YAAY,OAA6B,QAA2C;EAC5F,MAAMC,SAA4B,EAAE;AACpC,MAAI,iBAAiB,IACnB,MAAK,MAAM,CAAC,MAAM,QAAQ,MAAM,SAAS,EAAE;GACzC,MAAM,UAAU,OAAO;AACvB,OAAI,YAAY,YAAY,YAAY,SACtC,OAAM,IAAI,MAAM,iDAAiD,UAAU;GAE7E,MAAM,MAAM,gBAAgB,aAAaC,cAAO,KAAK,KAAK,CAAC,SAAS,QAAQ,GAAG,OAAO,KAAK;AAC3F,UAAO,OAAO,KAAK,WAAW,OAAO,KAAK,OAAO;;MAGnD,MAAK,MAAM,CAAC,KAAK,QAAQ,OAAO,QAAQ,MAAM,CAC5C,QAAO,OAAO,KAAK,WAAW,OAAO,KAAK,OAAO;AAIrD,SAAO;;CAGT,AAAO,eAAe,OAAmC;AACvD,SAAO,OAAO,KAAK,MAAM,CAAC,WAAW"}
@@ -3,7 +3,6 @@ const require_constants = require('../../constants.js');
3
3
  const require_address = require('../../address.js');
4
4
  const require_codec = require('../codec.js');
5
5
  let buffer = require("buffer");
6
- buffer = require_rolldown_runtime.__toESM(buffer);
7
6
 
8
7
  //#region packages/common/src/codecs/primitives/address.ts
9
8
  var AddressCodec = class extends require_codec.Codec {
@@ -1 +1 @@
1
- {"version":3,"file":"address.js","names":["Codec","Address","PUBLIC_KEY_BYTE_LENGTH","ADDRESS_LENGTH","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/address.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Address } from '../../address'\nimport { ADDRESS_LENGTH, PUBLIC_KEY_BYTE_LENGTH } from '../../constants'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\nclass AddressCodec extends Codec<Address, WireString> {\n public defaultValue(): Address {\n return Address.zeroAddress()\n }\n\n protected toEncoded(value: Address, format: EncodingFormat): WireString {\n if (format === 'json') {\n return value.toString()\n }\n return value.publicKey\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Address {\n if (typeof value === 'string') return Address.fromString(value)\n if (value instanceof Uint8Array) {\n if (value.length === PUBLIC_KEY_BYTE_LENGTH) {\n return new Address(value)\n } else if (value.length === ADDRESS_LENGTH) {\n return Address.fromString(Buffer.from(value).toString('utf-8'))\n }\n }\n throw new Error(`AddressCodec cannot decode address from ${typeof value}`)\n }\n\n public isDefaultValue(value: Address): boolean {\n return value.equals(this.defaultValue())\n }\n}\n\nexport const addressCodec = new AddressCodec()\n"],"mappings":";;;;;;;;AAOA,IAAM,eAAN,cAA2BA,oBAA2B;CACpD,AAAO,eAAwB;AAC7B,SAAOC,wBAAQ,aAAa;;CAG9B,AAAU,UAAU,OAAgB,QAAoC;AACtE,MAAI,WAAW,OACb,QAAO,MAAM,UAAU;AAEzB,SAAO,MAAM;;CAGf,AAAU,YAAY,OAAmB,SAAkC;AACzE,MAAI,OAAO,UAAU,SAAU,QAAOA,wBAAQ,WAAW,MAAM;AAC/D,MAAI,iBAAiB,YACnB;OAAI,MAAM,WAAWC,yCACnB,QAAO,IAAID,wBAAQ,MAAM;YAChB,MAAM,WAAWE,iCAC1B,QAAOF,wBAAQ,WAAWG,cAAO,KAAK,MAAM,CAAC,SAAS,QAAQ,CAAC;;AAGnE,QAAM,IAAI,MAAM,2CAA2C,OAAO,QAAQ;;CAG5E,AAAO,eAAe,OAAyB;AAC7C,SAAO,MAAM,OAAO,KAAK,cAAc,CAAC;;;AAI5C,MAAa,eAAe,IAAI,cAAc"}
1
+ {"version":3,"file":"address.js","names":["Codec","Address","PUBLIC_KEY_BYTE_LENGTH","ADDRESS_LENGTH","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/address.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Address } from '../../address'\nimport { ADDRESS_LENGTH, PUBLIC_KEY_BYTE_LENGTH } from '../../constants'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\nclass AddressCodec extends Codec<Address, WireString> {\n public defaultValue(): Address {\n return Address.zeroAddress()\n }\n\n protected toEncoded(value: Address, format: EncodingFormat): WireString {\n if (format === 'json') {\n return value.toString()\n }\n return value.publicKey\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Address {\n if (typeof value === 'string') return Address.fromString(value)\n if (value instanceof Uint8Array) {\n if (value.length === PUBLIC_KEY_BYTE_LENGTH) {\n return new Address(value)\n } else if (value.length === ADDRESS_LENGTH) {\n return Address.fromString(Buffer.from(value).toString('utf-8'))\n }\n }\n throw new Error(`AddressCodec cannot decode address from ${typeof value}`)\n }\n\n public isDefaultValue(value: Address): boolean {\n return value.equals(this.defaultValue())\n }\n}\n\nexport const addressCodec = new AddressCodec()\n"],"mappings":";;;;;;;AAOA,IAAM,eAAN,cAA2BA,oBAA2B;CACpD,AAAO,eAAwB;AAC7B,SAAOC,wBAAQ,aAAa;;CAG9B,AAAU,UAAU,OAAgB,QAAoC;AACtE,MAAI,WAAW,OACb,QAAO,MAAM,UAAU;AAEzB,SAAO,MAAM;;CAGf,AAAU,YAAY,OAAmB,SAAkC;AACzE,MAAI,OAAO,UAAU,SAAU,QAAOA,wBAAQ,WAAW,MAAM;AAC/D,MAAI,iBAAiB,YACnB;OAAI,MAAM,WAAWC,yCACnB,QAAO,IAAID,wBAAQ,MAAM;YAChB,MAAM,WAAWE,iCAC1B,QAAOF,wBAAQ,WAAWG,cAAO,KAAK,MAAM,CAAC,SAAS,QAAQ,CAAC;;AAGnE,QAAM,IAAI,MAAM,2CAA2C,OAAO,QAAQ;;CAG5E,AAAO,eAAe,OAAyB;AAC7C,SAAO,MAAM,OAAO,KAAK,cAAc,CAAC;;;AAI5C,MAAa,eAAe,IAAI,cAAc"}
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.js');
2
2
  const require_codec = require('../codec.js');
3
3
  let buffer = require("buffer");
4
- buffer = require_rolldown_runtime.__toESM(buffer);
5
4
 
6
5
  //#region packages/common/src/codecs/primitives/bytes.ts
7
6
  var BytesCodec = class extends require_codec.Codec {
@@ -1 +1 @@
1
- {"version":3,"file":"bytes.js","names":["Codec","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/bytes.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\nclass BytesCodec extends Codec<Uint8Array, WireString> {\n public defaultValue(): Uint8Array {\n return new Uint8Array()\n }\n\n protected toEncoded(value: Uint8Array, format: EncodingFormat): WireString {\n if (format === 'json') {\n return Buffer.from(value).toString('base64')\n }\n return value\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Uint8Array {\n if (value instanceof Uint8Array) return value\n if (typeof value === 'string') {\n return new Uint8Array(Buffer.from(value, 'base64'))\n }\n throw new Error(`Cannot decode bytes from ${typeof value}`)\n }\n\n public isDefaultValue(value: Uint8Array): boolean {\n return value.byteLength === 0\n }\n}\n\nexport const bytesCodec = new BytesCodec()\n"],"mappings":";;;;;;AAKA,IAAM,aAAN,cAAyBA,oBAA8B;CACrD,AAAO,eAA2B;AAChC,SAAO,IAAI,YAAY;;CAGzB,AAAU,UAAU,OAAmB,QAAoC;AACzE,MAAI,WAAW,OACb,QAAOC,cAAO,KAAK,MAAM,CAAC,SAAS,SAAS;AAE9C,SAAO;;CAGT,AAAU,YAAY,OAAmB,SAAqC;AAC5E,MAAI,iBAAiB,WAAY,QAAO;AACxC,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,WAAWA,cAAO,KAAK,OAAO,SAAS,CAAC;AAErD,QAAM,IAAI,MAAM,4BAA4B,OAAO,QAAQ;;CAG7D,AAAO,eAAe,OAA4B;AAChD,SAAO,MAAM,eAAe;;;AAIhC,MAAa,aAAa,IAAI,YAAY"}
1
+ {"version":3,"file":"bytes.js","names":["Codec","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/bytes.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\nclass BytesCodec extends Codec<Uint8Array, WireString> {\n public defaultValue(): Uint8Array {\n return new Uint8Array()\n }\n\n protected toEncoded(value: Uint8Array, format: EncodingFormat): WireString {\n if (format === 'json') {\n return Buffer.from(value).toString('base64')\n }\n return value\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Uint8Array {\n if (value instanceof Uint8Array) return value\n if (typeof value === 'string') {\n return new Uint8Array(Buffer.from(value, 'base64'))\n }\n throw new Error(`Cannot decode bytes from ${typeof value}`)\n }\n\n public isDefaultValue(value: Uint8Array): boolean {\n return value.byteLength === 0\n }\n}\n\nexport const bytesCodec = new BytesCodec()\n"],"mappings":";;;;;AAKA,IAAM,aAAN,cAAyBA,oBAA8B;CACrD,AAAO,eAA2B;AAChC,SAAO,IAAI,YAAY;;CAGzB,AAAU,UAAU,OAAmB,QAAoC;AACzE,MAAI,WAAW,OACb,QAAOC,cAAO,KAAK,MAAM,CAAC,SAAS,SAAS;AAE9C,SAAO;;CAGT,AAAU,YAAY,OAAmB,SAAqC;AAC5E,MAAI,iBAAiB,WAAY,QAAO;AACxC,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,WAAWA,cAAO,KAAK,OAAO,SAAS,CAAC;AAErD,QAAM,IAAI,MAAM,4BAA4B,OAAO,QAAQ;;CAG7D,AAAO,eAAe,OAA4B;AAChD,SAAO,MAAM,eAAe;;;AAIhC,MAAa,aAAa,IAAI,YAAY"}
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.js');
2
2
  const require_codec = require('../codec.js');
3
3
  let buffer = require("buffer");
4
- buffer = require_rolldown_runtime.__toESM(buffer);
5
4
 
6
5
  //#region packages/common/src/codecs/primitives/fixed-bytes.ts
7
6
  var FixedBytesCodec = class extends require_codec.Codec {
@@ -1 +1 @@
1
- {"version":3,"file":"fixed-bytes.js","names":["Codec","length: number","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/fixed-bytes.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\nexport class FixedBytesCodec extends Codec<Uint8Array, WireString> {\n constructor(private readonly length: number) {\n super()\n }\n\n public defaultValue(): Uint8Array {\n return new Uint8Array(this.length)\n }\n\n protected toEncoded(value: Uint8Array, format: EncodingFormat): WireString {\n if (format === 'json') {\n return Buffer.from(value).toString('base64')\n }\n return value\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Uint8Array {\n if (value instanceof Uint8Array) return value\n if (typeof value === 'string') {\n return new Uint8Array(Buffer.from(value, 'base64'))\n }\n throw new Error(`Cannot decode fixed ${this.length} bytes from ${typeof value}`)\n }\n\n public isDefaultValue(value: Uint8Array): boolean {\n if (value.byteLength !== this.length) return false\n return value.every((byte) => byte === 0)\n }\n}\n\nexport const fixedBytes32Codec = new FixedBytesCodec(32)\nexport const fixedBytes64Codec = new FixedBytesCodec(64)\nexport const fixedBytes1793Codec = new FixedBytesCodec(1793) // For Falcon signatures (0x701)\n"],"mappings":";;;;;;AAKA,IAAa,kBAAb,cAAqCA,oBAA8B;CACjE,YAAY,AAAiBC,QAAgB;AAC3C,SAAO;EADoB;;CAI7B,AAAO,eAA2B;AAChC,SAAO,IAAI,WAAW,KAAK,OAAO;;CAGpC,AAAU,UAAU,OAAmB,QAAoC;AACzE,MAAI,WAAW,OACb,QAAOC,cAAO,KAAK,MAAM,CAAC,SAAS,SAAS;AAE9C,SAAO;;CAGT,AAAU,YAAY,OAAmB,SAAqC;AAC5E,MAAI,iBAAiB,WAAY,QAAO;AACxC,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,WAAWA,cAAO,KAAK,OAAO,SAAS,CAAC;AAErD,QAAM,IAAI,MAAM,uBAAuB,KAAK,OAAO,cAAc,OAAO,QAAQ;;CAGlF,AAAO,eAAe,OAA4B;AAChD,MAAI,MAAM,eAAe,KAAK,OAAQ,QAAO;AAC7C,SAAO,MAAM,OAAO,SAAS,SAAS,EAAE;;;AAI5C,MAAa,oBAAoB,IAAI,gBAAgB,GAAG;AACxD,MAAa,oBAAoB,IAAI,gBAAgB,GAAG;AACxD,MAAa,sBAAsB,IAAI,gBAAgB,KAAK"}
1
+ {"version":3,"file":"fixed-bytes.js","names":["Codec","length: number","Buffer"],"sources":["../../../../../../packages/common/src/codecs/primitives/fixed-bytes.ts"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { Codec } from '../codec'\nimport type { EncodingFormat } from '../types'\nimport { WireString } from '../wire'\n\nexport class FixedBytesCodec extends Codec<Uint8Array, WireString> {\n constructor(private readonly length: number) {\n super()\n }\n\n public defaultValue(): Uint8Array {\n return new Uint8Array(this.length)\n }\n\n protected toEncoded(value: Uint8Array, format: EncodingFormat): WireString {\n if (format === 'json') {\n return Buffer.from(value).toString('base64')\n }\n return value\n }\n\n protected fromEncoded(value: WireString, _format: EncodingFormat): Uint8Array {\n if (value instanceof Uint8Array) return value\n if (typeof value === 'string') {\n return new Uint8Array(Buffer.from(value, 'base64'))\n }\n throw new Error(`Cannot decode fixed ${this.length} bytes from ${typeof value}`)\n }\n\n public isDefaultValue(value: Uint8Array): boolean {\n if (value.byteLength !== this.length) return false\n return value.every((byte) => byte === 0)\n }\n}\n\nexport const fixedBytes32Codec = new FixedBytesCodec(32)\nexport const fixedBytes64Codec = new FixedBytesCodec(64)\nexport const fixedBytes1793Codec = new FixedBytesCodec(1793) // For Falcon signatures (0x701)\n"],"mappings":";;;;;AAKA,IAAa,kBAAb,cAAqCA,oBAA8B;CACjE,YAAY,AAAiBC,QAAgB;AAC3C,SAAO;EADoB;;CAI7B,AAAO,eAA2B;AAChC,SAAO,IAAI,WAAW,KAAK,OAAO;;CAGpC,AAAU,UAAU,OAAmB,QAAoC;AACzE,MAAI,WAAW,OACb,QAAOC,cAAO,KAAK,MAAM,CAAC,SAAS,SAAS;AAE9C,SAAO;;CAGT,AAAU,YAAY,OAAmB,SAAqC;AAC5E,MAAI,iBAAiB,WAAY,QAAO;AACxC,MAAI,OAAO,UAAU,SACnB,QAAO,IAAI,WAAWA,cAAO,KAAK,OAAO,SAAS,CAAC;AAErD,QAAM,IAAI,MAAM,uBAAuB,KAAK,OAAO,cAAc,OAAO,QAAQ;;CAGlF,AAAO,eAAe,OAA4B;AAChD,MAAI,MAAM,eAAe,KAAK,OAAQ,QAAO;AAC7C,SAAO,MAAM,OAAO,SAAS,SAAS,EAAE;;;AAI5C,MAAa,oBAAoB,IAAI,gBAAgB,GAAG;AACxD,MAAa,oBAAoB,IAAI,gBAAgB,GAAG;AACxD,MAAa,sBAAsB,IAAI,gBAAgB,KAAK"}
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
2
2
  let buffer = require("buffer");
3
- buffer = require_rolldown_runtime.__toESM(buffer);
4
3
 
5
4
  //#region packages/common/src/codecs/wire.ts
6
5
  function normalizeWireKey(key) {
@@ -1 +1 @@
1
- {"version":3,"file":"wire.js","names":["Buffer","normalized: Record<string, unknown>"],"sources":["../../../../../packages/common/src/codecs/wire.ts"],"sourcesContent":["import { Buffer } from 'buffer'\n/**\n * Represents a map key coming off the wire.\n */\nexport type WireMapKey = Uint8Array | number | bigint\n\n/**\n * Represents object data coming off the wire.\n *\n * When from msgpack it's a Map. Both bytes and string keys are represented as Uint8Array.\n * When from JSON it's a plain object with string keys.\n */\nexport type WireObject<TValue = unknown> = Record<string, TValue> | Map<WireMapKey, TValue>\n\n/**\n * Represents a bigint value coming off the wire.\n *\n * When from msgpack it could be a number or bigint, depending on size.\n * When from JSON it could be a number or bigint (because of how we configure JSONbig), depending on size.\n */\nexport type WireBigInt = number | bigint\n\n/**\n * Represents either a bytes or string value coming off the wire.\n *\n * When from msgpack it's a Uint8Array for both bytes or string values.\n * When from JSON it's a base64-encoded bytes string or regular string.\n */\nexport type WireString = Uint8Array | string\n\nfunction normalizeWireKey(key: string | WireMapKey): string {\n return key instanceof Uint8Array ? normalizeWireString(key) : key.toString()\n}\n\nexport function normalizeWireString(value: WireString): string {\n return value instanceof Uint8Array ? Buffer.from(value).toString('utf-8') : value\n}\n\nexport function normalizeWireObject(wireObject: WireObject): Record<string, unknown> {\n if (wireObject instanceof Map) {\n const normalized: Record<string, unknown> = {}\n for (const [key, value] of wireObject.entries()) {\n normalized[normalizeWireKey(key)] = value\n }\n return normalized\n }\n\n return wireObject\n}\n"],"mappings":";;;;;AA8BA,SAAS,iBAAiB,KAAkC;AAC1D,QAAO,eAAe,aAAa,oBAAoB,IAAI,GAAG,IAAI,UAAU;;AAG9E,SAAgB,oBAAoB,OAA2B;AAC7D,QAAO,iBAAiB,aAAaA,cAAO,KAAK,MAAM,CAAC,SAAS,QAAQ,GAAG;;AAG9E,SAAgB,oBAAoB,YAAiD;AACnF,KAAI,sBAAsB,KAAK;EAC7B,MAAMC,aAAsC,EAAE;AAC9C,OAAK,MAAM,CAAC,KAAK,UAAU,WAAW,SAAS,CAC7C,YAAW,iBAAiB,IAAI,IAAI;AAEtC,SAAO;;AAGT,QAAO"}
1
+ {"version":3,"file":"wire.js","names":["Buffer","normalized: Record<string, unknown>"],"sources":["../../../../../packages/common/src/codecs/wire.ts"],"sourcesContent":["import { Buffer } from 'buffer'\n/**\n * Represents a map key coming off the wire.\n */\nexport type WireMapKey = Uint8Array | number | bigint\n\n/**\n * Represents object data coming off the wire.\n *\n * When from msgpack it's a Map. Both bytes and string keys are represented as Uint8Array.\n * When from JSON it's a plain object with string keys.\n */\nexport type WireObject<TValue = unknown> = Record<string, TValue> | Map<WireMapKey, TValue>\n\n/**\n * Represents a bigint value coming off the wire.\n *\n * When from msgpack it could be a number or bigint, depending on size.\n * When from JSON it could be a number or bigint (because of how we configure JSONbig), depending on size.\n */\nexport type WireBigInt = number | bigint\n\n/**\n * Represents either a bytes or string value coming off the wire.\n *\n * When from msgpack it's a Uint8Array for both bytes or string values.\n * When from JSON it's a base64-encoded bytes string or regular string.\n */\nexport type WireString = Uint8Array | string\n\nfunction normalizeWireKey(key: string | WireMapKey): string {\n return key instanceof Uint8Array ? normalizeWireString(key) : key.toString()\n}\n\nexport function normalizeWireString(value: WireString): string {\n return value instanceof Uint8Array ? Buffer.from(value).toString('utf-8') : value\n}\n\nexport function normalizeWireObject(wireObject: WireObject): Record<string, unknown> {\n if (wireObject instanceof Map) {\n const normalized: Record<string, unknown> = {}\n for (const [key, value] of wireObject.entries()) {\n normalized[normalizeWireKey(key)] = value\n }\n return normalized\n }\n\n return wireObject\n}\n"],"mappings":";;;;AA8BA,SAAS,iBAAiB,KAAkC;AAC1D,QAAO,eAAe,aAAa,oBAAoB,IAAI,GAAG,IAAI,UAAU;;AAG9E,SAAgB,oBAAoB,OAA2B;AAC7D,QAAO,iBAAiB,aAAaA,cAAO,KAAK,MAAM,CAAC,SAAS,QAAQ,GAAG;;AAG9E,SAAgB,oBAAoB,YAAiD;AACnF,KAAI,sBAAsB,KAAK;EAC7B,MAAMC,aAAsC,EAAE;AAC9C,OAAK,MAAM,CAAC,KAAK,UAAU,WAAW,SAAS,CAC7C,YAAW,iBAAiB,IAAI,IAAI;AAEtC,SAAO;;AAGT,QAAO"}
@@ -1,7 +1,7 @@
1
- import JSONbigWithoutConfig from "json-bigint";
1
+ import JSONbigFactory from "json-bigint";
2
2
 
3
3
  //#region packages/common/src/json.ts
4
- const JSONbig = JSONbigWithoutConfig({
4
+ const JSONbig = JSONbigFactory({
5
5
  useNativeBigInt: true,
6
6
  strict: true
7
7
  });
@@ -1 +1 @@
1
- {"version":3,"file":"json.mjs","names":["JSONbigFactory"],"sources":["../../../../packages/common/src/json.ts"],"sourcesContent":["import JSONbigFactory from 'json-bigint'\n\nconst JSONbig = JSONbigFactory({\n useNativeBigInt: true,\n strict: true,\n})\n\n/**\n * Parse JSON with bigint support.\n * @param str - The JSON string to parse.\n */\nexport function parseJson(str: string) {\n return JSONbig.parse(str, (_: string, value: unknown): unknown => {\n if (value != null && typeof value === 'object' && Object.getPrototypeOf(value) == null) {\n // JSONbig.parse objects are created with Object.create(null) and thus have a null prototype\n Object.setPrototypeOf(value, Object.prototype)\n }\n\n if (typeof value === 'bigint') {\n if (value > Number.MAX_SAFE_INTEGER) {\n return value\n }\n // JSONbig.parse converts number to BigInts if they are >= 10**15. This is smaller than\n // Number.MAX_SAFE_INTEGER, so we can convert some BigInts back to normal numbers.\n return Number(value)\n }\n\n return value\n })\n}\n\n/**\n * Convert a JavaScript value to a JSON string with bigint support.\n *\n * @param value - A JavaScript value, usually an object or array, to be converted.\n * @param replacer - A function that transforms the results.\n * @param space - Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\nexport function stringifyJson(\n value: unknown,\n replacer?: (this: unknown, key: string, value: unknown) => unknown,\n space?: string | number,\n): string {\n return JSONbig.stringify(value, replacer, space)\n}\n"],"mappings":";;;AAEA,MAAM,UAAUA,qBAAe;CAC7B,iBAAiB;CACjB,QAAQ;CACT,CAAC;;;;;AAMF,SAAgB,UAAU,KAAa;AACrC,QAAO,QAAQ,MAAM,MAAM,GAAW,UAA4B;AAChE,MAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,OAAO,eAAe,MAAM,IAAI,KAEhF,QAAO,eAAe,OAAO,OAAO,UAAU;AAGhD,MAAI,OAAO,UAAU,UAAU;AAC7B,OAAI,QAAQ,OAAO,iBACjB,QAAO;AAIT,UAAO,OAAO,MAAM;;AAGtB,SAAO;GACP;;;;;;;;;AAUJ,SAAgB,cACd,OACA,UACA,OACQ;AACR,QAAO,QAAQ,UAAU,OAAO,UAAU,MAAM"}
1
+ {"version":3,"file":"json.mjs","names":[],"sources":["../../../../packages/common/src/json.ts"],"sourcesContent":["import JSONbigFactory from 'json-bigint'\n\nconst JSONbig = JSONbigFactory({\n useNativeBigInt: true,\n strict: true,\n})\n\n/**\n * Parse JSON with bigint support.\n * @param str - The JSON string to parse.\n */\nexport function parseJson(str: string) {\n return JSONbig.parse(str, (_: string, value: unknown): unknown => {\n if (value != null && typeof value === 'object' && Object.getPrototypeOf(value) == null) {\n // JSONbig.parse objects are created with Object.create(null) and thus have a null prototype\n Object.setPrototypeOf(value, Object.prototype)\n }\n\n if (typeof value === 'bigint') {\n if (value > Number.MAX_SAFE_INTEGER) {\n return value\n }\n // JSONbig.parse converts number to BigInts if they are >= 10**15. This is smaller than\n // Number.MAX_SAFE_INTEGER, so we can convert some BigInts back to normal numbers.\n return Number(value)\n }\n\n return value\n })\n}\n\n/**\n * Convert a JavaScript value to a JSON string with bigint support.\n *\n * @param value - A JavaScript value, usually an object or array, to be converted.\n * @param replacer - A function that transforms the results.\n * @param space - Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.\n */\nexport function stringifyJson(\n value: unknown,\n replacer?: (this: unknown, key: string, value: unknown) => unknown,\n space?: string | number,\n): string {\n return JSONbig.stringify(value, replacer, space)\n}\n"],"mappings":";;;AAEA,MAAM,UAAU,eAAe;CAC7B,iBAAiB;CACjB,QAAQ;CACT,CAAC;;;;;AAMF,SAAgB,UAAU,KAAa;AACrC,QAAO,QAAQ,MAAM,MAAM,GAAW,UAA4B;AAChE,MAAI,SAAS,QAAQ,OAAO,UAAU,YAAY,OAAO,eAAe,MAAM,IAAI,KAEhF,QAAO,eAAe,OAAO,OAAO,UAAU;AAGhD,MAAI,OAAO,UAAU,UAAU;AAC7B,OAAI,QAAQ,OAAO,iBACjB,QAAO;AAIT,UAAO,OAAO,MAAM;;AAGtB,SAAO;GACP;;;;;;;;;AAUJ,SAAgB,cACd,OACA,UACA,OACQ;AACR,QAAO,QAAQ,UAAU,OAAO,UAAU,MAAM"}
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
2
2
  let algorand_msgpack = require("algorand-msgpack");
3
- algorand_msgpack = require_rolldown_runtime.__toESM(algorand_msgpack);
4
3
 
5
4
  //#region packages/common/src/msgpack.ts
6
5
  function decodeMsgpack(buffer, options = {
@@ -1 +1 @@
1
- {"version":3,"file":"msgpack.js","names":["IntMode"],"sources":["../../../../packages/common/src/msgpack.ts"],"sourcesContent":["import { IntMode, decode as msgpackDecode, encode as msgpackEncode } from 'algorand-msgpack'\n\ntype MsgPackDecodeOptions = {\n useMap: boolean\n rawBinaryStringKeys: boolean\n rawBinaryStringValues: boolean\n}\n\nexport function decodeMsgpack(\n buffer: Uint8Array,\n // These default options ensure that we can correctly decode all Algorand specific msgpack data structures.\n // Some of these structures have bytes or bigint keys and bytes values that can be incorrectly decoded as utf8 strings by the msgpack library.\n options: MsgPackDecodeOptions = { useMap: true, rawBinaryStringKeys: true, rawBinaryStringValues: true },\n): Map<number | bigint | Uint8Array, unknown> {\n return msgpackDecode(buffer, { intMode: IntMode.AS_ENCODED, ...options }) as Map<number | bigint | Uint8Array, unknown>\n}\n\nexport function encodeMsgpack(data: unknown): Uint8Array {\n return new Uint8Array(msgpackEncode(data, { sortKeys: true, ignoreUndefined: true }))\n}\n"],"mappings":";;;;;AAQA,SAAgB,cACd,QAGA,UAAgC;CAAE,QAAQ;CAAM,qBAAqB;CAAM,uBAAuB;CAAM,EAC5D;AAC5C,qCAAqB,QAAQ;EAAE,SAASA,yBAAQ;EAAY,GAAG;EAAS,CAAC;;AAG3E,SAAgB,cAAc,MAA2B;AACvD,QAAO,IAAI,wCAAyB,MAAM;EAAE,UAAU;EAAM,iBAAiB;EAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"msgpack.js","names":["IntMode"],"sources":["../../../../packages/common/src/msgpack.ts"],"sourcesContent":["import { IntMode, decode as msgpackDecode, encode as msgpackEncode } from 'algorand-msgpack'\n\ntype MsgPackDecodeOptions = {\n useMap: boolean\n rawBinaryStringKeys: boolean\n rawBinaryStringValues: boolean\n}\n\nexport function decodeMsgpack(\n buffer: Uint8Array,\n // These default options ensure that we can correctly decode all Algorand specific msgpack data structures.\n // Some of these structures have bytes or bigint keys and bytes values that can be incorrectly decoded as utf8 strings by the msgpack library.\n options: MsgPackDecodeOptions = { useMap: true, rawBinaryStringKeys: true, rawBinaryStringValues: true },\n): Map<number | bigint | Uint8Array, unknown> {\n return msgpackDecode(buffer, { intMode: IntMode.AS_ENCODED, ...options }) as Map<number | bigint | Uint8Array, unknown>\n}\n\nexport function encodeMsgpack(data: unknown): Uint8Array {\n return new Uint8Array(msgpackEncode(data, { sortKeys: true, ignoreUndefined: true }))\n}\n"],"mappings":";;;;AAQA,SAAgB,cACd,QAGA,UAAgC;CAAE,QAAQ;CAAM,qBAAqB;CAAM,uBAAuB;CAAM,EAC5D;AAC5C,qCAAqB,QAAQ;EAAE,SAASA,yBAAQ;EAAY,GAAG;EAAS,CAAC;;AAG3E,SAAgB,cAAc,MAA2B;AACvD,QAAO,IAAI,wCAAyB,MAAM;EAAE,UAAU;EAAM,iBAAiB;EAAM,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- //#region packages/sdk/src/logic/sourcemap.d.ts
1
+ //#region packages/common/src/sourcemap.d.ts
2
2
  /**
3
3
  * Represents a location in a source file.
4
4
  */
@@ -51,5 +51,5 @@ declare class ProgramSourceMap {
51
51
  getPcsOnSourceLine(sourceIndex: number, line: number): PcLineLocation[];
52
52
  }
53
53
  //#endregion
54
- export { PcLineLocation, ProgramSourceMap, SourceLocation };
54
+ export { ProgramSourceMap };
55
55
  //# sourceMappingURL=sourcemap.d.ts.map
@@ -1,8 +1,8 @@
1
- const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
2
2
  let vlq = require("vlq");
3
3
  vlq = require_rolldown_runtime.__toESM(vlq);
4
4
 
5
- //#region packages/sdk/src/logic/sourcemap.ts
5
+ //#region packages/common/src/sourcemap.ts
6
6
  /**
7
7
  * Contains a mapping from TEAL program PC to source file location.
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"sourcemap.js","names":["pcInLine: PcLineLocation","pcLocation: SourceLocation"],"sources":["../../../../../packages/sdk/src/logic/sourcemap.ts"],"sourcesContent":["// @ts-ignore - vlq doesn't have proper type exports\nimport * as vlq from 'vlq'\n\n/**\n * Represents a location in a source file.\n */\nexport interface SourceLocation {\n line: number\n column: number\n sourceIndex: number\n nameIndex?: number\n}\n\n/**\n * Represents the location of a specific PC in a source line.\n */\nexport interface PcLineLocation {\n pc: number\n column: number\n nameIndex?: number\n}\n\n/**\n * Contains a mapping from TEAL program PC to source file location.\n */\nexport class ProgramSourceMap {\n public readonly version: number\n /**\n * A list of original sources used by the \"mappings\" entry.\n */\n public readonly sources: string[]\n /**\n * A list of symbol names used by the \"mappings\" entry.\n */\n public readonly names: string[]\n /**\n * A string with the encoded mapping data.\n */\n public readonly mappings: string\n\n private pcToLocation: Map<number, SourceLocation>\n\n // Key is `${sourceIndex}:${line}`\n private sourceAndLineToPc: Map<string, PcLineLocation[]>\n\n constructor({ version, sources, names, mappings }: { version: number; sources: string[]; names: string[]; mappings: string }) {\n this.version = version\n this.sources = sources\n this.names = names\n this.mappings = mappings\n\n if (this.version !== 3) throw new Error(`Only version 3 is supported, got ${this.version}`)\n\n if (this.mappings === undefined) throw new Error('mapping undefined, cannot build source map without `mapping`')\n\n const pcList = this.mappings.split(';').map(vlq.decode)\n\n this.pcToLocation = new Map()\n this.sourceAndLineToPc = new Map()\n\n const lastLocation = {\n line: 0,\n column: 0,\n sourceIndex: 0,\n nameIndex: 0,\n } satisfies SourceLocation\n for (const [pc, data] of pcList.entries()) {\n const dataArray = data as number[]\n if (dataArray.length < 4) continue\n\n const nameDelta = dataArray.length > 4 ? dataArray[4] : undefined\n const [, sourceDelta, lineDelta, columnDelta] = dataArray\n\n lastLocation.sourceIndex += sourceDelta\n lastLocation.line += lineDelta\n lastLocation.column += columnDelta\n if (typeof nameDelta !== 'undefined') {\n lastLocation.nameIndex += nameDelta\n }\n\n const sourceAndLineKey = `${lastLocation.sourceIndex}:${lastLocation.line}`\n let pcsForSourceAndLine = this.sourceAndLineToPc.get(sourceAndLineKey)\n if (pcsForSourceAndLine === undefined) {\n pcsForSourceAndLine = []\n this.sourceAndLineToPc.set(sourceAndLineKey, pcsForSourceAndLine)\n }\n\n const pcInLine: PcLineLocation = {\n pc,\n column: lastLocation.column,\n }\n const pcLocation: SourceLocation = {\n line: lastLocation.line,\n column: lastLocation.column,\n sourceIndex: lastLocation.sourceIndex,\n }\n if (typeof nameDelta !== 'undefined') {\n pcInLine.nameIndex = lastLocation.nameIndex\n pcLocation.nameIndex = lastLocation.nameIndex\n }\n\n pcsForSourceAndLine.push(pcInLine)\n this.pcToLocation.set(pc, pcLocation)\n }\n }\n\n getPcs(): number[] {\n return Array.from(this.pcToLocation.keys())\n }\n\n getLocationForPc(pc: number): SourceLocation | undefined {\n return this.pcToLocation.get(pc)\n }\n\n getPcsOnSourceLine(sourceIndex: number, line: number): PcLineLocation[] {\n const pcs = this.sourceAndLineToPc.get(`${sourceIndex}:${line}`)\n if (pcs === undefined) return []\n return pcs\n }\n}\n"],"mappings":";;;;;;;;AAyBA,IAAa,mBAAb,MAA8B;CAC5B,AAAgB;;;;CAIhB,AAAgB;;;;CAIhB,AAAgB;;;;CAIhB,AAAgB;CAEhB,AAAQ;CAGR,AAAQ;CAER,YAAY,EAAE,SAAS,SAAS,OAAO,YAAuF;AAC5H,OAAK,UAAU;AACf,OAAK,UAAU;AACf,OAAK,QAAQ;AACb,OAAK,WAAW;AAEhB,MAAI,KAAK,YAAY,EAAG,OAAM,IAAI,MAAM,oCAAoC,KAAK,UAAU;AAE3F,MAAI,KAAK,aAAa,OAAW,OAAM,IAAI,MAAM,+DAA+D;EAEhH,MAAM,SAAS,KAAK,SAAS,MAAM,IAAI,CAAC,IAAI,IAAI,OAAO;AAEvD,OAAK,+BAAe,IAAI,KAAK;AAC7B,OAAK,oCAAoB,IAAI,KAAK;EAElC,MAAM,eAAe;GACnB,MAAM;GACN,QAAQ;GACR,aAAa;GACb,WAAW;GACZ;AACD,OAAK,MAAM,CAAC,IAAI,SAAS,OAAO,SAAS,EAAE;GACzC,MAAM,YAAY;AAClB,OAAI,UAAU,SAAS,EAAG;GAE1B,MAAM,YAAY,UAAU,SAAS,IAAI,UAAU,KAAK;GACxD,MAAM,GAAG,aAAa,WAAW,eAAe;AAEhD,gBAAa,eAAe;AAC5B,gBAAa,QAAQ;AACrB,gBAAa,UAAU;AACvB,OAAI,OAAO,cAAc,YACvB,cAAa,aAAa;GAG5B,MAAM,mBAAmB,GAAG,aAAa,YAAY,GAAG,aAAa;GACrE,IAAI,sBAAsB,KAAK,kBAAkB,IAAI,iBAAiB;AACtE,OAAI,wBAAwB,QAAW;AACrC,0BAAsB,EAAE;AACxB,SAAK,kBAAkB,IAAI,kBAAkB,oBAAoB;;GAGnE,MAAMA,WAA2B;IAC/B;IACA,QAAQ,aAAa;IACtB;GACD,MAAMC,aAA6B;IACjC,MAAM,aAAa;IACnB,QAAQ,aAAa;IACrB,aAAa,aAAa;IAC3B;AACD,OAAI,OAAO,cAAc,aAAa;AACpC,aAAS,YAAY,aAAa;AAClC,eAAW,YAAY,aAAa;;AAGtC,uBAAoB,KAAK,SAAS;AAClC,QAAK,aAAa,IAAI,IAAI,WAAW;;;CAIzC,SAAmB;AACjB,SAAO,MAAM,KAAK,KAAK,aAAa,MAAM,CAAC;;CAG7C,iBAAiB,IAAwC;AACvD,SAAO,KAAK,aAAa,IAAI,GAAG;;CAGlC,mBAAmB,aAAqB,MAAgC;EACtE,MAAM,MAAM,KAAK,kBAAkB,IAAI,GAAG,YAAY,GAAG,OAAO;AAChE,MAAI,QAAQ,OAAW,QAAO,EAAE;AAChC,SAAO"}
1
+ {"version":3,"file":"sourcemap.js","names":["pcInLine: PcLineLocation","pcLocation: SourceLocation"],"sources":["../../../../packages/common/src/sourcemap.ts"],"sourcesContent":["// @ts-expect-error - vlq doesn't have proper type exports\nimport * as vlq from 'vlq'\n\n/**\n * Represents a location in a source file.\n */\nexport interface SourceLocation {\n line: number\n column: number\n sourceIndex: number\n nameIndex?: number\n}\n\n/**\n * Represents the location of a specific PC in a source line.\n */\nexport interface PcLineLocation {\n pc: number\n column: number\n nameIndex?: number\n}\n\n/**\n * Contains a mapping from TEAL program PC to source file location.\n */\nexport class ProgramSourceMap {\n public readonly version: number\n /**\n * A list of original sources used by the \"mappings\" entry.\n */\n public readonly sources: string[]\n /**\n * A list of symbol names used by the \"mappings\" entry.\n */\n public readonly names: string[]\n /**\n * A string with the encoded mapping data.\n */\n public readonly mappings: string\n\n private pcToLocation: Map<number, SourceLocation>\n\n // Key is `${sourceIndex}:${line}`\n private sourceAndLineToPc: Map<string, PcLineLocation[]>\n\n constructor({ version, sources, names, mappings }: { version: number; sources: string[]; names: string[]; mappings: string }) {\n this.version = version\n this.sources = sources\n this.names = names\n this.mappings = mappings\n\n if (this.version !== 3) throw new Error(`Only version 3 is supported, got ${this.version}`)\n\n if (this.mappings === undefined) throw new Error('mapping undefined, cannot build source map without `mapping`')\n\n const pcList = this.mappings.split(';').map(vlq.decode)\n\n this.pcToLocation = new Map()\n this.sourceAndLineToPc = new Map()\n\n const lastLocation = {\n line: 0,\n column: 0,\n sourceIndex: 0,\n nameIndex: 0,\n } satisfies SourceLocation\n for (const [pc, data] of pcList.entries()) {\n const dataArray = data as number[]\n if (dataArray.length < 4) continue\n\n const nameDelta = dataArray.length > 4 ? dataArray[4] : undefined\n const [, sourceDelta, lineDelta, columnDelta] = dataArray\n\n lastLocation.sourceIndex += sourceDelta\n lastLocation.line += lineDelta\n lastLocation.column += columnDelta\n if (typeof nameDelta !== 'undefined') {\n lastLocation.nameIndex += nameDelta\n }\n\n const sourceAndLineKey = `${lastLocation.sourceIndex}:${lastLocation.line}`\n let pcsForSourceAndLine = this.sourceAndLineToPc.get(sourceAndLineKey)\n if (pcsForSourceAndLine === undefined) {\n pcsForSourceAndLine = []\n this.sourceAndLineToPc.set(sourceAndLineKey, pcsForSourceAndLine)\n }\n\n const pcInLine: PcLineLocation = {\n pc,\n column: lastLocation.column,\n }\n const pcLocation: SourceLocation = {\n line: lastLocation.line,\n column: lastLocation.column,\n sourceIndex: lastLocation.sourceIndex,\n }\n if (typeof nameDelta !== 'undefined') {\n pcInLine.nameIndex = lastLocation.nameIndex\n pcLocation.nameIndex = lastLocation.nameIndex\n }\n\n pcsForSourceAndLine.push(pcInLine)\n this.pcToLocation.set(pc, pcLocation)\n }\n }\n\n getPcs(): number[] {\n return Array.from(this.pcToLocation.keys())\n }\n\n getLocationForPc(pc: number): SourceLocation | undefined {\n return this.pcToLocation.get(pc)\n }\n\n getPcsOnSourceLine(sourceIndex: number, line: number): PcLineLocation[] {\n const pcs = this.sourceAndLineToPc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;IACrB,aAAa,aAAa;IAC3B;AACD,OAAI,OAAO,cAAc,aAAa;AACpC,aAAS,YAAY,aAAa;AAClC,eAAW,YAAY,aAAa;;AAGtC,uBAAoB,KAAK,SAAS;AAClC,QAAK,aAAa,IAAI,IAAI,WAAW;;;CAIzC,SAAmB;AACjB,SAAO,MAAM,KAAK,KAAK,aAAa,MAAM,CAAC;;CAG7C,iBAAiB,IAAwC;AACvD,SAAO,KAAK,aAAa,IAAI,GAAG;;CAGlC,mBAAmB,aAAqB,MAAgC;EACtE,MAAM,MAAM,KAAK,kBAAkB,IAAI,GAAG,YAAY,GAAG,OAAO;AAChE,MAAI,QAAQ,OAAW,QAAO,EAAE;AAChC,SAAO"}
@@ -1,6 +1,6 @@
1
1
  import * as vlq from "vlq";
2
2
 
3
- //#region packages/sdk/src/logic/sourcemap.ts
3
+ //#region packages/common/src/sourcemap.ts
4
4
  /**
5
5
  * Contains a mapping from TEAL program PC to source file location.
6
6
  */