@aeternity/aepp-sdk 13.0.1 → 13.2.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 (322) hide show
  1. package/README.md +4 -2
  2. package/bin/aesophia_cli +0 -0
  3. package/dist/aepp-sdk.browser-script.js +1 -1
  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 +28490 -17706
  8. package/dist/aepp-sdk.js.map +1 -1
  9. package/es/AeSdkAepp.mjs.map +1 -1
  10. package/es/AeSdkBase.d.ts +21 -3
  11. package/es/AeSdkBase.mjs +51 -3
  12. package/es/AeSdkBase.mjs.map +1 -1
  13. package/es/AeSdkMethods.d.ts +9 -14
  14. package/es/AeSdkMethods.mjs +20 -49
  15. package/es/AeSdkMethods.mjs.map +1 -1
  16. package/es/AeSdkWallet.d.ts +1 -1
  17. package/es/AeSdkWallet.mjs +79 -23
  18. package/es/AeSdkWallet.mjs.map +1 -1
  19. package/es/Middleware.d.ts +38 -0
  20. package/es/Middleware.mjs +90 -0
  21. package/es/Middleware.mjs.map +1 -0
  22. package/es/MiddlewareSubscriber.d.ts +30 -0
  23. package/es/MiddlewareSubscriber.mjs +198 -0
  24. package/es/MiddlewareSubscriber.mjs.map +1 -0
  25. package/es/Node.d.ts +1 -1
  26. package/es/Node.mjs.map +1 -1
  27. package/es/account/Base.d.ts +57 -3
  28. package/es/account/Base.mjs +95 -1
  29. package/es/account/Base.mjs.map +1 -1
  30. package/es/account/Generalized.d.ts +4 -0
  31. package/es/account/Generalized.mjs +20 -0
  32. package/es/account/Generalized.mjs.map +1 -1
  33. package/es/account/Ledger.d.ts +4 -0
  34. package/es/account/Ledger.mjs +20 -0
  35. package/es/account/Ledger.mjs.map +1 -1
  36. package/es/account/LedgerFactory.mjs.map +1 -1
  37. package/es/account/Memory.d.ts +12 -0
  38. package/es/account/Memory.mjs +52 -0
  39. package/es/account/Memory.mjs.map +1 -1
  40. package/es/account/Rpc.d.ts +5 -6
  41. package/es/account/Rpc.mjs +53 -10
  42. package/es/account/Rpc.mjs.map +1 -1
  43. package/es/aens.d.ts +1 -1
  44. package/es/aens.mjs +1 -1
  45. package/es/aens.mjs.map +1 -1
  46. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  47. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  48. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/connection-proxy.mjs.map +1 -1
  50. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -2
  51. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/rpc/types.d.ts +19 -0
  53. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  54. package/es/aepp-wallet-communication/schema.d.ts +2 -8
  55. package/es/aepp-wallet-communication/schema.mjs +21 -33
  56. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  57. package/es/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  58. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  59. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  60. package/es/apis/compiler/compiler.mjs +15 -1
  61. package/es/apis/compiler/compiler.mjs.map +1 -1
  62. package/es/apis/compiler/models/index.d.ts +1 -7
  63. package/es/apis/compiler/models/index.mjs.map +1 -1
  64. package/es/apis/compiler/models/mappers.d.ts +0 -1
  65. package/es/apis/compiler/models/mappers.mjs +0 -43
  66. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  67. package/es/apis/middleware/index.d.ts +2 -0
  68. package/es/apis/middleware/index.mjs +3 -0
  69. package/es/apis/middleware/index.mjs.map +1 -0
  70. package/es/apis/middleware/middleware.d.ts +309 -0
  71. package/es/apis/middleware/middleware.mjs +1527 -0
  72. package/es/apis/middleware/middleware.mjs.map +1 -0
  73. package/es/apis/middleware/models/index.d.ts +1496 -0
  74. package/es/apis/middleware/models/index.mjs +580 -0
  75. package/es/apis/middleware/models/index.mjs.map +1 -0
  76. package/es/apis/middleware/models/mappers.d.ts +102 -0
  77. package/es/apis/middleware/models/mappers.mjs +3334 -0
  78. package/es/apis/middleware/models/mappers.mjs.map +1 -0
  79. package/es/apis/middleware/models/parameters.d.ts +43 -0
  80. package/es/apis/middleware/models/parameters.mjs +417 -0
  81. package/es/apis/middleware/models/parameters.mjs.map +1 -0
  82. package/es/apis/node/node.mjs.map +1 -1
  83. package/es/chain.d.ts +2 -1
  84. package/es/chain.mjs +5 -3
  85. package/es/chain.mjs.map +1 -1
  86. package/es/channel/Base.d.ts +1 -1
  87. package/es/channel/Base.mjs +1 -4
  88. package/es/channel/Base.mjs.map +1 -1
  89. package/es/channel/Contract.mjs.map +1 -1
  90. package/es/channel/Spend.mjs.map +1 -1
  91. package/es/channel/handlers.mjs +2 -2
  92. package/es/channel/handlers.mjs.map +1 -1
  93. package/es/channel/internal.mjs +7 -5
  94. package/es/channel/internal.mjs.map +1 -1
  95. package/es/contract/Contract.mjs +2 -2
  96. package/es/contract/Contract.mjs.map +1 -1
  97. package/es/contract/compiler/Base.d.ts +21 -0
  98. package/es/contract/compiler/Base.mjs.map +1 -1
  99. package/es/contract/compiler/Cli.d.ts +2 -0
  100. package/es/contract/compiler/Cli.mjs +24 -3
  101. package/es/contract/compiler/Cli.mjs.map +1 -1
  102. package/es/contract/compiler/Http.d.ts +2 -0
  103. package/es/contract/compiler/Http.mjs +22 -2
  104. package/es/contract/compiler/Http.mjs.map +1 -1
  105. package/es/contract/compiler/HttpNode.d.ts +1 -0
  106. package/es/contract/compiler/HttpNode.mjs +5 -0
  107. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  108. package/es/contract/delegation-signature.d.ts +2 -1
  109. package/es/contract/delegation-signature.mjs +39 -8
  110. package/es/contract/delegation-signature.mjs.map +1 -1
  111. package/es/contract/ga.mjs.map +1 -1
  112. package/es/deprecated.d.ts +14 -0
  113. package/es/deprecated.mjs +22 -0
  114. package/es/deprecated.mjs.map +1 -0
  115. package/es/index-browser.d.ts +20 -14
  116. package/es/index-browser.mjs +19 -15
  117. package/es/index-browser.mjs.map +1 -1
  118. package/es/oracle.mjs.map +1 -1
  119. package/es/spend.d.ts +2 -1
  120. package/es/spend.mjs +4 -2
  121. package/es/spend.mjs.map +1 -1
  122. package/es/tx/builder/constants.d.ts +0 -1
  123. package/es/tx/builder/constants.mjs +26 -24
  124. package/es/tx/builder/constants.mjs.map +1 -1
  125. package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
  126. package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
  127. package/es/tx/builder/field-types/coin-amount.mjs +2 -1
  128. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  129. package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
  130. package/es/tx/builder/field-types/deposit.d.ts +1 -1
  131. package/es/tx/builder/field-types/deposit.mjs.map +1 -1
  132. package/es/tx/builder/field-types/entry.mjs +2 -1
  133. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  134. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  135. package/es/tx/builder/field-types/field.mjs.map +1 -1
  136. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  137. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  138. package/es/tx/builder/field-types/index.d.ts +28 -150
  139. package/es/tx/builder/field-types/index.mjs +28 -56
  140. package/es/tx/builder/field-types/index.mjs.map +1 -1
  141. package/es/tx/builder/field-types/map.mjs.map +1 -1
  142. package/es/tx/builder/field-types/mptree.mjs +3 -3
  143. package/es/tx/builder/field-types/mptree.mjs.map +1 -1
  144. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  145. package/es/tx/builder/field-types/pointers.mjs.map +1 -1
  146. package/es/tx/builder/field-types/string.mjs.map +1 -1
  147. package/es/tx/builder/field-types/ttl.mjs.map +1 -1
  148. package/es/tx/builder/field-types/u-int.mjs +1 -1
  149. package/es/tx/builder/field-types/u-int.mjs.map +1 -1
  150. package/es/tx/builder/helpers.d.ts +8 -1
  151. package/es/tx/builder/helpers.mjs +53 -9
  152. package/es/tx/builder/helpers.mjs.map +1 -1
  153. package/es/tx/builder/index.d.ts +4 -2
  154. package/es/tx/builder/index.mjs +0 -1
  155. package/es/tx/builder/index.mjs.map +1 -1
  156. package/es/tx/builder/schema.d.ts +9 -9
  157. package/es/tx/builder/schema.mjs +11 -10
  158. package/es/tx/builder/schema.mjs.map +1 -1
  159. package/es/tx/execution-cost.mjs.map +1 -1
  160. package/es/tx/transaction-signer.mjs.map +1 -1
  161. package/es/tx/validator.mjs +6 -3
  162. package/es/tx/validator.mjs.map +1 -1
  163. package/es/utils/amount-formatter.mjs +7 -7
  164. package/es/utils/amount-formatter.mjs.map +1 -1
  165. package/es/utils/autorest.mjs +6 -8
  166. package/es/utils/autorest.mjs.map +1 -1
  167. package/es/utils/bignumber.mjs.map +1 -1
  168. package/es/utils/bytes.mjs.map +1 -1
  169. package/es/utils/crypto.d.ts +1 -0
  170. package/es/utils/crypto.mjs +12 -2
  171. package/es/utils/crypto.mjs.map +1 -1
  172. package/es/utils/encoder-types.mjs +3 -3
  173. package/es/utils/encoder-types.mjs.map +1 -1
  174. package/es/utils/encoder.mjs.map +1 -1
  175. package/es/utils/errors.d.ts +2 -2
  176. package/es/utils/errors.mjs.map +1 -1
  177. package/es/utils/hd-wallet.mjs.map +1 -1
  178. package/es/utils/keystore.mjs.map +1 -1
  179. package/es/utils/other.d.ts +1 -0
  180. package/es/utils/other.mjs +5 -0
  181. package/es/utils/other.mjs.map +1 -1
  182. package/es/utils/semver-satisfies.mjs.map +1 -1
  183. package/es/utils/string.mjs.map +1 -1
  184. package/es/utils/typed-data.d.ts +45 -0
  185. package/es/utils/typed-data.mjs +70 -0
  186. package/es/utils/typed-data.mjs.map +1 -0
  187. package/package.json +56 -37
  188. package/src/AeSdkBase.ts +66 -5
  189. package/src/AeSdkMethods.ts +31 -50
  190. package/src/AeSdkWallet.ts +63 -17
  191. package/src/Middleware.ts +141 -0
  192. package/src/MiddlewareSubscriber.ts +207 -0
  193. package/src/Node.ts +1 -1
  194. package/src/account/Base.ts +102 -4
  195. package/src/account/Generalized.ts +20 -0
  196. package/src/account/Ledger.ts +20 -0
  197. package/src/account/Memory.ts +68 -1
  198. package/src/account/Rpc.ts +54 -7
  199. package/src/aens.ts +1 -1
  200. package/src/aepp-wallet-communication/rpc/RpcClient.ts +11 -3
  201. package/src/aepp-wallet-communication/rpc/types.ts +21 -0
  202. package/src/aepp-wallet-communication/schema.ts +3 -17
  203. package/src/aepp-wallet-communication/wallet-detector.ts +1 -2
  204. package/src/apis/compiler/compiler.ts +8 -1
  205. package/src/apis/compiler/models/index.ts +1 -8
  206. package/src/apis/compiler/models/mappers.ts +0 -36
  207. package/src/apis/middleware/index.ts +2 -0
  208. package/src/apis/middleware/middleware.ts +1807 -0
  209. package/src/apis/middleware/models/index.ts +1747 -0
  210. package/src/apis/middleware/models/mappers.ts +3370 -0
  211. package/src/apis/middleware/models/parameters.ts +463 -0
  212. package/src/chain.ts +4 -3
  213. package/src/channel/Base.ts +5 -5
  214. package/src/channel/internal.ts +2 -0
  215. package/src/contract/Contract.ts +2 -1
  216. package/src/contract/compiler/Base.ts +26 -0
  217. package/src/contract/compiler/Cli.ts +27 -3
  218. package/src/contract/compiler/Http.ts +21 -2
  219. package/src/contract/compiler/HttpNode.ts +6 -0
  220. package/src/contract/delegation-signature.ts +37 -11
  221. package/src/deprecated.ts +23 -0
  222. package/src/index-browser.ts +77 -15
  223. package/src/spend.ts +2 -2
  224. package/src/tx/builder/constants.ts +0 -1
  225. package/src/tx/builder/field-types/coin-amount.ts +2 -1
  226. package/src/tx/builder/field-types/entry.ts +1 -1
  227. package/src/tx/builder/field-types/index.ts +28 -58
  228. package/src/tx/builder/field-types/u-int.ts +1 -1
  229. package/src/tx/builder/helpers.ts +54 -9
  230. package/src/tx/builder/index.ts +6 -9
  231. package/src/tx/validator.ts +4 -2
  232. package/src/utils/autorest.ts +5 -10
  233. package/src/utils/crypto.ts +12 -2
  234. package/src/utils/errors.ts +2 -2
  235. package/src/utils/other.ts +5 -0
  236. package/src/utils/typed-data.ts +95 -0
  237. package/types-legacy/ts4.2/AeSdkBase.d.ts +21 -3
  238. package/types-legacy/ts4.2/AeSdkMethods.d.ts +9 -14
  239. package/types-legacy/ts4.2/AeSdkWallet.d.ts +1 -1
  240. package/types-legacy/ts4.2/Middleware.d.ts +46 -0
  241. package/types-legacy/ts4.2/MiddlewareSubscriber.d.ts +30 -0
  242. package/types-legacy/ts4.2/Node.d.ts +1 -1
  243. package/types-legacy/ts4.2/account/Base.d.ts +57 -3
  244. package/types-legacy/ts4.2/account/Generalized.d.ts +4 -0
  245. package/types-legacy/ts4.2/account/Ledger.d.ts +4 -0
  246. package/types-legacy/ts4.2/account/Memory.d.ts +12 -0
  247. package/types-legacy/ts4.2/account/Rpc.d.ts +5 -6
  248. package/types-legacy/ts4.2/aens.d.ts +1 -1
  249. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +19 -0
  250. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -8
  251. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  252. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -7
  253. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +0 -1
  254. package/types-legacy/ts4.2/apis/middleware/index.d.ts +2 -0
  255. package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +309 -0
  256. package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +1496 -0
  257. package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +102 -0
  258. package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +43 -0
  259. package/types-legacy/ts4.2/chain.d.ts +2 -1
  260. package/types-legacy/ts4.2/channel/Base.d.ts +1 -1
  261. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +21 -0
  262. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +2 -0
  263. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +2 -0
  264. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +1 -0
  265. package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
  266. package/types-legacy/ts4.2/deprecated.d.ts +14 -0
  267. package/types-legacy/ts4.2/index-browser.d.ts +20 -14
  268. package/types-legacy/ts4.2/spend.d.ts +2 -1
  269. package/types-legacy/ts4.2/tx/builder/constants.d.ts +0 -1
  270. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
  271. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
  272. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +28 -153
  273. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +8 -1
  274. package/types-legacy/ts4.2/tx/builder/index.d.ts +4 -2
  275. package/types-legacy/ts4.2/tx/builder/schema.d.ts +9 -9
  276. package/types-legacy/ts4.2/utils/crypto.d.ts +1 -0
  277. package/types-legacy/ts4.2/utils/errors.d.ts +2 -2
  278. package/types-legacy/ts4.2/utils/other.d.ts +1 -0
  279. package/types-legacy/ts4.2/utils/typed-data.d.ts +60 -0
  280. package/types-legacy/ts4.5/AeSdkBase.d.ts +21 -3
  281. package/types-legacy/ts4.5/AeSdkMethods.d.ts +9 -14
  282. package/types-legacy/ts4.5/AeSdkWallet.d.ts +1 -1
  283. package/types-legacy/ts4.5/Middleware.d.ts +46 -0
  284. package/types-legacy/ts4.5/MiddlewareSubscriber.d.ts +30 -0
  285. package/types-legacy/ts4.5/Node.d.ts +1 -1
  286. package/types-legacy/ts4.5/account/Base.d.ts +57 -3
  287. package/types-legacy/ts4.5/account/Generalized.d.ts +4 -0
  288. package/types-legacy/ts4.5/account/Ledger.d.ts +4 -0
  289. package/types-legacy/ts4.5/account/Memory.d.ts +12 -0
  290. package/types-legacy/ts4.5/account/Rpc.d.ts +5 -6
  291. package/types-legacy/ts4.5/aens.d.ts +1 -1
  292. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +19 -0
  293. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -8
  294. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  295. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -7
  296. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +0 -1
  297. package/types-legacy/ts4.5/apis/middleware/index.d.ts +2 -0
  298. package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +309 -0
  299. package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +1496 -0
  300. package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +102 -0
  301. package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +43 -0
  302. package/types-legacy/ts4.5/chain.d.ts +2 -1
  303. package/types-legacy/ts4.5/channel/Base.d.ts +1 -1
  304. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +21 -0
  305. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +2 -0
  306. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +2 -0
  307. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +1 -0
  308. package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
  309. package/types-legacy/ts4.5/deprecated.d.ts +14 -0
  310. package/types-legacy/ts4.5/index-browser.d.ts +20 -14
  311. package/types-legacy/ts4.5/spend.d.ts +2 -1
  312. package/types-legacy/ts4.5/tx/builder/constants.d.ts +0 -1
  313. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
  314. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
  315. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +28 -153
  316. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +8 -1
  317. package/types-legacy/ts4.5/tx/builder/index.d.ts +4 -2
  318. package/types-legacy/ts4.5/tx/builder/schema.d.ts +9 -9
  319. package/types-legacy/ts4.5/utils/crypto.d.ts +1 -0
  320. package/types-legacy/ts4.5/utils/errors.d.ts +2 -2
  321. package/types-legacy/ts4.5/utils/other.d.ts +1 -0
  322. package/types-legacy/ts4.5/utils/typed-data.d.ts +60 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeternity/aepp-sdk",
