@aeternity/aepp-sdk 13.2.2 → 13.3.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 (494) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/bin/aesophia_cli +0 -0
  4. package/bin/aesophia_cli_8 +0 -0
  5. package/dist/aepp-sdk.browser-script.js +1 -1
  6. package/dist/aepp-sdk.browser-script.js.map +1 -1
  7. package/dist/aepp-sdk.browser.js +1 -1
  8. package/dist/aepp-sdk.browser.js.map +1 -1
  9. package/dist/aepp-sdk.js +9171 -7086
  10. package/dist/aepp-sdk.js.map +1 -1
  11. package/es/AeSdk.d.ts +3 -0
  12. package/es/AeSdk.mjs +12 -12
  13. package/es/AeSdk.mjs.map +1 -1
  14. package/es/AeSdkAepp.d.ts +0 -1
  15. package/es/AeSdkAepp.mjs +12 -16
  16. package/es/AeSdkAepp.mjs.map +1 -1
  17. package/es/AeSdkBase.d.ts +61 -6
  18. package/es/AeSdkBase.mjs +150 -69
  19. package/es/AeSdkBase.mjs.map +1 -1
  20. package/es/AeSdkMethods.d.ts +19 -7
  21. package/es/AeSdkMethods.mjs +39 -38
  22. package/es/AeSdkMethods.mjs.map +1 -1
  23. package/es/AeSdkWallet.mjs +86 -55
  24. package/es/AeSdkWallet.mjs.map +1 -1
  25. package/es/Middleware.mjs +31 -27
  26. package/es/Middleware.mjs.map +1 -1
  27. package/es/MiddlewareSubscriber.mjs +5 -14
  28. package/es/MiddlewareSubscriber.mjs.map +1 -1
  29. package/es/Node.d.ts +10 -2
  30. package/es/Node.mjs +53 -54
  31. package/es/Node.mjs.map +1 -1
  32. package/es/account/Base.d.ts +39 -3
  33. package/es/account/Base.mjs +35 -1
  34. package/es/account/Base.mjs.map +1 -1
  35. package/es/account/Generalized.d.ts +2 -0
  36. package/es/account/Generalized.mjs +15 -6
  37. package/es/account/Generalized.mjs.map +1 -1
  38. package/es/account/Ledger.d.ts +2 -0
  39. package/es/account/Ledger.mjs +14 -5
  40. package/es/account/Ledger.mjs.map +1 -1
  41. package/es/account/LedgerFactory.mjs +4 -6
  42. package/es/account/LedgerFactory.mjs.map +1 -1
  43. package/es/account/Memory.d.ts +15 -4
  44. package/es/account/Memory.mjs +96 -31
  45. package/es/account/Memory.mjs.map +1 -1
  46. package/es/account/Rpc.d.ts +16 -5
  47. package/es/account/Rpc.mjs +94 -21
  48. package/es/account/Rpc.mjs.map +1 -1
  49. package/es/aens.d.ts +17 -44
  50. package/es/aens.mjs +32 -71
  51. package/es/aens.mjs.map +1 -1
  52. package/es/aepp-wallet-communication/connection/Browser.mjs +3 -4
  53. package/es/aepp-wallet-communication/connection/Browser.mjs.map +1 -1
  54. package/es/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  55. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs +7 -5
  56. package/es/aepp-wallet-communication/connection/BrowserRuntime.mjs.map +1 -1
  57. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs +8 -9
  58. package/es/aepp-wallet-communication/connection/BrowserWindowMessage.mjs.map +1 -1
  59. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +7 -7
  60. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  61. package/es/aepp-wallet-communication/rpc/types.d.ts +14 -0
  62. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  63. package/es/aepp-wallet-communication/schema.d.ts +2 -0
  64. package/es/aepp-wallet-communication/schema.mjs +2 -0
  65. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  66. package/es/aepp-wallet-communication/wallet-detector.mjs +4 -5
  67. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  68. package/es/apis/compiler/compiler.mjs.map +1 -1
  69. package/es/apis/compiler/models/index.d.ts +1 -0
  70. package/es/apis/compiler/models/index.mjs.map +1 -1
  71. package/es/apis/compiler/models/mappers.mjs +13 -0
  72. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  73. package/es/apis/compiler/models/parameters.mjs.map +1 -1
  74. package/es/apis/middleware/middleware.d.ts +23 -5
  75. package/es/apis/middleware/middleware.mjs +114 -18
  76. package/es/apis/middleware/middleware.mjs.map +1 -1
  77. package/es/apis/middleware/models/index.d.ts +164 -15
  78. package/es/apis/middleware/models/index.mjs +53 -3
  79. package/es/apis/middleware/models/index.mjs.map +1 -1
  80. package/es/apis/middleware/models/mappers.d.ts +8 -1
  81. package/es/apis/middleware/models/mappers.mjs +376 -3
  82. package/es/apis/middleware/models/mappers.mjs.map +1 -1
  83. package/es/apis/middleware/models/parameters.d.ts +6 -3
  84. package/es/apis/middleware/models/parameters.mjs +38 -11
  85. package/es/apis/middleware/models/parameters.mjs.map +1 -1
  86. package/es/apis/node/models/index.d.ts +66 -2
  87. package/es/apis/node/models/index.mjs.map +1 -1
  88. package/es/apis/node/models/mappers.d.ts +5 -1
  89. package/es/apis/node/models/mappers.mjs +229 -7
  90. package/es/apis/node/models/mappers.mjs.map +1 -1
  91. package/es/apis/node/models/parameters.d.ts +2 -2
  92. package/es/apis/node/models/parameters.mjs +2 -2
  93. package/es/apis/node/models/parameters.mjs.map +1 -1
  94. package/es/apis/node/node.d.ts +24 -3
  95. package/es/apis/node/node.mjs +135 -3
  96. package/es/apis/node/node.mjs.map +1 -1
  97. package/es/chain.d.ts +14 -44
  98. package/es/chain.mjs +125 -219
  99. package/es/chain.mjs.map +1 -1
  100. package/es/channel/Base.d.ts +3 -47
  101. package/es/channel/Base.mjs +21 -54
  102. package/es/channel/Base.mjs.map +1 -1
  103. package/es/channel/Contract.d.ts +16 -25
  104. package/es/channel/Contract.mjs +39 -63
  105. package/es/channel/Contract.mjs.map +1 -1
  106. package/es/channel/Spend.d.ts +0 -8
  107. package/es/channel/Spend.mjs +17 -29
  108. package/es/channel/Spend.mjs.map +1 -1
  109. package/es/channel/handlers.mjs +1 -1
  110. package/es/channel/handlers.mjs.map +1 -1
  111. package/es/channel/internal.d.ts +104 -5
  112. package/es/channel/internal.mjs +26 -34
  113. package/es/channel/internal.mjs.map +1 -1
  114. package/es/contract/Contract.d.ts +9 -1
  115. package/es/contract/Contract.mjs +67 -73
  116. package/es/contract/Contract.mjs.map +1 -1
  117. package/es/contract/compiler/Base.d.ts +14 -8
  118. package/es/contract/compiler/Base.mjs.map +1 -1
  119. package/es/contract/compiler/Cli.d.ts +5 -9
  120. package/es/contract/compiler/Cli.mjs +45 -23
  121. package/es/contract/compiler/Cli.mjs.map +1 -1
  122. package/es/contract/compiler/Cli8.d.ts +13 -0
  123. package/es/contract/compiler/Cli8.mjs +22 -0
  124. package/es/contract/compiler/Cli8.mjs.map +1 -0
  125. package/es/contract/compiler/Http.d.ts +3 -9
  126. package/es/contract/compiler/Http.mjs +28 -16
  127. package/es/contract/compiler/Http.mjs.map +1 -1
  128. package/es/contract/compiler/HttpNode.d.ts +2 -5
  129. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  130. package/es/contract/delegation-signature.d.ts +2 -1
  131. package/es/contract/delegation-signature.mjs +18 -14
  132. package/es/contract/delegation-signature.mjs.map +1 -1
  133. package/es/contract/ga.d.ts +1 -2
  134. package/es/contract/ga.mjs +23 -25
  135. package/es/contract/ga.mjs.map +1 -1
  136. package/es/deprecated.d.ts +38 -0
  137. package/es/deprecated.mjs +45 -0
  138. package/es/deprecated.mjs.map +1 -1
  139. package/es/index-browser.d.ts +10 -5
  140. package/es/index-browser.mjs +9 -5
  141. package/es/index-browser.mjs.map +1 -1
  142. package/es/index.d.ts +1 -0
  143. package/es/index.mjs +1 -0
  144. package/es/index.mjs.map +1 -1
  145. package/es/oracle.d.ts +6 -37
  146. package/es/oracle.mjs +32 -66
  147. package/es/oracle.mjs.map +1 -1
  148. package/es/send-transaction.d.ts +53 -0
  149. package/es/send-transaction.mjs +109 -0
  150. package/es/send-transaction.mjs.map +1 -0
  151. package/es/spend.d.ts +4 -3
  152. package/es/spend.mjs +6 -1
  153. package/es/spend.mjs.map +1 -1
  154. package/es/tx/builder/common.d.ts +29 -0
  155. package/es/tx/builder/common.mjs +42 -0
  156. package/es/tx/builder/common.mjs.map +1 -0
  157. package/es/tx/builder/constants.d.ts +4 -4
  158. package/es/tx/builder/constants.mjs +6 -15
  159. package/es/tx/builder/constants.mjs.map +1 -1
  160. package/es/tx/builder/delegation/index.d.ts +20 -0
  161. package/es/tx/builder/delegation/index.mjs +24 -0
  162. package/es/tx/builder/delegation/index.mjs.map +1 -0
  163. package/es/tx/builder/delegation/schema.d.ts +130 -0
  164. package/es/tx/builder/delegation/schema.generated.d.ts +141 -0
  165. package/es/tx/builder/delegation/schema.generated.mjs +2 -0
  166. package/es/tx/builder/delegation/schema.generated.mjs.map +1 -0
  167. package/es/tx/builder/delegation/schema.mjs +54 -0
  168. package/es/tx/builder/delegation/schema.mjs.map +1 -0
  169. package/es/tx/builder/field-types/abi-version.mjs +8 -11
  170. package/es/tx/builder/field-types/abi-version.mjs.map +1 -1
  171. package/es/tx/builder/field-types/address.mjs +1 -4
  172. package/es/tx/builder/field-types/address.mjs.map +1 -1
  173. package/es/tx/builder/field-types/coin-amount.d.ts +2 -2
  174. package/es/tx/builder/field-types/coin-amount.mjs +6 -6
  175. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  176. package/es/tx/builder/field-types/ct-version.mjs +3 -4
  177. package/es/tx/builder/field-types/ct-version.mjs.map +1 -1
  178. package/es/tx/builder/field-types/entry.mjs +7 -13
  179. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  180. package/es/tx/builder/field-types/fee.d.ts +19 -11
  181. package/es/tx/builder/field-types/fee.mjs +56 -38
  182. package/es/tx/builder/field-types/fee.mjs.map +1 -1
  183. package/es/tx/builder/field-types/gas-limit.mjs +13 -15
  184. package/es/tx/builder/field-types/gas-limit.mjs.map +1 -1
  185. package/es/tx/builder/field-types/gas-price.d.ts +10 -2
  186. package/es/tx/builder/field-types/gas-price.mjs +52 -3
  187. package/es/tx/builder/field-types/gas-price.mjs.map +1 -1
  188. package/es/tx/builder/field-types/index.d.ts +31 -29
  189. package/es/tx/builder/field-types/index.mjs +31 -29
  190. package/es/tx/builder/field-types/index.mjs.map +1 -1
  191. package/es/tx/builder/field-types/map.mjs +20 -31
  192. package/es/tx/builder/field-types/map.mjs.map +1 -1
  193. package/es/tx/builder/field-types/mptree.mjs +14 -29
  194. package/es/tx/builder/field-types/mptree.mjs.map +1 -1
  195. package/es/tx/builder/field-types/name-fee.d.ts +1 -1
  196. package/es/tx/builder/field-types/name-fee.mjs +1 -1
  197. package/es/tx/builder/field-types/name-fee.mjs.map +1 -1
  198. package/es/tx/builder/field-types/nonce.d.ts +1 -0
  199. package/es/tx/builder/field-types/nonce.mjs +2 -0
  200. package/es/tx/builder/field-types/nonce.mjs.map +1 -1
  201. package/es/tx/builder/field-types/pointers.mjs +4 -7
  202. package/es/tx/builder/field-types/pointers.mjs.map +1 -1
  203. package/es/tx/builder/field-types/pointers2.d.ts +23 -0
  204. package/es/tx/builder/field-types/pointers2.mjs +65 -0
  205. package/es/tx/builder/field-types/pointers2.mjs.map +1 -0
  206. package/es/tx/builder/field-types/query-fee.d.ts +19 -0
  207. package/es/tx/builder/field-types/query-fee.mjs +20 -0
  208. package/es/tx/builder/field-types/query-fee.mjs.map +1 -0
  209. package/es/tx/builder/field-types/ttl.d.ts +9 -1
  210. package/es/tx/builder/field-types/ttl.mjs +19 -8
  211. package/es/tx/builder/field-types/ttl.mjs.map +1 -1
  212. package/es/tx/builder/field-types/with-default.d.ts +7 -0
  213. package/es/tx/builder/field-types/with-default.mjs +9 -0
  214. package/es/tx/builder/field-types/with-default.mjs.map +1 -0
  215. package/es/tx/builder/field-types/with-formatting.d.ts +7 -0
  216. package/es/tx/builder/field-types/with-formatting.mjs +9 -0
  217. package/es/tx/builder/field-types/with-formatting.mjs.map +1 -0
  218. package/es/tx/builder/field-types/wrapped.mjs +6 -8
  219. package/es/tx/builder/field-types/wrapped.mjs.map +1 -1
  220. package/es/tx/builder/helpers.d.ts +2 -2
  221. package/es/tx/builder/helpers.mjs +12 -21
  222. package/es/tx/builder/helpers.mjs.map +1 -1
  223. package/es/tx/builder/index.d.ts +17 -10
  224. package/es/tx/builder/index.mjs +39 -65
  225. package/es/tx/builder/index.mjs.map +1 -1
  226. package/es/tx/builder/schema.d.ts +478 -257
  227. package/es/tx/builder/schema.generated.d.ts +39 -3
  228. package/es/tx/builder/schema.generated.mjs.map +1 -1
  229. package/es/tx/builder/schema.mjs +48 -36
  230. package/es/tx/builder/schema.mjs.map +1 -1
  231. package/es/tx/execution-cost.d.ts +6 -5
  232. package/es/tx/execution-cost.mjs +16 -17
  233. package/es/tx/execution-cost.mjs.map +1 -1
  234. package/es/tx/transaction-signer.mjs +1 -4
  235. package/es/tx/transaction-signer.mjs.map +1 -1
  236. package/es/tx/validator.mjs +61 -42
  237. package/es/tx/validator.mjs.map +1 -1
  238. package/es/utils/amount-formatter.mjs +15 -22
  239. package/es/utils/amount-formatter.mjs.map +1 -1
  240. package/es/utils/autorest.d.ts +2 -3
  241. package/es/utils/autorest.mjs +40 -24
  242. package/es/utils/autorest.mjs.map +1 -1
  243. package/es/utils/bytes.mjs +1 -2
  244. package/es/utils/bytes.mjs.map +1 -1
  245. package/es/utils/crypto.d.ts +8 -4
  246. package/es/utils/crypto.mjs +17 -13
  247. package/es/utils/crypto.mjs.map +1 -1
  248. package/es/utils/errors.d.ts +6 -0
  249. package/es/utils/errors.mjs +12 -6
  250. package/es/utils/errors.mjs.map +1 -1
  251. package/es/utils/hd-wallet.d.ts +2 -0
  252. package/es/utils/hd-wallet.mjs +6 -5
  253. package/es/utils/hd-wallet.mjs.map +1 -1
  254. package/es/utils/json-big.mjs +2 -10
  255. package/es/utils/json-big.mjs.map +1 -1
  256. package/es/utils/jwt.d.ts +53 -0
  257. package/es/utils/jwt.mjs +120 -0
  258. package/es/utils/jwt.mjs.map +1 -0
  259. package/es/utils/keystore.d.ts +6 -2
  260. package/es/utils/keystore.mjs +8 -16
  261. package/es/utils/keystore.mjs.map +1 -1
  262. package/es/utils/typed-data.mjs +1 -0
  263. package/es/utils/typed-data.mjs.map +1 -1
  264. package/es/utils/wrap-proxy.d.ts +2 -0
  265. package/es/utils/wrap-proxy.mjs +15 -0
  266. package/es/utils/wrap-proxy.mjs.map +1 -0
  267. package/package.json +57 -51
  268. package/src/AeSdk.ts +3 -0
  269. package/src/AeSdkAepp.ts +0 -1
  270. package/src/AeSdkBase.ts +97 -10
  271. package/src/AeSdkMethods.ts +37 -33
  272. package/src/AeSdkWallet.ts +22 -3
  273. package/src/Middleware.ts +16 -8
  274. package/src/MiddlewareSubscriber.ts +1 -1
  275. package/src/Node.ts +37 -18
  276. package/src/account/Base.ts +62 -3
  277. package/src/account/Generalized.ts +10 -0
  278. package/src/account/Ledger.ts +10 -0
  279. package/src/account/Memory.ts +83 -9
  280. package/src/account/Rpc.ts +69 -6
  281. package/src/aens.ts +35 -56
  282. package/src/aepp-wallet-communication/connection/BrowserRuntime.ts +3 -0
  283. package/src/aepp-wallet-communication/connection/BrowserWindowMessage.ts +2 -2
  284. package/src/aepp-wallet-communication/rpc/RpcClient.ts +4 -2
  285. package/src/aepp-wallet-communication/rpc/types.ts +13 -0
  286. package/src/aepp-wallet-communication/schema.ts +2 -0
  287. package/src/apis/compiler/compiler.ts +93 -93
  288. package/src/apis/compiler/models/index.ts +1 -0
  289. package/src/apis/compiler/models/mappers.ts +178 -165
  290. package/src/apis/compiler/models/parameters.ts +18 -18
  291. package/src/apis/middleware/middleware.ts +462 -341
  292. package/src/apis/middleware/models/index.ts +258 -56
  293. package/src/apis/middleware/models/mappers.ts +2357 -1919
  294. package/src/apis/middleware/models/parameters.ts +172 -142
  295. package/src/apis/node/models/index.ts +79 -2
  296. package/src/apis/node/models/mappers.ts +1529 -1302
  297. package/src/apis/node/models/parameters.ts +51 -51
  298. package/src/apis/node/node.ts +420 -275
  299. package/src/chain.ts +42 -128
  300. package/src/channel/Base.ts +14 -47
  301. package/src/channel/Contract.ts +18 -26
  302. package/src/channel/Spend.ts +0 -8
  303. package/src/channel/internal.ts +115 -13
  304. package/src/contract/Contract.ts +26 -8
  305. package/src/contract/compiler/Base.ts +15 -8
  306. package/src/contract/compiler/Cli.ts +37 -21
  307. package/src/contract/compiler/Cli8.ts +17 -0
  308. package/src/contract/compiler/Http.ts +24 -14
  309. package/src/contract/compiler/HttpNode.ts +2 -2
  310. package/src/contract/delegation-signature.ts +11 -5
  311. package/src/contract/ga.ts +4 -3
  312. package/src/deprecated.ts +36 -0
  313. package/src/index-browser.ts +14 -7
  314. package/src/index.ts +1 -0
  315. package/src/oracle.ts +11 -54
  316. package/src/send-transaction.ts +136 -0
  317. package/src/spend.ts +25 -11
  318. package/src/tx/builder/common.ts +74 -0
  319. package/src/tx/builder/constants.ts +6 -9
  320. package/src/tx/builder/delegation/index.ts +28 -0
  321. package/src/tx/builder/delegation/schema.generated.ts +143 -0
  322. package/src/tx/builder/delegation/schema.ts +61 -0
  323. package/src/tx/builder/field-types/coin-amount.ts +3 -2
  324. package/src/tx/builder/field-types/entry.ts +1 -4
  325. package/src/tx/builder/field-types/fee.ts +71 -43
  326. package/src/tx/builder/field-types/gas-limit.ts +4 -4
  327. package/src/tx/builder/field-types/gas-price.ts +70 -14
  328. package/src/tx/builder/field-types/index.ts +31 -59
  329. package/src/tx/builder/field-types/name-fee.ts +1 -1
  330. package/src/tx/builder/field-types/nonce.ts +7 -1
  331. package/src/tx/builder/field-types/pointers2.ts +62 -0
  332. package/src/tx/builder/field-types/query-fee.ts +25 -0
  333. package/src/tx/builder/field-types/ttl.ts +13 -3
  334. package/src/tx/builder/field-types/with-default.ts +18 -0
  335. package/src/tx/builder/field-types/with-formatting.ts +18 -0
  336. package/src/tx/builder/helpers.ts +2 -2
  337. package/src/tx/builder/index.ts +42 -59
  338. package/src/tx/builder/schema.generated.ts +39 -3
  339. package/src/tx/builder/schema.ts +55 -29
  340. package/src/tx/execution-cost.ts +6 -5
  341. package/src/tx/validator.ts +31 -5
  342. package/src/utils/autorest.ts +36 -27
  343. package/src/utils/crypto.ts +23 -13
  344. package/src/utils/errors.ts +10 -0
  345. package/src/utils/hd-wallet.ts +2 -0
  346. package/src/utils/jwt.ts +126 -0
  347. package/src/utils/keystore.ts +6 -2
  348. package/src/utils/wrap-proxy.ts +24 -0
  349. package/types-legacy/ts4.2/AeSdk.d.ts +3 -0
  350. package/types-legacy/ts4.2/AeSdkAepp.d.ts +0 -1
  351. package/types-legacy/ts4.2/AeSdkBase.d.ts +61 -6
  352. package/types-legacy/ts4.2/AeSdkMethods.d.ts +19 -7
  353. package/types-legacy/ts4.2/Node.d.ts +14 -1
  354. package/types-legacy/ts4.2/account/Base.d.ts +39 -3
  355. package/types-legacy/ts4.2/account/Generalized.d.ts +2 -0
  356. package/types-legacy/ts4.2/account/Ledger.d.ts +2 -0
  357. package/types-legacy/ts4.2/account/Memory.d.ts +15 -4
  358. package/types-legacy/ts4.2/account/Rpc.d.ts +16 -5
  359. package/types-legacy/ts4.2/aens.d.ts +17 -44
  360. package/types-legacy/ts4.2/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  361. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +14 -0
  362. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +2 -0
  363. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -0
  364. package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +23 -5
  365. package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +164 -15
  366. package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +8 -1
  367. package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +6 -3
  368. package/types-legacy/ts4.2/apis/node/models/index.d.ts +66 -2
  369. package/types-legacy/ts4.2/apis/node/models/mappers.d.ts +5 -1
  370. package/types-legacy/ts4.2/apis/node/models/parameters.d.ts +2 -2
  371. package/types-legacy/ts4.2/apis/node/node.d.ts +24 -3
  372. package/types-legacy/ts4.2/chain.d.ts +14 -44
  373. package/types-legacy/ts4.2/channel/Base.d.ts +3 -47
  374. package/types-legacy/ts4.2/channel/Contract.d.ts +16 -25
  375. package/types-legacy/ts4.2/channel/Spend.d.ts +0 -8
  376. package/types-legacy/ts4.2/channel/internal.d.ts +104 -5
  377. package/types-legacy/ts4.2/contract/Contract.d.ts +9 -1
  378. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +14 -8
  379. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +5 -9
  380. package/types-legacy/ts4.2/contract/compiler/Cli8.d.ts +13 -0
  381. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +3 -9
  382. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +2 -5
  383. package/types-legacy/ts4.2/contract/delegation-signature.d.ts +2 -1
  384. package/types-legacy/ts4.2/contract/ga.d.ts +1 -2
  385. package/types-legacy/ts4.2/deprecated.d.ts +38 -0
  386. package/types-legacy/ts4.2/index-browser.d.ts +10 -5
  387. package/types-legacy/ts4.2/index.d.ts +1 -0
  388. package/types-legacy/ts4.2/oracle.d.ts +6 -37
  389. package/types-legacy/ts4.2/send-transaction.d.ts +53 -0
  390. package/types-legacy/ts4.2/spend.d.ts +4 -3
  391. package/types-legacy/ts4.2/tx/builder/common.d.ts +32 -0
  392. package/types-legacy/ts4.2/tx/builder/constants.d.ts +4 -4
  393. package/types-legacy/ts4.2/tx/builder/delegation/index.d.ts +20 -0
  394. package/types-legacy/ts4.2/tx/builder/delegation/schema.d.ts +136 -0
  395. package/types-legacy/ts4.2/tx/builder/delegation/schema.generated.d.ts +141 -0
  396. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +2 -2
  397. package/types-legacy/ts4.2/tx/builder/field-types/fee.d.ts +19 -11
  398. package/types-legacy/ts4.2/tx/builder/field-types/gas-price.d.ts +10 -2
  399. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +31 -29
  400. package/types-legacy/ts4.2/tx/builder/field-types/name-fee.d.ts +1 -1
  401. package/types-legacy/ts4.2/tx/builder/field-types/nonce.d.ts +1 -0
  402. package/types-legacy/ts4.2/tx/builder/field-types/pointers2.d.ts +26 -0
  403. package/types-legacy/ts4.2/tx/builder/field-types/query-fee.d.ts +19 -0
  404. package/types-legacy/ts4.2/tx/builder/field-types/ttl.d.ts +9 -1
  405. package/types-legacy/ts4.2/tx/builder/field-types/with-default.d.ts +7 -0
  406. package/types-legacy/ts4.2/tx/builder/field-types/with-formatting.d.ts +7 -0
  407. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +2 -2
  408. package/types-legacy/ts4.2/tx/builder/index.d.ts +17 -10
  409. package/types-legacy/ts4.2/tx/builder/schema.d.ts +482 -257
  410. package/types-legacy/ts4.2/tx/builder/schema.generated.d.ts +39 -3
  411. package/types-legacy/ts4.2/tx/execution-cost.d.ts +6 -5
  412. package/types-legacy/ts4.2/utils/autorest.d.ts +2 -3
  413. package/types-legacy/ts4.2/utils/crypto.d.ts +8 -4
  414. package/types-legacy/ts4.2/utils/errors.d.ts +6 -0
  415. package/types-legacy/ts4.2/utils/hd-wallet.d.ts +2 -0
  416. package/types-legacy/ts4.2/utils/jwt.d.ts +53 -0
  417. package/types-legacy/ts4.2/utils/keystore.d.ts +6 -2
  418. package/types-legacy/ts4.2/utils/wrap-proxy.d.ts +2 -0
  419. package/types-legacy/ts4.5/AeSdk.d.ts +3 -0
  420. package/types-legacy/ts4.5/AeSdkAepp.d.ts +0 -1
  421. package/types-legacy/ts4.5/AeSdkBase.d.ts +61 -6
  422. package/types-legacy/ts4.5/AeSdkMethods.d.ts +19 -7
  423. package/types-legacy/ts4.5/Node.d.ts +14 -1
  424. package/types-legacy/ts4.5/account/Base.d.ts +39 -3
  425. package/types-legacy/ts4.5/account/Generalized.d.ts +2 -0
  426. package/types-legacy/ts4.5/account/Ledger.d.ts +2 -0
  427. package/types-legacy/ts4.5/account/Memory.d.ts +15 -4
  428. package/types-legacy/ts4.5/account/Rpc.d.ts +16 -5
  429. package/types-legacy/ts4.5/aens.d.ts +17 -44
  430. package/types-legacy/ts4.5/aepp-wallet-communication/connection/BrowserRuntime.d.ts +3 -0
  431. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +14 -0
  432. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +2 -0
  433. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -0
  434. package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +23 -5
  435. package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +164 -15
  436. package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +8 -1
  437. package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +6 -3
  438. package/types-legacy/ts4.5/apis/node/models/index.d.ts +66 -2
  439. package/types-legacy/ts4.5/apis/node/models/mappers.d.ts +5 -1
  440. package/types-legacy/ts4.5/apis/node/models/parameters.d.ts +2 -2
  441. package/types-legacy/ts4.5/apis/node/node.d.ts +24 -3
  442. package/types-legacy/ts4.5/chain.d.ts +14 -44
  443. package/types-legacy/ts4.5/channel/Base.d.ts +3 -47
  444. package/types-legacy/ts4.5/channel/Contract.d.ts +16 -25
  445. package/types-legacy/ts4.5/channel/Spend.d.ts +0 -8
  446. package/types-legacy/ts4.5/channel/internal.d.ts +104 -5
  447. package/types-legacy/ts4.5/contract/Contract.d.ts +9 -1
  448. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +14 -8
  449. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +5 -9
  450. package/types-legacy/ts4.5/contract/compiler/Cli8.d.ts +13 -0
  451. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +3 -9
  452. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +2 -5
  453. package/types-legacy/ts4.5/contract/delegation-signature.d.ts +2 -1
  454. package/types-legacy/ts4.5/contract/ga.d.ts +1 -2
  455. package/types-legacy/ts4.5/deprecated.d.ts +38 -0
  456. package/types-legacy/ts4.5/index-browser.d.ts +10 -5
  457. package/types-legacy/ts4.5/index.d.ts +1 -0
  458. package/types-legacy/ts4.5/oracle.d.ts +6 -37
  459. package/types-legacy/ts4.5/send-transaction.d.ts +53 -0
  460. package/types-legacy/ts4.5/spend.d.ts +4 -3
  461. package/types-legacy/ts4.5/tx/builder/common.d.ts +32 -0
  462. package/types-legacy/ts4.5/tx/builder/constants.d.ts +4 -4
  463. package/types-legacy/ts4.5/tx/builder/delegation/index.d.ts +20 -0
  464. package/types-legacy/ts4.5/tx/builder/delegation/schema.d.ts +136 -0
  465. package/types-legacy/ts4.5/tx/builder/delegation/schema.generated.d.ts +141 -0
  466. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +2 -2
  467. package/types-legacy/ts4.5/tx/builder/field-types/fee.d.ts +19 -11
  468. package/types-legacy/ts4.5/tx/builder/field-types/gas-price.d.ts +10 -2
  469. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +31 -29
  470. package/types-legacy/ts4.5/tx/builder/field-types/name-fee.d.ts +1 -1
  471. package/types-legacy/ts4.5/tx/builder/field-types/nonce.d.ts +1 -0
  472. package/types-legacy/ts4.5/tx/builder/field-types/pointers2.d.ts +26 -0
  473. package/types-legacy/ts4.5/tx/builder/field-types/query-fee.d.ts +19 -0
  474. package/types-legacy/ts4.5/tx/builder/field-types/ttl.d.ts +9 -1
  475. package/types-legacy/ts4.5/tx/builder/field-types/with-default.d.ts +7 -0
  476. package/types-legacy/ts4.5/tx/builder/field-types/with-formatting.d.ts +7 -0
  477. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +2 -2
  478. package/types-legacy/ts4.5/tx/builder/index.d.ts +17 -10
  479. package/types-legacy/ts4.5/tx/builder/schema.d.ts +482 -257
  480. package/types-legacy/ts4.5/tx/builder/schema.generated.d.ts +39 -3
  481. package/types-legacy/ts4.5/tx/execution-cost.d.ts +6 -5
  482. package/types-legacy/ts4.5/utils/autorest.d.ts +2 -3
  483. package/types-legacy/ts4.5/utils/crypto.d.ts +8 -4
  484. package/types-legacy/ts4.5/utils/errors.d.ts +6 -0
  485. package/types-legacy/ts4.5/utils/hd-wallet.d.ts +2 -0
  486. package/types-legacy/ts4.5/utils/jwt.d.ts +53 -0
  487. package/types-legacy/ts4.5/utils/keystore.d.ts +6 -2
  488. package/types-legacy/ts4.5/utils/wrap-proxy.d.ts +2 -0
  489. package/es/tx/builder/field-types/deposit.d.ts +0 -15
  490. package/es/tx/builder/field-types/deposit.mjs +0 -18
  491. package/es/tx/builder/field-types/deposit.mjs.map +0 -1
  492. package/src/tx/builder/field-types/deposit.ts +0 -23
  493. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +0 -15
  494. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +0 -15
