@aeternity/aepp-sdk 12.1.3 → 13.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/bin/aesophia_cli +0 -0
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.map +1 -1
  4. package/dist/aepp-sdk.browser.js +1 -1
  5. package/dist/aepp-sdk.browser.js.map +1 -1
  6. package/dist/aepp-sdk.js +12031 -11231
  7. package/dist/aepp-sdk.js.map +1 -1
  8. package/es/AeSdk.d.ts +7 -3
  9. package/es/AeSdk.mjs +17 -22
  10. package/es/AeSdk.mjs.map +1 -1
  11. package/es/AeSdkAepp.d.ts +6 -5
  12. package/es/AeSdkAepp.mjs +7 -30
  13. package/es/AeSdkAepp.mjs.map +1 -1
  14. package/es/AeSdkBase.d.ts +18 -140
  15. package/es/AeSdkBase.mjs +30 -184
  16. package/es/AeSdkBase.mjs.map +1 -1
  17. package/es/AeSdkMethods.d.ts +123 -0
  18. package/es/AeSdkMethods.mjs +122 -0
  19. package/es/AeSdkMethods.mjs.map +1 -0
  20. package/es/AeSdkWallet.d.ts +7 -21
  21. package/es/AeSdkWallet.mjs +38 -86
  22. package/es/AeSdkWallet.mjs.map +1 -1
  23. package/es/Node.d.ts +11 -15
  24. package/es/Node.mjs +35 -48
  25. package/es/Node.mjs.map +1 -1
  26. package/es/account/Base.d.ts +24 -40
  27. package/es/account/Base.mjs +1 -101
  28. package/es/account/Base.mjs.map +1 -1
  29. package/es/account/Generalized.d.ts +16 -0
  30. package/es/account/Generalized.mjs +113 -0
  31. package/es/account/Generalized.mjs.map +1 -0
  32. package/es/account/Ledger.d.ts +28 -0
  33. package/es/account/Ledger.mjs +102 -0
  34. package/es/account/Ledger.mjs.map +1 -0
  35. package/es/account/LedgerFactory.d.ts +39 -0
  36. package/es/account/LedgerFactory.mjs +81 -0
  37. package/es/account/LedgerFactory.mjs.map +1 -0
  38. package/es/account/Memory.d.ts +13 -17
  39. package/es/account/Memory.mjs +43 -64
  40. package/es/account/Memory.mjs.map +1 -1
  41. package/es/account/Rpc.d.ts +6 -8
  42. package/es/account/Rpc.mjs +14 -32
  43. package/es/account/Rpc.mjs.map +1 -1
  44. package/es/aens.d.ts +4 -4
  45. package/es/aens.mjs +46 -41
  46. package/es/aens.mjs.map +1 -1
  47. package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
  48. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
  50. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
  51. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
  53. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
  54. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  55. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  56. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
  57. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
  58. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
  60. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/schema.mjs +14 -68
  62. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  63. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  64. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  65. package/es/apis/compiler/compiler.d.ts +23 -29
  66. package/es/apis/compiler/compiler.mjs +128 -189
  67. package/es/apis/compiler/compiler.mjs.map +1 -1
  68. package/es/apis/compiler/index.mjs.map +1 -1
  69. package/es/apis/compiler/models/index.d.ts +82 -135
  70. package/es/apis/compiler/models/index.mjs +1 -47
  71. package/es/apis/compiler/models/index.mjs.map +1 -1
  72. package/es/apis/compiler/models/mappers.d.ts +8 -8
  73. package/es/apis/compiler/models/mappers.mjs +165 -183
  74. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  75. package/es/apis/compiler/models/parameters.d.ts +0 -1
  76. package/es/apis/compiler/models/parameters.mjs +5 -9
  77. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  78. package/es/apis/node/index.mjs.map +1 -1
  79. package/es/apis/node/models/index.d.ts +48 -48
  80. package/es/apis/node/models/mappers.mjs +12 -6
  81. package/es/apis/node/models/mappers.mjs.map +1 -1
  82. package/es/apis/node/models/parameters.mjs.map +1 -1
  83. package/es/apis/node/node.mjs +43 -84
  84. package/es/apis/node/node.mjs.map +1 -1
  85. package/es/chain.d.ts +10 -2
  86. package/es/chain.mjs +37 -59
  87. package/es/chain.mjs.map +1 -1
  88. package/es/channel/Base.d.ts +200 -0
  89. package/es/channel/Base.mjs +293 -0
  90. package/es/channel/Base.mjs.map +1 -0
  91. package/es/channel/Contract.d.ts +248 -0
  92. package/es/channel/Contract.mjs +420 -0
  93. package/es/channel/Contract.mjs.map +1 -0
  94. package/es/channel/Spend.d.ts +219 -0
  95. package/es/channel/Spend.mjs +385 -0
  96. package/es/channel/Spend.mjs.map +1 -0
  97. package/es/channel/handlers.d.ts +8 -21
  98. package/es/channel/handlers.mjs +151 -899
  99. package/es/channel/handlers.mjs.map +1 -1
  100. package/es/channel/internal.d.ts +27 -21
  101. package/es/channel/internal.mjs +101 -191
  102. package/es/channel/internal.mjs.map +1 -1
  103. package/es/contract/Contract.d.ts +210 -0
  104. package/es/contract/Contract.mjs +551 -0
  105. package/es/contract/Contract.mjs.map +1 -0
  106. package/es/contract/compiler/Base.d.ts +81 -0
  107. package/es/contract/compiler/Base.mjs +5 -0
  108. package/es/contract/compiler/Base.mjs.map +1 -0
  109. package/es/contract/compiler/Cli.d.ts +23 -0
  110. package/es/contract/compiler/Cli.mjs +155 -0
  111. package/es/contract/compiler/Cli.mjs.map +1 -0
  112. package/es/contract/compiler/Http.d.ts +32 -0
  113. package/es/contract/compiler/Http.mjs +118 -0
  114. package/es/contract/compiler/Http.mjs.map +1 -0
  115. package/es/contract/compiler/HttpNode.d.ts +17 -0
  116. package/es/contract/compiler/HttpNode.mjs +26 -0
  117. package/es/contract/compiler/HttpNode.mjs.map +1 -0
  118. package/es/contract/compiler/getFileSystem.d.ts +6 -0
  119. package/es/contract/compiler/getFileSystem.mjs +40 -0
  120. package/es/contract/compiler/getFileSystem.mjs.map +1 -0
  121. package/es/contract/ga.d.ts +9 -34
  122. package/es/contract/ga.mjs +29 -112
  123. package/es/contract/ga.mjs.map +1 -1
  124. package/es/index-browser.d.ts +39 -0
  125. package/es/index-browser.mjs +55 -0
  126. package/es/index-browser.mjs.map +1 -0
  127. package/es/index.d.ts +4 -35
  128. package/es/index.mjs +4 -51
  129. package/es/index.mjs.map +1 -1
  130. package/es/oracle.d.ts +5 -5
  131. package/es/oracle.mjs +34 -40
  132. package/es/oracle.mjs.map +1 -1
  133. package/es/spend.d.ts +3 -3
  134. package/es/spend.mjs +18 -23
  135. package/es/spend.mjs.map +1 -1
  136. package/es/tx/builder/constants.d.ts +30 -2
  137. package/es/tx/builder/constants.mjs +43 -14
  138. package/es/tx/builder/constants.mjs.map +1 -1
  139. package/es/tx/builder/field-types/abi-version.d.ts +10 -0
  140. package/es/tx/builder/field-types/abi-version.mjs +20 -0
  141. package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
  142. package/es/tx/builder/field-types/address.d.ts +14 -0
  143. package/es/tx/builder/field-types/address.mjs +51 -0
  144. package/es/tx/builder/field-types/address.mjs.map +1 -0
  145. package/es/tx/builder/field-types/array.d.ts +7 -0
  146. package/es/tx/builder/field-types/array.mjs +11 -0
  147. package/es/tx/builder/field-types/array.mjs.map +1 -0
  148. package/es/tx/builder/field-types/boolean.d.ts +6 -0
  149. package/es/tx/builder/field-types/boolean.mjs +13 -0
  150. package/es/tx/builder/field-types/boolean.mjs.map +1 -0
  151. package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
  152. package/es/tx/builder/field-types/coin-amount.mjs +4 -12
  153. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  154. package/es/tx/builder/field-types/ct-version.d.ts +30 -0
  155. package/es/tx/builder/field-types/ct-version.mjs +48 -0
  156. package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
  157. package/es/tx/builder/field-types/deposit.d.ts +1 -2
  158. package/es/tx/builder/field-types/deposit.mjs +2 -4
  159. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  160. package/es/tx/builder/field-types/encoded.d.ts +6 -0
  161. package/es/tx/builder/field-types/encoded.mjs +21 -0
  162. package/es/tx/builder/field-types/encoded.mjs.map +1 -0
  163. package/es/tx/builder/field-types/entry.d.ts +11 -0
  164. package/es/tx/builder/field-types/entry.mjs +31 -0
  165. package/es/tx/builder/field-types/entry.mjs.map +1 -0
  166. package/es/tx/builder/field-types/enumeration.d.ts +7 -0
  167. package/es/tx/builder/field-types/enumeration.mjs +30 -0
  168. package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
  169. package/es/tx/builder/field-types/fee.d.ts +10 -15
  170. package/es/tx/builder/field-types/fee.mjs +31 -43
  171. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  172. package/es/tx/builder/field-types/field.mjs +0 -2
  173. package/es/tx/builder/field-types/field.mjs.map +1 -1
  174. package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
  175. package/es/tx/builder/field-types/gas-limit.mjs +12 -14
  176. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  177. package/es/tx/builder/field-types/gas-price.d.ts +1 -2
  178. package/es/tx/builder/field-types/gas-price.mjs +3 -7
  179. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  180. package/es/tx/builder/field-types/index.d.ts +80 -30
  181. package/es/tx/builder/field-types/index.mjs +34 -9
  182. package/es/tx/builder/field-types/index.mjs.map +1 -1
  183. package/es/tx/builder/field-types/mptree.d.ts +37 -0
  184. package/es/tx/builder/field-types/mptree.mjs +268 -0
  185. package/es/tx/builder/field-types/mptree.mjs.map +1 -0
  186. package/es/tx/builder/field-types/name-fee.d.ts +1 -3
  187. package/es/tx/builder/field-types/name-fee.mjs +3 -5
  188. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  189. package/es/tx/builder/field-types/name-id.d.ts +1 -4
  190. package/es/tx/builder/field-types/name-id.mjs +5 -10
  191. package/es/tx/builder/field-types/name-id.mjs.map +1 -1
  192. package/es/tx/builder/field-types/name.mjs +0 -2
  193. package/es/tx/builder/field-types/name.mjs.map +1 -1
  194. package/es/tx/builder/field-types/pointers.d.ts +23 -0
  195. package/es/tx/builder/field-types/pointers.mjs +36 -0
  196. package/es/tx/builder/field-types/pointers.mjs.map +1 -0
  197. package/es/tx/builder/field-types/raw.d.ts +6 -0
  198. package/es/tx/builder/field-types/raw.mjs +13 -0
  199. package/es/tx/builder/field-types/raw.mjs.map +1 -0
  200. package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  201. package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
  202. package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
  203. package/es/tx/builder/field-types/short-u-int.mjs +0 -2
  204. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
  205. package/es/tx/builder/field-types/string.d.ts +6 -0
  206. package/es/tx/builder/field-types/string.mjs +10 -0
  207. package/es/tx/builder/field-types/string.mjs.map +1 -0
  208. package/es/tx/builder/field-types/u-int.d.ts +1 -2
  209. package/es/tx/builder/field-types/u-int.mjs +3 -4
  210. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  211. package/es/tx/builder/helpers.d.ts +2 -32
  212. package/es/tx/builder/helpers.mjs +19 -71
  213. package/es/tx/builder/helpers.mjs.map +1 -1
  214. package/es/tx/builder/index.d.ts +11 -49
  215. package/es/tx/builder/index.mjs +57 -337
  216. package/es/tx/builder/index.mjs.map +1 -1
  217. package/es/tx/builder/schema.d.ts +2367 -667
  218. package/es/tx/builder/schema.mjs +70 -145
  219. package/es/tx/builder/schema.mjs.map +1 -1
  220. package/es/tx/index.d.ts +4 -49
  221. package/es/tx/index.mjs +38 -112
  222. package/es/tx/index.mjs.map +1 -1
  223. package/es/tx/validator.d.ts +4 -6
  224. package/es/tx/validator.mjs +104 -90
  225. package/es/tx/validator.mjs.map +1 -1
  226. package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
  227. package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
  228. package/es/utils/amount-formatter.mjs +4 -10
  229. package/es/utils/amount-formatter.mjs.map +1 -1
  230. package/es/utils/autorest.d.ts +1 -0
  231. package/es/utils/autorest.mjs +17 -19
  232. package/es/utils/autorest.mjs.map +1 -1
  233. package/es/utils/bignumber.mjs +4 -7
  234. package/es/utils/bignumber.mjs.map +1 -1
  235. package/es/utils/bytes.d.ts +0 -17
  236. package/es/utils/bytes.mjs +6 -35
  237. package/es/utils/bytes.mjs.map +1 -1
  238. package/es/utils/crypto.d.ts +15 -8
  239. package/es/utils/crypto.mjs +40 -40
  240. package/es/utils/crypto.mjs.map +1 -1
  241. package/es/utils/encoder-types.d.ts +28 -28
  242. package/es/utils/encoder-types.mjs +0 -1
  243. package/es/utils/encoder-types.mjs.map +1 -1
  244. package/es/utils/encoder.d.ts +0 -1
  245. package/es/utils/encoder.mjs +7 -15
  246. package/es/utils/encoder.mjs.map +1 -1
  247. package/es/utils/errors.d.ts +15 -14
  248. package/es/utils/errors.mjs +86 -172
  249. package/es/utils/errors.mjs.map +1 -1
  250. package/es/utils/hd-wallet.d.ts +27 -19
  251. package/es/utils/hd-wallet.mjs +42 -26
  252. package/es/utils/hd-wallet.mjs.map +1 -1
  253. package/es/utils/json-big.mjs +0 -8
  254. package/es/utils/json-big.mjs.map +1 -1
  255. package/es/utils/keystore.d.ts +2 -0
  256. package/es/utils/keystore.mjs +37 -36
  257. package/es/utils/keystore.mjs.map +1 -1
  258. package/es/utils/other.d.ts +4 -2
  259. package/es/utils/other.mjs +11 -7
  260. package/es/utils/other.mjs.map +1 -1
  261. package/es/utils/semver-satisfies.mjs +0 -3
  262. package/es/utils/semver-satisfies.mjs.map +1 -1
  263. package/es/utils/string.d.ts +0 -12
  264. package/es/utils/string.mjs +1 -21
  265. package/es/utils/string.mjs.map +1 -1
  266. package/package.json +98 -51
  267. package/src/AeSdk.ts +15 -11
  268. package/src/AeSdkAepp.ts +9 -7
  269. package/src/AeSdkBase.ts +31 -202
  270. package/src/AeSdkMethods.ts +169 -0
  271. package/src/AeSdkWallet.ts +16 -47
  272. package/src/Node.ts +17 -18
  273. package/src/account/Base.ts +29 -75
  274. package/src/account/Generalized.ts +98 -0
  275. package/src/account/Ledger.ts +131 -0
  276. package/src/account/LedgerFactory.ts +86 -0
  277. package/src/account/Memory.ts +46 -60
  278. package/src/account/Rpc.ts +17 -26
  279. package/src/aens.ts +13 -11
  280. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
  281. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
  282. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
  283. package/src/aepp-wallet-communication/rpc/types.ts +11 -1
  284. package/src/aepp-wallet-communication/schema.ts +18 -18
  285. package/src/apis/compiler/code-model-v4.yaml +681 -888
  286. package/src/apis/compiler/compiler.ts +113 -154
  287. package/src/apis/compiler/models/index.ts +80 -140
  288. package/src/apis/compiler/models/mappers.ts +165 -183
  289. package/src/apis/compiler/models/parameters.ts +6 -12
  290. package/src/chain.ts +11 -6
  291. package/src/channel/Base.ts +335 -0
  292. package/src/channel/Contract.ts +488 -0
  293. package/src/channel/Spend.ts +408 -0
  294. package/src/channel/handlers.ts +164 -582
  295. package/src/channel/internal.ts +114 -143
  296. package/src/contract/Contract.ts +610 -0
  297. package/src/contract/compiler/Base.ts +94 -0
  298. package/src/contract/compiler/Cli.ts +134 -0
  299. package/src/contract/compiler/Http.ts +124 -0
  300. package/src/contract/compiler/HttpNode.ts +26 -0
  301. package/src/contract/compiler/getFileSystem.ts +42 -0
  302. package/src/contract/ga.ts +23 -106
  303. package/src/index-browser.ts +58 -0
  304. package/src/index.ts +4 -55
  305. package/src/oracle.ts +8 -8
  306. package/src/spend.ts +6 -14
  307. package/src/tx/builder/constants.ts +33 -3
  308. package/src/tx/builder/field-types/abi-version.ts +21 -0
  309. package/src/tx/builder/field-types/address.ts +62 -0
  310. package/src/tx/builder/field-types/array.ts +19 -0
  311. package/src/tx/builder/field-types/boolean.ts +9 -0
  312. package/src/tx/builder/field-types/coin-amount.ts +4 -9
  313. package/src/tx/builder/field-types/ct-version.ts +50 -0
  314. package/src/tx/builder/field-types/deposit.ts +1 -1
  315. package/src/tx/builder/field-types/encoded.ts +27 -0
  316. package/src/tx/builder/field-types/entry.ts +31 -0
  317. package/src/tx/builder/field-types/enumeration.ts +32 -0
  318. package/src/tx/builder/field-types/fee.ts +39 -21
  319. package/src/tx/builder/field-types/gas-limit.ts +13 -8
  320. package/src/tx/builder/field-types/gas-price.ts +0 -2
  321. package/src/tx/builder/field-types/index.ts +54 -15
  322. package/src/tx/builder/field-types/mptree.ts +242 -0
  323. package/src/tx/builder/field-types/name-fee.ts +2 -3
  324. package/src/tx/builder/field-types/name-id.ts +7 -10
  325. package/src/tx/builder/field-types/pointers.ts +41 -0
  326. package/src/tx/builder/field-types/raw.ts +9 -0
  327. package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
  328. package/src/tx/builder/field-types/string.ts +11 -0
  329. package/src/tx/builder/field-types/u-int.ts +4 -5
  330. package/src/tx/builder/helpers.ts +10 -60
  331. package/src/tx/builder/index.ts +65 -308
  332. package/src/tx/builder/schema.ts +280 -341
  333. package/src/tx/index.ts +40 -103
  334. package/src/tx/validator.ts +91 -96
  335. package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
  336. package/src/utils/autorest.ts +16 -1
  337. package/src/utils/bytes.ts +6 -34
  338. package/src/utils/crypto.ts +23 -16
  339. package/src/utils/encoder.ts +0 -1
  340. package/src/utils/errors.ts +22 -25
  341. package/src/utils/hd-wallet.ts +30 -9
  342. package/src/utils/keystore.ts +24 -21
  343. package/src/utils/other.ts +16 -1
  344. package/src/utils/string.ts +0 -20
  345. package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
  346. package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
  347. package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
  348. package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
  349. package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
  350. package/types-legacy/ts4.2/Node.d.ts +78 -0
  351. package/types-legacy/ts4.2/account/Base.d.ts +52 -0
  352. package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
  353. package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
  354. package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
  355. package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
  356. package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
  357. package/types-legacy/ts4.2/aens.d.ts +222 -0
  358. package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  359. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  360. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  361. package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  362. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  363. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
  364. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
  365. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  366. package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
  367. package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
  368. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
  369. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
  370. package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
  371. package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
  372. package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
  373. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
  374. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
  375. package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
  376. package/types-legacy/ts4.2/chain.d.ts +256 -0
  377. package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
  378. package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
  379. package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
  380. package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
  381. package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
  382. package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
  383. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
  384. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
  385. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
  386. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
  387. package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
  388. package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
  389. package/types-legacy/ts4.2/globals.d.ts +16 -0
  390. package/types-legacy/ts4.2/index-browser.d.ts +39 -0
  391. package/types-legacy/ts4.2/index.d.ts +5 -0
  392. package/types-legacy/ts4.2/oracle.d.ts +161 -0
  393. package/types-legacy/ts4.2/spend.d.ts +62 -0
  394. package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
  395. package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
  396. package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
  397. package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
  398. package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
  399. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
  400. package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
  401. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
  402. package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
  403. package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
  404. package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
  405. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
  406. package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
  407. package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
  408. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
  409. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
  410. package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
  411. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
  412. package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
  413. package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
  414. package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
  415. package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
  416. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  417. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
  418. package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
  419. package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
  420. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
  421. package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
  422. package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
  423. package/types-legacy/ts4.2/tx/index.d.ts +19 -0
  424. package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
  425. package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
  426. package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
  427. package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
  428. package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
  429. package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
  430. package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
  431. package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
  432. package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
  433. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
  434. package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
  435. package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
  436. package/types-legacy/ts4.2/utils/other.d.ts +31 -0
  437. package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
  438. package/types-legacy/ts4.2/utils/string.d.ts +12 -0
  439. package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
  440. package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
  441. package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
  442. package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
  443. package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
  444. package/types-legacy/ts4.5/Node.d.ts +78 -0
  445. package/types-legacy/ts4.5/account/Base.d.ts +52 -0
  446. package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
  447. package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
  448. package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
  449. package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
  450. package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
  451. package/types-legacy/ts4.5/aens.d.ts +222 -0
  452. package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  453. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  454. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  455. package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  456. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  457. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
  458. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
  459. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  460. package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
  461. package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
  462. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
  463. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
  464. package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
  465. package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
  466. package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
  467. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
  468. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
  469. package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
  470. package/types-legacy/ts4.5/chain.d.ts +256 -0
  471. package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
  472. package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
  473. package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
  474. package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
  475. package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
  476. package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
  477. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
  478. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
  479. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
  480. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
  481. package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
  482. package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
  483. package/types-legacy/ts4.5/index-browser.d.ts +39 -0
  484. package/types-legacy/ts4.5/index.d.ts +4 -0
  485. package/types-legacy/ts4.5/oracle.d.ts +161 -0
  486. package/types-legacy/ts4.5/spend.d.ts +62 -0
  487. package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
  488. package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
  489. package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
  490. package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
  491. package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
  492. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
  493. package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
  494. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
  495. package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
  496. package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
  497. package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
  498. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
  499. package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
  500. package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
  501. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
  502. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
  503. package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
  504. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
  505. package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
  506. package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
  507. package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
  508. package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
  509. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  510. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
  511. package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
  512. package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
  513. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
  514. package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
  515. package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
  516. package/types-legacy/ts4.5/tx/index.d.ts +19 -0
  517. package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
  518. package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
  519. package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
  520. package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
  521. package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
  522. package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
  523. package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
  524. package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
  525. package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
  526. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
  527. package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
  528. package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
  529. package/types-legacy/ts4.5/utils/other.d.ts +31 -0
  530. package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
  531. package/types-legacy/ts4.5/utils/string.d.ts +12 -0
  532. package/es/channel/index.d.ts +0 -625
  533. package/es/channel/index.mjs +0 -975
  534. package/es/channel/index.mjs.map +0 -1
  535. package/es/contract/Compiler.d.ts +0 -18
  536. package/es/contract/Compiler.mjs +0 -68
  537. package/es/contract/Compiler.mjs.map +0 -1
  538. package/es/contract/aci.d.ts +0 -127
  539. package/es/contract/aci.mjs +0 -508
  540. package/es/contract/aci.mjs.map +0 -1
  541. package/es/contract/methods.d.ts +0 -71
  542. package/es/contract/methods.mjs +0 -104
  543. package/es/contract/methods.mjs.map +0 -1
  544. package/es/deprecated/index.d.ts +0 -143
  545. package/es/deprecated/index.mjs +0 -162
  546. package/es/deprecated/index.mjs.map +0 -1
  547. package/es/deprecated/methods.d.ts +0 -18
  548. package/es/deprecated/methods.mjs +0 -26
  549. package/es/deprecated/methods.mjs.map +0 -1
  550. package/es/tx/builder/address.d.ts +0 -25
  551. package/es/tx/builder/address.mjs +0 -45
  552. package/es/tx/builder/address.mjs.map +0 -1
  553. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
  554. package/es/utils/mptree.d.ts +0 -26
  555. package/es/utils/mptree.mjs +0 -165
  556. package/es/utils/mptree.mjs.map +0 -1
  557. package/src/channel/index.ts +0 -1025
  558. package/src/contract/Compiler.ts +0 -67
  559. package/src/contract/aci.ts +0 -537
  560. package/src/contract/methods.ts +0 -123
  561. package/src/deprecated/index.ts +0 -172
  562. package/src/deprecated/methods.ts +0 -25
  563. package/src/tx/builder/address.ts +0 -50
  564. package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
  565. package/src/utils/mptree.ts +0 -145
