@morpho-dev/router 0.0.22 → 0.0.23

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.
@@ -13,6 +13,7 @@ type ChainName = (typeof chainNames)[number];
13
13
  declare const ChainId: {
14
14
  ETHEREUM: bigint;
15
15
  BASE: bigint;
16
+ "ETHEREUM-VIRTUAL-TESTNET": bigint;
16
17
  };
17
18
  type ChainId = (typeof ChainId)[keyof typeof ChainId];
18
19
  declare const chainIds: Set<bigint>;
@@ -21,6 +22,11 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
21
22
  name: ChainName;
22
23
  whitelistedAssets: Set<Address>;
23
24
  morpho: Address;
25
+ mempool?: {
26
+ address: Address;
27
+ deploymentBlock: number;
28
+ reindexBuffer: number;
29
+ };
24
30
  }>;
25
31
  declare function getChain(chainId: ChainId): Chain | undefined;
26
32
  declare const chains: Record<ChainName, Chain>;
@@ -347,6 +353,19 @@ type OfferStore = {
347
353
  nonce: Offer.Offer["nonce"];
348
354
  consumed: bigint;
349
355
  }) => Promise<void>;
356
+ /** Persist latest indexing progress for a chain and event type. */
357
+ saveLatestBlockNumberProcessed: (parameters: {
358
+ chainId: Offer.Offer["chainId"];
359
+ eventType: "offer_created" | "offer_matched";
360
+ latestBlockNumber: number;
361
+ }) => Promise<void>;
362
+ /** Retrieve latest indexing progress for a chain and event type. */
363
+ getLatestBlockNumberProcessed: (parameters: {
364
+ chainId: Offer.Offer["chainId"];
365
+ eventType: "offer_created" | "offer_matched";
366
+ }) => Promise<{
367
+ latestBlockNumber: number;
368
+ } | null>;
350
369
  };
351
370
  type GetOffersFilters = {
352
371
  creators?: string[];
@@ -13,6 +13,7 @@ type ChainName = (typeof chainNames)[number];
13
13
  declare const ChainId: {
14
14
  ETHEREUM: bigint;
15
15
  BASE: bigint;
16
+ "ETHEREUM-VIRTUAL-TESTNET": bigint;
16
17
  };
17
18
  type ChainId = (typeof ChainId)[keyof typeof ChainId];
18
19
  declare const chainIds: Set<bigint>;
@@ -21,6 +22,11 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
21
22
  name: ChainName;
22
23
  whitelistedAssets: Set<Address>;
23
24
  morpho: Address;
25
+ mempool?: {
26
+ address: Address;
27
+ deploymentBlock: number;
28
+ reindexBuffer: number;
29
+ };
24
30
  }>;
25
31
  declare function getChain(chainId: ChainId): Chain | undefined;
26
32
  declare const chains: Record<ChainName, Chain>;
@@ -347,6 +353,19 @@ type OfferStore = {
347
353
  nonce: Offer.Offer["nonce"];
348
354
  consumed: bigint;
349
355
  }) => Promise<void>;
356
+ /** Persist latest indexing progress for a chain and event type. */
357
+ saveLatestBlockNumberProcessed: (parameters: {
358
+ chainId: Offer.Offer["chainId"];
359
+ eventType: "offer_created" | "offer_matched";
360
+ latestBlockNumber: number;
361
+ }) => Promise<void>;
362
+ /** Retrieve latest indexing progress for a chain and event type. */
363
+ getLatestBlockNumberProcessed: (parameters: {
364
+ chainId: Offer.Offer["chainId"];
365
+ eventType: "offer_created" | "offer_matched";
366
+ }) => Promise<{
367
+ latestBlockNumber: number;
368
+ } | null>;
350
369
  };
351
370
  type GetOffersFilters = {
352
371
  creators?: string[];
@@ -27,7 +27,8 @@ __export(Chain_exports, {
27
27
  var chainNames = ["ethereum", "base", "ethereum-virtual-testnet"];
28
28
  var ChainId = {
29
29
  ETHEREUM: BigInt(chains$1.mainnet.id),
30
- BASE: BigInt(chains$1.base.id)
30
+ BASE: BigInt(chains$1.base.id),
31
+ "ETHEREUM-VIRTUAL-TESTNET": 121212n
31
32
  };
32
33
  var chainIds = new Set(Object.values(ChainId));
33
34
  var chainNameLookup = new Map(Object.entries(ChainId).map(([key, value]) => [value, key]));
@@ -69,7 +70,7 @@ var chains = {
69
70
  },
70
71
  "ethereum-virtual-testnet": {
71
72
  ...chains$1.mainnet,
72
- id: 1111n,
73
+ id: 121212n,
73
74
  name: "ethereum-virtual-testnet",
74
75
  whitelistedAssets: new Set(
75
76
  [
@@ -79,7 +80,12 @@ var chains = {
79
80
  // DAI
80
81
  ].map((address) => address.toLowerCase())
81
82
  ),
82
- morpho: "0x0000000000000000000000000000000000000000"
83
+ morpho: "0x0000000000000000000000000000000000000000",
84
+ mempool: {
85
+ address: "0x7be3164eeee8b35092f6128ec32c2e6ff8f6c890",
86
+ deploymentBlock: 23225668,
87
+ reindexBuffer: 10
88
+ }
83
89
  }
84
90
  };
85
91
 
@@ -1084,6 +1090,7 @@ __export(OfferStore_exports, {
1084
1090
  function memory(parameters) {
1085
1091
  const map = parameters.offers;
1086
1092
  const filled = parameters.filled;
1093
+ const indexingProgress = /* @__PURE__ */ new Map();
1087
1094
  const create = async (parameters2) => {
1088
1095
  if (map.has(parameters2.offer.hash.toLowerCase())) return parameters2.offer.hash;
1089
1096
  map.set(parameters2.offer.hash.toLowerCase(), {
@@ -1424,6 +1431,15 @@ function memory(parameters) {
1424
1431
  filledForOffering.set(nonce, parameters2.consumed);
1425
1432
  filledForChain.set(address, filledForOffering);
1426
1433
  filled.set(chainId, filledForChain);
1434
+ },
1435
+ saveLatestBlockNumberProcessed: async (parameters2) => {
1436
+ const key = `${parameters2.chainId.toString()}:${parameters2.eventType}`;
1437
+ indexingProgress.set(key, parameters2.latestBlockNumber);
1438
+ },
1439
+ getLatestBlockNumberProcessed: async (parameters2) => {
1440
+ const key = `${parameters2.chainId.toString()}:${parameters2.eventType}`;
1441
+ const value = indexingProgress.get(key);
1442
+ return value === void 0 ? null : { latestBlockNumber: value };
1427
1443
  }
1428
1444
  };
1429
1445
  }