@morpho-dev/router 0.2.1 → 0.4.0
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 +4224 -1627
- package/dist/drizzle/migrations/0015_add-lots-table.sql +12 -0
- package/dist/drizzle/migrations/0016_merkle-metadata.sql +26 -0
- 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/0015_snapshot.json +1365 -0
- package/dist/drizzle/migrations/meta/0016_snapshot.json +1531 -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 +56 -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 +1376 -651
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.d.ts +1375 -654
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2398 -1526
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +2394 -1522
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +2372 -1039
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.d.ts +2372 -1039
- package/dist/index.node.d.ts.map +1 -1
- package/dist/index.node.js +3094 -1399
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +3075 -1399
- package/dist/index.node.mjs.map +1 -1
- package/docs/integrator.md +78 -0
- package/package.json +11 -6
package/dist/index.node.d.ts
CHANGED
|
@@ -275,7 +275,7 @@ declare const Morpho: readonly [{
|
|
|
275
275
|
readonly stateMutability: "view";
|
|
276
276
|
}];
|
|
277
277
|
declare namespace Callback_d_exports {
|
|
278
|
-
export { CallbackType, decode$
|
|
278
|
+
export { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, decode$2 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$2 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
279
279
|
}
|
|
280
280
|
declare enum CallbackType {
|
|
281
281
|
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
@@ -283,11 +283,20 @@ declare enum CallbackType {
|
|
|
283
283
|
SellERC20Callback = "sell_erc20_callback",
|
|
284
284
|
}
|
|
285
285
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
286
|
-
declare function decode$
|
|
286
|
+
declare function decode$2(type: CallbackType, data: Hex): {
|
|
287
287
|
contract: Address;
|
|
288
288
|
amount: bigint;
|
|
289
289
|
}[];
|
|
290
|
-
|
|
290
|
+
type BuyVaultV1CallbackData = {
|
|
291
|
+
vaults: Address[];
|
|
292
|
+
amounts: bigint[];
|
|
293
|
+
};
|
|
294
|
+
type SellERC20CallbackData = {
|
|
295
|
+
collaterals: Address[];
|
|
296
|
+
amounts: bigint[];
|
|
297
|
+
};
|
|
298
|
+
declare function encode$2(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
299
|
+
declare function encode$2(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
291
300
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
292
301
|
contract: Address;
|
|
293
302
|
amount: bigint;
|
|
@@ -339,7 +348,7 @@ declare class ReorgError extends BaseError {
|
|
|
339
348
|
declare namespace Chain_d_exports {
|
|
340
349
|
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name$1 as Name, chainIds, chainNames, chains$2 as chains, getChain, getWhitelistedChains, streamLogs };
|
|
341
350
|
}
|
|
342
|
-
type Chain$1 = Compute<Chain<ChainFormatters, {
|
|
351
|
+
type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
343
352
|
morpho: ChainContract;
|
|
344
353
|
morphoBlue: ChainContract;
|
|
345
354
|
mempool: ChainContract;
|
|
@@ -349,9 +358,20 @@ type Chain$1 = Compute<Chain<ChainFormatters, {
|
|
|
349
358
|
v1_1: ChainContract;
|
|
350
359
|
};
|
|
351
360
|
};
|
|
352
|
-
}> & {
|
|
361
|
+
}>, "custom"> & {
|
|
353
362
|
id: Id;
|
|
354
363
|
name: Name$1;
|
|
364
|
+
custom: {
|
|
365
|
+
morpho: ChainContract;
|
|
366
|
+
morphoBlue: ChainContract;
|
|
367
|
+
mempool: ChainContract;
|
|
368
|
+
vaults: {
|
|
369
|
+
factories: {
|
|
370
|
+
v1_0: ChainContract;
|
|
371
|
+
v1_1: ChainContract;
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
};
|
|
355
375
|
}>;
|
|
356
376
|
declare const ChainId: {
|
|
357
377
|
readonly ETHEREUM: 1;
|
|
@@ -397,6 +417,14 @@ declare class MissingBlockNumberError extends BaseError {
|
|
|
397
417
|
name: string;
|
|
398
418
|
constructor();
|
|
399
419
|
}
|
|
420
|
+
declare namespace ChainRegistry_d_exports {
|
|
421
|
+
export { ChainRegistry, create$6 as create };
|
|
422
|
+
}
|
|
423
|
+
type ChainRegistry = {
|
|
424
|
+
getById: (chainId: Id) => Chain$1 | undefined;
|
|
425
|
+
list: () => Chain$1[];
|
|
426
|
+
};
|
|
427
|
+
declare function create$6(chains: Chain$1[]): ChainRegistry;
|
|
400
428
|
//#endregion
|
|
401
429
|
//#region src/core/types.d.ts
|
|
402
430
|
/** Combines members of an intersection into a readable type. */
|
|
@@ -406,7 +434,7 @@ type Brand<in out ID extends string | symbol> = {
|
|
|
406
434
|
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
407
435
|
};
|
|
408
436
|
declare namespace LLTV_d_exports {
|
|
409
|
-
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$
|
|
437
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$16 as from };
|
|
410
438
|
}
|
|
411
439
|
type LLTV = bigint & Brand<"LLTV">;
|
|
412
440
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
@@ -416,8 +444,8 @@ type Options = (typeof Options)[number];
|
|
|
416
444
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
417
445
|
* @returns The LLTV.
|
|
418
446
|
*/
|
|
419
|
-
declare function from$
|
|
420
|
-
declare namespace from$
|
|
447
|
+
declare function from$16(lltv: Options | bigint): LLTV;
|
|
448
|
+
declare namespace from$16 {
|
|
421
449
|
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
422
450
|
}
|
|
423
451
|
declare class InvalidOptionError$1 extends BaseError {
|
|
@@ -430,7 +458,7 @@ declare class InvalidLLTVError extends BaseError {
|
|
|
430
458
|
}
|
|
431
459
|
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
432
460
|
declare namespace Collateral_d_exports {
|
|
433
|
-
export { Collateral, CollateralSchema, CollateralsSchema, from$
|
|
461
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$15 as from, random$3 as random };
|
|
434
462
|
}
|
|
435
463
|
type Collateral = {
|
|
436
464
|
/** Asset being used as collateral. */
|
|
@@ -450,8 +478,8 @@ declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
|
450
478
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
451
479
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
452
480
|
}, z$1.core.$strip>>;
|
|
453
|
-
declare const from$
|
|
454
|
-
declare namespace from$
|
|
481
|
+
declare const from$15: (parameters: from$15.Parameters) => from$15.ReturnType;
|
|
482
|
+
declare namespace from$15 {
|
|
455
483
|
type Parameters = {
|
|
456
484
|
asset: Address;
|
|
457
485
|
lltv: Options | bigint;
|
|
@@ -560,35 +588,127 @@ declare class DenominatorIsZeroError extends BaseError {
|
|
|
560
588
|
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
561
589
|
constructor();
|
|
562
590
|
}
|
|
563
|
-
declare namespace
|
|
564
|
-
export {
|
|
591
|
+
declare namespace Liquidity_d_exports {
|
|
592
|
+
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
565
593
|
}
|
|
566
|
-
/** The snake case representation of a type with bigint values stringified. */
|
|
567
|
-
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
568
|
-
/** Make arrays/tuples and object props mutable, deeply. */
|
|
569
|
-
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;
|
|
570
|
-
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
571
|
-
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;
|
|
572
|
-
/** Key remapping that also preserves branded primitives. */
|
|
573
|
-
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;
|
|
574
|
-
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;
|
|
575
594
|
/**
|
|
576
|
-
*
|
|
577
|
-
* Preserves ethereum addresses as is.
|
|
578
|
-
* Converts ethereum addresses to checksummed if used as values.
|
|
579
|
-
* Stringifies bigint values to strings.
|
|
595
|
+
* Represents a liquidity pool with a unique ID and amount.
|
|
580
596
|
*/
|
|
581
|
-
|
|
597
|
+
type LiquidityPool = {
|
|
598
|
+
id: string;
|
|
599
|
+
amount: bigint;
|
|
600
|
+
};
|
|
582
601
|
/**
|
|
583
|
-
*
|
|
584
|
-
* Preserves ethereum addresses as is.
|
|
585
|
-
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
586
|
-
* @warning Does not unstringify bigint values.
|
|
602
|
+
* Represents a hierarchical relationship between two liquidity pools.
|
|
587
603
|
*/
|
|
588
|
-
|
|
589
|
-
|
|
604
|
+
type LiquidityLink = {
|
|
605
|
+
parentPoolId: string;
|
|
606
|
+
childPoolId: string;
|
|
607
|
+
priority: number;
|
|
608
|
+
};
|
|
609
|
+
/**
|
|
610
|
+
* Represents the connection between an offer and its liquidity pools.
|
|
611
|
+
*/
|
|
612
|
+
type OfferLiquidityPool = {
|
|
613
|
+
offerHash: Hex;
|
|
614
|
+
poolId: string;
|
|
615
|
+
/**
|
|
616
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
617
|
+
* Meaning varies by pool type:
|
|
618
|
+
* - BuyWithEmptyCallback: Matches allowance amount from pool bellow
|
|
619
|
+
* - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
|
|
620
|
+
* - SellERC20Callback: Existing debt as negative value (reduces available capacity)
|
|
621
|
+
*/
|
|
622
|
+
amount: bigint;
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* Calculate maximum debt capacity from collateral amount.
|
|
626
|
+
* @param amount - Collateral amount
|
|
627
|
+
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
628
|
+
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
629
|
+
* @returns Maximum debt capacity
|
|
630
|
+
*/
|
|
631
|
+
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
632
|
+
/**
|
|
633
|
+
* Generate pool ID for balance pools.
|
|
634
|
+
*/
|
|
635
|
+
declare function generateBalancePoolId(parameters: {
|
|
636
|
+
user: Address;
|
|
637
|
+
chainId: Id;
|
|
638
|
+
token: Address;
|
|
639
|
+
}): string;
|
|
640
|
+
/**
|
|
641
|
+
* Generate pool ID for allowance pools.
|
|
642
|
+
*/
|
|
643
|
+
declare function generateAllowancePoolId(parameters: {
|
|
644
|
+
user: Address;
|
|
645
|
+
chainId: Id;
|
|
646
|
+
token: Address;
|
|
647
|
+
}): string;
|
|
648
|
+
/**
|
|
649
|
+
* Generate pool ID for sell ERC20 callback pools.
|
|
650
|
+
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
651
|
+
*/
|
|
652
|
+
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
653
|
+
user: Address;
|
|
654
|
+
chainId: Id;
|
|
655
|
+
obligationId: Hex;
|
|
656
|
+
token: Address;
|
|
657
|
+
offerHash: Hex;
|
|
658
|
+
}): string;
|
|
659
|
+
/**
|
|
660
|
+
* Generate pool ID for obligation collateral pools.
|
|
661
|
+
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
662
|
+
* These pools are shared across all offers with the same obligation.
|
|
663
|
+
*/
|
|
664
|
+
declare function generateObligationCollateralPoolId(parameters: {
|
|
665
|
+
user: Address;
|
|
666
|
+
chainId: Id;
|
|
667
|
+
obligationId: Hex;
|
|
668
|
+
token: Address;
|
|
669
|
+
}): string;
|
|
670
|
+
/**
|
|
671
|
+
* Generate pool ID for buy vault callback pools.
|
|
672
|
+
*/
|
|
673
|
+
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
674
|
+
user: Address;
|
|
675
|
+
chainId: Id;
|
|
676
|
+
vault: Address;
|
|
677
|
+
offerHash: Hex;
|
|
678
|
+
}): string;
|
|
679
|
+
/**
|
|
680
|
+
* Generate pool ID for debt pools.
|
|
681
|
+
*/
|
|
682
|
+
declare function generateDebtPoolId(parameters: {
|
|
683
|
+
user: Address;
|
|
684
|
+
chainId: Id;
|
|
685
|
+
obligationId: Hex;
|
|
686
|
+
}): string;
|
|
687
|
+
/**
|
|
688
|
+
* Generate pool ID for user position in a vault.
|
|
689
|
+
*/
|
|
690
|
+
declare function generateUserVaultPositionPoolId(parameters: {
|
|
691
|
+
user: Address;
|
|
692
|
+
chainId: Id;
|
|
693
|
+
vault: Address;
|
|
694
|
+
}): string;
|
|
695
|
+
/**
|
|
696
|
+
* Generate pool ID for vault position in a market.
|
|
697
|
+
*/
|
|
698
|
+
declare function generateVaultPositionPoolId(parameters: {
|
|
699
|
+
vault: Address;
|
|
700
|
+
chainId: Id;
|
|
701
|
+
marketId: string;
|
|
702
|
+
}): string;
|
|
703
|
+
/**
|
|
704
|
+
* Generate pool ID for market total liquidity.
|
|
705
|
+
*/
|
|
706
|
+
declare function generateMarketLiquidityPoolId(parameters: {
|
|
707
|
+
chainId: Id;
|
|
708
|
+
marketId: string;
|
|
709
|
+
}): string;
|
|
590
710
|
declare namespace Maturity_d_exports {
|
|
591
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$
|
|
711
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$14 as from };
|
|
592
712
|
}
|
|
593
713
|
/**
|
|
594
714
|
* Maturity is a number that represents a date in seconds.
|
|
@@ -618,8 +738,8 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
618
738
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
619
739
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
620
740
|
*/
|
|
621
|
-
declare function from$
|
|
622
|
-
declare namespace from$
|
|
741
|
+
declare function from$14(ts: from$14.Parameters): Maturity;
|
|
742
|
+
declare namespace from$14 {
|
|
623
743
|
type Parameters = number | MaturityOptions;
|
|
624
744
|
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
625
745
|
}
|
|
@@ -635,72 +755,47 @@ declare class InvalidOptionError extends BaseError {
|
|
|
635
755
|
readonly name = "Maturity.InvalidOptionError";
|
|
636
756
|
constructor(input: string);
|
|
637
757
|
}
|
|
638
|
-
declare namespace
|
|
639
|
-
export {
|
|
758
|
+
declare namespace Format_d_exports {
|
|
759
|
+
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
640
760
|
}
|
|
641
|
-
type
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
668
|
-
readonly collaterals: readonly Collateral[];
|
|
669
|
-
/** The optional callback data to retrieve the maker funds. */
|
|
670
|
-
readonly callback: {
|
|
671
|
-
readonly address: Address;
|
|
672
|
-
readonly data: Hex;
|
|
673
|
-
readonly gasLimit: bigint;
|
|
674
|
-
};
|
|
675
|
-
/** The amount of assets consumed from the offer. */
|
|
676
|
-
consumed: bigint;
|
|
677
|
-
/** The hash of the offer. */
|
|
678
|
-
readonly hash: Hex;
|
|
679
|
-
/** The block number at which the offer was created. */
|
|
680
|
-
readonly blockNumber: number;
|
|
681
|
-
/** The signature of the offer. */
|
|
682
|
-
signature?: Hex;
|
|
683
|
-
};
|
|
684
|
-
declare enum Status {
|
|
685
|
-
VALID = "VALID",
|
|
686
|
-
SIMULATION_ERROR = "SIMULATION_ERROR",
|
|
761
|
+
/** The snake case representation of a type with bigint values stringified. */
|
|
762
|
+
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
763
|
+
/** Make arrays/tuples and object props mutable, deeply. */
|
|
764
|
+
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;
|
|
765
|
+
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
766
|
+
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;
|
|
767
|
+
/** Key remapping that also preserves branded primitives. */
|
|
768
|
+
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;
|
|
769
|
+
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;
|
|
770
|
+
/**
|
|
771
|
+
* Formats object keys to snake case.
|
|
772
|
+
* Preserves ethereum addresses as is.
|
|
773
|
+
* Converts ethereum addresses to checksummed if used as values.
|
|
774
|
+
* Stringifies bigint values to strings.
|
|
775
|
+
*/
|
|
776
|
+
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
777
|
+
/**
|
|
778
|
+
* Formats a snake case object to its camel case type.
|
|
779
|
+
* Preserves ethereum addresses as is.
|
|
780
|
+
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
781
|
+
* @warning Does not unstringify bigint values.
|
|
782
|
+
*/
|
|
783
|
+
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
784
|
+
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
785
|
+
declare namespace Obligation_d_exports {
|
|
786
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$13 as from, fromSnakeCase$2 as fromSnakeCase, id, random$2 as random };
|
|
687
787
|
}
|
|
688
|
-
type
|
|
689
|
-
|
|
690
|
-
|
|
788
|
+
type Obligation = {
|
|
789
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
790
|
+
chainId: Id;
|
|
791
|
+
/** The token that is being borrowed for this obligation. */
|
|
792
|
+
loanToken: Address;
|
|
793
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
794
|
+
collaterals: Collateral[];
|
|
795
|
+
/** The maturity of the obligation. */
|
|
796
|
+
maturity: Maturity;
|
|
691
797
|
};
|
|
692
|
-
declare const
|
|
693
|
-
declare const OfferSchema: (parameters?: {
|
|
694
|
-
omitHash?: boolean;
|
|
695
|
-
}) => z$1.ZodObject<{
|
|
696
|
-
offering: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
697
|
-
assets: z$1.ZodBigInt;
|
|
698
|
-
rate: z$1.ZodBigInt;
|
|
699
|
-
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
700
|
-
expiry: z$1.ZodNumber;
|
|
701
|
-
start: z$1.ZodNumber;
|
|
702
|
-
nonce: z$1.ZodBigInt;
|
|
703
|
-
buy: z$1.ZodBoolean;
|
|
798
|
+
declare const ObligationSchema: z$1.ZodObject<{
|
|
704
799
|
chainId: z$1.ZodNumber;
|
|
705
800
|
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
706
801
|
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
@@ -708,43 +803,259 @@ declare const OfferSchema: (parameters?: {
|
|
|
708
803
|
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
709
804
|
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
710
805
|
}, z$1.core.$strip>>;
|
|
711
|
-
|
|
712
|
-
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
713
|
-
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
714
|
-
gasLimit: z$1.ZodBigInt;
|
|
715
|
-
}, z$1.core.$strip>;
|
|
716
|
-
signature: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
717
|
-
consumed: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
718
|
-
takeable: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
719
|
-
blockNumber: z$1.ZodOptional<z$1.ZodNumber>;
|
|
806
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
720
807
|
}, z$1.core.$strip>;
|
|
721
808
|
/**
|
|
722
|
-
* Creates an
|
|
723
|
-
* @
|
|
724
|
-
* @param
|
|
725
|
-
* @returns The created
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
*
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
809
|
+
* Creates an obligation from the given parameters.
|
|
810
|
+
* @constructor
|
|
811
|
+
* @param parameters - {@link from.Parameters}
|
|
812
|
+
* @returns The created obligation. {@link Obligation}
|
|
813
|
+
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
814
|
+
*
|
|
815
|
+
* @example
|
|
816
|
+
* ```ts
|
|
817
|
+
* const obligation = Obligation.from({
|
|
818
|
+
* chainId: 1,
|
|
819
|
+
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
820
|
+
* collaterals: [
|
|
821
|
+
* Collateral.from({
|
|
822
|
+
* asset: privateKeyToAccount(generatePrivateKey()).address,
|
|
823
|
+
* oracle: privateKeyToAccount(generatePrivateKey()).address,
|
|
824
|
+
* lltv: 0.965
|
|
825
|
+
* }),
|
|
826
|
+
* ],
|
|
827
|
+
* maturity: Maturity.from("end_of_next_quarter"),
|
|
828
|
+
* });
|
|
829
|
+
* ```
|
|
830
|
+
*/
|
|
831
|
+
declare function from$13(parameters: from$13.Parameters): from$13.ReturnType;
|
|
832
|
+
declare namespace from$13 {
|
|
833
|
+
type Parameters = {
|
|
834
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
835
|
+
chainId: number;
|
|
836
|
+
/** The token that is being borrowed for this obligation. */
|
|
837
|
+
loanToken: Address;
|
|
838
|
+
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
839
|
+
collaterals: from$15.Parameters[] | readonly from$15.Parameters[];
|
|
840
|
+
/** The maturity of the obligation. */
|
|
841
|
+
maturity: from$14.Parameters;
|
|
842
|
+
};
|
|
843
|
+
type ReturnType = Obligation;
|
|
844
|
+
type ErrorType = InvalidObligationError;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Creates an obligation from a snake case object.
|
|
848
|
+
* @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
|
|
849
|
+
* @param input - {@link fromSnakeCase.Parameters}
|
|
850
|
+
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
851
|
+
*/
|
|
852
|
+
declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
|
|
853
|
+
declare namespace fromSnakeCase$2 {
|
|
854
|
+
type Parameters = Snake<Omit<Obligation, "chainId"> & {
|
|
855
|
+
chainId: number;
|
|
856
|
+
}>;
|
|
857
|
+
type ReturnType = Obligation;
|
|
858
|
+
type ErrorType = InvalidObligationError;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
862
|
+
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
|
|
863
|
+
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
864
|
+
* @param parameters - {@link id.Parameters}
|
|
865
|
+
* @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
|
|
866
|
+
*
|
|
867
|
+
* @example
|
|
868
|
+
* ```ts
|
|
869
|
+
* const obligation = Obligation.random();
|
|
870
|
+
* const id = Obligation.id(obligation);
|
|
871
|
+
* console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
872
|
+
* ```
|
|
873
|
+
*/
|
|
874
|
+
declare function id(parameters: id.Parameters): id.ReturnType;
|
|
875
|
+
declare namespace id {
|
|
876
|
+
type Parameters = {
|
|
877
|
+
chainId: number;
|
|
878
|
+
loanToken: Address;
|
|
879
|
+
collaterals: {
|
|
880
|
+
asset: Address;
|
|
881
|
+
lltv: bigint;
|
|
882
|
+
oracle: Address;
|
|
883
|
+
}[];
|
|
884
|
+
maturity: number;
|
|
885
|
+
};
|
|
886
|
+
type ReturnType = Hex;
|
|
887
|
+
type ErrorType = CollateralsAreNotSortedError;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Generates a random obligation.
|
|
891
|
+
* @returns A randomly generated obligation. {@link random.ReturnType}
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```ts
|
|
895
|
+
* const obligation = Obligation.random();
|
|
896
|
+
* ```
|
|
897
|
+
*/
|
|
898
|
+
declare function random$2(): random$2.ReturnType;
|
|
899
|
+
declare namespace random$2 {
|
|
900
|
+
type ReturnType = Obligation;
|
|
901
|
+
}
|
|
902
|
+
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
903
|
+
readonly name = "Obligation.InvalidObligationError";
|
|
904
|
+
constructor(error: z$1.ZodError | Error);
|
|
905
|
+
}
|
|
906
|
+
declare class CollateralsAreNotSortedError extends BaseError {
|
|
907
|
+
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
908
|
+
constructor();
|
|
909
|
+
}
|
|
910
|
+
declare namespace Offer_d_exports {
|
|
911
|
+
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, domain, encode$1 as encode, from$12 as from, fromSnakeCase$1 as fromSnakeCase, hash, obligationId, random$1 as random, serialize, sign, signatureMsg, toSnakeCase, types };
|
|
912
|
+
}
|
|
913
|
+
type Offer = {
|
|
914
|
+
/** The address that made the offer. */
|
|
915
|
+
readonly maker: Address;
|
|
916
|
+
/** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
917
|
+
readonly assets: bigint;
|
|
918
|
+
/** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
|
|
919
|
+
readonly obligationUnits: bigint;
|
|
920
|
+
/** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
|
|
921
|
+
readonly obligationShares: bigint;
|
|
922
|
+
/** The price (18 decimals). */
|
|
923
|
+
readonly price: bigint;
|
|
924
|
+
/** The date at which all interests will be paid. */
|
|
925
|
+
readonly maturity: Maturity;
|
|
926
|
+
/** The date at which the offer will expire. */
|
|
927
|
+
readonly expiry: number;
|
|
928
|
+
/** The date at which the offer will start. */
|
|
929
|
+
readonly start: number;
|
|
930
|
+
/** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
931
|
+
readonly group: Hex;
|
|
932
|
+
/** The session. Used for session-based offer management. */
|
|
933
|
+
readonly session: Hex;
|
|
934
|
+
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
935
|
+
readonly buy: boolean;
|
|
936
|
+
/** The chain id where the liquidity for this offer is located. */
|
|
937
|
+
readonly chainId: Id;
|
|
938
|
+
/** The token that is being borrowed. */
|
|
939
|
+
readonly loanToken: Address;
|
|
940
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
941
|
+
readonly collaterals: readonly Collateral[];
|
|
942
|
+
/** The optional callback data to retrieve the maker funds. */
|
|
943
|
+
readonly callback: {
|
|
944
|
+
readonly address: Address;
|
|
945
|
+
readonly data: Hex;
|
|
946
|
+
};
|
|
947
|
+
};
|
|
948
|
+
declare enum Status {
|
|
949
|
+
VALID = "VALID",
|
|
950
|
+
SIMULATION_ERROR = "SIMULATION_ERROR",
|
|
951
|
+
}
|
|
952
|
+
type Validation = {
|
|
953
|
+
offerHash: Hex;
|
|
954
|
+
status: Status;
|
|
955
|
+
};
|
|
956
|
+
declare const OfferSchema: () => z$1.ZodObject<{
|
|
957
|
+
maker: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
958
|
+
assets: z$1.ZodBigInt;
|
|
959
|
+
obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
960
|
+
obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
961
|
+
price: z$1.ZodBigInt;
|
|
962
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
963
|
+
expiry: z$1.ZodNumber;
|
|
964
|
+
start: z$1.ZodNumber;
|
|
965
|
+
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>>;
|
|
966
|
+
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>>;
|
|
967
|
+
buy: z$1.ZodBoolean;
|
|
968
|
+
chainId: z$1.ZodNumber;
|
|
969
|
+
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
970
|
+
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
971
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
972
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
973
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
974
|
+
}, z$1.core.$strip>>;
|
|
975
|
+
callback: z$1.ZodObject<{
|
|
976
|
+
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
977
|
+
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
978
|
+
}, z$1.core.$strip>;
|
|
979
|
+
}, z$1.core.$strip>;
|
|
980
|
+
/**
|
|
981
|
+
* Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
|
|
982
|
+
*
|
|
983
|
+
* The `group` field accepts multiple input formats:
|
|
984
|
+
* - **Hex string** (`0x...`): Padded to 32 bytes if needed
|
|
985
|
+
* - **Numeric string**: Converted to hex (e.g., `"123"` -> `"0x...7b"`)
|
|
986
|
+
* - **Number**: Non-negative safe integer, converted to hex
|
|
987
|
+
* - **BigInt**: Non-negative, must fit in bytes32
|
|
988
|
+
*
|
|
989
|
+
* All values validated to be non-negative and within bytes32 range.
|
|
990
|
+
*/
|
|
991
|
+
type OfferInput = Compute<Omit<Offer, "chainId" | "group" | "session" | "obligationUnits" | "obligationShares"> & {
|
|
992
|
+
chainId: number;
|
|
993
|
+
group: Hex | bigint | number | string;
|
|
994
|
+
/** Optional: defaults to zero bytes32. */
|
|
995
|
+
session?: Hex | bigint | number | string;
|
|
996
|
+
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
997
|
+
obligationUnits?: bigint;
|
|
998
|
+
/** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
999
|
+
obligationShares?: bigint;
|
|
1000
|
+
}>;
|
|
1001
|
+
/**
|
|
1002
|
+
* Creates an offer from a plain object.
|
|
1003
|
+
* @throws {InvalidOfferError} If the offer is invalid.
|
|
1004
|
+
* @param input - The offer to create.
|
|
1005
|
+
* @returns The created offer.
|
|
1006
|
+
*/
|
|
1007
|
+
declare function from$12(input: OfferInput): Offer;
|
|
1008
|
+
declare namespace from$12 {
|
|
1009
|
+
type ErrorType = InvalidOfferError;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* Creates an offer from a snake case object.
|
|
1013
|
+
* @throws {InvalidOfferError} If the offer is invalid.
|
|
1014
|
+
* @param input - The offer to create.
|
|
1015
|
+
* @returns The created offer.
|
|
1016
|
+
*/
|
|
1017
|
+
declare function fromSnakeCase$1(input: Snake<Omit<Offer, "chainId" | "session"> & {
|
|
1018
|
+
chainId: number;
|
|
1019
|
+
session: string;
|
|
1020
|
+
}>): Offer;
|
|
1021
|
+
/**
|
|
1022
|
+
* Converts an offer to a snake case object.
|
|
1023
|
+
* @param offer - The offer to convert.
|
|
1024
|
+
* @returns The converted offer.
|
|
1025
|
+
*/
|
|
747
1026
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Serializes an offer for merkle tree encoding.
|
|
1029
|
+
* Converts BigInt fields to strings for JSON compatibility.
|
|
1030
|
+
*
|
|
1031
|
+
* @param offer - Offer to serialize
|
|
1032
|
+
* @returns JSON-serializable offer object
|
|
1033
|
+
*/
|
|
1034
|
+
declare const serialize: (offer: Offer) => {
|
|
1035
|
+
maker: `0x${string}`;
|
|
1036
|
+
assets: string;
|
|
1037
|
+
obligationUnits: string;
|
|
1038
|
+
obligationShares: string;
|
|
1039
|
+
price: string;
|
|
1040
|
+
maturity: number;
|
|
1041
|
+
expiry: number;
|
|
1042
|
+
start: number;
|
|
1043
|
+
group: `0x${string}`;
|
|
1044
|
+
session: `0x${string}`;
|
|
1045
|
+
buy: boolean;
|
|
1046
|
+
chainId: Id;
|
|
1047
|
+
loanToken: `0x${string}`;
|
|
1048
|
+
collaterals: {
|
|
1049
|
+
asset: `0x${string}`;
|
|
1050
|
+
oracle: `0x${string}`;
|
|
1051
|
+
lltv: string;
|
|
1052
|
+
}[];
|
|
1053
|
+
callback: {
|
|
1054
|
+
address: `0x${string}`;
|
|
1055
|
+
data: `0x${string}`;
|
|
1056
|
+
};
|
|
1057
|
+
hash: `0x${string}`;
|
|
1058
|
+
};
|
|
748
1059
|
type RandomConfig = {
|
|
749
1060
|
chains?: Chain$1[];
|
|
750
1061
|
loanTokens?: Address[];
|
|
@@ -752,22 +1063,20 @@ type RandomConfig = {
|
|
|
752
1063
|
assetsDecimals?: Record<Address, number>;
|
|
753
1064
|
buy?: boolean;
|
|
754
1065
|
assets?: bigint;
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
1066
|
+
obligationUnits?: bigint;
|
|
1067
|
+
obligationShares?: bigint;
|
|
1068
|
+
maker?: Address;
|
|
758
1069
|
maturity?: Maturity;
|
|
759
1070
|
start?: number;
|
|
760
1071
|
expiry?: number;
|
|
761
|
-
|
|
762
|
-
|
|
1072
|
+
group?: Hex | bigint | number | string;
|
|
1073
|
+
session?: Hex | bigint | number | string;
|
|
1074
|
+
price?: bigint;
|
|
763
1075
|
callback?: {
|
|
764
1076
|
address: Address;
|
|
765
1077
|
data: Hex;
|
|
766
|
-
gasLimit: bigint;
|
|
767
1078
|
};
|
|
768
1079
|
collaterals?: readonly Collateral[];
|
|
769
|
-
signature?: Hex;
|
|
770
|
-
blockNumber?: number;
|
|
771
1080
|
};
|
|
772
1081
|
/**
|
|
773
1082
|
* Generates a random Offer.
|
|
@@ -775,7 +1084,7 @@ type RandomConfig = {
|
|
|
775
1084
|
* @warning The generated Offer should not be used for production usage.
|
|
776
1085
|
* @returns {Offer} A randomly generated Offer object.
|
|
777
1086
|
*/
|
|
778
|
-
declare function random$
|
|
1087
|
+
declare function random$1(config?: RandomConfig): Offer;
|
|
779
1088
|
/**
|
|
780
1089
|
* Creates an EIP-712 domain object.
|
|
781
1090
|
* @param chainId - The chain ID.
|
|
@@ -799,13 +1108,19 @@ declare const types: {
|
|
|
799
1108
|
readonly type: "address";
|
|
800
1109
|
}];
|
|
801
1110
|
readonly Offer: readonly [{
|
|
802
|
-
readonly name: "
|
|
1111
|
+
readonly name: "maker";
|
|
803
1112
|
readonly type: "address";
|
|
804
1113
|
}, {
|
|
805
1114
|
readonly name: "assets";
|
|
806
1115
|
readonly type: "uint256";
|
|
807
1116
|
}, {
|
|
808
|
-
readonly name: "
|
|
1117
|
+
readonly name: "obligationUnits";
|
|
1118
|
+
readonly type: "uint256";
|
|
1119
|
+
}, {
|
|
1120
|
+
readonly name: "obligationShares";
|
|
1121
|
+
readonly type: "uint256";
|
|
1122
|
+
}, {
|
|
1123
|
+
readonly name: "price";
|
|
809
1124
|
readonly type: "uint256";
|
|
810
1125
|
}, {
|
|
811
1126
|
readonly name: "maturity";
|
|
@@ -814,8 +1129,11 @@ declare const types: {
|
|
|
814
1129
|
readonly name: "expiry";
|
|
815
1130
|
readonly type: "uint256";
|
|
816
1131
|
}, {
|
|
817
|
-
readonly name: "
|
|
818
|
-
readonly type: "
|
|
1132
|
+
readonly name: "group";
|
|
1133
|
+
readonly type: "bytes32";
|
|
1134
|
+
}, {
|
|
1135
|
+
readonly name: "session";
|
|
1136
|
+
readonly type: "bytes32";
|
|
819
1137
|
}, {
|
|
820
1138
|
readonly name: "buy";
|
|
821
1139
|
readonly type: "bool";
|
|
@@ -845,9 +1163,6 @@ declare const types: {
|
|
|
845
1163
|
}, {
|
|
846
1164
|
readonly name: "data";
|
|
847
1165
|
readonly type: "bytes";
|
|
848
|
-
}, {
|
|
849
|
-
readonly name: "gasLimit";
|
|
850
|
-
readonly type: "uint256";
|
|
851
1166
|
}];
|
|
852
1167
|
};
|
|
853
1168
|
/**
|
|
@@ -859,7 +1174,7 @@ declare const types: {
|
|
|
859
1174
|
*/
|
|
860
1175
|
declare function sign(offers: Offer[], wallet: WalletClient): Promise<Hex>;
|
|
861
1176
|
declare function signatureMsg(offers: Offer[]): Hex;
|
|
862
|
-
declare function hash(offer:
|
|
1177
|
+
declare function hash(offer: Offer): Hex;
|
|
863
1178
|
/**
|
|
864
1179
|
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
865
1180
|
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals (sorted by token address), maturity)).
|
|
@@ -867,32 +1182,32 @@ declare function hash(offer: Omit<Offer, "hash">): Hex;
|
|
|
867
1182
|
* @returns The obligation id as a 32-byte hex string.
|
|
868
1183
|
*/
|
|
869
1184
|
declare function obligationId(offer: Offer): Hex;
|
|
870
|
-
declare function encode$
|
|
871
|
-
declare function decode$
|
|
1185
|
+
declare function encode$1(offer: Offer): `0x${string}`;
|
|
1186
|
+
declare function decode$1(data: Hex): Offer;
|
|
872
1187
|
type OfferConsumed = {
|
|
873
1188
|
id: string;
|
|
874
1189
|
chainId: Id;
|
|
875
|
-
|
|
876
|
-
|
|
1190
|
+
maker: Address;
|
|
1191
|
+
group: Hex;
|
|
877
1192
|
amount: bigint;
|
|
878
1193
|
blockNumber: number;
|
|
879
1194
|
};
|
|
880
1195
|
/**
|
|
881
|
-
* ABI for the
|
|
1196
|
+
* ABI for the Consume event emitted by the Obligation contract.
|
|
882
1197
|
*/
|
|
883
1198
|
declare const consumedEvent: {
|
|
884
1199
|
readonly type: "event";
|
|
885
|
-
readonly name: "
|
|
1200
|
+
readonly name: "Consume";
|
|
886
1201
|
readonly inputs: readonly [{
|
|
887
1202
|
readonly name: "user";
|
|
888
1203
|
readonly type: "address";
|
|
889
1204
|
readonly indexed: true;
|
|
890
1205
|
readonly internalType: "address";
|
|
891
1206
|
}, {
|
|
892
|
-
readonly name: "
|
|
893
|
-
readonly type: "
|
|
1207
|
+
readonly name: "group";
|
|
1208
|
+
readonly type: "bytes32";
|
|
894
1209
|
readonly indexed: true;
|
|
895
|
-
readonly internalType: "
|
|
1210
|
+
readonly internalType: "bytes32";
|
|
896
1211
|
}, {
|
|
897
1212
|
readonly name: "amount";
|
|
898
1213
|
readonly type: "uint256";
|
|
@@ -920,284 +1235,49 @@ declare class AccountNotSetError extends BaseError {
|
|
|
920
1235
|
readonly name = "Offer.AccountNotSetError";
|
|
921
1236
|
constructor();
|
|
922
1237
|
}
|
|
923
|
-
declare namespace
|
|
924
|
-
export {
|
|
1238
|
+
declare namespace Oracle_d_exports {
|
|
1239
|
+
export { Conversion, Oracle, from$11 as from };
|
|
925
1240
|
}
|
|
926
1241
|
/**
|
|
927
|
-
*
|
|
1242
|
+
* An oracle contract that provides price information for assets.
|
|
928
1243
|
*/
|
|
929
|
-
type
|
|
930
|
-
id
|
|
931
|
-
|
|
1244
|
+
type Oracle = {
|
|
1245
|
+
/** The chain id where the oracle is deployed. */
|
|
1246
|
+
readonly chainId: Id;
|
|
1247
|
+
/** The address of the oracle contract. */
|
|
1248
|
+
readonly address: Address;
|
|
1249
|
+
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1250
|
+
readonly price: bigint | null;
|
|
1251
|
+
/** The block number at which the price was fetched. */
|
|
1252
|
+
readonly blockNumber: number;
|
|
932
1253
|
};
|
|
933
1254
|
/**
|
|
934
|
-
*
|
|
1255
|
+
* Create an Oracle from a plain object.
|
|
1256
|
+
* @param data - The data to create the oracle from.
|
|
1257
|
+
* @returns The created oracle.
|
|
935
1258
|
*/
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1259
|
+
declare function from$11(data: from$11.Parameters): from$11.ReturnType;
|
|
1260
|
+
declare namespace from$11 {
|
|
1261
|
+
type Parameters = {
|
|
1262
|
+
chainId: Id;
|
|
1263
|
+
address: Address;
|
|
1264
|
+
price: string | null;
|
|
1265
|
+
blockNumber: number;
|
|
1266
|
+
};
|
|
1267
|
+
type ReturnType = Oracle;
|
|
1268
|
+
}
|
|
941
1269
|
/**
|
|
942
|
-
*
|
|
1270
|
+
* Conversion utilities for converting between collateral and loan token amounts
|
|
1271
|
+
* using oracle prices and LLTV
|
|
943
1272
|
*/
|
|
944
|
-
|
|
945
|
-
offerHash: Offer["hash"];
|
|
946
|
-
poolId: string;
|
|
1273
|
+
declare namespace Conversion {
|
|
947
1274
|
/**
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
952
|
-
* -
|
|
953
|
-
|
|
954
|
-
amount: bigint;
|
|
955
|
-
};
|
|
956
|
-
/**
|
|
957
|
-
* Calculate maximum debt capacity from collateral amount.
|
|
958
|
-
* @param amount - Collateral amount
|
|
959
|
-
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
960
|
-
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
961
|
-
* @returns Maximum debt capacity
|
|
962
|
-
*/
|
|
963
|
-
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
964
|
-
/**
|
|
965
|
-
* Generate pool ID for balance pools.
|
|
966
|
-
*/
|
|
967
|
-
declare function generateBalancePoolId(parameters: {
|
|
968
|
-
user: Address;
|
|
969
|
-
chainId: Id;
|
|
970
|
-
token: Address;
|
|
971
|
-
}): string;
|
|
972
|
-
/**
|
|
973
|
-
* Generate pool ID for allowance pools.
|
|
974
|
-
*/
|
|
975
|
-
declare function generateAllowancePoolId(parameters: {
|
|
976
|
-
user: Address;
|
|
977
|
-
chainId: Id;
|
|
978
|
-
token: Address;
|
|
979
|
-
}): string;
|
|
980
|
-
/**
|
|
981
|
-
* Generate pool ID for sell ERC20 callback pools.
|
|
982
|
-
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
983
|
-
*/
|
|
984
|
-
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
985
|
-
user: Address;
|
|
986
|
-
chainId: Id;
|
|
987
|
-
obligationId: Hex;
|
|
988
|
-
token: Address;
|
|
989
|
-
offerHash: Hex;
|
|
990
|
-
}): string;
|
|
991
|
-
/**
|
|
992
|
-
* Generate pool ID for obligation collateral pools.
|
|
993
|
-
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
994
|
-
* These pools are shared across all offers with the same obligation.
|
|
995
|
-
*/
|
|
996
|
-
declare function generateObligationCollateralPoolId(parameters: {
|
|
997
|
-
user: Address;
|
|
998
|
-
chainId: Id;
|
|
999
|
-
obligationId: Hex;
|
|
1000
|
-
token: Address;
|
|
1001
|
-
}): string;
|
|
1002
|
-
/**
|
|
1003
|
-
* Generate pool ID for buy vault callback pools.
|
|
1004
|
-
*/
|
|
1005
|
-
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
1006
|
-
user: Address;
|
|
1007
|
-
chainId: Id;
|
|
1008
|
-
vault: Address;
|
|
1009
|
-
offerHash: Hex;
|
|
1010
|
-
}): string;
|
|
1011
|
-
/**
|
|
1012
|
-
* Generate pool ID for debt pools.
|
|
1013
|
-
*/
|
|
1014
|
-
declare function generateDebtPoolId(parameters: {
|
|
1015
|
-
user: Address;
|
|
1016
|
-
chainId: Id;
|
|
1017
|
-
obligationId: Hex;
|
|
1018
|
-
}): string;
|
|
1019
|
-
/**
|
|
1020
|
-
* Generate pool ID for user position in a vault.
|
|
1021
|
-
*/
|
|
1022
|
-
declare function generateUserVaultPositionPoolId(parameters: {
|
|
1023
|
-
user: Address;
|
|
1024
|
-
chainId: Id;
|
|
1025
|
-
vault: Address;
|
|
1026
|
-
}): string;
|
|
1027
|
-
/**
|
|
1028
|
-
* Generate pool ID for vault position in a market.
|
|
1029
|
-
*/
|
|
1030
|
-
declare function generateVaultPositionPoolId(parameters: {
|
|
1031
|
-
vault: Address;
|
|
1032
|
-
chainId: Id;
|
|
1033
|
-
marketId: string;
|
|
1034
|
-
}): string;
|
|
1035
|
-
/**
|
|
1036
|
-
* Generate pool ID for market total liquidity.
|
|
1037
|
-
*/
|
|
1038
|
-
declare function generateMarketLiquidityPoolId(parameters: {
|
|
1039
|
-
chainId: Id;
|
|
1040
|
-
marketId: string;
|
|
1041
|
-
}): string;
|
|
1042
|
-
declare namespace Obligation_d_exports {
|
|
1043
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$11 as from, fromSnakeCase$1 as fromSnakeCase, id, random$1 as random };
|
|
1044
|
-
}
|
|
1045
|
-
type Obligation = {
|
|
1046
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
1047
|
-
chainId: Id;
|
|
1048
|
-
/** The token that is being borrowed for this obligation. */
|
|
1049
|
-
loanToken: Address;
|
|
1050
|
-
/** The exact set of collaterals required to borrow the loan token. */
|
|
1051
|
-
collaterals: Collateral[];
|
|
1052
|
-
/** The maturity of the obligation. */
|
|
1053
|
-
maturity: Maturity;
|
|
1054
|
-
};
|
|
1055
|
-
declare const ObligationSchema: z$1.ZodObject<{
|
|
1056
|
-
chainId: z$1.ZodNumber;
|
|
1057
|
-
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1058
|
-
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1059
|
-
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1060
|
-
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1061
|
-
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1062
|
-
}, z$1.core.$strip>>;
|
|
1063
|
-
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1064
|
-
}, z$1.core.$strip>;
|
|
1065
|
-
/**
|
|
1066
|
-
* Creates an obligation from the given parameters.
|
|
1067
|
-
* @constructor
|
|
1068
|
-
* @param parameters - {@link from.Parameters}
|
|
1069
|
-
* @returns The created obligation. {@link Obligation}
|
|
1070
|
-
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1071
|
-
*
|
|
1072
|
-
* @example
|
|
1073
|
-
* ```ts
|
|
1074
|
-
* const obligation = Obligation.from({
|
|
1075
|
-
* chainId: 1,
|
|
1076
|
-
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1077
|
-
* collaterals: [
|
|
1078
|
-
* Collateral.from({
|
|
1079
|
-
* asset: privateKeyToAccount(generatePrivateKey()).address,
|
|
1080
|
-
* oracle: privateKeyToAccount(generatePrivateKey()).address,
|
|
1081
|
-
* lltv: 0.965
|
|
1082
|
-
* }),
|
|
1083
|
-
* ],
|
|
1084
|
-
* maturity: Maturity.from("end_of_next_quarter"),
|
|
1085
|
-
* });
|
|
1086
|
-
* ```
|
|
1087
|
-
*/
|
|
1088
|
-
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
1089
|
-
declare namespace from$11 {
|
|
1090
|
-
type Parameters = {
|
|
1091
|
-
/** The chain id where the liquidity for this obligation is located. */
|
|
1092
|
-
chainId: number;
|
|
1093
|
-
/** The token that is being borrowed for this obligation. */
|
|
1094
|
-
loanToken: Address;
|
|
1095
|
-
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1096
|
-
collaterals: from$14.Parameters[] | readonly from$14.Parameters[];
|
|
1097
|
-
/** The maturity of the obligation. */
|
|
1098
|
-
maturity: from$13.Parameters;
|
|
1099
|
-
};
|
|
1100
|
-
type ReturnType = Obligation;
|
|
1101
|
-
type ErrorType = InvalidObligationError;
|
|
1102
|
-
}
|
|
1103
|
-
/**
|
|
1104
|
-
* Creates an obligation from a snake case object.
|
|
1105
|
-
* @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
|
|
1106
|
-
* @param input - {@link fromSnakeCase.Parameters}
|
|
1107
|
-
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
1108
|
-
*/
|
|
1109
|
-
declare function fromSnakeCase$1(input: fromSnakeCase$1.Parameters): fromSnakeCase$1.ReturnType;
|
|
1110
|
-
declare namespace fromSnakeCase$1 {
|
|
1111
|
-
type Parameters = Snake<Omit<Obligation, "chainId"> & {
|
|
1112
|
-
chainId: number;
|
|
1113
|
-
}>;
|
|
1114
|
-
type ReturnType = Obligation;
|
|
1115
|
-
type ErrorType = InvalidObligationError;
|
|
1116
|
-
}
|
|
1117
|
-
/**
|
|
1118
|
-
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
1119
|
-
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
|
|
1120
|
-
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1121
|
-
* @param obligation - {@link id.Parameters}
|
|
1122
|
-
* @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
|
|
1123
|
-
*
|
|
1124
|
-
* @example
|
|
1125
|
-
* ```ts
|
|
1126
|
-
* const obligation = Obligation.random();
|
|
1127
|
-
* const id = Obligation.id(obligation);
|
|
1128
|
-
* console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1129
|
-
* ```
|
|
1130
|
-
*/
|
|
1131
|
-
declare function id(obligation: id.Parameters): id.ReturnType;
|
|
1132
|
-
declare namespace id {
|
|
1133
|
-
type Parameters = Obligation;
|
|
1134
|
-
type ReturnType = Hex;
|
|
1135
|
-
type ErrorType = CollateralsAreNotSortedError;
|
|
1136
|
-
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Generates a random obligation.
|
|
1139
|
-
* @returns A randomly generated obligation. {@link random.ReturnType}
|
|
1140
|
-
*
|
|
1141
|
-
* @example
|
|
1142
|
-
* ```ts
|
|
1143
|
-
* const obligation = Obligation.random();
|
|
1144
|
-
* ```
|
|
1145
|
-
*/
|
|
1146
|
-
declare function random$1(): random$1.ReturnType;
|
|
1147
|
-
declare namespace random$1 {
|
|
1148
|
-
type ReturnType = Obligation;
|
|
1149
|
-
}
|
|
1150
|
-
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1151
|
-
readonly name = "Obligation.InvalidObligationError";
|
|
1152
|
-
constructor(error: z$1.ZodError | Error);
|
|
1153
|
-
}
|
|
1154
|
-
declare class CollateralsAreNotSortedError extends BaseError {
|
|
1155
|
-
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1156
|
-
constructor();
|
|
1157
|
-
}
|
|
1158
|
-
declare namespace Oracle_d_exports {
|
|
1159
|
-
export { Conversion, Oracle, from$10 as from };
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* An oracle contract that provides price information for assets.
|
|
1163
|
-
*/
|
|
1164
|
-
type Oracle = {
|
|
1165
|
-
/** The chain id where the oracle is deployed. */
|
|
1166
|
-
readonly chainId: Id;
|
|
1167
|
-
/** The address of the oracle contract. */
|
|
1168
|
-
readonly address: Address;
|
|
1169
|
-
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1170
|
-
readonly price: bigint | null;
|
|
1171
|
-
/** The block number at which the price was fetched. */
|
|
1172
|
-
readonly blockNumber: number;
|
|
1173
|
-
};
|
|
1174
|
-
/**
|
|
1175
|
-
* Create an Oracle from a plain object.
|
|
1176
|
-
* @param data - The data to create the oracle from.
|
|
1177
|
-
* @returns The created oracle.
|
|
1178
|
-
*/
|
|
1179
|
-
declare function from$10(data: from$10.Parameters): from$10.ReturnType;
|
|
1180
|
-
declare namespace from$10 {
|
|
1181
|
-
type Parameters = {
|
|
1182
|
-
chainId: Id;
|
|
1183
|
-
address: Address;
|
|
1184
|
-
price: string | null;
|
|
1185
|
-
blockNumber: number;
|
|
1186
|
-
};
|
|
1187
|
-
type ReturnType = Oracle;
|
|
1188
|
-
}
|
|
1189
|
-
/**
|
|
1190
|
-
* Conversion utilities for converting between collateral and loan token amounts
|
|
1191
|
-
* using oracle prices and LLTV
|
|
1192
|
-
*/
|
|
1193
|
-
declare namespace Conversion {
|
|
1194
|
-
/**
|
|
1195
|
-
* Converts a collateral amount to loan token
|
|
1196
|
-
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
1197
|
-
*
|
|
1198
|
-
* @param amount - The collateral amount to convert
|
|
1199
|
-
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1200
|
-
* @returns The equivalent loan token amount
|
|
1275
|
+
* Converts a collateral amount to loan token
|
|
1276
|
+
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
1277
|
+
*
|
|
1278
|
+
* @param amount - The collateral amount to convert
|
|
1279
|
+
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1280
|
+
* @returns The equivalent loan token amount
|
|
1201
1281
|
*/
|
|
1202
1282
|
function collateralToLoan(amount: bigint, params: {
|
|
1203
1283
|
price: bigint;
|
|
@@ -1218,7 +1298,7 @@ declare namespace Conversion {
|
|
|
1218
1298
|
}): bigint;
|
|
1219
1299
|
}
|
|
1220
1300
|
declare namespace Position_d_exports {
|
|
1221
|
-
export { Position, Type, from$
|
|
1301
|
+
export { Position, Type, from$10 as from };
|
|
1222
1302
|
}
|
|
1223
1303
|
type Position = {
|
|
1224
1304
|
/** The chain id. */
|
|
@@ -1252,8 +1332,8 @@ declare enum Type {
|
|
|
1252
1332
|
* @param parameters - {@link from.Parameters}
|
|
1253
1333
|
* @returns The created Position. {@link from.ReturnType}
|
|
1254
1334
|
*/
|
|
1255
|
-
declare function from$
|
|
1256
|
-
declare namespace from$
|
|
1335
|
+
declare function from$10(parameters: from$10.Parameters): from$10.ReturnType;
|
|
1336
|
+
declare namespace from$10 {
|
|
1257
1337
|
type Parameters = {
|
|
1258
1338
|
chainId: Id;
|
|
1259
1339
|
contract: Address;
|
|
@@ -1266,27 +1346,27 @@ declare namespace from$9 {
|
|
|
1266
1346
|
type ReturnType = Position;
|
|
1267
1347
|
}
|
|
1268
1348
|
declare namespace Quote_d_exports {
|
|
1269
|
-
export { InvalidQuoteError, Quote, QuoteSchema, from$
|
|
1349
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$9 as from, fromSnakeCase, random };
|
|
1270
1350
|
}
|
|
1271
1351
|
type Quote = {
|
|
1272
1352
|
/** The obligation id. */
|
|
1273
1353
|
obligationId: Hex;
|
|
1274
1354
|
ask: {
|
|
1275
|
-
/** The
|
|
1276
|
-
|
|
1355
|
+
/** The ask price for the obligation. (18 decimals). */
|
|
1356
|
+
price: bigint;
|
|
1277
1357
|
};
|
|
1278
1358
|
bid: {
|
|
1279
|
-
/** The
|
|
1280
|
-
|
|
1359
|
+
/** The bid price for the obligation. (18 decimals). */
|
|
1360
|
+
price: bigint;
|
|
1281
1361
|
};
|
|
1282
1362
|
};
|
|
1283
1363
|
declare const QuoteSchema: z$1.ZodObject<{
|
|
1284
1364
|
obligationId: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1285
1365
|
ask: z$1.ZodObject<{
|
|
1286
|
-
|
|
1366
|
+
price: z$1.ZodBigInt;
|
|
1287
1367
|
}, z$1.core.$strip>;
|
|
1288
1368
|
bid: z$1.ZodObject<{
|
|
1289
|
-
|
|
1369
|
+
price: z$1.ZodBigInt;
|
|
1290
1370
|
}, z$1.core.$strip>;
|
|
1291
1371
|
}, z$1.core.$strip>;
|
|
1292
1372
|
/**
|
|
@@ -1298,11 +1378,11 @@ declare const QuoteSchema: z$1.ZodObject<{
|
|
|
1298
1378
|
*
|
|
1299
1379
|
* @example
|
|
1300
1380
|
* ```ts
|
|
1301
|
-
* const quote = Quote.from({ obligationId: "0x123", ask: {
|
|
1381
|
+
* const quote = Quote.from({ obligationId: "0x123", ask: { price: 100n }, bid: { price: 100n } });
|
|
1302
1382
|
* ```
|
|
1303
1383
|
*/
|
|
1304
|
-
declare function from$
|
|
1305
|
-
declare namespace from$
|
|
1384
|
+
declare function from$9(parameters: from$9.Parameters): from$9.ReturnType;
|
|
1385
|
+
declare namespace from$9 {
|
|
1306
1386
|
type Parameters = Quote;
|
|
1307
1387
|
type ReturnType = Quote;
|
|
1308
1388
|
type ErrorType = InvalidQuoteError;
|
|
@@ -1317,7 +1397,7 @@ declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.R
|
|
|
1317
1397
|
declare namespace fromSnakeCase {
|
|
1318
1398
|
type Parameters = Snake<Quote>;
|
|
1319
1399
|
type ReturnType = Quote;
|
|
1320
|
-
type ErrorType = from$
|
|
1400
|
+
type ErrorType = from$9.ErrorType;
|
|
1321
1401
|
}
|
|
1322
1402
|
/**
|
|
1323
1403
|
* Generates a random quote.
|
|
@@ -1332,14 +1412,14 @@ declare function random(): random.ReturnType;
|
|
|
1332
1412
|
declare namespace random {
|
|
1333
1413
|
type Parameters = never;
|
|
1334
1414
|
type ReturnType = Quote;
|
|
1335
|
-
type ErrorType = from$
|
|
1415
|
+
type ErrorType = from$9.ErrorType;
|
|
1336
1416
|
}
|
|
1337
1417
|
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1338
1418
|
readonly name = "Quote.InvalidQuoteError";
|
|
1339
1419
|
constructor(error: z$1.ZodError | Error);
|
|
1340
1420
|
}
|
|
1341
1421
|
declare namespace Transfer_d_exports {
|
|
1342
|
-
export { Transfer, from$
|
|
1422
|
+
export { Transfer, from$8 as from };
|
|
1343
1423
|
}
|
|
1344
1424
|
type Transfer = {
|
|
1345
1425
|
id: string;
|
|
@@ -1362,8 +1442,8 @@ type Transfer = {
|
|
|
1362
1442
|
* const transfer = Transfer.from({ id: "1", chainId: 1, contract: "0x123", from: "0x456", to: "0x789", value: 100n, blockNumber: 100n });
|
|
1363
1443
|
* ```
|
|
1364
1444
|
*/
|
|
1365
|
-
declare function from$
|
|
1366
|
-
declare namespace from$
|
|
1445
|
+
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1446
|
+
declare namespace from$8 {
|
|
1367
1447
|
type Parameters = {
|
|
1368
1448
|
id: string;
|
|
1369
1449
|
chainId: Id;
|
|
@@ -1376,416 +1456,296 @@ declare namespace from$7 {
|
|
|
1376
1456
|
type ReturnType = Transfer;
|
|
1377
1457
|
}
|
|
1378
1458
|
declare namespace Tree_d_exports {
|
|
1379
|
-
export { Tree, VERSION$1 as VERSION, decode
|
|
1459
|
+
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION$1 as VERSION, decode, encode, encodeUnsigned, from$7 as from, proofs };
|
|
1380
1460
|
}
|
|
1461
|
+
/**
|
|
1462
|
+
* A merkle tree of offers built from offer hashes.
|
|
1463
|
+
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1464
|
+
*/
|
|
1381
1465
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1466
|
+
/** The offers in the tree. */
|
|
1382
1467
|
offers: Offer[];
|
|
1468
|
+
/** The root of the tree. */
|
|
1383
1469
|
root: Hex;
|
|
1384
1470
|
}>;
|
|
1471
|
+
type Proof = {
|
|
1472
|
+
/** The offer that the proof is for. */
|
|
1473
|
+
offer: Offer;
|
|
1474
|
+
/** The merkle proof path for the offer. */
|
|
1475
|
+
path: Hex[];
|
|
1476
|
+
};
|
|
1385
1477
|
declare const VERSION$1 = 1;
|
|
1386
1478
|
/**
|
|
1387
1479
|
* Builds a Merkle tree from a list of offers.
|
|
1388
1480
|
*
|
|
1389
1481
|
* Leaves are the offer `hash` values as `bytes32` and are deterministically
|
|
1390
|
-
* ordered
|
|
1391
|
-
* regardless of the input order.
|
|
1482
|
+
* ordered following the StandardMerkleTree leaf ordering so that the resulting
|
|
1483
|
+
* root is stable regardless of the input order.
|
|
1392
1484
|
*
|
|
1393
1485
|
* @param offers - Offers to include in the tree.
|
|
1394
1486
|
* @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
|
|
1487
|
+
* @throws {TreeError} If tree building fails due to offer inconsistencies.
|
|
1395
1488
|
*/
|
|
1396
|
-
declare const from$
|
|
1489
|
+
declare const from$7: (offers: Offer[]) => Tree;
|
|
1397
1490
|
/**
|
|
1398
|
-
*
|
|
1491
|
+
* Generates merkle proofs for all offers in a tree.
|
|
1399
1492
|
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1493
|
+
* Each proof allows independent verification that an offer is included in the tree
|
|
1494
|
+
* without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
|
|
1402
1495
|
*
|
|
1403
|
-
* @param tree - The
|
|
1404
|
-
* @returns
|
|
1405
|
-
* @throws Error if the given `root` does not match the offers.
|
|
1496
|
+
* @param tree - The {@link Tree} to generate proofs for.
|
|
1497
|
+
* @returns Array of proofs - {@link Proof}
|
|
1406
1498
|
*/
|
|
1407
|
-
declare const
|
|
1499
|
+
declare const proofs: (tree: Tree) => Proof[];
|
|
1408
1500
|
/**
|
|
1409
|
-
*
|
|
1501
|
+
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1502
|
+
*
|
|
1503
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}{signature}` where:
|
|
1504
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1505
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1506
|
+
* - `{root}`: 32-byte merkle root
|
|
1507
|
+
* - `{signature}`: 65-byte EIP-191 signature over raw root bytes
|
|
1508
|
+
*
|
|
1509
|
+
* Validates signature authenticity and root integrity before encoding.
|
|
1510
|
+
*
|
|
1511
|
+
* @example
|
|
1512
|
+
* ```typescript
|
|
1513
|
+
* const tree = Tree.from(offers);
|
|
1514
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1515
|
+
* const calldata = await Tree.encode(tree, signature);
|
|
1516
|
+
* await broadcast(calldata);
|
|
1517
|
+
* ```
|
|
1410
1518
|
*
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1519
|
+
* @example
|
|
1520
|
+
* Manual construction (for advanced users):
|
|
1521
|
+
* ```typescript
|
|
1522
|
+
* const tree = Tree.from(offers);
|
|
1523
|
+
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1524
|
+
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1525
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1526
|
+
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1527
|
+
* ```
|
|
1413
1528
|
*
|
|
1414
|
-
* @param
|
|
1415
|
-
* @
|
|
1416
|
-
* @
|
|
1529
|
+
* @param tree - Merkle tree of offers
|
|
1530
|
+
* @param signature - EIP-191 signature over raw root bytes
|
|
1531
|
+
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1532
|
+
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1417
1533
|
*/
|
|
1418
|
-
declare const
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
levels: Level[];
|
|
1469
|
-
nextCursor: string | null;
|
|
1470
|
-
};
|
|
1534
|
+
declare const encode: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1535
|
+
/**
|
|
1536
|
+
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1537
|
+
*
|
|
1538
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}` where:
|
|
1539
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1540
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1541
|
+
* - `{root}`: 32-byte merkle root
|
|
1542
|
+
*
|
|
1543
|
+
* Validates root integrity before encoding.
|
|
1544
|
+
*
|
|
1545
|
+
* @param tree - Merkle tree of offers
|
|
1546
|
+
* @returns Hex-encoded unsigned payload
|
|
1547
|
+
* @throws {EncodeError} If root mismatch
|
|
1548
|
+
*/
|
|
1549
|
+
declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
1550
|
+
/**
|
|
1551
|
+
* Decodes hex calldata into a validated merkle tree.
|
|
1552
|
+
*
|
|
1553
|
+
* Validates signature before decompression for fail-fast rejection of invalid payloads.
|
|
1554
|
+
* Returns the tree with separately validated signature and recovered signer address.
|
|
1555
|
+
*
|
|
1556
|
+
* Validation order:
|
|
1557
|
+
* 1. Version check
|
|
1558
|
+
* 2. Signature verification (fail-fast, before decompression)
|
|
1559
|
+
* 3. Decompression (only if signature valid)
|
|
1560
|
+
* 4. Root verification (computed from offers vs embedded root)
|
|
1561
|
+
*
|
|
1562
|
+
* @example
|
|
1563
|
+
* ```typescript
|
|
1564
|
+
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1565
|
+
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1566
|
+
* ```
|
|
1567
|
+
*
|
|
1568
|
+
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1569
|
+
* @returns Validated tree, signature, and recovered signer address
|
|
1570
|
+
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1571
|
+
*/
|
|
1572
|
+
declare const decode: (encoded: Hex) => Promise<{
|
|
1573
|
+
tree: Tree;
|
|
1574
|
+
signature: Hex;
|
|
1575
|
+
signer: Address;
|
|
1576
|
+
}>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Error thrown during tree building operations.
|
|
1579
|
+
* Indicates structural issues with the tree (missing offers, inconsistent state).
|
|
1580
|
+
*/
|
|
1581
|
+
declare class TreeError extends BaseError {
|
|
1582
|
+
name: string;
|
|
1583
|
+
constructor(reason: string);
|
|
1471
1584
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1585
|
+
/**
|
|
1586
|
+
* Error thrown during tree encoding.
|
|
1587
|
+
* Indicates validation failures (signature, root mismatch, mixed makers).
|
|
1588
|
+
*/
|
|
1589
|
+
declare class EncodeError extends BaseError {
|
|
1590
|
+
name: string;
|
|
1591
|
+
constructor(reason: string);
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Error thrown during tree decoding.
|
|
1595
|
+
* Indicates payload corruption, version mismatch, or validation failures.
|
|
1596
|
+
*/
|
|
1597
|
+
declare class DecodeError extends BaseError {
|
|
1598
|
+
name: string;
|
|
1599
|
+
constructor(reason: string);
|
|
1487
1600
|
}
|
|
1488
|
-
//#endregion
|
|
1489
|
-
//#region src/database/domains/Chains.d.ts
|
|
1490
|
-
type ChainsDomain = {
|
|
1491
|
-
/** Get the latest block number processed by a given chain alongside its epoch. */
|
|
1492
|
-
getBlockNumber: (chainId: Id) => Promise<{
|
|
1493
|
-
blockNumber: number;
|
|
1494
|
-
epoch: bigint;
|
|
1495
|
-
}>;
|
|
1496
|
-
/** Get the latest block number processed for all chains, optionally filtered by chain id. */
|
|
1497
|
-
getBlockNumbers: (parameters?: {
|
|
1498
|
-
chainId?: Id;
|
|
1499
|
-
}) => Promise<Array<{
|
|
1500
|
-
chainId: Id;
|
|
1501
|
-
blockNumber: number;
|
|
1502
|
-
epoch: bigint;
|
|
1503
|
-
updatedAt: Date;
|
|
1504
|
-
}>>;
|
|
1505
|
-
/** Save the latest block number processed for a given chain alongside its epoch.*/
|
|
1506
|
-
saveBlockNumber: (parameters: {
|
|
1507
|
-
chainId: Id;
|
|
1508
|
-
blockNumber: number;
|
|
1509
|
-
epoch: bigint;
|
|
1510
|
-
}) => Promise<void>;
|
|
1511
|
-
};
|
|
1512
1601
|
//#endregion
|
|
1513
1602
|
//#region src/indexer/collectors/Collector.d.ts
|
|
1514
1603
|
declare const names: readonly ["offers", "consumed_events", "positions", "prices"];
|
|
1515
1604
|
type Name = (typeof names)[number];
|
|
1516
1605
|
/** A general collector interface. */
|
|
1517
|
-
type Collector<name extends Name = Name,
|
|
1606
|
+
type Collector<name extends Name = Name, client extends PublicClient<Transport, Chain$1> = PublicClient<Transport, Chain$1>> = {
|
|
1518
1607
|
/** The name of the collector. */
|
|
1519
1608
|
readonly name: name;
|
|
1520
1609
|
/** The chain the collector is running on. */
|
|
1521
|
-
readonly chain: chain;
|
|
1610
|
+
readonly chain: client["chain"];
|
|
1611
|
+
/** The public client used to query chain head. */
|
|
1612
|
+
readonly client: client;
|
|
1613
|
+
/** The database connection for collector metadata. */
|
|
1614
|
+
readonly db: Database;
|
|
1615
|
+
/** The normal polling interval (ms) for this collector. */
|
|
1616
|
+
readonly interval: number;
|
|
1522
1617
|
/** Start collecting data from external sources.
|
|
1523
1618
|
* @yields The last block number processed by the collector.
|
|
1524
1619
|
*/
|
|
1525
1620
|
collect: () => AsyncGenerator<number, void, void>;
|
|
1526
1621
|
};
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
type Rule<T, Name$2 extends string = string> = {
|
|
1534
|
-
kind: "single";
|
|
1535
|
-
name: Name$2;
|
|
1536
|
-
description: string;
|
|
1537
|
-
run: Single<T, Name$2>;
|
|
1538
|
-
} | {
|
|
1539
|
-
kind: "batch";
|
|
1540
|
-
name: Name$2;
|
|
1541
|
-
description: string;
|
|
1542
|
-
run: Batch<T, Name$2>;
|
|
1543
|
-
};
|
|
1544
|
-
type RuleNames<Rules$1 extends readonly {
|
|
1545
|
-
name: string;
|
|
1546
|
-
}[]> = Rules$1[number]["name"];
|
|
1547
|
-
/**
|
|
1548
|
-
* A single item validation rule.
|
|
1549
|
-
* @param item - The item to validate.
|
|
1550
|
-
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
1551
|
-
*/
|
|
1552
|
-
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
1553
|
-
/**
|
|
1554
|
-
* A batch item validation rule.
|
|
1555
|
-
* @param items - The items to validate.
|
|
1556
|
-
* @returns A map of the items to the issue that was found.
|
|
1557
|
-
*/
|
|
1558
|
-
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>>;
|
|
1559
|
-
/**
|
|
1560
|
-
* Create a validation rule iterating over a single item at a time.
|
|
1561
|
-
* @param name - The name of the rule.
|
|
1562
|
-
* @param description - A human-readable description of the rule.
|
|
1563
|
-
* @param run - The function that validates the rule.
|
|
1564
|
-
* @returns The created rule.
|
|
1565
|
-
*/
|
|
1566
|
-
declare function single<Name$2 extends string, T>(name: Name$2, description: string, run: Single<T, Name$2>): Rule<T, Name$2>;
|
|
1567
|
-
/**
|
|
1568
|
-
* Create a validation rule iterating over a batch of items at a time.
|
|
1569
|
-
* @param name - The name of the rule.
|
|
1570
|
-
* @param description - A human-readable description of the rule.
|
|
1571
|
-
* @param run - The function that validates the rule.
|
|
1572
|
-
* @returns The created rule.
|
|
1573
|
-
*/
|
|
1574
|
-
declare function batch$1<Name$2 extends string, T>(name: Name$2, description: string, run: Batch<T, Name$2>): Rule<T, Name$2>;
|
|
1575
|
-
/**
|
|
1576
|
-
* A validation issue.
|
|
1577
|
-
*/
|
|
1578
|
-
type Issue<T, RuleName extends string = string> = {
|
|
1579
|
-
/** The name of the rule that caused the issue. */
|
|
1580
|
-
ruleName: RuleName;
|
|
1581
|
-
/** The message of the issue. */
|
|
1582
|
-
message: string;
|
|
1583
|
-
/** The item that was not valid. */
|
|
1584
|
-
item: T;
|
|
1585
|
-
};
|
|
1586
|
-
/**
|
|
1587
|
-
* The result of a validation.
|
|
1588
|
-
*/
|
|
1589
|
-
type Result<T, RuleName extends string = string> = {
|
|
1590
|
-
/** The items that were valid. */
|
|
1591
|
-
valid: T[];
|
|
1592
|
-
/** The reports of the failed validations. */
|
|
1593
|
-
issues: Issue<T, RuleName>[];
|
|
1622
|
+
//#endregion
|
|
1623
|
+
//#region src/database/domains/Blocks.d.ts
|
|
1624
|
+
type ChainState = {
|
|
1625
|
+
chainId: Id;
|
|
1626
|
+
blockNumber: number;
|
|
1627
|
+
epoch: bigint;
|
|
1594
1628
|
};
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
declare namespace Gatekeeper_d_exports {
|
|
1601
|
-
export { Gatekeeper, Rules, create$4 as create };
|
|
1602
|
-
}
|
|
1603
|
-
type Rules = readonly Rule<Offer, string>[];
|
|
1604
|
-
type Gatekeeper = {
|
|
1605
|
-
rules: Rules;
|
|
1606
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
1629
|
+
type CollectorState = {
|
|
1630
|
+
collectorName: Name;
|
|
1631
|
+
chainId: Id;
|
|
1632
|
+
blockNumber: number;
|
|
1633
|
+
epoch: bigint;
|
|
1607
1634
|
};
|
|
1608
|
-
type
|
|
1609
|
-
|
|
1635
|
+
type ChainSnapshot = ChainState & {
|
|
1636
|
+
updatedAt: Date;
|
|
1610
1637
|
};
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
1614
|
-
}
|
|
1615
|
-
type GateConfig = {
|
|
1616
|
-
callbacks?: CallbackConfig[];
|
|
1617
|
-
maturities?: MaturityType[];
|
|
1638
|
+
type CollectorSnapshot = CollectorState & {
|
|
1639
|
+
updatedAt: Date;
|
|
1618
1640
|
};
|
|
1619
|
-
type
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
vaultFactories: Address[];
|
|
1623
|
-
} | {
|
|
1624
|
-
type: CallbackType.SellERC20Callback;
|
|
1625
|
-
addresses: Address[];
|
|
1626
|
-
} | {
|
|
1627
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
1641
|
+
type InitParameters = {
|
|
1642
|
+
chainId: Id;
|
|
1643
|
+
collectorName: Name;
|
|
1628
1644
|
};
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
type: CallbackType.SellERC20Callback;
|
|
1634
|
-
}> | undefined;
|
|
1635
|
-
declare function getCallback(chain: Name$1, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
1636
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
1637
|
-
}> | undefined;
|
|
1638
|
-
declare function getCallback(chain: Name$1, type: CallbackType): CallbackConfig | undefined;
|
|
1639
|
-
/**
|
|
1640
|
-
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
1641
|
-
* Skips the empty callback type as it does not carry addresses.
|
|
1642
|
-
*
|
|
1643
|
-
* @param chain - Chain name for which to infer the callback type
|
|
1644
|
-
* @param address - Callback contract address
|
|
1645
|
-
* @returns The callback type when found, otherwise undefined
|
|
1646
|
-
*/
|
|
1647
|
-
declare function getCallbackType(chain: Name$1, address: Address): CallbackType | undefined;
|
|
1648
|
-
/**
|
|
1649
|
-
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
1650
|
-
* @param chain - Chain name for which to read the validation configuration
|
|
1651
|
-
* @param type - Callback type to retrieve
|
|
1652
|
-
* @returns The matching callback addresses or an empty array if not configured
|
|
1653
|
-
*/
|
|
1654
|
-
declare function getCallbackTypeAddresses(chain: Name$1, type: CallbackType): Address[];
|
|
1655
|
-
/**
|
|
1656
|
-
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
1657
|
-
*
|
|
1658
|
-
* @param chain - Chain name
|
|
1659
|
-
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
1660
|
-
*/
|
|
1661
|
-
declare const getCallbackAddresses: (chain: Name$1) => Address[];
|
|
1662
|
-
declare const assets$1: Record<string, Address[]>;
|
|
1663
|
-
declare const configs: Record<Name$1, GateConfig>;
|
|
1664
|
-
//#endregion
|
|
1665
|
-
//#region src/gatekeeper/morphoRules.d.ts
|
|
1666
|
-
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
1667
|
-
declare namespace Rules_d_exports {
|
|
1668
|
-
export { ValidityParameters, callback, chains$1 as chains, maturity, token, validity };
|
|
1669
|
-
}
|
|
1670
|
-
type ValidityParameters = {
|
|
1671
|
-
client: PublicClient<Transport, Chain$1>;
|
|
1645
|
+
type AdvanceChainParameters = {
|
|
1646
|
+
chainId: Id;
|
|
1647
|
+
blockNumber: number;
|
|
1648
|
+
epoch: bigint;
|
|
1672
1649
|
};
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
*/
|
|
1679
|
-
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
1680
|
-
declare const chains$1: ({
|
|
1681
|
-
chains: chains$1
|
|
1682
|
-
}: {
|
|
1683
|
-
chains: Chain$1[];
|
|
1684
|
-
}) => Rule<Offer, "chain_ids">;
|
|
1685
|
-
declare const maturity: ({
|
|
1686
|
-
maturities
|
|
1687
|
-
}: {
|
|
1688
|
-
maturities: MaturityType[];
|
|
1689
|
-
}) => Rule<Offer, "maturity">;
|
|
1690
|
-
declare const callback: ({
|
|
1691
|
-
callbacks,
|
|
1692
|
-
allowedAddresses
|
|
1693
|
-
}: {
|
|
1694
|
-
callbacks: CallbackType[];
|
|
1695
|
-
allowedAddresses: Address[];
|
|
1696
|
-
}) => Rule<Offer, "callback">;
|
|
1697
|
-
/**
|
|
1698
|
-
* A validation rule that checks if the offer's token is allowed.
|
|
1699
|
-
* @param offer - The offer to validate.
|
|
1700
|
-
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
1701
|
-
*/
|
|
1702
|
-
declare const token: ({
|
|
1703
|
-
assets
|
|
1704
|
-
}: {
|
|
1705
|
-
assets: Address[];
|
|
1706
|
-
}) => Rule<Offer, "token">;
|
|
1707
|
-
declare namespace Indexer_d_exports {
|
|
1708
|
-
export { Indexer, IndexerConfig, create$3 as create, from$5 as from };
|
|
1709
|
-
}
|
|
1710
|
-
type Indexer = {
|
|
1711
|
-
start: () => () => void;
|
|
1712
|
-
next: () => Promise<void>;
|
|
1713
|
-
return: () => Promise<void>;
|
|
1650
|
+
type AdvanceCollectorParameters = {
|
|
1651
|
+
collectorName: Name;
|
|
1652
|
+
chainId: Id;
|
|
1653
|
+
blockNumber: number;
|
|
1654
|
+
epoch: bigint;
|
|
1714
1655
|
};
|
|
1715
|
-
type
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
maxBatchSize?: number;
|
|
1721
|
-
maxBlockNumber?: number;
|
|
1722
|
-
blockWindow?: number;
|
|
1723
|
-
retryAttempts?: number;
|
|
1724
|
-
retryDelayMs?: number;
|
|
1656
|
+
type HandleReorgParameters = {
|
|
1657
|
+
chainId: Id;
|
|
1658
|
+
blockNumber: number;
|
|
1659
|
+
epoch: bigint;
|
|
1660
|
+
collectorNames?: Name[];
|
|
1725
1661
|
};
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
interval: number;
|
|
1732
|
-
}): Indexer;
|
|
1733
|
-
//#endregion
|
|
1734
|
-
//#region src/database/domains/Collectors.d.ts
|
|
1735
|
-
type CollectorsDomain = {
|
|
1736
|
-
/** Get the latest block number processed by a collector for a given chain alongside the epoch. */
|
|
1737
|
-
getBlockNumber: (parameters: {
|
|
1738
|
-
collectorName: Name;
|
|
1739
|
-
chainId: Id;
|
|
1740
|
-
}) => Promise<{
|
|
1741
|
-
blockNumber: number;
|
|
1742
|
-
epoch: bigint;
|
|
1662
|
+
type BlocksDomain = {
|
|
1663
|
+
/** Initialize and return chain + collector state, seeding rows when missing. */
|
|
1664
|
+
init: (parameters: InitParameters) => Promise<{
|
|
1665
|
+
chain: ChainState;
|
|
1666
|
+
collector: CollectorState;
|
|
1743
1667
|
}>;
|
|
1744
|
-
/**
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
getBlockNumbers: (parameters?: {
|
|
1749
|
-
chainId?: Id;
|
|
1750
|
-
}) => Promise<Array<{
|
|
1751
|
-
collectorName: Name;
|
|
1668
|
+
/** Return chain state, failing if it has not been initialized yet. */
|
|
1669
|
+
getChain: (chainId: Id) => Promise<ChainState>;
|
|
1670
|
+
/** Return collector state, failing if it has not been initialized yet. */
|
|
1671
|
+
getCollector: (parameters: {
|
|
1752
1672
|
chainId: Id;
|
|
1753
|
-
blockNumber: number;
|
|
1754
|
-
epoch: bigint;
|
|
1755
|
-
updatedAt: Date;
|
|
1756
|
-
}>>;
|
|
1757
|
-
/** Save the latest block number processed by a collector for a given chain.*/
|
|
1758
|
-
saveBlockNumber: (parameters: {
|
|
1759
1673
|
collectorName: Name;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1674
|
+
}) => Promise<CollectorState>;
|
|
1675
|
+
/** Return chain state rows, optionally filtered by chain id. */
|
|
1676
|
+
getChains: (parameters?: {
|
|
1677
|
+
chainId?: Id;
|
|
1678
|
+
}) => Promise<ChainSnapshot[]>;
|
|
1679
|
+
/** Return collector state rows, optionally filtered by chain id. */
|
|
1680
|
+
getCollectors: (parameters?: {
|
|
1681
|
+
chainId?: Id;
|
|
1682
|
+
}) => Promise<CollectorSnapshot[]>;
|
|
1683
|
+
/** Persist chain block state updates. */
|
|
1684
|
+
advanceChain: (parameters: AdvanceChainParameters) => Promise<void>;
|
|
1685
|
+
/** Persist collector block state updates and enforce invariants via storage CAS. */
|
|
1686
|
+
advanceCollector: (parameters: AdvanceCollectorParameters) => Promise<void>;
|
|
1687
|
+
/** Apply a reorg by advancing the chain epoch and fencing collectors. */
|
|
1688
|
+
handleReorg: (parameters: HandleReorgParameters) => Promise<void>;
|
|
1689
|
+
};
|
|
1690
|
+
declare namespace Logger_d_exports {
|
|
1691
|
+
export { LogEntry, LogFn, LogLevel, LogLevelValues, Logger, defaultLogger, getLogger, runWithLogger, silentLogger };
|
|
1692
|
+
}
|
|
1693
|
+
declare const LogLevelValues: readonly ["trace", "debug", "info", "warn", "error", "fatal", "silent"];
|
|
1694
|
+
type LogLevel = (typeof LogLevelValues)[number];
|
|
1695
|
+
type LogEntry = Compute<{
|
|
1696
|
+
msg: string;
|
|
1697
|
+
} & Record<string, unknown>>;
|
|
1698
|
+
type LogFn = (entry: LogEntry) => void;
|
|
1699
|
+
type Logger = {
|
|
1700
|
+
trace: LogFn;
|
|
1701
|
+
debug: LogFn;
|
|
1702
|
+
info: LogFn;
|
|
1703
|
+
warn: LogFn;
|
|
1704
|
+
error: LogFn;
|
|
1705
|
+
fatal: LogFn;
|
|
1764
1706
|
};
|
|
1707
|
+
declare function defaultLogger(minLevel?: LogLevel, pretty?: boolean): Logger;
|
|
1708
|
+
declare function silentLogger(): Logger;
|
|
1709
|
+
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
1710
|
+
declare function getLogger(): Logger;
|
|
1765
1711
|
//#endregion
|
|
1766
|
-
//#region src/database/domains/
|
|
1767
|
-
type
|
|
1768
|
-
|
|
1769
|
-
|
|
1712
|
+
//#region src/database/domains/Offers.d.ts
|
|
1713
|
+
type CreateBatch = Readonly<{
|
|
1714
|
+
blockNumber: number;
|
|
1715
|
+
offers: Offer[];
|
|
1716
|
+
}>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Raw row returned by database queries.
|
|
1719
|
+
* Built from primitives; no domain constructors in the DB layer.
|
|
1720
|
+
*/
|
|
1721
|
+
type Row = {
|
|
1722
|
+
hash: Hex;
|
|
1770
1723
|
maker: Address;
|
|
1771
|
-
|
|
1772
|
-
|
|
1724
|
+
assets: bigint;
|
|
1725
|
+
obligationUnits: bigint;
|
|
1726
|
+
obligationShares: bigint;
|
|
1727
|
+
price: bigint;
|
|
1728
|
+
maturity: Maturity;
|
|
1729
|
+
expiry: number;
|
|
1730
|
+
start: number;
|
|
1731
|
+
group: Hex;
|
|
1732
|
+
session: Hex;
|
|
1733
|
+
buy: boolean;
|
|
1734
|
+
chainId: Id;
|
|
1735
|
+
loanToken: Address;
|
|
1736
|
+
collaterals: Collateral[];
|
|
1737
|
+
callback: {
|
|
1738
|
+
address: Address;
|
|
1739
|
+
data: Hex;
|
|
1740
|
+
};
|
|
1741
|
+
consumed: bigint;
|
|
1742
|
+
available: bigint;
|
|
1743
|
+
takeable: bigint;
|
|
1773
1744
|
blockNumber: number;
|
|
1774
1745
|
};
|
|
1775
|
-
type ConsumedDomain = {
|
|
1776
|
-
/** Create new consumed events. */
|
|
1777
|
-
create: (parameters: Event[]) => Promise<void>;
|
|
1778
|
-
/** Delete multiple consumed events by chain and block number greater than or equal to the given value. */
|
|
1779
|
-
delete: (parameters: {
|
|
1780
|
-
chainId: Id;
|
|
1781
|
-
blockNumberGte: number;
|
|
1782
|
-
}) => Promise<number>;
|
|
1783
|
-
};
|
|
1784
|
-
//#endregion
|
|
1785
|
-
//#region src/database/domains/Offers.d.ts
|
|
1786
1746
|
type OffersDomain = {
|
|
1787
|
-
/** Create multiple
|
|
1788
|
-
create: (
|
|
1747
|
+
/** Create multiple offers. */
|
|
1748
|
+
create: (batches: CreateBatch[]) => Promise<Hex[]>;
|
|
1789
1749
|
/** Delete multiple offers by hashes or block number greater than or equal to the given value on a given chain.
|
|
1790
1750
|
* @returns the number of offers deleted.
|
|
1791
1751
|
*/
|
|
@@ -1797,13 +1757,16 @@ type OffersDomain = {
|
|
|
1797
1757
|
}) => Promise<number>;
|
|
1798
1758
|
/** Get all offers. */
|
|
1799
1759
|
get: (parameters?: GetOffersParams) => Promise<{
|
|
1800
|
-
|
|
1760
|
+
rows: Row[];
|
|
1801
1761
|
nextCursor: string | null;
|
|
1802
1762
|
}>;
|
|
1803
1763
|
/** Get obligations */
|
|
1804
1764
|
getObligations: (parameters?: {
|
|
1805
1765
|
ids?: Hex[];
|
|
1806
1766
|
chainId?: Id;
|
|
1767
|
+
loanToken?: Address;
|
|
1768
|
+
collateralToken?: Address;
|
|
1769
|
+
maturity?: number;
|
|
1807
1770
|
cursor?: string;
|
|
1808
1771
|
limit?: number;
|
|
1809
1772
|
}) => Promise<{
|
|
@@ -1822,10 +1785,145 @@ type PaginationParams$1 = {
|
|
|
1822
1785
|
limit?: number;
|
|
1823
1786
|
};
|
|
1824
1787
|
type GetOffersParams = {
|
|
1825
|
-
/** Filter by
|
|
1826
|
-
|
|
1788
|
+
/** Filter by maker address */
|
|
1789
|
+
maker?: Address;
|
|
1827
1790
|
} & PaginationParams$1;
|
|
1828
1791
|
//#endregion
|
|
1792
|
+
//#region src/database/domains/Book.d.ts
|
|
1793
|
+
type BookDomain = {
|
|
1794
|
+
/** Get aggregated book levels for a given obligation side. */
|
|
1795
|
+
get: (parameters: get$4.Parameters) => Promise<get$4.ReturnType>;
|
|
1796
|
+
/** Get all offers for a given obligation side with cross-invalidation. */
|
|
1797
|
+
getOffers: (parameters: getOffers$2.Parameters) => Promise<getOffers$2.ReturnType>;
|
|
1798
|
+
};
|
|
1799
|
+
declare namespace get$4 {
|
|
1800
|
+
type Parameters = {
|
|
1801
|
+
/** The side of the offer. */
|
|
1802
|
+
side: "buy" | "sell";
|
|
1803
|
+
/** The obligationId of the offer. */
|
|
1804
|
+
obligationId: Hex;
|
|
1805
|
+
/** Cursor string returned by a previous call, for pagination */
|
|
1806
|
+
cursor?: string;
|
|
1807
|
+
/** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
1808
|
+
limit?: number;
|
|
1809
|
+
};
|
|
1810
|
+
type Level = {
|
|
1811
|
+
/** The computed price for this level (interpolated at query time) */
|
|
1812
|
+
price: bigint;
|
|
1813
|
+
/** Sum of takeable amounts at this price */
|
|
1814
|
+
assets: bigint;
|
|
1815
|
+
/** Number of offers at this price */
|
|
1816
|
+
count: number;
|
|
1817
|
+
};
|
|
1818
|
+
type ReturnType = {
|
|
1819
|
+
levels: Level[];
|
|
1820
|
+
nextCursor: string | null;
|
|
1821
|
+
};
|
|
1822
|
+
}
|
|
1823
|
+
declare namespace getOffers$2 {
|
|
1824
|
+
type Parameters = {
|
|
1825
|
+
/** The side of the offer. */
|
|
1826
|
+
side: "buy" | "sell";
|
|
1827
|
+
/** The obligationId of the offer. */
|
|
1828
|
+
obligationId: Hex;
|
|
1829
|
+
/** Cursor string returned by a previous call, for pagination */
|
|
1830
|
+
cursor?: string;
|
|
1831
|
+
/** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
1832
|
+
limit?: number;
|
|
1833
|
+
};
|
|
1834
|
+
type ReturnType = {
|
|
1835
|
+
rows: Row[];
|
|
1836
|
+
nextCursor: string | null;
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
//#endregion
|
|
1840
|
+
//#region src/database/domains/Consumed.d.ts
|
|
1841
|
+
type Event = {
|
|
1842
|
+
id: string;
|
|
1843
|
+
chainId: Id;
|
|
1844
|
+
maker: Address;
|
|
1845
|
+
group: Hex;
|
|
1846
|
+
amount: bigint;
|
|
1847
|
+
blockNumber: number;
|
|
1848
|
+
};
|
|
1849
|
+
type ConsumedDomain = {
|
|
1850
|
+
/** Create new consumed events. */
|
|
1851
|
+
create: (parameters: Event[]) => Promise<void>;
|
|
1852
|
+
/** Delete multiple consumed events by chain and block number greater than or equal to the given value. */
|
|
1853
|
+
delete: (parameters: {
|
|
1854
|
+
chainId: Id;
|
|
1855
|
+
blockNumberGte: number;
|
|
1856
|
+
}) => Promise<number>;
|
|
1857
|
+
};
|
|
1858
|
+
//#endregion
|
|
1859
|
+
//#region src/database/domains/Lots.d.ts
|
|
1860
|
+
type Lot = {
|
|
1861
|
+
chainId: Id;
|
|
1862
|
+
user: Address;
|
|
1863
|
+
contract: Address;
|
|
1864
|
+
group: string;
|
|
1865
|
+
lower: bigint;
|
|
1866
|
+
upper: bigint;
|
|
1867
|
+
};
|
|
1868
|
+
type LotsDomain = {
|
|
1869
|
+
/**
|
|
1870
|
+
* Create or update lots for offers.
|
|
1871
|
+
* Called when offers are created to reserve liquidity on positions.
|
|
1872
|
+
* For each (position, group), keeps only the biggest offer by assets.
|
|
1873
|
+
* If lot exists and new offer is bigger, grows the lot and shifts higher lots.
|
|
1874
|
+
*/
|
|
1875
|
+
create: (parameters: create$5.Parameters) => Promise<void>;
|
|
1876
|
+
/**
|
|
1877
|
+
* Get lots with optional filtering.
|
|
1878
|
+
*/
|
|
1879
|
+
get: (parameters?: get$3.Parameters) => Promise<Lot[]>;
|
|
1880
|
+
};
|
|
1881
|
+
declare namespace create$5 {
|
|
1882
|
+
type OfferLotInfo = {
|
|
1883
|
+
positionChainId: Id;
|
|
1884
|
+
positionContract: Address;
|
|
1885
|
+
positionUser: Address;
|
|
1886
|
+
group: string;
|
|
1887
|
+
size: bigint;
|
|
1888
|
+
};
|
|
1889
|
+
type Parameters = OfferLotInfo[];
|
|
1890
|
+
type ReturnType = undefined;
|
|
1891
|
+
}
|
|
1892
|
+
declare namespace get$3 {
|
|
1893
|
+
type Parameters = {
|
|
1894
|
+
chainId?: Id;
|
|
1895
|
+
user?: Address;
|
|
1896
|
+
contract?: Address;
|
|
1897
|
+
group?: string;
|
|
1898
|
+
};
|
|
1899
|
+
type ReturnType = Lot[];
|
|
1900
|
+
}
|
|
1901
|
+
declare function create$5(db: Core): LotsDomain;
|
|
1902
|
+
//#endregion
|
|
1903
|
+
//#region src/database/domains/Offsets.d.ts
|
|
1904
|
+
type Offset = {
|
|
1905
|
+
chainId: Id;
|
|
1906
|
+
user: Address;
|
|
1907
|
+
contract: Address;
|
|
1908
|
+
group: string;
|
|
1909
|
+
value: bigint;
|
|
1910
|
+
};
|
|
1911
|
+
type OffsetsDomain = {
|
|
1912
|
+
/**
|
|
1913
|
+
* Get offsets with optional filtering.
|
|
1914
|
+
*/
|
|
1915
|
+
get: (parameters?: get$2.Parameters) => Promise<Offset[]>;
|
|
1916
|
+
};
|
|
1917
|
+
declare namespace get$2 {
|
|
1918
|
+
type Parameters = {
|
|
1919
|
+
chainId?: Id;
|
|
1920
|
+
user?: Address;
|
|
1921
|
+
contract?: Address;
|
|
1922
|
+
group?: string;
|
|
1923
|
+
};
|
|
1924
|
+
type ReturnType = Offset[];
|
|
1925
|
+
}
|
|
1926
|
+
//#endregion
|
|
1829
1927
|
//#region src/database/domains/Oracles.d.ts
|
|
1830
1928
|
type OraclesDomain = {
|
|
1831
1929
|
/**
|
|
@@ -1866,6 +1964,12 @@ type PositionsDomain = {
|
|
|
1866
1964
|
* @returns The positions. {@link get.ReturnType}
|
|
1867
1965
|
*/
|
|
1868
1966
|
get: (parameters?: get$1.Parameters) => Promise<get$1.ReturnType>;
|
|
1967
|
+
/**
|
|
1968
|
+
* Returns positions for a specific user with remaining balance calculation.
|
|
1969
|
+
* @param parameters - {@link getByUser.Parameters}
|
|
1970
|
+
* @returns The user's positions with remaining balances. {@link getByUser.ReturnType}
|
|
1971
|
+
*/
|
|
1972
|
+
getByUser: (parameters: getByUser.Parameters) => Promise<getByUser.ReturnType>;
|
|
1869
1973
|
/**
|
|
1870
1974
|
* Set all positions to empty after a given block number (inclusive), deletes all transfers linked to the positions.
|
|
1871
1975
|
* @param parameters - {@link setEmptyAfter.Parameters}
|
|
@@ -1887,7 +1991,25 @@ declare namespace get$1 {
|
|
|
1887
1991
|
filled?: boolean;
|
|
1888
1992
|
};
|
|
1889
1993
|
type ReturnType = {
|
|
1890
|
-
positions: Position[];
|
|
1994
|
+
positions: Position[];
|
|
1995
|
+
nextCursor: string | null;
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
declare namespace getByUser {
|
|
1999
|
+
type Parameters = PaginationParams & {
|
|
2000
|
+
/** The user address to get positions for. */
|
|
2001
|
+
user: Address;
|
|
2002
|
+
};
|
|
2003
|
+
type PositionWithReserved = {
|
|
2004
|
+
chainId: Id;
|
|
2005
|
+
contract: Address;
|
|
2006
|
+
user: Address;
|
|
2007
|
+
blockNumber: number;
|
|
2008
|
+
/** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
2009
|
+
reserved: bigint;
|
|
2010
|
+
};
|
|
2011
|
+
type ReturnType = {
|
|
2012
|
+
positions: PositionWithReserved[];
|
|
1891
2013
|
nextCursor: string | null;
|
|
1892
2014
|
};
|
|
1893
2015
|
}
|
|
@@ -1908,13 +2030,47 @@ type TransfersDomain = {
|
|
|
1908
2030
|
* @param transfers - {@link create.Parameters}
|
|
1909
2031
|
* @returns The number of transfers created. {@link create.ReturnType}
|
|
1910
2032
|
*/
|
|
1911
|
-
create: (transfers: create$
|
|
2033
|
+
create: (transfers: create$4.Parameters) => Promise<create$4.ReturnType>;
|
|
1912
2034
|
};
|
|
1913
|
-
declare namespace create$
|
|
2035
|
+
declare namespace create$4 {
|
|
1914
2036
|
type Parameters = Transfer[];
|
|
1915
2037
|
type ReturnType = number;
|
|
1916
2038
|
}
|
|
1917
|
-
declare const create$
|
|
2039
|
+
declare const create$4: (db: Core) => TransfersDomain;
|
|
2040
|
+
//#endregion
|
|
2041
|
+
//#region src/database/domains/Trees.d.ts
|
|
2042
|
+
/**
|
|
2043
|
+
* Attestation data for a single offer, containing the merkle root, signature, and proof.
|
|
2044
|
+
*/
|
|
2045
|
+
type Attestation = {
|
|
2046
|
+
root: Hex;
|
|
2047
|
+
signature: Hex;
|
|
2048
|
+
proof: Hex[];
|
|
2049
|
+
};
|
|
2050
|
+
/**
|
|
2051
|
+
* Input for creating trees with their signatures.
|
|
2052
|
+
*/
|
|
2053
|
+
type CreateInput = {
|
|
2054
|
+
tree: Tree;
|
|
2055
|
+
signature: Hex;
|
|
2056
|
+
blockNumber: number;
|
|
2057
|
+
};
|
|
2058
|
+
type TreesDomain = {
|
|
2059
|
+
/**
|
|
2060
|
+
* Creates trees, offers, and attestation links in a single transaction.
|
|
2061
|
+
*
|
|
2062
|
+
* @param trees - Array of decoded trees with signatures (batch insertion)
|
|
2063
|
+
* @returns Array of tree roots that were created/upserted
|
|
2064
|
+
*/
|
|
2065
|
+
create: (trees: CreateInput[]) => Promise<Hex[]>;
|
|
2066
|
+
/**
|
|
2067
|
+
* Retrieves merkle attestations for execution flow.
|
|
2068
|
+
*
|
|
2069
|
+
* @param hashes - Array of offer hashes to look up
|
|
2070
|
+
* @returns Map of offer hash to attestation (only entries with attestations are included)
|
|
2071
|
+
*/
|
|
2072
|
+
getAttestations: (hashes: Hex[]) => Promise<Map<Hex, Attestation>>;
|
|
2073
|
+
};
|
|
1918
2074
|
//#endregion
|
|
1919
2075
|
//#region src/database/domains/Validations.d.ts
|
|
1920
2076
|
type GetParams = {
|
|
@@ -1946,11 +2102,13 @@ declare namespace Database_d_exports {
|
|
|
1946
2102
|
type Driver = ReturnType<typeof drizzle> | ReturnType<typeof drizzle$1>;
|
|
1947
2103
|
type Domains = {
|
|
1948
2104
|
book: BookDomain;
|
|
1949
|
-
|
|
2105
|
+
blocks: BlocksDomain;
|
|
1950
2106
|
offers: OffersDomain;
|
|
1951
|
-
chains: ChainsDomain;
|
|
1952
2107
|
consumed: ConsumedDomain;
|
|
2108
|
+
lots: LotsDomain;
|
|
2109
|
+
offsets: OffsetsDomain;
|
|
1953
2110
|
oracles: OraclesDomain;
|
|
2111
|
+
trees: TreesDomain;
|
|
1954
2112
|
validations: ValidationsDomain;
|
|
1955
2113
|
positions: PositionsDomain;
|
|
1956
2114
|
transfers: TransfersDomain;
|
|
@@ -1971,9 +2129,225 @@ type Database = Core & {
|
|
|
1971
2129
|
* @param {string=} [connectionString] - The optional connection string for the Postgres database.
|
|
1972
2130
|
* @returns The database client {@link connect.ReturnType}
|
|
1973
2131
|
*/
|
|
1974
|
-
declare function connect$2(connectionString?: string): Database;
|
|
2132
|
+
declare function connect$2(chainRegistry: ChainRegistry, connectionString?: string): Database;
|
|
2133
|
+
declare namespace Gate_d_exports {
|
|
2134
|
+
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
2135
|
+
}
|
|
2136
|
+
/**
|
|
2137
|
+
* A validation rule.
|
|
2138
|
+
*/
|
|
2139
|
+
type Rule<T, Name$2 extends string = string> = {
|
|
2140
|
+
kind: "single";
|
|
2141
|
+
name: Name$2;
|
|
2142
|
+
description: string;
|
|
2143
|
+
run: Single<T, Name$2>;
|
|
2144
|
+
} | {
|
|
2145
|
+
kind: "batch";
|
|
2146
|
+
name: Name$2;
|
|
2147
|
+
description: string;
|
|
2148
|
+
run: Batch<T, Name$2>;
|
|
2149
|
+
};
|
|
2150
|
+
type RuleNames<Rules$1 extends readonly {
|
|
2151
|
+
name: string;
|
|
2152
|
+
}[]> = Rules$1[number]["name"];
|
|
2153
|
+
/**
|
|
2154
|
+
* A single item validation rule.
|
|
2155
|
+
* @param item - The item to validate.
|
|
2156
|
+
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
2157
|
+
*/
|
|
2158
|
+
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
2159
|
+
/**
|
|
2160
|
+
* A batch item validation rule.
|
|
2161
|
+
* @param items - The items to validate.
|
|
2162
|
+
* @returns A map of the items to the issue that was found.
|
|
2163
|
+
*/
|
|
2164
|
+
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>>;
|
|
2165
|
+
/**
|
|
2166
|
+
* Create a validation rule iterating over a single item at a time.
|
|
2167
|
+
* @param name - The name of the rule.
|
|
2168
|
+
* @param description - A human-readable description of the rule.
|
|
2169
|
+
* @param run - The function that validates the rule.
|
|
2170
|
+
* @returns The created rule.
|
|
2171
|
+
*/
|
|
2172
|
+
declare function single<Name$2 extends string, T>(name: Name$2, description: string, run: Single<T, Name$2>): Rule<T, Name$2>;
|
|
2173
|
+
/**
|
|
2174
|
+
* Create a validation rule iterating over a batch of items at a time.
|
|
2175
|
+
* @param name - The name of the rule.
|
|
2176
|
+
* @param description - A human-readable description of the rule.
|
|
2177
|
+
* @param run - The function that validates the rule.
|
|
2178
|
+
* @returns The created rule.
|
|
2179
|
+
*/
|
|
2180
|
+
declare function batch$1<Name$2 extends string, T>(name: Name$2, description: string, run: Batch<T, Name$2>): Rule<T, Name$2>;
|
|
2181
|
+
/**
|
|
2182
|
+
* A validation issue.
|
|
2183
|
+
*/
|
|
2184
|
+
type Issue<T, RuleName extends string = string> = {
|
|
2185
|
+
/** The name of the rule that caused the issue. */
|
|
2186
|
+
ruleName: RuleName;
|
|
2187
|
+
/** The message of the issue. */
|
|
2188
|
+
message: string;
|
|
2189
|
+
/** The item that was not valid. */
|
|
2190
|
+
item: T;
|
|
2191
|
+
};
|
|
2192
|
+
/**
|
|
2193
|
+
* The result of a validation.
|
|
2194
|
+
*/
|
|
2195
|
+
type Result<T, RuleName extends string = string> = {
|
|
2196
|
+
/** The items that were valid. */
|
|
2197
|
+
valid: T[];
|
|
2198
|
+
/** The reports of the failed validations. */
|
|
2199
|
+
issues: Issue<T, RuleName>[];
|
|
2200
|
+
};
|
|
2201
|
+
declare function run<T, Name$2 extends string, Rules$1 extends readonly Rule<T, Name$2>[]>(parameters: {
|
|
2202
|
+
items: T[];
|
|
2203
|
+
rules: Rules$1;
|
|
2204
|
+
chunkSize?: number;
|
|
2205
|
+
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
2206
|
+
declare namespace Gatekeeper_d_exports {
|
|
2207
|
+
export { Gatekeeper, Rules, create$3 as create };
|
|
2208
|
+
}
|
|
2209
|
+
type Rules = readonly Rule<Offer, string>[];
|
|
2210
|
+
type Gatekeeper = {
|
|
2211
|
+
rules: Rules;
|
|
2212
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2213
|
+
};
|
|
2214
|
+
type GatekeeperParameters = {
|
|
2215
|
+
rules: Rules;
|
|
2216
|
+
};
|
|
2217
|
+
declare function create$3(parameters: GatekeeperParameters): Gatekeeper;
|
|
2218
|
+
declare namespace GateConfig_d_exports {
|
|
2219
|
+
export { CallbackConfig, GateConfig, assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
2220
|
+
}
|
|
2221
|
+
type GateConfig = {
|
|
2222
|
+
callbacks?: CallbackConfig[];
|
|
2223
|
+
maturities?: MaturityType[];
|
|
2224
|
+
};
|
|
2225
|
+
type CallbackConfig = {
|
|
2226
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2227
|
+
addresses: Address[];
|
|
2228
|
+
vaultFactories: Address[];
|
|
2229
|
+
} | {
|
|
2230
|
+
type: CallbackType.SellERC20Callback;
|
|
2231
|
+
addresses: Address[];
|
|
2232
|
+
} | {
|
|
2233
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2234
|
+
};
|
|
2235
|
+
declare function getCallback(chain: Name$1, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
2236
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2237
|
+
}> | undefined;
|
|
2238
|
+
declare function getCallback(chain: Name$1, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
2239
|
+
type: CallbackType.SellERC20Callback;
|
|
2240
|
+
}> | undefined;
|
|
2241
|
+
declare function getCallback(chain: Name$1, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
2242
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2243
|
+
}> | undefined;
|
|
2244
|
+
declare function getCallback(chain: Name$1, type: CallbackType): CallbackConfig | undefined;
|
|
2245
|
+
/**
|
|
2246
|
+
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
2247
|
+
* Skips the empty callback type as it does not carry addresses.
|
|
2248
|
+
*
|
|
2249
|
+
* @param chain - Chain name for which to infer the callback type
|
|
2250
|
+
* @param address - Callback contract address
|
|
2251
|
+
* @returns The callback type when found, otherwise undefined
|
|
2252
|
+
*/
|
|
2253
|
+
declare function getCallbackType(chain: Name$1, address: Address): CallbackType | undefined;
|
|
2254
|
+
/**
|
|
2255
|
+
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
2256
|
+
* @param chain - Chain name for which to read the validation configuration
|
|
2257
|
+
* @param type - Callback type to retrieve
|
|
2258
|
+
* @returns The matching callback addresses or an empty array if not configured
|
|
2259
|
+
*/
|
|
2260
|
+
declare function getCallbackTypeAddresses(chain: Name$1, type: CallbackType): Address[];
|
|
2261
|
+
/**
|
|
2262
|
+
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
2263
|
+
*
|
|
2264
|
+
* @param chain - Chain name
|
|
2265
|
+
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
2266
|
+
*/
|
|
2267
|
+
declare const getCallbackAddresses: (chain: Name$1) => Address[];
|
|
2268
|
+
declare const assets: Record<string, Address[]>;
|
|
2269
|
+
declare const configs: Record<Name$1, GateConfig>;
|
|
2270
|
+
//#endregion
|
|
2271
|
+
//#region src/gatekeeper/morphoRules.d.ts
|
|
2272
|
+
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">)[];
|
|
2273
|
+
declare namespace Rules_d_exports {
|
|
2274
|
+
export { ValidityParameters, amountMutualExclusivity, callback, chains$1 as chains, maturity, sameMaker, token, validity };
|
|
2275
|
+
}
|
|
2276
|
+
type ValidityParameters = {
|
|
2277
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2278
|
+
};
|
|
2279
|
+
/**
|
|
2280
|
+
* set of rules to validate offers.
|
|
2281
|
+
*
|
|
2282
|
+
* @param parameters - Validity parameters with chain and client
|
|
2283
|
+
* @returns Array of validation rules to evaluate against offers
|
|
2284
|
+
*/
|
|
2285
|
+
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
2286
|
+
declare const chains$1: ({
|
|
2287
|
+
chains: chains$1
|
|
2288
|
+
}: {
|
|
2289
|
+
chains: Chain$1[];
|
|
2290
|
+
}) => Rule<Offer, "chain_ids">;
|
|
2291
|
+
declare const maturity: ({
|
|
2292
|
+
maturities
|
|
2293
|
+
}: {
|
|
2294
|
+
maturities: MaturityType[];
|
|
2295
|
+
}) => Rule<Offer, "maturity">;
|
|
2296
|
+
declare const callback: ({
|
|
2297
|
+
callbacks,
|
|
2298
|
+
allowedAddresses
|
|
2299
|
+
}: {
|
|
2300
|
+
callbacks: CallbackType[];
|
|
2301
|
+
allowedAddresses: Address[];
|
|
2302
|
+
}) => Rule<Offer, "callback">;
|
|
2303
|
+
/**
|
|
2304
|
+
* A validation rule that checks if the offer's tokens are allowed for its chain.
|
|
2305
|
+
* @param assetsByChainId - Allowed assets indexed by chain id.
|
|
2306
|
+
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
2307
|
+
*/
|
|
2308
|
+
declare const token: ({
|
|
2309
|
+
assetsByChainId
|
|
2310
|
+
}: {
|
|
2311
|
+
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
2312
|
+
}) => Rule<Offer, "token">;
|
|
2313
|
+
/**
|
|
2314
|
+
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
2315
|
+
* Returns an issue only for the first non-conforming offer.
|
|
2316
|
+
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
2317
|
+
*/
|
|
2318
|
+
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
2319
|
+
/**
|
|
2320
|
+
* A validation rule that ensures mutual exclusivity of offer amount fields.
|
|
2321
|
+
* At most one of (assets, obligationUnits, obligationShares) can be non-zero.
|
|
2322
|
+
* Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
|
|
2323
|
+
*/
|
|
2324
|
+
declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
|
|
2325
|
+
declare namespace Indexer_d_exports {
|
|
2326
|
+
export { Indexer, IndexerConfig, create$2 as create, from$6 as from };
|
|
2327
|
+
}
|
|
2328
|
+
type Indexer = {
|
|
2329
|
+
start: () => () => void;
|
|
2330
|
+
next: () => Promise<void>;
|
|
2331
|
+
return: () => Promise<void>;
|
|
2332
|
+
};
|
|
2333
|
+
type IndexerConfig<client extends PublicClient<Transport, Chain$1, Account | undefined>> = {
|
|
2334
|
+
client: client;
|
|
2335
|
+
db: Database;
|
|
2336
|
+
gatekeeper: Gatekeeper;
|
|
2337
|
+
interval?: number;
|
|
2338
|
+
maxBatchSize?: number;
|
|
2339
|
+
maxBlockNumber?: number;
|
|
2340
|
+
blockWindow?: number;
|
|
2341
|
+
retryAttempts?: number;
|
|
2342
|
+
retryDelayMs?: number;
|
|
2343
|
+
};
|
|
2344
|
+
declare function from$6<client extends PublicClient<Transport, Chain$1, Account | undefined>>(config: IndexerConfig<client>): Indexer;
|
|
2345
|
+
declare function create$2<client extends PublicClient<Transport, Chain$1, Account | undefined>>(params: {
|
|
2346
|
+
collectors: Collector[];
|
|
2347
|
+
client: client;
|
|
2348
|
+
}): Indexer;
|
|
1975
2349
|
declare namespace Health_d_exports {
|
|
1976
|
-
export { ChainHealth$1 as ChainHealth, CollectorHealth$1 as CollectorHealth, CollectorHealthStatus, HealthService, HealthServiceParameters, RouterStatus, create$1 as create };
|
|
2350
|
+
export { ChainHealth$1 as ChainHealth, CollectorHealth$1 as CollectorHealth, CollectorHealthStatus, HealthService, HealthServiceParameters, MissingCollector, RouterHealth, RouterStatus, create$1 as create };
|
|
1977
2351
|
}
|
|
1978
2352
|
type CollectorHealthStatus = "live" | "lagging" | "unknown";
|
|
1979
2353
|
type RouterStatus = "live" | "syncing";
|
|
@@ -1984,16 +2358,29 @@ type CollectorHealth$1 = {
|
|
|
1984
2358
|
updatedAt: string | null;
|
|
1985
2359
|
lag: number | null;
|
|
1986
2360
|
status: CollectorHealthStatus;
|
|
2361
|
+
initialized: boolean;
|
|
1987
2362
|
};
|
|
1988
2363
|
type ChainHealth$1 = {
|
|
1989
2364
|
chainId: Id;
|
|
1990
|
-
localBlockNumber: number;
|
|
2365
|
+
localBlockNumber: number | null;
|
|
1991
2366
|
remoteBlockNumber: number | null;
|
|
1992
|
-
epoch: string;
|
|
1993
|
-
updatedAt: string;
|
|
2367
|
+
epoch: string | null;
|
|
2368
|
+
updatedAt: string | null;
|
|
2369
|
+
initialized: boolean;
|
|
2370
|
+
};
|
|
2371
|
+
type MissingCollector = {
|
|
2372
|
+
chainId: Id;
|
|
2373
|
+
name: Name;
|
|
2374
|
+
};
|
|
2375
|
+
type RouterHealth = {
|
|
2376
|
+
status: RouterStatus;
|
|
2377
|
+
initialized: boolean;
|
|
2378
|
+
missingChains: Id[];
|
|
2379
|
+
missingCollectors: MissingCollector[];
|
|
1994
2380
|
};
|
|
1995
2381
|
type HealthService = {
|
|
1996
|
-
|
|
2382
|
+
getSnapshot: () => Promise<Snapshot>;
|
|
2383
|
+
getStatus: () => Promise<RouterHealth>;
|
|
1997
2384
|
getCollectors: () => Promise<CollectorHealth$1[]>;
|
|
1998
2385
|
getChains: () => Promise<ChainHealth$1[]>;
|
|
1999
2386
|
};
|
|
@@ -2003,6 +2390,16 @@ type HealthServiceParameters = {
|
|
|
2003
2390
|
maxAllowedLag?: number;
|
|
2004
2391
|
/** Map of chainId to client for fetching remote block numbers. */
|
|
2005
2392
|
healthClients?: Map<Id, Client>;
|
|
2393
|
+
/** Chain registry for deriving expected initialization state. */
|
|
2394
|
+
chainRegistry?: ChainRegistry;
|
|
2395
|
+
};
|
|
2396
|
+
type Snapshot = {
|
|
2397
|
+
status: RouterStatus;
|
|
2398
|
+
initialized: boolean;
|
|
2399
|
+
missingChains: Id[];
|
|
2400
|
+
missingCollectors: MissingCollector[];
|
|
2401
|
+
collectors: CollectorHealth$1[];
|
|
2402
|
+
chains: ChainHealth$1[];
|
|
2006
2403
|
};
|
|
2007
2404
|
/**
|
|
2008
2405
|
* Create a health service that exposes collector and chain block numbers.
|
|
@@ -2017,24 +2414,26 @@ type ApiConfig = {
|
|
|
2017
2414
|
db: Database;
|
|
2018
2415
|
gatekeeper: Gatekeeper;
|
|
2019
2416
|
port: number;
|
|
2417
|
+
chainRegistry: ChainRegistry;
|
|
2020
2418
|
};
|
|
2021
|
-
declare function from$
|
|
2419
|
+
declare function from$5(config: ApiConfig): RouterApi;
|
|
2022
2420
|
type CreateParameters = {
|
|
2023
2421
|
db: Database;
|
|
2024
2422
|
gatekeeper: Gatekeeper;
|
|
2025
2423
|
port: number;
|
|
2424
|
+
chainRegistry: ChainRegistry;
|
|
2026
2425
|
};
|
|
2027
2426
|
declare function create(params: CreateParameters): RouterApi;
|
|
2028
2427
|
declare namespace BookResponse_d_exports {
|
|
2029
|
-
export { BookLevelResponse, from$
|
|
2428
|
+
export { BookLevelResponse, from$4 as from };
|
|
2030
2429
|
}
|
|
2031
2430
|
type BookLevelResponse = {
|
|
2032
|
-
|
|
2431
|
+
price: string;
|
|
2033
2432
|
assets: string;
|
|
2034
2433
|
count: number;
|
|
2035
2434
|
};
|
|
2036
|
-
declare function from$
|
|
2037
|
-
|
|
2435
|
+
declare function from$4(level: {
|
|
2436
|
+
price: bigint;
|
|
2038
2437
|
assets: bigint;
|
|
2039
2438
|
count: number;
|
|
2040
2439
|
}): BookLevelResponse;
|
|
@@ -2051,6 +2450,7 @@ declare const CollectorHealth: z.ZodObject<{
|
|
|
2051
2450
|
live: "live";
|
|
2052
2451
|
lagging: "lagging";
|
|
2053
2452
|
}>;
|
|
2453
|
+
initialized: z.ZodBoolean;
|
|
2054
2454
|
}, z.core.$strip>;
|
|
2055
2455
|
declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
2056
2456
|
name: z.ZodString;
|
|
@@ -2063,24 +2463,33 @@ declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
|
2063
2463
|
live: "live";
|
|
2064
2464
|
lagging: "lagging";
|
|
2065
2465
|
}>;
|
|
2466
|
+
initialized: z.ZodBoolean;
|
|
2066
2467
|
}, z.core.$strip>>;
|
|
2067
2468
|
declare const ChainHealth: z.ZodObject<{
|
|
2068
2469
|
chain_id: z.ZodNumber;
|
|
2069
|
-
local_block_number: z.ZodNumber
|
|
2470
|
+
local_block_number: z.ZodNullable<z.ZodNumber>;
|
|
2070
2471
|
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
2071
|
-
updated_at: z.ZodString
|
|
2472
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
2473
|
+
initialized: z.ZodBoolean;
|
|
2072
2474
|
}, z.core.$strip>;
|
|
2073
2475
|
declare const ChainsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
2074
2476
|
chain_id: z.ZodNumber;
|
|
2075
|
-
local_block_number: z.ZodNumber
|
|
2477
|
+
local_block_number: z.ZodNullable<z.ZodNumber>;
|
|
2076
2478
|
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
2077
|
-
updated_at: z.ZodString
|
|
2479
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
2480
|
+
initialized: z.ZodBoolean;
|
|
2078
2481
|
}, z.core.$strip>>;
|
|
2079
2482
|
declare const RouterStatusResponse: z.ZodObject<{
|
|
2080
2483
|
status: z.ZodEnum<{
|
|
2081
2484
|
live: "live";
|
|
2082
2485
|
syncing: "syncing";
|
|
2083
2486
|
}>;
|
|
2487
|
+
initialized: z.ZodBoolean;
|
|
2488
|
+
missing_chains: z.ZodArray<z.ZodNumber>;
|
|
2489
|
+
missing_collectors: z.ZodArray<z.ZodObject<{
|
|
2490
|
+
chain_id: z.ZodNumber;
|
|
2491
|
+
name: z.ZodString;
|
|
2492
|
+
}, z.core.$strip>>;
|
|
2084
2493
|
}, z.core.$strip>;
|
|
2085
2494
|
type CollectorsHealthResponse = z.infer<typeof CollectorsHealthResponse>;
|
|
2086
2495
|
type ChainsHealthResponse = z.infer<typeof ChainsHealthResponse>;
|
|
@@ -2102,13 +2511,13 @@ interface paths {
|
|
|
2102
2511
|
};
|
|
2103
2512
|
/**
|
|
2104
2513
|
* Get aggregated book
|
|
2105
|
-
* @description Returns aggregated book data for a given obligation and side. Offers are grouped by
|
|
2514
|
+
* @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).
|
|
2106
2515
|
*/
|
|
2107
2516
|
get: {
|
|
2108
2517
|
parameters: {
|
|
2109
2518
|
query?: {
|
|
2110
2519
|
/**
|
|
2111
|
-
* @description Maximum number of
|
|
2520
|
+
* @description Maximum number of price levels to return.
|
|
2112
2521
|
* @example 10
|
|
2113
2522
|
*/
|
|
2114
2523
|
limit?: number;
|
|
@@ -2119,7 +2528,18 @@ interface paths {
|
|
|
2119
2528
|
cursor?: string;
|
|
2120
2529
|
};
|
|
2121
2530
|
header?: never;
|
|
2122
|
-
path
|
|
2531
|
+
path: {
|
|
2532
|
+
/**
|
|
2533
|
+
* @description Book side (buy or sell).
|
|
2534
|
+
* @example buy
|
|
2535
|
+
*/
|
|
2536
|
+
side: "buy" | "sell";
|
|
2537
|
+
/**
|
|
2538
|
+
* @description Obligation id.
|
|
2539
|
+
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
2540
|
+
*/
|
|
2541
|
+
obligationId: string;
|
|
2542
|
+
};
|
|
2123
2543
|
cookie?: never;
|
|
2124
2544
|
};
|
|
2125
2545
|
requestBody?: never;
|
|
@@ -2139,7 +2559,46 @@ interface paths {
|
|
|
2139
2559
|
[name: string]: unknown;
|
|
2140
2560
|
};
|
|
2141
2561
|
content: {
|
|
2142
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2562
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2563
|
+
};
|
|
2564
|
+
};
|
|
2565
|
+
};
|
|
2566
|
+
};
|
|
2567
|
+
put?: never;
|
|
2568
|
+
post?: never;
|
|
2569
|
+
delete?: never;
|
|
2570
|
+
options?: never;
|
|
2571
|
+
head?: never;
|
|
2572
|
+
patch?: never;
|
|
2573
|
+
trace?: never;
|
|
2574
|
+
};
|
|
2575
|
+
"/v1/config": {
|
|
2576
|
+
parameters: {
|
|
2577
|
+
query?: never;
|
|
2578
|
+
header?: never;
|
|
2579
|
+
path?: never;
|
|
2580
|
+
cookie?: never;
|
|
2581
|
+
};
|
|
2582
|
+
/**
|
|
2583
|
+
* Get router configuration
|
|
2584
|
+
* @description Returns chain configurations including contract addresses and supported maturity timestamps.
|
|
2585
|
+
*/
|
|
2586
|
+
get: {
|
|
2587
|
+
parameters: {
|
|
2588
|
+
query?: never;
|
|
2589
|
+
header?: never;
|
|
2590
|
+
path?: never;
|
|
2591
|
+
cookie?: never;
|
|
2592
|
+
};
|
|
2593
|
+
requestBody?: never;
|
|
2594
|
+
responses: {
|
|
2595
|
+
/** @description Success */
|
|
2596
|
+
200: {
|
|
2597
|
+
headers: {
|
|
2598
|
+
[name: string]: unknown;
|
|
2599
|
+
};
|
|
2600
|
+
content: {
|
|
2601
|
+
"application/json": components["schemas"]["ConfigSuccessResponse"];
|
|
2143
2602
|
};
|
|
2144
2603
|
};
|
|
2145
2604
|
};
|
|
@@ -2161,7 +2620,7 @@ interface paths {
|
|
|
2161
2620
|
};
|
|
2162
2621
|
/**
|
|
2163
2622
|
* List all offers
|
|
2164
|
-
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `
|
|
2623
|
+
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `maker` (by maker address).
|
|
2165
2624
|
*/
|
|
2166
2625
|
get: {
|
|
2167
2626
|
parameters: {
|
|
@@ -2180,9 +2639,9 @@ interface paths {
|
|
|
2180
2639
|
* @description Maker address to filter offers by. Alternative to obligation_id + side.
|
|
2181
2640
|
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
2182
2641
|
*/
|
|
2183
|
-
|
|
2642
|
+
maker?: string;
|
|
2184
2643
|
/**
|
|
2185
|
-
* @description Obligation id used to filter offers. Required when not using
|
|
2644
|
+
* @description Obligation id used to filter offers. Required when not using maker.
|
|
2186
2645
|
* @example 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
2187
2646
|
*/
|
|
2188
2647
|
obligation_id?: string;
|
|
@@ -2240,9 +2699,35 @@ interface paths {
|
|
|
2240
2699
|
get: {
|
|
2241
2700
|
parameters: {
|
|
2242
2701
|
query?: {
|
|
2243
|
-
/**
|
|
2702
|
+
/**
|
|
2703
|
+
* @description Filter by exact maturity timestamp (unix seconds).
|
|
2704
|
+
* @example 1761922800
|
|
2705
|
+
*/
|
|
2706
|
+
maturity?: number;
|
|
2707
|
+
/**
|
|
2708
|
+
* @description Filter by collateral token (matches any collateral in the obligation).
|
|
2709
|
+
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
2710
|
+
*/
|
|
2711
|
+
collateral_token?: string;
|
|
2712
|
+
/**
|
|
2713
|
+
* @description Filter by loan token address.
|
|
2714
|
+
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
2715
|
+
*/
|
|
2716
|
+
loan_token?: string;
|
|
2717
|
+
/**
|
|
2718
|
+
* @description Filter by chain ID.
|
|
2719
|
+
* @example 1
|
|
2720
|
+
*/
|
|
2721
|
+
chain?: number;
|
|
2722
|
+
/**
|
|
2723
|
+
* @description Maximum number of obligations to return.
|
|
2724
|
+
* @example 10
|
|
2725
|
+
*/
|
|
2244
2726
|
limit?: number;
|
|
2245
|
-
/**
|
|
2727
|
+
/**
|
|
2728
|
+
* @description Obligation id cursor for pagination.
|
|
2729
|
+
* @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc
|
|
2730
|
+
*/
|
|
2246
2731
|
cursor?: string;
|
|
2247
2732
|
};
|
|
2248
2733
|
header?: never;
|
|
@@ -2294,7 +2779,13 @@ interface paths {
|
|
|
2294
2779
|
parameters: {
|
|
2295
2780
|
query?: never;
|
|
2296
2781
|
header?: never;
|
|
2297
|
-
path
|
|
2782
|
+
path: {
|
|
2783
|
+
/**
|
|
2784
|
+
* @description Obligation id.
|
|
2785
|
+
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
2786
|
+
*/
|
|
2787
|
+
obligationId: string;
|
|
2788
|
+
};
|
|
2298
2789
|
cookie?: never;
|
|
2299
2790
|
};
|
|
2300
2791
|
requestBody?: never;
|
|
@@ -2340,7 +2831,13 @@ interface paths {
|
|
|
2340
2831
|
*/
|
|
2341
2832
|
get: {
|
|
2342
2833
|
parameters: {
|
|
2343
|
-
query?:
|
|
2834
|
+
query?: {
|
|
2835
|
+
/**
|
|
2836
|
+
* @description Fail the request if initialization is incomplete.
|
|
2837
|
+
* @example true
|
|
2838
|
+
*/
|
|
2839
|
+
strict?: boolean;
|
|
2840
|
+
};
|
|
2344
2841
|
header?: never;
|
|
2345
2842
|
path?: never;
|
|
2346
2843
|
cookie?: never;
|
|
@@ -2379,7 +2876,13 @@ interface paths {
|
|
|
2379
2876
|
*/
|
|
2380
2877
|
get: {
|
|
2381
2878
|
parameters: {
|
|
2382
|
-
query?:
|
|
2879
|
+
query?: {
|
|
2880
|
+
/**
|
|
2881
|
+
* @description Fail the request if initialization is incomplete.
|
|
2882
|
+
* @example true
|
|
2883
|
+
*/
|
|
2884
|
+
strict?: boolean;
|
|
2885
|
+
};
|
|
2383
2886
|
header?: never;
|
|
2384
2887
|
path?: never;
|
|
2385
2888
|
cookie?: never;
|
|
@@ -2418,7 +2921,13 @@ interface paths {
|
|
|
2418
2921
|
*/
|
|
2419
2922
|
get: {
|
|
2420
2923
|
parameters: {
|
|
2421
|
-
query?:
|
|
2924
|
+
query?: {
|
|
2925
|
+
/**
|
|
2926
|
+
* @description Fail the request if initialization is incomplete.
|
|
2927
|
+
* @example true
|
|
2928
|
+
*/
|
|
2929
|
+
strict?: boolean;
|
|
2930
|
+
};
|
|
2422
2931
|
header?: never;
|
|
2423
2932
|
path?: never;
|
|
2424
2933
|
cookie?: never;
|
|
@@ -2444,6 +2953,71 @@ interface paths {
|
|
|
2444
2953
|
patch?: never;
|
|
2445
2954
|
trace?: never;
|
|
2446
2955
|
};
|
|
2956
|
+
"/v1/users/{userAddress}/positions": {
|
|
2957
|
+
parameters: {
|
|
2958
|
+
query?: never;
|
|
2959
|
+
header?: never;
|
|
2960
|
+
path?: never;
|
|
2961
|
+
cookie?: never;
|
|
2962
|
+
};
|
|
2963
|
+
/**
|
|
2964
|
+
* Get user positions
|
|
2965
|
+
* @description Returns positions for a user with reserved balance. The reserved balance is the amount locked by active offers (max lot upper - offset - consumed).
|
|
2966
|
+
*/
|
|
2967
|
+
get: {
|
|
2968
|
+
parameters: {
|
|
2969
|
+
query?: {
|
|
2970
|
+
/**
|
|
2971
|
+
* @description Maximum number of positions to return.
|
|
2972
|
+
* @example 10
|
|
2973
|
+
*/
|
|
2974
|
+
limit?: number;
|
|
2975
|
+
/**
|
|
2976
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
2977
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
2978
|
+
*/
|
|
2979
|
+
cursor?: string;
|
|
2980
|
+
};
|
|
2981
|
+
header?: never;
|
|
2982
|
+
path: {
|
|
2983
|
+
/**
|
|
2984
|
+
* @description User address to get positions for.
|
|
2985
|
+
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
2986
|
+
*/
|
|
2987
|
+
userAddress: string;
|
|
2988
|
+
};
|
|
2989
|
+
cookie?: never;
|
|
2990
|
+
};
|
|
2991
|
+
requestBody?: never;
|
|
2992
|
+
responses: {
|
|
2993
|
+
/** @description Success */
|
|
2994
|
+
200: {
|
|
2995
|
+
headers: {
|
|
2996
|
+
[name: string]: unknown;
|
|
2997
|
+
};
|
|
2998
|
+
content: {
|
|
2999
|
+
"application/json": components["schemas"]["PositionListResponse"];
|
|
3000
|
+
};
|
|
3001
|
+
};
|
|
3002
|
+
/** @description Bad Request */
|
|
3003
|
+
400: {
|
|
3004
|
+
headers: {
|
|
3005
|
+
[name: string]: unknown;
|
|
3006
|
+
};
|
|
3007
|
+
content: {
|
|
3008
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3009
|
+
};
|
|
3010
|
+
};
|
|
3011
|
+
};
|
|
3012
|
+
};
|
|
3013
|
+
put?: never;
|
|
3014
|
+
post?: never;
|
|
3015
|
+
delete?: never;
|
|
3016
|
+
options?: never;
|
|
3017
|
+
head?: never;
|
|
3018
|
+
patch?: never;
|
|
3019
|
+
trace?: never;
|
|
3020
|
+
};
|
|
2447
3021
|
"/v1/validate": {
|
|
2448
3022
|
parameters: {
|
|
2449
3023
|
query?: never;
|
|
@@ -2455,14 +3029,16 @@ interface paths {
|
|
|
2455
3029
|
put?: never;
|
|
2456
3030
|
/**
|
|
2457
3031
|
* Validate offers
|
|
2458
|
-
* @description Validates offers against router validation rules. Returns
|
|
3032
|
+
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
2459
3033
|
*
|
|
2460
3034
|
* **Available validation rules:**
|
|
2461
3035
|
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
3036
|
+
* - **mixed_maker**: Validates that all offers in a batch have the same maker address
|
|
3037
|
+
* - **amount_mutual_exclusivity**: Validates that at most one of (assets, obligationUnits, obligationShares) is non-zero
|
|
2462
3038
|
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
2463
3039
|
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
2464
3040
|
* - **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]
|
|
2465
|
-
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list
|
|
3041
|
+
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list for the offer chain
|
|
2466
3042
|
*/
|
|
2467
3043
|
post: {
|
|
2468
3044
|
parameters: {
|
|
@@ -2483,7 +3059,7 @@ interface paths {
|
|
|
2483
3059
|
[name: string]: unknown;
|
|
2484
3060
|
};
|
|
2485
3061
|
content: {
|
|
2486
|
-
"application/json": components["schemas"]["
|
|
3062
|
+
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
2487
3063
|
};
|
|
2488
3064
|
};
|
|
2489
3065
|
/** @description Bad Request */
|
|
@@ -2510,7 +3086,7 @@ interface components {
|
|
|
2510
3086
|
meta: components["schemas"]["Meta"];
|
|
2511
3087
|
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2512
3088
|
cursor: string | null;
|
|
2513
|
-
/** @description Aggregated book levels grouped by
|
|
3089
|
+
/** @description Aggregated book levels grouped by computed price. */
|
|
2514
3090
|
data: components["schemas"]["BookLevelResponse"][];
|
|
2515
3091
|
};
|
|
2516
3092
|
Meta: {
|
|
@@ -2519,7 +3095,7 @@ interface components {
|
|
|
2519
3095
|
};
|
|
2520
3096
|
BookLevelResponse: {
|
|
2521
3097
|
/** @example 2750000000000000000 */
|
|
2522
|
-
|
|
3098
|
+
price: string;
|
|
2523
3099
|
/** @example 369216000000000000000000 */
|
|
2524
3100
|
assets: string;
|
|
2525
3101
|
/** @example 5 */
|
|
@@ -2547,6 +3123,56 @@ interface components {
|
|
|
2547
3123
|
*/
|
|
2548
3124
|
details: Record<string, never>;
|
|
2549
3125
|
};
|
|
3126
|
+
ConfigSuccessResponse: {
|
|
3127
|
+
meta: components["schemas"]["Meta"];
|
|
3128
|
+
/** @example null */
|
|
3129
|
+
cursor: string | null;
|
|
3130
|
+
/**
|
|
3131
|
+
* @description Array of chain configurations for all indexed chains.
|
|
3132
|
+
* @example [
|
|
3133
|
+
* {
|
|
3134
|
+
* "chain_id": 505050505,
|
|
3135
|
+
* "contracts": {
|
|
3136
|
+
* "mempool": "0xD946246695A9259F3B33a78629026F61B3Ab40aF"
|
|
3137
|
+
* },
|
|
3138
|
+
* "maturities": {
|
|
3139
|
+
* "end_of_month": 1738335600,
|
|
3140
|
+
* "end_of_next_month": 1740754800
|
|
3141
|
+
* }
|
|
3142
|
+
* }
|
|
3143
|
+
* ]
|
|
3144
|
+
*/
|
|
3145
|
+
data: components["schemas"]["ConfigDataResponse"][];
|
|
3146
|
+
};
|
|
3147
|
+
ConfigDataResponse: {
|
|
3148
|
+
/** @example 505050505 */
|
|
3149
|
+
chain_id: number;
|
|
3150
|
+
contracts: components["schemas"]["ConfigContractsResponse"];
|
|
3151
|
+
/**
|
|
3152
|
+
* @description Supported maturity timestamps. Offers must use one of these values.
|
|
3153
|
+
* @example {
|
|
3154
|
+
* "end_of_month": 1738335600,
|
|
3155
|
+
* "end_of_next_month": 1740754800
|
|
3156
|
+
* }
|
|
3157
|
+
*/
|
|
3158
|
+
maturities: components["schemas"]["MaturitiesResponse"];
|
|
3159
|
+
};
|
|
3160
|
+
ConfigContractsResponse: {
|
|
3161
|
+
/** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
3162
|
+
mempool: string;
|
|
3163
|
+
};
|
|
3164
|
+
MaturitiesResponse: {
|
|
3165
|
+
/**
|
|
3166
|
+
* @description Unix timestamp for end of current month maturity (last Friday 15:00 UTC).
|
|
3167
|
+
* @example 1738335600
|
|
3168
|
+
*/
|
|
3169
|
+
end_of_month: number;
|
|
3170
|
+
/**
|
|
3171
|
+
* @description Unix timestamp for end of next month maturity (last Friday 15:00 UTC).
|
|
3172
|
+
* @example 1740754800
|
|
3173
|
+
*/
|
|
3174
|
+
end_of_next_month: number;
|
|
3175
|
+
};
|
|
2550
3176
|
OfferListResponse: {
|
|
2551
3177
|
meta: components["schemas"]["Meta"];
|
|
2552
3178
|
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
@@ -2555,103 +3181,164 @@ interface components {
|
|
|
2555
3181
|
* @description Offers matching the provided filters.
|
|
2556
3182
|
* @example [
|
|
2557
3183
|
* {
|
|
2558
|
-
* "
|
|
2559
|
-
*
|
|
2560
|
-
*
|
|
2561
|
-
*
|
|
2562
|
-
*
|
|
2563
|
-
*
|
|
2564
|
-
*
|
|
2565
|
-
*
|
|
2566
|
-
*
|
|
2567
|
-
*
|
|
2568
|
-
*
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2571
|
-
*
|
|
2572
|
-
*
|
|
2573
|
-
*
|
|
2574
|
-
*
|
|
2575
|
-
*
|
|
2576
|
-
*
|
|
2577
|
-
* "
|
|
2578
|
-
* "
|
|
2579
|
-
* "
|
|
3184
|
+
* "offer": {
|
|
3185
|
+
* "obligation": {
|
|
3186
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3187
|
+
* "collaterals": [
|
|
3188
|
+
* {
|
|
3189
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3190
|
+
* "lltv": "860000000000000000",
|
|
3191
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3192
|
+
* }
|
|
3193
|
+
* ],
|
|
3194
|
+
* "maturity": 1761922799
|
|
3195
|
+
* },
|
|
3196
|
+
* "buy": false,
|
|
3197
|
+
* "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
3198
|
+
* "assets": "369216000000000000000000",
|
|
3199
|
+
* "obligation_units": "0",
|
|
3200
|
+
* "obligation_shares": "0",
|
|
3201
|
+
* "start": 1761922790,
|
|
3202
|
+
* "expiry": 1761922799,
|
|
3203
|
+
* "price": "2750000000000000000",
|
|
3204
|
+
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
3205
|
+
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3206
|
+
* "callback": "0x1111111111111111111111111111111111111111",
|
|
3207
|
+
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2580
3208
|
* },
|
|
2581
|
-
* "
|
|
3209
|
+
* "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
3210
|
+
* "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
|
|
3211
|
+
* "chain_id": 1,
|
|
2582
3212
|
* "consumed": "0",
|
|
2583
3213
|
* "takeable": "369216000000000000000000",
|
|
2584
|
-
* "block_number": 2942933377146801
|
|
3214
|
+
* "block_number": 2942933377146801,
|
|
3215
|
+
* "root": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
|
3216
|
+
* "proof": [
|
|
3217
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
3218
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
3219
|
+
* ],
|
|
3220
|
+
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400"
|
|
2585
3221
|
* }
|
|
2586
3222
|
* ]
|
|
2587
3223
|
*/
|
|
2588
3224
|
data: components["schemas"]["OfferListItemResponse"][];
|
|
2589
3225
|
};
|
|
2590
3226
|
OfferListItemResponse: {
|
|
3227
|
+
/**
|
|
3228
|
+
* @example {
|
|
3229
|
+
* "obligation": {
|
|
3230
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3231
|
+
* "collaterals": [
|
|
3232
|
+
* {
|
|
3233
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3234
|
+
* "lltv": "860000000000000000",
|
|
3235
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3236
|
+
* }
|
|
3237
|
+
* ],
|
|
3238
|
+
* "maturity": 1761922799
|
|
3239
|
+
* },
|
|
3240
|
+
* "buy": false,
|
|
3241
|
+
* "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
3242
|
+
* "assets": "369216000000000000000000",
|
|
3243
|
+
* "obligation_units": "0",
|
|
3244
|
+
* "obligation_shares": "0",
|
|
3245
|
+
* "start": 1761922790,
|
|
3246
|
+
* "expiry": 1761922799,
|
|
3247
|
+
* "price": "2750000000000000000",
|
|
3248
|
+
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
3249
|
+
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3250
|
+
* "callback": "0x1111111111111111111111111111111111111111",
|
|
3251
|
+
* "callback_data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
3252
|
+
* }
|
|
3253
|
+
*/
|
|
3254
|
+
offer: components["schemas"]["OfferDataResponse"];
|
|
2591
3255
|
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2592
|
-
|
|
3256
|
+
offer_hash: string;
|
|
3257
|
+
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
3258
|
+
obligation_id: string;
|
|
3259
|
+
/** @example 1 */
|
|
3260
|
+
chain_id: number;
|
|
3261
|
+
/** @example 0 */
|
|
3262
|
+
consumed: string;
|
|
3263
|
+
/** @example 369216000000000000000000 */
|
|
3264
|
+
takeable: string;
|
|
3265
|
+
/** @example 2942933377146801 */
|
|
3266
|
+
block_number: number;
|
|
3267
|
+
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
3268
|
+
root: string | null;
|
|
3269
|
+
/**
|
|
3270
|
+
* @example [
|
|
3271
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
3272
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
3273
|
+
* ]
|
|
3274
|
+
*/
|
|
3275
|
+
proof: string[] | null;
|
|
3276
|
+
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
3277
|
+
signature: string | null;
|
|
3278
|
+
};
|
|
3279
|
+
OfferDataResponse: {
|
|
3280
|
+
/**
|
|
3281
|
+
* @example {
|
|
3282
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3283
|
+
* "collaterals": [
|
|
3284
|
+
* {
|
|
3285
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3286
|
+
* "lltv": "860000000000000000",
|
|
3287
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3288
|
+
* }
|
|
3289
|
+
* ],
|
|
3290
|
+
* "maturity": 1761922799
|
|
3291
|
+
* }
|
|
3292
|
+
*/
|
|
3293
|
+
obligation: components["schemas"]["ObligationOfferResponse"];
|
|
3294
|
+
/** @example false */
|
|
3295
|
+
buy: boolean;
|
|
2593
3296
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2594
|
-
|
|
3297
|
+
maker: string;
|
|
2595
3298
|
/** @example 369216000000000000000000 */
|
|
2596
3299
|
assets: string;
|
|
2597
|
-
/** @example
|
|
2598
|
-
|
|
2599
|
-
/** @example
|
|
2600
|
-
|
|
2601
|
-
/** @example 1761922799 */
|
|
2602
|
-
expiry: number;
|
|
3300
|
+
/** @example 0 */
|
|
3301
|
+
obligation_units: string;
|
|
3302
|
+
/** @example 0 */
|
|
3303
|
+
obligation_shares: string;
|
|
2603
3304
|
/** @example 1761922790 */
|
|
2604
3305
|
start: number;
|
|
2605
|
-
/** @example
|
|
2606
|
-
|
|
2607
|
-
/** @example
|
|
2608
|
-
|
|
2609
|
-
/** @example
|
|
2610
|
-
|
|
3306
|
+
/** @example 1761922799 */
|
|
3307
|
+
expiry: number;
|
|
3308
|
+
/** @example 2750000000000000000 */
|
|
3309
|
+
price: string;
|
|
3310
|
+
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
3311
|
+
group: string;
|
|
3312
|
+
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
3313
|
+
session: string;
|
|
3314
|
+
/** @example 0x1111111111111111111111111111111111111111 */
|
|
3315
|
+
callback: string;
|
|
3316
|
+
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
3317
|
+
callback_data: string;
|
|
3318
|
+
};
|
|
3319
|
+
ObligationOfferResponse: {
|
|
2611
3320
|
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2612
3321
|
loan_token: string;
|
|
2613
3322
|
/**
|
|
2614
3323
|
* @example [
|
|
2615
3324
|
* {
|
|
2616
|
-
* "
|
|
2617
|
-
* "
|
|
2618
|
-
* "
|
|
3325
|
+
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3326
|
+
* "lltv": "860000000000000000",
|
|
3327
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
2619
3328
|
* }
|
|
2620
3329
|
* ]
|
|
2621
3330
|
*/
|
|
2622
3331
|
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2623
|
-
/**
|
|
2624
|
-
|
|
2625
|
-
* "address": "0x1111111111111111111111111111111111111111",
|
|
2626
|
-
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2627
|
-
* "gas_limit": "500000"
|
|
2628
|
-
* }
|
|
2629
|
-
*/
|
|
2630
|
-
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2631
|
-
/** @example 369216000000000000000000 */
|
|
2632
|
-
takeable: string;
|
|
2633
|
-
/** @example 0 */
|
|
2634
|
-
consumed: string;
|
|
2635
|
-
/** @example 2942933377146801 */
|
|
2636
|
-
block_number: number;
|
|
2637
|
-
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2638
|
-
signature: string | null;
|
|
3332
|
+
/** @example 1761922799 */
|
|
3333
|
+
maturity: number;
|
|
2639
3334
|
};
|
|
2640
3335
|
CollateralResponse: {
|
|
2641
3336
|
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2642
|
-
|
|
2643
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2644
|
-
oracle: string;
|
|
3337
|
+
token: string;
|
|
2645
3338
|
/** @example 860000000000000000 */
|
|
2646
3339
|
lltv: string;
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2650
|
-
address: string;
|
|
2651
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2652
|
-
data: string;
|
|
2653
|
-
/** @example 500000 */
|
|
2654
|
-
gas_limit: string;
|
|
3340
|
+
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3341
|
+
oracle: string;
|
|
2655
3342
|
};
|
|
2656
3343
|
ObligationListResponse: {
|
|
2657
3344
|
meta: components["schemas"]["Meta"];
|
|
@@ -2675,11 +3362,11 @@ interface components {
|
|
|
2675
3362
|
};
|
|
2676
3363
|
AskResponse: {
|
|
2677
3364
|
/** @example 1000000000000000000 */
|
|
2678
|
-
|
|
3365
|
+
price: string;
|
|
2679
3366
|
};
|
|
2680
3367
|
BidResponse: {
|
|
2681
3368
|
/** @example 1000000000000000000 */
|
|
2682
|
-
|
|
3369
|
+
price: string;
|
|
2683
3370
|
};
|
|
2684
3371
|
ObligationSingleSuccessResponse: {
|
|
2685
3372
|
meta: components["schemas"]["Meta"];
|
|
@@ -2693,7 +3380,10 @@ interface components {
|
|
|
2693
3380
|
/**
|
|
2694
3381
|
* @description Aggregated router status.
|
|
2695
3382
|
* @example {
|
|
2696
|
-
* "status": "live"
|
|
3383
|
+
* "status": "live",
|
|
3384
|
+
* "initialized": true,
|
|
3385
|
+
* "missing_chains": [],
|
|
3386
|
+
* "missing_collectors": []
|
|
2697
3387
|
* }
|
|
2698
3388
|
*/
|
|
2699
3389
|
data: components["schemas"]["RouterStatusDataResponse"];
|
|
@@ -2704,6 +3394,24 @@ interface components {
|
|
|
2704
3394
|
* @enum {string}
|
|
2705
3395
|
*/
|
|
2706
3396
|
status: "live" | "syncing";
|
|
3397
|
+
/** @example true */
|
|
3398
|
+
initialized: boolean;
|
|
3399
|
+
/**
|
|
3400
|
+
* @description Configured chain ids missing initialization rows.
|
|
3401
|
+
* @example []
|
|
3402
|
+
*/
|
|
3403
|
+
missing_chains: number[];
|
|
3404
|
+
/**
|
|
3405
|
+
* @description Collectors missing initialization rows.
|
|
3406
|
+
* @example []
|
|
3407
|
+
*/
|
|
3408
|
+
missing_collectors: components["schemas"]["MissingCollectorResponse"][];
|
|
3409
|
+
};
|
|
3410
|
+
MissingCollectorResponse: {
|
|
3411
|
+
/** @example 1 */
|
|
3412
|
+
chain_id: number;
|
|
3413
|
+
/** @example offers */
|
|
3414
|
+
name: string;
|
|
2707
3415
|
};
|
|
2708
3416
|
CollectorsHealthSuccessResponse: {
|
|
2709
3417
|
meta: components["schemas"]["Meta"];
|
|
@@ -2716,7 +3424,8 @@ interface components {
|
|
|
2716
3424
|
* "block_number": 21345678,
|
|
2717
3425
|
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
2718
3426
|
* "lag": 0,
|
|
2719
|
-
* "status": "live"
|
|
3427
|
+
* "status": "live",
|
|
3428
|
+
* "initialized": true
|
|
2720
3429
|
* }
|
|
2721
3430
|
* ]
|
|
2722
3431
|
*/
|
|
@@ -2738,6 +3447,8 @@ interface components {
|
|
|
2738
3447
|
* @enum {string}
|
|
2739
3448
|
*/
|
|
2740
3449
|
status: "live" | "lagging" | "unknown";
|
|
3450
|
+
/** @example true */
|
|
3451
|
+
initialized: boolean;
|
|
2741
3452
|
};
|
|
2742
3453
|
ChainsHealthSuccessResponse: {
|
|
2743
3454
|
meta: components["schemas"]["Meta"];
|
|
@@ -2748,7 +3459,8 @@ interface components {
|
|
|
2748
3459
|
* "chain_id": 1,
|
|
2749
3460
|
* "local_block_number": 21345678,
|
|
2750
3461
|
* "remote_block_number": 21345690,
|
|
2751
|
-
* "updated_at": "2024-01-01T12:00:00.000Z"
|
|
3462
|
+
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
3463
|
+
* "initialized": true
|
|
2752
3464
|
* }
|
|
2753
3465
|
* ]
|
|
2754
3466
|
*/
|
|
@@ -2758,36 +3470,69 @@ interface components {
|
|
|
2758
3470
|
/** @example 1 */
|
|
2759
3471
|
chain_id: number;
|
|
2760
3472
|
/** @example 21345678 */
|
|
2761
|
-
local_block_number: number;
|
|
3473
|
+
local_block_number: number | null;
|
|
2762
3474
|
/** @example 21345690 */
|
|
2763
3475
|
remote_block_number: number | null;
|
|
2764
3476
|
/** @example 2024-01-01T12:00:00.000Z */
|
|
2765
|
-
updated_at: string;
|
|
3477
|
+
updated_at: string | null;
|
|
3478
|
+
/** @example true */
|
|
3479
|
+
initialized: boolean;
|
|
2766
3480
|
};
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
3481
|
+
PositionListResponse: {
|
|
3482
|
+
meta: components["schemas"]["Meta"];
|
|
3483
|
+
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
3484
|
+
cursor: string | null;
|
|
2770
3485
|
/**
|
|
2771
|
-
* @description
|
|
2772
|
-
* @example
|
|
3486
|
+
* @description User positions with reserved balances from active offers.
|
|
3487
|
+
* @example [
|
|
3488
|
+
* {
|
|
3489
|
+
* "chain_id": 1,
|
|
3490
|
+
* "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3491
|
+
* "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
3492
|
+
* "reserved": "200000000000000000000",
|
|
3493
|
+
* "block_number": 21345678
|
|
3494
|
+
* }
|
|
3495
|
+
* ]
|
|
2773
3496
|
*/
|
|
2774
|
-
|
|
3497
|
+
data: components["schemas"]["PositionListItemResponse"][];
|
|
3498
|
+
};
|
|
3499
|
+
PositionListItemResponse: {
|
|
3500
|
+
/** @example 1 */
|
|
3501
|
+
chain_id: number;
|
|
3502
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
3503
|
+
contract: string;
|
|
3504
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3505
|
+
user: string;
|
|
3506
|
+
/** @example 200000000000000000000 */
|
|
3507
|
+
reserved: string;
|
|
3508
|
+
/** @example 21345678 */
|
|
3509
|
+
block_number: number;
|
|
3510
|
+
};
|
|
3511
|
+
ValidateOffersRequest: {
|
|
3512
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
3513
|
+
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2775
3514
|
};
|
|
2776
3515
|
ValidateOfferRequest: {
|
|
2777
3516
|
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2778
|
-
|
|
3517
|
+
maker: string;
|
|
2779
3518
|
/** @example 369216000000000000000000 */
|
|
2780
3519
|
assets: string;
|
|
3520
|
+
/** @example 0 */
|
|
3521
|
+
obligation_units?: string;
|
|
3522
|
+
/** @example 0 */
|
|
3523
|
+
obligation_shares?: string;
|
|
2781
3524
|
/** @example 2750000000000000000 */
|
|
2782
|
-
|
|
3525
|
+
price: string;
|
|
2783
3526
|
/** @example 1761922799 */
|
|
2784
3527
|
maturity: number;
|
|
2785
3528
|
/** @example 1761922799 */
|
|
2786
3529
|
expiry: number;
|
|
2787
3530
|
/** @example 1761922790 */
|
|
2788
3531
|
start: number;
|
|
2789
|
-
/** @example
|
|
2790
|
-
|
|
3532
|
+
/** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
3533
|
+
group: string;
|
|
3534
|
+
/** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
3535
|
+
session: string;
|
|
2791
3536
|
/** @example false */
|
|
2792
3537
|
buy: boolean;
|
|
2793
3538
|
/** @example 1 */
|
|
@@ -2803,32 +3548,47 @@ interface components {
|
|
|
2803
3548
|
* }
|
|
2804
3549
|
* ]
|
|
2805
3550
|
*/
|
|
2806
|
-
collaterals: components["schemas"]["
|
|
3551
|
+
collaterals: components["schemas"]["ValidateCollateralRequest"][];
|
|
2807
3552
|
/**
|
|
2808
3553
|
* @example {
|
|
2809
3554
|
* "address": "0x1111111111111111111111111111111111111111",
|
|
2810
|
-
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2811
|
-
* "gas_limit": "500000"
|
|
3555
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000"
|
|
2812
3556
|
* }
|
|
2813
3557
|
*/
|
|
2814
|
-
callback: components["schemas"]["
|
|
3558
|
+
callback: components["schemas"]["ValidateCallbackRequest"];
|
|
3559
|
+
};
|
|
3560
|
+
ValidateCollateralRequest: {
|
|
3561
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
3562
|
+
asset: string;
|
|
3563
|
+
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3564
|
+
oracle: string;
|
|
3565
|
+
/** @example 860000000000000000 */
|
|
3566
|
+
lltv: string;
|
|
3567
|
+
};
|
|
3568
|
+
ValidateCallbackRequest: {
|
|
3569
|
+
/** @example 0x1111111111111111111111111111111111111111 */
|
|
3570
|
+
address: string;
|
|
3571
|
+
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
3572
|
+
data: string;
|
|
2815
3573
|
};
|
|
2816
|
-
|
|
3574
|
+
ValidationSuccessResponse: {
|
|
2817
3575
|
meta: components["schemas"]["Meta"];
|
|
2818
3576
|
/** @example null */
|
|
2819
3577
|
cursor: string | null;
|
|
2820
|
-
/** @description
|
|
2821
|
-
data: components["schemas"]["
|
|
3578
|
+
/** @description Payload and root for client-side signing. */
|
|
3579
|
+
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2822
3580
|
};
|
|
2823
|
-
|
|
2824
|
-
/**
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
3581
|
+
ValidationSuccessDataResponse: {
|
|
3582
|
+
/**
|
|
3583
|
+
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
3584
|
+
* @example 0x01789c...
|
|
3585
|
+
*/
|
|
3586
|
+
payload: string;
|
|
3587
|
+
/**
|
|
3588
|
+
* @description Merkle tree root to sign with EIP-191.
|
|
3589
|
+
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
3590
|
+
*/
|
|
3591
|
+
root: string;
|
|
2832
3592
|
};
|
|
2833
3593
|
};
|
|
2834
3594
|
responses: never;
|
|
@@ -2838,7 +3598,7 @@ interface components {
|
|
|
2838
3598
|
pathItems: never;
|
|
2839
3599
|
}
|
|
2840
3600
|
declare namespace ObligationResponse_d_exports {
|
|
2841
|
-
export { ObligationResponse, from$
|
|
3601
|
+
export { ObligationResponse, from$3 as from };
|
|
2842
3602
|
}
|
|
2843
3603
|
type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
2844
3604
|
/**
|
|
@@ -2847,18 +3607,49 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
|
|
|
2847
3607
|
* @param obligation - {@link Obligation}
|
|
2848
3608
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
2849
3609
|
*/
|
|
2850
|
-
declare function from$
|
|
3610
|
+
declare function from$3(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
2851
3611
|
declare namespace OfferResponse_d_exports {
|
|
2852
|
-
export { OfferResponse, from$
|
|
3612
|
+
export { Input, OfferResponse, from$2 as from };
|
|
2853
3613
|
}
|
|
2854
3614
|
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
3615
|
+
type Input = Readonly<{
|
|
3616
|
+
hash: Hex;
|
|
3617
|
+
maker: Address;
|
|
3618
|
+
assets: bigint;
|
|
3619
|
+
obligationUnits: bigint;
|
|
3620
|
+
obligationShares: bigint;
|
|
3621
|
+
price: bigint;
|
|
3622
|
+
maturity: number;
|
|
3623
|
+
expiry: number;
|
|
3624
|
+
start: number;
|
|
3625
|
+
group: Hex;
|
|
3626
|
+
session: Hex;
|
|
3627
|
+
buy: boolean;
|
|
3628
|
+
chainId: number;
|
|
3629
|
+
loanToken: Address;
|
|
3630
|
+
collaterals: Readonly<{
|
|
3631
|
+
asset: Address;
|
|
3632
|
+
lltv: bigint;
|
|
3633
|
+
oracle: Address;
|
|
3634
|
+
}[]>;
|
|
3635
|
+
callback: {
|
|
3636
|
+
address: Address;
|
|
3637
|
+
data: Hex;
|
|
3638
|
+
};
|
|
3639
|
+
root?: Hex | undefined;
|
|
3640
|
+
proof?: Hex[] | undefined;
|
|
3641
|
+
signature?: Hex | undefined;
|
|
3642
|
+
consumed: bigint;
|
|
3643
|
+
takeable: bigint;
|
|
3644
|
+
blockNumber: number;
|
|
3645
|
+
}>;
|
|
2855
3646
|
/**
|
|
2856
|
-
* Creates an `OfferResponse`
|
|
3647
|
+
* Creates an `OfferResponse` matching the Solidity Offer struct layout.
|
|
2857
3648
|
* @constructor
|
|
2858
|
-
* @param
|
|
3649
|
+
* @param input - {@link Input}
|
|
2859
3650
|
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
2860
3651
|
*/
|
|
2861
|
-
declare function from$
|
|
3652
|
+
declare function from$2(input: Input): OfferResponse;
|
|
2862
3653
|
//#endregion
|
|
2863
3654
|
//#region src/api/Schema/openapi.d.ts
|
|
2864
3655
|
declare class BooksController {
|
|
@@ -2875,10 +3666,16 @@ declare class HealthController {
|
|
|
2875
3666
|
getCollectorsHealth(): Promise<void>;
|
|
2876
3667
|
getChainsHealth(): Promise<void>;
|
|
2877
3668
|
}
|
|
3669
|
+
declare class ConfigController {
|
|
3670
|
+
getConfig(): Promise<void>;
|
|
3671
|
+
}
|
|
2878
3672
|
declare class ObligationsController {
|
|
2879
3673
|
getObligations(): Promise<void>;
|
|
2880
3674
|
getObligation(): Promise<void>;
|
|
2881
3675
|
}
|
|
3676
|
+
declare class UsersController {
|
|
3677
|
+
getUserPositions(): Promise<void>;
|
|
3678
|
+
}
|
|
2882
3679
|
type RuleInfo = {
|
|
2883
3680
|
name: string;
|
|
2884
3681
|
description: string;
|
|
@@ -2887,21 +3684,66 @@ type OpenApiOptions = {
|
|
|
2887
3684
|
rules?: RuleInfo[];
|
|
2888
3685
|
};
|
|
2889
3686
|
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
3687
|
+
declare namespace PositionResponse_d_exports {
|
|
3688
|
+
export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
|
|
3689
|
+
}
|
|
3690
|
+
type PositionResponse = {
|
|
3691
|
+
chain_id: Id;
|
|
3692
|
+
contract: Address;
|
|
3693
|
+
user: Address;
|
|
3694
|
+
reserved: string;
|
|
3695
|
+
block_number: number;
|
|
3696
|
+
};
|
|
3697
|
+
type PositionWithReserved$1 = getByUser.PositionWithReserved;
|
|
3698
|
+
/**
|
|
3699
|
+
* Creates a `PositionResponse` from a `PositionWithReserved`.
|
|
3700
|
+
* @param position - {@link PositionWithReserved}
|
|
3701
|
+
* @returns The created `PositionResponse`. {@link PositionResponse}
|
|
3702
|
+
*/
|
|
3703
|
+
declare function from$1(position: PositionWithReserved$1): PositionResponse;
|
|
2890
3704
|
//#endregion
|
|
2891
3705
|
//#region src/api/Schema/requests.d.ts
|
|
2892
3706
|
declare const schemas: {
|
|
3707
|
+
readonly get_health: z$1.ZodObject<{
|
|
3708
|
+
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
3709
|
+
0: "0";
|
|
3710
|
+
1: "1";
|
|
3711
|
+
true: "true";
|
|
3712
|
+
false: "false";
|
|
3713
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
3714
|
+
}, z$1.core.$strip>;
|
|
3715
|
+
readonly get_health_collectors: z$1.ZodObject<{
|
|
3716
|
+
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
3717
|
+
0: "0";
|
|
3718
|
+
1: "1";
|
|
3719
|
+
true: "true";
|
|
3720
|
+
false: "false";
|
|
3721
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
3722
|
+
}, z$1.core.$strip>;
|
|
3723
|
+
readonly get_health_chains: z$1.ZodObject<{
|
|
3724
|
+
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
3725
|
+
0: "0";
|
|
3726
|
+
1: "1";
|
|
3727
|
+
true: "true";
|
|
3728
|
+
false: "false";
|
|
3729
|
+
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
3730
|
+
}, z$1.core.$strip>;
|
|
2893
3731
|
readonly get_offers: z$1.ZodObject<{
|
|
2894
3732
|
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2895
3733
|
buy: "buy";
|
|
2896
3734
|
sell: "sell";
|
|
2897
3735
|
}>>;
|
|
2898
3736
|
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2899
|
-
|
|
3737
|
+
maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2900
3738
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2901
3739
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2902
3740
|
}, z$1.core.$strip>;
|
|
2903
3741
|
readonly get_obligations: z$1.ZodObject<{
|
|
2904
3742
|
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3743
|
+
chain: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
|
|
3744
|
+
loan_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3745
|
+
collateral_token: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
3746
|
+
maturity: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>;
|
|
2905
3747
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2906
3748
|
}, z$1.core.$strip>;
|
|
2907
3749
|
readonly get_obligation: z$1.ZodObject<{
|
|
@@ -2917,8 +3759,12 @@ declare const schemas: {
|
|
|
2917
3759
|
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2918
3760
|
}, z$1.core.$strip>;
|
|
2919
3761
|
readonly validate_offers: z$1.ZodObject<{
|
|
2920
|
-
offers: z$1.
|
|
2921
|
-
|
|
3762
|
+
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
3763
|
+
}, z$1.core.$strict>;
|
|
3764
|
+
readonly get_user_positions: z$1.ZodObject<{
|
|
3765
|
+
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
3766
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
3767
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2922
3768
|
}, z$1.core.$strip>;
|
|
2923
3769
|
};
|
|
2924
3770
|
type Action = keyof typeof schemas;
|
|
@@ -2962,6 +3808,25 @@ type Payload<T> = SuccessPayload<T> | ErrorPayload;
|
|
|
2962
3808
|
//#region src/api/Controllers/getBook.d.ts
|
|
2963
3809
|
declare function getBook(params: object, db: Database): Promise<Payload<BookLevelResponse[]>>;
|
|
2964
3810
|
//#endregion
|
|
3811
|
+
//#region src/api/Controllers/getConfig.d.ts
|
|
3812
|
+
type MaturitiesConfig = {
|
|
3813
|
+
end_of_month: number;
|
|
3814
|
+
end_of_next_month: number;
|
|
3815
|
+
};
|
|
3816
|
+
type ChainConfig = {
|
|
3817
|
+
chain_id: Id;
|
|
3818
|
+
contracts: {
|
|
3819
|
+
mempool: string;
|
|
3820
|
+
};
|
|
3821
|
+
maturities: MaturitiesConfig;
|
|
3822
|
+
};
|
|
3823
|
+
/**
|
|
3824
|
+
* Returns the configuration for all chains the router is indexing.
|
|
3825
|
+
* @param chainRegistry - The chain registry instance. {@link ChainRegistry.ChainRegistry}
|
|
3826
|
+
* @returns The configuration for all chains the router is indexing. {@link ApiPayload.Payload<ChainConfig[]>}
|
|
3827
|
+
*/
|
|
3828
|
+
declare function getConfig(chainRegistry: ChainRegistry): Promise<Payload<ChainConfig[]>>;
|
|
3829
|
+
//#endregion
|
|
2965
3830
|
//#region src/api/Controllers/getDocs.d.ts
|
|
2966
3831
|
declare function getSwaggerJson({
|
|
2967
3832
|
gatekeeper
|
|
@@ -2973,11 +3838,16 @@ declare function getDocsHtml({
|
|
|
2973
3838
|
}: {
|
|
2974
3839
|
gatekeeper: Gatekeeper;
|
|
2975
3840
|
}): Promise<string>;
|
|
3841
|
+
/**
|
|
3842
|
+
* Renders the integrator documentation as HTML.
|
|
3843
|
+
* @returns HTML page with the rendered markdown documentation.
|
|
3844
|
+
*/
|
|
3845
|
+
declare function getIntegratorDocsHtml(): Promise<string>;
|
|
2976
3846
|
//#endregion
|
|
2977
3847
|
//#region src/api/Controllers/getHealth.d.ts
|
|
2978
|
-
declare function getHealth(db: Database): Promise<Payload<paths["/v1/health"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
|
|
2979
|
-
declare function getHealthChains(db: Database, healthClients?: Map<Id, Client
|
|
2980
|
-
declare function getHealthCollectors(db: Database): Promise<Payload<paths["/v1/health/collectors"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
|
|
3848
|
+
declare function getHealth(query: unknown, db: Database, chainRegistry?: ChainRegistry): Promise<Payload<paths["/v1/health"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
|
|
3849
|
+
declare function getHealthChains(query: unknown, db: Database, healthClients?: Map<Id, Client>, chainRegistry?: ChainRegistry): Promise<Payload<paths["/v1/health/chains"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
|
|
3850
|
+
declare function getHealthCollectors(query: unknown, db: Database, chainRegistry?: ChainRegistry): Promise<Payload<paths["/v1/health/collectors"]["get"]["responses"]["200"]["content"]["application/json"]["data"]>>;
|
|
2981
3851
|
//#endregion
|
|
2982
3852
|
//#region src/api/Controllers/getObligation.d.ts
|
|
2983
3853
|
declare function getObligation(params: object, db: Database): Promise<Payload<ObligationResponse>>;
|
|
@@ -2988,22 +3858,35 @@ declare function getObligations$1(queryParameters: object, db: Database): Promis
|
|
|
2988
3858
|
//#region src/api/Controllers/getOffers.d.ts
|
|
2989
3859
|
declare function getOffers$1(queryParameters: object, db: Database): Promise<Payload<OfferResponse[]>>;
|
|
2990
3860
|
//#endregion
|
|
3861
|
+
//#region src/api/Controllers/getUserPositions.d.ts
|
|
3862
|
+
/**
|
|
3863
|
+
* Get positions for a user with remaining balance calculation.
|
|
3864
|
+
* @param queryParameters - Request parameters including user address and pagination.
|
|
3865
|
+
* @param db - Database instance.
|
|
3866
|
+
* @returns Paginated list of positions with remaining balances.
|
|
3867
|
+
*/
|
|
3868
|
+
declare function getUserPositions(queryParameters: object, db: Database): Promise<Payload<PositionResponse[]>>;
|
|
3869
|
+
//#endregion
|
|
2991
3870
|
//#region src/api/Controllers/validateOffers.d.ts
|
|
2992
|
-
type
|
|
2993
|
-
|
|
2994
|
-
valid: true;
|
|
2995
|
-
} | {
|
|
2996
|
-
offer_hash: Hex;
|
|
2997
|
-
valid: false;
|
|
3871
|
+
type ValidationIssue = {
|
|
3872
|
+
index: number;
|
|
2998
3873
|
rule: string;
|
|
2999
3874
|
message: string;
|
|
3000
3875
|
};
|
|
3001
|
-
|
|
3876
|
+
type ValidateOffersSuccessPayload = SuccessPayload<{
|
|
3877
|
+
payload: Hex;
|
|
3878
|
+
root: Hex;
|
|
3879
|
+
}>;
|
|
3880
|
+
type ValidateOffersIssuesPayload = SuccessPayload<{
|
|
3881
|
+
issues: ValidationIssue[];
|
|
3882
|
+
}>;
|
|
3883
|
+
type ValidateOffersResponse = ValidateOffersSuccessPayload | ValidateOffersIssuesPayload;
|
|
3884
|
+
declare function validateOffers(body: object, gatekeeper: Gatekeeper): Promise<ValidateOffersResponse | ErrorPayload>;
|
|
3002
3885
|
declare namespace index_d_exports$4 {
|
|
3003
|
-
export {
|
|
3886
|
+
export { ChainConfig, MaturitiesConfig, ValidationIssue, getBook, getConfig, getDocsHtml, getHealth, getHealthChains, getHealthCollectors, getIntegratorDocsHtml, getObligation, getObligations$1 as getObligations, getOffers$1 as getOffers, getSwaggerJson, getUserPositions, validateOffers };
|
|
3004
3887
|
}
|
|
3005
3888
|
declare namespace RouterApi_d_exports {
|
|
3006
|
-
export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, RouterApi, RouterStatusResponse, RuleInfo, ValidateController, create, from$
|
|
3889
|
+
export { ApiConfig, BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigController, index_d_exports$4 as Controllers, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, PositionResponse_d_exports as PositionResponse, RouterApi, RouterStatusResponse, RuleInfo, UsersController, ValidateController, create, from$5 as from, parse, safeParse };
|
|
3007
3890
|
}
|
|
3008
3891
|
declare namespace Client_d_exports {
|
|
3009
3892
|
export { Client$3 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
@@ -3084,7 +3967,19 @@ declare namespace getOffers {
|
|
|
3084
3967
|
limit?: number;
|
|
3085
3968
|
};
|
|
3086
3969
|
type ReturnType = {
|
|
3087
|
-
offers: Offer
|
|
3970
|
+
offers: Compute<Offer & {
|
|
3971
|
+
hash: Hex;
|
|
3972
|
+
blockNumber: number;
|
|
3973
|
+
consumed: bigint;
|
|
3974
|
+
takeable: bigint;
|
|
3975
|
+
} & {
|
|
3976
|
+
/** 32-byte merkle root. */
|
|
3977
|
+
root?: Hex;
|
|
3978
|
+
/** Sibling hashes for the merkle proof. */
|
|
3979
|
+
proof?: Hex[];
|
|
3980
|
+
/** Offer signature from the Merkle tree. */
|
|
3981
|
+
signature?: Hex;
|
|
3982
|
+
}>[];
|
|
3088
3983
|
/** The pagination cursor. */
|
|
3089
3984
|
cursor: string | null;
|
|
3090
3985
|
};
|
|
@@ -3097,6 +3992,14 @@ declare namespace getObligations {
|
|
|
3097
3992
|
cursor?: Hex;
|
|
3098
3993
|
/** Maximum number of obligations to return. @default 20 */
|
|
3099
3994
|
limit?: number;
|
|
3995
|
+
/** Filter by chain ID. */
|
|
3996
|
+
chainId?: number;
|
|
3997
|
+
/** Filter by loan token address. */
|
|
3998
|
+
loanToken?: Address;
|
|
3999
|
+
/** Filter by collateral token (matches any collateral in the obligation). */
|
|
4000
|
+
collateralToken?: Address;
|
|
4001
|
+
/** Filter by exact maturity timestamp (unix seconds). */
|
|
4002
|
+
maturity?: number;
|
|
3100
4003
|
};
|
|
3101
4004
|
type ReturnType = {
|
|
3102
4005
|
obligations: Compute<{
|
|
@@ -3152,9 +4055,13 @@ declare enum EnumTableName {
|
|
|
3152
4055
|
VALIDATIONS = "validations",
|
|
3153
4056
|
COLLECTORS = "collectors",
|
|
3154
4057
|
CHAINS = "chains",
|
|
4058
|
+
LOTS = "lots",
|
|
4059
|
+
OFFSETS = "offsets",
|
|
4060
|
+
TREES = "trees",
|
|
4061
|
+
MERKLE_PATHS = "merkle_paths",
|
|
3155
4062
|
}
|
|
3156
4063
|
declare const TABLE_NAMES: readonly EnumTableName[];
|
|
3157
|
-
declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"")[];
|
|
4064
|
+
declare const VERSIONED_TABLE_NAMES: ("\"router_v1.6\".\"obligations\"" | "\"router_v1.6\".\"groups\"" | "\"router_v1.6\".\"consumed_events\"" | "\"router_v1.6\".\"obligation_collaterals_v2\"" | "\"router_v1.6\".\"oracles\"" | "\"router_v1.6\".\"offers\"" | "\"router_v1.6\".\"offers_callbacks\"" | "\"router_v1.6\".\"callbacks\"" | "\"router_v1.6\".\"positions\"" | "\"router_v1.6\".\"transfers\"" | "\"router_v1.6\".\"validations\"" | "\"router_v1.6\".\"collectors\"" | "\"router_v1.6\".\"chains\"" | "\"router_v1.6\".\"lots\"" | "\"router_v1.6\".\"offsets\"" | "\"router_v1.6\".\"trees\"" | "\"router_v1.6\".\"merkle_paths\"")[];
|
|
3158
4065
|
type TableName = (typeof TABLE_NAMES)[number];
|
|
3159
4066
|
type VersionedTableName = `"${typeof VERSION}"."${TableName}"`;
|
|
3160
4067
|
declare const obligations: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
@@ -3776,8 +4683,42 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
3776
4683
|
identity: undefined;
|
|
3777
4684
|
generated: undefined;
|
|
3778
4685
|
}, {}, {}>;
|
|
3779
|
-
|
|
3780
|
-
name: "
|
|
4686
|
+
obligationUnits: drizzle_orm_pg_core0.PgColumn<{
|
|
4687
|
+
name: "obligation_units";
|
|
4688
|
+
tableName: EnumTableName.OFFERS;
|
|
4689
|
+
dataType: "string";
|
|
4690
|
+
columnType: "PgNumeric";
|
|
4691
|
+
data: string;
|
|
4692
|
+
driverParam: string;
|
|
4693
|
+
notNull: true;
|
|
4694
|
+
hasDefault: true;
|
|
4695
|
+
isPrimaryKey: false;
|
|
4696
|
+
isAutoincrement: false;
|
|
4697
|
+
hasRuntimeDefault: false;
|
|
4698
|
+
enumValues: undefined;
|
|
4699
|
+
baseColumn: never;
|
|
4700
|
+
identity: undefined;
|
|
4701
|
+
generated: undefined;
|
|
4702
|
+
}, {}, {}>;
|
|
4703
|
+
obligationShares: drizzle_orm_pg_core0.PgColumn<{
|
|
4704
|
+
name: "obligation_shares";
|
|
4705
|
+
tableName: EnumTableName.OFFERS;
|
|
4706
|
+
dataType: "string";
|
|
4707
|
+
columnType: "PgNumeric";
|
|
4708
|
+
data: string;
|
|
4709
|
+
driverParam: string;
|
|
4710
|
+
notNull: true;
|
|
4711
|
+
hasDefault: true;
|
|
4712
|
+
isPrimaryKey: false;
|
|
4713
|
+
isAutoincrement: false;
|
|
4714
|
+
hasRuntimeDefault: false;
|
|
4715
|
+
enumValues: undefined;
|
|
4716
|
+
baseColumn: never;
|
|
4717
|
+
identity: undefined;
|
|
4718
|
+
generated: undefined;
|
|
4719
|
+
}, {}, {}>;
|
|
4720
|
+
price: drizzle_orm_pg_core0.PgColumn<{
|
|
4721
|
+
name: "price";
|
|
3781
4722
|
tableName: EnumTableName.OFFERS;
|
|
3782
4723
|
dataType: "string";
|
|
3783
4724
|
columnType: "PgNumeric";
|
|
@@ -3901,8 +4842,8 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
3901
4842
|
}, {}, {
|
|
3902
4843
|
length: 66;
|
|
3903
4844
|
}>;
|
|
3904
|
-
|
|
3905
|
-
name: "
|
|
4845
|
+
session: drizzle_orm_pg_core0.PgColumn<{
|
|
4846
|
+
name: "session";
|
|
3906
4847
|
tableName: EnumTableName.OFFERS;
|
|
3907
4848
|
dataType: "string";
|
|
3908
4849
|
columnType: "PgVarchar";
|
|
@@ -3998,25 +4939,208 @@ declare const offers: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
3998
4939
|
data: Date;
|
|
3999
4940
|
driverParam: string;
|
|
4000
4941
|
notNull: true;
|
|
4001
|
-
hasDefault: true;
|
|
4942
|
+
hasDefault: true;
|
|
4943
|
+
isPrimaryKey: false;
|
|
4944
|
+
isAutoincrement: false;
|
|
4945
|
+
hasRuntimeDefault: false;
|
|
4946
|
+
enumValues: undefined;
|
|
4947
|
+
baseColumn: never;
|
|
4948
|
+
identity: undefined;
|
|
4949
|
+
generated: undefined;
|
|
4950
|
+
}, {}, {}>;
|
|
4951
|
+
};
|
|
4952
|
+
dialect: "pg";
|
|
4953
|
+
}>;
|
|
4954
|
+
declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
4955
|
+
name: EnumTableName.OFFERS_CALLBACKS;
|
|
4956
|
+
schema: "router_v1.6";
|
|
4957
|
+
columns: {
|
|
4958
|
+
offerHash: drizzle_orm_pg_core0.PgColumn<{
|
|
4959
|
+
name: "offer_hash";
|
|
4960
|
+
tableName: EnumTableName.OFFERS_CALLBACKS;
|
|
4961
|
+
dataType: "string";
|
|
4962
|
+
columnType: "PgVarchar";
|
|
4963
|
+
data: string;
|
|
4964
|
+
driverParam: string;
|
|
4965
|
+
notNull: true;
|
|
4966
|
+
hasDefault: false;
|
|
4967
|
+
isPrimaryKey: false;
|
|
4968
|
+
isAutoincrement: false;
|
|
4969
|
+
hasRuntimeDefault: false;
|
|
4970
|
+
enumValues: [string, ...string[]];
|
|
4971
|
+
baseColumn: never;
|
|
4972
|
+
identity: undefined;
|
|
4973
|
+
generated: undefined;
|
|
4974
|
+
}, {}, {
|
|
4975
|
+
length: 66;
|
|
4976
|
+
}>;
|
|
4977
|
+
callbackId: drizzle_orm_pg_core0.PgColumn<{
|
|
4978
|
+
name: "callback_id";
|
|
4979
|
+
tableName: EnumTableName.OFFERS_CALLBACKS;
|
|
4980
|
+
dataType: "string";
|
|
4981
|
+
columnType: "PgVarchar";
|
|
4982
|
+
data: string;
|
|
4983
|
+
driverParam: string;
|
|
4984
|
+
notNull: false;
|
|
4985
|
+
hasDefault: false;
|
|
4986
|
+
isPrimaryKey: false;
|
|
4987
|
+
isAutoincrement: false;
|
|
4988
|
+
hasRuntimeDefault: false;
|
|
4989
|
+
enumValues: [string, ...string[]];
|
|
4990
|
+
baseColumn: never;
|
|
4991
|
+
identity: undefined;
|
|
4992
|
+
generated: undefined;
|
|
4993
|
+
}, {}, {
|
|
4994
|
+
length: 66;
|
|
4995
|
+
}>;
|
|
4996
|
+
};
|
|
4997
|
+
dialect: "pg";
|
|
4998
|
+
}>;
|
|
4999
|
+
declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
5000
|
+
name: EnumTableName.CALLBACKS;
|
|
5001
|
+
schema: "router_v1.6";
|
|
5002
|
+
columns: {
|
|
5003
|
+
id: drizzle_orm_pg_core0.PgColumn<{
|
|
5004
|
+
name: "id";
|
|
5005
|
+
tableName: EnumTableName.CALLBACKS;
|
|
5006
|
+
dataType: "string";
|
|
5007
|
+
columnType: "PgVarchar";
|
|
5008
|
+
data: string;
|
|
5009
|
+
driverParam: string;
|
|
5010
|
+
notNull: true;
|
|
5011
|
+
hasDefault: false;
|
|
5012
|
+
isPrimaryKey: true;
|
|
5013
|
+
isAutoincrement: false;
|
|
5014
|
+
hasRuntimeDefault: false;
|
|
5015
|
+
enumValues: [string, ...string[]];
|
|
5016
|
+
baseColumn: never;
|
|
5017
|
+
identity: undefined;
|
|
5018
|
+
generated: undefined;
|
|
5019
|
+
}, {}, {
|
|
5020
|
+
length: 66;
|
|
5021
|
+
}>;
|
|
5022
|
+
positionChainId: drizzle_orm_pg_core0.PgColumn<{
|
|
5023
|
+
name: "position_chain_id";
|
|
5024
|
+
tableName: EnumTableName.CALLBACKS;
|
|
5025
|
+
dataType: "number";
|
|
5026
|
+
columnType: "PgBigInt53";
|
|
5027
|
+
data: Id;
|
|
5028
|
+
driverParam: string | number;
|
|
5029
|
+
notNull: true;
|
|
5030
|
+
hasDefault: false;
|
|
5031
|
+
isPrimaryKey: false;
|
|
5032
|
+
isAutoincrement: false;
|
|
5033
|
+
hasRuntimeDefault: false;
|
|
5034
|
+
enumValues: undefined;
|
|
5035
|
+
baseColumn: never;
|
|
5036
|
+
identity: undefined;
|
|
5037
|
+
generated: undefined;
|
|
5038
|
+
}, {}, {
|
|
5039
|
+
$type: Id;
|
|
5040
|
+
}>;
|
|
5041
|
+
positionContract: drizzle_orm_pg_core0.PgColumn<{
|
|
5042
|
+
name: "position_contract";
|
|
5043
|
+
tableName: EnumTableName.CALLBACKS;
|
|
5044
|
+
dataType: "string";
|
|
5045
|
+
columnType: "PgVarchar";
|
|
5046
|
+
data: string;
|
|
5047
|
+
driverParam: string;
|
|
5048
|
+
notNull: true;
|
|
5049
|
+
hasDefault: false;
|
|
5050
|
+
isPrimaryKey: false;
|
|
5051
|
+
isAutoincrement: false;
|
|
5052
|
+
hasRuntimeDefault: false;
|
|
5053
|
+
enumValues: [string, ...string[]];
|
|
5054
|
+
baseColumn: never;
|
|
5055
|
+
identity: undefined;
|
|
5056
|
+
generated: undefined;
|
|
5057
|
+
}, {}, {
|
|
5058
|
+
length: 42;
|
|
5059
|
+
}>;
|
|
5060
|
+
positionUser: drizzle_orm_pg_core0.PgColumn<{
|
|
5061
|
+
name: "position_user";
|
|
5062
|
+
tableName: EnumTableName.CALLBACKS;
|
|
5063
|
+
dataType: "string";
|
|
5064
|
+
columnType: "PgVarchar";
|
|
5065
|
+
data: string;
|
|
5066
|
+
driverParam: string;
|
|
5067
|
+
notNull: true;
|
|
5068
|
+
hasDefault: false;
|
|
5069
|
+
isPrimaryKey: false;
|
|
5070
|
+
isAutoincrement: false;
|
|
5071
|
+
hasRuntimeDefault: false;
|
|
5072
|
+
enumValues: [string, ...string[]];
|
|
5073
|
+
baseColumn: never;
|
|
5074
|
+
identity: undefined;
|
|
5075
|
+
generated: undefined;
|
|
5076
|
+
}, {}, {
|
|
5077
|
+
length: 42;
|
|
5078
|
+
}>;
|
|
5079
|
+
amount: drizzle_orm_pg_core0.PgColumn<{
|
|
5080
|
+
name: "amount";
|
|
5081
|
+
tableName: EnumTableName.CALLBACKS;
|
|
5082
|
+
dataType: "string";
|
|
5083
|
+
columnType: "PgNumeric";
|
|
5084
|
+
data: string;
|
|
5085
|
+
driverParam: string;
|
|
5086
|
+
notNull: false;
|
|
5087
|
+
hasDefault: false;
|
|
5088
|
+
isPrimaryKey: false;
|
|
5089
|
+
isAutoincrement: false;
|
|
5090
|
+
hasRuntimeDefault: false;
|
|
5091
|
+
enumValues: undefined;
|
|
5092
|
+
baseColumn: never;
|
|
5093
|
+
identity: undefined;
|
|
5094
|
+
generated: undefined;
|
|
5095
|
+
}, {}, {}>;
|
|
5096
|
+
};
|
|
5097
|
+
dialect: "pg";
|
|
5098
|
+
}>;
|
|
5099
|
+
declare const lots: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
5100
|
+
name: EnumTableName.LOTS;
|
|
5101
|
+
schema: "router_v1.6";
|
|
5102
|
+
columns: {
|
|
5103
|
+
chainId: drizzle_orm_pg_core0.PgColumn<{
|
|
5104
|
+
name: "chain_id";
|
|
5105
|
+
tableName: EnumTableName.LOTS;
|
|
5106
|
+
dataType: "number";
|
|
5107
|
+
columnType: "PgBigInt53";
|
|
5108
|
+
data: Id;
|
|
5109
|
+
driverParam: string | number;
|
|
5110
|
+
notNull: true;
|
|
5111
|
+
hasDefault: false;
|
|
5112
|
+
isPrimaryKey: false;
|
|
5113
|
+
isAutoincrement: false;
|
|
5114
|
+
hasRuntimeDefault: false;
|
|
5115
|
+
enumValues: undefined;
|
|
5116
|
+
baseColumn: never;
|
|
5117
|
+
identity: undefined;
|
|
5118
|
+
generated: undefined;
|
|
5119
|
+
}, {}, {
|
|
5120
|
+
$type: Id;
|
|
5121
|
+
}>;
|
|
5122
|
+
user: drizzle_orm_pg_core0.PgColumn<{
|
|
5123
|
+
name: "user";
|
|
5124
|
+
tableName: EnumTableName.LOTS;
|
|
5125
|
+
dataType: "string";
|
|
5126
|
+
columnType: "PgVarchar";
|
|
5127
|
+
data: string;
|
|
5128
|
+
driverParam: string;
|
|
5129
|
+
notNull: true;
|
|
5130
|
+
hasDefault: false;
|
|
4002
5131
|
isPrimaryKey: false;
|
|
4003
5132
|
isAutoincrement: false;
|
|
4004
5133
|
hasRuntimeDefault: false;
|
|
4005
|
-
enumValues:
|
|
5134
|
+
enumValues: [string, ...string[]];
|
|
4006
5135
|
baseColumn: never;
|
|
4007
5136
|
identity: undefined;
|
|
4008
5137
|
generated: undefined;
|
|
4009
|
-
}, {}, {
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
schema: "router_v1.6";
|
|
4016
|
-
columns: {
|
|
4017
|
-
offerHash: drizzle_orm_pg_core0.PgColumn<{
|
|
4018
|
-
name: "offer_hash";
|
|
4019
|
-
tableName: EnumTableName.OFFERS_CALLBACKS;
|
|
5138
|
+
}, {}, {
|
|
5139
|
+
length: 42;
|
|
5140
|
+
}>;
|
|
5141
|
+
contract: drizzle_orm_pg_core0.PgColumn<{
|
|
5142
|
+
name: "contract";
|
|
5143
|
+
tableName: EnumTableName.LOTS;
|
|
4020
5144
|
dataType: "string";
|
|
4021
5145
|
columnType: "PgVarchar";
|
|
4022
5146
|
data: string;
|
|
@@ -4031,16 +5155,16 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4031
5155
|
identity: undefined;
|
|
4032
5156
|
generated: undefined;
|
|
4033
5157
|
}, {}, {
|
|
4034
|
-
length:
|
|
5158
|
+
length: 42;
|
|
4035
5159
|
}>;
|
|
4036
|
-
|
|
4037
|
-
name: "
|
|
4038
|
-
tableName: EnumTableName.
|
|
5160
|
+
group: drizzle_orm_pg_core0.PgColumn<{
|
|
5161
|
+
name: "group";
|
|
5162
|
+
tableName: EnumTableName.LOTS;
|
|
4039
5163
|
dataType: "string";
|
|
4040
5164
|
columnType: "PgVarchar";
|
|
4041
5165
|
data: string;
|
|
4042
5166
|
driverParam: string;
|
|
4043
|
-
notNull:
|
|
5167
|
+
notNull: true;
|
|
4044
5168
|
hasDefault: false;
|
|
4045
5169
|
isPrimaryKey: false;
|
|
4046
5170
|
isAutoincrement: false;
|
|
@@ -4052,35 +5176,50 @@ declare const offersCallbacks: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4052
5176
|
}, {}, {
|
|
4053
5177
|
length: 66;
|
|
4054
5178
|
}>;
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
4059
|
-
name: EnumTableName.CALLBACKS;
|
|
4060
|
-
schema: "router_v1.6";
|
|
4061
|
-
columns: {
|
|
4062
|
-
id: drizzle_orm_pg_core0.PgColumn<{
|
|
4063
|
-
name: "id";
|
|
4064
|
-
tableName: EnumTableName.CALLBACKS;
|
|
5179
|
+
lower: drizzle_orm_pg_core0.PgColumn<{
|
|
5180
|
+
name: "lower";
|
|
5181
|
+
tableName: EnumTableName.LOTS;
|
|
4065
5182
|
dataType: "string";
|
|
4066
|
-
columnType: "
|
|
5183
|
+
columnType: "PgNumeric";
|
|
4067
5184
|
data: string;
|
|
4068
5185
|
driverParam: string;
|
|
4069
5186
|
notNull: true;
|
|
4070
5187
|
hasDefault: false;
|
|
4071
|
-
isPrimaryKey:
|
|
5188
|
+
isPrimaryKey: false;
|
|
4072
5189
|
isAutoincrement: false;
|
|
4073
5190
|
hasRuntimeDefault: false;
|
|
4074
|
-
enumValues:
|
|
5191
|
+
enumValues: undefined;
|
|
4075
5192
|
baseColumn: never;
|
|
4076
5193
|
identity: undefined;
|
|
4077
5194
|
generated: undefined;
|
|
4078
|
-
}, {}, {
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
5195
|
+
}, {}, {}>;
|
|
5196
|
+
upper: drizzle_orm_pg_core0.PgColumn<{
|
|
5197
|
+
name: "upper";
|
|
5198
|
+
tableName: EnumTableName.LOTS;
|
|
5199
|
+
dataType: "string";
|
|
5200
|
+
columnType: "PgNumeric";
|
|
5201
|
+
data: string;
|
|
5202
|
+
driverParam: string;
|
|
5203
|
+
notNull: true;
|
|
5204
|
+
hasDefault: false;
|
|
5205
|
+
isPrimaryKey: false;
|
|
5206
|
+
isAutoincrement: false;
|
|
5207
|
+
hasRuntimeDefault: false;
|
|
5208
|
+
enumValues: undefined;
|
|
5209
|
+
baseColumn: never;
|
|
5210
|
+
identity: undefined;
|
|
5211
|
+
generated: undefined;
|
|
5212
|
+
}, {}, {}>;
|
|
5213
|
+
};
|
|
5214
|
+
dialect: "pg";
|
|
5215
|
+
}>;
|
|
5216
|
+
declare const offsets: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
5217
|
+
name: EnumTableName.OFFSETS;
|
|
5218
|
+
schema: "router_v1.6";
|
|
5219
|
+
columns: {
|
|
5220
|
+
chainId: drizzle_orm_pg_core0.PgColumn<{
|
|
5221
|
+
name: "chain_id";
|
|
5222
|
+
tableName: EnumTableName.OFFSETS;
|
|
4084
5223
|
dataType: "number";
|
|
4085
5224
|
columnType: "PgBigInt53";
|
|
4086
5225
|
data: Id;
|
|
@@ -4097,9 +5236,9 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4097
5236
|
}, {}, {
|
|
4098
5237
|
$type: Id;
|
|
4099
5238
|
}>;
|
|
4100
|
-
|
|
4101
|
-
name: "
|
|
4102
|
-
tableName: EnumTableName.
|
|
5239
|
+
user: drizzle_orm_pg_core0.PgColumn<{
|
|
5240
|
+
name: "user";
|
|
5241
|
+
tableName: EnumTableName.OFFSETS;
|
|
4103
5242
|
dataType: "string";
|
|
4104
5243
|
columnType: "PgVarchar";
|
|
4105
5244
|
data: string;
|
|
@@ -4116,9 +5255,9 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4116
5255
|
}, {}, {
|
|
4117
5256
|
length: 42;
|
|
4118
5257
|
}>;
|
|
4119
|
-
|
|
4120
|
-
name: "
|
|
4121
|
-
tableName: EnumTableName.
|
|
5258
|
+
contract: drizzle_orm_pg_core0.PgColumn<{
|
|
5259
|
+
name: "contract";
|
|
5260
|
+
tableName: EnumTableName.OFFSETS;
|
|
4122
5261
|
dataType: "string";
|
|
4123
5262
|
columnType: "PgVarchar";
|
|
4124
5263
|
data: string;
|
|
@@ -4135,14 +5274,33 @@ declare const callbacks$1: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4135
5274
|
}, {}, {
|
|
4136
5275
|
length: 42;
|
|
4137
5276
|
}>;
|
|
4138
|
-
|
|
4139
|
-
name: "
|
|
4140
|
-
tableName: EnumTableName.
|
|
5277
|
+
group: drizzle_orm_pg_core0.PgColumn<{
|
|
5278
|
+
name: "group";
|
|
5279
|
+
tableName: EnumTableName.OFFSETS;
|
|
5280
|
+
dataType: "string";
|
|
5281
|
+
columnType: "PgVarchar";
|
|
5282
|
+
data: string;
|
|
5283
|
+
driverParam: string;
|
|
5284
|
+
notNull: true;
|
|
5285
|
+
hasDefault: false;
|
|
5286
|
+
isPrimaryKey: false;
|
|
5287
|
+
isAutoincrement: false;
|
|
5288
|
+
hasRuntimeDefault: false;
|
|
5289
|
+
enumValues: [string, ...string[]];
|
|
5290
|
+
baseColumn: never;
|
|
5291
|
+
identity: undefined;
|
|
5292
|
+
generated: undefined;
|
|
5293
|
+
}, {}, {
|
|
5294
|
+
length: 66;
|
|
5295
|
+
}>;
|
|
5296
|
+
value: drizzle_orm_pg_core0.PgColumn<{
|
|
5297
|
+
name: "value";
|
|
5298
|
+
tableName: EnumTableName.OFFSETS;
|
|
4141
5299
|
dataType: "string";
|
|
4142
5300
|
columnType: "PgNumeric";
|
|
4143
5301
|
data: string;
|
|
4144
5302
|
driverParam: string;
|
|
4145
|
-
notNull:
|
|
5303
|
+
notNull: true;
|
|
4146
5304
|
hasDefault: false;
|
|
4147
5305
|
isPrimaryKey: false;
|
|
4148
5306
|
isAutoincrement: false;
|
|
@@ -4776,25 +5934,150 @@ declare const chains: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
|
4776
5934
|
};
|
|
4777
5935
|
dialect: "pg";
|
|
4778
5936
|
}>;
|
|
5937
|
+
declare const trees: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
5938
|
+
name: EnumTableName.TREES;
|
|
5939
|
+
schema: "router_v1.6";
|
|
5940
|
+
columns: {
|
|
5941
|
+
root: drizzle_orm_pg_core0.PgColumn<{
|
|
5942
|
+
name: "root";
|
|
5943
|
+
tableName: EnumTableName.TREES;
|
|
5944
|
+
dataType: "string";
|
|
5945
|
+
columnType: "PgVarchar";
|
|
5946
|
+
data: string;
|
|
5947
|
+
driverParam: string;
|
|
5948
|
+
notNull: true;
|
|
5949
|
+
hasDefault: false;
|
|
5950
|
+
isPrimaryKey: true;
|
|
5951
|
+
isAutoincrement: false;
|
|
5952
|
+
hasRuntimeDefault: false;
|
|
5953
|
+
enumValues: [string, ...string[]];
|
|
5954
|
+
baseColumn: never;
|
|
5955
|
+
identity: undefined;
|
|
5956
|
+
generated: undefined;
|
|
5957
|
+
}, {}, {
|
|
5958
|
+
length: 66;
|
|
5959
|
+
}>;
|
|
5960
|
+
rootSignature: drizzle_orm_pg_core0.PgColumn<{
|
|
5961
|
+
name: "root_signature";
|
|
5962
|
+
tableName: EnumTableName.TREES;
|
|
5963
|
+
dataType: "string";
|
|
5964
|
+
columnType: "PgVarchar";
|
|
5965
|
+
data: string;
|
|
5966
|
+
driverParam: string;
|
|
5967
|
+
notNull: true;
|
|
5968
|
+
hasDefault: false;
|
|
5969
|
+
isPrimaryKey: false;
|
|
5970
|
+
isAutoincrement: false;
|
|
5971
|
+
hasRuntimeDefault: false;
|
|
5972
|
+
enumValues: [string, ...string[]];
|
|
5973
|
+
baseColumn: never;
|
|
5974
|
+
identity: undefined;
|
|
5975
|
+
generated: undefined;
|
|
5976
|
+
}, {}, {
|
|
5977
|
+
length: 132;
|
|
5978
|
+
}>;
|
|
5979
|
+
createdAt: drizzle_orm_pg_core0.PgColumn<{
|
|
5980
|
+
name: "created_at";
|
|
5981
|
+
tableName: EnumTableName.TREES;
|
|
5982
|
+
dataType: "date";
|
|
5983
|
+
columnType: "PgTimestamp";
|
|
5984
|
+
data: Date;
|
|
5985
|
+
driverParam: string;
|
|
5986
|
+
notNull: true;
|
|
5987
|
+
hasDefault: true;
|
|
5988
|
+
isPrimaryKey: false;
|
|
5989
|
+
isAutoincrement: false;
|
|
5990
|
+
hasRuntimeDefault: false;
|
|
5991
|
+
enumValues: undefined;
|
|
5992
|
+
baseColumn: never;
|
|
5993
|
+
identity: undefined;
|
|
5994
|
+
generated: undefined;
|
|
5995
|
+
}, {}, {}>;
|
|
5996
|
+
};
|
|
5997
|
+
dialect: "pg";
|
|
5998
|
+
}>;
|
|
5999
|
+
declare const merklePaths: drizzle_orm_pg_core0.PgTableWithColumns<{
|
|
6000
|
+
name: EnumTableName.MERKLE_PATHS;
|
|
6001
|
+
schema: "router_v1.6";
|
|
6002
|
+
columns: {
|
|
6003
|
+
offerHash: drizzle_orm_pg_core0.PgColumn<{
|
|
6004
|
+
name: "offer_hash";
|
|
6005
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
6006
|
+
dataType: "string";
|
|
6007
|
+
columnType: "PgVarchar";
|
|
6008
|
+
data: string;
|
|
6009
|
+
driverParam: string;
|
|
6010
|
+
notNull: true;
|
|
6011
|
+
hasDefault: false;
|
|
6012
|
+
isPrimaryKey: true;
|
|
6013
|
+
isAutoincrement: false;
|
|
6014
|
+
hasRuntimeDefault: false;
|
|
6015
|
+
enumValues: [string, ...string[]];
|
|
6016
|
+
baseColumn: never;
|
|
6017
|
+
identity: undefined;
|
|
6018
|
+
generated: undefined;
|
|
6019
|
+
}, {}, {
|
|
6020
|
+
length: 66;
|
|
6021
|
+
}>;
|
|
6022
|
+
treeRoot: drizzle_orm_pg_core0.PgColumn<{
|
|
6023
|
+
name: "tree_root";
|
|
6024
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
6025
|
+
dataType: "string";
|
|
6026
|
+
columnType: "PgVarchar";
|
|
6027
|
+
data: string;
|
|
6028
|
+
driverParam: string;
|
|
6029
|
+
notNull: true;
|
|
6030
|
+
hasDefault: false;
|
|
6031
|
+
isPrimaryKey: false;
|
|
6032
|
+
isAutoincrement: false;
|
|
6033
|
+
hasRuntimeDefault: false;
|
|
6034
|
+
enumValues: [string, ...string[]];
|
|
6035
|
+
baseColumn: never;
|
|
6036
|
+
identity: undefined;
|
|
6037
|
+
generated: undefined;
|
|
6038
|
+
}, {}, {
|
|
6039
|
+
length: 66;
|
|
6040
|
+
}>;
|
|
6041
|
+
proofNodes: drizzle_orm_pg_core0.PgColumn<{
|
|
6042
|
+
name: "proof_nodes";
|
|
6043
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
6044
|
+
dataType: "string";
|
|
6045
|
+
columnType: "PgText";
|
|
6046
|
+
data: string;
|
|
6047
|
+
driverParam: string;
|
|
6048
|
+
notNull: true;
|
|
6049
|
+
hasDefault: false;
|
|
6050
|
+
isPrimaryKey: false;
|
|
6051
|
+
isAutoincrement: false;
|
|
6052
|
+
hasRuntimeDefault: false;
|
|
6053
|
+
enumValues: [string, ...string[]];
|
|
6054
|
+
baseColumn: never;
|
|
6055
|
+
identity: undefined;
|
|
6056
|
+
generated: undefined;
|
|
6057
|
+
}, {}, {}>;
|
|
6058
|
+
createdAt: drizzle_orm_pg_core0.PgColumn<{
|
|
6059
|
+
name: "created_at";
|
|
6060
|
+
tableName: EnumTableName.MERKLE_PATHS;
|
|
6061
|
+
dataType: "date";
|
|
6062
|
+
columnType: "PgTimestamp";
|
|
6063
|
+
data: Date;
|
|
6064
|
+
driverParam: string;
|
|
6065
|
+
notNull: true;
|
|
6066
|
+
hasDefault: true;
|
|
6067
|
+
isPrimaryKey: false;
|
|
6068
|
+
isAutoincrement: false;
|
|
6069
|
+
hasRuntimeDefault: false;
|
|
6070
|
+
enumValues: undefined;
|
|
6071
|
+
baseColumn: never;
|
|
6072
|
+
identity: undefined;
|
|
6073
|
+
generated: undefined;
|
|
6074
|
+
}, {}, {}>;
|
|
6075
|
+
};
|
|
6076
|
+
dialect: "pg";
|
|
6077
|
+
}>;
|
|
4779
6078
|
declare namespace index_d_exports$2 {
|
|
4780
|
-
export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, obligationCollateralsV2, obligations, offers, offersCallbacks, oracles, positionTypes, positions, status, transfers, validations };
|
|
4781
|
-
}
|
|
4782
|
-
declare namespace Cursor_d_exports {
|
|
4783
|
-
export { Cursor, decode, encode, validate };
|
|
6079
|
+
export { PositionTypes, StatusCode, TABLE_NAMES, TableName, VERSION, VERSIONED_TABLE_NAMES, VersionedTableName, callbacks$1 as callbacks, chains, collectors, consumedEvents, groups, lots, merklePaths, obligationCollateralsV2, obligations, offers, offersCallbacks, offsets, oracles, positionTypes, positions, status, transfers, trees, validations };
|
|
4784
6080
|
}
|
|
4785
|
-
type Cursor = {
|
|
4786
|
-
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
4787
|
-
dir: "asc" | "desc";
|
|
4788
|
-
rate?: string;
|
|
4789
|
-
maturity?: number;
|
|
4790
|
-
expiry?: number;
|
|
4791
|
-
assets?: string;
|
|
4792
|
-
hash: string;
|
|
4793
|
-
page?: number;
|
|
4794
|
-
};
|
|
4795
|
-
declare function validate(cursor: unknown): cursor is Cursor;
|
|
4796
|
-
declare function encode(c: Cursor): string;
|
|
4797
|
-
declare function decode(token?: string): Cursor | null;
|
|
4798
6081
|
//#endregion
|
|
4799
6082
|
//#region src/mempool/MempoolEVMClient.d.ts
|
|
4800
6083
|
type MempoolEVMClientConfig = {
|
|
@@ -4847,7 +6130,7 @@ declare class ChainIdMismatchError extends BaseError {
|
|
|
4847
6130
|
}
|
|
4848
6131
|
//#endregion
|
|
4849
6132
|
//#region src/mempool/MempoolClient.d.ts
|
|
4850
|
-
type AddParameters = Compute<Omit<Offer, "
|
|
6133
|
+
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
4851
6134
|
type GetParameters = {
|
|
4852
6135
|
/** The block number to get offers from. */
|
|
4853
6136
|
blockNumberGte?: number;
|
|
@@ -4905,6 +6188,12 @@ declare namespace index_d_exports$1 {
|
|
|
4905
6188
|
//#region src/utils/BigMath.d.ts
|
|
4906
6189
|
declare function max$1(a: bigint, b: bigint): bigint;
|
|
4907
6190
|
declare function min(a: bigint, b: bigint): bigint;
|
|
6191
|
+
/**
|
|
6192
|
+
* Checks if at most one of the given values is non-zero.
|
|
6193
|
+
* @param values - The bigint values to check.
|
|
6194
|
+
* @returns True if zero or one value is non-zero, false if two or more are non-zero.
|
|
6195
|
+
*/
|
|
6196
|
+
declare function atMostOneNonZero(...values: bigint[]): boolean;
|
|
4908
6197
|
//#endregion
|
|
4909
6198
|
//#region src/utils/batch.d.ts
|
|
4910
6199
|
/**
|
|
@@ -4942,6 +6231,15 @@ declare function batchMulticall<TResult>(parameters: {
|
|
|
4942
6231
|
retryDelayMs: number;
|
|
4943
6232
|
blockNumber?: bigint;
|
|
4944
6233
|
}): Promise<TResult[]>;
|
|
6234
|
+
declare namespace Group_d_exports {
|
|
6235
|
+
export { fromNumber };
|
|
6236
|
+
}
|
|
6237
|
+
/**
|
|
6238
|
+
* Creates a bytes32 group identifier from a number.
|
|
6239
|
+
* @param n - A non-negative integer.
|
|
6240
|
+
* @throws {Error} If n is negative or not an integer.
|
|
6241
|
+
*/
|
|
6242
|
+
declare const fromNumber: (n: number) => Hex;
|
|
4945
6243
|
//#endregion
|
|
4946
6244
|
//#region src/utils/lazy.d.ts
|
|
4947
6245
|
/**
|
|
@@ -4969,6 +6267,41 @@ declare function poll<data>(fn: ({
|
|
|
4969
6267
|
}: {
|
|
4970
6268
|
interval: () => Promise<number>;
|
|
4971
6269
|
}): () => boolean;
|
|
6270
|
+
declare namespace Random_d_exports {
|
|
6271
|
+
export { address, bool, bytes, float, hex, int, seed, withSeed };
|
|
6272
|
+
}
|
|
6273
|
+
/**
|
|
6274
|
+
* Runs a function with a deterministic RNG derived from the given seed.
|
|
6275
|
+
*/
|
|
6276
|
+
declare function withSeed<T>(seed: string, fn: () => T): T;
|
|
6277
|
+
/**
|
|
6278
|
+
* Seeds the global RNG for deterministic test runs.
|
|
6279
|
+
*/
|
|
6280
|
+
declare function seed(seed: string): void;
|
|
6281
|
+
/**
|
|
6282
|
+
* Returns a deterministic random float in [0, 1).
|
|
6283
|
+
*/
|
|
6284
|
+
declare function float(): number;
|
|
6285
|
+
/**
|
|
6286
|
+
* Returns a deterministic random integer in [min, maxExclusive).
|
|
6287
|
+
*/
|
|
6288
|
+
declare function int(maxExclusive: number, min?: number): number;
|
|
6289
|
+
/**
|
|
6290
|
+
* Returns a deterministic random boolean.
|
|
6291
|
+
*/
|
|
6292
|
+
declare function bool(probability?: number): boolean;
|
|
6293
|
+
/**
|
|
6294
|
+
* Returns deterministic random bytes.
|
|
6295
|
+
*/
|
|
6296
|
+
declare function bytes(length: number): Uint8Array;
|
|
6297
|
+
/**
|
|
6298
|
+
* Returns a deterministic random hex string for the given byte length.
|
|
6299
|
+
*/
|
|
6300
|
+
declare function hex(byteLength: number): Hex;
|
|
6301
|
+
/**
|
|
6302
|
+
* Returns a deterministic random address.
|
|
6303
|
+
*/
|
|
6304
|
+
declare function address(): Address;
|
|
4972
6305
|
//#endregion
|
|
4973
6306
|
//#region src/utils/retry.d.ts
|
|
4974
6307
|
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
@@ -4981,8 +6314,8 @@ declare function max(): number;
|
|
|
4981
6314
|
//#region src/utils/wait.d.ts
|
|
4982
6315
|
declare function wait(time: number): Promise<unknown>;
|
|
4983
6316
|
declare namespace index_d_exports$3 {
|
|
4984
|
-
export { BaseError, GlobalErrorType, 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 };
|
|
6317
|
+
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 };
|
|
4985
6318
|
}
|
|
4986
6319
|
//#endregion
|
|
4987
|
-
export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute,
|
|
6320
|
+
export { index_d_exports as Abi, BookResponse_d_exports as BookResponse, BooksController, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainHealth, ChainRegistry_d_exports as ChainRegistry, ChainsHealthResponse, Collateral_d_exports as Collateral, CollectorHealth, CollectorsHealthResponse, Compute, ConfigController, Database_d_exports as Database, 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, Health_d_exports as Health, HealthController, Indexer_d_exports as Indexer, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Logger_d_exports as Logger, Maturity_d_exports as Maturity, index_d_exports$1 as Mempool, Obligation_d_exports as Obligation, ObligationResponse_d_exports as ObligationResponse, ObligationsController, Offer_d_exports as Offer, OfferResponse_d_exports as OfferResponse, OffersController, index_d_exports$2 as OffersSchema, OpenApi, OpenApiOptions, Oracle_d_exports as Oracle, Position_d_exports as Position, PositionResponse_d_exports as PositionResponse, Quote_d_exports as Quote, RouterApi_d_exports as RouterApi, Client_d_exports as RouterClient, RouterStatusResponse, RuleInfo, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, UsersController, index_d_exports$3 as Utils, ValidateController, Gate_d_exports as Validation, morphoRules, parse, safeParse };
|
|
4988
6321
|
//# sourceMappingURL=index.node.d.ts.map
|