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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/bin/aesophia_cli +0 -0
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.map +1 -1
  4. package/dist/aepp-sdk.browser.js +1 -1
  5. package/dist/aepp-sdk.browser.js.map +1 -1
  6. package/dist/aepp-sdk.js +12031 -11231
  7. package/dist/aepp-sdk.js.map +1 -1
  8. package/es/AeSdk.d.ts +7 -3
  9. package/es/AeSdk.mjs +17 -22
  10. package/es/AeSdk.mjs.map +1 -1
  11. package/es/AeSdkAepp.d.ts +6 -5
  12. package/es/AeSdkAepp.mjs +7 -30
  13. package/es/AeSdkAepp.mjs.map +1 -1
  14. package/es/AeSdkBase.d.ts +18 -140
  15. package/es/AeSdkBase.mjs +30 -184
  16. package/es/AeSdkBase.mjs.map +1 -1
  17. package/es/AeSdkMethods.d.ts +123 -0
  18. package/es/AeSdkMethods.mjs +122 -0
  19. package/es/AeSdkMethods.mjs.map +1 -0
  20. package/es/AeSdkWallet.d.ts +7 -21
  21. package/es/AeSdkWallet.mjs +38 -86
  22. package/es/AeSdkWallet.mjs.map +1 -1
  23. package/es/Node.d.ts +11 -15
  24. package/es/Node.mjs +35 -48
  25. package/es/Node.mjs.map +1 -1
  26. package/es/account/Base.d.ts +24 -40
  27. package/es/account/Base.mjs +1 -101
  28. package/es/account/Base.mjs.map +1 -1
  29. package/es/account/Generalized.d.ts +16 -0
  30. package/es/account/Generalized.mjs +113 -0
  31. package/es/account/Generalized.mjs.map +1 -0
  32. package/es/account/Ledger.d.ts +28 -0
  33. package/es/account/Ledger.mjs +102 -0
  34. package/es/account/Ledger.mjs.map +1 -0
  35. package/es/account/LedgerFactory.d.ts +39 -0
  36. package/es/account/LedgerFactory.mjs +81 -0
  37. package/es/account/LedgerFactory.mjs.map +1 -0
  38. package/es/account/Memory.d.ts +13 -17
  39. package/es/account/Memory.mjs +43 -64
  40. package/es/account/Memory.mjs.map +1 -1
  41. package/es/account/Rpc.d.ts +6 -8
  42. package/es/account/Rpc.mjs +14 -32
  43. package/es/account/Rpc.mjs.map +1 -1
  44. package/es/aens.d.ts +4 -4
  45. package/es/aens.mjs +46 -41
  46. package/es/aens.mjs.map +1 -1
  47. package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
  48. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
  50. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
  51. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
  53. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
  54. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  55. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  56. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
  57. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
  58. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
  60. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/schema.mjs +14 -68
  62. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  63. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  64. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  65. package/es/apis/compiler/compiler.d.ts +23 -29
  66. package/es/apis/compiler/compiler.mjs +128 -189
  67. package/es/apis/compiler/compiler.mjs.map +1 -1
  68. package/es/apis/compiler/index.mjs.map +1 -1
  69. package/es/apis/compiler/models/index.d.ts +82 -135
  70. package/es/apis/compiler/models/index.mjs +1 -47
  71. package/es/apis/compiler/models/index.mjs.map +1 -1
  72. package/es/apis/compiler/models/mappers.d.ts +8 -8
  73. package/es/apis/compiler/models/mappers.mjs +165 -183
  74. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  75. package/es/apis/compiler/models/parameters.d.ts +0 -1
  76. package/es/apis/compiler/models/parameters.mjs +5 -9
  77. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  78. package/es/apis/node/index.mjs.map +1 -1
  79. package/es/apis/node/models/index.d.ts +48 -48
  80. package/es/apis/node/models/mappers.mjs +12 -6
  81. package/es/apis/node/models/mappers.mjs.map +1 -1
  82. package/es/apis/node/models/parameters.mjs.map +1 -1
  83. package/es/apis/node/node.mjs +43 -84
  84. package/es/apis/node/node.mjs.map +1 -1
  85. package/es/chain.d.ts +10 -2
  86. package/es/chain.mjs +37 -59
  87. package/es/chain.mjs.map +1 -1
  88. package/es/channel/Base.d.ts +200 -0
  89. package/es/channel/Base.mjs +293 -0
  90. package/es/channel/Base.mjs.map +1 -0
  91. package/es/channel/Contract.d.ts +248 -0
  92. package/es/channel/Contract.mjs +420 -0
  93. package/es/channel/Contract.mjs.map +1 -0
  94. package/es/channel/Spend.d.ts +219 -0
  95. package/es/channel/Spend.mjs +385 -0
  96. package/es/channel/Spend.mjs.map +1 -0
  97. package/es/channel/handlers.d.ts +8 -21
  98. package/es/channel/handlers.mjs +151 -899
  99. package/es/channel/handlers.mjs.map +1 -1
  100. package/es/channel/internal.d.ts +27 -21
  101. package/es/channel/internal.mjs +101 -191
  102. package/es/channel/internal.mjs.map +1 -1
  103. package/es/contract/Contract.d.ts +210 -0
  104. package/es/contract/Contract.mjs +551 -0
  105. package/es/contract/Contract.mjs.map +1 -0
  106. package/es/contract/compiler/Base.d.ts +81 -0
  107. package/es/contract/compiler/Base.mjs +5 -0
  108. package/es/contract/compiler/Base.mjs.map +1 -0
  109. package/es/contract/compiler/Cli.d.ts +23 -0
  110. package/es/contract/compiler/Cli.mjs +155 -0
  111. package/es/contract/compiler/Cli.mjs.map +1 -0
  112. package/es/contract/compiler/Http.d.ts +32 -0
  113. package/es/contract/compiler/Http.mjs +118 -0
  114. package/es/contract/compiler/Http.mjs.map +1 -0
  115. package/es/contract/compiler/HttpNode.d.ts +17 -0
  116. package/es/contract/compiler/HttpNode.mjs +26 -0
  117. package/es/contract/compiler/HttpNode.mjs.map +1 -0
  118. package/es/contract/compiler/getFileSystem.d.ts +6 -0
  119. package/es/contract/compiler/getFileSystem.mjs +40 -0
  120. package/es/contract/compiler/getFileSystem.mjs.map +1 -0
  121. package/es/contract/ga.d.ts +9 -34
  122. package/es/contract/ga.mjs +29 -112
  123. package/es/contract/ga.mjs.map +1 -1
  124. package/es/index-browser.d.ts +39 -0
  125. package/es/index-browser.mjs +55 -0
  126. package/es/index-browser.mjs.map +1 -0
  127. package/es/index.d.ts +4 -35
  128. package/es/index.mjs +4 -51
  129. package/es/index.mjs.map +1 -1
  130. package/es/oracle.d.ts +5 -5
  131. package/es/oracle.mjs +34 -40
  132. package/es/oracle.mjs.map +1 -1
  133. package/es/spend.d.ts +3 -3
  134. package/es/spend.mjs +18 -23
  135. package/es/spend.mjs.map +1 -1
  136. package/es/tx/builder/constants.d.ts +30 -2
  137. package/es/tx/builder/constants.mjs +43 -14
  138. package/es/tx/builder/constants.mjs.map +1 -1
  139. package/es/tx/builder/field-types/abi-version.d.ts +10 -0
  140. package/es/tx/builder/field-types/abi-version.mjs +20 -0
  141. package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
  142. package/es/tx/builder/field-types/address.d.ts +14 -0
  143. package/es/tx/builder/field-types/address.mjs +51 -0
  144. package/es/tx/builder/field-types/address.mjs.map +1 -0
  145. package/es/tx/builder/field-types/array.d.ts +7 -0
  146. package/es/tx/builder/field-types/array.mjs +11 -0
  147. package/es/tx/builder/field-types/array.mjs.map +1 -0
  148. package/es/tx/builder/field-types/boolean.d.ts +6 -0
  149. package/es/tx/builder/field-types/boolean.mjs +13 -0
  150. package/es/tx/builder/field-types/boolean.mjs.map +1 -0
  151. package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
  152. package/es/tx/builder/field-types/coin-amount.mjs +4 -12
  153. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  154. package/es/tx/builder/field-types/ct-version.d.ts +30 -0
  155. package/es/tx/builder/field-types/ct-version.mjs +48 -0
  156. package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
  157. package/es/tx/builder/field-types/deposit.d.ts +1 -2
  158. package/es/tx/builder/field-types/deposit.mjs +2 -4
  159. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  160. package/es/tx/builder/field-types/encoded.d.ts +6 -0
  161. package/es/tx/builder/field-types/encoded.mjs +21 -0
  162. package/es/tx/builder/field-types/encoded.mjs.map +1 -0
  163. package/es/tx/builder/field-types/entry.d.ts +11 -0
  164. package/es/tx/builder/field-types/entry.mjs +31 -0
  165. package/es/tx/builder/field-types/entry.mjs.map +1 -0
  166. package/es/tx/builder/field-types/enumeration.d.ts +7 -0
  167. package/es/tx/builder/field-types/enumeration.mjs +30 -0
  168. package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
  169. package/es/tx/builder/field-types/fee.d.ts +10 -15
  170. package/es/tx/builder/field-types/fee.mjs +31 -43
  171. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  172. package/es/tx/builder/field-types/field.mjs +0 -2
  173. package/es/tx/builder/field-types/field.mjs.map +1 -1
  174. package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
  175. package/es/tx/builder/field-types/gas-limit.mjs +12 -14
  176. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  177. package/es/tx/builder/field-types/gas-price.d.ts +1 -2
  178. package/es/tx/builder/field-types/gas-price.mjs +3 -7
  179. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  180. package/es/tx/builder/field-types/index.d.ts +80 -30
  181. package/es/tx/builder/field-types/index.mjs +34 -9
  182. package/es/tx/builder/field-types/index.mjs.map +1 -1
  183. package/es/tx/builder/field-types/mptree.d.ts +37 -0
  184. package/es/tx/builder/field-types/mptree.mjs +268 -0
  185. package/es/tx/builder/field-types/mptree.mjs.map +1 -0
  186. package/es/tx/builder/field-types/name-fee.d.ts +1 -3
  187. package/es/tx/builder/field-types/name-fee.mjs +3 -5
  188. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  189. package/es/tx/builder/field-types/name-id.d.ts +1 -4
  190. package/es/tx/builder/field-types/name-id.mjs +5 -10
  191. package/es/tx/builder/field-types/name-id.mjs.map +1 -1
  192. package/es/tx/builder/field-types/name.mjs +0 -2
  193. package/es/tx/builder/field-types/name.mjs.map +1 -1
  194. package/es/tx/builder/field-types/pointers.d.ts +23 -0
  195. package/es/tx/builder/field-types/pointers.mjs +36 -0
  196. package/es/tx/builder/field-types/pointers.mjs.map +1 -0
  197. package/es/tx/builder/field-types/raw.d.ts +6 -0
  198. package/es/tx/builder/field-types/raw.mjs +13 -0
  199. package/es/tx/builder/field-types/raw.mjs.map +1 -0
  200. package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  201. package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
  202. package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
  203. package/es/tx/builder/field-types/short-u-int.mjs +0 -2
  204. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
  205. package/es/tx/builder/field-types/string.d.ts +6 -0
  206. package/es/tx/builder/field-types/string.mjs +10 -0
  207. package/es/tx/builder/field-types/string.mjs.map +1 -0
  208. package/es/tx/builder/field-types/u-int.d.ts +1 -2
  209. package/es/tx/builder/field-types/u-int.mjs +3 -4
  210. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  211. package/es/tx/builder/helpers.d.ts +2 -32
  212. package/es/tx/builder/helpers.mjs +19 -71
  213. package/es/tx/builder/helpers.mjs.map +1 -1
  214. package/es/tx/builder/index.d.ts +11 -49
  215. package/es/tx/builder/index.mjs +57 -337
  216. package/es/tx/builder/index.mjs.map +1 -1
  217. package/es/tx/builder/schema.d.ts +2367 -667
  218. package/es/tx/builder/schema.mjs +70 -145
  219. package/es/tx/builder/schema.mjs.map +1 -1
  220. package/es/tx/index.d.ts +4 -49
  221. package/es/tx/index.mjs +38 -112
  222. package/es/tx/index.mjs.map +1 -1
  223. package/es/tx/validator.d.ts +4 -6
  224. package/es/tx/validator.mjs +104 -90
  225. package/es/tx/validator.mjs.map +1 -1
  226. package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
  227. package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
  228. package/es/utils/amount-formatter.mjs +4 -10
  229. package/es/utils/amount-formatter.mjs.map +1 -1
  230. package/es/utils/autorest.d.ts +1 -0
  231. package/es/utils/autorest.mjs +17 -19
  232. package/es/utils/autorest.mjs.map +1 -1
  233. package/es/utils/bignumber.mjs +4 -7
  234. package/es/utils/bignumber.mjs.map +1 -1
  235. package/es/utils/bytes.d.ts +0 -17
  236. package/es/utils/bytes.mjs +6 -35
  237. package/es/utils/bytes.mjs.map +1 -1
  238. package/es/utils/crypto.d.ts +15 -8
  239. package/es/utils/crypto.mjs +40 -40
  240. package/es/utils/crypto.mjs.map +1 -1
  241. package/es/utils/encoder-types.d.ts +28 -28
  242. package/es/utils/encoder-types.mjs +0 -1
  243. package/es/utils/encoder-types.mjs.map +1 -1
  244. package/es/utils/encoder.d.ts +0 -1
  245. package/es/utils/encoder.mjs +7 -15
  246. package/es/utils/encoder.mjs.map +1 -1
  247. package/es/utils/errors.d.ts +15 -14
  248. package/es/utils/errors.mjs +86 -172
  249. package/es/utils/errors.mjs.map +1 -1
  250. package/es/utils/hd-wallet.d.ts +27 -19
  251. package/es/utils/hd-wallet.mjs +42 -26
  252. package/es/utils/hd-wallet.mjs.map +1 -1
  253. package/es/utils/json-big.mjs +0 -8
  254. package/es/utils/json-big.mjs.map +1 -1
  255. package/es/utils/keystore.d.ts +2 -0
  256. package/es/utils/keystore.mjs +37 -36
  257. package/es/utils/keystore.mjs.map +1 -1
  258. package/es/utils/other.d.ts +4 -2
  259. package/es/utils/other.mjs +11 -7
  260. package/es/utils/other.mjs.map +1 -1
  261. package/es/utils/semver-satisfies.mjs +0 -3
  262. package/es/utils/semver-satisfies.mjs.map +1 -1
  263. package/es/utils/string.d.ts +0 -12
  264. package/es/utils/string.mjs +1 -21
  265. package/es/utils/string.mjs.map +1 -1
  266. package/package.json +98 -51
  267. package/src/AeSdk.ts +15 -11
  268. package/src/AeSdkAepp.ts +9 -7
  269. package/src/AeSdkBase.ts +31 -202
  270. package/src/AeSdkMethods.ts +169 -0
  271. package/src/AeSdkWallet.ts +16 -47
  272. package/src/Node.ts +17 -18
  273. package/src/account/Base.ts +29 -75
  274. package/src/account/Generalized.ts +98 -0
  275. package/src/account/Ledger.ts +131 -0
  276. package/src/account/LedgerFactory.ts +86 -0
  277. package/src/account/Memory.ts +46 -60
  278. package/src/account/Rpc.ts +17 -26
  279. package/src/aens.ts +13 -11
  280. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
  281. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
  282. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
  283. package/src/aepp-wallet-communication/rpc/types.ts +11 -1
  284. package/src/aepp-wallet-communication/schema.ts +18 -18
  285. package/src/apis/compiler/code-model-v4.yaml +681 -888
  286. package/src/apis/compiler/compiler.ts +113 -154
  287. package/src/apis/compiler/models/index.ts +80 -140
  288. package/src/apis/compiler/models/mappers.ts +165 -183
  289. package/src/apis/compiler/models/parameters.ts +6 -12
  290. package/src/chain.ts +11 -6
  291. package/src/channel/Base.ts +335 -0
  292. package/src/channel/Contract.ts +488 -0
  293. package/src/channel/Spend.ts +408 -0
  294. package/src/channel/handlers.ts +164 -582
  295. package/src/channel/internal.ts +114 -143
  296. package/src/contract/Contract.ts +610 -0
  297. package/src/contract/compiler/Base.ts +94 -0
  298. package/src/contract/compiler/Cli.ts +134 -0
  299. package/src/contract/compiler/Http.ts +124 -0
  300. package/src/contract/compiler/HttpNode.ts +26 -0
  301. package/src/contract/compiler/getFileSystem.ts +42 -0
  302. package/src/contract/ga.ts +23 -106
  303. package/src/index-browser.ts +58 -0
  304. package/src/index.ts +4 -55
  305. package/src/oracle.ts +8 -8
  306. package/src/spend.ts +6 -14
  307. package/src/tx/builder/constants.ts +33 -3
  308. package/src/tx/builder/field-types/abi-version.ts +21 -0
  309. package/src/tx/builder/field-types/address.ts +62 -0
  310. package/src/tx/builder/field-types/array.ts +19 -0
  311. package/src/tx/builder/field-types/boolean.ts +9 -0
  312. package/src/tx/builder/field-types/coin-amount.ts +4 -9
  313. package/src/tx/builder/field-types/ct-version.ts +50 -0
  314. package/src/tx/builder/field-types/deposit.ts +1 -1
  315. package/src/tx/builder/field-types/encoded.ts +27 -0
  316. package/src/tx/builder/field-types/entry.ts +31 -0
  317. package/src/tx/builder/field-types/enumeration.ts +32 -0
  318. package/src/tx/builder/field-types/fee.ts +39 -21
  319. package/src/tx/builder/field-types/gas-limit.ts +13 -8
  320. package/src/tx/builder/field-types/gas-price.ts +0 -2
  321. package/src/tx/builder/field-types/index.ts +54 -15
  322. package/src/tx/builder/field-types/mptree.ts +242 -0
  323. package/src/tx/builder/field-types/name-fee.ts +2 -3
  324. package/src/tx/builder/field-types/name-id.ts +7 -10
  325. package/src/tx/builder/field-types/pointers.ts +41 -0
  326. package/src/tx/builder/field-types/raw.ts +9 -0
  327. package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
  328. package/src/tx/builder/field-types/string.ts +11 -0
  329. package/src/tx/builder/field-types/u-int.ts +4 -5
  330. package/src/tx/builder/helpers.ts +10 -60
  331. package/src/tx/builder/index.ts +65 -308
  332. package/src/tx/builder/schema.ts +280 -341
  333. package/src/tx/index.ts +40 -103
  334. package/src/tx/validator.ts +91 -96
  335. package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
  336. package/src/utils/autorest.ts +16 -1
  337. package/src/utils/bytes.ts +6 -34
  338. package/src/utils/crypto.ts +23 -16
  339. package/src/utils/encoder.ts +0 -1
  340. package/src/utils/errors.ts +22 -25
  341. package/src/utils/hd-wallet.ts +30 -9
  342. package/src/utils/keystore.ts +24 -21
  343. package/src/utils/other.ts +16 -1
  344. package/src/utils/string.ts +0 -20
  345. package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
  346. package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
  347. package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
  348. package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
  349. package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
  350. package/types-legacy/ts4.2/Node.d.ts +78 -0
  351. package/types-legacy/ts4.2/account/Base.d.ts +52 -0
  352. package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
  353. package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
  354. package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
  355. package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
  356. package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
  357. package/types-legacy/ts4.2/aens.d.ts +222 -0
  358. package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  359. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  360. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  361. package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  362. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  363. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
  364. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
  365. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  366. package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
  367. package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
  368. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
  369. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
  370. package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
  371. package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
  372. package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
  373. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
  374. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
  375. package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
  376. package/types-legacy/ts4.2/chain.d.ts +256 -0
  377. package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
  378. package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
  379. package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
  380. package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
  381. package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
  382. package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
  383. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
  384. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
  385. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
  386. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
  387. package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
  388. package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
  389. package/types-legacy/ts4.2/globals.d.ts +16 -0
  390. package/types-legacy/ts4.2/index-browser.d.ts +39 -0
  391. package/types-legacy/ts4.2/index.d.ts +5 -0
  392. package/types-legacy/ts4.2/oracle.d.ts +161 -0
  393. package/types-legacy/ts4.2/spend.d.ts +62 -0
  394. package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
  395. package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
  396. package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
  397. package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
  398. package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
  399. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
  400. package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
  401. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
  402. package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
  403. package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
  404. package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
  405. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
  406. package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
  407. package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
  408. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
  409. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
  410. package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
  411. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
  412. package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
  413. package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
  414. package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
  415. package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
  416. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  417. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
  418. package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
  419. package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
  420. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
  421. package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
  422. package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
  423. package/types-legacy/ts4.2/tx/index.d.ts +19 -0
  424. package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
  425. package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
  426. package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
  427. package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
  428. package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
  429. package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
  430. package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
  431. package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
  432. package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
  433. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
  434. package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
  435. package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
  436. package/types-legacy/ts4.2/utils/other.d.ts +31 -0
  437. package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
  438. package/types-legacy/ts4.2/utils/string.d.ts +12 -0
  439. package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
  440. package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
  441. package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
  442. package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
  443. package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
  444. package/types-legacy/ts4.5/Node.d.ts +78 -0
  445. package/types-legacy/ts4.5/account/Base.d.ts +52 -0
  446. package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
  447. package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
  448. package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
  449. package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
  450. package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
  451. package/types-legacy/ts4.5/aens.d.ts +222 -0
  452. package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  453. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  454. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  455. package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  456. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  457. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
  458. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
  459. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  460. package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
  461. package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
  462. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
  463. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
  464. package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
  465. package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
  466. package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
  467. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
  468. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
  469. package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
  470. package/types-legacy/ts4.5/chain.d.ts +256 -0
  471. package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
  472. package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
  473. package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
  474. package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
  475. package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
  476. package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
  477. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
  478. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
  479. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
  480. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
  481. package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
  482. package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
  483. package/types-legacy/ts4.5/index-browser.d.ts +39 -0
  484. package/types-legacy/ts4.5/index.d.ts +4 -0
  485. package/types-legacy/ts4.5/oracle.d.ts +161 -0
  486. package/types-legacy/ts4.5/spend.d.ts +62 -0
  487. package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
  488. package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
  489. package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
  490. package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
  491. package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
  492. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
  493. package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
  494. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
  495. package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
  496. package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
  497. package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
  498. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
  499. package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
  500. package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
  501. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
  502. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
  503. package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
  504. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
  505. package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
  506. package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
  507. package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
  508. package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
  509. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  510. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
  511. package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
  512. package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
  513. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
  514. package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
  515. package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
  516. package/types-legacy/ts4.5/tx/index.d.ts +19 -0
  517. package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
  518. package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
  519. package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
  520. package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
  521. package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
  522. package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
  523. package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
  524. package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
  525. package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
  526. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
  527. package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
  528. package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
  529. package/types-legacy/ts4.5/utils/other.d.ts +31 -0
  530. package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
  531. package/types-legacy/ts4.5/utils/string.d.ts +12 -0
  532. package/es/channel/index.d.ts +0 -625
  533. package/es/channel/index.mjs +0 -975
  534. package/es/channel/index.mjs.map +0 -1
  535. package/es/contract/Compiler.d.ts +0 -18
  536. package/es/contract/Compiler.mjs +0 -68
  537. package/es/contract/Compiler.mjs.map +0 -1
  538. package/es/contract/aci.d.ts +0 -127
  539. package/es/contract/aci.mjs +0 -508
  540. package/es/contract/aci.mjs.map +0 -1
  541. package/es/contract/methods.d.ts +0 -71
  542. package/es/contract/methods.mjs +0 -104
  543. package/es/contract/methods.mjs.map +0 -1
  544. package/es/deprecated/index.d.ts +0 -143
  545. package/es/deprecated/index.mjs +0 -162
  546. package/es/deprecated/index.mjs.map +0 -1
  547. package/es/deprecated/methods.d.ts +0 -18
  548. package/es/deprecated/methods.mjs +0 -26
  549. package/es/deprecated/methods.mjs.map +0 -1
  550. package/es/tx/builder/address.d.ts +0 -25
  551. package/es/tx/builder/address.mjs +0 -45
  552. package/es/tx/builder/address.mjs.map +0 -1
  553. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
  554. package/es/utils/mptree.d.ts +0 -26
  555. package/es/utils/mptree.mjs +0 -165
  556. package/es/utils/mptree.mjs.map +0 -1
  557. package/src/channel/index.ts +0 -1025
  558. package/src/contract/Compiler.ts +0 -67
  559. package/src/contract/aci.ts +0 -537
  560. package/src/contract/methods.ts +0 -123
  561. package/src/deprecated/index.ts +0 -172
  562. package/src/deprecated/methods.ts +0 -25
  563. package/src/tx/builder/address.ts +0 -50
  564. package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
  565. package/src/utils/mptree.ts +0 -145
