@aeternity/aepp-sdk 11.0.1 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/LICENSE +1 -1
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.LICENSE.txt +12 -19
  4. package/dist/aepp-sdk.browser-script.js.map +1 -1
  5. package/dist/aepp-sdk.browser.js +1 -1
  6. package/dist/aepp-sdk.browser.js.map +1 -1
  7. package/dist/aepp-sdk.js +1 -1
  8. package/dist/aepp-sdk.js.map +1 -1
  9. package/es/AeSdk.d.ts +37 -0
  10. package/es/AeSdk.mjs +81 -0
  11. package/es/AeSdk.mjs.map +1 -0
  12. package/es/AeSdkAepp.d.ts +69 -0
  13. package/es/AeSdkAepp.mjs +175 -0
  14. package/es/AeSdkAepp.mjs.map +1 -0
  15. package/es/AeSdkBase.d.ts +212 -0
  16. package/es/AeSdkBase.mjs +310 -0
  17. package/es/AeSdkBase.mjs.map +1 -0
  18. package/es/AeSdkWallet.d.ts +103 -0
  19. package/es/AeSdkWallet.mjs +322 -0
  20. package/es/AeSdkWallet.mjs.map +1 -0
  21. package/es/Node.d.ts +44 -0
  22. package/es/Node.mjs +141 -0
  23. package/es/Node.mjs.map +1 -0
  24. package/es/account/Base.d.ts +65 -0
  25. package/es/account/Base.mjs +123 -0
  26. package/es/account/Base.mjs.map +1 -0
  27. package/es/account/Memory.d.ts +25 -0
  28. package/es/account/Memory.mjs +81 -0
  29. package/es/account/Memory.mjs.map +1 -0
  30. package/es/account/Rpc.d.ts +27 -0
  31. package/es/account/Rpc.mjs +79 -0
  32. package/es/account/Rpc.mjs.map +1 -0
  33. package/es/aens.d.ts +209 -0
  34. package/es/aens.mjs +332 -0
  35. package/es/aens.mjs.map +1 -0
  36. package/es/aepp-wallet-communication/connection/Browser.d.ts +32 -0
  37. package/es/aepp-wallet-communication/connection/Browser.mjs +70 -0
  38. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -0
  39. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +17 -0
  40. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +57 -0
  41. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -0
  42. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +35 -0
  43. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +142 -0
  44. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -0
  45. package/es/aepp-wallet-communication/connection-proxy.d.ts +10 -0
  46. package/{src/utils/crypto-ts.ts → es/aepp-wallet-communication/connection-proxy.mjs} +15 -11
  47. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -0
  48. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +33 -0
  49. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +169 -0
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -0
  51. package/es/aepp-wallet-communication/rpc/types.d.ts +77 -0
  52. package/es/aepp-wallet-communication/rpc/types.mjs +3 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -0
  54. package/es/aepp-wallet-communication/schema.d.ts +90 -46
  55. package/es/aepp-wallet-communication/schema.mjs +214 -0
  56. package/es/aepp-wallet-communication/schema.mjs.map +1 -0
  57. package/es/aepp-wallet-communication/wallet-detector.d.ts +24 -0
  58. package/es/aepp-wallet-communication/wallet-detector.mjs +63 -0
  59. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -0
  60. package/es/apis/compiler/compiler.d.ts +92 -0
  61. package/es/apis/compiler/compiler.mjs +576 -0
  62. package/es/apis/compiler/compiler.mjs.map +1 -0
  63. package/es/apis/compiler/index.d.ts +2 -0
  64. package/es/apis/compiler/index.mjs +3 -0
  65. package/es/apis/compiler/index.mjs.map +1 -0
  66. package/es/apis/compiler/models/index.d.ts +248 -0
  67. package/es/apis/compiler/models/index.mjs +48 -0
  68. package/es/apis/compiler/models/index.mjs.map +1 -0
  69. package/es/apis/compiler/models/mappers.d.ts +23 -0
  70. package/es/apis/compiler/models/mappers.mjs +585 -0
  71. package/es/apis/compiler/models/mappers.mjs.map +1 -0
  72. package/es/apis/compiler/models/parameters.d.ts +13 -0
  73. package/es/apis/compiler/models/parameters.mjs +71 -0
  74. package/es/apis/compiler/models/parameters.mjs.map +1 -0
  75. package/es/apis/node/index.d.ts +2 -0
  76. package/es/apis/node/index.mjs +3 -0
  77. package/es/apis/node/index.mjs.map +1 -0
  78. package/es/apis/node/models/index.d.ts +1061 -0
  79. package/es/apis/node/models/index.mjs +2 -0
  80. package/es/apis/node/models/index.mjs.map +1 -0
  81. package/es/apis/node/models/mappers.d.ts +95 -0
  82. package/es/apis/node/models/mappers.mjs +4164 -0
  83. package/es/apis/node/models/mappers.mjs.map +1 -0
  84. package/es/apis/node/models/parameters.d.ts +17 -0
  85. package/es/apis/node/models/parameters.mjs +165 -0
  86. package/es/apis/node/models/parameters.mjs.map +1 -0
  87. package/es/apis/node/node.d.ts +215 -0
  88. package/es/apis/node/node.mjs +1165 -0
  89. package/es/apis/node/node.mjs.map +1 -0
  90. package/es/chain.d.ts +220 -0
  91. package/es/chain.mjs +524 -0
  92. package/es/chain.mjs.map +1 -0
  93. package/es/channel/handlers.d.ts +34 -0
  94. package/es/channel/handlers.mjs +147 -112
  95. package/es/channel/handlers.mjs.map +1 -1
  96. package/es/channel/index.d.ts +634 -0
  97. package/es/channel/index.mjs +898 -900
  98. package/es/channel/index.mjs.map +1 -1
  99. package/es/channel/internal.d.ts +100 -0
  100. package/es/channel/internal.mjs +97 -51
  101. package/es/channel/internal.mjs.map +1 -1
  102. package/es/contract/Compiler.d.ts +17 -0
  103. package/es/contract/Compiler.mjs +67 -0
  104. package/es/contract/Compiler.mjs.map +1 -0
  105. package/es/contract/aci.d.ts +125 -0
  106. package/es/contract/aci.mjs +199 -180
  107. package/es/contract/aci.mjs.map +1 -1
  108. package/es/contract/ga.d.ts +68 -0
  109. package/es/contract/ga.mjs +190 -0
  110. package/es/contract/ga.mjs.map +1 -0
  111. package/es/contract/methods.d.ts +68 -0
  112. package/es/contract/methods.mjs +101 -0
  113. package/es/contract/methods.mjs.map +1 -0
  114. package/es/index.d.ts +32 -0
  115. package/es/index.mjs +32 -40
  116. package/es/index.mjs.map +1 -1
  117. package/es/oracle.d.ts +154 -0
  118. package/es/oracle.mjs +288 -0
  119. package/es/oracle.mjs.map +1 -0
  120. package/es/spend.d.ts +61 -0
  121. package/es/spend.mjs +122 -0
  122. package/es/spend.mjs.map +1 -0
  123. package/es/tx/builder/constants.d.ts +41 -0
  124. package/es/tx/builder/constants.mjs +11 -19
  125. package/es/tx/builder/constants.mjs.map +1 -1
  126. package/es/tx/builder/field-types.d.ts +62 -0
  127. package/es/tx/builder/field-types.mjs +62 -10
  128. package/es/tx/builder/field-types.mjs.map +1 -1
  129. package/es/tx/builder/helpers.d.ts +131 -0
  130. package/es/tx/builder/helpers.mjs +71 -169
  131. package/es/tx/builder/helpers.mjs.map +1 -1
  132. package/es/tx/builder/index.d.ts +75 -0
  133. package/es/tx/builder/index.mjs +141 -323
  134. package/es/tx/builder/index.mjs.map +1 -1
  135. package/es/tx/builder/schema.d.ts +350 -0
  136. package/es/tx/builder/schema.mjs +173 -510
  137. package/es/tx/builder/schema.mjs.map +1 -1
  138. package/es/tx/index.d.ts +63 -0
  139. package/es/tx/index.mjs +171 -265
  140. package/es/tx/index.mjs.map +1 -1
  141. package/es/tx/min-fee.d.ts +20 -0
  142. package/es/tx/min-fee.mjs +148 -0
  143. package/es/tx/min-fee.mjs.map +1 -0
  144. package/es/tx/validator.d.ts +19 -0
  145. package/es/tx/validator.mjs +64 -71
  146. package/es/tx/validator.mjs.map +1 -1
  147. package/es/typings/@aeternity__argon2-browser/index.d.mjs +2 -0
  148. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +1 -0
  149. package/es/typings/@aeternity__uuid/index.d.mjs +2 -0
  150. package/es/typings/@aeternity__uuid/index.d.mjs.map +1 -0
  151. package/es/typings/bip32-path/index.d.mjs +2 -0
  152. package/es/typings/bip32-path/index.d.mjs.map +1 -0
  153. package/es/typings/blakejs/index.d.mjs.map +1 -1
  154. package/es/typings/tweetnacl-auth/index.d.mjs +2 -0
  155. package/es/typings/tweetnacl-auth/index.d.mjs.map +1 -0
  156. package/es/utils/amount-formatter.d.ts +42 -0
  157. package/es/utils/amount-formatter.mjs +28 -41
  158. package/es/utils/amount-formatter.mjs.map +1 -1
  159. package/es/utils/autorest.d.ts +6 -0
  160. package/es/utils/autorest.mjs +97 -0
  161. package/es/utils/autorest.mjs.map +1 -0
  162. package/es/utils/bignumber.d.ts +13 -0
  163. package/es/utils/bignumber.mjs +10 -8
  164. package/es/utils/bignumber.mjs.map +1 -1
  165. package/es/{bytes.d.ts → utils/bytes.d.ts} +10 -13
  166. package/es/utils/bytes.mjs +10 -14
  167. package/es/utils/bytes.mjs.map +1 -1
  168. package/es/utils/crypto.d.ts +103 -0
  169. package/es/utils/crypto.mjs +60 -68
  170. package/es/utils/crypto.mjs.map +1 -1
  171. package/es/utils/encoder.d.ts +26 -0
  172. package/es/utils/encoder.mjs +47 -51
  173. package/es/utils/encoder.mjs.map +1 -1
  174. package/es/{errors.d.ts → utils/errors.d.ts} +254 -57
  175. package/es/utils/errors.mjs +318 -125
  176. package/es/utils/errors.mjs.map +1 -1
  177. package/es/utils/hd-wallet.d.ts +34 -0
  178. package/es/utils/hd-wallet.mjs +27 -16
  179. package/es/utils/hd-wallet.mjs.map +1 -1
  180. package/es/utils/json-big.d.ts +5 -0
  181. package/es/utils/json-big.mjs +10 -14
  182. package/es/utils/json-big.mjs.map +1 -1
  183. package/es/utils/keystore.d.ts +51 -0
  184. package/es/utils/keystore.mjs +98 -193
  185. package/es/utils/keystore.mjs.map +1 -1
  186. package/es/{mptree.d.ts → utils/mptree.d.ts} +5 -8
  187. package/es/utils/mptree.mjs +13 -14
  188. package/es/utils/mptree.mjs.map +1 -1
  189. package/es/utils/other.d.ts +14 -0
  190. package/es/utils/other.mjs +21 -36
  191. package/es/utils/other.mjs.map +1 -1
  192. package/es/{semver-satisfies.d.ts → utils/semver-satisfies.d.ts} +0 -0
  193. package/es/utils/semver-satisfies.mjs.map +1 -1
  194. package/es/utils/string.d.ts +24 -0
  195. package/es/utils/string.mjs +8 -10
  196. package/es/utils/string.mjs.map +1 -1
  197. package/package.json +49 -39
  198. package/src/AeSdk.ts +65 -0
  199. package/src/AeSdkAepp.ts +167 -0
  200. package/src/AeSdkBase.ts +320 -0
  201. package/src/AeSdkWallet.ts +332 -0
  202. package/src/Node.ts +167 -0
  203. package/src/account/Base.ts +114 -0
  204. package/src/account/Memory.ts +83 -0
  205. package/src/account/Rpc.ts +67 -0
  206. package/src/aens.ts +391 -0
  207. package/src/aepp-wallet-communication/connection/Browser.ts +68 -0
  208. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +58 -0
  209. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +111 -0
  210. package/{es/utils/crypto-ts.mjs → src/aepp-wallet-communication/connection-proxy.ts} +16 -17
  211. package/src/aepp-wallet-communication/rpc/RpcClient.ts +137 -0
  212. package/src/aepp-wallet-communication/rpc/types.ts +66 -0
  213. package/src/aepp-wallet-communication/schema.ts +181 -0
  214. package/src/aepp-wallet-communication/wallet-detector.ts +71 -0
  215. package/src/apis/compiler/code-model-v4.yaml +2649 -0
  216. package/src/apis/compiler/compiler.ts +585 -0
  217. package/src/apis/compiler/index.ts +2 -0
  218. package/src/apis/compiler/models/index.ts +301 -0
  219. package/src/apis/compiler/models/mappers.ts +583 -0
  220. package/src/apis/compiler/models/parameters.ts +93 -0
  221. package/src/apis/node/code-model-v4.yaml +10046 -0
  222. package/src/apis/node/index.ts +2 -0
  223. package/src/apis/node/models/index.ts +1253 -0
  224. package/src/apis/node/models/mappers.ts +4278 -0
  225. package/src/apis/node/models/parameters.ts +188 -0
  226. package/src/apis/node/node.ts +1299 -0
  227. package/src/chain.ts +444 -0
  228. package/src/channel/{handlers.js → handlers.ts} +220 -128
  229. package/src/channel/index.ts +991 -0
  230. package/src/channel/internal.ts +345 -0
  231. package/src/contract/Compiler.ts +66 -0
  232. package/src/contract/aci.ts +529 -0
  233. package/src/contract/ga.ts +178 -0
  234. package/src/contract/methods.ts +118 -0
  235. package/src/index.ts +51 -0
  236. package/src/oracle.ts +342 -0
  237. package/src/spend.ts +152 -0
  238. package/src/tx/builder/{constants.js → constants.ts} +12 -16
  239. package/src/tx/builder/field-types.ts +111 -0
  240. package/src/tx/builder/helpers.ts +253 -0
  241. package/src/tx/builder/index.ts +394 -0
  242. package/src/tx/builder/schema.ts +771 -0
  243. package/src/tx/index.ts +199 -0
  244. package/src/tx/min-fee.ts +136 -0
  245. package/src/tx/validator.ts +226 -0
  246. package/src/typings/@aeternity__argon2-browser/index.d.ts +3 -0
  247. package/src/typings/@aeternity__uuid/index.d.ts +3 -0
  248. package/src/typings/bip32-path/index.d.ts +33 -0
  249. package/src/typings/tweetnacl-auth/index.d.ts +14 -0
  250. package/src/utils/amount-formatter.ts +29 -42
  251. package/src/utils/autorest.ts +90 -0
  252. package/src/utils/bignumber.ts +9 -11
  253. package/src/utils/bytes.ts +12 -14
  254. package/src/utils/crypto.ts +217 -0
  255. package/src/utils/encoder.ts +52 -55
  256. package/src/utils/errors.ts +268 -134
  257. package/src/utils/hd-wallet.ts +134 -0
  258. package/src/utils/json-big.ts +26 -0
  259. package/src/utils/keystore.ts +179 -0
  260. package/src/utils/mptree.ts +14 -14
  261. package/src/utils/other.ts +28 -43
  262. package/src/utils/string.ts +8 -10
  263. package/es/account/base.mjs +0 -179
  264. package/es/account/base.mjs.map +0 -1
  265. package/es/account/memory.mjs +0 -99
  266. package/es/account/memory.mjs.map +0 -1
  267. package/es/account/multiple.mjs +0 -179
  268. package/es/account/multiple.mjs.map +0 -1
  269. package/es/ae/aens.mjs +0 -404
  270. package/es/ae/aens.mjs.map +0 -1
  271. package/es/ae/aepp.mjs +0 -45
  272. package/es/ae/aepp.mjs.map +0 -1
  273. package/es/ae/contract.mjs +0 -159
  274. package/es/ae/contract.mjs.map +0 -1
  275. package/es/ae/index.mjs +0 -207
  276. package/es/ae/index.mjs.map +0 -1
  277. package/es/ae/oracle.mjs +0 -339
  278. package/es/ae/oracle.mjs.map +0 -1
  279. package/es/ae/universal.mjs +0 -45
  280. package/es/ae/universal.mjs.map +0 -1
  281. package/es/ae/wallet.mjs +0 -50
  282. package/es/ae/wallet.mjs.map +0 -1
  283. package/es/amount-formatter.d.ts +0 -58
  284. package/es/bignumber.d.ts +0 -18
  285. package/es/chain/index.mjs +0 -272
  286. package/es/chain/index.mjs.map +0 -1
  287. package/es/chain/node.mjs +0 -442
  288. package/es/chain/node.mjs.map +0 -1
  289. package/es/contract/compiler.mjs +0 -115
  290. package/es/contract/compiler.mjs.map +0 -1
  291. package/es/contract/ga/helpers.mjs +0 -30
  292. package/es/contract/ga/helpers.mjs.map +0 -1
  293. package/es/contract/ga/index.mjs +0 -178
  294. package/es/contract/ga/index.mjs.map +0 -1
  295. package/es/crypto-ts.d.ts +0 -9
  296. package/es/encoder.d.ts +0 -26
  297. package/es/node-pool/index.mjs +0 -188
  298. package/es/node-pool/index.mjs.map +0 -1
  299. package/es/node.mjs +0 -133
  300. package/es/node.mjs.map +0 -1
  301. package/es/other.d.ts +0 -31
  302. package/es/string.d.ts +0 -26
  303. package/es/tx/tx-object.mjs +0 -283
  304. package/es/tx/tx-object.mjs.map +0 -1
  305. package/es/tx/tx.mjs +0 -938
  306. package/es/tx/tx.mjs.map +0 -1
  307. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs +0 -132
  308. package/es/utils/aepp-wallet-communication/connection/browser-runtime.mjs.map +0 -1
  309. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs +0 -183
  310. package/es/utils/aepp-wallet-communication/connection/browser-window-message.mjs.map +0 -1
  311. package/es/utils/aepp-wallet-communication/connection/index.mjs +0 -87
  312. package/es/utils/aepp-wallet-communication/connection/index.mjs.map +0 -1
  313. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs +0 -98
  314. package/es/utils/aepp-wallet-communication/content-script-bridge.mjs.map +0 -1
  315. package/es/utils/aepp-wallet-communication/helpers.mjs +0 -92
  316. package/es/utils/aepp-wallet-communication/helpers.mjs.map +0 -1
  317. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs +0 -375
  318. package/es/utils/aepp-wallet-communication/rpc/aepp-rpc.mjs.map +0 -1
  319. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs +0 -275
  320. package/es/utils/aepp-wallet-communication/rpc/rpc-client.mjs.map +0 -1
  321. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs +0 -541
  322. package/es/utils/aepp-wallet-communication/rpc/wallet-rpc.mjs.map +0 -1
  323. package/es/utils/aepp-wallet-communication/schema.mjs +0 -102
  324. package/es/utils/aepp-wallet-communication/schema.mjs.map +0 -1
  325. package/es/utils/aepp-wallet-communication/wallet-detector.mjs +0 -110
  326. package/es/utils/aepp-wallet-communication/wallet-detector.mjs.map +0 -1
  327. package/es/utils/async-init.mjs +0 -64
  328. package/es/utils/async-init.mjs.map +0 -1
  329. package/es/utils/crypto-ts.mjs.map +0 -1
  330. package/es/utils/swagger.mjs +0 -164
  331. package/es/utils/swagger.mjs.map +0 -1
  332. package/src/account/base.js +0 -153
  333. package/src/account/memory.js +0 -83
  334. package/src/account/multiple.js +0 -162
  335. package/src/ae/aens.js +0 -361
  336. package/src/ae/aepp.js +0 -45
  337. package/src/ae/contract.js +0 -148
  338. package/src/ae/index.js +0 -168
  339. package/src/ae/oracle.js +0 -311
  340. package/src/ae/universal.js +0 -47
  341. package/src/ae/wallet.js +0 -50
  342. package/src/chain/index.js +0 -269
  343. package/src/chain/node.js +0 -320
  344. package/src/channel/index.js +0 -903
  345. package/src/channel/internal.js +0 -236
  346. package/src/contract/aci.js +0 -376
  347. package/src/contract/compiler.js +0 -100
  348. package/src/contract/ga/helpers.js +0 -19
  349. package/src/contract/ga/index.js +0 -150
  350. package/src/index.js +0 -89
  351. package/src/node-pool/index.js +0 -172
  352. package/src/node.js +0 -116
  353. package/src/tx/builder/field-types.js +0 -61
  354. package/src/tx/builder/helpers.js +0 -334
  355. package/src/tx/builder/index.js +0 -465
  356. package/src/tx/builder/schema.js +0 -1100
  357. package/src/tx/index.js +0 -301
  358. package/src/tx/tx-object.js +0 -187
  359. package/src/tx/tx.js +0 -631
  360. package/src/tx/validator.js +0 -181
  361. package/src/utils/aepp-wallet-communication/connection/browser-runtime.js +0 -119
  362. package/src/utils/aepp-wallet-communication/connection/browser-window-message.js +0 -165
  363. package/src/utils/aepp-wallet-communication/connection/index.js +0 -85
  364. package/src/utils/aepp-wallet-communication/content-script-bridge.js +0 -86
  365. package/src/utils/aepp-wallet-communication/helpers.js +0 -60
  366. package/src/utils/aepp-wallet-communication/rpc/aepp-rpc.js +0 -294
  367. package/src/utils/aepp-wallet-communication/rpc/rpc-client.js +0 -232
  368. package/src/utils/aepp-wallet-communication/rpc/wallet-rpc.js +0 -401
  369. package/src/utils/aepp-wallet-communication/schema.ts +0 -80
  370. package/src/utils/aepp-wallet-communication/wallet-detector.js +0 -92
  371. package/src/utils/async-init.js +0 -45
  372. package/src/utils/crypto.js +0 -219
  373. package/src/utils/hd-wallet.js +0 -100
  374. package/src/utils/json-big.js +0 -26
  375. package/src/utils/keystore.js +0 -219
  376. package/src/utils/swagger.js +0 -156
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/other.ts"],"names":["snakeToPascal","pascalToSnake","pause","duration","Promise","resolve","setTimeout","mapObject","object","fn","Object","fromEntries","entries","map","filterObject","filter","traverseKeys","Array","isArray","i","key","value","snakizeKeys","bind","pascalizeKeys"],"mappings":"SAASA,a,EAAeC,a;AAExB,OAAO,MAAMC,KAAK,GAAG,MAAOC,QAAP,IACnB,MAAM,IAAIC,OAAJ,CAAYC,OAAO,IAAIC,UAAU,CAACD,OAAD,EAAUF,QAAV,CAAjC,CADD;AAGP,OAAO,MAAMI,SAAS,GAAG,CACvBC,MADuB,EAEvBC,EAFuB,KAGZC,MAAM,CAACC,WAAP,CAAmBD,MAAM,CAACE,OAAP,CAAeJ,MAAf,EAAuBK,GAAvB,CAA2BJ,EAA3B,CAAnB,CAHN;AAKP,OAAO,MAAMK,YAAY,GAAG,CAC1BN,MAD0B,EAE1BC,EAF0B,KAGfC,MAAM,CAACC,WAAP,CAAmBD,MAAM,CAACE,OAAP,CAAeJ,MAAf,EAAuBO,MAAvB,CAA8BN,EAA9B,CAAnB,CAHN;AAKP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMO,YAAY,GAAG,CAACP,EAAD,EAAeD,MAAf,KAAoC;AAC9D,MAAI,OAAOA,MAAP,KAAkB,QAAlB,IAA8BA,MAAM,KAAK,IAA7C,EAAmD,OAAOA,MAAP;AACnD,MAAIS,KAAK,CAACC,OAAN,CAAcV,MAAd,CAAJ,EAA2B,OAAOA,MAAM,CAACK,GAAP,CAAWM,CAAC,IAAIH,YAAY,CAACP,EAAD,EAAKU,CAAL,CAA5B,CAAP;AAC3B,SAAOZ,SAAS,CAACC,MAAD,EAAS;AAAA,QAAC,CAACY,GAAD,EAAMC,KAAN,CAAD;AAAA,WAAiC,CACxDZ,EAAE,CAACW,GAAD,CADsD,EAC/CJ,YAAY,CAACP,EAAD,EAAKY,KAAL,CADmC,CAAjC;AAAA,GAAT,CAAhB;AAGD,CANM;AAQP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,WAAW,GAAGN,YAAY,CAACO,IAAb,CAAkB,IAAlB,EAAwBtB,aAAxB,CAApB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMuB,aAAa,GAAGR,YAAY,CAACO,IAAb,CAAkB,IAAlB,EAAwBvB,aAAxB,CAAtB","sourcesContent":["import { snakeToPascal, pascalToSnake } from './string'\n\nexport const pause = async (duration: number): Promise<void> =>\n await new Promise(resolve => setTimeout(resolve, duration))\n\nexport const mapObject = (\n object: object,\n fn: (value: [string, any], index: number, array: Array<[string, any]>) => Array<[string, any]>\n): object => Object.fromEntries(Object.entries(object).map(fn))\n\nexport const filterObject = (\n object: object,\n fn: (value: [string, any], index: number, array: Array<[string, any]>) => boolean\n): object => Object.fromEntries(Object.entries(object).filter(fn))\n\n/**\n * Key traversal metafunction\n * @static\n * @function\n * @rtype (fn: (s: String) => String) => (o: Object) => Object\n * @param {Function} fn - Key transformation function\n * @param {Object} object - Object to traverse\n * @return {Object} Transformed object\n */\nexport const traverseKeys = (fn: Function, object: any): any => {\n if (typeof object !== 'object' || object === null) return object\n if (Array.isArray(object)) return object.map(i => traverseKeys(fn, i))\n return mapObject(object, ([key, value]: [string, any]) => [\n fn(key), traverseKeys(fn, value)\n ])\n}\n\n/**\n * snake_case key traversal\n * @static\n * @rtype (o: Object) => Object\n * @param {Object} object - Object to traverse\n * @return {Object} Transformed object\n * @see pascalToSnake\n */\nexport const snakizeKeys = traverseKeys.bind(null, pascalToSnake)\n\n/**\n * PascalCase key traversal\n * @static\n * @rtype (o: Object) => Object\n * @param {Object} object - Object to traverse\n * @return {Object} Transformed object\n * @see snakeToPascal\n */\nexport const pascalizeKeys = traverseKeys.bind(null, snakeToPascal)\n"],"file":"other.mjs"}
1
+ {"version":3,"file":"other.mjs","names":["pause","duration","Promise","resolve","setTimeout","mapObject","object","fn","Object","fromEntries","entries","map","isWebpack4Buffer","concat","Uint8Array","from","error","concatBuffers","list","totalLength","el","isKeyOfObject","key"],"sources":["../../src/utils/other.ts"],"sourcesContent":["export const pause = async (duration: number): Promise<void> =>\n await new Promise(resolve => setTimeout(resolve, duration))\n\nexport const mapObject = <InputV, OutputV>(\n object: { [k: string]: InputV },\n fn: (\n value: [string, InputV], index: number, array: Array<[string, InputV]>\n ) => [number | string, OutputV]\n): { [k: string]: OutputV } => Object.fromEntries(Object.entries(object).map(fn))\n\n// remove after dropping webpack4 support\nconst isWebpack4Buffer = (() => {\n try {\n Buffer.concat([Uint8Array.from([])])\n return false\n } catch (error) {\n return true\n }\n})()\n\nexport const concatBuffers = isWebpack4Buffer\n ? (list: readonly Uint8Array[], totalLength?: number): Buffer =>\n Buffer.concat(list.map(el => Buffer.from(el)), totalLength)\n : Buffer.concat\n\n/**\n * Object key type guard\n * @param key - Object key\n * @param object - object\n */\nexport function isKeyOfObject<T> (\n key: string | number | symbol,\n object: T\n): key is keyof T {\n return key in object\n}\n"],"mappings":";;;;AAAA,OAAO,MAAMA,KAAK,GAAG,MAAOC,QAAP,IACnB,MAAM,IAAIC,OAAJ,CAAYC,OAAO,IAAIC,UAAU,CAACD,OAAD,EAAUF,QAAV,CAAjC,CADD;AAGP,OAAO,MAAMI,SAAS,GAAG,CACvBC,MADuB,EAEvBC,EAFuB,KAKMC,MAAM,CAACC,WAAP,CAAmBD,MAAM,CAACE,OAAP,CAAeJ,MAAf,EAAuBK,GAAvB,CAA2BJ,EAA3B,CAAnB,CALxB,C,CAOP;;AACA,MAAMK,gBAAgB,GAAG,CAAC,MAAM;EAC9B,IAAI;IACF,QAAOC,MAAP,CAAc,CAACC,UAAU,CAACC,IAAX,CAAgB,EAAhB,CAAD,CAAd;;IACA,OAAO,KAAP;EACD,CAHD,CAGE,OAAOC,KAAP,EAAc;IACd,OAAO,IAAP;EACD;AACF,CAPwB,GAAzB;;AASA,OAAO,MAAMC,aAAa,GAAGL,gBAAgB,GACzC,CAACM,IAAD,EAA8BC,WAA9B,KACE,QAAON,MAAP,CAAcK,IAAI,CAACP,GAAL,CAASS,EAAE,IAAI,QAAOL,IAAP,CAAYK,EAAZ,CAAf,CAAd,EAA+CD,WAA/C,CAFuC,GAGzC,QAAON,MAHJ;AAKP;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASQ,aAAT,CACLC,GADK,EAELhB,MAFK,EAGW;EAChB,OAAOgB,GAAG,IAAIhB,MAAd;AACD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/semver-satisfies.ts"],"names":["version","geVersion","ltVersion","getComponents","v","split","map","i","versionComponents","geComponents","ltComponents","base","Math","max","componentsToNumber","components","reverse","reduce","acc","n","idx","pow","vNumber","geNumber","ltNumber"],"mappings":"AAAA,eAAe,UAAUA,OAAV,EAA2BC,SAA3B,EAA8CC,SAA9C,EAA0E;AACvF,QAAMC,aAAa,GAAIC,CAAD,IAAyBA,CAAC,CAC7CC,KAD4C,CACtC,MADsC,EAC9B,CAD8B,EAC3BA,KAD2B,CACrB,GADqB,EAChBC,GADgB,CACZC,CAAC,IAAI,CAACA,CADM,CAA/C;;AAGA,QAAMC,iBAAiB,GAAGL,aAAa,CAACH,OAAD,CAAvC;AACA,QAAMS,YAAY,GAAGN,aAAa,CAACF,SAAD,CAAlC;AACA,QAAMS,YAAY,GAAGP,aAAa,CAACD,SAAD,CAAlC;AAEA,QAAMS,IAAI,GAAGC,IAAI,CAACC,GAAL,CAAS,GAAGL,iBAAZ,EAA+B,GAAGC,YAAlC,EAAgD,GAAGC,YAAnD,IAAmE,CAAhF;;AACA,QAAMI,kBAAkB,GAAIC,UAAD,IAAkCA,UAAU,CAACC,OAAX,GAC1DC,MAD0D,CACnD,CAACC,GAAD,EAAMC,CAAN,EAASC,GAAT,KAAiBF,GAAG,GAAGC,CAAC,GAAGP,IAAI,CAACS,GAAL,CAASV,IAAT,EAAeS,GAAf,CADwB,EACH,CADG,CAA7D;;AAGA,QAAME,OAAO,GAAGR,kBAAkB,CAACN,iBAAD,CAAlC;AACA,QAAMe,QAAQ,GAAGT,kBAAkB,CAACL,YAAD,CAAnC;AACA,QAAMe,QAAQ,GAAGV,kBAAkB,CAACJ,YAAD,CAAnC;AACA,SAAOY,OAAO,IAAIC,QAAX,IAAuBD,OAAO,GAAGE,QAAxC;AACD","sourcesContent":["export default function (version: string, geVersion: string, ltVersion: string): boolean {\n const getComponents = (v: string): number[] => v\n .split(/[-+]/)[0].split('.').map(i => +i)\n\n const versionComponents = getComponents(version)\n const geComponents = getComponents(geVersion)\n const ltComponents = getComponents(ltVersion)\n\n const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1\n const componentsToNumber = (components: number[]): number => components.reverse()\n .reduce((acc, n, idx) => acc + n * Math.pow(base, idx), 0)\n\n const vNumber = componentsToNumber(versionComponents)\n const geNumber = componentsToNumber(geComponents)\n const ltNumber = componentsToNumber(ltComponents)\n return vNumber >= geNumber && vNumber < ltNumber\n}\n"],"file":"semver-satisfies.mjs"}
1
+ {"version":3,"file":"semver-satisfies.mjs","names":["version","geVersion","ltVersion","getComponents","v","split","map","i","versionComponents","geComponents","ltComponents","base","Math","max","componentsToNumber","components","reverse","reduce","acc","n","idx","pow","vNumber","geNumber","ltNumber"],"sources":["../../src/utils/semver-satisfies.ts"],"sourcesContent":["export default function (version: string, geVersion: string, ltVersion: string): boolean {\n const getComponents = (v: string): number[] => v\n .split(/[-+]/)[0].split('.').map(i => +i)\n\n const versionComponents = getComponents(version)\n const geComponents = getComponents(geVersion)\n const ltComponents = getComponents(ltVersion)\n\n const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1\n const componentsToNumber = (components: number[]): number => components.reverse()\n .reduce((acc, n, idx) => acc + n * Math.pow(base, idx), 0)\n\n const vNumber = componentsToNumber(versionComponents)\n const geNumber = componentsToNumber(geComponents)\n const ltNumber = componentsToNumber(ltComponents)\n return vNumber >= geNumber && vNumber < ltNumber\n}\n"],"mappings":"AAAA,eAAe,UAAUA,OAAV,EAA2BC,SAA3B,EAA8CC,SAA9C,EAA0E;EACvF,MAAMC,aAAa,GAAIC,CAAD,IAAyBA,CAAC,CAC7CC,KAD4C,CACtC,MADsC,EAC9B,CAD8B,EAC3BA,KAD2B,CACrB,GADqB,EAChBC,GADgB,CACZC,CAAC,IAAI,CAACA,CADM,CAA/C;;EAGA,MAAMC,iBAAiB,GAAGL,aAAa,CAACH,OAAD,CAAvC;EACA,MAAMS,YAAY,GAAGN,aAAa,CAACF,SAAD,CAAlC;EACA,MAAMS,YAAY,GAAGP,aAAa,CAACD,SAAD,CAAlC;EAEA,MAAMS,IAAI,GAAGC,IAAI,CAACC,GAAL,CAAS,GAAGL,iBAAZ,EAA+B,GAAGC,YAAlC,EAAgD,GAAGC,YAAnD,IAAmE,CAAhF;;EACA,MAAMI,kBAAkB,GAAIC,UAAD,IAAkCA,UAAU,CAACC,OAAX,GAC1DC,MAD0D,CACnD,CAACC,GAAD,EAAMC,CAAN,EAASC,GAAT,KAAiBF,GAAG,GAAGC,CAAC,GAAGP,IAAI,CAACS,GAAL,CAASV,IAAT,EAAeS,GAAf,CADwB,EACH,CADG,CAA7D;;EAGA,MAAME,OAAO,GAAGR,kBAAkB,CAACN,iBAAD,CAAlC;EACA,MAAMe,QAAQ,GAAGT,kBAAkB,CAACL,YAAD,CAAnC;EACA,MAAMe,QAAQ,GAAGV,kBAAkB,CAACJ,YAAD,CAAnC;EACA,OAAOY,OAAO,IAAIC,QAAX,IAAuBD,OAAO,GAAGE,QAAxC;AACD"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Convert string from snake_case to PascalCase
3
+ * @param s - String to convert
4
+ * @returns Converted string
5
+ */
6
+ export declare function snakeToPascal(s: string): string;
7
+ /**
8
+ * Convert string from PascalCase to snake_case
9
+ * @param s - String to convert
10
+ * @returns Converted string
11
+ */
12
+ export declare function pascalToSnake(s: string): string;
13
+ /**
14
+ * Check whether a string is valid hex.
15
+ * @param str - String to validate.
16
+ * @returns True if the string is valid hex, false otherwise.
17
+ */
18
+ export declare function isHex(str: string): boolean;
19
+ /**
20
+ * Check whether a string is valid base-64.
21
+ * @param str - String to validate.
22
+ * @returns True if the string is valid base-64, false otherwise.
23
+ */
24
+ export declare function isBase64(str: string): boolean;
@@ -17,18 +17,16 @@
17
17
 
18
18
  /**
19
19
  * Convert string from snake_case to PascalCase
20
- * @rtype (s: String) => String
21
- * @param {String} s - String to convert
22
- * @return {String} Converted string
20
+ * @param s - String to convert
21
+ * @returns Converted string
23
22
  */
24
23
  export function snakeToPascal(s) {
25
24
  return s.replace(/_./g, match => match[1].toUpperCase());
26
25
  }
27
26
  /**
28
27
  * Convert string from PascalCase to snake_case
29
- * @rtype (s: String) => String
30
- * @param {String} s - String to convert
31
- * @return {String} Converted string
28
+ * @param s - String to convert
29
+ * @returns Converted string
32
30
  */
33
31
 
34
32
  export function pascalToSnake(s) {
@@ -36,8 +34,8 @@ export function pascalToSnake(s) {
36
34
  }
37
35
  /**
38
36
  * Check whether a string is valid hex.
39
- * @param {string} str String to validate.
40
- * @return {boolean} True if the string is valid hex, false otherwise.
37
+ * @param str - String to validate.
38
+ * @returns True if the string is valid hex, false otherwise.
41
39
  */
42
40
 
43
41
  export function isHex(str) {
@@ -45,8 +43,8 @@ export function isHex(str) {
45
43
  }
46
44
  /**
47
45
  * Check whether a string is valid base-64.
48
- * @param {string} str String to validate.
49
- * @return {boolean} True if the string is valid base-64, false otherwise.
46
+ * @param str - String to validate.
47
+ * @returns True if the string is valid base-64, false otherwise.
50
48
  */
51
49
 
52
50
  export function isBase64(str) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/string.ts"],"names":["snakeToPascal","s","replace","match","toUpperCase","pascalToSnake","toLowerCase","isHex","str","length","test","isBase64","index","indexOf","slice"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,CAAxB,EAA2C;AAChD,SAAOA,CAAC,CAACC,OAAF,CAAU,KAAV,EAAiBC,KAAK,IAAIA,KAAK,CAAC,CAAD,CAAL,CAASC,WAAT,EAA1B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBJ,CAAxB,EAA2C;AAChD,SAAOA,CAAC,CAACC,OAAF,CAAU,QAAV,EAAoBC,KAAK,IAAK,IAAGA,KAAK,CAACG,WAAN,EAAoB,EAArD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAgBC,GAAhB,EAAsC;AAC3C,SAAOA,GAAG,CAACC,MAAJ,GAAa,CAAb,KAAmB,CAAnB,IAAwB,eAAeC,IAAf,CAAoBF,GAApB,CAA/B;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,QAAT,CAAmBH,GAAnB,EAAyC;AAC9C,MAAIA,GAAG,CAACC,MAAJ,GAAa,CAAb,GAAiB,CAAjB,IAAsB,gBAAgBC,IAAhB,CAAqBF,GAArB,CAA1B,EAAqD,OAAO,KAAP;AACrD,QAAMI,KAAK,GAAGJ,GAAG,CAACK,OAAJ,CAAY,GAAZ,CAAd;AACA,SAAOD,KAAK,KAAK,CAAC,CAAX,IAAgB,SAASF,IAAT,CAAcF,GAAG,CAACM,KAAJ,CAAUF,KAAV,CAAd,CAAvB;AACD","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Convert string from snake_case to PascalCase\n * @rtype (s: String) => String\n * @param {String} s - String to convert\n * @return {String} Converted string\n */\nexport function snakeToPascal (s: string): string {\n return s.replace(/_./g, match => match[1].toUpperCase())\n}\n\n/**\n * Convert string from PascalCase to snake_case\n * @rtype (s: String) => String\n * @param {String} s - String to convert\n * @return {String} Converted string\n */\nexport function pascalToSnake (s: string): string {\n return s.replace(/[A-Z]/g, match => `_${match.toLowerCase()}`)\n}\n\n/**\n * Check whether a string is valid hex.\n * @param {string} str String to validate.\n * @return {boolean} True if the string is valid hex, false otherwise.\n */\nexport function isHex (str: string): boolean {\n return str.length % 2 === 0 && /^[0-9a-f]+$/i.test(str)\n}\n\n/**\n * Check whether a string is valid base-64.\n * @param {string} str String to validate.\n * @return {boolean} True if the string is valid base-64, false otherwise.\n */\nexport function isBase64 (str: string): boolean {\n if (str.length % 4 > 0 || /[^0-9a-z+/=]/i.test(str)) return false\n const index = str.indexOf('=')\n return index === -1 || /={1,2}/.test(str.slice(index))\n}\n"],"file":"string.mjs"}
1
+ {"version":3,"file":"string.mjs","names":["snakeToPascal","s","replace","match","toUpperCase","pascalToSnake","toLowerCase","isHex","str","length","test","isBase64","index","indexOf","slice"],"sources":["../../src/utils/string.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright 2018 aeternity developers\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\n * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/**\n * Convert string from snake_case to PascalCase\n * @param s - String to convert\n * @returns Converted string\n */\nexport function snakeToPascal (s: string): string {\n return s.replace(/_./g, match => match[1].toUpperCase())\n}\n\n/**\n * Convert string from PascalCase to snake_case\n * @param s - String to convert\n * @returns Converted string\n */\nexport function pascalToSnake (s: string): string {\n return s.replace(/[A-Z]/g, match => `_${match.toLowerCase()}`)\n}\n\n/**\n * Check whether a string is valid hex.\n * @param str - String to validate.\n * @returns True if the string is valid hex, false otherwise.\n */\nexport function isHex (str: string): boolean {\n return str.length % 2 === 0 && /^[0-9a-f]+$/i.test(str)\n}\n\n/**\n * Check whether a string is valid base-64.\n * @param str - String to validate.\n * @returns True if the string is valid base-64, false otherwise.\n */\nexport function isBase64 (str: string): boolean {\n if (str.length % 4 > 0 || /[^0-9a-z+/=]/i.test(str)) return false\n const index = str.indexOf('=')\n return index === -1 || /={1,2}/.test(str.slice(index))\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,aAAT,CAAwBC,CAAxB,EAA2C;EAChD,OAAOA,CAAC,CAACC,OAAF,CAAU,KAAV,EAAiBC,KAAK,IAAIA,KAAK,CAAC,CAAD,CAAL,CAASC,WAAT,EAA1B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBJ,CAAxB,EAA2C;EAChD,OAAOA,CAAC,CAACC,OAAF,CAAU,QAAV,EAAoBC,KAAK,IAAK,IAAGA,KAAK,CAACG,WAAN,EAAoB,EAArD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,KAAT,CAAgBC,GAAhB,EAAsC;EAC3C,OAAOA,GAAG,CAACC,MAAJ,GAAa,CAAb,KAAmB,CAAnB,IAAwB,eAAeC,IAAf,CAAoBF,GAApB,CAA/B;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,QAAT,CAAmBH,GAAnB,EAAyC;EAC9C,IAAIA,GAAG,CAACC,MAAJ,GAAa,CAAb,GAAiB,CAAjB,IAAsB,gBAAgBC,IAAhB,CAAqBF,GAArB,CAA1B,EAAqD,OAAO,KAAP;EACrD,MAAMI,KAAK,GAAGJ,GAAG,CAACK,OAAJ,CAAY,GAAZ,CAAd;EACA,OAAOD,KAAK,KAAK,CAAC,CAAX,IAAgB,SAASF,IAAT,CAAcF,GAAG,CAACM,KAAJ,CAAUF,KAAV,CAAd,CAAvB;AACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeternity/aepp-sdk",
3
- "version": "11.0.1",
3
+ "version": "12.0.0",
4
4
  "description": "SDK for the æternity blockchain",
5
5
  "main": "dist/aepp-sdk.js",
6
6
  "types": "es/index.d.ts",
@@ -11,17 +11,18 @@
11
11
  "sideEffects": false,
12
12
  "scripts": {
13
13
  "build:es": "tsc && babel src --config-file ./babel.esm.config.js --out-dir es --extensions .js,.ts --out-file-extension .mjs --source-maps true",
14
- "build": "webpack --mode=production && npm run build:es",
14
+ "build:api": "npx autorest tooling/autorest/compiler.yaml --output-artifact:code-model-v4 && npx autorest tooling/autorest/node.yaml --output-artifact:code-model-v4",
15
+ "build": "npm run build:api && webpack --mode=production && npm run build:es",
15
16
  "build:dev": "webpack --mode=development && npm run build:es",
16
17
  "docs:examples": "node tooling/docs/examples-to-md.js examples/node/*.js",
17
- "docs:api": "node apidoc.js",
18
- "lint": "eslint .",
18
+ "docs:api": "typedoc",
19
+ "lint": "eslint . --ext .ts,.js",
19
20
  "test": "nyc mocha './test/unit/' './test/integration/'",
20
21
  "test:integration": "nyc mocha './test/integration/'",
21
22
  "test:unit": "nyc mocha './test/unit/'",
22
23
  "test:watch": "mocha './test/unit/' './test/integration/' --watch",
23
24
  "prepare": "npm run build",
24
- "prepublishOnly": "npm run docs:examples",
25
+ "prepublishOnly": "test/examples.sh && npm run docs:examples && npm run docs:api",
25
26
  "release": "standard-version --skip.tag --infile docs/CHANGELOG.md"
26
27
  },
27
28
  "license": "ISC",
@@ -34,25 +35,24 @@
34
35
  "dependencies": {
35
36
  "@aeternity/aepp-calldata": "^1.1.1",
36
37
  "@aeternity/argon2-browser": "^0.1.2",
37
- "@aeternity/blakejs": "^1.1.2",
38
- "@aeternity/json-bigint": "^0.3.1",
39
38
  "@aeternity/uuid": "^0.0.1",
40
- "@babel/runtime-corejs3": "^7.17.2",
41
- "@stamp/it": "^1.1.0",
42
- "@stamp/required": "^1.0.1",
39
+ "@azure/core-client": "^1.6.0",
40
+ "@azure/core-rest-pipeline": "^1.9.0",
41
+ "@babel/runtime-corejs3": "^7.18.3",
43
42
  "aes-js": "^3.1.2",
44
43
  "bignumber.js": "^9.0.2",
45
44
  "bip32-path": "^0.4.2",
46
- "bs58": "^4.0.1",
45
+ "blakejs": "^1.2.1",
46
+ "bs58": "^5.0.0",
47
47
  "buffer": "^6.0.3",
48
- "cross-fetch": "^3.1.5",
49
48
  "events": "^3.3.0",
49
+ "json-bigint": "^1.0.0",
50
50
  "process": "^0.11.10",
51
51
  "rlp": "^3.0.0",
52
52
  "sha.js": "^2.4.11",
53
- "swagger-client": "^3.18.4",
54
53
  "tweetnacl": "^1.0.3",
55
54
  "tweetnacl-auth": "^1.0.1",
55
+ "varuint-bitcoin": "^1.1.2",
56
56
  "websocket": "^1.0.34"
57
57
  },
58
58
  "repository": {
@@ -60,40 +60,50 @@
60
60
  "url": "https://github.com/aeternity/aepp-sdk-js"
61
61
  },
62
62
  "devDependencies": {
63
- "@babel/cli": "^7.17.0",
64
- "@babel/core": "^7.17.2",
65
- "@babel/node": "^7.16.8",
66
- "@babel/plugin-transform-runtime": "^7.17.0",
67
- "@babel/preset-env": "^7.16.11",
68
- "@babel/preset-typescript": "^7.16.7",
69
- "@babel/register": "^7.17.0",
70
- "@commitlint/cli": "^16.1.0",
71
- "@commitlint/config-conventional": "^16.0.0",
63
+ "@babel/cli": "^7.17.10",
64
+ "@babel/core": "^7.18.2",
65
+ "@babel/node": "^7.17.10",
66
+ "@babel/plugin-transform-runtime": "^7.18.2",
67
+ "@babel/preset-env": "^7.18.2",
68
+ "@babel/preset-typescript": "^7.17.12",
69
+ "@babel/register": "^7.17.7",
70
+ "@commitlint/cli": "^17.0.2",
71
+ "@commitlint/config-conventional": "^17.0.2",
72
+ "@types/aes-js": "^3.1.1",
73
+ "@types/argon2-browser": "^1.18.1",
72
74
  "@types/bn.js": "^5.1.0",
73
- "@types/bs58": "^4.0.1",
74
- "@types/chai": "^4.3.0",
75
- "@types/mocha": "^9.1.0",
76
- "@types/node": "^17.0.17",
75
+ "@types/chai": "^4.3.1",
76
+ "@types/chai-as-promised": "^7.1.5",
77
+ "@types/json-bigint": "^1.0.1",
78
+ "@types/mocha": "^9.1.1",
79
+ "@types/node": "^17.0.42",
77
80
  "@types/sha.js": "^2.4.0",
78
- "@typescript-eslint/eslint-plugin": "^5.11.0",
79
- "@typescript-eslint/parser": "^5.11.0",
80
- "babel-loader": "^8.2.3",
81
+ "@types/sinon": "^10.0.11",
82
+ "@types/uuid": "^8.3.4",
83
+ "@types/webextension-polyfill": "^0.9.0",
84
+ "@types/websocket": "^1.0.5",
85
+ "@typescript-eslint/eslint-plugin": "^5.27.1",
86
+ "@typescript-eslint/parser": "^5.27.1",
87
+ "babel-loader": "^8.2.5",
81
88
  "babel-plugin-add-import-extension": "^1.6.0",
82
89
  "babel-plugin-import-globals": "^2.0.0",
83
90
  "babel-plugin-transform-default-named-imports": "^1.2.2",
84
91
  "chai": "^4.3.6",
85
92
  "chai-as-promised": "^7.1.1",
86
- "eslint": "^8.8.0",
87
- "eslint-config-standard": "^17.0.0-1",
88
- "jsdoc-to-markdown": "^7.1.1",
89
- "mocha": "^9.2.0",
93
+ "eslint": "^8.17.0",
94
+ "eslint-config-standard": "^17.0.0",
95
+ "eslint-plugin-rulesdir": "^0.2.1",
96
+ "eslint-plugin-tsdoc": "^0.2.16",
97
+ "mocha": "^10.0.0",
90
98
  "nyc": "^15.1.0",
91
- "sinon": "^13.0.1",
92
- "source-map": "^0.7.3",
93
- "standard-version": "^9.3.2",
94
- "ts-node": "^10.5.0",
95
- "typescript": "^4.5.5",
96
- "webpack": "^5.68.0",
99
+ "sinon": "^14.0.0",
100
+ "source-map": "^0.7.4",
101
+ "standard-version": "^9.5.0",
102
+ "ts-node": "^10.8.1",
103
+ "typedoc": "^0.22.17",
104
+ "typedoc-plugin-missing-exports": "^0.22.6",
105
+ "typescript": "^4.7.3",
106
+ "webpack": "^5.73.0",
97
107
  "webpack-bundle-analyzer": "^4.5.0",
98
108
  "webpack-cli": "^4.9.2"
99
109
  },
package/src/AeSdk.ts ADDED
@@ -0,0 +1,65 @@
1
+ import AeSdkBase, { Account } from './AeSdkBase'
2
+ import AccountBase from './account/Base'
3
+ import { decode, EncodedData } from './utils/encoder'
4
+ import { UnavailableAccountError } from './utils/errors'
5
+
6
+ export default class AeSdk extends AeSdkBase {
7
+ accounts: { [key: EncodedData<'ak'>]: AccountBase } = {}
8
+ selectedAddress?: EncodedData<'ak'>
9
+
10
+ _resolveAccount (account: Account | EncodedData<'ak'> = this.selectedAddress): AccountBase {
11
+ if (typeof account === 'string') {
12
+ const address = account as EncodedData<'ak'>
13
+ decode(address)
14
+ if (this.accounts[address] == null) throw new UnavailableAccountError(account)
15
+ account = this.accounts[address]
16
+ }
17
+ return super._resolveAccount(account)
18
+ }
19
+
20
+ /**
21
+ * Get accounts addresses
22
+ * @example addresses()
23
+ */
24
+ addresses (): Array<EncodedData<'ak'>> {
25
+ return Object.keys(this.accounts) as Array<EncodedData<'ak'>>
26
+ }
27
+
28
+ /**
29
+ * Add specific account
30
+ * @param account - Account instance
31
+ * @param options - Options
32
+ * @param options.select - Select account
33
+ * @example addAccount(account)
34
+ */
35
+ async addAccount (account: AccountBase, { select }: { select?: boolean } = {}): Promise<void> {
36
+ const address = await account.address()
37
+ this.accounts[address] = account
38
+ if (select === true) this.selectAccount(address)
39
+ }
40
+
41
+ /**
42
+ * Remove specific account
43
+ * @param address - Address of account to remove
44
+ * @example removeAccount(address)
45
+ */
46
+ removeAccount (address: EncodedData<'ak'>): void {
47
+ if (this.accounts[address] == null) {
48
+ console.warn(`removeAccount: Account for ${address} not available`)
49
+ return
50
+ }
51
+ delete this.accounts[address] // eslint-disable-line @typescript-eslint/no-dynamic-delete
52
+ if (this.selectedAddress === address) delete this.selectedAddress
53
+ }
54
+
55
+ /**
56
+ * Select specific account
57
+ * @param address - Address of account to select
58
+ * @example selectAccount('ak_xxxxxxxx')
59
+ */
60
+ selectAccount (address: EncodedData<'ak'>): void {
61
+ decode(address)
62
+ if (this.accounts[address] == null) throw new UnavailableAccountError(address)
63
+ this.selectedAddress = address
64
+ }
65
+ }
@@ -0,0 +1,167 @@
1
+ import AeSdkBase, { Account } from './AeSdkBase'
2
+ import AccountBase from './account/Base'
3
+ import AccountRpc from './account/Rpc'
4
+ import { decode, EncodedData } from './utils/encoder'
5
+ import { Accounts, RPC_VERSION, WalletInfo, Network, WalletApi, AeppApi } from './aepp-wallet-communication/rpc/types'
6
+ import RpcClient from './aepp-wallet-communication/rpc/RpcClient'
7
+ import { METHODS, SUBSCRIPTION_TYPES } from './aepp-wallet-communication/schema'
8
+ import {
9
+ AlreadyConnectedError,
10
+ NoWalletConnectedError,
11
+ UnsubscribedAccountError,
12
+ UnAuthorizedAccountError,
13
+ RpcConnectionError
14
+ } from './utils/errors'
15
+ import Node from './Node'
16
+ import BrowserConnection from './aepp-wallet-communication/connection/Browser'
17
+
18
+ /**
19
+ * RPC handler for AEPP side
20
+ * Contain functionality for wallet interaction and connect it to sdk
21
+ */
22
+ export default class AeSdkAepp extends AeSdkBase {
23
+ name: string
24
+ onAddressChange: (a: Accounts) => void
25
+ onDisconnect: (p: any) => void
26
+ onNetworkChange: (a: Network) => void
27
+ rpcClient?: RpcClient<WalletApi, AeppApi>
28
+ _accounts?: Accounts
29
+
30
+ /**
31
+ * @param options - Options
32
+ * @param options.name - Aepp name
33
+ * @param options.onAddressChange - Call-back function for update address event
34
+ * @param options.onDisconnect - Call-back function for disconnect event
35
+ * @param options.onNetworkChange - Call-back function for update network event
36
+ */
37
+ constructor ({
38
+ name,
39
+ onAddressChange = () => {},
40
+ onDisconnect = () => {},
41
+ onNetworkChange = () => {},
42
+ ...other
43
+ }: {
44
+ name: string
45
+ onAddressChange: (a: Accounts) => void
46
+ onDisconnect: (p: any) => void
47
+ onNetworkChange: (a: Network) => void
48
+ } & ConstructorParameters<typeof AeSdkBase>[0]) {
49
+ super(other)
50
+ this.onAddressChange = onAddressChange
51
+ this.onDisconnect = onDisconnect
52
+ this.onNetworkChange = onNetworkChange
53
+ this.name = name
54
+ }
55
+
56
+ _resolveAccount (account: Account = this.addresses()[0]): AccountBase {
57
+ if (typeof account === 'string') {
58
+ const address = account as EncodedData<'ak'>
59
+ decode(address)
60
+ if (!this.addresses().includes(address)) throw new UnAuthorizedAccountError(address)
61
+ account = new AccountRpc({ rpcClient: this.rpcClient, address })
62
+ }
63
+ if (account == null) this._ensureAccountAccess()
64
+ return super._resolveAccount(account)
65
+ }
66
+
67
+ addresses (): Array<EncodedData<'ak'>> {
68
+ if (this._accounts == null) return []
69
+ const current = Object.keys(this._accounts.current)[0]
70
+ return [
71
+ ...current != null ? [current] : [], ...Object.keys(this._accounts.connected)
72
+ ] as Array<EncodedData<'ak'>>
73
+ }
74
+
75
+ /**
76
+ * Connect to wallet
77
+ * @param connection - Wallet connection object
78
+ * @param options - Options
79
+ * @param options.connectNode - Request wallet to bind node
80
+ * @param options.name - Node name
81
+ * @param options.select - Select this node as current
82
+ */
83
+ async connectToWallet (
84
+ connection: BrowserConnection,
85
+ { connectNode = false, name = 'wallet-node', select = false }:
86
+ { connectNode?: boolean, name?: string, select?: boolean } = {}
87
+ ): Promise<WalletInfo> {
88
+ if (this.rpcClient != null) throw new AlreadyConnectedError('You are already connected to wallet')
89
+ let disconnectParams: any
90
+ const client = new RpcClient<WalletApi, AeppApi>(
91
+ connection,
92
+ () => {
93
+ delete this.rpcClient
94
+ delete this._accounts
95
+ this.onDisconnect(disconnectParams)
96
+ }, {
97
+ [METHODS.updateAddress]: (params) => {
98
+ this._accounts = params
99
+ this.onAddressChange(params)
100
+ },
101
+ [METHODS.updateNetwork]: (params) => {
102
+ const { node } = params
103
+ if (node != null) this.addNode(node.name, new Node(node.url), true)
104
+ this.onNetworkChange(params)
105
+ },
106
+ [METHODS.closeConnection]: (params) => {
107
+ disconnectParams = params
108
+ client.connection.disconnect()
109
+ },
110
+ [METHODS.readyToConnect]: () => {}
111
+ }
112
+ )
113
+ const { node, ...walletInfo } = await client.request(
114
+ METHODS.connect, { name: this.name, version: RPC_VERSION, connectNode }
115
+ )
116
+ if (connectNode) {
117
+ if (node == null) throw new RpcConnectionError('Missing URLs of the Node')
118
+ this.addNode(name, new Node(node.url), select)
119
+ }
120
+ this.rpcClient = client
121
+ return walletInfo
122
+ }
123
+
124
+ /**
125
+ * Disconnect from wallet
126
+ */
127
+ disconnectWallet (): void {
128
+ this._ensureConnected()
129
+ this.rpcClient.notify(METHODS.closeConnection, { reason: 'bye' })
130
+ this.rpcClient.connection.disconnect()
131
+ }
132
+
133
+ /**
134
+ * Ask addresses from wallet
135
+ * @returns Addresses from wallet
136
+ */
137
+ async askAddresses (): Promise<Array<EncodedData<'ak'>>> {
138
+ this._ensureAccountAccess()
139
+ return await this.rpcClient.request(METHODS.address, undefined)
140
+ }
141
+
142
+ /**
143
+ * Subscribe for addresses from wallet
144
+ * @param type - Subscription type
145
+ * @param value - Should be one of 'current' (the selected account), 'connected' (all)
146
+ * @returns Accounts from wallet
147
+ */
148
+ async subscribeAddress (
149
+ type: SUBSCRIPTION_TYPES, value: 'current' | 'connected'
150
+ ): Promise<ReturnType<WalletApi[METHODS.subscribeAddress]>> {
151
+ this._ensureConnected()
152
+ const result = await this.rpcClient.request(METHODS.subscribeAddress, { type, value })
153
+ this._accounts = result.address
154
+ return result
155
+ }
156
+
157
+ _ensureConnected (): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {
158
+ if (this.rpcClient != null) return
159
+ throw new NoWalletConnectedError('You are not connected to Wallet')
160
+ }
161
+
162
+ _ensureAccountAccess (): asserts this is AeSdkAepp & { rpcClient: NonNullable<AeSdkAepp['rpcClient']> } {
163
+ this._ensureConnected()
164
+ if (this.addresses().length !== 0) return
165
+ throw new UnsubscribedAccountError()
166
+ }
167
+ }