@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.
@@ -34,9 +34,9 @@ declare const CollectorHealth: z.ZodObject<{
34
34
  updated_at: z.ZodNullable<z.ZodString>;
35
35
  lag: z.ZodNullable<z.ZodNumber>;
36
36
  status: z.ZodEnum<{
37
- unknown: "unknown";
38
37
  live: "live";
39
38
  lagging: "lagging";
39
+ unknown: "unknown";
40
40
  }>;
41
41
  initialized: z.ZodBoolean;
42
42
  }, z.core.$strip>;
@@ -47,9 +47,9 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
47
47
  updated_at: z.ZodNullable<z.ZodString>;
48
48
  lag: z.ZodNullable<z.ZodNumber>;
49
49
  status: z.ZodEnum<{
50
- unknown: "unknown";
51
50
  live: "live";
52
51
  lagging: "lagging";
52
+ unknown: "unknown";
53
53
  }>;
54
54
  initialized: z.ZodBoolean;
55
55
  }, z.core.$strip>>;
@@ -344,94 +344,19 @@ declare const Morpho: readonly [{
344
344
  }];
345
345
  readonly stateMutability: "view";
346
346
  }];
347
- //#endregion
348
- //#region src/core/types.d.ts
349
- /** Combines members of an intersection into a readable type. */
350
- type Compute<type> = { [key in keyof type]: type[key] } & unknown;
351
- declare const BrandTypeId: unique symbol;
352
- type Brand<in out ID extends string | symbol> = {
353
- readonly [BrandTypeId]: { readonly [id in ID]: ID };
354
- };
355
347
  declare namespace Callback_d_exports {
356
- 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 };
348
+ export { Callback, Type$1 as Type, isEmptyCallback };
357
349
  }
358
- /** A position decoded from callback data. */
359
- type CallbackPosition = {
360
- /** The ERC20 token contract address. */contract: Address; /** The maximum amount available from this position. */
361
- amount: bigint;
362
- };
363
350
  type Callback = {
364
351
  type: Type$1.BuyWithEmptyCallback;
365
- } | (({
366
- /** The address of the callback contract. */address: Address; /** The ABI-encoded callback data. */
367
- data: Hex;
368
- } & {
369
- type: Type$1.BuyERC20; /** The decoded callback inputs. */
370
- inputs: {
371
- /** The ERC20 positions available for the callback. */positions: CallbackPosition[];
372
- };
373
- }) & Brand<"Callback">);
352
+ } | {
353
+ type: Type$1.SellWithEmptyCallback;
354
+ };
374
355
  declare enum Type$1 {
375
356
  BuyWithEmptyCallback = "buy_with_empty_callback",
376
- BuyERC20 = "buy_erc20",
377
- BuyVaultV1Callback = "buy_vault_v1_callback",
378
- SellERC20Callback = "sell_erc20_callback"
357
+ SellWithEmptyCallback = "sell_with_empty_callback"
379
358
  }
380
359
  declare const isEmptyCallback: (offer: Offer) => boolean;