3
- "version": "13.0.1",
3
+ "version": "13.2.0",
4
4
  "description": "SDK for the æternity blockchain",
5
5
  "main": "dist/aepp-sdk.js",
6
6
  "types": "es/index.d.ts",
@@ -8,11 +8,17 @@
8
8
  "<4.5": {
9
9
  "es/index.d.ts": [
10
10
  "./types-legacy/ts4.2/index.d.ts"
11
+ ],
12
+ "es/index-browser.d.ts": [
13
+ "./types-legacy/ts4.2/index-browser.d.ts"
11
14
  ]
12
15
  },
13
16
  "<4.7": {
14
17
  "es/index.d.ts": [
15
18
  "./types-legacy/ts4.5/index.d.ts"
19
+ ],
20
+ "es/index-browser.d.ts": [
21
+ "./types-legacy/ts4.5/index-browser.d.ts"
16
22
  ]
17
23
  }
18
24
  },
@@ -23,9 +29,15 @@
23
29
  },
24
30
  "exports": {
25
31
  "node": {
32
+ "types@<4.5": "./types-legacy/ts4.2/index.d.ts",
33
+ "types@<4.7": "./types-legacy/ts4.5/index.d.ts",
34
+ "types": "./es/index.d.ts",
26
35
  "import": "./es/index.mjs",
27
36
  "default": "./dist/aepp-sdk.js"
28
37
  },
38
+ "types@<4.5": "./types-legacy/ts4.2/index-browser.d.ts",
39
+ "types@<4.7": "./types-legacy/ts4.5/index-browser.d.ts",
40
+ "types": "./es/index-browser.d.ts",
29
41
  "import": "./es/index-browser.mjs",
30
42
  "default": "./dist/aepp-sdk.browser.js"
31
43
  },
