dequanto 0.1.39 → 0.1.45

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 (204) hide show
  1. package/lib/cjs/clients/ClientPool.js +23 -2
  2. package/lib/cjs/clients/ClientPool.js.map +1 -1
  3. package/lib/cjs/clients/WalletClient.js +98 -0
  4. package/lib/cjs/clients/WalletClient.js.map +1 -0
  5. package/lib/cjs/clients/Web3Client.js +39 -10
  6. package/lib/cjs/clients/Web3Client.js.map +1 -1
  7. package/lib/cjs/clients/Web3ClientFactory.js +7 -37
  8. package/lib/cjs/clients/Web3ClientFactory.js.map +1 -1
  9. package/lib/cjs/config/Config.js +4 -1
  10. package/lib/cjs/config/Config.js.map +1 -1
  11. package/lib/cjs/config/ConfigDefaults.js +3 -6
  12. package/lib/cjs/config/ConfigDefaults.js.map +1 -1
  13. package/lib/cjs/config/ConfigProvider.js +5 -1
  14. package/lib/cjs/config/ConfigProvider.js.map +1 -1
  15. package/lib/cjs/contracts/ContractWriter.js.map +1 -1
  16. package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js +10 -1
  17. package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
  18. package/lib/cjs/explorer/BlockchainExplorer.js +65 -43
  19. package/lib/cjs/explorer/BlockchainExplorer.js.map +1 -1
  20. package/lib/cjs/explorer/BlockchainExplorerFactory.js +6 -4
  21. package/lib/cjs/explorer/BlockchainExplorerFactory.js.map +1 -1
  22. package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js +5 -5
  23. package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
  24. package/lib/cjs/json/JsonArrayMultiStore.js.map +1 -1
  25. package/lib/cjs/json/JsonArrayStore.js +1 -1
  26. package/lib/cjs/json/JsonArrayStore.js.map +1 -1
  27. package/lib/cjs/json/JsonObjectStore.js +2 -1
  28. package/lib/cjs/json/JsonObjectStore.js.map +1 -1
  29. package/lib/cjs/json/JsonStoreFs.js +84 -18
  30. package/lib/cjs/json/JsonStoreFs.js.map +1 -1
  31. package/lib/cjs/models/TChain.js +4 -0
  32. package/lib/cjs/models/TChain.js.map +1 -0
  33. package/lib/cjs/models/TExplorer.js +4 -0
  34. package/lib/cjs/models/TExplorer.js.map +1 -0
  35. package/lib/cjs/models/TPlatform.js +1 -0
  36. package/lib/cjs/models/TPlatform.js.map +1 -1
  37. package/lib/cjs/rpc/transports/ITransport.js.map +1 -1
  38. package/lib/cjs/rpc/transports/RpcTransport.js +4 -0
  39. package/lib/cjs/rpc/transports/RpcTransport.js.map +1 -1
  40. package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js +14 -2
  41. package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
  42. package/lib/cjs/rpc/transports/compatibility/IEIP6963Provider.js +4 -0
  43. package/lib/cjs/rpc/transports/compatibility/IEIP6963Provider.js.map +1 -0
  44. package/lib/cjs/safe/GnosisSafeHandler.js.map +1 -1
  45. package/lib/cjs/tokens/TokenProviders/TPChain.js +5 -1
  46. package/lib/cjs/tokens/TokenProviders/TPChain.js.map +1 -1
  47. package/lib/cjs/txs/TxWriter.js +8 -1
  48. package/lib/cjs/txs/TxWriter.js.map +1 -1
  49. package/lib/cjs/utils/$buffer.js.map +1 -1
  50. package/lib/cjs/utils/$config.js +67 -2
  51. package/lib/cjs/utils/$config.js.map +1 -1
  52. package/lib/cjs/utils/$dependency.js +4 -0
  53. package/lib/cjs/utils/$dependency.js.map +1 -1
  54. package/lib/cjs/utils/$path.js +9 -0
  55. package/lib/cjs/utils/$path.js.map +1 -1
  56. package/lib/cjs/utils/$ref.js +30 -0
  57. package/lib/cjs/utils/$ref.js.map +1 -0
  58. package/lib/cjs/utils/$secret.js +15 -2
  59. package/lib/cjs/utils/$secret.js.map +1 -1
  60. package/lib/cjs/utils/$sig.js +18 -9
  61. package/lib/cjs/utils/$sig.js.map +1 -1
  62. package/lib/cjs/wallets/EIP6963ProviderFactory.js +192 -0
  63. package/lib/cjs/wallets/EIP6963ProviderFactory.js.map +1 -0
  64. package/lib/cjs/wallets/Signer.js +30 -0
  65. package/lib/cjs/wallets/Signer.js.map +1 -0
  66. package/lib/esm/clients/ClientPool.js.map +1 -1
  67. package/lib/esm/clients/ClientPool.mjs +23 -2
  68. package/lib/esm/clients/WalletClient.js.map +1 -0
  69. package/lib/esm/clients/WalletClient.mjs +91 -0
  70. package/lib/esm/clients/Web3Client.js.map +1 -1
  71. package/lib/esm/clients/Web3Client.mjs +39 -10
  72. package/lib/esm/clients/Web3ClientFactory.js.map +1 -1
  73. package/lib/esm/clients/Web3ClientFactory.mjs +7 -37
  74. package/lib/esm/config/Config.js.map +1 -1
  75. package/lib/esm/config/Config.mjs +4 -1
  76. package/lib/esm/config/ConfigDefaults.js.map +1 -1
  77. package/lib/esm/config/ConfigDefaults.mjs +3 -6
  78. package/lib/esm/config/ConfigProvider.js.map +1 -1
  79. package/lib/esm/config/ConfigProvider.mjs +5 -1
  80. package/lib/esm/contracts/ContractWriter.js.map +1 -1
  81. package/lib/esm/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
  82. package/lib/esm/contracts/deploy/storage/DeploymentsStorage.mjs +10 -1
  83. package/lib/esm/explorer/BlockchainExplorer.js.map +1 -1
  84. package/lib/esm/explorer/BlockchainExplorer.mjs +65 -43
  85. package/lib/esm/explorer/BlockchainExplorerFactory.js.map +1 -1
  86. package/lib/esm/explorer/BlockchainExplorerFactory.mjs +6 -4
  87. package/lib/esm/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
  88. package/lib/esm/explorer/verifiers/FsHtmlVerifier.mjs +5 -5
  89. package/lib/esm/json/JsonArrayMultiStore.js.map +1 -1
  90. package/lib/esm/json/JsonArrayStore.js.map +1 -1
  91. package/lib/esm/json/JsonArrayStore.mjs +1 -1
  92. package/lib/esm/json/JsonObjectStore.js.map +1 -1
  93. package/lib/esm/json/JsonObjectStore.mjs +2 -1
  94. package/lib/esm/json/JsonStoreFs.js.map +1 -1
  95. package/lib/esm/json/JsonStoreFs.mjs +84 -18
  96. package/lib/esm/models/TChain.js.map +1 -0
  97. package/lib/esm/models/TChain.mjs +3 -0
  98. package/lib/esm/models/TExplorer.js.map +1 -0
  99. package/lib/esm/models/TExplorer.mjs +3 -0
  100. package/lib/esm/models/TPlatform.js.map +1 -1
  101. package/lib/esm/models/TPlatform.mjs +1 -0
  102. package/lib/esm/rpc/transports/ITransport.js.map +1 -1
  103. package/lib/esm/rpc/transports/RpcTransport.js.map +1 -1
  104. package/lib/esm/rpc/transports/RpcTransport.mjs +4 -0
  105. package/lib/esm/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
  106. package/lib/esm/rpc/transports/compatibility/EIP1193Transport.mjs +14 -2
  107. package/lib/esm/rpc/transports/compatibility/IEIP6963Provider.js.map +1 -0
  108. package/lib/esm/rpc/transports/compatibility/IEIP6963Provider.mjs +3 -0
  109. package/lib/esm/safe/GnosisSafeHandler.js.map +1 -1
  110. package/lib/esm/tokens/TokenProviders/TPChain.js.map +1 -1
  111. package/lib/esm/tokens/TokenProviders/TPChain.mjs +5 -1
  112. package/lib/esm/txs/TxWriter.js.map +1 -1
  113. package/lib/esm/txs/TxWriter.mjs +8 -1
  114. package/lib/esm/utils/$buffer.js.map +1 -1
  115. package/lib/esm/utils/$config.js.map +1 -1
  116. package/lib/esm/utils/$config.mjs +64 -2
  117. package/lib/esm/utils/$dependency.js.map +1 -1
  118. package/lib/esm/utils/$dependency.mjs +4 -0
  119. package/lib/esm/utils/$path.js.map +1 -1
  120. package/lib/esm/utils/$path.mjs +9 -0
  121. package/lib/esm/utils/$ref.js.map +1 -0
  122. package/lib/esm/utils/$ref.mjs +27 -0
  123. package/lib/esm/utils/$secret.js.map +1 -1
  124. package/lib/esm/utils/$secret.mjs +15 -2
  125. package/lib/esm/utils/$sig.js.map +1 -1
  126. package/lib/esm/utils/$sig.mjs +18 -9
  127. package/lib/esm/wallets/EIP6963ProviderFactory.js.map +1 -0
  128. package/lib/esm/wallets/EIP6963ProviderFactory.mjs +185 -0
  129. package/lib/esm/wallets/Signer.js.map +1 -0
  130. package/lib/esm/wallets/Signer.mjs +26 -0
  131. package/lib/types/clients/ClientPool.d.ts +13 -5
  132. package/lib/types/clients/WalletClient.d.ts +28 -0
  133. package/lib/types/clients/Web3Client.d.ts +7 -4
  134. package/lib/types/clients/Web3ClientFactory.d.ts +1 -1
  135. package/lib/types/clients/interfaces/IWeb3Client.d.ts +2 -5
  136. package/lib/types/config/AConfigBase.d.ts +0 -7
  137. package/lib/types/config/interface/IConfigData.d.ts +5 -2
  138. package/lib/types/explorer/BlockchainExplorer.d.ts +7 -4
  139. package/lib/types/explorer/BlockchainExplorerFactory.d.ts +7 -3
  140. package/lib/types/explorer/verifiers/FsHtmlVerifier.d.ts +3 -3
  141. package/lib/types/json/JsonArrayMultiStore.d.ts +2 -2
  142. package/lib/types/json/JsonArrayStore.d.ts +4 -3
  143. package/lib/types/json/JsonObjectStore.d.ts +5 -3
  144. package/lib/types/json/JsonStoreFs.d.ts +3 -2
  145. package/lib/types/models/TAccount.d.ts +9 -0
  146. package/lib/types/models/TChain.d.ts +45 -0
  147. package/lib/types/models/TEth.d.ts +8 -0
  148. package/lib/types/models/TExplorer.d.ts +31 -0
  149. package/lib/types/rpc/transports/ITransport.d.ts +2 -1
  150. package/lib/types/rpc/transports/compatibility/EIP1193Transport.d.ts +5 -1
  151. package/lib/types/rpc/transports/compatibility/IEIP6963Provider.d.ts +21 -0
  152. package/lib/types/utils/$config.d.ts +5 -0
  153. package/lib/types/utils/$ref.d.ts +11 -0
  154. package/lib/types/utils/$secret.d.ts +1 -0
  155. package/lib/types/utils/$sig.d.ts +1 -0
  156. package/lib/types/wallets/EIP6963ProviderFactory.d.ts +47 -0
  157. package/lib/types/wallets/Signer.d.ts +15 -0
  158. package/package.json +1 -1
  159. package/src/clients/ClientPool.ts +49 -15
  160. package/src/clients/WalletClient.ts +115 -0
  161. package/src/clients/Web3Client.ts +47 -16
  162. package/src/clients/Web3ClientFactory.ts +8 -39
  163. package/src/clients/interfaces/IWeb3Client.ts +2 -7
  164. package/src/config/AConfigBase.ts +3 -11
  165. package/src/config/Config.ts +6 -1
  166. package/src/config/ConfigDefaults.ts +3 -6
  167. package/src/config/ConfigProvider.ts +5 -1
  168. package/src/config/interface/IConfigData.ts +9 -4
  169. package/src/contracts/ContractWriter.ts +1 -0
  170. package/src/contracts/deploy/storage/DeploymentsStorage.ts +13 -3
  171. package/src/explorer/BlockchainExplorer.ts +82 -51
  172. package/src/explorer/BlockchainExplorerFactory.ts +19 -6
  173. package/src/explorer/verifiers/FsHtmlVerifier.ts +8 -8
  174. package/src/json/JsonArrayMultiStore.ts +2 -2
  175. package/src/json/JsonArrayStore.ts +5 -2
  176. package/src/json/JsonObjectStore.ts +7 -4
  177. package/src/json/JsonStoreFs.ts +103 -18
  178. package/src/models/TAccount.ts +10 -2
  179. package/src/models/TChain.ts +56 -0
  180. package/src/models/TEth.ts +9 -3
  181. package/src/models/TExplorer.ts +35 -0
  182. package/src/models/TPlatform.ts +1 -0
  183. package/src/rpc/transports/ITransport.ts +2 -1
  184. package/src/rpc/transports/RpcTransport.ts +4 -0
  185. package/src/rpc/transports/compatibility/EIP1193Transport.ts +19 -6
  186. package/src/rpc/transports/compatibility/IEIP6963Provider.ts +22 -0
  187. package/src/safe/GnosisSafeHandler.ts +1 -1
  188. package/src/tokens/TokenProviders/TPChain.ts +5 -1
  189. package/src/txs/TxWriter.ts +8 -2
  190. package/src/utils/$buffer.ts +1 -1
  191. package/src/utils/$config.ts +73 -2
  192. package/src/utils/$dependency.ts +5 -0
  193. package/src/utils/$path.ts +9 -0
  194. package/src/utils/$ref.ts +40 -0
  195. package/src/utils/$secret.ts +16 -3
  196. package/src/utils/$sig.ts +19 -10
  197. package/src/wallets/EIP6963ProviderFactory.ts +252 -0
  198. package/src/wallets/Signer.ts +32 -0
  199. package/lib/cjs/wallets/WalletBsc.js +0 -19
  200. package/lib/cjs/wallets/WalletBsc.js.map +0 -1
  201. package/lib/esm/wallets/WalletBsc.js.map +0 -1
  202. package/lib/esm/wallets/WalletBsc.mjs +0 -12
  203. package/lib/types/wallets/WalletBsc.d.ts +0 -10
  204. package/src/wallets/WalletBsc.ts +0 -13
