@aeternity/aepp-sdk 12.1.3 → 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 -8859
  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 +86 -47
  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 -508
  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 -537
  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
@@ -10,11 +10,9 @@ import { concatBuffers } from "../../utils/other.mjs";
10
10
  import { NAME_BID_RANGES, NAME_BID_TIMEOUT_BLOCKS, NAME_FEE_BID_INCREMENT, NAME_MAX_LENGTH_FEE } from "./constants.mjs";
11
11
  import { ceil } from "../../utils/bignumber.mjs";
12
12
  import { ArgumentError, IllegalBidFeeError } from "../../utils/errors.mjs";
13
- import { readId, writeId } from "./address.mjs";
14
13
  /**
15
14
  * JavaScript-based Transaction builder helper function's
16
15
  */
17
-
18
16
  /**
19
17
  * Build a contract public key
20
18
  * @category contract
@@ -22,13 +20,12 @@ import { readId, writeId } from "./address.mjs";
22
20
  * @param nonce - the nonce of the transaction
23
21
  * @returns Contract public key
24
22
  */
25
-
26
23
  export function buildContractId(ownerId, nonce) {
27
24
  const ownerIdAndNonce = _Buffer.from([...decode(ownerId), ...toBytes(nonce)]);
28
-
29
25
  const b2bHash = hash(ownerIdAndNonce);
30
26
  return encode(b2bHash, Encoding.ContractAddress);
31
27
  }
28
+
32
29
  /**
33
30
  * Build a oracle query id
34
31
  * @category oracle
@@ -37,141 +34,92 @@ export function buildContractId(ownerId, nonce) {
37
34
  * @param oracleId - The oracle public key
38
35
  * @returns Contract public key
39
36
  */
40
-
41
37
  export function oracleQueryId(senderId, nonce, oracleId) {
42
38
  function _int32(val) {
43
39
  const nonceBE = toBytes(val, true);
44
40
  return concatBuffers([_Buffer.alloc(32 - nonceBE.length), nonceBE]);
45
41
  }
46
-
47
42
  const b2bHash = hash(_Buffer.from([...decode(senderId), ..._int32(nonce), ...decode(oracleId)]));
48
43
  return encode(b2bHash, Encoding.OracleQueryId);
49
44
  }
50
- /**
51
- * Format the salt into a 64-byte hex string
52
- * @category transaction builder
53
- * @param salt - Random number
54
- * @returns Zero-padded hex string of salt
55
- */
56
45
 
57
- export function formatSalt(salt) {
58
- return _Buffer.from(salt.toString(16).padStart(64, '0'), 'hex');
59
- }
60
46
  /**
61
47
  * Encode an AENS name
62
48
  * @category AENS
63
49
  * @param name - Name to encode
64
50
  * @returns `nm_` prefixed encoded AENS name
65
51
  */
66
-
67
52
  export function produceNameId(name) {
68
53
  return encode(hash(name.toLowerCase()), Encoding.Name);
69
54
  }
55
+
70
56
  /**
71
- * Generate the commitment hash by hashing the formatted salt and
57
+ * Generate the commitment hash by hashing the salt and
72
58
  * name, base 58 encoding the result and prepending 'cm_'
73
59
  * @category transaction builder
74
60
  * @param name - Name to be registered
75
- * @param salt - Random salt
61
+ * @param salt - Random number
76
62
  * @returns Commitment hash
77
63
  */
78
-
79
64
  export function commitmentHash(name) {
80
65
  let salt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : genSalt();
81
- return encode(hash(concatBuffers([_Buffer.from(name.toLowerCase()), formatSalt(salt)])), Encoding.Commitment);
66
+ return encode(hash(concatBuffers([_Buffer.from(name.toLowerCase()), _Buffer.from(salt.toString(16).padStart(64, '0'), 'hex')])), Encoding.Commitment);
82
67
  }
83
- /**
84
- * Utility function to convert int to bytes
85
- * @category transaction builder
86
- * @param val - Value
87
- * @returns Buffer Buffer from number(BigEndian)
88
- */
89
68
 
90
- export function writeInt(val) {
91
- return toBytes(val, true);
92
- }
93
69
  /**
94
70
  * Utility function to convert bytes to int
95
71
  * @category transaction builder
96
72
  * @param buf - Value
97
73
  * @returns Buffer Buffer from number(BigEndian)
98
74
  */
