@morpho-dev/router 0.1.2 → 0.1.4
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/dist/index.browser.d.cts +132 -149
- package/dist/index.browser.d.ts +132 -149
- package/dist/index.browser.js +355 -302
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +355 -303
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +175 -193
- package/dist/index.node.d.ts +175 -193
- package/dist/index.node.js +355 -303
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +355 -304
- package/dist/index.node.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.node.d.ts
CHANGED
|
@@ -1,15 +1,132 @@
|
|
|
1
1
|
import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
2
2
|
import { Offer, Errors, Format, Maturity, LLTV, Compute, Chain } from '@morpho-dev/mempool';
|
|
3
3
|
export * from '@morpho-dev/mempool';
|
|
4
|
+
import * as viem from 'viem';
|
|
5
|
+
import { PublicActions, Address, Hex } from 'viem';
|
|
4
6
|
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
5
7
|
import { z, ZodError } from 'zod/v4';
|
|
6
|
-
import * as viem from 'viem';
|
|
7
|
-
import { Address, Hex, PublicClient } from 'viem';
|
|
8
8
|
import * as hono_utils_types from 'hono/utils/types';
|
|
9
9
|
import * as hono from 'hono';
|
|
10
10
|
import { Context } from 'hono';
|
|
11
11
|
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
12
12
|
|
|
13
|
+
declare function fetchBalancesAndAllowances(parameters: {
|
|
14
|
+
client: Pick<PublicActions, "multicall">;
|
|
15
|
+
spender: Address;
|
|
16
|
+
pairs: Array<{
|
|
17
|
+
user: Address;
|
|
18
|
+
token: Address;
|
|
19
|
+
}>;
|
|
20
|
+
options?: {
|
|
21
|
+
batchSize?: number;
|
|
22
|
+
retryAttempts?: number;
|
|
23
|
+
retryDelayMs?: number;
|
|
24
|
+
blockNumber?: number;
|
|
25
|
+
};
|
|
26
|
+
}): Promise<Map<Address, Map<Address, {
|
|
27
|
+
balance: bigint;
|
|
28
|
+
allowance: bigint;
|
|
29
|
+
}>>>;
|
|
30
|
+
type LiquidityUserPosition = {
|
|
31
|
+
id: string;
|
|
32
|
+
availableLiquidityQueueId: string;
|
|
33
|
+
user: string;
|
|
34
|
+
chainId: bigint;
|
|
35
|
+
amount: string;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
};
|
|
38
|
+
type LiquidityQueue = {
|
|
39
|
+
queueId: string;
|
|
40
|
+
availableLiquidityPoolId: string;
|
|
41
|
+
index: number;
|
|
42
|
+
updatedAt: Date;
|
|
43
|
+
};
|
|
44
|
+
type LiquidityPool = {
|
|
45
|
+
id: string;
|
|
46
|
+
amount: string;
|
|
47
|
+
updatedAt: Date;
|
|
48
|
+
};
|
|
49
|
+
type LiquidityQueueWithPool = {
|
|
50
|
+
queue: LiquidityQueue;
|
|
51
|
+
pool: LiquidityPool;
|
|
52
|
+
};
|
|
53
|
+
type Liquidity = {
|
|
54
|
+
userPosition: LiquidityUserPosition;
|
|
55
|
+
queues: LiquidityQueueWithPool[];
|
|
56
|
+
};
|
|
57
|
+
declare function fetch(parameters: {
|
|
58
|
+
client: Pick<PublicActions, "multicall">;
|
|
59
|
+
chainId: bigint;
|
|
60
|
+
spender: Address;
|
|
61
|
+
type: CallbackType;
|
|
62
|
+
pairs: Array<{
|
|
63
|
+
user: Address;
|
|
64
|
+
contract: Address;
|
|
65
|
+
}>;
|
|
66
|
+
options?: {
|
|
67
|
+
batchSize?: number;
|
|
68
|
+
retryAttempts?: number;
|
|
69
|
+
retryDelayMs?: number;
|
|
70
|
+
blockNumber?: number;
|
|
71
|
+
};
|
|
72
|
+
}): Promise<Liquidity[]>;
|
|
73
|
+
declare function serialize(liquidity: Liquidity): string;
|
|
74
|
+
|
|
75
|
+
type Liquidity$1_Liquidity = Liquidity;
|
|
76
|
+
type Liquidity$1_LiquidityPool = LiquidityPool;
|
|
77
|
+
type Liquidity$1_LiquidityQueue = LiquidityQueue;
|
|
78
|
+
type Liquidity$1_LiquidityQueueWithPool = LiquidityQueueWithPool;
|
|
79
|
+
type Liquidity$1_LiquidityUserPosition = LiquidityUserPosition;
|
|
80
|
+
declare const Liquidity$1_fetch: typeof fetch;
|
|
81
|
+
declare const Liquidity$1_fetchBalancesAndAllowances: typeof fetchBalancesAndAllowances;
|
|
82
|
+
declare const Liquidity$1_serialize: typeof serialize;
|
|
83
|
+
declare namespace Liquidity$1 {
|
|
84
|
+
export { type Liquidity$1_Liquidity as Liquidity, type Liquidity$1_LiquidityPool as LiquidityPool, type Liquidity$1_LiquidityQueue as LiquidityQueue, type Liquidity$1_LiquidityQueueWithPool as LiquidityQueueWithPool, type Liquidity$1_LiquidityUserPosition as LiquidityUserPosition, Liquidity$1_fetch as fetch, Liquidity$1_fetchBalancesAndAllowances as fetchBalancesAndAllowances, Liquidity$1_serialize as serialize };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare enum CallbackType {
|
|
88
|
+
BuyWithEmptyCallback = "buy_with_empty_callback"
|
|
89
|
+
}
|
|
90
|
+
declare function buildLiquidity(parameters: {
|
|
91
|
+
type: CallbackType;
|
|
92
|
+
user: string;
|
|
93
|
+
contract: string;
|
|
94
|
+
chainId: bigint;
|
|
95
|
+
amount: string | bigint;
|
|
96
|
+
index?: number;
|
|
97
|
+
updatedAt?: Date;
|
|
98
|
+
}): Liquidity;
|
|
99
|
+
declare function getCallbackIdForOffer(offer: Offer.Offer): string | null;
|
|
100
|
+
|
|
101
|
+
type Callback_CallbackType = CallbackType;
|
|
102
|
+
declare const Callback_CallbackType: typeof CallbackType;
|
|
103
|
+
declare const Callback_buildLiquidity: typeof buildLiquidity;
|
|
104
|
+
declare const Callback_getCallbackIdForOffer: typeof getCallbackIdForOffer;
|
|
105
|
+
declare namespace Callback {
|
|
106
|
+
export { Callback_CallbackType as CallbackType, Callback_buildLiquidity as buildLiquidity, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
type Cursor = {
|
|
110
|
+
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
111
|
+
dir: "asc" | "desc";
|
|
112
|
+
rate?: string;
|
|
113
|
+
maturity?: number;
|
|
114
|
+
expiry?: number;
|
|
115
|
+
assets?: string;
|
|
116
|
+
hash: string;
|
|
117
|
+
};
|
|
118
|
+
declare function validate(cursor: unknown): cursor is Cursor;
|
|
119
|
+
declare function encode(c: Cursor): string;
|
|
120
|
+
declare function decode(token?: string): Cursor | null;
|
|
121
|
+
|
|
122
|
+
type Cursor$1_Cursor = Cursor;
|
|
123
|
+
declare const Cursor$1_decode: typeof decode;
|
|
124
|
+
declare const Cursor$1_encode: typeof encode;
|
|
125
|
+
declare const Cursor$1_validate: typeof validate;
|
|
126
|
+
declare namespace Cursor$1 {
|
|
127
|
+
export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
|
|
128
|
+
}
|
|
129
|
+
|
|
13
130
|
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
14
131
|
|
|
15
132
|
declare const schemas: {
|
|
@@ -70,7 +187,6 @@ declare const schemas: {
|
|
|
70
187
|
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
71
188
|
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
72
189
|
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
73
|
-
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
74
190
|
cursor: z.ZodOptional<z.ZodString>;
|
|
75
191
|
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
76
192
|
}, z.core.$strip>;
|
|
@@ -162,8 +278,8 @@ declare const consumedEvent: {
|
|
|
162
278
|
* @param input - The router offer to create.
|
|
163
279
|
* @returns The created router offer with its hash.
|
|
164
280
|
*/
|
|
165
|
-
declare function from
|
|
166
|
-
declare namespace from
|
|
281
|
+
declare function from(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
282
|
+
declare namespace from {
|
|
167
283
|
type ErrorType = InvalidRouterOfferError;
|
|
168
284
|
}
|
|
169
285
|
/**
|
|
@@ -206,12 +322,13 @@ declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
|
206
322
|
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
207
323
|
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
208
324
|
declare const RouterOffer$1_consumedEvent: typeof consumedEvent;
|
|
325
|
+
declare const RouterOffer$1_from: typeof from;
|
|
209
326
|
declare const RouterOffer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
210
327
|
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
211
328
|
declare const RouterOffer$1_random: typeof random;
|
|
212
329
|
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
213
330
|
declare namespace RouterOffer$1 {
|
|
214
|
-
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferConsumed as OfferConsumed, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, RouterOffer$1_consumedEvent as consumedEvent,
|
|
331
|
+
export { RouterOffer$1_InvalidRouterOfferError as InvalidRouterOfferError, type RouterOffer$1_OfferConsumed as OfferConsumed, type RouterOffer$1_OfferMetadata as OfferMetadata, type RouterOffer$1_OfferStatus as OfferStatus, RouterOffer$1_OfferStatusValues as OfferStatusValues, type RouterOffer$1_RouterOffer as RouterOffer, RouterOffer$1_RouterOfferSchema as RouterOfferSchema, RouterOffer$1_consumedEvent as consumedEvent, RouterOffer$1_from as from, RouterOffer$1_fromConsumedLog as fromConsumedLog, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
215
332
|
}
|
|
216
333
|
|
|
217
334
|
type OfferResponse = {
|
|
@@ -233,14 +350,14 @@ declare function toResponse(routerOffer: RouterOffer): OfferResponse;
|
|
|
233
350
|
*/
|
|
234
351
|
declare function fromResponse(offerResponse: OfferResponse): RouterOffer;
|
|
235
352
|
|
|
236
|
-
type index$
|
|
237
|
-
declare const index$
|
|
238
|
-
declare const index$
|
|
239
|
-
declare const index$
|
|
240
|
-
declare const index$
|
|
241
|
-
declare const index$
|
|
242
|
-
declare namespace index$
|
|
243
|
-
export { type index$
|
|
353
|
+
type index$2_OfferResponse = OfferResponse;
|
|
354
|
+
declare const index$2_OpenApi: typeof OpenApi;
|
|
355
|
+
declare const index$2_fromResponse: typeof fromResponse;
|
|
356
|
+
declare const index$2_parse: typeof parse;
|
|
357
|
+
declare const index$2_safeParse: typeof safeParse;
|
|
358
|
+
declare const index$2_toResponse: typeof toResponse;
|
|
359
|
+
declare namespace index$2 {
|
|
360
|
+
export { type index$2_OfferResponse as OfferResponse, index$2_OpenApi as OpenApi, index$2_fromResponse as fromResponse, index$2_parse as parse, index$2_safeParse as safeParse, index$2_toResponse as toResponse };
|
|
244
361
|
}
|
|
245
362
|
|
|
246
363
|
type GetParameters = {
|
|
@@ -480,8 +597,6 @@ type FindMatchingOffersParams = {
|
|
|
480
597
|
maxMaturity?: number;
|
|
481
598
|
loanToken?: string;
|
|
482
599
|
creator?: string;
|
|
483
|
-
/** Filter by offer status; if omitted defaults to ["valid"] */
|
|
484
|
-
status?: OfferStatus[];
|
|
485
600
|
/** Cursor string returned by a previous call, for pagination */
|
|
486
601
|
cursor?: string;
|
|
487
602
|
/** Page size; defaults to 20 */
|
|
@@ -499,13 +614,13 @@ declare function memory(parameters: {
|
|
|
499
614
|
filled: Map<Chain.Id, Map<Address, Map<bigint, bigint>>>;
|
|
500
615
|
}): OfferStore;
|
|
501
616
|
|
|
502
|
-
type index$
|
|
503
|
-
type index$
|
|
504
|
-
type index$
|
|
505
|
-
type index$
|
|
506
|
-
declare const index$
|
|
507
|
-
declare namespace index$
|
|
508
|
-
export { type index$
|
|
617
|
+
type index$1_FindMatchingOffersParams = FindMatchingOffersParams;
|
|
618
|
+
type index$1_GetAllParams = GetAllParams;
|
|
619
|
+
type index$1_GetOffersFilters = GetOffersFilters;
|
|
620
|
+
type index$1_OfferStore = OfferStore;
|
|
621
|
+
declare const index$1_memory: typeof memory;
|
|
622
|
+
declare namespace index$1 {
|
|
623
|
+
export { type index$1_FindMatchingOffersParams as FindMatchingOffersParams, type index$1_GetAllParams as GetAllParams, type index$1_GetOffersFilters as GetOffersFilters, type index$1_OfferStore as OfferStore, index$1_memory as memory };
|
|
509
624
|
}
|
|
510
625
|
|
|
511
626
|
/**
|
|
@@ -604,39 +719,39 @@ declare class BadRequestError extends APIError {
|
|
|
604
719
|
}
|
|
605
720
|
declare function handleZodError(error: z.ZodError): ValidationError;
|
|
606
721
|
|
|
607
|
-
type
|
|
608
|
-
declare const
|
|
609
|
-
type
|
|
610
|
-
declare const
|
|
611
|
-
type
|
|
612
|
-
type
|
|
613
|
-
type
|
|
614
|
-
declare const
|
|
615
|
-
type
|
|
616
|
-
declare const
|
|
617
|
-
type
|
|
618
|
-
declare const
|
|
619
|
-
type
|
|
620
|
-
declare const
|
|
621
|
-
type
|
|
622
|
-
declare const
|
|
623
|
-
type
|
|
624
|
-
declare const
|
|
625
|
-
type
|
|
626
|
-
type
|
|
627
|
-
declare const
|
|
628
|
-
type
|
|
629
|
-
type
|
|
630
|
-
declare const
|
|
631
|
-
declare const
|
|
632
|
-
declare const
|
|
633
|
-
declare const
|
|
634
|
-
declare const
|
|
635
|
-
declare const
|
|
636
|
-
declare const
|
|
637
|
-
declare const
|
|
638
|
-
declare namespace index
|
|
639
|
-
export {
|
|
722
|
+
type index_APIError = APIError;
|
|
723
|
+
declare const index_APIError: typeof APIError;
|
|
724
|
+
type index_BadRequestError = BadRequestError;
|
|
725
|
+
declare const index_BadRequestError: typeof BadRequestError;
|
|
726
|
+
type index_Client = Client;
|
|
727
|
+
type index_GetParameters = GetParameters;
|
|
728
|
+
type index_HttpForbiddenError = HttpForbiddenError;
|
|
729
|
+
declare const index_HttpForbiddenError: typeof HttpForbiddenError;
|
|
730
|
+
type index_HttpGetOffersFailedError = HttpGetOffersFailedError;
|
|
731
|
+
declare const index_HttpGetOffersFailedError: typeof HttpGetOffersFailedError;
|
|
732
|
+
type index_HttpRateLimitError = HttpRateLimitError;
|
|
733
|
+
declare const index_HttpRateLimitError: typeof HttpRateLimitError;
|
|
734
|
+
type index_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
735
|
+
declare const index_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
736
|
+
type index_InternalServerError = InternalServerError;
|
|
737
|
+
declare const index_InternalServerError: typeof InternalServerError;
|
|
738
|
+
type index_InvalidUrlError = InvalidUrlError;
|
|
739
|
+
declare const index_InvalidUrlError: typeof InvalidUrlError;
|
|
740
|
+
type index_MatchParameters = MatchParameters;
|
|
741
|
+
type index_NotFoundError = NotFoundError;
|
|
742
|
+
declare const index_NotFoundError: typeof NotFoundError;
|
|
743
|
+
type index_RouterClientConfig = RouterClientConfig;
|
|
744
|
+
type index_ValidationError = ValidationError;
|
|
745
|
+
declare const index_ValidationError: typeof ValidationError;
|
|
746
|
+
declare const index_connect: typeof connect;
|
|
747
|
+
declare const index_error: typeof error;
|
|
748
|
+
declare const index_get: typeof get;
|
|
749
|
+
declare const index_handleZodError: typeof handleZodError;
|
|
750
|
+
declare const index_match: typeof match;
|
|
751
|
+
declare const index_serve: typeof serve;
|
|
752
|
+
declare const index_success: typeof success;
|
|
753
|
+
declare namespace index {
|
|
754
|
+
export { index_APIError as APIError, index_BadRequestError as BadRequestError, type index_Client as Client, type index_GetParameters as GetParameters, index_HttpForbiddenError as HttpForbiddenError, index_HttpGetOffersFailedError as HttpGetOffersFailedError, index_HttpRateLimitError as HttpRateLimitError, index_HttpUnauthorizedError as HttpUnauthorizedError, index_InternalServerError as InternalServerError, index_InvalidUrlError as InvalidUrlError, type index_MatchParameters as MatchParameters, index_NotFoundError as NotFoundError, type index_RouterClientConfig as RouterClientConfig, index_ValidationError as ValidationError, index_connect as connect, index_error as error, index_get as get, index_handleZodError as handleZodError, index_match as match, index_serve as serve, index_success as success };
|
|
640
755
|
}
|
|
641
756
|
|
|
642
757
|
declare const LogLevelValues: readonly ["silent", "trace", "debug", "info", "warn", "error", "fatal"];
|
|
@@ -671,89 +786,6 @@ declare namespace Logger$1 {
|
|
|
671
786
|
export { type Logger$1_LogFn as LogFn, type Logger$1_LogLevel as LogLevel, Logger$1_LogLevelValues as LogLevelValues, type Logger$1_Logger as Logger, Logger$1_defaultLogger as defaultLogger, Logger$1_getLogger as getLogger, Logger$1_runWithLogger as runWithLogger, Logger$1_silentLogger as silentLogger };
|
|
672
787
|
}
|
|
673
788
|
|
|
674
|
-
declare const types: readonly ["offer_created", "offer_consumed", "offer_validation"];
|
|
675
|
-
type Type = (typeof types)[number];
|
|
676
|
-
type BaseEvent<type extends Type = Type> = {
|
|
677
|
-
readonly id: string;
|
|
678
|
-
readonly type: type;
|
|
679
|
-
};
|
|
680
|
-
type RouterEvent<type extends Type = Type> = type extends "offer_consumed" ? Compute<BaseEvent<type> & {
|
|
681
|
-
readonly offerConsumed: OfferConsumed;
|
|
682
|
-
}> : type extends "offer_created" | "offer_validation" ? Compute<BaseEvent<type> & {
|
|
683
|
-
readonly offer: Offer.Offer;
|
|
684
|
-
}> : never;
|
|
685
|
-
/**
|
|
686
|
-
* Creates a RouterEvent with a deterministic id.
|
|
687
|
-
*/
|
|
688
|
-
declare function from<T extends Type = Type>(base: Omit<RouterEvent<T>, "id" | "type"> & {
|
|
689
|
-
type: T;
|
|
690
|
-
}): Compute<RouterEvent<T>>;
|
|
691
|
-
|
|
692
|
-
type RouterEvent$1_RouterEvent<type extends Type = Type> = RouterEvent<type>;
|
|
693
|
-
type RouterEvent$1_Type = Type;
|
|
694
|
-
declare const RouterEvent$1_from: typeof from;
|
|
695
|
-
declare const RouterEvent$1_types: typeof types;
|
|
696
|
-
declare namespace RouterEvent$1 {
|
|
697
|
-
export { type RouterEvent$1_RouterEvent as RouterEvent, type RouterEvent$1_Type as Type, RouterEvent$1_from as from, RouterEvent$1_types as types };
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* Splits an array into batches of a specified size.
|
|
702
|
-
* @param array The array to split.
|
|
703
|
-
* @param batchSize The size of each batch.
|
|
704
|
-
* @returns An iterator that yields each batch.
|
|
705
|
-
* @example
|
|
706
|
-
* ```typescript
|
|
707
|
-
* const array = [1, 2, 3, 4, 5];
|
|
708
|
-
* for (const batch of batch(array, 2)) {
|
|
709
|
-
* console.log(batch);
|
|
710
|
-
* }
|
|
711
|
-
* // Output:
|
|
712
|
-
* // [1, 2]
|
|
713
|
-
* // [3, 4]
|
|
714
|
-
* // [5]
|
|
715
|
-
* ```
|
|
716
|
-
*/
|
|
717
|
-
declare function batch$1<T>(array: Array<T>, batchSize: number): Generator<T[], void, unknown>;
|
|
718
|
-
|
|
719
|
-
type Cursor = {
|
|
720
|
-
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
721
|
-
dir: "asc" | "desc";
|
|
722
|
-
rate?: string;
|
|
723
|
-
maturity?: number;
|
|
724
|
-
expiry?: number;
|
|
725
|
-
assets?: string;
|
|
726
|
-
hash: string;
|
|
727
|
-
};
|
|
728
|
-
declare function validateCursor(cursor: unknown): cursor is Cursor;
|
|
729
|
-
declare function encodeCursor(c: Cursor): string;
|
|
730
|
-
declare function decodeCursor(token?: string): Cursor | null;
|
|
731
|
-
|
|
732
|
-
/**
|
|
733
|
-
* Polls a function at a specified interval.
|
|
734
|
-
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
735
|
-
*/
|
|
736
|
-
declare function poll<data>(fn: ({ unpoll }: {
|
|
737
|
-
unpoll: () => void;
|
|
738
|
-
}) => Promise<data | undefined>, { interval }: {
|
|
739
|
-
interval: number;
|
|
740
|
-
}): () => boolean;
|
|
741
|
-
|
|
742
|
-
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
743
|
-
|
|
744
|
-
declare function wait(time: number): Promise<unknown>;
|
|
745
|
-
|
|
746
|
-
type index_Cursor = Cursor;
|
|
747
|
-
declare const index_decodeCursor: typeof decodeCursor;
|
|
748
|
-
declare const index_encodeCursor: typeof encodeCursor;
|
|
749
|
-
declare const index_poll: typeof poll;
|
|
750
|
-
declare const index_retry: typeof retry;
|
|
751
|
-
declare const index_validateCursor: typeof validateCursor;
|
|
752
|
-
declare const index_wait: typeof wait;
|
|
753
|
-
declare namespace index {
|
|
754
|
-
export { type index_Cursor as Cursor, batch$1 as batch, index_decodeCursor as decodeCursor, index_encodeCursor as encodeCursor, index_poll as poll, index_retry as retry, index_validateCursor as validateCursor, index_wait as wait };
|
|
755
|
-
}
|
|
756
|
-
|
|
757
789
|
/**
|
|
758
790
|
* A validation rule.
|
|
759
791
|
*/
|
|
@@ -798,11 +830,9 @@ declare function single<Name extends string, T, Ctx = void>(name: Name, run: Sin
|
|
|
798
830
|
*/
|
|
799
831
|
declare function batch<Name extends string, T, Ctx = void>(name: Name, run: Batch<T, Name, Ctx>): Rule<T, Name, Ctx>;
|
|
800
832
|
type MorphoContext = {
|
|
801
|
-
|
|
833
|
+
chain: Chain.Chain;
|
|
802
834
|
};
|
|
803
|
-
declare function morpho(
|
|
804
|
-
whitelistedChains: Chain.Chain[];
|
|
805
|
-
}): (Rule<{
|
|
835
|
+
declare function morpho(): (Rule<{
|
|
806
836
|
readonly offering: Address;
|
|
807
837
|
readonly assets: bigint;
|
|
808
838
|
readonly rate: bigint;
|
|
@@ -898,55 +928,7 @@ declare function morpho(parameters: {
|
|
|
898
928
|
readonly hash: viem.Hex;
|
|
899
929
|
signature?: viem.Hex;
|
|
900
930
|
createdAt?: number;
|
|
901
|
-
}, "empty_callback", MorphoContext>
|
|
902
|
-
readonly offering: Address;
|
|
903
|
-
readonly assets: bigint;
|
|
904
|
-
readonly rate: bigint;
|
|
905
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
906
|
-
readonly expiry: number;
|
|
907
|
-
readonly nonce: bigint;
|
|
908
|
-
readonly buy: boolean;
|
|
909
|
-
readonly chainId: bigint;
|
|
910
|
-
readonly loanToken: Address;
|
|
911
|
-
readonly start: number;
|
|
912
|
-
readonly collaterals: readonly {
|
|
913
|
-
asset: Address;
|
|
914
|
-
oracle: Address;
|
|
915
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
916
|
-
}[];
|
|
917
|
-
readonly callback: {
|
|
918
|
-
readonly address: Address;
|
|
919
|
-
readonly data: viem.Hex;
|
|
920
|
-
readonly gasLimit: bigint;
|
|
921
|
-
};
|
|
922
|
-
readonly hash: viem.Hex;
|
|
923
|
-
signature?: viem.Hex;
|
|
924
|
-
createdAt?: number;
|
|
925
|
-
}, "sell_offers_empty_callback", MorphoContext> | Rule<{
|
|
926
|
-
readonly offering: Address;
|
|
927
|
-
readonly assets: bigint;
|
|
928
|
-
readonly rate: bigint;
|
|
929
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
930
|
-
readonly expiry: number;
|
|
931
|
-
readonly nonce: bigint;
|
|
932
|
-
readonly buy: boolean;
|
|
933
|
-
readonly chainId: bigint;
|
|
934
|
-
readonly loanToken: Address;
|
|
935
|
-
readonly start: number;
|
|
936
|
-
readonly collaterals: readonly {
|
|
937
|
-
asset: Address;
|
|
938
|
-
oracle: Address;
|
|
939
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
940
|
-
}[];
|
|
941
|
-
readonly callback: {
|
|
942
|
-
readonly address: Address;
|
|
943
|
-
readonly data: viem.Hex;
|
|
944
|
-
readonly gasLimit: bigint;
|
|
945
|
-
};
|
|
946
|
-
readonly hash: viem.Hex;
|
|
947
|
-
signature?: viem.Hex;
|
|
948
|
-
createdAt?: number;
|
|
949
|
-
}, "buy_offers_empty_callback", MorphoContext>)[];
|
|
931
|
+
}, "empty_callback", MorphoContext>)[];
|
|
950
932
|
|
|
951
933
|
type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
|
|
952
934
|
type ValidationRule_MorphoContext = MorphoContext;
|
|
@@ -1001,4 +983,4 @@ declare namespace Validation {
|
|
|
1001
983
|
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
1002
984
|
}
|
|
1003
985
|
|
|
1004
|
-
export { index$
|
|
986
|
+
export { index$2 as ApiSchema, Callback, Cursor$1 as Cursor, Liquidity$1 as Liquidity, Logger$1 as Logger, index$1 as OfferStore, index as Router, RouterOffer$1 as RouterOffer, Validation, ValidationRule };
|