@@ -1,29 +1,25 @@
1
1
  import BigNumber from 'bignumber.js';
2
- import { mapObject } from "../../utils/other.mjs"; // # AENS
3
-
4
- export const NAME_TTL = 180000; // # max number of block into the future that the name is going to be available
2
+ import { mapObject } from "../../utils/other.mjs";
3
+ export const MAX_AUTH_FUN_GAS = 50000;
4
+ export const NAME_TTL = 180000;
5
+ // # max number of block into the future that the name is going to be available
5
6
  // # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update
6
7
  // # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry
7
-
8
8
  export const NAME_MAX_TTL = 36000;
9
9
  export const NAME_MAX_CLIENT_TTL = 84600;
10
10
  export const CLIENT_TTL = NAME_MAX_CLIENT_TTL;
11
- export const MIN_GAS_PRICE = 1e9; // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
12
-
11
+ export const MIN_GAS_PRICE = 1e9;
12
+ // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67
13
13
  export const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000
14
-
15
14
  export const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage
16
15
  // # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272
17
-
18
16
  export const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day
19
17
  // # this is the max length for a domain that requires a base fee to be paid
20
-
21
18
  export const NAME_MAX_LENGTH_FEE = 31;
22
19
  export const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid
23
20
  // # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290
24
21
  // # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times