@@ -1 +1 @@
1
- {"version":3,"file":"errors.mjs","names":["BaseError","Error","constructor","message","name","AccountError","AensError","AeppError","ChannelError","CompilerError","ContractError","CryptographyError","NodeError","TransactionError","WalletError","ArgumentError","argumentName","requirement","argumentValue","String","IllegalArgumentError","ArgumentCountMismatchError","functionName","requiredCount","providedCount","InsufficientBalanceError","MissingParamError","NoSerializerFoundError","RequestTimedOutError","height","TxTimedOutError","blocks","th","join","TypeError","UnsupportedPlatformError","UnsupportedProtocolError","NotImplementedError","UnsupportedVersionError","dependency","version","geVersion","ltVersion","InternalError","UnexpectedTsError","InvalidKeypairError","UnavailableAccountError","address","AensPointerContextError","nameOrId","prefix","InsufficientNameFeeError","nameFee","minNameFee","toString","InvalidAensNameError","InvalidRpcMessageError","MissingCallbackError","id","UnAuthorizedAccountError","onAccount","UnknownRpcClientError","UnsubscribedAccountError","ChannelCallError","ChannelConnectionError","ChannelPingTimedOutError","UnexpectedChannelMessageError","UnknownChannelStateError","InvalidAuthDataError","BytecodeMismatchError","source","DuplicateContractError","InactiveContractError","contractAddress","InvalidMethodInvocationError","MissingContractAddressError","MissingContractDefError","MissingFunctionNameError","NodeInvocationError","transaction","NoSuchContractFunctionError","NotPayableFunctionError","amount","fn","MissingEventDefinitionError","eventNameHash","eventAddress","AmbiguousEventDefinitionError","matchedEvents","map","InvalidChecksumError","InvalidPasswordError","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownNodeLengthError","nodeLength","UnknownPathNibbleError","nibble","DuplicateNodeError","NodeNotFoundError","DecodeError","PayloadLengthError","DryRunError","IllegalBidFeeError","InvalidSignatureError","InvalidTxParamsError","PrefixNotFoundError","tag","SchemaNotFoundError","schemaName","key","TagNotFoundError","TxNotInChainError","txHash","UnknownTxError","UnsupportedABIversionError","UnsupportedVMversionError","AlreadyConnectedError","NoWalletConnectedError","RpcConnectionError"],"sources":["../../src/utils/errors.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport BigNumber from 'bignumber.js';\n\n/**\n * aepp-sdk originated error\n * @category exception\n */\nexport abstract class BaseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'BaseError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AccountError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'AccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AensError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'AensError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AeppError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'AeppError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'ChannelError';\n }\n}\n\n/**\n * @category exception\n */\nexport class CompilerError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'CompilerError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ContractError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'ContractError';\n }\n}\n\n/**\n * @category exception\n */\nexport class CryptographyError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'CryptographyError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'NodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TransactionError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'TransactionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class WalletError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'WalletError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ArgumentError extends BaseError {\n constructor(argumentName: string, requirement: string, argumentValue: any) {\n super(`${argumentName} should be ${requirement}, got ${String(argumentValue)} instead`);\n this.name = 'ArgumentError';\n }\n}\n\n/**\n * @category exception\n */\nexport class IllegalArgumentError extends CryptographyError {\n constructor(message: string) {\n super(message);\n this.name = 'IllegalArgumentError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ArgumentCountMismatchError extends BaseError {\n constructor(functionName: string, requiredCount: number, providedCount: number) {\n super(`${functionName} expects ${requiredCount} arguments, got ${providedCount} instead`);\n this.name = 'ArgumentCountMismatchError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InsufficientBalanceError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'InsufficientBalanceError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingParamError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'MissingParamError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NoSerializerFoundError extends BaseError {\n constructor() {\n super('Byte serialization not supported');\n this.name = 'NoSerializerFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class RequestTimedOutError extends BaseError {\n constructor(height: number) {\n super(`Giving up at height ${height}`);\n this.name = 'RequestTimedOutError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TxTimedOutError extends BaseError {\n constructor(blocks: number, th: string) {\n super([\n `Giving up after ${blocks} blocks mined`,\n `transaction hash: ${th}`,\n ].join(', '));\n this.name = 'TxTimedOutError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TypeError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'TypeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedPlatformError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedPlatformError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedProtocolError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedProtocolError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NotImplementedError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'NotImplementedError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedVersionError extends BaseError {\n constructor(dependency: string, version: string, geVersion: string, ltVersion: string) {\n super(`Unsupported ${dependency} version ${version}. Supported: >= ${geVersion} < ${ltVersion}`);\n this.name = 'UnsupportedVersionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InternalError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'InternalError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnexpectedTsError extends InternalError {\n constructor(message = 'Expected to not happen, required for TS') {\n super(message);\n this.name = 'UnexpectedTsError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidKeypairError extends AccountError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidKeypairError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnavailableAccountError extends AccountError {\n constructor(address: string) {\n super(`Account for ${address} not available`);\n this.name = 'UnavailableAccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AensPointerContextError extends AensError {\n constructor(nameOrId: string, prefix: string) {\n super(`Name ${nameOrId} don't have pointers for ${prefix}`);\n this.name = 'AensPointerContextError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InsufficientNameFeeError extends AensError {\n constructor(nameFee: BigNumber, minNameFee: BigNumber) {\n super(`the provided fee ${nameFee.toString()} is not enough to execute the claim, required: ${minNameFee.toString()}`);\n this.name = 'InsufficientNameFeeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidAensNameError extends AensError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidAensNameError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidRpcMessageError extends AeppError {\n constructor(message: string) {\n super(`Received invalid message: ${message}`);\n this.name = 'InvalidRpcMessageError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingCallbackError extends AeppError {\n constructor(id: number) {\n super(`Can't find callback for this messageId ${id}`);\n this.name = 'MissingCallbackError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnAuthorizedAccountError extends AeppError {\n constructor(onAccount: string) {\n super(`You do not have access to account ${onAccount}`);\n this.name = 'UnAuthorizedAccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownRpcClientError extends AeppError {\n constructor(id: string) {\n super(`RpcClient with id ${id} do not exist`);\n this.name = 'UnknownRpcClientError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsubscribedAccountError extends AeppError {\n constructor() {\n super('You are not subscribed for an account.');\n this.name = 'UnsubscribedAccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelCallError extends ChannelError {\n constructor(message: string) {\n super(message);\n this.name = 'ChannelCallError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelConnectionError extends ChannelError {\n constructor(message: string) {\n super(message);\n this.name = 'ChannelConnectionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelPingTimedOutError extends ChannelError {\n constructor() {\n super('Server pong timed out');\n this.name = 'ChannelPingTimedOutError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnexpectedChannelMessageError extends ChannelError {\n constructor(message: string) {\n super(message);\n this.name = 'UnexpectedChannelMessageError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownChannelStateError extends ChannelError {\n constructor() {\n super('State Channels FSM entered unknown state');\n this.name = 'UnknownChannelStateError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidAuthDataError extends CompilerError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidAuthDataError';\n }\n}\n\n/**\n * @category exception\n */\nexport class BytecodeMismatchError extends ContractError {\n constructor(source: string) {\n super(`Contract ${source} do not correspond to the bytecode deployed on the chain`);\n this.name = 'BytecodeMismatchError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DuplicateContractError extends ContractError {\n constructor() {\n super('Contract already deployed');\n this.name = 'DuplicateContractError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InactiveContractError extends ContractError {\n constructor(contractAddress: string) {\n super(`Contract with address ${contractAddress} not active`);\n this.name = 'InactiveContractError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidMethodInvocationError extends ContractError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidMethodInvocationError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingContractAddressError extends ContractError {\n constructor(message: string) {\n super(message);\n this.name = 'MissingContractAddressError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingContractDefError extends ContractError {\n constructor() {\n super('Either ACI or source code is required');\n this.name = 'MissingContractDefError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingFunctionNameError extends ContractError {\n constructor() {\n super('Function name is required');\n this.name = 'MissingFunctionNameError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeInvocationError extends ContractError {\n transaction: string;\n\n constructor(message: string, transaction: string) {\n super(`Invocation failed${message == null ? '' : `: \"${message}\"`}`);\n this.name = 'NodeInvocationError';\n this.transaction = transaction;\n }\n}\n\n/**\n * @category exception\n */\nexport class NoSuchContractFunctionError extends ContractError {\n constructor(name: string) {\n super(`Function ${name} doesn't exist in contract`);\n this.name = 'NoSuchContractFunctionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NotPayableFunctionError extends ContractError {\n constructor(amount: string, fn: string) {\n super(\n `You try to pay \"${amount}\" to function \"${fn}\" which is not payable. `\n + 'Only payable function can accept coins',\n );\n this.name = 'NotPayableFunctionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingEventDefinitionError extends ContractError {\n constructor(eventNameHash: string, eventAddress: string) {\n super(\n `Can't find definition of ${eventNameHash} event emitted by ${eventAddress}`\n + ' (use omitUnknown option to ignore events like this)',\n );\n this.name = 'MissingEventDefinitionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AmbiguousEventDefinitionError extends ContractError {\n constructor(eventAddress: string, matchedEvents: Array<[string, string]>) {\n super(\n `Found multiple definitions of \"${matchedEvents[0][1]}\" event emitted by ${eventAddress}`\n + ` in ${matchedEvents.map(([name]) => `\"${name}\"`).join(', ')} contracts`\n + ' (use contractAddressToName option to specify contract name corresponding to address)',\n );\n this.name = 'AmbiguousEventDefinitionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidChecksumError extends CryptographyError {\n constructor() {\n super('Invalid checksum');\n this.name = 'InvalidChecksumError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidPasswordError extends CryptographyError {\n constructor() {\n super('Invalid password or nonce');\n this.name = 'InvalidPasswordError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MerkleTreeHashMismatchError extends CryptographyError {\n constructor() {\n super('Node hash is not equal to provided one');\n this.name = 'MerkleTreeHashMismatchError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingNodeInTreeError extends CryptographyError {\n constructor(message: string) {\n super(message);\n this.name = 'MissingNodeInTreeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownNodeLengthError extends CryptographyError {\n constructor(nodeLength: number) {\n super(`Unknown node length: ${nodeLength}`);\n this.name = 'UnknownNodeLengthError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownPathNibbleError extends CryptographyError {\n constructor(nibble: number) {\n super(`Unknown path nibble: ${nibble}`);\n this.name = 'UnknownPathNibbleError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DuplicateNodeError extends NodeError {\n constructor(name: string) {\n super(`Node with name ${name} already exist`);\n this.name = 'DuplicateNodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeNotFoundError extends NodeError {\n constructor(message: string) {\n super(message);\n this.name = 'NodeNotFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DecodeError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'DecodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class PayloadLengthError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'PayloadLengthError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DryRunError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'DryRunError';\n }\n}\n\n/**\n * @category exception\n */\nexport class IllegalBidFeeError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'IllegalBidFeeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidSignatureError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidSignatureError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidTxParamsError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidTxParamsError';\n }\n}\n\n/**\n * @category exception\n */\nexport class PrefixNotFoundError extends TransactionError {\n constructor(tag: number) {\n super(`Prefix for id-tag ${tag} not found.`);\n this.name = 'PrefixNotFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class SchemaNotFoundError extends TransactionError {\n constructor(schemaName: string, key: string, version: number) {\n super(`Transaction ${schemaName} not implemented for ${key} version ${version}`);\n this.name = 'SchemaNotFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TagNotFoundError extends TransactionError {\n constructor(prefix: string) {\n super(`Id tag for prefix ${prefix} not found.`);\n this.name = 'DecodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TxNotInChainError extends TransactionError {\n constructor(txHash: string) {\n super(`Transaction ${txHash} is removed from chain`);\n this.name = 'TxNotInChainError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownTxError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'UnknownTxError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedABIversionError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedABIversionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedVMversionError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedVMversionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AlreadyConnectedError extends WalletError {\n constructor(message: string) {\n super(message);\n this.name = 'AlreadyConnectedError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NoWalletConnectedError extends WalletError {\n constructor(message: string) {\n super(message);\n this.name = 'NoWalletConnectedError';\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcConnectionError extends WalletError {\n constructor(message: string) {\n super(message);\n this.name = 'RpcConnectionError';\n }\n}\n"],"mappings":"AAAA;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAeA,SAAf,SAAiCC,KAAjC,CAAuC;EAC5CC,WAAW,CAACC,OAAD,EAAkB;IAC3B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,WAAZ;EACD;;AAJ2C;AAO9C;AACA;AACA;;AACA,OAAO,MAAMC,YAAN,SAA2BL,SAA3B,CAAqC;EAC1CE,WAAW,CAACC,OAAD,EAAkB;IAC3B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,cAAZ;EACD;;AAJyC;AAO5C;AACA;AACA;;AACA,OAAO,MAAME,SAAN,SAAwBN,SAAxB,CAAkC;EACvCE,WA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ACA,OAAO,MAAMkH,sBAAN,SAAqCxG,WAArC,CAAiD;EACtDZ,WAAW,CAACC,OAAD,EAAkB;IAC3B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,wBAAZ;EACD;;AAJqD;AAOxD;AACA;AACA;;AACA,OAAO,MAAMmH,kBAAN,SAAiCzG,WAAjC,CAA6C;EAClDZ,WAAW,CAACC,OAAD,EAAkB;IAC3B,MAAMA,OAAN;IACA,KAAKC,IAAL,GAAY,oBAAZ;EACD;;AAJiD"}
1
+ {"version":3,"file":"errors.mjs","names":["BaseError","Error","constructor","message","name","AccountError","AensError","AeppError","ChannelError","CompilerError","ContractError","CryptographyError","NodeError","TransactionError","WalletError","ArgumentError","argumentName","requirement","argumentValue","IllegalArgumentError","ArgumentCountMismatchError","functionName","requiredCount","providedCount","InsufficientBalanceError","MissingParamError","NoSerializerFoundError","RequestTimedOutError","height","TxTimedOutError","blocks","th","join","TypeError","UnsupportedPlatformError","UnsupportedProtocolError","NotImplementedError","UnsupportedVersionError","dependency","version","geVersion","ltVersion","InternalError","UnexpectedTsError","UnavailableAccountError","address","AensPointerContextError","nameOrId","prefix","InsufficientNameFeeError","nameFee","minNameFee","toString","InvalidAensNameError","InvalidRpcMessageError","MissingCallbackError","id","UnAuthorizedAccountError","onAccount","UnknownRpcClientError","UnsubscribedAccountError","ChannelCallError","ChannelConnectionError","ChannelPingTimedOutError","UnexpectedChannelMessageError","ChannelIncomingMessageError","handlerError","incomingMessage","UnknownChannelStateError","InvalidAuthDataError","BytecodeMismatchError","source","DuplicateContractError","InactiveContractError","contractAddress","InvalidMethodInvocationError","MissingContractAddressError","MissingContractDefError","MissingFunctionNameError","NodeInvocationError","transaction","NoSuchContractFunctionError","NotPayableFunctionError","amount","fn","MissingEventDefinitionError","eventNameHash","eventAddress","AmbiguousEventDefinitionError","matchedEvents","map","InvalidChecksumError","InvalidPasswordError","MerkleTreeHashMismatchError","MissingNodeInTreeError","UnknownNodeLengthError","nodeLength","UnknownPathNibbleError","nibble","DuplicateNodeError","NodeNotFoundError","DecodeError","PayloadLengthError","DryRunError","IllegalBidFeeError","InvalidSignatureError","InvalidTxParamsError","PrefixNotFoundError","tag","SchemaNotFoundError","schemaName","key","TagNotFoundError","TxNotInChainError","txHash","UnsupportedABIversionError","UnsupportedVMversionError","AlreadyConnectedError","NoWalletConnectedError","RpcConnectionError"],"sources":["../../src/utils/errors.ts"],"sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport BigNumber from 'bignumber.js';\nimport { Int } from '../tx/builder/constants';\n\n/**\n * aepp-sdk originated error\n * @category exception\n */\nexport abstract class BaseError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'BaseError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AccountError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'AccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AensError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'AensError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AeppError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'AeppError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'ChannelError';\n }\n}\n\n/**\n * @category exception\n */\nexport class CompilerError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'CompilerError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ContractError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'ContractError';\n }\n}\n\n/**\n * @category exception\n */\nexport class CryptographyError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'CryptographyError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'NodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TransactionError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'TransactionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class WalletError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'WalletError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ArgumentError extends BaseError {\n constructor(argumentName: string, requirement: unknown, argumentValue: unknown) {\n super(`${argumentName} should be ${requirement}, got ${argumentValue} instead`);\n this.name = 'ArgumentError';\n }\n}\n\n/**\n * @category exception\n */\nexport class IllegalArgumentError extends CryptographyError {\n constructor(message: string) {\n super(message);\n this.name = 'IllegalArgumentError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ArgumentCountMismatchError extends BaseError {\n constructor(functionName: string, requiredCount: number, providedCount: number) {\n super(`${functionName} expects ${requiredCount} arguments, got ${providedCount} instead`);\n this.name = 'ArgumentCountMismatchError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InsufficientBalanceError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'InsufficientBalanceError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingParamError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'MissingParamError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NoSerializerFoundError extends BaseError {\n constructor() {\n super('Byte serialization not supported');\n this.name = 'NoSerializerFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class RequestTimedOutError extends BaseError {\n constructor(height: number) {\n super(`Giving up at height ${height}`);\n this.name = 'RequestTimedOutError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TxTimedOutError extends BaseError {\n constructor(blocks: number, th: string) {\n super([\n `Giving up after ${blocks} blocks mined`,\n `transaction hash: ${th}`,\n ].join(', '));\n this.name = 'TxTimedOutError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TypeError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'TypeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedPlatformError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedPlatformError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedProtocolError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedProtocolError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NotImplementedError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'NotImplementedError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedVersionError extends BaseError {\n constructor(dependency: string, version: string, geVersion: string, ltVersion: string) {\n super(`Unsupported ${dependency} version ${version}. Supported: >= ${geVersion} < ${ltVersion}`);\n this.name = 'UnsupportedVersionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InternalError extends BaseError {\n constructor(message: string) {\n super(message);\n this.name = 'InternalError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnexpectedTsError extends InternalError {\n constructor(message = 'Expected to not happen, required for TS') {\n super(message);\n this.name = 'UnexpectedTsError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnavailableAccountError extends AccountError {\n constructor(address: string) {\n super(`Account for ${address} not available`);\n this.name = 'UnavailableAccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AensPointerContextError extends AensError {\n constructor(nameOrId: string, prefix: string) {\n super(`Name ${nameOrId} don't have pointers for ${prefix}`);\n this.name = 'AensPointerContextError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InsufficientNameFeeError extends AensError {\n constructor(nameFee: BigNumber, minNameFee: BigNumber) {\n super(`the provided fee ${nameFee.toString()} is not enough to execute the claim, required: ${minNameFee.toString()}`);\n this.name = 'InsufficientNameFeeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidAensNameError extends AensError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidAensNameError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidRpcMessageError extends AeppError {\n constructor(message: string) {\n super(`Received invalid message: ${message}`);\n this.name = 'InvalidRpcMessageError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingCallbackError extends AeppError {\n constructor(id: number) {\n super(`Can't find callback for this messageId ${id}`);\n this.name = 'MissingCallbackError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnAuthorizedAccountError extends AeppError {\n constructor(onAccount: string) {\n super(`You do not have access to account ${onAccount}`);\n this.name = 'UnAuthorizedAccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownRpcClientError extends AeppError {\n constructor(id: string) {\n super(`RpcClient with id ${id} do not exist`);\n this.name = 'UnknownRpcClientError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsubscribedAccountError extends AeppError {\n constructor() {\n super('You are not subscribed for an account.');\n this.name = 'UnsubscribedAccountError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelCallError extends ChannelError {\n constructor(message: string) {\n super(message);\n this.name = 'ChannelCallError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelConnectionError extends ChannelError {\n constructor(message: string) {\n super(message);\n this.name = 'ChannelConnectionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelPingTimedOutError extends ChannelError {\n constructor() {\n super('Server pong timed out');\n this.name = 'ChannelPingTimedOutError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnexpectedChannelMessageError extends ChannelError {\n constructor(message: string) {\n super(message);\n this.name = 'UnexpectedChannelMessageError';\n }\n}\n\n/**\n * @category exception\n */\nexport class ChannelIncomingMessageError extends ChannelError {\n handlerError: BaseError;\n\n incomingMessage: { [key: string]: any };\n\n constructor(handlerError: BaseError, incomingMessage: { [key: string]: any }) {\n super(handlerError.message);\n this.handlerError = handlerError;\n this.incomingMessage = incomingMessage;\n this.name = 'ChannelIncomingMessageError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownChannelStateError extends ChannelError {\n constructor() {\n super('State Channels FSM entered unknown state');\n this.name = 'UnknownChannelStateError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidAuthDataError extends CompilerError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidAuthDataError';\n }\n}\n\n/**\n * @category exception\n */\nexport class BytecodeMismatchError extends ContractError {\n constructor(source: string) {\n super(`Contract ${source} do not correspond to the bytecode deployed on the chain`);\n this.name = 'BytecodeMismatchError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DuplicateContractError extends ContractError {\n constructor() {\n super('Contract already deployed');\n this.name = 'DuplicateContractError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InactiveContractError extends ContractError {\n constructor(contractAddress: string) {\n super(`Contract with address ${contractAddress} not active`);\n this.name = 'InactiveContractError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidMethodInvocationError extends ContractError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidMethodInvocationError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingContractAddressError extends ContractError {\n constructor(message: string) {\n super(message);\n this.name = 'MissingContractAddressError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingContractDefError extends ContractError {\n constructor() {\n super('Either ACI or source code is required');\n this.name = 'MissingContractDefError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingFunctionNameError extends ContractError {\n constructor() {\n super('Function name is required');\n this.name = 'MissingFunctionNameError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeInvocationError extends ContractError {\n transaction: string;\n\n constructor(message: string, transaction: string) {\n super(`Invocation failed${message == null ? '' : `: \"${message}\"`}`);\n this.name = 'NodeInvocationError';\n this.transaction = transaction;\n }\n}\n\n/**\n * @category exception\n */\nexport class NoSuchContractFunctionError extends ContractError {\n constructor(name: string) {\n super(`Function ${name} doesn't exist in contract`);\n this.name = 'NoSuchContractFunctionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NotPayableFunctionError extends ContractError {\n constructor(amount: Int, fn: string) {\n super(\n `You try to pay \"${amount}\" to function \"${fn}\" which is not payable. `\n + 'Only payable function can accept coins',\n );\n this.name = 'NotPayableFunctionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingEventDefinitionError extends ContractError {\n constructor(eventNameHash: string, eventAddress: string) {\n super(\n `Can't find definition of ${eventNameHash} event emitted by ${eventAddress}`\n + ' (use omitUnknown option to ignore events like this)',\n );\n this.name = 'MissingEventDefinitionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AmbiguousEventDefinitionError extends ContractError {\n constructor(eventAddress: string, matchedEvents: Array<[string, string]>) {\n super(\n `Found multiple definitions of \"${matchedEvents[0][1]}\" event with different types emitted by`\n + ` ${eventAddress} in ${matchedEvents.map(([name]) => `\"${name}\"`).join(', ')} contracts`\n + ' (use contractAddressToName option to specify contract name corresponding to address)',\n );\n this.name = 'AmbiguousEventDefinitionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidChecksumError extends CryptographyError {\n constructor() {\n super('Invalid checksum');\n this.name = 'InvalidChecksumError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidPasswordError extends CryptographyError {\n constructor() {\n super('Invalid password or nonce');\n this.name = 'InvalidPasswordError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MerkleTreeHashMismatchError extends CryptographyError {\n constructor() {\n super('Node hash is not equal to provided one');\n this.name = 'MerkleTreeHashMismatchError';\n }\n}\n\n/**\n * @category exception\n */\nexport class MissingNodeInTreeError extends CryptographyError {\n constructor(message: string) {\n super(message);\n this.name = 'MissingNodeInTreeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownNodeLengthError extends CryptographyError {\n constructor(nodeLength: number) {\n super(`Unknown node length: ${nodeLength}`);\n this.name = 'UnknownNodeLengthError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnknownPathNibbleError extends CryptographyError {\n constructor(nibble: number) {\n super(`Unknown path nibble: ${nibble}`);\n this.name = 'UnknownPathNibbleError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DuplicateNodeError extends NodeError {\n constructor(name: string) {\n super(`Node with name ${name} already exist`);\n this.name = 'DuplicateNodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NodeNotFoundError extends NodeError {\n constructor(message: string) {\n super(message);\n this.name = 'NodeNotFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DecodeError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'DecodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class PayloadLengthError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'PayloadLengthError';\n }\n}\n\n/**\n * @category exception\n */\nexport class DryRunError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'DryRunError';\n }\n}\n\n/**\n * @category exception\n */\nexport class IllegalBidFeeError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'IllegalBidFeeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidSignatureError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidSignatureError';\n }\n}\n\n/**\n * @category exception\n */\nexport class InvalidTxParamsError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidTxParamsError';\n }\n}\n\n/**\n * @category exception\n */\nexport class PrefixNotFoundError extends TransactionError {\n constructor(tag: number) {\n super(`Prefix for id-tag ${tag} not found.`);\n this.name = 'PrefixNotFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class SchemaNotFoundError extends TransactionError {\n constructor(schemaName: string, key: string, version: number) {\n super(`Transaction ${schemaName} not implemented for ${key} version ${version}`);\n this.name = 'SchemaNotFoundError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TagNotFoundError extends TransactionError {\n constructor(prefix: string) {\n super(`Id tag for prefix ${prefix} not found.`);\n this.name = 'DecodeError';\n }\n}\n\n/**\n * @category exception\n */\nexport class TxNotInChainError extends TransactionError {\n constructor(txHash: string) {\n super(`Transaction ${txHash} is removed from chain`);\n this.name = 'TxNotInChainError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedABIversionError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedABIversionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class UnsupportedVMversionError extends TransactionError {\n constructor(message: string) {\n super(message);\n this.name = 'UnsupportedVMversionError';\n }\n}\n\n/**\n * @category exception\n */\nexport class AlreadyConnectedError extends WalletError {\n constructor(message: string) {\n super(message);\n this.name = 'AlreadyConnectedError';\n }\n}\n\n/**\n * @category exception\n */\nexport class NoWalletConnectedError extends WalletError {\n constructor(message: string) {\n super(message);\n this.name = 'NoWalletConnectedError';\n }\n}\n\n/**\n * @category exception\n */\nexport class RpcConnectionError extends WalletError {\n constructor(message: string) {\n super(message);\n this.name = 'RpcConnectionError';\n }\n}\n"],"mappings":"AAAA;;AAIA;AACA;AACA;AACA;AACA,OAAO,MAAeA,SAAS,SAASC,KAAK,CAAC;EAC5CC,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,WAAW;EACzB;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASL,SAAS,CAAC;EAC1CE,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,cAAc;EAC5B;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAME,SAAS,SAASN,SAAS,CAAC;EACvCE,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,WAAW;EACzB;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMG,SAAS,SAASP,SAAS,CAAC;EACvCE,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,WAAW;EACzB;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMI,YAAY,SAASR,SAAS,CAAC;EAC1CE,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,cAAc;EAC5B;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMK,aAAa,SAAST,SAAS,CAAC;EAC3CE,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,eAAe;EAC7B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MAAMkH,sBAAsB,SAASxG,WAAW,CAAC;EACtDZ,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,wBAAwB;EACtC;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMmH,kBAAkB,SAASzG,WAAW,CAAC;EAClDZ,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,oBAAoB;EAClC;AACF"}
@@ -1,21 +1,5 @@
1
1
  import nacl from 'tweetnacl';