@@ -3,14 +3,16 @@ const {
3
3
  Buffer: _Buffer
4
4
  } = _buffer;
5
5
  import AccountBase from "./Base.mjs";
6
- import { generateKeyPairFromSecret, sign, generateKeyPair, hash, messageToHash } from "../utils/crypto.mjs";
7
- import { ArgumentError } from "../utils/errors.mjs";
6
+ import { generateKeyPairFromSecret, sign, generateKeyPair, hash, messageToHash, messagePrefixLength } from "../utils/crypto.mjs";
7
+ import { ArgumentError, UnexpectedTsError } from "../utils/errors.mjs";
8
8
  import { decode, encode, Encoding } from "../utils/encoder.mjs";
9
9
  import { concatBuffers } from "../utils/other.mjs";
10
10
  import { hashTypedData } from "../utils/typed-data.mjs";
11
11
  import { buildTx } from "../tx/builder/index.mjs";
12
- import { Tag } from "../tx/builder/constants.mjs";
12
+ import { Tag, ConsensusProtocolVersion } from "../tx/builder/constants.mjs";
13
13
  import { produceNameId } from "../tx/builder/helpers.mjs";
14
+ import { DelegationTag } from "../tx/builder/delegation/schema.mjs";
15
+ import { packDelegation } from "../tx/builder/delegation/index.mjs";
14
16
  const secretKeys = new WeakMap();
