@apibara/starknet 2.0.0-beta.9 → 2.1.0-beta.2
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 +353 -169
- package/dist/index.d.cts +1297 -1263
- package/dist/index.d.mts +1297 -1263
- package/dist/index.d.ts +1297 -1263
- package/dist/index.mjs +349 -170
- package/dist/parser.cjs +133 -0
- package/dist/parser.d.cts +72 -0
- package/dist/parser.d.mts +72 -0
- package/dist/parser.d.ts +72 -0
- package/dist/parser.mjs +109 -0
- package/dist/shared/starknet.2b19268a.d.cts +32 -0
- package/dist/shared/starknet.2b19268a.d.mts +32 -0
- package/dist/shared/starknet.2b19268a.d.ts +32 -0
- package/package.json +10 -2
- package/src/abi.ts +79 -0
- package/src/access.ts +6 -2
- package/src/block.ts +151 -155
- package/src/common.ts +2 -0
- package/src/event.ts +204 -0
- package/src/index.ts +11 -0
- package/src/parser.test.ts +169 -0
- package/src/parser.ts +170 -0
- package/src/proto/data.ts +56 -12
package/src/block.ts
CHANGED
|
@@ -76,13 +76,13 @@ export const U128 = Schema.transform(
|
|
|
76
76
|
);
|
|
77
77
|
|
|
78
78
|
export const ResourceBounds = Schema.Struct({
|
|
79
|
-
maxAmount: Schema.
|
|
80
|
-
maxPricePerUnit:
|
|
79
|
+
maxAmount: Schema.BigIntFromSelf,
|
|
80
|
+
maxPricePerUnit: U128,
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
export const ResourceBoundsMapping = Schema.Struct({
|
|
84
|
-
l1Gas:
|
|
85
|
-
l2Gas:
|
|
84
|
+
l1Gas: ResourceBounds,
|
|
85
|
+
l2Gas: ResourceBounds,
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
export const DataAvailabilityMode = Schema.transform(
|
|
@@ -120,15 +120,15 @@ export const DataAvailabilityMode = Schema.transform(
|
|
|
120
120
|
*/
|
|
121
121
|
export const BlockHeader = Schema.Struct({
|
|
122
122
|
blockHash: Schema.optional(FieldElement),
|
|
123
|
-
parentBlockHash:
|
|
123
|
+
parentBlockHash: FieldElement,
|
|
124
124
|
blockNumber: Schema.BigIntFromSelf,
|
|
125
|
-
sequencerAddress:
|
|
125
|
+
sequencerAddress: FieldElement,
|
|
126
126
|
newRoot: Schema.optional(FieldElement),
|
|
127
|
-
timestamp: Schema.
|
|
128
|
-
starknetVersion: Schema.
|
|
129
|
-
l1GasPrice:
|
|
130
|
-
l1DataGasPrice:
|
|
131
|
-
l1DataAvailabilityMode:
|
|
127
|
+
timestamp: Schema.DateFromSelf,
|
|
128
|
+
starknetVersion: Schema.String,
|
|
129
|
+
l1GasPrice: ResourcePrice,
|
|
130
|
+
l1DataGasPrice: ResourcePrice,
|
|
131
|
+
l1DataAvailabilityMode: L1DataAvailabilityMode,
|
|
132
132
|
});
|
|
133
133
|
|
|
134
134
|
export type BlockHeader = typeof BlockHeader.Type;
|
|
@@ -142,9 +142,9 @@ export type BlockHeader = typeof BlockHeader.Type;
|
|
|
142
142
|
* @prop transactionStatus The transaction status.
|
|
143
143
|
*/
|
|
144
144
|
export const TransactionMeta = Schema.Struct({
|
|
145
|
-
transactionIndex: Schema.
|
|
146
|
-
transactionHash:
|
|
147
|
-
transactionStatus:
|
|
145
|
+
transactionIndex: Schema.Number,
|
|
146
|
+
transactionHash: FieldElement,
|
|
147
|
+
transactionStatus: TransactionStatus,
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
export type TransactionMeta = typeof TransactionMeta.Type;
|
|
@@ -152,135 +152,135 @@ export type TransactionMeta = typeof TransactionMeta.Type;
|
|
|
152
152
|
export const InvokeTransactionV0 = Schema.Struct({
|
|
153
153
|
_tag: tag("invokeV0"),
|
|
154
154
|
invokeV0: Schema.Struct({
|
|
155
|
-
maxFee:
|
|
156
|
-
signature: Schema.
|
|
157
|
-
contractAddress:
|
|
158
|
-
entryPointSelector:
|
|
159
|
-
calldata: Schema.
|
|
155
|
+
maxFee: FieldElement,
|
|
156
|
+
signature: Schema.Array(FieldElement),
|
|
157
|
+
contractAddress: FieldElement,
|
|
158
|
+
entryPointSelector: FieldElement,
|
|
159
|
+
calldata: Schema.Array(FieldElement),
|
|
160
160
|
}),
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
export const InvokeTransactionV1 = Schema.Struct({
|
|
164
164
|
_tag: tag("invokeV1"),
|
|
165
165
|
invokeV1: Schema.Struct({
|
|
166
|
-
senderAddress:
|
|
167
|
-
calldata: Schema.
|
|
168
|
-
maxFee:
|
|
169
|
-
signature: Schema.
|
|
170
|
-
nonce:
|
|
166
|
+
senderAddress: FieldElement,
|
|
167
|
+
calldata: Schema.Array(FieldElement),
|
|
168
|
+
maxFee: FieldElement,
|
|
169
|
+
signature: Schema.Array(FieldElement),
|
|
170
|
+
nonce: FieldElement,
|
|
171
171
|
}),
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
export const InvokeTransactionV3 = Schema.Struct({
|
|
175
175
|
_tag: tag("invokeV3"),
|
|
176
176
|
invokeV3: Schema.Struct({
|
|
177
|
-
senderAddress:
|
|
178
|
-
calldata: Schema.
|
|
179
|
-
signature: Schema.
|
|
180
|
-
nonce:
|
|
181
|
-
resourceBounds:
|
|
182
|
-
tip: Schema.
|
|
183
|
-
paymasterData: Schema.
|
|
184
|
-
accountDeploymentData: Schema.
|
|
185
|
-
nonceDataAvailabilityMode:
|
|
186
|
-
feeDataAvailabilityMode:
|
|
177
|
+
senderAddress: FieldElement,
|
|
178
|
+
calldata: Schema.Array(FieldElement),
|
|
179
|
+
signature: Schema.Array(FieldElement),
|
|
180
|
+
nonce: FieldElement,
|
|
181
|
+
resourceBounds: ResourceBoundsMapping,
|
|
182
|
+
tip: Schema.BigIntFromSelf,
|
|
183
|
+
paymasterData: Schema.Array(FieldElement),
|
|
184
|
+
accountDeploymentData: Schema.Array(FieldElement),
|
|
185
|
+
nonceDataAvailabilityMode: DataAvailabilityMode,
|
|
186
|
+
feeDataAvailabilityMode: DataAvailabilityMode,
|
|
187
187
|
}),
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
export const L1HandlerTransaction = Schema.Struct({
|
|
191
191
|
_tag: tag("l1Handler"),
|
|
192
192
|
l1Handler: Schema.Struct({
|
|
193
|
-
nonce: Schema.
|
|
194
|
-
contractAddress:
|
|
195
|
-
entryPointSelector:
|
|
196
|
-
calldata: Schema.
|
|
193
|
+
nonce: Schema.BigIntFromSelf,
|
|
194
|
+
contractAddress: FieldElement,
|
|
195
|
+
entryPointSelector: FieldElement,
|
|
196
|
+
calldata: Schema.Array(FieldElement),
|
|
197
197
|
}),
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
export const DeployTransaction = Schema.Struct({
|
|
201
201
|
_tag: tag("deploy"),
|
|
202
202
|
deploy: Schema.Struct({
|
|
203
|
-
contractAddressSalt:
|
|
204
|
-
constructorCalldata: Schema.
|
|
205
|
-
classHash:
|
|
203
|
+
contractAddressSalt: FieldElement,
|
|
204
|
+
constructorCalldata: Schema.Array(FieldElement),
|
|
205
|
+
classHash: FieldElement,
|
|
206
206
|
}),
|
|
207
207
|
});
|
|
208
208
|
|
|
209
209
|
export const DeclareTransactionV0 = Schema.Struct({
|
|
210
210
|
_tag: tag("declareV0"),
|
|
211
211
|
declareV0: Schema.Struct({
|
|
212
|
-
senderAddress:
|
|
213
|
-
maxFee:
|
|
214
|
-
signature: Schema.
|
|
215
|
-
classHash:
|
|
212
|
+
senderAddress: FieldElement,
|
|
213
|
+
maxFee: FieldElement,
|
|
214
|
+
signature: Schema.Array(FieldElement),
|
|
215
|
+
classHash: FieldElement,
|
|
216
216
|
}),
|
|
217
217
|
});
|
|
218
218
|
|
|
219
219
|
export const DeclareTransactionV1 = Schema.Struct({
|
|
220
220
|
_tag: tag("declareV1"),
|
|
221
221
|
declareV1: Schema.Struct({
|
|
222
|
-
senderAddress:
|
|
223
|
-
maxFee:
|
|
224
|
-
signature: Schema.
|
|
225
|
-
nonce:
|
|
226
|
-
classHash:
|
|
222
|
+
senderAddress: FieldElement,
|
|
223
|
+
maxFee: FieldElement,
|
|
224
|
+
signature: Schema.Array(FieldElement),
|
|
225
|
+
nonce: FieldElement,
|
|
226
|
+
classHash: FieldElement,
|
|
227
227
|
}),
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
export const DeclareTransactionV2 = Schema.Struct({
|
|
231
231
|
_tag: tag("declareV2"),
|
|
232
232
|
declareV2: Schema.Struct({
|
|
233
|
-
senderAddress:
|
|
234
|
-
compiledClassHash:
|
|
235
|
-
maxFee:
|
|
236
|
-
signature: Schema.
|
|
237
|
-
nonce:
|
|
238
|
-
classHash:
|
|
233
|
+
senderAddress: FieldElement,
|
|
234
|
+
compiledClassHash: FieldElement,
|
|
235
|
+
maxFee: FieldElement,
|
|
236
|
+
signature: Schema.Array(FieldElement),
|
|
237
|
+
nonce: FieldElement,
|
|
238
|
+
classHash: FieldElement,
|
|
239
239
|
}),
|
|
240
240
|
});
|
|
241
241
|
|
|
242
242
|
export const DeclareTransactionV3 = Schema.Struct({
|
|
243
243
|
_tag: tag("declareV3"),
|
|
244
244
|
declareV3: Schema.Struct({
|
|
245
|
-
senderAddress:
|
|
246
|
-
compiledClassHash:
|
|
247
|
-
signature: Schema.
|
|
248
|
-
nonce:
|
|
249
|
-
classHash:
|
|
250
|
-
resourceBounds:
|
|
251
|
-
tip: Schema.
|
|
252
|
-
paymasterData: Schema.
|
|
253
|
-
accountDeploymentData: Schema.
|
|
254
|
-
nonceDataAvailabilityMode:
|
|
255
|
-
feeDataAvailabilityMode:
|
|
245
|
+
senderAddress: FieldElement,
|
|
246
|
+
compiledClassHash: FieldElement,
|
|
247
|
+
signature: Schema.Array(FieldElement),
|
|
248
|
+
nonce: FieldElement,
|
|
249
|
+
classHash: FieldElement,
|
|
250
|
+
resourceBounds: ResourceBoundsMapping,
|
|
251
|
+
tip: Schema.BigIntFromSelf,
|
|
252
|
+
paymasterData: Schema.Array(FieldElement),
|
|
253
|
+
accountDeploymentData: Schema.Array(FieldElement),
|
|
254
|
+
nonceDataAvailabilityMode: DataAvailabilityMode,
|
|
255
|
+
feeDataAvailabilityMode: DataAvailabilityMode,
|
|
256
256
|
}),
|
|
257
257
|
});
|
|
258
258
|
|
|
259
259
|
export const DeployAccountTransactionV1 = Schema.Struct({
|
|
260
260
|
_tag: tag("deployAccountV1"),
|
|
261
261
|
deployAccountV1: Schema.Struct({
|
|
262
|
-
maxFee:
|
|
263
|
-
signature: Schema.
|
|
264
|
-
nonce:
|
|
265
|
-
contractAddressSalt:
|
|
266
|
-
constructorCalldata: Schema.
|
|
267
|
-
classHash:
|
|
262
|
+
maxFee: FieldElement,
|
|
263
|
+
signature: Schema.Array(FieldElement),
|
|
264
|
+
nonce: FieldElement,
|
|
265
|
+
contractAddressSalt: FieldElement,
|
|
266
|
+
constructorCalldata: Schema.Array(FieldElement),
|
|
267
|
+
classHash: FieldElement,
|
|
268
268
|
}),
|
|
269
269
|
});
|
|
270
270
|
|
|
271
271
|
export const DeployAccountTransactionV3 = Schema.Struct({
|
|
272
272
|
_tag: tag("deployAccountV3"),
|
|
273
273
|
deployAccountV3: Schema.Struct({
|
|
274
|
-
signature: Schema.
|
|
275
|
-
nonce:
|
|
276
|
-
contractAddressSalt:
|
|
277
|
-
constructorCalldata: Schema.
|
|
278
|
-
classHash:
|
|
279
|
-
resourceBounds:
|
|
280
|
-
tip: Schema.
|
|
281
|
-
paymasterData: Schema.
|
|
282
|
-
nonceDataAvailabilityMode:
|
|
283
|
-
feeDataAvailabilityMode:
|
|
274
|
+
signature: Schema.Array(FieldElement),
|
|
275
|
+
nonce: FieldElement,
|
|
276
|
+
contractAddressSalt: FieldElement,
|
|
277
|
+
constructorCalldata: Schema.Array(FieldElement),
|
|
278
|
+
classHash: FieldElement,
|
|
279
|
+
resourceBounds: ResourceBoundsMapping,
|
|
280
|
+
tip: Schema.BigIntFromSelf,
|
|
281
|
+
paymasterData: Schema.Array(FieldElement),
|
|
282
|
+
nonceDataAvailabilityMode: DataAvailabilityMode,
|
|
283
|
+
feeDataAvailabilityMode: DataAvailabilityMode,
|
|
284
284
|
}),
|
|
285
285
|
});
|
|
286
286
|
|
|
@@ -289,22 +289,20 @@ export const DeployAccountTransactionV3 = Schema.Struct({
|
|
|
289
289
|
* @prop meta Transaction metadata.
|
|
290
290
|
*/
|
|
291
291
|
export const Transaction = Schema.Struct({
|
|
292
|
-
filterIds: Schema.
|
|
293
|
-
meta:
|
|
294
|
-
transaction: Schema.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
DeployAccountTransactionV3,
|
|
307
|
-
),
|
|
292
|
+
filterIds: Schema.Array(Schema.Number),
|
|
293
|
+
meta: TransactionMeta,
|
|
294
|
+
transaction: Schema.Union(
|
|
295
|
+
InvokeTransactionV0,
|
|
296
|
+
InvokeTransactionV1,
|
|
297
|
+
InvokeTransactionV3,
|
|
298
|
+
L1HandlerTransaction,
|
|
299
|
+
DeployTransaction,
|
|
300
|
+
DeclareTransactionV0,
|
|
301
|
+
DeclareTransactionV1,
|
|
302
|
+
DeclareTransactionV2,
|
|
303
|
+
DeclareTransactionV3,
|
|
304
|
+
DeployAccountTransactionV1,
|
|
305
|
+
DeployAccountTransactionV3,
|
|
308
306
|
),
|
|
309
307
|
});
|
|
310
308
|
|
|
@@ -331,12 +329,12 @@ export const PriceUnit = Schema.transform(
|
|
|
331
329
|
);
|
|
332
330
|
|
|
333
331
|
export const FeePayment = Schema.Struct({
|
|
334
|
-
amount:
|
|
335
|
-
unit:
|
|
332
|
+
amount: FieldElement,
|
|
333
|
+
unit: PriceUnit,
|
|
336
334
|
});
|
|
337
335
|
|
|
338
336
|
export const ComputationResources = Schema.Struct({
|
|
339
|
-
steps: Schema.
|
|
337
|
+
steps: Schema.BigIntFromSelf,
|
|
340
338
|
memoryHoles: Schema.optional(Schema.BigIntFromSelf),
|
|
341
339
|
rangeCheckBuiltinApplications: Schema.optional(Schema.BigIntFromSelf),
|
|
342
340
|
pedersenBuiltinApplications: Schema.optional(Schema.BigIntFromSelf),
|
|
@@ -349,13 +347,13 @@ export const ComputationResources = Schema.Struct({
|
|
|
349
347
|
});
|
|
350
348
|
|
|
351
349
|
export const DataAvailabilityResources = Schema.Struct({
|
|
352
|
-
l1Gas: Schema.
|
|
353
|
-
l1DataGas: Schema.
|
|
350
|
+
l1Gas: Schema.BigIntFromSelf,
|
|
351
|
+
l1DataGas: Schema.BigIntFromSelf,
|
|
354
352
|
});
|
|
355
353
|
|
|
356
354
|
export const ExecutionResources = Schema.Struct({
|
|
357
|
-
computation:
|
|
358
|
-
dataAvailability:
|
|
355
|
+
computation: ComputationResources,
|
|
356
|
+
dataAvailability: DataAvailabilityResources,
|
|
359
357
|
});
|
|
360
358
|
|
|
361
359
|
export const ExecutionSucceeded = Schema.Struct({
|
|
@@ -372,13 +370,11 @@ export const ExecutionReverted = Schema.Struct({
|
|
|
372
370
|
|
|
373
371
|
/** Common fields for all transaction receipts. */
|
|
374
372
|
export const TransactionReceiptMeta = Schema.Struct({
|
|
375
|
-
transactionIndex: Schema.
|
|
376
|
-
transactionHash:
|
|
377
|
-
actualFee:
|
|
378
|
-
executionResources:
|
|
379
|
-
executionResult: Schema.
|
|
380
|
-
Schema.Union(ExecutionSucceeded, ExecutionReverted),
|
|
381
|
-
),
|
|
373
|
+
transactionIndex: Schema.Number,
|
|
374
|
+
transactionHash: FieldElement,
|
|
375
|
+
actualFee: FeePayment,
|
|
376
|
+
executionResources: ExecutionResources,
|
|
377
|
+
executionResult: Schema.Union(ExecutionSucceeded, ExecutionReverted),
|
|
382
378
|
});
|
|
383
379
|
|
|
384
380
|
export const InvokeTransactionReceipt = Schema.Struct({
|
|
@@ -389,7 +385,7 @@ export const InvokeTransactionReceipt = Schema.Struct({
|
|
|
389
385
|
export const L1HandlerTransactionReceipt = Schema.Struct({
|
|
390
386
|
_tag: tag("l1Handler"),
|
|
391
387
|
l1Handler: Schema.Struct({
|
|
392
|
-
messageHash: Schema.
|
|
388
|
+
messageHash: Schema.Uint8ArrayFromSelf,
|
|
393
389
|
}),
|
|
394
390
|
});
|
|
395
391
|
|
|
@@ -401,14 +397,14 @@ export const DeclareTransactionReceipt = Schema.Struct({
|
|
|
401
397
|
export const DeployTransactionReceipt = Schema.Struct({
|
|
402
398
|
_tag: tag("deploy"),
|
|
403
399
|
deploy: Schema.Struct({
|
|
404
|
-
contractAddress:
|
|
400
|
+
contractAddress: FieldElement,
|
|
405
401
|
}),
|
|
406
402
|
});
|
|
407
403
|
|
|
408
404
|
export const DeployAccountTransactionReceipt = Schema.Struct({
|
|
409
405
|
_tag: tag("deployAccount"),
|
|
410
406
|
deployAccount: Schema.Struct({
|
|
411
|
-
contractAddress:
|
|
407
|
+
contractAddress: FieldElement,
|
|
412
408
|
}),
|
|
413
409
|
});
|
|
414
410
|
|
|
@@ -418,16 +414,14 @@ export const DeployAccountTransactionReceipt = Schema.Struct({
|
|
|
418
414
|
* @prop receipt Transaction-specific receipt.
|
|
419
415
|
*/
|
|
420
416
|
export const TransactionReceipt = Schema.Struct({
|
|
421
|
-
filterIds: Schema.
|
|
422
|
-
meta:
|
|
423
|
-
receipt: Schema.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
DeployAccountTransactionReceipt,
|
|
430
|
-
),
|
|
417
|
+
filterIds: Schema.Array(Schema.Number),
|
|
418
|
+
meta: TransactionReceiptMeta,
|
|
419
|
+
receipt: Schema.Union(
|
|
420
|
+
InvokeTransactionReceipt,
|
|
421
|
+
L1HandlerTransactionReceipt,
|
|
422
|
+
DeclareTransactionReceipt,
|
|
423
|
+
DeployTransactionReceipt,
|
|
424
|
+
DeployAccountTransactionReceipt,
|
|
431
425
|
),
|
|
432
426
|
});
|
|
433
427
|
|
|
@@ -442,16 +436,18 @@ export type TransactionReceipt = typeof TransactionReceipt.Type;
|
|
|
442
436
|
* @prop transactionIndex The transaction index in the block.
|
|
443
437
|
* @prop transactionHash The transaction hash.
|
|
444
438
|
* @prop transactionStatus The transaction status.
|
|
439
|
+
* @prop eventIndexInTransaction The event index in the transaction.
|
|
445
440
|
*/
|
|
446
441
|
export const Event = Schema.Struct({
|
|
447
|
-
filterIds: Schema.
|
|
448
|
-
address:
|
|
449
|
-
keys: Schema.
|
|
450
|
-
data: Schema.
|
|
451
|
-
eventIndex: Schema.
|
|
452
|
-
transactionIndex: Schema.
|
|
453
|
-
transactionHash:
|
|
454
|
-
transactionStatus:
|
|
442
|
+
filterIds: Schema.Array(Schema.Number),
|
|
443
|
+
address: FieldElement,
|
|
444
|
+
keys: Schema.Array(FieldElement),
|
|
445
|
+
data: Schema.Array(FieldElement),
|
|
446
|
+
eventIndex: Schema.Number,
|
|
447
|
+
transactionIndex: Schema.Number,
|
|
448
|
+
transactionHash: FieldElement,
|
|
449
|
+
transactionStatus: TransactionStatus,
|
|
450
|
+
eventIndexInTransaction: Schema.Number,
|
|
455
451
|
});
|
|
456
452
|
|
|
457
453
|
export type Event = typeof Event.Type;
|
|
@@ -465,16 +461,18 @@ export type Event = typeof Event.Type;
|
|
|
465
461
|
* @prop transactionIndex The transaction index in the block.
|
|
466
462
|
* @prop transactionHash The transaction hash.
|
|
467
463
|
* @prop transactionStatus The transaction status.
|
|
464
|
+
* @prop messageIndexInTransaction The message index in the transaction.
|
|
468
465
|
*/
|
|
469
466
|
export const MessageToL1 = Schema.Struct({
|
|
470
|
-
filterIds: Schema.
|
|
471
|
-
fromAddress:
|
|
472
|
-
toAddress:
|
|
473
|
-
payload: Schema.
|
|
474
|
-
messageIndex: Schema.
|
|
475
|
-
transactionIndex: Schema.
|
|
476
|
-
transactionHash:
|
|
477
|
-
transactionStatus:
|
|
467
|
+
filterIds: Schema.Array(Schema.Number),
|
|
468
|
+
fromAddress: FieldElement,
|
|
469
|
+
toAddress: FieldElement,
|
|
470
|
+
payload: Schema.Array(FieldElement),
|
|
471
|
+
messageIndex: Schema.Number,
|
|
472
|
+
transactionIndex: Schema.Number,
|
|
473
|
+
transactionHash: FieldElement,
|
|
474
|
+
transactionStatus: TransactionStatus,
|
|
475
|
+
messageIndexInTransaction: Schema.Number,
|
|
478
476
|
});
|
|
479
477
|
|
|
480
478
|
export type MessageToL1 = typeof MessageToL1.Type;
|
|
@@ -485,8 +483,8 @@ export type MessageToL1 = typeof MessageToL1.Type;
|
|
|
485
483
|
* @prop value The new value at the storage location.
|
|
486
484
|
*/
|
|
487
485
|
export const StorageEntry = Schema.Struct({
|
|
488
|
-
key:
|
|
489
|
-
value:
|
|
486
|
+
key: FieldElement,
|
|
487
|
+
value: FieldElement,
|
|
490
488
|
});
|
|
491
489
|
|
|
492
490
|
export type StorageEntry = typeof StorageEntry.Type;
|
|
@@ -497,9 +495,9 @@ export type StorageEntry = typeof StorageEntry.Type;
|
|
|
497
495
|
* @prop storageEntries The entries that changed.
|
|
498
496
|
*/
|
|
499
497
|
export const StorageDiff = Schema.Struct({
|
|
500
|
-
filterIds: Schema.
|
|
501
|
-
contractAddress:
|
|
502
|
-
storageEntries: Schema.
|
|
498
|
+
filterIds: Schema.Array(Schema.Number),
|
|
499
|
+
contractAddress: FieldElement,
|
|
500
|
+
storageEntries: Schema.Array(StorageEntry),
|
|
503
501
|
});
|
|
504
502
|
|
|
505
503
|
export type StorageDiff = typeof StorageDiff.Type;
|
|
@@ -555,10 +553,8 @@ export type DeployedContract = typeof DeployedContract.Type;
|
|
|
555
553
|
* @prop change The change.
|
|
556
554
|
*/
|
|
557
555
|
export const ContractChange = Schema.Struct({
|
|
558
|
-
filterIds: Schema.
|
|
559
|
-
change: Schema.
|
|
560
|
-
Schema.Union(DeclaredClass, ReplacedClass, DeployedContract),
|
|
561
|
-
),
|
|
556
|
+
filterIds: Schema.Array(Schema.Number),
|
|
557
|
+
change: Schema.Union(DeclaredClass, ReplacedClass, DeployedContract),
|
|
562
558
|
});
|
|
563
559
|
|
|
564
560
|
export type ContractChange = typeof ContractChange.Type;
|
|
@@ -569,9 +565,9 @@ export type ContractChange = typeof ContractChange.Type;
|
|
|
569
565
|
* @prop nonce The new nonce.
|
|
570
566
|
*/
|
|
571
567
|
export const NonceUpdate = Schema.Struct({
|
|
572
|
-
filterIds: Schema.
|
|
573
|
-
contractAddress:
|
|
574
|
-
nonce:
|
|
568
|
+
filterIds: Schema.Array(Schema.Number),
|
|
569
|
+
contractAddress: FieldElement,
|
|
570
|
+
nonce: FieldElement,
|
|
575
571
|
});
|
|
576
572
|
|
|
577
573
|
export type NonceUpdate = typeof NonceUpdate.Type;
|
|
@@ -587,7 +583,7 @@ export type NonceUpdate = typeof NonceUpdate.Type;
|
|
|
587
583
|
* @prop contractChanges The changes to contracts and classes.
|
|
588
584
|
*/
|
|
589
585
|
export const Block = Schema.Struct({
|
|
590
|
-
header:
|
|
586
|
+
header: BlockHeader,
|
|
591
587
|
transactions: Schema.Array(Transaction),
|
|
592
588
|
receipts: Schema.Array(TransactionReceipt),
|
|
593
589
|
events: Schema.Array(Event),
|
package/src/common.ts
CHANGED
|
@@ -34,5 +34,7 @@ export const FieldElement = Schema.transform(FieldElementProto, _FieldElement, {
|
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
export type FieldElement = Schema.Schema.Type<typeof FieldElement>;
|
|
38
|
+
|
|
37
39
|
export const feltToProto = Schema.encodeSync(FieldElement);
|
|
38
40
|
export const feltFromProto = Schema.decodeSync(FieldElement);
|