99
-
100
75
  export function readInt() {
101
76
  let buf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _Buffer.from([]);
102
77
  return new BigNumber(_Buffer.from(buf).toString('hex'), 16).toString(10);
103
78
  }
104
- /**
105
- * Helper function to build pointers for name update TX
106
- * @category transaction builder
107
- * @param pointers - Array of pointers
108
- * `([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])`
109
- * @returns Serialized pointers array
110
- */
111
-
112
- export function buildPointers(pointers) {
113
- return pointers.map(p => [toBytes(p.key), writeId(p.id)]);
114
- }
115
- /**
116
- * Helper function to read pointers from name update TX
117
- * @category transaction builder
118
- * @param pointers - Array of pointers
119
- * @returns Deserialize pointer array
120
- */
121
-
122
- export function readPointers(pointers) {
123
- return pointers.map(_ref => {
124
- let [key, id] = _ref;
125
- return {
126
- key: key.toString(),
127
- id: readId(id)
128
- };
129
- });
130
- }
131
79
  const AENS_SUFFIX = '.chain';
80
+
132
81
  /**
133
82
  * Is AENS name valid
134
83
  * @category AENS
135
84
  * @param name - AENS name
136
85
  */
137
-
138
86
  export function isNameValid(name) {
139
87
  // TODO: probably there are stronger requirements
140
88
  return name.endsWith(AENS_SUFFIX);
141
89
  }
142
90
  const encodingToPointerKey = [[Encoding.AccountAddress, 'account_pubkey'], [Encoding.OracleAddress, 'oracle_pubkey'], [Encoding.ContractAddress, 'contract_pubkey'], [Encoding.Channel, 'channel']];
91
+
143
92
  /**
144
93
  * @category AENS
145
94
  * @param identifier - account/oracle/contract address, or channel
146
95
  * @returns default AENS pointer key
147
96
  */