15
17
  export function getBufferToSign(transaction, networkId, innerTx) {
16
18
  const prefixes = [networkId];
@@ -33,7 +35,7 @@ export default class AccountMemory extends AccountBase {
33
35
  throw new ArgumentError('secretKey', '64 bytes', secretKey.length);
34
36
  }
35
37
  secretKeys.set(this, secretKey);
36
- this.address = encode(generateKeyPairFromSecret(secretKeys.get(this)).publicKey, Encoding.AccountAddress);
38
+ this.address = encode(generateKeyPairFromSecret(secretKey).publicKey, Encoding.AccountAddress);
37
39
  }
38
40
 
39
41
  /**
@@ -45,14 +47,15 @@ export default class AccountMemory extends AccountBase {
45
47
 
46
48
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
49
  async sign(data, options) {
48
- return sign(data, secretKeys.get(this));
50
+ const secretKey = secretKeys.get(this);
51
+ if (secretKey == null) throw new UnexpectedTsError();
52
+ return sign(data, secretKey);
49
53
  }
50
- async signTransaction(transaction) {
51
- let {
52
- innerTx,
53
- networkId,
54
- ...options
55
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
54
+ async signTransaction(transaction, {
55
+ innerTx,
56
+ networkId,
57
+ ...options
58
+ } = {}) {
56
59
  if (networkId == null) {
57
60
  throw new ArgumentError('networkId', 'provided', networkId);
58
61
  }
@@ -68,14 +71,13 @@ export default class AccountMemory extends AccountBase {
68
71
  async signMessage(message, options) {
69
72
  return this.sign(messageToHash(message), options);
70
73
  }
71
- async signTypedData(data, aci) {
72
- let {
73
- name,
74
- version,
75
- networkId,
76
- contractAddress,
77
- ...options
78
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
74
+ async signTypedData(data, aci, {
75
+ name,
76
+ version,
77
+ networkId,
78
+ contractAddress,
79
+ ...options
80
+ } = {}) {
79
81
  const dHash = hashTypedData(data, aci, {
80
82
  name,
81
83
  version,
@@ -85,28 +87,83 @@ export default class AccountMemory extends AccountBase {
85
87
  const signature = await this.sign(dHash, options);
86
88
  return encode(signature, Encoding.Signature);
87
89
  }
88
- async signDelegationToContract(contractAddress) {
89
- let {
90
- networkId
91
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
90
+ async signDelegationToContract(contractAddress, {
91
+ networkId,
92
+ consensusProtocolVersion,
93
+ isOracle
94
+ } = {}) {
95
+ if (isOracle == null) {
96
+ const protocol = consensusProtocolVersion != null ? ConsensusProtocolVersion[consensusProtocolVersion] : 'unknown';
97
+ console.warn(`AccountMemory:signDelegationToContract: isOracle is not set. By default, sdk would generate an AENS preclaim delegation signature, but it won't be the same as the oracle delegation signature in Ceres (current protocol is ${protocol}).`);
98
+ }
99
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
100
+ const delegation = packDelegation({
101
+ tag: isOracle === true ? DelegationTag.Oracle : DelegationTag.AensPreclaim,
102
+ accountAddress: this.address,
103
+ contractAddress
104
+ });
105
+ return this.signDelegation(delegation, {
106
+ networkId
107
+ });
108
+ }
92
109
  if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
93
110
  const payload = concatBuffers([_Buffer.from(networkId), decode(this.address), decode(contractAddress)]);
94
111
  const signature = await this.sign(payload);
95
112
  return encode(signature, Encoding.Signature);
96
113
  }
97
- async signNameDelegationToContract(contractAddress, name) {
98
- let {
99
- networkId
100
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
114
+ async signNameDelegationToContract(contractAddress, name, {
115
+ networkId,
116
+ consensusProtocolVersion
117
+ } = {}) {
118
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
119
+ const delegation = packDelegation({
120
+ tag: DelegationTag.AensName,
121
+ accountAddress: this.address,
122
+ contractAddress,
123
+ nameId: name
124
+ });
125
+ return this.signDelegation(delegation, {
126
+ networkId
127
+ });
128
+ }
101
129
  if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
102
130
  const payload = concatBuffers([_Buffer.from(networkId), decode(this.address), decode(produceNameId(name)), decode(contractAddress)]);
103
131
  const signature = await this.sign(payload);
104
132
  return encode(signature, Encoding.Signature);
105
133
  }
106
- async signOracleQueryDelegationToContract(contractAddress, oracleQueryId) {
107
- let {
108
- networkId
109
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
134
+ async signAllNamesDelegationToContract(contractAddress, {
135
+ networkId,
136
+ consensusProtocolVersion
137
+ } = {}) {
138
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
139
+ const delegation = packDelegation({
140
+ tag: DelegationTag.AensWildcard,
141
+ accountAddress: this.address,
142
+ contractAddress
143
+ });
144
+ return this.signDelegation(delegation, {
145
+ networkId
146
+ });
147
+ }
148
+ if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
149
+ const payload = concatBuffers([_Buffer.from(networkId), decode(this.address), _Buffer.from('AENS'), decode(contractAddress)]);
150
+ const signature = await this.sign(payload);
151
+ return encode(signature, Encoding.Signature);
152
+ }
153
+ async signOracleQueryDelegationToContract(contractAddress, oracleQueryId, {
154
+ networkId,
155
+ consensusProtocolVersion
156
+ } = {}) {
157
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
158
+ const delegation = packDelegation({
159
+ tag: DelegationTag.OracleResponse,
160
+ queryId: oracleQueryId,
161
+ contractAddress
162
+ });
163
+ return this.signDelegation(delegation, {
164
+ networkId
165
+ });
166
+ }
110
167
  const oracleQueryIdDecoded = decode(oracleQueryId);
111
168
  const addressDecoded = decode(this.address);
112
169
  // TODO: remove after fixing https://github.com/aeternity/aesophia/issues/475
@@ -118,5 +175,13 @@ export default class AccountMemory extends AccountBase {
118
175
  const signature = await this.sign(payload);
119
176
  return encode(signature, Encoding.Signature);
120
177
  }
178
+ async signDelegation(delegation, {
179
+ networkId
180
+ } = {}) {
181
+ if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
182
+ const payload = concatBuffers([messagePrefixLength, new Uint8Array([1]), _Buffer.from(networkId), decode(delegation)]);
183
+ const signature = await this.sign(payload);
184
+ return encode(signature, Encoding.Signature);
185
+ }
121
186
  }
122
187
  //# sourceMappingURL=Memory.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Memory.mjs","names":["AccountBase","generateKeyPairFromSecret","sign","generateKeyPair","hash","messageToHash","ArgumentError","decode","encode","Encoding","concatBuffers","hashTypedData","buildTx","Tag","produceNameId","secretKeys","WeakMap","getBufferToSign","transaction","networkId","innerTx","prefixes","push","rlpBinaryTx","_Buffer","from","join","AccountMemory","constructor","secretKey","length","set","address","get","publicKey","AccountAddress","generate","data","options","signTransaction","arguments","undefined","txWithNetworkId","signatures","tag","SignedTx","encodedTx","signMessage","message","signTypedData","aci","name","version","contractAddress","dHash","signature","Signature","signDelegationToContract","payload","signNameDelegationToContract","signOracleQueryDelegationToContract","oracleQueryId","oracleQueryIdDecoded","addressDecoded","compare"],"sources":["../../src/account/Memory.ts"],"sourcesContent":["import AccountBase from './Base';\nimport {\n generateKeyPairFromSecret, sign, generateKeyPair, hash, messageToHash,\n} from '../utils/crypto';\nimport { ArgumentError } from '../utils/errors';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../utils/encoder';\nimport { concatBuffers } from '../utils/other';\nimport { hashTypedData, AciValue } from '../utils/typed-data';\nimport { buildTx } from '../tx/builder';\nimport { Tag, AensName } from '../tx/builder/constants';\nimport { produceNameId } from '../tx/builder/helpers';\n\nconst secretKeys = new WeakMap();\n\nexport function getBufferToSign(\n transaction: Encoded.Transaction,\n networkId: string,\n innerTx: boolean,\n): Uint8Array {\n const prefixes = [networkId];\n if (innerTx) prefixes.push('inner_tx');\n const rlpBinaryTx = decode(transaction);\n return concatBuffers([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)]);\n}\n\n/**\n * In-memory account class\n */\nexport default class AccountMemory extends AccountBase {\n override readonly address: Encoded.AccountAddress;\n\n /**\n * @param secretKey - Secret key\n */\n constructor(secretKey: string | Uint8Array) {\n super();\n secretKey = typeof secretKey === 'string' ? Buffer.from(secretKey, 'hex') : secretKey;\n if (secretKey.length !== 64) {\n throw new ArgumentError('secretKey', '64 bytes', secretKey.length);\n }\n secretKeys.set(this, secretKey);\n this.address = encode(\n generateKeyPairFromSecret(secretKeys.get(this)).publicKey,\n Encoding.AccountAddress,\n );\n }\n\n /**\n * Generates a new AccountMemory using a random secret key\n */\n static generate(): AccountMemory {\n return new AccountMemory(generateKeyPair().secretKey);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n override async sign(data: string | Uint8Array, options?: any): Promise<Uint8Array> {\n return sign(data, secretKeys.get(this));\n }\n\n override async signTransaction(\n transaction: Encoded.Transaction,\n { innerTx, networkId, ...options }: { innerTx?: boolean; networkId?: string } = {},\n ): Promise<Encoded.Transaction> {\n if (networkId == null) {\n throw new ArgumentError('networkId', 'provided', networkId);\n }\n const rlpBinaryTx = decode(transaction);\n const txWithNetworkId = getBufferToSign(transaction, networkId, innerTx === true);\n\n const signatures = [await this.sign(txWithNetworkId, options)];\n return buildTx({ tag: Tag.SignedTx, encodedTx: rlpBinaryTx, signatures });\n }\n\n override async signMessage(message: string, options?: any): Promise<Uint8Array> {\n return this.sign(messageToHash(message), options);\n }\n\n override async signTypedData(\n data: Encoded.ContractBytearray,\n aci: AciValue,\n {\n name, version, networkId, contractAddress, ...options\n }: Parameters<AccountBase['signTypedData']>[2] = {},\n ): Promise<Encoded.Signature> {\n const dHash = hashTypedData(data, aci, {\n name, version, networkId, contractAddress,\n });\n const signature = await this.sign(dHash, options);\n return encode(signature, Encoding.Signature);\n }\n\n override async signDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n { networkId }: { networkId?: string } = {},\n ): Promise<Encoded.Signature> {\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n decode(this.address),\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n\n override async signNameDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n name: AensName,\n { networkId }: { networkId?: string } = {},\n ): Promise<Encoded.Signature> {\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n decode(this.address),\n decode(produceNameId(name)),\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n\n override async signOracleQueryDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n oracleQueryId: Encoded.OracleQueryId,\n { networkId }: { networkId?: string } = {},\n ): Promise<Encoded.Signature> {\n const oracleQueryIdDecoded = decode(oracleQueryId);\n const addressDecoded = decode(this.address);\n // TODO: remove after fixing https://github.com/aeternity/aesophia/issues/475\n if (oracleQueryIdDecoded.compare(addressDecoded) === 0) {\n throw new ArgumentError('oracleQueryId', 'not equal to account address', oracleQueryId);\n }\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n oracleQueryIdDecoded,\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n}\n"],"mappings":";;;;OAAOA,WAAW;AAAA,SAEhBC,yBAAyB,EAAEC,IAAI,EAAEC,eAAe,EAAEC,IAAI,EAAEC,aAAa;AAAA,SAE9DC,aAAa;AAAA,SAEpBC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,aAAa;AAAA,SACbC,aAAa;AAAA,SACbC,OAAO;AAAA,SACPC,GAAG;AAAA,SACHC,aAAa;AAEtB,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAAC,CAAC;AAEhC,OAAO,SAASC,eAAeA,CAC7BC,WAAgC,EAChCC,SAAiB,EACjBC,OAAgB,EACJ;EACZ,MAAMC,QAAQ,GAAG,CAACF,SAAS,CAAC;EAC5B,IAAIC,OAAO,EAAEC,QAAQ,CAACC,IAAI,CAAC,UAAU,CAAC;EACtC,MAAMC,WAAW,GAAGhB,MAAM,CAACW,WAAW,CAAC;EACvC,OAAOR,aAAa,CAAC,CAACc,OAAA,CAAOC,IAAI,CAACJ,QAAQ,CAACK,IAAI,CAAC,GAAG,CAAC,CAAC,EAAEtB,IAAI,CAACmB,WAAW,CAAC,CAAC,CAAC;AAC5E;;AAEA;AACA;AACA;AACA,eAAe,MAAMI,aAAa,SAAS3B,WAAW,CAAC;EAGrD;AACF;AACA;EACE4B,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,OAAO,CAAC;IAC3C;IACA,IAAI8B,oBAAoB,CAACE,OAAO,CAACD,cAAc,CAAC,KAAK,CAAC,EAAE;MACtD,MAAM,IAAIzD,aAAa,CAAC,eAAe,EAAE,8BAA8B,EAAEuD,aAAa,CAAC;IACzF;IACA,IAAI1C,SAAS,IAAI,IAAI,EAAE,MAAM,IAAIb,aAAa,CAAC,WAAW,EAAE,UAAU,EAAEa,SAAS,CAAC;IAClF,MAAMuC,OAAO,GAAGhD,aAAa,CAAC,CAC5Bc,OAAA,CAAOC,IAAI,CAACN,SAAS,CAAC,EACtB2C,oBAAoB,EACpBvD,MAAM,CAAC8C,eAAe,CAAC,CACxB,CAAC;IACF,MAAME,SAAS,GAAG,MAAM,IAAI,CAACrD,IAAI,CAACwD,OAAO,CAAC;IAC1C,OAAOlD,MAAM,CAAC+C,SAAS,EAAE9C,QAAQ,CAAC+C,SAAS,CAAC;EAC9C;AACF"}
1
+ {"version":3,"file":"Memory.mjs","names":["AccountBase","generateKeyPairFromSecret","sign","generateKeyPair","hash","messageToHash","messagePrefixLength","ArgumentError","UnexpectedTsError","decode","encode","Encoding","concatBuffers","hashTypedData","buildTx","Tag","ConsensusProtocolVersion","produceNameId","DelegationTag","packDelegation","secretKeys","WeakMap","getBufferToSign","transaction","networkId","innerTx","prefixes","push","rlpBinaryTx","_Buffer","from","join","AccountMemory","constructor","secretKey","length","set","address","publicKey","AccountAddress","generate","data","options","get","signTransaction","txWithNetworkId","signatures","tag","SignedTx","encodedTx","signMessage","message","signTypedData","aci","name","version","contractAddress","dHash","signature","Signature","signDelegationToContract","consensusProtocolVersion","isOracle","protocol","console","warn","Ceres","delegation","Oracle","AensPreclaim","accountAddress","signDelegation","payload","signNameDelegationToContract","AensName","nameId","signAllNamesDelegationToContract","AensWildcard","signOracleQueryDelegationToContract","oracleQueryId","OracleResponse","queryId","oracleQueryIdDecoded","addressDecoded","compare","Uint8Array"],"sources":["../../src/account/Memory.ts"],"sourcesContent":["import AccountBase from './Base';\nimport {\n generateKeyPairFromSecret, sign, generateKeyPair, hash, messageToHash, messagePrefixLength,\n} from '../utils/crypto';\nimport { ArgumentError, UnexpectedTsError } from '../utils/errors';\nimport {\n decode, encode, Encoded, Encoding,\n} from '../utils/encoder';\nimport { concatBuffers } from '../utils/other';\nimport { hashTypedData, AciValue } from '../utils/typed-data';\nimport { buildTx } from '../tx/builder';\nimport { Tag, AensName, ConsensusProtocolVersion } from '../tx/builder/constants';\nimport { produceNameId } from '../tx/builder/helpers';\nimport { DelegationTag } from '../tx/builder/delegation/schema';\nimport { packDelegation } from '../tx/builder/delegation';\n\nconst secretKeys = new WeakMap<AccountMemory, Uint8Array>();\n\nexport function getBufferToSign(\n transaction: Encoded.Transaction,\n networkId: string,\n innerTx: boolean,\n): Uint8Array {\n const prefixes = [networkId];\n if (innerTx) prefixes.push('inner_tx');\n const rlpBinaryTx = decode(transaction);\n return concatBuffers([Buffer.from(prefixes.join('-')), hash(rlpBinaryTx)]);\n}\n\n/**\n * In-memory account class\n */\nexport default class AccountMemory extends AccountBase {\n override readonly address: Encoded.AccountAddress;\n\n /**\n * @param secretKey - Secret key\n */\n constructor(secretKey: string | Uint8Array) {\n super();\n secretKey = typeof secretKey === 'string' ? Buffer.from(secretKey, 'hex') : secretKey;\n if (secretKey.length !== 64) {\n throw new ArgumentError('secretKey', '64 bytes', secretKey.length);\n }\n secretKeys.set(this, secretKey);\n this.address = encode(\n generateKeyPairFromSecret(secretKey).publicKey,\n Encoding.AccountAddress,\n );\n }\n\n /**\n * Generates a new AccountMemory using a random secret key\n */\n static generate(): AccountMemory {\n return new AccountMemory(generateKeyPair().secretKey);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n override async sign(data: string | Uint8Array, options?: any): Promise<Uint8Array> {\n const secretKey = secretKeys.get(this);\n if (secretKey == null) throw new UnexpectedTsError();\n return sign(data, secretKey);\n }\n\n override async signTransaction(\n transaction: Encoded.Transaction,\n { innerTx, networkId, ...options }: { innerTx?: boolean; networkId?: string } = {},\n ): Promise<Encoded.Transaction> {\n if (networkId == null) {\n throw new ArgumentError('networkId', 'provided', networkId);\n }\n const rlpBinaryTx = decode(transaction);\n const txWithNetworkId = getBufferToSign(transaction, networkId, innerTx === true);\n\n const signatures = [await this.sign(txWithNetworkId, options)];\n return buildTx({ tag: Tag.SignedTx, encodedTx: rlpBinaryTx, signatures });\n }\n\n override async signMessage(message: string, options?: any): Promise<Uint8Array> {\n return this.sign(messageToHash(message), options);\n }\n\n override async signTypedData(\n data: Encoded.ContractBytearray,\n aci: AciValue,\n {\n name, version, networkId, contractAddress, ...options\n }: Parameters<AccountBase['signTypedData']>[2] = {},\n ): Promise<Encoded.Signature> {\n const dHash = hashTypedData(data, aci, {\n name, version, networkId, contractAddress,\n });\n const signature = await this.sign(dHash, options);\n return encode(signature, Encoding.Signature);\n }\n\n override async signDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n { networkId, consensusProtocolVersion, isOracle }: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n isOracle?: boolean;\n } = {},\n ): Promise<Encoded.Signature> {\n if (isOracle == null) {\n const protocol = (consensusProtocolVersion != null) ? ConsensusProtocolVersion[consensusProtocolVersion] : 'unknown';\n console.warn(`AccountMemory:signDelegationToContract: isOracle is not set. By default, sdk would generate an AENS preclaim delegation signature, but it won't be the same as the oracle delegation signature in Ceres (current protocol is ${protocol}).`);\n }\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: isOracle === true ? DelegationTag.Oracle : DelegationTag.AensPreclaim,\n accountAddress: this.address,\n contractAddress,\n });\n return this.signDelegation(delegation, { networkId });\n }\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n decode(this.address),\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n\n override async signNameDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n name: AensName,\n { networkId, consensusProtocolVersion }: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n } = {},\n ): Promise<Encoded.Signature> {\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: DelegationTag.AensName, accountAddress: this.address, contractAddress, nameId: name,\n });\n return this.signDelegation(delegation, { networkId });\n }\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n decode(this.address),\n decode(produceNameId(name)),\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n\n override async signAllNamesDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n { networkId, consensusProtocolVersion }: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n } = {},\n ): Promise<Encoded.Signature> {\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: DelegationTag.AensWildcard, accountAddress: this.address, contractAddress,\n });\n return this.signDelegation(delegation, { networkId });\n }\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n decode(this.address),\n Buffer.from('AENS'),\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n\n override async signOracleQueryDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n oracleQueryId: Encoded.OracleQueryId,\n { networkId, consensusProtocolVersion }: {\n networkId?: string;\n consensusProtocolVersion?: ConsensusProtocolVersion;\n } = {},\n ): Promise<Encoded.Signature> {\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: DelegationTag.OracleResponse, queryId: oracleQueryId, contractAddress,\n });\n return this.signDelegation(delegation, { networkId });\n }\n const oracleQueryIdDecoded = decode(oracleQueryId);\n const addressDecoded = decode(this.address);\n // TODO: remove after fixing https://github.com/aeternity/aesophia/issues/475\n if (oracleQueryIdDecoded.compare(addressDecoded) === 0) {\n throw new ArgumentError('oracleQueryId', 'not equal to account address', oracleQueryId);\n }\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n Buffer.from(networkId),\n oracleQueryIdDecoded,\n decode(contractAddress),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n\n override async signDelegation(\n delegation: Encoded.Bytearray,\n { networkId }: { networkId?: string } = {},\n ): Promise<Encoded.Signature> {\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const payload = concatBuffers([\n messagePrefixLength, new Uint8Array([1]), Buffer.from(networkId), decode(delegation),\n ]);\n const signature = await this.sign(payload);\n return encode(signature, Encoding.Signature);\n }\n}\n"],"mappings":";;;;OAAOA,WAAW;AAAA,SAEhBC,yBAAyB,EAAEC,IAAI,EAAEC,eAAe,EAAEC,IAAI,EAAEC,aAAa,EAAEC,mBAAmB;AAAA,SAEnFC,aAAa,EAAEC,iBAAiB;AAAA,SAEvCC,MAAM,EAAEC,MAAM,EAAWC,QAAQ;AAAA,SAE1BC,aAAa;AAAA,SACbC,aAAa;AAAA,SACbC,OAAO;AAAA,SACPC,GAAG,EAAYC,wBAAwB;AAAA,SACvCC,aAAa;AAAA,SACbC,aAAa;AAAA,SACbC,cAAc;AAEvB,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAA4B,CAAC;AAE3D,OAAO,SAASC,eAAeA,CAC7BC,WAAgC,EAChCC,SAAiB,EACjBC,OAAgB,EACJ;EACZ,MAAMC,QAAQ,GAAG,CAACF,SAAS,CAAC;EAC5B,IAAIC,OAAO,EAAEC,QAAQ,CAACC,IAAI,CAAC,UAAU,CAAC;EACtC,MAAMC,WAAW,GAAGnB,MAAM,CAACc,WAAW,CAAC;EACvC,OAAOX,aAAa,CAAC,CAACiB,OAAA,CAAOC,IAAI,CAACJ,QAAQ,CAACK,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE3B,IAAI,CAACwB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C3BJ,UAA6B,EAC7B;IAAE3C;EAAkC,CAAC,GAAG,CAAC,CAAC,EACd;IAC5B,IAAIA,SAAS,IAAI,IAAI,EAAE,MAAM,IAAIjB,aAAa,CAAC,WAAW,EAAE,UAAU,EAAEiB,SAAS,CAAC;IAClF,MAAMgD,OAAO,GAAG5D,aAAa,CAAC,CAC5BN,mBAAmB,EAAE,IAAI+E,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAExD,OAAA,CAAOC,IAAI,CAACN,SAAS,CAAC,EAAEf,MAAM,CAAC0D,UAAU,CAAC,CACrF,CAAC;IACF,MAAMT,SAAS,GAAG,MAAM,IAAI,CAACxD,IAAI,CAACsE,OAAO,CAAC;IAC1C,OAAO9D,MAAM,CAACgD,SAAS,EAAE/C,QAAQ,CAACgD,SAAS,CAAC;EAC9C;AACF"}
@@ -2,7 +2,7 @@ import AccountBase from './Base';
2
2
  import { Encoded } from '../utils/encoder';
3
3
  import RpcClient from '../aepp-wallet-communication/rpc/RpcClient';
4
4
  import { AeppApi, WalletApi } from '../aepp-wallet-communication/rpc/types';
5
- import { AensName } from '../tx/builder/constants';
5
+ import { AensName, ConsensusProtocolVersion } from '../tx/builder/constants';
6
6
  /**
7
7
  * Account provided by wallet
8
8
  * @param params - Params
@@ -14,11 +14,22 @@ export default class AccountRpc extends AccountBase {
14
14
  _rpcClient: RpcClient<WalletApi, AeppApi>;
15
15
  readonly address: Encoded.AccountAddress;
16
16
  constructor(rpcClient: RpcClient<WalletApi, AeppApi>, address: Encoded.AccountAddress);
17
- sign(): Promise<Uint8Array>;
17
+ sign(dataRaw: string | Uint8Array): Promise<Uint8Array>;
18
18
  signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
19
19
  signMessage(message: string): Promise<Uint8Array>;
20
20
  signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { name, version, contractAddress, networkId, }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
21
- signDelegationToContract(contractAddress: Encoded.ContractAddress): Promise<Encoded.Signature>;
22
- signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName): Promise<Encoded.Signature>;
23
- signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId): Promise<Encoded.Signature>;
21
+ signDelegationToContract(contractAddress: Encoded.ContractAddress, { consensusProtocolVersion, isOracle }?: {
22
+ consensusProtocolVersion?: ConsensusProtocolVersion;
23
+ isOracle?: boolean;
24
+ }): Promise<Encoded.Signature>;
25
+ signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { consensusProtocolVersion }?: {
26
+ consensusProtocolVersion?: ConsensusProtocolVersion;
27
+ }): Promise<Encoded.Signature>;
28
+ signAllNamesDelegationToContract(contractAddress: Encoded.ContractAddress, { consensusProtocolVersion }?: {
29
+ consensusProtocolVersion?: ConsensusProtocolVersion;
30
+ }): Promise<Encoded.Signature>;
31
+ signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { consensusProtocolVersion }?: {
32
+ consensusProtocolVersion?: ConsensusProtocolVersion;
33
+ }): Promise<Encoded.Signature>;
34
+ signDelegation(delegation: Encoded.Bytearray): Promise<Encoded.Signature>;
24
35
  }
@@ -4,7 +4,11 @@ const {
4
4
  } = _buffer;
5
5
  import AccountBase from "./Base.mjs";
6
6
  import { METHODS } from "../aepp-wallet-communication/schema.mjs";
7
- import { ArgumentError, NotImplementedError, UnsupportedProtocolError } from "../utils/errors.mjs";
7
+ import { ArgumentError, UnsupportedProtocolError } from "../utils/errors.mjs";
8
+ import { Encoding, decode, encode } from "../utils/encoder.mjs";
9
+ import { ConsensusProtocolVersion } from "../tx/builder/constants.mjs";
10
+ import { packDelegation } from "../tx/builder/delegation/index.mjs";
11
+ import { DelegationTag } from "../tx/builder/delegation/schema.mjs";
8
12
  /**
9
13
  * Account provided by wallet
10
14
  * @param params - Params
@@ -18,16 +22,20 @@ export default class AccountRpc extends AccountBase {
18
22
  this._rpcClient = rpcClient;
19
23
  this.address = address;
20
24
  }
21
-
22
- // eslint-disable-next-line class-methods-use-this
23
- async sign() {
24
- throw new NotImplementedError('RAW signing using wallet');
25
+ async sign(dataRaw) {
26
+ const data = encode(_Buffer.from(dataRaw), Encoding.Bytearray);
27
+ const {
28
+ signature
29
+ } = await this._rpcClient.request(METHODS.unsafeSign, {
30
+ onAccount: this.address,
31
+ data
32
+ });
33
+ return decode(signature);
25
34
  }
26
- async signTransaction(tx) {
27
- let {
28
- innerTx,
29
- networkId
30
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
35
+ async signTransaction(tx, {
36
+ innerTx,
37
+ networkId
38
+ } = {}) {
31
39
  if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);
32
40
  const res = await this._rpcClient.request(METHODS.sign, {
33
41
  onAccount: this.address,
@@ -50,13 +58,12 @@ export default class AccountRpc extends AccountBase {
50
58
  });
51
59
  return _Buffer.from(signature, 'hex');
52
60
  }
53
- async signTypedData(data, aci) {
54
- let {
55
- name,
56
- version,
57
- contractAddress,
58
- networkId
59
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
61
+ async signTypedData(data, aci, {
62
+ name,
63
+ version,
64
+ contractAddress,
65
+ networkId
66
+ } = {}) {
60
67
  const {
61
68
  signature
62
69
  } = await this._rpcClient.request(METHODS.signTypedData, {
@@ -72,16 +79,43 @@ export default class AccountRpc extends AccountBase {
72
79
  });
73
80
  return signature;
74
81
  }
75
- async signDelegationToContract(contractAddress) {
82
+ async signDelegationToContract(contractAddress, {
83
+ consensusProtocolVersion,
84
+ isOracle
85
+ } = {}) {
86
+ if (isOracle == null) {
87
+ const protocol = consensusProtocolVersion != null ? ConsensusProtocolVersion[consensusProtocolVersion] : 'unknown';
88
+ console.warn(`AccountRpc:signDelegationToContract: isOracle is not set. By default, sdk would generate an AENS preclaim delegation signature, but it won't be the same as the oracle delegation signature in Ceres (current protocol is ${protocol}).`);
89
+ }
90
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
91
+ const delegation = packDelegation({
92
+ tag: isOracle === true ? DelegationTag.Oracle : DelegationTag.AensPreclaim,
93
+ accountAddress: this.address,
94
+ contractAddress
95
+ });
96
+ return this.signDelegation(delegation);
97
+ }
76
98
  const {
77
99
  signature
78
100
  } = await this._rpcClient.request(METHODS.signDelegationToContract, {
79
101
  onAccount: this.address,
80
- contractAddress
102
+ contractAddress,
103
+ isOracle
81
104
  });
82
105
  return signature;
83
106
  }
84
- async signNameDelegationToContract(contractAddress, name) {
107
+ async signNameDelegationToContract(contractAddress, name, {
108
+ consensusProtocolVersion
109
+ } = {}) {
110
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
111
+ const delegation = packDelegation({
112
+ tag: DelegationTag.AensName,
113
+ accountAddress: this.address,
114
+ contractAddress,
115
+ nameId: name
116
+ });
117
+ return this.signDelegation(delegation);
118
+ }
85
119
  const {
86
120
  signature
87
121
  } = await this._rpcClient.request(METHODS.signDelegationToContract, {
@@ -91,7 +125,37 @@ export default class AccountRpc extends AccountBase {
91
125
  });
92
126
  return signature;
93
127
  }
94
- async signOracleQueryDelegationToContract(contractAddress, oracleQueryId) {
128
+ async signAllNamesDelegationToContract(contractAddress, {
129
+ consensusProtocolVersion
130
+ } = {}) {
131
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
132
+ const delegation = packDelegation({
133
+ tag: DelegationTag.AensWildcard,
134
+ accountAddress: this.address,
135
+ contractAddress
136
+ });
137
+ return this.signDelegation(delegation);
138
+ }
139
+ const {
140
+ signature
141
+ } = await this._rpcClient.request(METHODS.signDelegationToContract, {
142
+ onAccount: this.address,
143
+ contractAddress,
144
+ allNames: true
145
+ });
146
+ return signature;
147
+ }
148
+ async signOracleQueryDelegationToContract(contractAddress, oracleQueryId, {
149
+ consensusProtocolVersion
150
+ } = {}) {
151
+ if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {
152
+ const delegation = packDelegation({
153
+ tag: DelegationTag.OracleResponse,
154
+ queryId: oracleQueryId,
155
+ contractAddress
156
+ });
157
+ return this.signDelegation(delegation);
158
+ }
95
159
  const {
96
160
  signature
97
161
  } = await this._rpcClient.request(METHODS.signDelegationToContract, {
@@ -101,5 +165,14 @@ export default class AccountRpc extends AccountBase {
101
165
  });
102
166
  return signature;
103
167
  }
168
+ async signDelegation(delegation) {
169
+ const {
170
+ signature
171
+ } = await this._rpcClient.request(METHODS.signDelegation, {
172
+ delegation,
173
+ onAccount: this.address
174
+ });
175
+ return signature;
176
+ }
104
177
  }
105
178
  //# sourceMappingURL=Rpc.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Rpc.mjs","names":["AccountBase","METHODS","ArgumentError","NotImplementedError","UnsupportedProtocolError","AccountRpc","constructor","rpcClient","address","_rpcClient","sign","signTransaction","tx","innerTx","networkId","arguments","length","undefined","res","request","onAccount","returnSigned","signedTransaction","signMessage","message","signature","_Buffer","from","signTypedData","data","aci","name","version","contractAddress","domain","signDelegationToContract","signNameDelegationToContract","signOracleQueryDelegationToContract","oracleQueryId"],"sources":["../../src/account/Rpc.ts"],"sourcesContent":["import AccountBase from './Base';\nimport { METHODS } from '../aepp-wallet-communication/schema';\nimport { ArgumentError, NotImplementedError, UnsupportedProtocolError } from '../utils/errors';\nimport { Encoded } from '../utils/encoder';\nimport RpcClient from '../aepp-wallet-communication/rpc/RpcClient';\nimport { AeppApi, WalletApi } from '../aepp-wallet-communication/rpc/types';\nimport { AensName } from '../tx/builder/constants';\n\n/**\n * Account provided by wallet\n * @param params - Params\n * @param params.rpcClient - RpcClient instance\n * @param params.address - RPC account address\n * @returns AccountRpc instance\n */\nexport default class AccountRpc extends AccountBase {\n _rpcClient: RpcClient<WalletApi, AeppApi>;\n\n override readonly address: Encoded.AccountAddress;\n\n constructor(rpcClient: RpcClient<WalletApi, AeppApi>, address: Encoded.AccountAddress) {\n super();\n this._rpcClient = rpcClient;\n this.address = address;\n }\n\n // eslint-disable-next-line class-methods-use-this\n async sign(): Promise<Uint8Array> {\n throw new NotImplementedError('RAW signing using wallet');\n }\n\n override async signTransaction(\n tx: Encoded.Transaction,\n { innerTx, networkId }: Parameters<AccountBase['signTransaction']>[1] = {},\n ): Promise<Encoded.Transaction> {\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const res = await this._rpcClient.request(METHODS.sign, {\n onAccount: this.address,\n tx,\n returnSigned: true,\n networkId,\n innerTx,\n });\n if (res.signedTransaction == null) {\n throw new UnsupportedProtocolError('signedTransaction is missed in wallet response');\n }\n return res.signedTransaction;\n }\n\n override async signMessage(message: string): Promise<Uint8Array> {\n const { signature } = await this._rpcClient\n .request(METHODS.signMessage, { onAccount: this.address, message });\n return Buffer.from(signature, 'hex');\n }\n\n override async signTypedData(\n data: Encoded.ContractBytearray,\n aci: Parameters<AccountBase['signTypedData']>[1],\n {\n name, version, contractAddress, networkId,\n }: Parameters<AccountBase['signTypedData']>[2] = {},\n ): Promise<Encoded.Signature> {\n const { signature } = await this._rpcClient.request(METHODS.signTypedData, {\n onAccount: this.address,\n domain: {\n name, version, networkId, contractAddress,\n },\n aci,\n data,\n });\n return signature;\n }\n\n override async signDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n ): Promise<Encoded.Signature> {\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onAccount: this.address,\n contractAddress,\n });\n return signature;\n }\n\n override async signNameDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n name: AensName,\n ): Promise<Encoded.Signature> {\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onAccount: this.address,\n contractAddress,\n name,\n });\n return signature;\n }\n\n override async signOracleQueryDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n oracleQueryId: Encoded.OracleQueryId,\n ): Promise<Encoded.Signature> {\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onA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AAU,CAAC,GAAG,MAAM,IAAI,CAAChB,UAAU,CAACU,OAAO,CAAClB,OAAO,CAACkC,wBAAwB,EAAE;MACpFf,SAAS,EAAE,IAAI,CAACZ,OAAO;MACvByB,eAAe;MACfK;IACF,CAAC,CAAC;IACF,OAAOb,SAAS;EAClB;AACF"}
1
+ {"version":3,"file":"Rpc.mjs","names":["AccountBase","METHODS","ArgumentError","UnsupportedProtocolError","Encoding","decode","encode","ConsensusProtocolVersion","packDelegation","DelegationTag","AccountRpc","constructor","rpcClient","address","_rpcClient","sign","dataRaw","data","_Buffer","from","Bytearray","signature","request","unsafeSign","onAccount","signTransaction","tx","innerTx","networkId","res","returnSigned","signedTransaction","signMessage","message","signTypedData","aci","name","version","contractAddress","domain","signDelegationToContract","consensusProtocolVersion","isOracle","protocol","console","warn","Ceres","delegation","tag","Oracle","AensPreclaim","accountAddress","signDelegation","signNameDelegationToContract","AensName","nameId","signAllNamesDelegationToContract","AensWildcard","allNames","signOracleQueryDelegationToContract","oracleQueryId","OracleResponse","queryId"],"sources":["../../src/account/Rpc.ts"],"sourcesContent":["import AccountBase from './Base';\nimport { METHODS } from '../aepp-wallet-communication/schema';\nimport { ArgumentError, UnsupportedProtocolError } from '../utils/errors';\nimport {\n Encoded, Encoding, decode, encode,\n} from '../utils/encoder';\nimport RpcClient from '../aepp-wallet-communication/rpc/RpcClient';\nimport { AeppApi, WalletApi } from '../aepp-wallet-communication/rpc/types';\nimport { AensName, ConsensusProtocolVersion } from '../tx/builder/constants';\nimport { packDelegation } from '../tx/builder/delegation';\nimport { DelegationTag } from '../tx/builder/delegation/schema';\n\n/**\n * Account provided by wallet\n * @param params - Params\n * @param params.rpcClient - RpcClient instance\n * @param params.address - RPC account address\n * @returns AccountRpc instance\n */\nexport default class AccountRpc extends AccountBase {\n _rpcClient: RpcClient<WalletApi, AeppApi>;\n\n override readonly address: Encoded.AccountAddress;\n\n constructor(rpcClient: RpcClient<WalletApi, AeppApi>, address: Encoded.AccountAddress) {\n super();\n this._rpcClient = rpcClient;\n this.address = address;\n }\n\n async sign(dataRaw: string | Uint8Array): Promise<Uint8Array> {\n const data = encode(Buffer.from(dataRaw), Encoding.Bytearray);\n const { signature } = await this._rpcClient\n .request(METHODS.unsafeSign, { onAccount: this.address, data });\n return decode(signature);\n }\n\n override async signTransaction(\n tx: Encoded.Transaction,\n { innerTx, networkId }: Parameters<AccountBase['signTransaction']>[1] = {},\n ): Promise<Encoded.Transaction> {\n if (networkId == null) throw new ArgumentError('networkId', 'provided', networkId);\n const res = await this._rpcClient.request(METHODS.sign, {\n onAccount: this.address,\n tx,\n returnSigned: true,\n networkId,\n innerTx,\n });\n if (res.signedTransaction == null) {\n throw new UnsupportedProtocolError('signedTransaction is missed in wallet response');\n }\n return res.signedTransaction;\n }\n\n override async signMessage(message: string): Promise<Uint8Array> {\n const { signature } = await this._rpcClient\n .request(METHODS.signMessage, { onAccount: this.address, message });\n return Buffer.from(signature, 'hex');\n }\n\n override async signTypedData(\n data: Encoded.ContractBytearray,\n aci: Parameters<AccountBase['signTypedData']>[1],\n {\n name, version, contractAddress, networkId,\n }: Parameters<AccountBase['signTypedData']>[2] = {},\n ): Promise<Encoded.Signature> {\n const { signature } = await this._rpcClient.request(METHODS.signTypedData, {\n onAccount: this.address,\n domain: {\n name, version, networkId, contractAddress,\n },\n aci,\n data,\n });\n return signature;\n }\n\n override async signDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n { consensusProtocolVersion, isOracle }: {\n consensusProtocolVersion?: ConsensusProtocolVersion;\n isOracle?: boolean;\n } = {},\n ): Promise<Encoded.Signature> {\n if (isOracle == null) {\n const protocol = (consensusProtocolVersion != null) ? ConsensusProtocolVersion[consensusProtocolVersion] : 'unknown';\n console.warn(`AccountRpc:signDelegationToContract: isOracle is not set. By default, sdk would generate an AENS preclaim delegation signature, but it won't be the same as the oracle delegation signature in Ceres (current protocol is ${protocol}).`);\n }\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: isOracle === true ? DelegationTag.Oracle : DelegationTag.AensPreclaim,\n accountAddress: this.address,\n contractAddress,\n });\n return this.signDelegation(delegation);\n }\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onAccount: this.address,\n contractAddress,\n isOracle,\n });\n return signature;\n }\n\n override async signNameDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n name: AensName,\n { consensusProtocolVersion }: { consensusProtocolVersion?: ConsensusProtocolVersion } = {},\n ): Promise<Encoded.Signature> {\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: DelegationTag.AensName, accountAddress: this.address, contractAddress, nameId: name,\n });\n return this.signDelegation(delegation);\n }\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onAccount: this.address,\n contractAddress,\n name,\n });\n return signature;\n }\n\n override async signAllNamesDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n { consensusProtocolVersion }: { consensusProtocolVersion?: ConsensusProtocolVersion } = {},\n ): Promise<Encoded.Signature> {\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: DelegationTag.AensWildcard, accountAddress: this.address, contractAddress,\n });\n return this.signDelegation(delegation);\n }\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onAccount: this.address,\n contractAddress,\n allNames: true,\n });\n return signature;\n }\n\n override async signOracleQueryDelegationToContract(\n contractAddress: Encoded.ContractAddress,\n oracleQueryId: Encoded.OracleQueryId,\n { consensusProtocolVersion }: { consensusProtocolVersion?: ConsensusProtocolVersion } = {},\n ): Promise<Encoded.Signature> {\n if (consensusProtocolVersion === ConsensusProtocolVersion.Ceres) {\n const delegation = packDelegation({\n tag: DelegationTag.OracleResponse, queryId: oracleQueryId, contractAddress,\n });\n return this.signDelegation(delegation);\n }\n const { signature } = await this._rpcClient.request(METHODS.signDelegationToContract, {\n onAccount: this.address,\n contractAddress,\n oracleQueryId,\n });\n return signature;\n }\n\n override async signDelegation(delegation: Encoded.Bytearray): Promise<Encoded.Signature> {\n const { signature } = await this._rpcClient.request(\n METHODS.signDelegation,\n { delegation, onAccount: this.address },\n );\n return signature;\n }\n}\n"],"mappings":";;;;OAAOA,WAAW;AAAA,SACTC,OAAO;AAAA,SACPC,aAAa,EAAEC,wBAAwB;AAAA,SAErCC,QAAQ,EAAEC,MAAM,EAAEC,MAAM;AAAA,SAIhBC,wBAAwB;AAAA,SAClCC,cAAc;AAAA,SACdC,aAAa;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,MAAMC,UAAU,SAASV,WAAW,CAAC;EAKlDW,WAAWA,CAACC,SAAwC,EAAEC,OAA+B,EAAE;IACrF,KAAK,CAAC,CAAC;IACP,IAAI,CAACC,UAAU,GAAGF,SAAS;IAC3B,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;EAEA,MAAME,IAAIA,CAACC,OAA4B,EAAuB;IAC5D,MAAMC,IAAI,GAAGX,MAAM,CAACY,OAAA,CAAOC,IAAI,CAACH,OAAO,CAAC,EAAEZ,QAAQ,CAACgB,SAAS,CAAC;IAC7D,MAAM;MAAEC;IAAU,CAAC,GAAG,MAAM,IAAI,CAACP,UAAU,CACxCQ,OAAO,CAACrB,OAAO,CAACsB,UAAU,EAAE;MAAEC,SAAS,EAAE,IAAI,CAACX,OAAO;MAAEI;IAAK,CAAC,CAAC;IACjE,OAAOZ,MAAM,CAACgB,SAAS,CAAC;EAC1B;EAEA,MAAeI,eAAeA,CAC5BC,EAAuB,EACvB;IAAEC,OAAO;IAAEC;EAAyD,CAAC,GAAG,CAAC,CAAC,EAC5C;IAC9B,IAAIA,SAAS,IAAI,IAAI,EAAE,MAAM,IAAI1B,aAAa,CAAC,WAAW,EAAE,UAAU,EAAE0B,SAAS,CAAC;IAClF,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACf,UAAU,CAACQ,OAAO,CAACrB,OAAO,CAACc,IAAI,EAAE;MACtDS,SAAS,EAAE,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S,EAAE,IAAI,CAACX;IAAQ,CACxC,CAAC;IACD,OAAOQ,SAAS;EAClB;AACF"}
package/es/aens.d.ts CHANGED
@@ -7,26 +7,22 @@
7
7
  */
8
8
  import BigNumber from 'bignumber.js';
9
9
  import { Tag, AensName } from './tx/builder/constants';
10
- import { Encoded } from './utils/encoder';
11
- import { sendTransaction, SendTransactionOptions, getName } from './chain';
10
+ import { Encoded, Encoding } from './utils/encoder';
11
+ import { getName } from './chain';
12
+ import { sendTransaction, SendTransactionOptions } from './send-transaction';
12
13
  import { BuildTxOptions } from './tx/builder';
13
14
  import { TransformNodeType } from './Node';
14
15
  import { NameEntry, NamePointer } from './apis/node';
15
16
  import AccountBase from './account/Base';
16
17
  import { AddressEncodings } from './tx/builder/field-types/address';
17
18
  interface KeyPointers {
18
- [key: string]: Encoded.Generic<AddressEncodings>;
19
+ [key: string]: Encoded.Generic<AddressEncodings | Encoding.Bytearray>;
19
20
  }
20
21
  /**
21
22
  * Revoke a name
22
23
  * @category AENS
23
24
  * @param name - Name hash
24
25
  * @param options - Options
25
- * @param options.onAccount - Make operation on specific account from sdk (you pass
26
- * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
27
- * @param options.fee - fee
28
- * @param options.ttl - ttl
29
- * @param options.nonce - nonce
30
26
  * @returns Transaction result
31
27
  * @example
32
28
  * ```js
@@ -47,17 +43,6 @@ interface AensRevokeOptions extends BuildTxOptions<Tag.NameRevokeTx, 'nameId' |
47
43
  * @param name - AENS name
48
44
  * @param pointers - Map of pointer keys to corresponding addresses
49
45
  * @param options - Options
50
- * @param options.extendPointers - Get the pointers from the node and merge with provided
51
- * ones. Pointers with the same type will be overwritten
52
- * @param options.onAccount - Make operation on specific account from sdk (you
53
- * pass publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
54
- * @param options.fee - fee
55
- * @param options.ttl - ttl
56
- * @param options.nonce - nonce
57
- * @param options.nameTtl - Name ttl represented in number of
58
- * blocks (Max value is 50000 blocks)
59
- * @param options.clientTtl=84600 a suggestion as to how long any
60
- * clients should cache this information
61
46
  * @throws Invalid pointer array error
62
47
  * @example
63
48
  * ```js
@@ -72,8 +57,18 @@ interface AensRevokeOptions extends BuildTxOptions<Tag.NameRevokeTx, 'nameId' |
72
57
  */
73
58
  export declare function aensUpdate(name: AensName, pointers: KeyPointers, { extendPointers, ...options }: AensUpdateOptions): ReturnType<typeof sendTransaction>;
74
59
  interface AensUpdateOptions extends BuildTxOptions<Tag.NameUpdateTx, 'nameId' | 'accountId' | 'pointers' | 'clientTtl' | 'nameTtl' | 'onNode'>, SendTransactionOptions {
60
+ /**
61
+ * Get the pointers from the node and merge with provided ones. Pointers with the same key will be
62
+ * overwritten.
63
+ */
75
64
  extendPointers?: boolean;
65
+ /**
66
+ * a suggestion as to how long any clients should cache this information
67
+ */
76
68
  clientTtl?: number;
69
+ /**
70
+ * Name ttl represented in number of blocks (Max value is 50000 blocks)
71
+ */
77
72
  nameTtl?: number;
78
73
  }
79
74
  /**
@@ -82,11 +77,6 @@ interface AensUpdateOptions extends BuildTxOptions<Tag.NameUpdateTx, 'nameId' |
82
77
  * @param name - AENS name
83
78
  * @param account - Recipient account publick key
84
79
  * @param options - Options
85
- * @param options.onAccount - Make operation on specific account from sdk (you pass
86
- * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
87
- * @param options.fee - fee
88
- * @param options.ttl - ttl
89
- * @param options.nonce - nonce
90
80
  * @returns Transaction result
91
81
  * @example
92
82
  * ```js
@@ -108,7 +98,6 @@ interface AensTransferOptions extends BuildTxOptions<Tag.NameTransferTx, 'nameId
108
98
  * @category AENS
109
99
  * @param name - AENS name
110
100
  * @param opt - Options
111
- * @returns
112
101
  * @example
113
102
  * ```js
114
103
  * const nameObject = sdkInstance.aensQuery('test.chain')
@@ -135,22 +124,16 @@ export declare function aensQuery(name: AensName, opt: Parameters<typeof getName
135
124
  revoke: (options?: Omit<Parameters<typeof aensRevoke>[1], 'onNode' | 'onCompiler' | 'onAccount'> & {
136
125
  onAccount?: AccountBase;
137
126
  }) => ReturnType<typeof aensRevoke>;
138
- extendTtl: (nameTtl: number, options?: Omit<Parameters<typeof aensQuery>[1], 'onNode' | 'onCompiler' | 'onAccount'>) => ReturnType<typeof aensUpdate> & ReturnType<typeof aensQuery>;
127
+ extendTtl: (nameTtl?: number, options?: Omit<Parameters<typeof aensQuery>[1], 'onNode' | 'onCompiler' | 'onAccount'>) => ReturnType<typeof aensUpdate> & ReturnType<typeof aensQuery>;
139
128
  }>>;
140
129
  /**
141
130
  * Claim a previously preclaimed registration. This can only be done after the
142
131
  * preclaim step
143
132
  * @category AENS
144
133
  * @param name - AENS name
145
- * @param salt - Salt from pre-claim, or 0 if it's a bid
134
+ * @param salt - Salt from pre-claim, or 0 if it's a bid or claiming without preclaim (in Ceres)
146
135
  * @param options - options
147
- * @param options.onAccount - Make operation on specific account from sdk (you pass
148
- * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
149
- * @param options.fee - fee
150
- * @param options.ttl - ttl
151
- * @param options.nonce - nonce
152
- * @param options.nameFee - Name Fee (By default calculated by sdk)
153
- * @returns the result of the claim
136
+ * @returns Transaction result
154
137
  * @example
155
138
  * ```js
156
139
  * const name = 'test.chain'
@@ -170,11 +153,6 @@ interface AensClaimReturnType extends Awaited<ReturnType<typeof sendTransaction>
170
153
  * @category AENS
171
154
  * @param name - AENS name
172
155
  * @param options - Options
173
- * @param options.onAccount - Make operation on specific account from sdk (you pass
174
- * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
175
- * @param options.fee - fee
176
- * @param options.ttl - ttl
177
- * @param options.nonce - nonce
178
156
  * @example
179
157
  * ```js
180
158
  * const name = 'test.chain'
@@ -202,11 +180,6 @@ interface AensPreclaimOptions extends BuildTxOptions<Tag.NamePreclaimTx, 'accoun
202
180
  * @param name - Domain name
203
181
  * @param nameFee - Name fee (bid fee)
204
182
  * @param options - Options
205
- * @param options.onAccount - Make operation on specific account from sdk (you pass
206
- * publickKey) or using provided KeyPair(Can be keypair object or MemoryAccount)
207
- * @param options.fee - fee
208
- * @param options.ttl - ttl
209
- * @param options.nonce - nonce
210
183
  * @returns Transaction result
211
184
  * @example
212
185
  * ```js