@@ -34,7 +46,10 @@
34
46
  "build:assets": "node tooling/fetch-aesophia-cli.mjs",
35
47
  "build:types": "tsc && node tooling/downlevel/run.mjs",
36
48
  "build:es": "babel src --config-file ./babel.esm.config.js --out-dir es --extensions .js,.ts --out-file-extension .mjs --source-maps true",
37
- "build:api": "node tooling/autorest/compiler-prepare.mjs && autorest tooling/autorest/compiler.yaml && autorest tooling/autorest/node.yaml",
49
+ "build:api:node": "autorest tooling/autorest/node.yaml",
50
+ "build:api:compiler": "node tooling/autorest/compiler-prepare.mjs && autorest tooling/autorest/compiler.yaml",
51
+ "build:api:middleware": "node tooling/autorest/middleware-prepare.mjs && autorest tooling/autorest/middleware.yaml",
52
+ "build:api": "npm run build:api:node && npm run build:api:compiler && npm run build:api:middleware",
38
53
  "build:generate": "ts-node --transpileOnly tooling/generate-schema.ts",
39
54
  "build": "npm run build:api && npm run build:generate && webpack && npm run build:types && npm run build:es && npm run build:assets",
40
55
  "docs:examples": "node tooling/docs/examples-to-md.js examples/node/*.mjs",
