@asyncswap/eth-rpc 0.4.6 → 0.4.9

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @asyncswap/eth-rpc
2
2
 
3
+ ## 0.4.9
4
+
5
+ ### Patch Changes
6
+
7
+ - e9fc1df: remove biome dep
8
+ - Updated dependencies [e9fc1df]
9
+ - @asyncswap/jsonrpc@0.4.8
10
+
11
+ ## 0.4.8
12
+
13
+ ### Patch Changes
14
+
15
+ - cad9042: minimal eth rpc client
16
+
17
+ - ported engine api to different package
18
+
19
+ ## 0.4.7
20
+
21
+ ### Patch Changes
22
+
23
+ - ff4e035: fix base client proxy
24
+
25
+ ```ts
26
+ setHeaders(...) {
27
+ this.headers = ...
28
+ return this; // ❌ returns the *target*
29
+ }
30
+ ```
31
+
32
+ The correct fix: return the receiver / proxy, not this
33
+
34
+ You already have access to the proxy inside the get trap via receiver.
35
+
36
+ So you must bind methods so that they return the proxy.
37
+
38
+ - setHeaders() mutates the target
39
+ - returns receiver (the proxy)
40
+ - chaining continues in proxy-land
41
+ - RPC methods remain visible
42
+
3
43
  ## 0.4.6
4
44
 
5
45
  ### Patch Changes
package/README.md CHANGED
@@ -26,58 +26,9 @@ console.log("Balance:", balance);
26
26
  eth.eth_getTransactionCount("0x34", "safe");