2
2
  import { CryptographyError } from './errors';
3
- /**
4
- * Encrypt given data using `password`
5
- * @param password - Password to encrypt with
6
- * @param binaryData - Data to encrypt
7
- * @returns Encrypted data
8
- * @deprecated use 'sha.js' and 'aes-js' packages directly instead
9
- */
10
- export declare function encryptKey(password: string, binaryData: Uint8Array): Uint8Array;
11
- /**
12
- * Decrypt given data using `password`
13
- * @param password - Password to decrypt with
14
- * @param encrypted - Data to decrypt
15
- * @returns Decrypted data
16
- * @deprecated use 'sha.js' and 'aes-js' packages directly instead
17
- */
18
- export declare function decryptKey(password: string, encrypted: Uint8Array): Uint8Array;
19
3
  /**
20
4
  * @category exception
21
5
  */
@@ -34,16 +18,40 @@ interface Account {
34
18
  secretKey: string;
35
19
  publicKey: string;
36
20
  }
37
- declare type Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N];
38
- declare type Bip32PathT<MaxLen extends number, H extends 'H' | 'h' | '\''> = MaxLen extends -1 ? `${number}${H}` : Bip32PathT<Dec<MaxLen>, H> | `${Bip32PathT<Dec<MaxLen>, H>}/${number}${H}`;
39
- declare type Bip32Path<MaxLen extends number> = '' | Bip32PathT<MaxLen, 'H'> | Bip32PathT<MaxLen, 'h'> | Bip32PathT<MaxLen, '\''>;
21
+ type Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N];
22
+ type Bip32PathT<MaxLen extends number, H extends 'H' | 'h' | '\''> = MaxLen extends -1 ? `${number}${H}` : Bip32PathT<Dec<MaxLen>, H> | `${Bip32PathT<Dec<MaxLen>, H>}/${number}${H}`;
23
+ type Bip32Path<MaxLen extends number> = '' | Bip32PathT<MaxLen, 'H'> | Bip32PathT<MaxLen, 'h'> | Bip32PathT<MaxLen, '\''>;
24
+ /**
25
+ * @category hd-wallet
26
+ */
40
27
  export declare function deriveChild({ secretKey, chainCode }: KeyTreeNode, index: number): KeyTreeNode;
