@apibara/starknet 2.0.0-beta.2 → 2.0.0-beta.4

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/package.json CHANGED
@@ -1,47 +1,18 @@
1
1
  {
2
2
  "name": "@apibara/starknet",
3
- "version": "2.0.0-beta.2",
4
- "description": "Apibara DNA - Starknet types",
5
- "repository": "apibara/typescript-sdk",
6
- "license": "Apache-2.0",
7
- "sideEffects": false,
3
+ "version": "2.0.0-beta.4",
4
+ "type": "module",
8
5
  "source": "./src/index.ts",
9
6
  "main": "./dist/index.mjs",
10
7
  "exports": {
11
8
  ".": {
12
- "import": {
13
- "types": "./dist/index.d.mts",
14
- "default": "./dist/index.mjs"
15
- },
16
- "require": {
17
- "types": "./dist/index.d.cts",
18
- "default": "./dist/index.cjs"
19
- }
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs",
12
+ "default": "./dist/index.mjs"
20
13
  }
21
14
  },
22
- "publishConfig": {
23
- "files": [
24
- "dist",
25
- "src",
26
- "README.md"
27
- ]
28
- },
29
- "dependencies": {
30
- "@effect/schema": "^0.67.15",
31
- "effect": "^3.2.6",
32
- "long": "^5.2.1",
33
- "nice-grpc-common": "^2.0.2",
34
- "protobufjs": "^7.1.2",
35
- "@apibara/protocol": "2.0.0-beta.2"
36
- },
37
- "devDependencies": {
38
- "@bufbuild/buf": "^1.32.1",
39
- "@types/long": "^5.0.0",
40
- "@types/node": "^20.12.12",
41
- "unbuild": "^2.0.0",
42
- "viem": "^2.13.8",
43
- "vitest": "^1.6.0"
44
- },
15
+ "publishConfig": {},
45
16
  "scripts": {
46
17
  "build": "pnpm build:proto && unbuild",
47
18
  "build:proto": "buf generate proto",
@@ -52,5 +23,26 @@
52
23
  "lint:fix": "pnpm lint --write",
53
24
  "format": "biome format . --write"
54
25
  },
26
+ "devDependencies": {
27
+ "@bufbuild/buf": "^1.32.1",
28
+ "@types/long": "^5.0.0",
29
+ "@types/node": "^20.12.12",
30
+ "unbuild": "^2.0.0",
31
+ "viem": "^2.13.8",
32
+ "vitest": "^1.6.0"
33
+ },
34
+ "dependencies": {
35
+ "@apibara/protocol": "2.0.0-beta.4",
36
+ "@effect/schema": "^0.67.15",
37
+ "effect": "^3.2.6",
38
+ "long": "^5.2.1",
39
+ "nice-grpc-common": "^2.0.2",
40
+ "protobufjs": "^7.1.2"
41
+ },
42
+ "files": [
43
+ "dist",
44
+ "src",
45
+ "README.md"
46
+ ],
55
47
  "types": "./dist/index.d.ts"
56
- }
48
+ }
package/src/block.ts CHANGED
@@ -35,16 +35,38 @@ export const L1DataAvailabilityMode = Schema.transform(
35
35
  },
36
36
  );
37
37
 
