@apibara/indexer 0.2.4 → 0.3.0

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.
@@ -24,6 +24,8 @@ export type BlockHeader = {
24
24
  newRoot: FieldElement;
25
25
  /** Block production timestamp. */
26
26
  timestamp: string;
27
+ /** Price of L1 gas in the block. */
28
+ l1GasPrice?: ResourcePrice;
27
29
  };
28
30
  export type TransactionWithReceipt = {
29
31
  /** Transaction. */
@@ -45,7 +47,7 @@ export type L2ToL1MessageWithTransaction = {
45
47
  /** Message from L2 to L1. */
46
48
  message: L2ToL1Message;
47
49
  };
48
- export type Transaction = TransactionCommon & (InvokeTransactionV0 | InvokeTransactionV1 | DeployTransaction | DeclareTransaction | DeployAccountTransaction | L1HandlerTransaction);
50
+ export type Transaction = TransactionCommon & (InvokeTransactionV0 | InvokeTransactionV1 | InvokeTransactionV3 | DeployTransaction | DeclareTransaction | DeclareTransactionV3 | DeployAccountTransaction | DeployAccountTransactionV3 | L1HandlerTransaction);
49
51
  export type TransactionCommon = {
50
52
  meta: TransactionMeta;
51
53
  };
@@ -60,6 +62,18 @@ export type TransactionMeta = {
60
62
  nonce: FieldElement;
61
63
  /** Transaction version. */
62
64
  version: string;
65
+ /** Transaction resources. */
66
+ resourceBounds?: ResourceBoundsMapping;
67
+ /** Tip to the sequencer. */
68
+ tip?: number;
69
+ /** Data passed to the paymaster. */
70
+ paymasterData?: FieldElement[];
71
+ /** Account nonce's DA. */
72
+ nonceDataAvailabilityMode?: DataAvailabilityMode;
73
+ /** Transaction's DA. */
74
+ feeDataAvailabilityMode?: DataAvailabilityMode;
75
+ /** Transaction index in the block. */
76
+ transactionIndex?: number;
63
77
  };
64
78
  export type InvokeTransactionV0 = {
65
79
  invokeV0?: {
@@ -71,10 +85,13 @@ export type InvokeTransactionV0 = {
71
85
  calldata: FieldElement[];
72
86
  };
73
87
  invokeV1?: never;
88
+ invokeV3?: never;
74
89
  deploy?: never;
75
90
  declare?: never;
91
+ declareV3?: never;
76
92
  l1Handler?: never;
77
93
  deployAccount?: never;
94
+ deployAccountV3?: never;
78
95
  };
79
96
  export type InvokeTransactionV1 = {
80
97
  invokeV1?: {
@@ -84,10 +101,31 @@ export type InvokeTransactionV1 = {
84
101
  calldata: FieldElement[];
85
102
  };
86
103
  invokeV0?: never;
104
+ invokeV3?: never;
87
105
  deploy?: never;
88
106
  declare?: never;
107
+ declareV3?: never;
89
108
  l1Handler?: never;
90
109
  deployAccount?: never;
110
+ deployAccountV3?: never;
111
+ };
112
+ export type InvokeTransactionV3 = {
113
+ invokeV3?: {
114
+ /** Address of the account sending the transaction. */
115
+ senderAddress: FieldElement;
116
+ /** Calldata. */
117
+ calldata: FieldElement[];
118
+ /** Data passed to the account deployment. */
119
+ accountDeploymentData: FieldElement[];
120
+ };
121
+ invokeV1?: never;
122
+ invokeV0?: never;
123
+ deploy?: never;
124
+ declare?: never;
125
+ declareV3?: never;
126
+ l1Handler?: never;
127
+ deployAccount?: never;
128
+ deployAccountV3?: never;
91
129
  };
92
130
  export type DeployTransaction = {
93
131
  deploy?: {
@@ -100,9 +138,12 @@ export type DeployTransaction = {
100
138
  };
101
139
  invokeV0?: never;
102
140
  invokeV1?: never;
141
+ invokeV3?: never;
103
142
  declare?: never;
143
+ declareV3?: never;
104
144
  l1Handler?: never;
105
145
  deployAccount?: never;
146
+ deployAccountV3?: never;
106
147
  };
107
148
  export type DeclareTransaction = {
108
149
  declare?: {
@@ -113,9 +154,32 @@ export type DeclareTransaction = {
113
154
  /** Hash of the cairo assembly resulting from the sierra compilation. */
114
155
  compiledClassHash: FieldElement;
115
156
  };
157
+ declareV3?: never;
158
+ invokeV0?: never;
159
+ invokeV1?: never;
160
+ invokeV3?: never;
161
+ deploy?: never;
162
+ l1Handler?: never;
163
+ deployAccount?: never;
164
+ deployAccountV3?: never;
165
+ };
166
+ export type DeclareTransactionV3 = {
167
+ declareV3?: {
168
+ /** Class hash. */
169
+ classHash: FieldElement;
170
+ /** Address of the account sending the transaction. */
171
+ senderAddress: FieldElement;
172
+ /** Hash of the cairo assembly resulting from the sierra compilation. */
173
+ compiledClassHash: FieldElement;
174
+ /** Data passed to the account deployment. */
175
+ accountDeploymentData: FieldElement[];
176
+ };
177
+ declare?: never;
116
178
  invokeV0?: never;
117
179
  invokeV1?: never;
180
+ invokeV3?: never;
118
181
  deploy?: never;
182
+ deployAccountV3?: never;
119
183
  l1Handler?: never;
120
184
  deployAccount?: never;
121
185
  };
@@ -128,10 +192,31 @@ export type DeployAccountTransaction = {
128
192
  /** Hash of the class being deployed. */
129
193
  classHash: FieldElement;
130
194
  };
195
+ deployAccountV3?: never;
196
+ invokeV0?: never;
197
+ invokeV1?: never;
198
+ invokeV3?: never;
199
+ deploy?: never;
200
+ declare?: never;
201
+ declareV3?: never;
202
+ l1Handler?: never;
203
+ };
204
+ export type DeployAccountTransactionV3 = {
205
+ deployAccountV3?: {
206
+ /** Constructor calldata. */
207
+ constructorCalldata: FieldElement[];
208
+ /** Salt used when computing the contract's address. */
209
+ contractAddressSalt: FieldElement;
210
+ /** Hash of the class being deployed. */
211
+ classHash: FieldElement;
212
+ };
213
+ deployAccount?: never;
131
214
  invokeV0?: never;
132
215
  invokeV1?: never;
216
+ invokeV3?: never;
133
217
  deploy?: never;
134
218
  declare?: never;
219
+ declareV3?: never;
135
220
  l1Handler?: never;
136
221
  };
137
222
  export type L1HandlerTransaction = {
@@ -145,8 +230,10 @@ export type L1HandlerTransaction = {
145
230
  };
146
231
  invokeV0?: never;
147
232
  invokeV1?: never;
233
+ invokeV3?: never;
148
234
  deploy?: never;
149
235
  declare?: never;
236
+ declareV3?: never;
150
237
  deployAccount?: never;
151
238
  };
152
239
  export type TransactionReceipt = {
@@ -250,3 +337,21 @@ export type NonceUpdate = {
250
337
  /** New nonce. */
251
338
  nonce: FieldElement;
252
339
  };
340
+ export type ResourcePrice = {
341
+ /** Price in fri (10^-18 strk). */
342
+ priceInFri: FieldElement;
343
+ /** Price in wei (10^-18 eth). */
344
+ priceInWei: FieldElement;
345
+ };
346
+ export type ResourceBoundsMapping = {
347
+ l1Gas: ResourceBounds;
348
+ l2Gas: ResourceBounds;
349
+ };
350
+ export type ResourceBounds = {
351
+ maxAmount: number;
352
+ maxPricePerUnit: {
353
+ low: number;
354
+ high: number;
355
+ };
356
+ };
357
+ export type DataAvailabilityMode = "DATA_AVAILABILITY_MODE_UNSPECIFIED" | "DATA_AVAILABILITY_MODE_L2" | "DATA_AVAILABILITY_MODE_L1";
@@ -1 +1 @@
1
- {"version":3,"file":"block.test-d.js","sourceRoot":"","sources":["../../src/starknet/block.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,OAAO,GACX,oEAAoE,CAAC;AACvE,MAAM,kBAAkB,GACtB,oEAAoE,CAAC;AACvE,MAAM,QAAQ,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1E,MAAM,IAAI,GAAG;IACX,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;IAClC,SAAS,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,GAAG;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG;IACf,eAAe,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5C,kBAAkB,EAAE,YAAY,CAAC,KAAK,CAAC,kBAAkB,CAAC;IAC1D,QAAQ;CACT,CAAC;AAEF,MAAM,QAAQ,GAAG;IACf,aAAa,EAAE,YAAY,CAA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L,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -20,7 +20,7 @@ export class Contract {
20
20
  this.selectorToEvent = {};
21
21
  for (const event of this.abi) {
22
22
  if (event.type !== "event") {
23
- return;
23
+ continue;
24
24
  }
25
25
  this.selectorToEvent[getSelector(event.name)] = event.name;
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/starknet/parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGnD,iDAAiD;AACjD,MAAM,OAAO,QAAQ;IACnB,+DAA+D;IACtD,OAAO,CAAe;IACtB,GAAG,CAAM;IAEV,eAAe,CAA+B;IAEtD,YAAY,eAA6B,EAAE,WAAgB;QACzD,IAAI,CAAC,OAAO,GAAG,eAAe,CAAC;QAC/B,IAAI,CAAC,GAAG,GAAG,WAAW,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAClC,CAAC;IAEO,UAAU,CAAC,IAAY;QAC7B,wDAAwD;QACxD,MAAM,KAAK,GAAyB,IAAI,CAAC,GAAG,CAAC,IAAI,CAC/C,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CACtD,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,wBAAwB;QAC9B,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE;YAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC1B,OAAO;aACR;YACD,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;SAC5D;IACH,CAAC;IAED,iEAAiE;IACjE,WA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K,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CACtD,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,wBAAwB;QAC9B,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE;YAC5B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;gBAC1B,SAAS;aACV;YACD,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;SAC5D;IACH,CAAC;IAED,iEAAiE;IACjE,WAAW,CACT,IAAY,EACZ,OAGI,EAAE;QAEN,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEpC,sDAAsD;QACtD,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,4BAA4B,CAAC,CAAC;SAC5D;QAED,0BAA0B;QAC1B,OAAO;YACL,WAAW,EAAE,IAAI,CAAC,OAAO;YACzB,IAAI,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,IAAI,KAAK;YACpD,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,KAAK;YAC5C,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,KAAK;SAC/C,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,uBAAuB,CAAC,QAAsB;QAC5C,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apibara/indexer",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  import { assertType, describe, test } from "vitest";
2
2
 
3
- import { Block, BlockHeader, Transaction } from "./block";
3
+ import { Block, BlockHeader, Transaction, TransactionMeta } from "./block";
4
4
  import { FieldElement } from "./felt";
5
5
 
6
6
  const address =
@@ -8,7 +8,7 @@ const address =
8
8
  const entryPointSelector =
9
9
  "0x03943907ef0ef6f9d2e2408b05e520a66daaf74293dbf665e5a20b117676170e";
10
10
  const calldata = [FieldElement.parse("0x01"), FieldElement.parse("0x02")];
11
- const meta = {
11
+ const meta: TransactionMeta = {
12
12
  hash: FieldElement.parse("0x01"),
13
13
  maxFee: FieldElement.parse("0x02"),
14
14
  signature: [FieldElement.parse("0x03")],
@@ -26,6 +26,8 @@ export type BlockHeader = {
26
26
  newRoot: FieldElement;
27
27
  /** Block production timestamp. */
28
28
  timestamp: string;
29
+ /** Price of L1 gas in the block. */
30
+ l1GasPrice?: ResourcePrice;
29
31
  };
30
32
 
31
33
  export type TransactionWithReceipt = {
@@ -55,9 +57,12 @@ export type Transaction = TransactionCommon &
55
57
  (
56
58
  | InvokeTransactionV0
57
59
  | InvokeTransactionV1
60
+ | InvokeTransactionV3
58
61
  | DeployTransaction
59
62
  | DeclareTransaction
63
+ | DeclareTransactionV3
60
64
  | DeployAccountTransaction
65
+ | DeployAccountTransactionV3
61
66
  | L1HandlerTransaction
62
67
  );
63
68
 
@@ -76,6 +81,18 @@ export type TransactionMeta = {
76
81
  nonce: FieldElement;
77
82
  /** Transaction version. */
78
83
  version: string;
84
+ /** Transaction resources. */
85
+ resourceBounds?: ResourceBoundsMapping;
86
+ /** Tip to the sequencer. */
87
+ tip?: number;
88
+ /** Data passed to the paymaster. */
89
+ paymasterData?: FieldElement[];
90
+ /** Account nonce's DA. */
91
+ nonceDataAvailabilityMode?: DataAvailabilityMode;
92
+ /** Transaction's DA. */
93
+ feeDataAvailabilityMode?: DataAvailabilityMode;
94
+ /** Transaction index in the block. */
95
+ transactionIndex?: number;
79
96
  };
80
97
 
81
98
  export type InvokeTransactionV0 = {
@@ -88,10 +105,13 @@ export type InvokeTransactionV0 = {
88
105
  calldata: FieldElement[];
89
106
  };
90
107
  invokeV1?: never;
108
+ invokeV3?: never;
91
109
  deploy?: never;
92
110
  declare?: never;
111
+ declareV3?: never;
93
112
  l1Handler?: never;
94
113
  deployAccount?: never;
114
+ deployAccountV3?: never;
95
115
  };
96
116
 
97
117
  export type InvokeTransactionV1 = {
@@ -102,10 +122,32 @@ export type InvokeTransactionV1 = {
102
122
  calldata: FieldElement[];
103
123
  };
104
124
  invokeV0?: never;
125
+ invokeV3?: never;
105
126
  deploy?: never;
106
127
  declare?: never;
128
+ declareV3?: never;
107
129
  l1Handler?: never;
108
130
  deployAccount?: never;
131
+ deployAccountV3?: never;
132
+ };
133
+
134
+ export type InvokeTransactionV3 = {
135
+ invokeV3?: {
136
+ /** Address of the account sending the transaction. */
137
+ senderAddress: FieldElement;
138
+ /** Calldata. */
139
+ calldata: FieldElement[];
140
+ /** Data passed to the account deployment. */
141
+ accountDeploymentData: FieldElement[];
142
+ };
143
+ invokeV1?: never;
144
+ invokeV0?: never;
145
+ deploy?: never;
146
+ declare?: never;
147
+ declareV3?: never;
148
+ l1Handler?: never;
149
+ deployAccount?: never;
150
+ deployAccountV3?: never;
109
151
  };
110
152
 
111
153
  export type DeployTransaction = {
@@ -119,9 +161,12 @@ export type DeployTransaction = {
119
161
  };
120
162
  invokeV0?: never;
121
163
  invokeV1?: never;
164
+ invokeV3?: never;
122
165
  declare?: never;
166
+ declareV3?: never;
123
167
  l1Handler?: never;
124
168
  deployAccount?: never;
169
+ deployAccountV3?: never;
125
170
  };
126
171
 
127
172
  export type DeclareTransaction = {
@@ -133,9 +178,33 @@ export type DeclareTransaction = {
133
178
  /** Hash of the cairo assembly resulting from the sierra compilation. */
134
179
  compiledClassHash: FieldElement;
135
180
  };
181
+ declareV3?: never;
182
+ invokeV0?: never;
183
+ invokeV1?: never;
184
+ invokeV3?: never;
185
+ deploy?: never;
186
+ l1Handler?: never;
187
+ deployAccount?: never;
188
+ deployAccountV3?: never;
189
+ };
190
+
191
+ export type DeclareTransactionV3 = {
192
+ declareV3?: {
193
+ /** Class hash. */
194
+ classHash: FieldElement;
195
+ /** Address of the account sending the transaction. */
196
+ senderAddress: FieldElement;
197
+ /** Hash of the cairo assembly resulting from the sierra compilation. */
198
+ compiledClassHash: FieldElement;
199
+ /** Data passed to the account deployment. */
200
+ accountDeploymentData: FieldElement[];
201
+ };
202
+ declare?: never;
136
203
  invokeV0?: never;
137
204
  invokeV1?: never;
205
+ invokeV3?: never;
138
206
  deploy?: never;
207
+ deployAccountV3?: never;
139
208
  l1Handler?: never;
140
209
  deployAccount?: never;
141
210
  };
@@ -149,10 +218,32 @@ export type DeployAccountTransaction = {
149
218
  /** Hash of the class being deployed. */
150
219
  classHash: FieldElement;
151
220
  };
221
+ deployAccountV3?: never;
152
222
  invokeV0?: never;
153
223
  invokeV1?: never;
224
+ invokeV3?: never;
154
225
  deploy?: never;
155
226
  declare?: never;
227
+ declareV3?: never;
228
+ l1Handler?: never;
229
+ };
230
+
231
+ export type DeployAccountTransactionV3 = {
232
+ deployAccountV3?: {
233
+ /** Constructor calldata. */
234
+ constructorCalldata: FieldElement[];
235
+ /** Salt used when computing the contract's address. */
236
+ contractAddressSalt: FieldElement;
237
+ /** Hash of the class being deployed. */
238
+ classHash: FieldElement;
239
+ };
240
+ deployAccount?: never;
241
+ invokeV0?: never;
242
+ invokeV1?: never;
243
+ invokeV3?: never;
244
+ deploy?: never;
245
+ declare?: never;
246
+ declareV3?: never;
156
247
  l1Handler?: never;
157
248
  };
158
249
 
@@ -167,8 +258,10 @@ export type L1HandlerTransaction = {
167
258
  };
168
259
  invokeV0?: never;
169
260
  invokeV1?: never;
261
+ invokeV3?: never;
170
262
  deploy?: never;
171
263
  declare?: never;
264
+ declareV3?: never;
172
265
  deployAccount?: never;
173
266
  };
174
267
 
@@ -288,3 +381,25 @@ export type NonceUpdate = {
288
381
  /** New nonce. */
289
382
  nonce: FieldElement;
290
383
  };
384
+
385
+ export type ResourcePrice = {
386
+ /** Price in fri (10^-18 strk). */
387
+ priceInFri: FieldElement;
388
+ /** Price in wei (10^-18 eth). */
389
+ priceInWei: FieldElement;
390
+ };
391
+
392
+ export type ResourceBoundsMapping = {
393
+ l1Gas: ResourceBounds;
394
+ l2Gas: ResourceBounds;
395
+ };
396
+
397
+ export type ResourceBounds = {
398
+ maxAmount: number;
399
+ maxPricePerUnit: { low: number; high: number };
400
+ };
401
+
402
+ export type DataAvailabilityMode =
403
+ | "DATA_AVAILABILITY_MODE_UNSPECIFIED"
404
+ | "DATA_AVAILABILITY_MODE_L2"
405
+ | "DATA_AVAILABILITY_MODE_L1";
@@ -31,7 +31,7 @@ export class Contract {
31
31
  this.selectorToEvent = {};
32
32
  for (const event of this.abi) {
33
33
  if (event.type !== "event") {
34
- return;
34
+ continue;
35
35
  }
36
36
  this.selectorToEvent[getSelector(event.name)] = event.name;
37
37
  }