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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (565) hide show
  1. package/bin/aesophia_cli +0 -0
  2. package/dist/aepp-sdk.browser-script.js +1 -1
  3. package/dist/aepp-sdk.browser-script.js.map +1 -1
  4. package/dist/aepp-sdk.browser.js +1 -1
  5. package/dist/aepp-sdk.browser.js.map +1 -1
  6. package/dist/aepp-sdk.js +12031 -11231
  7. package/dist/aepp-sdk.js.map +1 -1
  8. package/es/AeSdk.d.ts +7 -3
  9. package/es/AeSdk.mjs +17 -22
  10. package/es/AeSdk.mjs.map +1 -1
  11. package/es/AeSdkAepp.d.ts +6 -5
  12. package/es/AeSdkAepp.mjs +7 -30
  13. package/es/AeSdkAepp.mjs.map +1 -1
  14. package/es/AeSdkBase.d.ts +18 -140
  15. package/es/AeSdkBase.mjs +30 -184
  16. package/es/AeSdkBase.mjs.map +1 -1
  17. package/es/AeSdkMethods.d.ts +123 -0
  18. package/es/AeSdkMethods.mjs +122 -0
  19. package/es/AeSdkMethods.mjs.map +1 -0
  20. package/es/AeSdkWallet.d.ts +7 -21
  21. package/es/AeSdkWallet.mjs +38 -86
  22. package/es/AeSdkWallet.mjs.map +1 -1
  23. package/es/Node.d.ts +11 -15
  24. package/es/Node.mjs +35 -48
  25. package/es/Node.mjs.map +1 -1
  26. package/es/account/Base.d.ts +24 -40
  27. package/es/account/Base.mjs +1 -101
  28. package/es/account/Base.mjs.map +1 -1
  29. package/es/account/Generalized.d.ts +16 -0
  30. package/es/account/Generalized.mjs +113 -0
  31. package/es/account/Generalized.mjs.map +1 -0
  32. package/es/account/Ledger.d.ts +28 -0
  33. package/es/account/Ledger.mjs +102 -0
  34. package/es/account/Ledger.mjs.map +1 -0
  35. package/es/account/LedgerFactory.d.ts +39 -0
  36. package/es/account/LedgerFactory.mjs +81 -0
  37. package/es/account/LedgerFactory.mjs.map +1 -0
  38. package/es/account/Memory.d.ts +13 -17
  39. package/es/account/Memory.mjs +43 -64
  40. package/es/account/Memory.mjs.map +1 -1
  41. package/es/account/Rpc.d.ts +6 -8
  42. package/es/account/Rpc.mjs +14 -32
  43. package/es/account/Rpc.mjs.map +1 -1
  44. package/es/aens.d.ts +4 -4
  45. package/es/aens.mjs +46 -41
  46. package/es/aens.mjs.map +1 -1
  47. package/es/aepp-wallet-communication/connection/Browser.mjs +9 -13
  48. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +1 -0
  50. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +22 -11
  51. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +1 -1
  53. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +0 -31
  54. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  55. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  56. package/es/aepp-wallet-communication/rpc/RpcClient.d.ts +3 -3
  57. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -42
  58. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/rpc/types.d.ts +7 -1
  60. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/schema.mjs +14 -68
  62. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  63. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  64. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  65. package/es/apis/compiler/compiler.d.ts +23 -29
  66. package/es/apis/compiler/compiler.mjs +128 -189
  67. package/es/apis/compiler/compiler.mjs.map +1 -1
  68. package/es/apis/compiler/index.mjs.map +1 -1
  69. package/es/apis/compiler/models/index.d.ts +82 -135
  70. package/es/apis/compiler/models/index.mjs +1 -47
  71. package/es/apis/compiler/models/index.mjs.map +1 -1
  72. package/es/apis/compiler/models/mappers.d.ts +8 -8
  73. package/es/apis/compiler/models/mappers.mjs +165 -183
  74. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  75. package/es/apis/compiler/models/parameters.d.ts +0 -1
  76. package/es/apis/compiler/models/parameters.mjs +5 -9
  77. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  78. package/es/apis/node/index.mjs.map +1 -1
  79. package/es/apis/node/models/index.d.ts +48 -48
  80. package/es/apis/node/models/mappers.mjs +12 -6
  81. package/es/apis/node/models/mappers.mjs.map +1 -1
  82. package/es/apis/node/models/parameters.mjs.map +1 -1
  83. package/es/apis/node/node.mjs +43 -84
  84. package/es/apis/node/node.mjs.map +1 -1
  85. package/es/chain.d.ts +10 -2
  86. package/es/chain.mjs +37 -59
  87. package/es/chain.mjs.map +1 -1
  88. package/es/channel/Base.d.ts +200 -0
  89. package/es/channel/Base.mjs +293 -0
  90. package/es/channel/Base.mjs.map +1 -0
  91. package/es/channel/Contract.d.ts +248 -0
  92. package/es/channel/Contract.mjs +420 -0
  93. package/es/channel/Contract.mjs.map +1 -0
  94. package/es/channel/Spend.d.ts +219 -0
  95. package/es/channel/Spend.mjs +385 -0
  96. package/es/channel/Spend.mjs.map +1 -0
  97. package/es/channel/handlers.d.ts +8 -21
  98. package/es/channel/handlers.mjs +151 -899
  99. package/es/channel/handlers.mjs.map +1 -1
  100. package/es/channel/internal.d.ts +27 -21
  101. package/es/channel/internal.mjs +101 -191
  102. package/es/channel/internal.mjs.map +1 -1
  103. package/es/contract/Contract.d.ts +210 -0
  104. package/es/contract/Contract.mjs +551 -0
  105. package/es/contract/Contract.mjs.map +1 -0
  106. package/es/contract/compiler/Base.d.ts +81 -0
  107. package/es/contract/compiler/Base.mjs +5 -0
  108. package/es/contract/compiler/Base.mjs.map +1 -0
  109. package/es/contract/compiler/Cli.d.ts +23 -0
  110. package/es/contract/compiler/Cli.mjs +155 -0
  111. package/es/contract/compiler/Cli.mjs.map +1 -0
  112. package/es/contract/compiler/Http.d.ts +32 -0
  113. package/es/contract/compiler/Http.mjs +118 -0
  114. package/es/contract/compiler/Http.mjs.map +1 -0
  115. package/es/contract/compiler/HttpNode.d.ts +17 -0
  116. package/es/contract/compiler/HttpNode.mjs +26 -0
  117. package/es/contract/compiler/HttpNode.mjs.map +1 -0
  118. package/es/contract/compiler/getFileSystem.d.ts +6 -0
  119. package/es/contract/compiler/getFileSystem.mjs +40 -0
  120. package/es/contract/compiler/getFileSystem.mjs.map +1 -0
  121. package/es/contract/ga.d.ts +9 -34
  122. package/es/contract/ga.mjs +29 -112
  123. package/es/contract/ga.mjs.map +1 -1
  124. package/es/index-browser.d.ts +39 -0
  125. package/es/index-browser.mjs +55 -0
  126. package/es/index-browser.mjs.map +1 -0
  127. package/es/index.d.ts +4 -35
  128. package/es/index.mjs +4 -51
  129. package/es/index.mjs.map +1 -1
  130. package/es/oracle.d.ts +5 -5
  131. package/es/oracle.mjs +34 -40
  132. package/es/oracle.mjs.map +1 -1
  133. package/es/spend.d.ts +3 -3
  134. package/es/spend.mjs +18 -23
  135. package/es/spend.mjs.map +1 -1
  136. package/es/tx/builder/constants.d.ts +30 -2
  137. package/es/tx/builder/constants.mjs +43 -14
  138. package/es/tx/builder/constants.mjs.map +1 -1
  139. package/es/tx/builder/field-types/abi-version.d.ts +10 -0
  140. package/es/tx/builder/field-types/abi-version.mjs +20 -0
  141. package/es/tx/builder/field-types/abi-version.mjs.map +1 -0
  142. package/es/tx/builder/field-types/address.d.ts +14 -0
  143. package/es/tx/builder/field-types/address.mjs +51 -0
  144. package/es/tx/builder/field-types/address.mjs.map +1 -0
  145. package/es/tx/builder/field-types/array.d.ts +7 -0
  146. package/es/tx/builder/field-types/array.mjs +11 -0
  147. package/es/tx/builder/field-types/array.mjs.map +1 -0
  148. package/es/tx/builder/field-types/boolean.d.ts +6 -0
  149. package/es/tx/builder/field-types/boolean.mjs +13 -0
  150. package/es/tx/builder/field-types/boolean.mjs.map +1 -0
  151. package/es/tx/builder/field-types/coin-amount.d.ts +2 -3
  152. package/es/tx/builder/field-types/coin-amount.mjs +4 -12
  153. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  154. package/es/tx/builder/field-types/ct-version.d.ts +30 -0
  155. package/es/tx/builder/field-types/ct-version.mjs +48 -0
  156. package/es/tx/builder/field-types/ct-version.mjs.map +1 -0
  157. package/es/tx/builder/field-types/deposit.d.ts +1 -2
  158. package/es/tx/builder/field-types/deposit.mjs +2 -4
  159. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  160. package/es/tx/builder/field-types/encoded.d.ts +6 -0
  161. package/es/tx/builder/field-types/encoded.mjs +21 -0
  162. package/es/tx/builder/field-types/encoded.mjs.map +1 -0
  163. package/es/tx/builder/field-types/entry.d.ts +11 -0
  164. package/es/tx/builder/field-types/entry.mjs +31 -0
  165. package/es/tx/builder/field-types/entry.mjs.map +1 -0
  166. package/es/tx/builder/field-types/enumeration.d.ts +7 -0
  167. package/es/tx/builder/field-types/enumeration.mjs +30 -0
  168. package/es/tx/builder/field-types/enumeration.mjs.map +1 -0
  169. package/es/tx/builder/field-types/fee.d.ts +10 -15
  170. package/es/tx/builder/field-types/fee.mjs +31 -43
  171. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  172. package/es/tx/builder/field-types/field.mjs +0 -2
  173. package/es/tx/builder/field-types/field.mjs.map +1 -1
  174. package/es/tx/builder/field-types/gas-limit.d.ts +5 -2
  175. package/es/tx/builder/field-types/gas-limit.mjs +12 -14
  176. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  177. package/es/tx/builder/field-types/gas-price.d.ts +1 -2
  178. package/es/tx/builder/field-types/gas-price.mjs +3 -7
  179. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  180. package/es/tx/builder/field-types/index.d.ts +80 -30
  181. package/es/tx/builder/field-types/index.mjs +34 -9
  182. package/es/tx/builder/field-types/index.mjs.map +1 -1
  183. package/es/tx/builder/field-types/mptree.d.ts +37 -0
  184. package/es/tx/builder/field-types/mptree.mjs +268 -0
  185. package/es/tx/builder/field-types/mptree.mjs.map +1 -0
  186. package/es/tx/builder/field-types/name-fee.d.ts +1 -3
  187. package/es/tx/builder/field-types/name-fee.mjs +3 -5
  188. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  189. package/es/tx/builder/field-types/name-id.d.ts +1 -4
  190. package/es/tx/builder/field-types/name-id.mjs +5 -10
  191. package/es/tx/builder/field-types/name-id.mjs.map +1 -1
  192. package/es/tx/builder/field-types/name.mjs +0 -2
  193. package/es/tx/builder/field-types/name.mjs.map +1 -1
  194. package/es/tx/builder/field-types/pointers.d.ts +23 -0
  195. package/es/tx/builder/field-types/pointers.mjs +36 -0
  196. package/es/tx/builder/field-types/pointers.mjs.map +1 -0
  197. package/es/tx/builder/field-types/raw.d.ts +6 -0
  198. package/es/tx/builder/field-types/raw.mjs +13 -0
  199. package/es/tx/builder/field-types/raw.mjs.map +1 -0
  200. package/es/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  201. package/es/tx/builder/field-types/short-u-int-const.mjs +16 -0
  202. package/es/tx/builder/field-types/short-u-int-const.mjs.map +1 -0
  203. package/es/tx/builder/field-types/short-u-int.mjs +0 -2
  204. package/es/tx/builder/field-types/short-u-int.mjs.map +1 -1
  205. package/es/tx/builder/field-types/string.d.ts +6 -0
  206. package/es/tx/builder/field-types/string.mjs +10 -0
  207. package/es/tx/builder/field-types/string.mjs.map +1 -0
  208. package/es/tx/builder/field-types/u-int.d.ts +1 -2
  209. package/es/tx/builder/field-types/u-int.mjs +3 -4
  210. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  211. package/es/tx/builder/helpers.d.ts +2 -32
  212. package/es/tx/builder/helpers.mjs +19 -71
  213. package/es/tx/builder/helpers.mjs.map +1 -1
  214. package/es/tx/builder/index.d.ts +11 -49
  215. package/es/tx/builder/index.mjs +57 -337
  216. package/es/tx/builder/index.mjs.map +1 -1
  217. package/es/tx/builder/schema.d.ts +2367 -667
  218. package/es/tx/builder/schema.mjs +70 -145
  219. package/es/tx/builder/schema.mjs.map +1 -1
  220. package/es/tx/index.d.ts +4 -49
  221. package/es/tx/index.mjs +38 -112
  222. package/es/tx/index.mjs.map +1 -1
  223. package/es/tx/validator.d.ts +4 -6
  224. package/es/tx/validator.mjs +104 -90
  225. package/es/tx/validator.mjs.map +1 -1
  226. package/es/typings/{@aeternity__argon2-browser → @aeternity__aepp-calldata}/index.d.mjs +0 -0
  227. package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +1 -0
  228. package/es/utils/amount-formatter.mjs +4 -10
  229. package/es/utils/amount-formatter.mjs.map +1 -1
  230. package/es/utils/autorest.d.ts +1 -0
  231. package/es/utils/autorest.mjs +17 -19
  232. package/es/utils/autorest.mjs.map +1 -1
  233. package/es/utils/bignumber.mjs +4 -7
  234. package/es/utils/bignumber.mjs.map +1 -1
  235. package/es/utils/bytes.d.ts +0 -17
  236. package/es/utils/bytes.mjs +6 -35
  237. package/es/utils/bytes.mjs.map +1 -1
  238. package/es/utils/crypto.d.ts +15 -8
  239. package/es/utils/crypto.mjs +40 -40
  240. package/es/utils/crypto.mjs.map +1 -1
  241. package/es/utils/encoder-types.d.ts +28 -28
  242. package/es/utils/encoder-types.mjs +0 -1
  243. package/es/utils/encoder-types.mjs.map +1 -1
  244. package/es/utils/encoder.d.ts +0 -1
  245. package/es/utils/encoder.mjs +7 -15
  246. package/es/utils/encoder.mjs.map +1 -1
  247. package/es/utils/errors.d.ts +15 -14
  248. package/es/utils/errors.mjs +86 -172
  249. package/es/utils/errors.mjs.map +1 -1
  250. package/es/utils/hd-wallet.d.ts +27 -19
  251. package/es/utils/hd-wallet.mjs +42 -26
  252. package/es/utils/hd-wallet.mjs.map +1 -1
  253. package/es/utils/json-big.mjs +0 -8
  254. package/es/utils/json-big.mjs.map +1 -1
  255. package/es/utils/keystore.d.ts +2 -0
  256. package/es/utils/keystore.mjs +37 -36
  257. package/es/utils/keystore.mjs.map +1 -1
  258. package/es/utils/other.d.ts +4 -2
  259. package/es/utils/other.mjs +11 -7
  260. package/es/utils/other.mjs.map +1 -1
  261. package/es/utils/semver-satisfies.mjs +0 -3
  262. package/es/utils/semver-satisfies.mjs.map +1 -1
  263. package/es/utils/string.d.ts +0 -12
  264. package/es/utils/string.mjs +1 -21
  265. package/es/utils/string.mjs.map +1 -1
  266. package/package.json +98 -51
  267. package/src/AeSdk.ts +15 -11
  268. package/src/AeSdkAepp.ts +9 -7
  269. package/src/AeSdkBase.ts +31 -202
  270. package/src/AeSdkMethods.ts +169 -0
  271. package/src/AeSdkWallet.ts +16 -47
  272. package/src/Node.ts +17 -18
  273. package/src/account/Base.ts +29 -75
  274. package/src/account/Generalized.ts +98 -0
  275. package/src/account/Ledger.ts +131 -0
  276. package/src/account/LedgerFactory.ts +86 -0
  277. package/src/account/Memory.ts +46 -60
  278. package/src/account/Rpc.ts +17 -26
  279. package/src/aens.ts +13 -11
  280. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +21 -9
  281. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +3 -3
  282. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -4
  283. package/src/aepp-wallet-communication/rpc/types.ts +11 -1
  284. package/src/aepp-wallet-communication/schema.ts +18 -18
  285. package/src/apis/compiler/code-model-v4.yaml +681 -888
  286. package/src/apis/compiler/compiler.ts +113 -154
  287. package/src/apis/compiler/models/index.ts +80 -140
  288. package/src/apis/compiler/models/mappers.ts +165 -183
  289. package/src/apis/compiler/models/parameters.ts +6 -12
  290. package/src/chain.ts +11 -6
  291. package/src/channel/Base.ts +335 -0
  292. package/src/channel/Contract.ts +488 -0
  293. package/src/channel/Spend.ts +408 -0
  294. package/src/channel/handlers.ts +164 -582
  295. package/src/channel/internal.ts +114 -143
  296. package/src/contract/Contract.ts +610 -0
  297. package/src/contract/compiler/Base.ts +94 -0
  298. package/src/contract/compiler/Cli.ts +134 -0
  299. package/src/contract/compiler/Http.ts +124 -0
  300. package/src/contract/compiler/HttpNode.ts +26 -0
  301. package/src/contract/compiler/getFileSystem.ts +42 -0
  302. package/src/contract/ga.ts +23 -106
  303. package/src/index-browser.ts +58 -0
  304. package/src/index.ts +4 -55
  305. package/src/oracle.ts +8 -8
  306. package/src/spend.ts +6 -14
  307. package/src/tx/builder/constants.ts +33 -3
  308. package/src/tx/builder/field-types/abi-version.ts +21 -0
  309. package/src/tx/builder/field-types/address.ts +62 -0
  310. package/src/tx/builder/field-types/array.ts +19 -0
  311. package/src/tx/builder/field-types/boolean.ts +9 -0
  312. package/src/tx/builder/field-types/coin-amount.ts +4 -9
  313. package/src/tx/builder/field-types/ct-version.ts +50 -0
  314. package/src/tx/builder/field-types/deposit.ts +1 -1
  315. package/src/tx/builder/field-types/encoded.ts +27 -0
  316. package/src/tx/builder/field-types/entry.ts +31 -0
  317. package/src/tx/builder/field-types/enumeration.ts +32 -0
  318. package/src/tx/builder/field-types/fee.ts +39 -21
  319. package/src/tx/builder/field-types/gas-limit.ts +13 -8
  320. package/src/tx/builder/field-types/gas-price.ts +0 -2
  321. package/src/tx/builder/field-types/index.ts +54 -15
  322. package/src/tx/builder/field-types/mptree.ts +242 -0
  323. package/src/tx/builder/field-types/name-fee.ts +2 -3
  324. package/src/tx/builder/field-types/name-id.ts +7 -10
  325. package/src/tx/builder/field-types/pointers.ts +41 -0
  326. package/src/tx/builder/field-types/raw.ts +9 -0
  327. package/src/tx/builder/field-types/short-u-int-const.ts +20 -0
  328. package/src/tx/builder/field-types/string.ts +11 -0
  329. package/src/tx/builder/field-types/u-int.ts +4 -5
  330. package/src/tx/builder/helpers.ts +10 -60
  331. package/src/tx/builder/index.ts +65 -308
  332. package/src/tx/builder/schema.ts +280 -341
  333. package/src/tx/index.ts +40 -103
  334. package/src/tx/validator.ts +91 -96
  335. package/src/typings/@aeternity__aepp-calldata/index.d.ts +20 -0
  336. package/src/utils/autorest.ts +16 -1
  337. package/src/utils/bytes.ts +6 -34
  338. package/src/utils/crypto.ts +23 -16
  339. package/src/utils/encoder.ts +0 -1
  340. package/src/utils/errors.ts +22 -25
  341. package/src/utils/hd-wallet.ts +30 -9
  342. package/src/utils/keystore.ts +24 -21
  343. package/src/utils/other.ts +16 -1
  344. package/src/utils/string.ts +0 -20
  345. package/types-legacy/ts4.2/AeSdk.d.ts +41 -0
  346. package/types-legacy/ts4.2/AeSdkAepp.d.ts +71 -0
  347. package/types-legacy/ts4.2/AeSdkBase.d.ts +91 -0
  348. package/types-legacy/ts4.2/AeSdkMethods.d.ts +140 -0
  349. package/types-legacy/ts4.2/AeSdkWallet.d.ts +90 -0
  350. package/types-legacy/ts4.2/Node.d.ts +78 -0
  351. package/types-legacy/ts4.2/account/Base.d.ts +52 -0
  352. package/types-legacy/ts4.2/account/Generalized.d.ts +16 -0
  353. package/types-legacy/ts4.2/account/Ledger.d.ts +28 -0
  354. package/types-legacy/ts4.2/account/LedgerFactory.d.ts +39 -0
  355. package/types-legacy/ts4.2/account/Memory.d.ts +22 -0
  356. package/types-legacy/ts4.2/account/Rpc.d.ts +25 -0
  357. package/types-legacy/ts4.2/aens.d.ts +222 -0
  358. package/types-legacy/ts4.2/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  359. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  360. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  361. package/types-legacy/ts4.2/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  362. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  363. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +83 -0
  364. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +133 -0
  365. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  366. package/types-legacy/ts4.2/apis/compiler/compiler.d.ts +86 -0
  367. package/types-legacy/ts4.2/apis/compiler/index.d.ts +2 -0
  368. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +195 -0
  369. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +23 -0
  370. package/types-legacy/ts4.2/apis/compiler/models/parameters.d.ts +12 -0
  371. package/types-legacy/ts4.2/apis/node/index.d.ts +2 -0
  372. package/types-legacy/ts4.2/apis/node/models/index.d.ts +1065 -0
  373. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +95 -0
  374. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +17 -0
  375. package/types-legacy/ts4.2/apis/node/node.d.ts +215 -0
  376. package/types-legacy/ts4.2/chain.d.ts +256 -0
  377. package/types-legacy/ts4.2/channel/Base.d.ts +199 -0
  378. package/types-legacy/ts4.2/channel/Contract.d.ts +248 -0
  379. package/types-legacy/ts4.2/channel/Spend.d.ts +219 -0
  380. package/types-legacy/ts4.2/channel/handlers.d.ts +21 -0
  381. package/types-legacy/ts4.2/channel/internal.d.ts +107 -0
  382. package/types-legacy/ts4.2/contract/Contract.d.ts +212 -0
  383. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +81 -0
  384. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +23 -0
  385. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +32 -0
  386. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +17 -0
  387. package/types-legacy/ts4.2/contract/compiler/getFileSystem.d.ts +6 -0
  388. package/types-legacy/ts4.2/contract/ga.d.ts +44 -0
  389. package/types-legacy/ts4.2/globals.d.ts +16 -0
  390. package/types-legacy/ts4.2/index-browser.d.ts +39 -0
  391. package/types-legacy/ts4.2/index.d.ts +5 -0
  392. package/types-legacy/ts4.2/oracle.d.ts +161 -0
  393. package/types-legacy/ts4.2/spend.d.ts +62 -0
  394. package/types-legacy/ts4.2/tx/builder/constants.d.ts +98 -0
  395. package/types-legacy/ts4.2/tx/builder/field-types/abi-version.d.ts +10 -0
  396. package/types-legacy/ts4.2/tx/builder/field-types/address.d.ts +21 -0
  397. package/types-legacy/ts4.2/tx/builder/field-types/array.d.ts +7 -0
  398. package/types-legacy/ts4.2/tx/builder/field-types/boolean.d.ts +6 -0
  399. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +12 -0
  400. package/types-legacy/ts4.2/tx/builder/field-types/ct-version.d.ts +42 -0
  401. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +14 -0
  402. package/types-legacy/ts4.2/tx/builder/field-types/encoded.d.ts +6 -0
  403. package/types-legacy/ts4.2/tx/builder/field-types/entry.d.ts +11 -0
  404. package/types-legacy/ts4.2/tx/builder/field-types/enumeration.d.ts +7 -0
  405. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +20 -0
  406. package/types-legacy/ts4.2/tx/builder/field-types/field.d.ts +6 -0
  407. package/types-legacy/ts4.2/tx/builder/field-types/gas-limit.d.ts +15 -0
  408. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +7 -0
  409. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +129 -0
  410. package/types-legacy/ts4.2/tx/builder/field-types/mptree.d.ts +43 -0
  411. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +18 -0
  412. package/types-legacy/ts4.2/tx/builder/field-types/name-id.d.ts +11 -0
  413. package/types-legacy/ts4.2/tx/builder/field-types/name.d.ts +13 -0
  414. package/types-legacy/ts4.2/tx/builder/field-types/pointers.d.ts +26 -0
  415. package/types-legacy/ts4.2/tx/builder/field-types/raw.d.ts +6 -0
  416. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  417. package/types-legacy/ts4.2/tx/builder/field-types/short-u-int.d.ts +6 -0
  418. package/types-legacy/ts4.2/tx/builder/field-types/string.d.ts +6 -0
  419. package/types-legacy/ts4.2/tx/builder/field-types/u-int.d.ts +7 -0
  420. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +112 -0
  421. package/types-legacy/ts4.2/tx/builder/index.d.ts +50 -0
  422. package/types-legacy/ts4.2/tx/builder/schema.d.ts +4675 -0
  423. package/types-legacy/ts4.2/tx/index.d.ts +19 -0
  424. package/types-legacy/ts4.2/tx/validator.d.ts +18 -0
  425. package/types-legacy/ts4.2/utils/amount-formatter.d.ts +42 -0
  426. package/types-legacy/ts4.2/utils/autorest.d.ts +7 -0
  427. package/types-legacy/ts4.2/utils/bignumber.d.ts +13 -0
  428. package/types-legacy/ts4.2/utils/bytes.d.ts +9 -0
  429. package/types-legacy/ts4.2/utils/crypto.d.ts +95 -0
  430. package/types-legacy/ts4.2/utils/encoder-types.d.ts +61 -0
  431. package/types-legacy/ts4.2/utils/encoder.d.ts +24 -0
  432. package/types-legacy/ts4.2/utils/errors.d.ts +475 -0
  433. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +65 -0
  434. package/types-legacy/ts4.2/utils/json-big.d.ts +5 -0
  435. package/types-legacy/ts4.2/utils/keystore.d.ts +53 -0
  436. package/types-legacy/ts4.2/utils/other.d.ts +31 -0
  437. package/types-legacy/ts4.2/utils/semver-satisfies.d.ts +1 -0
  438. package/types-legacy/ts4.2/utils/string.d.ts +12 -0
  439. package/types-legacy/ts4.5/AeSdk.d.ts +41 -0
  440. package/types-legacy/ts4.5/AeSdkAepp.d.ts +71 -0
  441. package/types-legacy/ts4.5/AeSdkBase.d.ts +91 -0
  442. package/types-legacy/ts4.5/AeSdkMethods.d.ts +140 -0
  443. package/types-legacy/ts4.5/AeSdkWallet.d.ts +90 -0
  444. package/types-legacy/ts4.5/Node.d.ts +78 -0
  445. package/types-legacy/ts4.5/account/Base.d.ts +52 -0
  446. package/types-legacy/ts4.5/account/Generalized.d.ts +16 -0
  447. package/types-legacy/ts4.5/account/Ledger.d.ts +28 -0
  448. package/types-legacy/ts4.5/account/LedgerFactory.d.ts +39 -0
  449. package/types-legacy/ts4.5/account/Memory.d.ts +22 -0
  450. package/types-legacy/ts4.5/account/Rpc.d.ts +25 -0
  451. package/types-legacy/ts4.5/aens.d.ts +222 -0
  452. package/types-legacy/ts4.5/aepp-wallet-communication/connection/Browser.d.ts +33 -0
  453. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +19 -0
  454. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserWindowMessage.d.ts +36 -0
  455. package/types-legacy/ts4.5/aepp-wallet-communication/connection-proxy.d.ts +11 -0
  456. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/RpcClient.d.ts +34 -0
  457. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +83 -0
  458. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +133 -0
  459. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +25 -0
  460. package/types-legacy/ts4.5/apis/compiler/compiler.d.ts +86 -0
  461. package/types-legacy/ts4.5/apis/compiler/index.d.ts +2 -0
  462. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +195 -0
  463. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +23 -0
  464. package/types-legacy/ts4.5/apis/compiler/models/parameters.d.ts +12 -0
  465. package/types-legacy/ts4.5/apis/node/index.d.ts +2 -0
  466. package/types-legacy/ts4.5/apis/node/models/index.d.ts +1065 -0
  467. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +95 -0
  468. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +17 -0
  469. package/types-legacy/ts4.5/apis/node/node.d.ts +215 -0
  470. package/types-legacy/ts4.5/chain.d.ts +256 -0
  471. package/types-legacy/ts4.5/channel/Base.d.ts +199 -0
  472. package/types-legacy/ts4.5/channel/Contract.d.ts +248 -0
  473. package/types-legacy/ts4.5/channel/Spend.d.ts +219 -0
  474. package/types-legacy/ts4.5/channel/handlers.d.ts +21 -0
  475. package/types-legacy/ts4.5/channel/internal.d.ts +107 -0
  476. package/types-legacy/ts4.5/contract/Contract.d.ts +212 -0
  477. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +81 -0
  478. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +23 -0
  479. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +32 -0
  480. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +17 -0
  481. package/types-legacy/ts4.5/contract/compiler/getFileSystem.d.ts +6 -0
  482. package/types-legacy/ts4.5/contract/ga.d.ts +44 -0
  483. package/types-legacy/ts4.5/index-browser.d.ts +39 -0
  484. package/types-legacy/ts4.5/index.d.ts +4 -0
  485. package/types-legacy/ts4.5/oracle.d.ts +161 -0
  486. package/types-legacy/ts4.5/spend.d.ts +62 -0
  487. package/types-legacy/ts4.5/tx/builder/constants.d.ts +98 -0
  488. package/types-legacy/ts4.5/tx/builder/field-types/abi-version.d.ts +10 -0
  489. package/types-legacy/ts4.5/tx/builder/field-types/address.d.ts +21 -0
  490. package/types-legacy/ts4.5/tx/builder/field-types/array.d.ts +7 -0
  491. package/types-legacy/ts4.5/tx/builder/field-types/boolean.d.ts +6 -0
  492. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +12 -0
  493. package/types-legacy/ts4.5/tx/builder/field-types/ct-version.d.ts +42 -0
  494. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +14 -0
  495. package/types-legacy/ts4.5/tx/builder/field-types/encoded.d.ts +6 -0
  496. package/types-legacy/ts4.5/tx/builder/field-types/entry.d.ts +11 -0
  497. package/types-legacy/ts4.5/tx/builder/field-types/enumeration.d.ts +7 -0
  498. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +20 -0
  499. package/types-legacy/ts4.5/tx/builder/field-types/field.d.ts +6 -0
  500. package/types-legacy/ts4.5/tx/builder/field-types/gas-limit.d.ts +15 -0
  501. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +7 -0
  502. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +129 -0
  503. package/types-legacy/ts4.5/tx/builder/field-types/mptree.d.ts +43 -0
  504. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +18 -0
  505. package/types-legacy/ts4.5/tx/builder/field-types/name-id.d.ts +11 -0
  506. package/types-legacy/ts4.5/tx/builder/field-types/name.d.ts +13 -0
  507. package/types-legacy/ts4.5/tx/builder/field-types/pointers.d.ts +26 -0
  508. package/types-legacy/ts4.5/tx/builder/field-types/raw.d.ts +6 -0
  509. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int-const.d.ts +5 -0
  510. package/types-legacy/ts4.5/tx/builder/field-types/short-u-int.d.ts +6 -0
  511. package/types-legacy/ts4.5/tx/builder/field-types/string.d.ts +6 -0
  512. package/types-legacy/ts4.5/tx/builder/field-types/u-int.d.ts +7 -0
  513. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +112 -0
  514. package/types-legacy/ts4.5/tx/builder/index.d.ts +50 -0
  515. package/types-legacy/ts4.5/tx/builder/schema.d.ts +4675 -0
  516. package/types-legacy/ts4.5/tx/index.d.ts +19 -0
  517. package/types-legacy/ts4.5/tx/validator.d.ts +18 -0
  518. package/types-legacy/ts4.5/utils/amount-formatter.d.ts +42 -0
  519. package/types-legacy/ts4.5/utils/autorest.d.ts +7 -0
  520. package/types-legacy/ts4.5/utils/bignumber.d.ts +13 -0
  521. package/types-legacy/ts4.5/utils/bytes.d.ts +9 -0
  522. package/types-legacy/ts4.5/utils/crypto.d.ts +95 -0
  523. package/types-legacy/ts4.5/utils/encoder-types.d.ts +61 -0
  524. package/types-legacy/ts4.5/utils/encoder.d.ts +24 -0
  525. package/types-legacy/ts4.5/utils/errors.d.ts +475 -0
  526. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +65 -0
  527. package/types-legacy/ts4.5/utils/json-big.d.ts +5 -0
  528. package/types-legacy/ts4.5/utils/keystore.d.ts +53 -0
  529. package/types-legacy/ts4.5/utils/other.d.ts +31 -0
  530. package/types-legacy/ts4.5/utils/semver-satisfies.d.ts +1 -0
  531. package/types-legacy/ts4.5/utils/string.d.ts +12 -0
  532. package/es/channel/index.d.ts +0 -625
  533. package/es/channel/index.mjs +0 -975
  534. package/es/channel/index.mjs.map +0 -1
  535. package/es/contract/Compiler.d.ts +0 -18
  536. package/es/contract/Compiler.mjs +0 -68
  537. package/es/contract/Compiler.mjs.map +0 -1
  538. package/es/contract/aci.d.ts +0 -127
  539. package/es/contract/aci.mjs +0 -508
  540. package/es/contract/aci.mjs.map +0 -1
  541. package/es/contract/methods.d.ts +0 -71
  542. package/es/contract/methods.mjs +0 -104
  543. package/es/contract/methods.mjs.map +0 -1
  544. package/es/deprecated/index.d.ts +0 -143
  545. package/es/deprecated/index.mjs +0 -162
  546. package/es/deprecated/index.mjs.map +0 -1
  547. package/es/deprecated/methods.d.ts +0 -18
  548. package/es/deprecated/methods.mjs +0 -26
  549. package/es/deprecated/methods.mjs.map +0 -1
  550. package/es/tx/builder/address.d.ts +0 -25
  551. package/es/tx/builder/address.mjs +0 -45
  552. package/es/tx/builder/address.mjs.map +0 -1
  553. package/es/typings/@aeternity__argon2-browser/index.d.mjs.map +0 -1
  554. package/es/utils/mptree.d.ts +0 -26
  555. package/es/utils/mptree.mjs +0 -165
  556. package/es/utils/mptree.mjs.map +0 -1
  557. package/src/channel/index.ts +0 -1025
  558. package/src/contract/Compiler.ts +0 -67
  559. package/src/contract/aci.ts +0 -537
  560. package/src/contract/methods.ts +0 -123
  561. package/src/deprecated/index.ts +0 -172
  562. package/src/deprecated/methods.ts +0 -25
  563. package/src/tx/builder/address.ts +0 -50
  564. package/src/typings/@aeternity__argon2-browser/index.d.ts +0 -3
  565. package/src/utils/mptree.ts +0 -145
