@aeternity/aepp-sdk 13.0.0 → 13.1.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 (276) 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 +27068 -16862
  8. package/dist/aepp-sdk.js.map +1 -1
  9. package/es/AeSdkBase.d.ts +11 -3
  10. package/es/AeSdkBase.mjs +24 -3
  11. package/es/AeSdkBase.mjs.map +1 -1
  12. package/es/AeSdkMethods.d.ts +9 -14
  13. package/es/AeSdkMethods.mjs +20 -49
  14. package/es/AeSdkMethods.mjs.map +1 -1
  15. package/es/AeSdkWallet.mjs +28 -5
  16. package/es/AeSdkWallet.mjs.map +1 -1
  17. package/es/Middleware.d.ts +38 -0
  18. package/es/Middleware.mjs +90 -0
  19. package/es/Middleware.mjs.map +1 -0
  20. package/es/MiddlewareSubscriber.d.ts +30 -0
  21. package/es/MiddlewareSubscriber.mjs +198 -0
  22. package/es/MiddlewareSubscriber.mjs.map +1 -0
  23. package/es/Node.d.ts +1 -1
  24. package/es/Node.mjs.map +1 -1
  25. package/es/account/Base.d.ts +14 -2
  26. package/es/account/Base.mjs.map +1 -1
  27. package/es/account/Generalized.d.ts +1 -0
  28. package/es/account/Generalized.mjs +5 -0
  29. package/es/account/Generalized.mjs.map +1 -1
  30. package/es/account/Ledger.d.ts +1 -0
  31. package/es/account/Ledger.mjs +5 -0
  32. package/es/account/Ledger.mjs.map +1 -1
  33. package/es/account/Memory.d.ts +2 -0
  34. package/es/account/Memory.mjs +18 -0
  35. package/es/account/Memory.mjs.map +1 -1
  36. package/es/account/Rpc.d.ts +1 -6
  37. package/es/account/Rpc.mjs +24 -10
  38. package/es/account/Rpc.mjs.map +1 -1
  39. package/es/aens.d.ts +1 -1
  40. package/es/aens.mjs +1 -1
  41. package/es/aens.mjs.map +1 -1
  42. package/es/aepp-wallet-communication/rpc/RpcClient.mjs +5 -2
  43. package/es/aepp-wallet-communication/rpc/RpcClient.mjs.map +1 -1
  44. package/es/aepp-wallet-communication/rpc/types.d.ts +10 -0
  45. package/es/aepp-wallet-communication/rpc/types.mjs.map +1 -1
  46. package/es/aepp-wallet-communication/schema.d.ts +1 -8
  47. package/es/aepp-wallet-communication/schema.mjs +1 -14
  48. package/es/aepp-wallet-communication/schema.mjs.map +1 -1
  49. package/es/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  50. package/es/aepp-wallet-communication/wallet-detector.mjs +0 -3
  51. package/es/aepp-wallet-communication/wallet-detector.mjs.map +1 -1
  52. package/es/apis/compiler/compiler.mjs +15 -1
  53. package/es/apis/compiler/compiler.mjs.map +1 -1
  54. package/es/apis/compiler/models/index.d.ts +1 -7
  55. package/es/apis/compiler/models/index.mjs.map +1 -1
  56. package/es/apis/compiler/models/mappers.d.ts +0 -1
  57. package/es/apis/compiler/models/mappers.mjs +0 -43
  58. package/es/apis/compiler/models/mappers.mjs.map +1 -1
  59. package/es/apis/middleware/index.d.ts +2 -0
  60. package/es/apis/middleware/index.mjs +3 -0
  61. package/es/apis/middleware/index.mjs.map +1 -0
  62. package/es/apis/middleware/middleware.d.ts +309 -0
  63. package/es/apis/middleware/middleware.mjs +1527 -0
  64. package/es/apis/middleware/middleware.mjs.map +1 -0
  65. package/es/apis/middleware/models/index.d.ts +1496 -0
  66. package/es/apis/middleware/models/index.mjs +364 -0
  67. package/es/apis/middleware/models/index.mjs.map +1 -0
  68. package/es/apis/middleware/models/mappers.d.ts +102 -0
  69. package/es/apis/middleware/models/mappers.mjs +3334 -0
  70. package/es/apis/middleware/models/mappers.mjs.map +1 -0
  71. package/es/apis/middleware/models/parameters.d.ts +43 -0
  72. package/es/apis/middleware/models/parameters.mjs +417 -0
  73. package/es/apis/middleware/models/parameters.mjs.map +1 -0
  74. package/es/chain.d.ts +2 -1
  75. package/es/chain.mjs +4 -2
  76. package/es/chain.mjs.map +1 -1
  77. package/es/channel/Base.d.ts +1 -1
  78. package/es/channel/Base.mjs +1 -4
  79. package/es/channel/Base.mjs.map +1 -1
  80. package/es/channel/internal.mjs +2 -0
  81. package/es/channel/internal.mjs.map +1 -1
  82. package/es/contract/Contract.d.ts +1 -2
  83. package/es/contract/Contract.mjs +1 -1
  84. package/es/contract/Contract.mjs.map +1 -1
  85. package/es/contract/compiler/Base.d.ts +21 -0
  86. package/es/contract/compiler/Base.mjs.map +1 -1
  87. package/es/contract/compiler/Cli.d.ts +2 -0
  88. package/es/contract/compiler/Cli.mjs +24 -3
  89. package/es/contract/compiler/Cli.mjs.map +1 -1
  90. package/es/contract/compiler/Http.d.ts +2 -0
  91. package/es/contract/compiler/Http.mjs +22 -2
  92. package/es/contract/compiler/Http.mjs.map +1 -1
  93. package/es/contract/compiler/HttpNode.d.ts +1 -0
  94. package/es/contract/compiler/HttpNode.mjs +5 -0
  95. package/es/contract/compiler/HttpNode.mjs.map +1 -1
  96. package/es/deprecated.d.ts +14 -0
  97. package/es/deprecated.mjs +22 -0
  98. package/es/deprecated.mjs.map +1 -0
  99. package/es/index-browser.d.ts +20 -14
  100. package/es/index-browser.mjs +19 -15
  101. package/es/index-browser.mjs.map +1 -1
  102. package/es/tx/builder/constants.d.ts +0 -1
  103. package/es/tx/builder/constants.mjs +0 -1
  104. package/es/tx/builder/constants.mjs.map +1 -1
  105. package/es/tx/builder/field-types/coin-amount.d.ts +1 -1
  106. package/es/tx/builder/field-types/coin-amount.mjs +2 -1
  107. package/es/tx/builder/field-types/coin-amount.mjs.map +1 -1
  108. package/es/tx/builder/field-types/deposit.d.ts +1 -1
  109. package/es/tx/builder/field-types/entry.mjs +2 -1
  110. package/es/tx/builder/field-types/entry.mjs.map +1 -1
  111. package/es/tx/builder/field-types/index.d.ts +2 -2
  112. package/es/tx/builder/helpers.d.ts +8 -1
  113. package/es/tx/builder/helpers.mjs +53 -9
  114. package/es/tx/builder/helpers.mjs.map +1 -1
  115. package/es/tx/builder/index.d.ts +4 -2
  116. package/es/tx/builder/index.mjs +0 -1
  117. package/es/tx/builder/index.mjs.map +1 -1
  118. package/es/tx/builder/schema.d.ts +9 -9
  119. package/es/tx/execution-cost.d.ts +17 -0
  120. package/es/tx/execution-cost.mjs +17 -0
  121. package/es/tx/execution-cost.mjs.map +1 -1
  122. package/es/tx/validator.mjs +6 -3
  123. package/es/tx/validator.mjs.map +1 -1
  124. package/es/utils/amount-formatter.d.ts +1 -2
  125. package/es/utils/amount-formatter.mjs +2 -2
  126. package/es/utils/amount-formatter.mjs.map +1 -1
  127. package/es/utils/autorest.mjs +6 -8
  128. package/es/utils/autorest.mjs.map +1 -1
  129. package/es/utils/crypto.d.ts +1 -0
  130. package/es/utils/crypto.mjs +12 -2
  131. package/es/utils/crypto.mjs.map +1 -1
  132. package/es/utils/errors.d.ts +2 -2
  133. package/es/utils/errors.mjs.map +1 -1
  134. package/es/utils/other.d.ts +1 -0
  135. package/es/utils/other.mjs +5 -0
  136. package/es/utils/other.mjs.map +1 -1
  137. package/es/utils/typed-data.d.ts +45 -0
  138. package/es/utils/typed-data.mjs +71 -0
  139. package/es/utils/typed-data.mjs.map +1 -0
  140. package/package.json +23 -4
  141. package/src/AeSdkBase.ts +30 -5
  142. package/src/AeSdkMethods.ts +31 -50
  143. package/src/AeSdkWallet.ts +27 -5
  144. package/src/Middleware.ts +141 -0
  145. package/src/MiddlewareSubscriber.ts +207 -0
  146. package/src/Node.ts +1 -1
  147. package/src/account/Base.ts +20 -3
  148. package/src/account/Generalized.ts +5 -0
  149. package/src/account/Ledger.ts +5 -0
  150. package/src/account/Memory.ts +15 -0
  151. package/src/account/Rpc.ts +19 -7
  152. package/src/aens.ts +1 -1
  153. package/src/aepp-wallet-communication/rpc/RpcClient.ts +11 -3
  154. package/src/aepp-wallet-communication/rpc/types.ts +11 -0
  155. package/src/aepp-wallet-communication/schema.ts +2 -17
  156. package/src/aepp-wallet-communication/wallet-detector.ts +1 -2
  157. package/src/apis/compiler/compiler.ts +8 -1
  158. package/src/apis/compiler/models/index.ts +1 -8
  159. package/src/apis/compiler/models/mappers.ts +0 -36
  160. package/src/apis/middleware/index.ts +2 -0
  161. package/src/apis/middleware/middleware.ts +1807 -0
  162. package/src/apis/middleware/models/index.ts +1747 -0
  163. package/src/apis/middleware/models/mappers.ts +3370 -0
  164. package/src/apis/middleware/models/parameters.ts +463 -0
  165. package/src/chain.ts +3 -2
  166. package/src/channel/Base.ts +5 -5
  167. package/src/channel/internal.ts +2 -0
  168. package/src/contract/Contract.ts +2 -1
  169. package/src/contract/compiler/Base.ts +26 -0
  170. package/src/contract/compiler/Cli.ts +27 -3
  171. package/src/contract/compiler/Http.ts +21 -2
  172. package/src/contract/compiler/HttpNode.ts +6 -0
  173. package/src/deprecated.ts +23 -0
  174. package/src/index-browser.ts +77 -15
  175. package/src/tx/builder/constants.ts +0 -1
  176. package/src/tx/builder/field-types/coin-amount.ts +2 -1
  177. package/src/tx/builder/field-types/entry.ts +1 -1
  178. package/src/tx/builder/helpers.ts +54 -9
  179. package/src/tx/builder/index.ts +6 -9
  180. package/src/tx/execution-cost.ts +17 -0
  181. package/src/tx/validator.ts +4 -2
  182. package/src/utils/amount-formatter.ts +1 -1
  183. package/src/utils/autorest.ts +5 -10
  184. package/src/utils/crypto.ts +12 -2
  185. package/src/utils/errors.ts +2 -2
  186. package/src/utils/other.ts +5 -0
  187. package/src/utils/typed-data.ts +95 -0
  188. package/types-legacy/ts4.2/AeSdkBase.d.ts +11 -3
  189. package/types-legacy/ts4.2/AeSdkMethods.d.ts +9 -14
  190. package/types-legacy/ts4.2/Middleware.d.ts +46 -0
  191. package/types-legacy/ts4.2/MiddlewareSubscriber.d.ts +30 -0
  192. package/types-legacy/ts4.2/Node.d.ts +1 -1
  193. package/types-legacy/ts4.2/account/Base.d.ts +14 -2
  194. package/types-legacy/ts4.2/account/Generalized.d.ts +1 -0
  195. package/types-legacy/ts4.2/account/Ledger.d.ts +1 -0
  196. package/types-legacy/ts4.2/account/Memory.d.ts +2 -0
  197. package/types-legacy/ts4.2/account/Rpc.d.ts +1 -6
  198. package/types-legacy/ts4.2/aens.d.ts +1 -1
  199. package/types-legacy/ts4.2/aepp-wallet-communication/rpc/types.d.ts +10 -0
  200. package/types-legacy/ts4.2/aepp-wallet-communication/schema.d.ts +1 -8
  201. package/types-legacy/ts4.2/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  202. package/types-legacy/ts4.2/apis/compiler/models/index.d.ts +1 -7
  203. package/types-legacy/ts4.2/apis/compiler/models/mappers.d.ts +0 -1
  204. package/types-legacy/ts4.2/apis/middleware/index.d.ts +2 -0
  205. package/types-legacy/ts4.2/apis/middleware/middleware.d.ts +309 -0
  206. package/types-legacy/ts4.2/apis/middleware/models/index.d.ts +1496 -0
  207. package/types-legacy/ts4.2/apis/middleware/models/mappers.d.ts +102 -0
  208. package/types-legacy/ts4.2/apis/middleware/models/parameters.d.ts +43 -0
  209. package/types-legacy/ts4.2/chain.d.ts +2 -1
  210. package/types-legacy/ts4.2/channel/Base.d.ts +1 -1
  211. package/types-legacy/ts4.2/contract/Contract.d.ts +1 -2
  212. package/types-legacy/ts4.2/contract/compiler/Base.d.ts +21 -0
  213. package/types-legacy/ts4.2/contract/compiler/Cli.d.ts +2 -0
  214. package/types-legacy/ts4.2/contract/compiler/Http.d.ts +2 -0
  215. package/types-legacy/ts4.2/contract/compiler/HttpNode.d.ts +1 -0
  216. package/types-legacy/ts4.2/deprecated.d.ts +14 -0
  217. package/types-legacy/ts4.2/index-browser.d.ts +20 -14
  218. package/types-legacy/ts4.2/tx/builder/constants.d.ts +0 -1
  219. package/types-legacy/ts4.2/tx/builder/field-types/coin-amount.d.ts +1 -1
  220. package/types-legacy/ts4.2/tx/builder/field-types/deposit.d.ts +1 -1
  221. package/types-legacy/ts4.2/tx/builder/field-types/index.d.ts +2 -2
  222. package/types-legacy/ts4.2/tx/builder/helpers.d.ts +8 -1
  223. package/types-legacy/ts4.2/tx/builder/index.d.ts +4 -2
  224. package/types-legacy/ts4.2/tx/builder/schema.d.ts +9 -9
  225. package/types-legacy/ts4.2/tx/execution-cost.d.ts +17 -0
  226. package/types-legacy/ts4.2/utils/amount-formatter.d.ts +1 -2
  227. package/types-legacy/ts4.2/utils/crypto.d.ts +1 -0
  228. package/types-legacy/ts4.2/utils/errors.d.ts +2 -2
  229. package/types-legacy/ts4.2/utils/other.d.ts +1 -0
  230. package/types-legacy/ts4.2/utils/typed-data.d.ts +60 -0
  231. package/types-legacy/ts4.5/AeSdkBase.d.ts +11 -3
  232. package/types-legacy/ts4.5/AeSdkMethods.d.ts +9 -14
  233. package/types-legacy/ts4.5/Middleware.d.ts +46 -0
  234. package/types-legacy/ts4.5/MiddlewareSubscriber.d.ts +30 -0
  235. package/types-legacy/ts4.5/Node.d.ts +1 -1
  236. package/types-legacy/ts4.5/account/Base.d.ts +14 -2
  237. package/types-legacy/ts4.5/account/Generalized.d.ts +1 -0
  238. package/types-legacy/ts4.5/account/Ledger.d.ts +1 -0
  239. package/types-legacy/ts4.5/account/Memory.d.ts +2 -0
  240. package/types-legacy/ts4.5/account/Rpc.d.ts +1 -6
  241. package/types-legacy/ts4.5/aens.d.ts +1 -1
  242. package/types-legacy/ts4.5/aepp-wallet-communication/rpc/types.d.ts +10 -0
  243. package/types-legacy/ts4.5/aepp-wallet-communication/schema.d.ts +1 -8
  244. package/types-legacy/ts4.5/aepp-wallet-communication/wallet-detector.d.ts +1 -1
  245. package/types-legacy/ts4.5/apis/compiler/models/index.d.ts +1 -7
  246. package/types-legacy/ts4.5/apis/compiler/models/mappers.d.ts +0 -1
  247. package/types-legacy/ts4.5/apis/middleware/index.d.ts +2 -0
  248. package/types-legacy/ts4.5/apis/middleware/middleware.d.ts +309 -0
  249. package/types-legacy/ts4.5/apis/middleware/models/index.d.ts +1496 -0
  250. package/types-legacy/ts4.5/apis/middleware/models/mappers.d.ts +102 -0
  251. package/types-legacy/ts4.5/apis/middleware/models/parameters.d.ts +43 -0
  252. package/types-legacy/ts4.5/chain.d.ts +2 -1
  253. package/types-legacy/ts4.5/channel/Base.d.ts +1 -1
  254. package/types-legacy/ts4.5/contract/Contract.d.ts +1 -2
  255. package/types-legacy/ts4.5/contract/compiler/Base.d.ts +21 -0
  256. package/types-legacy/ts4.5/contract/compiler/Cli.d.ts +2 -0
  257. package/types-legacy/ts4.5/contract/compiler/Http.d.ts +2 -0
  258. package/types-legacy/ts4.5/contract/compiler/HttpNode.d.ts +1 -0
  259. package/types-legacy/ts4.5/deprecated.d.ts +14 -0
  260. package/types-legacy/ts4.5/index-browser.d.ts +20 -14
  261. package/types-legacy/ts4.5/tx/builder/constants.d.ts +0 -1
  262. package/types-legacy/ts4.5/tx/builder/field-types/coin-amount.d.ts +1 -1
  263. package/types-legacy/ts4.5/tx/builder/field-types/deposit.d.ts +1 -1
  264. package/types-legacy/ts4.5/tx/builder/field-types/index.d.ts +2 -2
  265. package/types-legacy/ts4.5/tx/builder/helpers.d.ts +8 -1
  266. package/types-legacy/ts4.5/tx/builder/index.d.ts +4 -2
  267. package/types-legacy/ts4.5/tx/builder/schema.d.ts +9 -9
  268. package/types-legacy/ts4.5/tx/execution-cost.d.ts +17 -0
  269. package/types-legacy/ts4.5/utils/amount-formatter.d.ts +1 -2
  270. package/types-legacy/ts4.5/utils/crypto.d.ts +1 -0
  271. package/types-legacy/ts4.5/utils/errors.d.ts +2 -2
  272. package/types-legacy/ts4.5/utils/other.d.ts +1 -0
  273. package/types-legacy/ts4.5/utils/typed-data.d.ts +60 -0
  274. package/es/typings/@aeternity__aepp-calldata/index.d.mjs +0 -2
  275. package/es/typings/@aeternity__aepp-calldata/index.d.mjs.map +0 -1
  276. package/src/typings/@aeternity__aepp-calldata/index.d.ts +0 -20
