@aeternity/aepp-sdk 11.0.0 → 12.1.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 (442) hide show
  1. package/LICENSE +1 -1
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +0 -22
  4. package/dist/aepp-sdk.browser-script.js.map +1 -1
  5. package/dist/aepp-sdk.browser.js +2 -1
  6. package/dist/aepp-sdk.browser.js.LICENSE.txt +1 -0
  7. package/dist/aepp-sdk.browser.js.map +1 -1
  8. package/dist/aepp-sdk.js +20764 -1
  9. package/dist/aepp-sdk.js.map +1 -1
  10. package/es/AeSdk.d.ts +37 -0
  11. package/es/AeSdk.mjs +81 -0
  12. package/es/AeSdk.mjs.map +1 -0
  13. package/es/AeSdkAepp.d.ts +70 -0
  14. package/es/AeSdkAepp.mjs +176 -0
  15. package/es/AeSdkAepp.mjs.map +1 -0
  16. package/es/AeSdkBase.d.ts +213 -0
  17. package/es/AeSdkBase.mjs +314 -0
  18. package/es/AeSdkBase.mjs.map +1 -0
  19. package/es/AeSdkWallet.d.ts +104 -0
  20. package/es/AeSdkWallet.mjs +326 -0
  21. package/es/AeSdkWallet.mjs.map +1 -0
  22. package/es/Node.d.ts +41 -0
  23. package/es/Node.mjs +147 -0
  24. package/es/Node.mjs.map +1 -0
  25. package/es/account/Base.d.ts +68 -0
  26. package/es/account/Base.mjs +123 -0
  27. package/es/account/Base.mjs.map +1 -0
  28. package/es/account/Memory.d.ts +26 -0
  29. package/es/account/Memory.mjs +103 -0
  30. package/es/account/Memory.mjs.map +1 -0
  31. package/es/account/Rpc.d.ts +27 -0
  32. package/es/account/Rpc.mjs +80 -0
  33. package/es/account/Rpc.mjs.map +1 -0
  34. package/es/aens.d.ts +222 -0
  35. package/es/aens.mjs +338 -0
  36. package/es/aens.mjs.map +1 -0
  37. package/es/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs +73 -0
  39. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +18 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +58 -0
  42. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +146 -0
  45. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  46. package/es/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  47. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +16 -11
  48. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
  51. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
  52. package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
  54. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
  55. package/es/aepp-wallet-communication/schema.d.ts +105 -46
  56. package/es/aepp-wallet-communication/schema.mjs +251 -0
  57. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  58. package/es/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs +62 -0
  60. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  61. package/es/apis/compiler/compiler.d.ts +92 -0
  62. package/es/apis/compiler/compiler.mjs +576 -0
  63. package/es/apis/compiler/compiler.mjs.map +1 -0
  64. package/es/apis/compiler/index.d.ts +2 -0
  65. package/es/apis/compiler/index.mjs +3 -0
  66. package/es/apis/compiler/index.mjs.map +1 -0
  67. package/es/apis/compiler/models/index.d.ts +248 -0
  68. package/es/apis/compiler/models/index.mjs +48 -0
  69. package/es/apis/compiler/models/index.mjs.map +1 -0
  70. package/es/apis/compiler/models/mappers.d.ts +23 -0
  71. package/es/apis/compiler/models/mappers.mjs +585 -0
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -0
  73. package/es/apis/compiler/models/parameters.d.ts +13 -0
  74. package/es/apis/compiler/models/parameters.mjs +71 -0
  75. package/es/apis/compiler/models/parameters.mjs.map +1 -0
  76. package/es/apis/node/index.d.ts +2 -0
  77. package/es/apis/node/index.mjs +3 -0
  78. package/es/apis/node/index.mjs.map +1 -0
  79. package/es/apis/node/models/index.d.ts +1065 -0
  80. package/es/apis/node/models/index.mjs +2 -0
  81. package/es/apis/node/models/index.mjs.map +1 -0
  82. package/es/apis/node/models/mappers.d.ts +95 -0
  83. package/es/apis/node/models/mappers.mjs +4166 -0
  84. package/es/apis/node/models/mappers.mjs.map +1 -0
  85. package/es/apis/node/models/parameters.d.ts +17 -0
  86. package/es/apis/node/models/parameters.mjs +165 -0
  87. package/es/apis/node/models/parameters.mjs.map +1 -0
  88. package/es/apis/node/node.d.ts +215 -0
  89. package/es/apis/node/node.mjs +1165 -0
  90. package/es/apis/node/node.mjs.map +1 -0
  91. package/es/chain.d.ts +248 -0
  92. package/es/chain.mjs +560 -0
  93. package/es/chain.mjs.map +1 -0
  94. package/es/channel/handlers.d.ts +34 -0
  95. package/es/channel/handlers.mjs +164 -131
  96. package/es/channel/handlers.mjs.map +1 -1
  97. package/es/channel/index.d.ts +625 -0
  98. package/es/channel/index.mjs +897 -902
  99. package/es/channel/index.mjs.map +1 -1
  100. package/es/channel/internal.d.ts +101 -0
  101. package/es/channel/internal.mjs +138 -88
  102. package/es/channel/internal.mjs.map +1 -1
  103. package/es/contract/Compiler.d.ts +18 -0
  104. package/es/contract/Compiler.mjs +68 -0
  105. package/es/contract/Compiler.mjs.map +1 -0
  106. package/es/contract/aci.d.ts +127 -0
  107. package/es/contract/aci.mjs +225 -193
  108. package/es/contract/aci.mjs.map +1 -1
  109. package/es/contract/ga.d.ts +69 -0
  110. package/es/contract/ga.mjs +195 -0
  111. package/es/contract/ga.mjs.map +1 -0
  112. package/es/contract/methods.d.ts +71 -0
  113. package/es/contract/methods.mjs +104 -0
  114. package/es/contract/methods.mjs.map +1 -0
  115. package/es/deprecated/index.d.ts +143 -0
  116. package/es/deprecated/index.mjs +162 -0
  117. package/es/deprecated/index.mjs.map +1 -0
  118. package/es/deprecated/methods.d.ts +18 -0
  119. package/es/deprecated/methods.mjs +26 -0
  120. package/es/deprecated/methods.mjs.map +1 -0
  121. package/es/index.d.ts +35 -0
  122. package/es/index.mjs +35 -40
  123. package/es/index.mjs.map +1 -1
  124. package/es/oracle.d.ts +161 -0
  125. package/es/oracle.mjs +306 -0
  126. package/es/oracle.mjs.map +1 -0
  127. package/es/spend.d.ts +62 -0
  128. package/es/spend.mjs +111 -0
  129. package/es/spend.mjs.map +1 -0
  130. package/es/tx/builder/address.d.ts +25 -0
  131. package/es/tx/builder/address.mjs +45 -0
  132. package/es/tx/builder/address.mjs.map +1 -0
  133. package/es/tx/builder/constants.d.ts +70 -0
  134. package/es/tx/builder/constants.mjs +122 -0
  135. package/es/tx/builder/constants.mjs.map +1 -0
  136. package/es/tx/builder/field-types/coin-amount.d.ts +13 -0
  137. package/es/tx/builder/field-types/coin-amount.mjs +26 -0
  138. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -0
  139. package/es/tx/builder/field-types/deposit.d.ts +15 -0
  140. package/es/tx/builder/field-types/deposit.mjs +19 -0
  141. package/es/tx/builder/field-types/deposit.mjs.map +1 -0
  142. package/es/tx/builder/field-types/fee.d.ts +25 -0
  143. package/es/tx/builder/field-types/fee.mjs +150 -0
  144. package/es/tx/builder/field-types/fee.mjs.map +1 -0
  145. package/es/tx/builder/field-types/field.d.ts +6 -0
  146. package/es/tx/builder/field-types/field.mjs +15 -0
  147. package/es/tx/builder/field-types/field.mjs.map +1 -0
  148. package/es/tx/builder/field-types/gas-limit.d.ts +12 -0
  149. package/es/tx/builder/field-types/gas-limit.mjs +33 -0
  150. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -0
  151. package/es/tx/builder/field-types/gas-price.d.ts +8 -0
  152. package/es/tx/builder/field-types/gas-price.mjs +18 -0
  153. package/es/tx/builder/field-types/gas-price.mjs.map +1 -0
  154. package/es/tx/builder/field-types/index.d.ts +70 -0
  155. package/es/tx/builder/field-types/index.mjs +25 -0
  156. package/es/tx/builder/field-types/index.mjs.map +1 -0
  157. package/es/tx/builder/field-types/name-fee.d.ts +20 -0
  158. package/es/tx/builder/field-types/name-fee.mjs +24 -0
  159. package/es/tx/builder/field-types/name-fee.mjs.map +1 -0
  160. package/es/tx/builder/field-types/name-id.d.ts +14 -0
  161. package/es/tx/builder/field-types/name-id.mjs +19 -0
  162. package/es/tx/builder/field-types/name-id.mjs.map +1 -0
  163. package/es/tx/builder/field-types/name.d.ts +13 -0
  164. package/es/tx/builder/field-types/name.mjs +18 -0
  165. package/es/tx/builder/field-types/name.mjs.map +1 -0
  166. package/es/tx/builder/field-types/short-u-int.d.ts +6 -0
  167. package/es/tx/builder/field-types/short-u-int.mjs +12 -0
  168. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -0
  169. package/es/tx/builder/field-types/u-int.d.ts +8 -0
  170. package/es/tx/builder/field-types/u-int.mjs +14 -0
  171. package/es/tx/builder/field-types/u-int.mjs.map +1 -0
  172. package/es/tx/builder/helpers.d.ts +125 -0
  173. package/es/tx/builder/helpers.mjs +94 -240
  174. package/es/tx/builder/helpers.mjs.map +1 -1
  175. package/es/tx/builder/index.d.ts +88 -0
  176. package/es/tx/builder/index.mjs +167 -358
  177. package/es/tx/builder/index.mjs.map +1 -1
  178. package/es/tx/builder/schema.d.ts +1201 -0
  179. package/es/tx/builder/schema.mjs +175 -664
  180. package/es/tx/builder/schema.mjs.map +1 -1
  181. package/es/tx/index.d.ts +64 -0
  182. package/es/tx/index.mjs +151 -265
  183. package/es/tx/index.mjs.map +1 -1
  184. package/es/tx/validator.d.ts +20 -0
  185. package/es/tx/validator.mjs +104 -124
  186. package/es/tx/validator.mjs.map +1 -1
  187. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  188. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  189. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  190. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  191. package/es/typings/bip32-path/index.d.mjs +2 -0
  192. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  193. package/es/typings/blakejs/index.d.mjs.map +1 -1
  194. package/es/typings/sha-js/index.d.mjs +2 -0
  195. package/es/typings/sha-js/index.d.mjs.map +1 -0
  196. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  197. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  198. package/es/utils/amount-formatter.d.ts +42 -0
  199. package/es/utils/amount-formatter.mjs +36 -49
  200. package/es/utils/amount-formatter.mjs.map +1 -1
  201. package/es/utils/autorest.d.ts +6 -0
  202. package/es/utils/autorest.mjs +97 -0
  203. package/es/utils/autorest.mjs.map +1 -0
  204. package/es/utils/bignumber.d.ts +13 -0
  205. package/es/utils/bignumber.mjs +11 -8
  206. package/es/utils/bignumber.mjs.map +1 -1
  207. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  208. package/es/utils/bytes.mjs +11 -15
  209. package/es/utils/bytes.mjs.map +1 -1
  210. package/es/utils/crypto.d.ts +88 -0
  211. package/es/utils/crypto.mjs +64 -108
  212. package/es/utils/crypto.mjs.map +1 -1
  213. package/es/utils/encoder-types.d.ts +61 -0
  214. package/es/utils/encoder-types.mjs +36 -0
  215. package/es/utils/encoder-types.mjs.map +1 -0
  216. package/es/utils/encoder.d.ts +25 -0
  217. package/es/utils/encoder.mjs +118 -0
  218. package/es/utils/encoder.mjs.map +1 -0
  219. package/es/{errors.d.ts → utils/errors.d.ts} +246 -59
  220. package/es/utils/errors.mjs +313 -136
  221. package/es/utils/errors.mjs.map +1 -1
  222. package/es/utils/hd-wallet.d.ts +50 -0
  223. package/es/utils/hd-wallet.mjs +86 -45
  224. package/es/utils/hd-wallet.mjs.map +1 -1
  225. package/es/utils/json-big.d.ts +5 -0
  226. package/es/utils/json-big.mjs +12 -16
  227. package/es/utils/json-big.mjs.map +1 -1
  228. package/es/utils/keystore.d.ts +51 -0
  229. package/es/utils/keystore.mjs +101 -194
  230. package/es/utils/keystore.mjs.map +1 -1
  231. package/es/{mptree.d.ts → utils/mptree.d.ts} +6 -9
  232. package/es/utils/mptree.mjs +22 -18
  233. package/es/utils/mptree.mjs.map +1 -1
  234. package/es/utils/other.d.ts +20 -0
  235. package/es/utils/other.mjs +32 -35
  236. package/es/utils/other.mjs.map +1 -1
  237. package/es/utils/semver-satisfies.d.ts +1 -0
  238. package/es/utils/semver-satisfies.mjs +2 -2
  239. package/es/utils/semver-satisfies.mjs.map +1 -1
  240. package/es/utils/string.d.ts +24 -0
  241. package/es/utils/string.mjs +8 -10
  242. package/es/utils/string.mjs.map +1 -1
  243. package/package.json +56 -42
  244. package/src/AeSdk.ts +68 -0
  245. package/src/AeSdkAepp.ts +176 -0
  246. package/src/AeSdkBase.ts +338 -0
  247. package/src/AeSdkWallet.ts +348 -0
  248. package/src/Node.ts +173 -0
  249. package/src/account/Base.ts +124 -0
  250. package/src/account/Memory.ts +98 -0
  251. package/src/account/Rpc.ts +69 -0
  252. package/src/aens.ts +407 -0
  253. package/src/aepp-wallet-communication/connection/Browser.ts +71 -0
  254. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +59 -0
  255. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +122 -0
  256. package/{es/utils/crypto-ts.mjs → src/aepp-wallet-communication/connection-proxy.ts} +18 -18
  257. package/src/aepp-wallet-communication/rpc/RpcClient.ts +143 -0
  258. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  259. package/src/aepp-wallet-communication/schema.ts +224 -0
  260. package/src/aepp-wallet-communication/wallet-detector.ts +72 -0
  261. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  262. package/src/apis/compiler/compiler.ts +585 -0
  263. package/src/apis/compiler/index.ts +2 -0
  264. package/src/apis/compiler/models/index.ts +301 -0
  265. package/src/apis/compiler/models/mappers.ts +583 -0
  266. package/src/apis/compiler/models/parameters.ts +93 -0
  267. package/src/apis/node/code-model-v4.yaml +10080 -0
  268. package/src/apis/node/index.ts +2 -0
  269. package/src/apis/node/models/index.ts +1257 -0
  270. package/src/apis/node/models/mappers.ts +4280 -0
  271. package/src/apis/node/models/parameters.ts +188 -0
  272. package/src/apis/node/node.ts +1299 -0
  273. package/src/chain.ts +502 -0
  274. package/src/channel/handlers.ts +817 -0
  275. package/src/channel/index.ts +1025 -0
  276. package/src/channel/internal.ts +361 -0
  277. package/src/contract/Compiler.ts +67 -0
  278. package/src/contract/aci.ts +538 -0
  279. package/src/contract/ga.ts +199 -0
  280. package/src/contract/methods.ts +123 -0
  281. package/src/deprecated/index.ts +170 -0
  282. package/src/deprecated/methods.ts +25 -0
  283. package/src/index.ts +56 -0
  284. package/src/oracle.ts +364 -0
  285. package/src/spend.ts +164 -0
  286. package/src/tx/builder/address.ts +50 -0
  287. package/src/tx/builder/constants.ts +126 -0
  288. package/src/tx/builder/field-types/coin-amount.ts +27 -0
  289. package/src/tx/builder/field-types/deposit.ts +21 -0
  290. package/src/tx/builder/field-types/fee.ts +143 -0
  291. package/src/tx/builder/field-types/field.ts +9 -0
  292. package/src/tx/builder/field-types/gas-limit.ts +41 -0
  293. package/src/tx/builder/field-types/gas-price.ts +16 -0
  294. package/src/tx/builder/field-types/index.ts +45 -0
  295. package/src/tx/builder/field-types/name-fee.ts +32 -0
  296. package/src/tx/builder/field-types/name-id.ts +20 -0
  297. package/src/tx/builder/field-types/name.ts +18 -0
  298. package/src/tx/builder/field-types/short-u-int.ts +11 -0
  299. package/src/tx/builder/field-types/u-int.ts +16 -0
  300. package/src/tx/builder/helpers.ts +248 -0
  301. package/src/tx/builder/index.ts +400 -0
  302. package/src/tx/builder/schema.ts +727 -0
  303. package/src/tx/index.ts +192 -0
  304. package/src/tx/validator.ts +230 -0
  305. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  306. package/src/typings/@aeternity__uuid/index.d.ts +5 -0
  307. package/src/typings/bip32-path/index.d.ts +33 -0
  308. package/src/typings/blakejs/index.d.ts +4 -32
  309. package/src/typings/sha-js/index.d.ts +5 -0
  310. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  311. package/src/utils/amount-formatter.ts +56 -69
  312. package/src/utils/autorest.ts +93 -0
  313. package/src/utils/bignumber.ts +11 -12
  314. package/src/utils/bytes.ts +29 -31
  315. package/src/utils/crypto.ts +205 -0
  316. package/src/utils/encoder-types.ts +63 -0
  317. package/src/utils/encoder.ts +146 -0
  318. package/src/utils/errors.ts +482 -366
  319. package/src/utils/hd-wallet.ts +166 -0
  320. package/src/utils/json-big.ts +27 -0
  321. package/src/utils/keystore.ts +182 -0
  322. package/src/utils/mptree.ts +64 -61
  323. package/src/utils/other.ts +34 -41
  324. package/src/utils/semver-satisfies.ts +15 -11
  325. package/src/utils/string.ts +18 -20
  326. package/es/account/base.mjs +0 -179
  327. package/es/account/base.mjs.map +0 -1
  328. package/es/account/memory.mjs +0 -99
  329. package/es/account/memory.mjs.map +0 -1
  330. package/es/account/multiple.mjs +0 -179
  331. package/es/account/multiple.mjs.map +0 -1
  332. package/es/ae/aens.mjs +0 -404
  333. package/es/ae/aens.mjs.map +0 -1
  334. package/es/ae/aepp.mjs +0 -45
  335. package/es/ae/aepp.mjs.map +0 -1
  336. package/es/ae/contract.mjs +0 -159
  337. package/es/ae/contract.mjs.map +0 -1
  338. package/es/ae/index.mjs +0 -207
  339. package/es/ae/index.mjs.map +0 -1
  340. package/es/ae/oracle.mjs +0 -339
  341. package/es/ae/oracle.mjs.map +0 -1
  342. package/es/ae/universal.mjs +0 -45
  343. package/es/ae/universal.mjs.map +0 -1
  344. package/es/ae/wallet.mjs +0 -50
  345. package/es/ae/wallet.mjs.map +0 -1
  346. package/es/amount-formatter.d.ts +0 -58
  347. package/es/bignumber.d.ts +0 -18
  348. package/es/chain/index.mjs +0 -272
  349. package/es/chain/index.mjs.map +0 -1
  350. package/es/chain/node.mjs +0 -442
  351. package/es/chain/node.mjs.map +0 -1
  352. package/es/contract/compiler.mjs +0 -115
  353. package/es/contract/compiler.mjs.map +0 -1
  354. package/es/contract/ga/helpers.mjs +0 -30
  355. package/es/contract/ga/helpers.mjs.map +0 -1
  356. package/es/contract/ga/index.mjs +0 -178
  357. package/es/contract/ga/index.mjs.map +0 -1
  358. package/es/crypto-ts.d.ts +0 -9
  359. package/es/node-pool/index.mjs +0 -188
  360. package/es/node-pool/index.mjs.map +0 -1
  361. package/es/node.mjs +0 -133
  362. package/es/node.mjs.map +0 -1
  363. package/es/other.d.ts +0 -31
  364. package/es/semver-satisfies.d.ts +0 -1
  365. package/es/string.d.ts +0 -26
  366. package/es/tx/builder/field-types.mjs +0 -74
  367. package/es/tx/builder/field-types.mjs.map +0 -1
  368. package/es/tx/tx-object.mjs +0 -283
  369. package/es/tx/tx-object.mjs.map +0 -1
  370. package/es/tx/tx.mjs +0 -938
  371. package/es/tx/tx.mjs.map +0 -1
  372. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs +0 -132
  373. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +0 -1
  374. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +0 -183
  375. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +0 -1
  376. package/es/utils/aepp-wallet-communication/connection/index.mjs +0 -87
  377. package/es/utils/aepp-wallet-communication/connection/index.mjs.map +0 -1
  378. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs +0 -98
  379. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +0 -1
  380. package/es/utils/aepp-wallet-communication/helpers.mjs +0 -92
  381. package/es/utils/aepp-wallet-communication/helpers.mjs.map +0 -1
  382. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +0 -375
  383. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +0 -1
  384. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +0 -275
  385. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +0 -1
  386. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +0 -541
  387. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +0 -1
  388. package/es/utils/aepp-wallet-communication/schema.mjs +0 -102
  389. package/es/utils/aepp-wallet-communication/schema.mjs.map +0 -1
  390. package/es/utils/aepp-wallet-communication/wallet-detector.mjs +0 -110
  391. package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +0 -1
  392. package/es/utils/async-init.mjs +0 -64
  393. package/es/utils/async-init.mjs.map +0 -1
  394. package/es/utils/crypto-ts.mjs.map +0 -1
  395. package/es/utils/swagger.mjs +0 -164
  396. package/es/utils/swagger.mjs.map +0 -1
  397. package/src/account/base.js +0 -153
  398. package/src/account/memory.js +0 -83
  399. package/src/account/multiple.js +0 -162
  400. package/src/ae/aens.js +0 -361
  401. package/src/ae/aepp.js +0 -45
  402. package/src/ae/contract.js +0 -148
  403. package/src/ae/index.js +0 -168
  404. package/src/ae/oracle.js +0 -311
  405. package/src/ae/universal.js +0 -47
  406. package/src/ae/wallet.js +0 -50
  407. package/src/chain/index.js +0 -269
  408. package/src/chain/node.js +0 -320
  409. package/src/channel/handlers.js +0 -673
  410. package/src/channel/index.js +0 -898
  411. package/src/channel/internal.js +0 -237
  412. package/src/contract/aci.js +0 -376
  413. package/src/contract/compiler.js +0 -100
  414. package/src/contract/ga/helpers.js +0 -19
  415. package/src/contract/ga/index.js +0 -150
  416. package/src/index.js +0 -89
  417. package/src/node-pool/index.js +0 -172
  418. package/src/node.js +0 -116
  419. package/src/tx/builder/field-types.js +0 -61
  420. package/src/tx/builder/helpers.js +0 -380
  421. package/src/tx/builder/index.js +0 -465
  422. package/src/tx/builder/schema.js +0 -1197
  423. package/src/tx/index.js +0 -301
  424. package/src/tx/tx-object.js +0 -187
  425. package/src/tx/tx.js +0 -631
  426. package/src/tx/validator.js +0 -181
  427. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -119
  428. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -165
  429. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  430. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -86
  431. package/src/utils/aepp-wallet-communication/helpers.js +0 -60
  432. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -294
  433. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -232
  434. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -401
  435. package/src/utils/aepp-wallet-communication/schema.ts +0 -80
  436. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -92
  437. package/src/utils/async-init.js +0 -45
  438. package/src/utils/crypto.js +0 -229
  439. package/src/utils/hd-wallet.js +0 -100
  440. package/src/utils/json-big.js +0 -26
  441. package/src/utils/keystore.js +0 -219
  442. package/src/utils/swagger.js +0 -156
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/tx/builder/helpers.js"],"names":["BigNumber","bs58","hash","salt","sha256hash","toBytes","ID_TAG_PREFIX","PREFIX_ID_TAG","NAME_BID_RANGES","NAME_FEE_BID_INCREMENT","NAME_BID_TIMEOUTS","NAME_MAX_LENGTH_FEE","POINTER_KEY_BY_PREFIX","ceil","PrefixMismatchError","DecodeError","EncodeError","PayloadLengthError","TagNotFoundError","PrefixNotFoundError","InvalidNameError","IllegalBidFeeError","NoDefaultAensPointerError","ArgumentError","InvalidChecksumError","createSalt","buildContractId","ownerId","nonce","ownerIdAndNonce","from","decode","b2bHash","encode","oracleQueryId","senderId","oracleId","_int32","val","nonceBE","concat","alloc","length","formatSalt","toString","padStart","produceNameId","name","ensureNameValid","toLowerCase","commitmentHash","base64Types","base58Types","typesLength","ak","ct","ok","ensureValidLength","data","type","getChecksum","payload","slice","addChecksum","input","getPayload","buffer","equals","base64","string","base58","requiredPrefix","prefix","encodedPayload","extra","split","decoder","includes","encoder","writeId","hashId","idTag","readId","buf","tag","readUIntBE","writeInt","readInt","buildPointers","pointers","map","p","key","id","readPointers","Object","assign","AENS_SUFFIX","endsWith","isNameValid","error","getDefaultPointerKey","identifier","substr","getMinimumNameFee","nameLength","Math","min","computeBidFee","startFee","increment","Number","times","plus","computeAuctionEndBlock","claimHeight","h","isAuctionName"],"mappings":";;;;AAAA,OAAOA,SAAP,MAAsB,cAAtB;AACA,OAAOC,IAAP,MAAiB,MAAjB;SACSC,I,EAAMC,I,EAAMC,U;SACZC,O;SAEPC,a,EACAC,a,EACAC,e,EACAC,sB,EACAC,iB,EACAC,mB,EACAC,qB;SAEOC,I;SAEPC,mB,EACAC,W,EACAC,W,EACAC,kB,EACAC,gB,EACAC,mB,EACAC,gB,EACAC,kB,EACAC,yB,EACAC,a,EACAC,oB;AAGF;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,UAAU,GAAGtB,IAAnB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASuB,eAAT,CAA0BC,OAA1B,EAAmCC,KAAnC,EAA0C;AAC/C,QAAMC,eAAe,GAAG,QAAOC,IAAP,CAAY,CAAC,GAAGC,MAAM,CAACJ,OAAD,EAAU,IAAV,CAAV,EAA2B,GAAGtB,OAAO,CAACuB,KAAD,CAArC,CAAZ,CAAxB;;AACA,QAAMI,OAAO,GAAG9B,IAAI,CAAC2B,eAAD,CAApB;AACA,SAAOI,MAAM,CAACD,OAAD,EAAU,IAAV,CAAb;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,aAAT,CAAwBC,QAAxB,EAAkCP,KAAlC,EAAyCQ,QAAzC,EAAmD;AACxD,WAASC,MAAT,CAAiB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,CAAuC,CAAvC,CAArD,CADS,CAAX;AAGD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CAAiCnE,IAAjC,EAAuCoE,WAAvC,EAAoD;AACzDnE,EAAAA,eAAe,CAACD,IAAD,CAAf;AACA,QAAML,MAAM,GAAGK,IAAI,CAACL,MAAL,GAAcuD,WAAW,CAACvD,MAAzC;AACA,QAAM0E,CAAC,GAAI1E,MAAM,IAAI,CAAV,IAAehC,iBAAiB,CAAC,CAAD,CAAjC,IACPgC,MAAM,IAAI,CAAV,IAAehC,iBAAiB,CAAC,CAAD,CADzB,IAEPgC,MAAM,IAAI,EAAV,IAAgBhC,iBAAiB,CAAC,EAAD,CAF1B,IAGRA,iBAAiB,CAAC,EAAD,CAHnB;AAIA,SAAO0G,CAAC,CAACH,IAAF,CAAOE,WAAP,EAAoBvE,QAApB,CAA6B,EAA7B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASyE,aAAT,CAAwBtE,IAAxB,EAA8B;AACnCC,EAAAA,eAAe,CAACD,IAAD,CAAf;AACA,SAAOA,IAAI,CAACL,MAAL,GAAc,KAAKuD,WAAW,CAACvD,MAAtC;AACD","sourcesContent":["import BigNumber from 'bignumber.js'\nimport bs58 from 'bs58'\nimport { hash, salt, sha256hash } from '../../utils/crypto'\nimport { toBytes } from '../../utils/bytes'\nimport {\n ID_TAG_PREFIX,\n PREFIX_ID_TAG,\n NAME_BID_RANGES,\n NAME_FEE_BID_INCREMENT,\n NAME_BID_TIMEOUTS,\n NAME_MAX_LENGTH_FEE,\n POINTER_KEY_BY_PREFIX\n} from './schema'\nimport { ceil } from '../../utils/bignumber'\nimport {\n PrefixMismatchError,\n DecodeError,\n EncodeError,\n PayloadLengthError,\n TagNotFoundError,\n PrefixNotFoundError,\n InvalidNameError,\n IllegalBidFeeError,\n NoDefaultAensPointerError,\n ArgumentError,\n InvalidChecksumError\n} from '../../utils/errors'\n\n/**\n * JavaScript-based Transaction builder helper function's\n * @module @aeternity/aepp-sdk/es/tx/builder/helpers\n * @export TxBuilderHelper\n * @example import { TxBuilderHelper } from '@aeternity/aepp-sdk'\n */\n\nexport const createSalt = salt\n\n/**\n * Build a contract public key\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {string} ownerId The public key of the owner account\n * @param {number} nonce the nonce of the transaction\n * @return {string} Contract public key\n */\nexport function buildContractId (ownerId, nonce) {\n const ownerIdAndNonce = Buffer.from([...decode(ownerId, 'ak'), ...toBytes(nonce)])\n const b2bHash = hash(ownerIdAndNonce)\n return encode(b2bHash, 'ct')\n}\n\n/**\n * Build a oracle query id\n * @function\n * @function* @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {String} senderId The public key of the sender account\n * @param {Number} nonce the nonce of the transaction\n * @param {Number} oracleId The oracle public key\n * @return {string} Contract public key\n */\nexport function oracleQueryId (senderId, nonce, oracleId) {\n function _int32 (val) {\n const nonceBE = toBytes(val, true)\n return Buffer.concat([Buffer.alloc(32 - nonceBE.length), nonceBE])\n }\n\n const b2bHash = hash(Buffer.from([...decode(senderId, 'ak'), ..._int32(nonce), ...decode(oracleId, 'ok')]))\n return encode(b2bHash, 'oq')\n}\n\n/**\n * Format the salt into a 64-byte hex string\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {number} salt\n * @return {string} Zero-padded hex string of salt\n */\nexport function formatSalt (salt) {\n return Buffer.from(salt.toString(16).padStart(64, '0'), 'hex')\n}\n\n/**\n * Encode an AENS name\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {String} name Name to encode\n * @return {String} `nm_` prefixed encoded AENS name\n */\nexport function produceNameId (name) {\n ensureNameValid(name)\n return encode(hash(name.toLowerCase()), 'nm')\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 *\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @function commitmentHash\n * @category async\n * @rtype (name: String, salt?: String) => hash: Promise[String]\n * @param {String} name - Name to be registered\n * @param {Number} salt Random salt\n * @return {String} Commitment hash\n */\nexport function commitmentHash (name, salt = createSalt()) {\n ensureNameValid(name)\n return encode(hash(Buffer.concat([Buffer.from(name.toLowerCase()), formatSalt(salt)])), 'cm')\n}\n\n// based on https://github.com/aeternity/protocol/blob/master/node/api/api_encoding.md\nconst base64Types = ['ba', 'cb', 'or', 'ov', 'pi', 'ss', 'cs', 'ck', 'cv', 'st', 'tx']\nconst base58Types = ['ak', 'bf', 'bs', 'bx', 'ch', 'cm', 'ct', 'kh', 'mh', 'nm', 'ok', 'oq', 'pp', 'sg', 'th']\n// TODO: add all types with a fixed length\nconst typesLength = {\n ak: 32,\n ct: 32,\n ok: 32\n}\n\nfunction ensureValidLength (data, type) {\n if (!typesLength[type]) return\n if (data.length === typesLength[type]) return\n throw new PayloadLengthError(`Payload should be ${typesLength[type]} bytes, got ${data.length} instead`)\n}\n\nconst getChecksum = payload => sha256hash(sha256hash(payload)).slice(0, 4)\n\nconst addChecksum = (input) => {\n const payload = Buffer.from(input)\n return Buffer.concat([payload, getChecksum(payload)])\n}\n\nfunction getPayload (buffer) {\n const payload = buffer.slice(0, -4)\n if (!getChecksum(payload).equals(buffer.slice(-4))) throw new InvalidChecksumError()\n return payload\n}\n\nconst base64 = {\n encode: buffer => addChecksum(buffer).toString('base64'),\n decode: string => getPayload(Buffer.from(string, 'base64'))\n}\n\nconst base58 = {\n encode: buffer => bs58.encode(addChecksum(buffer)),\n decode: string => getPayload(bs58.decode(string))\n}\n\n/**\n * Decode data using the default encoding/decoding algorithm\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {string} data An Base58/64check encoded and prefixed string (ex tx_..., sg_..., ak_....)\n * @param {string} [requiredPrefix] Ensure that data have this prefix\n * @return {Buffer} Decoded data\n */\nexport function decode (data, requiredPrefix) {\n if (typeof data !== 'string') throw new DecodeError(`Encoded should be a string, got ${data} instead`)\n const [prefix, encodedPayload, extra] = data.split('_')\n if (!encodedPayload) throw new DecodeError(`Encoded string missing payload: ${data}`)\n if (extra) throw new DecodeError(`Encoded string have extra parts: ${data}`)\n if (requiredPrefix && requiredPrefix !== prefix) {\n throw new PrefixMismatchError(prefix, requiredPrefix)\n }\n const decoder = (base64Types.includes(prefix) && base64.decode) ||\n (base58Types.includes(prefix) && base58.decode)\n if (!decoder) {\n throw new DecodeError(`Encoded string have unknown type: ${prefix}`)\n }\n const payload = decoder(encodedPayload)\n ensureValidLength(payload, prefix)\n return payload\n}\n\n/**\n * Encode data using the default encoding/decoding algorithm\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {Buffer|String} data An decoded data\n * @param {string} type Prefix of Transaction\n * @return {String} Encoded string Base58check or Base64check data\n */\nexport function encode (data, type) {\n const encoder = (base64Types.includes(type) && base64.encode) ||\n (base58Types.includes(type) && base58.encode)\n if (!encoder) {\n throw new EncodeError(`Unknown type: ${type}`)\n }\n ensureValidLength(data, type)\n return `${type}_${encoder(data)}`\n}\n\n/**\n * Utility function to create and _id type\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {string} hashId Encoded hash\n * @return {Buffer} Buffer Buffer with ID tag and decoded HASh\n */\nexport function writeId (hashId) {\n if (typeof hashId !== 'string') throw new ArgumentError('hashId', 'a string', hashId)\n const prefix = hashId.slice(0, 2)\n const idTag = PREFIX_ID_TAG[prefix]\n if (!idTag) throw new TagNotFoundError(prefix)\n return Buffer.from([...toBytes(idTag), ...decode(hashId, prefix)])\n}\n\n/**\n * Utility function to read and _id type\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {Buffer} buf Data\n * @return {String} Encoided hash string with prefix\n */\nexport function readId (buf) {\n const tag = Buffer.from(buf).readUIntBE(0, 1)\n const prefix = ID_TAG_PREFIX[tag]\n if (!prefix) throw new PrefixNotFoundError(tag)\n return encode(buf.slice(1, buf.length), prefix)\n}\n\n/**\n * Utility function to convert int to bytes\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {Number|String|BigNumber} val Value\n * @return {Buffer} Buffer Buffer from number(BigEndian)\n */\nexport function writeInt (val) {\n return toBytes(val, true)\n}\n\n/**\n * Utility function to convert bytes to int\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {Buffer} buf Value\n * @return {String} Buffer Buffer from number(BigEndian)\n */\nexport function readInt (buf = Buffer.from([])) {\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 * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {Array} pointers - Array of pointers\n * ([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])\n * @return {Array} Serialized pointers array\n */\nexport function buildPointers (pointers) {\n return pointers.map(\n p => [\n toBytes(p.key),\n writeId(p.id)\n ]\n )\n}\n\n/**\n * Helper function to read pointers from name update TX\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {Array} pointers - Array of pointers\n * ([ { key: 'account_pubkey', id: 'ak_32klj5j23k23j5423l434l2j3423'} ])\n * @return {Array} Deserialize pointer array\n */\nexport function readPointers (pointers) {\n return pointers.map(\n ([key, id]) => Object.assign({\n key: key.toString(),\n id: readId(id)\n })\n )\n}\n\nconst AENS_SUFFIX = '.chain'\n\n/**\n * Ensure that AENS name is valid\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {string} name\n * @return void\n * @throws Error\n */\nexport function ensureNameValid (name) {\n if (!name || typeof name !== 'string') throw new InvalidNameError('Name must be a string')\n if (!name.endsWith(AENS_SUFFIX)) throw new InvalidNameError(`Name should end with ${AENS_SUFFIX}: ${name}`)\n}\n\n/**\n * Is AENS name valid\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {string} name\n * @return Boolean\n */\nexport function isNameValid (name) {\n try {\n ensureNameValid(name)\n return true\n } catch (error) {\n return false\n }\n}\n\n/**\n * @param identifier - account/oracle/contract address, or channel\n * @returns {String} default AENS pointer key\n * @throws exception when default key not defined\n */\nexport function getDefaultPointerKey (identifier) {\n decode(identifier)\n const prefix = identifier.substr(0, 2)\n return POINTER_KEY_BY_PREFIX[prefix] ||\n (() => { throw new NoDefaultAensPointerError(prefix) })()\n}\n\n/**\n * Get the minimum AENS name fee\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {String} name the AENS name to get the fee for\n * @return {String} the minimum fee for the AENS name auction\n */\nexport function getMinimumNameFee (name) {\n ensureNameValid(name)\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 * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {String} name the AENS name to get the fee for\n * @param {Number|String} startFee Auction start fee\n * @param {Number} [increment=0.5] Bid multiplier(In percentage, must be between 0 and 1)\n * @return {String} Bid fee\n */\nexport function computeBidFee (name, startFee, increment = NAME_FEE_BID_INCREMENT) {\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 return ceil(\n BigNumber(startFee ?? getMinimumNameFee(name)).times(BigNumber(NAME_FEE_BID_INCREMENT).plus(1))\n )\n}\n\n/**\n * Compute auction end height\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {String} name\n * @param {Number|String} claimHeight Auction starting height\n * @return {String} Auction end height\n */\nexport function computeAuctionEndBlock (name, claimHeight) {\n ensureNameValid(name)\n const length = name.length - AENS_SUFFIX.length\n const h = (length <= 4 && NAME_BID_TIMEOUTS[4]) ||\n (length <= 8 && NAME_BID_TIMEOUTS[8]) ||\n (length <= 12 && NAME_BID_TIMEOUTS[12]) ||\n NAME_BID_TIMEOUTS[13]\n return h.plus(claimHeight).toString(10)\n}\n\n/**\n * Is name accept going to auction\n * @function\n * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers\n * @param {String} name\n * @return {Boolean}\n */\nexport function isAuctionName (name) {\n ensureNameValid(name)\n return name.length < 13 + AENS_SUFFIX.length\n}\n"],"file":"helpers.mjs"}
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,GAAGlB,MAAM,CAACsB,QAAD,CAAV,EAAsB,GAAGE,MAAM,CAACR,K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GsC,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"}
@@ -0,0 +1,88 @@
1
+ import { NestedUint8Array } from 'rlp';
2
+ import { Encoded, Encoding } from '../../utils/encoder';
3
+ import { AE_AMOUNT_FORMATS } from '../../utils/amount-formatter';
4
+ import { RawTxObject, TxField, TxSchema, TxTypeSchemas } from './schema';
5
+ 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
+ /**
26
+ * @category transaction builder
27
+ */
28
+ export interface BuiltTx<Tx extends TxSchema, Prefix extends Encoding> {
29
+ tx: Encoded.Generic<Prefix>;
30
+ rlpEncoded: Uint8Array;
31
+ binary: Uint8Array;
32
+ txObject: RawTxObject<Tx>;
33
+ }
34
+ /**
35
+ * Build transaction hash
36
+ * @category transaction builder
37
+ * @param _params - Object with tx params
38
+ * @param type - Transaction type
39
+ * @param options - options
40
+ * @param options.excludeKeys - Array of keys to exclude for validation and build
41
+ * @param options.denomination - Denomination of amounts
42
+ * @param options.prefix - Prefix of transaction
43
+ * @throws {@link InvalidTxParamsError}
44
+ * @returns object
45
+ * @returns object.tx Base64Check transaction hash with 'tx_' prefix
46
+ * @returns object.rlpEncoded rlp encoded transaction
47
+ * @returns object.binary binary transaction
48
+ */
49
+ export declare function buildTx<TxType extends Tag, Prefix>(_params: Omit<TxTypeSchemas[TxType], 'tag' | 'VSN'> & {
50
+ VSN?: number;
51
+ }, type: TxType, { excludeKeys, prefix, vsn, denomination, }?: {
52
+ excludeKeys?: string[];
53
+ prefix?: Encoding;
54
+ vsn?: number;
55
+ denomination?: AE_AMOUNT_FORMATS;
56
+ }): BuiltTx<TxSchema, Prefix extends Encoding ? Prefix : Encoding.Transaction>;
57
+ /**
58
+ * @category transaction builder
59
+ */
60
+ export interface TxUnpacked<Tx extends TxSchema> {
61
+ txType: Tag;
62
+ tx: RawTxObject<Tx>;
63
+ rlpEncoded: Uint8Array;
64
+ }
65
+ /**
66
+ * Unpack transaction hash
67
+ * @category transaction builder
68
+ * @param encodedTx - Transaction to unpack
69
+ * @param txType - Expected transaction type
70
+ * @returns object
71
+ * @returns object.tx Object with transaction param's
72
+ * @returns object.txType Transaction type
73
+ */
74
+ export declare function unpackTx<TxType extends Tag>(encodedTx: Encoded.Transaction | Encoded.Poi, txType?: TxType): TxUnpacked<TxTypeSchemas[TxType]>;
75
+ /**
76
+ * Build a transaction hash
77
+ * @category transaction builder
78
+ * @param rawTx - base64 or rlp encoded transaction
79
+ * @returns Transaction hash
80
+ */
81
+ export declare function buildTxHash(rawTx: Encoded.Transaction | Uint8Array): Encoded.TxHash;
82
+ /**
83
+ * Build a contract public key by contractCreateTx or gaAttach
84
+ * @category contract
85
+ * @param contractTx - Transaction
86
+ * @returns Contract public key
87
+ */
88
+ export declare function buildContractIdByContractTx(contractTx: Encoded.Transaction): Encoded.ContractAddress;