@apibara/evm 2.1.0-beta.4 → 2.1.0-beta.41
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/dist/index.cjs +1554 -418
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1287 -1416
- package/dist/index.d.mts +1287 -1416
- package/dist/index.d.ts +1287 -1416
- package/dist/index.mjs +1545 -409
- package/dist/index.mjs.map +1 -0
- package/package.json +2 -4
- package/src/block.ts +358 -167
- package/src/common.ts +64 -95
- package/src/filter.ts +128 -134
- package/src/index.ts +1 -0
- package/src/proto/data.ts +1310 -3
- package/src/proto/filter.ts +46 -2
- package/src/common.test.ts +0 -79
- package/src/filter.test.ts +0 -187
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apibara/evm",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -35,9 +35,7 @@
|
|
|
35
35
|
"vitest": "^1.6.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@apibara/protocol": "2.1.0-beta.
|
|
39
|
-
"@effect/schema": "^0.67.15",
|
|
40
|
-
"effect": "^3.2.6",
|
|
38
|
+
"@apibara/protocol": "2.1.0-beta.41",
|
|
41
39
|
"long": "^5.2.1",
|
|
42
40
|
"nice-grpc-common": "^2.0.2",
|
|
43
41
|
"protobufjs": "^7.1.2",
|
package/src/block.ts
CHANGED
|
@@ -1,174 +1,365 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Schema } from "@effect/schema";
|
|
1
|
+
import { BytesFromUint8Array } from "@apibara/protocol";
|
|
3
2
|
|
|
3
|
+
import {
|
|
4
|
+
ArrayCodec,
|
|
5
|
+
BigIntCodec,
|
|
6
|
+
BooleanCodec,
|
|
7
|
+
type Codec,
|
|
8
|
+
type CodecType,
|
|
9
|
+
DateCodec,
|
|
10
|
+
MessageCodec,
|
|
11
|
+
NumberCodec,
|
|
12
|
+
OneOfCodec,
|
|
13
|
+
OptionalCodec,
|
|
14
|
+
StringCodec,
|
|
15
|
+
} from "@apibara/protocol/codec";
|
|
16
|
+
import { RequiredCodec } from "@apibara/protocol/codec";
|
|
4
17
|
import { Address, B256, U128, U256 } from "./common";
|
|
5
18
|
import * as proto from "./proto";
|
|
6
19
|
|
|
7
|
-
export const Bloom
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
strict: false,
|
|
14
|
-
encode(value) {
|
|
15
|
-
throw new Error("Not implemented");
|
|
16
|
-
},
|
|
17
|
-
decode({ value }) {
|
|
18
|
-
return value;
|
|
19
|
-
},
|
|
20
|
+
export const Bloom: Codec<
|
|
21
|
+
`0x${string}` | undefined,
|
|
22
|
+
{ value?: Uint8Array | undefined }
|
|
23
|
+
> = {
|
|
24
|
+
encode(x) {
|
|
25
|
+
return { value: BytesFromUint8Array.encode(x) };
|
|
20
26
|
},
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
export const TransactionStatus = Schema.transform(
|
|
24
|
-
Schema.Enums(proto.data.TransactionStatus),
|
|
25
|
-
Schema.Literal("unknown", "succeeded", "reverted"),
|
|
26
|
-
{
|
|
27
|
-
decode(value) {
|
|
28
|
-
const enumMap = {
|
|
29
|
-
[proto.data.TransactionStatus.SUCCEEDED]: "succeeded",
|
|
30
|
-
[proto.data.TransactionStatus.REVERTED]: "reverted",
|
|
31
|
-
[proto.data.TransactionStatus.UNSPECIFIED]: "unknown",
|
|
32
|
-
[proto.data.TransactionStatus.UNRECOGNIZED]: "unknown",
|
|
33
|
-
} as const;
|
|
34
|
-
|
|
35
|
-
return enumMap[value] ?? "unknown";
|
|
36
|
-
},
|
|
37
|
-
encode(value) {
|
|
38
|
-
throw new Error("encode: not implemented");
|
|
39
|
-
},
|
|
27
|
+
decode({ value }) {
|
|
28
|
+
return BytesFromUint8Array.decode(value);
|
|
40
29
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export type
|
|
44
|
-
|
|
45
|
-
export const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type
|
|
71
|
-
|
|
72
|
-
export const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type Bloom = CodecType<typeof Bloom>;
|
|
33
|
+
|
|
34
|
+
export const TransactionStatus: Codec<
|
|
35
|
+
"unknown" | "succeeded" | "reverted",
|
|
36
|
+
proto.data.TransactionStatus
|
|
37
|
+
> = {
|
|
38
|
+
encode(x) {
|
|
39
|
+
const enumMap = {
|
|
40
|
+
unknown: proto.data.TransactionStatus.UNSPECIFIED,
|
|
41
|
+
succeeded: proto.data.TransactionStatus.SUCCEEDED,
|
|
42
|
+
reverted: proto.data.TransactionStatus.REVERTED,
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
45
|
+
return enumMap[x] ?? proto.data.TransactionStatus.UNSPECIFIED;
|
|
46
|
+
},
|
|
47
|
+
decode(p) {
|
|
48
|
+
const enumMap = {
|
|
49
|
+
[proto.data.TransactionStatus.SUCCEEDED]: "succeeded",
|
|
50
|
+
[proto.data.TransactionStatus.REVERTED]: "reverted",
|
|
51
|
+
[proto.data.TransactionStatus.UNSPECIFIED]: "unknown",
|
|
52
|
+
[proto.data.TransactionStatus.UNRECOGNIZED]: "unknown",
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
return enumMap[p] ?? "unknown";
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type TransactionStatus = CodecType<typeof TransactionStatus>;
|
|
60
|
+
|
|
61
|
+
export const BlockHeader = MessageCodec({
|
|
62
|
+
blockNumber: RequiredCodec(BigIntCodec),
|
|
63
|
+
blockHash: OptionalCodec(B256),
|
|
64
|
+
parentBlockHash: RequiredCodec(B256),
|
|
65
|
+
unclesHash: RequiredCodec(B256),
|
|
66
|
+
miner: RequiredCodec(Address),
|
|
67
|
+
stateRoot: RequiredCodec(B256),
|
|
68
|
+
transactionsRoot: RequiredCodec(B256),
|
|
69
|
+
receiptsRoot: RequiredCodec(B256),
|
|
70
|
+
logsBloom: RequiredCodec(Bloom),
|
|
71
|
+
difficulty: RequiredCodec(U256),
|
|
72
|
+
gasLimit: RequiredCodec(U128),
|
|
73
|
+
gasUsed: RequiredCodec(U128),
|
|
74
|
+
timestamp: RequiredCodec(DateCodec),
|
|
75
|
+
extraData: RequiredCodec(BytesFromUint8Array),
|
|
76
|
+
mixHash: OptionalCodec(B256),
|
|
77
|
+
nonce: OptionalCodec(BigIntCodec),
|
|
78
|
+
baseFeePerGas: OptionalCodec(U128),
|
|
79
|
+
withdrawalsRoot: OptionalCodec(B256),
|
|
80
|
+
totalDifficulty: OptionalCodec(U256),
|
|
81
|
+
blobGasUsed: OptionalCodec(U128),
|
|
82
|
+
excessBlobGas: OptionalCodec(U128),
|
|
83
|
+
parentBeaconBlockRoot: OptionalCodec(B256),
|
|
84
|
+
requestsHash: OptionalCodec(B256),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export type BlockHeader = CodecType<typeof BlockHeader>;
|
|
88
|
+
|
|
89
|
+
export const Withdrawal = MessageCodec({
|
|
90
|
+
filterIds: ArrayCodec(NumberCodec),
|
|
91
|
+
withdrawalIndex: RequiredCodec(NumberCodec),
|
|
92
|
+
index: RequiredCodec(BigIntCodec),
|
|
93
|
+
validatorIndex: RequiredCodec(NumberCodec),
|
|
94
|
+
address: RequiredCodec(Address),
|
|
95
|
+
amount: RequiredCodec(BigIntCodec),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export type Withdrawal = CodecType<typeof Withdrawal>;
|
|
99
|
+
|
|
100
|
+
export const AccessListItem = MessageCodec({
|
|
101
|
+
address: RequiredCodec(Address),
|
|
102
|
+
storageKeys: ArrayCodec(B256),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export type AccessListItem = CodecType<typeof AccessListItem>;
|
|
106
|
+
|
|
107
|
+
export const Signature = MessageCodec({
|
|
108
|
+
r: RequiredCodec(U256),
|
|
109
|
+
s: RequiredCodec(U256),
|
|
110
|
+
v: OptionalCodec(U256),
|
|
111
|
+
YParity: OptionalCodec(BooleanCodec),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export type Signature = CodecType<typeof Signature>;
|
|
115
|
+
|
|
116
|
+
export const Transaction = MessageCodec({
|
|
117
|
+
filterIds: ArrayCodec(NumberCodec),
|
|
118
|
+
transactionIndex: RequiredCodec(NumberCodec),
|
|
119
|
+
transactionHash: RequiredCodec(B256),
|
|
120
|
+
nonce: RequiredCodec(BigIntCodec),
|
|
121
|
+
from: RequiredCodec(Address),
|
|
122
|
+
to: OptionalCodec(Address),
|
|
123
|
+
value: RequiredCodec(U256),
|
|
124
|
+
gasPrice: OptionalCodec(U128),
|
|
125
|
+
gas: RequiredCodec(U128),
|
|
126
|
+
maxFeePerGas: OptionalCodec(U128),
|
|
127
|
+
maxPriorityFeePerGas: OptionalCodec(U128),
|
|
128
|
+
input: RequiredCodec(BytesFromUint8Array),
|
|
129
|
+
signature: OptionalCodec(Signature),
|
|
130
|
+
chainId: OptionalCodec(BigIntCodec),
|
|
131
|
+
accessList: ArrayCodec(AccessListItem),
|
|
132
|
+
transactionType: RequiredCodec(BigIntCodec),
|
|
133
|
+
maxFeePerBlobGas: OptionalCodec(U128),
|
|
134
|
+
blobVersionedHashes: ArrayCodec(B256),
|
|
135
|
+
transactionStatus: RequiredCodec(TransactionStatus),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export type Transaction = CodecType<typeof Transaction>;
|
|
139
|
+
|
|
140
|
+
export const TransactionReceipt = MessageCodec({
|
|
141
|
+
filterIds: ArrayCodec(NumberCodec),
|
|
142
|
+
transactionIndex: RequiredCodec(NumberCodec),
|
|
143
|
+
transactionHash: RequiredCodec(B256),
|
|
144
|
+
cumulativeGasUsed: RequiredCodec(U128),
|
|
145
|
+
gasUsed: RequiredCodec(U128),
|
|
146
|
+
effectiveGasPrice: RequiredCodec(U128),
|
|
147
|
+
from: RequiredCodec(Address),
|
|
148
|
+
to: OptionalCodec(Address),
|
|
149
|
+
contractAddress: OptionalCodec(Address),
|
|
150
|
+
logsBloom: RequiredCodec(Bloom),
|
|
151
|
+
transactionType: RequiredCodec(BigIntCodec),
|
|
152
|
+
blobGasUsed: OptionalCodec(U128),
|
|
153
|
+
blobGasPrice: OptionalCodec(U128),
|
|
154
|
+
transactionStatus: RequiredCodec(TransactionStatus),
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
export type TransactionReceipt = CodecType<typeof TransactionReceipt>;
|
|
158
|
+
|
|
159
|
+
export const Log = MessageCodec({
|
|
160
|
+
filterIds: ArrayCodec(NumberCodec),
|
|
161
|
+
address: RequiredCodec(Address),
|
|
162
|
+
topics: ArrayCodec(B256),
|
|
163
|
+
data: RequiredCodec(BytesFromUint8Array),
|
|
164
|
+
logIndex: RequiredCodec(NumberCodec),
|
|
165
|
+
logIndexInTransaction: RequiredCodec(NumberCodec),
|
|
166
|
+
transactionIndex: RequiredCodec(NumberCodec),
|
|
167
|
+
transactionHash: RequiredCodec(B256),
|
|
168
|
+
transactionStatus: RequiredCodec(TransactionStatus),
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
export type Log = CodecType<typeof Log>;
|
|
172
|
+
|
|
173
|
+
export const CallType: Codec<
|
|
174
|
+
"unknown" | "call" | "delegateCall" | "callCode" | "staticCall" | "authCall",
|
|
175
|
+
proto.data.CallType
|
|
176
|
+
> = {
|
|
177
|
+
encode(x) {
|
|
178
|
+
const enumMap = {
|
|
179
|
+
unknown: proto.data.CallType.UNSPECIFIED,
|
|
180
|
+
call: proto.data.CallType.CALL,
|
|
181
|
+
callCode: proto.data.CallType.CALL_CODE,
|
|
182
|
+
delegateCall: proto.data.CallType.DELEGATE_CALL,
|
|
183
|
+
staticCall: proto.data.CallType.STATIC_CALL,
|
|
184
|
+
authCall: proto.data.CallType.AUTH_CALL,
|
|
185
|
+
} as const;
|
|
186
|
+
|
|
187
|
+
return enumMap[x] ?? proto.data.CallType.UNSPECIFIED;
|
|
188
|
+
},
|
|
189
|
+
decode(p) {
|
|
190
|
+
const enumMap = {
|
|
191
|
+
[proto.data.CallType.CALL]: "call",
|
|
192
|
+
[proto.data.CallType.CALL_CODE]: "callCode",
|
|
193
|
+
[proto.data.CallType.DELEGATE_CALL]: "delegateCall",
|
|
194
|
+
[proto.data.CallType.STATIC_CALL]: "staticCall",
|
|
195
|
+
[proto.data.CallType.AUTH_CALL]: "authCall",
|
|
196
|
+
[proto.data.CallType.UNSPECIFIED]: "unknown",
|
|
197
|
+
[proto.data.CallType.UNRECOGNIZED]: "unknown",
|
|
198
|
+
} as const;
|
|
199
|
+
|
|
200
|
+
return enumMap[p] ?? "unknown";
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type CallType = CodecType<typeof CallType>;
|
|
205
|
+
|
|
206
|
+
export const CreationMethod: Codec<
|
|
207
|
+
"unknown" | "create" | "create2" | "eofCreate",
|
|
208
|
+
proto.data.CreationMethod
|
|
209
|
+
> = {
|
|
210
|
+
encode(x) {
|
|
211
|
+
const enumMap = {
|
|
212
|
+
unknown: proto.data.CreationMethod.UNSPECIFIED,
|
|
213
|
+
create: proto.data.CreationMethod.CREATE,
|
|
214
|
+
create2: proto.data.CreationMethod.CREATE2,
|
|
215
|
+
eofCreate: proto.data.CreationMethod.EOF_CREATE,
|
|
216
|
+
} as const;
|
|
217
|
+
|
|
218
|
+
return enumMap[x] ?? proto.data.CreationMethod.UNSPECIFIED;
|
|
219
|
+
},
|
|
220
|
+
decode(p) {
|
|
221
|
+
const enumMap = {
|
|
222
|
+
[proto.data.CreationMethod.CREATE]: "create",
|
|
223
|
+
[proto.data.CreationMethod.CREATE2]: "create2",
|
|
224
|
+
[proto.data.CreationMethod.EOF_CREATE]: "eofCreate",
|
|
225
|
+
[proto.data.CreationMethod.UNSPECIFIED]: "unknown",
|
|
226
|
+
[proto.data.CreationMethod.UNRECOGNIZED]: "unknown",
|
|
227
|
+
} as const;
|
|
228
|
+
|
|
229
|
+
return enumMap[p] ?? "unknown";
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export type CreationMethod = CodecType<typeof CreationMethod>;
|
|
234
|
+
|
|
235
|
+
export const CallAction = MessageCodec({
|
|
236
|
+
fromAddress: RequiredCodec(Address),
|
|
237
|
+
type: RequiredCodec(CallType),
|
|
238
|
+
gas: RequiredCodec(BigIntCodec),
|
|
239
|
+
input: RequiredCodec(BytesFromUint8Array),
|
|
240
|
+
toAddress: RequiredCodec(Address),
|
|
241
|
+
value: RequiredCodec(U256),
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
export type CallAction = CodecType<typeof CallAction>;
|
|
245
|
+
|
|
246
|
+
export const CreateAction = MessageCodec({
|
|
247
|
+
fromAddress: RequiredCodec(Address),
|
|
248
|
+
gas: RequiredCodec(BigIntCodec),
|
|
249
|
+
init: RequiredCodec(BytesFromUint8Array),
|
|
250
|
+
value: RequiredCodec(U256),
|
|
251
|
+
creationMethod: RequiredCodec(CreationMethod),
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
export type CreateAction = CodecType<typeof CreateAction>;
|
|
255
|
+
|
|
256
|
+
export const SelfDestructAction = MessageCodec({
|
|
257
|
+
address: RequiredCodec(Address),
|
|
258
|
+
balance: RequiredCodec(U256),
|
|
259
|
+
refundAddress: RequiredCodec(Address),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export type SelfDestructAction = CodecType<typeof SelfDestructAction>;
|
|
263
|
+
|
|
264
|
+
export const RewardType: Codec<
|
|
265
|
+
"unknown" | "block" | "uncle",
|
|
266
|
+
proto.data.RewardType
|
|
267
|
+
> = {
|
|
268
|
+
encode(x) {
|
|
269
|
+
const enumMap = {
|
|
270
|
+
unknown: proto.data.RewardType.UNSPECIFIED,
|
|
271
|
+
block: proto.data.RewardType.BLOCK,
|
|
272
|
+
uncle: proto.data.RewardType.UNCLE,
|
|
273
|
+
} as const;
|
|
274
|
+
|
|
275
|
+
return enumMap[x] ?? proto.data.RewardType.UNSPECIFIED;
|
|
276
|
+
},
|
|
277
|
+
decode(p) {
|
|
278
|
+
const enumMap = {
|
|
279
|
+
[proto.data.RewardType.BLOCK]: "block",
|
|
280
|
+
[proto.data.RewardType.UNCLE]: "uncle",
|
|
281
|
+
[proto.data.RewardType.UNSPECIFIED]: "unknown",
|
|
282
|
+
[proto.data.RewardType.UNRECOGNIZED]: "unknown",
|
|
283
|
+
} as const;
|
|
284
|
+
|
|
285
|
+
return enumMap[p] ?? "unknown";
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export type RewardType = CodecType<typeof RewardType>;
|
|
290
|
+
|
|
291
|
+
export const RewardAction = MessageCodec({
|
|
292
|
+
author: RequiredCodec(Address),
|
|
293
|
+
type: RequiredCodec(RewardType),
|
|
294
|
+
value: RequiredCodec(U256),
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
export type RewardAction = CodecType<typeof RewardAction>;
|
|
298
|
+
|
|
299
|
+
export const CallOutput = MessageCodec({
|
|
300
|
+
gasUsed: RequiredCodec(BigIntCodec),
|
|
301
|
+
output: RequiredCodec(BytesFromUint8Array),
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
export type CallOutput = CodecType<typeof CallOutput>;
|
|
305
|
+
|
|
306
|
+
export const CreateOutput = MessageCodec({
|
|
307
|
+
address: RequiredCodec(Address),
|
|
308
|
+
code: RequiredCodec(BytesFromUint8Array),
|
|
309
|
+
gasUsed: RequiredCodec(BigIntCodec),
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
export type CreateOutput = CodecType<typeof CreateOutput>;
|
|
313
|
+
|
|
314
|
+
export const Trace = MessageCodec({
|
|
315
|
+
action: RequiredCodec(
|
|
316
|
+
OneOfCodec({
|
|
317
|
+
call: CallAction,
|
|
318
|
+
create: CreateAction,
|
|
319
|
+
selfDestruct: SelfDestructAction,
|
|
320
|
+
reward: RewardAction,
|
|
321
|
+
}),
|
|
322
|
+
),
|
|
323
|
+
error: OptionalCodec(StringCodec),
|
|
324
|
+
output: OptionalCodec(
|
|
325
|
+
OneOfCodec({
|
|
326
|
+
callOutput: CallOutput,
|
|
327
|
+
createOutput: CreateOutput,
|
|
328
|
+
}),
|
|
329
|
+
),
|
|
330
|
+
subtraces: RequiredCodec(NumberCodec),
|
|
331
|
+
traceAddress: ArrayCodec(NumberCodec),
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
export type Trace = CodecType<typeof Trace>;
|
|
335
|
+
|
|
336
|
+
export const TransactionTrace = MessageCodec({
|
|
337
|
+
filterIds: ArrayCodec(NumberCodec),
|
|
338
|
+
transactionIndex: RequiredCodec(NumberCodec),
|
|
339
|
+
transactionHash: RequiredCodec(B256),
|
|
340
|
+
traces: ArrayCodec(Trace),
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
export type TransactionTrace = CodecType<typeof TransactionTrace>;
|
|
344
|
+
|
|
345
|
+
export const Block = MessageCodec({
|
|
346
|
+
header: RequiredCodec(BlockHeader),
|
|
347
|
+
withdrawals: ArrayCodec(Withdrawal),
|
|
348
|
+
transactions: ArrayCodec(Transaction),
|
|
349
|
+
receipts: ArrayCodec(TransactionReceipt),
|
|
350
|
+
logs: ArrayCodec(Log),
|
|
351
|
+
traces: ArrayCodec(TransactionTrace),
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
export type Block = CodecType<typeof Block>;
|
|
355
|
+
|
|
356
|
+
export const BlockFromBytes: Codec<Block, Uint8Array> = {
|
|
357
|
+
encode(x) {
|
|
358
|
+
const block = Block.encode(x);
|
|
359
|
+
return proto.data.Block.encode(block).finish();
|
|
360
|
+
},
|
|
361
|
+
decode(p) {
|
|
362
|
+
const block = proto.data.Block.decode(p);
|
|
363
|
+
return Block.decode(block);
|
|
173
364
|
},
|
|
174
|
-
|
|
365
|
+
};
|