@morpho-dev/router 0.3.0 → 0.4.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.
- package/README.md +67 -71
- package/dist/cli.js +3209 -1252
- package/dist/drizzle/migrations/0017_dusty_the_hunter.sql +1 -0
- package/dist/drizzle/migrations/0018_add_chain_collector_constraints.sql +3 -0
- package/dist/drizzle/migrations/0019_add-obligation-units-shares.sql +2 -0
- package/dist/drizzle/migrations/0020_add-session.sql +1 -0
- package/dist/drizzle/migrations/0021_drop_chain_collector_epoch_indexes.sql +2 -0
- package/dist/drizzle/migrations/0021_migrate-rate-to-price.sql +15 -0
- package/dist/drizzle/migrations/0022_consolidate-price.sql +15 -0
- package/dist/drizzle/migrations/meta/0017_snapshot.json +1525 -0
- package/dist/drizzle/migrations/meta/0018_snapshot.json +1572 -0
- package/dist/drizzle/migrations/meta/0019_snapshot.json +1586 -0
- package/dist/drizzle/migrations/meta/_journal.json +42 -0
- package/dist/evm/bytecode/erc20.txt +1 -0
- package/dist/evm/bytecode/factory.txt +1 -0
- package/dist/evm/bytecode/mempool.txt +1 -0
- package/dist/evm/bytecode/morpho.txt +1 -0
- package/dist/evm/bytecode/multicall3.txt +1 -0
- package/dist/evm/bytecode/oracle.txt +1 -0
- package/dist/evm/bytecode/terms.txt +1 -0
- package/dist/evm/bytecode/vault.txt +1 -0
- package/dist/evm/bytecode/vaultV1.txt +1 -0
- package/dist/index.browser.d.mts +1327 -816
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +1358 -847
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2209 -1668
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +2173 -1632
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +1885 -1222
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +1885 -1222
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +1984 -1016
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +1963 -1014
- package/dist/index.node.mjs.map +1 -1
- package/docs/integrator.md +78 -0
- package/package.json +11 -5
package/dist/index.browser.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
import { AbiEvent, Address, ChainContract, ChainFormatters, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
|
|
3
|
+
import { Chain } from "viem/chains";
|
|
4
|
+
import * as z$1 from "zod";
|
|
5
|
+
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
|
|
3
6
|
import "reflect-metadata";
|
|
4
7
|
import { OpenAPIDocument } from "openapi-metadata";
|
|
5
|
-
import * as z$1 from "zod";
|
|
6
8
|
import { Client } from "openapi-fetch";
|
|
7
|
-
import { Chain } from "viem/chains";
|
|
8
|
-
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
|
|
9
9
|
import "@electric-sql/pglite";
|
|
10
10
|
import "drizzle-orm/node-postgres";
|
|
11
11
|
import "drizzle-orm/pglite";
|
|
@@ -13,15 +13,15 @@ import "pg";
|
|
|
13
13
|
|
|
14
14
|
//#region src/api/Schema/BookResponse.d.ts
|
|
15
15
|
declare namespace BookResponse_d_exports {
|
|
16
|
-
export { BookLevelResponse, from$
|
|
16
|
+
export { BookLevelResponse, from$14 as from };
|
|
17
17
|
}
|
|
18
18
|
type BookLevelResponse = {
|
|
19
|
-
|
|
19
|
+
price: string;
|
|
20
20
|
assets: string;
|
|
21
21
|
count: number;
|
|
22
22
|
};
|
|
23
|
-
declare function from$
|
|
24
|
-
|
|
23
|
+
declare function from$14(level: {
|
|
24
|
+
price: bigint;
|
|
25
25
|
assets: bigint;
|
|
26
26
|
count: number;
|
|
27
27
|
}): BookLevelResponse;
|
|
@@ -34,10 +34,11 @@ 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";
|
|
37
38
|
live: "live";
|
|
38
39
|
lagging: "lagging";
|
|
39
|
-
unknown: "unknown";
|
|
40
40
|
}>;
|
|
41
|
+
initialized: z.ZodBoolean;
|
|
41
42
|
}, z.core.$strip>;
|
|
42
43
|
declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
43
44
|
name: z.ZodString;
|
|
@@ -46,28 +47,37 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
46
47
|
updated_at: z.ZodNullable<z.ZodString>;
|
|
47
48
|
lag: z.ZodNullable<z.ZodNumber>;
|
|
48
49
|
status: z.ZodEnum<{
|
|
50
|
+
unknown: "unknown";
|
|
49
51
|
live: "live";
|
|
50
52
|
lagging: "lagging";
|
|
51
|
-
unknown: "unknown";
|
|
52
53
|
}>;
|
|
54
|
+
initialized: z.ZodBoolean;
|
|
53
55
|
}, z.core.$strip>>;
|
|
54
56
|
declare const ChainHealth: z.ZodObject<{
|
|
55
57
|
chain_id: z.ZodNumber;
|
|
56
|
-
local_block_number: z.ZodNumber
|
|
58
|
+
local_block_number: z.ZodNullable<z.ZodNumber>;
|
|
57
59
|
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
58
|
-
updated_at: z.ZodString
|
|
60
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
61
|
+
initialized: z.ZodBoolean;
|
|
59
62
|
}, z.core.$strip>;
|
|
60
63
|
declare const ChainsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
61
64
|
chain_id: z.ZodNumber;
|
|
62
|
-
local_block_number: z.ZodNumber
|
|
65
|
+
local_block_number: z.ZodNullable<z.ZodNumber>;
|
|
63
66
|
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
64
|
-
updated_at: z.ZodString
|
|
67
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
68
|
+
initialized: z.ZodBoolean;
|
|
65
69
|
}, z.core.$strip>>;
|
|
66
70
|
declare const RouterStatusResponse: z.ZodObject<{
|
|
67
71
|
status: z.ZodEnum<{
|
|
68
72
|
live: "live";
|
|
69
73
|
syncing: "syncing";
|
|
70
74
|
}>;
|
|
75
|
+
initialized: z.ZodBoolean;
|
|
76
|
+
missing_chains: z.ZodArray<z.ZodNumber>;
|
|
77
|
+
missing_collectors: z.ZodArray<z.ZodObject<{
|
|
78
|
+
chain_id: z.ZodNumber;
|
|
79
|
+
name: z.ZodString;
|
|
80
|
+
}, z.core.$strip>>;
|
|
71
81
|
}, z.core.$strip>;
|
|
72
82
|
type CollectorsHealthResponse = z.infer<typeof CollectorsHealthResponse>;
|
|
73
83
|
type ChainsHealthResponse = z.infer<typeof ChainsHealthResponse>;
|
|
@@ -335,7 +345,7 @@ declare const Morpho: readonly [{
|
|
|
335
345
|
readonly stateMutability: "view";
|
|
336
346
|
}];
|
|
337
347
|
declare namespace Callback_d_exports {
|
|
338
|
-
export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$
|
|
348
|
+
export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$2 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
339
349
|
}
|
|
340
350
|
declare enum CallbackType {
|
|
341
351
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
@@ -343,7 +353,7 @@ declare enum CallbackType {
|
|
|
343
353
|
SellERC20Callback = "sell_erc20_callback",
|
|
344
354
|
}
|
|
345
355
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
346
|
-
declare function decode$
|
|
356
|
+
declare function decode$2(type: CallbackType, data: Hex): {
|
|
347
357
|
contract: Address;
|
|
348
358
|
amount: bigint;
|
|
349
359
|
}[];
|
|
@@ -355,8 +365,8 @@ type SellERC20CallbackData = {
|
|
|
355
365
|
collaterals: Address[];
|
|
356
366
|
amounts: bigint[];
|
|
357
367
|
};
|
|
358
|
-
declare function encode$
|
|
359
|
-
declare function encode$
|
|
368
|
+
declare function encode$2(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
369
|
+
declare function encode$2(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
360
370
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
361
371
|
contract: Address;
|
|
362
372
|
amount: bigint;
|
|
@@ -408,7 +418,7 @@ declare class ReorgError extends BaseError {
|
|
|
408
418
|
declare namespace Chain_d_exports {
|
|
409
419
|
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
|
|
410
420
|
}
|
|
411
|
-
type Chain$1 = Compute<Chain<ChainFormatters, {
|
|
421
|
+
type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
412
422
|
morpho: ChainContract;
|
|
413
423
|
morphoBlue: ChainContract;
|
|
414
424
|
mempool: ChainContract;
|
|
@@ -418,9 +428,20 @@ type Chain$1 = Compute<Chain<ChainFormatters, {
|
|
|
418
428
|
v1_1: ChainContract;
|
|
419
429
|
};
|
|
420
430
|
};
|
|
421
|
-
}> & {
|
|
431
|
+
}>, "custom"> & {
|
|
422
432
|
id: Id;
|
|
423
433
|
name: Name;
|
|
434
|
+
custom: {
|
|
435
|
+
morpho: ChainContract;
|
|
436
|
+
morphoBlue: ChainContract;
|
|
437
|
+
mempool: ChainContract;
|
|
438
|
+
vaults: {
|
|
439
|
+
factories: {
|
|
440
|
+
v1_0: ChainContract;
|
|
441
|
+
v1_1: ChainContract;
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
};
|
|
424
445
|
}>;
|
|
425
446
|
declare const ChainId: {
|
|
426
447
|
readonly ETHEREUM: 1;
|
|
@@ -466,6 +487,14 @@ declare class MissingBlockNumberError extends BaseError {
|
|
|
466
487
|
name: string;
|
|
467
488
|
constructor();
|
|
468
489
|
}
|
|
490
|
+
declare namespace ChainRegistry_d_exports {
|
|
491
|
+
export { ChainRegistry, create$1 as create };
|
|
492
|
+
}
|
|
493
|
+
type ChainRegistry = {
|
|
494
|
+
getById: (chainId: Id) => Chain$1 | undefined;
|
|
495
|
+
list: () => Chain$1[];
|
|
496
|
+
};
|
|
497
|
+
declare function create$1(chains: Chain$1[]): ChainRegistry;
|
|
469
498
|
//#endregion
|
|
470
499
|
//#region src/core/types.d.ts
|
|
471
500
|
/** Combines members of an intersection into a readable type. */
|
|
@@ -475,7 +504,7 @@ type Brand<in out ID extends string | symbol> = {
|
|
|
475
504
|
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
476
505
|
};
|
|
477
506
|
declare namespace LLTV_d_exports {
|
|
478
|
-
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$
|
|
507
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$13 as from };
|
|
479
508
|
}
|
|
480
509
|
type LLTV = bigint & Brand<"LLTV">;
|
|
481
510
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
@@ -485,8 +514,8 @@ type Options = (typeof Options)[number];
|
|
|
485
514
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
486
515
|
* @returns The LLTV.
|
|
487
516
|
*/
|
|
488
|
-
declare function from$
|
|
489
|
-
declare namespace from$
|
|
517
|
+
declare function from$13(lltv: Options | bigint): LLTV;
|
|
518
|
+
declare namespace from$13 {
|
|
490
519
|
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
491
520
|
}
|
|
492
521
|
declare class InvalidOptionError$1 extends BaseError {
|
|
@@ -499,7 +528,7 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
499
528
|
}
|
|
500
529
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
501
530
|
declare namespace Collateral_d_exports {
|
|
502
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$
|
|
531
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$12 as from, random$3 as random };
|
|
503
532
|
}
|
|
504
533
|
type Collateral = {
|
|
505
534
|
/** Asset being used as collateral. */
|
|
@@ -519,8 +548,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
519
548
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
520
549
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
521
550
|
}, z$1.core.$strip>>;
|
|
522
|
-
declare const from$
|
|
523
|
-
declare namespace from$
|
|
551
|
+
declare const from$12: (parameters: from$12.Parameters) => from$12.ReturnType;
|
|
552
|
+
declare namespace from$12 {
|
|
524
553
|
type Parameters = {
|
|
525
554
|
asset: Address;
|
|
526
555
|
lltv: Options | bigint;
|
|
@@ -629,35 +658,127 @@ declare class DenominatorIsZeroError extends BaseError {
|
|
|
629
658
|
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
630
659
|
constructor();
|
|
631
660
|
}
|
|
632
|
-
declare namespace
|
|
633
|
-
export {
|
|
661
|
+
declare namespace Liquidity_d_exports {
|
|
662
|
+
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
634
663
|
}
|
|
635
|
-
/** The snake case representation of a type with bigint values stringified. */
|
|
636
|
-
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
637
|
-
/** Make arrays/tuples and object props mutable, deeply. */
|
|
638
|
-
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
639
|
-
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
640
|
-
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
641
|
-
/** Key remapping that also preserves branded primitives. */
|
|
642
|
-
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
643
|
-
type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
|
|
644
664
|
/**
|
|
645
|
-
*
|
|
646
|
-
* Preserves ethereum addresses as is.
|
|
647
|
-
* Converts ethereum addresses to checksummed if used as values.
|
|
648
|
-
* Stringifies bigint values to strings.
|
|
665
|
+
* Represents a liquidity pool with a unique ID and amount.
|
|
649
666
|
*/
|
|
650
|
-
|
|
667
|
+
type LiquidityPool = {
|
|
668
|
+
id: string;
|
|
669
|
+
amount: bigint;
|
|
670
|
+
};
|
|
651
671
|
/**
|
|
652
|
-
*
|
|
653
|
-
* Preserves ethereum addresses as is.
|
|
654
|
-
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
655
|
-
* @warning Does not unstringify bigint values.
|
|
672
|
+
* Represents a hierarchical relationship between two liquidity pools.
|
|
656
673
|
*/
|
|
657
|
-
|
|
658
|
-
|
|
674
|
+
type LiquidityLink = {
|
|
675
|
+
parentPoolId: string;
|
|
676
|
+
childPoolId: string;
|
|
677
|
+
priority: number;
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* Represents the connection between an offer and its liquidity pools.
|
|
681
|
+
*/
|
|
682
|
+
type OfferLiquidityPool = {
|
|
683
|
+
offerHash: Hex;
|
|
684
|
+
poolId: string;
|
|
685
|
+
/**
|
|
686
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
687
|
+
* Meaning varies by pool type:
|
|
688
|
+
* - BuyWithEmptyCallback: Matches allowance amount from pool bellow
|
|
689
|
+
* - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
|
|
690
|
+
* - SellERC20Callback: Existing debt as negative value (reduces available capacity)
|
|
691
|
+
*/
|
|
692
|
+
amount: bigint;
|
|
693
|
+
};
|
|
694
|
+
/**
|
|
695
|
+
* Calculate maximum debt capacity from collateral amount.
|
|
696
|
+
* @param amount - Collateral amount
|
|
697
|
+
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
698
|
+
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
699
|
+
* @returns Maximum debt capacity
|
|
700
|
+
*/
|
|
701
|
+
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
702
|
+
/**
|
|
703
|
+
* Generate pool ID for balance pools.
|
|
704
|
+
*/
|
|
705
|
+
declare function generateBalancePoolId(parameters: {
|
|
706
|
+
user: Address;
|
|
707
|
+
chainId: Id;
|
|
708
|
+
token: Address;
|
|
709
|
+
}): string;
|
|
710
|
+
/**
|
|
711
|
+
* Generate pool ID for allowance pools.
|
|
712
|
+
*/
|
|
713
|
+
declare function generateAllowancePoolId(parameters: {
|
|
714
|
+
user: Address;
|
|
715
|
+
chainId: Id;
|
|
716
|
+
token: Address;
|
|
717
|
+
}): string;
|
|
718
|
+
/**
|
|
719
|
+
* Generate pool ID for sell ERC20 callback pools.
|
|
720
|
+
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
721
|
+
*/
|
|
722
|
+
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
723
|
+
user: Address;
|
|
724
|
+
chainId: Id;
|
|
725
|
+
obligationId: Hex;
|
|
726
|
+
token: Address;
|
|
727
|
+
offerHash: Hex;
|
|
728
|
+
}): string;
|
|
729
|
+
/**
|
|
730
|
+
* Generate pool ID for obligation collateral pools.
|
|
731
|
+
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
732
|
+
* These pools are shared across all offers with the same obligation.
|
|
733
|
+
*/
|
|
734
|
+
declare function generateObligationCollateralPoolId(parameters: {
|
|
735
|
+
user: Address;
|
|
736
|
+
chainId: Id;
|
|
737
|
+
obligationId: Hex;
|
|
738
|
+
token: Address;
|
|
739
|
+
}): string;
|
|
740
|
+
/**
|
|
741
|
+
* Generate pool ID for buy vault callback pools.
|
|
742
|
+
*/
|
|
743
|
+
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
744
|
+
user: Address;
|
|
745
|
+
chainId: Id;
|
|
746
|
+
vault: Address;
|
|
747
|
+
offerHash: Hex;
|
|
748
|
+
}): string;
|
|
749
|
+
/**
|
|
750
|
+
* Generate pool ID for debt pools.
|
|
751
|
+
*/
|
|
752
|
+
declare function generateDebtPoolId(parameters: {
|
|
753
|
+
user: Address;
|
|
754
|
+
chainId: Id;
|
|
755
|
+
obligationId: Hex;
|
|
756
|
+
}): string;
|
|
757
|
+
/**
|
|
758
|
+
* Generate pool ID for user position in a vault.
|
|
759
|
+
*/
|
|
760
|
+
declare function generateUserVaultPositionPoolId(parameters: {
|
|
761
|
+
user: Address;
|
|
762
|
+
chainId: Id;
|
|
763
|
+
vault: Address;
|
|
764
|
+
}): string;
|
|
765
|
+
/**
|
|
766
|
+
* Generate pool ID for vault position in a market.
|
|
767
|
+
*/
|
|
768
|
+
declare function generateVaultPositionPoolId(parameters: {
|
|
769
|
+
vault: Address;
|
|
770
|
+
chainId: Id;
|
|
771
|
+
marketId: string;
|
|
772
|
+
}): string;
|
|
773
|
+
/**
|
|
774
|
+
* Generate pool ID for market total liquidity.
|
|
775
|
+
*/
|
|
776
|
+
declare function generateMarketLiquidityPoolId(parameters: {
|
|
777
|
+
chainId: Id;
|
|
778
|
+
marketId: string;
|
|
779
|
+
}): string;
|
|
659
780
|
declare namespace Maturity_d_exports {
|
|
660
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$
|
|
781
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$11 as from };
|
|
661
782
|
}
|
|
662
783
|
/**
|
|
663
784
|
* Maturity is a number that represents a date in seconds.
|
|
@@ -687,8 +808,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
687
808
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
688
809
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
689
810
|
*/
|
|
690
|
-
declare function from$
|
|
691
|
-
declare namespace from$
|
|
811
|
+
declare function from$11(ts: from$11.Parameters): Maturity;
|
|
812
|
+
declare namespace from$11 {
|
|
692
813
|
type Parameters = number | MaturityOptions;
|
|
693
814
|
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
694
815
|
}
|
|
@@ -704,72 +825,47 @@ declare class InvalidOptionError extends BaseError {
|
|
|
704
825
|
readonly name = "Maturity.InvalidOptionError";
|
|
705
826
|
constructor(input: string);
|
|
706
827
|
}
|
|
707
|
-
declare namespace
|
|
708
|
-
export {
|
|
828
|
+
declare namespace Format_d_exports {
|
|
829
|
+
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
709
830
|
}
|
|
710
|
-
type
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
737
|
-
readonly collaterals: readonly Collateral[];
|
|
738
|
-
/** The optional callback data to retrieve the maker funds. */
|
|
739
|
-
readonly callback: {
|
|
740
|
-
readonly address: Address;
|
|
741
|
-
readonly data: Hex;
|
|
742
|
-
readonly gasLimit: bigint;
|
|
743
|
-
};
|
|
744
|
-
/** The amount of assets consumed from the offer. */
|
|
745
|
-
consumed: bigint;
|
|
746
|
-
/** The hash of the offer. */
|
|
747
|
-
readonly hash: Hex;
|
|
748
|
-
/** The block number at which the offer was created. */
|
|
749
|
-
readonly blockNumber: number;
|
|
750
|
-
/** The signature of the offer. */
|
|
751
|
-
signature?: Hex;
|
|
752
|
-
};
|
|
753
|
-
declare enum Status {
|
|
754
|
-
VALID = "VALID",
|
|
755
|
-
SIMULATION_ERROR = "SIMULATION_ERROR",
|
|
831
|
+
/** The snake case representation of a type with bigint values stringified. */
|
|
832
|
+
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
833
|
+
/** Make arrays/tuples and object props mutable, deeply. */
|
|
834
|
+
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
835
|
+
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
836
|
+
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? string : T extends number ? T : T extends string ? T : T extends boolean ? T : T extends symbol ? T : T extends null | undefined ? T : T extends readonly (infer U)[] ? readonly StringifiedBigint<U>[] : T extends object ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
837
|
+
/** Key remapping that also preserves branded primitives. */
|
|
838
|
+
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
839
|
+
type ToSnakeCase<S extends string> = S extends `${infer Head}${infer Tail}` ? Tail extends Uncapitalize<Tail> ? `${Lowercase<Head>}${ToSnakeCase<Tail>}` : `${Lowercase<Head>}_${ToSnakeCase<Uncapitalize<Tail>>}` : S;
|
|
840
|
+
/**
|
|
841
|
+
* Formats object keys to snake case.
|
|
842
|
+
* Preserves ethereum addresses as is.
|
|
843
|
+
* Converts ethereum addresses to checksummed if used as values.
|
|
844
|
+
* Stringifies bigint values to strings.
|
|
845
|
+
*/
|
|
846
|
+
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
847
|
+
/**
|
|
848
|
+
* Formats a snake case object to its camel case type.
|
|
849
|
+
* Preserves ethereum addresses as is.
|
|
850
|
+
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
851
|
+
* @warning Does not unstringify bigint values.
|
|
852
|
+
*/
|
|
853
|
+
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
854
|
+
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
855
|
+
declare namespace Obligation_d_exports {
|
|
856
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$10 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
756
857
|
}
|
|
757
|
-
type
|
|
758
|
-
|
|
759
|
-
|
|
858
|
+
type Obligation = {
|
|
859
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
860
|
+
chainId: Id;
|
|
861
|
+
/** The token that is being borrowed for this obligation. */
|
|
862
|
+
loanToken: Address;
|
|
863
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
864
|
+
collaterals: Collateral[];
|
|
865
|
+
/** The maturity of the obligation. */
|
|
866
|
+
maturity: Maturity;
|
|
760
867
|
};
|
|
761
|
-
declare const
|
|
762
|
-
declare const OfferSchema: (parameters?: {
|
|
763
|
-
omitHash?: boolean;
|
|
764
|
-
}) => z$1.ZodObject<{
|
|
765
|
-
offering: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
766
|
-
assets: z$1.ZodBigInt;
|
|
767
|
-
rate: z$1.ZodBigInt;
|
|
768
|
-
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
769
|
-
expiry: z$1.ZodNumber;
|
|
770
|
-
start: z$1.ZodNumber;
|
|
771
|
-
nonce: z$1.ZodBigInt;
|
|
772
|
-
buy: z$1.ZodBoolean;
|
|
868
|
+
declare const ObligationSchema: z$1.ZodObject<{
|
|
773
869
|
chainId: z$1.ZodNumber;
|
|
774
870
|
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
775
871
|
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
@@ -777,38 +873,222 @@ declare const OfferSchema: (parameters?: {
|
|
|
777
873
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
778
874
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
779
875
|
}, z$1.core.$strip>>;
|
|
780
|
-
|
|
781
|
-
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
782
|
-
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
783
|
-
gasLimit: z$1.ZodBigInt;
|
|
784
|
-
}, z$1.core.$strip>;
|
|
785
|
-
signature: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
786
|
-
consumed: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
787
|
-
takeable: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
788
|
-
blockNumber: z$1.ZodOptional<z$1.ZodNumber>;
|
|
876
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
789
877
|
}, z$1.core.$strip>;
|
|
790
878
|
/**
|
|
791
|
-
* Creates an
|
|
792
|
-
* @
|
|
793
|
-
* @param
|
|
794
|
-
* @returns The created
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
*
|
|
804
|
-
*
|
|
805
|
-
*
|
|
806
|
-
*
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
}
|
|
811
|
-
|
|
879
|
+
* Creates an obligation from the given parameters.
|
|
880
|
+
* @constructor
|
|
881
|
+
* @param parameters - {@link from.Parameters}
|
|
882
|
+
* @returns The created obligation. {@link Obligation}
|
|
883
|
+
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
884
|
+
*
|
|
885
|
+
* @example
|
|
886
|
+
* ```ts
|
|
887
|
+
* const obligation = Obligation.from({
|
|
888
|
+
* chainId: 1,
|
|
889
|
+
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
890
|
+
* collaterals: [
|
|
891
|
+
* Collateral.from({
|
|
892
|
+
* asset: privateKeyToAccount(generatePrivateKey()).address,
|
|
893
|
+
* oracle: privateKeyToAccount(generatePrivateKey()).address,
|
|
894
|
+
* lltv: 0.965
|
|
895
|
+
* }),
|
|
896
|
+
* ],
|
|
897
|
+
* maturity: Maturity.from("end_of_next_quarter"),
|
|
898
|
+
* });
|
|
899
|
+
* ```
|
|
900
|
+
*/
|
|
901
|
+
declare function from$10(parameters: from$10.Parameters): from$10.ReturnType;
|
|
902
|
+
declare namespace from$10 {
|
|
903
|
+
type Parameters = {
|
|
904
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
905
|
+
chainId: number;
|
|
906
|
+
/** The token that is being borrowed for this obligation. */
|
|
907
|
+
loanToken: Address;
|
|
908
|
+
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
909
|
+
collaterals: from$12.Parameters[] | readonly from$12.Parameters[];
|
|
910
|
+
/** The maturity of the obligation. */
|
|
911
|
+
maturity: from$11.Parameters;
|
|
912
|
+
};
|
|
913
|
+
type ReturnType = Obligation;
|
|
914
|
+
type ErrorType = InvalidObligationError;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Creates an obligation from a snake case object.
|
|
918
|
+
* @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
|
|
919
|
+
* @param input - {@link fromSnakeCase.Parameters}
|
|
920
|
+
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
921
|
+
*/
|
|
922
|
+
declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
|
|
923
|
+
declare namespace fromSnakeCase$2 {
|
|
924
|
+
type Parameters = Snake<Omit<Obligation, "chainId"> & {
|
|
925
|
+
chainId: number;
|
|
926
|
+
}>;
|
|
927
|
+
type ReturnType = Obligation;
|
|
928
|
+
type ErrorType = InvalidObligationError;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
932
|
+
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
|
|
933
|
+
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
934
|
+
* @param parameters - {@link id.Parameters}
|
|
935
|
+
* @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
|
|
936
|
+
*
|
|
937
|
+
* @example
|
|
938
|
+
* ```ts
|
|
939
|
+
* const obligation = Obligation.random();
|
|
940
|
+
* const id = Obligation.id(obligation);
|
|
941
|
+
* console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
942
|
+
* ```
|
|
943
|
+
*/
|
|
944
|
+
declare function id(parameters: id.Parameters): id.ReturnType;
|
|
945
|
+
declare namespace id {
|
|
946
|
+
type Parameters = {
|
|
947
|
+
chainId: number;
|
|
948
|
+
loanToken: Address;
|
|
949
|
+
collaterals: {
|
|
950
|
+
asset: Address;
|
|
951
|
+
lltv: bigint;
|
|
952
|
+
oracle: Address;
|
|
953
|
+
}[];
|
|
954
|
+
maturity: number;
|
|
955
|
+
};
|
|
956
|
+
type ReturnType = Hex;
|
|
957
|
+
type ErrorType = CollateralsAreNotSortedError;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Generates a random obligation.
|
|
961
|
+
* @returns A randomly generated obligation. {@link random.ReturnType}
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```ts
|
|
965
|
+
* const obligation = Obligation.random();
|
|
966
|
+
* ```
|
|
967
|
+
*/
|
|
968
|
+
declare function random$2(): random$2.ReturnType;
|
|
969
|
+
declare namespace random$2 {
|
|
970
|
+
type ReturnType = Obligation;
|
|
971
|
+
}
|
|
972
|
+
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
973
|
+
readonly name = "Obligation.InvalidObligationError";
|
|
974
|
+
constructor(error: z$1.ZodError | Error);
|
|
975
|
+
}
|
|
976
|
+
declare class CollateralsAreNotSortedError extends BaseError {
|
|
977
|
+
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
978
|
+
constructor();
|
|
979
|
+
}
|
|
980
|
+
declare namespace Offer_d_exports {
|
|
981
|
+
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$9 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, sign, signatureMsg, toSnakeCase, types };
|
|
982
|
+
}
|
|
983
|
+
type Offer = {
|
|
984
|
+
/** The address that made the offer. */
|
|
985
|
+
readonly maker: Address;
|
|
986
|
+
/** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
987
|
+
readonly assets: bigint;
|
|
988
|
+
/** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
|
|
989
|
+
readonly obligationUnits: bigint;
|
|
990
|
+
/** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
|
|
991
|
+
readonly obligationShares: bigint;
|
|
992
|
+
/** The price (18 decimals). */
|
|
993
|
+
readonly price: bigint;
|
|
994
|
+
/** The date at which all interests will be paid. */
|
|
995
|
+
readonly maturity: Maturity;
|
|
996
|
+
/** The date at which the offer will expire. */
|
|
997
|
+
readonly expiry: number;
|
|
998
|
+
/** The date at which the offer will start. */
|
|
999
|
+
readonly start: number;
|
|
1000
|
+
/** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
1001
|
+
readonly group: Hex;
|
|
1002
|
+
/** The session. Used for session-based offer management. */
|
|
1003
|
+
readonly session: Hex;
|
|
1004
|
+
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
1005
|
+
readonly buy: boolean;
|
|
1006
|
+
/** The chain id where the liquidity for this offer is located. */
|
|
1007
|
+
readonly chainId: Id;
|
|
1008
|
+
/** The token that is being borrowed. */
|
|
1009
|
+
readonly loanToken: Address;
|
|
1010
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
1011
|
+
readonly collaterals: readonly Collateral[];
|
|
1012
|
+
/** The optional callback data to retrieve the maker funds. */
|
|
1013
|
+
readonly callback: {
|
|
1014
|
+
readonly address: Address;
|
|
1015
|
+
readonly data: Hex;
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1018
|
+
declare enum Status {
|
|
1019
|
+
VALID = "VALID",
|
|
1020
|
+
SIMULATION_ERROR = "SIMULATION_ERROR",
|
|
1021
|
+
}
|
|
1022
|
+
type Validation = {
|
|
1023
|
+
offerHash: Hex;
|
|
1024
|
+
status: Status;
|
|
1025
|
+
};
|
|
1026
|
+
declare const OfferSchema: () => z$1.ZodObject<{
|
|
1027
|
+
maker: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1028
|
+
assets: z$1.ZodBigInt;
|
|
1029
|
+
obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
1030
|
+
obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
1031
|
+
price: z$1.ZodBigInt;
|
|
1032
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1033
|
+
expiry: z$1.ZodNumber;
|
|
1034
|
+
start: z$1.ZodNumber;
|
|
1035
|
+
group: z$1.ZodPipe<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
1036
|
+
session: z$1.ZodPipe<z$1.ZodDefault<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>>>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
1037
|
+
buy: z$1.ZodBoolean;
|
|
1038
|
+
chainId: z$1.ZodNumber;
|
|
1039
|
+
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1040
|
+
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1041
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1042
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1043
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1044
|
+
}, z$1.core.$strip>>;
|
|
1045
|
+
callback: z$1.ZodObject<{
|
|
1046
|
+
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1047
|
+
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1048
|
+
}, z$1.core.$strip>;
|
|
1049
|
+
}, z$1.core.$strip>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
|
|
1052
|
+
*
|
|
1053
|
+
* The `group` field accepts multiple input formats:
|
|
1054
|
+
* - **Hex string** (`0x...`): Padded to 32 bytes if needed
|
|
1055
|
+
* - **Numeric string**: Converted to hex (e.g., `"123"` -> `"0x...7b"`)
|
|
1056
|
+
* - **Number**: Non-negative safe integer, converted to hex
|
|
1057
|
+
* - **BigInt**: Non-negative, must fit in bytes32
|
|
1058
|
+
*
|
|
1059
|
+
* All values validated to be non-negative and within bytes32 range.
|
|
1060
|
+
*/
|
|
1061
|
+
type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
|
|
1062
|
+
chainId: number;
|
|
1063
|
+
group: Hex | bigint | number | string;
|
|
1064
|
+
/** Optional: defaults to zero bytes32. */
|
|
1065
|
+
session?: Hex | bigint | number | string;
|
|
1066
|
+
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
1067
|
+
obligationUnits?: bigint;
|
|
1068
|
+
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
1069
|
+
obligationShares?: bigint;
|
|
1070
|
+
}>;
|
|
1071
|
+
/**
|
|
1072
|
+
* Creates an offer from a plain object.
|
|
1073
|
+
* @throws {InvalidOfferError} If the offer is invalid.
|
|
1074
|
+
* @param input - The offer to create.
|
|
1075
|
+
* @returns The created offer.
|
|
1076
|
+
*/
|
|
1077
|
+
declare function from$9(input: OfferInput): Offer;
|
|
1078
|
+
declare namespace from$9 {
|
|
1079
|
+
type ErrorType = InvalidOfferError;
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Creates an offer from a snake case object.
|
|
1083
|
+
* @throws {InvalidOfferError} If the offer is invalid.
|
|
1084
|
+
* @param input - The offer to create.
|
|
1085
|
+
* @returns The created offer.
|
|
1086
|
+
*/
|
|
1087
|
+
declare function fromSnakeCase$1(input: Snake<Omit<Offer, "chainId" | "session"> & {
|
|
1088
|
+
chainId: number;
|
|
1089
|
+
session: string;
|
|
1090
|
+
}>): Offer;
|
|
1091
|
+
/**
|
|
812
1092
|
* Converts an offer to a snake case object.
|
|
813
1093
|
* @param offer - The offer to convert.
|
|
814
1094
|
* @returns The converted offer.
|
|
@@ -822,13 +1102,16 @@ declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
|
822
1102
|
* @returns JSON-serializable offer object
|
|
823
1103
|
*/
|
|
824
1104
|
declare const serialize: (offer: Offer) => {
|
|
825
|
-
|
|
1105
|
+
maker: `0x${string}`;
|
|
826
1106
|
assets: string;
|
|
827
|
-
|
|
1107
|
+
obligationUnits: string;
|
|
1108
|
+
obligationShares: string;
|
|
1109
|
+
price: string;
|
|
828
1110
|
maturity: number;
|
|
829
1111
|
expiry: number;
|
|
830
1112
|
start: number;
|
|
831
|
-
|
|
1113
|
+
group: `0x${string}`;
|
|
1114
|
+
session: `0x${string}`;
|
|
832
1115
|
buy: boolean;
|
|
833
1116
|
chainId: Id;
|
|
834
1117
|
loanToken: `0x${string}`;
|
|
@@ -840,9 +1123,7 @@ declare const serialize: (offer: Offer) => {
|
|
|
840
1123
|
callback: {
|
|
841
1124
|
address: `0x${string}`;
|
|
842
1125
|
data: `0x${string}`;
|
|
843
|
-
gasLimit: string;
|
|
844
1126
|
};
|
|
845
|
-
signature: `0x${string}` | undefined;
|
|
846
1127
|
hash: `0x${string}`;
|
|
847
1128
|
};
|
|
848
1129
|
type RandomConfig = {
|
|
@@ -852,22 +1133,20 @@ type RandomConfig = {
|
|
|
852
1133
|
assetsDecimals?: Record<Address, number>;
|
|
853
1134
|
buy?: boolean;
|
|
854
1135
|
assets?: bigint;
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
1136
|
+
obligationUnits?: bigint;
|
|
1137
|
+
obligationShares?: bigint;
|
|
1138
|
+
maker?: Address;
|
|
858
1139
|
maturity?: Maturity;
|
|
859
1140
|
start?: number;
|
|
860
1141
|
expiry?: number;
|
|
861
|
-
|
|
862
|
-
|
|
1142
|
+
group?: Hex | bigint | number | string;
|
|
1143
|
+
session?: Hex | bigint | number | string;
|
|
1144
|
+
price?: bigint;
|
|
863
1145
|
callback?: {
|
|
864
1146
|
address: Address;
|
|
865
1147
|
data: Hex;
|
|
866
|
-
gasLimit: bigint;
|
|
867
1148
|
};
|
|
868
1149
|
collaterals?: readonly Collateral[];
|
|
869
|
-
signature?: Hex;
|
|
870
|
-
blockNumber?: number;
|
|
871
1150
|
};
|
|
872
1151
|
/**
|
|
873
1152
|
* Generates a random Offer.
|
|
@@ -875,7 +1154,7 @@ type RandomConfig = {
|
|
|
875
1154
|
* @warning The generated Offer should not be used for production usage.
|
|
876
1155
|
* @returns {Offer} A randomly generated Offer object.
|
|
877
1156
|
*/
|
|
878
|
-
declare function random$
|
|
1157
|
+
declare function random$1(config?: RandomConfig): Offer;
|
|
879
1158
|
/**
|
|
880
1159
|
* Creates an EIP-712 domain object.
|
|
881
1160
|
* @param chainId - The chain ID.
|
|
@@ -899,13 +1178,19 @@ declare const types: {
|
|
|
899
1178
|
readonly type: "address";
|
|
900
1179
|
}];
|
|
901
1180
|
readonly Offer: readonly [{
|
|
902
|
-
readonly name: "
|
|
1181
|
+
readonly name: "maker";
|
|
903
1182
|
readonly type: "address";
|
|
904
1183
|
}, {
|
|
905
1184
|
readonly name: "assets";
|
|
906
1185
|
readonly type: "uint256";
|
|
907
1186
|
}, {
|
|
908
|
-
readonly name: "
|
|
1187
|
+
readonly name: "obligationUnits";
|
|
1188
|
+
readonly type: "uint256";
|
|
1189
|
+
}, {
|
|
1190
|
+
readonly name: "obligationShares";
|
|
1191
|
+
readonly type: "uint256";
|
|
1192
|
+
}, {
|
|
1193
|
+
readonly name: "price";
|
|
909
1194
|
readonly type: "uint256";
|
|
910
1195
|
}, {
|
|
911
1196
|
readonly name: "maturity";
|
|
@@ -914,8 +1199,11 @@ declare const types: {
|
|
|
914
1199
|
readonly name: "expiry";
|
|
915
1200
|
readonly type: "uint256";
|
|
916
1201
|
}, {
|
|
917
|
-
readonly name: "
|
|
918
|
-
readonly type: "
|
|
1202
|
+
readonly name: "group";
|
|
1203
|
+
readonly type: "bytes32";
|
|
1204
|
+
}, {
|
|
1205
|
+
readonly name: "session";
|
|
1206
|
+
readonly type: "bytes32";
|
|
919
1207
|
}, {
|
|
920
1208
|
readonly name: "buy";
|
|
921
1209
|
readonly type: "bool";
|
|
@@ -945,9 +1233,6 @@ declare const types: {
|
|
|
945
1233
|
}, {
|
|
946
1234
|
readonly name: "data";
|
|
947
1235
|
readonly type: "bytes";
|
|
948
|
-
}, {
|
|
949
|
-
readonly name: "gasLimit";
|
|
950
|
-
readonly type: "uint256";
|
|
951
1236
|
}];
|
|
952
1237
|
};
|
|
953
1238
|
/**
|
|
@@ -959,7 +1244,7 @@ declare const types: {
|
|
|
959
1244
|
*/
|
|
960
1245
|
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
961
1246
|
declare function signatureMsg(offers: Offer[]): Hex;
|
|
962
|
-
declare function hash(offer:
|
|
1247
|
+
declare function hash(offer: Offer): Hex;
|
|
963
1248
|
/**
|
|
964
1249
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
965
1250
|
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals (sorted by token address), maturity)).
|
|
@@ -967,32 +1252,32 @@ declare function hash(offer: Omit<Offer, "hash">): Hex;
|
|
|
967
1252
|
* @returns The obligation id as a 32-byte hex string.
|
|
968
1253
|
*/
|
|
969
1254
|
declare function obligationId(offer: Offer): Hex;
|
|
970
|
-
declare function encode$
|
|
971
|
-
declare function decode$
|
|
1255
|
+
declare function encode$1(offer: Offer): `0x${string}`;
|
|
1256
|
+
declare function decode$1(data: Hex): Offer;
|
|
972
1257
|
type OfferConsumed = {
|
|
973
1258
|
id: string;
|
|
974
1259
|
chainId: Id;
|
|
975
|
-
|
|
976
|
-
|
|
1260
|
+
maker: Address;
|
|
1261
|
+
group: Hex;
|
|
977
1262
|
amount: bigint;
|
|
978
1263
|
blockNumber: number;
|
|
979
1264
|
};
|
|
980
1265
|
/**
|
|
981
|
-
* ABI for the
|
|
1266
|
+
* ABI for the Consume event emitted by the Obligation contract.
|
|
982
1267
|
*/
|
|
983
1268
|
declare const consumedEvent: {
|
|
984
1269
|
readonly type: "event";
|
|
985
|
-
readonly name: "
|
|
1270
|
+
readonly name: "Consume";
|
|
986
1271
|
readonly inputs: readonly [{
|
|
987
1272
|
readonly name: "user";
|
|
988
1273
|
readonly type: "address";
|
|
989
1274
|
readonly indexed: true;
|
|
990
1275
|
readonly internalType: "address";
|
|
991
1276
|
}, {
|
|
992
|
-
readonly name: "
|
|
993
|
-
readonly type: "
|
|
1277
|
+
readonly name: "group";
|
|
1278
|
+
readonly type: "bytes32";
|
|
994
1279
|
readonly indexed: true;
|
|
995
|
-
readonly internalType: "
|
|
1280
|
+
readonly internalType: "bytes32";
|
|
996
1281
|
}, {
|
|
997
1282
|
readonly name: "amount";
|
|
998
1283
|
readonly type: "uint256";
|
|
@@ -1020,284 +1305,49 @@ declare class AccountNotSetError extends BaseError {
|
|
|
1020
1305
|
readonly name = "Offer.AccountNotSetError";
|
|
1021
1306
|
constructor();
|
|
1022
1307
|
}
|
|
1023
|
-
declare namespace
|
|
1024
|
-
export {
|
|
1308
|
+
declare namespace Oracle_d_exports {
|
|
1309
|
+
export { Conversion, Oracle, from$8 as from };
|
|
1025
1310
|
}
|
|
1026
1311
|
/**
|
|
1027
|
-
*
|
|
1312
|
+
* An oracle contract that provides price information for assets.
|
|
1028
1313
|
*/
|
|
1029
|
-
type
|
|
1030
|
-
id
|
|
1031
|
-
|
|
1314
|
+
type Oracle = {
|
|
1315
|
+
/** The chain id where the oracle is deployed. */
|
|
1316
|
+
readonly chainId: Id;
|
|
1317
|
+
/** The address of the oracle contract. */
|
|
1318
|
+
readonly address: Address;
|
|
1319
|
+
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1320
|
+
readonly price: bigint | null;
|
|
1321
|
+
/** The block number at which the price was fetched. */
|
|
1322
|
+
readonly blockNumber: number;
|
|
1032
1323
|
};
|
|
1033
1324
|
/**
|
|
1034
|
-
*
|
|
1325
|
+
* Create an Oracle from a plain object.
|
|
1326
|
+
* @param data - The data to create the oracle from.
|
|
1327
|
+
* @returns The created oracle.
|
|
1035
1328
|
*/
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1329
|
+
declare function from$8(data: from$8.Parameters): from$8.ReturnType;
|
|
1330
|
+
declare namespace from$8 {
|
|
1331
|
+
type Parameters = {
|
|
1332
|
+
chainId: Id;
|
|
1333
|
+
address: Address;
|
|
1334
|
+
price: string | null;
|
|
1335
|
+
blockNumber: number;
|
|
1336
|
+
};
|
|
1337
|
+
type ReturnType = Oracle;
|
|
1338
|
+
}
|
|
1041
1339
|
/**
|
|
1042
|
-
*
|
|
1340
|
+
* Conversion utilities for converting between collateral and loan token amounts
|
|
1341
|
+
* using oracle prices and LLTV
|
|
1043
1342
|
*/
|
|
1044
|
-
|
|
1045
|
-
offerHash: Offer["hash"];
|
|
1046
|
-
poolId: string;
|
|
1343
|
+
declare namespace Conversion {
|
|
1047
1344
|
/**
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
* -
|
|
1053
|
-
|
|
1054
|
-
amount: bigint;
|
|
1055
|
-
};
|
|
1056
|
-
/**
|
|
1057
|
-
* Calculate maximum debt capacity from collateral amount.
|
|
1058
|
-
* @param amount - Collateral amount
|
|
1059
|
-
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
1060
|
-
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
1061
|
-
* @returns Maximum debt capacity
|
|
1062
|
-
*/
|
|
1063
|
-
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
1064
|
-
/**
|
|
1065
|
-
* Generate pool ID for balance pools.
|
|
1066
|
-
*/
|
|
1067
|
-
declare function generateBalancePoolId(parameters: {
|
|
1068
|
-
user: Address;
|
|
1069
|
-
chainId: Id;
|
|
1070
|
-
token: Address;
|
|
1071
|
-
}): string;
|
|
1072
|
-
/**
|
|
1073
|
-
* Generate pool ID for allowance pools.
|
|
1074
|
-
*/
|
|
1075
|
-
declare function generateAllowancePoolId(parameters: {
|
|
1076
|
-
user: Address;
|
|
1077
|
-
chainId: Id;
|
|
1078
|
-
token: Address;
|
|
1079
|
-
}): string;
|
|
1080
|
-
/**
|
|
1081
|
-
* Generate pool ID for sell ERC20 callback pools.
|
|
1082
|
-
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
1083
|
-
*/
|
|
1084
|
-
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
1085
|
-
user: Address;
|
|
1086
|
-
chainId: Id;
|
|
1087
|
-
obligationId: Hex;
|
|
1088
|
-
token: Address;
|
|
1089
|
-
offerHash: Hex;
|
|
1090
|
-
}): string;
|
|
1091
|
-
/**
|
|
1092
|
-
* Generate pool ID for obligation collateral pools.
|
|
1093
|
-
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
1094
|
-
* These pools are shared across all offers with the same obligation.
|
|
1095
|
-
*/
|
|
1096
|
-
declare function generateObligationCollateralPoolId(parameters: {
|
|
1097
|
-
user: Address;
|
|
1098
|
-
chainId: Id;
|
|
1099
|
-
obligationId: Hex;
|
|
1100
|
-
token: Address;
|
|
1101
|
-
}): string;
|
|
1102
|
-
/**
|
|
1103
|
-
* Generate pool ID for buy vault callback pools.
|
|
1104
|
-
*/
|
|
1105
|
-
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
1106
|
-
user: Address;
|
|
1107
|
-
chainId: Id;
|
|
1108
|
-
vault: Address;
|
|
1109
|
-
offerHash: Hex;
|
|
1110
|
-
}): string;
|
|
1111
|
-
/**
|
|
1112
|
-
* Generate pool ID for debt pools.
|
|
1113
|
-
*/
|
|
1114
|
-
declare function generateDebtPoolId(parameters: {
|
|
1115
|
-
user: Address;
|
|
1116
|
-
chainId: Id;
|
|
1117
|
-
obligationId: Hex;
|
|
1118
|
-
}): string;
|
|
1119
|
-
/**
|
|
1120
|
-
* Generate pool ID for user position in a vault.
|
|
1121
|
-
*/
|
|
1122
|
-
declare function generateUserVaultPositionPoolId(parameters: {
|
|
1123
|
-
user: Address;
|
|
1124
|
-
chainId: Id;
|
|
1125
|
-
vault: Address;
|
|
1126
|
-
}): string;
|
|
1127
|
-
/**
|
|
1128
|
-
* Generate pool ID for vault position in a market.
|
|
1129
|
-
*/
|
|
1130
|
-
declare function generateVaultPositionPoolId(parameters: {
|
|
1131
|
-
vault: Address;
|
|
1132
|
-
chainId: Id;
|
|
1133
|
-
marketId: string;
|
|
1134
|
-
}): string;
|
|
1135
|
-
/**
|
|
1136
|
-
* Generate pool ID for market total liquidity.
|
|
1137
|
-
*/
|
|
1138
|
-
declare function generateMarketLiquidityPoolId(parameters: {
|
|
1139
|
-
chainId: Id;
|
|
1140
|
-
marketId: string;
|
|
1141
|
-
}): string;
|
|
1142
|
-
declare namespace Obligation_d_exports {
|
|
1143
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$8 as from, fromSnakeCase$1 as fromSnakeCase, id, random$1 as random };
|
|
1144
|
-
}
|
|
1145
|
-
type Obligation = {
|
|
1146
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
1147
|
-
chainId: Id;
|
|
1148
|
-
/** The token that is being borrowed for this obligation. */
|
|
1149
|
-
loanToken: Address;
|
|
1150
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
1151
|
-
collaterals: Collateral[];
|
|
1152
|
-
/** The maturity of the obligation. */
|
|
1153
|
-
maturity: Maturity;
|
|
1154
|
-
};
|
|
1155
|
-
declare const ObligationSchema: z$1.ZodObject<{
|
|
1156
|
-
chainId: z$1.ZodNumber;
|
|
1157
|
-
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1158
|
-
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1159
|
-
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1160
|
-
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1161
|
-
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1162
|
-
}, z$1.core.$strip>>;
|
|
1163
|
-
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1164
|
-
}, z$1.core.$strip>;
|
|
1165
|
-
/**
|
|
1166
|
-
* Creates an obligation from the given parameters.
|
|
1167
|
-
* @constructor
|
|
1168
|
-
* @param parameters - {@link from.Parameters}
|
|
1169
|
-
* @returns The created obligation. {@link Obligation}
|
|
1170
|
-
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1171
|
-
*
|
|
1172
|
-
* @example
|
|
1173
|
-
* ```ts
|
|
1174
|
-
* const obligation = Obligation.from({
|
|
1175
|
-
* chainId: 1,
|
|
1176
|
-
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1177
|
-
* collaterals: [
|
|
1178
|
-
* Collateral.from({
|
|
1179
|
-
* asset: privateKeyToAccount(generatePrivateKey()).address,
|
|
1180
|
-
* oracle: privateKeyToAccount(generatePrivateKey()).address,
|
|
1181
|
-
* lltv: 0.965
|
|
1182
|
-
* }),
|
|
1183
|
-
* ],
|
|
1184
|
-
* maturity: Maturity.from("end_of_next_quarter"),
|
|
1185
|
-
* });
|
|
1186
|
-
* ```
|
|
1187
|
-
*/
|
|
1188
|
-
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1189
|
-
declare namespace from$8 {
|
|
1190
|
-
type Parameters = {
|
|
1191
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
1192
|
-
chainId: number;
|
|
1193
|
-
/** The token that is being borrowed for this obligation. */
|
|
1194
|
-
loanToken: Address;
|
|
1195
|
-
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1196
|
-
collaterals: from$11.Parameters[] | readonly from$11.Parameters[];
|
|
1197
|
-
/** The maturity of the obligation. */
|
|
1198
|
-
maturity: from$10.Parameters;
|
|
1199
|
-
};
|
|
1200
|
-
type ReturnType = Obligation;
|
|
1201
|
-
type ErrorType = InvalidObligationError;
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* Creates an obligation from a snake case object.
|
|
1205
|
-
* @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
|
|
1206
|
-
* @param input - {@link fromSnakeCase.Parameters}
|
|
1207
|
-
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
1208
|
-
*/
|
|
1209
|
-
declare function fromSnakeCase$1(input: fromSnakeCase$1.Parameters): fromSnakeCase$1.ReturnType;
|
|
1210
|
-
declare namespace fromSnakeCase$1 {
|
|
1211
|
-
type Parameters = Snake<Omit<Obligation, "chainId"> & {
|
|
1212
|
-
chainId: number;
|
|
1213
|
-
}>;
|
|
1214
|
-
type ReturnType = Obligation;
|
|
1215
|
-
type ErrorType = InvalidObligationError;
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
1219
|
-
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
|
|
1220
|
-
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1221
|
-
* @param obligation - {@link id.Parameters}
|
|
1222
|
-
* @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
|
|
1223
|
-
*
|
|
1224
|
-
* @example
|
|
1225
|
-
* ```ts
|
|
1226
|
-
* const obligation = Obligation.random();
|
|
1227
|
-
* const id = Obligation.id(obligation);
|
|
1228
|
-
* console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1229
|
-
* ```
|
|
1230
|
-
*/
|
|
1231
|
-
declare function id(obligation: id.Parameters): id.ReturnType;
|
|
1232
|
-
declare namespace id {
|
|
1233
|
-
type Parameters = Obligation;
|
|
1234
|
-
type ReturnType = Hex;
|
|
1235
|
-
type ErrorType = CollateralsAreNotSortedError;
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* Generates a random obligation.
|
|
1239
|
-
* @returns A randomly generated obligation. {@link random.ReturnType}
|
|
1240
|
-
*
|
|
1241
|
-
* @example
|
|
1242
|
-
* ```ts
|
|
1243
|
-
* const obligation = Obligation.random();
|
|
1244
|
-
* ```
|
|
1245
|
-
*/
|
|
1246
|
-
declare function random$1(): random$1.ReturnType;
|
|
1247
|
-
declare namespace random$1 {
|
|
1248
|
-
type ReturnType = Obligation;
|
|
1249
|
-
}
|
|
1250
|
-
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1251
|
-
readonly name = "Obligation.InvalidObligationError";
|
|
1252
|
-
constructor(error: z$1.ZodError | Error);
|
|
1253
|
-
}
|
|
1254
|
-
declare class CollateralsAreNotSortedError extends BaseError {
|
|
1255
|
-
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1256
|
-
constructor();
|
|
1257
|
-
}
|
|
1258
|
-
declare namespace Oracle_d_exports {
|
|
1259
|
-
export { Conversion, Oracle, from$7 as from };
|
|
1260
|
-
}
|
|
1261
|
-
/**
|
|
1262
|
-
* An oracle contract that provides price information for assets.
|
|
1263
|
-
*/
|
|
1264
|
-
type Oracle = {
|
|
1265
|
-
/** The chain id where the oracle is deployed. */
|
|
1266
|
-
readonly chainId: Id;
|
|
1267
|
-
/** The address of the oracle contract. */
|
|
1268
|
-
readonly address: Address;
|
|
1269
|
-
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1270
|
-
readonly price: bigint | null;
|
|
1271
|
-
/** The block number at which the price was fetched. */
|
|
1272
|
-
readonly blockNumber: number;
|
|
1273
|
-
};
|
|
1274
|
-
/**
|
|
1275
|
-
* Create an Oracle from a plain object.
|
|
1276
|
-
* @param data - The data to create the oracle from.
|
|
1277
|
-
* @returns The created oracle.
|
|
1278
|
-
*/
|
|
1279
|
-
declare function from$7(data: from$7.Parameters): from$7.ReturnType;
|
|
1280
|
-
declare namespace from$7 {
|
|
1281
|
-
type Parameters = {
|
|
1282
|
-
chainId: Id;
|
|
1283
|
-
address: Address;
|
|
1284
|
-
price: string | null;
|
|
1285
|
-
blockNumber: number;
|
|
1286
|
-
};
|
|
1287
|
-
type ReturnType = Oracle;
|
|
1288
|
-
}
|
|
1289
|
-
/**
|
|
1290
|
-
* Conversion utilities for converting between collateral and loan token amounts
|
|
1291
|
-
* using oracle prices and LLTV
|
|
1292
|
-
*/
|
|
1293
|
-
declare namespace Conversion {
|
|
1294
|
-
/**
|
|
1295
|
-
* Converts a collateral amount to loan token
|
|
1296
|
-
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
1297
|
-
*
|
|
1298
|
-
* @param amount - The collateral amount to convert
|
|
1299
|
-
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1300
|
-
* @returns The equivalent loan token amount
|
|
1345
|
+
* Converts a collateral amount to loan token
|
|
1346
|
+
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
1347
|
+
*
|
|
1348
|
+
* @param amount - The collateral amount to convert
|
|
1349
|
+
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1350
|
+
* @returns The equivalent loan token amount
|
|
1301
1351
|
*/
|
|
1302
1352
|
function collateralToLoan(amount: bigint, params: {
|
|
1303
1353
|
price: bigint;
|
|
@@ -1318,7 +1368,7 @@ declare namespace Conversion {
|
|
|
1318
1368
|
}): bigint;
|
|
1319
1369
|
}
|
|
1320
1370
|
declare namespace Position_d_exports {
|
|
1321
|
-
export { Position, Type, from$
|
|
1371
|
+
export { Position, Type, from$7 as from };
|
|
1322
1372
|
}
|
|
1323
1373
|
type Position = {
|
|
1324
1374
|
/** The chain id. */
|
|
@@ -1352,8 +1402,8 @@ declare enum Type {
|
|
|
1352
1402
|
* @param parameters - {@link from.Parameters}
|
|
1353
1403
|
* @returns The created Position. {@link from.ReturnType}
|
|
1354
1404
|
*/
|
|
1355
|
-
declare function from$
|
|
1356
|
-
declare namespace from$
|
|
1405
|
+
declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
|
|
1406
|
+
declare namespace from$7 {
|
|
1357
1407
|
type Parameters = {
|
|
1358
1408
|
chainId: Id;
|
|
1359
1409
|
contract: Address;
|
|
@@ -1366,27 +1416,27 @@ declare namespace from$6 {
|
|
|
1366
1416
|
type ReturnType = Position;
|
|
1367
1417
|
}
|
|
1368
1418
|
declare namespace Quote_d_exports {
|
|
1369
|
-
export { InvalidQuoteError, Quote, QuoteSchema, from$
|
|
1419
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$6 as from, fromSnakeCase, random };
|
|
1370
1420
|
}
|
|
1371
1421
|
type Quote = {
|
|
1372
1422
|
/** The obligation id. */
|
|
1373
1423
|
obligationId: Hex;
|
|
1374
1424
|
ask: {
|
|
1375
|
-
/** The
|
|
1376
|
-
|
|
1425
|
+
/** The ask price for the obligation. (18 decimals). */
|
|
1426
|
+
price: bigint;
|
|
1377
1427
|
};
|
|
1378
1428
|
bid: {
|
|
1379
|
-
/** The
|
|
1380
|
-
|
|
1429
|
+
/** The bid price for the obligation. (18 decimals). */
|
|
1430
|
+
price: bigint;
|
|
1381
1431
|
};
|
|
1382
1432
|
};
|
|
1383
1433
|
declare const QuoteSchema: z$1.ZodObject<{
|
|
1384
1434
|
obligationId: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1385
1435
|
ask: z$1.ZodObject<{
|
|
1386
|
-
|
|
1436
|
+
price: z$1.ZodBigInt;
|
|
1387
1437
|
}, z$1.core.$strip>;
|
|
1388
1438
|
bid: z$1.ZodObject<{
|
|
1389
|
-
|
|
1439
|
+
price: z$1.ZodBigInt;
|
|
1390
1440
|
}, z$1.core.$strip>;
|
|
1391
1441
|
}, z$1.core.$strip>;
|
|
1392
1442
|
/**
|
|
@@ -1398,11 +1448,11 @@ declare const QuoteSchema: z$1.ZodObject<{
|
|
|
1398
1448
|
*
|
|
1399
1449
|
* @example
|
|
1400
1450
|
* ```ts
|
|
1401
|
-
* const quote = Quote.from({ obligationId: "0x123", ask: {
|
|
1451
|
+
* const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
|
|
1402
1452
|
* ```
|
|
1403
1453
|
*/
|
|
1404
|
-
declare function from$
|
|
1405
|
-
declare namespace from$
|
|
1454
|
+
declare function from$6(parameters: from$6.Parameters): from$6.ReturnType;
|
|
1455
|
+
declare namespace from$6 {
|
|
1406
1456
|
type Parameters = Quote;
|
|
1407
1457
|
type ReturnType = Quote;
|
|
1408
1458
|
type ErrorType = InvalidQuoteError;
|
|
@@ -1417,7 +1467,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
|
|
|
1417
1467
|
declare namespace fromSnakeCase {
|
|
1418
1468
|
type Parameters = Snake<Quote>;
|
|
1419
1469
|
type ReturnType = Quote;
|
|
1420
|
-
type ErrorType = from$
|
|
1470
|
+
type ErrorType = from$6.ErrorType;
|
|
1421
1471
|
}
|
|
1422
1472
|
/**
|
|
1423
1473
|
* Generates a random quote.
|
|
@@ -1432,14 +1482,14 @@ declare function random(): random.ReturnType;
|
|
|
1432
1482
|
declare namespace random {
|
|
1433
1483
|
type Parameters = never;
|
|
1434
1484
|
type ReturnType = Quote;
|
|
1435
|
-
type ErrorType = from$
|
|
1485
|
+
type ErrorType = from$6.ErrorType;
|
|
1436
1486
|
}
|
|
1437
1487
|
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1438
1488
|
readonly name = "Quote.InvalidQuoteError";
|
|
1439
1489
|
constructor(error: z$1.ZodError | Error);
|
|
1440
1490
|
}
|
|
1441
1491
|
declare namespace Transfer_d_exports {
|
|
1442
|
-
export { Transfer, from$
|
|
1492
|
+
export { Transfer, from$5 as from };
|
|
1443
1493
|
}
|
|
1444
1494
|
type Transfer = {
|
|
1445
1495
|
id: string;
|
|
@@ -1462,8 +1512,8 @@ type Transfer = {
|
|
|
1462
1512
|
* const transfer = Transfer.from({ id: "1", chainId: 1, contract: "0x123", from: "0x456", to: "0x789", value: 100n, blockNumber: 100n });
|
|
1463
1513
|
* ```
|
|
1464
1514
|
*/
|
|
1465
|
-
declare function from$
|
|
1466
|
-
declare namespace from$
|
|
1515
|
+
declare function from$5(parameters: from$5.Parameters): from$5.ReturnType;
|
|
1516
|
+
declare namespace from$5 {
|
|
1467
1517
|
type Parameters = {
|
|
1468
1518
|
id: string;
|
|
1469
1519
|
chainId: Id;
|
|
@@ -1476,7 +1526,7 @@ declare namespace from$4 {
|
|
|
1476
1526
|
type ReturnType = Transfer;
|
|
1477
1527
|
}
|
|
1478
1528
|
declare namespace Tree_d_exports {
|
|
1479
|
-
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode
|
|
1529
|
+
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs };
|
|
1480
1530
|
}
|
|
1481
1531
|
/**
|
|
1482
1532
|
* A merkle tree of offers built from offer hashes.
|
|
@@ -1506,7 +1556,7 @@ declare const VERSION = 1;
|
|
|
1506
1556
|
* @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
|
|
1507
1557
|
* @throws {TreeError} If tree building fails due to offer inconsistencies.
|
|
1508
1558
|
*/
|
|
1509
|
-
declare const from$
|
|
1559
|
+
declare const from$4: (offers: Offer[]) => Tree;
|
|
1510
1560
|
/**
|
|
1511
1561
|
* Generates merkle proofs for all offers in a tree.
|
|
1512
1562
|
*
|
|
@@ -1551,7 +1601,7 @@ declare const proofs: (tree: Tree) => Proof[];
|
|
|
1551
1601
|
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1552
1602
|
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1553
1603
|
*/
|
|
1554
|
-
declare const encode
|
|
1604
|
+
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1555
1605
|
/**
|
|
1556
1606
|
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1557
1607
|
*
|
|
@@ -1589,7 +1639,7 @@ declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
|
1589
1639
|
* @returns Validated tree, signature, and recovered signer address
|
|
1590
1640
|
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1591
1641
|
*/
|
|
1592
|
-
declare const decode
|
|
1642
|
+
declare const decode: (encoded: Hex) => Promise<{
|
|
1593
1643
|
tree: Tree;
|
|
1594
1644
|
signature: Hex;
|
|
1595
1645
|
signer: Address;
|
|
@@ -1635,13 +1685,13 @@ interface paths {
|
|
|
1635
1685
|
};
|
|
1636
1686
|
/**
|
|
1637
1687
|
* Get aggregated book
|
|
1638
|
-
* @description Returns aggregated book data for a given obligation and side. Offers are grouped by
|
|
1688
|
+
* @description Returns aggregated book data for a given obligation and side. Offers are grouped by computed price with summed takeable amounts. Book levels are sorted by price (ascending for buy side, descending for sell side).
|
|
1639
1689
|
*/
|
|
1640
1690
|
get: {
|
|
1641
1691
|
parameters: {
|
|
1642
1692
|
query?: {
|
|
1643
1693
|
/**
|
|
1644
|
-
* @description Maximum number of
|
|
1694
|
+
* @description Maximum number of price levels to return.
|
|
1645
1695
|
* @example 10
|
|
1646
1696
|
*/
|
|
1647
1697
|
limit?: number;
|
|
@@ -1652,7 +1702,18 @@ interface paths {
|
|
|
1652
1702
|
cursor?: string;
|
|
1653
1703
|
};
|
|
1654
1704
|
header?: never;
|
|
1655
|
-
path
|
|
1705
|
+
path: {
|
|
1706
|
+
/**
|
|
1707
|
+
* @description Book side (buy or sell).
|
|
1708
|
+
* @example buy
|
|
1709
|
+
*/
|
|
1710
|
+
side: "buy" | "sell";
|
|
1711
|
+
/**
|
|
1712
|
+
* @description Obligation id.
|
|
1713
|
+
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
1714
|
+
*/
|
|
1715
|
+
obligationId: string;
|
|
1716
|
+
};
|
|
1656
1717
|
cookie?: never;
|
|
1657
1718
|
};
|
|
1658
1719
|
requestBody?: never;
|
|
@@ -1685,6 +1746,45 @@ interface paths {
|
|
|
1685
1746
|
patch?: never;
|
|
1686
1747
|
trace?: never;
|
|
1687
1748
|
};
|
|
1749
|
+
"/v1/config": {
|
|
1750
|
+
parameters: {
|
|
1751
|
+
query?: never;
|
|
1752
|
+
header?: never;
|
|
1753
|
+
path?: never;
|
|
1754
|
+
cookie?: never;
|
|
1755
|
+
};
|
|
1756
|
+
/**
|
|
1757
|
+
* Get router configuration
|
|
1758
|
+
* @description Returns chain configurations including contract addresses and supported maturity timestamps.
|
|
1759
|
+
*/
|
|
1760
|
+
get: {
|
|
1761
|
+
parameters: {
|
|
1762
|
+
query?: never;
|
|
1763
|
+
header?: never;
|
|
1764
|
+
path?: never;
|
|
1765
|
+
cookie?: never;
|
|
1766
|
+
};
|
|
1767
|
+
requestBody?: never;
|
|
1768
|
+
responses: {
|
|
1769
|
+
/** @description Success */
|
|
1770
|
+
200: {
|
|
1771
|
+
headers: {
|
|
1772
|
+
[name: string]: unknown;
|
|
1773
|
+
};
|
|
1774
|
+
content: {
|
|
1775
|
+
"application/json": components["schemas"]["ConfigSuccessResponse"];
|
|
1776
|
+
};
|
|
1777
|
+
};
|
|
1778
|
+
};
|
|
1779
|
+
};
|
|
1780
|
+
put?: never;
|
|
1781
|
+
post?: never;
|
|
1782
|
+
delete?: never;
|
|
1783
|
+
options?: never;
|
|
1784
|
+
head?: never;
|
|
1785
|
+
patch?: never;
|
|
1786
|
+
trace?: never;
|
|
1787
|
+
};
|
|
1688
1788
|
"/v1/offers": {
|
|
1689
1789
|
parameters: {
|
|
1690
1790
|
query?: never;
|
|
@@ -1694,7 +1794,7 @@ interface paths {
|
|
|
1694
1794
|
};
|
|
1695
1795
|
/**
|
|
1696
1796
|
* List all offers
|
|
1697
|
-
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `
|
|
1797
|
+
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `maker` (by maker address).
|
|
1698
1798
|
*/
|
|
1699
1799
|
get: {
|
|
1700
1800
|
parameters: {
|
|
@@ -1713,9 +1813,9 @@ interface paths {
|
|
|
1713
1813
|
* @description Maker address to filter offers by. Alternative to obligation_id + side.
|
|
1714
1814
|
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
1715
1815
|
*/
|
|
1716
|
-
|
|
1816
|
+
maker?: string;
|
|
1717
1817
|
/**
|
|
1718
|
-
* @description Obligation id used to filter offers. Required when not using
|
|
1818
|
+
* @description Obligation id used to filter offers. Required when not using maker.
|
|
1719
1819
|
* @example 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1720
1820
|
*/
|
|
1721
1821
|
obligation_id?: string;
|
|
@@ -1773,9 +1873,35 @@ interface paths {
|
|
|
1773
1873
|
get: {
|
|
1774
1874
|
parameters: {
|
|
1775
1875
|
query?: {
|
|
1776
|
-
/**
|
|
1876
|
+
/**
|
|
1877
|
+
* @description Filter by exact maturity timestamp (unix seconds).
|
|
1878
|
+
* @example 1761922800
|
|
1879
|
+
*/
|
|
1880
|
+
maturity?: number;
|
|
1881
|
+
/**
|
|
1882
|
+
* @description Filter by collateral token (matches any collateral in the obligation).
|
|
1883
|
+
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
1884
|
+
*/
|
|
1885
|
+
collateral_token?: string;
|
|
1886
|
+
/**
|
|
1887
|
+
* @description Filter by loan token address.
|
|
1888
|
+
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
1889
|
+
*/
|
|
1890
|
+
loan_token?: string;
|
|
1891
|
+
/**
|
|
1892
|
+
* @description Filter by chain ID.
|
|
1893
|
+
* @example 1
|
|
1894
|
+
*/
|
|
1895
|
+
chain?: number;
|
|
1896
|
+
/**
|
|
1897
|
+
* @description Maximum number of obligations to return.
|
|
1898
|
+
* @example 10
|
|
1899
|
+
*/
|
|
1777
1900
|
limit?: number;
|
|
1778
|
-
/**
|
|
1901
|
+
/**
|
|
1902
|
+
* @description Obligation id cursor for pagination.
|
|
1903
|
+
* @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc
|
|
1904
|
+
*/
|
|
1779
1905
|
cursor?: string;
|
|
1780
1906
|
};
|
|
1781
1907
|
header?: never;
|
|
@@ -1827,7 +1953,13 @@ interface paths {
|
|
|
1827
1953
|
parameters: {
|
|
1828
1954
|
query?: never;
|
|
1829
1955
|
header?: never;
|
|
1830
|
-
path
|
|
1956
|
+
path: {
|
|
1957
|
+
/**
|
|
1958
|
+
* @description Obligation id.
|
|
1959
|
+
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
1960
|
+
*/
|
|
1961
|
+
obligationId: string;
|
|
1962
|
+
};
|
|
1831
1963
|
cookie?: never;
|
|
1832
1964
|
};
|
|
1833
1965
|
requestBody?: never;
|
|
@@ -1873,7 +2005,13 @@ interface paths {
|
|
|
1873
2005
|
*/
|
|
1874
2006
|
get: {
|
|
1875
2007
|
parameters: {
|
|
1876
|
-
query?:
|
|
2008
|
+
query?: {
|
|
2009
|
+
/**
|
|
2010
|
+
* @description Fail the request if initialization is incomplete.
|
|
2011
|
+
* @example true
|
|
2012
|
+
*/
|
|
2013
|
+
strict?: boolean;
|
|
2014
|
+
};
|
|
1877
2015
|
header?: never;
|
|
1878
2016
|
path?: never;
|
|
1879
2017
|
cookie?: never;
|
|
@@ -1912,7 +2050,13 @@ interface paths {
|
|
|
1912
2050
|
*/
|
|
1913
2051
|
get: {
|
|
1914
2052
|
parameters: {
|
|
1915
|
-
query?:
|
|
2053
|
+
query?: {
|
|
2054
|
+
/**
|
|
2055
|
+
* @description Fail the request if initialization is incomplete.
|
|
2056
|
+
* @example true
|
|
2057
|
+
*/
|
|
2058
|
+
strict?: boolean;
|
|
2059
|
+
};
|
|
1916
2060
|
header?: never;
|
|
1917
2061
|
path?: never;
|
|
1918
2062
|
cookie?: never;
|
|
@@ -1951,7 +2095,13 @@ interface paths {
|
|
|
1951
2095
|
*/
|
|
1952
2096
|
get: {
|
|
1953
2097
|
parameters: {
|
|
1954
|
-
query?:
|
|
2098
|
+
query?: {
|
|
2099
|
+
/**
|
|
2100
|
+
* @description Fail the request if initialization is incomplete.
|
|
2101
|
+
* @example true
|
|
2102
|
+
*/
|
|
2103
|
+
strict?: boolean;
|
|
2104
|
+
};
|
|
1955
2105
|
header?: never;
|
|
1956
2106
|
path?: never;
|
|
1957
2107
|
cookie?: never;
|
|
@@ -1977,6 +2127,71 @@ interface paths {
|
|
|
1977
2127
|
patch?: never;
|
|
1978
2128
|
trace?: never;
|
|
1979
2129
|
};
|
|
2130
|
+
"/v1/users/{userAddress}/positions": {
|
|
2131
|
+
parameters: {
|
|
2132
|
+
query?: never;
|
|
2133
|
+
header?: never;
|
|
2134
|
+
path?: never;
|
|
2135
|
+
cookie?: never;
|
|
2136
|
+
};
|
|
2137
|
+
/**
|
|
2138
|
+
* Get user positions
|
|
2139
|
+
* @description Returns positions for a user with reserved balance. The reserved balance is the amount locked by active offers (max lot upper - offset - consumed).
|
|
2140
|
+
*/
|
|
2141
|
+
get: {
|
|
2142
|
+
parameters: {
|
|
2143
|
+
query?: {
|
|
2144
|
+
/**
|
|
2145
|
+
* @description Maximum number of positions to return.
|
|
2146
|
+
* @example 10
|
|
2147
|
+
*/
|
|
2148
|
+
limit?: number;
|
|
2149
|
+
/**
|
|
2150
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
2151
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
2152
|
+
*/
|
|
2153
|
+
cursor?: string;
|
|
2154
|
+
};
|
|
2155
|
+
header?: never;
|
|
2156
|
+
path: {
|
|
2157
|
+
/**
|
|
2158
|
+
* @description User address to get positions for.
|
|
2159
|
+
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
2160
|
+
*/
|
|
2161
|
+
userAddress: string;
|
|
2162
|
+
};
|
|
2163
|
+
cookie?: never;
|
|
2164
|
+
};
|
|
2165
|
+
requestBody?: never;
|
|
2166
|
+
responses: {
|
|
2167
|
+
/** @description Success */
|
|
2168
|
+
200: {
|
|
2169
|
+
headers: {
|
|
2170
|
+
[name: string]: unknown;
|
|
2171
|
+
};
|
|
2172
|
+
content: {
|
|
2173
|
+
"application/json": components["schemas"]["PositionListResponse"];
|
|
2174
|
+
};
|
|
2175
|
+
};
|
|
2176
|
+
/** @description Bad Request */
|
|
2177
|
+
400: {
|
|
2178
|
+
headers: {
|
|
2179
|
+
[name: string]: unknown;
|
|
2180
|
+
};
|
|
2181
|
+
content: {
|
|
2182
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2183
|
+
};
|
|
2184
|
+
};
|
|
2185
|
+
};
|
|
2186
|
+
};
|
|
2187
|
+
put?: never;
|
|
2188
|
+
post?: never;
|
|
2189
|
+
delete?: never;
|
|
2190
|
+
options?: never;
|
|
2191
|
+
head?: never;
|
|
2192
|
+
patch?: never;
|
|
2193
|
+
trace?: never;
|
|
2194
|
+
};
|
|
1980
2195
|
"/v1/validate": {
|
|
1981
2196
|
parameters: {
|
|
1982
2197
|
query?: never;
|
|
@@ -1992,11 +2207,12 @@ interface paths {
|
|
|
1992
2207
|
*
|
|
1993
2208
|
* **Available validation rules:**
|
|
1994
2209
|
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
1995
|
-
* - **mixed_maker**: Validates that all offers in a batch have the same maker
|
|
2210
|
+
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
2211
|
+
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
1996
2212
|
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
1997
2213
|
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
1998
2214
|
* - **callback**: Validates callbacks: buy empty callback is allowed; sell offers must use a non-empty callback; non-empty callbacks must target one of [0x3333333333333333333333333333333333333333, 0x4444444444444444444444444444444444444444, 0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222]
|
|
1999
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list
|
|
2215
|
+
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2000
2216
|
*/
|
|
2001
2217
|
post: {
|
|
2002
2218
|
parameters: {
|
|
@@ -2044,7 +2260,7 @@ interface components {
|
|
|
2044
2260
|
meta: components["schemas"]["Meta"];
|
|
2045
2261
|
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2046
2262
|
cursor: string | null;
|
|
2047
|
-
/** @description Aggregated book levels grouped by
|
|
2263
|
+
/** @description Aggregated book levels grouped by computed price. */
|
|
2048
2264
|
data: components["schemas"]["BookLevelResponse"][];
|
|
2049
2265
|
};
|
|
2050
2266
|
Meta: {
|
|
@@ -2053,7 +2269,7 @@ interface components {
|
|
|
2053
2269
|
};
|
|
2054
2270
|
BookLevelResponse: {
|
|
2055
2271
|
/** @example 2750000000000000000 */
|
|
2056
|
-
|
|
2272
|
+
price: string;
|
|
2057
2273
|
/** @example 369216000000000000000000 */
|
|
2058
2274
|
assets: string;
|
|
2059
2275
|
/** @example 5 */
|
|
@@ -2081,6 +2297,56 @@ interface components {
|
|
|
2081
2297
|
*/
|
|
2082
2298
|
details: Record<string, never>;
|
|
2083
2299
|
};
|
|
2300
|
+
ConfigSuccessResponse: {
|
|
2301
|
+
meta: components["schemas"]["Meta"];
|
|
2302
|
+
/** @example null */
|
|
2303
|
+
cursor: string | null;
|
|
2304
|
+
/**
|
|
2305
|
+
* @description Array of chain configurations for all indexed chains.
|
|
2306
|
+
* @example [
|
|
2307
|
+
* {
|
|
2308
|
+
* "chain_id": 505050505,
|
|
2309
|
+
* "contracts": {
|
|
2310
|
+
* "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
|
|
2311
|
+
* },
|
|
2312
|
+
* "maturities": {
|
|
2313
|
+
* "end_of_month": 1738335600,
|
|
2314
|
+
* "end_of_next_month": 1740754800
|
|
2315
|
+
* }
|
|
2316
|
+
* }
|
|
2317
|
+
* ]
|
|
2318
|
+
*/
|
|
2319
|
+
data: components["schemas"]["ConfigDataResponse"][];
|
|
2320
|
+
};
|
|
2321
|
+
ConfigDataResponse: {
|
|
2322
|
+
/** @example 505050505 */
|
|
2323
|
+
chain_id: number;
|
|
2324
|
+
contracts: components["schemas"]["ConfigContractsResponse"];
|
|
2325
|
+
/**
|
|
2326
|
+
* @description Supported maturity timestamps. Offers must use one of these values.
|
|
2327
|
+
* @example {
|
|
2328
|
+
* "end_of_month": 1738335600,
|
|
2329
|
+
* "end_of_next_month": 1740754800
|
|
2330
|
+
* }
|
|
2331
|
+
*/
|
|
2332
|
+
maturities: components["schemas"]["MaturitiesResponse"];
|
|
2333
|
+
};
|
|
2334
|
+
ConfigContractsResponse: {
|
|
2335
|
+
/** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
2336
|
+
mempool: string;
|
|
2337
|
+
};
|
|
2338
|
+
MaturitiesResponse: {
|
|
2339
|
+
/**
|
|
2340
|
+
* @description Unix timestamp for end of current month maturity (last Friday 15:00 UTC).
|
|
2341
|
+
* @example 1738335600
|
|
2342
|
+
*/
|
|
2343
|
+
end_of_month: number;
|
|
2344
|
+
/**
|
|
2345
|
+
* @description Unix timestamp for end of next month maturity (last Friday 15:00 UTC).
|
|
2346
|
+
* @example 1740754800
|
|
2347
|
+
*/
|
|
2348
|
+
end_of_next_month: number;
|
|
2349
|
+
};
|
|
2084
2350
|
OfferListResponse: {
|
|
2085
2351
|
meta: components["schemas"]["Meta"];
|
|
2086
2352
|
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
@@ -2089,29 +2355,34 @@ interface components {
|
|
|
2089
2355
|
* @description Offers matching the provided filters.
|
|
2090
2356
|
* @example [
|
|
2091
2357
|
* {
|
|
2092
|
-
* "
|
|
2093
|
-
*
|
|
2094
|
-
*
|
|
2095
|
-
*
|
|
2096
|
-
*
|
|
2097
|
-
*
|
|
2098
|
-
*
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2103
|
-
*
|
|
2104
|
-
*
|
|
2105
|
-
*
|
|
2106
|
-
*
|
|
2107
|
-
*
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
2111
|
-
* "
|
|
2112
|
-
* "
|
|
2113
|
-
* "
|
|
2358
|
+
* "offer": {
|
|
2359
|
+
* "obligation": {
|
|
2360
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
2361
|
+
* "collaterals": [
|
|
2362
|
+
* {
|
|
2363
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2364
|
+
* "lltv": "860000000000000000",
|
|
2365
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
2366
|
+
* }
|
|
2367
|
+
* ],
|
|
2368
|
+
* "maturity": 1761922799
|
|
2369
|
+
* },
|
|
2370
|
+
* "buy": false,
|
|
2371
|
+
* "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2372
|
+
* "assets": "369216000000000000000000",
|
|
2373
|
+
* "obligation_units": "0",
|
|
2374
|
+
* "obligation_shares": "0",
|
|
2375
|
+
* "start": 1761922790,
|
|
2376
|
+
* "expiry": 1761922799,
|
|
2377
|
+
* "price": "2750000000000000000",
|
|
2378
|
+
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
2379
|
+
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
2380
|
+
* "callback": "0x1111111111111111111111111111111111111111",
|
|
2381
|
+
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2114
2382
|
* },
|
|
2383
|
+
* "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
2384
|
+
* "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
|
|
2385
|
+
* "chain_id": 1,
|
|
2115
2386
|
* "consumed": "0",
|
|
2116
2387
|
* "takeable": "369216000000000000000000",
|
|
2117
2388
|
* "block_number": 2942933377146801,
|
|
@@ -2127,50 +2398,44 @@ interface components {
|
|
|
2127
2398
|
data: components["schemas"]["OfferListItemResponse"][];
|
|
2128
2399
|
};
|
|
2129
2400
|
OfferListItemResponse: {
|
|
2130
|
-
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2131
|
-
hash: string;
|
|
2132
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2133
|
-
offering: string;
|
|
2134
|
-
/** @example 369216000000000000000000 */
|
|
2135
|
-
assets: string;
|
|
2136
|
-
/** @example 2750000000000000000 */
|
|
2137
|
-
rate: string;
|
|
2138
|
-
/** @example 1761922799 */
|
|
2139
|
-
maturity: number;
|
|
2140
|
-
/** @example 1761922799 */
|
|
2141
|
-
expiry: number;
|
|
2142
|
-
/** @example 1761922790 */
|
|
2143
|
-
start: number;
|
|
2144
|
-
/** @example 571380 */
|
|
2145
|
-
nonce: string;
|
|
2146
|
-
/** @example false */
|
|
2147
|
-
buy: boolean;
|
|
2148
|
-
/** @example 1 */
|
|
2149
|
-
chain_id: number;
|
|
2150
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2151
|
-
loan_token: string;
|
|
2152
|
-
/**
|
|
2153
|
-
* @example [
|
|
2154
|
-
* {
|
|
2155
|
-
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2156
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2157
|
-
* "lltv": "860000000000000000"
|
|
2158
|
-
* }
|
|
2159
|
-
* ]
|
|
2160
|
-
*/
|
|
2161
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2162
2401
|
/**
|
|
2163
2402
|
* @example {
|
|
2164
|
-
* "
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2403
|
+
* "obligation": {
|
|
2404
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
2405
|
+
* "collaterals": [
|
|
2406
|
+
* {
|
|
2407
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2408
|
+
* "lltv": "860000000000000000",
|
|
2409
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
2410
|
+
* }
|
|
2411
|
+
* ],
|
|
2412
|
+
* "maturity": 1761922799
|
|
2413
|
+
* },
|
|
2414
|
+
* "buy": false,
|
|
2415
|
+
* "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2416
|
+
* "assets": "369216000000000000000000",
|
|
2417
|
+
* "obligation_units": "0",
|
|
2418
|
+
* "obligation_shares": "0",
|
|
2419
|
+
* "start": 1761922790,
|
|
2420
|
+
* "expiry": 1761922799,
|
|
2421
|
+
* "price": "2750000000000000000",
|
|
2422
|
+
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
2423
|
+
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
2424
|
+
* "callback": "0x1111111111111111111111111111111111111111",
|
|
2425
|
+
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2167
2426
|
* }
|
|
2168
2427
|
*/
|
|
2169
|
-
|
|
2170
|
-
/** @example
|
|
2171
|
-
|
|
2428
|
+
offer: components["schemas"]["OfferDataResponse"];
|
|
2429
|
+
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2430
|
+
offer_hash: string;
|
|
2431
|
+
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2432
|
+
obligation_id: string;
|
|
2433
|
+
/** @example 1 */
|
|
2434
|
+
chain_id: number;
|
|
2172
2435
|
/** @example 0 */
|
|
2173
2436
|
consumed: string;
|
|
2437
|
+
/** @example 369216000000000000000000 */
|
|
2438
|
+
takeable: string;
|
|
2174
2439
|
/** @example 2942933377146801 */
|
|
2175
2440
|
block_number: number;
|
|
2176
2441
|
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
@@ -2185,21 +2450,69 @@ interface components {
|
|
|
2185
2450
|
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2186
2451
|
signature: string | null;
|
|
2187
2452
|
};
|
|
2453
|
+
OfferDataResponse: {
|
|
2454
|
+
/**
|
|
2455
|
+
* @example {
|
|
2456
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
2457
|
+
* "collaterals": [
|
|
2458
|
+
* {
|
|
2459
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2460
|
+
* "lltv": "860000000000000000",
|
|
2461
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
2462
|
+
* }
|
|
2463
|
+
* ],
|
|
2464
|
+
* "maturity": 1761922799
|
|
2465
|
+
* }
|
|
2466
|
+
*/
|
|
2467
|
+
obligation: components["schemas"]["ObligationOfferResponse"];
|
|
2468
|
+
/** @example false */
|
|
2469
|
+
buy: boolean;
|
|
2470
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2471
|
+
maker: string;
|
|
2472
|
+
/** @example 369216000000000000000000 */
|
|
2473
|
+
assets: string;
|
|
2474
|
+
/** @example 0 */
|
|
2475
|
+
obligation_units: string;
|
|
2476
|
+
/** @example 0 */
|
|
2477
|
+
obligation_shares: string;
|
|
2478
|
+
/** @example 1761922790 */
|
|
2479
|
+
start: number;
|
|
2480
|
+
/** @example 1761922799 */
|
|
2481
|
+
expiry: number;
|
|
2482
|
+
/** @example 2750000000000000000 */
|
|
2483
|
+
price: string;
|
|
2484
|
+
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2485
|
+
group: string;
|
|
2486
|
+
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2487
|
+
session: string;
|
|
2488
|
+
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2489
|
+
callback: string;
|
|
2490
|
+
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2491
|
+
callback_data: string;
|
|
2492
|
+
};
|
|
2493
|
+
ObligationOfferResponse: {
|
|
2494
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2495
|
+
loan_token: string;
|
|
2496
|
+
/**
|
|
2497
|
+
* @example [
|
|
2498
|
+
* {
|
|
2499
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2500
|
+
* "lltv": "860000000000000000",
|
|
2501
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
2502
|
+
* }
|
|
2503
|
+
* ]
|
|
2504
|
+
*/
|
|
2505
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2506
|
+
/** @example 1761922799 */
|
|
2507
|
+
maturity: number;
|
|
2508
|
+
};
|
|
2188
2509
|
CollateralResponse: {
|
|
2189
2510
|
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2190
|
-
|
|
2191
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2192
|
-
oracle: string;
|
|
2511
|
+
token: string;
|
|
2193
2512
|
/** @example 860000000000000000 */
|
|
2194
2513
|
lltv: string;
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2198
|
-
address: string;
|
|
2199
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2200
|
-
data: string;
|
|
2201
|
-
/** @example 500000 */
|
|
2202
|
-
gas_limit: string;
|
|
2514
|
+
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2515
|
+
oracle: string;
|
|
2203
2516
|
};
|
|
2204
2517
|
ObligationListResponse: {
|
|
2205
2518
|
meta: components["schemas"]["Meta"];
|
|
@@ -2223,11 +2536,11 @@ interface components {
|
|
|
2223
2536
|
};
|
|
2224
2537
|
AskResponse: {
|
|
2225
2538
|
/** @example 1000000000000000000 */
|
|
2226
|
-
|
|
2539
|
+
price: string;
|
|
2227
2540
|
};
|
|
2228
2541
|
BidResponse: {
|
|
2229
2542
|
/** @example 1000000000000000000 */
|
|
2230
|
-
|
|
2543
|
+
price: string;
|
|
2231
2544
|
};
|
|
2232
2545
|
ObligationSingleSuccessResponse: {
|
|
2233
2546
|
meta: components["schemas"]["Meta"];
|
|
@@ -2241,7 +2554,10 @@ interface components {
|
|
|
2241
2554
|
/**
|
|
2242
2555
|
* @description Aggregated router status.
|
|
2243
2556
|
* @example {
|
|
2244
|
-
* "status": "live"
|
|
2557
|
+
* "status": "live",
|
|
2558
|
+
* "initialized": true,
|
|
2559
|
+
* "missing_chains": [],
|
|
2560
|
+
* "missing_collectors": []
|
|
2245
2561
|
* }
|
|
2246
2562
|
*/
|
|
2247
2563
|
data: components["schemas"]["RouterStatusDataResponse"];
|
|
@@ -2252,6 +2568,24 @@ interface components {
|
|
|
2252
2568
|
* @enum {string}
|
|
2253
2569
|
*/
|
|
2254
2570
|
status: "live" | "syncing";
|
|
2571
|
+
/** @example true */
|
|
2572
|
+
initialized: boolean;
|
|
2573
|
+
/**
|
|
2574
|
+
* @description Configured chain ids missing initialization rows.
|
|
2575
|
+
* @example []
|
|
2576
|
+
*/
|
|
2577
|
+
missing_chains: number[];
|
|
2578
|
+
/**
|
|
2579
|
+
* @description Collectors missing initialization rows.
|
|
2580
|
+
* @example []
|
|
2581
|
+
*/
|
|
2582
|
+
missing_collectors: components["schemas"]["MissingCollectorResponse"][];
|
|
2583
|
+
};
|
|
2584
|
+
MissingCollectorResponse: {
|
|
2585
|
+
/** @example 1 */
|
|
2586
|
+
chain_id: number;
|
|
2587
|
+
/** @example offers */
|
|
2588
|
+
name: string;
|
|
2255
2589
|
};
|
|
2256
2590
|
CollectorsHealthSuccessResponse: {
|
|
2257
2591
|
meta: components["schemas"]["Meta"];
|
|
@@ -2264,7 +2598,8 @@ interface components {
|
|
|
2264
2598
|
* "block_number": 21345678,
|
|
2265
2599
|
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
2266
2600
|
* "lag": 0,
|
|
2267
|
-
* "status": "live"
|
|
2601
|
+
* "status": "live",
|
|
2602
|
+
* "initialized": true
|
|
2268
2603
|
* }
|
|
2269
2604
|
* ]
|
|
2270
2605
|
*/
|
|
@@ -2286,6 +2621,8 @@ interface components {
|
|
|
2286
2621
|
* @enum {string}
|
|
2287
2622
|
*/
|
|
2288
2623
|
status: "live" | "lagging" | "unknown";
|
|
2624
|
+
/** @example true */
|
|
2625
|
+
initialized: boolean;
|
|
2289
2626
|
};
|
|
2290
2627
|
ChainsHealthSuccessResponse: {
|
|
2291
2628
|
meta: components["schemas"]["Meta"];
|
|
@@ -2296,7 +2633,8 @@ interface components {
|
|
|
2296
2633
|
* "chain_id": 1,
|
|
2297
2634
|
* "local_block_number": 21345678,
|
|
2298
2635
|
* "remote_block_number": 21345690,
|
|
2299
|
-
* "updated_at": "2024-01-01T12:00:00.000Z"
|
|
2636
|
+
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
2637
|
+
* "initialized": true
|
|
2300
2638
|
* }
|
|
2301
2639
|
* ]
|
|
2302
2640
|
*/
|
|
@@ -2306,11 +2644,43 @@ interface components {
|
|
|
2306
2644
|
/** @example 1 */
|
|
2307
2645
|
chain_id: number;
|
|
2308
2646
|
/** @example 21345678 */
|
|
2309
|
-
local_block_number: number;
|
|
2647
|
+
local_block_number: number | null;
|
|
2310
2648
|
/** @example 21345690 */
|
|
2311
2649
|
remote_block_number: number | null;
|
|
2312
2650
|
/** @example 2024-01-01T12:00:00.000Z */
|
|
2313
|
-
updated_at: string;
|
|
2651
|
+
updated_at: string | null;
|
|
2652
|
+
/** @example true */
|
|
2653
|
+
initialized: boolean;
|
|
2654
|
+
};
|
|
2655
|
+
PositionListResponse: {
|
|
2656
|
+
meta: components["schemas"]["Meta"];
|
|
2657
|
+
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2658
|
+
cursor: string | null;
|
|
2659
|
+
/**
|
|
2660
|
+
* @description User positions with reserved balances from active offers.
|
|
2661
|
+
* @example [
|
|
2662
|
+
* {
|
|
2663
|
+
* "chain_id": 1,
|
|
2664
|
+
* "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
2665
|
+
* "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2666
|
+
* "reserved": "200000000000000000000",
|
|
2667
|
+
* "block_number": 21345678
|
|
2668
|
+
* }
|
|
2669
|
+
* ]
|
|
2670
|
+
*/
|
|
2671
|
+
data: components["schemas"]["PositionListItemResponse"][];
|
|
2672
|
+
};
|
|
2673
|
+
PositionListItemResponse: {
|
|
2674
|
+
/** @example 1 */
|
|
2675
|
+
chain_id: number;
|
|
2676
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2677
|
+
contract: string;
|
|
2678
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2679
|
+
user: string;
|
|
2680
|
+
/** @example 200000000000000000000 */
|
|
2681
|
+
reserved: string;
|
|
2682
|
+
/** @example 21345678 */
|
|
2683
|
+
block_number: number;
|
|
2314
2684
|
};
|
|
2315
2685
|
ValidateOffersRequest: {
|
|
2316
2686
|
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
@@ -2318,19 +2688,25 @@ interface components {
|
|
|
2318
2688
|
};
|
|
2319
2689
|
ValidateOfferRequest: {
|
|
2320
2690
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2321
|
-
|
|
2691
|
+
maker: string;
|
|
2322
2692
|
/** @example 369216000000000000000000 */
|
|
2323
2693
|
assets: string;
|
|
2694
|
+
/** @example 0 */
|
|
2695
|
+
obligation_units?: string;
|
|
2696
|
+
/** @example 0 */
|
|
2697
|
+
obligation_shares?: string;
|
|
2324
2698
|
/** @example 2750000000000000000 */
|
|
2325
|
-
|
|
2699
|
+
price: string;
|
|
2326
2700
|
/** @example 1761922799 */
|
|
2327
2701
|
maturity: number;
|
|
2328
2702
|
/** @example 1761922799 */
|
|
2329
2703
|
expiry: number;
|
|
2330
2704
|
/** @example 1761922790 */
|
|
2331
2705
|
start: number;
|
|
2332
|
-
/** @example
|
|
2333
|
-
|
|
2706
|
+
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
2707
|
+
group: string;
|
|
2708
|
+
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
2709
|
+
session: string;
|
|
2334
2710
|
/** @example false */
|
|
2335
2711
|
buy: boolean;
|
|
2336
2712
|
/** @example 1 */
|
|
@@ -2346,15 +2722,28 @@ interface components {
|
|
|
2346
2722
|
* }
|
|
2347
2723
|
* ]
|
|
2348
2724
|
*/
|
|
2349
|
-
collaterals: components["schemas"]["
|
|
2725
|
+
collaterals: components["schemas"]["ValidateCollateralRequest"][];
|
|
2350
2726
|
/**
|
|
2351
2727
|
* @example {
|
|
2352
2728
|
* "address": "0x1111111111111111111111111111111111111111",
|
|
2353
|
-
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2354
|
-
* "gas_limit": "500000"
|
|
2729
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2355
2730
|
* }
|
|
2356
2731
|
*/
|
|
2357
|
-
callback: components["schemas"]["
|
|
2732
|
+
callback: components["schemas"]["ValidateCallbackRequest"];
|
|
2733
|
+
};
|
|
2734
|
+
ValidateCollateralRequest: {
|
|
2735
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2736
|
+
asset: string;
|
|
2737
|
+
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2738
|
+
oracle: string;
|
|
2739
|
+
/** @example 860000000000000000 */
|
|
2740
|
+
lltv: string;
|
|
2741
|
+
};
|
|
2742
|
+
ValidateCallbackRequest: {
|
|
2743
|
+
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2744
|
+
address: string;
|
|
2745
|
+
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2746
|
+
data: string;
|
|
2358
2747
|
};
|
|
2359
2748
|
ValidationSuccessResponse: {
|
|
2360
2749
|
meta: components["schemas"]["Meta"];
|
|
@@ -2362,245 +2751,79 @@ interface components {
|
|
|
2362
2751
|
cursor: string | null;
|
|
2363
2752
|
/** @description Payload and root for client-side signing. */
|
|
2364
2753
|
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2365
|
-
};
|
|
2366
|
-
ValidationSuccessDataResponse: {
|
|
2367
|
-
/**
|
|
2368
|
-
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
2369
|
-
* @example 0x01789c...
|
|
2370
|
-
*/
|
|
2371
|
-
payload: string;
|
|
2372
|
-
/**
|
|
2373
|
-
* @description Merkle tree root to sign with EIP-191.
|
|
2374
|
-
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
2375
|
-
*/
|
|
2376
|
-
root: string;
|
|
2377
|
-
};
|
|
2378
|
-
};
|
|
2379
|
-
responses: never;
|
|
2380
|
-
parameters: never;
|
|
2381
|
-
requestBodies: never;
|
|
2382
|
-
headers: never;
|
|
2383
|
-
pathItems: never;
|
|
2384
|
-
}
|
|
2385
|
-
declare namespace ObligationResponse_d_exports {
|
|
2386
|
-
export { ObligationResponse, from$
|
|
2387
|
-
}
|
|
2388
|
-
type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
2389
|
-
/**
|
|
2390
|
-
* Creates an `ObligationResponse` from a `Obligation`.
|
|
2391
|
-
* @constructor
|
|
2392
|
-
* @param obligation - {@link Obligation}
|
|
2393
|
-
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
2394
|
-
*/
|
|
2395
|
-
declare function from$2(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
2396
|
-
declare namespace Gate_d_exports {
|
|
2397
|
-
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
2398
|
-
}
|
|
2399
|
-
/**
|
|
2400
|
-
* A validation rule.
|
|
2401
|
-
*/
|
|
2402
|
-
type Rule<T, Name$1 extends string = string> = {
|
|
2403
|
-
kind: "single";
|
|
2404
|
-
name: Name$1;
|
|
2405
|
-
description: string;
|
|
2406
|
-
run: Single<T, Name$1>;
|
|
2407
|
-
} | {
|
|
2408
|
-
kind: "batch";
|
|
2409
|
-
name: Name$1;
|
|
2410
|
-
description: string;
|
|
2411
|
-
run: Batch<T, Name$1>;
|
|
2412
|
-
};
|
|
2413
|
-
type RuleNames<Rules$1 extends readonly {
|
|
2414
|
-
name: string;
|
|
2415
|
-
}[]> = Rules$1[number]["name"];
|
|
2416
|
-
/**
|
|
2417
|
-
* A single item validation rule.
|
|
2418
|
-
* @param item - The item to validate.
|
|
2419
|
-
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
2420
|
-
*/
|
|
2421
|
-
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
2422
|
-
/**
|
|
2423
|
-
* A batch item validation rule.
|
|
2424
|
-
* @param items - The items to validate.
|
|
2425
|
-
* @returns A map of the items to the issue that was found.
|
|
2426
|
-
*/
|
|
2427
|
-
type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
|
|
2428
|
-
/**
|
|
2429
|
-
* Create a validation rule iterating over a single item at a time.
|
|
2430
|
-
* @param name - The name of the rule.
|
|
2431
|
-
* @param description - A human-readable description of the rule.
|
|
2432
|
-
* @param run - The function that validates the rule.
|
|
2433
|
-
* @returns The created rule.
|
|
2434
|
-
*/
|
|
2435
|
-
declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
|
|
2436
|
-
/**
|
|
2437
|
-
* Create a validation rule iterating over a batch of items at a time.
|
|
2438
|
-
* @param name - The name of the rule.
|
|
2439
|
-
* @param description - A human-readable description of the rule.
|
|
2440
|
-
* @param run - The function that validates the rule.
|
|
2441
|
-
* @returns The created rule.
|
|
2442
|
-
*/
|
|
2443
|
-
declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
|
|
2444
|
-
/**
|
|
2445
|
-
* A validation issue.
|
|
2446
|
-
*/
|
|
2447
|
-
type Issue<T, RuleName extends string = string> = {
|
|
2448
|
-
/** The name of the rule that caused the issue. */
|
|
2449
|
-
ruleName: RuleName;
|
|
2450
|
-
/** The message of the issue. */
|
|
2451
|
-
message: string;
|
|
2452
|
-
/** The item that was not valid. */
|
|
2453
|
-
item: T;
|
|
2454
|
-
};
|
|
2455
|
-
/**
|
|
2456
|
-
* The result of a validation.
|
|
2457
|
-
*/
|
|
2458
|
-
type Result<T, RuleName extends string = string> = {
|
|
2459
|
-
/** The items that were valid. */
|
|
2460
|
-
valid: T[];
|
|
2461
|
-
/** The reports of the failed validations. */
|
|
2462
|
-
issues: Issue<T, RuleName>[];
|
|
2463
|
-
};
|
|
2464
|
-
declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
|
|
2465
|
-
items: T[];
|
|
2466
|
-
rules: Rules$1;
|
|
2467
|
-
chunkSize?: number;
|
|
2468
|
-
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
2469
|
-
declare namespace Gatekeeper_d_exports {
|
|
2470
|
-
export { Gatekeeper, Rules, create };
|
|
2471
|
-
}
|
|
2472
|
-
type Rules = readonly Rule<Offer, string>[];
|
|
2473
|
-
type Gatekeeper = {
|
|
2474
|
-
rules: Rules;
|
|
2475
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2476
|
-
};
|
|
2477
|
-
type GatekeeperParameters = {
|
|
2478
|
-
rules: Rules;
|
|
2479
|
-
};
|
|
2480
|
-
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
2481
|
-
declare namespace GateConfig_d_exports {
|
|
2482
|
-
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
2483
|
-
}
|
|
2484
|
-
type GateConfig = {
|
|
2485
|
-
callbacks?: CallbackConfig[];
|
|
2486
|
-
maturities?: MaturityType[];
|
|
2487
|
-
};
|
|
2488
|
-
type CallbackConfig = {
|
|
2489
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
2490
|
-
addresses: Address[];
|
|
2491
|
-
vaultFactories: Address[];
|
|
2492
|
-
} | {
|
|
2493
|
-
type: CallbackType.SellERC20Callback;
|
|
2494
|
-
addresses: Address[];
|
|
2495
|
-
} | {
|
|
2496
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
2497
|
-
};
|
|
2498
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
2499
|
-
type: CallbackType.BuyVaultV1Callback;
|
|
2500
|
-
}> | undefined;
|
|
2501
|
-
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
2502
|
-
type: CallbackType.SellERC20Callback;
|
|
2503
|
-
}> | undefined;
|
|
2504
|
-
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
2505
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
2506
|
-
}> | undefined;
|
|
2507
|
-
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
2508
|
-
/**
|
|
2509
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
2510
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
2511
|
-
*
|
|
2512
|
-
* @param chain - Chain name for which to infer the callback type
|
|
2513
|
-
* @param address - Callback contract address
|
|
2514
|
-
* @returns The callback type when found, otherwise undefined
|
|
2515
|
-
*/
|
|
2516
|
-
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
2517
|
-
/**
|
|
2518
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
2519
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
2520
|
-
* @param type - Callback type to retrieve
|
|
2521
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
2522
|
-
*/
|
|
2523
|
-
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
2524
|
-
/**
|
|
2525
|
-
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
2526
|
-
*
|
|
2527
|
-
* @param chain - Chain name
|
|
2528
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
2529
|
-
*/
|
|
2530
|
-
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
2531
|
-
declare const assets$1: Record<string, Address[]>;
|
|
2532
|
-
declare const configs: Record<Name, GateConfig>;
|
|
2533
|
-
//#endregion
|
|
2534
|
-
//#region src/gatekeeper/morphoRules.d.ts
|
|
2535
|
-
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
2536
|
-
declare namespace Rules_d_exports {
|
|
2537
|
-
export { ValidityParameters, callback, chains, maturity, sameMaker, token, validity };
|
|
2538
|
-
}
|
|
2539
|
-
type ValidityParameters = {
|
|
2540
|
-
client: PublicClient<Transport, Chain$1>;
|
|
2541
|
-
};
|
|
2542
|
-
/**
|
|
2543
|
-
* set of rules to validate offers.
|
|
2544
|
-
*
|
|
2545
|
-
* @param parameters - Validity parameters with chain and client
|
|
2546
|
-
* @returns Array of validation rules to evaluate against offers
|
|
2547
|
-
*/
|
|
2548
|
-
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
2549
|
-
declare const chains: ({
|
|
2550
|
-
chains
|
|
2551
|
-
}: {
|
|
2552
|
-
chains: Chain$1[];
|
|
2553
|
-
}) => Rule<Offer, "chain_ids">;
|
|
2554
|
-
declare const maturity: ({
|
|
2555
|
-
maturities
|
|
2556
|
-
}: {
|
|
2557
|
-
maturities: MaturityType[];
|
|
2558
|
-
}) => Rule<Offer, "maturity">;
|
|
2559
|
-
declare const callback: ({
|
|
2560
|
-
callbacks,
|
|
2561
|
-
allowedAddresses
|
|
2562
|
-
}: {
|
|
2563
|
-
callbacks: CallbackType[];
|
|
2564
|
-
allowedAddresses: Address[];
|
|
2565
|
-
}) => Rule<Offer, "callback">;
|
|
2566
|
-
/**
|
|
2567
|
-
* A validation rule that checks if the offer's token is allowed.
|
|
2568
|
-
* @param offer - The offer to validate.
|
|
2569
|
-
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
2570
|
-
*/
|
|
2571
|
-
declare const token: ({
|
|
2572
|
-
assets
|
|
2573
|
-
}: {
|
|
2574
|
-
assets: Address[];
|
|
2575
|
-
}) => Rule<Offer, "token">;
|
|
2576
|
-
/**
|
|
2577
|
-
* A batch validation rule that ensures all offers in a tree have the same maker (offering address).
|
|
2578
|
-
* Returns an issue only for the first non-conforming offer.
|
|
2579
|
-
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
2580
|
-
*/
|
|
2581
|
-
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
2582
|
-
//#endregion
|
|
2583
|
-
//#region src/database/domains/Trees.d.ts
|
|
2754
|
+
};
|
|
2755
|
+
ValidationSuccessDataResponse: {
|
|
2756
|
+
/**
|
|
2757
|
+
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
2758
|
+
* @example 0x01789c...
|
|
2759
|
+
*/
|
|
2760
|
+
payload: string;
|
|
2761
|
+
/**
|
|
2762
|
+
* @description Merkle tree root to sign with EIP-191.
|
|
2763
|
+
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
2764
|
+
*/
|
|
2765
|
+
root: string;
|
|
2766
|
+
};
|
|
2767
|
+
};
|
|
2768
|
+
responses: never;
|
|
2769
|
+
parameters: never;
|
|
2770
|
+
requestBodies: never;
|
|
2771
|
+
headers: never;
|
|
2772
|
+
pathItems: never;
|
|
2773
|
+
}
|
|
2774
|
+
declare namespace ObligationResponse_d_exports {
|
|
2775
|
+
export { ObligationResponse, from$3 as from };
|
|
2776
|
+
}
|
|
2777
|
+
type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
2584
2778
|
/**
|
|
2585
|
-
*
|
|
2779
|
+
* Creates an `ObligationResponse` from a `Obligation`.
|
|
2780
|
+
* @constructor
|
|
2781
|
+
* @param obligation - {@link Obligation}
|
|
2782
|
+
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
2586
2783
|
*/
|
|
2587
|
-
|
|
2588
|
-
root: Hex;
|
|
2589
|
-
signature: Hex;
|
|
2590
|
-
proof: Hex[];
|
|
2591
|
-
};
|
|
2784
|
+
declare function from$3(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
2592
2785
|
declare namespace OfferResponse_d_exports {
|
|
2593
|
-
export { OfferResponse, from$
|
|
2786
|
+
export { Input, OfferResponse, from$2 as from };
|
|
2594
2787
|
}
|
|
2595
2788
|
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
2789
|
+
type Input = Readonly<{
|
|
2790
|
+
hash: Hex;
|
|
2791
|
+
maker: Address;
|
|
2792
|
+
assets: bigint;
|
|
2793
|
+
obligationUnits: bigint;
|
|
2794
|
+
obligationShares: bigint;
|
|
2795
|
+
price: bigint;
|
|
2796
|
+
maturity: number;
|
|
2797
|
+
expiry: number;
|
|
2798
|
+
start: number;
|
|
2799
|
+
group: Hex;
|
|
2800
|
+
session: Hex;
|
|
2801
|
+
buy: boolean;
|
|
2802
|
+
chainId: number;
|
|
2803
|
+
loanToken: Address;
|
|
2804
|
+
collaterals: Readonly<{
|
|
2805
|
+
asset: Address;
|
|
2806
|
+
lltv: bigint;
|
|
2807
|
+
oracle: Address;
|
|
2808
|
+
}[]>;
|
|
2809
|
+
callback: {
|
|
2810
|
+
address: Address;
|
|
2811
|
+
data: Hex;
|
|
2812
|
+
};
|
|
2813
|
+
root?: Hex | undefined;
|
|
2814
|
+
proof?: Hex[] | undefined;
|
|
2815
|
+
signature?: Hex | undefined;
|
|
2816
|
+
consumed: bigint;
|
|
2817
|
+
takeable: bigint;
|
|
2818
|
+
blockNumber: number;
|
|
2819
|
+
}>;
|
|
2596
2820
|
/**
|
|
2597
|
-
* Creates an `OfferResponse`
|
|
2821
|
+
* Creates an `OfferResponse` matching the Solidity Offer struct layout.
|
|
2598
2822
|
* @constructor
|
|
2599
|
-
* @param
|
|
2600
|
-
* @param attestation - {@link Attestation}
|
|
2823
|
+
* @param input - {@link Input}
|
|
2601
2824
|
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
2602
2825
|
*/
|
|
2603
|
-
declare function from$
|
|
2826
|
+
declare function from$2(input: Input): OfferResponse;
|
|
2604
2827
|
//#endregion
|
|
2605
2828
|
//#region src/api/Schema/openapi.d.ts
|
|
2606
2829
|
declare class BooksController {
|
|
@@ -2617,10 +2840,16 @@ declare class HealthController {
|
|
|
2617
2840
|
getCollectorsHealth(): Promise<void>;
|
|
2618
2841
|
getChainsHealth(): Promise<void>;
|
|
2619
2842
|
}
|
|
2843
|
+
declare class ConfigController {
|
|
2844
|
+
getConfig(): Promise<void>;
|
|
2845
|
+
}
|
|
2620
2846
|
declare class ObligationsController {
|
|
2621
2847
|
getObligations(): Promise<void>;
|
|
2622
2848
|
getObligation(): Promise<void>;
|
|
2623
2849
|
}
|
|
2850
|
+
declare class UsersController {
|
|
2851
|
+
getUserPositions(): Promise<void>;
|
|
2852
|
+
}
|
|
2624
2853
|
type RuleInfo = {
|
|
2625
2854
|
name: string;
|
|
2626
2855
|
description: string;
|
|
@@ -2630,20 +2859,91 @@ type OpenApiOptions = {
|
|
|
2630
2859
|
};
|
|
2631
2860
|
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
2632
2861
|
//#endregion
|
|
2862
|
+
//#region src/database/domains/Positions.d.ts
|
|
2863
|
+
type PaginationParams = {
|
|
2864
|
+
/** Cursor string returned by a previous call, for pagination */
|
|
2865
|
+
cursor?: string;
|
|
2866
|
+
/** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
2867
|
+
limit?: number;
|
|
2868
|
+
};
|
|
2869
|
+
declare namespace getByUser {
|
|
2870
|
+
type Parameters = PaginationParams & {
|
|
2871
|
+
/** The user address to get positions for. */
|
|
2872
|
+
user: Address;
|
|
2873
|
+
};
|
|
2874
|
+
type PositionWithReserved = {
|
|
2875
|
+
chainId: Id;
|
|
2876
|
+
contract: Address;
|
|
2877
|
+
user: Address;
|
|
2878
|
+
blockNumber: number;
|
|
2879
|
+
/** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
2880
|
+
reserved: bigint;
|
|
2881
|
+
};
|
|
2882
|
+
type ReturnType = {
|
|
2883
|
+
positions: PositionWithReserved[];
|
|
2884
|
+
nextCursor: string | null;
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
declare namespace PositionResponse_d_exports {
|
|
2888
|
+
export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
|
|
2889
|
+
}
|
|
2890
|
+
type PositionResponse = {
|
|
2891
|
+
chain_id: Id;
|
|
2892
|
+
contract: Address;
|
|
2893
|
+
user: Address;
|
|
2894
|
+
reserved: string;
|
|
2895
|
+
block_number: number;
|
|
2896
|
+
};
|
|
2897
|
+
type PositionWithReserved$1 = getByUser.PositionWithReserved;
|
|
2898
|
+
/**
|
|
2899
|
+
* Creates a `PositionResponse` from a `PositionWithReserved`.
|
|
2900
|
+
* @param position - {@link PositionWithReserved}
|
|
2901
|
+
* @returns The created `PositionResponse`. {@link PositionResponse}
|
|
2902
|
+
*/
|
|
2903
|
+
declare function from$1(position: PositionWithReserved$1): PositionResponse;
|
|
2904
|
+
//#endregion
|
|
2633
2905
|
//#region src/api/Schema/requests.d.ts
|
|
2634
2906
|
declare const schemas: {
|
|
2907
|
+
readonly get_health: z$1.ZodObject<{
|
|
2908
|
+
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
2909
|
+
0: "0";
|
|
2910
|
+
1: "1";
|
|
2911
|
+
true: "true";
|
|
2912
|
+
false: "false";
|
|
2913
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2914
|
+
}, z$1.core.$strip>;
|
|
2915
|
+
readonly get_health_collectors: z$1.ZodObject<{
|
|
2916
|
+
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
2917
|
+
0: "0";
|
|
2918
|
+
1: "1";
|
|
2919
|
+
true: "true";
|
|
2920
|
+
false: "false";
|
|
2921
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2922
|
+
}, z$1.core.$strip>;
|
|
2923
|
+
readonly get_health_chains: z$1.ZodObject<{
|
|
2924
|
+
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
2925
|
+
0: "0";
|
|
2926
|
+
1: "1";
|
|
2927
|
+
true: "true";
|
|
2928
|
+
false: "false";
|
|
2929
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
2930
|
+
}, z$1.core.$strip>;
|
|
2635
2931
|
readonly get_offers: z$1.ZodObject<{
|
|
2636
2932
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2637
2933
|
buy: "buy";
|
|
2638
2934
|
sell: "sell";
|
|
2639
2935
|
}>>;
|
|
2640
2936
|
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2641
|
-
|
|
2937
|
+
maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2642
2938
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2643
2939
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2644
2940
|
}, z$1.core.$strip>;
|
|
2645
2941
|
readonly get_obligations: z$1.ZodObject<{
|
|
2646
2942
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2943
|
+
chain: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
|
|
2944
|
+
loan_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2945
|
+
collateral_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2946
|
+
maturity: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
|
|
2647
2947
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2648
2948
|
}, z$1.core.$strip>;
|
|
2649
2949
|
readonly get_obligation: z$1.ZodObject<{
|
|
@@ -2661,12 +2961,17 @@ declare const schemas: {
|
|
|
2661
2961
|
readonly validate_offers: z$1.ZodObject<{
|
|
2662
2962
|
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2663
2963
|
}, z$1.core.$strict>;
|
|
2964
|
+
readonly get_user_positions: z$1.ZodObject<{
|
|
2965
|
+
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2966
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2967
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2968
|
+
}, z$1.core.$strip>;
|
|
2664
2969
|
};
|
|
2665
2970
|
type Action = keyof typeof schemas;
|
|
2666
2971
|
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2667
2972
|
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]>>;
|
|
2668
2973
|
declare namespace index_d_exports$1 {
|
|
2669
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, RouterStatusResponse, RuleInfo, ValidateController, parse, safeParse };
|
|
2974
|
+
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, RuleInfo, UsersController, ValidateController, parse, safeParse };
|
|
2670
2975
|
}
|
|
2671
2976
|
declare namespace Client_d_exports {
|
|
2672
2977
|
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
@@ -2748,10 +3053,17 @@ declare namespace getOffers {
|
|
|
2748
3053
|
};
|
|
2749
3054
|
type ReturnType = {
|
|
2750
3055
|
offers: Compute<Offer & {
|
|
3056
|
+
hash: Hex;
|
|
3057
|
+
blockNumber: number;
|
|
3058
|
+
consumed: bigint;
|
|
3059
|
+
takeable: bigint;
|
|
3060
|
+
} & {
|
|
2751
3061
|
/** 32-byte merkle root. */
|
|
2752
3062
|
root?: Hex;
|
|
2753
3063
|
/** Sibling hashes for the merkle proof. */
|
|
2754
3064
|
proof?: Hex[];
|
|
3065
|
+
/** Offer signature from the Merkle tree. */
|
|
3066
|
+
signature?: Hex;
|
|
2755
3067
|
}>[];
|
|
2756
3068
|
/** The pagination cursor. */
|
|
2757
3069
|
cursor: string | null;
|
|
@@ -2765,6 +3077,14 @@ declare namespace getObligations {
|
|
|
2765
3077
|
cursor?: Hex;
|
|
2766
3078
|
/** Maximum number of obligations to return. @default 20 */
|
|
2767
3079
|
limit?: number;
|
|
3080
|
+
/** Filter by chain ID. */
|
|
3081
|
+
chainId?: number;
|
|
3082
|
+
/** Filter by loan token address. */
|
|
3083
|
+
loanToken?: Address;
|
|
3084
|
+
/** Filter by collateral token (matches any collateral in the obligation). */
|
|
3085
|
+
collateralToken?: Address;
|
|
3086
|
+
/** Filter by exact maturity timestamp (unix seconds). */
|
|
3087
|
+
maturity?: number;
|
|
2768
3088
|
};
|
|
2769
3089
|
type ReturnType = {
|
|
2770
3090
|
obligations: Compute<{
|
|
@@ -2801,22 +3121,198 @@ declare class HttpGetApiFailedError extends BaseError {
|
|
|
2801
3121
|
details?: string;
|
|
2802
3122
|
});
|
|
2803
3123
|
}
|
|
2804
|
-
declare namespace
|
|
2805
|
-
export {
|
|
3124
|
+
declare namespace Gate_d_exports {
|
|
3125
|
+
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
2806
3126
|
}
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
3127
|
+
/**
|
|
3128
|
+
* A validation rule.
|
|
3129
|
+
*/
|
|
3130
|
+
type Rule<T, Name$1 extends string = string> = {
|
|
3131
|
+
kind: "single";
|
|
3132
|
+
name: Name$1;
|
|
3133
|
+
description: string;
|
|
3134
|
+
run: Single<T, Name$1>;
|
|
3135
|
+
} | {
|
|
3136
|
+
kind: "batch";
|
|
3137
|
+
name: Name$1;
|
|
3138
|
+
description: string;
|
|
3139
|
+
run: Batch<T, Name$1>;
|
|
3140
|
+
};
|
|
3141
|
+
type RuleNames<Rules$1 extends readonly {
|
|
3142
|
+
name: string;
|
|
3143
|
+
}[]> = Rules$1[number]["name"];
|
|
3144
|
+
/**
|
|
3145
|
+
* A single item validation rule.
|
|
3146
|
+
* @param item - The item to validate.
|
|
3147
|
+
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
3148
|
+
*/
|
|
3149
|
+
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
3150
|
+
/**
|
|
3151
|
+
* A batch item validation rule.
|
|
3152
|
+
* @param items - The items to validate.
|
|
3153
|
+
* @returns A map of the items to the issue that was found.
|
|
3154
|
+
*/
|
|
3155
|
+
type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
|
|
3156
|
+
/**
|
|
3157
|
+
* Create a validation rule iterating over a single item at a time.
|
|
3158
|
+
* @param name - The name of the rule.
|
|
3159
|
+
* @param description - A human-readable description of the rule.
|
|
3160
|
+
* @param run - The function that validates the rule.
|
|
3161
|
+
* @returns The created rule.
|
|
3162
|
+
*/
|
|
3163
|
+
declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
|
|
3164
|
+
/**
|
|
3165
|
+
* Create a validation rule iterating over a batch of items at a time.
|
|
3166
|
+
* @param name - The name of the rule.
|
|
3167
|
+
* @param description - A human-readable description of the rule.
|
|
3168
|
+
* @param run - The function that validates the rule.
|
|
3169
|
+
* @returns The created rule.
|
|
3170
|
+
*/
|
|
3171
|
+
declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
|
|
3172
|
+
/**
|
|
3173
|
+
* A validation issue.
|
|
3174
|
+
*/
|
|
3175
|
+
type Issue<T, RuleName extends string = string> = {
|
|
3176
|
+
/** The name of the rule that caused the issue. */
|
|
3177
|
+
ruleName: RuleName;
|
|
3178
|
+
/** The message of the issue. */
|
|
3179
|
+
message: string;
|
|
3180
|
+
/** The item that was not valid. */
|
|
3181
|
+
item: T;
|
|
3182
|
+
};
|
|
3183
|
+
/**
|
|
3184
|
+
* The result of a validation.
|
|
3185
|
+
*/
|
|
3186
|
+
type Result<T, RuleName extends string = string> = {
|
|
3187
|
+
/** The items that were valid. */
|
|
3188
|
+
valid: T[];
|
|
3189
|
+
/** The reports of the failed validations. */
|
|
3190
|
+
issues: Issue<T, RuleName>[];
|
|
3191
|
+
};
|
|
3192
|
+
declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
|
|
3193
|
+
items: T[];
|
|
3194
|
+
rules: Rules$1;
|
|
3195
|
+
chunkSize?: number;
|
|
3196
|
+
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
3197
|
+
declare namespace GateConfig_d_exports {
|
|
3198
|
+
export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
3199
|
+
}
|
|
3200
|
+
type GateConfig = {
|
|
3201
|
+
callbacks?: CallbackConfig[];
|
|
3202
|
+
maturities?: MaturityType[];
|
|
3203
|
+
};
|
|
3204
|
+
type CallbackConfig = {
|
|
3205
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
3206
|
+
addresses: Address[];
|
|
3207
|
+
vaultFactories: Address[];
|
|
3208
|
+
} | {
|
|
3209
|
+
type: CallbackType.SellERC20Callback;
|
|
3210
|
+
addresses: Address[];
|
|
3211
|
+
} | {
|
|
3212
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
3213
|
+
};
|
|
3214
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
3215
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
3216
|
+
}> | undefined;
|
|
3217
|
+
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
3218
|
+
type: CallbackType.SellERC20Callback;
|
|
3219
|
+
}> | undefined;
|
|
3220
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
3221
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
3222
|
+
}> | undefined;
|
|
3223
|
+
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
3224
|
+
/**
|
|
3225
|
+
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
3226
|
+
* Skips the empty callback type as it does not carry addresses.
|
|
3227
|
+
*
|
|
3228
|
+
* @param chain - Chain name for which to infer the callback type
|
|
3229
|
+
* @param address - Callback contract address
|
|
3230
|
+
* @returns The callback type when found, otherwise undefined
|
|
3231
|
+
*/
|
|
3232
|
+
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
3233
|
+
/**
|
|
3234
|
+
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
3235
|
+
* @param chain - Chain name for which to read the validation configuration
|
|
3236
|
+
* @param type - Callback type to retrieve
|
|
3237
|
+
* @returns The matching callback addresses or an empty array if not configured
|
|
3238
|
+
*/
|
|
3239
|
+
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
3240
|
+
/**
|
|
3241
|
+
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
3242
|
+
*
|
|
3243
|
+
* @param chain - Chain name
|
|
3244
|
+
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
3245
|
+
*/
|
|
3246
|
+
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
3247
|
+
declare const assets: Record<string, Address[]>;
|
|
3248
|
+
declare const configs: Record<Name, GateConfig>;
|
|
3249
|
+
declare namespace Gatekeeper_d_exports {
|
|
3250
|
+
export { Gatekeeper, Rules, create };
|
|
3251
|
+
}
|
|
3252
|
+
type Rules = readonly Rule<Offer, string>[];
|
|
3253
|
+
type Gatekeeper = {
|
|
3254
|
+
rules: Rules;
|
|
3255
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
3256
|
+
};
|
|
3257
|
+
type GatekeeperParameters = {
|
|
3258
|
+
rules: Rules;
|
|
3259
|
+
};
|
|
3260
|
+
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
3261
|
+
//#endregion
|
|
3262
|
+
//#region src/gatekeeper/morphoRules.d.ts
|
|
3263
|
+
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">)[];
|
|
3264
|
+
declare namespace Rules_d_exports {
|
|
3265
|
+
export { ValidityParameters, amountMutualExclusivity, callback, chains, maturity, sameMaker, token, validity };
|
|
3266
|
+
}
|
|
3267
|
+
type ValidityParameters = {
|
|
3268
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2816
3269
|
};
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
3270
|
+
/**
|
|
3271
|
+
* set of rules to validate offers.
|
|
3272
|
+
*
|
|
3273
|
+
* @param parameters - Validity parameters with chain and client
|
|
3274
|
+
* @returns Array of validation rules to evaluate against offers
|
|
3275
|
+
*/
|
|
3276
|
+
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
3277
|
+
declare const chains: ({
|
|
3278
|
+
chains
|
|
3279
|
+
}: {
|
|
3280
|
+
chains: Chain$1[];
|
|
3281
|
+
}) => Rule<Offer, "chain_ids">;
|
|
3282
|
+
declare const maturity: ({
|
|
3283
|
+
maturities
|
|
3284
|
+
}: {
|
|
3285
|
+
maturities: MaturityType[];
|
|
3286
|
+
}) => Rule<Offer, "maturity">;
|
|
3287
|
+
declare const callback: ({
|
|
3288
|
+
callbacks,
|
|
3289
|
+
allowedAddresses
|
|
3290
|
+
}: {
|
|
3291
|
+
callbacks: CallbackType[];
|
|
3292
|
+
allowedAddresses: Address[];
|
|
3293
|
+
}) => Rule<Offer, "callback">;
|
|
3294
|
+
/**
|
|
3295
|
+
* A validation rule that checks if the offer's tokens are allowed for its chain.
|
|
3296
|
+
* @param assetsByChainId - Allowed assets indexed by chain id.
|
|
3297
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
3298
|
+
*/
|
|
3299
|
+
declare const token: ({
|
|
3300
|
+
assetsByChainId
|
|
3301
|
+
}: {
|
|
3302
|
+
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
3303
|
+
}) => Rule<Offer, "token">;
|
|
3304
|
+
/**
|
|
3305
|
+
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
3306
|
+
* Returns an issue only for the first non-conforming offer.
|
|
3307
|
+
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
3308
|
+
*/
|
|
3309
|
+
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
3310
|
+
/**
|
|
3311
|
+
* A validation rule that ensures mutual exclusivity of offer amount fields.
|
|
3312
|
+
* At most one of (assets, obligationUnits, obligationShares) can be non-zero.
|
|
3313
|
+
* Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
|
|
3314
|
+
*/
|
|
3315
|
+
declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
|
|
2820
3316
|
//#endregion
|
|
2821
3317
|
//#region src/mempool/MempoolEVMClient.d.ts
|
|
2822
3318
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
@@ -2835,7 +3331,7 @@ declare namespace from {
|
|
|
2835
3331
|
declare namespace MempoolClient_d_exports {
|
|
2836
3332
|
export { AddParameters, Client$1 as Client, GetParameters, connect };
|
|
2837
3333
|
}
|
|
2838
|
-
type AddParameters = Compute<Omit<Offer, "
|
|
3334
|
+
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
2839
3335
|
type GetParameters = {
|
|
2840
3336
|
/** The block number to get offers from. */
|
|
2841
3337
|
blockNumberGte?: number;
|
|
@@ -2890,6 +3386,12 @@ declare namespace connect {
|
|
|
2890
3386
|
//#region src/utils/BigMath.d.ts
|
|
2891
3387
|
declare function max$1(a: bigint, b: bigint): bigint;
|
|
2892
3388
|
declare function min(a: bigint, b: bigint): bigint;
|
|
3389
|
+
/**
|
|
3390
|
+
* Checks if at most one of the given values is non-zero.
|
|
3391
|
+
* @param values - The bigint values to check.
|
|
3392
|
+
* @returns True if zero or one value is non-zero, false if two or more are non-zero.
|
|
3393
|
+
*/
|
|
3394
|
+
declare function atMostOneNonZero(...values: bigint[]): boolean;
|
|
2893
3395
|
//#endregion
|
|
2894
3396
|
//#region src/utils/batch.d.ts
|
|
2895
3397
|
/**
|
|
@@ -2927,6 +3429,15 @@ declare function batchMulticall<TResult>(parameters: {
|
|
|
2927
3429
|
retryDelayMs: number;
|
|
2928
3430
|
blockNumber?: bigint;
|
|
2929
3431
|
}): Promise<TResult[]>;
|
|
3432
|
+
declare namespace Group_d_exports {
|
|
3433
|
+
export { fromNumber };
|
|
3434
|
+
}
|
|
3435
|
+
/**
|
|
3436
|
+
* Creates a bytes32 group identifier from a number.
|
|
3437
|
+
* @param n - A non-negative integer.
|
|
3438
|
+
* @throws {Error} If n is negative or not an integer.
|
|
3439
|
+
*/
|
|
3440
|
+
declare const fromNumber: (n: number) => Hex;
|
|
2930
3441
|
//#endregion
|
|
2931
3442
|
//#region src/utils/lazy.d.ts
|
|
2932
3443
|
/**
|
|
@@ -3001,8 +3512,8 @@ declare function max(): number;
|
|
|
3001
3512
|
//#region src/utils/wait.d.ts
|
|
3002
3513
|
declare function wait(time: number): Promise<unknown>;
|
|
3003
3514
|
declare namespace index_d_exports$2 {
|
|
3004
|
-
export { BaseError, GlobalErrorType, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
3515
|
+
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 };
|
|
3005
3516
|
}
|
|
3006
3517
|
//#endregion
|
|
3007
|
-
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, Collateral_d_exports as Collateral, Compute,
|
|
3518
|
+
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, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, 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 as RouterClient, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, Gate_d_exports as Validation, morphoRules };
|
|
3008
3519
|
//# sourceMappingURL=index.browser.d.mts.map
|