@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.
@@ -29,9 +29,9 @@ declare const CollectorHealth: z.ZodObject<{
29
29
  updated_at: z.ZodNullable<z.ZodString>;
30
30
  lag: z.ZodNullable<z.ZodNumber>;
31
31
  status: z.ZodEnum<{
32
- unknown: "unknown";
33
32
  live: "live";
34
33
  lagging: "lagging";
34
+ unknown: "unknown";
35
35
  }>;
36
36
  initialized: z.ZodBoolean;
37
37
  }, z.core.$strip>;
@@ -42,9 +42,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
42
42
  updated_at: z.ZodNullable<z.ZodString>;
43
43
  lag: z.ZodNullable<z.ZodNumber>;
44
44
  status: z.ZodEnum<{
45
- unknown: "unknown";
46
45
  live: "live";
47
46
  lagging: "lagging";
47
+ unknown: "unknown";
48
48
  }>;
49
49
  initialized: z.ZodBoolean;
50
50
  }, z.core.$strip>>;
@@ -339,94 +339,19 @@ declare const Morpho: readonly [{
339
339
  }];
340
340
  readonly stateMutability: "view";
341
341
  }];
342
- //#endregion
343
- //#region src/core/types.d.ts
344
- /** Combines members of an intersection into a readable type. */
345
- type Compute<type> = { [key in keyof type]: type[key] } & unknown;
346
- declare const BrandTypeId: unique symbol;
347
- type Brand<in out ID extends string | symbol> = {
348
- readonly [BrandTypeId]: { readonly [id in ID]: ID };
349
- };
350
342
  declare namespace Callback_d_exports {
351
- 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 };
343
+ export { Callback, Type$1 as Type, isEmptyCallback };
352
344
  }
353
- /** A position decoded from callback data. */
354
- type CallbackPosition = {
355
- /** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
356
- amount: bigint;
357
- };
358
345
  type Callback = {
359
346
  type: Type$1.BuyWithEmptyCallback;
360
- } | (({
361
- /** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
362
- data: Hex;
363
- } & {
364
- type: Type$1.BuyERC20; /** The decoded callback inputs. */
365
- inputs: {
366
- /** The ERC20 positions available for the callback. */positions: CallbackPosition[];
367
- };
368
- }) & Brand<"Callback">);
347
+ } | {
348
+ type: Type$1.SellWithEmptyCallback;
349
+ };
369
350
  declare enum Type$1 {
370
351
  BuyWithEmptyCallback = "buy_with_empty_callback",
371
- BuyERC20 = "buy_erc20",
372
- BuyVaultV1Callback = "buy_vault_v1_callback",
373
- SellERC20Callback = "sell_erc20_callback"
352
+ SellWithEmptyCallback = "sell_with_empty_callback"
374
353
  }
375
354
  declare const isEmptyCallback: (offer: Offer) => boolean;
376
- declare function decode$2(type: Type$1, data: Hex): {
377
- contract: Address;
378
- amount: bigint;
379
- }[];
380
- type BuyERC20Data = {
381
- tokens: Address[];
382
- amounts: bigint[];
383
- };
384
- type BuyVaultV1CallbackData = {
385
- vaults: Address[];
386
- amounts: bigint[];
387
- };
388
- type SellERC20CallbackData = {
389
- collaterals: Address[];
390
- amounts: bigint[];
391
- };
392
- declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
393
- declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
394
- declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
395
- /**
396
- * Decodes BuyERC20 callback data into positions.
397
- * @param data - The ABI-encoded callback data containing token addresses and amounts.
398
- * @returns Array of positions with contract address and amount.
399
- * @throws If data is empty, malformed, or arrays have mismatched lengths.
400
- */
401
- declare function decodeBuyERC20(data: Hex): Array<{
402
- contract: Address;
403
- amount: bigint;
404
- }>;
405
- /**
406
- * Encodes BuyERC20 callback parameters into ABI-encoded data.
407
- * @param parameters - The tokens and amounts to encode.
408
- * @returns ABI-encoded hex string.
409
- */
410
- declare function encodeBuyERC20(parameters: {
411
- tokens: Address[];
412
- amounts: bigint[];
413
- }): Hex;
414
- declare function decodeBuyVaultV1Callback(data: Hex): Array<{
415
- contract: Address;
416
- amount: bigint;
417
- }>;
418
- declare function decodeSellERC20Callback(data: Hex): Array<{
419
- contract: Address;
420
- amount: bigint;
421
- }>;
422
- declare function encodeBuyVaultV1Callback(parameters: {
423
- vaults: Address[];
424
- amounts: bigint[];
425
- }): Hex;
426
- declare function encodeSellERC20Callback(parameters: {
427
- collaterals: Address[];
428
- amounts: bigint[];
429
- }): Hex;
430
355
  declare namespace Errors_d_exports {
431
356
  export { BaseError, GlobalErrorType, ReorgError };
432
357
  }
