@asyncswap/eth-rpc 0.4.2 → 0.4.3
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 +10 -2
- package/README.md +11 -2
- package/example.ts +4 -2
- package/package.json +2 -2
- package/src/engine-api.ts +25 -308
- package/src/eth-api.ts +21 -252
- package/src/mev-api.ts +23 -150
- package/src/types/debug/methods.d.ts +7 -7
- package/src/types/engine/methods.d.ts +115 -33
- package/src/types/eth/methods.d.ts +96 -43
- package/src/types/mev/methods.d.ts +70 -19
- package/CLAUDE.md +0 -111
|
@@ -1,55 +1,108 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
export type EthMethodsSpec = {
|
|
3
|
+
eth_getTransactionByHash: {
|
|
4
|
+
params: [Hash32];
|
|
5
|
+
result: NotFound | TransactionInfo;
|
|
6
|
+
};
|
|
7
|
+
eth_getTransactionByBlockHashAndIndex: {
|
|
8
|
+
params: [Hash32, Uint];
|
|
9
|
+
result: NotFound | TransactionInfo;
|
|
10
|
+
};
|
|
11
|
+
eth_getTransactionReceipt: {
|
|
12
|
+
params: [Hash32];
|
|
13
|
+
result: NotFound | ReceiptInfo;
|
|
14
|
+
};
|
|
7
15
|
// eth/submit
|
|
8
|
-
eth_sendTransaction
|
|
9
|
-
eth_sendRawTransaction
|
|
16
|
+
eth_sendTransaction: { params: [GenericTransaction]; result: Hash32 };
|
|
17
|
+
eth_sendRawTransaction: { params: [Bytes]; result: Hash32 };
|
|
10
18
|
// eth/state
|
|
11
|
-
eth_getBalance
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
eth_getBalance: {
|
|
20
|
+
params: [Address, BlockNumberOrTagOrHash];
|
|
21
|
+
result: Uint;
|
|
22
|
+
};
|
|
23
|
+
eth_getStorageAt: {
|
|
24
|
+
params: [Address, Bytes32, BlockNumberOrTagOrHash];
|
|
25
|
+
result: Bytes;
|
|
26
|
+
};
|
|
27
|
+
eth_getTransactionCount: {
|
|
28
|
+
params: [Address, BlockNumberOrTagOrHash];
|
|
29
|
+
result: Uint;
|
|
30
|
+
};
|
|
31
|
+
eth_getCode: {
|
|
32
|
+
params: [Address, BlockNumberOrTagOrHash];
|
|
33
|
+
result: Bytes;
|
|
34
|
+
};
|
|
35
|
+
eth_getProof: {
|
|
36
|
+
params: [Address, Bytes32[], BlockNumberOrTagOrHash];
|
|
37
|
+
result: AccountProof;
|
|
38
|
+
};
|
|
16
39
|
// eth/sign
|
|
17
|
-
eth_sign
|
|
18
|
-
eth_signTransaction
|
|
40
|
+
eth_sign: { params: [Address, Bytes]; result: Bytes65 };
|
|
41
|
+
eth_signTransaction: { params: [GenericTransaction]; result: Bytes };
|
|
19
42
|
// eth/filter
|
|
20
|
-
eth_newFilter
|
|
21
|
-
eth_newBlockFilter
|
|
22
|
-
eth_newPendingTransactionFilter
|
|
23
|
-
eth_uninstallFilter
|
|
24
|
-
eth_getFilterChanges
|
|
25
|
-
eth_getFilterLogs
|
|
26
|
-
eth_getLogs
|
|
43
|
+
eth_newFilter: { params: [Filter]; result: Uint };
|
|
44
|
+
eth_newBlockFilter: { params: []; result: Uint };
|
|
45
|
+
eth_newPendingTransactionFilter: { params: []; result: Uint };
|
|
46
|
+
eth_uninstallFilter: { params: []; result: Uint };
|
|
47
|
+
eth_getFilterChanges: { params: []; result: FilterResults };
|
|
48
|
+
eth_getFilterLogs: { params: [Uint]; result: FilterResults };
|
|
49
|
+
eth_getLogs: { params: [Filter]; result: FilterResults };
|
|
27
50
|
// eth/feeMarket
|
|
28
|
-
eth_gasPrice
|
|
29
|
-
eth_blobBaseFee
|
|
30
|
-
eth_maxPriorityFeePerGas
|
|
31
|
-
eth_feeHistory
|
|
51
|
+
eth_gasPrice: { params: []; result: Uint };
|
|
52
|
+
eth_blobBaseFee: { params: []; result: Uint };
|
|
53
|
+
eth_maxPriorityFeePerGas: { params: []; result: Uint };
|
|
54
|
+
eth_feeHistory: {
|
|
55
|
+
params: [Uint, BlockNumberOrTag, number[]];
|
|
56
|
+
result: FeeHistoryResults;
|
|
57
|
+
};
|
|
32
58
|
// eth/execute
|
|
33
|
-
eth_call
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
59
|
+
eth_call: {
|
|
60
|
+
params: [GenericTransaction, BlockNumberOrTagOrHash];
|
|
61
|
+
result: Bytes;
|
|
62
|
+
};
|
|
63
|
+
eth_estimateGas: {
|
|
64
|
+
params: [GenericTransaction, BlockNumberOrTag];
|
|
65
|
+
result: Uint;
|
|
66
|
+
};
|
|
67
|
+
eth_createAccessList: {
|
|
68
|
+
params: [GenericTransaction, BlockNumberOrTag];
|
|
69
|
+
result: AccessListResult;
|
|
70
|
+
};
|
|
71
|
+
eth_simulateV1: {
|
|
72
|
+
params: [EthSimulatePayload, BlockNumberOrTagOrHash];
|
|
73
|
+
result: EthSimulateResult;
|
|
74
|
+
};
|
|
37
75
|
// eth/client
|
|
38
|
-
eth_chainId
|
|
39
|
-
eth_syncing
|
|
40
|
-
eth_coinbase
|
|
41
|
-
eth_accounts
|
|
42
|
-
eth_blockNumber
|
|
43
|
-
net_version
|
|
76
|
+
eth_chainId: { params: []; result: Uint };
|
|
77
|
+
eth_syncing: { params: []; result: SyncingStatus };
|
|
78
|
+
eth_coinbase: { params: []; result: Address };
|
|
79
|
+
eth_accounts: { params: []; result: Addresses };
|
|
80
|
+
eth_blockNumber: { params: []; result: Uint };
|
|
81
|
+
net_version: { params: []; result: UintDecimal };
|
|
44
82
|
// eth/block
|
|
45
|
-
eth_getBlockByHash
|
|
46
|
-
eth_getBlockByNumber
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
83
|
+
eth_getBlockByHash: { params: [Hash32, boolean]; result: NotFound | Block };
|
|
84
|
+
eth_getBlockByNumber: {
|
|
85
|
+
params: [BlockNumberOrTag, boolean];
|
|
86
|
+
result: NotFound | Block;
|
|
87
|
+
};
|
|
88
|
+
eth_getBlockTransactionCountByHash: {
|
|
89
|
+
params: [Hash32];
|
|
90
|
+
result: NotFound | Uint;
|
|
91
|
+
};
|
|
92
|
+
eth_getBlockTransactionCountByNumber: {
|
|
93
|
+
params: [BlockNumberOrTag];
|
|
94
|
+
result: NotFound | Uint;
|
|
95
|
+
};
|
|
96
|
+
eth_getUncleCountByBlockHash: { params: [Hash32]; result: NotFound | Uint };
|
|
97
|
+
eth_getUncleCountByBlockNumber: {
|
|
98
|
+
params: [BlockNumberOrTag];
|
|
99
|
+
result: NotFound | Uint;
|
|
100
|
+
};
|
|
101
|
+
eth_getBlockReceipts: {
|
|
102
|
+
params: [BlockNumberOrTagOrHash];
|
|
103
|
+
result: NotFound | ReceiptInfo[];
|
|
104
|
+
};
|
|
105
|
+
} & DebugMethods;
|
|
53
106
|
}
|
|
54
107
|
|
|
55
108
|
export { };
|
|
@@ -1,24 +1,75 @@
|
|
|
1
1
|
declare global {
|
|
2
|
-
export
|
|
3
|
-
eth_sendBundle
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
};
|
|
11
35
|
|
|
12
|
-
flashbots_getFeeRefundTotalsByRecipient
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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;
|
|
22
73
|
|
|
23
74
|
export enum BuilderNetMethods {
|
|
24
75
|
eth_sendBundle = "eth_sendBundle",
|
package/CLAUDE.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Use Bun instead of Node.js, npm, pnpm, or vite.
|
|
3
|
-
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
|
|
4
|
-
alwaysApply: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
Default to using Bun instead of Node.js.
|
|
8
|
-
|
|
9
|
-
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
|
|
10
|
-
- Use `bun test` instead of `jest` or `vitest`
|
|
11
|
-
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
|
|
12
|
-
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
|
|
13
|
-
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
|
|
14
|
-
- Bun automatically loads .env, so don't use dotenv.
|
|
15
|
-
|
|
16
|
-
## APIs
|
|
17
|
-
|
|
18
|
-
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
|
|
19
|
-
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
|
|
20
|
-
- `Bun.redis` for Redis. Don't use `ioredis`.
|
|
21
|
-
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
|
|
22
|
-
- `WebSocket` is built-in. Don't use `ws`.
|
|
23
|
-
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
|
|
24
|
-
- Bun.$`ls` instead of execa.
|
|
25
|
-
|
|
26
|
-
## Testing
|
|
27
|
-
|
|
28
|
-
Use `bun test` to run tests.
|
|
29
|
-
|
|
30
|
-
```ts#index.test.ts
|
|
31
|
-
import { test, expect } from "bun:test";
|
|
32
|
-
|
|
33
|
-
test("hello world", () => {
|
|
34
|
-
expect(1).toBe(1);
|
|
35
|
-
});
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Frontend
|
|
39
|
-
|
|
40
|
-
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
|
|
41
|
-
|
|
42
|
-
Server:
|
|
43
|
-
|
|
44
|
-
```ts#index.ts
|
|
45
|
-
import index from "./index.html"
|
|
46
|
-
|
|
47
|
-
Bun.serve({
|
|
48
|
-
routes: {
|
|
49
|
-
"/": index,
|
|
50
|
-
"/api/users/:id": {
|
|
51
|
-
GET: (req) => {
|
|
52
|
-
return new Response(JSON.stringify({ id: req.params.id }));
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
// optional websocket support
|
|
57
|
-
websocket: {
|
|
58
|
-
open: (ws) => {
|
|
59
|
-
ws.send("Hello, world!");
|
|
60
|
-
},
|
|
61
|
-
message: (ws, message) => {
|
|
62
|
-
ws.send(message);
|
|
63
|
-
},
|
|
64
|
-
close: (ws) => {
|
|
65
|
-
// handle close
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
development: {
|
|
69
|
-
hmr: true,
|
|
70
|
-
console: true,
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
|
|
76
|
-
|
|
77
|
-
```html#index.html
|
|
78
|
-
<html>
|
|
79
|
-
<body>
|
|
80
|
-
<h1>Hello, world!</h1>
|
|
81
|
-
<script type="module" src="./frontend.tsx"></script>
|
|
82
|
-
</body>
|
|
83
|
-
</html>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
With the following `frontend.tsx`:
|
|
87
|
-
|
|
88
|
-
```tsx#frontend.tsx
|
|
89
|
-
import React from "react";
|
|
90
|
-
|
|
91
|
-
// import .css files directly and it works
|
|
92
|
-
import './index.css';
|
|
93
|
-
|
|
94
|
-
import { createRoot } from "react-dom/client";
|
|
95
|
-
|
|
96
|
-
const root = createRoot(document.body);
|
|
97
|
-
|
|
98
|
-
export default function Frontend() {
|
|
99
|
-
return <h1>Hello, world!</h1>;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
root.render(<Frontend />);
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
Then, run index.ts
|
|
106
|
-
|
|
107
|
-
```sh
|
|
108
|
-
bun --hot ./index.ts
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.
|