@rango-dev/wallets-core 0.37.1-next.1 → 0.38.1-next.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 (193) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/builders/action.d.ts +22 -0
  3. package/dist/builders/action.d.ts.map +1 -0
  4. package/dist/builders/mod.d.ts +5 -0
  5. package/dist/builders/mod.d.ts.map +1 -0
  6. package/dist/builders/namespace.d.ts +47 -0
  7. package/dist/builders/namespace.d.ts.map +1 -0
  8. package/dist/builders/provider.d.ts +13 -0
  9. package/dist/builders/provider.d.ts.map +1 -0
  10. package/dist/builders/types.d.ts +21 -0
  11. package/dist/builders/types.d.ts.map +1 -0
  12. package/dist/hub/helpers.d.ts +6 -0
  13. package/dist/hub/helpers.d.ts.map +1 -0
  14. package/dist/hub/hub.d.ts +28 -0
  15. package/dist/hub/hub.d.ts.map +1 -0
  16. package/dist/hub/mod.d.ts +7 -0
  17. package/dist/hub/mod.d.ts.map +1 -0
  18. package/dist/hub/namespaces/errors.d.ts +4 -0
  19. package/dist/hub/namespaces/errors.d.ts.map +1 -0
  20. package/dist/hub/namespaces/mod.d.ts +3 -0
  21. package/dist/hub/namespaces/mod.d.ts.map +1 -0
  22. package/dist/hub/namespaces/namespace.d.ts +146 -0
  23. package/dist/hub/namespaces/namespace.d.ts.map +1 -0
  24. package/dist/hub/namespaces/namespace.test.d.ts +2 -0
  25. package/dist/hub/namespaces/namespace.test.d.ts.map +1 -0
  26. package/dist/hub/namespaces/types.d.ts +33 -0
  27. package/dist/hub/namespaces/types.d.ts.map +1 -0
  28. package/dist/hub/provider/mod.d.ts +3 -0
  29. package/dist/hub/provider/mod.d.ts.map +1 -0
  30. package/dist/hub/provider/provider.d.ts +136 -0
  31. package/dist/hub/provider/provider.d.ts.map +1 -0
  32. package/dist/hub/provider/provider.test.d.ts +2 -0
  33. package/dist/hub/provider/provider.test.d.ts.map +1 -0
  34. package/dist/hub/provider/types.d.ts +28 -0
  35. package/dist/hub/provider/types.d.ts.map +1 -0
  36. package/dist/hub/store/hub.d.ts +11 -0
  37. package/dist/hub/store/hub.d.ts.map +1 -0
  38. package/dist/hub/store/mod.d.ts +6 -0
  39. package/dist/hub/store/mod.d.ts.map +1 -0
  40. package/dist/hub/store/namespaces.d.ts +34 -0
  41. package/dist/hub/store/namespaces.d.ts.map +1 -0
  42. package/dist/hub/store/providers.d.ts +45 -0
  43. package/dist/hub/store/providers.d.ts.map +1 -0
  44. package/dist/hub/store/selectors.d.ts +18 -0
  45. package/dist/hub/store/selectors.d.ts.map +1 -0
  46. package/dist/hub/store/store.d.ts +13 -0
  47. package/dist/hub/store/store.d.ts.map +1 -0
  48. package/dist/hub/store/store.test.d.ts +2 -0
  49. package/dist/hub/store/store.test.d.ts.map +1 -0
  50. package/dist/mod.d.ts +6 -1
  51. package/dist/mod.d.ts.map +1 -1
  52. package/dist/mod.js +1 -0
  53. package/dist/mod.js.map +4 -4
  54. package/dist/namespaces/common/actions.d.ts +4 -0
  55. package/dist/namespaces/common/actions.d.ts.map +1 -0
  56. package/dist/namespaces/common/after.d.ts +4 -0
  57. package/dist/namespaces/common/after.d.ts.map +1 -0
  58. package/dist/namespaces/common/and.d.ts +6 -0
  59. package/dist/namespaces/common/and.d.ts.map +1 -0
  60. package/dist/namespaces/common/before.d.ts +4 -0
  61. package/dist/namespaces/common/before.d.ts.map +1 -0
  62. package/dist/namespaces/common/builders.d.ts +4 -0
  63. package/dist/namespaces/common/builders.d.ts.map +1 -0
  64. package/dist/namespaces/common/helpers.d.ts +2 -0
  65. package/dist/namespaces/common/helpers.d.ts.map +1 -0
  66. package/dist/namespaces/common/mod.d.ts +6 -0
  67. package/dist/namespaces/common/mod.d.ts.map +1 -0
  68. package/dist/namespaces/common/mod.js +2 -0
  69. package/dist/namespaces/common/mod.js.map +7 -0
  70. package/dist/namespaces/common/types.d.ts +7 -0
  71. package/dist/namespaces/common/types.d.ts.map +1 -0
  72. package/dist/namespaces/cosmos/mod.d.ts +2 -0
  73. package/dist/namespaces/cosmos/mod.d.ts.map +1 -0
  74. package/dist/namespaces/cosmos/types.d.ts +4 -0
  75. package/dist/namespaces/cosmos/types.d.ts.map +1 -0
  76. package/dist/namespaces/evm/actions.d.ts +8 -0
  77. package/dist/namespaces/evm/actions.d.ts.map +1 -0
  78. package/dist/namespaces/evm/after.d.ts +2 -0
  79. package/dist/namespaces/evm/after.d.ts.map +1 -0
  80. package/dist/namespaces/evm/and.d.ts +3 -0
  81. package/dist/namespaces/evm/and.d.ts.map +1 -0
  82. package/dist/namespaces/evm/before.d.ts +2 -0
  83. package/dist/namespaces/evm/before.d.ts.map +1 -0
  84. package/dist/namespaces/evm/builders.d.ts +4 -0
  85. package/dist/namespaces/evm/builders.d.ts.map +1 -0
  86. package/dist/namespaces/evm/constants.d.ts +3 -0
  87. package/dist/namespaces/evm/constants.d.ts.map +1 -0
  88. package/dist/namespaces/evm/eip1193.d.ts +1228 -0
  89. package/dist/namespaces/evm/eip1193.d.ts.map +1 -0
  90. package/dist/namespaces/evm/mod.d.ts +9 -0
  91. package/dist/namespaces/evm/mod.d.ts.map +1 -0
  92. package/dist/namespaces/evm/mod.js +2 -0
  93. package/dist/namespaces/evm/mod.js.map +7 -0
  94. package/dist/namespaces/evm/types.d.ts +10 -0
  95. package/dist/namespaces/evm/types.d.ts.map +1 -0
  96. package/dist/namespaces/evm/utils.d.ts +9 -0
  97. package/dist/namespaces/evm/utils.d.ts.map +1 -0
  98. package/dist/namespaces/solana/actions.d.ts +6 -0
  99. package/dist/namespaces/solana/actions.d.ts.map +1 -0
  100. package/dist/namespaces/solana/after.d.ts +2 -0
  101. package/dist/namespaces/solana/after.d.ts.map +1 -0
  102. package/dist/namespaces/solana/and.d.ts +3 -0
  103. package/dist/namespaces/solana/and.d.ts.map +1 -0
  104. package/dist/namespaces/solana/before.d.ts +2 -0
  105. package/dist/namespaces/solana/before.d.ts.map +1 -0
  106. package/dist/namespaces/solana/builders.d.ts +4 -0
  107. package/dist/namespaces/solana/builders.d.ts.map +1 -0
  108. package/dist/namespaces/solana/constants.d.ts +3 -0
  109. package/dist/namespaces/solana/constants.d.ts.map +1 -0
  110. package/dist/namespaces/solana/mod.d.ts +8 -0
  111. package/dist/namespaces/solana/mod.d.ts.map +1 -0
  112. package/dist/namespaces/solana/mod.js +2 -0
  113. package/dist/namespaces/solana/mod.js.map +7 -0
  114. package/dist/namespaces/solana/types.d.ts +7 -0
  115. package/dist/namespaces/solana/types.d.ts.map +1 -0
  116. package/dist/test-utils/fixtures.d.ts +3 -0
  117. package/dist/test-utils/fixtures.d.ts.map +1 -0
  118. package/dist/types/accounts.d.ts +11 -0
  119. package/dist/types/accounts.d.ts.map +1 -0
  120. package/dist/types/actions.d.ts +5 -0
  121. package/dist/types/actions.d.ts.map +1 -0
  122. package/dist/types/utils.d.ts +7 -0
  123. package/dist/types/utils.d.ts.map +1 -0
  124. package/dist/utils/mod.d.ts +4 -0
  125. package/dist/utils/mod.d.ts.map +1 -0
  126. package/dist/utils/mod.js +2 -0
  127. package/dist/utils/mod.js.map +7 -0
  128. package/dist/utils/versions.d.ts +21 -0
  129. package/dist/utils/versions.d.ts.map +1 -0
  130. package/dist/utils/versions.test.d.ts +2 -0
  131. package/dist/utils/versions.test.d.ts.map +1 -0
  132. package/dist/wallets-core.build.json +1 -1
  133. package/package.json +25 -4
  134. package/src/builders/action.ts +86 -0
  135. package/src/builders/mod.ts +5 -0
  136. package/src/builders/namespace.ts +229 -0
  137. package/src/builders/provider.ts +61 -0
  138. package/src/builders/types.ts +29 -0
  139. package/src/hub/helpers.ts +11 -0
  140. package/src/hub/hub.ts +122 -0
  141. package/src/hub/mod.ts +10 -0
  142. package/src/hub/namespaces/errors.ts +8 -0
  143. package/src/hub/namespaces/mod.ts +9 -0
  144. package/src/hub/namespaces/namespace.test.ts +333 -0
  145. package/src/hub/namespaces/namespace.ts +443 -0
  146. package/src/hub/namespaces/types.ts +50 -0
  147. package/src/hub/provider/mod.ts +9 -0
  148. package/src/hub/provider/provider.test.ts +231 -0
  149. package/src/hub/provider/provider.ts +330 -0
  150. package/src/hub/provider/types.ts +37 -0
  151. package/src/hub/store/hub.ts +18 -0
  152. package/src/hub/store/mod.ts +8 -0
  153. package/src/hub/store/namespaces.ts +90 -0
  154. package/src/hub/store/providers.ts +97 -0
  155. package/src/hub/store/selectors.ts +59 -0
  156. package/src/hub/store/store.test.ts +32 -0
  157. package/src/hub/store/store.ts +26 -0
  158. package/src/mod.ts +35 -1
  159. package/src/namespaces/common/actions.ts +11 -0
  160. package/src/namespaces/common/after.ts +8 -0
  161. package/src/namespaces/common/and.ts +42 -0
  162. package/src/namespaces/common/before.ts +9 -0
  163. package/src/namespaces/common/builders.ts +19 -0
  164. package/src/namespaces/common/helpers.ts +10 -0
  165. package/src/namespaces/common/mod.ts +12 -0
  166. package/src/namespaces/common/types.ts +7 -0
  167. package/src/namespaces/cosmos/mod.ts +1 -0
  168. package/src/namespaces/cosmos/types.ts +10 -0
  169. package/src/namespaces/evm/actions.ts +97 -0
  170. package/src/namespaces/evm/after.ts +3 -0
  171. package/src/namespaces/evm/and.ts +5 -0
  172. package/src/namespaces/evm/before.ts +3 -0
  173. package/src/namespaces/evm/builders.ts +10 -0
  174. package/src/namespaces/evm/constants.ts +2 -0
  175. package/src/namespaces/evm/eip1193.ts +1414 -0
  176. package/src/namespaces/evm/mod.ts +9 -0
  177. package/src/namespaces/evm/types.ts +18 -0
  178. package/src/namespaces/evm/utils.ts +52 -0
  179. package/src/namespaces/solana/actions.ts +70 -0
  180. package/src/namespaces/solana/after.ts +3 -0
  181. package/src/namespaces/solana/and.ts +5 -0
  182. package/src/namespaces/solana/before.ts +3 -0
  183. package/src/namespaces/solana/builders.ts +10 -0
  184. package/src/namespaces/solana/constants.ts +2 -0
  185. package/src/namespaces/solana/mod.ts +8 -0
  186. package/src/namespaces/solana/types.ts +20 -0
  187. package/src/test-utils/fixtures.ts +9 -0
  188. package/src/types/accounts.ts +12 -0
  189. package/src/types/actions.ts +11 -0
  190. package/src/types/utils.ts +7 -0
  191. package/src/utils/mod.ts +8 -0
  192. package/src/utils/versions.test.ts +22 -0
  193. package/src/utils/versions.ts +63 -0