@@ -546,6 +471,14 @@ type ChainRegistry = {
546
471
  * @returns A registry for looking up chains by ID. {@link ChainRegistry}
547
472
  */
548
473
  declare function create$1(chains: Chain$1[]): ChainRegistry;
474
+ //#endregion
475
+ //#region src/core/types.d.ts
476
+ /** Combines members of an intersection into a readable type. */
477
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown;
478
+ declare const BrandTypeId: unique symbol;
479
+ type Brand<in out ID extends string | symbol> = {
480
+ readonly [BrandTypeId]: { readonly [id in ID]: ID };
481
+ };
549
482
  declare namespace LLTV_d_exports {
550
483
  export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
551
484
  }
@@ -692,7 +625,7 @@ declare class DenominatorIsZeroError extends BaseError {
692
625
  constructor();
693
626
  }
694
627
  declare namespace Liquidity_d_exports {
695
- export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
628
+ export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
696
629
  }
697
630
  /**
698
631
  * Represents a liquidity pool with a unique ID and amount.
@@ -717,10 +650,7 @@ type OfferLiquidityPool = {
717
650
  poolId: string;
718
651
  /**
719
652
  * The available capacity/liquidity from this pool for this offer.
720
- * Meaning varies by pool type:
721
- * - BuyWithEmptyCallback: Matches allowance amount from pool bellow
722
- * - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
723
- * - SellERC20Callback: Existing debt as negative value (reduces available capacity)
653
+ * Matches allowance amount from pool below.
724
654
  */
725
655
  amount: bigint;
726
656
  };
@@ -748,17 +678,6 @@ declare function generateAllowancePoolId(parameters: {
748
678
  chainId: Id;
749
679
  token: Address;
750
680
  }): string;
751
- /**
752
- * Generate pool ID for sell ERC20 callback pools.
753
- * Each offer has its own callback pool to prevent liquidity conflicts.
754
- */
755
- declare function generateSellERC20CallbackPoolId(parameters: {
756
- user: Address;
757
- chainId: Id;
758
- obligationId: Hex;
759
- token: Address;
760
- offerHash: Hex;
761
- }): string;
762
681
  /**
763
682
  * Generate pool ID for obligation collateral pools.
764
683
  * Obligation collateral pools represent collateral already deposited in the obligation.
@@ -770,15 +689,6 @@ declare function generateObligationCollateralPoolId(parameters: {
770
689
  obligationId: Hex;
771
690
  token: Address;
772
691
  }): string;
773
- /**
774
- * Generate pool ID for buy vault callback pools.
775
- */
776
- declare function generateBuyVaultCallbackPoolId(parameters: {
777
- user: Address;
778
- chainId: Id;
779
- vault: Address;
780
- offerHash: Hex;
781
- }): string;
782
692
  /**
783
693
  * Generate pool ID for debt pools.
784
694
  */
@@ -1015,7 +925,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
1015
925
  constructor();
1016
926
  }
