@aeternity/aepp-sdk 12.1.2 → 13.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (475) hide show
  1. package/dist/aepp-sdk.browser-script.js +1 -1
  2. package/dist/aepp-sdk.browser-script.js.map +1 -1
  3. package/dist/aepp-sdk.browser.js +1 -1
  4. package/dist/aepp-sdk.browser.js.map +1 -1
  5. package/dist/aepp-sdk.js +6580 -8860
  6. package/dist/aepp-sdk.js.map +1 -1
  7. package/es/AeSdk.d.ts +7 -3
  8. package/es/AeSdk.mjs +17 -22
  9. package/es/AeSdk.mjs.map +1 -1
  10. package/es/AeSdkAepp.d.ts +6 -5
  11. package/es/AeSdkAepp.mjs +7 -30
  12. package/es/AeSdkAepp.mjs.map +1 -1
  13. package/es/AeSdkBase.d.ts +18 -140
  14. package/es/AeSdkBase.mjs +27 -185
  15. package/es/AeSdkBase.mjs.map +1 -1
  16. package/es/AeSdkMethods.d.ts +124 -0
  17. package/es/AeSdkMethods.mjs +122 -0
  18. package/es/AeSdkMethods.mjs.map +1 -0
  19. package/es/AeSdkWallet.d.ts +7 -21
  20. package/es/AeSdkWallet.mjs +38 -86
  21. package/es/AeSdkWallet.mjs.map +1 -1
  22. package/es/Node.d.ts +7 -12
  23. package/es/Node.mjs +34 -47
  24. package/es/Node.mjs.map +1 -1
  25. package/es/account/Base.d.ts +24 -40
  26. package/es/account/Base.mjs +1 -101
  27. package/es/account/Base.mjs.map +1 -1
  28. package/es/account/Generalized.d.ts +16 -0
  29. package/es/account/Generalized.mjs +111 -0
  30. package/es/account/Generalized.mjs.map +1 -0
  31. package/es/account/Ledger.d.ts +28 -0
  32. package/es/account/Ledger.mjs +101 -0
  33. package/es/account/Ledger.mjs.map +1 -0
  34. package/es/account/LedgerFactory.d.ts +39 -0
  35. package/es/account/LedgerFactory.mjs +81 -0
  36. package/es/account/LedgerFactory.mjs.map +1 -0
  37. package/es/account/Memory.d.ts +13 -17
  38. package/es/account/Memory.mjs +43 -65
  39. package/es/account/Memory.mjs.map +1 -1
  40. package/es/account/Rpc.d.ts +6 -8
  41. package/es/account/Rpc.mjs +14 -32
  42. package/es/account/Rpc.mjs.map +1 -1
  43. package/es/aens.d.ts +3 -3
  44. package/es/aens.mjs +42 -41
  45. package/es/aens.mjs.map +1 -1
  46. package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
  47. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  48. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +3 -7
  49. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  50. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
  51. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
  52. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  53. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  54. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
  55. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +4 -41
  56. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  57. package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
  58. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/schema.mjs +14 -68
  60. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  62. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  63. package/es/apis/compiler/compiler.d.ts +23 -29
  64. package/es/apis/compiler/compiler.mjs +128 -189
  65. package/es/apis/compiler/compiler.mjs.map +1 -1
  66. package/es/apis/compiler/index.mjs.map +1 -1
  67. package/es/apis/compiler/models/index.d.ts +82 -135
  68. package/es/apis/compiler/models/index.mjs +1 -47
  69. package/es/apis/compiler/models/index.mjs.map +1 -1
  70. package/es/apis/compiler/models/mappers.d.ts +8 -8
  71. package/es/apis/compiler/models/mappers.mjs +165 -183
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  73. package/es/apis/compiler/models/parameters.d.ts +0 -1
  74. package/es/apis/compiler/models/parameters.mjs +5 -9
  75. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  76. package/es/apis/node/index.mjs.map +1 -1
  77. package/es/apis/node/models/index.d.ts +48 -48
  78. package/es/apis/node/models/mappers.mjs +12 -6
  79. package/es/apis/node/models/mappers.mjs.map +1 -1
  80. package/es/apis/node/models/parameters.mjs.map +1 -1
  81. package/es/apis/node/node.mjs +43 -84
  82. package/es/apis/node/node.mjs.map +1 -1
  83. package/es/chain.d.ts +1 -1
  84. package/es/chain.mjs +33 -58
  85. package/es/chain.mjs.map +1 -1
  86. package/es/channel/Base.d.ts +195 -0
  87. package/es/channel/Base.mjs +290 -0
  88. package/es/channel/Base.mjs.map +1 -0
  89. package/es/channel/Contract.d.ts +247 -0
  90. package/es/channel/Contract.mjs +420 -0
  91. package/es/channel/Contract.mjs.map +1 -0
  92. package/es/channel/Spend.d.ts +217 -0
  93. package/es/channel/Spend.mjs +383 -0
  94. package/es/channel/Spend.mjs.map +1 -0
  95. package/es/channel/handlers.d.ts +8 -21
  96. package/es/channel/handlers.mjs +141 -891
  97. package/es/channel/handlers.mjs.map +1 -1
  98. package/es/channel/internal.d.ts +27 -21
  99. package/es/channel/internal.mjs +98 -190
  100. package/es/channel/internal.mjs.map +1 -1
  101. package/es/contract/{Compiler.d.ts → CompilerHttp.d.ts} +3 -3
  102. package/es/contract/{Compiler.mjs → CompilerHttp.mjs} +8 -13
  103. package/es/contract/CompilerHttp.mjs.map +1 -0
  104. package/es/contract/Contract.d.ts +235 -0
  105. package/es/contract/Contract.mjs +534 -0
  106. package/es/contract/Contract.mjs.map +1 -0
  107. package/es/contract/ga.d.ts +7 -33
  108. package/es/contract/ga.mjs +20 -112
  109. package/es/contract/ga.mjs.map +1 -1
  110. package/es/index.d.ts +9 -6
  111. package/es/index.mjs +8 -6
  112. package/es/index.mjs.map +1 -1
  113. package/es/oracle.d.ts +5 -5
  114. package/es/oracle.mjs +33 -39
  115. package/es/oracle.mjs.map +1 -1
  116. package/es/spend.d.ts +3 -3
  117. package/es/spend.mjs +17 -20
  118. package/es/spend.mjs.map +1 -1
  119. package/es/tx/builder/constants.d.ts +2 -1
  120. package/es/tx/builder/constants.mjs +12 -12
  121. package/es/tx/builder/constants.mjs.map +1 -1
  122. package/es/tx/builder/field-types/address.d.ts +15 -0
  123. package/es/tx/builder/field-types/address.mjs +42 -0
  124. package/es/tx/builder/field-types/address.mjs.map +1 -0
  125. package/es/tx/builder/field-types/addresses.d.ts +6 -0
  126. package/es/tx/builder/field-types/addresses.mjs +13 -0
  127. package/es/tx/builder/field-types/addresses.mjs.map +1 -0
  128. package/es/tx/builder/field-types/coin-amount.d.ts +1 -2
  129. package/es/tx/builder/field-types/coin-amount.mjs +4 -12
  130. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  131. package/es/tx/builder/field-types/deposit.d.ts +0 -1
  132. package/es/tx/builder/field-types/deposit.mjs +2 -4
  133. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  134. package/es/tx/builder/field-types/enumeration.d.ts +5 -0
  135. package/es/tx/builder/field-types/enumeration.mjs +21 -0
  136. package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
  137. package/es/tx/builder/field-types/fee.d.ts +1 -9
  138. package/es/tx/builder/field-types/fee.mjs +9 -25
  139. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  140. package/es/tx/builder/field-types/field.mjs +0 -2
  141. package/es/tx/builder/field-types/field.mjs.map +1 -1
  142. package/es/tx/builder/field-types/gas-limit.mjs +4 -9
  143. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  144. package/es/tx/builder/field-types/gas-price.d.ts +1 -2
  145. package/es/tx/builder/field-types/gas-price.mjs +3 -7
  146. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  147. package/es/tx/builder/field-types/index.d.ts +23 -11
  148. package/es/tx/builder/field-types/index.mjs +10 -3
  149. package/es/tx/builder/field-types/index.mjs.map +1 -1
  150. package/es/tx/builder/field-types/name-fee.d.ts +0 -1
  151. package/es/tx/builder/field-types/name-fee.mjs +3 -5
  152. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  153. package/es/tx/builder/field-types/name-id.d.ts +1 -4
  154. package/es/tx/builder/field-types/name-id.mjs +4 -10
  155. package/es/tx/builder/field-types/name-id.mjs.map +1 -1
  156. package/es/tx/builder/field-types/name.mjs +0 -2
  157. package/es/tx/builder/field-types/name.mjs.map +1 -1
  158. package/es/tx/builder/field-types/pointers.d.ts +23 -0
  159. package/es/tx/builder/field-types/pointers.mjs +36 -0
  160. package/es/tx/builder/field-types/pointers.mjs.map +1 -0
  161. package/es/tx/builder/field-types/short-u-int.mjs +0 -2
  162. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
  163. package/es/tx/builder/field-types/u-int.d.ts +1 -1
  164. package/es/tx/builder/field-types/u-int.mjs +3 -4
  165. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  166. package/es/tx/builder/helpers.d.ts +2 -32
  167. package/es/tx/builder/helpers.mjs +19 -71
  168. package/es/tx/builder/helpers.mjs.map +1 -1
  169. package/es/tx/builder/index.d.ts +1 -21
  170. package/es/tx/builder/index.mjs +29 -148
  171. package/es/tx/builder/index.mjs.map +1 -1
  172. package/es/tx/builder/schema.d.ts +336 -176
  173. package/es/tx/builder/schema.mjs +71 -78
  174. package/es/tx/builder/schema.mjs.map +1 -1
  175. package/es/tx/index.d.ts +3 -33
  176. package/es/tx/index.mjs +26 -43
  177. package/es/tx/index.mjs.map +1 -1
  178. package/es/tx/validator.d.ts +2 -2
  179. package/es/tx/validator.mjs +86 -59
  180. package/es/tx/validator.mjs.map +1 -1
  181. package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
  182. package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
  183. package/es/utils/amount-formatter.mjs +4 -10
  184. package/es/utils/amount-formatter.mjs.map +1 -1
  185. package/es/utils/autorest.d.ts +1 -0
  186. package/es/utils/autorest.mjs +17 -19
  187. package/es/utils/autorest.mjs.map +1 -1
  188. package/es/utils/bignumber.mjs +4 -7
  189. package/es/utils/bignumber.mjs.map +1 -1
  190. package/es/utils/bytes.d.ts +0 -17
  191. package/es/utils/bytes.mjs +6 -35
  192. package/es/utils/bytes.mjs.map +1 -1
  193. package/es/utils/crypto.d.ts +15 -8
  194. package/es/utils/crypto.mjs +40 -40
  195. package/es/utils/crypto.mjs.map +1 -1
  196. package/es/utils/encoder-types.d.ts +28 -28
  197. package/es/utils/encoder-types.mjs +0 -1
  198. package/es/utils/encoder-types.mjs.map +1 -1
  199. package/es/utils/encoder.d.ts +0 -1
  200. package/es/utils/encoder.mjs +7 -15
  201. package/es/utils/encoder.mjs.map +1 -1
  202. package/es/utils/errors.d.ts +12 -6
  203. package/es/utils/errors.mjs +87 -163
  204. package/es/utils/errors.mjs.map +1 -1
  205. package/es/utils/hd-wallet.d.ts +27 -19
  206. package/es/utils/hd-wallet.mjs +42 -26
  207. package/es/utils/hd-wallet.mjs.map +1 -1
  208. package/es/utils/json-big.mjs +0 -8
  209. package/es/utils/json-big.mjs.map +1 -1
  210. package/es/utils/keystore.d.ts +2 -0
  211. package/es/utils/keystore.mjs +37 -36
  212. package/es/utils/keystore.mjs.map +1 -1
  213. package/es/utils/mptree.d.ts +1 -1
  214. package/es/utils/mptree.mjs +4 -26
  215. package/es/utils/mptree.mjs.map +1 -1
  216. package/es/utils/other.d.ts +3 -1
  217. package/es/utils/other.mjs +11 -7
  218. package/es/utils/other.mjs.map +1 -1
  219. package/es/utils/semver-satisfies.mjs +0 -3
  220. package/es/utils/semver-satisfies.mjs.map +1 -1
  221. package/es/utils/string.d.ts +0 -12
  222. package/es/utils/string.mjs +1 -21
  223. package/es/utils/string.mjs.map +1 -1
  224. package/package.json +87 -48
  225. package/src/AeSdk.ts +15 -11
  226. package/src/AeSdkAepp.ts +9 -7
  227. package/src/AeSdkBase.ts +28 -202
  228. package/src/AeSdkMethods.ts +170 -0
  229. package/src/AeSdkWallet.ts +16 -47
  230. package/src/Node.ts +11 -15
  231. package/src/account/Base.ts +29 -75
  232. package/src/account/Generalized.ts +98 -0
  233. package/src/account/Ledger.ts +131 -0
  234. package/src/account/LedgerFactory.ts +86 -0
  235. package/src/account/Memory.ts +46 -60
  236. package/src/account/Rpc.ts +17 -26
  237. package/src/aens.ts +10 -9
  238. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +5 -4
  239. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
  240. package/src/aepp-wallet-communication/rpc/RpcClient.ts +2 -2
  241. package/src/aepp-wallet-communication/rpc/types.ts +11 -1
  242. package/src/aepp-wallet-communication/schema.ts +18 -18
  243. package/src/apis/compiler/code-model-v4.yaml +681 -888
  244. package/src/apis/compiler/compiler.ts +113 -154
  245. package/src/apis/compiler/models/index.ts +80 -140
  246. package/src/apis/compiler/models/mappers.ts +165 -183
  247. package/src/apis/compiler/models/parameters.ts +6 -12
  248. package/src/chain.ts +6 -3
  249. package/src/channel/Base.ts +327 -0
  250. package/src/channel/Contract.ts +487 -0
  251. package/src/channel/Spend.ts +403 -0
  252. package/src/channel/handlers.ts +154 -573
  253. package/src/channel/internal.ts +113 -142
  254. package/src/contract/{Compiler.ts → CompilerHttp.ts} +5 -5
  255. package/src/contract/Contract.ts +620 -0
  256. package/src/contract/ga.ts +18 -104
  257. package/src/index.ts +9 -8
  258. package/src/oracle.ts +7 -7
  259. package/src/spend.ts +5 -13
  260. package/src/tx/builder/constants.ts +1 -0
  261. package/src/tx/builder/field-types/address.ts +52 -0
  262. package/src/tx/builder/field-types/addresses.ts +18 -0
  263. package/src/tx/builder/field-types/coin-amount.ts +2 -8
  264. package/src/tx/builder/field-types/enumeration.ts +21 -0
  265. package/src/tx/builder/field-types/fee.ts +1 -3
  266. package/src/tx/builder/field-types/gas-limit.ts +2 -2
  267. package/src/tx/builder/field-types/gas-price.ts +0 -2
  268. package/src/tx/builder/field-types/index.ts +16 -6
  269. package/src/tx/builder/field-types/name-fee.ts +1 -1
  270. package/src/tx/builder/field-types/name-id.ts +7 -10
  271. package/src/tx/builder/field-types/pointers.ts +41 -0
  272. package/src/tx/builder/field-types/u-int.ts +3 -2
  273. package/src/tx/builder/helpers.ts +10 -60
  274. package/src/tx/builder/index.ts +6 -65
  275. package/src/tx/builder/schema.ts +89 -100
  276. package/src/tx/index.ts +19 -15
  277. package/src/tx/validator.ts +36 -18
  278. package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
  279. package/src/utils/autorest.ts +16 -1
  280. package/src/utils/bytes.ts +5 -33
  281. package/src/utils/crypto.ts +23 -16
  282. package/src/utils/encoder.ts +0 -1
  283. package/src/utils/errors.ts +18 -12
  284. package/src/utils/hd-wallet.ts +30 -9
  285. package/src/utils/keystore.ts +24 -21
  286. package/src/utils/other.ts +16 -1
  287. package/src/utils/string.ts +0 -20
  288. package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
  289. package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
  290. package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
  291. package/types-legacy/ts4.2/AeSdkMethods.d.ts +141 -0
  292. package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
  293. package/types-legacy/ts4.2/Node.d.ts +78 -0
  294. package/types-legacy/ts4.2/account/Base.d.ts +52 -0
  295. package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
  296. package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
  297. package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
  298. package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
  299. package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
  300. package/types-legacy/ts4.2/aens.d.ts +222 -0
  301. package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  302. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
  303. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  304. package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  305. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  306. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
  307. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
  308. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  309. package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
  310. package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
  311. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
  312. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
  313. package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
  314. package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
  315. package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
  316. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
  317. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
  318. package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
  319. package/types-legacy/ts4.2/chain.d.ts +248 -0
  320. package/types-legacy/ts4.2/channel/Base.d.ts +194 -0
  321. package/types-legacy/ts4.2/channel/Contract.d.ts +247 -0
  322. package/types-legacy/ts4.2/channel/Spend.d.ts +217 -0
  323. package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
  324. package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
  325. package/types-legacy/ts4.2/contract/CompilerHttp.d.ts +18 -0
  326. package/types-legacy/ts4.2/contract/Contract.d.ts +237 -0
  327. package/types-legacy/ts4.2/contract/ga.d.ts +43 -0
  328. package/types-legacy/ts4.2/globals.d.ts +16 -0
  329. package/types-legacy/ts4.2/index.d.ts +39 -0
  330. package/types-legacy/ts4.2/oracle.d.ts +161 -0
  331. package/types-legacy/ts4.2/spend.d.ts +62 -0
  332. package/types-legacy/ts4.2/tx/builder/constants.d.ts +71 -0
  333. package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +22 -0
  334. package/types-legacy/ts4.2/tx/builder/field-types/addresses.d.ts +6 -0
  335. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
  336. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
  337. package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +5 -0
  338. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +17 -0
  339. package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
  340. package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +12 -0
  341. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
  342. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +85 -0
  343. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +19 -0
  344. package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
  345. package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
  346. package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
  347. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
  348. package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +8 -0
  349. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
  350. package/types-legacy/ts4.2/tx/builder/index.d.ts +68 -0
  351. package/types-legacy/ts4.2/tx/builder/schema.d.ts +2963 -0
  352. package/types-legacy/ts4.2/tx/index.d.ts +34 -0
  353. package/types-legacy/ts4.2/tx/validator.d.ts +20 -0
  354. package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
  355. package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
  356. package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
  357. package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
  358. package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
  359. package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
  360. package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
  361. package/types-legacy/ts4.2/utils/errors.d.ts +480 -0
  362. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
  363. package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
  364. package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
  365. package/types-legacy/ts4.2/utils/mptree.d.ts +32 -0
  366. package/types-legacy/ts4.2/utils/other.d.ts +31 -0
  367. package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
  368. package/types-legacy/ts4.2/utils/string.d.ts +12 -0
  369. package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
  370. package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
  371. package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
  372. package/types-legacy/ts4.5/AeSdkMethods.d.ts +141 -0
  373. package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
  374. package/types-legacy/ts4.5/Node.d.ts +78 -0
  375. package/types-legacy/ts4.5/account/Base.d.ts +52 -0
  376. package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
  377. package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
  378. package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
  379. package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
  380. package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
  381. package/types-legacy/ts4.5/aens.d.ts +222 -0
  382. package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  383. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
  384. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  385. package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  386. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  387. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
  388. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
  389. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  390. package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
  391. package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
  392. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
  393. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
  394. package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
  395. package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
  396. package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
  397. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
  398. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
  399. package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
  400. package/types-legacy/ts4.5/chain.d.ts +248 -0
  401. package/types-legacy/ts4.5/channel/Base.d.ts +194 -0
  402. package/types-legacy/ts4.5/channel/Contract.d.ts +247 -0
  403. package/types-legacy/ts4.5/channel/Spend.d.ts +217 -0
  404. package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
  405. package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
  406. package/types-legacy/ts4.5/contract/CompilerHttp.d.ts +18 -0
  407. package/types-legacy/ts4.5/contract/Contract.d.ts +237 -0
  408. package/types-legacy/ts4.5/contract/ga.d.ts +43 -0
  409. package/types-legacy/ts4.5/index.d.ts +38 -0
  410. package/types-legacy/ts4.5/oracle.d.ts +161 -0
  411. package/types-legacy/ts4.5/spend.d.ts +62 -0
  412. package/types-legacy/ts4.5/tx/builder/constants.d.ts +71 -0
  413. package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +22 -0
  414. package/types-legacy/ts4.5/tx/builder/field-types/addresses.d.ts +6 -0
  415. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
  416. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
  417. package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +5 -0
  418. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +17 -0
  419. package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
  420. package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +12 -0
  421. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
  422. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +85 -0
  423. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +19 -0
  424. package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
  425. package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
  426. package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
  427. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
  428. package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +8 -0
  429. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
  430. package/types-legacy/ts4.5/tx/builder/index.d.ts +68 -0
  431. package/types-legacy/ts4.5/tx/builder/schema.d.ts +2963 -0
  432. package/types-legacy/ts4.5/tx/index.d.ts +34 -0
  433. package/types-legacy/ts4.5/tx/validator.d.ts +20 -0
  434. package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
  435. package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
  436. package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
  437. package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
  438. package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
  439. package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
  440. package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
  441. package/types-legacy/ts4.5/utils/errors.d.ts +480 -0
  442. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
  443. package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
  444. package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
  445. package/types-legacy/ts4.5/utils/mptree.d.ts +32 -0
  446. package/types-legacy/ts4.5/utils/other.d.ts +31 -0
  447. package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
  448. package/types-legacy/ts4.5/utils/string.d.ts +12 -0
  449. package/es/channel/index.d.ts +0 -625
  450. package/es/channel/index.mjs +0 -975
  451. package/es/channel/index.mjs.map +0 -1
  452. package/es/contract/Compiler.mjs.map +0 -1
  453. package/es/contract/aci.d.ts +0 -127
  454. package/es/contract/aci.mjs +0 -509
  455. package/es/contract/aci.mjs.map +0 -1
  456. package/es/contract/methods.d.ts +0 -71
  457. package/es/contract/methods.mjs +0 -104
  458. package/es/contract/methods.mjs.map +0 -1
  459. package/es/deprecated/index.d.ts +0 -143
  460. package/es/deprecated/index.mjs +0 -162
  461. package/es/deprecated/index.mjs.map +0 -1
  462. package/es/deprecated/methods.d.ts +0 -18
  463. package/es/deprecated/methods.mjs +0 -26
  464. package/es/deprecated/methods.mjs.map +0 -1
  465. package/es/tx/builder/address.d.ts +0 -25
  466. package/es/tx/builder/address.mjs +0 -45
  467. package/es/tx/builder/address.mjs.map +0 -1
  468. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
  469. package/src/channel/index.ts +0 -1025
  470. package/src/contract/aci.ts +0 -538
  471. package/src/contract/methods.ts +0 -123
  472. package/src/deprecated/index.ts +0 -172
  473. package/src/deprecated/methods.ts +0 -25
  474. package/src/tx/builder/address.ts +0 -50
  475. package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
