@morpho-dev/router 0.6.0 → 0.7.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.
@@ -2,10 +2,10 @@ import { AbiEvent, Account, Address, ChainContract, ChainFormatters, Client, Get
2
2
  import { Chain } from "viem/chains";
3
3
  import * as z$1 from "zod";
4
4
  import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
5
+ import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
5
6
  import { z } from "zod/v4";
6
7
  import "reflect-metadata";
7
8
  import { OpenAPIDocument } from "openapi-metadata";
8
- import * as drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
9
9
  import { Client as Client$1 } from "openapi-fetch";
10
10
  import { PGlite } from "@electric-sql/pglite";
11
11
  import { drizzle } from "drizzle-orm/node-postgres";
@@ -273,94 +273,19 @@ declare const Morpho: readonly [{
273
273
  }];
274
274
  readonly stateMutability: "view";
275
275
  }];
276
- //#endregion
277
- //#region src/core/types.d.ts
278
- /** Combines members of an intersection into a readable type. */
279
- type Compute<type> = { [key in keyof type]: type[key] } & unknown;
280
- declare const BrandTypeId: unique symbol;
281
- type Brand<in out ID extends string | symbol> = {
282
- readonly [BrandTypeId]: { readonly [id in ID]: ID };
283
- };
284
276
  declare namespace Callback_d_exports {
285
- export { BuyERC20Data, BuyVaultV1CallbackData, Callback, CallbackPosition, SellERC20CallbackData, Type$1 as Type, decode$2 as decode, decodeBuyERC20, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyERC20, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
277
+ export { Callback, Type$1 as Type, isEmptyCallback };
286
278
  }
287
- /** A position decoded from callback data. */
288
- type CallbackPosition = {
289
- /** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
290
- amount: bigint;
291
- };
292
279
  type Callback = {
293
280
  type: Type$1.BuyWithEmptyCallback;
294
- } | (({
295
- /** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
296
- data: Hex;
297
- } & {
298
- type: Type$1.BuyERC20; /** The decoded callback inputs. */
299
- inputs: {
300
- /** The ERC20 positions available for the callback. */positions: CallbackPosition[];
301
- };
302
- }) & Brand<"Callback">);
281
+ } | {
282
+ type: Type$1.SellWithEmptyCallback;
283
+ };
303
284
  declare enum Type$1 {
304
285
  BuyWithEmptyCallback = "buy_with_empty_callback",
305
- BuyERC20 = "buy_erc20",
306
- BuyVaultV1Callback = "buy_vault_v1_callback",
307
- SellERC20Callback = "sell_erc20_callback"
286
+ SellWithEmptyCallback = "sell_with_empty_callback"
308
287
  }
309
288
  declare const isEmptyCallback: (offer: Offer) => boolean;
310
- declare function decode$2(type: Type$1, data: Hex): {
311
- contract: Address;
312
- amount: bigint;
313
- }[];
314
- type BuyERC20Data = {
315
- tokens: Address[];
316
- amounts: bigint[];
317
- };
318
- type BuyVaultV1CallbackData = {
319
- vaults: Address[];
320
- amounts: bigint[];
321
- };
322
- type SellERC20CallbackData = {
323
- collaterals: Address[];
324
- amounts: bigint[];
325
- };
326
- declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
327
- declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
328
- declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
329
- /**
330
- * Decodes BuyERC20 callback data into positions.
331
- * @param data - The ABI-encoded callback data containing token addresses and amounts.
332
- * @returns Array of positions with contract address and amount.
333
- * @throws If data is empty, malformed, or arrays have mismatched lengths.
334
- */
335
- declare function decodeBuyERC20(data: Hex): Array<{
336
- contract: Address;
337
- amount: bigint;
338
- }>;
339
- /**
340
- * Encodes BuyERC20 callback parameters into ABI-encoded data.
341
- * @param parameters - The tokens and amounts to encode.
342
- * @returns ABI-encoded hex string.
343
- */
344
- declare function encodeBuyERC20(parameters: {
345
- tokens: Address[];
346
- amounts: bigint[];
347
- }): Hex;
348
- declare function decodeBuyVaultV1Callback(data: Hex): Array<{
349
- contract: Address;
350
- amount: bigint;
351
- }>;
352
- declare function decodeSellERC20Callback(data: Hex): Array<{
353
- contract: Address;
354
- amount: bigint;
355
- }>;
356
- declare function encodeBuyVaultV1Callback(parameters: {
357
- vaults: Address[];
358
- amounts: bigint[];
359
- }): Hex;
360
- declare function encodeSellERC20Callback(parameters: {
361
- collaterals: Address[];
362
- amounts: bigint[];
363
- }): Hex;
364
289
  declare namespace Errors_d_exports {
365
290
  export { BaseError, GlobalErrorType, ReorgError };
366
291
  }