148
-
149
97
  export function getDefaultPointerKey(identifier) {
150
98
  var _encodingToPointerKey;
151
-
152
99
  decode(identifier);
153
100
  const encoding = identifier.substring(0, 2);
154
- const result = (_encodingToPointerKey = encodingToPointerKey.find(_ref2 => {
155
- let [e] = _ref2;
101
+ const result = (_encodingToPointerKey = encodingToPointerKey.find(_ref => {
102
+ let [e] = _ref;
156
103
  return e === encoding;
157
104
  })) === null || _encodingToPointerKey === void 0 ? void 0 : _encodingToPointerKey[1];
158
105
  if (result != null) return result;
159
- throw new ArgumentError('identifier', `prefixed with one of ${encodingToPointerKey.map(_ref3 => {
160
- let [e] = _ref3;
106
+ throw new ArgumentError('identifier', `prefixed with one of ${encodingToPointerKey.map(_ref2 => {
107
+ let [e] = _ref2;
161
108
  return `${e}_`;
162
109
  }).join(', ')}`, identifier);
163
110
  }
111
+
164
112
  /**
165
113
  * Get the minimum AENS name fee
166
114
  * @category AENS
167
115
  * @param name - the AENS name to get the fee for
168
116
  * @returns the minimum fee for the AENS name auction
169
117
  */
170
-
171
118
  export function getMinimumNameFee(name) {
172
119
  const nameLength = name.length - AENS_SUFFIX.length;
173
120
  return NAME_BID_RANGES[Math.min(nameLength, NAME_MAX_LENGTH_FEE)];
174
121
  }
122
+
175
123
  /**
176
124
  * Compute bid fee for AENS auction
177
125
  * @category AENS
@@ -181,17 +129,17 @@ export function getMinimumNameFee(name) {
181
129
  * @param options.increment - Bid multiplier(In percentage, must be between 0 and 1)
182
130
  * @returns Bid fee
183
131
  */
184
-
185
132
  export function computeBidFee(name) {
186
133
  let {
187
134
  startFee,
188
135
  increment = NAME_FEE_BID_INCREMENT
189
136
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
190
137
  if (!(Number(increment) === increment && increment % 1 !== 0)) throw new IllegalBidFeeError(`Increment must be float. Current increment ${increment}`);
191
- if (increment < NAME_FEE_BID_INCREMENT) throw new IllegalBidFeeError(`minimum increment percentage is ${NAME_FEE_BID_INCREMENT}`); // FIXME: increment should be used somehow here
192
-
138
+ if (increment < NAME_FEE_BID_INCREMENT) throw new IllegalBidFeeError(`minimum increment percentage is ${NAME_FEE_BID_INCREMENT}`);
139
+ // FIXME: increment should be used somehow here
193
140
  return ceil(new BigNumber(startFee !== null && startFee !== void 0 ? startFee : getMinimumNameFee(name)).times(new BigNumber(NAME_FEE_BID_INCREMENT).plus(1)));
194
141
  }
142
+
195
143
  /**
196
144
  * Compute auction end height
197
145
  * @category AENS
@@ -200,17 +148,17 @@ export function computeBidFee(name) {
200
148
  * @see {@link https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273}
201
149
  * @returns Auction end height
202
150
  */
203
-
204
151
  export function computeAuctionEndBlock(name, claimHeight) {
152
+ var _ref3, _ref4, _ref5;
205
153
  const length = name.length - AENS_SUFFIX.length;
206
- const h = length <= 4 && 62 * NAME_BID_TIMEOUT_BLOCKS || length <= 8 && 31 * NAME_BID_TIMEOUT_BLOCKS || length <= 12 && NAME_BID_TIMEOUT_BLOCKS || 0;
154
+ const h = (_ref3 = (_ref4 = (_ref5 = length <= 4 ? 62 * NAME_BID_TIMEOUT_BLOCKS : null) !== null && _ref5 !== void 0 ? _ref5 : length <= 8 ? 31 * NAME_BID_TIMEOUT_BLOCKS : null) !== null && _ref4 !== void 0 ? _ref4 : length <= 12 ? NAME_BID_TIMEOUT_BLOCKS : null) !== null && _ref3 !== void 0 ? _ref3 : 0;
207
155
  return h + claimHeight;
208
156
  }
157
+
209
158
  /**
210
159
  * Is name accept going to auction
211
160
  * @category AENS
212
161
  */
213
-
214
162
  export function isAuctionName(name) {
215
163
  return name.length < 13 + AENS_SUFFIX.length;
216
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":["BigNumber","genSalt","hash","decode","encode","Encoding","toBytes","concatBuffers","NAME_BID_RANGES","NAME_BID_TIMEOUT_BLOCKS","NAME_FEE_BID_INCREMENT","NAME_MAX_LENGTH_FEE","ceil","ArgumentError","IllegalBidFeeError","readId","writeId","buildContractId","ownerId","nonce","ownerIdAndNonce","from","b2bHash","ContractAddress","oracleQueryId","senderId","oracleId","_int32","val","nonceBE","alloc","length","OracleQueryId","formatSalt","salt","toString","padStart","produceNameId","name","toLowerCase","Name","commitmentHash","Commitment","writeInt","readInt","buf","buildPointers","pointers","map","p","key","id","readPointers","AENS_SUFFIX","isNameValid","endsWith","encodingToPointerKey","AccountAddress","OracleAddress","Channel","getDefaultPointerKey","identifier","encoding","substring","result","find","e","join","getMinimumNameFee","nameLength","Math","min","computeBidFee","startFee","increment","Number","times","plus","computeAuctionEndBlock","claimHeight","h","isAuctionName"],"sources":["../../../src/tx/builder/helpers.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { genSalt, hash } from '../../utils/crypto';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../utils/encoder';\nimport { toBytes } from '../../utils/bytes';\nimport { concatBuffers } from '../../utils/other';\nimport {\n AensName,\n NAME_BID_RANGES,\n NAME_BID_TIMEOUT_BLOCKS,\n NAME_FEE_BID_INCREMENT,\n NAME_MAX_LENGTH_FEE,\n} from './constants';\nimport { ceil } from '../../utils/bignumber';\nimport { ArgumentError, IllegalBidFeeError } from '../../utils/errors';\nimport { NamePointer } from '../../apis/node';\nimport { readId, writeId } from './address';\n\n/**\n * JavaScript-based Transaction builder helper function's\n */\n\n/**\n * Build a contract public key\n * @category contract\n * @param ownerId - The public key of the owner account\n * @param nonce - the nonce of the transaction\n * @returns Contract public key\n */\nexport function buildContractId(\n ownerId: Encoded.AccountAddress,\n nonce: number | BigNumber,\n): Encoded.ContractAddress {\n const ownerIdAndNonce = Buffer.from([...decode(ownerId), ...toBytes(nonce)]);\n const b2bHash = hash(ownerIdAndNonce);\n return encode(b2bHash, Encoding.ContractAddress);\n}\n\n/**\n * Build a oracle query id\n * @category oracle\n * @param senderId - The public key of the sender account\n * @param nonce - the nonce of the transaction\n * @param oracleId - The oracle public key\n * @returns Contract public key\n */\nexport function oracleQueryId(\n senderId: Encoded.AccountAddress,\n nonce: number | BigNumber | string,\n oracleId: Encoded.OracleAddress,\n): Encoded.OracleQueryId {\n function _int32(val: number | string | BigNumber): Buffer {\n const nonceBE = toBytes(val, true);\n return concatBuffers([Buffer.alloc(32 - nonceBE.length), nonceBE]);\n }\n\n const b2bHash = hash(\n Buffer.from([...decode(senderId), ..._int32(nonce), ...decode(oracleId)]),\n );\n return encode(b2bHash, Encoding.OracleQueryId);\n}\n\n/**\n * Format the salt into a 64-byte hex string\n * @category transaction builder\n * @param salt - Random number\n * @returns Zero-padded hex string of salt\n */\nexport function formatSalt(salt: number): Buffer {\n return Buffer.from(salt.toString(16).padStart(64, '0'), 'hex');\n}\n\n/**\n * Encode an AENS name\n * @category AENS\n * @param name - Name to encode\n * @returns `nm_` prefixed encoded AENS name\n */\nexport function produceNameId(name: AensName): Encoded.Name {\n return encode(hash(name.toLowerCase()), Encoding.Name);\n}\n\n/**\n * Generate the commitment hash by hashing the formatted salt and\n * name, base 58 encoding the result and prepending 'cm_'\n * @category transaction builder\n * @param name - Name to be registered\n * @param salt - Random salt\n * @returns Commitment hash\n */\nexport function commitmentHash(\n name: AensName,\n salt: number = genSalt(),\n): Encoded.Commitment {\n return encode(\n hash(concatBuffers([Buffer.from(name.toLowerCase()), formatSalt(salt)])),\n Encoding.Commitment,\n );\n}\n\n/**\n * Utility function to convert int to bytes\n * @category transaction builder\n * @param val - Value\n * @returns Buffer Buffer from number(BigEndian)\n */\nexport function writeInt(val: number | string | BigNumber): Buffer {\n return toBytes(val, true);\n}\n\n/**\n * Utility function to convert bytes to int\n * @category transaction builder\n * @param buf - Value\n * @returns Buffer Buffer from number(BigEndian)\n */\nexport function readInt(buf: Buffer = Buffer.from([])): string {\n return new BigNumber(Buffer.from(buf).toString('hex'), 16).toString(10);\n}\n\n/**\n * Helper function to build pointers for name update TX\n * @category transaction builder\n * @param pointers - Array of pointers\n * `([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])`\n * @returns Serialized pointers array\n */\nexport function buildPointers(pointers: NamePointer[]): Buffer[][] {\n return pointers.map(\n (p) => [\n toBytes(p.key),\n writeId(p.id as Parameters<typeof writeId>[0]),\n ],\n );\n}\n\n/**\n * Helper function to read pointers from name update TX\n * @category transaction builder\n * @param pointers - Array of pointers\n * @returns Deserialize pointer array\n */\nexport function readPointers(pointers: Array<[key: string, id: Buffer]>): NamePointer[] {\n return pointers.map(\n ([key, id]) => ({\n key: key.toString(),\n id: readId(id),\n }),\n );\n}\n\nconst AENS_SUFFIX = '.chain';\n\n/**\n * Is AENS name valid\n * @category AENS\n * @param name - AENS name\n */\nexport function isNameValid(name: string): name is AensName {\n // TODO: probably there are stronger requirements\n return name.endsWith(AENS_SUFFIX);\n}\n\nconst encodingToPointerKey = [\n [Encoding.AccountAddress, 'account_pubkey'],\n [Encoding.OracleAddress, 'oracle_pubkey'],\n [Encoding.ContractAddress, 'contract_pubkey'],\n [Encoding.Channel, 'channel'],\n] as const;\n\n/**\n * @category AENS\n * @param identifier - account/oracle/contract address, or channel\n * @returns default AENS pointer key\n */\nexport function getDefaultPointerKey(\n identifier: Encoded.Generic<typeof encodingToPointerKey[number][0]>,\n): typeof encodingToPointerKey[number][1] {\n decode(identifier);\n const encoding = identifier.substring(0, 2);\n const result = encodingToPointerKey.find(([e]) => e === encoding)?.[1];\n if (result != null) return result;\n throw new ArgumentError(\n 'identifier',\n `prefixed with one of ${encodingToPointerKey.map(([e]) => `${e}_`).join(', ')}`,\n identifier,\n );\n}\n\n/**\n * Get the minimum AENS name fee\n * @category AENS\n * @param name - the AENS name to get the fee for\n * @returns the minimum fee for the AENS name auction\n */\nexport function getMinimumNameFee(name: AensName): BigNumber {\n const nameLength = name.length - AENS_SUFFIX.length;\n return NAME_BID_RANGES[Math.min(nameLength, NAME_MAX_LENGTH_FEE)];\n}\n\n/**\n * Compute bid fee for AENS auction\n * @category AENS\n * @param name - the AENS name to get the fee for\n * @param options - Options\n * @param options.startFee - Auction start fee\n * @param options.increment - Bid multiplier(In percentage, must be between 0 and 1)\n * @returns Bid fee\n */\nexport function computeBidFee(\n name: AensName,\n { startFee, increment = NAME_FEE_BID_INCREMENT }:\n { startFee?: number | string | BigNumber; increment?: number } = {},\n): BigNumber {\n if (!(Number(increment) === increment && increment % 1 !== 0)) throw new IllegalBidFeeError(`Increment must be float. Current increment ${increment}`);\n if (increment < NAME_FEE_BID_INCREMENT) throw new IllegalBidFeeError(`minimum increment percentage is ${NAME_FEE_BID_INCREMENT}`);\n // FIXME: increment should be used somehow here\n return ceil(\n new BigNumber(startFee ?? getMinimumNameFee(name))\n .times(new BigNumber(NAME_FEE_BID_INCREMENT).plus(1)),\n );\n}\n\n/**\n * Compute auction end height\n * @category AENS\n * @param name - Name to compute auction end for\n * @param claimHeight - Auction starting height\n * @see {@link https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273}\n * @returns Auction end height\n */\nexport function computeAuctionEndBlock(name: AensName, claimHeight: number): number {\n const length = name.length - AENS_SUFFIX.length;\n const h = (length <= 4 && 62 * NAME_BID_TIMEOUT_BLOCKS)\n || (length <= 8 && 31 * NAME_BID_TIMEOUT_BLOCKS)\n || (length <= 12 && NAME_BID_TIMEOUT_BLOCKS)\n || 0;\n return h + claimHeight;\n}\n\n/**\n * Is name accept going to auction\n * @category AENS\n */\nexport function isAuctionName(name: AensName): boolean {\n return name.length < 13 + AENS_SUFFIX.length;\n}\n"],"mappings":";;;;AAAA,OAAOA,SAAP,MAAsB,cAAtB;SACSC,O,EAASC,I;SAEhBC,M,EAAQC,M,EAAiBC,Q;SAElBC,O;SACAC,a;SAGPC,e,EACAC,uB,EACAC,sB,EACAC,mB;SAEOC,I;SACAC,a,EAAeC,kB;SAEfC,M,EAAQC,O;AAEjB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,eAAT,CACLC,OADK,EAELC,KAFK,EAGoB;EACzB,MAAMC,eAAe,GAAG,QAAOC,IAAP,CAAY,CAAC,GAAGlB,MAAM,CAACe,OAAD,CAAV,EAAqB,GAAGZ,OAAO,CAACa,KAAD,CAA/B,CAAZ,CAAxB;;EACA,MAAMG,OAAO,GAAGpB,IAAI,CAACkB,eAAD,CAApB;EACA,OAAOhB,MAAM,CAACkB,OAAD,EAAUjB,QAAQ,CAACkB,eAAnB,CAAb;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CACLC,QADK,EAELN,KAFK,EAGLO,QAHK,EAIkB;EACvB,SAASC,MAAT,CAAgBC,GAAhB,EAA0D;IACxD,MAAMC,OAAO,GAAGvB,OAAO,CAACsB,GAAD,EAAM,IAAN,CAAvB;IACA,OAAOrB,aAAa,CAAC,CAAC,QAAOuB,KAAP,CAAa,KAAKD,OAAO,CAACE,MAA1B,CAAD,EAAoCF,OAApC,CAAD,CAApB;EACD;;EAED,MAAMP,OAAO,GAAGpB,IAAI,CAClB,QAAOmB,IAAP,CAAY,CAAC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A,QAAd,cAAcA,QAAd,GAA0BL,iBAAiB,CAAC9B,IAAD,CAA3C,EACGsC,KADH,CACS,IAAI5E,SAAJ,CAAcU,sBAAd,EAAsCmE,IAAtC,CAA2C,CAA3C,CADT,CADS,CAAX;AAID;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CAAgCxC,IAAhC,EAAgDyC,WAAhD,EAA6E;EAClF,MAAMhD,MAAM,GAAGO,IAAI,CAACP,MAAL,GAAcsB,WAAW,CAACtB,MAAzC;EACA,MAAMiD,CAAC,GAAIjD,MAAM,IAAI,CAAV,IAAe,KAAKtB,uBAArB,IACJsB,MAAM,IAAI,CAAV,IAAe,KAAKtB,uBADhB,IAEJsB,MAAM,IAAI,EAAV,IAAgBtB,uBAFZ,IAGL,CAHL;EAIA,OAAOuE,CAAC,GAAGD,WAAX;AACD;AAED;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,CAAuB3C,IAAvB,EAAgD;EACrD,OAAOA,IAAI,CAACP,MAAL,GAAc,KAAKsB,WAAW,CAACtB,MAAtC;AACD"}
1
+ {"version":3,"file":"helpers.mjs","names":["BigNumber","genSalt","hash","decode","encode","Encoding","toBytes","concatBuffers","NAME_BID_RANGES","NAME_BID_TIMEOUT_BLOCKS","NAME_FEE_BID_INCREMENT","NAME_MAX_LENGTH_FEE","ceil","ArgumentError","IllegalBidFeeError","buildContractId","ownerId","nonce","ownerIdAndNonce","from","b2bHash","ContractAddress","oracleQueryId","senderId","oracleId","_int32","val","nonceBE","alloc","length","OracleQueryId","produceNameId","name","toLowerCase","Name","commitmentHash","salt","toString","padStart","Commitment","readInt","buf","AENS_SUFFIX","isNameValid","endsWith","encodingToPointerKey","AccountAddress","OracleAddress","Channel","getDefaultPointerKey","identifier","encoding","substring","result","find","e","map","join","getMinimumNameFee","nameLength","Math","min","computeBidFee","startFee","increment","Number","times","plus","computeAuctionEndBlock","claimHeight","h","isAuctionName"],"sources":["../../../src/tx/builder/helpers.ts"],"sourcesContent":["import BigNumber from 'bignumber.js';\nimport { genSalt, hash } from '../../utils/crypto';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../../utils/encoder';\nimport { toBytes } from '../../utils/bytes';\nimport { concatBuffers } from '../../utils/other';\nimport {\n AensName,\n NAME_BID_RANGES,\n NAME_BID_TIMEOUT_BLOCKS,\n NAME_FEE_BID_INCREMENT,\n NAME_MAX_LENGTH_FEE,\n} from './constants';\nimport { ceil } from '../../utils/bignumber';\nimport { ArgumentError, IllegalBidFeeError } from '../../utils/errors';\n\n/**\n * JavaScript-based Transaction builder helper function's\n */\n\n/**\n * Build a contract public key\n * @category contract\n * @param ownerId - The public key of the owner account\n * @param nonce - the nonce of the transaction\n * @returns Contract public key\n */\nexport function buildContractId(\n ownerId: Encoded.AccountAddress,\n nonce: number | BigNumber,\n): Encoded.ContractAddress {\n const ownerIdAndNonce = Buffer.from([...decode(ownerId), ...toBytes(nonce)]);\n const b2bHash = hash(ownerIdAndNonce);\n return encode(b2bHash, Encoding.ContractAddress);\n}\n\n/**\n * Build a oracle query id\n * @category oracle\n * @param senderId - The public key of the sender account\n * @param nonce - the nonce of the transaction\n * @param oracleId - The oracle public key\n * @returns Contract public key\n */\nexport function oracleQueryId(\n senderId: Encoded.AccountAddress,\n nonce: number | BigNumber | string,\n oracleId: Encoded.OracleAddress,\n): Encoded.OracleQueryId {\n function _int32(val: number | string | BigNumber): Buffer {\n const nonceBE = toBytes(val, true);\n return concatBuffers([Buffer.alloc(32 - nonceBE.length), nonceBE]);\n }\n\n const b2bHash = hash(\n Buffer.from([...decode(senderId), ..._int32(nonce), ...decode(oracleId)]),\n );\n return encode(b2bHash, Encoding.OracleQueryId);\n}\n\n/**\n * Encode an AENS name\n * @category AENS\n * @param name - Name to encode\n * @returns `nm_` prefixed encoded AENS name\n */\nexport function produceNameId(name: AensName): Encoded.Name {\n return encode(hash(name.toLowerCase()), Encoding.Name);\n}\n\n/**\n * Generate the commitment hash by hashing the salt and\n * name, base 58 encoding the result and prepending 'cm_'\n * @category transaction builder\n * @param name - Name to be registered\n * @param salt - Random number\n * @returns Commitment hash\n */\nexport function commitmentHash(\n name: AensName,\n salt: number = genSalt(),\n): Encoded.Commitment {\n return encode(\n hash(concatBuffers([\n Buffer.from(name.toLowerCase()),\n Buffer.from(salt.toString(16).padStart(64, '0'), 'hex'),\n ])),\n Encoding.Commitment,\n );\n}\n\n/**\n * Utility function to convert bytes to int\n * @category transaction builder\n * @param buf - Value\n * @returns Buffer Buffer from number(BigEndian)\n */\nexport function readInt(buf: Buffer = Buffer.from([])): string {\n return new BigNumber(Buffer.from(buf).toString('hex'), 16).toString(10);\n}\n\nconst AENS_SUFFIX = '.chain';\n\n/**\n * Is AENS name valid\n * @category AENS\n * @param name - AENS name\n */\nexport function isNameValid(name: string): name is AensName {\n // TODO: probably there are stronger requirements\n return name.endsWith(AENS_SUFFIX);\n}\n\nconst encodingToPointerKey = [\n [Encoding.AccountAddress, 'account_pubkey'],\n [Encoding.OracleAddress, 'oracle_pubkey'],\n [Encoding.ContractAddress, 'contract_pubkey'],\n [Encoding.Channel, 'channel'],\n] as const;\n\n/**\n * @category AENS\n * @param identifier - account/oracle/contract address, or channel\n * @returns default AENS pointer key\n */\nexport function getDefaultPointerKey(\n identifier: Encoded.Generic<typeof encodingToPointerKey[number][0]>,\n): typeof encodingToPointerKey[number][1] {\n decode(identifier);\n const encoding = identifier.substring(0, 2);\n const result = encodingToPointerKey.find(([e]) => e === encoding)?.[1];\n if (result != null) return result;\n throw new ArgumentError(\n 'identifier',\n `prefixed with one of ${encodingToPointerKey.map(([e]) => `${e}_`).join(', ')}`,\n identifier,\n );\n}\n\n/**\n * Get the minimum AENS name fee\n * @category AENS\n * @param name - the AENS name to get the fee for\n * @returns the minimum fee for the AENS name auction\n */\nexport function getMinimumNameFee(name: AensName): BigNumber {\n const nameLength = name.length - AENS_SUFFIX.length;\n return NAME_BID_RANGES[Math.min(nameLength, NAME_MAX_LENGTH_FEE)];\n}\n\n/**\n * Compute bid fee for AENS auction\n * @category AENS\n * @param name - the AENS name to get the fee for\n * @param options - Options\n * @param options.startFee - Auction start fee\n * @param options.increment - Bid multiplier(In percentage, must be between 0 and 1)\n * @returns Bid fee\n */\nexport function computeBidFee(\n name: AensName,\n { startFee, increment = NAME_FEE_BID_INCREMENT }:\n { startFee?: number | string | BigNumber; increment?: number } = {},\n): BigNumber {\n if (!(Number(increment) === increment && increment % 1 !== 0)) throw new IllegalBidFeeError(`Increment must be float. Current increment ${increment}`);\n if (increment < NAME_FEE_BID_INCREMENT) throw new IllegalBidFeeError(`minimum increment percentage is ${NAME_FEE_BID_INCREMENT}`);\n // FIXME: increment should be used somehow here\n return ceil(\n new BigNumber(startFee ?? getMinimumNameFee(name))\n .times(new BigNumber(NAME_FEE_BID_INCREMENT).plus(1)),\n );\n}\n\n/**\n * Compute auction end height\n * @category AENS\n * @param name - Name to compute auction end for\n * @param claimHeight - Auction starting height\n * @see {@link https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273}\n * @returns Auction end height\n */\nexport function computeAuctionEndBlock(name: AensName, claimHeight: number): number {\n const length = name.length - AENS_SUFFIX.length;\n const h = (length <= 4 ? 62 * NAME_BID_TIMEOUT_BLOCKS : null)\n ?? (length <= 8 ? 31 * NAME_BID_TIMEOUT_BLOCKS : null)\n ?? (length <= 12 ? NAME_BID_TIMEOUT_BLOCKS : null)\n ?? 0;\n return h + claimHeight;\n}\n\n/**\n * Is name accept going to auction\n * @category AENS\n */\nexport function isAuctionName(name: AensName): boolean {\n return name.length < 13 + AENS_SUFFIX.length;\n}\n"],"mappings":";;;;AAAA,OAAOA,SAAS,MAAM,cAAc;AAAC,SAC5BC,OAAO,EAAEC,IAAI;AAAA,SAEpBC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,OAAO;AAAA,SACPC,aAAa;AAAA,SAGpBC,eAAe,EACfC,uBAAuB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CAAC+D,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIL,iBAAiB,CAAC1B,IAAI,CAAC,CAAC,CAC/CkC,KAAK,CAAC,IAAIlE,SAAS,CAACU,sBAAsB,CAAC,CAACyD,IAAI,CAAC,CAAC,CAAC,CAAC,CACxD;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsB,CAACpC,IAAc,EAAEqC,WAAmB,EAAU;EAAA;EAClF,MAAMxC,MAAM,GAAGG,IAAI,CAACH,MAAM,GAAGa,WAAW,CAACb,MAAM;EAC/C,MAAMyC,CAAC,8BAAIzC,MAAM,IAAI,CAAC,GAAG,EAAE,GAAGpB,uBAAuB,GAAG,IAAI,yCACtDoB,MAAM,IAAI,CAAC,GAAG,EAAE,GAAGpB,uBAAuB,GAAG,IAAI,yCACjDoB,MAAM,IAAI,EAAE,GAAGpB,uBAAuB,GAAG,IAAI,yCAC9C,CAAC;EACN,OAAO6D,CAAC,GAAGD,WAAW;AACxB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,aAAa,CAACvC,IAAc,EAAW;EACrD,OAAOA,IAAI,CAACH,MAAM,GAAG,EAAE,GAAGa,WAAW,CAACb,MAAM;AAC9C"}
@@ -1,27 +1,7 @@
1
- import { NestedUint8Array } from 'rlp';
2
1
  import { Encoded, Encoding } from '../../utils/encoder';
3
2
  import { AE_AMOUNT_FORMATS } from '../../utils/amount-formatter';
4
- import { RawTxObject, TxField, TxSchema, TxTypeSchemas } from './schema';
3
+ import { RawTxObject, TxSchema, TxTypeSchemas } from './schema';
5
4
  import { Tag } from './constants';
6
- /**
7
- * Validate transaction params
8
- * @category transaction builder
9
- * @param params - Object with tx params
10
- * @param schema - Transaction schema
11
- * @param excludeKeys - Array of keys to exclude for validation
12
- * @returns Object with validation errors
13
- */
14
- export declare function validateParams(params: any, schema: TxField[], { excludeKeys }: {
15
- excludeKeys: string[];
16
- }): object;
17
- /**
18
- * Unpack binary transaction
19
- * @category transaction builder
20
- * @param binary - Array with binary transaction field's
21
- * @param schema - Transaction schema
22
- * @returns Object with transaction field's
23
- */
24
- export declare function unpackRawTx<Tx extends TxSchema>(binary: Uint8Array | NestedUint8Array, schema: TxField[]): RawTxObject<Tx>;
25
5
  /**
26
6
  * @category transaction builder
27
7
  */