@@ -47,7 +62,7 @@
47
62
  "test:unit": "mocha './test/unit/'",
48
63
  "test:watch": "mocha './test/unit/' './test/integration/' --watch",
49
64
  "prepare": "npm run build",
50
- "prepublishOnly": "test/examples.sh && npm run docs:examples && npm run docs:api",
65
+ "prepublishOnly": "test/examples.sh",
51
66
  "release": "standard-version --skip.tag --infile docs/CHANGELOG.md",
52
67
  "release-alpha": "npm run release -- --prerelease alpha",
53
68
  "release-beta": "npm run release -- --prerelease beta"
@@ -64,23 +79,26 @@
64
79
  "@aeternity/argon2": "^0.0.1",
65
80
  "@aeternity/uuid": "^0.0.1",
66
81
  "@azure/core-client": "1.6.0",
67
- "@azure/core-rest-pipeline": "^1.10.1",
68
- "@babel/runtime-corejs3": "^7.21.0",
69
- "@ledgerhq/hw-transport": "^6.28.1",
82
+ "@azure/core-rest-pipeline": "^1.11.0",
83
+ "@babel/runtime-corejs3": "^7.22.6",
84
+ "@ledgerhq/hw-transport": "^6.28.6",
70
85
  "@types/aes-js": "^3.1.1",
71
86
  "@types/json-bigint": "^1.0.1",
72
87
  "@types/node": "~18.11.9",
73
- "@types/sha.js": "^2.4.0",
74
- "@types/uuid": "^9.0.1",
75
- "@types/webextension-polyfill": "^0.10.0",
88
+ "@types/sha.js": "^2.4.1",
89
+ "@types/uuid": "^9.0.2",
90
+ "@types/webextension-polyfill": "^0.10.1",
76
91
  "@types/websocket": "^1.0.5",
92
+ "@types/ws": "^8.5.5",
77
93
  "aes-js": "^3.1.2",
78
94
  "bignumber.js": "^9.1.1",
79
95
  "bip32-path": "^0.4.2",
80
96
  "blakejs": "^1.2.1",
81
97
  "bs58": "^5.0.0",
