@asyncswap/eth-rpc 0.3.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.
- package/CHANGELOG.md +56 -0
- package/CLAUDE.md +111 -0
- package/README.md +38 -0
- package/example.ts +19 -0
- package/package.json +46 -0
- package/src/engine-api.ts +254 -0
- package/src/eth-api.ts +275 -0
- package/src/index.ts +2 -0
- package/src/types/base.d.ts +23 -0
- package/src/types/block.d.ts +46 -0
- package/src/types/client.d.ts +11 -0
- package/src/types/debug/methods.d.ts +11 -0
- package/src/types/engine/blob.d.ts +12 -0
- package/src/types/engine/forkchoice.d.ts +32 -0
- package/src/types/engine/methods.d.ts +42 -0
- package/src/types/engine/payload.d.ts +121 -0
- package/src/types/engine/transition-configuration.d.ts +10 -0
- package/src/types/eth/methods.d.ts +55 -0
- package/src/types/execute.d.ts +85 -0
- package/src/types/feeHistory.d.ts +18 -0
- package/src/types/filter.d.ts +20 -0
- package/src/types/receit.d.ts +36 -0
- package/src/types/state.d.ts +19 -0
- package/src/types/transaction.d.ts +149 -0
- package/src/types/withdraw.d.ts +11 -0
- package/tsconfig.json +40 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// execute.yaml
|
|
3
|
+
export interface EthSimulatePayload {
|
|
4
|
+
blockStateCalls: BlockStateCall[];
|
|
5
|
+
traceTransfers?: boolean;
|
|
6
|
+
validation?: boolean;
|
|
7
|
+
returnFullTransactions?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface BlockStateCall {
|
|
10
|
+
blockOverrides?: BlockOverrides;
|
|
11
|
+
stateOverrides?: StateOverrides;
|
|
12
|
+
calls?: GenericCallTransaction[];
|
|
13
|
+
}
|
|
14
|
+
export interface BlockOverrides {
|
|
15
|
+
number?: Uint64;
|
|
16
|
+
prevRandao?: Uint256;
|
|
17
|
+
time?: Uint64;
|
|
18
|
+
gasLimit?: Uint64;
|
|
19
|
+
feeRecipient?: Address;
|
|
20
|
+
baseFeePerGas?: Uint256;
|
|
21
|
+
withdrawals?: Withdrawal[];
|
|
22
|
+
blobBaseFee?: Uint64;
|
|
23
|
+
}
|
|
24
|
+
export type StateOverrides = Record<Address, AccountOverride>;
|
|
25
|
+
export interface GenericCallTransaction {
|
|
26
|
+
type?: "0x0" | "0x1" | "0x2" | "0x3";
|
|
27
|
+
to?: Address | null;
|
|
28
|
+
from?: Address;
|
|
29
|
+
value?: Uint;
|
|
30
|
+
nonce?: Uint;
|
|
31
|
+
gas?: Uint;
|
|
32
|
+
input?: Bytes;
|
|
33
|
+
gasPrice?: Uint;
|
|
34
|
+
maxPriorityFeePerGas?: Uint;
|
|
35
|
+
maxFeePerGas?: Uint;
|
|
36
|
+
maxFeePerBlobGas?: Uint;
|
|
37
|
+
accessList?: AccessListEntry[];
|
|
38
|
+
blobVersionedHashes?: Hash32[];
|
|
39
|
+
authorizationList?: AuthorizationList;
|
|
40
|
+
}
|
|
41
|
+
export type AccountOverride = AccountOverrideState | AccountOverrideStateDiff;
|
|
42
|
+
export interface AccountOverrideState {
|
|
43
|
+
state: AccountStorage;
|
|
44
|
+
nonce?: Uint64;
|
|
45
|
+
balance?: Uint256;
|
|
46
|
+
code?: Bytes;
|
|
47
|
+
movePrecompileToAddress?: Address;
|
|
48
|
+
}
|
|
49
|
+
export interface AccountOverrideStateDiff {
|
|
50
|
+
stateDiff: AccountStorage;
|
|
51
|
+
nonce?: Uint64;
|
|
52
|
+
balance?: Uint256;
|
|
53
|
+
code?: Bytes;
|
|
54
|
+
movePrecompileToAddress?: Address;
|
|
55
|
+
}
|
|
56
|
+
export type AccountStorage = Record<Bytes32, Hash32>;
|
|
57
|
+
export type EthSimulateResult = EthSimulateBlockResultSingleSuccess[];
|
|
58
|
+
|
|
59
|
+
export type EthSimulateBlockResultSingleSuccess = {
|
|
60
|
+
calls: CallResults;
|
|
61
|
+
} & Block;
|
|
62
|
+
export type CallResults = CallResultFailure | CallResultSuccess;
|
|
63
|
+
export interface CallResultFailure {
|
|
64
|
+
status: "0x0";
|
|
65
|
+
returnData: Bytes;
|
|
66
|
+
gasUsed: Uint64;
|
|
67
|
+
error: EXECUTION_REVERTED_ERROR | VM_EXECUTION_ERROR;
|
|
68
|
+
}
|
|
69
|
+
export type EXECUTION_REVERTED_ERROR = {
|
|
70
|
+
code: -32000;
|
|
71
|
+
message: "execution reverted.";
|
|
72
|
+
};
|
|
73
|
+
export type VM_EXECUTION_ERROR = {
|
|
74
|
+
code: -32015;
|
|
75
|
+
message: "vm execution error.";
|
|
76
|
+
};
|
|
77
|
+
export interface CallResultSuccess {
|
|
78
|
+
status: "0x1";
|
|
79
|
+
returnData: Bytes;
|
|
80
|
+
gasUsed: Uint64;
|
|
81
|
+
logs: Log[];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// misc
|
|
3
|
+
export interface FeeHistoryResults {
|
|
4
|
+
oldestBlock: Uint;
|
|
5
|
+
baseFeePerGas: Uint[];
|
|
6
|
+
baseFeePerBlobGas?: Uint[];
|
|
7
|
+
gasUsedRatio: Ratio[];
|
|
8
|
+
blobGasUsedRatio?: Ratio[];
|
|
9
|
+
reward?: Uint[][];
|
|
10
|
+
}
|
|
11
|
+
export interface AccessListResult {
|
|
12
|
+
accessList?: AccessListEntry[];
|
|
13
|
+
error?: string;
|
|
14
|
+
gasUsed?: Uint;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// filter.yaml
|
|
3
|
+
export type FilterResults = Hash32[] | Log[];
|
|
4
|
+
export type FilterTopic = Bytes32 | Bytes32[];
|
|
5
|
+
export type FilterTopics = FilterTopic | null;
|
|
6
|
+
export type Filter = FilterByBlockRange | FilterByBlockHash;
|
|
7
|
+
export interface FilterByBlockRange {
|
|
8
|
+
fromBlock?: Uint;
|
|
9
|
+
toBlock?: Uint;
|
|
10
|
+
address?: null | Address | Addresses;
|
|
11
|
+
topics?: FilterTopics;
|
|
12
|
+
}
|
|
13
|
+
export interface FilterByBlockHash {
|
|
14
|
+
blockHash: Hash32;
|
|
15
|
+
address?: Address | Addresses | null;
|
|
16
|
+
topics?: FilterTopics;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// receipt.yaml
|
|
3
|
+
export interface Log {
|
|
4
|
+
transactionHash: Hash32;
|
|
5
|
+
removed?: boolean;
|
|
6
|
+
logIndex?: Uint;
|
|
7
|
+
transactionIndex?: Uint;
|
|
8
|
+
blockHash?: Hash32;
|
|
9
|
+
blockNumber?: Uint;
|
|
10
|
+
blockTimestamp?: Uint;
|
|
11
|
+
address?: Address;
|
|
12
|
+
data?: Bytes;
|
|
13
|
+
topics?: Bytes32[];
|
|
14
|
+
}
|
|
15
|
+
export interface ReceiptInfo {
|
|
16
|
+
type?: Byte;
|
|
17
|
+
transactionHash: Hash32;
|
|
18
|
+
transactionIndex: Uint;
|
|
19
|
+
blockHash: Byte;
|
|
20
|
+
blockNumber: Uint;
|
|
21
|
+
from: Address;
|
|
22
|
+
to?: Address | null;
|
|
23
|
+
cumulativeGasUsed: Uint;
|
|
24
|
+
gasUsed: Uint;
|
|
25
|
+
blobGasUsed?: Uint;
|
|
26
|
+
contractAddress?: Address | null;
|
|
27
|
+
logs: Log[];
|
|
28
|
+
logsBloom: Bytes256;
|
|
29
|
+
root?: Hash32;
|
|
30
|
+
status?: Uint;
|
|
31
|
+
effectiveGasPrice: Uint;
|
|
32
|
+
blobGasPrice?: Uint;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// state.yaml
|
|
3
|
+
export interface AccountProof {
|
|
4
|
+
address: Address;
|
|
5
|
+
accountProof: Bytes;
|
|
6
|
+
balance: Uint256;
|
|
7
|
+
codeHash: Hash32;
|
|
8
|
+
nonce: Uint64;
|
|
9
|
+
storageHash: Hash32;
|
|
10
|
+
storageProof: StorageProof;
|
|
11
|
+
}
|
|
12
|
+
export interface StorageProof {
|
|
13
|
+
key: Bytes32;
|
|
14
|
+
value: Uint256;
|
|
15
|
+
proof: Bytes;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
// transaction.yaml
|
|
3
|
+
export interface AccessListEntry {
|
|
4
|
+
address: Address;
|
|
5
|
+
storageKeys: Hash32[];
|
|
6
|
+
}
|
|
7
|
+
export type TransactionUnsigned =
|
|
8
|
+
| TransactionLegacyUnsigned
|
|
9
|
+
| Transaction2930Unsigned
|
|
10
|
+
| Transaction1559Unsigned
|
|
11
|
+
| Transaction4844Unsigned
|
|
12
|
+
| Transaction7702Unsigned;
|
|
13
|
+
|
|
14
|
+
export interface TransactionLegacyUnsigned {
|
|
15
|
+
type: "0x0";
|
|
16
|
+
nonce: Uint;
|
|
17
|
+
to?: Address | null;
|
|
18
|
+
gas: Uint;
|
|
19
|
+
value: Uint;
|
|
20
|
+
input: Bytes;
|
|
21
|
+
gasPrice: Uint;
|
|
22
|
+
chainId?: Uint;
|
|
23
|
+
}
|
|
24
|
+
export interface Transaction2930Unsigned {
|
|
25
|
+
type: "0x1";
|
|
26
|
+
nonce: Uint;
|
|
27
|
+
to?: Address | null;
|
|
28
|
+
gas: Uint;
|
|
29
|
+
value: Uint;
|
|
30
|
+
input: Bytes;
|
|
31
|
+
gasPrice: Uint;
|
|
32
|
+
chainId: Uint;
|
|
33
|
+
accessList: AccessListEntry[];
|
|
34
|
+
}
|
|
35
|
+
export interface Transaction1559Unsigned {
|
|
36
|
+
type: "0x2";
|
|
37
|
+
nonce: Uint;
|
|
38
|
+
to?: Address | null;
|
|
39
|
+
gas: Uint;
|
|
40
|
+
value: Uint;
|
|
41
|
+
input: Bytes;
|
|
42
|
+
gasPrice: Uint;
|
|
43
|
+
maxFeePerGas: Uint;
|
|
44
|
+
maxPriorityFeePerGas: Uint;
|
|
45
|
+
accessList: AccessListEntry[];
|
|
46
|
+
chainId: Uint;
|
|
47
|
+
}
|
|
48
|
+
export interface Transaction4844Unsigned {
|
|
49
|
+
type: "0x3";
|
|
50
|
+
nonce: Uint;
|
|
51
|
+
to: Address;
|
|
52
|
+
gas: Uint;
|
|
53
|
+
value: Uint;
|
|
54
|
+
input: Bytes;
|
|
55
|
+
gasPrice?: Uint;
|
|
56
|
+
maxFeePerGas: Uint;
|
|
57
|
+
maxPriorityFeePerGas: Uint;
|
|
58
|
+
maxFeePerBlobGas: Uint;
|
|
59
|
+
accessList: AccessListEntry[];
|
|
60
|
+
blobVersionedHashes: Hash32[];
|
|
61
|
+
chainId: Uint;
|
|
62
|
+
}
|
|
63
|
+
export interface Transaction7702Unsigned {
|
|
64
|
+
type: "0x4";
|
|
65
|
+
nonce: Uint;
|
|
66
|
+
to: Address;
|
|
67
|
+
gas: Uint;
|
|
68
|
+
value: Uint;
|
|
69
|
+
input: Bytes;
|
|
70
|
+
maxPriorityFeePerGas: Uint;
|
|
71
|
+
maxFeePerGas: Uint;
|
|
72
|
+
gasPrice?: Uint;
|
|
73
|
+
accessList: AccessListEntry[];
|
|
74
|
+
chainId: Uint;
|
|
75
|
+
authorizationList: AuthorizationList;
|
|
76
|
+
}
|
|
77
|
+
export interface AuthorizationListEntry {
|
|
78
|
+
chainId: Uint;
|
|
79
|
+
nonce: Uint;
|
|
80
|
+
address: Address;
|
|
81
|
+
yParity: Byte;
|
|
82
|
+
r: Uint256;
|
|
83
|
+
s: Uint256;
|
|
84
|
+
}
|
|
85
|
+
export type AuthorizationList = AuthorizationListEntry[];
|
|
86
|
+
|
|
87
|
+
export type TransactionLegacySigned = {
|
|
88
|
+
v: Byte;
|
|
89
|
+
r: Uint;
|
|
90
|
+
s: Uint;
|
|
91
|
+
} & TransactionLegacyUnsigned;
|
|
92
|
+
export type Transaction2930Signed = {
|
|
93
|
+
yParity: Bytes;
|
|
94
|
+
r: Uint;
|
|
95
|
+
s: Uint;
|
|
96
|
+
v?: Byte;
|
|
97
|
+
} & Transaction2930Unsigned;
|
|
98
|
+
export type Transaction1559Signed = {
|
|
99
|
+
yParity: Bytes;
|
|
100
|
+
r: Uint;
|
|
101
|
+
s: Uint;
|
|
102
|
+
v?: Byte;
|
|
103
|
+
} & Transaction1559Unsigned;
|
|
104
|
+
export type Transaction4844Signed = {
|
|
105
|
+
yParity: Byte;
|
|
106
|
+
r: Uint;
|
|
107
|
+
s: Uint;
|
|
108
|
+
v?: Byte;
|
|
109
|
+
} & Transaction4844Unsigned;
|
|
110
|
+
export type Transaction7702Signed = {
|
|
111
|
+
yParity: Byte;
|
|
112
|
+
r: Uint;
|
|
113
|
+
s: Uint;
|
|
114
|
+
v?: Byte;
|
|
115
|
+
} & Transaction7702Unsigned;
|
|
116
|
+
export type TransactionSigned =
|
|
117
|
+
| TransactionLegacySigned
|
|
118
|
+
| Transaction2930Signed
|
|
119
|
+
| Transaction1559Signed
|
|
120
|
+
| Transaction4844Signed
|
|
121
|
+
| Transaction7702Signed;
|
|
122
|
+
export type TransactionInfo = {
|
|
123
|
+
blockHash: Hash32;
|
|
124
|
+
blockNumber: Uint;
|
|
125
|
+
from: Address;
|
|
126
|
+
hash: Hash32;
|
|
127
|
+
transactionIndex: Uint;
|
|
128
|
+
} & TransactionSigned;
|
|
129
|
+
export interface GenericTransaction {
|
|
130
|
+
type?: "0x0" | "0x1" | "0x2" | "0x3";
|
|
131
|
+
to?: Address | null;
|
|
132
|
+
from?: Address;
|
|
133
|
+
value?: Uint;
|
|
134
|
+
nonce?: Uint;
|
|
135
|
+
gas?: Uint;
|
|
136
|
+
input?: Bytes;
|
|
137
|
+
gasPrice?: Uint;
|
|
138
|
+
maxPriorityFeePerGas?: Uint;
|
|
139
|
+
maxFeePerGas?: Uint;
|
|
140
|
+
maxFeePerBlobGas?: Uint;
|
|
141
|
+
accessList?: AccessListEntry[];
|
|
142
|
+
blobVersionedHashes?: Hash32[];
|
|
143
|
+
blobs?: Bytes[];
|
|
144
|
+
chainId?: Uint;
|
|
145
|
+
authorizationList?: AuthorizationList;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export { };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// Environment setup & latest features
|
|
4
|
+
"lib": [
|
|
5
|
+
"ESNext"
|
|
6
|
+
],
|
|
7
|
+
"target": "ESNext",
|
|
8
|
+
"module": "Preserve",
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
"allowJs": true,
|
|
12
|
+
// Bundler mode
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"declarationMap": true,
|
|
16
|
+
"moduleResolution": "bundler",
|
|
17
|
+
"outDir": "dist",
|
|
18
|
+
"rootDir": "src",
|
|
19
|
+
"allowImportingTsExtensions": false,
|
|
20
|
+
"verbatimModuleSyntax": true,
|
|
21
|
+
"noEmit": false,
|
|
22
|
+
// Best practices
|
|
23
|
+
"strict": true,
|
|
24
|
+
"skipLibCheck": true,
|
|
25
|
+
"noFallthroughCasesInSwitch": true,
|
|
26
|
+
"noUncheckedIndexedAccess": true,
|
|
27
|
+
"noImplicitOverride": true,
|
|
28
|
+
// Some stricter flags (disabled by default)
|
|
29
|
+
"noUnusedLocals": false,
|
|
30
|
+
"noUnusedParameters": false,
|
|
31
|
+
"noPropertyAccessFromIndexSignature": false
|
|
32
|
+
},
|
|
33
|
+
"include": [
|
|
34
|
+
"src/**/*",
|
|
35
|
+
"global.d.ts"
|
|
36
|
+
],
|
|
37
|
+
"exclude": [
|
|
38
|
+
"example.ts"
|
|
39
|
+
]
|
|
40
|
+
}
|