@@ -480,6 +405,14 @@ type ChainRegistry = {
480
405
  * @returns A registry for looking up chains by ID. {@link ChainRegistry}
481
406
  */
482
407
  declare function create$6(chains: Chain$1[]): ChainRegistry;
408
+ //#endregion
409
+ //#region src/core/types.d.ts
410
+ /** Combines members of an intersection into a readable type. */
411
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown;
412
+ declare const BrandTypeId: unique symbol;
413
+ type Brand<in out ID extends string | symbol> = {
414
+ readonly [BrandTypeId]: { readonly [id in ID]: ID };
415
+ };
483
416
  declare namespace LLTV_d_exports {
484
417
  export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$17 as from };
485
418
  }
@@ -626,7 +559,7 @@ declare class DenominatorIsZeroError extends BaseError {
626
559
  constructor();
627
560
  }
628
561
  declare namespace Liquidity_d_exports {
629
- export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
562
+ export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
630
563
  }
631
564
  /**
632
565
  * Represents a liquidity pool with a unique ID and amount.
@@ -651,10 +584,7 @@ type OfferLiquidityPool = {
651
584
  poolId: string;
652
585
  /**
653
586
  * The available capacity/liquidity from this pool for this offer.
654
- * Meaning varies by pool type:
655
- * - BuyWithEmptyCallback: Matches allowance amount from pool bellow
656
- * - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
657
- * - SellERC20Callback: Existing debt as negative value (reduces available capacity)
587
+ * Matches allowance amount from pool below.
658
588
  */
659
589
  amount: bigint;
660
590
  };
@@ -682,17 +612,6 @@ declare function generateAllowancePoolId(parameters: {
682
612
  chainId: Id;
683
613
  token: Address;
684
614
  }): string;
685
- /**
686
- * Generate pool ID for sell ERC20 callback pools.
687
- * Each offer has its own callback pool to prevent liquidity conflicts.
688
- */
689
- declare function generateSellERC20CallbackPoolId(parameters: {
690
- user: Address;
691
- chainId: Id;
692
- obligationId: Hex;
693
- token: Address;
694
- offerHash: Hex;
695
- }): string;
696
615
  /**
697
616
  * Generate pool ID for obligation collateral pools.
698
617
  * Obligation collateral pools represent collateral already deposited in the obligation.
@@ -704,15 +623,6 @@ declare function generateObligationCollateralPoolId(parameters: {
704
623
  obligationId: Hex;
705
624
  token: Address;
706
625
  }): string;
707
- /**
708
- * Generate pool ID for buy vault callback pools.
709
- */
710
- declare function generateBuyVaultCallbackPoolId(parameters: {
711
- user: Address;
712
- chainId: Id;
713
- vault: Address;
714
- offerHash: Hex;
715
- }): string;
716
626
  /**
717
627
  * Generate pool ID for debt pools.
718
628
  */
@@ -949,7 +859,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
949
859
  constructor();
950
860
  }
951
861
  declare namespace Offer_d_exports {
952
- export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
862
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$13 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, takeEvent, toSnakeCase, types };
953
863
  }