381
- declare function decode$2(type: Type$1, data: Hex): {
382
- contract: Address;
383
- amount: bigint;
384
- }[];
385
- type BuyERC20Data = {
386
- tokens: Address[];
387
- amounts: bigint[];
388
- };
389
- type BuyVaultV1CallbackData = {
390
- vaults: Address[];
391
- amounts: bigint[];
392
- };
393
- type SellERC20CallbackData = {
394
- collaterals: Address[];
395
- amounts: bigint[];
396
- };
397
- declare function encode$2(type: Type$1.BuyERC20, data: BuyERC20Data): Hex;
398
- declare function encode$2(type: Type$1.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
399
- declare function encode$2(type: Type$1.SellERC20Callback, data: SellERC20CallbackData): Hex;
400
- /**
401
- * Decodes BuyERC20 callback data into positions.
402
- * @param data - The ABI-encoded callback data containing token addresses and amounts.
403
- * @returns Array of positions with contract address and amount.
404
- * @throws If data is empty, malformed, or arrays have mismatched lengths.
405
- */
406
- declare function decodeBuyERC20(data: Hex): Array<{
407
- contract: Address;
408
- amount: bigint;
409
- }>;
410
- /**
411
- * Encodes BuyERC20 callback parameters into ABI-encoded data.
412
- * @param parameters - The tokens and amounts to encode.
413
- * @returns ABI-encoded hex string.
414
- */
415
- declare function encodeBuyERC20(parameters: {
416
- tokens: Address[];
417
- amounts: bigint[];
418
- }): Hex;
419
- declare function decodeBuyVaultV1Callback(data: Hex): Array<{
420
- contract: Address;
421
- amount: bigint;
422
- }>;
423
- declare function decodeSellERC20Callback(data: Hex): Array<{
424
- contract: Address;
425
- amount: bigint;
426
- }>;
427
- declare function encodeBuyVaultV1Callback(parameters: {
428
- vaults: Address[];
429
- amounts: bigint[];
430
- }): Hex;
431
- declare function encodeSellERC20Callback(parameters: {
432
- collaterals: Address[];
433
- amounts: bigint[];
434
- }): Hex;
435
360
  declare namespace Errors_d_exports {
436
361
  export { BaseError, GlobalErrorType, ReorgError };
437
362
  }
@@ -551,6 +476,14 @@ type ChainRegistry = {
551
476
  * @returns A registry for looking up chains by ID. {@link ChainRegistry}
552
477
  */
553
478
  declare function create$1(chains: Chain$1[]): ChainRegistry;
479
+ //#endregion
480
+ //#region src/core/types.d.ts
481
+ /** Combines members of an intersection into a readable type. */
482
+ type Compute<type> = { [key in keyof type]: type[key] } & unknown;
483
+ declare const BrandTypeId: unique symbol;
484
+ type Brand<in out ID extends string | symbol> = {
485
+ readonly [BrandTypeId]: { readonly [id in ID]: ID };
486
+ };
554
487
  declare namespace LLTV_d_exports {
555
488
  export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
556
489
  }
@@ -697,7 +630,7 @@ declare class DenominatorIsZeroError extends BaseError {
697
630
  constructor();
698
631
  }
699
632
  declare namespace Liquidity_d_exports {
700
- export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
633
+ export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
701
634
  }
702
635
  /**
703
636
  * Represents a liquidity pool with a unique ID and amount.
@@ -722,10 +655,7 @@ type OfferLiquidityPool = {
722
655
  poolId: string;
723
656
  /**
724
657
  * The available capacity/liquidity from this pool for this offer.
725
- * Meaning varies by pool type:
726
- * - BuyWithEmptyCallback: Matches allowance amount from pool bellow
727
- * - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
728
- * - SellERC20Callback: Existing debt as negative value (reduces available capacity)
658
+ * Matches allowance amount from pool below.
729
659
  */
730
660
  amount: bigint;
731
661
  };
@@ -753,17 +683,6 @@ declare function generateAllowancePoolId(parameters: {
753
683
  chainId: Id;
754
684
  token: Address;
755
685
  }): string;
756
- /**
757
- * Generate pool ID for sell ERC20 callback pools.
758
- * Each offer has its own callback pool to prevent liquidity conflicts.
759
- */
760
- declare function generateSellERC20CallbackPoolId(parameters: {
761
- user: Address;
762
- chainId: Id;
763
- obligationId: Hex;
764
- token: Address;
765
- offerHash: Hex;
766
- }): string;
767
686
  /**
768
687
  * Generate pool ID for obligation collateral pools.
769
688
  * Obligation collateral pools represent collateral already deposited in the obligation.
@@ -775,15 +694,6 @@ declare function generateObligationCollateralPoolId(parameters: {
775
694
  obligationId: Hex;
776
695
  token: Address;
777
696
  }): string;
778
- /**
779
- * Generate pool ID for buy vault callback pools.
780
- */
781
- declare function generateBuyVaultCallbackPoolId(parameters: {
782
- user: Address;
783
- chainId: Id;
784
- vault: Address;
785
- offerHash: Hex;
786
- }): string;
787
697
  /**
788
698
  * Generate pool ID for debt pools.
789
699
  */
@@ -1020,7 +930,7 @@ declare class CollateralsAreNotSortedError extends BaseError {
1020
930
  constructor();
1021
931
  }
1022
932
  declare namespace Offer_d_exports {
1023
- 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 };
933
+ 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 };
1024
934
  }
