@apibara/indexer 0.3.1 → 0.4.1

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.
@@ -1,4 +1,4 @@
1
- import { FieldElement } from "./felt";
1
+ import type { FieldElement } from "./felt";
2
2
  export type Block = Partial<{
3
3
  /** Block header. */
4
4
  header: BlockHeader;
@@ -24,8 +24,14 @@ export type BlockHeader = Partial<{
24
24
  newRoot: FieldElement;
25
25
  /** Block production timestamp. */
26
26
  timestamp: string;
27
+ /** Starknet version. */
28
+ starknetVersion: string;
27
29
  /** Price of L1 gas in the block. */
28
- l1GasPrice: ResourcePrice;
30
+ l1GasPrice?: ResourcePrice;
31
+ /** Price of L1 data gas in the block. */
32
+ l1DataGasPrice?: ResourcePrice;
33
+ /** L1 data availability mode. */
34
+ l1DataAvailabilityMode?: L1DataAvailabilityMode;
29
35
  }>;
30
36
  export type TransactionWithReceipt = {
31
37
  /** Transaction. */
@@ -252,9 +258,54 @@ export type TransactionReceipt = Partial<{
252
258
  /** Events. */
253
259
  events: Event[];
254
260
  /** Revert reason. */
255
- revertReason?: string;
261
+ revertReason: string;
262
+ /** Fee paid. */
263
+ actualFeePaid: FeePayment;
264
+ /** Resources consumed by the transaction. */
265
+ executionResources: ExecutionResources;
256
266
  }>;
257
267
  export type ExecutionStatus = "EXECUTION_STATUS_UNSPECIFIED" | "EXECUTION_STATUS_SUCCEEDED" | "EXECUTION_STATUS_REVERTED";
268
+ export type FeePayment = Partial<{
269
+ /** Amount paid. */
270
+ amount: FieldElement;
271
+ /** Unit of the amount. */
272
+ unit: PriceUnit;
273
+ }>;
274
+ export type ExecutionResources = Partial<{
275
+ /** Computation resources. */
276
+ computation: ComputationResources;
277
+ /** Data availability resources. */
278
+ dataAvailability: DataAvailabilityResources;
279
+ }>;
280
+ export type DataAvailabilityResources = Partial<{
281
+ /** The gas consumed by this transaction's data, 0 if it uses data gas for DA. */
282
+ l1Gas: number;
283
+ /** The data gas consumed by this transaction's data, 0 if it uses gas for DA. */
284
+ l1DataGas: number;
285
+ }>;
286
+ export type ComputationResources = Partial<{
287
+ /** The number of Cairo steps used. */
288
+ steps: number;
289
+ /** The number of unused memory cells. */
290
+ memoryHoles: number;
291
+ /** The number of RANGE_CHECK builtin instances. */
292
+ rangeCheckBuiltinApplications: number;
293
+ /** The number of Pedersen builtin instances. */
294
+ pedersenBuiltinApplications: number;
295
+ /** The number of Poseidon builtin instances. */
296
+ poseidonBuiltinApplications: number;
297
+ /** The number of EC_OP builtin instances. */
298
+ ecOpBuiltinApplications: number;
299
+ /** The number of ECDSA builtin instances. */
300
+ ecdsaBuiltinApplications: number;
301
+ /** The number of BITWISE builtin instances. */
302
+ bitwiseBuiltinApplications: number;
303
+ /** The number of KECCAK builtin instances. */
304
+ keccakBuiltinApplications: number;
305
+ /** The number of accesses to the segment arena. */
306
+ segmentArenaBuiltin: number;
307
+ }>;
308
+ export type PriceUnit = "PRICE_UNIT_UNSPECIFIED" | "PRICE_UNIT_FRI" | "PRICE_UNIT_WEI";
258
309
  export type Event = Partial<{
259
310
  /** Event index. */
260
311
  index: number;
@@ -355,3 +406,4 @@ export type ResourceBounds = Partial<{
355
406
  }>;
356
407
  }>;
357
408
  export type DataAvailabilityMode = "DATA_AVAILABILITY_MODE_UNSPECIFIED" | "DATA_AVAILABILITY_MODE_L2" | "DATA_AVAILABILITY_MODE_L1";
409
+ export type L1DataAvailabilityMode = "L1_DATA_AVAILABILITY_MODE_UNSPECIFIED" | "L1_DATA_AVAILABILITY_MODE_BLOB" | "L1_DATA_AVAILABILITY_MODE_CALLDATA";
@@ -1,4 +1,4 @@
1
- import { FieldElement } from "./felt";
1
+ import type { FieldElement } from "./felt";
2
2
  export type Filter = {
3
3
  /** Header information. */
4
4
  header?: HeaderFilter;
@@ -2,7 +2,7 @@ export * from "./filter";
2
2
  export * from "./block";
3
3
  export { FieldElement, getSelector } from "./felt";
4
4
  export { Contract } from "./parser";
5
- import { Filter } from "./filter";
5
+ import type { Filter } from "./filter";
6
6
  /** Starknet network type and data filter. */
7
7
  export type Starknet = {
8
8
  network: "starknet";
@@ -1,6 +1,6 @@
1
- import { type Abi } from "starknet";
2
- import { FieldElement } from "./felt";
3
- import { EventFilter } from "./filter";
1
+ import type { Abi } from "starknet";
2
+ import { type FieldElement } from "./felt";
3
+ import type { EventFilter } from "./filter";
4
4
  /** Build a stream filter from a contract ABI. */
5
5
  export declare class Contract {
6
6
  readonly address: FieldElement;
@@ -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,SAAS;aACV;YACD,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI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4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,6 +1,6 @@
1
1
  import { assertType, describe, test } from "vitest";
2
2
 
3
- import { Config } from "./config";
3
+ import type { Config } from "./config";
4
4
 
5
5
  describe("Config", () => {
6
6
  test("without any network or sink type", () => {
@@ -1,6 +1,6 @@
1
1
  import { assertType, describe, test } from "vitest";
2
2
 
3
- import { Console } from "./console";
3
+ import type { Console } from "./console";
4
4
 
5
5
  describe("Console", () => {
6
6
  test("accepts any option", () => {
@@ -1,6 +1,6 @@
1
1
  import { assertType, describe, test } from "vitest";
2
2
 
3
- import { Block, BlockHeader, Transaction, TransactionMeta } from "./block";
3
+ import type { Block, BlockHeader, Transaction, TransactionMeta } from "./block";
4
4
  import { FieldElement } from "./felt";
5
5
 
6
6
  const address =
@@ -1,4 +1,4 @@
1
- import { FieldElement } from "./felt";
1
+ import type { FieldElement } from "./felt";
2
2
 
3
3
  export type Block = Partial<{
4
4
  /** Block header. */
@@ -26,8 +26,14 @@ export type BlockHeader = Partial<{
26
26
  newRoot: FieldElement;
27
27
  /** Block production timestamp. */
28
28
  timestamp: string;
29
+ /** Starknet version. */
30
+ starknetVersion: string;
29
31
  /** Price of L1 gas in the block. */
30
- l1GasPrice: ResourcePrice;
32
+ l1GasPrice?: ResourcePrice;
33
+ /** Price of L1 data gas in the block. */
34
+ l1DataGasPrice?: ResourcePrice;
35
+ /** L1 data availability mode. */
36
+ l1DataAvailabilityMode?: L1DataAvailabilityMode;
31
37
  }>;
32
38
 
33
39
  export type TransactionWithReceipt = {
@@ -281,7 +287,11 @@ export type TransactionReceipt = Partial<{
281
287
  /** Events. */
282
288
  events: Event[];
283
289
  /** Revert reason. */
284
- revertReason?: string;
290
+ revertReason: string;
291
+ /** Fee paid. */
292
+ actualFeePaid: FeePayment;
293
+ /** Resources consumed by the transaction. */
294
+ executionResources: ExecutionResources;
285
295
  }>;
286
296
 
287
297
  export type ExecutionStatus =
@@ -289,6 +299,55 @@ export type ExecutionStatus =
289
299
  | "EXECUTION_STATUS_SUCCEEDED"
290
300
  | "EXECUTION_STATUS_REVERTED";
291
301
 
302
+ export type FeePayment = Partial<{
303
+ /** Amount paid. */
304
+ amount: FieldElement;
305
+ /** Unit of the amount. */
306
+ unit: PriceUnit;
307
+ }>;
308
+
309
+ export type ExecutionResources = Partial<{
310
+ /** Computation resources. */
311
+ computation: ComputationResources;
312
+ /** Data availability resources. */
313
+ dataAvailability: DataAvailabilityResources;
314
+ }>;
315
+
316
+ export type DataAvailabilityResources = Partial<{
317
+ /** The gas consumed by this transaction's data, 0 if it uses data gas for DA. */
318
+ l1Gas: number;
319
+ /** The data gas consumed by this transaction's data, 0 if it uses gas for DA. */
320
+ l1DataGas: number;
321
+ }>;
322
+
323
+ export type ComputationResources = Partial<{
324
+ /** The number of Cairo steps used. */
325
+ steps: number;
326
+ /** The number of unused memory cells. */
327
+ memoryHoles: number;
328
+ /** The number of RANGE_CHECK builtin instances. */
329
+ rangeCheckBuiltinApplications: number;
330
+ /** The number of Pedersen builtin instances. */
331
+ pedersenBuiltinApplications: number;
332
+ /** The number of Poseidon builtin instances. */
333
+ poseidonBuiltinApplications: number;
334
+ /** The number of EC_OP builtin instances. */
335
+ ecOpBuiltinApplications: number;
336
+ /** The number of ECDSA builtin instances. */
337
+ ecdsaBuiltinApplications: number;
338
+ /** The number of BITWISE builtin instances. */
339
+ bitwiseBuiltinApplications: number;
340
+ /** The number of KECCAK builtin instances. */
341
+ keccakBuiltinApplications: number;
342
+ /** The number of accesses to the segment arena. */
343
+ segmentArenaBuiltin: number;
344
+ }>;
345
+
346
+ export type PriceUnit =
347
+ | "PRICE_UNIT_UNSPECIFIED"
348
+ | "PRICE_UNIT_FRI"
349
+ | "PRICE_UNIT_WEI";
350
+
292
351
  export type Event = Partial<{
293
352
  /** Event index. */
294
353
  index: number;
@@ -403,3 +462,8 @@ export type DataAvailabilityMode =
403
462
  | "DATA_AVAILABILITY_MODE_UNSPECIFIED"
404
463
  | "DATA_AVAILABILITY_MODE_L2"
405
464
  | "DATA_AVAILABILITY_MODE_L1";
465
+
466
+ export type L1DataAvailabilityMode =
467
+ | "L1_DATA_AVAILABILITY_MODE_UNSPECIFIED"
468
+ | "L1_DATA_AVAILABILITY_MODE_BLOB"
469
+ | "L1_DATA_AVAILABILITY_MODE_CALLDATA";
@@ -1,7 +1,7 @@
1
1
  import { assertType, describe, test } from "vitest";
2
2
 
3
3
  import { FieldElement } from "./felt";
4
- import {
4
+ import type {
5
5
  EventFilter,
6
6
  Filter,
7
7
  L2ToL1MessageFilter,
@@ -1,4 +1,4 @@
1
- import { FieldElement } from "./felt";
1
+ import type { FieldElement } from "./felt";
2
2
 
3
3
  export type Filter = {
4
4
  /** Header information. */
@@ -3,7 +3,7 @@ export * from "./block";
3
3
  export { FieldElement, getSelector } from "./felt";
4
4
  export { Contract } from "./parser";
5
5
 
6
- import { Filter } from "./filter";
6
+ import type { Filter } from "./filter";
7
7
 
8
8
  /** Starknet network type and data filter. */
9
9
  export type Starknet = {
@@ -1,6 +1,6 @@
1
1
  import { Contract } from "./parser";
2
2
  import { describe, expect, it } from "vitest";
3
- import { FieldElement } from "./felt";
3
+ import type { FieldElement } from "./felt";
4
4
  import { EventAbi } from "starknet";
5
5
 
6
6
  describe("Contract", () => {
@@ -1,7 +1,7 @@
1
- import { type Abi, EventAbi } from "starknet";
1
+ import type { Abi, EventAbi } from "starknet";
2
2
 
3
- import { FieldElement, getSelector } from "./felt";
4
- import { EventFilter } from "./filter";
3
+ import { type FieldElement, getSelector } from "./felt";
4
+ import type { EventFilter } from "./filter";
5
5
 
6
6
  /** Build a stream filter from a contract ABI. */
7
7
  export class Contract {