28
+ /**
29
+ * @category hd-wallet
30
+ */
41
31
  export declare function derivePathFromKey(path: Bip32Path<5>, key: KeyTreeNode): KeyTreeNode;
32
+ /**
33
+ * @category hd-wallet
34
+ */
42
35
  export declare function getMasterKeyFromSeed(seed: Uint8Array): KeyTreeNode;
36
+ /**
37
+ * @category hd-wallet
38
+ */
43
39
  export declare function derivePathFromSeed(path: 'm' | `m/${Bip32Path<5>}`, seed: Uint8Array): KeyTreeNode;
40
+ /**
41
+ * @category hd-wallet
42
+ */
44
43
  export declare function getKeyPair(secretKey: Uint8Array): nacl.SignKeyPair;
44
+ /**
45
+ * @category hd-wallet
46
+ */
45
47
  export declare function generateSaveHDWalletFromSeed(seed: Uint8Array, password: string): HDWallet;
48
+ /**
49
+ * @category hd-wallet
50
+ */
46
51
  export declare function getSaveHDWalletAccounts(saveHDWallet: HDWallet, password: string, accountCount: number): Account[];
52
+ /**
53
+ * @category hd-wallet
54
+ */
47
55
  export declare const getHdWalletAccountFromSeed: (seed: Uint8Array, accountIdx: number) => Account & {
48
56
  idx: number;
49
57
  };