1025
935
  type Offer = {
1026
936
  /** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
@@ -1277,6 +1187,80 @@ type OfferConsumed = {
1277
1187
  amount: bigint;
1278
1188
  blockNumber: number;
1279
1189
  };
1190
+ /**
1191
+ * ABI for the Take event emitted by the Morpho V2 contract.
1192
+ */
1193
+ declare const takeEvent: {
1194
+ readonly type: "event";
1195
+ readonly name: "Take";
1196
+ readonly inputs: readonly [{
1197
+ readonly name: "caller";
1198
+ readonly type: "address";
1199
+ readonly indexed: false;
1200
+ readonly internalType: "address";
1201
+ }, {
1202
+ readonly name: "id";
1203
+ readonly type: "bytes32";
1204
+ readonly indexed: true;
1205
+ readonly internalType: "bytes32";
1206
+ }, {
1207
+ readonly name: "maker";
1208
+ readonly type: "address";
1209
+ readonly indexed: true;
1210
+ readonly internalType: "address";
1211
+ }, {
1212
+ readonly name: "taker";
1213
+ readonly type: "address";
1214
+ readonly indexed: true;
1215
+ readonly internalType: "address";
1216
+ }, {
1217
+ readonly name: "offerIsBuy";
1218
+ readonly type: "bool";
1219
+ readonly indexed: false;
1220
+ readonly internalType: "bool";
1221
+ }, {
1222
+ readonly name: "buyerAssets";
1223
+ readonly type: "uint256";
1224
+ readonly indexed: false;
1225
+ readonly internalType: "uint256";
1226
+ }, {
1227
+ readonly name: "sellerAssets";
1228
+ readonly type: "uint256";
1229
+ readonly indexed: false;
1230
+ readonly internalType: "uint256";
1231
+ }, {
1232
+ readonly name: "obligationUnits";
1233
+ readonly type: "uint256";
1234
+ readonly indexed: false;
1235
+ readonly internalType: "uint256";
1236
+ }, {
1237
+ readonly name: "obligationShares";
1238
+ readonly type: "uint256";
1239
+ readonly indexed: false;
1240
+ readonly internalType: "uint256";
1241
+ }, {
1242
+ readonly name: "buyerIsLender";
1243
+ readonly type: "bool";
1244
+ readonly indexed: false;
1245
+ readonly internalType: "bool";
1246
+ }, {
1247
+ readonly name: "sellerIsBorrower";
1248
+ readonly type: "bool";
1249
+ readonly indexed: false;
1250
+ readonly internalType: "bool";
1251
+ }, {
1252
+ readonly name: "group";
1253
+ readonly type: "bytes32";
1254
+ readonly indexed: false;
1255
+ readonly internalType: "bytes32";
1256
+ }, {
1257
+ readonly name: "consumed";
1258
+ readonly type: "uint256";
1259
+ readonly indexed: false;
1260
+ readonly internalType: "uint256";
1261
+ }];
1262
+ readonly anonymous: false;
1263
+ };
1280
1264
  /**
1281
1265
  * ABI for the Consume event emitted by the Obligation contract.
1282
1266
  */
@@ -1974,7 +1958,7 @@ interface paths {
1974
1958
  };
1975
1959
  /**
1976
1960
  * Get config rules
1977
- * @description Returns configured rules for supported chains.
1961
+ * @description Returns configured rules (maturities, loan tokens, oracles) for supported chains.
1978
1962
  */
1979
1963
  get: {
1980
1964
  parameters: {
@@ -1986,7 +1970,7 @@ interface paths {
1986
1970
  chains?: number[];
1987
1971
  /**
1988
1972
  * @description Filter by rule types (comma-separated).
1989
- * @example maturity,loan_token
1973
+ * @example maturity,loan_token,oracle
1990
1974
  */
1991
1975
  types?: string[];
1992
1976
  /**
@@ -2431,7 +2415,7 @@ interface paths {
2431
2415
  put?: never;
2432
2416
  /**
2433
2417
  * Validate offers
2434
- * @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
2418
+ * @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.
2435
2419
  */
2436
2420
  post: {
2437
2421
  parameters: {
@@ -2470,56 +2454,6 @@ interface paths {
2470
2454
  patch?: never;
2471
2455
  trace?: never;
2472
2456
  };
2473
- "/v1/callbacks": {
2474
- parameters: {
2475
- query?: never;
2476
- header?: never;
2477
- path?: never;
2478
- cookie?: never;
2479
- };
2480
- get?: never;
2481
- put?: never;
2482
- /**
2483
- * Resolve callback types
2484
- * @description Returns callback types for callback addresses grouped by chain.
2485
- */
2486
- post: {
2487
- parameters: {
2488
- query?: never;
2489
- header?: never;
2490
- path?: never;
2491
- cookie?: never;
2492
- };
2493
- requestBody?: {
2494
- content: {
2495
- "application/json": components["schemas"]["CallbackTypesRequest"];
2496
- };
2497
- };
2498
- responses: {
2499
- /** @description Success */200: {
2500
- headers: {
2501
- [name: string]: unknown;
2502
- };
2503
- content: {
2504
- "application/json": components["schemas"]["CallbackTypesSuccessResponse"];
2505
- };
2506
- }; /** @description Bad Request */
2507
- 400: {
2508
- headers: {
2509
- [name: string]: unknown;
2510
- };
2511
- content: {
2512
- "application/json": components["schemas"]["BadRequestResponse"];
2513
- };
2514
- };
2515
- };
2516
- };
2517
- delete?: never;
2518
- options?: never;
2519
- head?: never;
2520
- patch?: never;
2521
- trace?: never;
2522
- };
2523
2457
  }
2524
2458
  interface components {
2525
2459
  schemas: {
@@ -2604,15 +2538,14 @@ interface components {
2604
2538
  * "timestamp": 1730415600
2605
2539
  * },
2606
2540
  * {
2607
- * "type": "callback",
2541
+ * "type": "loan_token",
2608
2542
  * "chain_id": 1,
2609
- * "address": "0x1111111111111111111111111111111111111111",
2610
- * "callback_type": "sell_erc20_callback"
2543
+ * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
2611
2544
  * },
2612
2545
  * {
2613
- * "type": "loan_token",
2546
+ * "type": "oracle",
2614
2547
  * "chain_id": 1,
2615
- * "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
2548
+ * "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
2616
2549
  * }
2617
2550
  * ]
2618
2551
  */
@@ -2626,12 +2559,15 @@ interface components {
2626
2559
  /** @example maturity */type: string; /** @example 1 */
2627
2560
  chain_id: number; /** @example end_of_next_month */
2628
2561
  name?: string; /** @example 1730415600 */
2629
- timestamp?: number; /** @example 0x1111111111111111111111111111111111111111 */
2630
- address?: string; /** @example sell_erc20_callback */
2631
- callback_type?: string;
2562
+ timestamp?: number; /** @example 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 */
2563
+ address?: string;
2632
2564
  };
2633
2565
  OfferListResponse: {
2634
- meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
2566
+ meta: components["schemas"]["Meta"];
2567
+ /**
2568
+ * @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
2569
+ * @example eyJvZmZzZXQiOjEwMH0
2570
+ */
2635
2571
  cursor: string | null;
2636
2572
  /**
2637
2573
  * @description Offers matching the provided filters.
@@ -2659,8 +2595,8 @@ interface components {
2659
2595
  * "price": "2750000000000000000",
2660
2596
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
2661
2597
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
2662
- * "callback": "0x1111111111111111111111111111111111111111",
2663
- * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2598
+ * "callback": "0x0000000000000000000000000000000000000000",
2599
+ * "callback_data": "0x"
2664
2600
  * },
2665
2601
  * "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
2666
2602
  * "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
@@ -2703,8 +2639,8 @@ interface components {
2703
2639
  * "price": "2750000000000000000",
2704
2640
  * "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
2705
2641
  * "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
2706
- * "callback": "0x1111111111111111111111111111111111111111",
2707
- * "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2642
+ * "callback": "0x0000000000000000000000000000000000000000",
2643
+ * "callback_data": "0x"
2708
2644
  * }
2709
2645
  */
2710
2646
  offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
@@ -2748,8 +2684,8 @@ interface components {
2748
2684
  expiry: number; /** @example 2750000000000000000 */
2749
2685
  price: string; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
2750
2686
  group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
2751
- session: string; /** @example 0x1111111111111111111111111111111111111111 */
2752
- callback: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2687
+ session: string; /** @example 0x0000000000000000000000000000000000000000 */
2688
+ callback: string; /** @example 0x */
2753
2689
  callback_data: string;
2754
2690
  };
2755
2691
  ObligationOfferResponse: {
@@ -2938,8 +2874,8 @@ interface components {
2938
2874
  collaterals: components["schemas"]["ValidateCollateralRequest"][];
2939
2875
  /**
2940
2876
  * @example {
2941
- * "address": "0x1111111111111111111111111111111111111111",
2942
- * "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
2877
+ * "address": "0x0000000000000000000000000000000000000000",
2878
+ * "data": "0x"
2943
2879
  * }
2944
2880
  */
2945
2881
  callback: components["schemas"]["ValidateCallbackRequest"];
@@ -2950,7 +2886,7 @@ interface components {
2950
2886
  lltv: string;
2951
2887
  };
2952
2888
  ValidateCallbackRequest: {
2953
- /** @example 0x1111111111111111111111111111111111111111 */address: string; /** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
2889
+ /** @example 0x0000000000000000000000000000000000000000 */address: string; /** @example 0x */
2954
2890
  data: string;
2955
2891
  };
2956
2892
  ValidationSuccessResponse: {
@@ -2970,84 +2906,6 @@ interface components {
2970
2906
  */
2971
2907
  root: string;
2972
2908
  };
2973
- CallbackTypesRequest: {
2974
- /**
2975
- * @example [
2976
- * {
2977
- * "chain_id": 1,
2978
- * "addresses": [
2979
- * "0x1111111111111111111111111111111111111111",
2980
- * "0x3333333333333333333333333333333333333333",
2981
- * "0x9999999999999999999999999999999999999999"
2982
- * ]
2983
- * }
2984
- * ]
2985
- */
2986
- callbacks: components["schemas"]["CallbackTypesChainRequest"][];
2987
- };
2988
- CallbackTypesChainRequest: {
2989
- /** @example 1 */chain_id: number;
2990
- /**
2991
- * @example [
2992
- * "0x1111111111111111111111111111111111111111",
2993
- * "0x3333333333333333333333333333333333333333",
2994
- * "0x9999999999999999999999999999999999999999"
2995
- * ]
2996
- */
2997
- addresses: string[];
2998
- };
2999
- CallbackTypesSuccessResponse: {
3000
- meta: components["schemas"]["Meta"]; /** @example maturity:1:1730415600:end_of_next_month */
3001
- cursor: string | null;
3002
- /**
3003
- * @description Callback types grouped by chain.
3004
- * @example [
3005
- * {
3006
- * "chain_id": 1,
3007
- * "sell_erc20_callback": [
3008
- * "0x1111111111111111111111111111111111111111"
3009
- * ],
3010
- * "buy_erc20": [
3011
- * "0x5555555555555555555555555555555555555555"
3012
- * ],
3013
- * "buy_vault_v1_callback": [
3014
- * "0x3333333333333333333333333333333333333333"
3015
- * ],
3016
- * "not_supported": [
3017
- * "0x9999999999999999999999999999999999999999"
3018
- * ]
3019
- * }
3020
- * ]
3021
- */
3022
- data: components["schemas"]["CallbackTypesChainResponse"][];
3023
- };
3024
- CallbackTypesChainResponse: {
3025
- /** @example 1 */chain_id: number;
3026
- /**
3027
- * @example [
3028
- * "0x3333333333333333333333333333333333333333"
3029
- * ]
3030
- */
3031
- buy_vault_v1_callback?: string[];
3032
- /**
3033
- * @example [
3034
- * "0x1111111111111111111111111111111111111111"
3035
- * ]
3036
- */
3037
- sell_erc20_callback?: string[];
3038
- /**
3039
- * @example [
3040
- * "0x5555555555555555555555555555555555555555"
3041
- * ]
3042
- */
3043
- buy_erc20?: string[];
3044
- /**
3045
- * @example [
3046
- * "0x9999999999999999999999999999999999999999"
3047
- * ]
3048
- */
3049
- not_supported: string[];
3050
- };
3051
2909
  };
3052
2910
  responses: never;
3053
2911
  parameters: never;
@@ -3116,9 +2974,6 @@ declare class BooksController {
3116
2974
  declare class ValidateController {
3117
2975
  validateOffers(): Promise<void>;
3118
2976
  }
3119
- declare class CallbacksController {
3120
- resolveCallbackTypes(): Promise<void>;
3121
- }
3122
2977
  declare class OffersController {
3123
2978
  getOffers(): Promise<void>;
3124
2979
  }
@@ -3219,19 +3074,32 @@ declare const schemas: {
3219
3074
  maturity: "maturity";
3220
3075
  callback: "callback";
3221
3076
  loan_token: "loan_token";
3077
+ oracle: "oracle";
3222
3078
  }>>>>;
3223
3079
  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>>>>>;
3224
3080
  }, z$1.core.$strip>;
3225
- readonly get_offers: z$1.ZodObject<{
3081
+ readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
3082
+ limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3083
+ cursor: z$1.ZodOptional<z$1.ZodString>;
3226
3084
  side: z$1.ZodOptional<z$1.ZodEnum<{
3227
3085
  buy: "buy";
3228
3086
  sell: "sell";
3229
3087
  }>>;
3230
3088
  obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3231
3089
  maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3232
- cursor: z$1.ZodOptional<z$1.ZodString>;
3233
- limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
3234
- }, z$1.core.$strip>;
3090
+ }, z$1.core.$strip>, z$1.ZodTransform<{
3091
+ limit: number;
3092
+ cursor?: string | undefined;
3093
+ side?: "buy" | "sell" | undefined;
3094
+ obligation_id?: `0x${string}` | undefined;
3095
+ maker?: `0x${string}` | undefined;
3096
+ }, {
3097
+ limit: number;
3098
+ cursor?: string | undefined;
3099
+ side?: "buy" | "sell" | undefined;
3100
+ obligation_id?: `0x${string}` | undefined;
3101
+ maker?: `0x${string}` | undefined;
3102
+ }>>;
3235
3103
  readonly get_obligations: z$1.ZodObject<{
3236
3104
  cursor: z$1.ZodOptional<z$1.ZodString>;
3237
3105
  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>>>>>;
@@ -3255,12 +3123,6 @@ declare const schemas: {
3255
3123
  readonly validate_offers: z$1.ZodObject<{
3256
3124
  offers: z$1.ZodArray<z$1.ZodUnknown>;
3257
3125
  }, z$1.core.$strict>;
3258
- readonly callback_types: z$1.ZodObject<{
3259
- callbacks: z$1.ZodArray<z$1.ZodObject<{
3260
- chain_id: z$1.ZodNumber;
3261
- addresses: z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
3262
- }, z$1.core.$strict>>;
3263
- }, z$1.core.$strict>;
3264
3126
  readonly get_user_positions: z$1.ZodObject<{
3265
3127
  user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
3266
3128
  cursor: z$1.ZodOptional<z$1.ZodString>;
@@ -3271,7 +3133,7 @@ type Action = keyof typeof schemas;
3271
3133
  declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
3272
3134
  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]>>;
3273
3135
  declare namespace index_d_exports$1 {
3274
- 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 };
3136
+ 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 };
3275
3137
  }
3276
3138
  declare namespace Client_d_exports$1 {
3277
3139
  export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
@@ -3485,6 +3347,10 @@ type ConfigRule = {
3485
3347
  type: "loan_token";
3486
3348
  chain_id: Id;
3487
3349
  address: Address;
3350
+ } | {
3351
+ type: "oracle";
3352
+ chain_id: Id;
3353
+ address: Address;
3488
3354
  };
3489
3355
  type ValidationIssue = {
3490
3356
  index: number;
@@ -3499,16 +3365,6 @@ type ValidateOffersIssues = {
3499
3365
  issues: ValidationIssue[];
3500
3366
  };
3501
3367
  type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
3502
- type CallbackType = Type$1 | "not_supported";
3503
- type CallbackTypesRequest = {
3504
- callbacks: Array<{
3505
- chain_id: Id;
3506
- addresses: Address[];
3507
- }>;
3508
- };
3509
- type CallbackTypesResponse = Array<{
3510
- chain_id: Id;
3511
- } & Partial<Record<CallbackType, Address[]>>>;
3512
3368
  type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
3513
3369
  type SuccessPayload<T> = {
3514
3370
  meta: {
@@ -3545,8 +3401,7 @@ type GatekeeperClient = {
3545
3401
  statusCode: number;
3546
3402
  body: ConfigRulesPayload;
3547
3403
  }>; /** Validate offers and return decision results. */
3548
- isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Resolve callback types for callback addresses. */
3549
- getCallbackTypes: (request: CallbackTypesRequest) => Promise<CallbackTypesResponse>; /** Base URL for the gatekeeper service. */
3404
+ isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
3550
3405
  baseUrl: string;
3551
3406
  };
3552
3407
  type ClientConfig = {
@@ -3579,9 +3434,9 @@ type GatekeeperParameters = {
3579
3434
  declare function create(parameters: GatekeeperParameters): Gatekeeper;
3580
3435
  //#endregion
3581
3436
  //#region src/gatekeeper/morphoRules.d.ts
3582
- 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">)[];
3437
+ 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">)[];
3583
3438
  declare namespace Rules_d_exports {
3584
- export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
3439
+ export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, oracle, sameMaker, token, validity };
3585
3440
  }
3586
3441
  type ValidityParameters = {
3587
3442
  client: PublicClient<Transport, Chain$1>;
@@ -3589,10 +3444,10 @@ type ValidityParameters = {
3589
3444
  /**
3590
3445
  * set of rules to validate offers.
3591
3446
  *
3592
- * @param parameters - Validity parameters with chain and client
3447
+ * @param _parameters - Validity parameters with chain and client
3593
3448
  * @returns Array of validation rules to evaluate against offers
3594
3449
  */
3595
- declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
3450
+ declare function validity(_parameters: ValidityParameters): Rule<Offer, "expiry">[];
3596
3451
  declare const chains: ({
3597
3452
  chains
3598
3453
  }: {
@@ -3604,8 +3459,7 @@ declare const maturity: ({
3604
3459
  maturities: MaturityType[];
3605
3460
  }) => Rule<Offer, "maturity">;
3606
3461
  declare const callback: ({
3607
- callbacks,
3608
- allowedAddresses
3462
+ callbacks
3609
3463
  }: {
3610
3464
  callbacks: Type$1[];
3611
3465
  allowedAddresses: Address[];
@@ -3620,6 +3474,16 @@ declare const token: ({
3620
3474
  }: {
3621
3475
  assetsByChainId: Partial<Record<Id, Address[]>>;
3622
3476
  }) => Rule<Offer, "token">;
3477
+ /**
3478
+ * A validation rule that checks if the offer's oracle addresses are allowed for its chain.
3479
+ * @param oraclesByChainId - Allowed oracles indexed by chain id.
3480
+ * @returns The issue that was found. If the offer is valid, this will be undefined.
3481
+ */
3482
+ declare const oracle: ({
3483
+ oraclesByChainId
3484
+ }: {
3485
+ oraclesByChainId: Partial<Record<Id, Address[]>>;
3486
+ }) => Rule<Offer, "oracle">;
3623
3487
  /**
3624
3488
  * A batch validation rule that ensures all offers in a tree have the same maker address.
3625
3489
  * Returns an issue only for the first non-conforming offer.
@@ -3824,5 +3688,5 @@ declare namespace index_d_exports$2 {
3824
3688
  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 };
3825
3689
  }
3826
3690
  //#endregion
3827
- 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 };
3691
+ 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 };
3828
3692
  //# sourceMappingURL=index.browser.d.mts.map