@morpho-dev/router 0.7.2 → 0.8.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.
Files changed (65) hide show
  1. package/dist/cli.js +292 -122
  2. package/dist/drizzle/migrations/0000_setup_single_migration_folder.sql +64 -64
  3. package/dist/drizzle/migrations/0001_add-trigger-for-consumed-events.sql +5 -5
  4. package/dist/drizzle/migrations/0002_insert-status-code.sql +1 -1
  5. package/dist/drizzle/migrations/0003_update-triggers-for-consumed-events.sql +1 -1
  6. package/dist/drizzle/migrations/0004_drop-status-offers-foreign-key-constraint.sql +1 -1
  7. package/dist/drizzle/migrations/0005_add-index-to-boost-group-query-and-offer-hash.sql +1 -1
  8. package/dist/drizzle/migrations/0006_add-callbacks-and-positions-relations.sql +11 -11
  9. package/dist/drizzle/migrations/0008_validation.sql +10 -10
  10. package/dist/drizzle/migrations/0009_add-transfers-table.sql +4 -4
  11. package/dist/drizzle/migrations/0010_add-price.sql +1 -1
  12. package/dist/drizzle/migrations/0011_nullable-callback-amount.sql +1 -1
  13. package/dist/drizzle/migrations/0012_add-position-asset.sql +1 -1
  14. package/dist/drizzle/migrations/0013_remove-depecrated-domains.sql +13 -13
  15. package/dist/drizzle/migrations/0014_rename-offers-v2-into-offers.sql +19 -19
  16. package/dist/drizzle/migrations/0015_add-lots-table.sql +3 -3
  17. package/dist/drizzle/migrations/0016_merkle-metadata.sql +7 -7
  18. package/dist/drizzle/migrations/0017_dusty_the_hunter.sql +1 -1
  19. package/dist/drizzle/migrations/0018_add_chain_collector_constraints.sql +3 -3
  20. package/dist/drizzle/migrations/0019_add-obligation-units-shares.sql +2 -2
  21. package/dist/drizzle/migrations/0020_add-session.sql +1 -1
  22. package/dist/drizzle/migrations/0021_drop_chain_collector_epoch_indexes.sql +2 -2
  23. package/dist/drizzle/migrations/0021_migrate-rate-to-price.sql +6 -6
  24. package/dist/drizzle/migrations/0022_consolidate-price.sql +5 -5
  25. package/dist/drizzle/migrations/0023_remove-block-number-for-collaterals.sql +1 -1
  26. package/dist/drizzle/migrations/0024_add-obligation-id-to-lots.sql +8 -0
  27. package/dist/drizzle/migrations/0025_rename-price-to-tick.sql +202 -0
  28. package/dist/drizzle/migrations/meta/0000_snapshot.json +48 -48
  29. package/dist/drizzle/migrations/meta/0001_snapshot.json +48 -48
  30. package/dist/drizzle/migrations/meta/0002_snapshot.json +48 -48
  31. package/dist/drizzle/migrations/meta/0003_snapshot.json +48 -48
  32. package/dist/drizzle/migrations/meta/0004_snapshot.json +47 -47
  33. package/dist/drizzle/migrations/meta/0005_snapshot.json +47 -47
  34. package/dist/drizzle/migrations/meta/0006_snapshot.json +61 -61
  35. package/dist/drizzle/migrations/meta/0008_snapshot.json +62 -62
  36. package/dist/drizzle/migrations/meta/0009_snapshot.json +66 -66
  37. package/dist/drizzle/migrations/meta/0010_snapshot.json +66 -66
  38. package/dist/drizzle/migrations/meta/0013_snapshot.json +48 -48
  39. package/dist/drizzle/migrations/meta/0014_snapshot.json +48 -48
  40. package/dist/drizzle/migrations/meta/0015_snapshot.json +52 -52
  41. package/dist/drizzle/migrations/meta/0016_snapshot.json +61 -61
  42. package/dist/drizzle/migrations/meta/0017_snapshot.json +61 -61
  43. package/dist/drizzle/migrations/meta/0018_snapshot.json +62 -62
  44. package/dist/drizzle/migrations/meta/0019_snapshot.json +62 -62
  45. package/dist/drizzle/migrations/meta/0023_snapshot.json +62 -62
  46. package/dist/drizzle/migrations/meta/0024_snapshot.json +1448 -0
  47. package/dist/drizzle/migrations/meta/0025_snapshot.json +1448 -0
  48. package/dist/drizzle/migrations/meta/_journal.json +14 -0
  49. package/dist/index.browser.d.mts +103 -33
  50. package/dist/index.browser.d.mts.map +1 -1
  51. package/dist/index.browser.d.ts +103 -33
  52. package/dist/index.browser.d.ts.map +1 -1
  53. package/dist/index.browser.js +298 -146
  54. package/dist/index.browser.js.map +1 -1
  55. package/dist/index.browser.mjs +293 -147
  56. package/dist/index.browser.mjs.map +1 -1
  57. package/dist/index.node.d.mts +182 -63
  58. package/dist/index.node.d.mts.map +1 -1
  59. package/dist/index.node.d.ts +182 -63
  60. package/dist/index.node.d.ts.map +1 -1
  61. package/dist/index.node.js +342 -127
  62. package/dist/index.node.js.map +1 -1
  63. package/dist/index.node.mjs +337 -128
  64. package/dist/index.node.mjs.map +1 -1
  65. package/package.json +1 -1
