eip-1193 0.6.0 → 0.6.2

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 (2) hide show
  1. package/index.d.ts +16 -2
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -19,6 +19,13 @@ export type EIP1193ChainId = `0x${string}`;
19
19
  export type EIP1193Account = `0x${string}`;
20
20
  export type EIP1193Accounts = EIP1193Account[];
21
21
 
22
+ export type EIP1193FeeHistory = {
23
+ oldestBlock: string;
24
+ reward: EIP1193QUANTITY[][];
25
+ baseFeePerGas: string[];
26
+ gasUsedRatio: string[];
27
+ };
28
+
22
29
  type BaseEIP1193Transaction = {
23
30
  blockHash: EIP1193DATA;
24
31
  blockNumber: EIP1193QUANTITY | null;
@@ -318,6 +325,8 @@ export type ReadMethods = {
318
325
  };
319
326
  eth_unsubscribe: {params: [EIP1193DATA]; result: boolean};
320
327
  eth_getProof: {params: [EIP1193DATA, EIP1193DATA[]] | [EIP1193DATA, EIP1193DATA[], EIP1898BlockTag]; result: unknown}; // TODO
328
+
329
+ eth_feeHistory: {params: [EIP1193DATA, EIP1193BlockTag, number[]]; result: EIP1193FeeHistory};
321
330
  };
322
331
 
323
332
  export type WriteMethods = {
@@ -361,7 +370,7 @@ export type EIP1193TypedSignatureParam = {[field: string]: any}; // TODO
361
370
 
362
371
  export type EIP1193GenericRequest = {
363
372
  method: string;
364
- params?: any[];
373
+ params?: Readonly<unknown[]>;
365
374
  };
366
375
 
367
376
  export interface EIP1193ProviderRpcError extends Error {
@@ -457,7 +466,12 @@ export type RequestUnion<T extends RPCMethods> = {
457
466
  // PROVIDERS
458
467
  // ------------------------------------------------------------------------------------------------
459
468
 
460
- export type RequestRPC<T extends RPCMethods> = UnionToIntersection<RequestUnion<T>>;
469
+ export type RequestRPC<T extends RPCMethods> = UnionToIntersection<RequestUnion<T>> & {
470
+ request<U extends {params?: any; result?: any}>(req: {
471
+ method: string;
472
+ params: DeepReadonly<U['params']>;
473
+ }): Promise<U['result']>;
474
+ };
461
475
 
462
476
  export type EIP1193ProviderWithoutEvents = RequestRPC<Methods>;
463
477
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eip-1193",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "Types for EIP-1193 ethereum provider",
5
5
  "keywords": ["ethereum", "eip-1193"],
6
6
  "author": "Ronan Sandford",