82
98
  "buffer": "^6.0.3",
99
+ "canonicalize": "^2.0.0",
83
100
  "events": "^3.3.0",
101
+ "isomorphic-ws": "^5.0.0",
84
102
  "json-bigint": "^1.0.0",
85
103
  "process": "^0.11.10",
86
104
  "rlp": "^3.0.0",
@@ -88,34 +106,35 @@
88
106
  "tweetnacl": "^1.0.3",
89
107
  "tweetnacl-auth": "^1.0.1",
90
108
  "varuint-bitcoin": "^1.1.2",
91
- "websocket": "^1.0.34"
109
+ "websocket": "^1.0.34",
110
+ "ws": "^8.13.0"
92
111
  },
93
112
  "repository": {
94
113
  "type": "git",
95
114
  "url": "https://github.com/aeternity/aepp-sdk-js"
96
115
  },
97
116
  "devDependencies": {
98
- "@babel/cli": "^7.21.0",
99
- "@babel/core": "^7.21.0",
100
- "@babel/node": "^7.20.7",
101
- "@babel/plugin-transform-runtime": "^7.21.0",
102
- "@babel/preset-env": "^7.20.2",
103
- "@babel/preset-typescript": "^7.21.0",
104
- "@babel/register": "^7.21.0",
105
- "@commitlint/cli": "^17.4.4",
106
- "@commitlint/config-conventional": "^17.4.4",
107
- "@ledgerhq/hw-transport-mocker": "^6.27.12",
108
- "@ledgerhq/hw-transport-node-hid-singleton": "^6.28.9",
109
- "@ledgerhq/hw-transport-webusb": "^6.27.12",
110
- "@types/chai": "^4.3.4",
117
+ "@babel/cli": "^7.22.9",
118
+ "@babel/core": "^7.22.9",
119
+ "@babel/node": "^7.22.6",
120
+ "@babel/plugin-transform-runtime": "^7.22.9",
121
+ "@babel/preset-env": "^7.22.9",
122
+ "@babel/preset-typescript": "^7.22.5",
123
+ "@babel/register": "^7.22.5",
124
+ "@commitlint/cli": "^17.6.7",
125
+ "@commitlint/config-conventional": "^17.6.7",
126
+ "@ledgerhq/hw-transport-mocker": "^6.27.17",
127
+ "@ledgerhq/hw-transport-node-hid-singleton": "^6.28.16",
128
+ "@ledgerhq/hw-transport-webusb": "^6.27.17",
129
+ "@types/chai": "^4.3.5",
111
130
  "@types/chai-as-promised": "^7.1.5",
112
131
  "@types/mocha": "^10.0.1",
113
132
  "@types/node-hid": "^1.3.1",
114
- "@types/sinon": "^10.0.13",
115
- "@typescript-eslint/eslint-plugin": "^5.54.0",
116
- "@typescript-eslint/parser": "^5.54.0",
133
+ "@types/sinon": "^10.0.15",
134
+ "@typescript-eslint/eslint-plugin": "^6.2.0",
135
+ "@typescript-eslint/parser": "^6.2.0",
117
136
  "autorest": "^3.6.3",
118
- "babel-loader": "^9.1.2",
137
+ "babel-loader": "^9.1.3",
119
138
  "babel-plugin-add-import-extension": "^1.6.0",
120
139
  "babel-plugin-import-globals": "^2.0.0",
121
140
  "babel-plugin-transform-default-named-imports": "^1.2.2",
@@ -123,24 +142,24 @@
123
142
  "chai": "^4.3.7",
124
143
  "chai-as-promised": "^7.1.1",
125
144
  "downlevel-dts": "github:aeternity/downlevel-dts",
126
- "eslint": "^8.35.0",
145
+ "eslint": "^8.45.0",
127
146
  "eslint-config-airbnb-base": "^15.0.0",
128
- "eslint-config-airbnb-typescript": "^17.0.0",
147
+ "eslint-config-airbnb-typescript": "^17.1.0",
129
148
  "eslint-plugin-rulesdir": "^0.2.2",
130
149
  "eslint-plugin-tsdoc": "^0.2.17",
131
- "html-webpack-plugin": "^5.5.0",
150
+ "html-webpack-plugin": "^5.5.3",
132
151
  "mocha": "^10.2.0",
133
152
  "nyc": "^15.1.0",
134
- "sinon": "^15.0.1",
153
+ "sinon": "^15.2.0",
135
154
  "source-map": "^0.7.4",
136
155
  "standard-version": "^9.5.0",
137
156
  "ts-node": "^10.9.1",
138
- "typedoc": "^0.23.26",
139
- "typedoc-plugin-missing-exports": "^1.0.0",
140
- "typescript": "^4.9.5",
141
- "webpack": "^5.75.0",
142
- "webpack-bundle-analyzer": "^4.8.0",
143
- "webpack-cli": "^5.0.1"
157
+ "typedoc": "^0.24.8",
158
+ "typedoc-plugin-missing-exports": "^2.0.0",
159
+ "typescript": "^5.1.6",
160
+ "webpack": "^5.88.2",
161
+ "webpack-bundle-analyzer": "^4.9.0",
162
+ "webpack-cli": "^5.1.4"
144
163
  },