25
22
  // # bid ranges:
26
-
27
23
  export const NAME_BID_RANGES = mapObject({
28
24
  31: 3,
29
25
  30: 5,
@@ -60,6 +56,32 @@ export const NAME_BID_RANGES = mapObject({
60
56
  let [key, value] = _ref;
61
57
  return [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)];
62
58
  });
59
+ export let ConsensusProtocolVersion;
60
+
61
+ /**
62
+ * @category transaction builder
63
+ * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
64
+ */
65
+ (function (ConsensusProtocolVersion) {
66
+ ConsensusProtocolVersion[ConsensusProtocolVersion["Iris"] = 5] = "Iris";
67
+ })(ConsensusProtocolVersion || (ConsensusProtocolVersion = {}));
68
+ export let VmVersion;
69
+
70
+ /**
71
+ * @category transaction builder
72
+ * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}
73
+ */
74
+ (function (VmVersion) {
75
+ VmVersion[VmVersion["NoVm"] = 0] = "NoVm";
76
+ VmVersion[VmVersion["Sophia"] = 1] = "Sophia";
77
+ VmVersion[VmVersion["SophiaImprovementsMinerva"] = 3] = "SophiaImprovementsMinerva";
78
+ VmVersion[VmVersion["SophiaImprovementsFortuna"] = 4] = "SophiaImprovementsFortuna";
79
+ VmVersion[VmVersion["Fate"] = 5] = "Fate";
80
+ VmVersion[VmVersion["SophiaImprovementsLima"] = 6] = "SophiaImprovementsLima";
81
+ VmVersion[VmVersion["Fate2"] = 7] = "Fate2";
82
+ })(VmVersion || (VmVersion = {}));
83
+ export let AbiVersion;
84
+
63
85
  /**
64
86
  * Enum with tag types
65
87
  * @category transaction builder
@@ -67,17 +89,25 @@ export const NAME_BID_RANGES = mapObject({
67
89
  * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}
68
90
  */
69
91
  // TODO: implement serialisation for commented-out tags
70
-
71
- export let Tag;
72
-
92
+ (function (AbiVersion) {
93
+ AbiVersion[AbiVersion["NoAbi"] = 0] = "NoAbi";
94
+ AbiVersion[AbiVersion["Sophia"] = 1] = "Sophia";
95
+ AbiVersion[AbiVersion["Fate"] = 3] = "Fate";
96
+ })(AbiVersion || (AbiVersion = {}));
97
+ export let Tag; // KeyBlock = 100,
98
+ // MicroBlock = 101,
99
+ // LightMicroBlock = 102,
100
+ // Pof = 200,
73
101
  (function (Tag) {
74
102
  Tag[Tag["Account"] = 10] = "Account";
75
103
  Tag[Tag["SignedTx"] = 11] = "SignedTx";
76
104
  Tag[Tag["SpendTx"] = 12] = "SpendTx";
105
+ Tag[Tag["Oracle"] = 20] = "Oracle";
77
106
  Tag[Tag["OracleRegisterTx"] = 22] = "OracleRegisterTx";
78
107
  Tag[Tag["OracleQueryTx"] = 23] = "OracleQueryTx";
79
108
  Tag[Tag["OracleResponseTx"] = 24] = "OracleResponseTx";
80
109
  Tag[Tag["OracleExtendTx"] = 25] = "OracleExtendTx";
110
+ Tag[Tag["Name"] = 30] = "Name";
81
111
  Tag[Tag["NameClaimTx"] = 32] = "NameClaimTx";
82
112
  Tag[Tag["NamePreclaimTx"] = 33] = "NamePreclaimTx";
83
113
  Tag[Tag["NameUpdateTx"] = 34] = "NameUpdateTx";
@@ -114,7 +144,6 @@ export let Tag;
114
144
  Tag[Tag["NameserviceMtree"] = 624] = "NameserviceMtree";
115
145
  Tag[Tag["OraclesMtree"] = 625] = "OraclesMtree";
116
146
  Tag[Tag["AccountsMtree"] = 626] = "AccountsMtree";
117
- Tag[Tag["CompilerSophia"] = 70] = "CompilerSophia";
118
147
  Tag[Tag["GaAttachTx"] = 80] = "GaAttachTx";
119
148
  Tag[Tag["GaMetaTx"] = 81] = "GaMetaTx";
120
149
  Tag[Tag["PayingForTx"] = 82] = "PayingForTx";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n // Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n // Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,S,iCAET;;AAEA,OAAO,MAAMC,QAAQ,GAAG,MAAjB,C,CACP;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAG,KAArB;AACP,OAAO,MAAMC,mBAAmB,GAAG,KAA5B;AACP,OAAO,MAAMC,UAAU,GAAGD,mBAAnB;AACP,OAAO,MAAME,aAAa,GAAG,GAAtB,C,CACP;;AACA,OAAO,MAAMC,mBAAmB,GAAG,IAA5B,C,CAAkC;;AACzC,OAAO,MAAMC,sBAAsB,GAAG,IAA/B,C,CAAqC;AAC5C;;AACA,OAAO,MAAMC,uBAAuB,GAAG,GAAhC,C,CAAqC;AAC5C;;AACA,OAAO,MAAMC,mBAAmB,GAAG,EAA5B;AACP,OAAO,MAAMC,mBAAmB,GAAG,EAA5B,C,CAAgC;AACvC;AACA;AACA;;AACA,OAAO,MAAMC,eAAe,GAAGX,SAAS,CAAC;EACvC,IAAI,CADmC;EAEvC,IAAI,CAFmC;EAGvC,IAAI,CAHmC;EAIvC,IAAI,EAJmC;EAKvC,IAAI,EALmC;EAMvC,IAAI,EANmC;EAOvC,IAAI,EAPmC;EAQvC,IAAI,EARmC;EASvC,IAAI,GATmC;EAUvC,IAAI,GAVmC;EAWvC,IAAI,GAXmC;EAYvC,IAAI,GAZmC;EAavC,IAAI,GAbmC;EAcvC,IAAI,IAdmC;EAevC,IAAI,IAfmC;EAgBvC,IAAI,IAhBmC;EAiBvC,IAAI,IAjBmC;EAkBvC,IAAI,KAlBmC;EAmBvC,IAAI,KAnBmC;EAoBvC,IAAI,KApBmC;EAqBvC,IAAI,KArBmC;EAsBvC,IAAI,KAtBmC;EAuBvC,GAAG,MAvBoC;EAwBvC,GAAG,MAxBoC;EAyBvC,GAAG,MAzBoC;EA0BvC,GAAG,MA1BoC;EA2BvC,GAAG,MA3BoC;EA4BvC,GAAG,OA5BoC;EA6BvC,GAAG,OA7BoC;EA8BvC,GAAG,OA9BoC;EA+BvC,GAAG;AA/BoC,CAAD,EAgCrC;EAAA,IAAC,CAACY,GAAD,EAAMC,KAAN,CAAD;EAAA,OAAkB,CAACD,GAAD,EAAM,IAAIb,SAAJ,CAAcc,KAAd,EAAqBC,KAArB,CAA2BR,mBAA3B,CAAN,CAAlB;AAAA,CAhCqC,CAAjC;AAkCP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,WAAYS,GAAZ;;WAAYA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;EAAAA,G,CAAAA,G;GAAAA,G,KAAAA,G"}
1
+ {"version":3,"file":"constants.mjs","names":["BigNumber","mapObject","MAX_AUTH_FUN_GAS","NAME_TTL","NAME_MAX_TTL","NAME_MAX_CLIENT_TTL","CLIENT_TTL","MIN_GAS_PRICE","NAME_FEE_MULTIPLIER","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUT_BLOCKS","NAME_MAX_LENGTH_FEE","NAME_BID_MAX_LENGTH","NAME_BID_RANGES","key","value","times","ConsensusProtocolVersion","VmVersion","AbiVersion","Tag"],"sources":["../../../src/tx/builder/constants.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { mapObject } from '../../utils/other';\n\nexport const MAX_AUTH_FUN_GAS = 50000;\nexport type Int = number | string | BigNumber;\n// # AENS\nexport type AensName = `${string}.chain`;\nexport const NAME_TTL = 180000;\n// # max number of block into the future that the name is going to be available\n// # https://github.com/aeternity/protocol/blob/epoch-v0.22.0/AENS.md#update\n// # https://github.com/aeternity/protocol/blob/44a93d3aab957ca820183c3520b9daf6b0fedff4/AENS.md#aens-entry\nexport const NAME_MAX_TTL = 36000;\nexport const NAME_MAX_CLIENT_TTL = 84600;\nexport const CLIENT_TTL = NAME_MAX_CLIENT_TTL;\nexport const MIN_GAS_PRICE = 1e9;\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L67\nexport const NAME_FEE_MULTIPLIER = 1e14; // 100000000000000\nexport const NAME_FEE_BID_INCREMENT = 0.05; // # the increment is in percentage\n// # see https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L272\nexport const NAME_BID_TIMEOUT_BLOCKS = 480; // # ~1 day\n// # this is the max length for a domain that requires a base fee to be paid\nexport const NAME_MAX_LENGTH_FEE = 31;\nexport const NAME_BID_MAX_LENGTH = 12; // # this is the max length for a domain to be part of a bid\n// # https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L290\n// # https://github.com/aeternity/protocol/blob/master/AENS.md#protocol-fees-and-protection-times\n// # bid ranges:\nexport const NAME_BID_RANGES = mapObject({\n 31: 3,\n 30: 5,\n 29: 8,\n 28: 13,\n 27: 21,\n 26: 34,\n 25: 55,\n 24: 89,\n 23: 144,\n 22: 233,\n 21: 377,\n 20: 610,\n 19: 987,\n 18: 1597,\n 17: 2584,\n 16: 4181,\n 15: 6765,\n 14: 10946,\n 13: 17711,\n 12: 28657,\n 11: 46368,\n 10: 75025,\n 9: 121393,\n 8: 196418,\n 7: 317811,\n 6: 514229,\n 5: 832040,\n 4: 1346269,\n 3: 2178309,\n 2: 3524578,\n 1: 5702887,\n}, ([key, value]) => [key, new BigNumber(value).times(NAME_FEE_MULTIPLIER)]);\n\nexport enum ConsensusProtocolVersion {\n Iris = 5,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum VmVersion {\n NoVm = 0,\n Sophia = 1,\n SophiaImprovementsMinerva = 3,\n SophiaImprovementsFortuna = 4,\n Fate = 5,\n SophiaImprovementsLima = 6,\n Fate2 = 7,\n}\n\n/**\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain}\n */\nexport enum AbiVersion {\n NoAbi = 0,\n Sophia = 1,\n Fate = 3,\n}\n\n/**\n * Enum with tag types\n * @category transaction builder\n * @see {@link https://github.com/aeternity/protocol/blob/0f6dee3d9d1e8e2469816798f5c7587a6c918f94/serializations.md#binary-serialization}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_chain_objects.erl#L39-L97}\n */\n// TODO: implement serialisation for commented-out tags\nexport enum Tag {\n Account = 10,\n SignedTx = 11,\n SpendTx = 12,\n Oracle = 20,\n // OracleQuery = 21,\n OracleRegisterTx = 22,\n OracleQueryTx = 23,\n OracleResponseTx = 24,\n OracleExtendTx = 25,\n Name = 30,\n // NameCommitment = 31,\n NameClaimTx = 32,\n NamePreclaimTx = 33,\n NameUpdateTx = 34,\n NameRevokeTx = 35,\n NameTransferTx = 36,\n // NameAuction = 37,\n Contract = 40,\n ContractCall = 41,\n ContractCreateTx = 42,\n ContractCallTx = 43,\n ChannelCreateTx = 50,\n // ChannelSetDelegatesTx = 501,\n ChannelDepositTx = 51,\n ChannelWithdrawTx = 52,\n ChannelForceProgressTx = 521,\n ChannelCloseMutualTx = 53,\n ChannelCloseSoloTx = 54,\n ChannelSlashTx = 55,\n ChannelSettleTx = 56,\n ChannelOffChainTx = 57,\n ChannelOffChainUpdateTransfer = 570,\n ChannelOffChainUpdateDeposit = 571,\n ChannelOffChainUpdateWithdraw = 572,\n ChannelOffChainUpdateCreateContract = 573,\n ChannelOffChainUpdateCallContract = 574,\n // ChannelOffChainUpdateMeta = 576,\n ChannelClientReconnectTx = 575,\n Channel = 58,\n ChannelSnapshotSoloTx = 59,\n TreesPoi = 60,\n // TreesDb = 61,\n StateTrees = 62,\n Mtree = 63,\n MtreeValue = 64,\n ContractsMtree = 621,\n CallsMtree = 622,\n ChannelsMtree = 623,\n NameserviceMtree = 624,\n OraclesMtree = 625,\n AccountsMtree = 626,\n // CompilerSophia = 70,\n GaAttachTx = 80,\n GaMetaTx = 81,\n PayingForTx = 82,\n // KeyBlock = 100,\n // MicroBlock = 101,\n // LightMicroBlock = 102,\n // Pof = 200,\n}\n"],"mappings":"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"}
@@ -0,0 +1,10 @@
1
+ /// <reference types="node" />
2
+ import { Tag, ConsensusProtocolVersion, AbiVersion } from '../constants';
3
+ declare const _default: {
4
+ serialize(value: AbiVersion | undefined, { tag, consensusProtocolVersion }: {
5
+ tag: Tag;
6
+ consensusProtocolVersion: ConsensusProtocolVersion;
7
+ }): Buffer;
8
+ deserialize(buffer: Buffer): AbiVersion;
9
+ };
10
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { Tag, ConsensusProtocolVersion } from "../constants.mjs";
6
+ import { getProtocolDetails } from "./ct-version.mjs";
7
+ export default {
8
+ serialize(value, _ref) {
9
+ let {
10
+ tag,
11
+ consensusProtocolVersion = ConsensusProtocolVersion.Iris
12
+ } = _ref;
13
+ const result = value !== null && value !== void 0 ? value : getProtocolDetails(consensusProtocolVersion, Tag.ContractCallTx === tag || Tag.GaMetaTx === tag ? 'contract-call' : 'oracle-call').abiVersion;
14
+ return _Buffer.from([result]);
15
+ },
16
+ deserialize(buffer) {
17
+ return buffer[0];
18
+ }
19
+ };
20
+ //# sourceMappingURL=abi-version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abi-version.mjs","names":["Tag","ConsensusProtocolVersion","getProtocolDetails","serialize","value","tag","consensusProtocolVersion","Iris","result","ContractCallTx","GaMetaTx","abiVersion","from","deserialize","buffer"],"sources":["../../../../src/tx/builder/field-types/abi-version.ts"],"sourcesContent":["import { Tag, ConsensusProtocolVersion, AbiVersion } from '../constants';\nimport { getProtocolDetails } from './ct-version';\n\nexport default {\n serialize(\n value: AbiVersion | undefined,\n { tag, consensusProtocolVersion = ConsensusProtocolVersion.Iris }:\n { tag: Tag; consensusProtocolVersion: ConsensusProtocolVersion },\n ): Buffer {\n const result = value ?? getProtocolDetails(\n consensusProtocolVersion,\n Tag.ContractCallTx === tag || Tag.GaMetaTx === tag ? 'contract-call' : 'oracle-call',\n ).abiVersion;\n\n return Buffer.from([result]);\n },\n\n deserialize(buffer: Buffer): AbiVersion {\n return buffer[0];\n },\n};\n"],"mappings":";;;;SAASA,GAAG,EAAEC,wBAAwB;AAAA,SAC7BC,kBAAkB;AAE3B,eAAe;EACbC,SAAS,CACPC,KAA6B,QAGrB;IAAA,IAFR;MAAEC,GAAG;MAAEC,wBAAwB,GAAGL,wBAAwB,CAACM;IACI,CAAC;IAEhE,MAAMC,MAAM,GAAGJ,KAAK,aAALA,KAAK,cAALA,KAAK,GAAIF,kBAAkB,CACxCI,wBAAwB,EACxBN,GAAG,CAACS,cAAc,KAAKJ,GAAG,IAAIL,GAAG,CAACU,QAAQ,KAAKL,GAAG,GAAG,eAAe,GAAG,aAAa,CACrF,CAACM,UAAU;IAEZ,OAAO,QAAOC,IAAI,CAAC,CAACJ,MAAM,CAAC,CAAC;EAC9B,CAAC;EAEDK,WAAW,CAACC,MAAc,EAAc;IACtC,OAAOA,MAAM,CAAC,CAAC,CAAC;EAClB;AACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import { Encoded } from '../../../utils/encoder';
3
+ /**
4
+ * Map of prefix to ID tag constant
5
+ * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
6
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
7
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
8
+ */
9
+ export declare const idTagToEncoding: readonly [Encoded.Encoding.AccountAddress, Encoded.Encoding.Name, Encoded.Encoding.Commitment, Encoded.Encoding.OracleAddress, Encoded.Encoding.ContractAddress, Encoded.Encoding.Channel];
10
+ export type AddressEncodings = typeof idTagToEncoding[number];
11
+ export default function genAddressField<Encoding extends AddressEncodings>(...encodings: Encoding[]): {
12
+ serialize: (value: Encoded.Generic<Encoding>) => Buffer;
13
+ deserialize: (value: Buffer) => Encoded.Generic<Encoding>;
14
+ };
@@ -0,0 +1,51 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { ArgumentError, PrefixNotFoundError, TagNotFoundError } from "../../../utils/errors.mjs";
6
+ import { toBytes } from "../../../utils/bytes.mjs";
7
+ import { decode, encode, Encoding } from "../../../utils/encoder.mjs";
8
+ import { isItemOfArray } from "../../../utils/other.mjs";
9
+ /**
10
+ * Map of prefix to ID tag constant
11
+ * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}
12
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}
13
+ * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}
14
+ */
15
+ export const idTagToEncoding = [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
16
+ export default function genAddressField() {
17
+ for (var _len = arguments.length, encodings = new Array(_len), _key = 0; _key < _len; _key++) {
18
+ encodings[_key] = arguments[_key];
19
+ }
20
+ return {
21
+ /**
22
+ * Utility function to create and _id type
23
+ * @param hashId - Encoded hash
24
+ * @returns Buffer Buffer with ID tag and decoded HASh
25
+ */
26
+ serialize(hashId) {
27
+ const enc = hashId.slice(0, 2);
28
+ if (!isItemOfArray(enc, idTagToEncoding)) throw new TagNotFoundError(enc);
29
+ if (!isItemOfArray(enc, encodings)) {
30
+ throw new ArgumentError('Address encoding', encodings.join(', '), enc);
31
+ }
32
+ const idTag = idTagToEncoding.indexOf(enc) + 1;
33
+ return _Buffer.from([...toBytes(idTag), ...decode(hashId)]);
34
+ },
35
+ /**
36
+ * Utility function to read and _id type
37
+ * @param buf - Data
38
+ * @returns Encoded hash string with prefix
39
+ */
40
+ deserialize(buf) {
41
+ const idTag = _Buffer.from(buf).readUIntBE(0, 1);
42
+ const enc = idTagToEncoding[idTag - 1];
43
+ if (enc == null) throw new PrefixNotFoundError(idTag);
44
+ if (!isItemOfArray(enc, encodings)) {
45
+ throw new ArgumentError('Address encoding', encodings.join(', '), enc);
46
+ }
47
+ return encode(buf.subarray(1), enc);
48
+ }
49
+ };
50
+ }
51
+ //# sourceMappingURL=address.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.mjs","names":["ArgumentError","PrefixNotFoundError","TagNotFoundError","toBytes","decode","encode","Encoding","isItemOfArray","idTagToEncoding","AccountAddress","Name","Commitment","OracleAddress","ContractAddress","Channel","genAddressField","encodings","serialize","hashId","enc","slice","join","idTag","indexOf","from","deserialize","buf","readUIntBE","subarray"],"sources":["../../../../src/tx/builder/field-types/address.ts"],"sourcesContent":["import { ArgumentError, PrefixNotFoundError, TagNotFoundError } from '../../../utils/errors';\nimport { toBytes } from '../../../utils/bytes';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport { isItemOfArray } from '../../../utils/other';\n\n/**\n * Map of prefix to ID tag constant\n * @see {@link https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_id.erl#L97-L102}\n * @see {@link https://github.com/aeternity/aeserialization/blob/eb68fe331bd476910394966b7f5ede7a74d37e35/src/aeser_api_encoder.erl#L163-L168}\n */\nexport const idTagToEncoding = [\n Encoding.AccountAddress,\n Encoding.Name,\n Encoding.Commitment,\n Encoding.OracleAddress,\n Encoding.ContractAddress,\n Encoding.Channel,\n] as const;\n\nexport type AddressEncodings = typeof idTagToEncoding[number];\n\nexport default function genAddressField<Encoding extends AddressEncodings>(\n ...encodings: Encoding[]\n): {\n serialize: (value: Encoded.Generic<Encoding>) => Buffer;\n deserialize: (value: Buffer) => Encoded.Generic<Encoding>;\n } {\n return {\n /**\n * Utility function to create and _id type\n * @param hashId - Encoded hash\n * @returns Buffer Buffer with ID tag and decoded HASh\n */\n serialize(hashId) {\n const enc = hashId.slice(0, 2);\n if (!isItemOfArray(enc, idTagToEncoding)) throw new TagNotFoundError(enc);\n if (!isItemOfArray(enc, encodings)) {\n throw new ArgumentError('Address encoding', encodings.join(', '), enc);\n }\n const idTag = idTagToEncoding.indexOf(enc) + 1;\n return Buffer.from([...toBytes(idTag), ...decode(hashId)]);\n },\n\n /**\n * Utility function to read and _id type\n * @param buf - Data\n * @returns Encoded hash string with prefix\n */\n deserialize(buf) {\n const idTag = Buffer.from(buf).readUIntBE(0, 1);\n const enc = idTagToEncoding[idTag - 1];\n if (enc == null) throw new PrefixNotFoundError(idTag);\n if (!isItemOfArray(enc, encodings)) {\n throw new ArgumentError('Address encoding', encodings.join(', '), enc);\n }\n return encode(buf.subarray(1), enc) as Encoded.Generic<Encoding>;\n },\n };\n}\n"],"mappings":";;;;SAASA,aAAa,EAAEC,mBAAmB,EAAEC,gBAAgB;AAAA,SACpDC,OAAO;AAAA,SAEdC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,aAAa;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG,CAC7BF,QAAQ,CAACG,cAAc,EACvBH,QAAQ,CAACI,IAAI,EACbJ,QAAQ,CAACK,UAAU,EACnBL,QAAQ,CAACM,aAAa,EACtBN,QAAQ,CAACO,eAAe,EACxBP,QAAQ,CAACQ,OAAO,CACR;AAIV,eAAe,SAASC,eAAe,GAKnC;EAAA,kCAJCC,SAAS;IAATA,SAAS;EAAA;EAKZ,OAAO;IACL;AACJ;AACA;AACA;AACA;IACIC,SAAS,CAACC,MAAM,EAAE;MAChB,MAAMC,GAAG,GAAGD,MAAM,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;MAC9B,IAAI,CAACb,aAAa,CAACY,GAAG,EAAEX,eAAe,CAAC,EAAE,MAAM,IAAIN,gBAAgB,CAACiB,GAAG,CAAC;MACzE,IAAI,CAACZ,aAAa,CAACY,GAAG,EAAEH,SAAS,CAAC,EAAE;QAClC,MAAM,IAAIhB,aAAa,CAAC,kBAAkB,EAAEgB,SAAS,CAACK,IAAI,CAAC,IAAI,CAAC,EAAEF,GAAG,CAAC;MACxE;MACA,MAAMG,KAAK,GAAGd,eAAe,CAACe,OAAO,CAACJ,GAAG,CAAC,GAAG,CAAC;MAC9C,OAAO,QAAOK,IAAI,CAAC,CAAC,GAAGrB,OAAO,CAACmB,KAAK,CAAC,EAAE,GAAGlB,MAAM,CAACc,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIO,WAAW,CAACC,GAAG,EAAE;MACf,MAAMJ,KAAK,GAAG,QAAOE,IAAI,CAACE,GAAG,CAAC,CAACC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;MAC/C,MAAMR,GAAG,GAAGX,eAAe,CAACc,KAAK,GAAG,CAAC,CAAC;MACtC,IAAIH,GAAG,IAAI,IAAI,EAAE,MAAM,IAAIlB,mBAAmB,CAACqB,KAAK,CAAC;MACrD,IAAI,CAACf,aAAa,CAACY,GAAG,EAAEH,SAAS,CAAC,EAAE;QAClC,MAAM,IAAIhB,aAAa,CAAC,kBAAkB,EAAEgB,SAAS,CAACK,IAAI,CAAC,IAAI,CAAC,EAAEF,GAAG,CAAC;MACxE;MACA,OAAOd,MAAM,CAACqB,GAAG,CAACE,QAAQ,CAAC,CAAC,CAAC,EAAET,GAAG,CAAC;IACrC;EACF,CAAC;AACH"}
@@ -0,0 +1,7 @@
1
+ export default function genArrayField<Input, Output, Binary>(itemHandler: {
2
+ serialize: (value: Input, params: unknown) => Binary;
3
+ deserialize: (value: Binary, params: unknown) => Output;
4
+ }): {
5
+ serialize: (value: Input[], params: unknown) => Binary[];
6
+ deserialize: (value: Binary[], params: unknown) => Output[];
7
+ };
@@ -0,0 +1,11 @@
1
+ export default function genArrayField(itemHandler) {
2
+ return {
3
+ serialize(items, params) {
4
+ return items.map(item => itemHandler.serialize(item, params));
5
+ },
6
+ deserialize(buffers, params) {
7
+ return buffers.map(buffer => itemHandler.deserialize(buffer, params));
8
+ }
9
+ };
10
+ }
11
+ //# sourceMappingURL=array.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"array.mjs","names":["genArrayField","itemHandler","serialize","items","params","map","item","deserialize","buffers","buffer"],"sources":["../../../../src/tx/builder/field-types/array.ts"],"sourcesContent":["export default function genArrayField<Input, Output, Binary>(\n itemHandler: {\n serialize: (value: Input, params: unknown) => Binary;\n deserialize: (value: Binary, params: unknown) => Output;\n },\n): {\n serialize: (value: Input[], params: unknown) => Binary[];\n deserialize: (value: Binary[], params: unknown) => Output[];\n } {\n return {\n serialize(items, params) {\n return items.map((item) => itemHandler.serialize(item, params));\n },\n\n deserialize(buffers, params) {\n return buffers.map((buffer) => itemHandler.deserialize(buffer, params));\n },\n };\n}\n"],"mappings":"AAAA,eAAe,SAASA,aAAa,CACnCC,WAGC,EAIC;EACF,OAAO;IACLC,SAAS,CAACC,KAAK,EAAEC,MAAM,EAAE;MACvB,OAAOD,KAAK,CAACE,GAAG,CAAEC,IAAI,IAAKL,WAAW,CAACC,SAAS,CAACI,IAAI,EAAEF,MAAM,CAAC,CAAC;IACjE,CAAC;IAEDG,WAAW,CAACC,OAAO,EAAEJ,MAAM,EAAE;MAC3B,OAAOI,OAAO,CAACH,GAAG,CAAEI,MAAM,IAAKR,WAAW,CAACM,WAAW,CAACE,MAAM,EAAEL,MAAM,CAAC,CAAC;IACzE;EACF,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ declare const _default: {
3
+ serialize(value: boolean): Buffer;
4
+ deserialize(buffer: Buffer): boolean;
5
+ };
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ export default {
6
+ serialize(value) {
7
+ return _Buffer.from([value ? 1 : 0]);
8
+ },
9
+ deserialize(buffer) {
10
+ return buffer[0] === 1;
11
+ }
12
+ };
13
+ //# sourceMappingURL=boolean.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boolean.mjs","names":["serialize","value","from","deserialize","buffer"],"sources":["../../../../src/tx/builder/field-types/boolean.ts"],"sourcesContent":["export default {\n serialize(value: boolean): Buffer {\n return Buffer.from([value ? 1 : 0]);\n },\n\n deserialize(buffer: Buffer): boolean {\n return buffer[0] === 1;\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,KAAc,EAAU;IAChC,OAAO,QAAOC,IAAI,CAAC,CAACD,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;EACrC,CAAC;EAEDE,WAAW,CAACC,MAAc,EAAW;IACnC,OAAOA,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;EACxB;AACF,CAAC"}
@@ -1,13 +1,12 @@
1
1
  /// <reference types="node" />
2
- import { Int } from './u-int';
2
+ import { Int } from '../constants';
3
3
  import { AE_AMOUNT_FORMATS } from '../../../utils/amount-formatter';
4
4
  export interface Options {
5
5
  denomination?: AE_AMOUNT_FORMATS;
6
6
  }
7
7
  declare const _default: {
8
8
  serializeAettos(value: string | undefined): string;
9
- serializeOptional(value: Int | undefined, { denomination, ...options }: Options): Buffer;
10
- serialize(value: Int, options: Options): Buffer;
9
+ serialize(value: Int | undefined, { denomination, ...options }: Options): Buffer;
11
10
  deserialize(value: Buffer): string;
12
11
  };
13
12
  export default _default;
@@ -1,14 +1,11 @@
1
1
  import uInt from "./u-int.mjs";
2
2
  import { formatAmount } from "../../../utils/amount-formatter.mjs";
3
- import { ArgumentError } from "../../../utils/errors.mjs";
4
- export default { ...uInt,
5
-
3
+ export default {
4
+ ...uInt,
6
5
  serializeAettos(value) {
7
- if (value == null) throw new ArgumentError('value', 'provided', value);
8
- return value;
6
+ return value !== null && value !== void 0 ? value : '0';
9
7
  },
10
-
11
- serializeOptional(value, _ref) {
8
+ serialize(value, _ref) {
12
9
  let {
13
10
  denomination,
14
11
  ...options
@@ -16,11 +13,6 @@ export default { ...uInt,
16
13
  return uInt.serialize(this.serializeAettos(value != null ? formatAmount(value, {
17
14
  denomination
18
15
  }) : value, options));
19
- },
20
-
21
- serialize(value, options) {
22
- return this.serializeOptional(value, options);
23
16
  }
24
-
25
17
  };
26
18
  //# sourceMappingURL=coin-amount.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","ArgumentError","serializeAettos","value","serializeOptional","denomination","options","serialize"],"sources":["../../../../src/tx/builder/field-types/coin-amount.ts"],"sourcesContent":["import uInt, { Int } from './u-int';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\nimport { ArgumentError } from '../../../utils/errors';\n\nexport interface Options { denomination?: AE_AMOUNT_FORMATS }\n\nexport default {\n ...uInt,\n\n serializeAettos(value: string | undefined): string {\n if (value == null) throw new ArgumentError('value', 'provided', value);\n return value;\n },\n\n serializeOptional(value: Int | undefined, { denomination, ...options }: Options): Buffer {\n return uInt.serialize(\n this.serializeAettos(\n value != null ? formatAmount(value, { denomination }) : value,\n options,\n ),\n );\n },\n\n serialize(value: Int, options: Options): Buffer {\n return this.serializeOptional(value, options);\n },\n};\n"],"mappings":"OAAOA,I;SACqBC,Y;SACnBC,a;AAIT,eAAe,EACb,GAAGF,IADU;;EAGbG,eAAe,CAACC,KAAD,EAAoC;IACjD,IAAIA,KAAK,IAAI,IAAb,EAAmB,MAAM,IAAIF,aAAJ,CAAkB,OAAlB,EAA2B,UAA3B,EAAuCE,KAAvC,CAAN;IACnB,OAAOA,KAAP;EACD,CANY;;EAQbC,iBAAiB,CAACD,KAAD,QAAwE;IAAA,IAA/C;MAAEE,YAAF;MAAgB,GAAGC;IAAnB,CAA+C;IACvF,OAAOP,IAAI,CAACQ,SAAL,CACL,KAAKL,eAAL,CACEC,KAAK,IAAI,IAAT,GAAgBH,YAAY,CAACG,KAAD,EAAQ;MAAEE;IAAF,CAAR,CAA5B,GAAwDF,KAD1D,EAEEG,OAFF,CADK,CAAP;EAMD,CAfY;;EAiBbC,SAAS,CAACJ,KAAD,EAAaG,OAAb,EAAuC;IAC9C,OAAO,KAAKF,iBAAL,CAAuBD,KAAvB,EAA8BG,OAA9B,CAAP;EACD;;AAnBY,CAAf"}
1
+ {"version":3,"file":"coin-amount.mjs","names":["uInt","formatAmount","serializeAettos","value","serialize","denomination","options"],"sources":["../../../../src/tx/builder/field-types/coin-amount.ts"],"sourcesContent":["import uInt from './u-int';\nimport { Int } from '../constants';\nimport { AE_AMOUNT_FORMATS, formatAmount } from '../../../utils/amount-formatter';\n\nexport interface Options { denomination?: AE_AMOUNT_FORMATS }\n\nexport default {\n ...uInt,\n\n serializeAettos(value: string | undefined): string {\n return value ?? '0';\n },\n\n serialize(value: Int | undefined, { denomination, ...options }: Options): Buffer {\n return uInt.serialize(\n this.serializeAettos(\n value != null ? formatAmount(value, { denomination }) : value,\n options,\n ),\n );\n },\n};\n"],"mappings":"OAAOA,IAAI;AAAA,SAEiBC,YAAY;AAIxC,eAAe;EACb,GAAGD,IAAI;EAEPE,eAAe,CAACC,KAAyB,EAAU;IACjD,OAAOA,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,GAAG;EACrB,CAAC;EAEDC,SAAS,CAACD,KAAsB,QAAiD;IAAA,IAA/C;MAAEE,YAAY;MAAE,GAAGC;IAAiB,CAAC;IACrE,OAAON,IAAI,CAACI,SAAS,CACnB,IAAI,CAACF,eAAe,CAClBC,KAAK,IAAI,IAAI,GAAGF,YAAY,CAACE,KAAK,EAAE;MAAEE;IAAa,CAAC,CAAC,GAAGF,KAAK,EAC7DG,OAAO,CACR,CACF;EACH;AACF,CAAC"}
@@ -0,0 +1,30 @@
1
+ /// <reference types="node" />
2
+ import { ConsensusProtocolVersion, VmVersion, AbiVersion } from '../constants';
3
+ export declare const ProtocolToVmAbi: {
4
+ readonly 5: {
5
+ readonly 'contract-create': {
6
+ readonly vmVersion: readonly [VmVersion.Fate2];
7
+ readonly abiVersion: readonly [AbiVersion.Fate];
8
+ };
9
+ readonly 'contract-call': {
10
+ readonly vmVersion: readonly [];
11
+ readonly abiVersion: readonly [AbiVersion.Fate, AbiVersion.Sophia];
12
+ };
13
+ readonly 'oracle-call': {
14
+ readonly vmVersion: readonly [];
15
+ readonly abiVersion: readonly [AbiVersion.NoAbi, AbiVersion.Sophia];
16
+ };
17
+ };
18
+ };
19
+ export interface CtVersion {
20
+ vmVersion: VmVersion;
21
+ abiVersion: AbiVersion;
22
+ }
23
+ export declare function getProtocolDetails(protocolVersion: ConsensusProtocolVersion, type: 'contract-create' | 'contract-call' | 'oracle-call'): CtVersion;
24
+ declare const _default: {
25
+ serialize(value: CtVersion | undefined, { consensusProtocolVersion }: {
26
+ consensusProtocolVersion: ConsensusProtocolVersion;
27
+ }): Buffer;
28
+ deserialize(buffer: Buffer): CtVersion;
29
+ };
30
+ export default _default;
@@ -0,0 +1,48 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { ConsensusProtocolVersion, VmVersion, AbiVersion } from "../constants.mjs"; // First abi/vm by default
6
+ export const ProtocolToVmAbi = {
7
+ [ConsensusProtocolVersion.Iris]: {
8
+ 'contract-create': {
9
+ vmVersion: [VmVersion.Fate2],
10
+ abiVersion: [AbiVersion.Fate]
11
+ },
12
+ // TODO: Ensure that AEVM (Sophia?) is still available here
13
+ 'contract-call': {
14
+ vmVersion: [],
15
+ abiVersion: [AbiVersion.Fate, AbiVersion.Sophia]
16
+ },
17
+ 'oracle-call': {
18
+ vmVersion: [],
19
+ abiVersion: [AbiVersion.NoAbi, AbiVersion.Sophia]
20
+ }
21
+ }
22
+ };
23
+ export function getProtocolDetails(protocolVersion, type) {
24
+ var _protocol$vmVersion$;
25
+ const protocol = ProtocolToVmAbi[protocolVersion][type];
26
+ return {
27
+ vmVersion: (_protocol$vmVersion$ = protocol.vmVersion[0]) !== null && _protocol$vmVersion$ !== void 0 ? _protocol$vmVersion$ : VmVersion.Fate2,
28
+ abiVersion: protocol.abiVersion[0]
29
+ };
30
+ }
31
+ export default {
32
+ serialize(value, _ref) {
33
+ var _value;
34
+ let {
35
+ consensusProtocolVersion = ConsensusProtocolVersion.Iris
36
+ } = _ref;
37
+ (_value = value) !== null && _value !== void 0 ? _value : value = getProtocolDetails(consensusProtocolVersion, 'contract-create');
38
+ return _Buffer.from([value.vmVersion, 0, value.abiVersion]);
39
+ },
40
+ deserialize(buffer) {
41
+ const [vm,, abi] = buffer;
42
+ return {
43
+ vmVersion: +vm,
44
+ abiVersion: +abi
45
+ };
46
+ }
47
+ };
48
+ //# sourceMappingURL=ct-version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ct-version.mjs","names":["ConsensusProtocolVersion","VmVersion","AbiVersion","ProtocolToVmAbi","Iris","vmVersion","Fate2","abiVersion","Fate","Sophia","NoAbi","getProtocolDetails","protocolVersion","type","protocol","serialize","value","consensusProtocolVersion","from","deserialize","buffer","vm","abi"],"sources":["../../../../src/tx/builder/field-types/ct-version.ts"],"sourcesContent":["import { ConsensusProtocolVersion, VmVersion, AbiVersion } from '../constants';\n\n// First abi/vm by default\nexport const ProtocolToVmAbi = {\n [ConsensusProtocolVersion.Iris]: {\n 'contract-create': {\n vmVersion: [VmVersion.Fate2], abiVersion: [AbiVersion.Fate],\n },\n // TODO: Ensure that AEVM (Sophia?) is still available here\n 'contract-call': {\n vmVersion: [], abiVersion: [AbiVersion.Fate, AbiVersion.Sophia],\n },\n 'oracle-call': {\n vmVersion: [], abiVersion: [AbiVersion.NoAbi, AbiVersion.Sophia],\n },\n },\n} as const;\n\nexport interface CtVersion {\n vmVersion: VmVersion;\n abiVersion: AbiVersion;\n}\n\nexport function getProtocolDetails(\n protocolVersion: ConsensusProtocolVersion,\n type: 'contract-create' | 'contract-call' | 'oracle-call',\n): CtVersion {\n const protocol = ProtocolToVmAbi[protocolVersion][type];\n return {\n vmVersion: protocol.vmVersion[0] ?? VmVersion.Fate2,\n abiVersion: protocol.abiVersion[0],\n };\n}\n\nexport default {\n serialize(\n value: CtVersion | undefined,\n { consensusProtocolVersion = ConsensusProtocolVersion.Iris }:\n { consensusProtocolVersion: ConsensusProtocolVersion },\n ): Buffer {\n value ??= getProtocolDetails(consensusProtocolVersion, 'contract-create');\n\n return Buffer.from([value.vmVersion, 0, value.abiVersion]);\n },\n\n deserialize(buffer: Buffer): CtVersion {\n const [vm, , abi] = buffer;\n return { vmVersion: +vm, abiVersion: +abi };\n },\n};\n"],"mappings":";;;;SAASA,wBAAwB,EAAEC,SAAS,EAAEC,UAAU,4BAExD;AACA,OAAO,MAAMC,eAAe,GAAG;EAC7B,CAACH,wBAAwB,CAACI,IAAI,GAAG;IAC/B,iBAAiB,EAAE;MACjBC,SAAS,EAAE,CAACJ,SAAS,CAACK,KAAK,CAAC;MAAEC,UAAU,EAAE,CAACL,UAAU,CAACM,IAAI;IAC5D,CAAC;IACD;IACA,eAAe,EAAE;MACfH,SAAS,EAAE,EAAE;MAAEE,UAAU,EAAE,CAACL,UAAU,CAACM,IAAI,EAAEN,UAAU,CAACO,MAAM;IAChE,CAAC;IACD,aAAa,EAAE;MACbJ,SAAS,EAAE,EAAE;MAAEE,UAAU,EAAE,CAACL,UAAU,CAACQ,KAAK,EAAER,UAAU,CAACO,MAAM;IACjE;EACF;AACF,CAAU;AAOV,OAAO,SAASE,kBAAkB,CAChCC,eAAyC,EACzCC,IAAyD,EAC9C;EAAA;EACX,MAAMC,QAAQ,GAAGX,eAAe,CAACS,eAAe,CAAC,CAACC,IAAI,CAAC;EACvD,OAAO;IACLR,SAAS,0BAAES,QAAQ,CAACT,SAAS,CAAC,CAAC,CAAC,uEAAIJ,SAAS,CAACK,KAAK;IACnDC,UAAU,EAAEO,QAAQ,CAACP,UAAU,CAAC,CAAC;EACnC,CAAC;AACH;AAEA,eAAe;EACbQ,SAAS,CACPC,KAA4B,QAGpB;IAAA;IAAA,IAFR;MAAEC,wBAAwB,GAAGjB,wBAAwB,CAACI;IACD,CAAC;IAEtD,UAAAY,KAAK,2CAALA,KAAK,GAAKL,kBAAkB,CAACM,wBAAwB,EAAE,iBAAiB,CAAC;IAEzE,OAAO,QAAOC,IAAI,CAAC,CAACF,KAAK,CAACX,SAAS,EAAE,CAAC,EAAEW,KAAK,CAACT,UAAU,CAAC,CAAC;EAC5D,CAAC;EAEDY,WAAW,CAACC,MAAc,EAAa;IACrC,MAAM,CAACC,EAAE,GAAIC,GAAG,CAAC,GAAGF,MAAM;IAC1B,OAAO;MAAEf,SAAS,EAAE,CAACgB,EAAE;MAAEd,UAAU,EAAE,CAACe;IAAI,CAAC;EAC7C;AACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import coinAmount from './coin-amount';
3
- import { Int } from './u-int';
3
+ import { Int } from '../constants';
4
4
  declare const _default: {
5
5
  /**
6
6
  * @param value - Deposit value in string format. Should be equal to '0'.
@@ -9,7 +9,6 @@ declare const _default: {
9
9
  */
10
10
  serialize(value: Int | undefined, options: Parameters<(typeof coinAmount)['serialize']>[1]): Buffer;
11
11
  serializeAettos(value: string | undefined): string;
12
- serializeOptional(value: Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
13
12
  deserialize(value: Buffer): string;
14
13
  };
15
14
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import coinAmount from "./coin-amount.mjs";
2
2
  import { IllegalArgumentError } from "../../../utils/errors.mjs";
3
- export default { ...coinAmount,
4
-
3
+ export default {
4
+ ...coinAmount,
5
5
  /**
6
6
  * @param value - Deposit value in string format. Should be equal to '0'.
7
7
  * @param options - Options
@@ -9,11 +9,9 @@ export default { ...coinAmount,
9
9
  */
10
10
  serialize(value, options) {
11
11
  var _value;
12
-
13
12
  (_value = value) !== null && _value !== void 0 ? _value : value = 0;
14
13
  if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);
15
14
  return coinAmount.serialize(value, options);
16
15
  }
17
-
18
16
  };
19
17
  //# sourceMappingURL=deposit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from './u-int';\nimport { IllegalArgumentError } from '../../../utils/errors';\n\nexport default {\n ...coinAmount,\n\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @param options - Options\n * @returns Deposit value Buffer.\n */\n serialize(\n value: Int | undefined,\n options: Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n value ??= 0;\n if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);\n return coinAmount.serialize(value, options);\n },\n};\n"],"mappings":"OAAOA,U;SAEEC,oB;AAET,eAAe,EACb,GAAGD,UADU;;EAGb;AACF;AACA;AACA;AACA;EACEE,SAAS,CACPC,KADO,EAEPC,OAFO,EAGC;IAAA;;IACR,UAAAD,KAAK,UAAL,iCAAAA,KAAK,GAAK,CAAV;IACA,IAAI,CAACA,KAAD,KAAW,CAAf,EAAkB,MAAM,IAAIF,oBAAJ,CAA0B,oEAAmEE,KAAK,CAACE,QAAN,EAAiB,UAA9G,CAAN;IAClB,OAAOL,UAAU,CAACE,SAAX,CAAqBC,KAArB,EAA4BC,OAA5B,CAAP;EACD;;AAfY,CAAf"}
1
+ {"version":3,"file":"deposit.mjs","names":["coinAmount","IllegalArgumentError","serialize","value","options","toString"],"sources":["../../../../src/tx/builder/field-types/deposit.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { Int } from '../constants';\nimport { IllegalArgumentError } from '../../../utils/errors';\n\nexport default {\n ...coinAmount,\n\n /**\n * @param value - Deposit value in string format. Should be equal to '0'.\n * @param options - Options\n * @returns Deposit value Buffer.\n */\n serialize(\n value: Int | undefined,\n options: Parameters<typeof coinAmount['serialize']>[1],\n ): Buffer {\n value ??= 0;\n if (+value !== 0) throw new IllegalArgumentError(`Contract deposit is not refundable, so it should be equal 0, got ${value.toString()} instead`);\n return coinAmount.serialize(value, options);\n },\n};\n"],"mappings":"OAAOA,UAAU;AAAA,SAERC,oBAAoB;AAE7B,eAAe;EACb,GAAGD,UAAU;EAEb;AACF;AACA;AACA;AACA;EACEE,SAAS,CACPC,KAAsB,EACtBC,OAAsD,EAC9C;IAAA;IACR,UAAAD,KAAK,2CAALA,KAAK,GAAK,CAAC;IACX,IAAI,CAACA,KAAK,KAAK,CAAC,EAAE,MAAM,IAAIF,oBAAoB,CAAE,oEAAmEE,KAAK,CAACE,QAAQ,EAAG,UAAS,CAAC;IAChJ,OAAOL,UAAU,CAACE,SAAS,CAACC,KAAK,EAAEC,OAAO,CAAC;EAC7C;AACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ import { Encoded, Encoding } from '../../../utils/encoder';
3
+ export default function genEncodedField<E extends Encoding, Optional extends boolean = false>(encoding: E, optional?: Optional): {
4
+ serialize: Optional extends true ? (value?: Encoded.Generic<E>) => Buffer : (value: Encoded.Generic<E>) => Buffer;
5
+ deserialize: (value: Buffer) => Encoded.Generic<Encoding>;
6
+ };
@@ -0,0 +1,21 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { decode, encode } from "../../../utils/encoder.mjs";
6
+ import { ArgumentError } from "../../../utils/errors.mjs";
7
+ export default function genEncodedField(encoding, optional) {
8
+ return {
9
+ serialize(encodedData) {
10
+ if (encodedData == null) {
11
+ if (optional === true) return _Buffer.from([]);
12
+ throw new ArgumentError('Encoded data', 'provided', encodedData);
13
+ }
14
+ return decode(encodedData);
15
+ },
16
+ deserialize(buffer) {
17
+ return encode(buffer, encoding);
18
+ }
19
+ };
20
+ }
21
+ //# sourceMappingURL=encoded.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoded.mjs","names":["decode","encode","ArgumentError","genEncodedField","encoding","optional","serialize","encodedData","from","deserialize","buffer"],"sources":["../../../../src/tx/builder/field-types/encoded.ts"],"sourcesContent":["import {\n decode, encode, Encoded, Encoding,\n} from '../../../utils/encoder';\nimport { ArgumentError } from '../../../utils/errors';\n\nexport default function genEncodedField<E extends Encoding, Optional extends boolean = false>(\n encoding: E,\n optional?: Optional,\n): {\n serialize: Optional extends true\n ? (value?: Encoded.Generic<E>) => Buffer : (value: Encoded.Generic<E>) => Buffer;\n deserialize: (value: Buffer) => Encoded.Generic<Encoding>;\n } {\n return {\n serialize(encodedData?: Encoded.Generic<E>) {\n if (encodedData == null) {\n if (optional === true) return Buffer.from([]);\n throw new ArgumentError('Encoded data', 'provided', encodedData);\n }\n return decode(encodedData);\n },\n\n deserialize(buffer) {\n return encode(buffer, encoding);\n },\n };\n}\n"],"mappings":";;;;SACEA,MAAM,EAAEC,MAAM;AAAA,SAEPC,aAAa;AAEtB,eAAe,SAASC,eAAe,CACrCC,QAAW,EACXC,QAAmB,EAKjB;EACF,OAAO;IACLC,SAAS,CAACC,WAAgC,EAAE;MAC1C,IAAIA,WAAW,IAAI,IAAI,EAAE;QACvB,IAAIF,QAAQ,KAAK,IAAI,EAAE,OAAO,QAAOG,IAAI,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAIN,aAAa,CAAC,cAAc,EAAE,UAAU,EAAEK,WAAW,CAAC;MAClE;MACA,OAAOP,MAAM,CAACO,WAAW,CAAC;IAC5B,CAAC;IAEDE,WAAW,CAACC,MAAM,EAAE;MAClB,OAAOT,MAAM,CAACS,MAAM,EAAEN,QAAQ,CAAC;IACjC;EACF,CAAC;AACH"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="node" />
2
+ import { Tag } from '../constants';
3
+ import type { unpackTx as unpackTxType, buildTx as buildTxType } from '../index';
4
+ export default function genEntryField<T extends Tag = Tag>(tag?: T): {
5
+ serialize: (value: any, options: {
6
+ buildTx: typeof buildTxType;
7
+ }) => Buffer;
8
+ deserialize: (value: Buffer, options: {
9
+ unpackTx: typeof unpackTxType;
10
+ }) => any;
11
+ };
@@ -0,0 +1,31 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { decode, encode, Encoding } from "../../../utils/encoder.mjs";
6
+ import { ArgumentError } from "../../../utils/errors.mjs";
7
+ export default function genEntryField(tag) {
8
+ return {
9
+ serialize(txParams, _ref) {
10
+ let {
11
+ buildTx
12
+ } = _ref;
13
+ if (ArrayBuffer.isView(txParams)) return _Buffer.from(txParams);
14
+ return decode(buildTx({
15
+ ...txParams,
16
+ ...(tag != null && {
17
+ tag
18
+ })
19
+ }));
20
+ },
21
+ deserialize(buf, _ref2) {
22
+ let {
23
+ unpackTx
24
+ } = _ref2;
25
+ const tx = unpackTx(encode(buf, Encoding.Transaction));
26
+ if (tag != null && tx.tag !== tag) throw new ArgumentError('Tag', tag, tx.tag);
27
+ return tx;
28
+ }
29
+ };
30
+ }
31
+ //# sourceMappingURL=entry.mjs.map