954
864
  type Offer = {
955
865
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1206,6 +1116,80 @@ type OfferConsumed = {
1206
1116
  amount: bigint;
1207
1117
  blockNumber: number;
1208
1118
  };
1119
+ /**
1120
+ * ABI for the Take event emitted by the Morpho V2 contract.
1121
+ */
1122
+ declare const takeEvent: {
1123
+ readonly type: "event";
1124
+ readonly name: "Take";
1125
+ readonly inputs: readonly [{
1126
+ readonly name: "caller";
1127
+ readonly type: "address";
1128
+ readonly indexed: false;
1129
+ readonly internalType: "address";
1130
+ }, {
1131
+ readonly name: "id";
1132
+ readonly type: "bytes32";
1133
+ readonly indexed: true;
1134
+ readonly internalType: "bytes32";
1135
+ }, {
1136
+ readonly name: "maker";
1137
+ readonly type: "address";
1138
+ readonly indexed: true;
1139
+ readonly internalType: "address";
1140
+ }, {
1141
+ readonly name: "taker";
1142
+ readonly type: "address";
1143
+ readonly indexed: true;
1144
+ readonly internalType: "address";
1145
+ }, {
1146
+ readonly name: "offerIsBuy";
1147
+ readonly type: "bool";
1148
+ readonly indexed: false;
1149
+ readonly internalType: "bool";
1150
+ }, {
1151
+ readonly name: "buyerAssets";
1152
+ readonly type: "uint256";
1153
+ readonly indexed: false;
1154
+ readonly internalType: "uint256";
1155
+ }, {
1156
+ readonly name: "sellerAssets";
1157
+ readonly type: "uint256";
1158
+ readonly indexed: false;
1159
+ readonly internalType: "uint256";
1160
+ }, {
1161
+ readonly name: "obligationUnits";
1162
+ readonly type: "uint256";
1163
+ readonly indexed: false;
1164
+ readonly internalType: "uint256";
1165
+ }, {
1166
+ readonly name: "obligationShares";
1167
+ readonly type: "uint256";
1168
+ readonly indexed: false;
1169
+ readonly internalType: "uint256";
1170
+ }, {
1171
+ readonly name: "buyerIsLender";
1172
+ readonly type: "bool";
1173
+ readonly indexed: false;
1174
+ readonly internalType: "bool";
1175
+ }, {
1176
+ readonly name: "sellerIsBorrower";
1177
+ readonly type: "bool";
1178
+ readonly indexed: false;
1179
+ readonly internalType: "bool";
1180
+ }, {
1181
+ readonly name: "group";
1182
+ readonly type: "bytes32";
1183
+ readonly indexed: false;
1184
+ readonly internalType: "bytes32";
1185
+ }, {
1186
+ readonly name: "consumed";
1187
+ readonly type: "uint256";
1188
+ readonly indexed: false;
1189
+ readonly internalType: "uint256";
1190
+ }];
1191
+ readonly anonymous: false;
1192
+ };
1209
1193
  /**
1210
1194
  * ABI for the Consume event emitted by the Obligation contract.
1211
1195
  */
@@ -2393,6 +2377,10 @@ type ConfigRule = {
2393
2377
  type: "loan_token";
2394
2378
  chain_id: Id;
2395
2379
  address: Address;
2380
+ } | {
2381
+ type: "oracle";
2382
+ chain_id: Id;
2383
+ address: Address;
2396
2384
  };
2397
2385
  type ValidationIssue = {
2398
2386
  index: number;
@@ -2407,16 +2395,6 @@ type ValidateOffersIssues = {
2407
2395
  issues: ValidationIssue[];
2408
2396
  };
2409
2397
  type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
2410
- type CallbackType = Type$1 | "not_supported";
2411
- type CallbackTypesRequest = {
2412
- callbacks: Array<{
2413
- chain_id: Id;
2414
- addresses: Address[];
2415
- }>;
2416
- };
2417
- type CallbackTypesResponse = Array<{
2418
- chain_id: Id;
2419
- } & Partial<Record<CallbackType, Address[]>>>;
2420
2398
  type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
2421
2399
  type SuccessPayload<T> = {
2422
2400
  meta: {
@@ -2453,8 +2431,7 @@ type GatekeeperClient = {
2453
2431
  statusCode: number;
2454
2432
  body: ConfigRulesPayload;
2455
2433
  }>; /** Validate offers and return decision results. */
2456
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
2457
- getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
2434
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
2458
2435
  baseUrl: string;
2459
2436
  };
2460
2437
  type ClientConfig = {
@@ -2776,7 +2753,7 @@ interface paths {
2776
2753
  };
2777
2754
  /**
2778
2755
  * Get config rules
2779
- * @description Returns configured rules for supported chains.
2756
+ * @description Returns configured rules (maturities, loan tokens, oracles) for supported chains.
2780
2757
  */
2781
2758
  get: {
2782
2759
  parameters: {
@@ -2788,7 +2765,7 @@ interface paths {
2788
2765
  chains?: number[];
2789
2766
  /**
2790
2767
  * @description Filter by rule types (comma-separated).
2791
- * @example maturity,loan_token
2768
+ * @example maturity,loan_token,oracle
2792
2769
  */
2793
2770
  types?: string[];
2794
2771
  /**
@@ -3233,7 +3210,7 @@ interface paths {
3233
3210
  put?: never;
3234
3211
  /**
3235
3212
  * Validate offers
3236
- * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
3213
+ * @description Validates offers against router validation rules. Only empty callbacks (zero address, 0x data) are accepted. Returns unsigned payload + root on success, or issues only on validation failure.
3237
3214
  */
3238
3215
  post: {
3239
3216
  parameters: {
@@ -3272,56 +3249,6 @@ interface paths {
3272
3249
  patch?: never;
3273
3250
  trace?: never;
3274
3251
  };
3275
- "/v1/callbacks": {
3276
- parameters: {
3277
- query?: never;
3278
- header?: never;
3279
- path?: never;
3280
- cookie?: never;
3281
- };
3282
- get?: never;
3283
- put?: never;
3284
- /**
3285
- * Resolve callback types
3286
- * @description Returns callback types for callback addresses grouped by chain.
3287
- */
3288
- post: {
3289
- parameters: {
3290
- query?: never;
3291
- header?: never;
3292
- path?: never;
3293
- cookie?: never;
3294
- };
3295
- requestBody?: {
3296
- content: {
3297
- "application/json": components["schemas"]["CallbackTypesRequest"];
3298
- };
3299
- };
3300
- responses: {
3301
- /** @description Success */200: {
3302
- headers: {
3303
- [name: string]: unknown;
3304
- };
3305
- content: {
3306
- "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
3307
- };
3308
- }; /** @description Bad Request */
3309
- 400: {
3310
- headers: {
3311
- [name: string]: unknown;
3312
- };
3313
- content: {
3314
- "application/json": components["schemas"]["BadRequestResponse"];
3315
- };
3316
- };
3317
- };
3318
- };
3319
- delete?: never;
3320
- options?: never;
3321
- head?: never;
3322
- patch?: never;
3323
- trace?: never;
3324
- };
3325
3252
  }
3326
3253
  interface components {
3327
3254
  schemas: {
@@ -3406,15 +3333,14 @@ interface components {
3406
3333
  * "timestamp": 1730415600
3407
3334
  * },
3408
3335
  * {
3409
- * "type": "callback",
3336
+ * "type": "loan_token",
3410
3337
  * "chain_id": 1,
3411
- * "address": "0x1111111111111111111111111111111111111111",
3412
- * "callback_type": "sell_erc20_callback"
3338
+ * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
3413
3339
  * },
3414
3340
  * {
3415
- * "type": "loan_token",
3341
+ * "type": "oracle",
3416
3342
  * "chain_id": 1,
3417
- * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
3343
+ * "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
3418
3344
  * }
3419
3345
  * ]
3420
3346
  */
@@ -3428,12 +3354,15 @@ interface components {
3428
3354
  /** @example maturity */type: string; /** @example 1 */
3429
3355
  chain_id: number; /** @example end_of_next_month */
3430
3356
  name?: string; /** @example 1730415600 */
3431
- timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
3432
- address?: string; /** @example sell_erc20_callback */
3433
- callback_type?: string;
3357
+ timestamp?: number; /** @example 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 */
3358
+ address?: string;
3434
3359
  };
3435
3360
  OfferListResponse: {
3436
- meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
3361
+ meta: components["schemas"]["Meta"];
3362
+ /**
3363
+ * @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
3364
+ * @example eyJvZmZzZXQiOjEwMH0
3365
+ */
3437
3366
  cursor: string | null;
3438
3367
  /**
3439
3368
  * @description Offers matching the provided filters.
@@ -3461,8 +3390,8 @@ interface components {
3461
3390
  * "price": "2750000000000000000",
3462
3391
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
3463
3392
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
3464
- * "callback": "0x1111111111111111111111111111111111111111",
3465
- * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
3393
+ * "callback": "0x0000000000000000000000000000000000000000",
3394
+ * "callback_data": "0x"
3466
3395
  * },
3467
3396
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
3468
3397
  * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
@@ -3505,8 +3434,8 @@ interface components {
3505
3434
  * "price": "2750000000000000000",
3506
3435
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
3507
3436
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
3508
- * "callback": "0x1111111111111111111111111111111111111111",
3509
- * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
3437
+ * "callback": "0x0000000000000000000000000000000000000000",
3438
+ * "callback_data": "0x"
3510
3439
  * }
3511
3440
  */
3512
3441
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
@@ -3550,8 +3479,8 @@ interface components {
3550
3479
  expiry: number; /** @example 2750000000000000000 */
3551
3480
  price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
3552
3481
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
3553
- session: string; /** @example 0x1111111111111111111111111111111111111111 */
3554
- callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
3482
+ session: string; /** @example 0x0000000000000000000000000000000000000000 */
3483
+ callback: string; /** @example 0x */
3555
3484
  callback_data: string;
3556
3485
  };
3557
3486
  ObligationOfferResponse: {
@@ -3740,8 +3669,8 @@ interface components {
3740
3669
  collaterals: components["schemas"]["ValidateCollateralRequest"][];
3741
3670
  /**
3742
3671
  * @example {
3743
- * "address": "0x1111111111111111111111111111111111111111",
3744
- * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
3672
+ * "address": "0x0000000000000000000000000000000000000000",
3673
+ * "data": "0x"
3745
3674
  * }
3746
3675
  */
3747
3676
  callback: components["schemas"]["ValidateCallbackRequest"];
@@ -3752,7 +3681,7 @@ interface components {
3752
3681
  lltv: string;
3753
3682
  };
3754
3683
  ValidateCallbackRequest: {
3755
- /** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
3684
+ /** @example 0x0000000000000000000000000000000000000000 */address: string; /** @example 0x */
3756
3685
  data: string;
3757
3686
  };
3758
3687
  ValidationSuccessResponse: {
@@ -3772,84 +3701,6 @@ interface components {
3772
3701
  */
3773
3702
  root: string;
3774
3703
  };
3775
- CallbackTypesRequest: {
3776
- /**
3777
- * @example [
3778
- * {
3779
- * "chain_id": 1,
3780
- * "addresses": [
3781
- * "0x1111111111111111111111111111111111111111",
3782
- * "0x3333333333333333333333333333333333333333",
3783
- * "0x9999999999999999999999999999999999999999"
3784
- * ]
3785
- * }
3786
- * ]
3787
- */
3788
- callbacks: components["schemas"]["CallbackTypesChainRequest"][];
3789
- };
3790
- CallbackTypesChainRequest: {
3791
- /** @example 1 */chain_id: number;
3792
- /**
3793
- * @example [
3794
- * "0x1111111111111111111111111111111111111111",
3795
- * "0x3333333333333333333333333333333333333333",
3796
- * "0x9999999999999999999999999999999999999999"
3797
- * ]
3798
- */
3799
- addresses: string[];
3800
- };
3801
- CallbackTypesSuccessResponse: {
3802
- meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
3803
- cursor: string | null;
3804
- /**
3805
- * @description Callback types grouped by chain.
3806
- * @example [
3807
- * {
3808
- * "chain_id": 1,
3809
- * "sell_erc20_callback": [
3810
- * "0x1111111111111111111111111111111111111111"
3811
- * ],
3812
- * "buy_erc20": [
3813
- * "0x5555555555555555555555555555555555555555"
3814
- * ],
3815
- * "buy_vault_v1_callback": [
3816
- * "0x3333333333333333333333333333333333333333"
3817
- * ],
3818
- * "not_supported": [
3819
- * "0x9999999999999999999999999999999999999999"
3820
- * ]
3821
- * }
3822
- * ]
3823
- */
3824
- data: components["schemas"]["CallbackTypesChainResponse"][];
3825
- };
3826
- CallbackTypesChainResponse: {
3827
- /** @example 1 */chain_id: number;
3828
- /**
3829
- * @example [
3830
- * "0x3333333333333333333333333333333333333333"
3831
- * ]
3832
- */
3833
- buy_vault_v1_callback?: string[];
3834
- /**
3835
- * @example [
3836
- * "0x1111111111111111111111111111111111111111"
3837
- * ]
3838
- */
3839
- sell_erc20_callback?: string[];
3840
- /**
3841
- * @example [
3842
- * "0x5555555555555555555555555555555555555555"
3843
- * ]
3844
- */
3845
- buy_erc20?: string[];
3846
- /**
3847
- * @example [
3848
- * "0x9999999999999999999999999999999999999999"
3849
- * ]
3850
- */
3851
- not_supported: string[];
3852
- };
3853
3704
  };
3854
3705
  responses: never;
3855
3706
  parameters: never;
@@ -3918,9 +3769,6 @@ declare class BooksController {
3918
3769
  declare class ValidateController {
3919
3770
  validateOffers(): Promise<void>;
3920
3771
  }
3921
- declare class CallbacksController {
3922
- resolveCallbackTypes(): Promise<void>;
3923
- }
3924
3772
  declare class OffersController {
3925
3773
  getOffers(): Promise<void>;
3926
3774
  }
@@ -3996,22 +3844,35 @@ declare const schemas: {
3996
3844
  cursor: z$1.ZodOptional<z$1.ZodString>;
3997
3845
  limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3998
3846
  types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
3847
+ loan_token: "loan_token";
3999
3848
  maturity: "maturity";
4000
3849
  callback: "callback";
4001
- loan_token: "loan_token";
3850
+ oracle: "oracle";
4002
3851
  }>>>>;
4003
3852
  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>>>>>;
4004
3853
  }, z$1.core.$strip>;
4005
- readonly get_offers: z$1.ZodObject<{
3854
+ readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
3855
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3856
+ cursor: z$1.ZodOptional<z$1.ZodString>;
4006
3857
  side: z$1.ZodOptional<z$1.ZodEnum<{
4007
3858
  buy: "buy";
4008
3859
  sell: "sell";
4009
3860
  }>>;
4010
3861
  obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
4011
3862
  maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
4012
- cursor: z$1.ZodOptional<z$1.ZodString>;
4013
- limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
4014
- }, z$1.core.$strip>;
3863
+ }, z$1.core.$strip>, z$1.ZodTransform<{
3864
+ limit: number;
3865
+ cursor?: string | undefined;
3866
+ side?: "buy" | "sell" | undefined;
3867
+ obligation_id?: `0x${string}` | undefined;
3868
+ maker?: `0x${string}` | undefined;
3869
+ }, {
3870
+ limit: number;
3871
+ cursor?: string | undefined;
3872
+ side?: "buy" | "sell" | undefined;
3873
+ obligation_id?: `0x${string}` | undefined;
3874
+ maker?: `0x${string}` | undefined;
3875
+ }>>;
4015
3876
  readonly get_obligations: z$1.ZodObject<{
4016
3877
  cursor: z$1.ZodOptional<z$1.ZodString>;
4017
3878
  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>>>>>;
@@ -4035,12 +3896,6 @@ declare const schemas: {
4035
3896
  readonly validate_offers: z$1.ZodObject<{
4036
3897
  offers: z$1.ZodArray<z$1.ZodUnknown>;
4037
3898
  }, z$1.core.$strict>;
4038
- readonly callback_types: z$1.ZodObject<{
4039
- callbacks: z$1.ZodArray<z$1.ZodObject<{
4040
- chain_id: z$1.ZodNumber;
4041
- addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
4042
- }, z$1.core.$strict>>;
4043
- }, z$1.core.$strict>;
4044
3899
  readonly get_user_positions: z$1.ZodObject<{
4045
3900
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
4046
3901
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -4168,16 +4023,6 @@ declare function getOffers$1(queryParameters: object, db: Database): Promise<Pay
4168
4023
  * @returns Paginated list of positions with remaining balances.
4169
4024
  */
4170
4025
  declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
4171
- //#endregion
4172
- //#region src/api/Controllers/resolveCallbackTypes.d.ts
4173
- type CallbackTypesPayload = SuccessPayload$1<CallbackTypesResponse>;
4174
- /**
4175
- * Resolve callback types for a list of callback addresses grouped by chain.
4176
- * @param body - Request body with callback addresses. {@link CallbackTypesRequest}
4177
- * @param chains - Chains to resolve callback types against. {@link Chain.Chain}
4178
- * @returns Callback types grouped by chain. {@link CallbackTypesPayload}
4179
- */
4180
- declare function resolveCallbackTypes(body: object, chains: Chain$1[]): Promise<CallbackTypesPayload | ErrorPayload$1>;
4181
4026
  declare namespace Gatekeeper_d_exports {
4182
4027
  export { Gatekeeper, Rules, create };
4183
4028
  }
@@ -4211,10 +4056,10 @@ type ValidateOffersIssuesPayload = SuccessPayload$1<{
4211
4056
  type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
4212
4057
  declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload$1>;
4213
4058
  declare namespace index_d_exports$4 {
4214
- export { CONFIG_CONTRACT_NAMES, ConfigContract, ConfigContractName, GetOffersQueryParams, ValidationIssue$1 as ValidationIssue, getBook, getConfigContracts, getConfigRules, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getOffersQuery, getSwaggerJson, getUserPositions, resolveCallbackTypes, validateOffers };
4059
+ export { CONFIG_CONTRACT_NAMES, ConfigContract, ConfigContractName, GetOffersQueryParams, ValidationIssue$1 as ValidationIssue, getBook, getConfigContracts, getConfigRules, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getOffersQuery, getSwaggerJson, getUserPositions, validateOffers };
4215
4060
  }
4216
4061
  declare namespace RouterApi_d_exports {
4217
- export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, UsersController, ValidateController, create$1 as create, from$5 as from, parse, safeParse };
4062
+ export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, UsersController, ValidateController, create$1 as create, from$5 as from, parse, safeParse };
4218
4063
  }
4219
4064
  declare namespace Client_d_exports$1 {
4220
4065
  export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -6371,9 +6216,9 @@ declare namespace index_d_exports$2 {
6371
6216
  }
6372
6217
  //#endregion
6373
6218
  //#region src/gatekeeper/morphoRules.d.ts
6374
- 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">)[];
6219
+ 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">)[];
6375
6220
  declare namespace Rules_d_exports {
6376
- export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
6221
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
6377
6222
  }
6378
6223
  type ValidityParameters = {
6379
6224
  client: PublicClient<Transport, Chain$1>;
@@ -6381,10 +6226,10 @@ type ValidityParameters = {
6381
6226
  /**
6382
6227
  * set of rules to validate offers.
6383
6228
  *
6384
- * @param parameters - Validity parameters with chain and client
6229
+ * @param _parameters - Validity parameters with chain and client
6385
6230
  * @returns Array of validation rules to evaluate against offers
6386
6231
  */
6387
- declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
6232
+ declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
6388
6233
  declare const chains: ({
6389
6234
  chains
6390
6235
  }: {
@@ -6396,8 +6241,7 @@ declare const maturity: ({
6396
6241
  maturities: MaturityType[];
6397
6242
  }) => Rule<Offer, "maturity">;
6398
6243
  declare const callback: ({
6399
- callbacks,
6400
- allowedAddresses
6244
+ callbacks
6401
6245
  }: {
6402
6246
  callbacks: Type$1[];
6403
6247
  allowedAddresses: Address[];
@@ -6412,6 +6256,16 @@ declare const token: ({
6412
6256
  }: {
6413
6257
  assetsByChainId: Partial<Record<Id, Address[]>>;
6414
6258
  }) => Rule<Offer, "token">;
6259
+ /**
6260
+ * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
6261
+ * @param oraclesByChainId - Allowed oracles indexed by chain id.
6262
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
6263
+ */
6264
+ declare const oracle: ({
6265
+ oraclesByChainId
6266
+ }: {
6267
+ oraclesByChainId: Partial<Record<Id, Address[]>>;
6268
+ }) => Rule<Offer, "oracle">;
6415
6269
  /**
6416
6270
  * A batch validation rule that ensures all offers in a tree have the same maker address.
6417
6271
  * Returns an issue only for the first non-conforming offer.
@@ -6658,5 +6512,5 @@ declare namespace index_d_exports$3 {
6658
6512
  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 };
6659
6513
  }
6660
6514
  //#endregion
6661
- export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, CallbacksController, 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 };
6515
+ 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 };
6662
6516
  //# sourceMappingURL=index.node.d.mts.map