145
164
  "files": [
146
165
  "dist",
package/src/AeSdkBase.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  import Node from './Node';
2
2
  import AccountBase from './account/Base';
3
- import { CompilerError, DuplicateNodeError, NodeNotFoundError } from './utils/errors';
3
+ import {
4
+ CompilerError, DuplicateNodeError, NodeNotFoundError, NotImplementedError, TypeError,
5
+ } from './utils/errors';
4
6
  import { Encoded } from './utils/encoder';
5
7
  import CompilerBase from './contract/compiler/Base';
6
- import AeSdkMethods, { OnAccount, getValueOrErrorProxy } from './AeSdkMethods';
8
+ import AeSdkMethods, { OnAccount, getValueOrErrorProxy, AeSdkMethodsOptions } from './AeSdkMethods';
9
+ import { AensName } from './tx/builder/constants';
7
10
 
8
11
  type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & { name: string };
9
12
 
@@ -23,7 +26,7 @@ export default class AeSdkBase extends AeSdkMethods {
23
26
  * @param options.nodes - Array of nodes
24
27
  */
25
28
  constructor(
26
- { nodes = [], ...options }: ConstructorParameters<typeof AeSdkMethods>[0] & {
29
+ { nodes = [], ...options }: AeSdkMethodsOptions & {
27
30
  nodes?: Array<{ name: string; instance: Node }>;
28
31
  } = {},
29
32
  ) {
@@ -127,6 +130,19 @@ export default class AeSdkBase extends AeSdkMethods {
127
130
  return [];
128
131
  }
129
132
 
133
+ /**
134
+ * Resolves an account
135
+ * @param account - ak-address, instance of AccountBase, or keypair
136
+ */
137
+ _resolveAccount(account: OnAccount = this._options.onAccount): AccountBase {
138
+ if (typeof account === 'string') throw new NotImplementedError('Address in AccountResolver');
139
+ if (typeof account === 'object') return account;
140
+ throw new TypeError(
141
+ 'Account should be an address (ak-prefixed string), '
142
+ + `or instance of AccountBase, got ${String(account)} instead`,
143
+ );
144
+ }
145
+
130
146
  get address(): Encoded.AccountAddress {
131
147
  return this._resolveAccount().address;
132
148
  }
@@ -153,15 +169,60 @@ export default class AeSdkBase extends AeSdkMethods {
153
169
  return this._resolveAccount(onAccount).signMessage(message, options);
154
170
  }
155
171
 
156
- override _getOptions(): {
172
+ async signTypedData(
173
+ data: Encoded.ContractBytearray,
174
+ aci: Parameters<AccountBase['signTypedData']>[1],
175
+ { onAccount, ...options }: { onAccount?: OnAccount } & Parameters<AccountBase['signTypedData']>[2] = {},
176
+ ): Promise<Encoded.Signature> {
177
+ return this._resolveAccount(onAccount).signTypedData(data, aci, options);
178
+ }
179
+
180
+ async signDelegationToContract(
181
+ contractAddress: Encoded.ContractAddress,
182
+ { onAccount, ...options }: { onAccount?: OnAccount }
183
+ & Parameters<AccountBase['signDelegationToContract']>[1] = {},
184
+ ): Promise<Encoded.Signature> {
185
+ options.networkId ??= this.selectedNodeName !== null
186
+ ? await this.api.getNetworkId() : undefined;
187
+ return this._resolveAccount(onAccount)
188
+ .signDelegationToContract(contractAddress, options);
189
+ }
190
+
191
+ async signNameDelegationToContract(
192
+ contractAddress: Encoded.ContractAddress,
193
+ name: AensName,
194
+ { onAccount, ...options }: { onAccount?: OnAccount }
195
+ & Parameters<AccountBase['signNameDelegationToContract']>[2] = {},
196
+ ): Promise<Encoded.Signature> {
197
+ options.networkId ??= this.selectedNodeName !== null
198
+ ? await this.api.getNetworkId() : undefined;
199
+ return this._resolveAccount(onAccount)
200
+ .signNameDelegationToContract(contractAddress, name, options);
201
+ }
202
+
203
+ async signOracleQueryDelegationToContract(
204
+ contractAddress: Encoded.ContractAddress,
205
+ oracleQueryId: Encoded.OracleQueryId,
206
+ { onAccount, ...options }: { onAccount?: OnAccount }
207
+ & Parameters<AccountBase['signOracleQueryDelegationToContract']>[2] = {},
208
+ ): Promise<Encoded.Signature> {
209
+ options.networkId ??= this.selectedNodeName !== null
210
+ ? await this.api.getNetworkId() : undefined;
211
+ return this._resolveAccount(onAccount)
212
+ .signOracleQueryDelegationToContract(contractAddress, oracleQueryId, options);
213
+ }
214
+
215
+ override _getOptions(callOptions: AeSdkMethodsOptions = {}): {
157
216
  onNode: Node;
158
217
  onAccount: AccountBase;
159
218
  onCompiler: CompilerBase;
160
219
  } {
161
220
  return {
162
- ...super._getOptions(),
221
+ ...this._options,
163
222
  onNode: getValueOrErrorProxy(() => this.api),
164
223
  onCompiler: getValueOrErrorProxy(() => this.compilerApi),
224
+ ...callOptions,
225
+ onAccount: getValueOrErrorProxy(() => this._resolveAccount(callOptions.onAccount)),
165
226
  };
166
227
  }
167
228
  }
@@ -11,25 +11,27 @@ import Node from './Node';
11
11
  import { TxParamsAsync } from './tx/builder/schema.generated';
12
12
  import AccountBase from './account/Base';
13
13
  import { Encoded } from './utils/encoder';
14
- import { ArgumentError, NotImplementedError, TypeError } from './utils/errors';
14
+ import CompilerBase from './contract/compiler/Base';
15
15
 
16
16
  export type OnAccount = Encoded.AccountAddress | AccountBase | undefined;
17
17
 
18
- export function getValueOrErrorProxy<Value extends object>(valueCb: () => Value): Value {
19
- return new Proxy({}, {
20
- ...Object.fromEntries([
18
+ export function getValueOrErrorProxy<Value extends object | undefined>(
19
+ valueCb: () => Value,
20
+ ): NonNullable<Value> {
21
+ return new Proxy(
22
+ {},
23
+ Object.fromEntries(([
21
24
  'apply', 'construct', 'defineProperty', 'deleteProperty', 'getOwnPropertyDescriptor',
22
25
  'getPrototypeOf', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf',
23
- ].map((name) => [name, () => { throw new NotImplementedError(`${name} proxy request`); }])),
24
- get(t: {}, property: string | symbol, receiver: any) {
25
- const target = valueCb();
26
- const value = Reflect.get(target, property, receiver);
27
- return typeof value === 'function' ? value.bind(target) : value;
28
- },
29
- has(t: {}, property: string | symbol) {
30
- return Reflect.has(valueCb(), property);
31
- },
32
- }) as Value;
26
+ 'get', 'has',
27
+ ] as const).map((name) => [name, (t: {}, ...args: unknown[]) => {
28
+ const target = valueCb() as object; // to get a native exception in case it missed
29
+ const res = (Reflect[name] as any)(target, ...args);
30
+ return typeof res === 'function' && name === 'get'
31
+ ? res.bind(target) // otherwise it fails with attempted to get private field on non-instance
32
+ : res;
33
+ }])),
34
+ ) as NonNullable<Value>;
33
35
  }
34
36
 
35
37
  const { InvalidTxError: _2, ...chainMethodsOther } = chainMethods;
@@ -51,9 +53,8 @@ type GetMethodsOptions <Methods extends { [key: string]: Function }> =
51
53
  ? Args[Decrement<Args['length']>] : never
52
54
  };
53
55
  type MethodsOptions = GetMethodsOptions<typeof methods>;
54
- interface AeSdkMethodsOptions
56
+ export interface AeSdkMethodsOptions
55
57
  extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
56
- nodes?: Array<{ name: string; instance: Node }>;
57
58
  }
58
59
 
59
60
  /**
@@ -79,24 +80,15 @@ class AeSdkMethods {
79
80
  Object.assign(this._options, options);
80
81
  }
81
82
 
82
- /**
83
- * Resolves an account
84
- * @param account - ak-address, instance of AccountBase, or keypair
85
- */
86
- // eslint-disable-next-line class-methods-use-this
87
- _resolveAccount(account?: OnAccount): AccountBase {
88
- if (typeof account === 'string') throw new NotImplementedError('Address in AccountResolver');
89
- if (typeof account === 'object') return account;
90
- throw new TypeError(
91
- 'Account should be an address (ak-prefixed string), '
92
- + `or instance of AccountBase, got ${String(account)} instead`,
93
- );
94
- }
95
-
96
- _getOptions(): AeSdkMethodsOptions & { onAccount: AccountBase } {
83
+ _getOptions(
84
+ callOptions: AeSdkMethodsOptions = {},
85
+ ): AeSdkMethodsOptions & { onAccount: AccountBase; onCompiler: CompilerBase; onNode: Node } {
97
86
  return {
98
87
  ...this._options,
99
- onAccount: getValueOrErrorProxy(() => this._resolveAccount()),
88
+ onAccount: getValueOrErrorProxy(() => this._options.onAccount),
89
+ onNode: getValueOrErrorProxy(() => this._options.onNode),
90
+ onCompiler: getValueOrErrorProxy(() => this._options.onCompiler),
91
+ ...callOptions,
100
92
  };
101
93
  }
102
94
 
@@ -107,16 +99,7 @@ class AeSdkMethods {
107
99
  async initializeContract<Methods extends ContractMethodsBase>(
108
100
  options?: Omit<Parameters<typeof Contract.initialize>[0], 'onNode'> & { onNode?: Node },
109
101
  ): Promise<Contract<Methods>> {
110
- const { onNode, onCompiler, ...otherOptions } = this._getOptions();
111
- if (onCompiler == null || onNode == null) {
112
- throw new ArgumentError('onCompiler, onNode', 'provided', null);
113
- }
114
- return Contract.initialize<Methods>({
115
- ...otherOptions,
116
- onNode,
117
- onCompiler,
118
- ...options,
119
- });
102
+ return Contract.initialize<Methods>(this._getOptions(options as AeSdkMethodsOptions));
120
103
  }
121
104
  }
122
105
 
@@ -147,18 +130,16 @@ Object.assign(AeSdkMethods.prototype, mapObject<Function, Function>(
147
130
  methods,
148
131
  ([name, handler]) => [
149
132
  name,
150
- function methodWrapper(...args: any[]) {
133
+ function methodWrapper(this: AeSdkMethods, ...args: any[]) {
151
134
  args.length = handler.length;
152
135
  const options = args[args.length - 1];
153
- args[args.length - 1] = {
154
- ...this._getOptions(),
155
- ...options,
156
- ...options?.onAccount != null && { onAccount: this._resolveAccount(options.onAccount) },
157
- };
136
+ args[args.length - 1] = this._getOptions(options);
158
137
  return handler(...args);
159
138
  },
160
139
  ],
161
140
  ));
162
141
 
163
- export default AeSdkMethods as new (options?: ConstructorParameters<typeof AeSdkMethods>[0]) =>
164
- AeSdkMethods & AeSdkMethodsTransformed;
142
+ type AeSdkMethodsTyped = AeSdkMethods & AeSdkMethodsTransformed;
143
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
144
+ const AeSdkMethodsTyped = AeSdkMethods as new (options?: AeSdkMethodsOptions) => AeSdkMethodsTyped;
145
+ export default AeSdkMethodsTyped;
@@ -4,7 +4,7 @@ import verifyTransaction from './tx/validator';
4
4
  import RpcClient from './aepp-wallet-communication/rpc/RpcClient';
5
5
  import {
6
6
  METHODS, RPC_STATUS, SUBSCRIPTION_TYPES, WALLET_TYPE,
7
- RpcBroadcastError, RpcInvalidTransactionError,
7
+ RpcInvalidTransactionError,
8
8
  RpcNotAuthorizeError, RpcPermissionDenyError, RpcUnsupportedProtocolError,
9
9
  } from './aepp-wallet-communication/schema';
10
10
  import { InternalError, UnknownRpcClientError } from './utils/errors';
@@ -106,12 +106,23 @@ export default class AeSdkWallet extends AeSdk {
106
106
  this._type = type;
107
107
  }
108
108
 
109
+ _getAccountsForClient({ addressSubscription }: RpcClientsInfo): Accounts {
110
+ const { current, connected } = this.getAccounts();
111
+ return {
112
+ current: addressSubscription.has('current') || addressSubscription.has('connected')
113
+ ? current : {},
114
+ connected: addressSubscription.has('connected') ? connected : {},
115
+ };
116
+ }
117
+
109
118
  _pushAccountsToApps(): void {
110
119
  if (this._clients == null) return;
111
120
  Array.from(this._clients.keys())
112
- .filter((clientId) => this._isRpcClientSubscribed(clientId))
113
- .map((clientId) => this._getClient(clientId).rpc)
114
- .forEach((client) => client.notify(METHODS.updateAddress, this.getAccounts()));
121
+ .filter((clientId) => this._isRpcClientConnected(clientId))
122
+ .map((clientId) => this._getClient(clientId))
123
+ .filter((client) => client.addressSubscription.size !== 0)
124
+ .forEach((client) => client.rpc
125
+ .notify(METHODS.updateAddress, this._getAccountsForClient(client)));
115
126
  }
116
127
 
117
128
  override selectAccount(address: Encoded.AccountAddress): void {
@@ -149,11 +160,6 @@ export default class AeSdkWallet extends AeSdk {
149
160
  return client;
150
161
  }
151
162
 
152
- _isRpcClientSubscribed(clientId: string): boolean {
153
- return this._isRpcClientConnected(clientId)
154
- && this._getClient(clientId).addressSubscription.size !== 0;
155
- }
156
-
157
163
  _isRpcClientConnected(clientId: string): boolean {
158
164
  return RPC_STATUS.CONNECTED === this._getClient(clientId).status
159
165
  && this._getClient(clientId).rpc.connection.isConnected();
@@ -219,10 +225,10 @@ export default class AeSdkWallet extends AeSdk {
219
225
  [METHODS.subscribeAddress]: async ({ type, value }, origin) => {
220
226
  if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
221
227
 
222
- await this.onSubscription(id, { type, value }, origin);
223
-
224
228
  switch (type) {
225
229
  case SUBSCRIPTION_TYPES.subscribe:
230
+ // TODO: remove `type` as it always subscribe
231
+ await this.onSubscription(id, { type, value }, origin);
226
232
  client.addressSubscription.add(value);
227
233
  break;
228
234
  case SUBSCRIPTION_TYPES.unsubscribe:
@@ -234,22 +240,29 @@ export default class AeSdkWallet extends AeSdk {
234
240
 
235
241
  return {
236
242
  subscription: Array.from(client.addressSubscription),
237
- address: this.getAccounts(),
243
+ address: this._getAccountsForClient(client),
238
244
  };
239
245
  },
240
246
  [METHODS.address]: async (params, origin) => {
241
- if (!this._isRpcClientSubscribed(id)) throw new RpcNotAuthorizeError();
247
+ if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
242
248
  await this.onAskAccounts(id, params, origin);
243
249
  return this.addresses();
244
250
  },
245
- [METHODS.sign]: async ({ tx, onAccount = this.address, returnSigned }, origin) => {
251
+ [METHODS.sign]: async (
252
+ {
253
+ tx, onAccount = this.address, returnSigned, innerTx,
254
+ },
255
+ origin,
256
+ ) => {
246
257
  if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
247
258
  if (!this.addresses().includes(onAccount)) {
248
259
  throw new RpcPermissionDenyError(onAccount);
249
260
  }
250
261
 
251
- const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };
252
- if (returnSigned) {
262
+ const parameters = {
263
+ onAccount, aeppOrigin: origin, aeppRpcClientId: id, innerTx,
264
+ };
265
+ if (returnSigned || innerTx === true) {
253
266
  return { signedTransaction: await this.signTransaction(tx, parameters) };
254
267
  }
255
268
  try {
@@ -259,7 +272,7 @@ export default class AeSdkWallet extends AeSdk {
259
272
  } catch (error) {
260
273
  const validation = await verifyTransaction(tx, this.api);
261
274
  if (validation.length > 0) throw new RpcInvalidTransactionError(validation);
262
- throw new RpcBroadcastError(error.message);
275
+ throw error;
263
276
  }
264
277
  },
265
278
  [METHODS.signMessage]: async ({ message, onAccount = this.address }, origin) => {
@@ -273,6 +286,39 @@ export default class AeSdkWallet extends AeSdk {
273
286
  signature: Buffer.from(await this.signMessage(message, parameters)).toString('hex'),
274
287
  };
275
288
  },
289
+ [METHODS.signTypedData]: async ({
290
+ domain, aci, data, onAccount = this.address,
291
+ }, origin) => {
292
+ if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
293
+ if (!this.addresses().includes(onAccount)) {
294
+ throw new RpcPermissionDenyError(onAccount);
295
+ }
296
+
297
+ const parameters = {
298
+ ...domain, onAccount, aeppOrigin: origin, aeppRpcClientId: id,
299
+ };
300
+ return {
301
+ signature: await this.signTypedData(data, aci, parameters),
302
+ };
303
+ },
304
+ [METHODS.signDelegationToContract]: async ({
305
+ contractAddress, name, oracleQueryId, onAccount = this.address,
306
+ }, origin) => {
307
+ if (!this._isRpcClientConnected(id)) throw new RpcNotAuthorizeError();
308
+ if (!this.addresses().includes(onAccount)) {
309
+ throw new RpcPermissionDenyError(onAccount);
310
+ }
311
+
312
+ const parameters = { onAccount, aeppOrigin: origin, aeppRpcClientId: id };
313
+ const signature = await (
314
+ (name == null ? null : this
315
+ .signNameDelegationToContract(contractAddress, name, parameters))
316
+ ?? (oracleQueryId == null ? null : this
317
+ .signOracleQueryDelegationToContract(contractAddress, oracleQueryId, parameters))
318
+ ?? this.signDelegationToContract(contractAddress, parameters)
319
+ );
320
+ return { signature };
321
+ },
276
322
  },
277
323
  ),
278
324
  };