@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,179 +0,0 @@
1
- import _buffer from "buffer";
2
- const {
3
- Buffer: _Buffer
4
- } = _buffer;
5
-
6
- /*
7
- * ISC License (ISC)
8
- * Copyright (c) 2018 aeternity developers
9
- *
10
- * Permission to use, copy, modify, and/or distribute this software for any
11
- * purpose with or without fee is hereby granted, provided that the above
12
- * copyright notice and this permission notice appear in all copies.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- * PERFORMANCE OF THIS SOFTWARE.
21
- */
22
-
23
- /**
24
- * AccountBase module
25
- * @module @aeternity/aepp-sdk/es/account/base
26
- * @export AccountBase
27
- * @export isAccountBase
28
- */
29
- import stampit from '@stamp/it';
30
- import _stampRequired from '@stamp/required';
31
- const {
32
- required
33
- } = _stampRequired;
34
- import { messageToHash, verifyMessage as verifyMessageCrypto, hash } from "../utils/crypto.mjs";
35
- import { buildTx } from "../tx/builder/index.mjs";
36
- import { decode } from "../tx/builder/helpers.mjs";
37
- import { TX_TYPE } from "../tx/builder/schema.mjs";
38
- import { getNetworkId } from "../node.mjs";
39
- /**
40
- * Check is provided object looks like an instance of AccountBase
41
- * @rtype (Object) => Boolean
42
- * @param {Object} acc - Object to check
43
- * @return {Boolean}
44
- */
45
-
46
- export const isAccountBase = acc => !['sign', 'address'].find(f => typeof acc[f] !== 'function');
47
- /**
48
- * Sign encoded transaction
49
- * @instance
50
- * @category async
51
- * @rtype (tx: String) => tx: Promise[String], throws: Error
52
- * @param {String} tx - Transaction to sign
53
- * @param {Object} opt - Options
54
- * @param {Object} [opt.innerTx] - Sign as inner transaction for PayingFor
55
- * @return {String} Signed transaction
56
- */
57
-
58
- async function signTransaction(tx) {
59
- let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
60
- const prefixes = [this.getNetworkId(opt)];
61
- if (opt.innerTx) prefixes.push('inner_tx');
62
- const rlpBinaryTx = decode(tx, 'tx');
63
-
64
- const txWithNetworkId = _Buffer.concat([_Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)]);
65
-
66
- const signatures = [await this.sign(txWithNetworkId, opt)];
67
- return buildTx({
68
- encodedTx: rlpBinaryTx,
69
- signatures
70
- }, TX_TYPE.signed).tx;
71
- }
72
- /**
73
- * Get network Id
74
- * @instance
75
- * @function getNetworkId
76
- * @category async
77
- * @rtype () => networkId: String
78
- * @return {String} Network Id
79
- */
80
-
81
- /**
82
- * Sign message
83
- * @instance
84
- * @category async
85
- * @rtype (msg: String) => signature: Promise[String], throws: Error
86
- * @param {String} message - Message to sign
87
- * @param {Object} opt - Options
88
- * @return {String} Signature
89
- */
90
-
91
-
92
- async function signMessage(message) {
93
- let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
94
- returnHex: false
95
- };
96
- const sig = await this.sign(messageToHash(message), opt);
97
- return opt.returnHex ? _Buffer.from(sig).toString('hex') : sig;
98
- }
99
- /**
100
- * Verify message
101
- * @instance
102
- * @category async
103
- * @rtype (
104
- * msg: String, signature: String, publicKey: String
105
- * ) => signature: Promise[String], throws: Error
106
- * @param {String} message - Message to verify
107
- * @param {String} signature - Signature
108
- * @param {Object} opt - Options
109
- * @return {Boolean}
110
- */
111
-
112
-
113
- async function verifyMessage(message, signature) {
114
- let opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
115
- return verifyMessageCrypto(message, typeof signature === 'string' ? _Buffer.from(signature, 'hex') : signature, decode(await this.address(opt)));
116
- }
117
- /**
118
- * AccountBase Stamp
119
- *
120
- * Attempting to create instances from the Stamp without overwriting all
121
- * abstract methods using composition will result in an exception.
122
- *
123
- * Account is one of the three basic building blocks of an
124
- * {@link module:@aeternity/aepp-sdk/es/ae--Ae} client and provides access to a
125
- * signing key pair.
126
- * @function
127
- * @alias module:@aeternity/aepp-sdk/es/account
128
- * @rtype Stamp
129
- * @param {Object} [options={}] - Initializer object
130
- * @param {String} options.networkId - NETWORK_ID using for signing transaction's
131
- * @return {Object} Account instance
132
- */
133
-
134
-
135
- export default stampit({
136
- init(_ref) {
137
- let {
138
- networkId
139
- } = _ref;
140
-
141
- // NETWORK_ID using for signing transaction's
142
- if (!this.networkId && networkId) {
143
- this.networkId = networkId;
144
- }
145
- },
146
-
147
- methods: {
148
- signTransaction,
149
- getNetworkId,
150
- signMessage,
151
- verifyMessage
152
- }
153
- }, required({
154
- methods: {
155
- sign: required,
156
- address: required
157
- }
158
- }));
159
- /**
160
- * Sign data blob
161
- * @function sign
162
- * @instance
163
- * @abstract
164
- * @category async
165
- * @rtype (data: String) => data: Promise[String]
166
- * @param {String} data - Data blob to sign
167
- * @return {String} Signed data blob
168
- */
169
-
170
- /**
171
- * Obtain account address
172
- * @function address
173
- * @instance
174
- * @abstract
175
- * @category async
176
- * @rtype () => address: Promise[String]
177
- * @return {String} Public account address
178
- */
179
- //# sourceMappingURL=base.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/account/base.js"],"names":["stampit","messageToHash","verifyMessage","verifyMessageCrypto","hash","buildTx","decode","TX_TYPE","getNetworkId","isAccountBase","acc","find","f","signTransaction","tx","opt","prefixes","innerTx","push","rlpBinaryTx","txWithNetworkId","concat","from","join","signatures","sign","encodedTx","signed","signMessage","message","returnHex","sig","toString","signature","address","init","networkId","methods","required"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAEA,OAAOA,OAAP,MAAoB,WAApB;AACA,2BAAyB,iBAAzB;;;;SACSC,a,EAAeC,aAAa,IAAIC,mB,EAAqBC,I;SACrDC,O;SACAC,M;SACAC,O;SACAC,Y;AAET;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAIC,GAAD,IAAS,CAAC,CAAC,MAAD,EAAS,SAAT,EAAoBC,IAApB,CAAyBC,CAAC,IAAI,OAAOF,GAAG,CAACE,CAAD,CAAV,KAAkB,UAAhD,CAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeC,eAAf,CAAgCC,EAAhC,EAA8C;AAAA,MAAVC,GAAU,uEAAJ,EAAI;AAC5C,QAAMC,QAAQ,GAAG,CAAC,KAAKR,YAAL,CAAkBO,GAAlB,CAAD,CAAjB;AACA,MAAIA,GAAG,CAACE,OAAR,EAAiBD,QAAQ,CAACE,IAAT,CAAc,UAAd;AACjB,QAAMC,WAAW,GAAGb,MAAM,CAACQ,EAAD,EAAK,IAAL,CAA1B;;AACA,QAAMM,eAAe,GAAG,QAAOC,MAAP,CAAc,CAAC,QAAOC,IAAP,CAAYN,QAAQ,CAACO,IAAT,CAAc,GAAd,CAAZ,CAAD,EAAkCnB,IAAI,CAACe,WAAD,CAAtC,CAAd,CAAxB;;AAEA,QAAMK,UAAU,GAAG,CAAC,MAAM,KAAKC,IAAL,CAAUL,eAAV,EAA2BL,GAA3B,CAAP,CAAnB;AACA,SAAOV,OAAO,CAAC;AAAEqB,IAAAA,SAAS,EAAEP,WAAb;AAA0BK,IAAAA;AAA1B,GAAD,EAAyCjB,OAAO,CAACoB,MAAjD,CAAP,CAAgEb,EAAvE;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAec,WAAf,CAA4BC,OAA5B,EAAiE;AAAA,MAA5Bd,GAA4B,uEAAtB;AAAEe,IAAAA,SAAS,EAAE;AAAb,GAAsB;AAC/D,QAAMC,GAAG,GAAG,MAAM,KAAKN,IAAL,CAAUxB,aAAa,CAAC4B,OAAD,CAAvB,EAAkCd,GAAlC,CAAlB;AACA,SAAOA,GAAG,CAACe,SAAJ,GAAgB,QAAOR,IAAP,CAAYS,GAAZ,EAAiBC,QAAjB,CAA0B,KAA1B,CAAhB,GAAmDD,GAA1D;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAe7B,aAAf,CAA8B2B,OAA9B,EAAuCI,SAAvC,EAA4D;AAAA,MAAVlB,GAAU,uEAAJ,EAAI;AAC1D,SAAOZ,mBAAmB,CACxB0B,OADwB,EAExB,OAAOI,SAAP,KAAqB,QAArB,GAAgC,QAAOX,IAAP,CAAYW,SAAZ,EAAuB,KAAvB,CAAhC,GAAgEA,SAFxC,EAGxB3B,MAAM,CAAC,MAAM,KAAK4B,OAAL,CAAanB,GAAb,CAAP,CAHkB,CAA1B;AAKD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,eAAef,OAAO,CAAC;AACrBmC,EAAAA,IAAI,OAAiB;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;;AAAE;AACrB,QAAI,CAAC,KAAKA,SAAN,IAAmBA,SAAvB,EAAkC;AAChC,WAAKA,SAAL,GAAiBA,SAAjB;AACD;AACF,GALoB;;AAMrBC,EAAAA,OAAO,EAAE;AAAExB,IAAAA,eAAF;AAAmBL,IAAAA,YAAnB;AAAiCoB,IAAAA,WAAjC;AAA8C1B,IAAAA;AAA9C;AANY,CAAD,EAOnBoC,QAAQ,CAAC;AACVD,EAAAA,OAAO,EAAE;AACPZ,IAAAA,IAAI,EAAEa,QADC;AAEPJ,IAAAA,OAAO,EAAEI;AAFF;AADC,CAAD,CAPW,CAAtB;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 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 * AccountBase module\n * @module @aeternity/aepp-sdk/es/account/base\n * @export AccountBase\n * @export isAccountBase\n */\n\nimport stampit from '@stamp/it'\nimport { required } from '@stamp/required'\nimport { messageToHash, verifyMessage as verifyMessageCrypto, hash } from '../utils/crypto'\nimport { buildTx } from '../tx/builder'\nimport { decode } from '../tx/builder/helpers'\nimport { TX_TYPE } from '../tx/builder/schema'\nimport { getNetworkId } from '../node'\n\n/**\n * Check is provided object looks like an instance of AccountBase\n * @rtype (Object) => Boolean\n * @param {Object} acc - Object to check\n * @return {Boolean}\n */\nexport const isAccountBase = (acc) => !['sign', 'address'].find(f => typeof acc[f] !== 'function')\n\n/**\n * Sign encoded transaction\n * @instance\n * @category async\n * @rtype (tx: String) => tx: Promise[String], throws: Error\n * @param {String} tx - Transaction to sign\n * @param {Object} opt - Options\n * @param {Object} [opt.innerTx] - Sign as inner transaction for PayingFor\n * @return {String} Signed transaction\n */\nasync function signTransaction (tx, opt = {}) {\n const prefixes = [this.getNetworkId(opt)]\n if (opt.innerTx) prefixes.push('inner_tx')\n const rlpBinaryTx = decode(tx, 'tx')\n const txWithNetworkId = Buffer.concat([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)])\n\n const signatures = [await this.sign(txWithNetworkId, opt)]\n return buildTx({ encodedTx: rlpBinaryTx, signatures }, TX_TYPE.signed).tx\n}\n\n/**\n * Get network Id\n * @instance\n * @function getNetworkId\n * @category async\n * @rtype () => networkId: String\n * @return {String} Network Id\n */\n\n/**\n * Sign message\n * @instance\n * @category async\n * @rtype (msg: String) => signature: Promise[String], throws: Error\n * @param {String} message - Message to sign\n * @param {Object} opt - Options\n * @return {String} Signature\n */\nasync function signMessage (message, opt = { returnHex: false }) {\n const sig = await this.sign(messageToHash(message), opt)\n return opt.returnHex ? Buffer.from(sig).toString('hex') : sig\n}\n\n/**\n * Verify message\n * @instance\n * @category async\n * @rtype (\n * msg: String, signature: String, publicKey: String\n * ) => signature: Promise[String], throws: Error\n * @param {String} message - Message to verify\n * @param {String} signature - Signature\n * @param {Object} opt - Options\n * @return {Boolean}\n */\nasync function verifyMessage (message, signature, opt = {}) {\n return verifyMessageCrypto(\n message,\n typeof signature === 'string' ? Buffer.from(signature, 'hex') : signature,\n decode(await this.address(opt))\n )\n}\n\n/**\n * AccountBase Stamp\n *\n * Attempting to create instances from the Stamp without overwriting all\n * abstract methods using composition will result in an exception.\n *\n * Account is one of the three basic building blocks of an\n * {@link module:@aeternity/aepp-sdk/es/ae--Ae} client and provides access to a\n * signing key pair.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/account\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @param {String} options.networkId - NETWORK_ID using for signing transaction's\n * @return {Object} Account instance\n */\nexport default stampit({\n init ({ networkId }) { // NETWORK_ID using for signing transaction's\n if (!this.networkId && networkId) {\n this.networkId = networkId\n }\n },\n methods: { signTransaction, getNetworkId, signMessage, verifyMessage }\n}, required({\n methods: {\n sign: required,\n address: required\n }\n}))\n\n/**\n * Sign data blob\n * @function sign\n * @instance\n * @abstract\n * @category async\n * @rtype (data: String) => data: Promise[String]\n * @param {String} data - Data blob to sign\n * @return {String} Signed data blob\n */\n\n/**\n * Obtain account address\n * @function address\n * @instance\n * @abstract\n * @category async\n * @rtype () => address: Promise[String]\n * @return {String} Public account address\n */\n"],"file":"base.mjs"}
@@ -1,99 +0,0 @@
1
- import _buffer from "buffer";
2
- const {
3
- Buffer: _Buffer
4
- } = _buffer;
5
-
6
- /*
7
- * ISC License (ISC)
8
- * Copyright (c) 2018 aeternity developers
9
- *
10
- * Permission to use, copy, modify, and/or distribute this software for any
11
- * purpose with or without fee is hereby granted, provided that the above
12
- * copyright notice and this permission notice appear in all copies.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
16
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
- * PERFORMANCE OF THIS SOFTWARE.
21
- */
22
-
23
- /**
24
- * Memory Account module
25
- * @module @aeternity/aepp-sdk/es/account/memory
26
- * @export MemoryAccount
27
- * @example import { MemoryAccount } from '@aeternity/aepp-sdk'
28
- */
29
- import AccountBase from "./base.mjs";
30
- import { sign, isValidKeypair } from "../utils/crypto.mjs";
31
- import { isHex } from "../utils/string.mjs";
32
- import { decode } from "../tx/builder/helpers.mjs";
33
- import { InvalidKeypairError } from "../utils/errors.mjs";
34
- const secrets = new WeakMap();
35
- /**
36
- * In-memory account stamp
37
- * @function
38
- * @alias module:@aeternity/aepp-sdk/es/account/memory
39
- * @rtype Stamp
40
- * @param {Object} [options={}] - Initializer object
41
- * @param {Object} options.keypair - Key pair to use
42
- * @param {String} options.keypair.publicKey - Public key
43
- * @param {String} options.keypair.secretKey - Private key
44
- * @return {Account}
45
- */
46
-
47
- export default AccountBase.compose({
48
- init(_ref) {
49
- let {
50
- keypair,
51
- gaId
52
- } = _ref;
53
- this.isGa = !!gaId;
54
-
55
- if (gaId) {
56
- decode(gaId);
57
- secrets.set(this, {
58
- publicKey: gaId
59
- });
60
- return;
61
- }
62
-
63
- if (!keypair || typeof keypair !== 'object') throw new InvalidKeypairError('KeyPair must be an object');
64
-
65
- if (!keypair.secretKey || !keypair.publicKey) {
66
- throw new InvalidKeypairError('KeyPair must must have "secretKey", "publicKey" properties');
67
- }
68
-
69
- if (typeof keypair.publicKey !== 'string' || keypair.publicKey.indexOf('ak_') === -1) {
70
- throw new InvalidKeypairError('Public Key must be a base58c string with "ak_" prefix');
71
- }
72
-
73
- if (!_Buffer.isBuffer(keypair.secretKey) && typeof keypair.secretKey === 'string' && !isHex(keypair.secretKey)) throw new InvalidKeypairError('Secret key must be hex string or Buffer');
74
-
75
- const pubBuffer = _Buffer.from(decode(keypair.publicKey, 'ak'));
76
-
77
- if (!isValidKeypair(_Buffer.from(keypair.secretKey, 'hex'), pubBuffer)) throw new InvalidKeypairError('Invalid Key Pair');
78
- secrets.set(this, {
79
- secretKey: _Buffer.isBuffer(keypair.secretKey) ? keypair.secretKey : _Buffer.from(keypair.secretKey, 'hex'),
80
- publicKey: keypair.publicKey
81
- });
82
- },
83
-
84
- props: {
85
- isGa: false
86
- },
87
- methods: {
88
- sign(data) {
89
- if (this.isGa) throw new InvalidKeypairError('You are trying to sign data using generalized account without keypair');
90
- return Promise.resolve(sign(data, secrets.get(this).secretKey));
91
- },
92
-
93
- address() {
94
- return Promise.resolve(secrets.get(this).publicKey);
95
- }
96
-
97
- }
98
- });
99
- //# sourceMappingURL=memory.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/account/memory.js"],"names":["AccountBase","sign","isValidKeypair","isHex","decode","InvalidKeypairError","secrets","WeakMap","compose","init","keypair","gaId","isGa","set","publicKey","secretKey","indexOf","isBuffer","pubBuffer","from","props","methods","data","Promise","resolve","get","address"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;OAEOA,W;SACEC,I,EAAMC,c;SACNC,K;SACAC,M;SACAC,mB;AAET,MAAMC,OAAO,GAAG,IAAIC,OAAJ,EAAhB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAeP,WAAW,CAACQ,OAAZ,CAAoB;AACjCC,EAAAA,IAAI,OAAqB;AAAA,QAAnB;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,KAAmB;AACvB,SAAKC,IAAL,GAAY,CAAC,CAACD,IAAd;;AACA,QAAIA,IAAJ,EAAU;AACRP,MAAAA,MAAM,CAACO,IAAD,CAAN;AACAL,MAAAA,OAAO,CAACO,GAAR,CAAY,IAAZ,EAAkB;AAAEC,QAAAA,SAAS,EAAEH;AAAb,OAAlB;AACA;AACD;;AAED,QAAI,CAACD,OAAD,IAAY,OAAOA,OAAP,KAAmB,QAAnC,EAA6C,MAAM,IAAIL,mBAAJ,CAAwB,2BAAxB,CAAN;;AAC7C,QAAI,CAACK,OAAO,CAACK,SAAT,IAAsB,CAACL,OAAO,CAACI,SAAnC,EAA8C;AAC5C,YAAM,IAAIT,mBAAJ,CAAwB,4DAAxB,CAAN;AACD;;AACD,QAAI,OAAOK,OAAO,CAACI,SAAf,KAA6B,QAA7B,IAAyCJ,OAAO,CAACI,SAAR,CAAkBE,OAAlB,CAA0B,KAA1B,MAAqC,CAAC,CAAnF,EAAsF;AACpF,YAAM,IAAIX,mBAAJ,CAAwB,uDAAxB,CAAN;AACD;;AACD,QACE,CAAC,QAAOY,QAAP,CAAgBP,OAAO,CAACK,SAAxB,CAAD,IACC,OAAOL,OAAO,CAACK,SAAf,KAA6B,QAA7B,IAAyC,CAACZ,KAAK,CAACO,OAAO,CAACK,SAAT,CAFlD,EAGE,MAAM,IAAIV,mBAAJ,CAAwB,yCAAxB,CAAN;;AAEF,UAAMa,SAAS,GAAG,QAAOC,IAAP,CAAYf,MAAM,CAACM,OAAO,CAACI,SAAT,EAAoB,IAApB,CAAlB,CAAlB;;AACA,QAAI,CAACZ,cAAc,CAAC,QAAOiB,IAAP,CAAYT,OAAO,CAACK,SAApB,EAA+B,KAA/B,CAAD,EAAwCG,SAAxC,CAAnB,EAAuE,MAAM,IAAIb,mBAAJ,CAAwB,kBAAxB,CAAN;AAEvEC,IAAAA,OAAO,CAACO,GAAR,CAAY,IAAZ,EAAkB;AAChBE,MAAAA,SAAS,EAAE,QAAOE,QAAP,CAAgBP,OAAO,CAACK,SAAxB,IAAqCL,OAAO,CAACK,SAA7C,GAAyD,QAAOI,IAAP,CAAYT,OAAO,CAACK,SAApB,EAA+B,KAA/B,CADpD;AAEhBD,MAAAA,SAAS,EAAEJ,OAAO,CAACI;AAFH,KAAlB;AAID,GA5BgC;;AA6BjCM,EAAAA,KAAK,EAAE;AAAER,IAAAA,IAAI,EAAE;AAAR,GA7B0B;AA8BjCS,EAAAA,OAAO,EAAE;AACPpB,IAAAA,IAAI,CAAEqB,IAAF,EAAQ;AACV,UAAI,KAAKV,IAAT,EAAe,MAAM,IAAIP,mBAAJ,CAAwB,uEAAxB,CAAN;AACf,aAAOkB,OAAO,CAACC,OAAR,CAAgBvB,IAAI,CAACqB,IAAD,EAAOhB,OAAO,CAACmB,GAAR,CAAY,IAAZ,EAAkBV,SAAzB,CAApB,CAAP;AACD,KAJM;;AAKPW,IAAAA,OAAO,GAAI;AACT,aAAOH,OAAO,CAACC,OAAR,CAAgBlB,OAAO,CAACmB,GAAR,CAAY,IAAZ,EAAkBX,SAAlC,CAAP;AACD;;AAPM;AA9BwB,CAApB,CAAf","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 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 * Memory Account module\n * @module @aeternity/aepp-sdk/es/account/memory\n * @export MemoryAccount\n * @example import { MemoryAccount } from '@aeternity/aepp-sdk'\n */\n\nimport AccountBase from './base'\nimport { sign, isValidKeypair } from '../utils/crypto'\nimport { isHex } from '../utils/string'\nimport { decode } from '../tx/builder/helpers'\nimport { InvalidKeypairError } from '../utils/errors'\n\nconst secrets = new WeakMap()\n\n/**\n * In-memory account stamp\n * @function\n * @alias module:@aeternity/aepp-sdk/es/account/memory\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @param {Object} options.keypair - Key pair to use\n * @param {String} options.keypair.publicKey - Public key\n * @param {String} options.keypair.secretKey - Private key\n * @return {Account}\n */\nexport default AccountBase.compose({\n init ({ keypair, gaId }) {\n this.isGa = !!gaId\n if (gaId) {\n decode(gaId)\n secrets.set(this, { publicKey: gaId })\n return\n }\n\n if (!keypair || typeof keypair !== 'object') throw new InvalidKeypairError('KeyPair must be an object')\n if (!keypair.secretKey || !keypair.publicKey) {\n throw new InvalidKeypairError('KeyPair must must have \"secretKey\", \"publicKey\" properties')\n }\n if (typeof keypair.publicKey !== 'string' || keypair.publicKey.indexOf('ak_') === -1) {\n throw new InvalidKeypairError('Public Key must be a base58c string with \"ak_\" prefix')\n }\n if (\n !Buffer.isBuffer(keypair.secretKey) &&\n (typeof keypair.secretKey === 'string' && !isHex(keypair.secretKey))\n ) throw new InvalidKeypairError('Secret key must be hex string or Buffer')\n\n const pubBuffer = Buffer.from(decode(keypair.publicKey, 'ak'))\n if (!isValidKeypair(Buffer.from(keypair.secretKey, 'hex'), pubBuffer)) throw new InvalidKeypairError('Invalid Key Pair')\n\n secrets.set(this, {\n secretKey: Buffer.isBuffer(keypair.secretKey) ? keypair.secretKey : Buffer.from(keypair.secretKey, 'hex'),\n publicKey: keypair.publicKey\n })\n },\n props: { isGa: false },\n methods: {\n sign (data) {\n if (this.isGa) throw new InvalidKeypairError('You are trying to sign data using generalized account without keypair')\n return Promise.resolve(sign(data, secrets.get(this).secretKey))\n },\n address () {\n return Promise.resolve(secrets.get(this).publicKey)\n }\n }\n})\n"],"file":"memory.mjs"}
@@ -1,179 +0,0 @@
1
- /*
2
- * ISC License (ISC)
3
- * Copyright (c) 2018 aeternity developers
4
- *
5
- * Permission to use, copy, modify, and/or distribute this software for any
6
- * purpose with or without fee is hereby granted, provided that the above
7
- * copyright notice and this permission notice appear in all copies.
8
- *
9
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- * PERFORMANCE OF THIS SOFTWARE.
16
- */
17
-
18
- /**
19
- * AccountMultiple module
20
- * @module @aeternity/aepp-sdk/es/accounts/multiple
21
- * @export AccountMultiple
22
- */
23
- import AsyncInit from "../utils/async-init.mjs";
24
- import MemoryAccount from "./memory.mjs";
25
- import { decode } from "../tx/builder/helpers.mjs";
26
- import AccountBase, { isAccountBase } from "./base.mjs";
27
- import { UnavailableAccountError, TypeError } from "../utils/errors.mjs";
28
- /**
29
- * AccountMultiple stamp
30
- *
31
- * The purpose of this stamp is to wrap up implementations of
32
- * {@link module:@aeternity/aepp-sdk/es/account/base--AccountBase} objects and provide a
33
- * common interface to all of them. List are a substantial part of
34
- * {@link module:@aeternity/aepp-sdk/es/ae/wallet--Wallet}s.
35
- * @function
36
- * @alias module:@aeternity/aepp-sdk/es/accounts/multiple
37
- * @rtype Stamp
38
- * @param {Object} [options={}] - Initializer object
39
- * @param {Array} [options.accounts] - Accounts array
40
- * @param {String} [options.address] - Address of account to select
41
- * @return {Object} AccountMultiple instance
42
- * @example
43
- * const accounts = await AccountMultiple({
44
- * accounts: [MemoryAccount({ keypair: 'keypair_object' })]
45
- * })
46
- * await accounts.addAccount(account, { select: true }) // Add account and make it selected
47
- * accounts.removeAccount(address) // Remove account
48
- * accounts.selectAccount(address) // Select account
49
- * accounts.addresses() // Get available accounts
50
- */
51
-
52
- export default AccountBase.compose(AsyncInit, {
53
- async init(_ref) {
54
- let {
55
- accounts = [],
56
- address
57
- } = _ref;
58
- this.accounts = Object.fromEntries(await Promise.all(accounts.map(async a => [await a.address(), a])));
59
- address = address || Object.keys(this.accounts)[0];
60
- if (address) this.selectAccount(address);
61
- },
62
-
63
- props: {
64
- accounts: {}
65
- },
66
- deepProps: {
67
- selectedAddress: null
68
- },
69
- methods: {
70
- async address() {
71
- let {
72
- onAccount = this.selectedAddress
73
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
74
- return this._resolveAccount(onAccount).address();
75
- },
76
-
77
- async sign(data) {
78
- let {
79
- onAccount = this.selectedAddress
80
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
81
- return this._resolveAccount(onAccount).sign(data);
82
- },
83
-
84
- /**
85
- * Get accounts addresses
86
- * @alias module:@aeternity/aepp-sdk/es/accounts/multiple
87
- * @function
88
- * @rtype () => String[]
89
- * @return {String[]}
90
- * @example addresses()
91
- */
92
- addresses() {
93
- return Object.keys(this.accounts);
94
- },
95
-
96
- /**
97
- * Add specific account
98
- * @alias module:@aeternity/aepp-sdk/es/accounts/multiple
99
- * @function
100
- * @category async
101
- * @rtype (account: Account, { select: Boolean }) => void
102
- * @param {Object} account - Account instance
103
- * @param {Object} [options={}] - Options
104
- * @param {Boolean} [options.select] - Select account
105
- * @return {void}
106
- * @example addAccount(account)
107
- */
108
- async addAccount(account) {
109
- let {
110
- select
111
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
112
- const address = await account.address();
113
- this.accounts[address] = account;
114
- if (select) this.selectAccount(address);
115
- },
116
-
117
- /**
118
- * Remove specific account
119
- * @alias module:@aeternity/aepp-sdk/es/accounts/multiple
120
- * @function
121
- * @rtype (address: String) => void
122
- * @param {String} address - Address of account to remove
123
- * @return {void}
124
- * @example removeAccount(address)
125
- */
126
- removeAccount(address) {
127
- if (!this.accounts[address]) {
128
- console.warn(`removeAccount: Account for ${address} not available`);
129
- return;
130
- }
131
-
132
- delete this.accounts[address];
133
- if (this.selectedAddress === address) this.selectedAddress = null;
134
- },
135
-
136
- /**
137
- * Select specific account
138
- * @alias module:@aeternity/aepp-sdk/es/account/selector
139
- * @instance
140
- * @rtype (address: String) => void
141
- * @param {String} address - Address of account to select
142
- * @example selectAccount('ak_xxxxxxxx')
143
- */
144
- selectAccount(address) {
145
- decode(address, 'ak');
146
- if (!this.accounts[address]) throw new UnavailableAccountError(address);
147
- this.selectedAddress = address;
148
- },
149
-
150
- /**
151
- * Resolves an account
152
- * @param account account address (should exist in sdk instance), MemoryAccount or keypair
153
- * @returns {AccountBase}
154
- * @private
155
- */
156
- _resolveAccount(account) {
157
- if (account === null) {
158
- throw new TypeError('Account should be an address (ak-prefixed string), ' + 'keypair, or instance of account base, got null instead');
159
- } else {
160
- switch (typeof account) {
161
- case 'string':
162
- decode(account, 'ak');
163
- if (!this.accounts[account]) throw new UnavailableAccountError(account);
164
- return this.accounts[account];
165
-
166
- case 'object':
167
- return isAccountBase(account) ? account : MemoryAccount({
168
- keypair: account
169
- });
170
-
171
- default:
172
- throw new TypeError('Account should be an address (ak-prefixed string), ' + `keypair, or instance of account base, got ${account} instead`);
173
- }
174
- }
175
- }
176
-
177
- }
178
- });
179
- //# sourceMappingURL=multiple.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/account/multiple.js"],"names":["AsyncInit","MemoryAccount","decode","AccountBase","isAccountBase","UnavailableAccountError","TypeError","compose","init","accounts","address","Object","fromEntries","Promise","all","map","a","keys","selectAccount","props","deepProps","selectedAddress","methods","onAccount","_resolveAccount","sign","data","addresses","addAccount","account","select","removeAccount","console","warn","keypair"],"mappings":"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","sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 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 * AccountMultiple module\n * @module @aeternity/aepp-sdk/es/accounts/multiple\n * @export AccountMultiple\n */\n\nimport AsyncInit from '../utils/async-init'\nimport MemoryAccount from './memory'\nimport { decode } from '../tx/builder/helpers'\nimport AccountBase, { isAccountBase } from './base'\nimport {\n UnavailableAccountError,\n TypeError\n} from '../utils/errors'\n\n/**\n * AccountMultiple stamp\n *\n * The purpose of this stamp is to wrap up implementations of\n * {@link module:@aeternity/aepp-sdk/es/account/base--AccountBase} objects and provide a\n * common interface to all of them. List are a substantial part of\n * {@link module:@aeternity/aepp-sdk/es/ae/wallet--Wallet}s.\n * @function\n * @alias module:@aeternity/aepp-sdk/es/accounts/multiple\n * @rtype Stamp\n * @param {Object} [options={}] - Initializer object\n * @param {Array} [options.accounts] - Accounts array\n * @param {String} [options.address] - Address of account to select\n * @return {Object} AccountMultiple instance\n * @example\n * const accounts = await AccountMultiple({\n * accounts: [MemoryAccount({ keypair: 'keypair_object' })]\n * })\n * await accounts.addAccount(account, { select: true }) // Add account and make it selected\n * accounts.removeAccount(address) // Remove account\n * accounts.selectAccount(address) // Select account\n * accounts.addresses() // Get available accounts\n */\nexport default AccountBase.compose(AsyncInit, {\n async init ({ accounts = [], address }) {\n this.accounts = Object.fromEntries(await Promise.all(\n accounts.map(async a => [await a.address(), a])\n ))\n address = address || Object.keys(this.accounts)[0]\n if (address) this.selectAccount(address)\n },\n props: {\n accounts: {}\n },\n deepProps: {\n selectedAddress: null\n },\n methods: {\n async address ({ onAccount = this.selectedAddress } = {}) {\n return this._resolveAccount(onAccount).address()\n },\n async sign (data, { onAccount = this.selectedAddress } = {}) {\n return this._resolveAccount(onAccount).sign(data)\n },\n /**\n * Get accounts addresses\n * @alias module:@aeternity/aepp-sdk/es/accounts/multiple\n * @function\n * @rtype () => String[]\n * @return {String[]}\n * @example addresses()\n */\n addresses () {\n return Object.keys(this.accounts)\n },\n /**\n * Add specific account\n * @alias module:@aeternity/aepp-sdk/es/accounts/multiple\n * @function\n * @category async\n * @rtype (account: Account, { select: Boolean }) => void\n * @param {Object} account - Account instance\n * @param {Object} [options={}] - Options\n * @param {Boolean} [options.select] - Select account\n * @return {void}\n * @example addAccount(account)\n */\n async addAccount (account, { select } = {}) {\n const address = await account.address()\n this.accounts[address] = account\n if (select) this.selectAccount(address)\n },\n /**\n * Remove specific account\n * @alias module:@aeternity/aepp-sdk/es/accounts/multiple\n * @function\n * @rtype (address: String) => void\n * @param {String} address - Address of account to remove\n * @return {void}\n * @example removeAccount(address)\n */\n removeAccount (address) {\n if (!this.accounts[address]) {\n console.warn(`removeAccount: Account for ${address} not available`)\n return\n }\n delete this.accounts[address]\n if (this.selectedAddress === address) this.selectedAddress = null\n },\n /**\n * Select specific account\n * @alias module:@aeternity/aepp-sdk/es/account/selector\n * @instance\n * @rtype (address: String) => void\n * @param {String} address - Address of account to select\n * @example selectAccount('ak_xxxxxxxx')\n */\n selectAccount (address) {\n decode(address, 'ak')\n if (!this.accounts[address]) throw new UnavailableAccountError(address)\n this.selectedAddress = address\n },\n /**\n * Resolves an account\n * @param account account address (should exist in sdk instance), MemoryAccount or keypair\n * @returns {AccountBase}\n * @private\n */\n _resolveAccount (account) {\n if (account === null) {\n throw new TypeError(\n 'Account should be an address (ak-prefixed string), ' +\n 'keypair, or instance of account base, got null instead')\n } else {\n switch (typeof account) {\n case 'string':\n decode(account, 'ak')\n if (!this.accounts[account]) throw new UnavailableAccountError(account)\n return this.accounts[account]\n case 'object':\n return isAccountBase(account) ? account : MemoryAccount({ keypair: account })\n default:\n throw new TypeError(\n 'Account should be an address (ak-prefixed string), ' +\n `keypair, or instance of account base, got ${account} instead`)\n }\n }\n }\n }\n})\n"],"file":"multiple.mjs"}