@morpho-dev/router 0.0.21 → 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,11 +13,12 @@ import * as hono from 'hono';
13
13
  import { Context } from 'hono';
14
14
  import * as hono_utils_http_status from 'hono/utils/http-status';
15
15
 
16
- declare const chainNames: readonly ["ethereum", "base"];
16
+ declare const chainNames: readonly ["ethereum", "base", "ethereum-virtual-testnet"];
17
17
  type ChainName = (typeof chainNames)[number];
18
18
  declare const ChainId: {
19
19
  ETHEREUM: bigint;
20
20
  BASE: bigint;
21
+ "ETHEREUM-VIRTUAL-TESTNET": bigint;
21
22
  };
22
23
  type ChainId = (typeof ChainId)[keyof typeof ChainId];
23
24
  declare const chainIds: Set<bigint>;
@@ -26,6 +27,11 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
26
27
  name: ChainName;
27
28
  whitelistedAssets: Set<Address>;
28
29
  morpho: Address;
30
+ mempool?: {
31
+ address: Address;
32
+ deploymentBlock: number;
33
+ reindexBuffer: number;
34
+ };
29
35
  }>;
30
36
  declare function getChain(chainId: ChainId): Chain | undefined;
31
37
  declare const chains: Record<ChainName, Chain>;
@@ -422,6 +428,19 @@ type OfferStore = {
422
428
  nonce: Offer.Offer["nonce"];
423
429
  consumed: bigint;
424
430
  }) => Promise<void>;
431
+ /** Persist latest indexing progress for a chain and event type. */
432
+ saveLatestBlockNumberProcessed: (parameters: {
433
+ chainId: Offer.Offer["chainId"];
434
+ eventType: "offer_created" | "offer_matched";
435
+ latestBlockNumber: number;
436
+ }) => Promise<void>;
437
+ /** Retrieve latest indexing progress for a chain and event type. */
438
+ getLatestBlockNumberProcessed: (parameters: {
439
+ chainId: Offer.Offer["chainId"];
440
+ eventType: "offer_created" | "offer_matched";
441
+ }) => Promise<{
442
+ latestBlockNumber: number;
443
+ } | null>;
425
444
  };
426
445
  type GetOffersFilters = {
427
446
  creators?: string[];
@@ -13,11 +13,12 @@ import * as hono from 'hono';
13
13
  import { Context } from 'hono';
14
14
  import * as hono_utils_http_status from 'hono/utils/http-status';
15
15
 
16
- declare const chainNames: readonly ["ethereum", "base"];
16
+ declare const chainNames: readonly ["ethereum", "base", "ethereum-virtual-testnet"];
17
17
  type ChainName = (typeof chainNames)[number];
18
18
  declare const ChainId: {
19
19
  ETHEREUM: bigint;
20
20
  BASE: bigint;
21
+ "ETHEREUM-VIRTUAL-TESTNET": bigint;
21
22
  };
22
23
  type ChainId = (typeof ChainId)[keyof typeof ChainId];
23
24
  declare const chainIds: Set<bigint>;
@@ -26,6 +27,11 @@ type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
26
27
  name: ChainName;
27
28
  whitelistedAssets: Set<Address>;
28
29
  morpho: Address;
30
+ mempool?: {
31
+ address: Address;
32
+ deploymentBlock: number;
33
+ reindexBuffer: number;
34
+ };
29
35
  }>;
30
36
  declare function getChain(chainId: ChainId): Chain | undefined;
31
37
  declare const chains: Record<ChainName, Chain>;
@@ -422,6 +428,19 @@ type OfferStore = {
422
428
  nonce: Offer.Offer["nonce"];
423
429
  consumed: bigint;
424
430
  }) => Promise<void>;
431
+ /** Persist latest indexing progress for a chain and event type. */
432
+ saveLatestBlockNumberProcessed: (parameters: {
433
+ chainId: Offer.Offer["chainId"];
434
+ eventType: "offer_created" | "offer_matched";
435
+ latestBlockNumber: number;
436
+ }) => Promise<void>;
437
+ /** Retrieve latest indexing progress for a chain and event type. */
438
+ getLatestBlockNumberProcessed: (parameters: {
439
+ chainId: Offer.Offer["chainId"];
440
+ eventType: "offer_created" | "offer_matched";
441
+ }) => Promise<{
442
+ latestBlockNumber: number;
443
+ } | null>;
425
444
  };
426
445
  type GetOffersFilters = {
427
446
  creators?: string[];
@@ -25,10 +25,11 @@ __export(Chain_exports, {
25
25
  chains: () => chains,
26
26
  getChain: () => getChain
27
27
  });
28
- var chainNames = ["ethereum", "base"];
28
+ var chainNames = ["ethereum", "base", "ethereum-virtual-testnet"];
29
29
  var ChainId = {
30
30
  ETHEREUM: BigInt(chains$1.mainnet.id),
31
- BASE: BigInt(chains$1.base.id)
31
+ BASE: BigInt(chains$1.base.id),
32
+ "ETHEREUM-VIRTUAL-TESTNET": 121212n
32
33
  };
33
34
  var chainIds = new Set(Object.values(ChainId));
34
35
  var chainNameLookup = new Map(Object.entries(ChainId).map(([key, value]) => [value, key]));
@@ -67,6 +68,25 @@ var chains = {
67
68
  ].map((address) => address.toLowerCase())
68
69
  ),
69
70
  morpho: "0x0000000000000000000000000000000000000000"
71
+ },
72
+ "ethereum-virtual-testnet": {
73
+ ...chains$1.mainnet,
74
+ id: 121212n,
75
+ name: "ethereum-virtual-testnet",
76
+ whitelistedAssets: new Set(
77
+ [
78
+ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
79
+ // USDC
80
+ "0x6B175474E89094C44Da98b954EedeAC495271d0F"
81
+ // DAI
82
+ ].map((address) => address.toLowerCase())
83
+ ),
84
+ morpho: "0x0000000000000000000000000000000000000000",
85
+ mempool: {
86
+ address: "0x7be3164eeee8b35092f6128ec32c2e6ff8f6c890",
87
+ deploymentBlock: 23225668,
88
+ reindexBuffer: 10
89
+ }
70
90
  }
71
91
  };
72
92
 
@@ -1091,6 +1111,7 @@ __export(OfferStore_exports, {
1091
1111
  function memory(parameters) {
1092
1112
  const map = parameters.offers;
1093
1113
  const filled = parameters.filled;
1114
+ const indexingProgress = /* @__PURE__ */ new Map();
1094
1115
  const create = async (parameters2) => {
1095
1116
  if (map.has(parameters2.offer.hash.toLowerCase())) return parameters2.offer.hash;
1096
1117
  map.set(parameters2.offer.hash.toLowerCase(), {
@@ -1431,6 +1452,15 @@ function memory(parameters) {
1431
1452
  filledForOffering.set(nonce, parameters2.consumed);
1432
1453
  filledForChain.set(address, filledForOffering);
1433
1454
  filled.set(chainId, filledForChain);
1455
+ },
1456
+ saveLatestBlockNumberProcessed: async (parameters2) => {
1457
+ const key = `${parameters2.chainId.toString()}:${parameters2.eventType}`;
1458
+ indexingProgress.set(key, parameters2.latestBlockNumber);
1459
+ },
1460
+ getLatestBlockNumberProcessed: async (parameters2) => {
1461
+ const key = `${parameters2.chainId.toString()}:${parameters2.eventType}`;
1462
+ const value = indexingProgress.get(key);
1463
+ return value === void 0 ? null : { latestBlockNumber: value };
1434
1464
  }
1435
1465
  };
1436
1466
  }