@@ -1,10 +1,7 @@
1
1
  import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
2
2
  import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/classPrivateFieldSet";
3
-
4
3
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
-
6
4
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
7
-
8
5
  /*
9
6
  * ISC License (ISC)
10
7
  * Copyright (c) 2022 aeternity developers
@@ -24,13 +21,9 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
24
21
  import BrowserConnection from "./Browser.mjs";
25
22
  import { MESSAGE_DIRECTION } from "../schema.mjs";
26
23
  import { InternalError, RpcConnectionError } from "../../utils/errors.mjs";
27
-
28
24
  var _onDisconnect = /*#__PURE__*/new WeakMap();
29
-
30
25
  var _target = /*#__PURE__*/new WeakMap();
31
-
32
26
  var _self = /*#__PURE__*/new WeakMap();
33
-
34
27
  /**
35
28
  * Browser window Post Message connector module
36
29
  * @category aepp wallet communication
@@ -56,41 +49,31 @@ export default class BrowserWindowMessageConnection extends BrowserConnection {
56
49
  ...options
57
50
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
58
51
  super(options);
59
-
60
52
  _classPrivateFieldInitSpec(this, _onDisconnect, {
61
53
  writable: true,
62
54
  value: void 0
63
55
  });
64
-
65
56
  _classPrivateFieldInitSpec(this, _target, {
66
57
  writable: true,
67
58
  value: void 0
68
59
  });
69
-
70
60
  _classPrivateFieldInitSpec(this, _self, {
71
61
  writable: true,
72
62
  value: void 0
73
63
  });
74
-
75
64
  _classPrivateFieldSet(this, _target, target);
76
-
77
65
  _classPrivateFieldSet(this, _self, self);
78
-
79
66
  this.origin = origin;
80
67
  this.sendDirection = sendDirection;
81
68
  this.receiveDirection = receiveDirection;
82
69
  }
83
-
84
70
  isConnected() {
85
71
  return this.listener != null;
86
72
  }
87
-
88
73
  connect(onMessage, onDisconnect) {
89
74
  super.connect(onMessage, onDisconnect);
90
-
91
75
  this.listener = message => {
92
76
  var _message$data$jsonrpc, _message$data$data;
93
-
94
77
  // TODO: strict validate origin and source instead of checking message structure
95
78
  if (typeof message.data !== 'object' || ((_message$data$jsonrpc = message.data.jsonrpc) !== null && _message$data$jsonrpc !== void 0 ? _message$data$jsonrpc : (_message$data$data = message.data.data) === null || _message$data$data === void 0 ? void 0 : _message$data$data.jsonrpc) !== '2.0') return;
96
79
  if (this.origin != null && this.origin !== message.origin) return;
@@ -99,48 +82,34 @@ export default class BrowserWindowMessageConnection extends BrowserConnection {
99
82
  let {
100
83
  data
101
84
  } = message;
102
-
103
85
  if (data.type != null) {
104
86
  if (message.data.type !== this.receiveDirection) return;
105
87
  data = data.data;
106
88
  }
107
-
108
89
  onMessage(data, message.origin, message.source);
109
90
  };
110
-
111
91
  _classPrivateFieldGet(this, _self).addEventListener('message', this.listener);
112
-
113
92
  _classPrivateFieldSet(this, _onDisconnect, onDisconnect);
114
93
  }
115
-
116
94
  disconnect() {
117
95
  super.disconnect();
118
-
119
96
  if (this.listener == null || _classPrivateFieldGet(this, _onDisconnect) == null) {
120
97
  throw new InternalError('Expected to not happen, required for TS');
121
98
  }
122
-
123
99
  _classPrivateFieldGet(this, _self).removeEventListener('message', this.listener);
124
-
125
100
  delete this.listener;
126
-
127
101
  _classPrivateFieldGet(this, _onDisconnect).call(this);
128
-
129
102
  _classPrivateFieldSet(this, _onDisconnect, undefined);
130
103
  }
131
-
132
104
  sendMessage(msg) {
133
105
  var _this$origin;
134
-
135
106
  if (_classPrivateFieldGet(this, _target) == null) throw new RpcConnectionError('Can\'t send messages without target');
136
107
  const message = this.sendDirection != null ? {
137
108
  type: this.sendDirection,
138
109
  data: msg
139
110
  } : msg;
140
111
  super.sendMessage(message);
141
-
142
112
  _classPrivateFieldGet(this, _target).postMessage(message, (_this$origin = this.origin) !== null && _this$origin !== void 0 ? _this$origin : '*');
143
113
  }
144
-
145
114
  }
146
115
  //# sourceMappingURL=BrowserWindowMessage.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserWindowMessage.mjs","names":["BrowserConnection","MESSAGE_DIRECTION","InternalError","RpcConnectionError","BrowserWindowMessageConnection","constructor","target","self","window","origin","sendDirection","receiveDirection","to_aepp","options","isConnected","listener","connect","onMessage","onDisconnect","message","data","jsonrpc","source","receiveMessage","type","addEventListener","disconnect","removeEventListener","undefined","sendMessage","msg","postMessage"],"sources":["../../../src/aepp-wallet-communication/connection/BrowserWindowMessage.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 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\nimport BrowserConnection from './Browser';\nimport { MESSAGE_DIRECTION } from '../schema';\nimport { InternalError, RpcConnectionError } from '../../utils/errors';\n\nexport type ImplPostMessage = Pick<Window, 'addEventListener' | 'removeEventListener' | 'postMessage'>;\n\n/**\n * Browser window Post Message connector module\n * @category aepp wallet communication\n */\nexport default class BrowserWindowMessageConnection extends BrowserConnection {\n origin?: string;\n\n sendDirection?: MESSAGE_DIRECTION;\n\n receiveDirection: MESSAGE_DIRECTION;\n\n listener?: (this: Window, ev: MessageEvent<any>) => void;\n\n #onDisconnect?: () => void;\n\n #target?: ImplPostMessage;\n\n #self: ImplPostMessage;\n\n /**\n * @param options - Options\n * @param options.target Target window for message\n * @param options.self Host window for message\n * @param options.origin Origin of receiver\n * @param options.sendDirection Wrapping messages into additional struct\n * `({ type: 'to_aepp' || 'to_waellet', data })`\n * Used for handling messages between content script and page\n * @param options.receiveDirection Unwrapping messages from additional struct\n */\n constructor({\n target,\n self = window,\n origin,\n sendDirection,\n receiveDirection = MESSAGE_DIRECTION.to_aepp,\n ...options\n }: {\n target?: ImplPostMessage;\n self?: ImplPostMessage;\n origin?: string;\n sendDirection?: MESSAGE_DIRECTION;\n receiveDirection?: MESSAGE_DIRECTION;\n debug?: boolean;\n } = {}) {\n super(options);\n this.#target = target;\n this.#self = self;\n this.origin = origin;\n this.sendDirection = sendDirection;\n this.receiveDirection = receiveDirection;\n }\n\n isConnected(): boolean {\n return this.listener != null;\n }\n\n connect(\n onMessage: (message: any, origin: string, source: MessageEventSource | null) => void,\n onDisconnect: () => void,\n ): void {\n super.connect(onMessage, onDisconnect);\n this.listener = (message: MessageEvent<any>) => {\n // TODO: strict validate origin and source instead of checking message structure\n if (\n typeof message.data !== 'object'\n || (message.data.jsonrpc ?? message.data.data?.jsonrpc) !== '2.0'\n ) return;\n if (this.origin != null && this.origin !== message.origin) return;\n if (this.#target != null && this.#target !== message.source) return;\n this.receiveMessage(message);\n let { data } = message;\n if (data.type != null) {\n if (message.data.type !== this.receiveDirection) return;\n data = data.data;\n }\n onMessage(data, message.origin, message.source);\n };\n this.#self.addEventListener('message', this.listener);\n this.#onDisconnect = onDisconnect;\n }\n\n disconnect(): void {\n super.disconnect();\n if (this.listener == null || this.#onDisconnect == null) {\n throw new InternalError('Expected to not happen, required for TS');\n }\n this.#self.removeEventListener('message', this.listener);\n delete this.listener;\n this.#onDisconnect();\n this.#onDisconnect = undefined;\n }\n\n sendMessage(msg: any): void {\n if (this.#target == null) throw new RpcConnectionError('Can\\'t send messages without target');\n const message = this.sendDirection != null ? { type: this.sendDirection, data: msg } : msg;\n super.sendMessage(message);\n this.#target.postMessage(message, this.origin ?? '*');\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;OAEOA,iB;SACEC,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IAAa,IAAjB,EAAuB;QACrB,IAAIL,OAAO,CAACC,IAAR,CAAaI,IAAb,KAAsB,KAAKb,gBAA/B,EAAiD;QACjDS,IAAI,GAAGA,IAAI,CAACA,IAAZ;MACD;;MACDH,SAAS,CAACG,IAAD,EAAOD,OAAO,CAACV,MAAf,EAAuBU,OAAO,CAACG,MAA/B,CAAT;IACD,CAfD;;IAgBA,mCAAWG,gBAAX,CAA4B,SAA5B,EAAuC,KAAKV,QAA5C;;IACA,2CAAqBG,YAArB;EACD;;EAEDQ,UAAU,GAAS;IACjB,MAAMA,UAAN;;IACA,IAAI,KAAKX,QAAL,IAAiB,IAAjB,IAAyB,8CAAsB,IAAnD,EAAyD;MACvD,MAAM,IAAIb,aAAJ,CAAkB,yCAAlB,CAAN;IACD;;IACD,mCAAWyB,mBAAX,CAA+B,SAA/B,EAA0C,KAAKZ,QAA/C;;IACA,OAAO,KAAKA,QAAZ;;IACA;;IACA,2CAAqBa,SAArB;EACD;;EAEDC,WAAW,CAACC,GAAD,EAAiB;IAAA;;IAC1B,IAAI,wCAAgB,IAApB,EAA0B,MAAM,IAAI3B,kBAAJ,CAAuB,qCAAvB,CAAN;IAC1B,MAAMgB,OAAO,GAAG,KAAKT,aAAL,IAAsB,IAAtB,GAA6B;MAAEc,IAAI,EAAE,KAAKd,aAAb;MAA4BU,IAAI,EAAEU;IAAlC,CAA7B,GAAuEA,GAAvF;IACA,MAAMD,WAAN,CAAkBV,OAAlB;;IACA,qCAAaY,WAAb,CAAyBZ,OAAzB,kBAAkC,KAAKV,MAAvC,uDAAiD,GAAjD;EACD;;AA7F2E"}
1
+ {"version":3,"file":"BrowserWindowMessage.mjs","names":["BrowserConnection","MESSAGE_DIRECTION","InternalError","RpcConnectionError","BrowserWindowMessageConnection","constructor","target","self","window","origin","sendDirection","receiveDirection","to_aepp","options","isConnected","listener","connect","onMessage","onDisconnect","message","data","jsonrpc","source","receiveMessage","type","addEventListener","disconnect","removeEventListener","undefined","sendMessage","msg","postMessage"],"sources":["../../../src/aepp-wallet-communication/connection/BrowserWindowMessage.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 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\nimport BrowserConnection from './Browser';\nimport { MESSAGE_DIRECTION } from '../schema';\nimport { InternalError, RpcConnectionError } from '../../utils/errors';\n\nexport type ImplPostMessage = Pick<Window, 'addEventListener' | 'removeEventListener' | 'postMessage'>;\n\n/**\n * Browser window Post Message connector module\n * @category aepp wallet communication\n */\nexport default class BrowserWindowMessageConnection extends BrowserConnection {\n origin?: string;\n\n sendDirection?: MESSAGE_DIRECTION;\n\n receiveDirection: MESSAGE_DIRECTION;\n\n listener?: (this: Window, ev: MessageEvent<any>) => void;\n\n #onDisconnect?: () => void;\n\n #target?: ImplPostMessage;\n\n #self: ImplPostMessage;\n\n /**\n * @param options - Options\n * @param options.target Target window for message\n * @param options.self Host window for message\n * @param options.origin Origin of receiver\n * @param options.sendDirection Wrapping messages into additional struct\n * `({ type: 'to_aepp' || 'to_waellet', data })`\n * Used for handling messages between content script and page\n * @param options.receiveDirection Unwrapping messages from additional struct\n */\n constructor({\n target,\n self = window,\n origin,\n sendDirection,\n receiveDirection = MESSAGE_DIRECTION.to_aepp,\n ...options\n }: {\n target?: ImplPostMessage;\n self?: ImplPostMessage;\n origin?: string;\n sendDirection?: MESSAGE_DIRECTION;\n receiveDirection?: MESSAGE_DIRECTION;\n debug?: boolean;\n } = {}) {\n super(options);\n this.#target = target;\n this.#self = self;\n this.origin = origin;\n this.sendDirection = sendDirection;\n this.receiveDirection = receiveDirection;\n }\n\n isConnected(): boolean {\n return this.listener != null;\n }\n\n override connect(\n onMessage: (message: any, origin: string, source: MessageEventSource | null) => void,\n onDisconnect: () => void,\n ): void {\n super.connect(onMessage, onDisconnect);\n this.listener = (message: MessageEvent<any>) => {\n // TODO: strict validate origin and source instead of checking message structure\n if (\n typeof message.data !== 'object'\n || (message.data.jsonrpc ?? message.data.data?.jsonrpc) !== '2.0'\n ) return;\n if (this.origin != null && this.origin !== message.origin) return;\n if (this.#target != null && this.#target !== message.source) return;\n this.receiveMessage(message);\n let { data } = message;\n if (data.type != null) {\n if (message.data.type !== this.receiveDirection) return;\n data = data.data;\n }\n onMessage(data, message.origin, message.source);\n };\n this.#self.addEventListener('message', this.listener);\n this.#onDisconnect = onDisconnect;\n }\n\n override disconnect(): void {\n super.disconnect();\n if (this.listener == null || this.#onDisconnect == null) {\n throw new InternalError('Expected to not happen, required for TS');\n }\n this.#self.removeEventListener('message', this.listener);\n delete this.listener;\n this.#onDisconnect();\n this.#onDisconnect = undefined;\n }\n\n override sendMessage(msg: any): void {\n if (this.#target == null) throw new RpcConnectionError('Can\\'t send messages without target');\n const message = this.sendDirection != null ? { type: this.sendDirection, data: msg } : msg;\n super.sendMessage(message);\n this.#target.postMessage(message, this.origin ?? '*');\n }\n}\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,OAiBOA,iBAAiB;AAAA,SACfC,iBAAiB;AAAA,SACjBC,aAAa,EAAEC,kBAAkB;AAAA;AAAA;AAAA;AAI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OAAO;MACtB,IAAIC,IAAI,CAACI,IAAI,IAAI,IAAI,EAAE;QACrB,IAAIL,OAAO,CAACC,IAAI,CAACI,IAAI,KAAK,IAAI,CAACb,gBAAgB,EAAE;QACjDS,IAAI,GAAGA,IAAI,CAACA,IAAI;MAClB;MACAH,SAAS,CAACG,IAAI,EAAED,OAAO,CAACV,MAAM,EAAEU,OAAO,CAACG,MAAM,CAAC;IACjD,CAAC;IACD,0BAAI,SAAOG,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAACV,QAAQ,CAAC;IACrD,0BAAI,iBAAiBG,YAAY;EACnC;EAESQ,UAAU,GAAS;IAC1B,KAAK,CAACA,UAAU,EAAE;IAClB,IAAI,IAAI,CAACX,QAAQ,IAAI,IAAI,IAAI,0BAAI,oBAAkB,IAAI,EAAE;MACvD,MAAM,IAAIb,aAAa,CAAC,yCAAyC,CAAC;IACpE;IACA,0BAAI,SAAOyB,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAACZ,QAAQ,CAAC;IACxD,OAAO,IAAI,CAACA,QAAQ;IACpB,0BAAI,sBAAJ,IAAI;IACJ,0BAAI,iBAAiBa,SAAS;EAChC;EAESC,WAAW,CAACC,GAAQ,EAAQ;IAAA;IACnC,IAAI,0BAAI,cAAY,IAAI,EAAE,MAAM,IAAI3B,kBAAkB,CAAC,qCAAqC,CAAC;IAC7F,MAAMgB,OAAO,GAAG,IAAI,CAACT,aAAa,IAAI,IAAI,GAAG;MAAEc,IAAI,EAAE,IAAI,CAACd,aAAa;MAAEU,IAAI,EAAEU;IAAI,CAAC,GAAGA,GAAG;IAC1F,KAAK,CAACD,WAAW,CAACV,OAAO,CAAC;IAC1B,0BAAI,WAASY,WAAW,CAACZ,OAAO,kBAAE,IAAI,CAACV,MAAM,uDAAI,GAAG,CAAC;EACvD;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"connection-proxy.mjs","names":["con1","con2","connect","msg","sendMessage","disconnect"],"sources":["../../src/aepp-wallet-communication/connection-proxy.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 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\nimport BrowserConnection from './connection/Browser';\n\n/**\n * Browser connection proxy\n * Provide functionality to easily forward messages from one connection to another and back\n * @category aepp wallet communication\n * @param con1 - first connection\n * @param con2 - second connection\n * @returns a function to stop proxying\n */\nexport default (con1: BrowserConnection, con2: BrowserConnection): () => void => {\n con1.connect((msg: any) => con2.sendMessage(msg), () => con2.disconnect());\n con2.connect((msg: any) => con1.sendMessage(msg), () => con1.disconnect());\n\n return () => {\n con1.disconnect();\n con2.disconnect();\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CAACA,IAAD,EAA0BC,IAA1B,KAAkE;EAC/ED,IAAI,CAACE,OAAL,CAAcC,GAAD,IAAcF,IAAI,CAACG,WAAL,CAAiBD,GAAjB,CAA3B,EAAkD,MAAMF,IAAI,CAACI,UAAL,EAAxD;EACAJ,IAAI,CAACC,OAAL,CAAcC,GAAD,IAAcH,IAAI,CAACI,WAAL,CAAiBD,GAAjB,CAA3B,EAAkD,MAAMH,IAAI,CAACK,UAAL,EAAxD;EAEA,OAAO,MAAM;IACXL,IAAI,CAACK,UAAL;IACAJ,IAAI,CAACI,UAAL;EACD,CAHD;AAID,CARD"}
1
+ {"version":3,"file":"connection-proxy.mjs","names":["con1","con2","connect","msg","sendMessage","disconnect"],"sources":["../../src/aepp-wallet-communication/connection-proxy.ts"],"sourcesContent":["/*\n * ISC License (ISC)\n * Copyright (c) 2022 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\nimport BrowserConnection from './connection/Browser';\n\n/**\n * Browser connection proxy\n * Provide functionality to easily forward messages from one connection to another and back\n * @category aepp wallet communication\n * @param con1 - first connection\n * @param con2 - second connection\n * @returns a function to stop proxying\n */\nexport default (con1: BrowserConnection, con2: BrowserConnection): () => void => {\n con1.connect((msg: any) => con2.sendMessage(msg), () => con2.disconnect());\n con2.connect((msg: any) => con1.sendMessage(msg), () => con1.disconnect());\n\n return () => {\n con1.disconnect();\n con2.disconnect();\n };\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,CAACA,IAAuB,EAAEC,IAAuB,KAAiB;EAC/ED,IAAI,CAACE,OAAO,CAAEC,GAAQ,IAAKF,IAAI,CAACG,WAAW,CAACD,GAAG,CAAC,EAAE,MAAMF,IAAI,CAACI,UAAU,EAAE,CAAC;EAC1EJ,IAAI,CAACC,OAAO,CAAEC,GAAQ,IAAKH,IAAI,CAACI,WAAW,CAACD,GAAG,CAAC,EAAE,MAAMH,IAAI,CAACK,UAAU,EAAE,CAAC;EAE1E,OAAO,MAAM;IACXL,IAAI,CAACK,UAAU,EAAE;IACjBJ,IAAI,CAACI,UAAU,EAAE;EACnB,CAAC;AACH,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import BrowserConnection from '../connection/Browser';
2
- declare type RpcApiHandler = (p?: any) => any | undefined;
3
- declare type RpcApi<Api> = {
2
+ type RpcApiHandler = (p?: any) => any | undefined;
3
+ type RpcApi<Api> = {
4
4
  [k in keyof Api]: RpcApiHandler;
5
5
  };
6
- declare type WithOrigin<Api extends RpcApi<Api>> = {
6
+ type WithOrigin<Api extends RpcApi<Api>> = {
7
7
  [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>;
8
8
  };
9
9
  /**
@@ -1,31 +1,18 @@
1
1
  import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/classPrivateFieldGet";
2
2
  import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/classPrivateFieldSet";
3
-
4
3
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
5
-
6
4
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
7
-
8
5
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
9
-
10
6
  function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
11
-
12
7
  import { RpcError, RpcInternalError, RpcMethodNotFoundError } from "../schema.mjs";
13
8
  import { InvalidRpcMessageError, MissingCallbackError } from "../../utils/errors.mjs";
14
-
15
9
  var _callbacks = /*#__PURE__*/new WeakMap();
16
-
17
10
  var _messageId = /*#__PURE__*/new WeakMap();
18
-
19
11
  var _methods = /*#__PURE__*/new WeakMap();
20
-
21
12
  var _handleMessage = /*#__PURE__*/new WeakSet();
22
-
23
13
  var _sendRequest = /*#__PURE__*/new WeakSet();
24
-
25
14
  var _sendResponse = /*#__PURE__*/new WeakSet();
26
-
27
15
  var _processResponse = /*#__PURE__*/new WeakSet();
28
-
29
16
  /**
30
17
  * Contain functionality for using RPC conection
31
18
  * @category aepp wallet communication
@@ -36,35 +23,25 @@ var _processResponse = /*#__PURE__*/new WeakSet();
36
23
  export default class RpcClient {
37
24
  constructor(connection, onDisconnect, methods) {
38
25
  _classPrivateMethodInitSpec(this, _processResponse);
39
-
40
26
  _classPrivateMethodInitSpec(this, _sendResponse);
41
-
42
27
  _classPrivateMethodInitSpec(this, _sendRequest);
43
-
44
28
  _classPrivateMethodInitSpec(this, _handleMessage);
45
-
46
29
  _classPrivateFieldInitSpec(this, _callbacks, {
47
30
  writable: true,
48
31
  value: new Map()
49
32
  });
50
-
51
33
  _classPrivateFieldInitSpec(this, _messageId, {
52
34
  writable: true,
53
35
  value: 0
54
36
  });
55
-
56
37
  _classPrivateFieldInitSpec(this, _methods, {
57
38
  writable: true,
58
39
  value: void 0
59
40
  });
60
-
61
41
  this.connection = connection;
62
-
63
42
  _classPrivateFieldSet(this, _methods, methods);
64
-
65
43
  connection.connect(_classPrivateMethodGet(this, _handleMessage, _handleMessage2).bind(this), onDisconnect);
66
44
  }
67
-
68
45
  /**
69
46
  * Make a request
70
47
  * @param name - Method name
@@ -73,7 +50,6 @@ export default class RpcClient {
73
50
  */
74
51
  async request(name, params) {
75
52
  _classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, _classPrivateFieldSet(this, _messageId, _classPrivateFieldGet(this, _messageId) + 1), name, params);
76
-
77
53
  return new Promise((resolve, reject) => {
78
54
  _classPrivateFieldGet(this, _callbacks).set(_classPrivateFieldGet(this, _messageId), {
79
55
  resolve,
@@ -81,37 +57,30 @@ export default class RpcClient {
81
57
  });
82
58
  });
83
59
  }
60
+
84
61
  /**
85
62
  * Make a notification
86
63
  * @param name - Method name
87
64
  * @param params - Method params
88
65
  */
89
-
90
-
91
66
  notify(name, params) {
92
67
  _classPrivateMethodGet(this, _sendRequest, _sendRequest2).call(this, undefined, name, params);
93
68
  }
69
+
94
70
  /**
95
71
  * Process response message
96
72
  * @param msg - Message object
97
73
  */
98
-
99
-
100
74
  }
101
-
102
75
  async function _handleMessage2(msg, origin) {
103
76
  if ((msg === null || msg === void 0 ? void 0 : msg.jsonrpc) !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));
104
-
105
77
  if ('result' in msg || 'error' in msg) {
106
78
  _classPrivateMethodGet(this, _processResponse, _processResponse2).call(this, msg);
107
-
108
79
  return;
109
80
  }
110
-
111
81
  const request = msg;
112
82
  let result;
113
83
  let error;
114
-
115
84
  try {
116
85
  if (!(request.method in _classPrivateFieldGet(this, _methods))) throw new RpcMethodNotFoundError();
117
86
  const methodName = request.method;
@@ -119,12 +88,10 @@ async function _handleMessage2(msg, origin) {
119
88
  } catch (e) {
120
89
  error = e instanceof RpcError ? e : new RpcInternalError();
121
90
  }
122
-
123
91
  if (request.id != null) {
124
92
  _classPrivateMethodGet(this, _sendResponse, _sendResponse2).call(this, request.id, request.method, result, error);
125
93
  }
126
94
  }
127
-
128
95
  function _sendRequest2(id, method, params) {
129
96
  this.connection.sendMessage({
130
97
  jsonrpc: '2.0',
@@ -137,33 +104,29 @@ function _sendRequest2(id, method, params) {
137
104
  } : {})
138
105
  });
139
106
  }
140
-
141
- function _sendResponse2(id, method, // TODO: remove as far it is not required in JSON RPC
107
+ function _sendResponse2(id, method,
108
+ // TODO: remove as far it is not required in JSON RPC
142
109
  result, error) {
143
110
  this.connection.sendMessage({
144
111
  jsonrpc: '2.0',
145
112
  id,
146
113
  method,
147
114
  ...(error != null ? {
148
- error
115
+ error: error.toJSON()
149
116
  } : {
150
117
  result
151
118
  })
152
119
  });
153
120
  }
154
-
155
121
  function _processResponse2(_ref) {
156
122
  let {
157
123
  id,
158
124
  error,
159
125
  result
160
126
  } = _ref;
161
-
162
127
  const callbacks = _classPrivateFieldGet(this, _callbacks).get(id);
163
-
164
128
  if (callbacks == null) throw new MissingCallbackError(id);
165
129
  if (error != null) callbacks.reject(RpcError.deserialize(error));else callbacks.resolve(result);
166
-
167
130
  _classPrivateFieldGet(this, _callbacks).delete(id);
168
131
  }
169
132
  //# sourceMappingURL=RpcClient.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"RpcClient.mjs","names":["RpcError","RpcInternalError","RpcMethodNotFoundError","InvalidRpcMessageError","MissingCallbackError","RpcClient","constructor","connection","onDisconnect","methods","Map","connect","bind","request","name","params","Promise","resolve","reject","set","notify","undefined","msg","origin","jsonrpc","JSON","stringify","result","error","method","methodName","e","id","sendMessage","callbacks","get","deserialize","delete"],"sources":["../../../src/aepp-wallet-communication/rpc/RpcClient.ts"],"sourcesContent":["import { RpcError, RpcInternalError, RpcMethodNotFoundError } from '../schema';\nimport BrowserConnection from '../connection/Browser';\nimport { InvalidRpcMessageError, MissingCallbackError } from '../../utils/errors';\n\ninterface JsonRpcRequest {\n jsonrpc: '2.0';\n id: number;\n method: string;\n params?: any;\n}\n\ninterface JsonRpcResponse {\n jsonrpc: '2.0';\n id: number;\n method: string;\n result?: any;\n error?: {\n code: number;\n message: string;\n data?: any;\n };\n}\n\ntype RpcApiHandler = (p?: any) => any | undefined;\ntype RpcApi<Api> = { [k in keyof Api]: RpcApiHandler };\ntype WithOrigin<Api extends RpcApi<Api>> = {\n [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>\n};\n\n/**\n * Contain functionality for using RPC conection\n * @category aepp wallet communication\n * @param connection - Connection object\n * @param onDisconnect - Disconnect callback\n * @param methods - Object containing handlers for each request by name\n */\nexport default class RpcClient <\n RemoteApi extends RpcApi<RemoteApi>, LocalApi extends RpcApi<LocalApi>,\n> {\n connection: BrowserConnection;\n\n #callbacks = new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>();\n\n #messageId = 0;\n\n #methods: WithOrigin<LocalApi>;\n\n constructor(\n connection: BrowserConnection,\n onDisconnect: () => void,\n methods: WithOrigin<LocalApi>,\n ) {\n this.connection = connection;\n this.#methods = methods;\n connection.connect(this.#handleMessage.bind(this), onDisconnect);\n }\n\n async #handleMessage(msg: JsonRpcRequest | JsonRpcResponse, origin: string): Promise<void> {\n if (msg?.jsonrpc !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));\n if ('result' in msg || 'error' in msg) {\n this.#processResponse(msg);\n return;\n }\n\n const request = msg as JsonRpcRequest;\n let result; let\n error;\n try {\n if (!(request.method in this.#methods)) throw new RpcMethodNotFoundError();\n const methodName = request.method as keyof LocalApi;\n result = await this.#methods[methodName](request.params, origin);\n } catch (e) {\n error = e instanceof RpcError ? e : new RpcInternalError();\n }\n if (request.id != null) {\n this.#sendResponse(request.id, request.method as keyof LocalApi, result, error);\n }\n }\n\n #sendRequest(\n id: number | undefined,\n method: keyof RemoteApi | keyof LocalApi,\n params?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n ...id != null ? { id } : {},\n method,\n ...params != null ? { params } : {},\n });\n }\n\n #sendResponse(\n id: number,\n method: keyof RemoteApi | keyof LocalApi, // TODO: remove as far it is not required in JSON RPC\n result?: any,\n error?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n id,\n method,\n ...error != null ? { error } : { result },\n });\n }\n\n /**\n * Make a request\n * @param name - Method name\n * @param params - Method params\n * @returns Promise which will be resolved after receiving response message\n */\n async request<Name extends keyof RemoteApi>(\n name: Name,\n params: Parameters<RemoteApi[Name]>[0],\n ): Promise<ReturnType<RemoteApi[Name]>> {\n this.#sendRequest(this.#messageId += 1, name, params);\n return new Promise((resolve, reject) => {\n this.#callbacks.set(this.#messageId, { resolve, reject });\n });\n }\n\n /**\n * Make a notification\n * @param name - Method name\n * @param params - Method params\n */\n notify<Name extends keyof RemoteApi>(name: Name, params: Parameters<RemoteApi[Name]>[0]): void {\n this.#sendRequest(undefined, name, params);\n }\n\n /**\n * Process response message\n * @param msg - Message object\n */\n #processResponse({ id, error, result }: { id: number; error?: any; result?: any }): void {\n const callbacks = this.#callbacks.get(id);\n if (callbacks == null) throw new MissingCallbackError(id);\n if (error != null) callbacks.reject(RpcError.deserialize(error));\n else callbacks.resolve(result);\n this.#callbacks.delete(id);\n }\n}\n"],"mappings":";;;;;;;;;;;SAASA,Q,EAAUC,gB,EAAkBC,sB;SAE5BC,sB,EAAwBC,oB;;;;;;;;;;;;;;;;AA2BjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,SAAN,CAEb;EASAC,WAAW,CACTC,UADS,EAETC,YAFS,EAGTC,OAHS,EAIT;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;MAAA;MAAA,OAVW,IAAIC,GAAJ;IAUX;;IAAA;MAAA;MAAA,OARW;IAQX;;IAAA;MAAA;MAAA;IAAA;;IACA,KAAKH,UAAL,GAAkBA,UAAlB;;IACA,sCAAgBE,OAAhB;;IACAF,UAAU,CAACI,OAAX,CAAmB,8DAAoBC,IAApB,CAAyB,IAAzB,CAAnB,EAAmDJ,YAAnD;EACD;;EAmDD;AACF;AACA;AACA;AACA;AACA;EACe,MAAPK,OAAO,CACXC,IADW,EAEXC,MAFW,EAG2B;IACtC,2FAAkB,IAAlB,oCAAkB,IAAlB,gBAAqC,CAArC,GAAwCD,IAAxC,EAA8CC,MAA9C;;IACA,OAAO,IAAIC,OAAJ,CAAY,CAACC,OAAD,EAAU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ACN,KAAKR,UAAL,CAAgB0B,WAAhB,CAA4B;IAC1BT,OAAO,EAAE,KADiB;IAE1B,IAAGQ,EAAE,IAAI,IAAN,GAAa;MAAEA;IAAF,CAAb,GAAsB,EAAzB,CAF0B;IAG1BH,MAH0B;IAI1B,IAAGd,MAAM,IAAI,IAAV,GAAiB;MAAEA;IAAF,CAAjB,GAA8B,EAAjC;EAJ0B,CAA5B;AAMD;;wBAGCiB,E,EACAH,M,EAA0C;AAC1CF,M,EACAC,K,EACM;EACN,KAAKrB,UAAL,CAAgB0B,WAAhB,CAA4B;IAC1BT,OAAO,EAAE,KADiB;IAE1BQ,EAF0B;IAG1BH,MAH0B;IAI1B,IAAGD,KAAK,IAAI,IAAT,GAAgB;MAAEA;IAAF,CAAhB,GAA4B;MAAED;IAAF,CAA/B;EAJ0B,CAA5B;AAMD;;iCA+BwF;EAAA,IAAxE;IAAEK,EAAF;IAAMJ,KAAN;IAAaD;EAAb,CAAwE;;EACvF,MAAMO,SAAS,GAAG,wCAAgBC,GAAhB,CAAoBH,EAApB,CAAlB;;EACA,IAAIE,SAAS,IAAI,IAAjB,EAAuB,MAAM,IAAI9B,oBAAJ,CAAyB4B,EAAzB,CAAN;EACvB,IAAIJ,KAAK,IAAI,IAAb,EAAmBM,SAAS,CAAChB,MAAV,CAAiBlB,QAAQ,CAACoC,WAAT,CAAqBR,KAArB,CAAjB,EAAnB,KACKM,SAAS,CAACjB,OAAV,CAAkBU,MAAlB;;EACL,wCAAgBU,MAAhB,CAAuBL,EAAvB;AACD"}
1
+ {"version":3,"file":"RpcClient.mjs","names":["RpcError","RpcInternalError","RpcMethodNotFoundError","InvalidRpcMessageError","MissingCallbackError","RpcClient","constructor","connection","onDisconnect","methods","Map","connect","bind","request","name","params","Promise","resolve","reject","set","notify","undefined","msg","origin","jsonrpc","JSON","stringify","result","error","method","methodName","e","id","sendMessage","toJSON","callbacks","get","deserialize","delete"],"sources":["../../../src/aepp-wallet-communication/rpc/RpcClient.ts"],"sourcesContent":["import { RpcError, RpcInternalError, RpcMethodNotFoundError } from '../schema';\nimport BrowserConnection from '../connection/Browser';\nimport { InvalidRpcMessageError, MissingCallbackError } from '../../utils/errors';\n\ninterface JsonRpcRequest {\n jsonrpc: '2.0';\n id: number;\n method: string;\n params?: any;\n}\n\ninterface JsonRpcResponse {\n jsonrpc: '2.0';\n id: number;\n method: string;\n result?: any;\n error?: {\n code: number;\n message: string;\n data?: any;\n };\n}\n\ntype RpcApiHandler = (p?: any) => any | undefined;\ntype RpcApi<Api> = { [k in keyof Api]: RpcApiHandler };\ntype WithOrigin<Api extends RpcApi<Api>> = {\n [k in keyof Api]: (p: Parameters<Api[k]>[0], origin: string) => ReturnType<Api[k]>\n};\n\n/**\n * Contain functionality for using RPC conection\n * @category aepp wallet communication\n * @param connection - Connection object\n * @param onDisconnect - Disconnect callback\n * @param methods - Object containing handlers for each request by name\n */\nexport default class RpcClient <\n RemoteApi extends RpcApi<RemoteApi>, LocalApi extends RpcApi<LocalApi>,\n> {\n connection: BrowserConnection;\n\n #callbacks = new Map<number, { resolve: (v: any) => void; reject: (e: Error) => void }>();\n\n #messageId = 0;\n\n #methods: WithOrigin<LocalApi>;\n\n constructor(\n connection: BrowserConnection,\n onDisconnect: () => void,\n methods: WithOrigin<LocalApi>,\n ) {\n this.connection = connection;\n this.#methods = methods;\n connection.connect(this.#handleMessage.bind(this), onDisconnect);\n }\n\n async #handleMessage(msg: JsonRpcRequest | JsonRpcResponse, origin: string): Promise<void> {\n if (msg?.jsonrpc !== '2.0') throw new InvalidRpcMessageError(JSON.stringify(msg));\n if ('result' in msg || 'error' in msg) {\n this.#processResponse(msg);\n return;\n }\n\n const request = msg as JsonRpcRequest;\n let result;\n let error;\n try {\n if (!(request.method in this.#methods)) throw new RpcMethodNotFoundError();\n const methodName = request.method as keyof LocalApi;\n result = await this.#methods[methodName](request.params, origin);\n } catch (e) {\n error = e instanceof RpcError ? e : new RpcInternalError();\n }\n if (request.id != null) {\n this.#sendResponse(request.id, request.method as keyof LocalApi, result, error);\n }\n }\n\n #sendRequest(\n id: number | undefined,\n method: keyof RemoteApi | keyof LocalApi,\n params?: any,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n ...id != null ? { id } : {},\n method,\n ...params != null ? { params } : {},\n });\n }\n\n #sendResponse(\n id: number,\n method: keyof RemoteApi | keyof LocalApi, // TODO: remove as far it is not required in JSON RPC\n result?: any,\n error?: RpcError,\n ): void {\n this.connection.sendMessage({\n jsonrpc: '2.0',\n id,\n method,\n ...error != null ? { error: error.toJSON() } : { result },\n });\n }\n\n /**\n * Make a request\n * @param name - Method name\n * @param params - Method params\n * @returns Promise which will be resolved after receiving response message\n */\n async request<Name extends keyof RemoteApi>(\n name: Name,\n params: Parameters<RemoteApi[Name]>[0],\n ): Promise<ReturnType<RemoteApi[Name]>> {\n this.#sendRequest(this.#messageId += 1, name, params);\n return new Promise((resolve, reject) => {\n this.#callbacks.set(this.#messageId, { resolve, reject });\n });\n }\n\n /**\n * Make a notification\n * @param name - Method name\n * @param params - Method params\n */\n notify<Name extends keyof RemoteApi>(name: Name, params: Parameters<RemoteApi[Name]>[0]): void {\n this.#sendRequest(undefined, name, params);\n }\n\n /**\n * Process response message\n * @param msg - Message object\n */\n #processResponse({ id, error, result }: { id: number; error?: any; result?: any }): void {\n const callbacks = this.#callbacks.get(id);\n if (callbacks == null) throw new MissingCallbackError(id);\n if (error != null) callbacks.reject(RpcError.deserialize(error));\n else callbacks.resolve(result);\n this.#callbacks.delete(id);\n }\n}\n"],"mappings":";;;;;;SAASA,QAAQ,EAAEC,gBAAgB,EAAEC,sBAAsB;AAAA,SAElDC,sBAAsB,EAAEC,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,SAAS,CAE5B;EASAC,WAAW,CACTC,UAA6B,EAC7BC,YAAwB,EACxBC,OAA6B,EAC7B;IAAA;IAAA;IAAA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I,cAAYC,GAAG,CAACJ,EAAE,CAAC;EACzC,IAAIG,SAAS,IAAI,IAAI,EAAE,MAAM,IAAI/B,oBAAoB,CAAC4B,EAAE,CAAC;EACzD,IAAIJ,KAAK,IAAI,IAAI,EAAEO,SAAS,CAACjB,MAAM,CAAClB,QAAQ,CAACqC,WAAW,CAACT,KAAK,CAAC,CAAC,CAAC,KAC5DO,SAAS,CAAClB,OAAO,CAACU,MAAM,CAAC;EAC9B,0BAAI,cAAYW,MAAM,CAACN,EAAE,CAAC;AAC5B"}
@@ -24,7 +24,7 @@ export interface Network {
24
24
  networkId: string;
25
25
  node?: Node;
26
26
  }
27
- declare type Icons = Array<{
27
+ type Icons = Array<{
28
28
  src: string;
29
29
  sizes?: string;
30
30
  type?: string;
@@ -53,6 +53,12 @@ export interface WalletApi {
53
53
  tx: Encoded.Transaction;
54
54
  onAccount: Encoded.AccountAddress;
55
55
  returnSigned: boolean;
56
+ /**
57
+ * @deprecated Wallet provided networkId will be used (current network)
58
+ * required to maintain backward compatibility with wallets using SDK v11.0.1 and below
59
+ * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}
60
+ */
61
+ networkId: string;
56
62
  }) => Promise<{
57
63
  /**
58
64
  * @deprecated this is not a hash at all, will be removed later at the same time
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":["METHODS","RPC_VERSION"],"sources":["../../../src/aepp-wallet-communication/rpc/types.ts"],"sourcesContent":["import { send } from '../../spend';\nimport { Encoded } from '../../utils/encoder';\nimport { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';\n\nexport interface WalletInfo {\n id: string;\n name: string;\n networkId: string;\n origin: string;\n type: WALLET_TYPE;\n}\n\nexport interface Accounts {\n connected: { [pub: Encoded.AccountAddress]: {} };\n current: { [pub: Encoded.AccountAddress]: {} };\n}\n\nexport interface Node {\n name: string;\n url: string;\n}\n\nexport interface Network {\n networkId: string;\n node?: Node;\n}\n\ntype Icons = Array<{ src: string; sizes?: string; type?: string; purpose?: string }>;\n\nexport const RPC_VERSION = 1;\n\nexport interface WalletApi {\n [METHODS.connect]: (\n p: { name: string; icons?: Icons; version: typeof RPC_VERSION; connectNode: boolean }\n ) => Promise<WalletInfo & { node?: Node }>;\n\n [METHODS.closeConnection]: (p: any) => void;\n\n [METHODS.subscribeAddress]: (\n p: { type: SUBSCRIPTION_TYPES; value: 'connected' | 'current' }\n ) => Promise<{ subscription: Array<'connected' | 'current'>; address: Accounts }>;\n\n [METHODS.address]: () => Promise<Encoded.AccountAddress[]>;\n\n [METHODS.sign]: ((\n p: { tx: Encoded.Transaction; onAccount: Encoded.AccountAddress; returnSigned: boolean }\n ) => Promise<{\n /**\n * @deprecated this is not a hash at all, will be removed later at the same time\n * as dropping ability to broadcast transaction by wallet\n */\n transactionHash?: Awaited<ReturnType<typeof send>>;\n signedTransaction?: Encoded.Transaction;\n }>);\n\n [METHODS.signMessage]: (\n p: { message: string; onAccount: Encoded.AccountAddress }\n ) => Promise<{ signature: string }>;\n}\n\nexport interface AeppApi {\n [METHODS.updateAddress]: (a: Accounts) => void;\n [METHODS.updateNetwork]: (a: Network) => void;\n [METHODS.readyToConnect]: (w: WalletInfo) => void;\n [METHODS.closeConnection]: (p: any) => void;\n}\n"],"mappings":"SAESA,O;AA2BT,OAAO,MAAMC,WAAW,GAAG,CAApB"}
1
+ {"version":3,"file":"types.mjs","names":["METHODS","RPC_VERSION"],"sources":["../../../src/aepp-wallet-communication/rpc/types.ts"],"sourcesContent":["import { send } from '../../spend';\nimport { Encoded } from '../../utils/encoder';\nimport { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';\n\nexport interface WalletInfo {\n id: string;\n name: string;\n networkId: string;\n origin: string;\n type: WALLET_TYPE;\n}\n\nexport interface Accounts {\n connected: { [pub: Encoded.AccountAddress]: {} };\n current: { [pub: Encoded.AccountAddress]: {} };\n}\n\nexport interface Node {\n name: string;\n url: string;\n}\n\nexport interface Network {\n networkId: string;\n node?: Node;\n}\n\ntype Icons = Array<{ src: string; sizes?: string; type?: string; purpose?: string }>;\n\nexport const RPC_VERSION = 1;\n\nexport interface WalletApi {\n [METHODS.connect]: (\n p: { name: string; icons?: Icons; version: typeof RPC_VERSION; connectNode: boolean }\n ) => Promise<WalletInfo & { node?: Node }>;\n\n [METHODS.closeConnection]: (p: any) => void;\n\n [METHODS.subscribeAddress]: (\n p: { type: SUBSCRIPTION_TYPES; value: 'connected' | 'current' }\n ) => Promise<{ subscription: Array<'connected' | 'current'>; address: Accounts }>;\n\n [METHODS.address]: () => Promise<Encoded.AccountAddress[]>;\n\n [METHODS.sign]: ((\n p: {\n tx: Encoded.Transaction;\n onAccount: Encoded.AccountAddress;\n returnSigned: boolean;\n /**\n * @deprecated Wallet provided networkId will be used (current network)\n * required to maintain backward compatibility with wallets using SDK v11.0.1 and below\n * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}\n */\n networkId: string;\n }\n ) => Promise<{\n /**\n * @deprecated this is not a hash at all, will be removed later at the same time\n * as dropping ability to broadcast transaction by wallet\n */\n transactionHash?: Awaited<ReturnType<typeof send>>;\n signedTransaction?: Encoded.Transaction;\n }>);\n\n [METHODS.signMessage]: (\n p: { message: string; onAccount: Encoded.AccountAddress }\n ) => Promise<{ signature: string }>;\n}\n\nexport interface AeppApi {\n [METHODS.updateAddress]: (a: Accounts) => void;\n [METHODS.updateNetwork]: (a: Network) => void;\n [METHODS.readyToConnect]: (w: WalletInfo) => void;\n [METHODS.closeConnection]: (p: any) => void;\n}\n"],"mappings":"SAESA,OAAO;AA2BhB,OAAO,MAAMC,WAAW,GAAG,CAAC"}