38
+ export const TransactionStatus = Schema.transform(
39
+ Schema.Enums(proto.data.TransactionStatus),
40
+ Schema.Literal("unknown", "succeeded", "reverted"),
41
+ {
42
+ decode(value) {
43
+ const enumMap = {
44
+ [proto.data.TransactionStatus.SUCCEEDED]: "succeeded",
45
+ [proto.data.TransactionStatus.REVERTED]: "reverted",
46
+ [proto.data.TransactionStatus.UNSPECIFIED]: "unknown",
47
+ [proto.data.TransactionStatus.UNRECOGNIZED]: "unknown",
48
+ } as const;
49
+
50
+ return enumMap[value] ?? "unknown";
51
+ },
52
+ encode(value) {
53
+ throw new Error("encode: not implemented");
54
+ },
55
+ },
56
+ );
57
+
58
+ export type TransactionStatus = typeof TransactionStatus.Type;
59
+
38
60
  export const U128 = Schema.transform(
39
61
  Schema.Struct({
40
- low: Schema.BigIntFromSelf,
41
- high: Schema.BigIntFromSelf,
62
+ x0: Schema.BigIntFromSelf,
63
+ x1: Schema.BigIntFromSelf,
42
64
  }),
43
65
  Schema.BigIntFromSelf,
44
66
  {
45
67
  decode(value) {
46
- const low = value.low.toString(16).padStart(16, "0");
47
- const high = value.high.toString(16).padStart(16, "0");
68
+ const low = value.x0.toString(16).padStart(16, "0");
69
+ const high = value.x1.toString(16).padStart(16, "0");
48
70
  return BigInt(`0x${low}${high}`);
49
71
  },
50
72
  encode(value) {
@@ -117,12 +139,12 @@ export type BlockHeader = typeof BlockHeader.Type;
117
139
  *
118
140
  * @prop transactionIndex The transaction index in the block.
119
141
  * @prop transactionHash The transaction hash.
120
- * @prop transactionReverted Whether the transaction was reverted.
142
+ * @prop transactionStatus The transaction status.
121
143
  */
122
144
  export const TransactionMeta = Schema.Struct({
123
145
  transactionIndex: Schema.optional(Schema.Number),
124
146
  transactionHash: Schema.optional(FieldElement),
125
- transactionReverted: Schema.optional(Schema.Boolean),
147
+ transactionStatus: Schema.optional(TransactionStatus),
126
148
  });
127
149
 
128
150
  export type TransactionMeta = typeof TransactionMeta.Type;
@@ -267,6 +289,7 @@ export const DeployAccountTransactionV3 = Schema.Struct({
267
289
  * @prop meta Transaction metadata.
268
290
  */
269
291
  export const Transaction = Schema.Struct({
292
+ filterIds: Schema.optional(Schema.Array(Schema.Number)),
270
293
  meta: Schema.optional(TransactionMeta),
271
294
  transaction: Schema.optional(
272
295
  Schema.Union(
@@ -395,6 +418,7 @@ export const DeployAccountTransactionReceipt = Schema.Struct({
395
418
  * @prop receipt Transaction-specific receipt.
396
419
  */
397
420
  export const TransactionReceipt = Schema.Struct({
421
+ filterIds: Schema.optional(Schema.Array(Schema.Number)),
398
422
  meta: Schema.optional(TransactionReceiptMeta),
399
423
  receipt: Schema.optional(
400
424
  Schema.Union(
@@ -417,16 +441,17 @@ export type TransactionReceipt = typeof TransactionReceipt.Type;
417
441
  * @prop eventIndex The event index in the block.
418
442
  * @prop transactionIndex The transaction index in the block.
419
443
  * @prop transactionHash The transaction hash.
420
- * @prop transactionReverted Whether the transaction was reverted.
444
+ * @prop transactionStatus The transaction status.
421
445
  */
422
446
  export const Event = Schema.Struct({
423
- fromAddress: Schema.optional(FieldElement),
447
+ filterIds: Schema.optional(Schema.Array(Schema.Number)),
448
+ address: Schema.optional(FieldElement),
424
449
  keys: Schema.optional(Schema.Array(FieldElement)),
425
450
  data: Schema.optional(Schema.Array(FieldElement)),
426
451
  eventIndex: Schema.optional(Schema.Number),
427
452
  transactionIndex: Schema.optional(Schema.Number),
428
453
  transactionHash: Schema.optional(FieldElement),
429
- transactionReverted: Schema.optional(Schema.Boolean),
454
+ transactionStatus: Schema.optional(TransactionStatus),
430
455
  });
431
456
 
432
457
  export type Event = typeof Event.Type;
@@ -439,16 +464,17 @@ export type Event = typeof Event.Type;
439
464
  * @prop messageIndex The message index in the block.
440
465
  * @prop transactionIndex The transaction index in the block.
441
466
  * @prop transactionHash The transaction hash.
442
- * @prop transactionReverted Whether the transaction was reverted.
467
+ * @prop transactionStatus The transaction status.
443
468
  */
444
469
  export const MessageToL1 = Schema.Struct({
470
+ filterIds: Schema.optional(Schema.Array(Schema.Number)),
445
471
  fromAddress: Schema.optional(FieldElement),
446
472
  toAddress: Schema.optional(FieldElement),
447
473
  payload: Schema.optional(Schema.Array(FieldElement)),
448
474
  messageIndex: Schema.optional(Schema.Number),
449
475
  transactionIndex: Schema.optional(Schema.Number),
450
476
  transactionHash: Schema.optional(FieldElement),
451
- transactionReverted: Schema.optional(Schema.Boolean),
477
+ transactionStatus: Schema.optional(TransactionStatus),
452
478
  });
453
479
 
454
480
  export type MessageToL1 = typeof MessageToL1.Type;
@@ -10,10 +10,10 @@ describe("FieldElement", () => {
10
10
 
11
11
  const message = feltToProto(felt);
12
12
 
13
- expect(message.loLo).toBeDefined();
14
- expect(message.loHi).toBeDefined();
15
- expect(message.hiLo).toBeDefined();
16
- expect(message.hiHi).toBeDefined();
13
+ expect(message.x0).toBeDefined();
14
+ expect(message.x1).toBeDefined();
15
+ expect(message.x2).toBeDefined();
16
+ expect(message.x3).toBeDefined();
17
17
 
18
18
  const back = feltFromProto(message);
19
19
  expect(back).toEqual(pad(felt, { size: 32 }));
package/src/common.ts CHANGED
@@ -7,30 +7,30 @@ const _FieldElement = Schema.TemplateLiteral(
7
7
 
8
8
  /** Wire representation of `FieldElement`. */
9
9
  export const FieldElementProto = Schema.Struct({
10
- loLo: Schema.BigIntFromSelf,
11
- loHi: Schema.BigIntFromSelf,
12
- hiLo: Schema.BigIntFromSelf,
13
- hiHi: Schema.BigIntFromSelf,
10
+ x0: Schema.BigIntFromSelf,
11
+ x1: Schema.BigIntFromSelf,
12
+ x2: Schema.BigIntFromSelf,
13
+ x3: Schema.BigIntFromSelf,
14
14
  });
15
15
 
16
16
  /** Field element. */
17
17
  export const FieldElement = Schema.transform(FieldElementProto, _FieldElement, {
18
18
  decode(value) {
19
- const loLo = value.loLo.toString(16).padStart(16, "0");
20
- const loHi = value.loHi.toString(16).padStart(16, "0");
21
- const hiLo = value.hiLo.toString(16).padStart(16, "0");
22
- const hiHi = value.hiHi.toString(16).padStart(16, "0");
23
- return `0x${loLo}${loHi}${hiLo}${hiHi}` as `0x${string}`;
19
+ const x0 = value.x0.toString(16).padStart(16, "0");
20
+ const x1 = value.x1.toString(16).padStart(16, "0");
21
+ const x2 = value.x2.toString(16).padStart(16, "0");
22
+ const x3 = value.x3.toString(16).padStart(16, "0");
23
+ return `0x${x0}${x1}${x2}${x3}` as `0x${string}`;
24
24
  },
25
25
  encode(value) {
26
26
  const bn = BigInt(value);
27
27
  const hex = bn.toString(16).padStart(64, "0");
28
28
  const s = hex.length;
29
- const hiHi = BigInt(`0x${hex.slice(s - 16, s)}`);
30
- const hiLo = BigInt(`0x${hex.slice(s - 32, s - 16)}`);
31
- const loHi = BigInt(`0x${hex.slice(s - 48, s - 32)}`);
32
- const loLo = BigInt(`0x${hex.slice(s - 64, s - 48)}`);
33
- return { loLo, loHi, hiLo, hiHi };
29
+ const x3 = BigInt(`0x${hex.slice(s - 16, s)}`);
30
+ const x2 = BigInt(`0x${hex.slice(s - 32, s - 16)}`);
31
+ const x1 = BigInt(`0x${hex.slice(s - 48, s - 32)}`);
32
+ const x0 = BigInt(`0x${hex.slice(s - 64, s - 48)}`);
33
+ return { x0, x1, x2, x3 };
34
34
  },
35
35
  });
36
36
 
@@ -42,10 +42,10 @@ describe("Key", () => {
42
42
  expect(proto).toMatchInlineSnapshot(`
43
43
  {
44
44
  "value": {
45
- "hiHi": 4660n,
46
- "hiLo": 0n,
47
- "loHi": 0n,
48
- "loLo": 0n,
45
+ "x0": 0n,
46
+ "x1": 0n,
47
+ "x2": 0n,
48
+ "x3": 4660n,
49
49
  },
50
50
  }
51
51
  `);
@@ -69,7 +69,7 @@ describe("EventFilter", () => {
69
69
 
70
70
  it("should encode and decode all values", () => {
71
71
  const proto = encode({
72
- fromAddress: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
72
+ address: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
73
73
  keys: [
74
74
  "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
75
75
  null,
@@ -77,7 +77,7 @@ describe("EventFilter", () => {
77
77
  "0xCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC",
78
78
  ],
79
79
  strict: true,
80
- includeReverted: true,
80
+ transactionStatus: "all",
81
81
  includeTransaction: true,
82
82
  includeReceipt: true,
83
83
  includeMessages: true,
@@ -85,24 +85,23 @@ describe("EventFilter", () => {
85
85
  });
86
86
  expect(proto).toMatchInlineSnapshot(`
87
87
  {
88
- "fromAddress": {
89
- "hiHi": 12297829382473034410n,
90
- "hiLo": 12297829382473034410n,
91
- "loHi": 170n,
92
- "loLo": 0n,
88
+ "address": {
89
+ "x0": 0n,
90
+ "x1": 170n,
91
+ "x2": 12297829382473034410n,
92
+ "x3": 12297829382473034410n,
93
93
  },
94
94
  "includeMessages": true,
95
95
  "includeReceipt": true,
96
- "includeReverted": true,
97
96
  "includeSiblings": true,
98
97
  "includeTransaction": true,
99
98
  "keys": [
100
99
  {
101
100
  "value": {
102
- "hiHi": 13527612320720337851n,
103
- "hiLo": 13527612320720337851n,
104
- "loHi": 187n,
105
- "loLo": 0n,
101
+ "x0": 0n,
102
+ "x1": 187n,
103
+ "x2": 13527612320720337851n,
104
+ "x3": 13527612320720337851n,
106
105
  },
107
106
  },
108
107
  {
@@ -113,23 +112,23 @@ describe("EventFilter", () => {
113
112
  },
114
113
  {
115
114
  "value": {
116
- "hiHi": 14757395258967641292n,
117
- "hiLo": 14757395258967641292n,
118
- "loHi": 0n,
119
- "loLo": 0n,
115
+ "x0": 0n,
116
+ "x1": 0n,
117
+ "x2": 14757395258967641292n,
118
+ "x3": 14757395258967641292n,
120
119
  },
121
120
  },
122
121
  ],
123
122
  "strict": true,
123
+ "transactionStatus": 3,
124
124
  }
125
125
  `);
126
126
  const decoded = decode(proto);
127
127
  expect(decoded).toMatchInlineSnapshot(`
128
128
  {
129
- "fromAddress": "0x000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
129
+ "address": "0x000000000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
130
130
  "includeMessages": true,
131
131
  "includeReceipt": true,
132
- "includeReverted": true,
133
132
  "includeSiblings": true,
134
133
  "includeTransaction": true,
135
134
  "keys": [
@@ -139,6 +138,7 @@ describe("EventFilter", () => {
139
138
  "0x00000000000000000000000000000000cccccccccccccccccccccccccccccccc",
140
139
  ],
141
140
  "strict": true,
141
+ "transactionStatus": "all",
142
142
  }
143
143
  `);
144
144
  });
@@ -160,14 +160,14 @@ describe("TransactionFilter", () => {
160
160
  includeEvents: true,
161
161
  includeMessages: true,
162
162
  includeReceipt: true,
163
- includeReverted: true,
163
+ transactionStatus: "reverted",
164
164
  });
165
165
  expect(proto).toMatchInlineSnapshot(`
166
166
  {
167
167
  "includeEvents": true,
168
168
  "includeMessages": true,
169
169
  "includeReceipt": true,
170
- "includeReverted": true,
170
+ "transactionStatus": 2,
171
171
  }
172
172
  `);
173
173
  const decoded = decode(proto);
@@ -176,7 +176,7 @@ describe("TransactionFilter", () => {
176
176
  "includeEvents": true,
177
177
  "includeMessages": true,
178
178
  "includeReceipt": true,
179
- "includeReverted": true,
179
+ "transactionStatus": "reverted",
180
180
  }
181
181
  `);
182
182
  });
@@ -540,17 +540,17 @@ describe("mergeFilter", () => {
540
540
 
541
541
  it("concatenates events", () => {
542
542
  const f = mergeFilter(
543
- { events: [{ fromAddress: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }] },
544
- { events: [{ fromAddress: "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" }] },
543
+ { events: [{ address: "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" }] },
544
+ { events: [{ address: "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" }] },
545
545
  );
546
546
  expect(f).toMatchInlineSnapshot(`
547
547
  {
548
548
  "events": [
549
549
  {
550
- "fromAddress": "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
550
+ "address": "0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
551
551
  },
552
552
  {
553
- "fromAddress": "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
553
+ "address": "0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
554
554
  },
555
555
  ],
556
556
  "header": undefined,
package/src/filter.ts CHANGED
@@ -36,24 +36,55 @@ export const Key = Schema.transform(
36
36
 
37
37
  export type Key = typeof Key.Type;
38
38
 
39
+ export const TransactionStatusFilter = Schema.transform(
40
+ Schema.Enums(proto.filter.TransactionStatusFilter),
41
+ Schema.Literal("succeeded", "reverted", "all", "unknown"),
42
+ {
43
+ decode(value) {
44
+ const enumMap = {
45
+ [proto.filter.TransactionStatusFilter.SUCCEEDED]: "succeeded",
46
+ [proto.filter.TransactionStatusFilter.REVERTED]: "reverted",
47
+ [proto.filter.TransactionStatusFilter.ALL]: "all",
48
+ [proto.filter.TransactionStatusFilter.UNSPECIFIED]: "unknown",
49
+ [proto.filter.TransactionStatusFilter.UNRECOGNIZED]: "unknown",
50
+ } as const;
51
+ return enumMap[value] ?? "unknown";
52
+ },
53
+ encode(value) {
54
+ switch (value) {
55
+ case "succeeded":
56
+ return proto.filter.TransactionStatusFilter.SUCCEEDED;
57
+ case "reverted":
58
+ return proto.filter.TransactionStatusFilter.REVERTED;
59
+ case "all":
60
+ return proto.filter.TransactionStatusFilter.ALL;
61
+ default:
62
+ return proto.filter.TransactionStatusFilter.UNSPECIFIED;
63
+ }
64
+ },
65
+ },
66
+ );
67
+
68
+ export type TransactionStatusFilter = typeof TransactionStatusFilter.Type;
69
+
39
70
  /** Filter events.
40
71
  *
41
- * @prop fromAddress Filter events by the sender address.
72
+ * @prop address Filter events by the sender address.
42
73
  * @prop keys Filter events by the event keys. Use `null` to match any key.
43
74
  * @prop strict If `true`, then the filter will only match events that have exactly the
44
75
  * same number of keys as specified in `keys`.
45
- * @prop includeReverted Include events from reverted transactions. In most
46
- * cases, this will be the fee payment Transfer event.
76
+ * @prop transactionStatus Filter based on the transaction status.
47
77
  * @prop includeTransaction Include the transaction that emitted the event.
48
78
  * @prop includeReceipt Include the transaction receipt.
49
79
  * @prop includeMessages Include the messages that were sent to L1 in the same transaction.
50
80
  * @prop includeSiblings Include the sibling events of the matched events.
51
81
  */
52
82
  export const EventFilter = Schema.Struct({
53
- fromAddress: Schema.optional(FieldElement),
83
+ id: Schema.optional(Schema.Number),
84
+ address: Schema.optional(FieldElement),
54
85
  keys: Schema.optional(Schema.Array(Key)),
55
86
  strict: Schema.optional(Schema.Boolean),
56
- includeReverted: Schema.optional(Schema.Boolean),
87
+ transactionStatus: Schema.optional(TransactionStatusFilter),
57
88
  includeTransaction: Schema.optional(Schema.Boolean),
58
89
  includeReceipt: Schema.optional(Schema.Boolean),
59
90
  includeMessages: Schema.optional(Schema.Boolean),
@@ -66,15 +97,16 @@ export type EventFilter = typeof EventFilter.Type;
66
97
  *
67
98
  * @prop fromAddress Filter messages by the sender address (on L2).
68
99
  * @prop toAddress Filter messages by the recipient address (on L1).
69
- * @prop includeReverted Include messages from reverted transactions.
100
+ * @prop transactionStatus Filter based on the transaction status.
70
101
  * @prop includeTransaction Include the transaction that sent the message.
71
102
  * @prop includeReceipt Include the transaction receipt.
72
103
  * @prop includeEvents Include events from the same transaction.
73
104
  */
74
105
  export const MessageToL1Filter = Schema.Struct({
106
+ id: Schema.optional(Schema.Number),
75
107
  fromAddress: Schema.optional(FieldElement),
76
108
  toAddress: Schema.optional(FieldElement),
77
- includeReverted: Schema.optional(Schema.Boolean),
109
+ transactionStatus: Schema.optional(TransactionStatusFilter),
78
110
  includeTransaction: Schema.optional(Schema.Boolean),
79
111
  includeReceipt: Schema.optional(Schema.Boolean),
80
112
  includeEvents: Schema.optional(Schema.Boolean),
@@ -139,13 +171,14 @@ export const DeployAccountV3TransactionFilter = Schema.Struct({
139
171
 
140
172
  /** Filter transactions.
141
173
  *
142
- * @prop includeReverted Include messages from reverted transactions.
174
+ * @prop transactionStatus Filter based on the transaction status.
143
175
  * @prop includeReceipt Include the transaction receipt.
144
176
  * @prop includeEvents Include events from the same transaction.
145
177
  * @prop includeMessages Include messages sent in the transaction.
146
178
  */
147
179
  export const TransactionFilter = Schema.Struct({
148
- includeReverted: Schema.optional(Schema.Boolean),
180
+ id: Schema.optional(Schema.Number),
181
+ transactionStatus: Schema.optional(TransactionStatusFilter),
149
182
  includeReceipt: Schema.optional(Schema.Boolean),
150
183
  includeMessages: Schema.optional(Schema.Boolean),
151
184
  includeEvents: Schema.optional(Schema.Boolean),
@@ -12,41 +12,41 @@ export const protobufPackage = "starknet.v2";
12
12
 
13
13
  /** A field element. */
14
14
  export interface FieldElement {
15
- readonly loLo?: bigint | undefined;
16
- readonly loHi?: bigint | undefined;
17
- readonly hiLo?: bigint | undefined;
18
- readonly hiHi?: bigint | undefined;
15
+ readonly x0?: bigint | undefined;
16
+ readonly x1?: bigint | undefined;
17
+ readonly x2?: bigint | undefined;
18
+ readonly x3?: bigint | undefined;
19
19
  }
20
20
 
21
21
  function createBaseFieldElement(): FieldElement {
22
- return { loLo: BigInt("0"), loHi: BigInt("0"), hiLo: BigInt("0"), hiHi: BigInt("0") };
22
+ return { x0: BigInt("0"), x1: BigInt("0"), x2: BigInt("0"), x3: BigInt("0") };
23
23
  }
24
24
 
25
25
  export const FieldElement = {
26
26
  encode(message: FieldElement, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
27
- if (message.loLo !== undefined && message.loLo !== BigInt("0")) {
28
- if (BigInt.asUintN(64, message.loLo) !== message.loLo) {
29
- throw new globalThis.Error("value provided for field message.loLo of type fixed64 too large");
27
+ if (message.x0 !== undefined && message.x0 !== BigInt("0")) {
28
+ if (BigInt.asUintN(64, message.x0) !== message.x0) {
29
+ throw new globalThis.Error("value provided for field message.x0 of type fixed64 too large");
30
30
  }
31
- writer.uint32(9).fixed64(message.loLo.toString());
31
+ writer.uint32(9).fixed64(message.x0.toString());
32
32
  }
33
- if (message.loHi !== undefined && message.loHi !== BigInt("0")) {
34
- if (BigInt.asUintN(64, message.loHi) !== message.loHi) {
35
- throw new globalThis.Error("value provided for field message.loHi of type fixed64 too large");
33
+ if (message.x1 !== undefined && message.x1 !== BigInt("0")) {
34
+ if (BigInt.asUintN(64, message.x1) !== message.x1) {
35
+ throw new globalThis.Error("value provided for field message.x1 of type fixed64 too large");
36
36
  }
37
- writer.uint32(17).fixed64(message.loHi.toString());
37
+ writer.uint32(17).fixed64(message.x1.toString());
38
38
  }
39
- if (message.hiLo !== undefined && message.hiLo !== BigInt("0")) {
40
- if (BigInt.asUintN(64, message.hiLo) !== message.hiLo) {
41
- throw new globalThis.Error("value provided for field message.hiLo of type fixed64 too large");
39
+ if (message.x2 !== undefined && message.x2 !== BigInt("0")) {
40
+ if (BigInt.asUintN(64, message.x2) !== message.x2) {
41
+ throw new globalThis.Error("value provided for field message.x2 of type fixed64 too large");
42
42
  }
43
- writer.uint32(25).fixed64(message.hiLo.toString());
43
+ writer.uint32(25).fixed64(message.x2.toString());
44
44
  }
45
- if (message.hiHi !== undefined && message.hiHi !== BigInt("0")) {
46
- if (BigInt.asUintN(64, message.hiHi) !== message.hiHi) {
47
- throw new globalThis.Error("value provided for field message.hiHi of type fixed64 too large");
45
+ if (message.x3 !== undefined && message.x3 !== BigInt("0")) {
46
+ if (BigInt.asUintN(64, message.x3) !== message.x3) {
47
+ throw new globalThis.Error("value provided for field message.x3 of type fixed64 too large");
48
48
  }
49
- writer.uint32(33).fixed64(message.hiHi.toString());
49
+ writer.uint32(33).fixed64(message.x3.toString());
50
50
  }
51
51
  return writer;
52
52
  },
@@ -63,28 +63,28 @@ export const FieldElement = {
63
63
  break;
64
64
  }
65
65
 
66
- message.loLo = longToBigint(reader.fixed64() as Long);
66
+ message.x0 = longToBigint(reader.fixed64() as Long);
67
67
  continue;
68
68
  case 2:
69
69
  if (tag !== 17) {
70
70
  break;
71
71
  }
72
72
 
73
- message.loHi = longToBigint(reader.fixed64() as Long);
73
+ message.x1 = longToBigint(reader.fixed64() as Long);
74
74
  continue;
75
75
  case 3:
76
76
  if (tag !== 25) {
77
77
  break;
78
78
  }
79
79
 
80
- message.hiLo = longToBigint(reader.fixed64() as Long);
80
+ message.x2 = longToBigint(reader.fixed64() as Long);
81
81
  continue;
82
82
  case 4:
83
83
  if (tag !== 33) {
84
84
  break;
85
85
  }
86
86
 
87
- message.hiHi = longToBigint(reader.fixed64() as Long);
87
+ message.x3 = longToBigint(reader.fixed64() as Long);
88
88
  continue;
89
89
  }
90
90
  if ((tag & 7) === 4 || tag === 0) {
@@ -97,26 +97,26 @@ export const FieldElement = {
97
97
 
98
98
  fromJSON(object: any): FieldElement {
99
99
  return {
100
- loLo: isSet(object.loLo) ? BigInt(object.loLo) : BigInt("0"),
101
- loHi: isSet(object.loHi) ? BigInt(object.loHi) : BigInt("0"),
102
- hiLo: isSet(object.hiLo) ? BigInt(object.hiLo) : BigInt("0"),
103
- hiHi: isSet(object.hiHi) ? BigInt(object.hiHi) : BigInt("0"),
100
+ x0: isSet(object.x0) ? BigInt(object.x0) : BigInt("0"),
101
+ x1: isSet(object.x1) ? BigInt(object.x1) : BigInt("0"),
102
+ x2: isSet(object.x2) ? BigInt(object.x2) : BigInt("0"),
103
+ x3: isSet(object.x3) ? BigInt(object.x3) : BigInt("0"),
104
104
  };
105
105
  },
106
106
 
107
107
  toJSON(message: FieldElement): unknown {
108
108
  const obj: any = {};
109
- if (message.loLo !== undefined && message.loLo !== BigInt("0")) {
110
- obj.loLo = message.loLo.toString();
109
+ if (message.x0 !== undefined && message.x0 !== BigInt("0")) {
110
+ obj.x0 = message.x0.toString();
111
111
  }
112
- if (message.loHi !== undefined && message.loHi !== BigInt("0")) {
113
- obj.loHi = message.loHi.toString();
112
+ if (message.x1 !== undefined && message.x1 !== BigInt("0")) {
113
+ obj.x1 = message.x1.toString();
114
114
  }
115
- if (message.hiLo !== undefined && message.hiLo !== BigInt("0")) {
116
- obj.hiLo = message.hiLo.toString();
115
+ if (message.x2 !== undefined && message.x2 !== BigInt("0")) {
116
+ obj.x2 = message.x2.toString();
117
117
  }
118
- if (message.hiHi !== undefined && message.hiHi !== BigInt("0")) {
119
- obj.hiHi = message.hiHi.toString();
118
+ if (message.x3 !== undefined && message.x3 !== BigInt("0")) {
119
+ obj.x3 = message.x3.toString();
120
120
  }
121
121
  return obj;
122
122
  },
@@ -126,10 +126,10 @@ export const FieldElement = {
126
126
  },
127
127
  fromPartial(object: DeepPartial<FieldElement>): FieldElement {
128
128
  const message = createBaseFieldElement() as any;
129
- message.loLo = object.loLo ?? BigInt("0");
130
- message.loHi = object.loHi ?? BigInt("0");
131
- message.hiLo = object.hiLo ?? BigInt("0");
132
- message.hiHi = object.hiHi ?? BigInt("0");
129
+ message.x0 = object.x0 ?? BigInt("0");
130
+ message.x1 = object.x1 ?? BigInt("0");
131
+ message.x2 = object.x2 ?? BigInt("0");
132
+ message.x3 = object.x3 ?? BigInt("0");
133
133
  return message;
134
134
  },
135
135
  };