27
27
  ```
28
28
 
29
- ### Flashbots Client API
29
+ ## References
30
30
 
31
- ```ts
32
- import { FlashbotsClient } from "@asyncswap/eth-rpc";
33
-
34
- const rpc = "https://relay.flashbots.net";
35
- const client = new FlashbotsClient(rpc);
36
- const bundle = {
37
- txs: ["0x123abc", "0x456def..."] as Hex[],
38
-
39
- blockNumber: "0xb63dcd" as Hex,
40
- minTimestamp: 0,
41
- maxTimestamp: 1615920932,
42
- };
43
- const body = client.rpc.buildRequest("eth_sendBundle", [bundle]);
44
- // const signature = wallet.sign(body)
45
- // const sender = wallet.address
46
- client
47
- .setHeaders({
48
- "X-Flashbots-Signature": `0x<sender>:0x<signature>`,
49
- })
50
- .eth_sendBundle(bundle);
51
- ```
52
-
53
- ### Engine API Client
54
-
55
- ```typescript
56
- import { EngineExecutionClient } from '@asyncswap/eth-rpc';
57
-
58
- const engineUrl = 'https://localhost:8551';
59
- const engine = new EngineExecutionClient(engineUrl, process.env.JWT_TOKEN!);
60
- const payload = await engine.engine_getPayloadV1("0x1");
61
-
62
- console.log(payload);
63
- ```
64
-
65
- ## Error Handling
66
-
67
- All methods return typed responses. Handle errors appropriately:
68
-
69
- ```typescript
70
- try {
71
- const balance = await client.eth_getBalance(address, 'latest');
72
- console.log('Balance:', balance);
73
- } catch (error) {
74
- console.error('RPC Error:', error);
75
- }
76
- ```
77
-
78
- ## Type Safety
79
-
80
- Full TypeScript support with comprehensive type definitions for all RPC methods and responses.
31
+ - [ethereum/execution-apis](https://github.com/ethereum/execution-apis)
81
32
 
82
33
  ## Dependencies
83
34
 
package/example.ts CHANGED
@@ -8,35 +8,3 @@ const balance = await eth.eth_getBalance(
8
8
  );
9
9
  console.log("Balance:", balance);
10
10
  eth.eth_getTransactionCount("0x34", "safe");
11
-
12
- import { EngineExecutionClient } from "./src";
13
-
14
- const engineUrl = "https://localhost:8551";
15
- const engine = new EngineExecutionClient(engineUrl, process.env.JWT_TOKEN!);
16
- const payload = await engine
17
- .setHeaders({
18
- Authorization: `Bearer <jwt-token>`,
19
- })
20
- .engine_getPayloadV1("0x1");
21
-
22
- console.log(payload);
23
-
24
- import { FlashbotsClient } from "./src";
25
-
26
- const rpc = "https://relay.flashbots.net";
27
- const client = new FlashbotsClient(rpc);
28
- const bundle = {
29
- txs: ["0x123abc", "0x456def..."] as Hex[],
30
-
31
- blockNumber: "0xb63dcd" as Hex,
32
- minTimestamp: 0,
33
- maxTimestamp: 1615920932,
34
- };
35
- const body = client.rpc.buildRequest("eth_sendBundle", [bundle]);
36
- // const signature = wallet.sign(body)
37
- // const sender = wallet.address
38
- client
39
- .setHeaders({
40
- "X-Flashbots-Signature": `0x<sender>:0x<signature>`,
41
- })
42
- .eth_sendBundle(bundle);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@asyncswap/eth-rpc",
3
3
  "description": "A library for ethereum execution clients apis.",
4
4
  "author": "Meek Msaki",
5
- "version": "0.4.6",
5
+ "version": "0.4.9",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
@@ -34,13 +34,12 @@
34
34
  "format": "bun biome format --write"
35
35
  },
36
36
  "devDependencies": {
37
- "@biomejs/biome": "2.3.11",
38
37
  "@types/bun": "latest"
39
38
  },
40
39
  "peerDependencies": {
41
40
  "typescript": "^5"
42
41
  },
43
42
  "dependencies": {
44
- "@asyncswap/jsonrpc": "^0.4.7"
43
+ "@asyncswap/jsonrpc": "^0.4.8"
45
44
  }
46
45
  }
package/src/base.ts CHANGED
@@ -14,7 +14,20 @@ export abstract class BaseClient<MethodsSpec extends RpcSpecBase> {
14
14
  this.rpc = new JsonRpcClient(url);
15
15
 
16
16
  return new Proxy(this, {
17
- get: (_: this, prop: string | symbol) => {
17
+ get: (target: this, prop: string | symbol, receiver) => {
18
+ // let real properties / methods through
19
+ if (prop in target) {
20
+ const value = Reflect.get(target, prop, receiver);
21
+ if (typeof value === "function") {
22
+ return (...args: any[]) => {
23
+ const result = value.apply(target, args);
24
+ // if method returns target, return proxy instead
25
+ return result === target ? receiver : result;
26
+ };
27
+ }
28
+ return value;
29
+ }
30
+ // dynamic rpc
18
31
  if (typeof prop !== "string") return undefined;
19
32
 
20
33
  const method = prop as keyof MethodsSpec;
package/src/eth-api.ts CHANGED
@@ -7,7 +7,7 @@ export class ExecutionClient extends BaseClient<EthMethodsSpec> {
7
7
  }
8
8
 
9
9
  export type EthRpcMethods<
10
- T extends Record<string, { params: unknown[]; result: unknown }>,
10
+ T extends Record<string, { params: readonly unknown[]; result: unknown }>,
11
11
  > = {
12
12
  [K in keyof T]: (...params: T[K]["params"]) => Promise<T[K]["result"]>;
13
13
  };
package/src/index.ts CHANGED
@@ -1,4 +1,2 @@
1
1
  export * from "./base";
2
- export * from "./engine-api";
3
2
  export * from "./eth-api";
4
- export * from "./mev-api";
package/tsconfig.json CHANGED
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  // Environment setup & latest features
4
- "lib": [
5
- "ESNext"
6
- ],
4
+ "lib": ["ESNext"],
7
5
  "target": "ESNext",
8
6
  "module": "Preserve",
9
7
  "moduleDetection": "force",
@@ -30,11 +28,6 @@
30
28
  "noUnusedParameters": false,
31
29
  "noPropertyAccessFromIndexSignature": false
32
30
  },
33
- "include": [
34
- "src/**/*",
35
- "global.d.ts"
36
- ],
37
- "exclude": [
38
- "example.ts"
39
- ]
31
+ "include": ["src/**/*", "global.d.ts"],
32
+ "exclude": ["example.ts"]
40
33
  }
package/src/engine-api.ts DELETED
@@ -1,19 +0,0 @@
1
- import { BaseClient } from "./base";
2
-
3
- export class EngineExecutionClient extends BaseClient<EngineMethodsSpec> {
4
- constructor(url: string, jwt_token: string) {
5
- super(url);
6
- this.headers = {
7
- Authorization: `Bearer ${jwt_token}`,
8
- };
9
- }
10
- }
11
-
12
- export type EngineRpcMethods<
13
- T extends Record<string, { params: unknown[]; result: unknown }>,
14
- > = {
15
- [K in keyof T]: (...params: T[K]["params"]) => Promise<T[K]["result"]>;
16
- };
17
-
18
- export interface EngineExecutionClient
19
- extends EngineRpcMethods<EngineMethodsSpec> { }
package/src/mev-api.ts DELETED
@@ -1,17 +0,0 @@
1
- import { BaseClient } from "./base";
2
-
3
- export class FlashbotsClient extends BaseClient<FlashbotsMethodsSpec> {
4
- constructor(url: string) {
5
- super(url);
6
- }
7
-
8
- // "X-Flashbots-Signature": `${sender}:${signature}`,
9
- }
10
-
11
- export type FlashbotsRpcMethods<
12
- T extends Record<string, { params: unknown[]; result: unknown }>,
13
- > = {
14
- [M in keyof T]: (...params: T[M]["params"]) => Promise<T[M]["result"]>;
15
- };
16
- export interface FlashbotsClient
17
- extends FlashbotsRpcMethods<FlashbotsMethodsSpec> { }
@@ -1,12 +0,0 @@
1
- declare global {
2
- export interface BlobAndProofV1 {
3
- blob: Bytes;
4
- proof: Bytes48;
5
- }
6
- export interface BlobAndProofV2 {
7
- blob: Bytes;
8
- proofs: Bytes48[];
9
- }
10
- }
11
-
12
- export { };
@@ -1,32 +0,0 @@
1
- declare global {
2
- // forkchoice
3
- export interface ForkchoiceStateV1 {
4
- headBlockHash: Hash32;
5
- safeBlockHash: Hash32;
6
- finalizedBlockHash: Hash32;
7
- }
8
- export interface ForkchoiceUpdatedResponseV1 {
9
- payloadStatus: RestrictedPayloadStatusV1;
10
- payloadId?: Bytes8;
11
- }
12
- export interface PayloadAttributesV1 {
13
- timestamp: Uint64;
14
- prevRandao: Bytes32;
15
- suggestedFeeRecipient: Address;
16
- }
17
- export interface PayloadAttributesV2 {
18
- timestamp: Uint64;
19
- prevRandao: Bytes32;
20
- suggestedFeeRecipient: Address;
21
- withdrawals: WithdrawalV1[];
22
- }
23
- export interface PayloadAttributesV3 {
24
- timestamp: Uint64;
25
- prevRandao: Bytes32;
26
- suggestedFeeRecipient: Address;
27
- withdrawals: WithdrawalV1[];
28
- parentBeaconBlockRoot: Hash32;
29
- }
30
- }
31
-
32
- export { };
@@ -1,24 +0,0 @@
1
- declare global {
2
- export type ClientVersionV1 = {
3
- code: ClientCode;
4
- name: string;
5
- varsion: string;
6
- commit: string;
7
- };
8
- export type ClientCode =
9
- | "BU" // besu
10
- | "EJ" // ethereumJs
11
- | "EG" // erigon
12
- | "GE" // go-ethereum
13
- | "GR" // gradine
14
- | "LH" // lighthouse
15
- | "LS" // lodestar
16
- | "NM" // nethermind
17
- | "NB" // nimbus
18
- | "TE" // thin-execution
19
- | "TK" // teku
20
- | "PM" // prysm
21
- | "RH"; // reth
22
- }
23
-
24
- export { };
@@ -1,130 +0,0 @@
1
- declare global {
2
- export type EngineMethodsSpec = {
3
- // identification
4
- engine_getClientVersionV1: {
5
- params: [ClientVersionV1];
6
- result: ClientVersionV1[];
7
- };
8
- // share methods
9
- eth_blockNumber: { params: []; result: Uint };
10
- eth_call: {
11
- params: [GenericTransaction, BlockNumberOrTagOrHash];
12
- result: Bytes;
13
- };
14
- eth_chainId: { params: []; result: Uint };
15
- eth_getCode: { params: [Address, BlockNumberOrTagOrHash]; result: Bytes };
16
- eth_getBlockByHash: { params: [Hash32, boolean]; result: NotFound | Block };
17
- eth_getBlockByNumber: {
18
- params: [BlockNumberOrTag, boolean];
19
- result: NotFound | Block;
20
- };
21
- eth_getLogs: { params: [Filter]; result: FilterResults };
22
- eth_sendRawTransaction: { params: [Bytes]; result: Hash32 };
23
- eth_syncing: { params: []; result: SyncingStatus };
24
- // engine/blob
25
- engine_getBlobsV1: { params: [Hash32[]]; result: BlobAndProofV1[] };
26
- engine_getBlobsV2: { params: [Hash32[]]; result: BlobAndProofV2[] };
27
- engine_getBlobsV3: {
28
- params: [Hash32[]];
29
- result: Array<BlobAndProofV2[] | null> | null;
30
- };
31
- // engine/capabilities
32
- engine_exchangeCapabilities: { params: [string[]]; result: string[] };
33
- // engine/forkchoice
34
- engine_forkchoiceUpdatedV1: {
35
- params: [ForkchoiceStateV1, PayloadAttributesV1];
36
- result: ForkchoiceUpdatedResponseV1;
37
- };
38
- engine_forkchoiceUpdatedV2: {
39
- params: [ForkchoiceStateV1, PayloadAttributesV2];
40
- result: ForkchoiceUpdatedResponseV1;
41
- };
42
- engine_forkchoiceUpdatedV3: {
43
- params: [ForkchoiceStateV1, PayloadAttributesV3];
44
- result: ForkchoiceUpdatedResponseV1;
45
- };
46
- // engine/payload
47
- engine_newPayloadV1: {
48
- params: [ExecutionPayloadV1];
49
- result: PayloadStatusV1;
50
- };
51
- engine_newPayloadV2: {
52
- params: [ExecutionPayloadV1 | ExecutionPayloadV2];
53
- result: PayloadStatusNoInvalidBlockHash;
54
- };
55
- engine_newPayloadV3: {
56
- params: [ExecutionPayloadV3, Hash32[], Hash32];
57
- result: PayloadStatusNoInvalidBlockHash;
58
- };
59
- engine_newPayloadV4: {
60
- params: [ExecutionPayloadV3, Hash32[], Hash32, Bytes[]];
61
- result: PayloadStatusNoInvalidBlockHash;
62
- };
63
- engine_getPayloadV1: { params: [Bytes8]; result: ExecutionPayloadV1 };
64
- engine_getPayloadV2: {
65
- params: [Bytes8];
66
- result: {
67
- executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2;
68
- blockValue: Uint256;
69
- };
70
- };
71
- engine_getPayloadV3: {
72
- params: [Bytes8];
73
- result: {
74
- executionPayload: ExecutionPayloadV3;
75
- blockValue: Uint256;
76
- blobsBundle: BlobsBundleV1;
77
- shouldOverrideBuilder: boolean;
78
- };
79
- };
80
- engine_getPayloadV4: {
81
- params: [Bytes8];
82
- result: {
83
- executionPayload: ExecutionPayloadV3;
84
- blockValue: Uint256;
85
- blobsBundle: BlobsBundleV1;
86
- shouldOverrideBuilder: boolean;
87
- executionRequests: Bytes[];
88
- };
89
- };
90
- engine_getPayloadV5: {
91
- params: [Bytes8];
92
- result: {
93
- executionPayload: ExecutionPayloadV3;
94
- blockValue: Uint256;
95
- blobsBundle: BlobsBundleV2;
96
- shouldOverrideBuilder: boolean;
97
- executionRequests: Bytes[];
98
- };
99
- };
100
- engine_getPayloadBodiesByHashV1: {
101
- params: [Hash32[]];
102
- result: ExecutionPayloadBodyV1[];
103
- };
104
- engine_getPayloadBodiesByRangeV1: {
105
- params: [Uint64, Uint64];
106
- result: ExecutionPayloadBodyV1[];
107
- };
108
- engine_newPayloadV5: {
109
- params: [ExecutionPayloadV4, Hash32[], Hash32, Bytes[]];
110
- result: PayloadStatusNoInvalidBlockHash;
111
- };
112
- engine_getPayloadV6: {
113
- params: [Bytes8];
114
- result: {
115
- executionPayload: ExecutionPayloadV4;
116
- blockValue: Uint256;
117
- blobsBundle: BlobsBundleV2;
118
- shouldOverrideBuilder: boolean;
119
- executionRequests: Bytes[];
120
- };
121
- };
122
- // engine/transition-configuration
123
- engine_exchangeTransitionConfigurationV1: {
124
- params: [TransitionConfigurationV1];
125
- result: TransitionConfigurationV1;
126
- };
127
- };
128
- }
129
-
130
- export { };
@@ -1,121 +0,0 @@
1
- declare global {
2
- export enum PAYLOAD_STATUS {
3
- VALID = "VALID",
4
- INVALID = "INVALID",
5
- SYNCING = "SYNCING",
6
- ACCEPTED = "ACCEPTED",
7
- INVALID_BLOCK_HASH = "INVALID_BLOCK_HASH",
8
- }
9
- export interface PayloadStatusV1 {
10
- status: PAYLOAD_STATUS;
11
- latestValidHash?: Hash32;
12
- validationError?: string;
13
- }
14
- export interface RestrictedPayloadStatusV1 {
15
- status:
16
- | PAYLOAD_STATUS.VALID
17
- | PAYLOAD_STATUS.INVALID
18
- | PAYLOAD_STATUS.SYNCING;
19
- latestValidHash: Hash32;
20
- validationError: string;
21
- }
22
- export interface PayloadStatusNoInvalidBlockHash {
23
- status: Exclude<PAYLOAD_STATUS, PAYLOAD_STATUS.INVALID_BLOCK_HASH>;
24
- latestValidHash: Hash32;
25
- validationError: string;
26
- }
27
- export interface ExecutionPayloadV1 {
28
- parentHash: Hash32;
29
- feeRecipient: Address;
30
- stateRoot: Bytes32;
31
- receiptsRoot: Bytes32;
32
- logsBloom: Bytes256;
33
- prevRandao: Bytes32;
34
- blockNumber: Uint64;
35
- gasLimit: Uint64;
36
- gasUsed: Uint64;
37
- timestamp: Uint64;
38
- extraData: Bytes32;
39
- baseFeePerGas: Uint64;
40
- blockHash: Hash32;
41
- transactions: Bytes[];
42
- }
43
- export interface WithdrawalV1 {
44
- index: Uint64;
45
- validatorIndex: Uint64;
46
- address: Address;
47
- amount: Uint64;
48
- }
49
- export interface ExecutionPayloadV2 {
50
- parentHash: Hash32;
51
- feeRecipient: Address;
52
- stateRoot: Bytes32;
53
- receiptsRoot: Bytes32;
54
- logsBloom: Bytes256;
55
- prevRandao: Bytes32;
56
- blockNumber: Uint64;
57
- gasLimit: Uint64;
58
- gasUsed: Uint64;
59
- timestamp: Uint64;
60
- extraData: Bytes32;
61
- baseFeePerGas: Uint64;
62
- blockHash: Hash32;
63
- transactions: Bytes[];
64
- withdrawals: WithdrawalV1[];
65
- }
66
- export interface ExecutionPayloadV3 {
67
- parentHash: Hash32;
68
- feeRecipient: Address;
69
- stateRoot: Bytes32;
70
- receiptsRoot: Bytes32;
71
- logsBloom: Bytes256;
72
- prevRandao: Bytes32;
73
- blockNumber: Uint64;
74
- gasLimit: Uint64;
75
- gasUsed: Uint64;
76
- timestamp: Uint64;
77
- extraData: Bytes32;
78
- baseFeePerGas: Uint64;
79
- blockHash: Hash32;
80
- transactions: Bytes[];
81
- withdrawals: WithdrawalV1[];
82
- blobGasUsed: Uint64;
83
- excessBlobGas: Uint64;
84
- }
85
- export interface ExecutionPayloadV4 {
86
- parentHash: Hash32;
87
- feeRecipient: Address;
88
- stateRoot: Bytes32;
89
- receiptsRoot: Bytes32;
90
- logsBloom: Bytes256;
91
- prevRandao: Bytes32;
92
- blockNumber: Uint64;
93
- gasLimit: Uint64;
94
- gasUsed: Uint64;
95
- timestamp: Uint64;
96
- extraData: Bytes32;
97
- baseFeePerGas: Uint64;
98
- blockHash: Hash32;
99
- transactions: Bytes[];
100
- withdrawals: WithdrawalV1[];
101
- blobGasUsed: Uint64;
102
- excessBlobGas: Uint64;
103
- blockAccessList: Bytes;
104
- }
105
- export interface ExecutionPayloadBodyV1 {
106
- transactions: Bytes[];
107
- withdrawals?: WithdrawalV1[];
108
- }
109
- export interface BlobsBundleV1 {
110
- commitments: Bytes48[];
111
- proofs: Bytes48[];
112
- blobs: Bytes[];
113
- }
114
- export interface BlobsBundleV2 {
115
- commitments: Bytes48[];
116
- proofs: Bytes48[];
117
- blobs: Bytes[];
118
- }
119
- }
120
-
121
- export { };
@@ -1,10 +0,0 @@
1
- declare global {
2
- // engine types
3
- export interface TransitionConfigurationV1 {
4
- terminalTotalDifficulty: Uint256;
5
- terminalBlockHash: Hash32;
6
- terminalBlockNumber: Uint64;
7
- }
8
- }
9
-
10
- export { };
@@ -1,87 +0,0 @@
1
- declare global {
2
- export type FlashbotsMethodsSpec = {
3
- eth_sendBundle: {
4
- params: [EthSendBundleParams];
5
- result: EthSendBundleResult;
6
- };
7
- eth_callBundle: {
8
- params: [EthCallBundleParams];
9
- result: EthCallBundleResult;
10
- };
11
- mev_sendBundle: {
12
- params: [MevSendBundleParams];
13
- result: MevSendBundleResult;
14
- };
15
- mev_simBundle: {
16
- params: [MevSimBundleParams, { parentBlock: Hash32 }];
17
- result: MevSimBundleResult;
18
- };
19
- eth_cancelBundle: {
20
- params: [EthCancelBundleParams];
21
- result: EthCancelBundleResult;
22
- };
23
- eth_sendPrivateTransaction: {
24
- params: [EthSendPrivateTransactionParams];
25
- result: EthSendPrivateTransactionResult;
26
- };
27
- eth_sendPrivateRawTransaction: {
28
- params: [EthSendPrivateRawTransactionParams];
29
- result: EthSendPrivateRawTransactionResult;
30
- };
31
- eth_cancelPrivateTransaction: {
32
- params: [EthCancelPrivateTransactioParams];
33
- result: EthCancelPrivateTransactionResult;
34
- };
35
-
36
- flashbots_getFeeRefundTotalsByRecipient: {
37
- params: GetFeeRefundTotalsByRecipientParams[];
38
- result: GetFeeRefundTotalsByRecipientResult;
39
- };
40
- flashbots_getFeeRefundsByRecipient: {
41
- params: [GetFeeRefundsByRecipientParams];
42
- result: GetFeeRefundsByRecipientResult;
43
- };
44
- flashbots_getFeeRefundsByBlock: {
45
- params: [GetFeeRefundsByBlockParams];
46
- result: GetFeeRefundsByBlockResult;
47
- };
48
- flashbots_getFeeRefundsByBundle: {
49
- params: [GetFeeRefundsByBundleParams];
50
- result: GetFeeRefundsByBundleResult;
51
- };
52
- flashbots_setFeeRefundRecipient: {
53
- params: [Address, Address];
54
- result: { from: Address; to: Address };
55
- };
56
- buildernet_getDelayedRefunds: {
57
- params: [GetDelayedRefundsParams];
58
- result: GetDelayedRefundsResult;
59
- };
60
- buildernet_getDelayedRefundTotalsByRecipient: {
61
- params: [GetDelayedRefundTotalsByRecipientParams];
62
- result: GetDelayedRefundTotalsByRecipientResult;
63
- };
64
- flashbots_getMevRefundTotalByRecipient: {
65
- params: [Address];
66
- result: { total: Hex };
67
- };
68
- flashbots_getMevRefundTotalBySender: {
69
- params: [Address];
70
- result: { total: Hex };
71
- };
72
- } & EthMethodsSpec;
73
-
74
- export enum BuilderNetMethods {
75
- eth_sendBundle = "eth_sendBundle",
76
- eth_sendRawTransaction = "eth_sendRawTransaction",
77
- buildernet_getFeeRefundTotalsByRecipient = "buildernet_getFeeRefundTotalsByRecipient",
78
- buildernet_getFeeRefundsByRecipient = "buildernet_getFeeRefundsByRecipient",
79
- buildernet_getFeeRefundsByBlock = "buildernet_getFeeRefundsByBlock",
80
- buildernet_getFeeRefundsByBundle = "buildernet_getFeeRefundsByBundle",
81
- buildernet_setFeeRefundRecipient = "buildernet_setFeeRefundRecipient",
82
- buildernet_getDelayedRefunds = "buildernet_getDelayedRefunds",
83
- buildernet_getDelayedRefundTotalsByRecipient = "buildernet_getDelayedRefundTotalsByRecipient",
84
- }
85
- }
86
-
87
- export { };
@@ -1,231 +0,0 @@
1
- declare global {
2
- export type GetDelayedRefundTotalsByRecipientParams = {
3
- recipient: Address;
4
- blockRangeFrom?: Hex;
5
- blockRangeTo?: Hex;
6
- };
7
- export type GetDelayedRefundTotalsByRecipientResult = {
8
- pending: Hex;
9
- received: Hex;
10
- indexedUpTo: Hex;
11
- };
12
-
13
- export type GetDelayedRefundsParams = {
14
- recipient: Address;
15
- blockRangeFrom?: Hex;
16
- blockRangeTo?: Hex;
17
- cursor?: Hex;
18
- hash?: Hash32;
19
- };
20
- export type GetDelayedRefundsResult = {
21
- refunds: Refund[];
22
- nextCursor: Hex;
23
- indexedUpTo: Hex;
24
- };
25
- export type GetFeeRefundsByBlockParams = {
26
- block_number: Hex;
27
- };
28
- export type GetFeeRefundsByBlockResult = unknown;
29
- export type GetFeeRefundsByBundleParams = {
30
- bundle_hash: Hex;
31
- };
32
- export type GetFeeRefundsByBundleResult = unknown;
33
- export type GetFeeRefundsByRecipientParams = {
34
- recipient: Address;
35
- cursor?: Hex;
36
- };
37
- export type Refund = {
38
- hash: Hex;
39
- amount: Hex;
40
- blockNumber: Hex;
41
- status: "pending" | "received";
42
- recipient: Address;
43
- };
44
- export type GetFeeRefundsByRecipientResult = {
45
- refunds: Refund[];
46
- cursor: string;
47
- };
48
- export type GetFeeRefundTotalsByRecipientParams = {
49
- recipient: Address;
50
- };
51
- export type GetFeeRefundTotalsByRecipientResult = {
52
- pending: Hex;
53
- received: Hex;
54
- maxBlockNumber: Hex;
55
- };
56
- export type EthCancelPrivateTransactioParams = {
57
- txHash: Hex;
58
- };
59
- export type EthCancelPrivateTransactionResult = boolean;
60
-
61
- export type EthSendPrivateRawTransactionParams = {
62
- // String, raw signed transaction
63
- tx: Hex;
64
- preferences?: {
65
- // Sends transactions to all registered block builders, sets MEV-Share revenue share to 50%
66
- fast: boolean;
67
- privacy?: {
68
- hints?: BundleHints;
69
- builders?: Builders[];
70
- };
71
- validity?: {
72
- refund?: Array<{ address: Address; percent: number }>;
73
- };
74
- };
75
- };
76
- export type EthSendPrivateRawTransactionResult = Hash32;
77
-
78
- export type EthSendPrivateTransactionParams = {
79
- tx: Hex;
80
- maxBlockNumber: Hex;
81
- preferences?: {
82
- // Sends transactions to all registered block builders, sets MEV-Share revenue share to 50%
83
- fast: boolean;
84
- privacy?: {
85
- hints?: BundleHints;
86
- builders?: Builders[];
87
- };
88
- validity?: {
89
- refund?: Array<{ address: Address; percent: number }>;
90
- };
91
- };
92
- };
93
- export type EthSendPrivateTransactionResult = Hash32;
94
- export type EthCancelBundleParams = {
95
- replacementUuid: string;
96
- };
97
- export type EthCancelBundleResult = unknown;
98
-
99
- export type EthSendBundleParams = {
100
- txs: Hex[];
101
- blockNumber: Hex | "0x" | null; // 0x | null or missing field for next block only
102
- // Replacing: send bundle with same replacementUuid to override previous one
103
- // Canceling: send bundle with same replacementUuid and empty list of transactions to cancel
104
- replacementUuid?: string;
105
- revertingTxHashes?: Hex[];
106
- minBlockNumber?: Hex;
107
- maxBlockNumber?: Hex;
108
- minFlashblockNumber?: Hex;
109
- maxFlashblockNumber?: Hex;
110
- minTimestamp?: number;
111
- maxTimestamp?: number;
112
- builders?: Builders[];
113
- };
114
- export type EthCallBundleParams = {
115
- txs: Hex[];
116
- blockNumber: Hex;
117
- stateBlockNumber: string | "latest";
118
- timestamp: number;
119
- };
120
- export type MevSendBundleParams = {
121
- version: "v0.1";
122
- inclusion: Inclusion;
123
- body: BundleBody;
124
- validity?: BundleValidity;
125
- privacy?: BundlePrivacy;
126
- };
127
- export type MevSimBundleParams = {
128
- version: "beta-1";
129
- inclusion: Inclusion;
130
- body: BundleBody;
131
- validity: BundleValidity;
132
- privacy?: BundlePrivacy;
133
- metadata?: BundleMetadata;
134
- simOptions?: BundleSimOptions;
135
- };
136
- export type Inclusion = {
137
- block: string;
138
- maxBlock?: string;
139
- };
140
- export type BundleBody = Array<
141
- | { hash: string } // tx hash
142
- | { tx: string; canRevert: boolean } // signed tx
143
- | { bundle: MevSendBundleParams[] }
144
- >;
145
- export type BundleValidity = {
146
- refund?: Array<{ bodyIdx: number; percent: number }>;
147
- refundConfig?: Array<{ address: string; percent: number }>;
148
- };
149
- export type BundlePrivacy = {
150
- hints?: BundleHints[];
151
- builders?: Builders[];
152
- };
153
- export type BundleMetadata = { originId?: string };
154
- export type BundleSimOptions = {
155
- parentBlock?: number | string; // Block used for simulation state. Defaults to latest block.
156
- blockNumber?: number; // default = parentBlock.number + 1
157
- coinbase?: string; // default = parentBlock.coinbase
158
- timestamp?: number; // default = parentBlock.timestamp + 12
159
- gasLimit?: number; // default = parentBlock.gasLimit
160
- baseFee?: bigint; // default = parentBlock.baseFeePerGas
161
- timeout?: number; // default = 5 (defined in seconds)
162
- };
163
- export type EthSendBundleResult = { bundleHash: Hex; smart: boolean };
164
- export type MevSendBundleResult = { bundleHash: Hex };
165
- export type BundleHints =
166
- | "calldata"
167
- | "contract_address"
168
- | "logs"
169
- | "function_selector"
170
- | "hash"
171
- | "tx_hash";
172
-
173
- export type EthCallBundleResult = {
174
- bundleGasPrice: Uint;
175
- bundleHash: Hash32;
176
- coinbaseDiff: Uint;
177
- ethSentToCoinbase: Uint;
178
- gasFees: Uint;
179
- results: Array<{
180
- coinbaseDiff: Uint;
181
- ethSentToCoinbase: Uint;
182
- fromAddress: Address;
183
- gasFees: Uint;
184
- gasPrice: Uint;
185
- gasUsed: number;
186
- toAddress: Address;
187
- txHash: Hash32;
188
- value: Hex;
189
- }>;
190
- stateBlockNumber: number;
191
- totalGasUsed: number;
192
- };
193
- export type MevSimBundleResult = {
194
- success: boolean;
195
- error?: string;
196
- stateBlock: Hex;
197
- mevGasPrice: Hex;
198
- profit: Hex;
199
- refundableValue: Hex;
200
- gasUsed: Hex;
201
- logs?: Array<{
202
- txLogs?: Log[];
203
- bundleLogs?: MevSimBundleResult[];
204
- }>;
205
- };
206
- export type Builders =
207
- | "default"
208
- | "flashbots"
209
- | "f1b.io"
210
- | "rsync"
211
- | "beaverbuild.org"
212
- | "builder0x69"
213
- | "Titan"
214
- | "EigenPhi"
215
- | "boba-builder"
216
- | "Gambit"
217
- | "payload"
218
- | "Loki"
219
- | "BuildAI"
220
- | "JetBuilder"
221
- | "tbuilder"
222
- | "penguinbuild"
223
- | "bobthebuilder"
224
- | "BTCS"
225
- | "bloXroute"
226
- | "Blockbeelder"
227
- | "Quasar"
228
- | "Eureka";
229
- }
230
-
231
- export { };