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