@@ -0,0 +1,26 @@
1
+ export class Signer {
2
+ constructor(opts) {
3
+ this.opts = opts;
4
+ }
5
+ eth_sign(account, data) {
6
+ return this.call('eth_sign', [account, data]);
7
+ }
8
+ eth_signTransaction(tx) {
9
+ return this.call('eth_signTransaction', [tx]);
10
+ }
11
+ eth_signTypedData_v4(address, typedData) {
12
+ return this.call('eth_signTypedData_v4', [address, typedData]);
13
+ }
14
+ personal_sign(challenge, address) {
15
+ return this.call('personal_sign', [challenge, address]);
16
+ }
17
+ call(method, params) {
18
+ let fn = this.opts[method] ?? this.opts.rpc[method];
19
+ if (typeof fn === 'function') {
20
+ return fn(...params);
21
+ }
22
+ throw new Error(`Method ${method} not found in Signer`);
23
+ }
24
+ }
25
+ //# sourceMappingURL=Signer.js.map
26
+ //# sourceMappingURL=Signer.ts.map
@@ -5,17 +5,19 @@ import { ClientPoolTrace } from './ClientPoolStats';
5
5
  import { IWeb3ClientOptions } from './interfaces/IWeb3Client';
6
6
  import { RateLimitGuard } from './handlers/RateLimitGuard';
