@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
@@ -0,0 +1,95 @@
1
+ // js extension is required for mjs build
2
+ // @ts-expect-error see https://github.com/aeternity/aepp-calldata-js/issues/216
3
+ // eslint-disable-next-line import/extensions
4
+ import ContractByteArrayEncoder from '@aeternity/aepp-calldata/src/ContractByteArrayEncoder.js';
5
+ // @ts-expect-error see https://github.com/aeternity/aepp-calldata-js/issues/216
6
+ // eslint-disable-next-line import/extensions
7
+ import AciTypeResolver from '@aeternity/aepp-calldata/src/AciTypeResolver.js';
8
+ import canonicalize from 'canonicalize';
9
+ import { Encoded, decode } from './encoder';
10
+ import { hash, messagePrefixLength } from './crypto';
11
+ import { concatBuffers } from './other';
12
+
13
+ /**
14
+ * Hashes arbitrary object, can be used to inline the aci hash to contract source code
15
+ */
16
+ export function hashJson(data: unknown): Buffer {
17
+ return hash(canonicalize(data) ?? '');
18
+ }
19
+
20
+ // TODO: move this type to calldata library https://github.com/aeternity/aepp-calldata-js/issues/215
21
+ // based on https://github.com/aeternity/aepp-calldata-js/blob/82b5a98f9b308482627da8d7484d213e9cf87151/src/AciTypeResolver.js#L129
22
+ export type AciValue = 'void' | 'unit' | 'int' | 'bool' | 'string' | 'bits' | 'hash' | 'signature'
23
+ | 'address' | 'contract_pubkey' | 'Chain.ttl' | 'Chain.ga_meta_tx' | 'Chain.paying_for_tx'
24
+ | 'Chain.base_tx' | 'AENS.pointee' | 'AENS.name' | 'MCL_BLS12_381.fr' | 'MCL_BLS12_381.fp'
25
+ | { 'Set.set': readonly [AciValue] }
26
+ | { bytes: number }
27
+ | { list: readonly [AciValue] }
28
+ | { map: readonly [AciValue, AciValue] }
29
+ | { tuple: readonly AciValue[] }
30
+ | { record: ReadonlyArray<{ name: string; type: AciValue }> }
31
+ | { variant: ReadonlyArray<{ [key: string]: readonly AciValue[] }> }
32
+ | { option: readonly [AciValue] }
33
+ | { oracle: readonly [AciValue, AciValue] }
34
+ | { oracle_query: readonly [AciValue, AciValue] };
35
+
36
+ export interface Domain {
37
+ name?: string;
38
+ version?: number;
39
+ networkId?: string;
40
+ contractAddress?: Encoded.ContractAddress;
41
+ }
42
+
43
+ // TODO: replace with api on calldata side https://github.com/aeternity/aepp-calldata-js/issues/216
44
+ export function encodeFateValue(
45
+ value: unknown,
46
+ aci: AciValue,
47
+ ): Encoded.ContractBytearray {
48
+ const contractByteArrayEncoder = new ContractByteArrayEncoder();
49
+ const aciTypeResolver = new AciTypeResolver([]);
50
+ aciTypeResolver.isCustomType = () => false;
51
+ return contractByteArrayEncoder.encode(aciTypeResolver.resolveType(aci), value);
52
+ }
53
+
54
+ // TODO: replace with api on calldata side https://github.com/aeternity/aepp-calldata-js/issues/216
55
+ export function decodeFateValue(
56
+ value: Encoded.ContractBytearray,
57
+ aci: AciValue,
58
+ ): Encoded.ContractBytearray {
59
+ const contractByteArrayEncoder = new ContractByteArrayEncoder();
60
+ const aciTypeResolver = new AciTypeResolver([]);
61
+ aciTypeResolver.isCustomType = () => false;
62
+ return contractByteArrayEncoder.decodeWithType(value, aciTypeResolver.resolveType(aci));
63
+ }
64
+
65
+ /**
66
+ * Hashes domain object, can be used to inline domain hash to contract source code
67
+ */
68
+ export function hashDomain(domain: Domain): Buffer {
69
+ const domainAci = {
70
+ record: [{
71
+ name: 'name',
72
+ type: { option: ['string'] },
73
+ }, {
74
+ name: 'version',
75
+ type: { option: ['int'] },
76
+ }, {
77
+ name: 'networkId',
78
+ type: { option: ['string'] },
79
+ }, {
80
+ name: 'contractAddress',
81
+ type: { option: ['contract_pubkey'] },
82
+ }],
83
+ } as const;
84
+ return hash(decode(encodeFateValue(domain, domainAci)));
85
+ }
86
+
87
+ export function hashTypedData(
88
+ data: Encoded.ContractBytearray,
89
+ aci: AciValue,
90
+ domain: Domain,
91
+ ): Buffer {
92
+ return hash(concatBuffers([
93
+ messagePrefixLength, new Uint8Array([0]), hashDomain(domain), hashJson(aci), hash(decode(data)),
94
+ ]));
95
+ }
@@ -2,7 +2,8 @@ import Node from './Node';
2
2
  import AccountBase from './account/Base';