@@ -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,IA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,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","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;\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,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,OAAO,MAAMC,gBAAgB,GAAG,KAAK;AACrC;;AAEA,OAAO,MAAMC,QAAQ,GAAG,MAAM;AAC9B;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,KAAK;AACjC,OAAO,MAAMC,mBAAmB,GAAG,KAAK;AACxC,OAAO,MAAMC,UAAU,GAAGD,mBAAmB;AAC7C,OAAO,MAAME,aAAa,GAAG,GAAG;AAChC;AACA,OAAO,MAAMC,mBAAmB,GAAG,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HA,GAAG;EAAHA,GAAG,CAAHA,GAAG;AAAA,GAAHA,GAAG,KAAHA,GAAG"}
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ import { Encoding } 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
+ declare const idTagToEncoding: readonly [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
10
+ export type AddressEncodings = typeof idTagToEncoding[number];
11
+ export default function genAddressField<Encoding extends AddressEncodings>(): {
12
+ serialize: (value: `${Encoding}_${string}`) => Buffer;
13
+ deserialize: (value: Buffer) => `${Encoding}_${string}`;
14
+ };
15
+ export {};
@@ -0,0 +1,42 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { 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
+ const idTagToEncoding = [Encoding.AccountAddress, Encoding.Name, Encoding.Commitment, Encoding.OracleAddress, Encoding.ContractAddress, Encoding.Channel];
16
+ export default function genAddressField() {
17
+ return {
18
+ /**
19
+ * Utility function to create and _id type
20
+ * @param hashId - Encoded hash
21
+ * @returns Buffer Buffer with ID tag and decoded HASh
22
+ */
23
+ serialize(hashId) {
24
+ const encoding = hashId.slice(0, 2);
25
+ if (!isItemOfArray(encoding, idTagToEncoding)) throw new TagNotFoundError(encoding);
26
+ const idTag = idTagToEncoding.indexOf(encoding) + 1;
27
+ return _Buffer.from([...toBytes(idTag), ...decode(hashId)]);
28
+ },
29
+ /**
30
+ * Utility function to read and _id type
31
+ * @param buf - Data
32
+ * @returns Encoded hash string with prefix
33
+ */
34
+ deserialize(buf) {
35
+ const idTag = _Buffer.from(buf).readUIntBE(0, 1);
36
+ const encoding = idTagToEncoding[idTag - 1];
37
+ if (encoding == null) throw new PrefixNotFoundError(idTag);
38
+ return encode(buf.subarray(1), encoding);
39
+ }
40
+ };
41
+ }
42
+ //# sourceMappingURL=address.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.mjs","names":["PrefixNotFoundError","TagNotFoundError","toBytes","decode","encode","Encoding","isItemOfArray","idTagToEncoding","AccountAddress","Name","Commitment","OracleAddress","ContractAddress","Channel","genAddressField","serialize","hashId","encoding","slice","idTag","indexOf","from","deserialize","buf","readUIntBE","subarray"],"sources":["../../../../src/tx/builder/field-types/address.ts"],"sourcesContent":["import { PrefixNotFoundError, TagNotFoundError } from '../../../utils/errors';\nimport { toBytes } from '../../../utils/bytes';\nimport { decode, encode, Encoding } 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 */\nconst 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 serialize: (value: `${Encoding}_${string}`) => Buffer;\n deserialize: (value: Buffer) => `${Encoding}_${string}`;\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 encoding = hashId.slice(0, 2);\n if (!isItemOfArray(encoding, idTagToEncoding)) throw new TagNotFoundError(encoding);\n const idTag = idTagToEncoding.indexOf(encoding) + 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 encoding = idTagToEncoding[idTag - 1];\n if (encoding == null) throw new PrefixNotFoundError(idTag);\n return encode(buf.subarray(1), encoding) as `${Encoding}_${string}`;\n },\n };\n}\n"],"mappings":";;;;SAASA,mBAAmB,EAAEC,gBAAgB;AAAA,SACrCC,OAAO;AAAA,SACPC,MAAM,EAAEC,MAAM,EAAEC,QAAQ;AAAA,SACxBC,aAAa;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,CACtBF,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,GAGrC;EACA,OAAO;IACL;AACJ;AACA;AACA;AACA;IACIC,SAAS,CAACC,MAAM,EAAE;MAChB,MAAMC,QAAQ,GAAGD,MAAM,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;MACnC,IAAI,CAACZ,aAAa,CAACW,QAAQ,EAAEV,eAAe,CAAC,EAAE,MAAM,IAAIN,gBAAgB,CAACgB,QAAQ,CAAC;MACnF,MAAME,KAAK,GAAGZ,eAAe,CAACa,OAAO,CAACH,QAAQ,CAAC,GAAG,CAAC;MACnD,OAAO,QAAOI,IAAI,CAAC,CAAC,GAAGnB,OAAO,CAACiB,KAAK,CAAC,EAAE,GAAGhB,MAAM,CAACa,MAAM,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIM,WAAW,CAACC,GAAG,EAAE;MACf,MAAMJ,KAAK,GAAG,QAAOE,IAAI,CAACE,GAAG,CAAC,CAACC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC;MAC/C,MAAMP,QAAQ,GAAGV,eAAe,CAACY,KAAK,GAAG,CAAC,CAAC;MAC3C,IAAIF,QAAQ,IAAI,IAAI,EAAE,MAAM,IAAIjB,mBAAmB,CAACmB,KAAK,CAAC;MAC1D,OAAOf,MAAM,CAACmB,GAAG,CAACE,QAAQ,CAAC,CAAC,CAAC,EAAER,QAAQ,CAAC;IAC1C;EACF,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ /// <reference types="node" />
2
+ import { AddressEncodings } from './address';
3
+ export default function genAddressesField<Encoding extends AddressEncodings>(): {
4
+ serialize: (value: Array<`${Encoding}_${string}`>) => Buffer[];
5
+ deserialize: (value: Buffer[]) => Array<`${Encoding}_${string}`>;
6
+ };
@@ -0,0 +1,13 @@
1
+ import genAddressField from "./address.mjs";
2
+ export default function genAddressesField() {
3
+ const address = genAddressField();
4
+ return {
5
+ serialize(addresses) {
6
+ return addresses.map(address.serialize);
7
+ },
8
+ deserialize(addresses) {
9
+ return addresses.map(address.deserialize);
10
+ }
11
+ };
12
+ }
13
+ //# sourceMappingURL=addresses.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addresses.mjs","names":["genAddressField","genAddressesField","address","serialize","addresses","map","deserialize"],"sources":["../../../../src/tx/builder/field-types/addresses.ts"],"sourcesContent":["import genAddressField, { AddressEncodings } from './address';\n\nexport default function genAddressesField<Encoding extends AddressEncodings>(): {\n serialize: (value: Array<`${Encoding}_${string}`>) => Buffer[];\n deserialize: (value: Buffer[]) => Array<`${Encoding}_${string}`>;\n} {\n const address = genAddressField<Encoding>();\n\n return {\n serialize(addresses) {\n return addresses.map(address.serialize);\n },\n\n deserialize(addresses) {\n return addresses.map(address.deserialize);\n },\n };\n}\n"],"mappings":"OAAOA,eAAe;AAEtB,eAAe,SAASC,iBAAiB,GAGvC;EACA,MAAMC,OAAO,GAAGF,eAAe,EAAY;EAE3C,OAAO;IACLG,SAAS,CAACC,SAAS,EAAE;MACnB,OAAOA,SAAS,CAACC,GAAG,CAACH,OAAO,CAACC,SAAS,CAAC;IACzC,CAAC;IAEDG,WAAW,CAACF,SAAS,EAAE;MACrB,OAAOA,SAAS,CAACC,GAAG,CAACH,OAAO,CAACI,WAAW,CAAC;IAC3C;EACF,CAAC;AACH"}
@@ -6,8 +6,7 @@ export interface Options {
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, { Int } from './u-int';\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,SACiBC,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"}
@@ -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 './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,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,5 @@
1
+ /// <reference types="node" />
2
+ export default function genEnumerationField<Enum extends number>(): {
3
+ serialize: (value: Enum) => Buffer;
4
+ deserialize: (value: Buffer) => Enum;
5
+ };
@@ -0,0 +1,21 @@
1
+ import _buffer from "buffer";
2
+ const {
3
+ Buffer: _Buffer
4
+ } = _buffer;
5
+ import { ArgumentError } from "../../../utils/errors.mjs";
6
+ export default function genEnumerationField() {
7
+ return {
8
+ serialize(value) {
9
+ if (typeof value !== 'number') throw new ArgumentError('value', 'to be a number', value);
10
+ if (value > 0xff) throw new ArgumentError('value', 'to be less than 256', value);
11
+ return _Buffer.from([value]);
12
+ },
13
+ deserialize(buffer) {
14
+ if (buffer.length !== 1) {
15
+ throw new ArgumentError('buffer', 'to have single element', buffer.length);
16
+ }
17
+ return buffer[0];
18
+ }
19
+ };
20
+ }
21
+ //# sourceMappingURL=enumeration.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enumeration.mjs","names":["ArgumentError","genEnumerationField","serialize","value","from","deserialize","buffer","length"],"sources":["../../../../src/tx/builder/field-types/enumeration.ts"],"sourcesContent":["import { ArgumentError } from '../../../utils/errors';\n\nexport default function genEnumerationField<Enum extends number>(): {\n serialize: (value: Enum) => Buffer;\n deserialize: (value: Buffer) => Enum;\n} {\n return {\n serialize(value) {\n if (typeof value !== 'number') throw new ArgumentError('value', 'to be a number', value);\n if (value > 0xff) throw new ArgumentError('value', 'to be less than 256', value);\n return Buffer.from([value]);\n },\n\n deserialize(buffer) {\n if (buffer.length !== 1) {\n throw new ArgumentError('buffer', 'to have single element', buffer.length);\n }\n return buffer[0] as Enum;\n },\n };\n}\n"],"mappings":";;;;SAASA,aAAa;AAEtB,eAAe,SAASC,mBAAmB,GAGzC;EACA,OAAO;IACLC,SAAS,CAACC,KAAK,EAAE;MACf,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,MAAM,IAAIH,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAEG,KAAK,CAAC;MACxF,IAAIA,KAAK,GAAG,IAAI,EAAE,MAAM,IAAIH,aAAa,CAAC,OAAO,EAAE,qBAAqB,EAAEG,KAAK,CAAC;MAChF,OAAO,QAAOC,IAAI,CAAC,CAACD,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEDE,WAAW,CAACC,MAAM,EAAE;MAClB,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAIP,aAAa,CAAC,QAAQ,EAAE,wBAAwB,EAAEM,MAAM,CAACC,MAAM,CAAC;MAC5E;MACA,OAAOD,MAAM,CAAC,CAAC,CAAC;IAClB;EACF,CAAC;AACH"}
@@ -5,21 +5,13 @@ import { Tag } from '../constants';
5
5
  * Calculate fee based on tx type and params
6
6
  */
7
7
  export declare function buildFee(txType: Tag, buildTx: any): BigNumber;
8
- /**
9
- * Calculate min fee
10
- * @category transaction builder
11
- * @param txType - Transaction type
12
- * @param rebuildTx - Callback to get built transaction with specific fee
13
- */
14
- export declare function calculateMinFee(txType: Tag, rebuildTx: (value: BigNumber) => any): BigNumber;
15
8
  declare const _default: {
16
9
  serializeAettos(_value: string | undefined, { txType, rebuildTx, _computingMinFee }: {
17
10
  txType: Tag;
18
11
  rebuildTx: (params: any) => any;
19
12
  _computingMinFee?: string | undefined;
20
13
  }): string;
21
- serialize: (value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options) => Buffer;
22
- serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
14
+ serialize(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
23
15
  deserialize(value: Buffer): string;
24
16
  };
25
17
  export default _default;
@@ -1,4 +1,3 @@
1
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
2
1
  import BigNumber from 'bignumber.js';
3
2
  import { IllegalArgumentError } from "../../../utils/errors.mjs";
4
3
  import { MIN_GAS_PRICE, Tag } from "../constants.mjs";
@@ -7,6 +6,7 @@ import { isKeyOfObject } from "../../../utils/other.mjs";
7
6
  const BASE_GAS = 15000;
8
7
  const GAS_PER_BYTE = 20;
9
8
  const KEY_BLOCK_INTERVAL = 3;
9
+
10
10
  /**
11
11
  * Calculate the Base fee gas
12
12
  * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
@@ -17,10 +17,8 @@ const KEY_BLOCK_INTERVAL = 3;
17
17
  * TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)
18
18
  * ```
19
19
  */
20
-
21
20
  const TX_FEE_BASE_GAS = txType => {
22
21
  var _feeFactors;
23
-
24
22
  const feeFactors = {
25
23
  [Tag.ChannelForceProgressTx]: 30,
26
24
  [Tag.ChannelOffChainTx]: 0,
@@ -38,6 +36,7 @@ const TX_FEE_BASE_GAS = txType => {
38
36
  const factor = (_feeFactors = feeFactors[txType]) !== null && _feeFactors !== void 0 ? _feeFactors : 1;
39
37
  return new BigNumber(factor * BASE_GAS);
40
38
  };
39
+
41
40
  /**
42
41
  * Calculate fee for Other types of transactions
43
42
  * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}
@@ -53,30 +52,24 @@ const TX_FEE_BASE_GAS = txType => {
53
52
  * => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))
54
53
  * ```
55
54
  */
56
-
57
-
58
55
  const TX_FEE_OTHER_GAS = (txType, txSize, _ref) => {
59
56
  let {
60
57
  relativeTtl,
61
58
  innerTxSize
62
59
  } = _ref;
63
-
64
60
  switch (txType) {
65
61
  case Tag.OracleRegisterTx:
66
62
  case Tag.OracleExtendTx:
67
63
  case Tag.OracleQueryTx:
68
64
  case Tag.OracleResponseTx:
69
65
  return new BigNumber(txSize).times(GAS_PER_BYTE).plus(Math.ceil(32000 * relativeTtl / Math.floor(60 * 24 * 365 / KEY_BLOCK_INTERVAL)));
70
-
71
66
  case Tag.GaMetaTx:
72
67
  case Tag.PayingForTx:
73
68
  return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);
74
-
75
69
  default:
76
70
  return new BigNumber(txSize).times(GAS_PER_BYTE);
77
71
  }
78
72
  };
79
-
80
73
  function getOracleRelativeTtl(params, txType) {
81
74
  const ttlKeys = {
82
75
  [Tag.OracleRegisterTx]: 'oracleTtlValue',
@@ -87,14 +80,11 @@ function getOracleRelativeTtl(params, txType) {
87
80
  if (!isKeyOfObject(txType, ttlKeys)) return 1;
88
81
  return params[ttlKeys[txType]];
89
82
  }
83
+
90
84
  /**
91
85
  * Calculate fee based on tx type and params
92
86
  */
93
-
94
-
95
87
  export function buildFee(txType, buildTx) {
96
- var _context;
97
-
98
88
  const {
99
89
  rlpEncoded: {
100
90
  length
@@ -103,29 +93,27 @@ export function buildFee(txType, buildTx) {
103
93
  } = buildTx;
104
94
  return TX_FEE_BASE_GAS(txType).plus(TX_FEE_OTHER_GAS(txType, length, {
105
95
  relativeTtl: getOracleRelativeTtl(txObject, txType),
106
- innerTxSize: _includesInstanceProperty(_context = [Tag.GaMetaTx, Tag.PayingForTx]).call(_context, txType) ? txObject.tx.tx.encodedTx.rlpEncoded.length : 0
96
+ innerTxSize: [Tag.GaMetaTx, Tag.PayingForTx].includes(txType) ? txObject.tx.tx.encodedTx.rlpEncoded.length : 0
107
97
  })).times(MIN_GAS_PRICE);
108
98
  }
99
+
109
100
  /**
110
101
  * Calculate min fee
111
102
  * @category transaction builder
112
103
  * @param txType - Transaction type
113
104
  * @param rebuildTx - Callback to get built transaction with specific fee
114
105
  */
115
-
116
- export function calculateMinFee(txType, rebuildTx) {
106
+ function calculateMinFee(txType, rebuildTx) {
117
107
  let fee = new BigNumber(0);
118
108
  let previousFee;
119
-
120
109
  do {
121
110
  previousFee = fee;
122
111
  fee = buildFee(txType, rebuildTx(fee));
123
112
  } while (!fee.eq(previousFee));
124
-
125
113
  return fee;
126
114
  }
127
- export default { ...coinAmount,
128
-
115
+ export default {
116
+ ...coinAmount,
129
117
  serializeAettos(_value, _ref2) {
130
118
  let {
131
119
  txType,
@@ -137,14 +125,10 @@ export default { ...coinAmount,
137
125
  _computingMinFee: fee
138
126
  }));
139
127
  const value = new BigNumber(_value !== null && _value !== void 0 ? _value : minFee);
140
-
141
128
  if (minFee.gt(value)) {
142
129
  throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);
143
130
  }
144
-
145
131
  return value.toFixed();
146
- },
147
-
148
- serialize: coinAmount.serializeOptional
132
+ }
149
133
  };
150
134
  //# sourceMappingURL=fee.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","buildFee","buildTx","rlpEncoded","length","txObject","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","eq","serializeAettos","_value","_computingMinFee","minFee","value","gt","toString","toFixed","serialize","serializeOptional"],"sources":["../../../../src/tx/builder/field-types/fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag } from '../constants';\nimport coinAmount from './coin-amount';\nimport { isKeyOfObject } from '../../../utils/other';\n\nconst BASE_GAS = 15000;\nconst GAS_PER_BYTE = 20;\nconst KEY_BLOCK_INTERVAL = 3;\n\n/**\n * Calculate the Base fee gas\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @returns The base fee\n * @example\n * ```js\n * TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)\n * ```\n */\nconst TX_FEE_BASE_GAS = (txType: Tag): BigNumber => {\n const feeFactors = {\n [Tag.ChannelForceProgressTx]: 30,\n [Tag.ChannelOffChainTx]: 0,\n [Tag.ChannelOffChainUpdateCallContract]: 0,\n [Tag.ChannelOffChainUpdateCreateContract]: 0,\n [Tag.ChannelOffChainUpdateDeposit]: 0,\n [Tag.ChannelOffChainUpdateWithdraw]: 0,\n [Tag.ChannelOffChainUpdateTransfer]: 0,\n [Tag.ContractCreateTx]: 5,\n [Tag.ContractCallTx]: 12,\n [Tag.GaAttachTx]: 5,\n [Tag.GaMetaTx]: 5,\n [Tag.PayingForTx]: 1 / 5,\n } as const;\n const factor = feeFactors[txType as keyof typeof feeFactors] ?? 1;\n return new BigNumber(factor * BASE_GAS);\n};\n\n/**\n * Calculate fee for Other types of transactions\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @param txSize - The transaction size\n * @returns parameters - The transaction parameters\n * @returns parameters.relativeTtl - The relative ttl\n * @returns parameters.innerTxSize - The size of the inner transaction\n * @returns The Other fee\n * @example\n * ```js\n * TX_FEE_OTHER_GAS('oracleResponse',10, { relativeTtl: 10, innerTxSize: 10 })\n * => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))\n * ```\n */\nconst TX_FEE_OTHER_GAS = (\n txType: Tag,\n txSize: number,\n { relativeTtl, innerTxSize }: { relativeTtl: number; innerTxSize: number },\n): BigNumber => {\n switch (txType) {\n case Tag.OracleRegisterTx:\n case Tag.OracleExtendTx:\n case Tag.OracleQueryTx:\n case Tag.OracleResponseTx:\n return new BigNumber(txSize)\n .times(GAS_PER_BYTE)\n .plus(\n Math.ceil((32000 * relativeTtl) / Math.floor((60 * 24 * 365) / KEY_BLOCK_INTERVAL)),\n );\n case Tag.GaMetaTx:\n case Tag.PayingForTx:\n return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);\n default:\n return new BigNumber(txSize).times(GAS_PER_BYTE);\n }\n};\n\nfunction getOracleRelativeTtl(params: any, txType: Tag): number {\n const ttlKeys = {\n [Tag.OracleRegisterTx]: 'oracleTtlValue',\n [Tag.OracleExtendTx]: 'oracleTtlValue',\n [Tag.OracleQueryTx]: 'queryTtlValue',\n [Tag.OracleResponseTx]: 'responseTtlValue',\n } as const;\n\n if (!isKeyOfObject(txType, ttlKeys)) return 1;\n return params[ttlKeys[txType]];\n}\n\n/**\n * Calculate fee based on tx type and params\n */\nexport function buildFee(txType: Tag, buildTx: any): BigNumber {\n const { rlpEncoded: { length }, txObject } = buildTx;\n\n return TX_FEE_BASE_GAS(txType)\n .plus(TX_FEE_OTHER_GAS(txType, length, {\n relativeTtl: getOracleRelativeTtl(txObject, txType),\n innerTxSize: [Tag.GaMetaTx, Tag.PayingForTx].includes(txType)\n ? txObject.tx.tx.encodedTx.rlpEncoded.length\n : 0,\n }))\n .times(MIN_GAS_PRICE);\n}\n\n/**\n * Calculate min fee\n * @category transaction builder\n * @param txType - Transaction type\n * @param rebuildTx - Callback to get built transaction with specific fee\n */\nexport function calculateMinFee(\n txType: Tag,\n rebuildTx: (value: BigNumber) => any,\n): BigNumber {\n let fee = new BigNumber(0);\n let previousFee;\n do {\n previousFee = fee;\n fee = buildFee(txType, rebuildTx(fee));\n } while (!fee.eq(previousFee));\n return fee;\n}\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n { txType, rebuildTx, _computingMinFee }:\n { txType: Tag; rebuildTx: (params: any) => any; _computingMinFee?: string },\n ): string {\n if (_computingMinFee != null) return _computingMinFee;\n const minFee = calculateMinFee(txType, (fee) => rebuildTx({ _computingMinFee: fee }));\n const value = new BigNumber(_value ?? minFee);\n if (minFee.gt(value)) {\n throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);\n }\n return value.toFixed();\n },\n\n serialize: coinAmount.serializeOptional,\n};\n"],"mappings":";AAAA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,oB;SACAC,a,EAAeC,G;OACjBC,U;SACEC,a;AAET,MAAMC,QAAQ,GAAG,KAAjB;AACA,MAAMC,YAAY,GAAG,EAArB;AACA,MAAM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SAAS,EAAE1D,UAAU,CAAC2D;AAjBT,CAAf"}
1
+ {"version":3,"file":"fee.mjs","names":["BigNumber","IllegalArgumentError","MIN_GAS_PRICE","Tag","coinAmount","isKeyOfObject","BASE_GAS","GAS_PER_BYTE","KEY_BLOCK_INTERVAL","TX_FEE_BASE_GAS","txType","feeFactors","ChannelForceProgressTx","ChannelOffChainTx","ChannelOffChainUpdateCallContract","ChannelOffChainUpdateCreateContract","ChannelOffChainUpdateDeposit","ChannelOffChainUpdateWithdraw","ChannelOffChainUpdateTransfer","ContractCreateTx","ContractCallTx","GaAttachTx","GaMetaTx","PayingForTx","factor","TX_FEE_OTHER_GAS","txSize","relativeTtl","innerTxSize","OracleRegisterTx","OracleExtendTx","OracleQueryTx","OracleResponseTx","times","plus","Math","ceil","floor","minus","getOracleRelativeTtl","params","ttlKeys","buildFee","buildTx","rlpEncoded","length","txObject","includes","tx","encodedTx","calculateMinFee","rebuildTx","fee","previousFee","eq","serializeAettos","_value","_computingMinFee","minFee","value","gt","toString","toFixed"],"sources":["../../../../src/tx/builder/field-types/fee.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag } from '../constants';\nimport coinAmount from './coin-amount';\nimport { isKeyOfObject } from '../../../utils/other';\n\nconst BASE_GAS = 15000;\nconst GAS_PER_BYTE = 20;\nconst KEY_BLOCK_INTERVAL = 3;\n\n/**\n * Calculate the Base fee gas\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @returns The base fee\n * @example\n * ```js\n * TX_FEE_BASE('channelForceProgress') => new BigNumber(30 * 15000)\n * ```\n */\nconst TX_FEE_BASE_GAS = (txType: Tag): BigNumber => {\n const feeFactors = {\n [Tag.ChannelForceProgressTx]: 30,\n [Tag.ChannelOffChainTx]: 0,\n [Tag.ChannelOffChainUpdateCallContract]: 0,\n [Tag.ChannelOffChainUpdateCreateContract]: 0,\n [Tag.ChannelOffChainUpdateDeposit]: 0,\n [Tag.ChannelOffChainUpdateWithdraw]: 0,\n [Tag.ChannelOffChainUpdateTransfer]: 0,\n [Tag.ContractCreateTx]: 5,\n [Tag.ContractCallTx]: 12,\n [Tag.GaAttachTx]: 5,\n [Tag.GaMetaTx]: 5,\n [Tag.PayingForTx]: 1 / 5,\n } as const;\n const factor = feeFactors[txType as keyof typeof feeFactors] ?? 1;\n return new BigNumber(factor * BASE_GAS);\n};\n\n/**\n * Calculate fee for Other types of transactions\n * @see {@link https://github.com/aeternity/protocol/blob/master/consensus/README.md#gas}\n * @param txType - The transaction type\n * @param txSize - The transaction size\n * @returns parameters - The transaction parameters\n * @returns parameters.relativeTtl - The relative ttl\n * @returns parameters.innerTxSize - The size of the inner transaction\n * @returns The Other fee\n * @example\n * ```js\n * TX_FEE_OTHER_GAS('oracleResponse',10, { relativeTtl: 10, innerTxSize: 10 })\n * => new BigNumber(10).times(20).plus(Math.ceil(32000 * 10 / Math.floor(60 * 24 * 365 / 2)))\n * ```\n */\nconst TX_FEE_OTHER_GAS = (\n txType: Tag,\n txSize: number,\n { relativeTtl, innerTxSize }: { relativeTtl: number; innerTxSize: number },\n): BigNumber => {\n switch (txType) {\n case Tag.OracleRegisterTx:\n case Tag.OracleExtendTx:\n case Tag.OracleQueryTx:\n case Tag.OracleResponseTx:\n return new BigNumber(txSize)\n .times(GAS_PER_BYTE)\n .plus(\n Math.ceil((32000 * relativeTtl) / Math.floor((60 * 24 * 365) / KEY_BLOCK_INTERVAL)),\n );\n case Tag.GaMetaTx:\n case Tag.PayingForTx:\n return new BigNumber(txSize).minus(innerTxSize).times(GAS_PER_BYTE);\n default:\n return new BigNumber(txSize).times(GAS_PER_BYTE);\n }\n};\n\nfunction getOracleRelativeTtl(params: any, txType: Tag): number {\n const ttlKeys = {\n [Tag.OracleRegisterTx]: 'oracleTtlValue',\n [Tag.OracleExtendTx]: 'oracleTtlValue',\n [Tag.OracleQueryTx]: 'queryTtlValue',\n [Tag.OracleResponseTx]: 'responseTtlValue',\n } as const;\n\n if (!isKeyOfObject(txType, ttlKeys)) return 1;\n return params[ttlKeys[txType]];\n}\n\n/**\n * Calculate fee based on tx type and params\n */\nexport function buildFee(txType: Tag, buildTx: any): BigNumber {\n const { rlpEncoded: { length }, txObject } = buildTx;\n\n return TX_FEE_BASE_GAS(txType)\n .plus(TX_FEE_OTHER_GAS(txType, length, {\n relativeTtl: getOracleRelativeTtl(txObject, txType),\n innerTxSize: [Tag.GaMetaTx, Tag.PayingForTx].includes(txType)\n ? txObject.tx.tx.encodedTx.rlpEncoded.length\n : 0,\n }))\n .times(MIN_GAS_PRICE);\n}\n\n/**\n * Calculate min fee\n * @category transaction builder\n * @param txType - Transaction type\n * @param rebuildTx - Callback to get built transaction with specific fee\n */\nfunction calculateMinFee(\n txType: Tag,\n rebuildTx: (value: BigNumber) => any,\n): BigNumber {\n let fee = new BigNumber(0);\n let previousFee;\n do {\n previousFee = fee;\n fee = buildFee(txType, rebuildTx(fee));\n } while (!fee.eq(previousFee));\n return fee;\n}\n\nexport default {\n ...coinAmount,\n\n serializeAettos(\n _value: string | undefined,\n { txType, rebuildTx, _computingMinFee }:\n { txType: Tag; rebuildTx: (params: any) => any; _computingMinFee?: string },\n ): string {\n if (_computingMinFee != null) return _computingMinFee;\n const minFee = calculateMinFee(txType, (fee) => rebuildTx({ _computingMinFee: fee }));\n const value = new BigNumber(_value ?? minFee);\n if (minFee.gt(value)) {\n throw new IllegalArgumentError(`Fee ${value.toString()} must be bigger then ${minFee}`);\n }\n return value.toFixed();\n },\n};\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,oBAAoB;AAAA,SACpBC,aAAa,EAAEC,GAAG;AAAA,OACpBC,UAAU;AAAA,SACRC,aAAa;AAEtB,MAAMC,QAAQ,GAAG,KAAK;AACtB,MAAMC,YAAY,GAAG,EAAE;AACvB,MAAMC,kBAAkB,GAAG,CAAC;;AAE5B;AACA;AACA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) {
7
7
  return _Buffer.from(value);
8
8
  },
9
-
10
9
  deserialize(value) {
11
10
  return value.toString();
12
11
  }
13
-
14
12
  };
15
13
  //# sourceMappingURL=field.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"field.mjs","names":["serialize","value","from","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/field.ts"],"sourcesContent":["export default {\n serialize(value: string): Buffer {\n return Buffer.from(value);\n },\n\n deserialize(value: Buffer): string {\n return value.toString();\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,KAAD,EAAwB;IAC/B,OAAO,QAAOC,IAAP,CAAYD,KAAZ,CAAP;EACD,CAHY;;EAKbE,WAAW,CAACF,KAAD,EAAwB;IACjC,OAAOA,KAAK,CAACG,QAAN,EAAP;EACD;;AAPY,CAAf"}
1
+ {"version":3,"file":"field.mjs","names":["serialize","value","from","deserialize","toString"],"sources":["../../../../src/tx/builder/field-types/field.ts"],"sourcesContent":["export default {\n serialize(value: string): Buffer {\n return Buffer.from(value);\n },\n\n deserialize(value: Buffer): string {\n return value.toString();\n },\n};\n"],"mappings":";;;;AAAA,eAAe;EACbA,SAAS,CAACC,KAAa,EAAU;IAC/B,OAAO,QAAOC,IAAI,CAACD,KAAK,CAAC;EAC3B,CAAC;EAEDE,WAAW,CAACF,KAAa,EAAU;IACjC,OAAOA,KAAK,CAACG,QAAQ,EAAE;EACzB;AACF,CAAC"}
@@ -1,14 +1,12 @@
1
1
  import { IllegalArgumentError } from "../../../utils/errors.mjs";
2
- import { MIN_GAS_PRICE } from "../constants.mjs";
2
+ import { MIN_GAS_PRICE, Tag, MAX_AUTH_FUN_GAS } from "../constants.mjs";
3
3
  import shortUInt from "./short-u-int.mjs";
4
4
  import { buildFee } from "./fee.mjs";
5
-
6
5
  function calculateGasLimitMax(txType, gasMax, rebuildTx) {
7
6
  return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);
8
7
  }
9
-
10
- export default { ...shortUInt,
11
-
8
+ export default {
9
+ ...shortUInt,
12
10
  serialize(_value, _ref) {
13
11
  let {
14
12
  txType,
@@ -17,17 +15,14 @@ export default { ...shortUInt,
17
15
  _computingGasLimit
18
16
  } = _ref;
19
17
  if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);
20
- const gasLimitMax = calculateGasLimitMax(txType, gasMax, gasLimit => rebuildTx({
18
+ const gasLimitMax = txType === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(txType, gasMax, gasLimit => rebuildTx({
21
19
  _computingGasLimit: gasLimit
22
20
  }));
23
21
  const value = _value !== null && _value !== void 0 ? _value : gasLimitMax;
24
-
25
22
  if (value > gasLimitMax) {
26
23
  throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);
27
24
  }
28
-
29
25
  return shortUInt.serialize(value);
30
26
  }
31
-
32
27
  };
33
28
  //# sourceMappingURL=gas-limit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","MIN_GAS_PRICE","shortUInt","buildFee","calculateGasLimitMax","txType","gasMax","rebuildTx","dividedBy","serialize","_value","_computingGasLimit","gasLimitMax","gasLimit","value"],"sources":["../../../../src/tx/builder/field-types/gas-limit.ts"],"sourcesContent":["import { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag } from '../constants';\nimport shortUInt from './short-u-int';\nimport { buildFee } from './fee';\n\nfunction calculateGasLimitMax(\n txType: Tag,\n gasMax: number,\n rebuildTx: (value: number) => any,\n): number {\n return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);\n}\n\nexport default {\n ...shortUInt,\n\n serialize(\n _value: number | undefined,\n {\n txType, rebuildTx, gasMax = 6e6, _computingGasLimit,\n }: {\n txType: Tag;\n rebuildTx: (params: any) => any;\n gasMax: number;\n _computingGasLimit?: number;\n },\n ): Buffer {\n if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);\n\n const gasLimitMax = calculateGasLimitMax(\n txType,\n gasMax,\n (gasLimit) => rebuildTx({ _computingGasLimit: gasLimit }),\n );\n const value = _value ?? gasLimitMax;\n if (value > gasLimitMax) {\n throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);\n }\n return shortUInt.serialize(value);\n },\n};\n"],"mappings":"SAASA,oB;SACAC,a;OACFC,S;SACEC,Q;;AAET,SAASC,oBAAT,CACEC,MADF,EAEEC,MAFF,EAGEC,SAHF,EAIU;EACR,OAAOD,MAAM,GAAG,CAACH,QAAQ,CAACE,MAAD,EAASE,SAAS,CAACD,MAAD,CAAlB,CAAR,CAAoCE,SAApC,CAA8CP,aAA9C,CAAjB;AACD;;AAED,eAAe,EACb,GAAGC,SADU;;EAGbO,SAAS,CACPC,MADO,QAUC;IAAA,IARR;MACEL,MADF;MACUE,SADV;MACqBD,MAAM,GAAG,GAD9B;MACmCK;IADnC,CAQQ;IACR,IAAIA,kBAAkB,IAAI,IAA1B,EAAgC,OAAOT,SAAS,CAACO,SAAV,CAAoBE,kBAApB,CAAP;IAEhC,MAAMC,WAAW,GAAGR,oBAAoB,CACtCC,MADsC,EAEtCC,MAFsC,EAGrCO,QAAD,IAAcN,SAAS,CAAC;MAAEI,kBAAkB,EAAEE;IAAtB,CAAD,CAHe,CAAxC;IAKA,MAAMC,KAAK,GAAGJ,MAAH,aAAGA,MAAH,cAAGA,MAAH,GAAaE,WAAxB;;IACA,IAAIE,KAAK,GAAGF,WAAZ,EAAyB;MACvB,MAAM,IAAIZ,oBAAJ,CAA0B,aAAYc,KAAM,6BAA4BF,WAAY,EAApF,CAAN;IACD;;IACD,OAAOV,SAAS,CAACO,SAAV,CAAoBK,KAApB,CAAP;EACD;;AA1BY,CAAf"}
1
+ {"version":3,"file":"gas-limit.mjs","names":["IllegalArgumentError","MIN_GAS_PRICE","Tag","MAX_AUTH_FUN_GAS","shortUInt","buildFee","calculateGasLimitMax","txType","gasMax","rebuildTx","dividedBy","serialize","_value","_computingGasLimit","gasLimitMax","GaMetaTx","gasLimit","value"],"sources":["../../../../src/tx/builder/field-types/gas-limit.ts"],"sourcesContent":["import { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE, Tag, MAX_AUTH_FUN_GAS } from '../constants';\nimport shortUInt from './short-u-int';\nimport { buildFee } from './fee';\n\nfunction calculateGasLimitMax(\n txType: Tag,\n gasMax: number,\n rebuildTx: (value: number) => any,\n): number {\n return gasMax - +buildFee(txType, rebuildTx(gasMax)).dividedBy(MIN_GAS_PRICE);\n}\n\nexport default {\n ...shortUInt,\n\n serialize(\n _value: number | undefined,\n {\n txType, rebuildTx, gasMax = 6e6, _computingGasLimit,\n }: {\n txType: Tag;\n rebuildTx: (params: any) => any;\n gasMax: number;\n _computingGasLimit?: number;\n },\n ): Buffer {\n if (_computingGasLimit != null) return shortUInt.serialize(_computingGasLimit);\n\n const gasLimitMax = txType === Tag.GaMetaTx ? MAX_AUTH_FUN_GAS : calculateGasLimitMax(\n txType,\n gasMax,\n (gasLimit) => rebuildTx({ _computingGasLimit: gasLimit }),\n );\n const value = _value ?? gasLimitMax;\n if (value > gasLimitMax) {\n throw new IllegalArgumentError(`Gas limit ${value} must be less or equal to ${gasLimitMax}`);\n }\n return shortUInt.serialize(value);\n },\n};\n"],"mappings":"SAASA,oBAAoB;AAAA,SACpBC,aAAa,EAAEC,GAAG,EAAEC,gBAAgB;AAAA,OACtCC,SAAS;AAAA,SACPC,QAAQ;AAEjB,SAASC,oBAAoB,CAC3BC,MAAW,EACXC,MAAc,EACdC,SAAiC,EACzB;EACR,OAAOD,MAAM,GAAG,CAACH,QAAQ,CAACE,MAAM,EAAEE,SAAS,CAACD,MAAM,CAAC,CAAC,CAACE,SAAS,CAACT,aAAa,CAAC;AAC/E;AAEA,eAAe;EACb,GAAGG,SAAS;EAEZO,SAAS,CACPC,MAA0B,QASlB;IAAA,IARR;MACEL,MAAM;MAAEE,SAAS;MAAED,MAAM,GAAG,GAAG;MAAEK;IAMnC,CAAC;IAED,IAAIA,kBAAkB,IAAI,IAAI,EAAE,OAAOT,SAAS,CAACO,SAAS,CAACE,kBAAkB,CAAC;IAE9E,MAAMC,WAAW,GAAGP,MAAM,KAAKL,GAAG,CAACa,QAAQ,GAAGZ,gBAAgB,GAAGG,oBAAoB,CACnFC,MAAM,EACNC,MAAM,EACLQ,QAAQ,IAAKP,SAAS,CAAC;MAAEI,kBAAkB,EAAEG;IAAS,CAAC,CAAC,CAC1D;IACD,MAAMC,KAAK,GAAGL,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIE,WAAW;IACnC,IAAIG,KAAK,GAAGH,WAAW,EAAE;MACvB,MAAM,IAAId,oBAAoB,CAAE,aAAYiB,KAAM,6BAA4BH,WAAY,EAAC,CAAC;IAC9F;IACA,OAAOV,SAAS,CAACO,SAAS,CAACM,KAAK,CAAC;EACnC;AACF,CAAC"}
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  declare const _default: {
3
3
  serializeAettos(value?: string | undefined): string;
4
- serialize: (value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options) => Buffer;
5
- serializeOptional(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
4
+ serialize(value: import("./u-int").Int | undefined, { denomination, ...options }: import("./coin-amount").Options): Buffer;
6
5
  deserialize(value: Buffer): string;
7
6
  };
8
7
  export default _default;
@@ -1,18 +1,14 @@
1
1
  import coinAmount from "./coin-amount.mjs";
2
2
  import { IllegalArgumentError } from "../../../utils/errors.mjs";
3
3
  import { MIN_GAS_PRICE } from "../constants.mjs";
4
- export default { ...coinAmount,
5
-
4
+ export default {
5
+ ...coinAmount,
6
6
  serializeAettos() {
7
7
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : MIN_GAS_PRICE.toString();
8
-
9
8
  if (+value < MIN_GAS_PRICE) {
10
9
  throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);
11
10
  }
12
-
13
11
  return value;
14
- },
15
-
16
- serialize: coinAmount.serializeOptional
12
+ }
17
13
  };
18
14
  //# sourceMappingURL=gas-price.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","serializeAettos","value","toString","serialize","serializeOptional"],"sources":["../../../../src/tx/builder/field-types/gas-price.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE } from '../constants';\n\nexport default {\n ...coinAmount,\n\n serializeAettos(value: string | undefined = MIN_GAS_PRICE.toString()): string {\n if (+value < MIN_GAS_PRICE) {\n throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);\n }\n return value;\n },\n\n serialize: coinAmount.serializeOptional,\n};\n"],"mappings":"OAAOA,U;SACEC,oB;SACAC,a;AAET,eAAe,EACb,GAAGF,UADU;;EAGbG,eAAe,GAA+D;IAAA,IAA9DC,KAA8D,uEAAlCF,aAAa,CAACG,QAAd,EAAkC;;IAC5E,IAAI,CAACD,KAAD,GAASF,aAAb,EAA4B;MAC1B,MAAM,IAAID,oBAAJ,CAA0B,aAAYG,KAAK,CAACC,QAAN,EAAiB,wBAAuBH,aAAc,EAA5F,CAAN;IACD;;IACD,OAAOE,KAAP;EACD,CARY;;EAUbE,SAAS,EAAEN,UAAU,CAACO;AAVT,CAAf"}
1
+ {"version":3,"file":"gas-price.mjs","names":["coinAmount","IllegalArgumentError","MIN_GAS_PRICE","serializeAettos","value","toString"],"sources":["../../../../src/tx/builder/field-types/gas-price.ts"],"sourcesContent":["import coinAmount from './coin-amount';\nimport { IllegalArgumentError } from '../../../utils/errors';\nimport { MIN_GAS_PRICE } from '../constants';\n\nexport default {\n ...coinAmount,\n\n serializeAettos(value: string | undefined = MIN_GAS_PRICE.toString()): string {\n if (+value < MIN_GAS_PRICE) {\n throw new IllegalArgumentError(`Gas price ${value.toString()} must be bigger then ${MIN_GAS_PRICE}`);\n }\n return value;\n },\n};\n"],"mappings":"OAAOA,UAAU;AAAA,SACRC,oBAAoB;AAAA,SACpBC,aAAa;AAEtB,eAAe;EACb,GAAGF,UAAU;EAEbG,eAAe,GAA+D;IAAA,IAA9DC,KAAyB,uEAAGF,aAAa,CAACG,QAAQ,EAAE;IAClE,IAAI,CAACD,KAAK,GAAGF,aAAa,EAAE;MAC1B,MAAM,IAAID,oBAAoB,CAAE,aAAYG,KAAK,CAACC,QAAQ,EAAG,wBAAuBH,aAAc,EAAC,CAAC;IACtG;IACA,OAAOE,KAAK;EACd;AACF,CAAC"}