@@ -1,5 +1,4 @@
1
1
  import _buffer from "buffer";
2
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
3
2
  const {
4
3
  Buffer: _Buffer
5
4
  } = _buffer;
@@ -15,65 +14,58 @@ const {
15
14
  import aesjs from 'aes-js';
16
15
  import { sha256hash, encode, Encoding } from "./encoder.mjs";
17
16
  import { CryptographyError } from "./errors.mjs";
18
- import { bytesToHex } from "./bytes.mjs";
19
17
  import { concatBuffers } from "./other.mjs";
20
- const Ecb = aesjs.ModeOfOperation.ecb; // TODO: at least don't export `encryptKey` and `decryptKey`
18
+ const Ecb = aesjs.ModeOfOperation.ecb;
21
19
 
20
+ // TODO: use mnemonic encryption instead of AES
22
21
  /**
23
22
  * Encrypt given data using `password`
24
23
  * @param password - Password to encrypt with
25
24
  * @param binaryData - Data to encrypt
26
25
  * @returns Encrypted data
27
- * @deprecated use 'sha.js' and 'aes-js' packages directly instead
28
26
  */
29
-
30
- export function encryptKey(password, binaryData) {
27
+ function encryptKey(password, binaryData) {
31
28
  const hashedPasswordBytes = sha256hash(password);
32
29
  const aesEcb = new Ecb(hashedPasswordBytes);
33
30
  return aesEcb.encrypt(binaryData);
34
31
  }
32
+
35
33
  /**
36
34
  * Decrypt given data using `password`
37
35
  * @param password - Password to decrypt with
38
36
  * @param encrypted - Data to decrypt
39
37
  * @returns Decrypted data
40
- * @deprecated use 'sha.js' and 'aes-js' packages directly instead
41
38
  */
42
-
43
- export function decryptKey(password, encrypted) {
39
+ function decryptKey(password, encrypted) {
44
40
  const encryptedBytes = _Buffer.from(encrypted);
45
-
46
41
  const hashedPasswordBytes = sha256hash(password);
47
42
  const aesEcb = new Ecb(hashedPasswordBytes);
48
43
  return aesEcb.decrypt(encryptedBytes);
49
44
  }
45
+
50
46
  /**
51
47
  * @category exception
52
48
  */
53
-
54
49
  export class DerivationError extends CryptographyError {
55
50
  constructor(message) {
56
51
  super(message);
57
52
  this.name = 'DerivationError';
58
53
  }
59
-
60
54
  }
61
-
62
55
  const ED25519_CURVE = _Buffer.from('ed25519 seed');
63
-
64
56
  const HARDENED_OFFSET = 0x80000000;
57
+ /**
58
+ * @category hd-wallet
59
+ */
65
60
  export function deriveChild(_ref, index) {
66
61
  let {
67
62
  secretKey,
68
63
  chainCode
69
64
  } = _ref;
70
-
71
65
  if (index < HARDENED_OFFSET) {
72
66
  throw new DerivationError(`Segment ${index} is not hardened`);
73
67
  }
74
-
75
68
  const indexBuffer = _Buffer.allocUnsafe(4);
76
-
77
69
  indexBuffer.writeUInt32BE(index, 0);
78
70
  const data = concatBuffers([_Buffer.alloc(1, 0), secretKey, indexBuffer]);
79
71
  const I = hmac(data, chainCode);
@@ -84,6 +76,10 @@ export function deriveChild(_ref, index) {
84
76
  chainCode: IR
85
77
  };
86
78
  }
79
+
80
+ /**
81
+ * @category hd-wallet
82
+ */
87
83
  export function derivePathFromKey(path, key) {
88
84
  const segments = path === '' ? [] : fromString(path).toPathArray();
89
85
  segments.forEach((segment, i) => {
@@ -93,6 +89,10 @@ export function derivePathFromKey(path, key) {
93
89
  });
94
90
  return segments.reduce((parentKey, segment) => deriveChild(parentKey, segment), key);
95
91
  }
92
+
93
+ /**
94
+ * @category hd-wallet
95
+ */
96
96
  export function getMasterKeyFromSeed(seed) {
97
97
  const I = hmac(seed, ED25519_CURVE);
98
98
  const IL = I.slice(0, 32);
@@ -102,38 +102,49 @@ export function getMasterKeyFromSeed(seed) {
102
102
  chainCode: IR
103
103
  };
104
104
  }
105
- export function derivePathFromSeed(path, seed) {
106
- var _context;
107
105
 
108
- if (!_includesInstanceProperty(_context = ['m', 'm/']).call(_context, path.slice(0, 2))) {
106
+ /**
107
+ * @category hd-wallet
108
+ */
109
+ export function derivePathFromSeed(path, seed) {
110
+ if (!['m', 'm/'].includes(path.slice(0, 2))) {
109
111
  throw new DerivationError('Root element is required');
110
112
  }
111
-
112
113
  const masterKey = getMasterKeyFromSeed(seed);
113
114
  return derivePathFromKey(path.slice(2), masterKey);
114
115
  }
115
-
116
116
  function formatAccount(keys) {
117
117
  const {
118
118
  secretKey,
119
119
  publicKey
120
120
  } = keys;
121
121
  return {
122
- secretKey: bytesToHex(secretKey),
122
+ secretKey: _Buffer.from(secretKey).toString('hex'),
123
123
  publicKey: encode(publicKey, Encoding.AccountAddress)
124
124
  };
125
125
  }
126
126
 
127
+ /**
128
+ * @category hd-wallet
129
+ */
127
130
  export function getKeyPair(secretKey) {
128
131
  return nacl.sign.keyPair.fromSeed(secretKey);
129
132
  }
133
+
134
+ /**
135
+ * @category hd-wallet
136
+ */
130
137
  export function generateSaveHDWalletFromSeed(seed, password) {
131
138
  const walletKey = derivePathFromSeed('m/44h/457h', seed);
132
139
  return {
133
- secretKey: bytesToHex(encryptKey(password, walletKey.secretKey)),
134
- chainCode: bytesToHex(encryptKey(password, walletKey.chainCode))
140
+ secretKey: _Buffer.from(encryptKey(password, walletKey.secretKey)).toString('hex'),
141
+ chainCode: _Buffer.from(encryptKey(password, walletKey.chainCode)).toString('hex')
135
142
  };
136
143
  }
144
+
145
+ /**
146
+ * @category hd-wallet
147
+ */
137
148
  export function getSaveHDWalletAccounts(saveHDWallet, password, accountCount) {
138
149
  const walletKey = {
139
150
  secretKey: decryptKey(password, _Buffer.from(saveHDWallet.secretKey, 'hex')),
@@ -141,11 +152,16 @@ export function getSaveHDWalletAccounts(saveHDWallet, password, accountCount) {
141
152
  };
142
153
  return new Array(accountCount).fill(undefined).map((_, idx) => formatAccount(getKeyPair(derivePathFromKey(`${idx}h/0h/0h`, walletKey).secretKey)));
143
154
  }
155
+
156
+ /**
157
+ * @category hd-wallet
158
+ */
144
159
  export const getHdWalletAccountFromSeed = (seed, accountIdx) => {
145
160
  const walletKey = derivePathFromSeed('m/44h/457h', seed);
146
161
  const derived = derivePathFromKey(`${accountIdx}h/0h/0h`, walletKey);
147
162
  const keyPair = getKeyPair(derived.secretKey);
148
- return { ...formatAccount(keyPair),
163
+ return {
164
+ ...formatAccount(keyPair),
149
165
  idx: accountIdx
150
166
  };
151
167
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hd-wallet.mjs","names":["nacl","aesjs","sha256hash","encode","Encoding","CryptographyError","bytesToHex","concatBuffers","Ecb","ModeOfOperation","ecb","encryptKey","password","binaryData","hashedPasswordBytes","aesEcb","encrypt","decryptKey","encrypted","encryptedBytes","from","decrypt","DerivationError","constructor","message","name","ED25519_CURVE","HARDENED_OFFSET","deriveChild","index","secretKey","chainCode","indexBuffer","allocUnsafe","writeUInt32BE","data","alloc","I","hmac","IL","slice","IR","derivePathFromKey","path","key","segments","fromString","toPathArray","forEach","segment","i","reduce","parentKey","getMasterKeyFromSeed","seed","derivePathFromSeed","masterKey","formatAccount","keys","publicKey","AccountAddress","getKeyPair","sign","keyPair","fromSeed","generateSaveHDWalletFromSeed","walletKey","getSaveHDWalletAccounts","saveHDWallet","accountCount","Array","fill","undefined","map","_","idx","getHdWalletAccountFromSeed","accountIdx","derived"],"sources":["../../src/utils/hd-wallet.ts"],"sourcesContent":["import nacl from 'tweetnacl';\nimport { full as hmac } from 'tweetnacl-auth';\nimport { fromString } from 'bip32-path';\nimport aesjs from 'aes-js';\nimport { sha256hash, encode, Encoding } from './encoder';\nimport { CryptographyError } from './errors';\nimport { bytesToHex } from './bytes';\nimport { concatBuffers } from './other';\n\nconst Ecb = aesjs.ModeOfOperation.ecb;\n\n// TODO: at least don't export `encryptKey` and `decryptKey`\n/**\n * Encrypt given data using `password`\n * @param password - Password to encrypt with\n * @param binaryData - Data to encrypt\n * @returns Encrypted data\n * @deprecated use 'sha.js' and 'aes-js' packages directly instead\n */\nexport function encryptKey(password: string, binaryData: Uint8Array): Uint8Array {\n const hashedPasswordBytes = sha256hash(password);\n const aesEcb = new Ecb(hashedPasswordBytes);\n return aesEcb.encrypt(binaryData);\n}\n\n/**\n * Decrypt given data using `password`\n * @param password - Password to decrypt with\n * @param encrypted - Data to decrypt\n * @returns Decrypted data\n * @deprecated use 'sha.js' and 'aes-js' packages directly instead\n */\nexport function decryptKey(password: string, encrypted: Uint8Array): Uint8Array {\n const encryptedBytes = Buffer.from(encrypted);\n const hashedPasswordBytes = sha256hash(password);\n const aesEcb = new Ecb(hashedPasswordBytes);\n return aesEcb.decrypt(encryptedBytes);\n}\n\n/**\n * @category exception\n */\nexport class DerivationError extends CryptographyError {\n constructor(message: string) {\n super(message);\n this.name = 'DerivationError';\n }\n}\n\nconst ED25519_CURVE = Buffer.from('ed25519 seed');\nconst HARDENED_OFFSET = 0x80000000;\n\ninterface KeyTreeNode {\n secretKey: Uint8Array;\n chainCode: Uint8Array;\n}\n\ninterface HDWallet {\n secretKey: string;\n chainCode: string;\n}\n\ninterface Account {\n secretKey: string;\n publicKey: string;\n}\n\ntype Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N];\ntype Bip32PathT<MaxLen extends number, H extends 'H' | 'h' | '\\''> = MaxLen extends -1\n ? `${number}${H}`\n : Bip32PathT<Dec<MaxLen>, H> | `${Bip32PathT<Dec<MaxLen>, H>}/${number}${H}`;\ntype Bip32Path<MaxLen extends number> =\n '' | Bip32PathT<MaxLen, 'H'> | Bip32PathT<MaxLen, 'h'> | Bip32PathT<MaxLen, '\\''>;\n\nexport function deriveChild({ secretKey, chainCode }: KeyTreeNode, index: number): KeyTreeNode {\n if (index < HARDENED_OFFSET) {\n throw new DerivationError(`Segment ${index} is not hardened`);\n }\n const indexBuffer = Buffer.allocUnsafe(4);\n indexBuffer.writeUInt32BE(index, 0);\n\n const data = concatBuffers([Buffer.alloc(1, 0), secretKey, indexBuffer]);\n\n const I = hmac(data, chainCode);\n const IL = I.slice(0, 32);\n const IR = I.slice(32);\n return {\n secretKey: IL,\n chainCode: IR,\n };\n}\n\nexport function derivePathFromKey(path: Bip32Path<5>, key: KeyTreeNode): KeyTreeNode {\n const segments = path === '' ? [] : fromString(path).toPathArray();\n segments.forEach((segment, i) => {\n if (segment < HARDENED_OFFSET) {\n throw new DerivationError(`Segment #${i + 1} is not hardened`);\n }\n });\n\n return segments.reduce((parentKey, segment) => deriveChild(parentKey, segment), key);\n}\n\nexport function getMasterKeyFromSeed(seed: Uint8Array): KeyTreeNode {\n const I = hmac(seed, ED25519_CURVE);\n const IL = I.slice(0, 32);\n const IR = I.slice(32);\n return {\n secretKey: IL,\n chainCode: IR,\n };\n}\n\nexport function derivePathFromSeed(path: 'm' | `m/${Bip32Path<5>}`, seed: Uint8Array): KeyTreeNode {\n if (!['m', 'm/'].includes(path.slice(0, 2))) {\n throw new DerivationError('Root element is required');\n }\n const masterKey = getMasterKeyFromSeed(seed);\n return derivePathFromKey(path.slice(2) as Bip32Path<5>, masterKey);\n}\n\nfunction formatAccount(keys: nacl.SignKeyPair): Account {\n const { secretKey, publicKey } = keys;\n return {\n secretKey: bytesToHex(secretKey),\n publicKey: encode(publicKey, Encoding.AccountAddress),\n };\n}\n\nexport function getKeyPair(secretKey: Uint8Array): nacl.SignKeyPair {\n return nacl.sign.keyPair.fromSeed(secretKey);\n}\n\nexport function generateSaveHDWalletFromSeed(seed: Uint8Array, password: string): HDWallet {\n const walletKey = derivePathFromSeed('m/44h/457h', seed);\n return {\n secretKey: bytesToHex(encryptKey(password, walletKey.secretKey)),\n chainCode: bytesToHex(encryptKey(password, walletKey.chainCode)),\n };\n}\n\nexport function getSaveHDWalletAccounts(\n saveHDWallet: HDWallet,\n password: string,\n accountCount: number,\n): Account[] {\n const walletKey = {\n secretKey: decryptKey(password, Buffer.from(saveHDWallet.secretKey, 'hex')),\n chainCode: decryptKey(password, Buffer.from(saveHDWallet.chainCode, 'hex')),\n };\n return (new Array(accountCount)).fill(undefined)\n .map((_, idx) => formatAccount(getKeyPair(derivePathFromKey(`${idx}h/0h/0h`, walletKey).secretKey)));\n}\n\nexport const getHdWalletAccountFromSeed = (\n seed: Uint8Array,\n accountIdx: number,\n): Account & { idx: number } => {\n const walletKey = derivePathFromSeed('m/44h/457h', seed);\n const derived = derivePathFromKey(`${accountIdx}h/0h/0h`, walletKey);\n const keyPair = getKeyPair(derived.secretKey);\n return {\n ...formatAccount(keyPair),\n idx: accountIdx,\n };\n};\n"],"mappings":";;;;;AAAA,OAAOA,IAAP,MAAiB,WAAjB;AACA,2BAA6B,gBAA7B;;;;AACA,uBAA2B,YAA3B;;;;AACA,OAAOC,KAAP,MAAkB,QAAlB;SACSC,U,EAAYC,M,EAAQC,Q;SACpBC,iB;SACAC,U;SACAC,a;AAET,MAAMC,GAAG,GAAGP,KAAK,CAACQ,eAAN,CAAsBC,GAAlC,C,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AACtC,SAAzB,EAAoC,KAApC,CAAX,CADL;IAEhBC,SAAS,EAAEd,UAAU,CAACL,QAAD,EAAW,QAAOQ,IAAP,CAAYgD,YAAY,CAACrC,SAAzB,EAAoC,KAApC,CAAX;EAFL,CAAlB;EAIA,OAAQ,IAAIuC,KAAJ,CAAUD,YAAV,CAAD,CAA0BE,IAA1B,CAA+BC,SAA/B,EACJC,GADI,CACA,CAACC,CAAD,EAAIC,GAAJ,KAAYlB,aAAa,CAACI,UAAU,CAACnB,iBAAiB,CAAE,GAAEiC,GAAI,SAAR,EAAkBT,SAAlB,CAAjB,CAA8CpC,SAA/C,CAAX,CADzB,CAAP;AAED;AAED,OAAO,MAAM8C,0BAA0B,GAAG,CACxCtB,IADwC,EAExCuB,UAFwC,KAGV;EAC9B,MAAMX,SAAS,GAAGX,kBAAkB,CAAC,YAAD,EAAeD,IAAf,CAApC;EACA,MAAMwB,OAAO,GAAGpC,iBAAiB,CAAE,GAAEmC,UAAW,SAAf,EAAyBX,SAAzB,CAAjC;EACA,MAAMH,OAAO,GAAGF,UAAU,CAACiB,OAAO,CAAChD,SAAT,CAA1B;EACA,OAAO,EACL,GAAG2B,aAAa,CAACM,OAAD,CADX;IAELY,GAAG,EAAEE;EAFA,CAAP;AAID,CAXM"}
1
+ {"version":3,"file":"hd-wallet.mjs","names":["nacl","aesjs","sha256hash","encode","Encoding","CryptographyError","concatBuffers","Ecb","ModeOfOperation","ecb","encryptKey","password","binaryData","hashedPasswordBytes","aesEcb","encrypt","decryptKey","encrypted","encryptedBytes","from","decrypt","DerivationError","constructor","message","name","ED25519_CURVE","HARDENED_OFFSET","deriveChild","index","secretKey","chainCode","indexBuffer","allocUnsafe","writeUInt32BE","data","alloc","I","hmac","IL","slice","IR","derivePathFromKey","path","key","segments","fromString","toPathArray","forEach","segment","i","reduce","parentKey","getMasterKeyFromSeed","seed","derivePathFromSeed","includes","masterKey","formatAccount","keys","publicKey","toString","AccountAddress","getKeyPair","sign","keyPair","fromSeed","generateSaveHDWalletFromSeed","walletKey","getSaveHDWalletAccounts","saveHDWallet","accountCount","Array","fill","undefined","map","_","idx","getHdWalletAccountFromSeed","accountIdx","derived"],"sources":["../../src/utils/hd-wallet.ts"],"sourcesContent":["import nacl from 'tweetnacl';\nimport { full as hmac } from 'tweetnacl-auth';\nimport { fromString } from 'bip32-path';\nimport aesjs from 'aes-js';\nimport { sha256hash, encode, Encoding } from './encoder';\nimport { CryptographyError } from './errors';\nimport { concatBuffers } from './other';\n\nconst Ecb = aesjs.ModeOfOperation.ecb;\n\n// TODO: use mnemonic encryption instead of AES\n/**\n * Encrypt given data using `password`\n * @param password - Password to encrypt with\n * @param binaryData - Data to encrypt\n * @returns Encrypted data\n */\nfunction encryptKey(password: string, binaryData: Uint8Array): Uint8Array {\n const hashedPasswordBytes = sha256hash(password);\n const aesEcb = new Ecb(hashedPasswordBytes);\n return aesEcb.encrypt(binaryData);\n}\n\n/**\n * Decrypt given data using `password`\n * @param password - Password to decrypt with\n * @param encrypted - Data to decrypt\n * @returns Decrypted data\n */\nfunction decryptKey(password: string, encrypted: Uint8Array): Uint8Array {\n const encryptedBytes = Buffer.from(encrypted);\n const hashedPasswordBytes = sha256hash(password);\n const aesEcb = new Ecb(hashedPasswordBytes);\n return aesEcb.decrypt(encryptedBytes);\n}\n\n/**\n * @category exception\n */\nexport class DerivationError extends CryptographyError {\n constructor(message: string) {\n super(message);\n this.name = 'DerivationError';\n }\n}\n\nconst ED25519_CURVE = Buffer.from('ed25519 seed');\nconst HARDENED_OFFSET = 0x80000000;\n\ninterface KeyTreeNode {\n secretKey: Uint8Array;\n chainCode: Uint8Array;\n}\n\ninterface HDWallet {\n secretKey: string;\n chainCode: string;\n}\n\ninterface Account {\n secretKey: string;\n publicKey: string;\n}\n\ntype Dec<N extends number> = [-1, 0, 1, 2, 3, 4][N];\ntype Bip32PathT<MaxLen extends number, H extends 'H' | 'h' | '\\''> = MaxLen extends -1\n ? `${number}${H}`\n : Bip32PathT<Dec<MaxLen>, H> | `${Bip32PathT<Dec<MaxLen>, H>}/${number}${H}`;\ntype Bip32Path<MaxLen extends number> =\n '' | Bip32PathT<MaxLen, 'H'> | Bip32PathT<MaxLen, 'h'> | Bip32PathT<MaxLen, '\\''>;\n\n/**\n * @category hd-wallet\n */\nexport function deriveChild({ secretKey, chainCode }: KeyTreeNode, index: number): KeyTreeNode {\n if (index < HARDENED_OFFSET) {\n throw new DerivationError(`Segment ${index} is not hardened`);\n }\n const indexBuffer = Buffer.allocUnsafe(4);\n indexBuffer.writeUInt32BE(index, 0);\n\n const data = concatBuffers([Buffer.alloc(1, 0), secretKey, indexBuffer]);\n\n const I = hmac(data, chainCode);\n const IL = I.slice(0, 32);\n const IR = I.slice(32);\n return {\n secretKey: IL,\n chainCode: IR,\n };\n}\n\n/**\n * @category hd-wallet\n */\nexport function derivePathFromKey(path: Bip32Path<5>, key: KeyTreeNode): KeyTreeNode {\n const segments = path === '' ? [] : fromString(path).toPathArray();\n segments.forEach((segment, i) => {\n if (segment < HARDENED_OFFSET) {\n throw new DerivationError(`Segment #${i + 1} is not hardened`);\n }\n });\n\n return segments.reduce((parentKey, segment) => deriveChild(parentKey, segment), key);\n}\n\n/**\n * @category hd-wallet\n */\nexport function getMasterKeyFromSeed(seed: Uint8Array): KeyTreeNode {\n const I = hmac(seed, ED25519_CURVE);\n const IL = I.slice(0, 32);\n const IR = I.slice(32);\n return {\n secretKey: IL,\n chainCode: IR,\n };\n}\n\n/**\n * @category hd-wallet\n */\nexport function derivePathFromSeed(path: 'm' | `m/${Bip32Path<5>}`, seed: Uint8Array): KeyTreeNode {\n if (!['m', 'm/'].includes(path.slice(0, 2))) {\n throw new DerivationError('Root element is required');\n }\n const masterKey = getMasterKeyFromSeed(seed);\n return derivePathFromKey(path.slice(2) as Bip32Path<5>, masterKey);\n}\n\nfunction formatAccount(keys: nacl.SignKeyPair): Account {\n const { secretKey, publicKey } = keys;\n return {\n secretKey: Buffer.from(secretKey).toString('hex'),\n publicKey: encode(publicKey, Encoding.AccountAddress),\n };\n}\n\n/**\n * @category hd-wallet\n */\nexport function getKeyPair(secretKey: Uint8Array): nacl.SignKeyPair {\n return nacl.sign.keyPair.fromSeed(secretKey);\n}\n\n/**\n * @category hd-wallet\n */\nexport function generateSaveHDWalletFromSeed(seed: Uint8Array, password: string): HDWallet {\n const walletKey = derivePathFromSeed('m/44h/457h', seed);\n return {\n secretKey: Buffer.from(encryptKey(password, walletKey.secretKey)).toString('hex'),\n chainCode: Buffer.from(encryptKey(password, walletKey.chainCode)).toString('hex'),\n };\n}\n\n/**\n * @category hd-wallet\n */\nexport function getSaveHDWalletAccounts(\n saveHDWallet: HDWallet,\n password: string,\n accountCount: number,\n): Account[] {\n const walletKey = {\n secretKey: decryptKey(password, Buffer.from(saveHDWallet.secretKey, 'hex')),\n chainCode: decryptKey(password, Buffer.from(saveHDWallet.chainCode, 'hex')),\n };\n return (new Array(accountCount)).fill(undefined)\n .map((_, idx) => formatAccount(getKeyPair(derivePathFromKey(`${idx}h/0h/0h`, walletKey).secretKey)));\n}\n\n/**\n * @category hd-wallet\n */\nexport const getHdWalletAccountFromSeed = (\n seed: Uint8Array,\n accountIdx: number,\n): Account & { idx: number } => {\n const walletKey = derivePathFromSeed('m/44h/457h', seed);\n const derived = derivePathFromKey(`${accountIdx}h/0h/0h`, walletKey);\n const keyPair = getKeyPair(derived.secretKey);\n return {\n ...formatAccount(keyPair),\n idx: accountIdx,\n };\n};\n"],"mappings":";;;;AAAA,OAAOA,IAAI,MAAM,WAAW;AAC5B,2BAA6B,gBAAgB;AAAC;EAAA;AAAA;AAC9C,uBAA2B,YAAY;AAAC;EAAA;AAAA;AACxC,OAAOC,KAAK,MAAM,QAAQ;AAAC,SAClBC,UAAU,EAAEC,MAAM,EAAEC,QAAQ;AAAA,SAC5BC,iBAAiB;AAAA,SACjBC,aAAa;AAEtB,MAAMC,GAAG,GAAGN,KAAK,CAACO,eAAe,CAACC,GAAG;;AAErC;AACA;AACA;AACA;AACA;AACA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CACrCC,YAAsB,EACtB1D,QAAgB,EAChB2D,YAAoB,EACT;EACX,MAAMH,SAAS,GAAG;IAChBtC,SAAS,EAAEb,UAAU,CAACL,QAAQ,EAAE,QAAOQ,IAAI,CAACkD,YAAY,CAACxC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3EC,SAAS,EAAEd,UAAU,CAACL,QAAQ,EAAE,QAAOQ,IAAI,CAACkD,YAAY,CAACvC,SAAS,EAAE,KAAK,CAAC;EAC5E,CAAC;EACD,OAAQ,IAAIyC,KAAK,CAACD,YAAY,CAAC,CAAEE,IAAI,CAACC,SAAS,CAAC,CAC7CC,GAAG,CAAC,CAACC,CAAC,EAAEC,GAAG,KAAKnB,aAAa,CAACK,UAAU,CAACrB,iBAAiB,CAAE,GAAEmC,GAAI,SAAQ,EAAET,SAAS,CAAC,CAACtC,SAAS,CAAC,CAAC,CAAC;AACxG;;AAEA;AACA;AACA;AACA,OAAO,MAAMgD,0BAA0B,GAAG,CACxCxB,IAAgB,EAChByB,UAAkB,KACY;EAC9B,MAAMX,SAAS,GAAGb,kBAAkB,CAAC,YAAY,EAAED,IAAI,CAAC;EACxD,MAAM0B,OAAO,GAAGtC,iBAAiB,CAAE,GAAEqC,UAAW,SAAQ,EAAEX,SAAS,CAAC;EACpE,MAAMH,OAAO,GAAGF,UAAU,CAACiB,OAAO,CAAClD,SAAS,CAAC;EAC7C,OAAO;IACL,GAAG4B,aAAa,CAACO,OAAO,CAAC;IACzBY,GAAG,EAAEE;EACP,CAAC;AACH,CAAC"}
@@ -4,7 +4,6 @@ import { mapObject } from "./other.mjs";
4
4
  const jsonBig = JsonBig({
5
5
  storeAsString: true
6
6
  });
7
-
8
7
  const convertValuesToBigNumbers = value => {
9
8
  if (typeof value === 'object' && value !== null && value.constructor === Object) {
10
9
  return mapObject(value, _ref => {
@@ -12,28 +11,21 @@ const convertValuesToBigNumbers = value => {
12
11
  return [k, convertValuesToBigNumbers(v)];
13
12
  });
14
13
  }
15
-
16
14
  if (Array.isArray(value)) {
17
15
  return value.map(item => convertValuesToBigNumbers(item));
18
16
  }
19
-
20
17
  if (typeof value === 'string' && new BigNumber(value).toString(10) === value) {
21
18
  const bn = new BigNumber(value);
22
-
23
19
  bn.toJSON = () => bn.toString(10);
24
-
25
20
  return bn;
26
21
  }
27
-
28
22
  return value;
29
23
  };
30
-
31
24
  export default {
32
25
  stringify: function () {
33
26
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
34
27
  args[_key] = arguments[_key];
35
28
  }
36
-
37
29
  return jsonBig.stringify(convertValuesToBigNumbers(args[0]), ...args.slice(1));
38
30
  },
39
31
  parse: jsonBig.parse
@@ -1 +1 @@
1
- {"version":3,"file":"json-big.mjs","names":["JsonBig","BigNumber","mapObject","jsonBig","storeAsString","convertValuesToBigNumbers","value","constructor","Object","k","v","Array","isArray","map","item","toString","bn","toJSON","stringify","args","slice","parse"],"sources":["../../src/utils/json-big.ts"],"sourcesContent":["import JsonBig from 'json-bigint';\nimport BigNumber from 'bignumber.js';\nimport { mapObject } from './other';\n\nconst jsonBig = JsonBig({ storeAsString: true });\n\nconst convertValuesToBigNumbers = (value: any): any => {\n if (typeof value === 'object' && value !== null && value.constructor === Object) {\n return mapObject(value, ([k, v]) => [k, convertValuesToBigNumbers(v)]);\n }\n if (Array.isArray(value)) {\n return value.map((item) => convertValuesToBigNumbers(item));\n }\n if (typeof value === 'string' && new BigNumber(value).toString(10) === value) {\n const bn = new BigNumber(value);\n bn.toJSON = () => bn.toString(10);\n return bn;\n }\n return value;\n};\n\nexport default {\n stringify: (...args: Parameters<typeof JsonBig['stringify']>): string => (\n jsonBig.stringify(convertValuesToBigNumbers(args[0]), ...args.slice(1))\n ),\n parse: jsonBig.parse,\n};\n"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,aAApB;AACA,OAAOC,SAAP,MAAsB,cAAtB;SACSC,S;AAET,MAAMC,OAAO,GAAGH,OAAO,CAAC;EAAEI,aAAa,EAAE;AAAjB,CAAD,CAAvB;;AAEA,MAAMC,yBAAyB,GAAIC,KAAD,IAAqB;EACrD,IAAI,OAAOA,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,KAAK,IAAvC,IAA+CA,KAAK,CAACC,WAAN,KAAsBC,MAAzE,EAAiF;IAC/E,OAAON,SAAS,CAACI,KAAD,EAAQ;MAAA,IAAC,CAACG,CAAD,EAAIC,CAAJ,CAAD;MAAA,OAAY,CAACD,CAAD,EAAIJ,yBAAyB,CAACK,CAAD,CAA7B,CAAZ;IAAA,CAAR,CAAhB;EACD;;EACD,IAAIC,KAAK,CAACC,OAAN,CAAcN,KAAd,CAAJ,EAA0B;IACxB,OAAOA,KAAK,CAACO,GAAN,CAAWC,IAAD,IAAUT,yBAAyB,CAACS,IAAD,CAA7C,CAAP;EACD;;EACD,IAAI,OAAOR,KAAP,KAAiB,QAAjB,IAA6B,IAAIL,SAAJ,CAAcK,KAAd,EAAqBS,QAArB,CAA8B,EAA9B,MAAsCT,KAAvE,EAA8E;IAC5E,MAAMU,EAAE,GAAG,IAAIf,SAAJ,CAAcK,KAAd,CAAX;;IACAU,EAAE,CAACC,MAAH,GAAY,MAAMD,EAAE,CAACD,QAAH,CAAY,EAAZ,CAAlB;;IACA,OAAOC,EAAP;EACD;;EACD,OAAOV,KAAP;AACD,CAbD;;AAeA,eAAe;EACbY,SAAS,EAAE;IAAA,kCAAIC,IAAJ;MAAIA,IAAJ;IAAA;;IAAA,OACThB,OAAO,CAACe,SAAR,CAAkBb,yBAAyB,CAACc,IAAI,CAAC,CAAD,CAAL,CAA3C,EAAsD,GAAGA,IAAI,CAACC,KAAL,CAAW,CAAX,CAAzD,CADS;EAAA,CADE;EAIbC,KAAK,EAAElB,OAAO,CAACkB;AAJF,CAAf"}
1
+ {"version":3,"file":"json-big.mjs","names":["JsonBig","BigNumber","mapObject","jsonBig","storeAsString","convertValuesToBigNumbers","value","constructor","Object","k","v","Array","isArray","map","item","toString","bn","toJSON","stringify","args","slice","parse"],"sources":["../../src/utils/json-big.ts"],"sourcesContent":["import JsonBig from 'json-bigint';\nimport BigNumber from 'bignumber.js';\nimport { mapObject } from './other';\n\nconst jsonBig = JsonBig({ storeAsString: true });\n\nconst convertValuesToBigNumbers = (value: any): any => {\n if (typeof value === 'object' && value !== null && value.constructor === Object) {\n return mapObject(value, ([k, v]) => [k, convertValuesToBigNumbers(v)]);\n }\n if (Array.isArray(value)) {\n return value.map((item) => convertValuesToBigNumbers(item));\n }\n if (typeof value === 'string' && new BigNumber(value).toString(10) === value) {\n const bn = new BigNumber(value);\n bn.toJSON = () => bn.toString(10);\n return bn;\n }\n return value;\n};\n\nexport default {\n stringify: (...args: Parameters<typeof JsonBig['stringify']>): string => (\n jsonBig.stringify(convertValuesToBigNumbers(args[0]), ...args.slice(1))\n ),\n parse: jsonBig.parse,\n};\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,aAAa;AACjC,OAAOC,SAAS,MAAM,cAAc;AAAC,SAC5BC,SAAS;AAElB,MAAMC,OAAO,GAAGH,OAAO,CAAC;EAAEI,aAAa,EAAE;AAAK,CAAC,CAAC;AAEhD,MAAMC,yBAAyB,GAAIC,KAAU,IAAU;EACrD,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,CAACC,WAAW,KAAKC,MAAM,EAAE;IAC/E,OAAON,SAAS,CAACI,KAAK,EAAE;MAAA,IAAC,CAACG,CAAC,EAAEC,CAAC,CAAC;MAAA,OAAK,CAACD,CAAC,EAAEJ,yBAAyB,CAACK,CAAC,CAAC,CAAC;IAAA,EAAC;EACxE;EACA,IAAIC,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;IACxB,OAAOA,KAAK,CAACO,GAAG,CAAEC,IAAI,IAAKT,yBAAyB,CAACS,IAAI,CAAC,CAAC;EAC7D;EACA,IAAI,OAAOR,KAAK,KAAK,QAAQ,IAAI,IAAIL,SAAS,CAACK,KAAK,CAAC,CAACS,QAAQ,CAAC,EAAE,CAAC,KAAKT,KAAK,EAAE;IAC5E,MAAMU,EAAE,GAAG,IAAIf,SAAS,CAACK,KAAK,CAAC;IAC/BU,EAAE,CAACC,MAAM,GAAG,MAAMD,EAAE,CAACD,QAAQ,CAAC,EAAE,CAAC;IACjC,OAAOC,EAAE;EACX;EACA,OAAOV,KAAK;AACd,CAAC;AAED,eAAe;EACbY,SAAS,EAAE;IAAA,kCAAIC,IAAI;MAAJA,IAAI;IAAA;IAAA,OACjBhB,OAAO,CAACe,SAAS,CAACb,yBAAyB,CAACc,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAGA,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;EAAA,CACxE;EACDC,KAAK,EAAElB,OAAO,CAACkB;AACjB,CAAC"}
@@ -31,6 +31,7 @@ export interface Keystore {
31
31
  }
32
32
  /**
33
33
  * Recover plaintext private key from secret-storage key object.
34
+ * @category keystore
34
35
  * @param password - Keystore object password.
35
36
  * @param keystore - Keystore object.
36
37
  * @returns Plaintext private key.
@@ -38,6 +39,7 @@ export interface Keystore {
38
39
  export declare function recover(password: string | Uint8Array, { crypto }: Keystore): Promise<string>;
39
40
  /**
40
41
  * Export private key to keystore secret-storage format.
42
+ * @category keystore
41
43
  * @param name - Key name.
42
44
  * @param password - User-supplied password.
43
45
  * @param privateKey - Private key as hex-string or a Buffer.