@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/dist/index.cjs
CHANGED
|
@@ -4,6 +4,8 @@ const protocol = require('@apibara/protocol');
|
|
|
4
4
|
const schema = require('@effect/schema');
|
|
5
5
|
const Long = require('long');
|
|
6
6
|
const _m0 = require('protobufjs/minimal.js');
|
|
7
|
+
const starknet = require('@scure/starknet');
|
|
8
|
+
const parser = require('./parser.cjs');
|
|
7
9
|
|
|
8
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
9
11
|
|
|
@@ -3272,13 +3274,14 @@ const DeployAccountTransactionReceipt$1 = {
|
|
|
3272
3274
|
function createBaseEvent() {
|
|
3273
3275
|
return {
|
|
3274
3276
|
filterIds: [],
|
|
3275
|
-
|
|
3277
|
+
address: void 0,
|
|
3276
3278
|
keys: [],
|
|
3277
3279
|
data: [],
|
|
3278
3280
|
eventIndex: 0,
|
|
3279
3281
|
transactionIndex: 0,
|
|
3280
3282
|
transactionHash: void 0,
|
|
3281
|
-
transactionStatus: 0
|
|
3283
|
+
transactionStatus: 0,
|
|
3284
|
+
eventIndexInTransaction: 0
|
|
3282
3285
|
};
|
|
3283
3286
|
}
|
|
3284
3287
|
const Event$1 = {
|
|
@@ -3290,8 +3293,8 @@ const Event$1 = {
|
|
|
3290
3293
|
}
|
|
3291
3294
|
writer.ldelim();
|
|
3292
3295
|
}
|
|
3293
|
-
if (message.
|
|
3294
|
-
FieldElement.encode(message.
|
|
3296
|
+
if (message.address !== void 0) {
|
|
3297
|
+
FieldElement.encode(message.address, writer.uint32(18).fork()).ldelim();
|
|
3295
3298
|
}
|
|
3296
3299
|
if (message.keys !== void 0 && message.keys.length !== 0) {
|
|
3297
3300
|
for (const v of message.keys) {
|
|
@@ -3315,6 +3318,9 @@ const Event$1 = {
|
|
|
3315
3318
|
if (message.transactionStatus !== void 0 && message.transactionStatus !== 0) {
|
|
3316
3319
|
writer.uint32(64).int32(message.transactionStatus);
|
|
3317
3320
|
}
|
|
3321
|
+
if (message.eventIndexInTransaction !== void 0 && message.eventIndexInTransaction !== 0) {
|
|
3322
|
+
writer.uint32(72).uint32(message.eventIndexInTransaction);
|
|
3323
|
+
}
|
|
3318
3324
|
return writer;
|
|
3319
3325
|
},
|
|
3320
3326
|
decode(input, length) {
|
|
@@ -3341,7 +3347,7 @@ const Event$1 = {
|
|
|
3341
3347
|
if (tag !== 18) {
|
|
3342
3348
|
break;
|
|
3343
3349
|
}
|
|
3344
|
-
message.
|
|
3350
|
+
message.address = FieldElement.decode(reader, reader.uint32());
|
|
3345
3351
|
continue;
|
|
3346
3352
|
case 3:
|
|
3347
3353
|
if (tag !== 26) {
|
|
@@ -3379,6 +3385,12 @@ const Event$1 = {
|
|
|
3379
3385
|
}
|
|
3380
3386
|
message.transactionStatus = reader.int32();
|
|
3381
3387
|
continue;
|
|
3388
|
+
case 9:
|
|
3389
|
+
if (tag !== 72) {
|
|
3390
|
+
break;
|
|
3391
|
+
}
|
|
3392
|
+
message.eventIndexInTransaction = reader.uint32();
|
|
3393
|
+
continue;
|
|
3382
3394
|
}
|
|
3383
3395
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3384
3396
|
break;
|
|
@@ -3390,13 +3402,14 @@ const Event$1 = {
|
|
|
3390
3402
|
fromJSON(object) {
|
|
3391
3403
|
return {
|
|
3392
3404
|
filterIds: globalThis.Array.isArray(object?.filterIds) ? object.filterIds.map((e) => globalThis.Number(e)) : [],
|
|
3393
|
-
|
|
3405
|
+
address: isSet$1(object.address) ? FieldElement.fromJSON(object.address) : void 0,
|
|
3394
3406
|
keys: globalThis.Array.isArray(object?.keys) ? object.keys.map((e) => FieldElement.fromJSON(e)) : [],
|
|
3395
3407
|
data: globalThis.Array.isArray(object?.data) ? object.data.map((e) => FieldElement.fromJSON(e)) : [],
|
|
3396
3408
|
eventIndex: isSet$1(object.eventIndex) ? globalThis.Number(object.eventIndex) : 0,
|
|
3397
3409
|
transactionIndex: isSet$1(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
|
|
3398
3410
|
transactionHash: isSet$1(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : void 0,
|
|
3399
|
-
transactionStatus: isSet$1(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0
|
|
3411
|
+
transactionStatus: isSet$1(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
|
|
3412
|
+
eventIndexInTransaction: isSet$1(object.eventIndexInTransaction) ? globalThis.Number(object.eventIndexInTransaction) : 0
|
|
3400
3413
|
};
|
|
3401
3414
|
},
|
|
3402
3415
|
toJSON(message) {
|
|
@@ -3404,8 +3417,8 @@ const Event$1 = {
|
|
|
3404
3417
|
if (message.filterIds?.length) {
|
|
3405
3418
|
obj.filterIds = message.filterIds.map((e) => Math.round(e));
|
|
3406
3419
|
}
|
|
3407
|
-
if (message.
|
|
3408
|
-
obj.
|
|
3420
|
+
if (message.address !== void 0) {
|
|
3421
|
+
obj.address = FieldElement.toJSON(message.address);
|
|
3409
3422
|
}
|
|
3410
3423
|
if (message.keys?.length) {
|
|
3411
3424
|
obj.keys = message.keys.map((e) => FieldElement.toJSON(e));
|
|
@@ -3425,6 +3438,9 @@ const Event$1 = {
|
|
|
3425
3438
|
if (message.transactionStatus !== void 0 && message.transactionStatus !== 0) {
|
|
3426
3439
|
obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
|
|
3427
3440
|
}
|
|
3441
|
+
if (message.eventIndexInTransaction !== void 0 && message.eventIndexInTransaction !== 0) {
|
|
3442
|
+
obj.eventIndexInTransaction = Math.round(message.eventIndexInTransaction);
|
|
3443
|
+
}
|
|
3428
3444
|
return obj;
|
|
3429
3445
|
},
|
|
3430
3446
|
create(base) {
|
|
@@ -3433,13 +3449,14 @@ const Event$1 = {
|
|
|
3433
3449
|
fromPartial(object) {
|
|
3434
3450
|
const message = createBaseEvent();
|
|
3435
3451
|
message.filterIds = object.filterIds?.map((e) => e) || [];
|
|
3436
|
-
message.
|
|
3452
|
+
message.address = object.address !== void 0 && object.address !== null ? FieldElement.fromPartial(object.address) : void 0;
|
|
3437
3453
|
message.keys = object.keys?.map((e) => FieldElement.fromPartial(e)) || [];
|
|
3438
3454
|
message.data = object.data?.map((e) => FieldElement.fromPartial(e)) || [];
|
|
3439
3455
|
message.eventIndex = object.eventIndex ?? 0;
|
|
3440
3456
|
message.transactionIndex = object.transactionIndex ?? 0;
|
|
3441
3457
|
message.transactionHash = object.transactionHash !== void 0 && object.transactionHash !== null ? FieldElement.fromPartial(object.transactionHash) : void 0;
|
|
3442
3458
|
message.transactionStatus = object.transactionStatus ?? 0;
|
|
3459
|
+
message.eventIndexInTransaction = object.eventIndexInTransaction ?? 0;
|
|
3443
3460
|
return message;
|
|
3444
3461
|
}
|
|
3445
3462
|
};
|
|
@@ -3452,7 +3469,8 @@ function createBaseMessageToL1() {
|
|
|
3452
3469
|
messageIndex: 0,
|
|
3453
3470
|
transactionIndex: 0,
|
|
3454
3471
|
transactionHash: void 0,
|
|
3455
|
-
transactionStatus: 0
|
|
3472
|
+
transactionStatus: 0,
|
|
3473
|
+
messageIndexInTransaction: 0
|
|
3456
3474
|
};
|
|
3457
3475
|
}
|
|
3458
3476
|
const MessageToL1$1 = {
|
|
@@ -3487,6 +3505,9 @@ const MessageToL1$1 = {
|
|
|
3487
3505
|
if (message.transactionStatus !== void 0 && message.transactionStatus !== 0) {
|
|
3488
3506
|
writer.uint32(64).int32(message.transactionStatus);
|
|
3489
3507
|
}
|
|
3508
|
+
if (message.messageIndexInTransaction !== void 0 && message.messageIndexInTransaction !== 0) {
|
|
3509
|
+
writer.uint32(72).uint32(message.messageIndexInTransaction);
|
|
3510
|
+
}
|
|
3490
3511
|
return writer;
|
|
3491
3512
|
},
|
|
3492
3513
|
decode(input, length) {
|
|
@@ -3551,6 +3572,12 @@ const MessageToL1$1 = {
|
|
|
3551
3572
|
}
|
|
3552
3573
|
message.transactionStatus = reader.int32();
|
|
3553
3574
|
continue;
|
|
3575
|
+
case 9:
|
|
3576
|
+
if (tag !== 72) {
|
|
3577
|
+
break;
|
|
3578
|
+
}
|
|
3579
|
+
message.messageIndexInTransaction = reader.uint32();
|
|
3580
|
+
continue;
|
|
3554
3581
|
}
|
|
3555
3582
|
if ((tag & 7) === 4 || tag === 0) {
|
|
3556
3583
|
break;
|
|
@@ -3568,7 +3595,8 @@ const MessageToL1$1 = {
|
|
|
3568
3595
|
messageIndex: isSet$1(object.messageIndex) ? globalThis.Number(object.messageIndex) : 0,
|
|
3569
3596
|
transactionIndex: isSet$1(object.transactionIndex) ? globalThis.Number(object.transactionIndex) : 0,
|
|
3570
3597
|
transactionHash: isSet$1(object.transactionHash) ? FieldElement.fromJSON(object.transactionHash) : void 0,
|
|
3571
|
-
transactionStatus: isSet$1(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0
|
|
3598
|
+
transactionStatus: isSet$1(object.transactionStatus) ? transactionStatusFromJSON(object.transactionStatus) : 0,
|
|
3599
|
+
messageIndexInTransaction: isSet$1(object.messageIndexInTransaction) ? globalThis.Number(object.messageIndexInTransaction) : 0
|
|
3572
3600
|
};
|
|
3573
3601
|
},
|
|
3574
3602
|
toJSON(message) {
|
|
@@ -3597,6 +3625,9 @@ const MessageToL1$1 = {
|
|
|
3597
3625
|
if (message.transactionStatus !== void 0 && message.transactionStatus !== 0) {
|
|
3598
3626
|
obj.transactionStatus = transactionStatusToJSON(message.transactionStatus);
|
|
3599
3627
|
}
|
|
3628
|
+
if (message.messageIndexInTransaction !== void 0 && message.messageIndexInTransaction !== 0) {
|
|
3629
|
+
obj.messageIndexInTransaction = Math.round(message.messageIndexInTransaction);
|
|
3630
|
+
}
|
|
3600
3631
|
return obj;
|
|
3601
3632
|
},
|
|
3602
3633
|
create(base) {
|
|
@@ -3612,6 +3643,7 @@ const MessageToL1$1 = {
|
|
|
3612
3643
|
message.transactionIndex = object.transactionIndex ?? 0;
|
|
3613
3644
|
message.transactionHash = object.transactionHash !== void 0 && object.transactionHash !== null ? FieldElement.fromPartial(object.transactionHash) : void 0;
|
|
3614
3645
|
message.transactionStatus = object.transactionStatus ?? 0;
|
|
3646
|
+
message.messageIndexInTransaction = object.messageIndexInTransaction ?? 0;
|
|
3615
3647
|
return message;
|
|
3616
3648
|
}
|
|
3617
3649
|
};
|
|
@@ -6779,12 +6811,12 @@ const U128 = schema.Schema.transform(
|
|
|
6779
6811
|
}
|
|
6780
6812
|
);
|
|
6781
6813
|
const ResourceBounds = schema.Schema.Struct({
|
|
6782
|
-
maxAmount: schema.Schema.
|
|
6783
|
-
maxPricePerUnit:
|
|
6814
|
+
maxAmount: schema.Schema.BigIntFromSelf,
|
|
6815
|
+
maxPricePerUnit: U128
|
|
6784
6816
|
});
|
|
6785
6817
|
const ResourceBoundsMapping = schema.Schema.Struct({
|
|
6786
|
-
l1Gas:
|
|
6787
|
-
l2Gas:
|
|
6818
|
+
l1Gas: ResourceBounds,
|
|
6819
|
+
l2Gas: ResourceBounds
|
|
6788
6820
|
});
|
|
6789
6821
|
const DataAvailabilityMode = schema.Schema.transform(
|
|
6790
6822
|
schema.Schema.Enums(DataAvailabilityMode$1),
|
|
@@ -6806,162 +6838,160 @@ const DataAvailabilityMode = schema.Schema.transform(
|
|
|
6806
6838
|
);
|
|
6807
6839
|
const BlockHeader = schema.Schema.Struct({
|
|
6808
6840
|
blockHash: schema.Schema.optional(FieldElement$1),
|
|
6809
|
-
parentBlockHash:
|
|
6841
|
+
parentBlockHash: FieldElement$1,
|
|
6810
6842
|
blockNumber: schema.Schema.BigIntFromSelf,
|
|
6811
|
-
sequencerAddress:
|
|
6843
|
+
sequencerAddress: FieldElement$1,
|
|
6812
6844
|
newRoot: schema.Schema.optional(FieldElement$1),
|
|
6813
|
-
timestamp: schema.Schema.
|
|
6814
|
-
starknetVersion: schema.Schema.
|
|
6815
|
-
l1GasPrice:
|
|
6816
|
-
l1DataGasPrice:
|
|
6817
|
-
l1DataAvailabilityMode:
|
|
6845
|
+
timestamp: schema.Schema.DateFromSelf,
|
|
6846
|
+
starknetVersion: schema.Schema.String,
|
|
6847
|
+
l1GasPrice: ResourcePrice,
|
|
6848
|
+
l1DataGasPrice: ResourcePrice,
|
|
6849
|
+
l1DataAvailabilityMode: L1DataAvailabilityMode
|
|
6818
6850
|
});
|
|
6819
6851
|
const TransactionMeta = schema.Schema.Struct({
|
|
6820
|
-
transactionIndex: schema.Schema.
|
|
6821
|
-
transactionHash:
|
|
6822
|
-
transactionStatus:
|
|
6852
|
+
transactionIndex: schema.Schema.Number,
|
|
6853
|
+
transactionHash: FieldElement$1,
|
|
6854
|
+
transactionStatus: TransactionStatus
|
|
6823
6855
|
});
|
|
6824
6856
|
const InvokeTransactionV0 = schema.Schema.Struct({
|
|
6825
6857
|
_tag: tag("invokeV0"),
|
|
6826
6858
|
invokeV0: schema.Schema.Struct({
|
|
6827
|
-
maxFee:
|
|
6828
|
-
signature: schema.Schema.
|
|
6829
|
-
contractAddress:
|
|
6830
|
-
entryPointSelector:
|
|
6831
|
-
calldata: schema.Schema.
|
|
6859
|
+
maxFee: FieldElement$1,
|
|
6860
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6861
|
+
contractAddress: FieldElement$1,
|
|
6862
|
+
entryPointSelector: FieldElement$1,
|
|
6863
|
+
calldata: schema.Schema.Array(FieldElement$1)
|
|
6832
6864
|
})
|
|
6833
6865
|
});
|
|
6834
6866
|
const InvokeTransactionV1 = schema.Schema.Struct({
|
|
6835
6867
|
_tag: tag("invokeV1"),
|
|
6836
6868
|
invokeV1: schema.Schema.Struct({
|
|
6837
|
-
senderAddress:
|
|
6838
|
-
calldata: schema.Schema.
|
|
6839
|
-
maxFee:
|
|
6840
|
-
signature: schema.Schema.
|
|
6841
|
-
nonce:
|
|
6869
|
+
senderAddress: FieldElement$1,
|
|
6870
|
+
calldata: schema.Schema.Array(FieldElement$1),
|
|
6871
|
+
maxFee: FieldElement$1,
|
|
6872
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6873
|
+
nonce: FieldElement$1
|
|
6842
6874
|
})
|
|
6843
6875
|
});
|
|
6844
6876
|
const InvokeTransactionV3 = schema.Schema.Struct({
|
|
6845
6877
|
_tag: tag("invokeV3"),
|
|
6846
6878
|
invokeV3: schema.Schema.Struct({
|
|
6847
|
-
senderAddress:
|
|
6848
|
-
calldata: schema.Schema.
|
|
6849
|
-
signature: schema.Schema.
|
|
6850
|
-
nonce:
|
|
6851
|
-
resourceBounds:
|
|
6852
|
-
tip: schema.Schema.
|
|
6853
|
-
paymasterData: schema.Schema.
|
|
6854
|
-
accountDeploymentData: schema.Schema.
|
|
6855
|
-
nonceDataAvailabilityMode:
|
|
6856
|
-
feeDataAvailabilityMode:
|
|
6879
|
+
senderAddress: FieldElement$1,
|
|
6880
|
+
calldata: schema.Schema.Array(FieldElement$1),
|
|
6881
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6882
|
+
nonce: FieldElement$1,
|
|
6883
|
+
resourceBounds: ResourceBoundsMapping,
|
|
6884
|
+
tip: schema.Schema.BigIntFromSelf,
|
|
6885
|
+
paymasterData: schema.Schema.Array(FieldElement$1),
|
|
6886
|
+
accountDeploymentData: schema.Schema.Array(FieldElement$1),
|
|
6887
|
+
nonceDataAvailabilityMode: DataAvailabilityMode,
|
|
6888
|
+
feeDataAvailabilityMode: DataAvailabilityMode
|
|
6857
6889
|
})
|
|
6858
6890
|
});
|
|
6859
6891
|
const L1HandlerTransaction = schema.Schema.Struct({
|
|
6860
6892
|
_tag: tag("l1Handler"),
|
|
6861
6893
|
l1Handler: schema.Schema.Struct({
|
|
6862
|
-
nonce: schema.Schema.
|
|
6863
|
-
contractAddress:
|
|
6864
|
-
entryPointSelector:
|
|
6865
|
-
calldata: schema.Schema.
|
|
6894
|
+
nonce: schema.Schema.BigIntFromSelf,
|
|
6895
|
+
contractAddress: FieldElement$1,
|
|
6896
|
+
entryPointSelector: FieldElement$1,
|
|
6897
|
+
calldata: schema.Schema.Array(FieldElement$1)
|
|
6866
6898
|
})
|
|
6867
6899
|
});
|
|
6868
6900
|
const DeployTransaction = schema.Schema.Struct({
|
|
6869
6901
|
_tag: tag("deploy"),
|
|
6870
6902
|
deploy: schema.Schema.Struct({
|
|
6871
|
-
contractAddressSalt:
|
|
6872
|
-
constructorCalldata: schema.Schema.
|
|
6873
|
-
classHash:
|
|
6903
|
+
contractAddressSalt: FieldElement$1,
|
|
6904
|
+
constructorCalldata: schema.Schema.Array(FieldElement$1),
|
|
6905
|
+
classHash: FieldElement$1
|
|
6874
6906
|
})
|
|
6875
6907
|
});
|
|
6876
6908
|
const DeclareTransactionV0 = schema.Schema.Struct({
|
|
6877
6909
|
_tag: tag("declareV0"),
|
|
6878
6910
|
declareV0: schema.Schema.Struct({
|
|
6879
|
-
senderAddress:
|
|
6880
|
-
maxFee:
|
|
6881
|
-
signature: schema.Schema.
|
|
6882
|
-
classHash:
|
|
6911
|
+
senderAddress: FieldElement$1,
|
|
6912
|
+
maxFee: FieldElement$1,
|
|
6913
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6914
|
+
classHash: FieldElement$1
|
|
6883
6915
|
})
|
|
6884
6916
|
});
|
|
6885
6917
|
const DeclareTransactionV1 = schema.Schema.Struct({
|
|
6886
6918
|
_tag: tag("declareV1"),
|
|
6887
6919
|
declareV1: schema.Schema.Struct({
|
|
6888
|
-
senderAddress:
|
|
6889
|
-
maxFee:
|
|
6890
|
-
signature: schema.Schema.
|
|
6891
|
-
nonce:
|
|
6892
|
-
classHash:
|
|
6920
|
+
senderAddress: FieldElement$1,
|
|
6921
|
+
maxFee: FieldElement$1,
|
|
6922
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6923
|
+
nonce: FieldElement$1,
|
|
6924
|
+
classHash: FieldElement$1
|
|
6893
6925
|
})
|
|
6894
6926
|
});
|
|
6895
6927
|
const DeclareTransactionV2 = schema.Schema.Struct({
|
|
6896
6928
|
_tag: tag("declareV2"),
|
|
6897
6929
|
declareV2: schema.Schema.Struct({
|
|
6898
|
-
senderAddress:
|
|
6899
|
-
compiledClassHash:
|
|
6900
|
-
maxFee:
|
|
6901
|
-
signature: schema.Schema.
|
|
6902
|
-
nonce:
|
|
6903
|
-
classHash:
|
|
6930
|
+
senderAddress: FieldElement$1,
|
|
6931
|
+
compiledClassHash: FieldElement$1,
|
|
6932
|
+
maxFee: FieldElement$1,
|
|
6933
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6934
|
+
nonce: FieldElement$1,
|
|
6935
|
+
classHash: FieldElement$1
|
|
6904
6936
|
})
|
|
6905
6937
|
});
|
|
6906
6938
|
const DeclareTransactionV3 = schema.Schema.Struct({
|
|
6907
6939
|
_tag: tag("declareV3"),
|
|
6908
6940
|
declareV3: schema.Schema.Struct({
|
|
6909
|
-
senderAddress:
|
|
6910
|
-
compiledClassHash:
|
|
6911
|
-
signature: schema.Schema.
|
|
6912
|
-
nonce:
|
|
6913
|
-
classHash:
|
|
6914
|
-
resourceBounds:
|
|
6915
|
-
tip: schema.Schema.
|
|
6916
|
-
paymasterData: schema.Schema.
|
|
6917
|
-
accountDeploymentData: schema.Schema.
|
|
6918
|
-
nonceDataAvailabilityMode:
|
|
6919
|
-
feeDataAvailabilityMode:
|
|
6941
|
+
senderAddress: FieldElement$1,
|
|
6942
|
+
compiledClassHash: FieldElement$1,
|
|
6943
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6944
|
+
nonce: FieldElement$1,
|
|
6945
|
+
classHash: FieldElement$1,
|
|
6946
|
+
resourceBounds: ResourceBoundsMapping,
|
|
6947
|
+
tip: schema.Schema.BigIntFromSelf,
|
|
6948
|
+
paymasterData: schema.Schema.Array(FieldElement$1),
|
|
6949
|
+
accountDeploymentData: schema.Schema.Array(FieldElement$1),
|
|
6950
|
+
nonceDataAvailabilityMode: DataAvailabilityMode,
|
|
6951
|
+
feeDataAvailabilityMode: DataAvailabilityMode
|
|
6920
6952
|
})
|
|
6921
6953
|
});
|
|
6922
6954
|
const DeployAccountTransactionV1 = schema.Schema.Struct({
|
|
6923
6955
|
_tag: tag("deployAccountV1"),
|
|
6924
6956
|
deployAccountV1: schema.Schema.Struct({
|
|
6925
|
-
maxFee:
|
|
6926
|
-
signature: schema.Schema.
|
|
6927
|
-
nonce:
|
|
6928
|
-
contractAddressSalt:
|
|
6929
|
-
constructorCalldata: schema.Schema.
|
|
6930
|
-
classHash:
|
|
6957
|
+
maxFee: FieldElement$1,
|
|
6958
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6959
|
+
nonce: FieldElement$1,
|
|
6960
|
+
contractAddressSalt: FieldElement$1,
|
|
6961
|
+
constructorCalldata: schema.Schema.Array(FieldElement$1),
|
|
6962
|
+
classHash: FieldElement$1
|
|
6931
6963
|
})
|
|
6932
6964
|
});
|
|
6933
6965
|
const DeployAccountTransactionV3 = schema.Schema.Struct({
|
|
6934
6966
|
_tag: tag("deployAccountV3"),
|
|
6935
6967
|
deployAccountV3: schema.Schema.Struct({
|
|
6936
|
-
signature: schema.Schema.
|
|
6937
|
-
nonce:
|
|
6938
|
-
contractAddressSalt:
|
|
6939
|
-
constructorCalldata: schema.Schema.
|
|
6940
|
-
classHash:
|
|
6941
|
-
resourceBounds:
|
|
6942
|
-
tip: schema.Schema.
|
|
6943
|
-
paymasterData: schema.Schema.
|
|
6944
|
-
nonceDataAvailabilityMode:
|
|
6945
|
-
feeDataAvailabilityMode:
|
|
6968
|
+
signature: schema.Schema.Array(FieldElement$1),
|
|
6969
|
+
nonce: FieldElement$1,
|
|
6970
|
+
contractAddressSalt: FieldElement$1,
|
|
6971
|
+
constructorCalldata: schema.Schema.Array(FieldElement$1),
|
|
6972
|
+
classHash: FieldElement$1,
|
|
6973
|
+
resourceBounds: ResourceBoundsMapping,
|
|
6974
|
+
tip: schema.Schema.BigIntFromSelf,
|
|
6975
|
+
paymasterData: schema.Schema.Array(FieldElement$1),
|
|
6976
|
+
nonceDataAvailabilityMode: DataAvailabilityMode,
|
|
6977
|
+
feeDataAvailabilityMode: DataAvailabilityMode
|
|
6946
6978
|
})
|
|
6947
6979
|
});
|
|
6948
6980
|
const Transaction = schema.Schema.Struct({
|
|
6949
|
-
filterIds: schema.Schema.
|
|
6950
|
-
meta:
|
|
6951
|
-
transaction: schema.Schema.
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
DeployAccountTransactionV3
|
|
6964
|
-
)
|
|
6981
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
6982
|
+
meta: TransactionMeta,
|
|
6983
|
+
transaction: schema.Schema.Union(
|
|
6984
|
+
InvokeTransactionV0,
|
|
6985
|
+
InvokeTransactionV1,
|
|
6986
|
+
InvokeTransactionV3,
|
|
6987
|
+
L1HandlerTransaction,
|
|
6988
|
+
DeployTransaction,
|
|
6989
|
+
DeclareTransactionV0,
|
|
6990
|
+
DeclareTransactionV1,
|
|
6991
|
+
DeclareTransactionV2,
|
|
6992
|
+
DeclareTransactionV3,
|
|
6993
|
+
DeployAccountTransactionV1,
|
|
6994
|
+
DeployAccountTransactionV3
|
|
6965
6995
|
)
|
|
6966
6996
|
});
|
|
6967
6997
|
const PriceUnit = schema.Schema.transform(
|
|
@@ -6983,11 +7013,11 @@ const PriceUnit = schema.Schema.transform(
|
|
|
6983
7013
|
}
|
|
6984
7014
|
);
|
|
6985
7015
|
const FeePayment = schema.Schema.Struct({
|
|
6986
|
-
amount:
|
|
6987
|
-
unit:
|
|
7016
|
+
amount: FieldElement$1,
|
|
7017
|
+
unit: PriceUnit
|
|
6988
7018
|
});
|
|
6989
7019
|
const ComputationResources = schema.Schema.Struct({
|
|
6990
|
-
steps: schema.Schema.
|
|
7020
|
+
steps: schema.Schema.BigIntFromSelf,
|
|
6991
7021
|
memoryHoles: schema.Schema.optional(schema.Schema.BigIntFromSelf),
|
|
6992
7022
|
rangeCheckBuiltinApplications: schema.Schema.optional(schema.Schema.BigIntFromSelf),
|
|
6993
7023
|
pedersenBuiltinApplications: schema.Schema.optional(schema.Schema.BigIntFromSelf),
|
|
@@ -6999,12 +7029,12 @@ const ComputationResources = schema.Schema.Struct({
|
|
|
6999
7029
|
segmentArenaBuiltin: schema.Schema.optional(schema.Schema.BigIntFromSelf)
|
|
7000
7030
|
});
|
|
7001
7031
|
const DataAvailabilityResources = schema.Schema.Struct({
|
|
7002
|
-
l1Gas: schema.Schema.
|
|
7003
|
-
l1DataGas: schema.Schema.
|
|
7032
|
+
l1Gas: schema.Schema.BigIntFromSelf,
|
|
7033
|
+
l1DataGas: schema.Schema.BigIntFromSelf
|
|
7004
7034
|
});
|
|
7005
7035
|
const ExecutionResources = schema.Schema.Struct({
|
|
7006
|
-
computation:
|
|
7007
|
-
dataAvailability:
|
|
7036
|
+
computation: ComputationResources,
|
|
7037
|
+
dataAvailability: DataAvailabilityResources
|
|
7008
7038
|
});
|
|
7009
7039
|
const ExecutionSucceeded = schema.Schema.Struct({
|
|
7010
7040
|
_tag: tag("succeeded"),
|
|
@@ -7017,13 +7047,11 @@ const ExecutionReverted = schema.Schema.Struct({
|
|
|
7017
7047
|
})
|
|
7018
7048
|
});
|
|
7019
7049
|
const TransactionReceiptMeta = schema.Schema.Struct({
|
|
7020
|
-
transactionIndex: schema.Schema.
|
|
7021
|
-
transactionHash:
|
|
7022
|
-
actualFee:
|
|
7023
|
-
executionResources:
|
|
7024
|
-
executionResult: schema.Schema.
|
|
7025
|
-
schema.Schema.Union(ExecutionSucceeded, ExecutionReverted)
|
|
7026
|
-
)
|
|
7050
|
+
transactionIndex: schema.Schema.Number,
|
|
7051
|
+
transactionHash: FieldElement$1,
|
|
7052
|
+
actualFee: FeePayment,
|
|
7053
|
+
executionResources: ExecutionResources,
|
|
7054
|
+
executionResult: schema.Schema.Union(ExecutionSucceeded, ExecutionReverted)
|
|
7027
7055
|
});
|
|
7028
7056
|
const InvokeTransactionReceipt = schema.Schema.Struct({
|
|
7029
7057
|
_tag: tag("invoke"),
|
|
@@ -7032,7 +7060,7 @@ const InvokeTransactionReceipt = schema.Schema.Struct({
|
|
|
7032
7060
|
const L1HandlerTransactionReceipt = schema.Schema.Struct({
|
|
7033
7061
|
_tag: tag("l1Handler"),
|
|
7034
7062
|
l1Handler: schema.Schema.Struct({
|
|
7035
|
-
messageHash: schema.Schema.
|
|
7063
|
+
messageHash: schema.Schema.Uint8ArrayFromSelf
|
|
7036
7064
|
})
|
|
7037
7065
|
});
|
|
7038
7066
|
const DeclareTransactionReceipt = schema.Schema.Struct({
|
|
@@ -7042,56 +7070,56 @@ const DeclareTransactionReceipt = schema.Schema.Struct({
|
|
|
7042
7070
|
const DeployTransactionReceipt = schema.Schema.Struct({
|
|
7043
7071
|
_tag: tag("deploy"),
|
|
7044
7072
|
deploy: schema.Schema.Struct({
|
|
7045
|
-
contractAddress:
|
|
7073
|
+
contractAddress: FieldElement$1
|
|
7046
7074
|
})
|
|
7047
7075
|
});
|
|
7048
7076
|
const DeployAccountTransactionReceipt = schema.Schema.Struct({
|
|
7049
7077
|
_tag: tag("deployAccount"),
|
|
7050
7078
|
deployAccount: schema.Schema.Struct({
|
|
7051
|
-
contractAddress:
|
|
7079
|
+
contractAddress: FieldElement$1
|
|
7052
7080
|
})
|
|
7053
7081
|
});
|
|
7054
7082
|
const TransactionReceipt = schema.Schema.Struct({
|
|
7055
|
-
filterIds: schema.Schema.
|
|
7056
|
-
meta:
|
|
7057
|
-
receipt: schema.Schema.
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
DeployAccountTransactionReceipt
|
|
7064
|
-
)
|
|
7083
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
7084
|
+
meta: TransactionReceiptMeta,
|
|
7085
|
+
receipt: schema.Schema.Union(
|
|
7086
|
+
InvokeTransactionReceipt,
|
|
7087
|
+
L1HandlerTransactionReceipt,
|
|
7088
|
+
DeclareTransactionReceipt,
|
|
7089
|
+
DeployTransactionReceipt,
|
|
7090
|
+
DeployAccountTransactionReceipt
|
|
7065
7091
|
)
|
|
7066
7092
|
});
|
|
7067
7093
|
const Event = schema.Schema.Struct({
|
|
7068
|
-
filterIds: schema.Schema.
|
|
7069
|
-
address:
|
|
7070
|
-
keys: schema.Schema.
|
|
7071
|
-
data: schema.Schema.
|
|
7072
|
-
eventIndex: schema.Schema.
|
|
7073
|
-
transactionIndex: schema.Schema.
|
|
7074
|
-
transactionHash:
|
|
7075
|
-
transactionStatus:
|
|
7094
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
7095
|
+
address: FieldElement$1,
|
|
7096
|
+
keys: schema.Schema.Array(FieldElement$1),
|
|
7097
|
+
data: schema.Schema.Array(FieldElement$1),
|
|
7098
|
+
eventIndex: schema.Schema.Number,
|
|
7099
|
+
transactionIndex: schema.Schema.Number,
|
|
7100
|
+
transactionHash: FieldElement$1,
|
|
7101
|
+
transactionStatus: TransactionStatus,
|
|
7102
|
+
eventIndexInTransaction: schema.Schema.Number
|
|
7076
7103
|
});
|
|
7077
7104
|
const MessageToL1 = schema.Schema.Struct({
|
|
7078
|
-
filterIds: schema.Schema.
|
|
7079
|
-
fromAddress:
|
|
7080
|
-
toAddress:
|
|
7081
|
-
payload: schema.Schema.
|
|
7082
|
-
messageIndex: schema.Schema.
|
|
7083
|
-
transactionIndex: schema.Schema.
|
|
7084
|
-
transactionHash:
|
|
7085
|
-
transactionStatus:
|
|
7105
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
7106
|
+
fromAddress: FieldElement$1,
|
|
7107
|
+
toAddress: FieldElement$1,
|
|
7108
|
+
payload: schema.Schema.Array(FieldElement$1),
|
|
7109
|
+
messageIndex: schema.Schema.Number,
|
|
7110
|
+
transactionIndex: schema.Schema.Number,
|
|
7111
|
+
transactionHash: FieldElement$1,
|
|
7112
|
+
transactionStatus: TransactionStatus,
|
|
7113
|
+
messageIndexInTransaction: schema.Schema.Number
|
|
7086
7114
|
});
|
|
7087
7115
|
const StorageEntry = schema.Schema.Struct({
|
|
7088
|
-
key:
|
|
7089
|
-
value:
|
|
7116
|
+
key: FieldElement$1,
|
|
7117
|
+
value: FieldElement$1
|
|
7090
7118
|
});
|
|
7091
7119
|
const StorageDiff = schema.Schema.Struct({
|
|
7092
|
-
filterIds: schema.Schema.
|
|
7093
|
-
contractAddress:
|
|
7094
|
-
storageEntries: schema.Schema.
|
|
7120
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
7121
|
+
contractAddress: FieldElement$1,
|
|
7122
|
+
storageEntries: schema.Schema.Array(StorageEntry)
|
|
7095
7123
|
});
|
|
7096
7124
|
const DeclaredClass = schema.Schema.Struct({
|
|
7097
7125
|
_tag: tag("declaredClass"),
|
|
@@ -7115,18 +7143,16 @@ const DeployedContract = schema.Schema.Struct({
|
|
|
7115
7143
|
})
|
|
7116
7144
|
});
|
|
7117
7145
|
const ContractChange = schema.Schema.Struct({
|
|
7118
|
-
filterIds: schema.Schema.
|
|
7119
|
-
change: schema.Schema.
|
|
7120
|
-
schema.Schema.Union(DeclaredClass, ReplacedClass, DeployedContract)
|
|
7121
|
-
)
|
|
7146
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
7147
|
+
change: schema.Schema.Union(DeclaredClass, ReplacedClass, DeployedContract)
|
|
7122
7148
|
});
|
|
7123
7149
|
const NonceUpdate = schema.Schema.Struct({
|
|
7124
|
-
filterIds: schema.Schema.
|
|
7125
|
-
contractAddress:
|
|
7126
|
-
nonce:
|
|
7150
|
+
filterIds: schema.Schema.Array(schema.Schema.Number),
|
|
7151
|
+
contractAddress: FieldElement$1,
|
|
7152
|
+
nonce: FieldElement$1
|
|
7127
7153
|
});
|
|
7128
7154
|
const Block = schema.Schema.Struct({
|
|
7129
|
-
header:
|
|
7155
|
+
header: BlockHeader,
|
|
7130
7156
|
transactions: schema.Schema.Array(Transaction),
|
|
7131
7157
|
receipts: schema.Schema.Array(TransactionReceipt),
|
|
7132
7158
|
events: schema.Schema.Array(Event),
|
|
@@ -7403,14 +7429,16 @@ function mergeHeaderFilter(a, b) {
|
|
|
7403
7429
|
return "on_data";
|
|
7404
7430
|
}
|
|
7405
7431
|
|
|
7406
|
-
function getReceipt(transactionIndex,
|
|
7432
|
+
function getReceipt(transactionIndex, params) {
|
|
7433
|
+
const receipts = "receipts" in params ? params.receipts : params;
|
|
7407
7434
|
return binarySearch(
|
|
7408
7435
|
transactionIndex,
|
|
7409
7436
|
receipts,
|
|
7410
7437
|
(receipt) => receipt.meta?.transactionIndex ?? 0
|
|
7411
7438
|
);
|
|
7412
7439
|
}
|
|
7413
|
-
function getTransaction(transactionIndex,
|
|
7440
|
+
function getTransaction(transactionIndex, params) {
|
|
7441
|
+
const transactions = "transactions" in params ? params.transactions : params;
|
|
7414
7442
|
return binarySearch(
|
|
7415
7443
|
transactionIndex,
|
|
7416
7444
|
transactions,
|
|
@@ -7435,6 +7463,157 @@ function binarySearch(index, arr, getIndex) {
|
|
|
7435
7463
|
}
|
|
7436
7464
|
}
|
|
7437
7465
|
|
|
7466
|
+
function getBigIntSelector(name) {
|
|
7467
|
+
const asBytes = new TextEncoder().encode(name);
|
|
7468
|
+
return starknet.keccak(asBytes);
|
|
7469
|
+
}
|
|
7470
|
+
function getSelector(name) {
|
|
7471
|
+
const bn = getBigIntSelector(name);
|
|
7472
|
+
return `0x${bn.toString(16).padStart(64, "0")}`;
|
|
7473
|
+
}
|
|
7474
|
+
function getEventSelector(name) {
|
|
7475
|
+
const parts = name.split("::");
|
|
7476
|
+
return getSelector(parts[parts.length - 1]);
|
|
7477
|
+
}
|
|
7478
|
+
const PrimitiveTypeParsers = {
|
|
7479
|
+
"core::bool": parser.parseBool,
|
|
7480
|
+
"core::felt252": parser.parseFelt252,
|
|
7481
|
+
"core::integer::u8": parser.parseU8,
|
|
7482
|
+
"core::integer::u16": parser.parseU16,
|
|
7483
|
+
"core::integer::u32": parser.parseU32,
|
|
7484
|
+
"core::integer::u64": parser.parseU64,
|
|
7485
|
+
"core::integer::u128": parser.parseU128,
|
|
7486
|
+
"core::integer::u256": parser.parseU256,
|
|
7487
|
+
"core::starknet::contract_address::ContractAddress": parser.parseContractAddress
|
|
7488
|
+
};
|
|
7489
|
+
function isPrimitiveType(type) {
|
|
7490
|
+
return type in PrimitiveTypeParsers;
|
|
7491
|
+
}
|
|
7492
|
+
function isArrayType(type) {
|
|
7493
|
+
return type.startsWith("core::array::Array::<") && type.endsWith(">");
|
|
7494
|
+
}
|
|
7495
|
+
function getArrayElementType(type) {
|
|
7496
|
+
return type.slice("core::array::Array::<".length, -1);
|
|
7497
|
+
}
|
|
7498
|
+
function isSpanType(type) {
|
|
7499
|
+
return type.startsWith("core::array::Span::<") && type.endsWith(">");
|
|
7500
|
+
}
|
|
7501
|
+
function getSpanType(type) {
|
|
7502
|
+
return type.slice("core::array::Span::<".length, -1);
|
|
7503
|
+
}
|
|
7504
|
+
function isOptionType(type) {
|
|
7505
|
+
return type.startsWith("core::option::Option::<") && type.endsWith(">");
|
|
7506
|
+
}
|
|
7507
|
+
function getOptionType(type) {
|
|
7508
|
+
return type.slice("core::option::Option::<".length, -1);
|
|
7509
|
+
}
|
|
7510
|
+
function isEmptyType(type) {
|
|
7511
|
+
return type === "()";
|
|
7512
|
+
}
|
|
7513
|
+
|
|
7514
|
+
class DecodeEventError extends Error {
|
|
7515
|
+
constructor(message) {
|
|
7516
|
+
super(message);
|
|
7517
|
+
this.name = "DecodeEventError";
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7520
|
+
function decodeEvent(args) {
|
|
7521
|
+
const { abi, event, eventName, strict = true } = args;
|
|
7522
|
+
const eventAbi = abi.find(
|
|
7523
|
+
(item) => item.name === eventName && item.type === "event"
|
|
7524
|
+
);
|
|
7525
|
+
if (!eventAbi || eventAbi.type !== "event") {
|
|
7526
|
+
if (strict) {
|
|
7527
|
+
throw new DecodeEventError(`Event ${eventName} not found in ABI`);
|
|
7528
|
+
}
|
|
7529
|
+
return null;
|
|
7530
|
+
}
|
|
7531
|
+
if (eventAbi.kind === "enum") {
|
|
7532
|
+
throw new DecodeEventError("enum: not implemented");
|
|
7533
|
+
}
|
|
7534
|
+
const selector = BigInt(getEventSelector(eventName));
|
|
7535
|
+
if (event.keys && selector !== BigInt(event.keys[0]) || !event.keys) {
|
|
7536
|
+
if (strict) {
|
|
7537
|
+
throw new DecodeEventError(
|
|
7538
|
+
`Selector mismatch. Expected ${selector}, got ${event.keys?.[0]}`
|
|
7539
|
+
);
|
|
7540
|
+
}
|
|
7541
|
+
return null;
|
|
7542
|
+
}
|
|
7543
|
+
const keysAbi = eventAbi.members.filter((m) => m.kind === "key");
|
|
7544
|
+
const dataAbi = eventAbi.members.filter((m) => m.kind === "data");
|
|
7545
|
+
try {
|
|
7546
|
+
const keysParser = compileEventMembers(abi, keysAbi);
|
|
7547
|
+
const dataParser = compileEventMembers(abi, dataAbi);
|
|
7548
|
+
const keysWithoutSelector = event.keys?.slice(1) ?? [];
|
|
7549
|
+
const { out: decodedKeys } = keysParser(keysWithoutSelector, 0);
|
|
7550
|
+
const { out: decodedData } = dataParser(event.data ?? [], 0);
|
|
7551
|
+
const decoded = {
|
|
7552
|
+
...decodedKeys,
|
|
7553
|
+
...decodedData
|
|
7554
|
+
};
|
|
7555
|
+
return {
|
|
7556
|
+
...event,
|
|
7557
|
+
eventName,
|
|
7558
|
+
args: decoded
|
|
7559
|
+
};
|
|
7560
|
+
} catch (error) {
|
|
7561
|
+
if (error instanceof DecodeEventError && !strict) {
|
|
7562
|
+
return null;
|
|
7563
|
+
}
|
|
7564
|
+
if (error instanceof parser.ParseError && !strict) {
|
|
7565
|
+
return null;
|
|
7566
|
+
}
|
|
7567
|
+
throw error;
|
|
7568
|
+
}
|
|
7569
|
+
}
|
|
7570
|
+
function compileEventMembers(abi, members) {
|
|
7571
|
+
return compileStructParser(abi, members);
|
|
7572
|
+
}
|
|
7573
|
+
function compileTypeParser(abi, type) {
|
|
7574
|
+
if (isPrimitiveType(type)) {
|
|
7575
|
+
return PrimitiveTypeParsers[type];
|
|
7576
|
+
}
|
|
7577
|
+
if (isArrayType(type)) {
|
|
7578
|
+
const elementType = getArrayElementType(type);
|
|
7579
|
+
return parser.parseArray(compileTypeParser(abi, elementType));
|
|
7580
|
+
}
|
|
7581
|
+
if (isSpanType(type)) {
|
|
7582
|
+
const elementType = getSpanType(type);
|
|
7583
|
+
return parser.parseSpan(compileTypeParser(abi, elementType));
|
|
7584
|
+
}
|
|
7585
|
+
if (isOptionType(type)) {
|
|
7586
|
+
const elementType = getOptionType(type);
|
|
7587
|
+
return parser.parseOption(compileTypeParser(abi, elementType));
|
|
7588
|
+
}
|
|
7589
|
+
if (isEmptyType(type)) {
|
|
7590
|
+
return parser.parseEmpty;
|
|
7591
|
+
}
|
|
7592
|
+
const typeAbi = abi.find((item) => item.name === type);
|
|
7593
|
+
if (!typeAbi) {
|
|
7594
|
+
throw new DecodeEventError(`Type ${type} not found in ABI`);
|
|
7595
|
+
}
|
|
7596
|
+
switch (typeAbi.type) {
|
|
7597
|
+
case "struct": {
|
|
7598
|
+
return compileStructParser(abi, typeAbi.members);
|
|
7599
|
+
}
|
|
7600
|
+
case "enum":
|
|
7601
|
+
throw new DecodeEventError("enum: not implemented");
|
|
7602
|
+
default:
|
|
7603
|
+
throw new DecodeEventError(`Invalid type ${typeAbi.type}`);
|
|
7604
|
+
}
|
|
7605
|
+
}
|
|
7606
|
+
function compileStructParser(abi, members) {
|
|
7607
|
+
const parsers = {};
|
|
7608
|
+
for (const [index, member] of members.entries()) {
|
|
7609
|
+
parsers[member.name] = {
|
|
7610
|
+
index,
|
|
7611
|
+
parser: compileTypeParser(abi, member.type)
|
|
7612
|
+
};
|
|
7613
|
+
}
|
|
7614
|
+
return parser.parseStruct(parsers);
|
|
7615
|
+
}
|
|
7616
|
+
|
|
7438
7617
|
const StarknetStream = new protocol.StreamConfig(
|
|
7439
7618
|
FilterFromBytes,
|
|
7440
7619
|
BlockFromBytes,
|
|
@@ -7460,6 +7639,7 @@ exports.DeclareV2TransactionFilter = DeclareV2TransactionFilter;
|
|
|
7460
7639
|
exports.DeclareV3TransactionFilter = DeclareV3TransactionFilter;
|
|
7461
7640
|
exports.DeclaredClass = DeclaredClass;
|
|
7462
7641
|
exports.DeclaredClassFilter = DeclaredClassFilter;
|
|
7642
|
+
exports.DecodeEventError = DecodeEventError;
|
|
7463
7643
|
exports.DeployAccountTransactionReceipt = DeployAccountTransactionReceipt;
|
|
7464
7644
|
exports.DeployAccountTransactionV1 = DeployAccountTransactionV1;
|
|
7465
7645
|
exports.DeployAccountTransactionV3 = DeployAccountTransactionV3;
|
|
@@ -7515,13 +7695,17 @@ exports.TransactionReceiptMeta = TransactionReceiptMeta;
|
|
|
7515
7695
|
exports.TransactionStatus = TransactionStatus;
|
|
7516
7696
|
exports.TransactionStatusFilter = TransactionStatusFilter;
|
|
7517
7697
|
exports.U128 = U128;
|
|
7698
|
+
exports.decodeEvent = decodeEvent;
|
|
7518
7699
|
exports.feltFromProto = feltFromProto;
|
|
7519
7700
|
exports.feltToProto = feltToProto;
|
|
7520
7701
|
exports.filterFromBytes = filterFromBytes;
|
|
7521
7702
|
exports.filterFromProto = filterFromProto;
|
|
7522
7703
|
exports.filterToBytes = filterToBytes;
|
|
7523
7704
|
exports.filterToProto = filterToProto;
|
|
7705
|
+
exports.getBigIntSelector = getBigIntSelector;
|
|
7706
|
+
exports.getEventSelector = getEventSelector;
|
|
7524
7707
|
exports.getReceipt = getReceipt;
|
|
7708
|
+
exports.getSelector = getSelector;
|
|
7525
7709
|
exports.getTransaction = getTransaction;
|
|
7526
7710
|
exports.mergeFilter = mergeFilter;
|
|
7527
7711
|
exports.proto = index;
|