@morpho-dev/router 0.1.17 → 0.1.18
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 +6 -6
- package/dist/cli.js +204 -53
- package/dist/cli.js.map +1 -1
- package/dist/index.browser.d.cts +26 -4
- package/dist/index.browser.d.ts +26 -4
- package/dist/index.browser.js +93 -24
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +93 -24
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +170 -12
- package/dist/index.node.d.ts +170 -12
- package/dist/index.node.js +245 -24
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +245 -25
- package/dist/index.node.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.node.d.cts
CHANGED
|
@@ -583,14 +583,35 @@ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "hash">>): Offer;
|
|
|
583
583
|
* @returns The converted offer.
|
|
584
584
|
*/
|
|
585
585
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
586
|
+
type RandomConfig = {
|
|
587
|
+
chains?: Chain[];
|
|
588
|
+
loanTokens?: Address[];
|
|
589
|
+
collateralTokens?: Address[];
|
|
590
|
+
assetsDecimals?: Record<Address, number>;
|
|
591
|
+
buy?: boolean;
|
|
592
|
+
assets?: bigint;
|
|
593
|
+
consumed?: bigint;
|
|
594
|
+
offering?: Address;
|
|
595
|
+
maturity?: Maturity;
|
|
596
|
+
start?: number;
|
|
597
|
+
expiry?: number;
|
|
598
|
+
nonce?: bigint;
|
|
599
|
+
rate?: bigint;
|
|
600
|
+
callback?: {
|
|
601
|
+
address: Address;
|
|
602
|
+
data: Hex;
|
|
603
|
+
gasLimit: bigint;
|
|
604
|
+
};
|
|
605
|
+
collaterals?: readonly Collateral[];
|
|
606
|
+
signature?: Hex;
|
|
607
|
+
};
|
|
586
608
|
/**
|
|
587
609
|
* Generates a random Offer.
|
|
588
|
-
* The returned Offer contains randomly generated values
|
|
589
|
-
* Some fields use fixed or deterministic values (e.g., chainId, collaterals, callback).
|
|
610
|
+
* The returned Offer contains randomly generated values.
|
|
590
611
|
* @warning The generated Offer should not be used for production usage.
|
|
591
612
|
* @returns {Offer} A randomly generated Offer object.
|
|
592
613
|
*/
|
|
593
|
-
declare function random$2(): Offer;
|
|
614
|
+
declare function random$2(config?: RandomConfig): Offer;
|
|
594
615
|
/**
|
|
595
616
|
* Creates an EIP-712 domain object.
|
|
596
617
|
* @param chainId - The chain ID.
|
|
@@ -741,6 +762,7 @@ type Offer$1_Offer = Offer;
|
|
|
741
762
|
type Offer$1_OfferConsumed = OfferConsumed;
|
|
742
763
|
declare const Offer$1_OfferHashSchema: typeof OfferHashSchema;
|
|
743
764
|
declare const Offer$1_OfferSchema: typeof OfferSchema;
|
|
765
|
+
type Offer$1_RandomConfig = RandomConfig;
|
|
744
766
|
declare const Offer$1_consumedEvent: typeof consumedEvent;
|
|
745
767
|
declare const Offer$1_domain: typeof domain;
|
|
746
768
|
declare const Offer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
@@ -750,7 +772,7 @@ declare const Offer$1_sign: typeof sign;
|
|
|
750
772
|
declare const Offer$1_toSnakeCase: typeof toSnakeCase;
|
|
751
773
|
declare const Offer$1_types: typeof types;
|
|
752
774
|
declare namespace Offer$1 {
|
|
753
|
-
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, Offer$1_consumedEvent as consumedEvent, decode$1 as decode, Offer$1_domain as domain, encode$1 as encode, from$6 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$2 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$2 as random, Offer$1_sign as sign, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
775
|
+
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, type Offer$1_RandomConfig as RandomConfig, Offer$1_consumedEvent as consumedEvent, decode$1 as decode, Offer$1_domain as domain, encode$1 as encode, from$6 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$2 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$2 as random, Offer$1_sign as sign, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
754
776
|
}
|
|
755
777
|
|
|
756
778
|
/**
|
|
@@ -1112,7 +1134,7 @@ type PGLiteDB = ReturnType<typeof drizzle$1> & {
|
|
|
1112
1134
|
pool: PGlite;
|
|
1113
1135
|
};
|
|
1114
1136
|
type PG = PgDB | PGLiteDB;
|
|
1115
|
-
declare function connect$
|
|
1137
|
+
declare function connect$2(parameters: {
|
|
1116
1138
|
type: "pg";
|
|
1117
1139
|
endpoint: string;
|
|
1118
1140
|
} | {
|
|
@@ -1127,7 +1149,7 @@ type PG$1_PgDB = PgDB;
|
|
|
1127
1149
|
declare const PG$1_applyMigrations: typeof applyMigrations;
|
|
1128
1150
|
declare const PG$1_clean: typeof clean;
|
|
1129
1151
|
declare namespace PG$1 {
|
|
1130
|
-
export { type PG$1_PG as PG, type PG$1_PGLiteDB as PGLiteDB, type PG$1_PgDB as PgDB, PG$1_applyMigrations as applyMigrations, PG$1_clean as clean, connect$
|
|
1152
|
+
export { type PG$1_PG as PG, type PG$1_PGLiteDB as PGLiteDB, type PG$1_PgDB as PgDB, PG$1_applyMigrations as applyMigrations, PG$1_clean as clean, connect$2 as connect };
|
|
1131
1153
|
}
|
|
1132
1154
|
|
|
1133
1155
|
type ChainStore = {
|
|
@@ -1861,7 +1883,7 @@ declare function getHealthCollectors(healthService: HealthService): Promise<{
|
|
|
1861
1883
|
});
|
|
1862
1884
|
}>;
|
|
1863
1885
|
|
|
1864
|
-
declare function getObligations(queryParameters: object, store: OfferStore): Promise<{
|
|
1886
|
+
declare function getObligations$1(queryParameters: object, store: OfferStore): Promise<{
|
|
1865
1887
|
statusCode: STATUS_CODE;
|
|
1866
1888
|
body: {
|
|
1867
1889
|
status: "success" | "error";
|
|
@@ -1880,7 +1902,7 @@ declare function getObligations(queryParameters: object, store: OfferStore): Pro
|
|
|
1880
1902
|
});
|
|
1881
1903
|
}>;
|
|
1882
1904
|
|
|
1883
|
-
declare function getOffers(queryParameters: object, store: OfferStore): Promise<{
|
|
1905
|
+
declare function getOffers$1(queryParameters: object, store: OfferStore): Promise<{
|
|
1884
1906
|
statusCode: STATUS_CODE;
|
|
1885
1907
|
body: {
|
|
1886
1908
|
status: "success" | "error";
|
|
@@ -1903,11 +1925,9 @@ declare const index$2_getDocsHtml: typeof getDocsHtml;
|
|
|
1903
1925
|
declare const index$2_getHealth: typeof getHealth;
|
|
1904
1926
|
declare const index$2_getHealthChains: typeof getHealthChains;
|
|
1905
1927
|
declare const index$2_getHealthCollectors: typeof getHealthCollectors;
|
|
1906
|
-
declare const index$2_getObligations: typeof getObligations;
|
|
1907
|
-
declare const index$2_getOffers: typeof getOffers;
|
|
1908
1928
|
declare const index$2_getSwaggerJson: typeof getSwaggerJson;
|
|
1909
1929
|
declare namespace index$2 {
|
|
1910
|
-
export { index$2_getDocsHtml as getDocsHtml, index$2_getHealth as getHealth, index$2_getHealthChains as getHealthChains, index$2_getHealthCollectors as getHealthCollectors,
|
|
1930
|
+
export { index$2_getDocsHtml as getDocsHtml, index$2_getHealth as getHealth, index$2_getHealthChains as getHealthChains, index$2_getHealthCollectors as getHealthCollectors, getObligations$1 as getObligations, getOffers$1 as getOffers, index$2_getSwaggerJson as getSwaggerJson };
|
|
1911
1931
|
}
|
|
1912
1932
|
|
|
1913
1933
|
declare const CollectorHealth: z$1.ZodObject<{
|
|
@@ -2023,6 +2043,144 @@ declare namespace RouterApi {
|
|
|
2023
2043
|
export { RouterApi_ChainHealth as ChainHealth, type RouterApi_ChainsHealthResponse as ChainsHealthResponse, RouterApi_CollectorHealth as CollectorHealth, type RouterApi_CollectorsHealthResponse as CollectorsHealthResponse, index$2 as Controllers, ObligationResponse$1 as ObligationResponse, OfferResponse$1 as OfferResponse, RouterApi_OpenApi as OpenApi, type RouterApi$1 as RouterApi, type RouterApi_RouterApiConfig as RouterApiConfig, type RouterApi_RouterStatusResponse as RouterStatusResponse, RouterApi_create as create, RouterApi_parse as parse, RouterApi_safeParse as safeParse };
|
|
2024
2044
|
}
|
|
2025
2045
|
|
|
2046
|
+
type RouterClientConfig = {
|
|
2047
|
+
/** The URL of the router. */
|
|
2048
|
+
readonly url: URL;
|
|
2049
|
+
/** The default headers to use for each request. */
|
|
2050
|
+
readonly headers: Headers;
|
|
2051
|
+
};
|
|
2052
|
+
type Client$1 = Compute<RouterClientConfig & {
|
|
2053
|
+
/**
|
|
2054
|
+
* Get offers from the router.
|
|
2055
|
+
* @param parameters - {@link getOffers.Parameters}
|
|
2056
|
+
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
2057
|
+
*
|
|
2058
|
+
* @example
|
|
2059
|
+
* ```ts
|
|
2060
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2061
|
+
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
2062
|
+
* console.log(offers);
|
|
2063
|
+
* ```
|
|
2064
|
+
*/
|
|
2065
|
+
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
2066
|
+
/**
|
|
2067
|
+
* Get obligations from the router.
|
|
2068
|
+
* @param parameters - {@link getObligations.Parameters}
|
|
2069
|
+
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
2070
|
+
*
|
|
2071
|
+
* @example
|
|
2072
|
+
* ```ts
|
|
2073
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2074
|
+
* const { obligations, cursor } = await router.getObligations();
|
|
2075
|
+
* console.log(obligations);
|
|
2076
|
+
* ```
|
|
2077
|
+
*/
|
|
2078
|
+
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
2079
|
+
}>;
|
|
2080
|
+
type ConnectOptions = {
|
|
2081
|
+
/** The URL of the router to interact with.
|
|
2082
|
+
* @default "https://router.morpho.dev"
|
|
2083
|
+
*/
|
|
2084
|
+
url?: string;
|
|
2085
|
+
/** The API key to use for the router API. */
|
|
2086
|
+
apiKey?: string;
|
|
2087
|
+
/** The default headers to use for each request. */
|
|
2088
|
+
headers?: Headers;
|
|
2089
|
+
};
|
|
2090
|
+
/**
|
|
2091
|
+
* Creates an instance of a router client.
|
|
2092
|
+
* @constructor
|
|
2093
|
+
* @param options - {@link ConnectOptions}
|
|
2094
|
+
* @returns A Router Client. {@link Client}
|
|
2095
|
+
*
|
|
2096
|
+
* @example
|
|
2097
|
+
* ```typescript
|
|
2098
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2099
|
+
* ```
|
|
2100
|
+
*/
|
|
2101
|
+
declare function connect$1(options?: ConnectOptions): connect$1.ReturnType;
|
|
2102
|
+
declare namespace connect$1 {
|
|
2103
|
+
type ReturnType = Client$1;
|
|
2104
|
+
type ErrorType = InvalidUrlError;
|
|
2105
|
+
}
|
|
2106
|
+
declare function getOffers(config: RouterClientConfig, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
2107
|
+
declare namespace getOffers {
|
|
2108
|
+
type Parameters = {
|
|
2109
|
+
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
2110
|
+
side: "buy" | "sell";
|
|
2111
|
+
/** The offers obligation id */
|
|
2112
|
+
obligationId: Hex;
|
|
2113
|
+
/** Pagination cursor in base64url-encoded format */
|
|
2114
|
+
cursor?: string;
|
|
2115
|
+
/** Maximum number of offers to return. @default 20 */
|
|
2116
|
+
limit?: number;
|
|
2117
|
+
};
|
|
2118
|
+
type ReturnType = {
|
|
2119
|
+
offers: Offer[];
|
|
2120
|
+
/** The pagination cursor. */
|
|
2121
|
+
cursor: string | null;
|
|
2122
|
+
};
|
|
2123
|
+
type ErrorType = GetApiErrorType;
|
|
2124
|
+
}
|
|
2125
|
+
declare function getObligations(config: RouterClientConfig, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
2126
|
+
declare namespace getObligations {
|
|
2127
|
+
type Parameters = {
|
|
2128
|
+
/** Pagination cursor is a 32-byte hex string. */
|
|
2129
|
+
cursor?: Hex;
|
|
2130
|
+
/** Maximum number of obligations to return. @default 20 */
|
|
2131
|
+
limit?: number;
|
|
2132
|
+
};
|
|
2133
|
+
type ReturnType = {
|
|
2134
|
+
obligations: Compute<{
|
|
2135
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
2136
|
+
id: () => Hex;
|
|
2137
|
+
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
2138
|
+
/** The pagination cursor. */
|
|
2139
|
+
cursor: string | null;
|
|
2140
|
+
};
|
|
2141
|
+
type ErrorType = GetApiErrorType;
|
|
2142
|
+
}
|
|
2143
|
+
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
2144
|
+
declare class InvalidUrlError extends BaseError {
|
|
2145
|
+
name: string;
|
|
2146
|
+
constructor(url: string);
|
|
2147
|
+
}
|
|
2148
|
+
declare class HttpUnauthorizedError extends BaseError {
|
|
2149
|
+
name: string;
|
|
2150
|
+
constructor();
|
|
2151
|
+
}
|
|
2152
|
+
declare class HttpForbiddenError extends BaseError {
|
|
2153
|
+
name: string;
|
|
2154
|
+
constructor();
|
|
2155
|
+
}
|
|
2156
|
+
declare class HttpRateLimitError extends BaseError {
|
|
2157
|
+
name: string;
|
|
2158
|
+
constructor();
|
|
2159
|
+
}
|
|
2160
|
+
declare class HttpGetApiFailedError extends BaseError {
|
|
2161
|
+
name: string;
|
|
2162
|
+
constructor(message: string, { details }?: {
|
|
2163
|
+
details?: string;
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
type Client$2_ConnectOptions = ConnectOptions;
|
|
2168
|
+
type Client$2_HttpForbiddenError = HttpForbiddenError;
|
|
2169
|
+
declare const Client$2_HttpForbiddenError: typeof HttpForbiddenError;
|
|
2170
|
+
type Client$2_HttpGetApiFailedError = HttpGetApiFailedError;
|
|
2171
|
+
declare const Client$2_HttpGetApiFailedError: typeof HttpGetApiFailedError;
|
|
2172
|
+
type Client$2_HttpRateLimitError = HttpRateLimitError;
|
|
2173
|
+
declare const Client$2_HttpRateLimitError: typeof HttpRateLimitError;
|
|
2174
|
+
type Client$2_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
2175
|
+
declare const Client$2_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
2176
|
+
type Client$2_InvalidUrlError = InvalidUrlError;
|
|
2177
|
+
declare const Client$2_InvalidUrlError: typeof InvalidUrlError;
|
|
2178
|
+
declare const Client$2_getObligations: typeof getObligations;
|
|
2179
|
+
declare const Client$2_getOffers: typeof getOffers;
|
|
2180
|
+
declare namespace Client$2 {
|
|
2181
|
+
export { type Client$1 as Client, type Client$2_ConnectOptions as ConnectOptions, Client$2_HttpForbiddenError as HttpForbiddenError, Client$2_HttpGetApiFailedError as HttpGetApiFailedError, Client$2_HttpRateLimitError as HttpRateLimitError, Client$2_HttpUnauthorizedError as HttpUnauthorizedError, Client$2_InvalidUrlError as InvalidUrlError, connect$1 as connect, Client$2_getObligations as getObligations, Client$2_getOffers as getOffers };
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2026
2184
|
type MempoolEVMClientConfig = {
|
|
2027
2185
|
readonly client: WalletClient;
|
|
2028
2186
|
readonly mempoolAddress: Address;
|
|
@@ -3310,4 +3468,4 @@ declare namespace index {
|
|
|
3310
3468
|
export { index_BaseError as BaseError, type index_GlobalErrorType as GlobalErrorType, type index_Snake as Snake, time as Time, index_batch as batch, index_batchMulticall as batchMulticall, fromSnakeCase$3 as fromSnakeCase, index_lazy as lazy, max$1 as max, index_min as min, index_poll as poll, index_retry as retry, toSnakeCase$1 as toSnakeCase, index_wait as wait };
|
|
3311
3469
|
}
|
|
3312
3470
|
|
|
3313
|
-
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, ChainHealth, ChainStore$1 as ChainStore, ChainsHealthResponse, Collateral$1 as Collateral, index$3 as Collector, CollectorHealth, CollectorStore$1 as CollectorStore, CollectorsHealthResponse, type Compute, Cursor$1 as Cursor, Errors, Format, Health, LLTV$1 as LLTV, Liquidity, LiquidityStore$1 as LiquidityStore, Logger$1 as Logger, Maturity$1 as Maturity, index$1 as Mempool, Obligation$1 as Obligation, ObligationResponse$1 as ObligationResponse, Offer$1 as Offer, OfferResponse$1 as OfferResponse, OfferStore$1 as OfferStore, schema as OffersSchema, OpenApi, PG$1 as PG, Quote$1 as Quote, RouterApi, RouterIndexer, RouterStatusResponse, Services$1 as Services, time as Time, index as Utils, Validation, ValidationRule, parse, safeParse };
|
|
3471
|
+
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, ChainHealth, ChainStore$1 as ChainStore, ChainsHealthResponse, Collateral$1 as Collateral, index$3 as Collector, CollectorHealth, CollectorStore$1 as CollectorStore, CollectorsHealthResponse, type Compute, Cursor$1 as Cursor, Errors, Format, Health, LLTV$1 as LLTV, Liquidity, LiquidityStore$1 as LiquidityStore, Logger$1 as Logger, Maturity$1 as Maturity, index$1 as Mempool, Obligation$1 as Obligation, ObligationResponse$1 as ObligationResponse, Offer$1 as Offer, OfferResponse$1 as OfferResponse, OfferStore$1 as OfferStore, schema as OffersSchema, OpenApi, PG$1 as PG, Quote$1 as Quote, RouterApi, Client$2 as RouterClient, RouterIndexer, RouterStatusResponse, Services$1 as Services, time as Time, index as Utils, Validation, ValidationRule, parse, safeParse };
|
package/dist/index.node.d.ts
CHANGED
|
@@ -583,14 +583,35 @@ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "hash">>): Offer;
|
|
|
583
583
|
* @returns The converted offer.
|
|
584
584
|
*/
|
|
585
585
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
586
|
+
type RandomConfig = {
|
|
587
|
+
chains?: Chain[];
|
|
588
|
+
loanTokens?: Address[];
|
|
589
|
+
collateralTokens?: Address[];
|
|
590
|
+
assetsDecimals?: Record<Address, number>;
|
|
591
|
+
buy?: boolean;
|
|
592
|
+
assets?: bigint;
|
|
593
|
+
consumed?: bigint;
|
|
594
|
+
offering?: Address;
|
|
595
|
+
maturity?: Maturity;
|
|
596
|
+
start?: number;
|
|
597
|
+
expiry?: number;
|
|
598
|
+
nonce?: bigint;
|
|
599
|
+
rate?: bigint;
|
|
600
|
+
callback?: {
|
|
601
|
+
address: Address;
|
|
602
|
+
data: Hex;
|
|
603
|
+
gasLimit: bigint;
|
|
604
|
+
};
|
|
605
|
+
collaterals?: readonly Collateral[];
|
|
606
|
+
signature?: Hex;
|
|
607
|
+
};
|
|
586
608
|
/**
|
|
587
609
|
* Generates a random Offer.
|
|
588
|
-
* The returned Offer contains randomly generated values
|
|
589
|
-
* Some fields use fixed or deterministic values (e.g., chainId, collaterals, callback).
|
|
610
|
+
* The returned Offer contains randomly generated values.
|
|
590
611
|
* @warning The generated Offer should not be used for production usage.
|
|
591
612
|
* @returns {Offer} A randomly generated Offer object.
|
|
592
613
|
*/
|
|
593
|
-
declare function random$2(): Offer;
|
|
614
|
+
declare function random$2(config?: RandomConfig): Offer;
|
|
594
615
|
/**
|
|
595
616
|
* Creates an EIP-712 domain object.
|
|
596
617
|
* @param chainId - The chain ID.
|
|
@@ -741,6 +762,7 @@ type Offer$1_Offer = Offer;
|
|
|
741
762
|
type Offer$1_OfferConsumed = OfferConsumed;
|
|
742
763
|
declare const Offer$1_OfferHashSchema: typeof OfferHashSchema;
|
|
743
764
|
declare const Offer$1_OfferSchema: typeof OfferSchema;
|
|
765
|
+
type Offer$1_RandomConfig = RandomConfig;
|
|
744
766
|
declare const Offer$1_consumedEvent: typeof consumedEvent;
|
|
745
767
|
declare const Offer$1_domain: typeof domain;
|
|
746
768
|
declare const Offer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
@@ -750,7 +772,7 @@ declare const Offer$1_sign: typeof sign;
|
|
|
750
772
|
declare const Offer$1_toSnakeCase: typeof toSnakeCase;
|
|
751
773
|
declare const Offer$1_types: typeof types;
|
|
752
774
|
declare namespace Offer$1 {
|
|
753
|
-
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, Offer$1_consumedEvent as consumedEvent, decode$1 as decode, Offer$1_domain as domain, encode$1 as encode, from$6 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$2 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$2 as random, Offer$1_sign as sign, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
775
|
+
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, type Offer$1_RandomConfig as RandomConfig, Offer$1_consumedEvent as consumedEvent, decode$1 as decode, Offer$1_domain as domain, encode$1 as encode, from$6 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$2 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$2 as random, Offer$1_sign as sign, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
754
776
|
}
|
|
755
777
|
|
|
756
778
|
/**
|
|
@@ -1112,7 +1134,7 @@ type PGLiteDB = ReturnType<typeof drizzle$1> & {
|
|
|
1112
1134
|
pool: PGlite;
|
|
1113
1135
|
};
|
|
1114
1136
|
type PG = PgDB | PGLiteDB;
|
|
1115
|
-
declare function connect$
|
|
1137
|
+
declare function connect$2(parameters: {
|
|
1116
1138
|
type: "pg";
|
|
1117
1139
|
endpoint: string;
|
|
1118
1140
|
} | {
|
|
@@ -1127,7 +1149,7 @@ type PG$1_PgDB = PgDB;
|
|
|
1127
1149
|
declare const PG$1_applyMigrations: typeof applyMigrations;
|
|
1128
1150
|
declare const PG$1_clean: typeof clean;
|
|
1129
1151
|
declare namespace PG$1 {
|
|
1130
|
-
export { type PG$1_PG as PG, type PG$1_PGLiteDB as PGLiteDB, type PG$1_PgDB as PgDB, PG$1_applyMigrations as applyMigrations, PG$1_clean as clean, connect$
|
|
1152
|
+
export { type PG$1_PG as PG, type PG$1_PGLiteDB as PGLiteDB, type PG$1_PgDB as PgDB, PG$1_applyMigrations as applyMigrations, PG$1_clean as clean, connect$2 as connect };
|
|
1131
1153
|
}
|
|
1132
1154
|
|
|
1133
1155
|
type ChainStore = {
|
|
@@ -1861,7 +1883,7 @@ declare function getHealthCollectors(healthService: HealthService): Promise<{
|
|
|
1861
1883
|
});
|
|
1862
1884
|
}>;
|
|
1863
1885
|
|
|
1864
|
-
declare function getObligations(queryParameters: object, store: OfferStore): Promise<{
|
|
1886
|
+
declare function getObligations$1(queryParameters: object, store: OfferStore): Promise<{
|
|
1865
1887
|
statusCode: STATUS_CODE;
|
|
1866
1888
|
body: {
|
|
1867
1889
|
status: "success" | "error";
|
|
@@ -1880,7 +1902,7 @@ declare function getObligations(queryParameters: object, store: OfferStore): Pro
|
|
|
1880
1902
|
});
|
|
1881
1903
|
}>;
|
|
1882
1904
|
|
|
1883
|
-
declare function getOffers(queryParameters: object, store: OfferStore): Promise<{
|
|
1905
|
+
declare function getOffers$1(queryParameters: object, store: OfferStore): Promise<{
|
|
1884
1906
|
statusCode: STATUS_CODE;
|
|
1885
1907
|
body: {
|
|
1886
1908
|
status: "success" | "error";
|
|
@@ -1903,11 +1925,9 @@ declare const index$2_getDocsHtml: typeof getDocsHtml;
|
|
|
1903
1925
|
declare const index$2_getHealth: typeof getHealth;
|
|
1904
1926
|
declare const index$2_getHealthChains: typeof getHealthChains;
|
|
1905
1927
|
declare const index$2_getHealthCollectors: typeof getHealthCollectors;
|
|
1906
|
-
declare const index$2_getObligations: typeof getObligations;
|
|
1907
|
-
declare const index$2_getOffers: typeof getOffers;
|
|
1908
1928
|
declare const index$2_getSwaggerJson: typeof getSwaggerJson;
|
|
1909
1929
|
declare namespace index$2 {
|
|
1910
|
-
export { index$2_getDocsHtml as getDocsHtml, index$2_getHealth as getHealth, index$2_getHealthChains as getHealthChains, index$2_getHealthCollectors as getHealthCollectors,
|
|
1930
|
+
export { index$2_getDocsHtml as getDocsHtml, index$2_getHealth as getHealth, index$2_getHealthChains as getHealthChains, index$2_getHealthCollectors as getHealthCollectors, getObligations$1 as getObligations, getOffers$1 as getOffers, index$2_getSwaggerJson as getSwaggerJson };
|
|
1911
1931
|
}
|
|
1912
1932
|
|
|
1913
1933
|
declare const CollectorHealth: z$1.ZodObject<{
|
|
@@ -2023,6 +2043,144 @@ declare namespace RouterApi {
|
|
|
2023
2043
|
export { RouterApi_ChainHealth as ChainHealth, type RouterApi_ChainsHealthResponse as ChainsHealthResponse, RouterApi_CollectorHealth as CollectorHealth, type RouterApi_CollectorsHealthResponse as CollectorsHealthResponse, index$2 as Controllers, ObligationResponse$1 as ObligationResponse, OfferResponse$1 as OfferResponse, RouterApi_OpenApi as OpenApi, type RouterApi$1 as RouterApi, type RouterApi_RouterApiConfig as RouterApiConfig, type RouterApi_RouterStatusResponse as RouterStatusResponse, RouterApi_create as create, RouterApi_parse as parse, RouterApi_safeParse as safeParse };
|
|
2024
2044
|
}
|
|
2025
2045
|
|
|
2046
|
+
type RouterClientConfig = {
|
|
2047
|
+
/** The URL of the router. */
|
|
2048
|
+
readonly url: URL;
|
|
2049
|
+
/** The default headers to use for each request. */
|
|
2050
|
+
readonly headers: Headers;
|
|
2051
|
+
};
|
|
2052
|
+
type Client$1 = Compute<RouterClientConfig & {
|
|
2053
|
+
/**
|
|
2054
|
+
* Get offers from the router.
|
|
2055
|
+
* @param parameters - {@link getOffers.Parameters}
|
|
2056
|
+
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
2057
|
+
*
|
|
2058
|
+
* @example
|
|
2059
|
+
* ```ts
|
|
2060
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2061
|
+
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
2062
|
+
* console.log(offers);
|
|
2063
|
+
* ```
|
|
2064
|
+
*/
|
|
2065
|
+
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
2066
|
+
/**
|
|
2067
|
+
* Get obligations from the router.
|
|
2068
|
+
* @param parameters - {@link getObligations.Parameters}
|
|
2069
|
+
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
2070
|
+
*
|
|
2071
|
+
* @example
|
|
2072
|
+
* ```ts
|
|
2073
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2074
|
+
* const { obligations, cursor } = await router.getObligations();
|
|
2075
|
+
* console.log(obligations);
|
|
2076
|
+
* ```
|
|
2077
|
+
*/
|
|
2078
|
+
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
2079
|
+
}>;
|
|
2080
|
+
type ConnectOptions = {
|
|
2081
|
+
/** The URL of the router to interact with.
|
|
2082
|
+
* @default "https://router.morpho.dev"
|
|
2083
|
+
*/
|
|
2084
|
+
url?: string;
|
|
2085
|
+
/** The API key to use for the router API. */
|
|
2086
|
+
apiKey?: string;
|
|
2087
|
+
/** The default headers to use for each request. */
|
|
2088
|
+
headers?: Headers;
|
|
2089
|
+
};
|
|
2090
|
+
/**
|
|
2091
|
+
* Creates an instance of a router client.
|
|
2092
|
+
* @constructor
|
|
2093
|
+
* @param options - {@link ConnectOptions}
|
|
2094
|
+
* @returns A Router Client. {@link Client}
|
|
2095
|
+
*
|
|
2096
|
+
* @example
|
|
2097
|
+
* ```typescript
|
|
2098
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2099
|
+
* ```
|
|
2100
|
+
*/
|
|
2101
|
+
declare function connect$1(options?: ConnectOptions): connect$1.ReturnType;
|
|
2102
|
+
declare namespace connect$1 {
|
|
2103
|
+
type ReturnType = Client$1;
|
|
2104
|
+
type ErrorType = InvalidUrlError;
|
|
2105
|
+
}
|
|
2106
|
+
declare function getOffers(config: RouterClientConfig, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
2107
|
+
declare namespace getOffers {
|
|
2108
|
+
type Parameters = {
|
|
2109
|
+
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
2110
|
+
side: "buy" | "sell";
|
|
2111
|
+
/** The offers obligation id */
|
|
2112
|
+
obligationId: Hex;
|
|
2113
|
+
/** Pagination cursor in base64url-encoded format */
|
|
2114
|
+
cursor?: string;
|
|
2115
|
+
/** Maximum number of offers to return. @default 20 */
|
|
2116
|
+
limit?: number;
|
|
2117
|
+
};
|
|
2118
|
+
type ReturnType = {
|
|
2119
|
+
offers: Offer[];
|
|
2120
|
+
/** The pagination cursor. */
|
|
2121
|
+
cursor: string | null;
|
|
2122
|
+
};
|
|
2123
|
+
type ErrorType = GetApiErrorType;
|
|
2124
|
+
}
|
|
2125
|
+
declare function getObligations(config: RouterClientConfig, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
2126
|
+
declare namespace getObligations {
|
|
2127
|
+
type Parameters = {
|
|
2128
|
+
/** Pagination cursor is a 32-byte hex string. */
|
|
2129
|
+
cursor?: Hex;
|
|
2130
|
+
/** Maximum number of obligations to return. @default 20 */
|
|
2131
|
+
limit?: number;
|
|
2132
|
+
};
|
|
2133
|
+
type ReturnType = {
|
|
2134
|
+
obligations: Compute<{
|
|
2135
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
2136
|
+
id: () => Hex;
|
|
2137
|
+
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
2138
|
+
/** The pagination cursor. */
|
|
2139
|
+
cursor: string | null;
|
|
2140
|
+
};
|
|
2141
|
+
type ErrorType = GetApiErrorType;
|
|
2142
|
+
}
|
|
2143
|
+
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
2144
|
+
declare class InvalidUrlError extends BaseError {
|
|
2145
|
+
name: string;
|
|
2146
|
+
constructor(url: string);
|
|
2147
|
+
}
|
|
2148
|
+
declare class HttpUnauthorizedError extends BaseError {
|
|
2149
|
+
name: string;
|
|
2150
|
+
constructor();
|
|
2151
|
+
}
|
|
2152
|
+
declare class HttpForbiddenError extends BaseError {
|
|
2153
|
+
name: string;
|
|
2154
|
+
constructor();
|
|
2155
|
+
}
|
|
2156
|
+
declare class HttpRateLimitError extends BaseError {
|
|
2157
|
+
name: string;
|
|
2158
|
+
constructor();
|
|
2159
|
+
}
|
|
2160
|
+
declare class HttpGetApiFailedError extends BaseError {
|
|
2161
|
+
name: string;
|
|
2162
|
+
constructor(message: string, { details }?: {
|
|
2163
|
+
details?: string;
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
type Client$2_ConnectOptions = ConnectOptions;
|
|
2168
|
+
type Client$2_HttpForbiddenError = HttpForbiddenError;
|
|
2169
|
+
declare const Client$2_HttpForbiddenError: typeof HttpForbiddenError;
|
|
2170
|
+
type Client$2_HttpGetApiFailedError = HttpGetApiFailedError;
|
|
2171
|
+
declare const Client$2_HttpGetApiFailedError: typeof HttpGetApiFailedError;
|
|
2172
|
+
type Client$2_HttpRateLimitError = HttpRateLimitError;
|
|
2173
|
+
declare const Client$2_HttpRateLimitError: typeof HttpRateLimitError;
|
|
2174
|
+
type Client$2_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
2175
|
+
declare const Client$2_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
2176
|
+
type Client$2_InvalidUrlError = InvalidUrlError;
|
|
2177
|
+
declare const Client$2_InvalidUrlError: typeof InvalidUrlError;
|
|
2178
|
+
declare const Client$2_getObligations: typeof getObligations;
|
|
2179
|
+
declare const Client$2_getOffers: typeof getOffers;
|
|
2180
|
+
declare namespace Client$2 {
|
|
2181
|
+
export { type Client$1 as Client, type Client$2_ConnectOptions as ConnectOptions, Client$2_HttpForbiddenError as HttpForbiddenError, Client$2_HttpGetApiFailedError as HttpGetApiFailedError, Client$2_HttpRateLimitError as HttpRateLimitError, Client$2_HttpUnauthorizedError as HttpUnauthorizedError, Client$2_InvalidUrlError as InvalidUrlError, connect$1 as connect, Client$2_getObligations as getObligations, Client$2_getOffers as getOffers };
|
|
2182
|
+
}
|
|
2183
|
+
|
|
2026
2184
|
type MempoolEVMClientConfig = {
|
|
2027
2185
|
readonly client: WalletClient;
|
|
2028
2186
|
readonly mempoolAddress: Address;
|
|
@@ -3310,4 +3468,4 @@ declare namespace index {
|
|
|
3310
3468
|
export { index_BaseError as BaseError, type index_GlobalErrorType as GlobalErrorType, type index_Snake as Snake, time as Time, index_batch as batch, index_batchMulticall as batchMulticall, fromSnakeCase$3 as fromSnakeCase, index_lazy as lazy, max$1 as max, index_min as min, index_poll as poll, index_retry as retry, toSnakeCase$1 as toSnakeCase, index_wait as wait };
|
|
3311
3469
|
}
|
|
3312
3470
|
|
|
3313
|
-
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, ChainHealth, ChainStore$1 as ChainStore, ChainsHealthResponse, Collateral$1 as Collateral, index$3 as Collector, CollectorHealth, CollectorStore$1 as CollectorStore, CollectorsHealthResponse, type Compute, Cursor$1 as Cursor, Errors, Format, Health, LLTV$1 as LLTV, Liquidity, LiquidityStore$1 as LiquidityStore, Logger$1 as Logger, Maturity$1 as Maturity, index$1 as Mempool, Obligation$1 as Obligation, ObligationResponse$1 as ObligationResponse, Offer$1 as Offer, OfferResponse$1 as OfferResponse, OfferStore$1 as OfferStore, schema as OffersSchema, OpenApi, PG$1 as PG, Quote$1 as Quote, RouterApi, RouterIndexer, RouterStatusResponse, Services$1 as Services, time as Time, index as Utils, Validation, ValidationRule, parse, safeParse };
|
|
3471
|
+
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, ChainHealth, ChainStore$1 as ChainStore, ChainsHealthResponse, Collateral$1 as Collateral, index$3 as Collector, CollectorHealth, CollectorStore$1 as CollectorStore, CollectorsHealthResponse, type Compute, Cursor$1 as Cursor, Errors, Format, Health, LLTV$1 as LLTV, Liquidity, LiquidityStore$1 as LiquidityStore, Logger$1 as Logger, Maturity$1 as Maturity, index$1 as Mempool, Obligation$1 as Obligation, ObligationResponse$1 as ObligationResponse, Offer$1 as Offer, OfferResponse$1 as OfferResponse, OfferStore$1 as OfferStore, schema as OffersSchema, OpenApi, PG$1 as PG, Quote$1 as Quote, RouterApi, Client$2 as RouterClient, RouterIndexer, RouterStatusResponse, Services$1 as Services, time as Time, index as Utils, Validation, ValidationRule, parse, safeParse };
|