@@ -0,0 +1,1414 @@
1
+ /*
2
+ * These are copied from `viem` (EIP1193Provider)
3
+ * They have an issue with `node16`, we can not directly import from their package.
4
+ * When they fixed the issue, it would better to re-export from viem instead of keeping it here and maintaining the changes.
5
+ */
6
+
7
+ // These are types that has so much nested types, for now i put any instead.
8
+ type Block = any;
9
+ type Log = any;
10
+ type TransactionRequest = any;
11
+ type BlockNumber = any;
12
+ type BlockTag = any;
13
+ type BlockIdentifier = any;
14
+ type RpcStateOverride = any;
15
+ type FeeHistory = any;
16
+ type Proof = any;
17
+ type Transaction = any;
18
+ type TransactionReceipt = any;
19
+ type LogTopic = any;
20
+ type Uncle = any;
21
+ type RpcUserOperation<_ = any> = any;
22
+ type RpcEstimateUserOperationGasReturnType = any;
23
+ type RpcGetUserOperationByHashReturnType = any;
24
+ type RpcUserOperationReceipt = any;
25
+
26
+ type KeyofUnion<type> = type extends type ? keyof type : never;
27
+
28
+ export type OneOf<
29
+ union extends object,
30
+ fallback extends object | undefined = undefined,
31
+ ///
32
+ keys extends KeyofUnion<union> = KeyofUnion<union>
33
+ > = union extends infer item
34
+ ? Prettify<
35
+ item & {
36
+ [key in Exclude<keys, keyof item>]?: fallback extends object
37
+ ? key extends keyof fallback
38
+ ? fallback[key]
39
+ : undefined
40
+ : undefined;
41
+ }
42
+ >
43
+ : never;
44
+
45
+ export type AddEthereumChainParameter = {
46
+ /** A 0x-prefixed hexadecimal string */
47
+ chainId: string;
48
+ /** The chain name. */
49
+ chainName: string;
50
+ /** Native currency for the chain. */
51
+ nativeCurrency?:
52
+ | {
53
+ name: string;
54
+ symbol: string;
55
+ decimals: number;
56
+ }
57
+ | undefined;
58
+ rpcUrls: readonly string[];
59
+ blockExplorerUrls?: string[] | undefined;
60
+ iconUrls?: string[] | undefined;
61
+ };
62
+
63
+ export type NetworkSync = {
64
+ /** The current block number */
65
+ currentBlock: Quantity;
66
+ /** Number of latest block on the network */
67
+ highestBlock: Quantity;
68
+ /** Block number at which syncing started */
69
+ startingBlock: Quantity;
70
+ };
71
+
72
+ export type WalletCapabilities = {
73
+ [capability: string]: any;
74
+ };
75
+
76
+ export type WalletCapabilitiesRecord<
77
+ capabilities extends WalletCapabilities = WalletCapabilities,
78
+ id extends string | number = Hex
79
+ > = {
80
+ [chainId in id]: capabilities;
81
+ };
82
+
83
+ export type WalletCallReceipt<quantity = Hex, status = Hex> = {
84
+ logs: {
85
+ address: Hex;
86
+ data: Hex;
87
+ topics: Hex[];
88
+ }[];
89
+ status: status;
90
+ blockHash: Hex;
91
+ blockNumber: quantity;
92
+ gasUsed: quantity;
93
+ transactionHash: Hex;
94
+ };
95
+
96
+ export type WalletGrantPermissionsParameters = {
97
+ signer?:
98
+ | {
99
+ type: string;
100
+ data?: unknown | undefined;
101
+ }
102
+ | undefined;
103
+ permissions: readonly {
104
+ data: unknown;
105
+ policies: readonly {
106
+ data: unknown;
107
+ type: string;
108
+ }[];
109
+ required?: boolean | undefined;
110
+ type: string;
111
+ }[];
112
+ expiry: number;
113
+ };
114
+
115
+ export type WalletGrantPermissionsReturnType = {
116
+ expiry: number;
117
+ factory?: `0x${string}` | undefined;
118
+ factoryData?: string | undefined;
119
+ grantedPermissions: readonly {
120
+ data: unknown;
121
+ policies: readonly {
122
+ data: unknown;
123
+ type: string;
124
+ }[];
125
+ required?: boolean | undefined;
126
+ type: string;
127
+ }[];
128
+ permissionsContext: string;
129
+ signerData?:
130
+ | {
131
+ userOpBuilder?: `0x${string}` | undefined;
132
+ submitToAddress?: `0x${string}` | undefined;
133
+ }
134
+ | undefined;
135
+ };
136
+
137
+ export type WalletGetCallsStatusReturnType<quantity = Hex, status = Hex> = {
138
+ status: 'PENDING' | 'CONFIRMED';
139
+ receipts?: WalletCallReceipt<quantity, status>[] | undefined;
140
+ };
141
+
142
+ export type WalletPermissionCaveat = {
143
+ type: string;
144
+ value: any;
145
+ };
146
+
147
+ export type WalletPermission = {
148
+ caveats: WalletPermissionCaveat[];
149
+ date: number;
150
+ id: string;
151
+ invoker: `http://${string}` | `https://${string}`;
152
+ parentCapability: 'eth_accounts' | string;
153
+ };
154
+
155
+ export type WalletSendCallsParameters<
156
+ capabilities extends WalletCapabilities = WalletCapabilities,
157
+ chainId extends Hex | number = Hex,
158
+ quantity extends Quantity | bigint = Quantity
159
+ > = [
160
+ {
161
+ calls: OneOf<
162
+ | {
163
+ to: Address;
164
+ data?: Hex | undefined;
165
+ value?: quantity | undefined;
166
+ }
167
+ | {
168
+ data: Hex;
169
+ }
170
+ >[];
171
+ capabilities?: capabilities | undefined;
172
+ chainId: chainId;
173
+ from: Address;
174
+ version: string;
175
+ }
176
+ ];
177
+
178
+ export type WatchAssetParams = {
179
+ /** Token type. */
180
+ type: 'ERC20';
181
+ options: {
182
+ /** The address of the token contract */
183
+ address: string;
184
+ /** A ticker symbol or shorthand, up to 11 characters */
185
+ symbol: string;
186
+ /** The number of token decimals */
187
+ decimals: number;
188
+ /** A string url of the token logo */
189
+ image?: string | undefined;
190
+ };
191
+ };
192
+
193
+ export type ExactPartial<type> = {
194
+ [key in keyof type]?: type[key] | undefined;
195
+ };
196
+
197
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> &
198
+ ExactPartial<Pick<T, K>>;
199
+
200
+ /** TypeScript type to use for `address` values */
201
+ type Address = `0x${string}`;
202
+
203
+ export type ProviderConnectInfo = {
204
+ chainId: string;
205
+ };
206
+
207
+ export type ProviderMessage = {
208
+ type: string;
209
+ data: unknown;
210
+ };
211
+
212
+ class ProviderRpcError extends Error {
213
+ code: number;
214
+ details: string;
215
+
216
+ constructor(code: number, message: string) {
217
+ super(message);
218
+ this.code = code;
219
+ this.details = message;
220
+ }
221
+ }
222
+
223
+ export type EIP1193EventMap = {
224
+ accountsChanged(accounts: Address[]): void;
225
+ chainChanged(chainId: string): void;
226
+ connect(connectInfo: ProviderConnectInfo): void;
227
+ disconnect(error: ProviderRpcError): void;
228
+ message(message: ProviderMessage): void;
229
+ };
230
+
231
+ export type EIP1193Events = {
232
+ on<event extends keyof EIP1193EventMap>(
233
+ event: event,
234
+ listener: EIP1193EventMap[event]
235
+ ): void;
236
+ removeListener<event extends keyof EIP1193EventMap>(
237
+ event: event,
238
+ listener: EIP1193EventMap[event]
239
+ ): void;
240
+ };
241
+
242
+ export type Prettify<T> = {
243
+ [K in keyof T]: T[K];
244
+ // eslint-disable-next-line @typescript-eslint/ban-types
245
+ } & {};
246
+
247
+ export type RpcSchema = readonly {
248
+ Method: string;
249
+ Parameters?: unknown | undefined;
250
+ ReturnType: unknown;
251
+ }[];
252
+
253
+ export type RpcSchemaOverride = Omit<RpcSchema[number], 'Method'>;
254
+
255
+ export type EIP1193Parameters<
256
+ rpcSchema extends RpcSchema | undefined = undefined
257
+ > = rpcSchema extends RpcSchema
258
+ ? {
259
+ [K in keyof rpcSchema]: Prettify<
260
+ {
261
+ method: rpcSchema[K] extends rpcSchema[number]
262
+ ? rpcSchema[K]['Method']
263
+ : never;
264
+ } & (rpcSchema[K] extends rpcSchema[number]
265
+ ? rpcSchema[K]['Parameters'] extends undefined
266
+ ? { params?: undefined }
267
+ : { params: rpcSchema[K]['Parameters'] }
268
+ : never)
269
+ >;
270
+ }[number]
271
+ : {
272
+ method: string;
273
+ params?: unknown | undefined;
274
+ };
275
+
276
+ export type EIP1193RequestOptions = {
277
+ // Deduplicate in-flight requests.
278
+ dedupe?: boolean | undefined;
279
+ // The base delay (in ms) between retries.
280
+ retryDelay?: number | undefined;
281
+ // The max number of times to retry.
282
+ retryCount?: number | undefined;
283
+ /** Unique identifier for the request. */
284
+ uid?: string | undefined;
285
+ };
286
+
287
+ type DerivedRpcSchema<
288
+ rpcSchema extends RpcSchema | undefined,
289
+ rpcSchemaOverride extends RpcSchemaOverride | undefined
290
+ > = rpcSchemaOverride extends RpcSchemaOverride
291
+ ? [rpcSchemaOverride & { Method: string }]
292
+ : rpcSchema;
293
+
294
+ export type EIP1193RequestFn<
295
+ rpcSchema extends RpcSchema | undefined = undefined
296
+ > = <
297
+ rpcSchemaOverride extends RpcSchemaOverride | undefined = undefined,
298
+ _parameters extends EIP1193Parameters<
299
+ DerivedRpcSchema<rpcSchema, rpcSchemaOverride>
300
+ > = EIP1193Parameters<DerivedRpcSchema<rpcSchema, rpcSchemaOverride>>,
301
+ _returnType = DerivedRpcSchema<rpcSchema, rpcSchemaOverride> extends RpcSchema
302
+ ? Extract<
303
+ DerivedRpcSchema<rpcSchema, rpcSchemaOverride>[number],
304
+ { Method: _parameters['method'] }
305
+ >['ReturnType']
306
+ : unknown
307
+ >(
308
+ args: _parameters,
309
+ options?: EIP1193RequestOptions | undefined
310
+ ) => Promise<_returnType>;
311
+
312
+ export type Hex = `0x${string}`;
313
+ export type Hash = `0x${string}`;
314
+ export type Quantity = `0x${string}`;
315
+
316
+ export type PublicRpcSchema = [
317
+ /**
318
+ * @description Returns the version of the current client
319
+ *
320
+ * @example
321
+ * provider.request({ method: 'web3_clientVersion' })
322
+ * // => 'MetaMask/v1.0.0'
323
+ */
324
+ {
325
+ Method: 'web3_clientVersion';
326
+ Parameters?: undefined;
327
+ ReturnType: string;
328
+ },
329
+ /**
330
+ * @description Hashes data using the Keccak-256 algorithm
331
+ *
332
+ * @example
333
+ * provider.request({ method: 'web3_sha3', params: ['0x68656c6c6f20776f726c64'] })
334
+ * // => '0xc94770007dda54cF92009BFF0dE90c06F603a09f'
335
+ */
336
+ {
337
+ Method: 'web3_sha3';
338
+ Parameters: [data: Hash];
339
+ ReturnType: string;
340
+ },
341
+ /**
342
+ * @description Determines if this client is listening for new network connections
343
+ *
344
+ * @example
345
+ * provider.request({ method: 'net_listening' })
346
+ * // => true
347
+ */
348
+ {
349
+ Method: 'net_listening';
350
+ Parameters?: undefined;
351
+ ReturnType: boolean;
352
+ },
353
+ /**
354
+ * @description Returns the number of peers currently connected to this client
355
+ *
356
+ * @example
357
+ * provider.request({ method: 'net_peerCount' })
358
+ * // => '0x1'
359
+ */
360
+ {
361
+ Method: 'net_peerCount';
362
+ Parameters?: undefined;
363
+ ReturnType: Quantity;
364
+ },
365
+ /**
366
+ * @description Returns the chain ID associated with the current network
367
+ *
368
+ * @example
369
+ * provider.request({ method: 'net_version' })
370
+ * // => '1'
371
+ */
372
+ {
373
+ Method: 'net_version';
374
+ Parameters?: undefined;
375
+ ReturnType: Quantity;
376
+ },
377
+ /**
378
+ * @description Returns the base fee per blob gas in wei.
379
+ *
380
+ * @example
381
+ * provider.request({ method: 'eth_blobBaseFee' })
382
+ * // => '0x09184e72a000'
383
+ */
384
+ {
385
+ Method: 'eth_blobBaseFee';
386
+ Parameters?: undefined;
387
+ ReturnType: Quantity;
388
+ },
389
+ /**
390
+ * @description Returns the number of the most recent block seen by this client
391
+ *
392
+ * @example
393
+ * provider.request({ method: 'eth_blockNumber' })
394
+ * // => '0x1b4'
395
+ */
396
+ {
397
+ Method: 'eth_blockNumber';
398
+ Parameters?: undefined;
399
+ ReturnType: Quantity;
400
+ },
401
+ /**
402
+ * @description Executes a new message call immediately without submitting a transaction to the network
403
+ *
404
+ * @example
405
+ * provider.request({ method: 'eth_call', params: [{ to: '0x...', data: '0x...' }] })
406
+ * // => '0x...'
407
+ */
408
+ {
409
+ Method: 'eth_call';
410
+ Parameters:
411
+ | [transaction: ExactPartial<TransactionRequest>]
412
+ | [
413
+ transaction: ExactPartial<TransactionRequest>,
414
+ block: BlockNumber | BlockTag | BlockIdentifier
415
+ ]
416
+ | [
417
+ transaction: ExactPartial<TransactionRequest>,
418
+ block: BlockNumber | BlockTag | BlockIdentifier,
419
+ stateOverrideSet: RpcStateOverride
420
+ ];
421
+ ReturnType: Hex;
422
+ },
423
+ /**
424
+ * @description Returns the chain ID associated with the current network
425
+ * @example
426
+ * provider.request({ method: 'eth_chainId' })
427
+ * // => '1'
428
+ */
429
+ {
430
+ Method: 'eth_chainId';
431
+ Parameters?: undefined;
432
+ ReturnType: Quantity;
433
+ },
434
+ /**
435
+ * @description Returns the client coinbase address.
436
+ * @example
437
+ * provider.request({ method: 'eth_coinbase' })
438
+ * // => '0x...'
439
+ */
440
+ {
441
+ Method: 'eth_coinbase';
442
+ Parameters?: undefined;
443
+ ReturnType: Address;
444
+ },
445
+ /**
446
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
447
+ *
448
+ * @example
449
+ * provider.request({
450
+ * method: 'eth_estimateGas',
451
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
452
+ * })
453
+ * // => '0x5208'
454
+ */
455
+ {
456
+ Method: 'eth_estimateGas';
457
+ Parameters:
458
+ | [transaction: TransactionRequest]
459
+ | [transaction: TransactionRequest, block: BlockNumber | BlockTag]
460
+ | [
461
+ transaction: TransactionRequest,
462
+ block: BlockNumber | BlockTag,
463
+ stateOverride: RpcStateOverride
464
+ ];
465
+ ReturnType: Quantity;
466
+ },
467
+ /**
468
+ * @description Returns a collection of historical gas information
469
+ *
470
+ * @example
471
+ * provider.request({
472
+ * method: 'eth_feeHistory',
473
+ * params: ['4', 'latest', ['25', '75']]
474
+ * })
475
+ * // => {
476
+ * // oldestBlock: '0x1',
477
+ * // baseFeePerGas: ['0x1', '0x2', '0x3', '0x4'],
478
+ * // gasUsedRatio: ['0x1', '0x2', '0x3', '0x4'],
479
+ * // reward: [['0x1', '0x2'], ['0x3', '0x4'], ['0x5', '0x6'], ['0x7', '0x8']]
480
+ * // }
481
+ *
482
+ */
483
+ {
484
+ Method: 'eth_feeHistory';
485
+ Parameters: [
486
+ /** Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available. */
487
+ blockCount: Quantity,
488
+ /** Highest number block of the requested range. */
489
+ newestBlock: BlockNumber | BlockTag,
490
+ /** A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used. */
491
+ rewardPercentiles: number[] | undefined
492
+ ];
493
+ ReturnType: FeeHistory;
494
+ },
495
+ /**
496
+ * @description Returns the current price of gas expressed in wei
497
+ *
498
+ * @example
499
+ * provider.request({ method: 'eth_gasPrice' })
500
+ * // => '0x09184e72a000'
501
+ */
502
+ {
503
+ Method: 'eth_gasPrice';
504
+ Parameters?: undefined;
505
+ ReturnType: Quantity;
506
+ },
507
+ /**
508
+ * @description Returns the balance of an address in wei
509
+ *
510
+ * @example
511
+ * provider.request({ method: 'eth_getBalance', params: ['0x...', 'latest'] })
512
+ * // => '0x12a05...'
513
+ */
514
+ {
515
+ Method: 'eth_getBalance';
516
+ Parameters: [
517
+ address: Address,
518
+ block: BlockNumber | BlockTag | BlockIdentifier
519
+ ];
520
+ ReturnType: Quantity;
521
+ },
522
+ /**
523
+ * @description Returns information about a block specified by hash
524
+ * @link https://eips.ethereum.org/EIPS/eip-1474
525
+ * @example
526
+ * provider.request({ method: 'eth_getBlockByHash', params: ['0x...', true] })
527
+ * // => {
528
+ * // number: '0x1b4',
529
+ * // hash: '0x...',
530
+ * // parentHash: '0x...',
531
+ * // ...
532
+ * // }
533
+ */
534
+ {
535
+ Method: 'eth_getBlockByHash';
536
+ Parameters: [
537
+ /** hash of a block */
538
+ hash: Hash,
539
+ /** true will pull full transaction objects, false will pull transaction hashes */
540
+ includeTransactionObjects: boolean
541
+ ];
542
+ ReturnType: Block | null;
543
+ },
544
+ /**
545
+ * @description Returns information about a block specified by number
546
+ * @link https://eips.ethereum.org/EIPS/eip-1474
547
+ * @example
548
+ * provider.request({ method: 'eth_getBlockByNumber', params: ['0x1b4', true] })
549
+ * // => {
550
+ * // number: '0x1b4',
551
+ * // hash: '0x...',
552
+ * // parentHash: '0x...',
553
+ * // ...
554
+ * // }
555
+ */
556
+ {
557
+ Method: 'eth_getBlockByNumber';
558
+ Parameters: [
559
+ /** block number, or one of "latest", "safe", "finalized", "earliest" or "pending" */
560
+ block: BlockNumber | BlockTag,
561
+ /** true will pull full transaction objects, false will pull transaction hashes */
562
+ includeTransactionObjects: boolean
563
+ ];
564
+ ReturnType: Block | null;
565
+ },
566
+ /**
567
+ * @description Returns the number of transactions in a block specified by block hash
568
+ * @link https://eips.ethereum.org/EIPS/eip-1474
569
+ * @example
570
+ * provider.request({ method: 'eth_getBlockTransactionCountByHash', params: ['0x...'] })
571
+ * // => '0x1'
572
+ */
573
+ {
574
+ Method: 'eth_getBlockTransactionCountByHash';
575
+ Parameters: [hash: Hash];
576
+ ReturnType: Quantity;
577
+ },
578
+ /**
579
+ * @description Returns the number of transactions in a block specified by block number
580
+ * @link https://eips.ethereum.org/EIPS/eip-1474
581
+ * @example
582
+ * provider.request({ method: 'eth_getBlockTransactionCountByNumber', params: ['0x1b4'] })
583
+ * // => '0x1'
584
+ */
585
+ {
586
+ Method: 'eth_getBlockTransactionCountByNumber';
587
+ Parameters: [block: BlockNumber | BlockTag];
588
+ ReturnType: Quantity;
589
+ },
590
+ /**
591
+ * @description Returns the contract code stored at a given address
592
+ * @link https://eips.ethereum.org/EIPS/eip-1474
593
+ * @example
594
+ * provider.request({ method: 'eth_getCode', params: ['0x...', 'latest'] })
595
+ * // => '0x...'
596
+ */
597
+ {
598
+ Method: 'eth_getCode';
599
+ Parameters: [
600
+ address: Address,
601
+ block: BlockNumber | BlockTag | BlockIdentifier
602
+ ];
603
+ ReturnType: Hex;
604
+ },
605
+ /**
606
+ * @description Returns a list of all logs based on filter ID since the last log retrieval
607
+ * @link https://eips.ethereum.org/EIPS/eip-1474
608
+ * @example
609
+ * provider.request({ method: 'eth_getFilterChanges', params: ['0x...'] })
610
+ * // => [{ ... }, { ... }]
611
+ */
612
+ {
613
+ Method: 'eth_getFilterChanges';
614
+ Parameters: [filterId: Quantity];
615
+ ReturnType: Log[] | Hex[];
616
+ },
617
+ /**
618
+ * @description Returns a list of all logs based on filter ID
619
+ * @link https://eips.ethereum.org/EIPS/eip-1474
620
+ * @example
621
+ * provider.request({ method: 'eth_getFilterLogs', params: ['0x...'] })
622
+ * // => [{ ... }, { ... }]
623
+ */
624
+ {
625
+ Method: 'eth_getFilterLogs';
626
+ Parameters: [filterId: Quantity];
627
+ ReturnType: Log[];
628
+ },
629
+ /**
630
+ * @description Returns a list of all logs based on a filter object
631
+ * @link https://eips.ethereum.org/EIPS/eip-1474
632
+ * @example
633
+ * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
634
+ * // => [{ ... }, { ... }]
635
+ */
636
+ {
637
+ Method: 'eth_getLogs';
638
+ Parameters: [
639
+ {
640
+ address?: Address | Address[] | undefined;
641
+ topics?: LogTopic[] | undefined;
642
+ } & (
643
+ | {
644
+ fromBlock?: BlockNumber | BlockTag | undefined;
645
+ toBlock?: BlockNumber | BlockTag | undefined;
646
+ blockHash?: undefined;
647
+ }
648
+ | {
649
+ fromBlock?: undefined;
650
+ toBlock?: undefined;
651
+ blockHash?: Hash | undefined;
652
+ }
653
+ )
654
+ ];
655
+ ReturnType: Log[];
656
+ },
657
+ /**
658
+ * @description Returns the account and storage values of the specified account including the Merkle-proof.
659
+ * @link https://eips.ethereum.org/EIPS/eip-1186
660
+ * @example
661
+ * provider.request({ method: 'eth_getProof', params: ['0x...', ['0x...'], 'latest'] })
662
+ * // => {
663
+ * // ...
664
+ * // }
665
+ */
666
+ {
667
+ Method: 'eth_getProof';
668
+ Parameters: [
669
+ /** Address of the account. */
670
+ address: Address,
671
+ /** An array of storage-keys that should be proofed and included. */
672
+ storageKeys: Hash[],
673
+ block: BlockNumber | BlockTag
674
+ ];
675
+ ReturnType: Proof;
676
+ },
677
+ /**
678
+ * @description Returns the value from a storage position at an address
679
+ * @link https://eips.ethereum.org/EIPS/eip-1474
680
+ * @example
681
+ * provider.request({ method: 'eth_getStorageAt', params: ['0x...', '0x...', 'latest'] })
682
+ * // => '0x...'
683
+ */
684
+ {
685
+ Method: 'eth_getStorageAt';
686
+ Parameters: [
687
+ address: Address,
688
+ index: Quantity,
689
+ block: BlockNumber | BlockTag | BlockIdentifier
690
+ ];
691
+ ReturnType: Hex;
692
+ },
693
+ /**
694
+ * @description Returns information about a transaction specified by block hash and transaction index
695
+ * @link https://eips.ethereum.org/EIPS/eip-1474
696
+ * @example
697
+ * provider.request({ method: 'eth_getTransactionByBlockHashAndIndex', params: ['0x...', '0x...'] })
698
+ * // => { ... }
699
+ */
700
+ {
701
+ Method: 'eth_getTransactionByBlockHashAndIndex';
702
+ Parameters: [hash: Hash, index: Quantity];
703
+ ReturnType: Transaction | null;
704
+ },
705
+ /**
706
+ * @description Returns information about a transaction specified by block number and transaction index
707
+ * @link https://eips.ethereum.org/EIPS/eip-1474
708
+ * @example
709
+ * provider.request({ method: 'eth_getTransactionByBlockNumberAndIndex', params: ['0x...', '0x...'] })
710
+ * // => { ... }
711
+ */
712
+ {
713
+ Method: 'eth_getTransactionByBlockNumberAndIndex';
714
+ Parameters: [block: BlockNumber | BlockTag, index: Quantity];
715
+ ReturnType: Transaction | null;
716
+ },
717
+ /**
718
+ * @description Returns information about a transaction specified by hash
719
+ * @link https://eips.ethereum.org/EIPS/eip-1474
720
+ * @example
721
+ * provider.request({ method: 'eth_getTransactionByHash', params: ['0x...'] })
722
+ * // => { ... }
723
+ */
724
+ {
725
+ Method: 'eth_getTransactionByHash';
726
+ Parameters: [hash: Hash];
727
+ ReturnType: Transaction | null;
728
+ },
729
+ /**
730
+ * @description Returns the number of transactions sent from an address
731
+ * @link https://eips.ethereum.org/EIPS/eip-1474
732
+ * @example
733
+ * provider.request({ method: 'eth_getTransactionCount', params: ['0x...', 'latest'] })
734
+ * // => '0x1'
735
+ */
736
+ {
737
+ Method: 'eth_getTransactionCount';
738
+ Parameters: [
739
+ address: Address,
740
+ block: BlockNumber | BlockTag | BlockIdentifier
741
+ ];
742
+ ReturnType: Quantity;
743
+ },
744
+ /**
745
+ * @description Returns the receipt of a transaction specified by hash
746
+ * @link https://eips.ethereum.org/EIPS/eip-1474
747
+ * @example
748
+ * provider.request({ method: 'eth_getTransactionReceipt', params: ['0x...'] })
749
+ * // => { ... }
750
+ */
751
+ {
752
+ Method: 'eth_getTransactionReceipt';
753
+ Parameters: [hash: Hash];
754
+ ReturnType: TransactionReceipt | null;
755
+ },
756
+ /**
757
+ * @description Returns information about an uncle specified by block hash and uncle index position
758
+ * @link https://eips.ethereum.org/EIPS/eip-1474
759
+ * @example
760
+ * provider.request({ method: 'eth_getUncleByBlockHashAndIndex', params: ['0x...', '0x...'] })
761
+ * // => { ... }
762
+ */
763
+ {
764
+ Method: 'eth_getUncleByBlockHashAndIndex';
765
+ Parameters: [hash: Hash, index: Quantity];
766
+ ReturnType: Uncle | null;
767
+ },
768
+ /**
769
+ * @description Returns information about an uncle specified by block number and uncle index position
770
+ * @link https://eips.ethereum.org/EIPS/eip-1474
771
+ * @example
772
+ * provider.request({ method: 'eth_getUncleByBlockNumberAndIndex', params: ['0x...', '0x...'] })
773
+ * // => { ... }
774
+ */
775
+ {
776
+ Method: 'eth_getUncleByBlockNumberAndIndex';
777
+ Parameters: [block: BlockNumber | BlockTag, index: Quantity];
778
+ ReturnType: Uncle | null;
779
+ },
780
+ /**
781
+ * @description Returns the number of uncles in a block specified by block hash
782
+ * @link https://eips.ethereum.org/EIPS/eip-1474
783
+ * @example
784
+ * provider.request({ method: 'eth_getUncleCountByBlockHash', params: ['0x...'] })
785
+ * // => '0x1'
786
+ */
787
+ {
788
+ Method: 'eth_getUncleCountByBlockHash';
789
+ Parameters: [hash: Hash];
790
+ ReturnType: Quantity;
791
+ },
792
+ /**
793
+ * @description Returns the number of uncles in a block specified by block number
794
+ * @link https://eips.ethereum.org/EIPS/eip-1474
795
+ * @example
796
+ * provider.request({ method: 'eth_getUncleCountByBlockNumber', params: ['0x...'] })
797
+ * // => '0x1'
798
+ */
799
+ {
800
+ Method: 'eth_getUncleCountByBlockNumber';
801
+ Parameters: [block: BlockNumber | BlockTag];
802
+ ReturnType: Quantity;
803
+ },
804
+ /**
805
+ * @description Returns the current maxPriorityFeePerGas in wei.
806
+ * @link https://ethereum.github.io/execution-apis/api-documentation/
807
+ * @example
808
+ * provider.request({ method: 'eth_maxPriorityFeePerGas' })
809
+ * // => '0x5f5e100'
810
+ */
811
+ {
812
+ Method: 'eth_maxPriorityFeePerGas';
813
+ Parameters?: undefined;
814
+ ReturnType: Quantity;
815
+ },
816
+ /**
817
+ * @description Creates a filter to listen for new blocks that can be used with `eth_getFilterChanges`
818
+ * @link https://eips.ethereum.org/EIPS/eip-1474
819
+ * @example
820
+ * provider.request({ method: 'eth_newBlockFilter' })
821
+ * // => '0x1'
822
+ */
823
+ {
824
+ Method: 'eth_newBlockFilter';
825
+ Parameters?: undefined;
826
+ ReturnType: Quantity;
827
+ },
828
+ /**
829
+ * @description Creates a filter to listen for specific state changes that can then be used with `eth_getFilterChanges`
830
+ * @link https://eips.ethereum.org/EIPS/eip-1474
831
+ * @example
832
+ * provider.request({ method: 'eth_newFilter', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
833
+ * // => '0x1'
834
+ */
835
+ {
836
+ Method: 'eth_newFilter';
837
+ Parameters: [
838
+ filter: {
839
+ fromBlock?: BlockNumber | BlockTag | undefined;
840
+ toBlock?: BlockNumber | BlockTag | undefined;
841
+ address?: Address | Address[] | undefined;
842
+ topics?: LogTopic[] | undefined;
843
+ }
844
+ ];
845
+ ReturnType: Quantity;
846
+ },
847
+ /**
848
+ * @description Creates a filter to listen for new pending transactions that can be used with `eth_getFilterChanges`
849
+ * @link https://eips.ethereum.org/EIPS/eip-1474
850
+ * @example
851
+ * provider.request({ method: 'eth_newPendingTransactionFilter' })
852
+ * // => '0x1'
853
+ */
854
+ {
855
+ Method: 'eth_newPendingTransactionFilter';
856
+ Parameters?: undefined;
857
+ ReturnType: Quantity;
858
+ },
859
+ /**
860
+ * @description Returns the current Ethereum protocol version
861
+ * @link https://eips.ethereum.org/EIPS/eip-1474
862
+ * @example
863
+ * provider.request({ method: 'eth_protocolVersion' })
864
+ * // => '54'
865
+ */
866
+ {
867
+ Method: 'eth_protocolVersion';
868
+ Parameters?: undefined;
869
+ ReturnType: string;
870
+ },
871
+ /**
872
+ * @description Sends a **signed** transaction to the network
873
+ * @link https://eips.ethereum.org/EIPS/eip-1474
874
+ * @example
875
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
876
+ * // => '0x...'
877
+ */
878
+ {
879
+ Method: 'eth_sendRawTransaction';
880
+ Parameters: [signedTransaction: Hex];
881
+ ReturnType: Hash;
882
+ },
883
+ /**
884
+ * @description Destroys a filter based on filter ID
885
+ * @link https://eips.ethereum.org/EIPS/eip-1474
886
+ * @example
887
+ * provider.request({ method: 'eth_uninstallFilter', params: ['0x1'] })
888
+ * // => true
889
+ */
890
+ {
891
+ Method: 'eth_uninstallFilter';
892
+ Parameters: [filterId: Quantity];
893
+ ReturnType: boolean;
894
+ }
895
+ ];
896
+
897
+ export type WalletRpcSchema = [
898
+ /**
899
+ * @description Returns a list of addresses owned by this client
900
+ * @link https://eips.ethereum.org/EIPS/eip-1474
901
+ * @example
902
+ * provider.request({ method: 'eth_accounts' })
903
+ * // => ['0x0fB69...']
904
+ */
905
+ {
906
+ Method: 'eth_accounts';
907
+ Parameters?: undefined;
908
+ ReturnType: Address[];
909
+ },
910
+ /**
911
+ * @description Returns the current chain ID associated with the wallet.
912
+ * @example
913
+ * provider.request({ method: 'eth_chainId' })
914
+ * // => '1'
915
+ */
916
+ {
917
+ Method: 'eth_chainId';
918
+ Parameters?: undefined;
919
+ ReturnType: Quantity;
920
+ },
921
+ /**
922
+ * @description Estimates the gas necessary to complete a transaction without submitting it to the network
923
+ *
924
+ * @example
925
+ * provider.request({
926
+ * method: 'eth_estimateGas',
927
+ * params: [{ from: '0x...', to: '0x...', value: '0x...' }]
928
+ * })
929
+ * // => '0x5208'
930
+ */
931
+ {
932
+ Method: 'eth_estimateGas';
933
+ Parameters:
934
+ | [transaction: TransactionRequest]
935
+ | [transaction: TransactionRequest, block: BlockNumber | BlockTag]
936
+ | [
937
+ transaction: TransactionRequest,
938
+ block: BlockNumber | BlockTag,
939
+ stateOverride: RpcStateOverride
940
+ ];
941
+ ReturnType: Quantity;
942
+ },
943
+ /**
944
+ * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
945
+ * @link https://eips.ethereum.org/EIPS/eip-1102
946
+ * @example
947
+ * provider.request({ method: 'eth_requestAccounts' }] })
948
+ * // => ['0x...', '0x...']
949
+ */
950
+ {
951
+ Method: 'eth_requestAccounts';
952
+ Parameters?: undefined;
953
+ ReturnType: Address[];
954
+ },
955
+ /**
956
+ * @description Creates, signs, and sends a new transaction to the network
957
+ * @link https://eips.ethereum.org/EIPS/eip-1474
958
+ * @example
959
+ * provider.request({ method: 'eth_sendTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
960
+ * // => '0x...'
961
+ */
962
+ {
963
+ Method: 'eth_sendTransaction';
964
+ Parameters: [transaction: TransactionRequest];
965
+ ReturnType: Hash;
966
+ },
967
+ /**
968
+ * @description Sends and already-signed transaction to the network
969
+ * @link https://eips.ethereum.org/EIPS/eip-1474
970
+ * @example
971
+ * provider.request({ method: 'eth_sendRawTransaction', params: ['0x...'] })
972
+ * // => '0x...'
973
+ */
974
+ {
975
+ Method: 'eth_sendRawTransaction';
976
+ Parameters: [signedTransaction: Hex];
977
+ ReturnType: Hash;
978
+ },
979
+ /**
980
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
981
+ * @link https://eips.ethereum.org/EIPS/eip-1474
982
+ * @example
983
+ * provider.request({ method: 'eth_sign', params: ['0x...', '0x...'] })
984
+ * // => '0x...'
985
+ */
986
+ {
987
+ Method: 'eth_sign';
988
+ Parameters: [
989
+ /** Address to use for signing */
990
+ address: Address,
991
+ /** Data to sign */
992
+ data: Hex
993
+ ];
994
+ ReturnType: Hex;
995
+ },
996
+ /**
997
+ * @description Signs a transaction that can be submitted to the network at a later time using with `eth_sendRawTransaction`
998
+ * @link https://eips.ethereum.org/EIPS/eip-1474
999
+ * @example
1000
+ * provider.request({ method: 'eth_signTransaction', params: [{ from: '0x...', to: '0x...', value: '0x...' }] })
1001
+ * // => '0x...'
1002
+ */
1003
+ {
1004
+ Method: 'eth_signTransaction';
1005
+ Parameters: [request: TransactionRequest];
1006
+ ReturnType: Hex;
1007
+ },
1008
+ /**
1009
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1010
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1011
+ * @example
1012
+ * provider.request({ method: 'eth_signTypedData_v4', params: [{ from: '0x...', data: [{ type: 'string', name: 'message', value: 'hello world' }] }] })
1013
+ * // => '0x...'
1014
+ */
1015
+ {
1016
+ Method: 'eth_signTypedData_v4';
1017
+ Parameters: [
1018
+ /** Address to use for signing */
1019
+ address: Address,
1020
+ /** Message to sign containing type information, a domain separator, and data */
1021
+ message: string
1022
+ ];
1023
+ ReturnType: Hex;
1024
+ },
1025
+ /**
1026
+ * @description Returns information about the status of this client’s network synchronization
1027
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1028
+ * @example
1029
+ * provider.request({ method: 'eth_syncing' })
1030
+ * // => { startingBlock: '0x...', currentBlock: '0x...', highestBlock: '0x...' }
1031
+ */
1032
+ {
1033
+ Method: 'eth_syncing';
1034
+ Parameters?: undefined;
1035
+ ReturnType: NetworkSync | false;
1036
+ },
1037
+ /**
1038
+ * @description Calculates an Ethereum-specific signature in the form of `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`
1039
+ * @link https://eips.ethereum.org/EIPS/eip-1474
1040
+ * @example
1041
+ * provider.request({ method: 'personal_sign', params: ['0x...', '0x...'] })
1042
+ * // => '0x...'
1043
+ */
1044
+ {
1045
+ Method: 'personal_sign';
1046
+ Parameters: [
1047
+ /** Data to sign */
1048
+ data: Hex,
1049
+ /** Address to use for signing */
1050
+ address: Address
1051
+ ];
1052
+ ReturnType: Hex;
1053
+ },
1054
+ /**
1055
+ * @description Add an Ethereum chain to the wallet.
1056
+ * @link https://eips.ethereum.org/EIPS/eip-3085
1057
+ * @example
1058
+ * provider.request({ method: 'wallet_addEthereumChain', params: [{ chainId: 1, rpcUrl: 'https://mainnet.infura.io/v3/...' }] })
1059
+ * // => { ... }
1060
+ */
1061
+ {
1062
+ Method: 'wallet_addEthereumChain';
1063
+ Parameters: [chain: AddEthereumChainParameter];
1064
+ ReturnType: null;
1065
+ },
1066
+ /**
1067
+ * @description Returns the status of a call batch that was sent via `wallet_sendCalls`.
1068
+ * @link https://eips.ethereum.org/EIPS/eip-5792
1069
+ * @example
1070
+ * provider.request({ method: 'wallet_getCallsStatus' })
1071
+ * // => { ... }
1072
+ */
1073
+ {
1074
+ Method: 'wallet_getCallsStatus';
1075
+ Parameters?: [string];
1076
+ ReturnType: WalletGetCallsStatusReturnType;
1077
+ },
1078
+ /**
1079
+ * @description Gets the connected wallet's capabilities.
1080
+ * @link https://eips.ethereum.org/EIPS/eip-5792
1081
+ * @example
1082
+ * provider.request({ method: 'wallet_getCapabilities' })
1083
+ * // => { ... }
1084
+ */
1085
+ {
1086
+ Method: 'wallet_getCapabilities';
1087
+ Parameters?: [Address];
1088
+ ReturnType: Prettify<WalletCapabilitiesRecord>;
1089
+ },
1090
+ /**
1091
+ * @description Gets the wallets current permissions.
1092
+ * @link https://eips.ethereum.org/EIPS/eip-2255
1093
+ * @example
1094
+ * provider.request({ method: 'wallet_getPermissions' })
1095
+ * // => { ... }
1096
+ */
1097
+ {
1098
+ Method: 'wallet_getPermissions';
1099
+ Parameters?: undefined;
1100
+ ReturnType: WalletPermission[];
1101
+ },
1102
+ /**
1103
+ * @description Requests permissions from a wallet
1104
+ * @link https://eips.ethereum.org/EIPS/eip-7715
1105
+ * @example
1106
+ * provider.request({ method: 'wallet_grantPermissions', params: [{ ... }] })
1107
+ * // => { ... }
1108
+ */
1109
+ {
1110
+ Method: 'wallet_grantPermissions';
1111
+ Parameters?: [WalletGrantPermissionsParameters];
1112
+ ReturnType: Prettify<WalletGrantPermissionsReturnType>;
1113
+ },
1114
+ /**
1115
+ * @description Requests the given permissions from the user.
1116
+ * @link https://eips.ethereum.org/EIPS/eip-2255
1117
+ * @example
1118
+ * provider.request({ method: 'wallet_requestPermissions', params: [{ eth_accounts: {} }] })
1119
+ * // => { ... }
1120
+ */
1121
+ {
1122
+ Method: 'wallet_requestPermissions';
1123
+ Parameters: [permissions: { eth_accounts: Record<string, any> }];
1124
+ ReturnType: WalletPermission[];
1125
+ },
1126
+ /**
1127
+ * @description Revokes the given permissions from the user.
1128
+ * @link https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-2.md
1129
+ * @example
1130
+ * provider.request({ method: 'wallet_revokePermissions', params: [{ eth_accounts: {} }] })
1131
+ * // => { ... }
1132
+ */
1133
+ {
1134
+ Method: 'wallet_revokePermissions';
1135
+ Parameters: [permissions: { eth_accounts: Record<string, any> }];
1136
+ ReturnType: null;
1137
+ },
1138
+ /**
1139
+ * @description Requests the connected wallet to send a batch of calls.
1140
+ * @link https://eips.ethereum.org/EIPS/eip-5792
1141
+ * @example
1142
+ * provider.request({ method: 'wallet_sendCalls' })
1143
+ * // => { ... }
1144
+ */
1145
+ {
1146
+ Method: 'wallet_sendCalls';
1147
+ Parameters?: WalletSendCallsParameters;
1148
+ ReturnType: string;
1149
+ },
1150
+ /**
1151
+ * @description Requests for the wallet to show information about a call batch
1152
+ * that was sent via `wallet_sendCalls`.
1153
+ * @link https://eips.ethereum.org/EIPS/eip-5792
1154
+ * @example
1155
+ * provider.request({ method: 'wallet_showCallsStatus', params: ['...'] })
1156
+ */
1157
+ {
1158
+ Method: 'wallet_showCallsStatus';
1159
+ Parameters?: [string];
1160
+ ReturnType: void;
1161
+ },
1162
+ /**
1163
+ * @description Switch the wallet to the given Ethereum chain.
1164
+ * @link https://eips.ethereum.org/EIPS/eip-3326
1165
+ * @example
1166
+ * provider.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: '0xf00' }] })
1167
+ * // => { ... }
1168
+ */
1169
+ {
1170
+ Method: 'wallet_switchEthereumChain';
1171
+ Parameters: [chain: { chainId: string }];
1172
+ ReturnType: null;
1173
+ },
1174
+ /**
1175
+ * @description Requests that the user tracks the token in their wallet. Returns a boolean indicating if the token was successfully added.
1176
+ * @link https://eips.ethereum.org/EIPS/eip-747
1177
+ * @example
1178
+ * provider.request({ method: 'wallet_watchAsset' }] })
1179
+ * // => true
1180
+ */
1181
+ {
1182
+ Method: 'wallet_watchAsset';
1183
+ Parameters: WatchAssetParams;
1184
+ ReturnType: boolean;
1185
+ }
1186
+ ];
1187
+
1188
+ export type BundlerRpcSchema = [
1189
+ /**
1190
+ * @description Returns the chain ID associated with the current network
1191
+ *
1192
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_chainid
1193
+ */
1194
+ {
1195
+ Method: 'eth_chainId';
1196
+ Parameters?: undefined;
1197
+ ReturnType: Hex;
1198
+ },
1199
+ /**
1200
+ * @description Estimate the gas values for a UserOperation.
1201
+ *
1202
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_estimateuseroperationgas
1203
+ *
1204
+ * @example
1205
+ * provider.request({
1206
+ * method: 'eth_estimateUserOperationGas',
1207
+ * params: [{ ... }]
1208
+ * })
1209
+ * // => { ... }
1210
+ */
1211
+ {
1212
+ Method: 'eth_estimateUserOperationGas';
1213
+ Parameters:
1214
+ | [userOperation: RpcUserOperation, entrypoint: Address]
1215
+ | [
1216
+ userOperation: RpcUserOperation,
1217
+ entrypoint: Address,
1218
+ stateOverrideSet: RpcStateOverride
1219
+ ];
1220
+ ReturnType: RpcEstimateUserOperationGasReturnType;
1221
+ },
1222
+ /**
1223
+ * @description Return a UserOperation based on a hash.
1224
+ *
1225
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_getuseroperationbyhash
1226
+ *
1227
+ * @example
1228
+ * provider.request({
1229
+ * method: 'eth_getUserOperationByHash',
1230
+ * params: ['0x...']
1231
+ * })
1232
+ * // => { ... }
1233
+ */
1234
+ {
1235
+ Method: 'eth_getUserOperationByHash';
1236
+ Parameters: [hash: Hash];
1237
+ ReturnType: RpcGetUserOperationByHashReturnType | null;
1238
+ },
1239
+ /**
1240
+ * @description Return a UserOperation receipt based on a hash.
1241
+ *
1242
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_getuseroperationreceipt
1243
+ *
1244
+ * @example
1245
+ * provider.request({
1246
+ * method: 'eth_getUserOperationReceipt',
1247
+ * params: ['0x...']
1248
+ * })
1249
+ * // => { ... }
1250
+ */
1251
+ {
1252
+ Method: 'eth_getUserOperationReceipt';
1253
+ Parameters: [hash: Hash];
1254
+ ReturnType: RpcUserOperationReceipt | null;
1255
+ },
1256
+ /**
1257
+ * @description Submits a User Operation object to the User Operation pool of the client.
1258
+ *
1259
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_senduseroperation
1260
+ *
1261
+ * @example
1262
+ * provider.request({
1263
+ * method: 'eth_sendUserOperation',
1264
+ * params: [{ ... }]
1265
+ * })
1266
+ * // => '0x...'
1267
+ */
1268
+ {
1269
+ Method: 'eth_sendUserOperation';
1270
+ Parameters: [userOperation: RpcUserOperation, entrypoint: Address];
1271
+ ReturnType: Hash;
1272
+ },
1273
+ /**
1274
+ * @description Return the list of supported entry points by the client.
1275
+ *
1276
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_supportedentrypoints
1277
+ */
1278
+ {
1279
+ Method: 'eth_supportedEntryPoints';
1280
+ Parameters?: undefined;
1281
+ ReturnType: readonly Address[];
1282
+ }
1283
+ ];
1284
+
1285
+ export type PaymasterRpcSchema = [
1286
+ /**
1287
+ * @description Returns the chain ID associated with the current network
1288
+ *
1289
+ * @link https://eips.ethereum.org/EIPS/eip-4337#-eth_chainid
1290
+ */
1291
+ {
1292
+ Method: 'pm_getPaymasterStubData';
1293
+ Parameters?: [
1294
+ userOperation: OneOf<
1295
+ | PartialBy<
1296
+ Pick<
1297
+ RpcUserOperation<'0.6'>,
1298
+ | 'callData'
1299
+ | 'callGasLimit'
1300
+ | 'initCode'
1301
+ | 'maxFeePerGas'
1302
+ | 'maxPriorityFeePerGas'
1303
+ | 'nonce'
1304
+ | 'sender'
1305
+ | 'preVerificationGas'
1306
+ | 'verificationGasLimit'
1307
+ >,
1308
+ | 'callGasLimit'
1309
+ | 'initCode'
1310
+ | 'maxFeePerGas'
1311
+ | 'maxPriorityFeePerGas'
1312
+ | 'preVerificationGas'
1313
+ | 'verificationGasLimit'
1314
+ >
1315
+ | PartialBy<
1316
+ Pick<
1317
+ RpcUserOperation<'0.7'>,
1318
+ | 'callData'
1319
+ | 'callGasLimit'
1320
+ | 'factory'
1321
+ | 'factoryData'
1322
+ | 'maxFeePerGas'
1323
+ | 'maxPriorityFeePerGas'
1324
+ | 'nonce'
1325
+ | 'sender'
1326
+ | 'preVerificationGas'
1327
+ | 'verificationGasLimit'
1328
+ >,
1329
+ | 'callGasLimit'
1330
+ | 'factory'
1331
+ | 'factoryData'
1332
+ | 'maxFeePerGas'
1333
+ | 'maxPriorityFeePerGas'
1334
+ | 'preVerificationGas'
1335
+ | 'verificationGasLimit'
1336
+ >
1337
+ >,
1338
+ entrypoint: Address,
1339
+ chainId: Hex,
1340
+ context: unknown
1341
+ ];
1342
+ ReturnType: OneOf<
1343
+ | { paymasterAndData: Hex }
1344
+ | {
1345
+ paymaster: Address;
1346
+ paymasterData: Hex;
1347
+ paymasterVerificationGasLimit: Hex;
1348
+ paymasterPostOpGasLimit: Hex;
1349
+ }
1350
+ > & {
1351
+ sponsor?: { name: string; icon?: string | undefined } | undefined;
1352
+ isFinal?: boolean | undefined;
1353
+ };
1354
+ },
1355
+ /**
1356
+ * @description Returns values to be used in paymaster-related fields of a signed user operation.
1357
+ *
1358
+ * @link https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7677.md#pm_getpaymasterdata
1359
+ */
1360
+ {
1361
+ Method: 'pm_getPaymasterData';
1362
+ Parameters?: [
1363
+ userOperation:
1364
+ | Pick<
1365
+ RpcUserOperation<'0.6'>,
1366
+ | 'callData'
1367
+ | 'callGasLimit'
1368
+ | 'initCode'
1369
+ | 'maxFeePerGas'
1370
+ | 'maxPriorityFeePerGas'
1371
+ | 'nonce'
1372
+ | 'sender'
1373
+ | 'preVerificationGas'
1374
+ | 'verificationGasLimit'
1375
+ >
1376
+ | Pick<
1377
+ RpcUserOperation<'0.7'>,
1378
+ | 'callData'
1379
+ | 'callGasLimit'
1380
+ | 'factory'
1381
+ | 'factoryData'
1382
+ | 'maxFeePerGas'
1383
+ | 'maxPriorityFeePerGas'
1384
+ | 'nonce'
1385
+ | 'sender'
1386
+ | 'preVerificationGas'
1387
+ | 'verificationGasLimit'
1388
+ >,
1389
+ entrypoint: Address,
1390
+ chainId: Hex,
1391
+ context: unknown
1392
+ ];
1393
+ ReturnType: OneOf<
1394
+ | { paymasterAndData: Hex }
1395
+ | {
1396
+ paymaster: Address;
1397
+ paymasterData: Hex;
1398
+ paymasterVerificationGasLimit: Hex;
1399
+ paymasterPostOpGasLimit: Hex;
1400
+ }
1401
+ >;
1402
+ }
1403
+ ];
1404
+
1405
+ export type EIP1474Methods = [
1406
+ ...PublicRpcSchema,
1407
+ ...WalletRpcSchema,
1408
+ ...BundlerRpcSchema,
1409
+ ...PaymasterRpcSchema
1410
+ ];
1411
+
1412
+ export type EIP1193Provider = EIP1193Events & {
1413
+ request: EIP1193RequestFn<EIP1474Methods>;
1414
+ };