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