@@ -2,7 +2,7 @@ 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
6
  type NodeInfo = Awaited<ReturnType<Node['getNodeInfo']>> & {
7
7
  name: string;
8
8
  };
@@ -19,7 +19,7 @@ export default class AeSdkBase extends AeSdkMethods {
19
19
  * @param options - Options
20
20
  * @param options.nodes - Array of nodes
21
21
  */
22
- constructor({ nodes, ...options }?: ConstructorParameters<typeof AeSdkMethods>[0] & {
22
+ constructor({ nodes, ...options }?: AeSdkMethodsOptions & {
23
23
  nodes?: Array<{
24
24
  name: string;
25
25
  instance: Node;
@@ -72,6 +72,11 @@ export default class AeSdkBase extends AeSdkMethods {
72
72
  */
73
73
  getNodesInPool(): Promise<NodeInfo[]>;
74
74
  addresses(): Encoded.AccountAddress[];
75
+ /**
76
+ * Resolves an account
77
+ * @param account - ak-address, instance of AccountBase, or keypair
78
+ */
79
+ _resolveAccount(account?: OnAccount): AccountBase;
75
80
  get address(): Encoded.AccountAddress;
76
81
  sign(data: string | Uint8Array, { onAccount, ...options }?: {
77
82
  onAccount?: OnAccount;
@@ -82,7 +87,10 @@ export default class AeSdkBase extends AeSdkMethods {
82
87
  signMessage(message: string, { onAccount, ...options }?: {
83
88
  onAccount?: OnAccount;
84
89
  } & Parameters<AccountBase['signMessage']>[1]): Promise<Uint8Array>;
85
- _getOptions(): {
90
+ signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { onAccount, ...options }?: {
91
+ onAccount?: OnAccount;
92
+ } & Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
93
+ _getOptions(callOptions?: AeSdkMethodsOptions): {
86
94
  onNode: Node;
87
95
  onAccount: AccountBase;
88
96
  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;
@@ -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;
@@ -2,6 +2,7 @@ import { Encoded } from '../utils/encoder';
2
2
  import Node from '../Node';
3
3
  import CompilerBase from '../contract/compiler/Base';
4
4
  import { 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,28 @@ 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
+ abstract signTypedData(data: Encoded.ContractBytearray, aci: AciValue, options?: Domain & {
54
+ aeppOrigin?: string;
55
+ aeppRpcClientId?: string;
56
+ }): Promise<Encoded.Signature>;
45
57
  /**
46
58
  * Sign data blob
47
59
  * @param data - Data blob to sign
48
60
  * @param options - Options
49
- * @returns Signed data blob
61
+ * @returns Signature
50
62
  */
51
63
  abstract sign(data: string | Uint8Array, options?: any): Promise<Uint8Array>;
52
64
  /**
@@ -12,5 +12,6 @@ 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>;
15
16
  signTransaction(tx: Encoded.Transaction, { authData, onCompiler, onNode }: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
16
17
  }
@@ -20,6 +20,7 @@ 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>;
23
24
  signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: {
24
25
  innerTx?: boolean;
25
26
  networkId?: string;
@@ -1,5 +1,6 @@
1
1
  import AccountBase from './Base';
2
2
  import { Encoded } from '../utils/encoder';
3
+ import { AciValue } from '../utils/typed-data';
3
4
  export declare function getBufferToSign(transaction: Encoded.Transaction, networkId: string, innerTx: boolean): Uint8Array;
4
5
  /**
5
6
  * In-memory account class
@@ -20,4 +21,5 @@ export default class AccountMemory extends AccountBase {
20
21
  networkId?: string;
21
22
  }): Promise<Encoded.Transaction>;
22
23
  signMessage(message: string, options?: any): Promise<Uint8Array>;
24
+ signTypedData(data: Encoded.ContractBytearray, aci: AciValue, { name, version, networkId, contractAddress, ...options }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
23
25
  }
@@ -14,12 +14,7 @@ export default class AccountRpc extends AccountBase {
14
14
  readonly address: Encoded.AccountAddress;
15
15
  constructor(rpcClient: RpcClient<WalletApi, AeppApi>, address: Encoded.AccountAddress);
16
16
  sign(): Promise<Uint8Array>;
17
- /**
18
- * @returns Signed transaction
19
- */
20
17
  signTransaction(tx: Encoded.Transaction, { innerTx, networkId }?: Parameters<AccountBase['signTransaction']>[1]): Promise<Encoded.Transaction>;
21
- /**
22
- * @returns Signed message
23
- */
24
18
  signMessage(message: string): Promise<Uint8Array>;
19
+ signTypedData(data: Encoded.ContractBytearray, aci: Parameters<AccountBase['signTypedData']>[1], { name, version, contractAddress, networkId, }?: Parameters<AccountBase['signTypedData']>[2]): Promise<Encoded.Signature>;
25
20
  }
@@ -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,4 +1,5 @@
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';
@@ -60,6 +61,7 @@ export interface WalletApi {
60
61
  * @see {@link https://github.com/aeternity/aepp-sdk-js/commit/153fd89a52c4eab39fcd659b356b36d32129c1ba}
61
62
  */
62
63
  networkId: string;
64
+ innerTx?: boolean;
63
65
  }) => Promise<{
64
66
  /**
65
67
  * @deprecated this is not a hash at all, will be removed later at the same time
@@ -77,6 +79,14 @@ export interface WalletApi {
77
79
  }) => Promise<{
78
80
  signature: string;
79
81
  }>;
82
+ [METHODS.signTypedData]: (p: {
83
+ domain: Domain;
84
+ aci: AciValue;
85
+ data: Encoded.ContractBytearray;
86
+ onAccount: Encoded.AccountAddress;
87
+ }) => Promise<{
88
+ signature: Encoded.Signature;
89
+ }>;
80
90
  }
81
91
  export interface AeppApi {
82
92
  [METHODS.updateAddress]: (a: Accounts) => void;
@@ -31,6 +31,7 @@ export declare const enum METHODS {
31
31
  connect = "connection.open",
32
32
  sign = "transaction.sign",
33
33
  signMessage = "message.sign",
34
+ signTypedData = "typedData.sign",
34
35
  subscribeAddress = "address.subscribe",
35
36
  updateNetwork = "networkId.update",
36
37
  closeConnection = "connection.close"
@@ -66,14 +67,6 @@ export declare class RpcInvalidTransactionError extends RpcError {
66
67
  code: number;
67
68
  constructor(data?: any);
68
69
  }
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
70
  /**
78
71
  * @category exception
79
72
  */
@@ -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";