@@ -1872,8 +1872,8 @@ type Offer = {
1872
1872
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
1873
1873
  readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
1874
1874
  readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
1875
- readonly obligationShares: bigint; /** The price (18 decimals). */
1876
- readonly price: bigint; /** The date at which all interests will be paid. */
1875
+ readonly obligationShares: bigint; /** The offer tick. */
1876
+ readonly tick: number; /** The date at which all interests will be paid. */
1877
1877
  readonly maturity: Maturity; /** The date at which the offer will expire. */
1878
1878
  readonly expiry: number; /** The date at which the offer will start. */
1879
1879
  readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
@@ -1901,7 +1901,7 @@ declare const OfferSchema: () => z$1.ZodObject<{
1901
1901
  assets: z$1.ZodBigInt;
1902
1902
  obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
1903
1903
  obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
1904
- price: z$1.ZodBigInt;
1904
+ tick: z$1.ZodCoercedNumber<unknown>;
1905
1905
  maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
1906
1906
  expiry: z$1.ZodNumber;
1907
1907
  start: z$1.ZodNumber;
@@ -1976,7 +1976,7 @@ declare const serialize: (offer: Offer) => {
1976
1976
  assets: string;
1977
1977
  obligationUnits: string;
1978
1978
  obligationShares: string;
1979
- price: string;
1979
+ tick: number;
1980
1980
  maturity: number;
1981
1981
  expiry: number;
1982
1982
  start: number;
@@ -2011,7 +2011,7 @@ type RandomConfig = {
2011
2011
  expiry?: number;
2012
2012
  group?: Hex | bigint | number | string;
2013
2013
  session?: Hex | bigint | number | string;
2014
- price?: bigint;
2014
+ tick?: number;
2015
2015
  callback?: {
2016
2016
  address: Address;
2017
2017
  data: Hex;
@@ -2060,7 +2060,7 @@ declare const types: {
2060
2060
  readonly name: "obligationShares";
2061
2061
  readonly type: "uint256";
2062
2062
  }, {
2063
- readonly name: "price";
2063
+ readonly name: "tick";
2064
2064
  readonly type: "uint256";
2065
2065
  }, {
2066
2066
  readonly name: "maturity";
@@ -2456,6 +2456,41 @@ declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
2456
2456
  readonly name = "Quote.InvalidQuoteError";
2457
2457
  constructor(error: z$1.ZodError | Error);
2458
2458
  }
2459
+ declare namespace Tick_d_exports {
2460
+ export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, priceToTick, tickToPrice };
2461
+ }
2462
+ /** Tick domain supported by Morpho V2. */
2463
+ declare const TICK_RANGE = 990;
2464
+ /** Max allowed price (1e18 in wad). */
2465
+ declare const MAX_PRICE: bigint;
2466
+ /**
2467
+ * Converts a tick to a wad price using the same approximation and rounding as TickLib.
2468
+ * @param tick - Tick value in the inclusive range [0, 990].
2469
+ * @returns The price in wad units.
2470
+ * @throws {@link InvalidTickError} If tick is not an integer in range [0, 990].
2471
+ */
2472
+ declare function tickToPrice(tick: number): bigint;
2473
+ declare namespace tickToPrice {
2474
+ type ErrorType = InvalidTickError;
2475
+ }
2476
+ /**
2477
+ * Returns the lowest tick with a higher-or-equal price.
2478
+ * @param price - Price in wad units.
2479
+ * @returns The first tick whose {@link tickToPrice} is greater than or equal to `price`.
2480
+ * @throws {@link InvalidPriceError} If price is outside [0, 1e18].
2481
+ */
2482
+ declare function priceToTick(price: bigint): number;
2483
+ declare namespace priceToTick {
2484
+ type ErrorType = InvalidPriceError;
2485
+ }
2486
+ declare class InvalidTickError extends BaseError {
2487
+ readonly name = "Tick.InvalidTickError";
2488
+ constructor(tick: number);
2489
+ }
2490
+ declare class InvalidPriceError extends BaseError {
2491
+ readonly name = "Tick.InvalidPriceError";
2492
+ constructor(price: bigint);
2493
+ }
2459
2494
  declare namespace TradingFee_d_exports {
2460
2495
  export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$9 as from, getFees, isActivated };
2461
2496
  }
@@ -2869,7 +2904,7 @@ type Row = {
2869
2904
  assets: bigint;
2870
2905
  obligationUnits: bigint;
2871
2906
  obligationShares: bigint;
2872
- price: bigint;
2907
+ tick: number;
2873
2908
  maturity: Maturity;
2874
2909
  expiry: number;
2875
2910
  start: number;
@@ -2940,8 +2975,8 @@ declare namespace get$4 {
2940
2975
  limit?: number;
2941
2976
  };
2942
2977
  type Level = {
2943
- /** The computed price for this level (interpolated at query time) */price: bigint; /** Sum of takeable amounts at this price */
2944
- assets: bigint; /** Number of offers at this price */
2978
+ /** The offer tick for this level */tick: number; /** Sum of takeable amounts at this tick */
2979
+ assets: bigint; /** Number of offers at this tick */
2945
2980
  count: number;
2946
2981
  };
2947
2982
  type ReturnType = {
@@ -3030,6 +3065,7 @@ type Lot = {
3030
3065
  user: Address;
3031
3066
  contract: Address;
3032
3067
  group: string;
3068
+ obligationId: string;
3033
3069
  lower: bigint;
3034
3070
  upper: bigint;
3035
3071
  };
@@ -3052,6 +3088,7 @@ declare namespace create$5 {
3052
3088
  positionContract: Address;
3053
3089
  positionUser: Address;
3054
3090
  group: string;
3091
+ obligationId: string;
3055
3092
  size: bigint;
3056
3093
  };
3057
3094
  type Parameters = OfferLotInfo[];
@@ -3063,6 +3100,7 @@ declare namespace get$3 {
3063
3100
  user?: Address;
3064
3101
  contract?: Address;
3065
3102
  group?: string;
3103
+ obligationId?: string;
3066
3104
  };
3067
3105
  type ReturnType = Lot[];
3068
3106
  }
@@ -3083,6 +3121,7 @@ type Offset = {
3083
3121
  user: Address;
3084
3122
  contract: Address;
3085
3123
  group: string;
3124
+ obligationId: string;
3086
3125
  value: bigint;
3087
3126
  };
3088
3127
  type OffsetsDomain = {
@@ -3097,6 +3136,7 @@ declare namespace get$2 {
3097
3136
  user?: Address;
3098
3137
  contract?: Address;
3099
3138
  group?: string;
3139
+ obligationId?: string;
3100
3140
  };
3101
3141
  type ReturnType = Offset[];
3102
3142
  }
@@ -3175,7 +3215,8 @@ declare namespace getByUser {
3175
3215
  chainId: Id;
3176
3216
  contract: Address;
3177
3217
  user: Address;
3178
- blockNumber: number; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
3218
+ blockNumber: number; /** The obligation this reserved amount belongs to, or null if no lots exist */
3219
+ obligationId: string | null; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
3179
3220
  reserved: bigint;
3180
3221
  };
3181
3222
  type ReturnType = {
@@ -3264,7 +3305,7 @@ type ValidationsDomain = {
3264
3305
  upsert: (validations: Validation[]) => Promise<void>;
3265
3306
  };
3266
3307
  declare namespace Database_d_exports {
3267
- export { Core, Database, Driver, WithDomains, connect$2 as connect };
3308
+ export { Core, Database, Driver, WithDomains, connect$2 as connect, getSchemaNamesForMigration };
3268
3309
  }
3269
3310
  type Driver = ReturnType<typeof drizzle> | ReturnType<typeof drizzle$1>;
3270
3311
  type Domains = {
@@ -3300,6 +3341,12 @@ type Database = Core & {
3300
3341
  * @returns The database client {@link connect.ReturnType}
3301
3342
  */
3302
3343
  declare function connect$2(chainRegistry: ChainRegistry, connectionString?: string): Database;
3344
+ /**
3345
+ * Build the list of router schemas that should exist before running migrations.
3346
+ * @param version - Current schema version (e.g. `router_v1.8`).
3347
+ * @returns Ordered schema names from `router_v1.7` to current, or just current if parsing fails.
3348
+ */
3349
+ declare function getSchemaNamesForMigration(version: string): string[];
3303
3350
  declare namespace Gate_d_exports {
3304
3351
  export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
3305
3352
  }
@@ -3384,6 +3431,10 @@ type ConfigRule = {
3384
3431
  type: "loan_token";
3385
3432
  chain_id: Id;
3386
3433
  address: Address;
3434
+ } | {
3435
+ type: "collateral_token";
3436
+ chain_id: Id;
3437
+ address: Address;
3387
3438
  } | {
3388
3439
  type: "oracle";
3389
3440
  chain_id: Id;
@@ -3556,15 +3607,17 @@ declare namespace BookResponse_d_exports {
3556
3607
  export { BookLevelResponse, from$4 as from };
3557
3608
  }
3558
3609
  type BookLevelResponse = {
3610
+ tick: number;
3559
3611
  price: string;
3560
3612
  assets: string;
3561
3613
  count: number;
3562
3614
  };
3563
- declare function from$4(level: {
3564
- price: bigint;
3615
+ type Input$1 = {
3616
+ tick: number;
3565
3617
  assets: bigint;
3566
3618
  count: number;
3567
- }): BookLevelResponse;
3619
+ };
3620
+ declare function from$4(level: Input$1): BookLevelResponse;
3568
3621
  //#endregion
3569
3622
  //#region src/api/Schema/health.d.ts
3570
3623
  declare const CollectorHealth: z.ZodObject<{
@@ -3638,13 +3691,13 @@ interface paths {
3638
3691
  };
3639
3692
  /**
3640
3693
  * Get aggregated book
3641
- * @description Returns aggregated book data for a given obligation and side. Offers are grouped by computed price with summed takeable amounts. Book levels are sorted by price (ascending for buy side, descending for sell side).
3694
+ * @description Returns aggregated book data for a given obligation and side. Offers are grouped by tick with summed takeable amounts, and each level includes the corresponding wad-scaled price. Book levels are sorted by tick (ascending for sell side, descending for buy side).
3642
3695
  */
3643
3696
  get: {
3644
3697
  parameters: {
3645
3698
  query?: {
3646
3699
  /**
3647
- * @description Maximum number of price levels to return.
3700
+ * @description Maximum number of tick levels to return.
3648
3701
  * @example 10
3649
3702
  */
3650
3703
  limit?: number;
@@ -3760,7 +3813,7 @@ interface paths {
3760
3813
  };
3761
3814
  /**
3762
3815
  * Get config rules
3763
- * @description Returns configured rules (maturities, loan tokens, oracles) for supported chains.
3816
+ * @description Returns configured rules (maturities, loan tokens, collateral tokens, oracles) for supported chains.
3764
3817
  */
3765
3818
  get: {
3766
3819
  parameters: {
@@ -3772,7 +3825,7 @@ interface paths {
3772
3825
  chains?: number[];
3773
3826
  /**
3774
3827
  * @description Filter by rule types (comma-separated).
3775
- * @example maturity,loan_token,oracle
3828
+ * @example maturity,loan_token,collateral_token,oracle
3776
3829
  */
3777
3830
  types?: string[];
3778
3831
  /**
@@ -4152,7 +4205,7 @@ interface paths {
4152
4205
  };
4153
4206
  /**
4154
4207
  * Get user positions
4155
- * @description Returns positions for a user with reserved balance. The reserved balance is the amount locked by active offers (max lot upper - offset - consumed).
4208
+ * @description Returns positions for a user with reserved balance per obligation. Each (position, obligation) pair is returned as a separate row. Positions with no lots return a single row with obligation_id = null and reserved = 0.
4156
4209
  */
4157
4210
  get: {
4158
4211
  parameters: {
@@ -4261,14 +4314,19 @@ interface components {
4261
4314
  schemas: {
4262
4315
  BookListResponse: {
4263
4316
  meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
4264
- cursor: string | null; /** @description Aggregated book levels grouped by computed price. */
4317
+ cursor: string | null; /** @description Aggregated book levels grouped by offer tick. */
4265
4318
  data: components["schemas"]["BookLevelResponse"][];
4266
4319
  };
4267
4320
  Meta: {
4268
4321
  /** @example 2024-01-01T12:00:00.000Z */timestamp: string;
4269
4322
  };
4270
4323
  BookLevelResponse: {
4271
- /** @example 2750000000000000000 */price: string; /** @example 369216000000000000000000 */
4324
+ /** @example 495 */tick: number;
4325
+ /**
4326
+ * @description Price derived from tick, scaled by 1e18.
4327
+ * @example 500000000000000000
4328
+ */
4329
+ price: string; /** @example 369216000000000000000000 */
4272
4330
  assets: string; /** @example 5 */
4273
4331
  count: number;
4274
4332
  };
@@ -4345,6 +4403,11 @@ interface components {
4345
4403
  * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
4346
4404
  * },
4347
4405
  * {
4406
+ * "type": "collateral_token",
4407
+ * "chain_id": 1,
4408
+ * "address": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
4409
+ * },
4410
+ * {
4348
4411
  * "type": "oracle",
4349
4412
  * "chain_id": 1,
4350
4413
  * "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
@@ -4394,7 +4457,7 @@ interface components {
4394
4457
  * "obligation_shares": "0",
4395
4458
  * "start": 1761922790,
4396
4459
  * "expiry": 1761922799,
4397
- * "price": "2750000000000000000",
4460
+ * "tick": 495,
4398
4461
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
4399
4462
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
4400
4463
  * "callback": "0x0000000000000000000000000000000000000000",
@@ -4438,7 +4501,7 @@ interface components {
4438
4501
  * "obligation_shares": "0",
4439
4502
  * "start": 1761922790,
4440
4503
  * "expiry": 1761922799,
4441
- * "price": "2750000000000000000",
4504
+ * "tick": 495,
4442
4505
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
4443
4506
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
4444
4507
  * "callback": "0x0000000000000000000000000000000000000000",
@@ -4483,8 +4546,8 @@ interface components {
4483
4546
  obligation_units: string; /** @example 0 */
4484
4547
  obligation_shares: string; /** @example 1761922790 */
4485
4548
  start: number; /** @example 1761922799 */
4486
- expiry: number; /** @example 2750000000000000000 */
4487
- price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
4549
+ expiry: number; /** @example 495 */
4550
+ tick: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
4488
4551
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
4489
4552
  session: string; /** @example 0x0000000000000000000000000000000000000000 */
4490
4553
  callback: string; /** @example 0x */
@@ -4633,6 +4696,7 @@ interface components {
4633
4696
  * "chain_id": 1,
4634
4697
  * "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
4635
4698
  * "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
4699
+ * "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
4636
4700
  * "reserved": "200000000000000000000",
4637
4701
  * "block_number": 21345678
4638
4702
  * }
@@ -4643,7 +4707,12 @@ interface components {
4643
4707
  PositionListItemResponse: {
4644
4708
  /** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
4645
4709
  contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
4646
- user: string; /** @example 200000000000000000000 */
4710
+ user: string;
4711
+ /**
4712
+ * @description Obligation id this reserved amount belongs to, or null if no lots exist.
4713
+ * @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
4714
+ */
4715
+ obligation_id: string | null; /** @example 200000000000000000000 */
4647
4716
  reserved: string; /** @example 21345678 */
4648
4717
  block_number: number;
4649
4718
  };
@@ -4654,8 +4723,8 @@ interface components {
4654
4723
  /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
4655
4724
  assets: string; /** @example 0 */
4656
4725
  obligation_units?: string; /** @example 0 */
4657
- obligation_shares?: string; /** @example 2750000000000000000 */
4658
- price: string; /** @example 1761922799 */
4726
+ obligation_shares?: string; /** @example 495 */
4727
+ tick: number; /** @example 1761922799 */
4659
4728
  maturity: number; /** @example 1761922799 */
4660
4729
  expiry: number; /** @example 1761922790 */
4661
4730
  start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
@@ -4736,7 +4805,7 @@ type Input = Readonly<{
4736
4805
  assets: bigint;
4737
4806
  obligationUnits: bigint;
4738
4807
  obligationShares: bigint;
4739
- price: bigint;
4808
+ tick: number;
4740
4809
  maturity: number;
4741
4810
  expiry: number;
4742
4811
  start: number;
@@ -4805,6 +4874,7 @@ type PositionResponse = {
4805
4874
  chain_id: Id;
4806
4875
  contract: Address;
4807
4876
  user: Address;
4877
+ obligation_id: string | null;
4808
4878
  reserved: string;
4809
4879
  block_number: number;
4810
4880
  };
@@ -4855,6 +4925,7 @@ declare const schemas: {
4855
4925
  maturity: "maturity";
4856
4926
  callback: "callback";
4857
4927
  loan_token: "loan_token";
4928
+ collateral_token: "collateral_token";
4858
4929
  }>>>>;
4859
4930
  chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
4860
4931
  }, z$1.core.$strip>;
@@ -5199,7 +5270,7 @@ declare class HttpGetApiFailedError extends BaseError {
5199
5270
  }
5200
5271
  //#endregion
5201
5272
  //#region src/database/drizzle/VERSION.d.ts
5202
- declare const VERSION: "router_v1.6";
5273
+ declare const VERSION: "router_v1.8";
5203
5274
  //#endregion
5204
5275
  //#region src/database/drizzle/schema.d.ts
5205
5276
  declare enum EnumTableName {
@@ -5222,12 +5293,12 @@ declare enum EnumTableName {
5222
5293
  MERKLE_PATHS = "merkle_paths"
5223
5294
  }
5224
5295
  declare const TABLE_NAMES: readonly EnumTableName[];
5225
- declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"" | "\"router_v1.6\".\"lots\"" | "\"router_v1.6\".\"offsets\"" | "\"router_v1.6\".\"trees\"" | "\"router_v1.6\".\"merkle_paths\"")[];
5296
+ declare const VERSIONED_TABLE_NAMES: ("\"router_v1.8\".\"obligations\"" | "\"router_v1.8\".\"groups\"" | "\"router_v1.8\".\"consumed_events\"" | "\"router_v1.8\".\"obligation_collaterals_v2\"" | "\"router_v1.8\".\"oracles\"" | "\"router_v1.8\".\"offers\"" | "\"router_v1.8\".\"offers_callbacks\"" | "\"router_v1.8\".\"callbacks\"" | "\"router_v1.8\".\"positions\"" | "\"router_v1.8\".\"transfers\"" | "\"router_v1.8\".\"validations\"" | "\"router_v1.8\".\"collectors\"" | "\"router_v1.8\".\"chains\"" | "\"router_v1.8\".\"lots\"" | "\"router_v1.8\".\"offsets\"" | "\"router_v1.8\".\"trees\"" | "\"router_v1.8\".\"merkle_paths\"")[];
5226
5297
  type TableName = (typeof TABLE_NAMES)[number];
5227
5298
  type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
5228
5299
  declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5229
5300
  name: EnumTableName.OBLIGATIONS;
5230
- schema: "router_v1.6";
5301
+ schema: "router_v1.8";
5231
5302
  columns: {
5232
5303
  obligationId: drizzle_orm_pg_core0.PgColumn<{
5233
5304
  name: "obligation_id";
@@ -5308,7 +5379,7 @@ declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
5308
5379
  }>;
5309
5380
  declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5310
5381
  name: EnumTableName.GROUPS;
5311
- schema: "router_v1.6";
5382
+ schema: "router_v1.8";
5312
5383
  columns: {
5313
5384
  chainId: drizzle_orm_pg_core0.PgColumn<{
5314
5385
  name: "chain_id";
@@ -5423,7 +5494,7 @@ declare const groups: drizzle_orm_pg_core0.PgTableWithColumns<{
5423
5494
  }>;
5424
5495
  declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
5425
5496
  name: EnumTableName.CONSUMED_EVENTS;
5426
- schema: "router_v1.6";
5497
+ schema: "router_v1.8";
5427
5498
  columns: {
5428
5499
  eventId: drizzle_orm_pg_core0.PgColumn<{
5429
5500
  name: "event_id";
@@ -5557,7 +5628,7 @@ declare const consumedEvents: drizzle_orm_pg_core0.PgTableWithColumns<{
5557
5628
  }>;
5558
5629
  declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5559
5630
  name: EnumTableName.OBLIGATION_COLLATERALS_V2;
5560
- schema: "router_v1.6";
5631
+ schema: "router_v1.8";
5561
5632
  columns: {
5562
5633
  obligationId: drizzle_orm_pg_core0.PgColumn<{
5563
5634
  name: "obligation_id";
@@ -5674,7 +5745,7 @@ declare const obligationCollateralsV2: drizzle_orm_pg_core0.PgTableWithColumns<{
5674
5745
  }>;
5675
5746
  declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
5676
5747
  name: EnumTableName.ORACLES;
5677
- schema: "router_v1.6";
5748
+ schema: "router_v1.8";
5678
5749
  columns: {
5679
5750
  chainId: drizzle_orm_pg_core0.PgColumn<{
5680
5751
  name: "chain_id";
@@ -5770,7 +5841,7 @@ declare const oracles: drizzle_orm_pg_core0.PgTableWithColumns<{
5770
5841
  }>;
5771
5842
  declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
5772
5843
  name: EnumTableName.OFFERS;
5773
- schema: "router_v1.6";
5844
+ schema: "router_v1.8";
5774
5845
  columns: {
5775
5846
  hash: drizzle_orm_pg_core0.PgColumn<{
5776
5847
  name: "hash";
@@ -5861,13 +5932,13 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
5861
5932
  identity: undefined;
5862
5933
  generated: undefined;
5863
5934
  }, {}, {}>;
5864
- price: drizzle_orm_pg_core0.PgColumn<{
5865
- name: "price";
5935
+ tick: drizzle_orm_pg_core0.PgColumn<{
5936
+ name: "tick";
5866
5937
  tableName: EnumTableName.OFFERS;
5867
- dataType: "string";
5868
- columnType: "PgNumeric";
5869
- data: string;
5870
- driverParam: string;
5938
+ dataType: "number";
5939
+ columnType: "PgInteger";
5940
+ data: number;
5941
+ driverParam: string | number;
5871
5942
  notNull: true;
5872
5943
  hasDefault: false;
5873
5944
  isPrimaryKey: false;
@@ -6097,7 +6168,7 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
6097
6168
  }>;
6098
6169
  declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6099
6170
  name: EnumTableName.OFFERS_CALLBACKS;
6100
- schema: "router_v1.6";
6171
+ schema: "router_v1.8";
6101
6172
  columns: {
6102
6173
  offerHash: drizzle_orm_pg_core0.PgColumn<{
6103
6174
  name: "offer_hash";
@@ -6142,7 +6213,7 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
6142
6213
  }>;
6143
6214
  declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6144
6215
  name: EnumTableName.CALLBACKS;
6145
- schema: "router_v1.6";
6216
+ schema: "router_v1.8";
6146
6217
  columns: {
6147
6218
  id: drizzle_orm_pg_core0.PgColumn<{
6148
6219
  name: "id";
@@ -6242,7 +6313,7 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
6242
6313
  }>;
6243
6314
  declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6244
6315
  name: EnumTableName.LOTS;
6245
- schema: "router_v1.6";
6316
+ schema: "router_v1.8";
6246
6317
  columns: {
6247
6318
  chainId: drizzle_orm_pg_core0.PgColumn<{
6248
6319
  name: "chain_id";
@@ -6320,6 +6391,25 @@ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6320
6391
  }, {}, {
6321
6392
  length: 66;
6322
6393
  }>;
6394
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
6395
+ name: "obligation_id";
6396
+ tableName: EnumTableName.LOTS;
6397
+ dataType: "string";
6398
+ columnType: "PgVarchar";
6399
+ data: string;
6400
+ driverParam: string;
6401
+ notNull: true;
6402
+ hasDefault: false;
6403
+ isPrimaryKey: false;
6404
+ isAutoincrement: false;
6405
+ hasRuntimeDefault: false;
6406
+ enumValues: [string, ...string[]];
6407
+ baseColumn: never;
6408
+ identity: undefined;
6409
+ generated: undefined;
6410
+ }, {}, {
6411
+ length: 66;
6412
+ }>;
6323
6413
  lower: drizzle_orm_pg_core0.PgColumn<{
6324
6414
  name: "lower";
6325
6415
  tableName: EnumTableName.LOTS;
@@ -6359,7 +6449,7 @@ declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
6359
6449
  }>;
6360
6450
  declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6361
6451
  name: EnumTableName.OFFSETS;
6362
- schema: "router_v1.6";
6452
+ schema: "router_v1.8";
6363
6453
  columns: {
6364
6454
  chainId: drizzle_orm_pg_core0.PgColumn<{
6365
6455
  name: "chain_id";
@@ -6437,6 +6527,25 @@ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6437
6527
  }, {}, {
6438
6528
  length: 66;
6439
6529
  }>;
6530
+ obligationId: drizzle_orm_pg_core0.PgColumn<{
6531
+ name: "obligation_id";
6532
+ tableName: EnumTableName.OFFSETS;
6533
+ dataType: "string";
6534
+ columnType: "PgVarchar";
6535
+ data: string;
6536
+ driverParam: string;
6537
+ notNull: true;
6538
+ hasDefault: false;
6539
+ isPrimaryKey: false;
6540
+ isAutoincrement: false;
6541
+ hasRuntimeDefault: false;
6542
+ enumValues: [string, ...string[]];
6543
+ baseColumn: never;
6544
+ identity: undefined;
6545
+ generated: undefined;
6546
+ }, {}, {
6547
+ length: 66;
6548
+ }>;
6440
6549
  value: drizzle_orm_pg_core0.PgColumn<{
6441
6550
  name: "value";
6442
6551
  tableName: EnumTableName.OFFSETS;
@@ -6460,7 +6569,7 @@ declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
6460
6569
  declare const PositionTypes: drizzle_orm_pg_core0.PgEnum<[Type, ...Type[]]>;
6461
6570
  declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
6462
6571
  name: "position_types";
6463
- schema: "router_v1.6";
6572
+ schema: "router_v1.8";
6464
6573
  columns: {
6465
6574
  id: drizzle_orm_pg_core0.PgColumn<{
6466
6575
  name: "id";
@@ -6501,7 +6610,7 @@ declare const positionTypes: drizzle_orm_pg_core0.PgTableWithColumns<{
6501
6610
  }>;
6502
6611
  declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6503
6612
  name: EnumTableName.POSITIONS;
6504
- schema: "router_v1.6";
6613
+ schema: "router_v1.8";
6505
6614
  columns: {
6506
6615
  chainId: drizzle_orm_pg_core0.PgColumn<{
6507
6616
  name: "chain_id";
@@ -6652,7 +6761,7 @@ declare const positions: drizzle_orm_pg_core0.PgTableWithColumns<{
6652
6761
  }>;
6653
6762
  declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6654
6763
  name: EnumTableName.TRANSFERS;
6655
- schema: "router_v1.6";
6764
+ schema: "router_v1.8";
6656
6765
  columns: {
6657
6766
  eventId: drizzle_orm_pg_core0.PgColumn<{
6658
6767
  name: "event_id";
@@ -6806,7 +6915,7 @@ declare const transfers: drizzle_orm_pg_core0.PgTableWithColumns<{
6806
6915
  declare const StatusCode: drizzle_orm_pg_core0.PgEnum<[Status, ...Status[]]>;
6807
6916
  declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
6808
6917
  name: "status";
6809
- schema: "router_v1.6";
6918
+ schema: "router_v1.8";
6810
6919
  columns: {
6811
6920
  id: drizzle_orm_pg_core0.PgColumn<{
6812
6921
  name: "id";
@@ -6847,7 +6956,7 @@ declare const status: drizzle_orm_pg_core0.PgTableWithColumns<{
6847
6956
  }>;
6848
6957
  declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
6849
6958
  name: "validations";
6850
- schema: "router_v1.6";
6959
+ schema: "router_v1.8";
6851
6960
  columns: {
6852
6961
  offerHash: drizzle_orm_pg_core0.PgColumn<{
6853
6962
  name: "offer_hash";
@@ -6907,7 +7016,7 @@ declare const validations: drizzle_orm_pg_core0.PgTableWithColumns<{
6907
7016
  }>;
6908
7017
  declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
6909
7018
  name: EnumTableName.COLLECTORS;
6910
- schema: "router_v1.6";
7019
+ schema: "router_v1.8";
6911
7020
  columns: {
6912
7021
  chainId: drizzle_orm_pg_core0.PgColumn<{
6913
7022
  name: "chain_id";
@@ -7003,7 +7112,7 @@ declare const collectors: drizzle_orm_pg_core0.PgTableWithColumns<{
7003
7112
  }>;
7004
7113
  declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
7005
7114
  name: EnumTableName.CHAINS;
7006
- schema: "router_v1.6";
7115
+ schema: "router_v1.8";
7007
7116
  columns: {
7008
7117
  chainId: drizzle_orm_pg_core0.PgColumn<{
7009
7118
  name: "chain_id";
@@ -7080,7 +7189,7 @@ declare const chains$1: drizzle_orm_pg_core0.PgTableWithColumns<{
7080
7189
  }>;
7081
7190
  declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7082
7191
  name: EnumTableName.TREES;
7083
- schema: "router_v1.6";
7192
+ schema: "router_v1.8";
7084
7193
  columns: {
7085
7194
  root: drizzle_orm_pg_core0.PgColumn<{
7086
7195
  name: "root";
@@ -7142,7 +7251,7 @@ declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
7142
7251
  }>;
7143
7252
  declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
7144
7253
  name: EnumTableName.MERKLE_PATHS;
7145
- schema: "router_v1.6";
7254
+ schema: "router_v1.8";
7146
7255
  columns: {
7147
7256
  offerHash: drizzle_orm_pg_core0.PgColumn<{
7148
7257
  name: "offer_hash";
@@ -7224,9 +7333,9 @@ declare namespace index_d_exports$2 {
7224
7333
  }
7225
7334
  //#endregion
7226
7335
  //#region src/gatekeeper/morphoRules.d.ts
7227
- declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token"> | Rule<Offer, "oracle">)[];
7336
+ declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
7228
7337
  declare namespace Rules_d_exports {
7229
- export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
7338
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, collateralToken, loanToken, maturity, oracle, sameMaker, validity };
7230
7339
  }
7231
7340
  type ValidityParameters = {
7232
7341
  client: PublicClient<Transport, Chain$1>;
@@ -7255,15 +7364,25 @@ declare const callback: ({
7255
7364
  allowedAddresses: Address[];
7256
7365
  }) => Rule<Offer, "callback">;
7257
7366
  /**
7258
- * A validation rule that checks if the offer's tokens are allowed for its chain.
7259
- * @param assetsByChainId - Allowed assets indexed by chain id.
7367
+ * A validation rule that checks if the offer's loan token is allowed for its chain.
7368
+ * @param assetsByChainId - Allowed loan tokens indexed by chain id.
7260
7369
  * @returns The issue that was found. If the offer is valid, this will be undefined.
7261
7370
  */
7262
- declare const token: ({
7371
+ declare const loanToken: ({
7263
7372
  assetsByChainId
7264
7373
  }: {
7265
7374
  assetsByChainId: Partial<Record<Id, Address[]>>;
7266
- }) => Rule<Offer, "token">;
7375
+ }) => Rule<Offer, "loan_token">;
7376
+ /**
7377
+ * A validation rule that checks if the offer's collateral tokens are allowed for its chain.
7378
+ * @param collateralAssetsByChainId - Allowed collateral tokens indexed by chain id.
7379
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
7380
+ */
7381
+ declare const collateralToken: ({
7382
+ collateralAssetsByChainId
7383
+ }: {
7384
+ collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
7385
+ }) => Rule<Offer, "collateral_token">;
7267
7386
  /**
7268
7387
  * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
7269
7388
  * @param oraclesByChainId - Allowed oracles indexed by chain id.
@@ -7520,5 +7639,5 @@ declare namespace index_d_exports$3 {
7520
7639
  export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
7521
7640
  }
7522
7641
  //#endregion
7523
- export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigContractsController, ConfigRule, ConfigRulesController, ConfigRulesPayload, Database_d_exports as Database, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports$1 as RouterClient, RouterStatusResponse, Rules_d_exports as Rules, SuccessPayload, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules, parse, safeParse };
7642
+ export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigContractsController, ConfigRule, ConfigRulesController, ConfigRulesPayload, Database_d_exports as Database, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports$1 as RouterClient, RouterStatusResponse, Rules_d_exports as Rules, SuccessPayload, Tick_d_exports as Tick, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules, parse, safeParse };
7524
7643
  //# sourceMappingURL=index.node.d.ts.map