3
3
  import { Encoded } from './utils/encoder';
4
4
  import CompilerBase from './contract/compiler/Base';
5
- import AeSdkMethods, { OnAccount } from './AeSdkMethods';
5
+ import AeSdkMethods, { OnAccount, AeSdkMethodsOptions } from './AeSdkMethods';
6
+ import { AensName } from './tx/builder/constants';
6
7
  type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
7
8
  name: string;
8
9
  };
@@ -19,7 +20,7 @@ export default class AeSdkBase extends AeSdkMethods {
19
20
  * @param options - Options
20
21
  * @param options.nodes - Array of nodes
21
22
  */
22
- constructor({ nodes, ...options }?: ConstructorParameters<typeof AeSdkMethods>[0] & {
23
+ constructor({ nodes, ...options }?: AeSdkMethodsOptions & {
23
24
  nodes?: Array<{
24
25
  name: string;
25
26
  instance: Node;
@@ -72,6 +73,11 @@ export default class AeSdkBase extends AeSdkMethods {
72
73
  */
73
74
  getNodesInPool(): Promise<NodeInfo[]>;
74
75
  addresses(): Encoded.AccountAddress[];
76
+ /**
77
+ * Resolves an account
78
+ * @param account - ak-address, instance of AccountBase, or keypair
79
+ */
80
+ _resolveAccount(account?: OnAccount): AccountBase;
75
81
  get address(): Encoded.AccountAddress;
76
82
  sign(data: string | Uint8Array, { onAccount, ...options }?: {
77
83
  onAccount?: OnAccount;
@@ -82,7 +88,19 @@ export default class AeSdkBase extends AeSdkMethods {
82
88
  signMessage(message: string, { onAccount, ...options }?: {
83
89
  onAccount?: OnAccount;
84
90
  } & Parameters<AccountBase['signMessage']>[1]): Promise<Uint8Array>;
85
- _getOptions(): {
91
+ signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { onAccount, ...options }?: {
92
+ onAccount?: OnAccount;
93
+ } & Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
94
+ signDelegationToContract(contractAddress: Encoded.ContractAddress, { onAccount, ...options }?: {
95
+ onAccount?: OnAccount;
96
+ } & Parameters<AccountBase['signDelegationToContract']>[1]): Promise<Encoded.Signature>;
97
+ signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { onAccount, ...options }?: {
98
+ onAccount?: OnAccount;
99
+ } & Parameters<AccountBase['signNameDelegationToContract']>[2]): Promise<Encoded.Signature>;
100
+ signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { onAccount, ...options }?: {
101
+ onAccount?: OnAccount;
102
+ } & Parameters<AccountBase['signOracleQueryDelegationToContract']>[2]): Promise<Encoded.Signature>;
103
+ _getOptions(callOptions?: AeSdkMethodsOptions): {
86
104
  onNode: Node;
87
105
  onAccount: AccountBase;
88
106
  onCompiler: CompilerBase;
@@ -10,8 +10,9 @@ import Node from './Node';
10
10
  import { TxParamsAsync } from './tx/builder/schema.generated';
11
11
  import AccountBase from './account/Base';
12
12
  import { Encoded } from './utils/encoder';
13
+ import CompilerBase from './contract/compiler/Base';
13
14
  export type OnAccount = Encoded.AccountAddress | AccountBase | undefined;
14
- export declare function getValueOrErrorProxy<Value extends object>(valueCb: () => Value): Value;
15
+ export declare function getValueOrErrorProxy<Value extends object | undefined>(valueCb: () => Value): NonNullable<Value>;
15
16
  declare const methods: {
16
17
  readonly createGeneralizedAccount: typeof contractGaMethods.createGeneralizedAccount;
17
18
  readonly buildAuthTxHash: typeof contractGaMethods.buildAuthTxHash;
@@ -69,11 +70,7 @@ type GetMethodsOptions<Methods extends {
69
70
  [Name in keyof Methods]: Methods[Name] extends (...args: infer Args) => any ? Args[Decrement<Args['length']>] : never;
70
71
  };
71
72
  type MethodsOptions = GetMethodsOptions<typeof methods>;
72
- interface AeSdkMethodsOptions extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
73
- nodes?: Array<{
74
- name: string;
75
- instance: Node;
76
- }>;
73
+ export interface AeSdkMethodsOptions extends Partial<UnionToIntersection<MethodsOptions[keyof MethodsOptions]>> {
77
74
  }
78
75
  /**
79
76
  * AeSdkMethods is the composition of:
@@ -94,13 +91,10 @@ declare class AeSdkMethods {
94
91
  * @param options - Options
95
92
  */
96
93
  constructor(options?: AeSdkMethodsOptions);
97
- /**
98
- * Resolves an account
99
- * @param account - ak-address, instance of AccountBase, or keypair
100
- */
101
- _resolveAccount(account?: OnAccount): AccountBase;
102
- _getOptions(): AeSdkMethodsOptions & {
94
+ _getOptions(callOptions?: AeSdkMethodsOptions): AeSdkMethodsOptions & {
103
95
  onAccount: AccountBase;
96
+ onCompiler: CompilerBase;
97
+ onNode: Node;
104
98
  };
105
99
  buildTx(options: TxParamsAsync): Promise<Encoded.Transaction>;
106
100
  initializeContract<Methods extends ContractMethodsBase>(options?: Omit<Parameters<typeof Contract.initialize>[0], 'onNode'> & {
@@ -135,5 +129,6 @@ type TransformMethods<Methods extends {
135
129
  };
136
130
  interface AeSdkMethodsTransformed extends TransformMethods<typeof methods> {
137
131
  }
138
- declare const _default: new (options?: ConstructorParameters<typeof AeSdkMethods>[0]) => AeSdkMethods & AeSdkMethodsTransformed;
139
- export default _default;
132
+ type AeSdkMethodsTyped = AeSdkMethods & AeSdkMethodsTransformed;
133
+ declare const AeSdkMethodsTyped: new (options?: AeSdkMethodsOptions) => AeSdkMethodsTyped;
134
+ export default AeSdkMethodsTyped;
@@ -49,6 +49,7 @@ export default class AeSdkWallet extends AeSdk {
49
49
  onDisconnect: OnDisconnect;
50
50
  onAskAccounts: OnAskAccounts;
51
51
  } & ConstructorParameters<typeof AeSdk>[0]);
52
+ _getAccountsForClient({ addressSubscription }: RpcClientsInfo): Accounts;
52
53
  _pushAccountsToApps(): void;
53
54
  selectAccount(address: Encoded.AccountAddress): void;
54
55
  addAccount(account: AccountBase, options?: Parameters<AeSdk['addAccount']>[1]): void;
@@ -57,7 +58,6 @@ export default class AeSdkWallet extends AeSdk {
57
58
  };
58
59
  selectNode(name: string): Promise<void>;
59
60
  _getClient(clientId: string): RpcClientsInfo;
60
- _isRpcClientSubscribed(clientId: string): boolean;
61
61
  _isRpcClientConnected(clientId: string): boolean;
62
62
  _disconnectRpcClient(clientId: string): void;
63
63
  /**
@@ -0,0 +1,46 @@
1
+ import { Middleware as MiddlewareApi, MiddlewareOptionalParams } from './apis/middleware';
2
+ import { Encoded } from './utils/encoder';
3
+ import { ConsensusProtocolVersion } from './tx/builder/constants';
4
+ declare const bigIntPropertyNames: readonly [
5
+ ];
6
+ declare const numberPropertyNames: readonly [
7
+ ];
8
+ type BigIntPropertyNames = typeof bigIntPropertyNames[number];
9
+ type NumberPropertyNames = typeof numberPropertyNames[number];
10
+ type PreserveOptional<NewType, OrigType> = OrigType extends undefined ? NewType | undefined : NewType;
11
+ export type TransformMiddlewareType<Type> = Type extends (...args: infer Args) => infer Ret ? (...args: TransformMiddlewareType<Args>) => TransformMiddlewareType<Ret> : Type extends [
12
+ infer Item,
13
+ ...infer Rest
14
+ ] ? [
15
+ TransformMiddlewareType<Item>,
16
+ ...TransformMiddlewareType<Rest>
17
+ ] : Type extends Array<infer Item> ? Array<TransformMiddlewareType<Item>> : Type extends Promise<infer T> ? Promise<TransformMiddlewareType<T>> : Type extends {
18
+ [P in any]: any;
19
+ } ? {
20
+ [Property in keyof Type]: Property extends BigIntPropertyNames ? PreserveOptional<bigint, Type[Property]> : Property extends NumberPropertyNames ? PreserveOptional<number, Type[Property]> : Property extends 'txHash' ? PreserveOptional<Encoded.TxHash, Type[Property]> : Property extends 'bytecode' ? PreserveOptional<Encoded.ContractBytearray, Type[Property]> : TransformMiddlewareType<Type[Property]>;
21
+ } : Type;
22
+ type MiddlewareTransformedApi = new (...args: ConstructorParameters<typeof MiddlewareApi>) => {
23
+ [Name in keyof InstanceType<typeof MiddlewareApi>]: Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest' ? MiddlewareApi[Name] : TransformMiddlewareType<MiddlewareApi[Name]>;
24
+ };
25
+ export interface MiddlewareInfo {
26
+ url: string;
27
+ nodeNetworkId: string;
28
+ version: string;
29
+ consensusProtocolVersion: ConsensusProtocolVersion;
30
+ }
31
+ declare const Middleware_base: MiddlewareTransformedApi;
32
+ export default class Middleware extends Middleware_base {
33
+ /**
34
+ * @param url - Url for middleware API
35
+ * @param options - Options
36
+ * @param options.ignoreVersion - Don't check node version
37
+ * @param options.retryCount - Amount of extra requests to do in case of failure
38
+ * @param options.retryOverallDelay - Time in ms to wait between all retries
39
+ */
40
+ constructor(url: string, { ignoreVersion, retryCount, retryOverallDelay, ...options }?: MiddlewareOptionalParams & {
41
+ ignoreVersion?: boolean;
42
+ retryCount?: number;
43
+ retryOverallDelay?: number;
44
+ });
45
+ }
46
+ export {};
@@ -0,0 +1,30 @@
1
+ /// <reference types="ws" />
2
+ import WebSocket from 'isomorphic-ws';
3
+ import { BaseError } from './utils/errors';
4
+ import { Encoded } from './utils/encoder';
5
+ export declare class MiddlewareSubscriberError extends BaseError {
6
+ constructor(message: string);
7
+ }
8
+ export declare class MiddlewareSubscriberDisconnected extends MiddlewareSubscriberError {
9
+ readonly closeEvent: WebSocket.CloseEvent;
10
+ constructor(closeEvent: WebSocket.CloseEvent);
11
+ }
12
+ export default class MiddlewareSubscriber {
13
+ #private;
14
+ readonly url: string;
15
+ get webSocket(): WebSocket | undefined;
16
+ constructor(url: string);
17
+ reconnect(): Promise<void>;
18
+ subscribeKeyBlocks(cb: (p?: any, e?: Error) => void): () => void;
19
+ subscribeKeyBlocksNode(cb: (p?: any, e?: Error) => void): () => void;
20
+ subscribeKeyBlocksAll(cb: (p?: any, e?: Error) => void): () => void;
21
+ subscribeMicroBlocks(cb: (p?: any, e?: Error) => void): () => void;
22
+ subscribeMicroBlocksNode(cb: (p?: any, e?: Error) => void): () => void;
23
+ subscribeMicroBlocksAll(cb: (p?: any, e?: Error) => void): () => void;
24
+ subscribeTransactions(cb: (p?: any, e?: Error) => void): () => void;
25
+ subscribeTransactionsNode(cb: (p?: any, e?: Error) => void): () => void;
26
+ subscribeTransactionsAll(cb: (p?: any, e?: Error) => void): () => void;
27
+ subscribeObject(target: Encoded.KeyBlockHash | Encoded.Channel | Encoded.ContractAddress | Encoded.OracleAddress | Encoded.OracleQueryId | Encoded.AccountAddress | Encoded.Name | `${string}.chain`, cb: (p?: any, e?: Error) => void): () => void;
28
+ subscribeObjectNode(target: Encoded.KeyBlockHash | Encoded.Channel | Encoded.ContractAddress | Encoded.OracleAddress | Encoded.OracleQueryId | Encoded.AccountAddress | Encoded.Name | `${string}.chain`, cb: (p?: any, e?: Error) => void): () => void;
29
+ subscribeObjectAll(target: Encoded.KeyBlockHash | Encoded.Channel | Encoded.ContractAddress | Encoded.OracleAddress | Encoded.OracleQueryId | Encoded.AccountAddress | Encoded.Name | `${string}.chain`, cb: (p?: any, e?: Error) => void): () => void;
30
+ }
@@ -55,7 +55,7 @@ export type TransformNodeType<Type> = Type extends (...args: infer Args) => infe
55
55
  type NodeTransformedApi = new (...args: ConstructorParameters<typeof NodeApi>) => {
56
56
  [Name in keyof InstanceType<typeof NodeApi>]: Name extends 'pipeline' | 'sendRequest' | 'sendOperationRequest' ? NodeApi[Name] : TransformNodeType<NodeApi[Name]>;
57
57
  };
58
- export interface NodeInfo {
58
+ interface NodeInfo {
59
59
  url: string;
60
60
  nodeNetworkId: string;
61
61
  version: string;
@@ -1,7 +1,8 @@
1
1
  import { Encoded } from '../utils/encoder';
2
2
  import Node from '../Node';
3
3
  import CompilerBase from '../contract/compiler/Base';
4
- import { Int } from '../tx/builder/constants';
4
+ import { AensName, Int } from '../tx/builder/constants';
5
+ import { AciValue, Domain } from '../utils/typed-data';
5
6
  interface AuthData {
6
7
  fee?: Int;
7
8
  gasLimit?: number;
@@ -36,17 +37,70 @@ export default abstract class AccountBase {
36
37
  * Sign message
37
38
  * @param message - Message to sign
38
39
  * @param options - Options
39
- * @returns Signature as hex string of Uint8Array
40
+ * @returns Signature
40
41
  */
41
42
  abstract signMessage(message: string, options?: {
42
43
  aeppOrigin?: string;
43
44
  aeppRpcClientId?: string;
44
45
  }): Promise<Uint8Array>;
46
+ /**
47
+ * Sign typed data
48
+ * @param type - Type of data to sign
49
+ * @param data - Encoded data to sign
50
+ * @param options - Options
51
+ * @returns Signature
52
+ */
53
+ signTypedData(data: Encoded.ContractBytearray, aci: AciValue, options?: Domain & {
54
+ aeppOrigin?: string;
55
+ aeppRpcClientId?: string;
56
+ }): Promise<Encoded.Signature>;
57
+ /**
58
+ * Sign delegation of AENS, oracle operations to a contract
59
+ * @param contractAddress - Address of a contract to delegate permissions to
60
+ * @param options - Options
61
+ * @returns Signature
62
+ */
63
+ signDelegationToContract(contractAddress: Encoded.ContractAddress, options?: {
64
+ networkId?: string;
65
+ aeppOrigin?: string;
66
+ aeppRpcClientId?: string;
67
+ }): Promise<Encoded.Signature>;
68
+ /**
69
+ * Sign delegation of an AENS name to a contract
70
+ * @param contractAddress - Address of a contract to delegate permissions to
71
+ * @param name - AENS name to manage by a contract
72
+ * @param options - Options
73
+ * @returns Signature
74
+ */
75
+ signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, options?: {
76
+ networkId?: string;
77
+ aeppOrigin?: string;
78
+ aeppRpcClientId?: string;
79
+ }): Promise<Encoded.Signature>;
80
+ /**
81
+ * Sign delegation of oracle query to a contract
82
+ *
83
+ * Warning! Implementations needs to ensure that decoded oracle query id is not equal to decoded
84
+ * current account address unless https://github.com/aeternity/aesophia/issues/475 is fixed.
85
+ *
86
+ * Warning! Implementations needs to ensure that oracle query and contract exists unless
87
+ * https://github.com/aeternity/aesophia/issues/474 is fixed.
88
+ *
89
+ * @param contractAddress - Address of a contract to delegate permissions to
90
+ * @param oracleQueryId - Oracle query ID to reply by a contract
91
+ * @param options - Options
92
+ * @returns Signature
93
+ */
94
+ signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, options?: {
95
+ networkId?: string;
96
+ aeppOrigin?: string;
97
+ aeppRpcClientId?: string;
98
+ }): Promise<Encoded.Signature>;
45
99
  /**
46
100
  * Sign data blob
47
101
  * @param data - Data blob to sign
48
102
  * @param options - Options
49
- * @returns Signed data blob
103
+ * @returns Signature
50
104
  */
51
105
  abstract sign(data: string | Uint8Array, options?: any): Promise<Uint8Array>;
52
106
  /**
@@ -12,5 +12,9 @@ export default class AccountGeneralized extends AccountBase {
12
12
  constructor(address: Encoded.AccountAddress);
13
13
  sign(): Promise<Uint8Array>;
14
14
  signMessage(): Promise<Uint8Array>;
15
+ signTypedData(): Promise<Encoded.Signature>;
16
+ signDelegationToContract(): Promise<Encoded.Signature>;
17
+ signNameDelegationToContract(): Promise<Encoded.Signature>;
18
+ signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
15
19
  signTransaction(tx: Encoded.Transaction, { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
16
20
  }
@@ -20,6 +20,10 @@ export default class AccountLedger extends AccountBase {
20
20
  */
21
21
  constructor(transport: Transport, index: number, address: Encoded.AccountAddress);
22
22
  sign(): Promise<Uint8Array>;
23
+ signTypedData(): Promise<Encoded.Signature>;
24
+ signDelegationToContract(): Promise<Encoded.Signature>;
25
+ signNameDelegationToContract(): Promise<Encoded.Signature>;
26
+ signOracleQueryDelegationToContract(): Promise<Encoded.Signature>;
23
27
  signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: {
24
28
  innerTx?: boolean;
25
29
  networkId?: string;
@@ -1,5 +1,7 @@
1
1
  import AccountBase from './Base';
2
2
  import { Encoded } from '../utils/encoder';
3
+ import { AciValue } from '../utils/typed-data';
4
+ import { AensName } from '../tx/builder/constants';
3
5
  export declare function getBufferToSign(transaction: Encoded.Transaction, networkId: string, innerTx: boolean): Uint8Array;
4
6
  /**
5
7
  * In-memory account class
@@ -20,4 +22,14 @@ export default class AccountMemory extends AccountBase {
20
22
  networkId?: string;
21
23
  }): Promise<Encoded.Transaction>;
22
24
  signMessage(message: string, options?: any): Promise<Uint8Array>;
25
+ signTypedData(data: Encoded.ContractBytearray, aci: AciValue, { name, version, networkId, contractAddress, ...options }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
26
+ signDelegationToContract(contractAddress: Encoded.ContractAddress, { networkId }?: {
27
+ networkId?: string;
28
+ }): Promise<Encoded.Signature>;
29
+ signNameDelegationToContract(contractAddress: Encoded.ContractAddress, name: AensName, { networkId }?: {
30
+ networkId?: string;
31
+ }): Promise<Encoded.Signature>;
32
+ signOracleQueryDelegationToContract(contractAddress: Encoded.ContractAddress, oracleQueryId: Encoded.OracleQueryId, { networkId }?: {
33
+ networkId?: string;
34
+ }): Promise<Encoded.Signature>;
23
35
  }
@@ -2,6 +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
6
  /**
6
7
  * Account provided by wallet
7
8
  * @param params - Params
@@ -14,12 +15,10 @@ export default class AccountRpc extends AccountBase {
14
15
  readonly address: Encoded.AccountAddress;
15
16
  constructor(rpcClient: RpcClient<WalletApi, AeppApi>, address: Encoded.AccountAddress);
16
17
  sign(): Promise<Uint8Array>;
17
- /**
18
- * @returns Signed transaction
19
- */
20
18
  signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
21
- /**
22
- * @returns Signed message
23
- */
24
19
  signMessage(message: string): Promise<Uint8Array>;
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>;
25
24
  }
@@ -211,7 +211,7 @@ interface AensPreclaimOptions extends BuildTxOptions<Tag.NamePreclaimTx, 'accoun
211
211
  * @example
212
212
  * ```js
213
213
  * const name = 'test.chain'
214
- * const bidFee = computeBidFee(name, startFee, incrementPercentage)
214
+ * const bidFee = computeBidFee(name, { startFee, increment: 0.42 })
215
215
  *
216
216
  * await sdkInstance.aensBid(name, 213109412839123, { ttl, fee, nonce })
217
217
  * ```
@@ -1,7 +1,9 @@
1
1
  import { Encoded } from '../../utils/encoder';
2
+ import { Domain, AciValue } from '../../utils/typed-data';
2
3
  import { METHODS, SUBSCRIPTION_TYPES, WALLET_TYPE } from '../schema';
3
4
  import { TransformNodeType } from '../../Node';
4
5
  import { SignedTx } from '../../apis/node';
6
+ import { AensName } from '../../tx/builder/constants';
5
7
  export interface WalletInfo {
6
8
  id: string;
7
9
  name: string;
@@ -60,6 +62,7 @@ export interface WalletApi {
60
62
  * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}
61
63
  */
62
64
  networkId: string;
65
+ innerTx?: boolean;
63
66
  }) => Promise<{
64
67
  /**
65
68
  * @deprecated this is not a hash at all, will be removed later at the same time
@@ -77,6 +80,22 @@ export interface WalletApi {
77
80
  }) => Promise<{
78
81
  signature: string;
79
82
  }>;
83
+ [METHODS.signTypedData]: (p: {
84
+ domain: Domain;
85
+ aci: AciValue;
86
+ data: Encoded.ContractBytearray;
87
+ onAccount: Encoded.AccountAddress;
88
+ }) => Promise<{
89
+ signature: Encoded.Signature;
90
+ }>;
91
+ [METHODS.signDelegationToContract]: (p: {
92
+ contractAddress: Encoded.ContractAddress;
93
+ name?: AensName;
94
+ oracleQueryId?: Encoded.OracleQueryId;
95
+ onAccount: Encoded.AccountAddress;
96
+ }) => Promise<{
97
+ signature: Encoded.Signature;
98
+ }>;
80
99
  }
81
100
  export interface AeppApi {
82
101
  [METHODS.updateAddress]: (a: Accounts) => void;
@@ -31,6 +31,8 @@ export declare const enum METHODS {
31
31
  connect = "connection.open",
32
32
  sign = "transaction.sign",
33
33
  signMessage = "message.sign",
34
+ signTypedData = "typedData.sign",
35
+ signDelegationToContract = "delegationToContract.sign",
34
36
  subscribeAddress = "address.subscribe",
35
37
  updateNetwork = "networkId.update",
36
38
  closeConnection = "connection.close"
@@ -66,14 +68,6 @@ export declare class RpcInvalidTransactionError extends RpcError {
66
68
  code: number;
67
69
  constructor(data?: any);
68
70
  }
69
- /**
70
- * @category exception
71
- */
72
- export declare class RpcBroadcastError extends RpcError {
73
- static code: number;
74
- code: number;
75
- constructor(data?: any);
76
- }
77
71
  /**
78
72
  * @category exception
79
73
  */
@@ -20,6 +20,6 @@ interface Wallets {
20
20
  */
21
21
  declare const _default: (connection: BrowserConnection, onDetected: ({ wallets, newWallet }: {
22
22
  wallets: Wallets;
23
- newWallet?: Wallet | undefined;
23
+ newWallet: Wallet;
24
24
  }) => void) => () => void;
25
25
  export default _default;
@@ -9,12 +9,6 @@ export interface CompileOpts {
9
9
  /** Name of contract source file - only used in error messages */
10
10
  srcFile?: string;
11
11
  }
12
- export interface Aci {
13
- /** Any object */
14
- encodedAci: Record<string, unknown>;
15
- externalEncodedAci?: Record<string, unknown>[];
16
- interface: string;
17
- }
18
12
  export interface CompilerError {
19
13
  type: string;
20
14
  pos: ErrorPos;
@@ -127,7 +121,7 @@ export interface SophiaJsonData {
127
121
  export interface GenerateACIOptionalParams extends coreClient.OperationOptions {
128
122
  }
129
123
  /** Contains response data for the generateACI operation. */
130
- export type GenerateACIResponse = Aci;
124
+ export type GenerateACIResponse = Record<string, unknown>[];
131
125
  /** Optional parameters. */
132
126
  export interface CompileContractOptionalParams extends coreClient.OperationOptions {
133
127
  }
@@ -1,7 +1,6 @@
1
1
  import * as coreClient from "@azure/core-client";
2
2
  export declare const Contract: coreClient.CompositeMapper;
3
3
  export declare const CompileOpts: coreClient.CompositeMapper;
4
- export declare const Aci: coreClient.CompositeMapper;
5
4
  export declare const CompilerError: coreClient.CompositeMapper;
6
5
  export declare const ErrorPos: coreClient.CompositeMapper;
7
6
  export declare const CompileResult: coreClient.CompositeMapper;
@@ -0,0 +1,2 @@
1
+ export * from "./models";
2
+ export { Middleware } from "./middleware";