1017
927
  declare namespace Offer_d_exports {
1018
- export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, toSnakeCase, types };
928
+ export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, takeEvent, toSnakeCase, types };
1019
929
  }
1020
930
  type Offer = {
1021
931
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1272,6 +1182,80 @@ type OfferConsumed = {
1272
1182
  amount: bigint;
1273
1183
  blockNumber: number;
1274
1184
  };
1185
+ /**
1186
+ * ABI for the Take event emitted by the Morpho V2 contract.
1187
+ */
1188
+ declare const takeEvent: {
1189
+ readonly type: "event";
1190
+ readonly name: "Take";
1191
+ readonly inputs: readonly [{
1192
+ readonly name: "caller";
1193
+ readonly type: "address";
1194
+ readonly indexed: false;
1195
+ readonly internalType: "address";
1196
+ }, {
1197
+ readonly name: "id";
1198
+ readonly type: "bytes32";
1199
+ readonly indexed: true;
1200
+ readonly internalType: "bytes32";
1201
+ }, {
1202
+ readonly name: "maker";
1203
+ readonly type: "address";
1204
+ readonly indexed: true;
1205
+ readonly internalType: "address";
1206
+ }, {
1207
+ readonly name: "taker";
1208
+ readonly type: "address";
1209
+ readonly indexed: true;
1210
+ readonly internalType: "address";
1211
+ }, {
1212
+ readonly name: "offerIsBuy";
1213
+ readonly type: "bool";
1214
+ readonly indexed: false;
1215
+ readonly internalType: "bool";
1216
+ }, {
1217
+ readonly name: "buyerAssets";
1218
+ readonly type: "uint256";
1219
+ readonly indexed: false;
1220
+ readonly internalType: "uint256";
1221
+ }, {
1222
+ readonly name: "sellerAssets";
1223
+ readonly type: "uint256";
1224
+ readonly indexed: false;
1225
+ readonly internalType: "uint256";
1226
+ }, {
1227
+ readonly name: "obligationUnits";
1228
+ readonly type: "uint256";
1229
+ readonly indexed: false;
1230
+ readonly internalType: "uint256";
1231
+ }, {
1232
+ readonly name: "obligationShares";
1233
+ readonly type: "uint256";
1234
+ readonly indexed: false;
1235
+ readonly internalType: "uint256";
1236
+ }, {
1237
+ readonly name: "buyerIsLender";
1238
+ readonly type: "bool";
1239
+ readonly indexed: false;
1240
+ readonly internalType: "bool";
1241
+ }, {
1242
+ readonly name: "sellerIsBorrower";
1243
+ readonly type: "bool";
1244
+ readonly indexed: false;
1245
+ readonly internalType: "bool";
1246
+ }, {
1247
+ readonly name: "group";
1248
+ readonly type: "bytes32";
1249
+ readonly indexed: false;
1250
+ readonly internalType: "bytes32";
1251
+ }, {
1252
+ readonly name: "consumed";
1253
+ readonly type: "uint256";
1254
+ readonly indexed: false;
1255
+ readonly internalType: "uint256";
1256
+ }];
1257
+ readonly anonymous: false;
1258
+ };
1275
1259
  /**
1276
1260
  * ABI for the Consume event emitted by the Obligation contract.
1277
1261
  */
@@ -1969,7 +1953,7 @@ interface paths {
1969
1953
  };
1970
1954
  /**
1971
1955
  * Get config rules
1972
- * @description Returns configured rules for supported chains.
1956
+ * @description Returns configured rules (maturities, loan tokens, oracles) for supported chains.
1973
1957
  */
1974
1958
  get: {
1975
1959
  parameters: {
@@ -1981,7 +1965,7 @@ interface paths {
1981
1965
  chains?: number[];
1982
1966
  /**
1983
1967
  * @description Filter by rule types (comma-separated).
1984
- * @example maturity,loan_token
1968
+ * @example maturity,loan_token,oracle
1985
1969
  */
1986
1970
  types?: string[];
1987
1971
  /**
@@ -2426,7 +2410,7 @@ interface paths {
2426
2410
  put?: never;
2427
2411
  /**
2428
2412
  * Validate offers
2429
- * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
2413
+ * @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.
2430
2414
  */
2431
2415
  post: {
2432
2416
  parameters: {
@@ -2465,56 +2449,6 @@ interface paths {
2465
2449
  patch?: never;
2466
2450
  trace?: never;
2467
2451
  };
2468
- "/v1/callbacks": {
2469
- parameters: {
2470
- query?: never;
2471
- header?: never;
2472
- path?: never;
2473
- cookie?: never;
2474
- };
2475
- get?: never;
2476
- put?: never;
2477
- /**
2478
- * Resolve callback types
2479
- * @description Returns callback types for callback addresses grouped by chain.
2480
- */
2481
- post: {
2482
- parameters: {
2483
- query?: never;
2484
- header?: never;
2485
- path?: never;
2486
- cookie?: never;
2487
- };
2488
- requestBody?: {
2489
- content: {
2490
- "application/json": components["schemas"]["CallbackTypesRequest"];
2491
- };
2492
- };
2493
- responses: {
2494
- /** @description Success */200: {
2495
- headers: {
2496
- [name: string]: unknown;
2497
- };
2498
- content: {
2499
- "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
2500
- };
2501
- }; /** @description Bad Request */
2502
- 400: {
2503
- headers: {
2504
- [name: string]: unknown;
2505
- };
2506
- content: {
2507
- "application/json": components["schemas"]["BadRequestResponse"];
2508
- };
2509
- };
2510
- };
2511
- };
2512
- delete?: never;
2513
- options?: never;
2514
- head?: never;
2515
- patch?: never;
2516
- trace?: never;
2517
- };
2518
2452
  }
2519
2453
  interface components {
2520
2454
  schemas: {
@@ -2599,15 +2533,14 @@ interface components {
2599
2533
  * "timestamp": 1730415600
2600
2534
  * },
2601
2535
  * {
2602
- * "type": "callback",
2536
+ * "type": "loan_token",
2603
2537
  * "chain_id": 1,
2604
- * "address": "0x1111111111111111111111111111111111111111",
2605
- * "callback_type": "sell_erc20_callback"
2538
+ * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
2606
2539
  * },
2607
2540
  * {
2608
- * "type": "loan_token",
2541
+ * "type": "oracle",
2609
2542
  * "chain_id": 1,
2610
- * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
2543
+ * "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
2611
2544
  * }
2612
2545
  * ]
2613
2546
  */
@@ -2621,12 +2554,15 @@ interface components {
2621
2554
  /** @example maturity */type: string; /** @example 1 */
2622
2555
  chain_id: number; /** @example end_of_next_month */
2623
2556
  name?: string; /** @example 1730415600 */
2624
- timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
2625
- address?: string; /** @example sell_erc20_callback */
2626
- callback_type?: string;
2557
+ timestamp?: number; /** @example 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 */
2558
+ address?: string;
2627
2559
  };
2628
2560
  OfferListResponse: {
2629
- meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
2561
+ meta: components["schemas"]["Meta"];
2562
+ /**
2563
+ * @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
2564
+ * @example eyJvZmZzZXQiOjEwMH0
2565
+ */
2630
2566
  cursor: string | null;
2631
2567
  /**
2632
2568
  * @description Offers matching the provided filters.
@@ -2654,8 +2590,8 @@ interface components {
2654
2590
  * "price": "2750000000000000000",
2655
2591
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
2656
2592
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
2657
- * "callback": "0x1111111111111111111111111111111111111111",
2658
- * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2593
+ * "callback": "0x0000000000000000000000000000000000000000",
2594
+ * "callback_data": "0x"
2659
2595
  * },
2660
2596
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
2661
2597
  * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
@@ -2698,8 +2634,8 @@ interface components {
2698
2634
  * "price": "2750000000000000000",
2699
2635
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
2700
2636
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
2701
- * "callback": "0x1111111111111111111111111111111111111111",
2702
- * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2637
+ * "callback": "0x0000000000000000000000000000000000000000",
2638
+ * "callback_data": "0x"
2703
2639
  * }
2704
2640
  */
2705
2641
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
@@ -2743,8 +2679,8 @@ interface components {
2743
2679
  expiry: number; /** @example 2750000000000000000 */
2744
2680
  price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2745
2681
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2746
- session: string; /** @example 0x1111111111111111111111111111111111111111 */
2747
- callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2682
+ session: string; /** @example 0x0000000000000000000000000000000000000000 */
2683
+ callback: string; /** @example 0x */
2748
2684
  callback_data: string;
2749
2685
  };
2750
2686
  ObligationOfferResponse: {
@@ -2933,8 +2869,8 @@ interface components {
2933
2869
  collaterals: components["schemas"]["ValidateCollateralRequest"][];
2934
2870
  /**
2935
2871
  * @example {
2936
- * "address": "0x1111111111111111111111111111111111111111",
2937
- * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2872
+ * "address": "0x0000000000000000000000000000000000000000",
2873
+ * "data": "0x"
2938
2874
  * }
2939
2875
  */
2940
2876
  callback: components["schemas"]["ValidateCallbackRequest"];
@@ -2945,7 +2881,7 @@ interface components {
2945
2881
  lltv: string;
2946
2882
  };
2947
2883
  ValidateCallbackRequest: {
2948
- /** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2884
+ /** @example 0x0000000000000000000000000000000000000000 */address: string; /** @example 0x */
2949
2885
  data: string;
2950
2886
  };
2951
2887
  ValidationSuccessResponse: {
@@ -2965,84 +2901,6 @@ interface components {
2965
2901
  */
2966
2902
  root: string;
2967
2903
  };
2968
- CallbackTypesRequest: {
2969
- /**
2970
- * @example [
2971
- * {
2972
- * "chain_id": 1,
2973
- * "addresses": [
2974
- * "0x1111111111111111111111111111111111111111",
2975
- * "0x3333333333333333333333333333333333333333",
2976
- * "0x9999999999999999999999999999999999999999"
2977
- * ]
2978
- * }
2979
- * ]
2980
- */
2981
- callbacks: components["schemas"]["CallbackTypesChainRequest"][];
2982
- };
2983
- CallbackTypesChainRequest: {
2984
- /** @example 1 */chain_id: number;
2985
- /**
2986
- * @example [
2987
- * "0x1111111111111111111111111111111111111111",
2988
- * "0x3333333333333333333333333333333333333333",
2989
- * "0x9999999999999999999999999999999999999999"
2990
- * ]
2991
- */
2992
- addresses: string[];
2993
- };
2994
- CallbackTypesSuccessResponse: {
2995
- meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
2996
- cursor: string | null;
2997
- /**
2998
- * @description Callback types grouped by chain.
2999
- * @example [
3000
- * {
3001
- * "chain_id": 1,
3002
- * "sell_erc20_callback": [
3003
- * "0x1111111111111111111111111111111111111111"
3004
- * ],
3005
- * "buy_erc20": [
3006
- * "0x5555555555555555555555555555555555555555"
3007
- * ],
3008
- * "buy_vault_v1_callback": [
3009
- * "0x3333333333333333333333333333333333333333"
3010
- * ],
3011
- * "not_supported": [
3012
- * "0x9999999999999999999999999999999999999999"
3013
- * ]
3014
- * }
3015
- * ]
3016
- */
3017
- data: components["schemas"]["CallbackTypesChainResponse"][];
3018
- };
3019
- CallbackTypesChainResponse: {
3020
- /** @example 1 */chain_id: number;
3021
- /**
3022
- * @example [
3023
- * "0x3333333333333333333333333333333333333333"
3024
- * ]
3025
- */
3026
- buy_vault_v1_callback?: string[];
3027
- /**
3028
- * @example [
3029
- * "0x1111111111111111111111111111111111111111"
3030
- * ]
3031
- */
3032
- sell_erc20_callback?: string[];
3033
- /**
3034
- * @example [
3035
- * "0x5555555555555555555555555555555555555555"
3036
- * ]
3037
- */
3038
- buy_erc20?: string[];
3039
- /**
3040
- * @example [
3041
- * "0x9999999999999999999999999999999999999999"
3042
- * ]
3043
- */
3044
- not_supported: string[];
3045
- };
3046
2904
  };
3047
2905
  responses: never;
3048
2906
  parameters: never;
@@ -3111,9 +2969,6 @@ declare class BooksController {
3111
2969
  declare class ValidateController {
3112
2970
  validateOffers(): Promise<void>;
3113
2971
  }
3114
- declare class CallbacksController {
3115
- resolveCallbackTypes(): Promise<void>;
3116
- }
3117
2972
  declare class OffersController {
3118
2973
  getOffers(): Promise<void>;
3119
2974
  }
@@ -3214,19 +3069,32 @@ declare const schemas: {
3214
3069
  maturity: "maturity";
3215
3070
  callback: "callback";
3216
3071
  loan_token: "loan_token";
3072
+ oracle: "oracle";
3217
3073
  }>>>>;
3218
3074
  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>>>>>;
3219
3075
  }, z$1.core.$strip>;
3220
- readonly get_offers: z$1.ZodObject<{
3076
+ readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
3077
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3078
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3221
3079
  side: z$1.ZodOptional<z$1.ZodEnum<{
3222
3080
  buy: "buy";
3223
3081
  sell: "sell";
3224
3082
  }>>;
3225
3083
  obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3226
3084
  maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3227
- cursor: z$1.ZodOptional<z$1.ZodString>;
3228
- limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3229
- }, z$1.core.$strip>;
3085
+ }, z$1.core.$strip>, z$1.ZodTransform<{
3086
+ limit: number;
3087
+ cursor?: string | undefined;
3088
+ side?: "buy" | "sell" | undefined;
3089
+ obligation_id?: `0x${string}` | undefined;
3090
+ maker?: `0x${string}` | undefined;
3091
+ }, {
3092
+ limit: number;
3093
+ cursor?: string | undefined;
3094
+ side?: "buy" | "sell" | undefined;
3095
+ obligation_id?: `0x${string}` | undefined;
3096
+ maker?: `0x${string}` | undefined;
3097
+ }>>;
3230
3098
  readonly get_obligations: z$1.ZodObject<{
3231
3099
  cursor: z$1.ZodOptional<z$1.ZodString>;
3232
3100
  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>>>>>;
@@ -3250,12 +3118,6 @@ declare const schemas: {
3250
3118
  readonly validate_offers: z$1.ZodObject<{
3251
3119
  offers: z$1.ZodArray<z$1.ZodUnknown>;
3252
3120
  }, z$1.core.$strict>;
3253
- readonly callback_types: z$1.ZodObject<{
3254
- callbacks: z$1.ZodArray<z$1.ZodObject<{
3255
- chain_id: z$1.ZodNumber;
3256
- addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3257
- }, z$1.core.$strict>>;
3258
- }, z$1.core.$strict>;
3259
3121
  readonly get_user_positions: z$1.ZodObject<{
3260
3122
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
3261
3123
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -3266,7 +3128,7 @@ type Action = keyof typeof schemas;
3266
3128
  declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
3267
3129
  declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
3268
3130
  declare namespace index_d_exports$1 {
3269
- export { BookResponse_d_exports as BookResponse, BooksController, CallbacksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
3131
+ export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
3270
3132
  }
3271
3133
  declare namespace Client_d_exports$1 {
3272
3134
  export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -3480,6 +3342,10 @@ type ConfigRule = {
3480
3342
  type: "loan_token";
3481
3343
  chain_id: Id;
3482
3344
  address: Address;
3345
+ } | {
3346
+ type: "oracle";
3347
+ chain_id: Id;
3348
+ address: Address;
3483
3349
  };
3484
3350
  type ValidationIssue = {
3485
3351
  index: number;
@@ -3494,16 +3360,6 @@ type ValidateOffersIssues = {
3494
3360
  issues: ValidationIssue[];
3495
3361
  };
3496
3362
  type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
3497
- type CallbackType = Type$1 | "not_supported";
3498
- type CallbackTypesRequest = {
3499
- callbacks: Array<{
3500
- chain_id: Id;
3501
- addresses: Address[];
3502
- }>;
3503
- };
3504
- type CallbackTypesResponse = Array<{
3505
- chain_id: Id;
3506
- } & Partial<Record<CallbackType, Address[]>>>;
3507
3363
  type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
3508
3364
  type SuccessPayload<T> = {
3509
3365
  meta: {
@@ -3540,8 +3396,7 @@ type GatekeeperClient = {
3540
3396
  statusCode: number;
3541
3397
  body: ConfigRulesPayload;
3542
3398
  }>; /** Validate offers and return decision results. */
3543
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
3544
- getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
3399
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3545
3400
  baseUrl: string;
3546
3401
  };
3547
3402
  type ClientConfig = {
@@ -3574,9 +3429,9 @@ type GatekeeperParameters = {
3574
3429
  declare function create(parameters: GatekeeperParameters): Gatekeeper;
3575
3430
  //#endregion
3576
3431
  //#region src/gatekeeper/morphoRules.d.ts
3577
- 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">)[];
3432
+ 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">)[];
3578
3433
  declare namespace Rules_d_exports {
3579
- export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
3434
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
3580
3435
  }
3581
3436
  type ValidityParameters = {
3582
3437
  client: PublicClient<Transport, Chain$1>;
@@ -3584,10 +3439,10 @@ type ValidityParameters = {
3584
3439
  /**
3585
3440
  * set of rules to validate offers.
3586
3441
  *
3587
- * @param parameters - Validity parameters with chain and client
3442
+ * @param _parameters - Validity parameters with chain and client
3588
3443
  * @returns Array of validation rules to evaluate against offers
3589
3444
  */
3590
- declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
3445
+ declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
3591
3446
  declare const chains: ({
3592
3447
  chains
3593
3448
  }: {
@@ -3599,8 +3454,7 @@ declare const maturity: ({
3599
3454
  maturities: MaturityType[];
3600
3455
  }) => Rule<Offer, "maturity">;
3601
3456
  declare const callback: ({
3602
- callbacks,
3603
- allowedAddresses
3457
+ callbacks
3604
3458
  }: {
3605
3459
  callbacks: Type$1[];
3606
3460
  allowedAddresses: Address[];
@@ -3615,6 +3469,16 @@ declare const token: ({
3615
3469
  }: {
3616
3470
  assetsByChainId: Partial<Record<Id, Address[]>>;
3617
3471
  }) => Rule<Offer, "token">;
3472
+ /**
3473
+ * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
3474
+ * @param oraclesByChainId - Allowed oracles indexed by chain id.
3475
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
3476
+ */
3477
+ declare const oracle: ({
3478
+ oraclesByChainId
3479
+ }: {
3480
+ oraclesByChainId: Partial<Record<Id, Address[]>>;
3481
+ }) => Rule<Offer, "oracle">;
3618
3482
  /**
3619
3483
  * A batch validation rule that ensures all offers in a tree have the same maker address.
3620
3484
  * Returns an issue only for the first non-conforming offer.
@@ -3819,5 +3683,5 @@ declare namespace index_d_exports$2 {
3819
3683
  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 };
3820
3684
  }
3821
3685
  //#endregion
3822
- export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, CallbackType, CallbackTypesRequest, CallbackTypesResponse, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, 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, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, 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, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
3686
+ export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, 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, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, 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, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
3823
3687
  //# sourceMappingURL=index.browser.d.ts.map