@apibara/starknet 2.1.0-beta.3 → 2.1.0-beta.31
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 +1638 -696
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5158 -4389
- package/dist/index.d.mts +5158 -4389
- package/dist/index.d.ts +5158 -4389
- package/dist/index.mjs +1631 -690
- package/dist/index.mjs.map +1 -0
- package/dist/parser.cjs +7 -5
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +9 -12
- package/dist/parser.d.mts +9 -12
- package/dist/parser.d.ts +9 -12
- package/dist/parser.mjs +7 -5
- package/dist/parser.mjs.map +1 -0
- package/dist/shared/starknet.e649ecb1.d.cts +40 -0
- package/dist/shared/starknet.e649ecb1.d.mts +40 -0
- package/dist/shared/starknet.e649ecb1.d.ts +40 -0
- package/package.json +4 -5
- package/src/abi-wan-helpers.ts +140 -0
- package/src/block.ts +905 -423
- package/src/common.ts +20 -35
- package/src/event.ts +174 -44
- package/src/filter.ts +240 -239
- package/src/index.ts +3 -0
- package/src/parser.ts +6 -5
- package/src/proto/data.ts +1081 -1
- package/src/proto/filter.ts +76 -2
- package/dist/shared/starknet.2b19268a.d.cts +0 -32
- package/dist/shared/starknet.2b19268a.d.mts +0 -32
- package/dist/shared/starknet.2b19268a.d.ts +0 -32
- package/src/common.test.ts +0 -21
- package/src/filter.test.ts +0 -832
- package/src/helpers.ts +0 -8
- package/src/parser.test.ts +0 -169
package/src/proto/filter.ts
CHANGED
|
@@ -189,7 +189,15 @@ export interface EventFilter {
|
|
|
189
189
|
*
|
|
190
190
|
* Defaults to false.
|
|
191
191
|
*/
|
|
192
|
-
readonly includeSiblings?:
|
|
192
|
+
readonly includeSiblings?:
|
|
193
|
+
| boolean
|
|
194
|
+
| undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Include the trace of the transaction that emitted the event.
|
|
197
|
+
*
|
|
198
|
+
* Defaults to false.
|
|
199
|
+
*/
|
|
200
|
+
readonly includeTransactionTrace?: boolean | undefined;
|
|
193
201
|
}
|
|
194
202
|
|
|
195
203
|
export interface Key {
|
|
@@ -247,7 +255,15 @@ export interface MessageToL1Filter {
|
|
|
247
255
|
*
|
|
248
256
|
* Defaults to false.
|
|
249
257
|
*/
|
|
250
|
-
readonly includeSiblings?:
|
|
258
|
+
readonly includeSiblings?:
|
|
259
|
+
| boolean
|
|
260
|
+
| undefined;
|
|
261
|
+
/**
|
|
262
|
+
* Include the trace of the transaction that sent the message.
|
|
263
|
+
*
|
|
264
|
+
* Defaults to false.
|
|
265
|
+
*/
|
|
266
|
+
readonly includeTransactionTrace?: boolean | undefined;
|
|
251
267
|
}
|
|
252
268
|
|
|
253
269
|
/** Filter transactions. */
|
|
@@ -298,6 +314,12 @@ export interface TransactionFilter {
|
|
|
298
314
|
| { readonly $case: "deployAccountV1"; readonly deployAccountV1: DeployAccountV1TransactionFilter }
|
|
299
315
|
| { readonly $case: "deployAccountV3"; readonly deployAccountV3: DeployAccountV3TransactionFilter }
|
|
300
316
|
| undefined;
|
|
317
|
+
/**
|
|
318
|
+
* Flag to request the transaction's trace.
|
|
319
|
+
*
|
|
320
|
+
* Defaults to `false``.
|
|
321
|
+
*/
|
|
322
|
+
readonly includeTrace?: boolean | undefined;
|
|
301
323
|
}
|
|
302
324
|
|
|
303
325
|
export interface InvokeTransactionV0Filter {
|
|
@@ -557,6 +579,7 @@ function createBaseEventFilter(): EventFilter {
|
|
|
557
579
|
includeReceipt: undefined,
|
|
558
580
|
includeMessages: undefined,
|
|
559
581
|
includeSiblings: undefined,
|
|
582
|
+
includeTransactionTrace: undefined,
|
|
560
583
|
};
|
|
561
584
|
}
|
|
562
585
|
|
|
@@ -591,6 +614,9 @@ export const EventFilter = {
|
|
|
591
614
|
if (message.includeSiblings !== undefined) {
|
|
592
615
|
writer.uint32(72).bool(message.includeSiblings);
|
|
593
616
|
}
|
|
617
|
+
if (message.includeTransactionTrace !== undefined) {
|
|
618
|
+
writer.uint32(80).bool(message.includeTransactionTrace);
|
|
619
|
+
}
|
|
594
620
|
return writer;
|
|
595
621
|
},
|
|
596
622
|
|
|
@@ -664,6 +690,13 @@ export const EventFilter = {
|
|
|
664
690
|
|
|
665
691
|
message.includeSiblings = reader.bool();
|
|
666
692
|
continue;
|
|
693
|
+
case 10:
|
|
694
|
+
if (tag !== 80) {
|
|
695
|
+
break;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
message.includeTransactionTrace = reader.bool();
|
|
699
|
+
continue;
|
|
667
700
|
}
|
|
668
701
|
if ((tag & 7) === 4 || tag === 0) {
|
|
669
702
|
break;
|
|
@@ -686,6 +719,9 @@ export const EventFilter = {
|
|
|
686
719
|
includeReceipt: isSet(object.includeReceipt) ? globalThis.Boolean(object.includeReceipt) : undefined,
|
|
687
720
|
includeMessages: isSet(object.includeMessages) ? globalThis.Boolean(object.includeMessages) : undefined,
|
|
688
721
|
includeSiblings: isSet(object.includeSiblings) ? globalThis.Boolean(object.includeSiblings) : undefined,
|
|
722
|
+
includeTransactionTrace: isSet(object.includeTransactionTrace)
|
|
723
|
+
? globalThis.Boolean(object.includeTransactionTrace)
|
|
724
|
+
: undefined,
|
|
689
725
|
};
|
|
690
726
|
},
|
|
691
727
|
|
|
@@ -718,6 +754,9 @@ export const EventFilter = {
|
|
|
718
754
|
if (message.includeSiblings !== undefined) {
|
|
719
755
|
obj.includeSiblings = message.includeSiblings;
|
|
720
756
|
}
|
|
757
|
+
if (message.includeTransactionTrace !== undefined) {
|
|
758
|
+
obj.includeTransactionTrace = message.includeTransactionTrace;
|
|
759
|
+
}
|
|
721
760
|
return obj;
|
|
722
761
|
},
|
|
723
762
|
|
|
@@ -737,6 +776,7 @@ export const EventFilter = {
|
|
|
737
776
|
message.includeReceipt = object.includeReceipt ?? undefined;
|
|
738
777
|
message.includeMessages = object.includeMessages ?? undefined;
|
|
739
778
|
message.includeSiblings = object.includeSiblings ?? undefined;
|
|
779
|
+
message.includeTransactionTrace = object.includeTransactionTrace ?? undefined;
|
|
740
780
|
return message;
|
|
741
781
|
},
|
|
742
782
|
};
|
|
@@ -810,6 +850,7 @@ function createBaseMessageToL1Filter(): MessageToL1Filter {
|
|
|
810
850
|
includeReceipt: undefined,
|
|
811
851
|
includeEvents: undefined,
|
|
812
852
|
includeSiblings: undefined,
|
|
853
|
+
includeTransactionTrace: undefined,
|
|
813
854
|
};
|
|
814
855
|
}
|
|
815
856
|
|
|
@@ -839,6 +880,9 @@ export const MessageToL1Filter = {
|
|
|
839
880
|
if (message.includeSiblings !== undefined) {
|
|
840
881
|
writer.uint32(64).bool(message.includeSiblings);
|
|
841
882
|
}
|
|
883
|
+
if (message.includeTransactionTrace !== undefined) {
|
|
884
|
+
writer.uint32(72).bool(message.includeTransactionTrace);
|
|
885
|
+
}
|
|
842
886
|
return writer;
|
|
843
887
|
},
|
|
844
888
|
|
|
@@ -905,6 +949,13 @@ export const MessageToL1Filter = {
|
|
|
905
949
|
|
|
906
950
|
message.includeSiblings = reader.bool();
|
|
907
951
|
continue;
|
|
952
|
+
case 9:
|
|
953
|
+
if (tag !== 72) {
|
|
954
|
+
break;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
message.includeTransactionTrace = reader.bool();
|
|
958
|
+
continue;
|
|
908
959
|
}
|
|
909
960
|
if ((tag & 7) === 4 || tag === 0) {
|
|
910
961
|
break;
|
|
@@ -926,6 +977,9 @@ export const MessageToL1Filter = {
|
|
|
926
977
|
includeReceipt: isSet(object.includeReceipt) ? globalThis.Boolean(object.includeReceipt) : undefined,
|
|
927
978
|
includeEvents: isSet(object.includeEvents) ? globalThis.Boolean(object.includeEvents) : undefined,
|
|
928
979
|
includeSiblings: isSet(object.includeSiblings) ? globalThis.Boolean(object.includeSiblings) : undefined,
|
|
980
|
+
includeTransactionTrace: isSet(object.includeTransactionTrace)
|
|
981
|
+
? globalThis.Boolean(object.includeTransactionTrace)
|
|
982
|
+
: undefined,
|
|
929
983
|
};
|
|
930
984
|
},
|
|
931
985
|
|
|
@@ -955,6 +1009,9 @@ export const MessageToL1Filter = {
|
|
|
955
1009
|
if (message.includeSiblings !== undefined) {
|
|
956
1010
|
obj.includeSiblings = message.includeSiblings;
|
|
957
1011
|
}
|
|
1012
|
+
if (message.includeTransactionTrace !== undefined) {
|
|
1013
|
+
obj.includeTransactionTrace = message.includeTransactionTrace;
|
|
1014
|
+
}
|
|
958
1015
|
return obj;
|
|
959
1016
|
},
|
|
960
1017
|
|
|
@@ -975,6 +1032,7 @@ export const MessageToL1Filter = {
|
|
|
975
1032
|
message.includeReceipt = object.includeReceipt ?? undefined;
|
|
976
1033
|
message.includeEvents = object.includeEvents ?? undefined;
|
|
977
1034
|
message.includeSiblings = object.includeSiblings ?? undefined;
|
|
1035
|
+
message.includeTransactionTrace = object.includeTransactionTrace ?? undefined;
|
|
978
1036
|
return message;
|
|
979
1037
|
},
|
|
980
1038
|
};
|
|
@@ -987,6 +1045,7 @@ function createBaseTransactionFilter(): TransactionFilter {
|
|
|
987
1045
|
includeEvents: undefined,
|
|
988
1046
|
includeMessages: undefined,
|
|
989
1047
|
inner: undefined,
|
|
1048
|
+
includeTrace: undefined,
|
|
990
1049
|
};
|
|
991
1050
|
}
|
|
992
1051
|
|
|
@@ -1042,6 +1101,9 @@ export const TransactionFilter = {
|
|
|
1042
1101
|
DeployAccountV3TransactionFilter.encode(message.inner.deployAccountV3, writer.uint32(130).fork()).ldelim();
|
|
1043
1102
|
break;
|
|
1044
1103
|
}
|
|
1104
|
+
if (message.includeTrace !== undefined) {
|
|
1105
|
+
writer.uint32(136).bool(message.includeTrace);
|
|
1106
|
+
}
|
|
1045
1107
|
return writer;
|
|
1046
1108
|
},
|
|
1047
1109
|
|
|
@@ -1170,6 +1232,13 @@ export const TransactionFilter = {
|
|
|
1170
1232
|
deployAccountV3: DeployAccountV3TransactionFilter.decode(reader, reader.uint32()),
|
|
1171
1233
|
};
|
|
1172
1234
|
continue;
|
|
1235
|
+
case 17:
|
|
1236
|
+
if (tag !== 136) {
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
message.includeTrace = reader.bool();
|
|
1241
|
+
continue;
|
|
1173
1242
|
}
|
|
1174
1243
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1175
1244
|
break;
|
|
@@ -1217,6 +1286,7 @@ export const TransactionFilter = {
|
|
|
1217
1286
|
deployAccountV3: DeployAccountV3TransactionFilter.fromJSON(object.deployAccountV3),
|
|
1218
1287
|
}
|
|
1219
1288
|
: undefined,
|
|
1289
|
+
includeTrace: isSet(object.includeTrace) ? globalThis.Boolean(object.includeTrace) : undefined,
|
|
1220
1290
|
};
|
|
1221
1291
|
},
|
|
1222
1292
|
|
|
@@ -1270,6 +1340,9 @@ export const TransactionFilter = {
|
|
|
1270
1340
|
if (message.inner?.$case === "deployAccountV3") {
|
|
1271
1341
|
obj.deployAccountV3 = DeployAccountV3TransactionFilter.toJSON(message.inner.deployAccountV3);
|
|
1272
1342
|
}
|
|
1343
|
+
if (message.includeTrace !== undefined) {
|
|
1344
|
+
obj.includeTrace = message.includeTrace;
|
|
1345
|
+
}
|
|
1273
1346
|
return obj;
|
|
1274
1347
|
},
|
|
1275
1348
|
|
|
@@ -1340,6 +1413,7 @@ export const TransactionFilter = {
|
|
|
1340
1413
|
deployAccountV3: DeployAccountV3TransactionFilter.fromPartial(object.inner.deployAccountV3),
|
|
1341
1414
|
};
|
|
1342
1415
|
}
|
|
1416
|
+
message.includeTrace = object.includeTrace ?? undefined;
|
|
1343
1417
|
return message;
|
|
1344
1418
|
},
|
|
1345
1419
|
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as _effect_schema_AST from '@effect/schema/AST';
|
|
2
|
-
import { Schema } from '@effect/schema';
|
|
3
|
-
|
|
4
|
-
/** Wire representation of `FieldElement`. */
|
|
5
|
-
declare const FieldElementProto: Schema.Struct<{
|
|
6
|
-
x0: typeof Schema.BigIntFromSelf;
|
|
7
|
-
x1: typeof Schema.BigIntFromSelf;
|
|
8
|
-
x2: typeof Schema.BigIntFromSelf;
|
|
9
|
-
x3: typeof Schema.BigIntFromSelf;
|
|
10
|
-
}>;
|
|
11
|
-
/** Field element. */
|
|
12
|
-
declare const FieldElement: Schema.transform<Schema.Struct<{
|
|
13
|
-
x0: typeof Schema.BigIntFromSelf;
|
|
14
|
-
x1: typeof Schema.BigIntFromSelf;
|
|
15
|
-
x2: typeof Schema.BigIntFromSelf;
|
|
16
|
-
x3: typeof Schema.BigIntFromSelf;
|
|
17
|
-
}>, Schema.SchemaClass<`0x${string}`, `0x${string}`, never>>;
|
|
18
|
-
type FieldElement = Schema.Schema.Type<typeof FieldElement>;
|
|
19
|
-
declare const feltToProto: (a: `0x${string}`, overrideOptions?: _effect_schema_AST.ParseOptions) => {
|
|
20
|
-
readonly x0: bigint;
|
|
21
|
-
readonly x1: bigint;
|
|
22
|
-
readonly x2: bigint;
|
|
23
|
-
readonly x3: bigint;
|
|
24
|
-
};
|
|
25
|
-
declare const feltFromProto: (i: {
|
|
26
|
-
readonly x0: bigint;
|
|
27
|
-
readonly x1: bigint;
|
|
28
|
-
readonly x2: bigint;
|
|
29
|
-
readonly x3: bigint;
|
|
30
|
-
}, overrideOptions?: _effect_schema_AST.ParseOptions) => `0x${string}`;
|
|
31
|
-
|
|
32
|
-
export { FieldElement as F, FieldElementProto as a, feltFromProto as b, feltToProto as f };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as _effect_schema_AST from '@effect/schema/AST';
|
|
2
|
-
import { Schema } from '@effect/schema';
|
|
3
|
-
|
|
4
|
-
/** Wire representation of `FieldElement`. */
|
|
5
|
-
declare const FieldElementProto: Schema.Struct<{
|
|
6
|
-
x0: typeof Schema.BigIntFromSelf;
|
|
7
|
-
x1: typeof Schema.BigIntFromSelf;
|
|
8
|
-
x2: typeof Schema.BigIntFromSelf;
|
|
9
|
-
x3: typeof Schema.BigIntFromSelf;
|
|
10
|
-
}>;
|
|
11
|
-
/** Field element. */
|
|
12
|
-
declare const FieldElement: Schema.transform<Schema.Struct<{
|
|
13
|
-
x0: typeof Schema.BigIntFromSelf;
|
|
14
|
-
x1: typeof Schema.BigIntFromSelf;
|
|
15
|
-
x2: typeof Schema.BigIntFromSelf;
|
|
16
|
-
x3: typeof Schema.BigIntFromSelf;
|
|
17
|
-
}>, Schema.SchemaClass<`0x${string}`, `0x${string}`, never>>;
|
|
18
|
-
type FieldElement = Schema.Schema.Type<typeof FieldElement>;
|
|
19
|
-
declare const feltToProto: (a: `0x${string}`, overrideOptions?: _effect_schema_AST.ParseOptions) => {
|
|
20
|
-
readonly x0: bigint;
|
|
21
|
-
readonly x1: bigint;
|
|
22
|
-
readonly x2: bigint;
|
|
23
|
-
readonly x3: bigint;
|
|
24
|
-
};
|
|
25
|
-
declare const feltFromProto: (i: {
|
|
26
|
-
readonly x0: bigint;
|
|
27
|
-
readonly x1: bigint;
|
|
28
|
-
readonly x2: bigint;
|
|
29
|
-
readonly x3: bigint;
|
|
30
|
-
}, overrideOptions?: _effect_schema_AST.ParseOptions) => `0x${string}`;
|
|
31
|
-
|
|
32
|
-
export { FieldElement as F, FieldElementProto as a, feltFromProto as b, feltToProto as f };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as _effect_schema_AST from '@effect/schema/AST';
|
|
2
|
-
import { Schema } from '@effect/schema';
|
|
3
|
-
|
|
4
|
-
/** Wire representation of `FieldElement`. */
|
|
5
|
-
declare const FieldElementProto: Schema.Struct<{
|
|
6
|
-
x0: typeof Schema.BigIntFromSelf;
|
|
7
|
-
x1: typeof Schema.BigIntFromSelf;
|
|
8
|
-
x2: typeof Schema.BigIntFromSelf;
|
|
9
|
-
x3: typeof Schema.BigIntFromSelf;
|
|
10
|
-
}>;
|
|
11
|
-
/** Field element. */
|
|
12
|
-
declare const FieldElement: Schema.transform<Schema.Struct<{
|
|
13
|
-
x0: typeof Schema.BigIntFromSelf;
|
|
14
|
-
x1: typeof Schema.BigIntFromSelf;
|
|
15
|
-
x2: typeof Schema.BigIntFromSelf;
|
|
16
|
-
x3: typeof Schema.BigIntFromSelf;
|
|
17
|
-
}>, Schema.SchemaClass<`0x${string}`, `0x${string}`, never>>;
|
|
18
|
-
type FieldElement = Schema.Schema.Type<typeof FieldElement>;
|
|
19
|
-
declare const feltToProto: (a: `0x${string}`, overrideOptions?: _effect_schema_AST.ParseOptions) => {
|
|
20
|
-
readonly x0: bigint;
|
|
21
|
-
readonly x1: bigint;
|
|
22
|
-
readonly x2: bigint;
|
|
23
|
-
readonly x3: bigint;
|
|
24
|
-
};
|
|
25
|
-
declare const feltFromProto: (i: {
|
|
26
|
-
readonly x0: bigint;
|
|
27
|
-
readonly x1: bigint;
|
|
28
|
-
readonly x2: bigint;
|
|
29
|
-
readonly x3: bigint;
|
|
30
|
-
}, overrideOptions?: _effect_schema_AST.ParseOptions) => `0x${string}`;
|
|
31
|
-
|
|
32
|
-
export { FieldElement as F, FieldElementProto as a, feltFromProto as b, feltToProto as f };
|
package/src/common.test.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { pad } from "viem";
|
|
4
|
-
|
|
5
|
-
import { feltFromProto, feltToProto } from "./common";
|
|
6
|
-
|
|
7
|
-
describe("FieldElement", () => {
|
|
8
|
-
it("should convert to and from proto", () => {
|
|
9
|
-
const felt = "0xcafe0000cafe";
|
|
10
|
-
|
|
11
|
-
const message = feltToProto(felt);
|
|
12
|
-
|
|
13
|
-
expect(message.x0).toBeDefined();
|
|
14
|
-
expect(message.x1).toBeDefined();
|
|
15
|
-
expect(message.x2).toBeDefined();
|
|
16
|
-
expect(message.x3).toBeDefined();
|
|
17
|
-
|
|
18
|
-
const back = feltFromProto(message);
|
|
19
|
-
expect(back).toEqual(pad(felt, { size: 32 }));
|
|
20
|
-
});
|
|
21
|
-
});
|