@asyncswap/eth-rpc 0.4.5 → 0.4.8

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,43 @@
1
1
  # @asyncswap/eth-rpc
2
2
 
3
+ ## 0.4.8
4
+
5
+ ### Patch Changes
6
+
7
+ - cad9042: minimal eth rpc client
8
+
9
+ - ported engine api to different package
10
+
11
+ ## 0.4.7
12
+
13
+ ### Patch Changes
14
+
15
+ - ff4e035: fix base client proxy
16
+
17
+ ```ts
18
+ setHeaders(...) {
19
+ this.headers = ...
20
+ return this; // ❌ returns the *target*
21
+ }
22
+ ```
23
+
24
+ The correct fix: return the receiver / proxy, not this
25
+
26
+ You already have access to the proxy inside the get trap via receiver.
27
+
28
+ So you must bind methods so that they return the proxy.
29
+
30
+ - setHeaders() mutates the target
31
+ - returns receiver (the proxy)
32
+ - chaining continues in proxy-land
33
+ - RPC methods remain visible
34
+
35
+ ## 0.4.6
36
+
37
+ ### Patch Changes
38
+
39
+ - 3d6ec6e: add clinet version spec
40
+
3
41
  ## 0.4.5
4
42
 
5
43
  ### Patch Changes
package/README.md CHANGED
@@ -26,48 +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
- ```
37
-
38
- ### Engine API Client
39
-
40
- ```typescript
41
- import { EngineExecutionClient } from '@asyncswap/eth-rpc';
42
-
43
- const engineUrl = 'https://localhost:8551';
44
- const engine = new EngineExecutionClient(engineUrl, process.env.JWT_TOKEN!);
45
- const payload = await engine.engine_getPayloadV1("0x1");
46
-
47
- console.log(payload);
48
-
49
- import { FlashbotsClient } from '@asyncswap/eth-rpc';
50
-
51
- const rpc = 'https://relay.flashbots.net';
52
- const client = new FlashbotsClient(rpc);
53
- ```
54
-
55
- ## Error Handling
56
-
57
- All methods return typed responses. Handle errors appropriately:
58
-
59
- ```typescript
60
- try {
61
- const balance = await client.eth_getBalance(address, 'latest');
62
- console.log('Balance:', balance);
63
- } catch (error) {
64
- console.error('RPC Error:', error);
65
- }
66
- ```
67
-
68
- ## Type Safety
69
-
70
- Full TypeScript support with comprehensive type definitions for all RPC methods and responses.
31
+ - [ethereum/execution-apis](https://github.com/ethereum/execution-apis)
71
32
 
72
33
  ## Dependencies
73
34
 
package/example.ts CHANGED
@@ -8,36 +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.engine_getPayloadV1("0x1");
17
-
18
- console.log(payload);
19
-
20
- import { FlashbotsClient } from "./src";
21
-
22
- const rpc = "https://relay.flashbots.net";
23
- const client = new FlashbotsClient(rpc);
24
- const body = client.rpc.buildRequest("eth_sendBundle", [
25
- {
26
- txs: ["0x123abc", "0x456def..."],
27
- blockNumber: "0xb63dcd",
28
- minTimestamp: 0,
29
- maxTimestamp: 1615920932,
30
- } as EthSendBundleParams,
31
- ]);
32
- // const signature = wallet.sign(body)
33
- // const signature = wallet.address
34
- client
35
- .setHeaders({
36
- "X-Flashbots-Signature": `0x<sender>:0x<signature>`,
37
- })
38
- .eth_sendBundle({
39
- txs: ["0x123abc...", "0x456def..."],
40
- blockNumber: "0xb63dcd",
41
- minTimestamp: 0,
42
- maxTimestamp: 1615920932,
43
- });
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.5",
5
+ "version": "0.4.8",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
package/src/base.ts CHANGED
@@ -14,12 +14,27 @@ 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;
21
34
 
22
- return (...params: MethodsSpec[typeof method]["params"]) =>
35
+ return (
36
+ ...params: MethodsSpec[typeof method]["params"]
37
+ ): MethodsSpec[typeof method]["result"] =>
23
38
  this.rpc.call(this.rpc.buildRequest(method, params), this.headers);
24
39
  },
25
40
  });
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/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,124 +0,0 @@
1
- declare global {
2
- export type EngineMethodsSpec = {
3
- eth_blockNumber: { params: []; result: Uint };
4
- eth_call: {
5
- params: [GenericTransaction, BlockNumberOrTagOrHash];
6
- result: Bytes;
7
- };
8
- eth_chainId: { params: []; result: Uint };
9
- eth_getCode: { params: [Address, BlockNumberOrTagOrHash]; result: Bytes };
10
- eth_getBlockByHash: { params: [Hash32, boolean]; result: NotFound | Block };
11
- eth_getBlockByNumber: {
12
- params: [BlockNumberOrTag, boolean];
13
- result: NotFound | Block;
14
- };
15
- eth_getLogs: { params: [Filter]; result: FilterResults };
16
- eth_sendRawTransaction: { params: [Bytes]; result: Hash32 };
17
- eth_syncing: { params: []; result: SyncingStatus };
18
- // engine/blob
19
- engine_getBlobsV1: { params: [Hash32[]]; result: BlobAndProofV1[] };
20
- engine_getBlobsV2: { params: [Hash32[]]; result: BlobAndProofV2[] };
21
- engine_getBlobsV3: {
22
- params: [Hash32[]];
23
- result: Array<BlobAndProofV2[] | null> | null;
24
- };
25
- // engine/capabilities
26
- engine_exchangeCapabilities: { params: [string[]]; result: string[] };
27
- // engine/forkchoice
28
- engine_forkchoiceUpdatedV1: {
29
- params: [ForkchoiceStateV1, PayloadAttributesV1];
30
- result: ForkchoiceUpdatedResponseV1;
31
- };
32
- engine_forkchoiceUpdatedV2: {
33
- params: [ForkchoiceStateV1, PayloadAttributesV2];
34
- result: ForkchoiceUpdatedResponseV1;
35
- };
36
- engine_forkchoiceUpdatedV3: {
37
- params: [ForkchoiceStateV1, PayloadAttributesV3];
38
- result: ForkchoiceUpdatedResponseV1;
39
- };
40
- // engine/payload
41
- engine_newPayloadV1: {
42
- params: [ExecutionPayloadV1];
43
- result: PayloadStatusV1;
44
- };
45
- engine_newPayloadV2: {
46
- params: [ExecutionPayloadV1 | ExecutionPayloadV2];
47
- result: PayloadStatusNoInvalidBlockHash;
48
- };
49
- engine_newPayloadV3: {
50
- params: [ExecutionPayloadV3, Hash32[], Hash32];
51
- result: PayloadStatusNoInvalidBlockHash;
52
- };
53
- engine_newPayloadV4: {
54
- params: [ExecutionPayloadV3, Hash32[], Hash32, Bytes[]];
55
- result: PayloadStatusNoInvalidBlockHash;
56
- };
57
- engine_getPayloadV1: { params: [Bytes8]; result: ExecutionPayloadV1 };
58
- engine_getPayloadV2: {
59
- params: [Bytes8];
60
- result: {
61
- executionPayload: ExecutionPayloadV1 | ExecutionPayloadV2;
62
- blockValue: Uint256;
63
- };
64
- };
65
- engine_getPayloadV3: {
66
- params: [Bytes8];
67
- result: {
68
- executionPayload: ExecutionPayloadV3;
69
- blockValue: Uint256;
70
- blobsBundle: BlobsBundleV1;
71
- shouldOverrideBuilder: boolean;
72
- };
73
- };
74
- engine_getPayloadV4: {
75
- params: [Bytes8];
76
- result: {
77
- executionPayload: ExecutionPayloadV3;
78
- blockValue: Uint256;
79
- blobsBundle: BlobsBundleV1;
80
- shouldOverrideBuilder: boolean;
81
- executionRequests: Bytes[];
82
- };
83
- };
84
- engine_getPayloadV5: {
85
- params: [Bytes8];
86
- result: {
87
- executionPayload: ExecutionPayloadV3;
88
- blockValue: Uint256;
89
- blobsBundle: BlobsBundleV2;
90
- shouldOverrideBuilder: boolean;
91
- executionRequests: Bytes[];
92
- };
93
- };
94
- engine_getPayloadBodiesByHashV1: {
95
- params: [Hash32[]];
96
- result: ExecutionPayloadBodyV1[];
97
- };
98
- engine_getPayloadBodiesByRangeV1: {
99
- params: [Uint64, Uint64];
100
- result: ExecutionPayloadBodyV1[];
101
- };
102
- engine_newPayloadV5: {
103
- params: [ExecutionPayloadV4, Hash32[], Hash32, Bytes[]];
104
- result: PayloadStatusNoInvalidBlockHash;
105
- };
106
- engine_getPayloadV6: {
107
- params: [Bytes8];
108
- result: {
109
- executionPayload: ExecutionPayloadV4;
110
- blockValue: Uint256;
111
- blobsBundle: BlobsBundleV2;
112
- shouldOverrideBuilder: boolean;
113
- executionRequests: Bytes[];
114
- };
115
- };
116
- // engine/transition-configuration
117
- engine_exchangeTransitionConfigurationV1: {
118
- params: [TransitionConfigurationV1];
119
- result: TransitionConfigurationV1;
120
- };
121
- };
122
- }
123
-
124
- 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 { };