7
7
  import { Web3BatchRequests } from './Web3BatchRequests';
8
- import { Rpc } from '../rpc/Rpc';
8
+ import { Rpc, RpcTypes } from '../rpc/Rpc';
9
9
  import { PromiseEvent } from '../class/PromiseEvent';
10
10
  import { TTransport } from '../rpc/transports/ITransport';
11
11
  import { TRpc } from '../rpc/RpcBase';
12
12
  import { TEth } from '../models/TEth';
13
- export interface IPoolClientConfig {
13
+ import { DataLike } from '../utils/types';
14
+ export interface IRpcConfig {
14
15
  url?: string;
15
16
  options?: TTransport.Options.Http | TTransport.Options.Ws;
16
- /** Will be a pefered node for submitting transactions */
17
+ /** Will be a preferred node for submitting transactions */
17
18
  safe?: boolean;
18
19
  distinct?: boolean;
20
+ wallet?: boolean;
19
21
  web3?: TTransport.Transport | Promise<TTransport.Transport>;
20
22
  name?: string;
21
23
  /** Will be used only if manually requested with .getWeb3, or .getNodeUrl */
@@ -35,6 +37,8 @@ export interface IPoolClientConfig {
35
37
  export interface IPoolWeb3Request {
36
38
  ws?: boolean;
37
39
  preferSafe?: boolean;
40
+ /** Request wallet node to submit unsigned transactions */
41
+ wallet?: boolean;
38
42
  distinct?: boolean;
39
43
  name?: string;
40
44
  /** HTTP Web3 Client traces */
@@ -68,11 +72,13 @@ export declare class ClientPool {
68
72
  getNodeURL(options?: IPoolWeb3Request): Promise<string>;
69
73
  releaseWeb3(): Promise<void>;
70
74
  getOptionForFetchableRange(blockRangeLimits?: WClient['blockRangeLimits']): number;
75
+ wrappedPromiEvent<T>(asyncFactory: () => Promise<T>): PromiseEvent<T>;
71
76
  callPromiEvent<TResult extends PromiseEvent<any>>(fn: (web3: WClient) => TResult, opts?: {
72
77
  preferSafe?: boolean;
73
78
  parallel?: number;
74
79
  silent?: boolean;
75
80
  distinct?: boolean;
81
+ wallet?: boolean;
76
82
  }, used?: Map<WClient, number>, errors?: any[], root?: PromiseEventWrap): TResult;
77
83
  getNodeStats(): {
78
84
  success: number;
@@ -105,7 +111,7 @@ export declare class WClient {
105
111
  ping: number;
106
112
  };
107
113
  rpc: Rpc;
108
- config: IPoolClientConfig;
114
+ config: IRpcConfig;
109
115
  rateLimitGuard: RateLimitGuard;
110
116
  /** For getLogs method, as some providers limit the range request or page result value */
111
117
  blockRangeLimits: {
@@ -116,7 +122,7 @@ export declare class WClient {
116
122
  healthy(): boolean;
117
123
  private updateRateLimitInfo;
118
124
  updateBlockRangeInfo(info: WClient['blockRangeLimits']): void;
119
- constructor(mix: IPoolClientConfig);
125
+ constructor(mix: IRpcConfig);
120
126
  send<TResult>(fn: (web3: WClient) => PromiseEvent<TResult>): Promise<{
121
127
  status: ClientStatus;
122
128
  error?: any;
@@ -124,6 +130,8 @@ export declare class WClient {
124
130
  }>;
125
131
  sendSignedTransaction(tx: TEth.Hex): PromiseEvent<TEth.TxReceipt>;
126
132
  sendTransaction(tx: any): PromiseEvent<TEth.TxReceipt>;
133
+ sign(address: TEth.Address, message: string): Promise<string>;
134
+ signTypedData(address: TEth.Address, typedData: DataLike<RpcTypes.TypedData>): Promise<TEth.Hex>;
127
135
  callBatched<TResult = any>(requests: TRpc.IRpcAction[]): Promise<TResult[]>;
128
136
  call<TResult extends PromiseLike<any>>(fn: (wClient: WClient) => TResult, options?: {
129
137
  batchRequestCount?: number;
@@ -0,0 +1,28 @@
1
+ import { TEth } from '../models/TEth';
2
+ import { Rpc, RpcTypes } from '../rpc/Rpc';
3
+ import { DataLike } from '../utils/types';
4
+ import { EIP6963ProviderDetail, EIP6963ProviderFactory } from '../wallets/EIP6963ProviderFactory';
5
+ import { WClient } from './ClientPool';
6
+ /** Wallet actions only. For all Node (Chain) related actions - Web3Client should be used */
7
+ export declare class WalletClient {
8
+ factory: EIP6963ProviderFactory;
9
+ constructor(factory?: EIP6963ProviderFactory);
10
+ useProvider(uuid: string): Promise<void>;
11
+ getProvider(uuid?: string): Promise<EIP6963ProviderDetail>;
12
+ getProviders(): Promise<EIP6963ProviderDetail[]>;
13
+ getAccounts(uuid?: string): Promise<TEth.Address[]>;
14
+ /** Find the provider by UUID or use the first one to connect to and to requestAccounts */
15
+ connect(uuid?: string): Promise<TEth.Address[]>;
16
+ disconnect(): Promise<void>;
17
+ isConnected(address?: TEth.Address): boolean;
18
+ eth_accounts(): Promise<`0x${string}`[]>;
19
+ eth_requestAccounts(): Promise<`0x${string}`[]>;
20
+ eth_sign(address: TEth.Address, message: string): Promise<string>;
21
+ eth_signTypedData_v4(address: TEth.Address, typedData: DataLike<RpcTypes.TypedData>): Promise<`0x${string}`>;
22
+ eth_sendTransaction(...args: Parameters<Rpc['eth_sendTransaction']>): Promise<`0x${string}`>;
23
+ eth_chainId(...args: Parameters<Rpc['eth_chainId']>): Promise<number>;
24
+ wallet_addEthereumChain(...args: Parameters<Rpc['wallet_addEthereumChain']>): Promise<undefined>;
25
+ wallet_switchEthereumChain(...args: Parameters<Rpc['wallet_switchEthereumChain']>): Promise<undefined>;
26
+ getClientFor(chainId: number): Promise<WClient>;
27
+ private getRpc;
28
+ }
@@ -1,7 +1,7 @@
1
1
  import type { TAbiItem } from '../types/TAbi';
2
2
  import type { TPlatform } from '../models/TPlatform';
3
3
  import type { IWeb3Client, IWeb3ClientOptions } from './interfaces/IWeb3Client';
4
- import { ClientPool, IPoolClientConfig, IPoolWeb3Request, WClient } from './ClientPool';
4
+ import { ClientPool, IRpcConfig, IPoolWeb3Request, WClient } from './ClientPool';
5
5
  import { ClientEventsStream } from './ClientEventsStream';
6
6
  import { ClientDebugMethods } from './debug/ClientDebugMethods';
7
7
  import { TRpcContractCall } from '../rpc/RpcContract';
@@ -11,6 +11,7 @@ import { PromiseEvent } from '../class/PromiseEvent';
11
11
  import { Rpc, RpcTypes } from '../rpc/Rpc';
12
12
  import { TRpc } from '../rpc/RpcBase';
13
13
  import { DataLike } from '../utils/types';
14
+ import { WalletClient } from './WalletClient';
14
15
  export declare abstract class Web3Client implements IWeb3Client {
15
16
  TIMEOUT: number;
16
17
  abstract platform: TPlatform;
@@ -25,12 +26,12 @@ export declare abstract class Web3Client implements IWeb3Client {
25
26
  defaultGasPriceRatio: number;
26
27
  blockTimeAvg: number;
27
28
  get network(): TPlatform;
28
- sign(txData: TEth.TxLike, privateKey: TEth.Hex): Promise<string>;
29
29
  options: IWeb3ClientOptions;
30
30
  pool: ClientPool;
31
31
  debug: ClientDebugMethods;
32
+ wallet: WalletClient;
32
33
  constructor(options: IWeb3ClientOptions);
33
- constructor(endpoints: IPoolClientConfig[]);
34
+ constructor(endpoints: IRpcConfig[]);
34
35
  request<TResult = any>(req: TRpc.IRpcAction): Promise<TResult>;
35
36
  batch(requests: TRpc.IRpcAction[]): Promise<any[]>;
36
37
  getEventStream(address: TEth.Address, abi: TAbiItem[], event: string): ClientEventsStream<any>;
@@ -76,6 +77,8 @@ export declare abstract class Web3Client implements IWeb3Client {
76
77
  chainId: number | string;
77
78
  }, options: IPoolWeb3Request): Promise<void>;
78
79
  sendSignedTransaction(signedTxBuffer: TEth.Hex): PromiseEvent<TEth.TxReceipt>;
80
+ sign(address: TEth.Address, message: string): Promise<string>;
81
+ signTypedData(address: TEth.Address, typedData: DataLike<RpcTypes.TypedData>): Promise<TEth.Hex>;
79
82
  sendTransaction(data: TEth.TxLike): PromiseEvent<TEth.TxReceipt>;
80
83
  getBlockNumber(): Promise<number>;
81
84
  call(tx: TEth.TxLike): Promise<any>;
@@ -107,7 +110,7 @@ export declare abstract class Web3Client implements IWeb3Client {
107
110
  url: string;
108
111
  }[];
109
112
  static url<T extends Web3Client>(options: IWeb3ClientOptions): any;
110
- static url<T extends Web3Client>(endpoints: IPoolClientConfig[], opts?: Partial<IWeb3ClientOptions>): any;
113
+ static url<T extends Web3Client>(endpoints: IRpcConfig[], opts?: Partial<IWeb3ClientOptions>): any;
111
114
  static url<T extends Web3Client>(url: string, opts?: Partial<IWeb3ClientOptions>): T;
112
115
  }
113
116
  export type TLogsRangeProgress<TLogParsed> = {
@@ -2,7 +2,7 @@ import { TPlatform } from '../models/TPlatform';
2
2
  import { IWeb3EndpointOptions } from './interfaces/IWeb3EndpointOptions';
3
3
  import { EvmWeb3Client } from './EvmWeb3Client';
4
4
  export declare namespace Web3ClientFactory {
5
- function get(platform: TPlatform | string | number, opts?: IWeb3EndpointOptions): import("../hardhat/HardhatWeb3Client").HardhatWeb3Client | EvmWeb3Client;
5
+ function get(platform: TPlatform | number, opts?: IWeb3EndpointOptions): import("../hardhat/HardhatWeb3Client").HardhatWeb3Client | EvmWeb3Client;
6
6
  /** Same as sync variation, but ensures the config is being fetched */
7
7
  function getAsync(platform: TPlatform | string | number, opts?: IWeb3EndpointOptions): Promise<import("../hardhat/HardhatWeb3Client").HardhatWeb3Client | EvmWeb3Client>;
8
8
  }
@@ -1,16 +1,13 @@
1
- import { TBufferLike } from '../../models/TBufferLike';
2
1
  import { TPlatform } from '../../models/TPlatform';
3
- import { IPoolClientConfig } from '../ClientPool';
4
- import { TEth } from '../../models/TEth';
2
+ import { IRpcConfig } from '../ClientPool';
5
3
  import { TTransport } from '../../rpc/transports/ITransport';
6
4
  export interface IWeb3Client {
7
5
  platform: string;
8
6
  chainId: number;
9
7
  defaultGasLimit: number;
10
- sign(txData: TEth.Tx, privateKey: string): Promise<TBufferLike>;
11
8
  }
12
9
  export interface IWeb3ClientOptions {
13
- endpoints: IPoolClientConfig[];
10
+ endpoints: IRpcConfig[];
14
11
  platform?: TPlatform;
15
12
  chainId?: number;
16
13
  chainToken?: string;
@@ -11,13 +11,6 @@ export type TConfigParamsNode = TConfigParamsBase & {
11
11
  };
12
12
  export type TConfigParamsBrowser = TConfigParamsBase & {};
13
13
  export type TConfigParams = TConfigParamsNode | TConfigParamsBrowser;
14
- export interface IProviderEndpoint {
15
- url: string;
16
- private?: boolean;
17
- safe?: boolean;
18
- manual?: boolean;
19
- traceable?: boolean;
20
- }
21
14
  export interface IConfigProvider {
22
15
  fetch(parameters?: TConfigParamsBase): Promise<IConfigData>;
23
16
  extend(json?: Partial<IConfigData>): Promise<void>;
@@ -2,7 +2,8 @@ import { IContractDetails } from '../../models/IContractDetails';
2
2
  import { ITokenGlob } from '../../models/ITokenGlob';
3
3
  import { TAddress } from '../../models/TAddress';
4
4
  import { TPlatform } from '../../models/TPlatform';
5
- import { IProviderEndpoint } from '../AConfigBase';
5
+ import { IRpcConfig } from '../../clients/ClientPool';
6
+ import { TChain } from '../../models/TChain';
6
7
  export interface IConfigData {
7
8
  settings: {
8
9
  /** Root path of the dequanto library */
@@ -27,11 +28,13 @@ export interface IConfigData {
27
28
  host: string;
28
29
  };
29
30
  };
31
+ chains: TChain[];
30
32
  web3: {
31
33
  [platform in TPlatform]: {
32
34
  chainId?: number;
33
35
  chainToken?: string;
34
- endpoints: IProviderEndpoint[];
36
+ aliases?: string[];
37
+ endpoints: IRpcConfig[];
35
38
  };
36
39
  };
37
40
  contracts?: {
@@ -5,6 +5,8 @@ import { TAddress } from '../models/TAddress';
5
5
  import { TPlatform } from '../models/TPlatform';
6
6
  import { TEth } from '../models/TEth';
7
7
  import { IVerifier } from './verifiers/IVerifier';
8
+ import { TExplorer, TExplorerDefinition } from '../models/TExplorer';
9
+ /** @deprecated use TExplorerDefinition instead */
8
10
  export interface IBlockchainExplorerConfig {
9
11
  key?: string;
10
12
  api?: string;
@@ -17,6 +19,7 @@ export interface IBlockchainExplorerConfig {
17
19
  verification?: boolean | 'fs';
18
20
  }[];
19
21
  }
22
+ /** @deprecated use TExplorerDefinition instead */
20
23
  export interface IBlockchainExplorerFactoryParams extends IBlockchainExplorerConfig {
21
24
  platform?: string;
22
25
  ABI_CACHE?: string;
@@ -33,12 +36,12 @@ type TxFilter = {
33
36
  export declare class BlockchainExplorer implements IBlockchainExplorer {
34
37
  client: HttpClient;
35
38
  inMemoryDb: IContractDetails[];
36
- config: IBlockchainExplorerConfig;
37
39
  fsVerification: IVerifier;
38
- opts: IBlockchainExplorerFactoryParams;
40
+ config: TExplorer;
39
41
  platform: TPlatform;
40
- constructor(opts?: IBlockchainExplorerFactoryParams);
41
- constructor(platform?: TPlatform);
42
+ getWeb3: (platform: any) => Web3Client;
43
+ constructor(config: TExplorerDefinition);
44
+ constructor(opts: IBlockchainExplorerFactoryParams);
42
45
  getContractMeta(name: string): any;
43
46
  getContractMeta(address: string): any;
44
47
  getContractCreation(address: TAddress): Promise<{
@@ -1,15 +1,19 @@
1
1
  import { IBlockchainExplorer } from './IBlockchainExplorer';
2
2
  import { Constructor } from '../utils/types';
3
- import { BlockchainExplorer, IBlockchainExplorerFactoryParams } from './BlockchainExplorer';
3
+ import { IBlockchainExplorerFactoryParams } from './BlockchainExplorer';
4
4
  import { TPlatform } from '../models/TPlatform';
5
+ import { TExplorerDefinition } from '../models/TExplorer';
5
6
  /**
6
7
  * @obsolete Use BlockchainExplorer class instead.
7
8
  */
8
9
  export declare namespace BlockchainExplorerFactory {
9
10
  function register(platform: TPlatform, explorer: IBlockchainExplorer | Constructor<IBlockchainExplorer>): void;
10
- function get(platform: TPlatform | string, opts?: IBlockchainExplorerFactoryParams): IBlockchainExplorer | BlockchainExplorer;
11
+ function get(platform: TPlatform | number): any;
12
+ function get(config: TExplorerDefinition): any;
13
+ /** @obsolete */
14
+ function get(platform: TPlatform | number, opts: IBlockchainExplorerFactoryParams): any;
11
15
  /** Same as sync variation, but ensures the config is being fetched */
12
- function getAsync(platform: TPlatform | string, opts?: IBlockchainExplorerFactoryParams): Promise<IBlockchainExplorer | BlockchainExplorer>;
16
+ function getAsync(platform: TPlatform, opts?: IBlockchainExplorerFactoryParams): Promise<any>;
13
17
  /** @obsolete Create instance directly with the get/getAsync method */
14
18
  function create(opts: IBlockchainExplorerFactoryParams): Constructor<IBlockchainExplorer>;
15
19
  }
@@ -2,13 +2,13 @@ import { TEth } from '../../models/TEth';
2
2
  import { IVerifier } from './IVerifier';
3
3
  import { IBlockchainTransferEvent } from '../IBlockchainExplorer';
4
4
  import { TPlatform } from '../../models/TPlatform';
5
- import { IBlockchainExplorerConfig } from '../BlockchainExplorer';
5
+ import { TExplorer } from '../../models/TExplorer';
6
6
  export declare class FsHtmlVerifier implements IVerifier {
7
7
  platform: TPlatform;
8
- config: IBlockchainExplorerConfig;
8
+ config: TExplorer;
9
9
  private key;
10
10
  private enabled;
11
- constructor(platform: TPlatform, config: IBlockchainExplorerConfig);
11
+ constructor(platform: TPlatform, config: TExplorer);
12
12
  submitContractVerification(contractData: {
13
13
  address: `0x${string}`;
14
14
  sourceCode: any;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Store data across multiple files for cases, that could contain thousands of entries
3
3
  */
4
- import { IStoreOptions } from './JsonArrayStore';
4
+ import { IArrayStoreOptions } from './JsonArrayStore';
5
5
  import type { Alot } from 'alot/alot';
6
- export interface IMultiStoreOptions<T> extends IStoreOptions<T> {
6
+ export interface IMultiStoreOptions<T> extends IArrayStoreOptions<T> {
7
7
  groupKey: (x: T) => number;
8
8
  groupSize: number;
9
9
  }
@@ -1,6 +1,6 @@
1
1
  import { Alot } from 'alot/alot';
2
2
  import { Constructor } from '../utils/types';
3
- export interface IStoreOptions<T, TStorage = T> {
3
+ export interface IArrayStoreOptions<T, TStorage = T> {
4
4
  path: string;
5
5
  watchFs?: boolean;
6
6
  onFsChanged?: () => any;
@@ -9,13 +9,14 @@ export interface IStoreOptions<T, TStorage = T> {
9
9
  serialize?(x: T): TStorage;
10
10
  Type?: Constructor;
11
11
  format?: boolean;
12
+ transport?: 'file' | 'localStorage';
12
13
  }
13
14
  export declare class JsonArrayStore<T> {
14
- options: IStoreOptions<T>;
15
+ options: IArrayStoreOptions<T>;
15
16
  private array;
16
17
  private hash;
17
18
  private fs;
18
- constructor(options: IStoreOptions<T>);
19
+ constructor(options: IArrayStoreOptions<T>);
19
20
  query(): Promise<Alot<T>>;
20
21
  getAll(opts?: {
21
22
  cloned?: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { Constructor } from 'atma-utils';
2
- export interface IStoreOptions<T, TOut = T> {
2
+ export interface IObjectStoreOptions<T, TOut = T> {
3
3
  path: string;
4
4
  map?(x: T): TOut;
5
5
  serialize?(x: T): any;
@@ -7,12 +7,14 @@ export interface IStoreOptions<T, TOut = T> {
7
7
  format?: boolean;
8
8
  default?: TOut;
9
9
  watchFs?: boolean;
10
+ onFsChanged?: () => any;
11
+ transport?: 'file' | 'localStorage';
10
12
  }
11
13
  export declare class JsonObjectStore<T> {
12
- options: IStoreOptions<T>;
14
+ options: IObjectStoreOptions<T>;
13
15
  private data;
14
16
  private fs;
15
- constructor(options: IStoreOptions<T>);
17
+ constructor(options: IObjectStoreOptions<T>);
16
18
  get(opts?: {
17
19
  cloned?: boolean;
18
20
  }): Promise<this['options']['default']>;
@@ -6,6 +6,7 @@ export declare class JsonStoreFs<T> {
6
6
  format?: boolean;
7
7
  $default?: T;
8
8
  serializeFn?: (x: T) => any;
9
+ persistence: 'file' | 'localStorage';
9
10
  errored: Error;
10
11
  private listeners;
11
12
  private version;
@@ -14,9 +15,9 @@ export declare class JsonStoreFs<T> {
14
15
  private busy;
15
16
  private watcherFn;
16
17
  private watching;
17
- private file;
18
+ private transport;
18
19
  lock: class_Dfr<any>;
19
- constructor(path: string, Type?: Constructor, mapFn?: (x: T) => any, format?: boolean, $default?: T, serializeFn?: (x: T) => any);
20
+ constructor(path: string, Type?: Constructor, mapFn?: (x: T) => any, format?: boolean, $default?: T, serializeFn?: (x: T) => any, persistence?: 'file' | 'localStorage');
20
21
  watch(cb: typeof this.watcherFn): void;
21
22
  unwatch(): void;
22
23
  cleanCache(): void;
@@ -1,3 +1,4 @@
1
+ import type { RpcTypes } from '../rpc/Rpc';
1
2
  import { TAddress } from './TAddress';
2
3
  import { TEth } from './TEth';
3
4
  import { TPlatform } from './TPlatform';
@@ -14,6 +15,13 @@ export interface IAccountTx extends IAccount {
14
15
  export interface EoAccount extends IAccount {
15
16
  type?: 'eoa';
16
17
  key?: TEth.Hex | `p1:0x${string}`;
18
+ signer?: IRpcSigner;
19
+ }
20
+ interface IRpcSigner {
21
+ eth_sign(account: TEth.Address, data: TEth.Hex): Promise<TEth.Hex>;
22
+ eth_signTransaction(tx: TEth.TxLike): Promise<TEth.Hex>;
23
+ eth_signTypedData_v4(address: TEth.Address, typedData: Partial<RpcTypes.TypedData>): Promise<TEth.Hex>;
24
+ personal_sign(challenge: string, address: TEth.Address): Promise<TEth.Hex>;
17
25
  }
18
26
  export interface SafeAccount extends IAccount {
19
27
  type: 'safe';
@@ -34,3 +42,4 @@ export interface Erc4337Account extends IAccount {
34
42
  operator: EoAccount;
35
43
  }
36
44
  export type TAccount = string | IAccount | EoAccount | SafeAccount | Erc4337Account;
45
+ export {};
@@ -0,0 +1,45 @@
1
+ import { IRpcConfig } from '../clients/ClientPool';
2
+ import { TEth } from './TEth';
3
+ import { IToken } from './IToken';
4
+ import { TExplorer } from './TExplorer';
5
+ export interface TChain {
6
+ name?: string;
7
+ icon?: string;
8
+ wwww?: string;
9
+ platform: TEth.Platform;
10
+ aliases?: string[];
11
+ chainId?: number;
12
+ chainToken?: string;
13
+ endpoints: IRpcConfig[];
14
+ explorers: TExplorer[];
15
+ tokens?: IToken[];
16
+ defaultTxType?: 0 | 1 | 2;
17
+ defaultGasPriceRatio?: number;
18
+ blockTimeAvg?: number;
19
+ erc4337?: {
20
+ name: string;
21
+ contracts: {
22
+ entryPoint: TEth.Address;
23
+ accountFactory: TEth.Address;
24
+ };
25
+ }[];
26
+ safe?: {
27
+ transactionService: `https://${string}`;
28
+ contracts: {
29
+ Safe: TEth.Address;
30
+ SafeL2?: TEth.Address;
31
+ SafeProxyFactory: TEth.Address;
32
+ MultiSend: TEth.Address;
33
+ CreateCall?: TEth.Address;
34
+ };
35
+ };
36
+ flashbots?: {
37
+ url: string;
38
+ };
39
+ spotPriceAggregator?: {
40
+ aggregator: TEth.Address;
41
+ };
42
+ ens?: {
43
+ registry: TEth.Address;
44
+ };
45
+ }
@@ -1,3 +1,4 @@
1
+ import type { RpcTypes } from '../rpc/Rpc';
1
2
  import { TPlatform } from './TPlatform';
2
3
  export declare namespace TEth {
3
4
  type Hex = `0x${string}`;
@@ -114,6 +115,13 @@ export declare namespace TEth {
114
115
  interface EoAccount extends IAccount {
115
116
  type?: 'eoa';
116
117
  key?: TEth.Hex | `p1:0x${string}`;
118
+ signer?: IRpcSigner;
119
+ }
120
+ interface IRpcSigner {
121
+ eth_sign(account: TEth.Address, data: TEth.Hex): Promise<TEth.Hex>;
122
+ eth_signTransaction(tx: TEth.TxLike): Promise<TEth.Hex>;
123
+ eth_signTypedData_v4(address: TEth.Address, typedData: Partial<RpcTypes.TypedData>): Promise<TEth.Hex>;
124
+ personal_sign(challenge: string, address: TEth.Address): Promise<TEth.Hex>;
117
125
  }
118
126
  interface SafeAccount extends IAccount {
119
127
  type: 'safe';
@@ -0,0 +1,31 @@
1
+ import { Web3Client } from '../clients/Web3Client';
2
+ import { IContractDetails } from './IContractDetails';
3
+ import { TEth } from './TEth';
4
+ /** Blockchain explorer settings - in config */
5
+ export interface TExplorerDefinition {
6
+ platform: TEth.Platform;
7
+ name?: string;
8
+ standard?: 'EIP3091' | string;
9
+ url?: string;
10
+ key?: string;
11
+ api?: string | {
12
+ url?: string;
13
+ key?: string;
14
+ };
15
+ verification?: boolean | 'fs';
16
+ ABI_CACHE?: string;
17
+ CONTRACTS?: IContractDetails[];
18
+ getWeb3?: (platform?: TEth.Platform) => Web3Client;
19
+ }
20
+ /** Blockchain explorer settings - normalized */
21
+ export interface TExplorer {
22
+ platform: TEth.Platform;
23
+ name: string;
24
+ standard: 'EIP3091' | string;
25
+ url: string;
26
+ api: {
27
+ url: string;
28
+ key?: string;
29
+ };
30
+ verification: boolean | 'fs';
31
+ }
@@ -1,6 +1,7 @@
1
1
  import type { IWeb3EndpointOptions } from '../../clients/interfaces/IWeb3EndpointOptions';
2
2
  import type { TEth } from '../../models/TEth';
3
3
  import type { ClientOptions } from 'ws';
4
+ import { IEip1193Provider } from './compatibility/EIP1193Transport';
4
5
  export declare namespace TTransport {
5
6
  type Transport = {
6
7
  id?: string;
@@ -37,7 +38,7 @@ export declare namespace TTransport {
37
38
  subscribe(cb: (x: T) => void, onError?: (x: Error | any) => void, once?: any): any;
38
39
  }
39
40
  namespace Options {
40
- type Any = string | Http | Ws | Wrapped | Transport | Web3Wrapper;
41
+ type Any = string | Http | Ws | Wrapped | Transport | Web3Wrapper | IEip1193Provider;
41
42
  type Http = {
42
43
  url: string;
43
44
  } & Omit<Parameters<typeof fetch>[1], 'headers'> & {
@@ -1,7 +1,11 @@
1
1
  import { TTransport } from '../ITransport';
2
2
  import { RpcSubscription } from '../../RpcSubscription';
3
3
  export interface IEip1193Provider {
4
- sendAsync: any;
4
+ sendAsync?(request: Object, callback: Function): void;
5
+ request(args: {
6
+ method: string;
7
+ params?: any[];
8
+ }): Promise<unknown>;
5
9
  }
6
10
  export declare class EIP1193Transport implements TTransport.Transport {
7
11
  private provider;
@@ -0,0 +1,21 @@
1
+ export interface IEIP6963Provider {
2
+ isStatus?: boolean;
3
+ request: (request: {
4
+ method: string;
5
+ params?: Array<any>;
6
+ }) => Promise<any>;
7
+ on(event: 'accountsChanged', handler: (accounts: Array<string>) => void): any;
8
+ on(event: 'chainChanged', handler: (chainId: string) => void): any;
9
+ on(event: 'connect', handler: (connectInfo: ConnectInfo) => void): any;
10
+ on(event: 'disconnect', handler: (error: ProviderRpcError) => void): any;
11
+ removeListener(event: 'accountsChanged' | 'chainChanged' | 'connect' | 'disconnect', handler: (...args: any[]) => void): any;
12
+ }
13
+ interface ConnectInfo {
14
+ chainId: string;
15
+ }
16
+ interface ProviderRpcError extends Error {
17
+ message: string;
18
+ code: number;
19
+ data?: unknown;
20
+ }
21
+ export {};
@@ -1,5 +1,10 @@
1
+ import { TEth } from '../models/TEth';
2
+ import { IWeb3ClientOptions } from '../clients/interfaces/IWeb3Client';
3
+ import { TExplorerDefinition } from '../models/TExplorer';
1
4
  export declare namespace $config {
2
5
  function get<T = any>(path: string, $default?: T): T;
6
+ function getWeb3Options(mix: TEth.Platform | number): IWeb3ClientOptions;
7
+ function getExplorerOptions(mix: TEth.Platform | number): TExplorerDefinition;
3
8
  function set<T = any>(path: string, value: T): void;
4
9
  /**
5
10
  * Reloads dequanto env config from cli ARGUMENTS and DQ_SETTINGS__** environment
@@ -0,0 +1,11 @@
1
+ import { IEIP6963Provider } from '../rpc/transports/compatibility/IEIP6963Provider';
2
+ export type TGlobal = {
3
+ ethereum: IEIP6963Provider;
4
+ addEventListener: Window['addEventListener'];
5
+ removeEventListener: Window['removeEventListener'];
6
+ dispatchEvent(event: any): void;
7
+ localStorage?: WindowLocalStorage['localStorage'];
8
+ };
9
+ export declare namespace $ref {
10
+ function getGlobal(): TGlobal;
11
+ }
@@ -1,5 +1,6 @@
1
1
  export declare namespace $secret {
2
2
  function getPin(parameters?: {
3
3
  pin?: string;
4
+ machineKey?: string;
4
5
  }): Promise<string>;
5
6
  }
@@ -21,6 +21,7 @@ export declare namespace $sig {
21
21
  }): TEth.Address;
22
22
  function recoverTx(signedTxRaw: TEth.Hex): `0x${string}`;
23
23
  namespace $rpc {
24
+ function ensureRpcSigner(account: TEth.EoAccount, mix: Rpc | Web3Client): Promise<Rpc>;
24
25
  function signTx(rpc: Rpc, tx: TEth.TxLike): Promise<TEth.Hex>;
25
26
  function signTypedData(rpc: Rpc, typedData: Partial<RpcTypes.TypedData>, account: TEth.EoAccount): Promise<TSignature>;
26
27
  function sign(rpc: Rpc, message: string | Uint8Array, account: TEth.EoAccount): Promise<TSignature>;