@morpho-dev/router 0.1.12 → 0.1.15
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 +97 -64
- package/dist/cli.js +6043 -0
- package/dist/cli.js.map +1 -0
- package/dist/drizzle/router_v1.4/0000_add_obligation_id.sql +112 -0
- package/dist/drizzle/router_v1.4/0001_update-primary-key-on-link.sql +3 -0
- package/dist/drizzle/{router_v1.1 → router_v1.4}/meta/0000_snapshot.json +305 -265
- package/dist/drizzle/router_v1.4/meta/0001_snapshot.json +972 -0
- package/dist/drizzle/router_v1.4/meta/_journal.json +20 -0
- package/dist/index.browser.d.cts +1384 -603
- package/dist/index.browser.d.ts +1384 -603
- package/dist/index.browser.js +2103 -1343
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +2054 -1322
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +2546 -1317
- package/dist/index.node.d.ts +2546 -1317
- package/dist/index.node.js +6362 -3544
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +6318 -3542
- package/dist/index.node.mjs.map +1 -1
- package/package.json +14 -8
- package/dist/drizzle/router_v1.1/0000_init.sql +0 -103
- package/dist/drizzle/router_v1.1/meta/_journal.json +0 -13
package/dist/index.node.d.ts
CHANGED
|
@@ -1,44 +1,565 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
export * from '@morpho-dev/mempool';
|
|
4
|
-
import * as viem from 'viem';
|
|
5
|
-
import { Address, Hex, PublicClient, PublicActions } from 'viem';
|
|
6
|
-
import { z, ZodError } from 'zod/v4';
|
|
7
|
-
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
8
|
-
import * as hono_utils_types from 'hono/utils/types';
|
|
9
|
-
import * as hono from 'hono';
|
|
10
|
-
import { Context } from 'hono';
|
|
11
|
-
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
1
|
+
import { Hex, Address, AbiEvent, PublicClient, GetLogsReturnType, WalletClient, PublicActions, Account } from 'viem';
|
|
2
|
+
import { Chain as Chain$2 } from 'viem/chains';
|
|
12
3
|
import { PGlite } from '@electric-sql/pglite';
|
|
13
4
|
import { drizzle } from 'drizzle-orm/node-postgres';
|
|
14
5
|
import { drizzle as drizzle$1 } from 'drizzle-orm/pglite';
|
|
15
6
|
import { Pool } from 'pg';
|
|
7
|
+
import * as z from 'zod';
|
|
8
|
+
import { z as z$1 } from 'zod/v4';
|
|
9
|
+
import * as node_modules_zod_openapi_dist_components_DkyUTLcs_js from 'node_modules/zod-openapi/dist/components-DkyUTLcs.js';
|
|
16
10
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
17
11
|
|
|
18
|
-
declare const
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
declare const Oracle: readonly [{
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
readonly name: "price";
|
|
15
|
+
readonly inputs: readonly [];
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly name: "";
|
|
18
|
+
readonly type: "uint256";
|
|
19
|
+
}];
|
|
20
|
+
readonly stateMutability: "view";
|
|
21
|
+
}];
|
|
22
|
+
declare const ERC4626: readonly [{
|
|
23
|
+
readonly type: "function";
|
|
24
|
+
readonly name: "asset";
|
|
25
|
+
readonly inputs: readonly [];
|
|
26
|
+
readonly outputs: readonly [{
|
|
27
|
+
readonly name: "";
|
|
28
|
+
readonly type: "address";
|
|
29
|
+
}];
|
|
30
|
+
readonly stateMutability: "view";
|
|
31
|
+
}];
|
|
32
|
+
declare const MetaMorphoFactory: readonly [{
|
|
33
|
+
readonly type: "function";
|
|
34
|
+
readonly name: "isMetaMorpho";
|
|
35
|
+
readonly inputs: readonly [{
|
|
36
|
+
readonly name: "target";
|
|
37
|
+
readonly type: "address";
|
|
38
|
+
}];
|
|
39
|
+
readonly outputs: readonly [{
|
|
40
|
+
readonly name: "";
|
|
41
|
+
readonly type: "bool";
|
|
42
|
+
}];
|
|
43
|
+
readonly stateMutability: "view";
|
|
44
|
+
}];
|
|
45
|
+
declare const MetaMorpho: readonly [{
|
|
46
|
+
readonly type: "function";
|
|
47
|
+
readonly name: "withdrawQueue";
|
|
48
|
+
readonly inputs: readonly [{
|
|
49
|
+
readonly name: "index";
|
|
50
|
+
readonly type: "uint256";
|
|
51
|
+
}];
|
|
52
|
+
readonly outputs: readonly [{
|
|
53
|
+
readonly name: "";
|
|
54
|
+
readonly type: "bytes32";
|
|
55
|
+
}];
|
|
56
|
+
readonly stateMutability: "view";
|
|
57
|
+
}, {
|
|
58
|
+
readonly type: "function";
|
|
59
|
+
readonly name: "withdrawQueueLength";
|
|
60
|
+
readonly inputs: readonly [];
|
|
61
|
+
readonly outputs: readonly [{
|
|
62
|
+
readonly name: "";
|
|
63
|
+
readonly type: "uint256";
|
|
64
|
+
}];
|
|
65
|
+
readonly stateMutability: "view";
|
|
66
|
+
}, {
|
|
67
|
+
readonly type: "function";
|
|
68
|
+
readonly name: "maxWithdraw";
|
|
69
|
+
readonly inputs: readonly [{
|
|
70
|
+
readonly name: "owner";
|
|
71
|
+
readonly type: "address";
|
|
72
|
+
}];
|
|
73
|
+
readonly outputs: readonly [{
|
|
74
|
+
readonly name: "";
|
|
75
|
+
readonly type: "uint256";
|
|
76
|
+
}];
|
|
77
|
+
readonly stateMutability: "view";
|
|
78
|
+
}];
|
|
79
|
+
declare const Morpho: readonly [{
|
|
80
|
+
readonly type: "function";
|
|
81
|
+
readonly name: "collateralOf";
|
|
82
|
+
readonly inputs: readonly [{
|
|
83
|
+
readonly name: "";
|
|
84
|
+
readonly type: "address";
|
|
85
|
+
readonly internalType: "address";
|
|
86
|
+
}, {
|
|
87
|
+
readonly name: "";
|
|
88
|
+
readonly type: "bytes32";
|
|
89
|
+
readonly internalType: "bytes32";
|
|
90
|
+
}, {
|
|
91
|
+
readonly name: "";
|
|
92
|
+
readonly type: "address";
|
|
93
|
+
readonly internalType: "address";
|
|
94
|
+
}];
|
|
95
|
+
readonly outputs: readonly [{
|
|
96
|
+
readonly name: "";
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
readonly internalType: "uint256";
|
|
99
|
+
}];
|
|
100
|
+
readonly stateMutability: "view";
|
|
101
|
+
}, {
|
|
102
|
+
readonly type: "function";
|
|
103
|
+
readonly name: "debtOf";
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly name: "";
|
|
106
|
+
readonly type: "address";
|
|
107
|
+
readonly internalType: "address";
|
|
108
|
+
}, {
|
|
109
|
+
readonly name: "";
|
|
110
|
+
readonly type: "bytes32";
|
|
111
|
+
readonly internalType: "bytes32";
|
|
112
|
+
}];
|
|
113
|
+
readonly outputs: readonly [{
|
|
114
|
+
readonly name: "";
|
|
115
|
+
readonly type: "uint256";
|
|
116
|
+
readonly internalType: "uint256";
|
|
117
|
+
}];
|
|
118
|
+
readonly stateMutability: "view";
|
|
119
|
+
}, {
|
|
120
|
+
readonly type: "function";
|
|
121
|
+
readonly name: "market";
|
|
122
|
+
readonly inputs: readonly [{
|
|
123
|
+
readonly name: "id";
|
|
124
|
+
readonly type: "bytes32";
|
|
125
|
+
readonly internalType: "Id";
|
|
126
|
+
}];
|
|
127
|
+
readonly outputs: readonly [{
|
|
128
|
+
readonly name: "totalSupplyAssets";
|
|
129
|
+
readonly type: "uint128";
|
|
130
|
+
readonly internalType: "uint128";
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "totalSupplyShares";
|
|
133
|
+
readonly type: "uint128";
|
|
134
|
+
readonly internalType: "uint128";
|
|
135
|
+
}, {
|
|
136
|
+
readonly name: "totalBorrowAssets";
|
|
137
|
+
readonly type: "uint128";
|
|
138
|
+
readonly internalType: "uint128";
|
|
139
|
+
}, {
|
|
140
|
+
readonly name: "totalBorrowShares";
|
|
141
|
+
readonly type: "uint128";
|
|
142
|
+
readonly internalType: "uint128";
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "lastUpdate";
|
|
145
|
+
readonly type: "uint128";
|
|
146
|
+
readonly internalType: "uint128";
|
|
147
|
+
}, {
|
|
148
|
+
readonly name: "fee";
|
|
149
|
+
readonly type: "uint128";
|
|
150
|
+
readonly internalType: "uint128";
|
|
151
|
+
}];
|
|
152
|
+
readonly stateMutability: "view";
|
|
153
|
+
}, {
|
|
154
|
+
readonly type: "function";
|
|
155
|
+
readonly name: "position";
|
|
156
|
+
readonly inputs: readonly [{
|
|
157
|
+
readonly name: "id";
|
|
158
|
+
readonly type: "bytes32";
|
|
159
|
+
readonly internalType: "Id";
|
|
160
|
+
}, {
|
|
161
|
+
readonly name: "user";
|
|
162
|
+
readonly type: "address";
|
|
163
|
+
readonly internalType: "address";
|
|
164
|
+
}];
|
|
165
|
+
readonly outputs: readonly [{
|
|
166
|
+
readonly name: "supplyShares";
|
|
167
|
+
readonly type: "uint256";
|
|
168
|
+
readonly internalType: "uint256";
|
|
169
|
+
}, {
|
|
170
|
+
readonly name: "borrowShares";
|
|
171
|
+
readonly type: "uint128";
|
|
172
|
+
readonly internalType: "uint128";
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "collateral";
|
|
175
|
+
readonly type: "uint128";
|
|
176
|
+
readonly internalType: "uint128";
|
|
177
|
+
}];
|
|
178
|
+
readonly stateMutability: "view";
|
|
179
|
+
}];
|
|
180
|
+
|
|
181
|
+
declare const Abi_ERC4626: typeof ERC4626;
|
|
182
|
+
declare const Abi_MetaMorpho: typeof MetaMorpho;
|
|
183
|
+
declare const Abi_MetaMorphoFactory: typeof MetaMorphoFactory;
|
|
184
|
+
declare const Abi_Morpho: typeof Morpho;
|
|
185
|
+
declare const Abi_Oracle: typeof Oracle;
|
|
186
|
+
declare namespace Abi {
|
|
187
|
+
export { Abi_ERC4626 as ERC4626, Abi_MetaMorpho as MetaMorpho, Abi_MetaMorphoFactory as MetaMorphoFactory, Abi_Morpho as Morpho, Abi_Oracle as Oracle };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
declare enum CallbackType {
|
|
191
|
+
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
192
|
+
BuyVaultV1Callback = "buy_vault_v1_callback",
|
|
193
|
+
SellERC20Callback = "sell_erc20_callback"
|
|
194
|
+
}
|
|
195
|
+
declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
|
|
196
|
+
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
197
|
+
vault: Address;
|
|
198
|
+
amount: bigint;
|
|
199
|
+
}>;
|
|
200
|
+
declare function decodeSellERC20Callback(data: Hex): Array<{
|
|
201
|
+
collateral: Address;
|
|
202
|
+
amount: bigint;
|
|
203
|
+
}>;
|
|
204
|
+
declare function encodeBuyVaultV1Callback(parameters: {
|
|
205
|
+
vaults: Address[];
|
|
206
|
+
amounts: bigint[];
|
|
207
|
+
}): Hex;
|
|
208
|
+
declare function encodeSellERC20Callback(parameters: {
|
|
209
|
+
collaterals: Address[];
|
|
210
|
+
amounts: bigint[];
|
|
211
|
+
}): Hex;
|
|
212
|
+
|
|
213
|
+
type Callback_CallbackType = CallbackType;
|
|
214
|
+
declare const Callback_CallbackType: typeof CallbackType;
|
|
215
|
+
declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
|
|
216
|
+
declare const Callback_decodeBuyVaultV1Callback: typeof decodeBuyVaultV1Callback;
|
|
217
|
+
declare const Callback_decodeSellERC20Callback: typeof decodeSellERC20Callback;
|
|
218
|
+
declare const Callback_encodeBuyVaultV1Callback: typeof encodeBuyVaultV1Callback;
|
|
219
|
+
declare const Callback_encodeSellERC20Callback: typeof encodeSellERC20Callback;
|
|
220
|
+
declare namespace Callback {
|
|
221
|
+
export { Callback_CallbackType as CallbackType, Callback_WhitelistedCallbackAddresses as WhitelistedCallbackAddresses, Callback_decodeBuyVaultV1Callback as decodeBuyVaultV1Callback, Callback_decodeSellERC20Callback as decodeSellERC20Callback, Callback_encodeBuyVaultV1Callback as encodeBuyVaultV1Callback, Callback_encodeSellERC20Callback as encodeSellERC20Callback };
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
type GlobalErrorType<name extends string = "Error"> = Error & {
|
|
225
|
+
name: name;
|
|
22
226
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Base error class inherited by all errors thrown by mempool.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```ts
|
|
232
|
+
* import { Errors } from 'mempool'
|
|
233
|
+
* throw new Errors.BaseError('An error occurred')
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
declare class BaseError<cause extends Error | undefined = undefined> extends Error {
|
|
237
|
+
details: string;
|
|
238
|
+
shortMessage: string;
|
|
239
|
+
cause: cause;
|
|
240
|
+
name: string;
|
|
241
|
+
constructor(shortMessage: string, options?: {
|
|
242
|
+
cause?: cause | undefined;
|
|
243
|
+
details?: string | undefined;
|
|
244
|
+
metaMessages?: (string | undefined)[] | undefined;
|
|
245
|
+
});
|
|
246
|
+
walk(): Error;
|
|
247
|
+
walk(fn: (err: unknown) => boolean): Error | null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type Errors_BaseError<cause extends Error | undefined = undefined> = BaseError<cause>;
|
|
251
|
+
declare const Errors_BaseError: typeof BaseError;
|
|
252
|
+
type Errors_GlobalErrorType<name extends string = "Error"> = GlobalErrorType<name>;
|
|
253
|
+
declare namespace Errors {
|
|
254
|
+
export { Errors_BaseError as BaseError, type Errors_GlobalErrorType as GlobalErrorType };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Combines members of an intersection into a readable type. */
|
|
258
|
+
type Compute<type> = {
|
|
259
|
+
[key in keyof type]: type[key];
|
|
260
|
+
} & unknown;
|
|
261
|
+
declare const BrandTypeId: unique symbol;
|
|
262
|
+
type Brand<in out ID extends string | symbol> = {
|
|
263
|
+
readonly [BrandTypeId]: {
|
|
264
|
+
readonly [id in ID]: ID;
|
|
265
|
+
};
|
|
27
266
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
267
|
+
|
|
268
|
+
declare const chainNames: readonly ["ethereum", "base", "ethereum-virtual-testnet", "anvil"];
|
|
269
|
+
type ChainName = (typeof chainNames)[number];
|
|
270
|
+
declare const ChainId: {
|
|
271
|
+
ETHEREUM: bigint;
|
|
272
|
+
BASE: bigint;
|
|
273
|
+
"ETHEREUM-VIRTUAL-TESTNET": bigint;
|
|
274
|
+
ANVIL: bigint;
|
|
275
|
+
};
|
|
276
|
+
type Id = (typeof ChainId)[keyof typeof ChainId];
|
|
277
|
+
declare const chainIds: Set<bigint>;
|
|
278
|
+
type Chain = Compute<Omit<Chain$2, "id" | "name"> & {
|
|
279
|
+
id: Id;
|
|
280
|
+
name: ChainName;
|
|
281
|
+
whitelistedAssets: Set<Address>;
|
|
282
|
+
morpho: Address;
|
|
283
|
+
morphoBlue: Address;
|
|
284
|
+
mempool: {
|
|
285
|
+
address: Address;
|
|
286
|
+
deploymentBlock: number;
|
|
287
|
+
reindexBuffer: number;
|
|
288
|
+
};
|
|
289
|
+
vaultV1Factory: Record<string, Address>;
|
|
290
|
+
}>;
|
|
291
|
+
declare function getChain(chainId: Id): Chain | undefined;
|
|
292
|
+
declare const getWhitelistedChains: () => Chain[];
|
|
293
|
+
declare const chains$1: Record<ChainName, Chain>;
|
|
294
|
+
declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
|
|
295
|
+
client: PublicClient;
|
|
296
|
+
contractAddress: Address;
|
|
297
|
+
event?: abiEvent;
|
|
298
|
+
blockNumberGte?: number;
|
|
299
|
+
blockNumberLte?: number;
|
|
300
|
+
order: "asc" | "desc";
|
|
301
|
+
options: {
|
|
302
|
+
maxBatchSize?: number;
|
|
303
|
+
blockWindow?: number;
|
|
304
|
+
};
|
|
305
|
+
}): AsyncGenerator<{
|
|
306
|
+
logs: GetLogsReturnType<abiEvent | undefined>;
|
|
307
|
+
blockNumber: number;
|
|
308
|
+
}, void, void>;
|
|
309
|
+
declare class InvalidBlockRangeError extends BaseError {
|
|
310
|
+
name: string;
|
|
311
|
+
constructor(fromBlock: bigint, toBlock: bigint);
|
|
312
|
+
}
|
|
313
|
+
declare class InvalidBlockWindowError extends BaseError {
|
|
314
|
+
name: string;
|
|
315
|
+
constructor(blockWindow: number);
|
|
316
|
+
}
|
|
317
|
+
declare class InvalidBatchSizeError extends BaseError {
|
|
318
|
+
name: string;
|
|
319
|
+
constructor(maxBatchSize: number);
|
|
320
|
+
}
|
|
321
|
+
declare class MissingBlockNumberError extends BaseError {
|
|
322
|
+
name: string;
|
|
323
|
+
constructor();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
type Chain$1_Chain = Chain;
|
|
327
|
+
declare const Chain$1_ChainId: typeof ChainId;
|
|
328
|
+
type Chain$1_ChainName = ChainName;
|
|
329
|
+
type Chain$1_Id = Id;
|
|
330
|
+
type Chain$1_InvalidBatchSizeError = InvalidBatchSizeError;
|
|
331
|
+
declare const Chain$1_InvalidBatchSizeError: typeof InvalidBatchSizeError;
|
|
332
|
+
type Chain$1_InvalidBlockRangeError = InvalidBlockRangeError;
|
|
333
|
+
declare const Chain$1_InvalidBlockRangeError: typeof InvalidBlockRangeError;
|
|
334
|
+
type Chain$1_InvalidBlockWindowError = InvalidBlockWindowError;
|
|
335
|
+
declare const Chain$1_InvalidBlockWindowError: typeof InvalidBlockWindowError;
|
|
336
|
+
type Chain$1_MissingBlockNumberError = MissingBlockNumberError;
|
|
337
|
+
declare const Chain$1_MissingBlockNumberError: typeof MissingBlockNumberError;
|
|
338
|
+
declare const Chain$1_chainIds: typeof chainIds;
|
|
339
|
+
declare const Chain$1_chainNames: typeof chainNames;
|
|
340
|
+
declare const Chain$1_getChain: typeof getChain;
|
|
341
|
+
declare const Chain$1_getWhitelistedChains: typeof getWhitelistedChains;
|
|
342
|
+
declare const Chain$1_streamLogs: typeof streamLogs;
|
|
343
|
+
declare namespace Chain$1 {
|
|
344
|
+
export { type Chain$1_Chain as Chain, Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, type Chain$1_Id as Id, Chain$1_InvalidBatchSizeError as InvalidBatchSizeError, Chain$1_InvalidBlockRangeError as InvalidBlockRangeError, Chain$1_InvalidBlockWindowError as InvalidBlockWindowError, Chain$1_MissingBlockNumberError as MissingBlockNumberError, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, chains$1 as chains, Chain$1_getChain as getChain, Chain$1_getWhitelistedChains as getWhitelistedChains, Chain$1_streamLogs as streamLogs };
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
type LLTV = bigint & Brand<"LLTV">;
|
|
348
|
+
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
349
|
+
type Options = (typeof Options)[number];
|
|
350
|
+
/**
|
|
351
|
+
* Convert a LLTV option or a scaled LLTV to a LLTV.
|
|
352
|
+
* @param lltv - The LLTV option or the scaled LLTV.
|
|
353
|
+
* @returns The LLTV.
|
|
354
|
+
*/
|
|
355
|
+
declare function from$8(lltv: Options | bigint): LLTV;
|
|
356
|
+
declare namespace from$8 {
|
|
357
|
+
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
358
|
+
}
|
|
359
|
+
declare class InvalidOptionError$1 extends BaseError {
|
|
360
|
+
readonly name = "LLTV.InvalidOptionError";
|
|
361
|
+
constructor(input: number);
|
|
362
|
+
}
|
|
363
|
+
declare class InvalidLLTVError extends BaseError {
|
|
364
|
+
readonly name = "LLTV.InvalidLLTVError";
|
|
365
|
+
constructor(input: bigint);
|
|
366
|
+
}
|
|
367
|
+
declare const LLTVSchema: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
368
|
+
|
|
369
|
+
type LLTV$1_InvalidLLTVError = InvalidLLTVError;
|
|
370
|
+
declare const LLTV$1_InvalidLLTVError: typeof InvalidLLTVError;
|
|
371
|
+
type LLTV$1_LLTV = LLTV;
|
|
372
|
+
declare const LLTV$1_LLTVSchema: typeof LLTVSchema;
|
|
373
|
+
type LLTV$1_Options = Options;
|
|
374
|
+
declare namespace LLTV$1 {
|
|
375
|
+
export { LLTV$1_InvalidLLTVError as InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, type LLTV$1_LLTV as LLTV, LLTV$1_LLTVSchema as LLTVSchema, type LLTV$1_Options as Options, from$8 as from };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
type Collateral = {
|
|
379
|
+
/** Asset being used as collateral. */
|
|
380
|
+
asset: Address;
|
|
381
|
+
/** Liquidation Loan-to-Value of the collateral. */
|
|
382
|
+
lltv: LLTV;
|
|
383
|
+
/** Oracle contract used to price the collateral. */
|
|
384
|
+
oracle: Address;
|
|
385
|
+
};
|
|
386
|
+
declare const CollateralSchema: z.ZodObject<{
|
|
387
|
+
asset: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
388
|
+
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
389
|
+
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
390
|
+
}, z.core.$strip>;
|
|
391
|
+
declare const CollateralsSchema: z.ZodArray<z.ZodObject<{
|
|
392
|
+
asset: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
393
|
+
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
394
|
+
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
395
|
+
}, z.core.$strip>>;
|
|
396
|
+
declare const from$7: (parameters: from$7.Parameters) => from$7.ReturnType;
|
|
397
|
+
declare namespace from$7 {
|
|
398
|
+
type Parameters = {
|
|
399
|
+
asset: Address;
|
|
400
|
+
lltv: Options | bigint;
|
|
401
|
+
oracle: Address;
|
|
402
|
+
};
|
|
403
|
+
type ReturnType = Collateral;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
type Collateral$1_Collateral = Collateral;
|
|
407
|
+
declare const Collateral$1_CollateralSchema: typeof CollateralSchema;
|
|
408
|
+
declare const Collateral$1_CollateralsSchema: typeof CollateralsSchema;
|
|
409
|
+
declare namespace Collateral$1 {
|
|
410
|
+
export { type Collateral$1_Collateral as Collateral, Collateral$1_CollateralSchema as CollateralSchema, Collateral$1_CollateralsSchema as CollateralsSchema, from$7 as from };
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
type Cursor = {
|
|
414
|
+
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
415
|
+
dir: "asc" | "desc";
|
|
416
|
+
rate?: string;
|
|
417
|
+
maturity?: number;
|
|
418
|
+
expiry?: number;
|
|
419
|
+
assets?: string;
|
|
420
|
+
hash: string;
|
|
421
|
+
page?: number;
|
|
422
|
+
};
|
|
423
|
+
declare function validate(cursor: unknown): cursor is Cursor;
|
|
424
|
+
declare function encode$1(c: Cursor): string;
|
|
425
|
+
declare function decode$1(token?: string): Cursor | null;
|
|
426
|
+
|
|
427
|
+
type Cursor$1_Cursor = Cursor;
|
|
428
|
+
declare const Cursor$1_validate: typeof validate;
|
|
429
|
+
declare namespace Cursor$1 {
|
|
430
|
+
export { type Cursor$1_Cursor as Cursor, decode$1 as decode, encode$1 as encode, Cursor$1_validate as validate };
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** The snake case representation of a type with bigint values stringified. */
|
|
434
|
+
type Snake<T> = SnakeKeys<StringifiedBigint<T>>;
|
|
435
|
+
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
436
|
+
type StringifiedBigint<T> = [
|
|
437
|
+
T
|
|
438
|
+
] extends [bigint] ? 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 ? {
|
|
439
|
+
[K in keyof T]: StringifiedBigint<T[K]>;
|
|
440
|
+
} : T;
|
|
441
|
+
/** Key remapping that also preserves branded primitives. */
|
|
442
|
+
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? {
|
|
443
|
+
[K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]>;
|
|
444
|
+
} : T;
|
|
445
|
+
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;
|
|
446
|
+
/**
|
|
447
|
+
* Formats object keys to snake case.
|
|
448
|
+
* Preserves ethereum addresses as is.
|
|
449
|
+
* Converts ethereum addresses to checksummed if used as values.
|
|
450
|
+
* Stringifies bigint values to strings.
|
|
451
|
+
*/
|
|
452
|
+
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
453
|
+
/**
|
|
454
|
+
* Formats a snake case object to its camel case type.
|
|
455
|
+
* Preserves ethereum addresses as is.
|
|
456
|
+
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
457
|
+
* @warning Does not unstringify bigint values.
|
|
458
|
+
*/
|
|
459
|
+
declare function fromSnakeCase$2<T>(obj: Snake<T>): T;
|
|
460
|
+
|
|
461
|
+
type Format_Snake<T> = Snake<T>;
|
|
462
|
+
declare namespace Format {
|
|
463
|
+
export { type Format_Snake as Snake, fromSnakeCase$2 as fromSnakeCase, toSnakeCase$1 as toSnakeCase };
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Maturity is a number that represents a date in seconds.
|
|
468
|
+
*/
|
|
469
|
+
type Maturity = number & Brand<"Maturity">;
|
|
470
|
+
declare const MaturitySchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<Maturity, number>>;
|
|
471
|
+
declare const MaturityOptions: {
|
|
472
|
+
readonly end_of_week: () => Maturity;
|
|
473
|
+
readonly end_of_next_week: () => Maturity;
|
|
474
|
+
readonly end_of_month: () => Maturity;
|
|
475
|
+
readonly end_of_next_month: () => Maturity;
|
|
476
|
+
readonly end_of_quarter: () => Maturity;
|
|
477
|
+
readonly end_of_next_quarter: () => Maturity;
|
|
478
|
+
};
|
|
479
|
+
type MaturityOptions = keyof typeof MaturityOptions;
|
|
480
|
+
/**
|
|
481
|
+
* Creates a maturity from a timestamp in seconds or a maturity option.
|
|
482
|
+
* @throws {InvalidFormatError} If the maturity is in milliseconds.
|
|
483
|
+
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
484
|
+
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
485
|
+
*/
|
|
486
|
+
declare function from$6(ts: from$6.Parameters): Maturity;
|
|
487
|
+
declare namespace from$6 {
|
|
488
|
+
type Parameters = number | MaturityOptions;
|
|
489
|
+
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
490
|
+
}
|
|
491
|
+
declare class InvalidFormatError extends BaseError {
|
|
492
|
+
readonly name = "Maturity.InvalidFormatError";
|
|
493
|
+
constructor();
|
|
494
|
+
}
|
|
495
|
+
declare class InvalidDateError extends BaseError {
|
|
496
|
+
readonly name = "Maturity.InvalidDateError";
|
|
497
|
+
constructor(input: number);
|
|
498
|
+
}
|
|
499
|
+
declare class InvalidOptionError extends BaseError {
|
|
500
|
+
readonly name = "Maturity.InvalidOptionError";
|
|
501
|
+
constructor(input: string);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
type Maturity$1_InvalidDateError = InvalidDateError;
|
|
505
|
+
declare const Maturity$1_InvalidDateError: typeof InvalidDateError;
|
|
506
|
+
type Maturity$1_InvalidFormatError = InvalidFormatError;
|
|
507
|
+
declare const Maturity$1_InvalidFormatError: typeof InvalidFormatError;
|
|
508
|
+
type Maturity$1_InvalidOptionError = InvalidOptionError;
|
|
509
|
+
declare const Maturity$1_InvalidOptionError: typeof InvalidOptionError;
|
|
510
|
+
type Maturity$1_Maturity = Maturity;
|
|
511
|
+
type Maturity$1_MaturityOptions = MaturityOptions;
|
|
512
|
+
declare const Maturity$1_MaturitySchema: typeof MaturitySchema;
|
|
513
|
+
declare namespace Maturity$1 {
|
|
514
|
+
export { Maturity$1_InvalidDateError as InvalidDateError, Maturity$1_InvalidFormatError as InvalidFormatError, Maturity$1_InvalidOptionError as InvalidOptionError, type Maturity$1_Maturity as Maturity, type Maturity$1_MaturityOptions as MaturityOptions, Maturity$1_MaturitySchema as MaturitySchema, from$6 as from };
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
type Offer = {
|
|
518
|
+
/** The address that made the offer. */
|
|
519
|
+
readonly offering: Address;
|
|
520
|
+
/** The amount of assets offered. */
|
|
521
|
+
readonly assets: bigint;
|
|
522
|
+
/** The interest rate (with 18 decimals). */
|
|
523
|
+
readonly rate: bigint;
|
|
524
|
+
/** The date at which all interests will be paid. */
|
|
525
|
+
readonly maturity: Maturity;
|
|
526
|
+
/** The date at which the offer will expire. */
|
|
527
|
+
readonly expiry: number;
|
|
528
|
+
/** The date at which the offer will start. */
|
|
529
|
+
readonly start: number;
|
|
530
|
+
/** The nonce. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
531
|
+
readonly nonce: bigint;
|
|
532
|
+
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
533
|
+
readonly buy: boolean;
|
|
534
|
+
/** The chain id where the liquidity for this offer is located. */
|
|
535
|
+
readonly chainId: bigint;
|
|
536
|
+
/** The token that is being borrowed. */
|
|
537
|
+
readonly loanToken: Address;
|
|
538
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
539
|
+
readonly collaterals: readonly Collateral[];
|
|
540
|
+
/** The optional callback data to retrieve the maker funds. */
|
|
541
|
+
readonly callback: {
|
|
542
|
+
readonly address: Address;
|
|
543
|
+
readonly data: Hex;
|
|
544
|
+
readonly gasLimit: bigint;
|
|
545
|
+
};
|
|
546
|
+
/** The amount of assets consumed from the offer. */
|
|
547
|
+
consumed: bigint;
|
|
548
|
+
/** The hash of the offer. */
|
|
549
|
+
readonly hash: Hex;
|
|
550
|
+
/** The block number at which the offer was created. */
|
|
551
|
+
readonly blockNumber: number;
|
|
552
|
+
/** The signature of the offer. */
|
|
553
|
+
signature?: Hex;
|
|
34
554
|
};
|
|
35
|
-
declare const
|
|
555
|
+
declare const OfferHashSchema: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
556
|
+
declare const OfferSchema: (parameters?: {
|
|
36
557
|
omitHash?: boolean;
|
|
37
558
|
}) => z.ZodObject<{
|
|
38
559
|
offering: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
39
560
|
assets: z.ZodBigInt;
|
|
40
561
|
rate: z.ZodBigInt;
|
|
41
|
-
maturity: z.ZodPipe<z.ZodNumber, z.ZodTransform<
|
|
562
|
+
maturity: z.ZodPipe<z.ZodNumber, z.ZodTransform<Maturity, number>>;
|
|
42
563
|
expiry: z.ZodNumber;
|
|
43
564
|
start: z.ZodNumber;
|
|
44
565
|
nonce: z.ZodBigInt;
|
|
@@ -48,28 +569,150 @@ declare const RouterOfferSchema: (parameters?: {
|
|
|
48
569
|
collaterals: z.ZodArray<z.ZodObject<{
|
|
49
570
|
asset: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
50
571
|
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
51
|
-
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<
|
|
572
|
+
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
52
573
|
}, z.core.$strip>>;
|
|
53
574
|
callback: z.ZodObject<{
|
|
54
575
|
address: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
55
576
|
data: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
56
577
|
gasLimit: z.ZodBigInt;
|
|
57
578
|
}, z.core.$strip>;
|
|
58
|
-
signature: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
59
|
-
createdAt: z.ZodOptional<z.ZodNumber>;
|
|
60
579
|
consumed: z.ZodBigInt;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
callback_not_supported: "callback_not_supported";
|
|
64
|
-
callback_error: "callback_error";
|
|
65
|
-
unverified: "unverified";
|
|
66
|
-
}>;
|
|
67
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
68
|
-
issue: z.ZodString;
|
|
69
|
-
}, z.core.$strip>>;
|
|
580
|
+
blockNumber: z.ZodNumber;
|
|
581
|
+
signature: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
70
582
|
}, z.core.$strip>;
|
|
71
583
|
/**
|
|
72
|
-
*
|
|
584
|
+
* Creates an offer from a plain object.
|
|
585
|
+
* @throws {InvalidOfferError} If the offer is invalid.
|
|
586
|
+
* @param input - The offer to create.
|
|
587
|
+
* @returns The created offer with its hash.
|
|
588
|
+
*/
|
|
589
|
+
declare function from$5(input: Omit<Offer, "hash">): Offer;
|
|
590
|
+
declare namespace from$5 {
|
|
591
|
+
type ErrorType = InvalidOfferError;
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Creates an offer from a snake case object.
|
|
595
|
+
* @throws {InvalidOfferError} If the offer is invalid.
|
|
596
|
+
* @param input - The offer to create.
|
|
597
|
+
* @returns The created offer with its hash.
|
|
598
|
+
*/
|
|
599
|
+
declare function fromSnakeCase$1(input: Snake<Omit<Offer, "hash">>): Offer;
|
|
600
|
+
/**
|
|
601
|
+
* Converts an offer to a snake case object.
|
|
602
|
+
* @param offer - The offer to convert.
|
|
603
|
+
* @returns The converted offer.
|
|
604
|
+
*/
|
|
605
|
+
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
606
|
+
/**
|
|
607
|
+
* Generates a random Offer.
|
|
608
|
+
* The returned Offer contains randomly generated values for most fields, such as assets, rate, nonce, and buy flag.
|
|
609
|
+
* Some fields use fixed or deterministic values (e.g., chainId, collaterals, callback).
|
|
610
|
+
* @warning The generated Offer should not be used for production usage.
|
|
611
|
+
* @returns {Offer} A randomly generated Offer object.
|
|
612
|
+
*/
|
|
613
|
+
declare function random$1(): Offer;
|
|
614
|
+
/**
|
|
615
|
+
* Creates an EIP-712 domain object.
|
|
616
|
+
* @param chainId - The chain ID.
|
|
617
|
+
* @returns The EIP-712 domain object.
|
|
618
|
+
*/
|
|
619
|
+
declare const domain: (chainId: bigint) => {
|
|
620
|
+
chainId: bigint;
|
|
621
|
+
verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* The EIP-712 types for the offer.
|
|
625
|
+
* @warning The ordering of the types should NEVER be changed. The offer hash is computed based on the order of the types.
|
|
626
|
+
* @returns The EIP-712 types.
|
|
627
|
+
*/
|
|
628
|
+
declare const types: {
|
|
629
|
+
readonly EIP712Domain: readonly [{
|
|
630
|
+
readonly name: "chainId";
|
|
631
|
+
readonly type: "uint256";
|
|
632
|
+
}, {
|
|
633
|
+
readonly name: "verifyingContract";
|
|
634
|
+
readonly type: "address";
|
|
635
|
+
}];
|
|
636
|
+
readonly Offer: readonly [{
|
|
637
|
+
readonly name: "offering";
|
|
638
|
+
readonly type: "address";
|
|
639
|
+
}, {
|
|
640
|
+
readonly name: "assets";
|
|
641
|
+
readonly type: "uint256";
|
|
642
|
+
}, {
|
|
643
|
+
readonly name: "rate";
|
|
644
|
+
readonly type: "uint256";
|
|
645
|
+
}, {
|
|
646
|
+
readonly name: "maturity";
|
|
647
|
+
readonly type: "uint256";
|
|
648
|
+
}, {
|
|
649
|
+
readonly name: "expiry";
|
|
650
|
+
readonly type: "uint256";
|
|
651
|
+
}, {
|
|
652
|
+
readonly name: "nonce";
|
|
653
|
+
readonly type: "uint256";
|
|
654
|
+
}, {
|
|
655
|
+
readonly name: "buy";
|
|
656
|
+
readonly type: "bool";
|
|
657
|
+
}, {
|
|
658
|
+
readonly name: "loanToken";
|
|
659
|
+
readonly type: "address";
|
|
660
|
+
}, {
|
|
661
|
+
readonly name: "collaterals";
|
|
662
|
+
readonly type: "Collateral[]";
|
|
663
|
+
}, {
|
|
664
|
+
readonly name: "callback";
|
|
665
|
+
readonly type: "Callback";
|
|
666
|
+
}];
|
|
667
|
+
readonly Collateral: readonly [{
|
|
668
|
+
readonly name: "asset";
|
|
669
|
+
readonly type: "address";
|
|
670
|
+
}, {
|
|
671
|
+
readonly name: "oracle";
|
|
672
|
+
readonly type: "address";
|
|
673
|
+
}, {
|
|
674
|
+
readonly name: "lltv";
|
|
675
|
+
readonly type: "uint256";
|
|
676
|
+
}];
|
|
677
|
+
readonly Callback: readonly [{
|
|
678
|
+
readonly name: "address";
|
|
679
|
+
readonly type: "address";
|
|
680
|
+
}, {
|
|
681
|
+
readonly name: "data";
|
|
682
|
+
readonly type: "bytes";
|
|
683
|
+
}, {
|
|
684
|
+
readonly name: "gasLimit";
|
|
685
|
+
readonly type: "uint256";
|
|
686
|
+
}];
|
|
687
|
+
};
|
|
688
|
+
/**
|
|
689
|
+
* Signs an offer.
|
|
690
|
+
* @throws {Error} If the wallet account is not set.
|
|
691
|
+
* @param offer - The offer to sign.
|
|
692
|
+
* @param wallet - The wallet to sign the offer with.
|
|
693
|
+
* @returns The signed offer.
|
|
694
|
+
*/
|
|
695
|
+
declare function sign(offer: Offer, wallet: WalletClient): Promise<Hex>;
|
|
696
|
+
declare function hash(offer: Omit<Offer, "hash">): Hex;
|
|
697
|
+
/**
|
|
698
|
+
* Calculates the obligation id for an offer based on the smart contract's Obligation struct.
|
|
699
|
+
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals (sorted by token address), maturity)).
|
|
700
|
+
* @param offer - The offer to calculate the obligation id for.
|
|
701
|
+
* @returns The obligation id as a 32-byte hex string.
|
|
702
|
+
*/
|
|
703
|
+
declare function obligationId(offer: Offer): Hex;
|
|
704
|
+
declare function encode(offer: Offer): `0x${string}`;
|
|
705
|
+
declare function decode(data: Hex, blockNumber: number | bigint): Offer;
|
|
706
|
+
type OfferConsumed = {
|
|
707
|
+
id: string;
|
|
708
|
+
chainId: bigint;
|
|
709
|
+
offering: Address;
|
|
710
|
+
nonce: bigint;
|
|
711
|
+
amount: bigint;
|
|
712
|
+
blockNumber: number;
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* ABI for the Consumed event emitted by the Obligation contract.
|
|
73
716
|
*/
|
|
74
717
|
declare const consumedEvent: {
|
|
75
718
|
readonly type: "event";
|
|
@@ -92,33 +735,6 @@ declare const consumedEvent: {
|
|
|
92
735
|
}];
|
|
93
736
|
readonly anonymous: false;
|
|
94
737
|
};
|
|
95
|
-
/**
|
|
96
|
-
* Creates a router offer from a plain object.
|
|
97
|
-
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
98
|
-
* @param input - The router offer to create.
|
|
99
|
-
* @returns The created router offer with its hash.
|
|
100
|
-
*/
|
|
101
|
-
declare function from$1(input: Omit<RouterOffer, "hash">): RouterOffer;
|
|
102
|
-
declare namespace from$1 {
|
|
103
|
-
type ErrorType = InvalidRouterOfferError;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Creates a router offer from a snake case object.
|
|
107
|
-
* @throws {InvalidRouterOfferError} If the router offer is invalid.
|
|
108
|
-
* @param input - The router offer to create.
|
|
109
|
-
* @returns The created router offer with its hash.
|
|
110
|
-
*/
|
|
111
|
-
declare function fromSnakeCase(input: Format.Snake<Omit<RouterOffer, "hash">>): RouterOffer;
|
|
112
|
-
declare namespace fromSnakeCase {
|
|
113
|
-
type ErrorType = InvalidRouterOfferError;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Converts a router offer to a snake case object.
|
|
117
|
-
* @param offer - The router offer to convert.
|
|
118
|
-
* @returns The converted router offer.
|
|
119
|
-
*/
|
|
120
|
-
declare function toSnakeCase(offer: RouterOffer): Format.Snake<RouterOffer>;
|
|
121
|
-
declare function random(): RouterOffer;
|
|
122
738
|
declare function fromConsumedLog(parameters: {
|
|
123
739
|
blockNumber: bigint;
|
|
124
740
|
logIndex: number;
|
|
@@ -128,354 +744,306 @@ declare function fromConsumedLog(parameters: {
|
|
|
128
744
|
nonce: bigint;
|
|
129
745
|
amount: bigint;
|
|
130
746
|
}): OfferConsumed;
|
|
131
|
-
declare class
|
|
132
|
-
readonly name = "
|
|
133
|
-
constructor(error: ZodError | Error);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
type RouterOffer$1_OfferConsumed = OfferConsumed;
|
|
139
|
-
type RouterOffer$1_OfferMetadata = OfferMetadata;
|
|
140
|
-
type RouterOffer$1_OfferStatus = OfferStatus;
|
|
141
|
-
declare const RouterOffer$1_OfferStatusValues: typeof OfferStatusValues;
|
|
142
|
-
type RouterOffer$1_RouterOffer = RouterOffer;
|
|
143
|
-
declare const RouterOffer$1_RouterOfferSchema: typeof RouterOfferSchema;
|
|
144
|
-
declare const RouterOffer$1_consumedEvent: typeof consumedEvent;
|
|
145
|
-
declare const RouterOffer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
146
|
-
declare const RouterOffer$1_fromSnakeCase: typeof fromSnakeCase;
|
|
147
|
-
declare const RouterOffer$1_random: typeof random;
|
|
148
|
-
declare const RouterOffer$1_toSnakeCase: typeof toSnakeCase;
|
|
149
|
-
declare namespace RouterOffer$1 {
|
|
150
|
-
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, from$1 as from, RouterOffer$1_fromConsumedLog as fromConsumedLog, RouterOffer$1_fromSnakeCase as fromSnakeCase, RouterOffer$1_random as random, RouterOffer$1_toSnakeCase as toSnakeCase };
|
|
747
|
+
declare class InvalidOfferError extends BaseError<z.ZodError | Error> {
|
|
748
|
+
readonly name = "Offer.InvalidOfferError";
|
|
749
|
+
constructor(error: z.ZodError | Error);
|
|
750
|
+
}
|
|
751
|
+
declare class AccountNotSetError extends BaseError {
|
|
752
|
+
readonly name = "Offer.AccountNotSetError";
|
|
753
|
+
constructor();
|
|
151
754
|
}
|
|
152
755
|
|
|
153
|
-
|
|
756
|
+
type Offer$1_AccountNotSetError = AccountNotSetError;
|
|
757
|
+
declare const Offer$1_AccountNotSetError: typeof AccountNotSetError;
|
|
758
|
+
type Offer$1_InvalidOfferError = InvalidOfferError;
|
|
759
|
+
declare const Offer$1_InvalidOfferError: typeof InvalidOfferError;
|
|
760
|
+
type Offer$1_Offer = Offer;
|
|
761
|
+
type Offer$1_OfferConsumed = OfferConsumed;
|
|
762
|
+
declare const Offer$1_OfferHashSchema: typeof OfferHashSchema;
|
|
763
|
+
declare const Offer$1_OfferSchema: typeof OfferSchema;
|
|
764
|
+
declare const Offer$1_consumedEvent: typeof consumedEvent;
|
|
765
|
+
declare const Offer$1_decode: typeof decode;
|
|
766
|
+
declare const Offer$1_domain: typeof domain;
|
|
767
|
+
declare const Offer$1_encode: typeof encode;
|
|
768
|
+
declare const Offer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
769
|
+
declare const Offer$1_hash: typeof hash;
|
|
770
|
+
declare const Offer$1_obligationId: typeof obligationId;
|
|
771
|
+
declare const Offer$1_sign: typeof sign;
|
|
772
|
+
declare const Offer$1_toSnakeCase: typeof toSnakeCase;
|
|
773
|
+
declare const Offer$1_types: typeof types;
|
|
774
|
+
declare namespace Offer$1 {
|
|
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, Offer$1_consumedEvent as consumedEvent, Offer$1_decode as decode, Offer$1_domain as domain, Offer$1_encode as encode, from$5 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$1 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$1 as random, Offer$1_sign as sign, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
776
|
+
}
|
|
154
777
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}>>;
|
|
162
|
-
chains: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<number[], string>>>;
|
|
163
|
-
loan_tokens: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
164
|
-
status: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<("valid" | "callback_not_supported" | "callback_error" | "unverified")[], string>>>;
|
|
165
|
-
callback_addresses: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
166
|
-
min_amount: z.ZodOptional<z.ZodBigInt>;
|
|
167
|
-
max_amount: z.ZodOptional<z.ZodBigInt>;
|
|
168
|
-
min_rate: z.ZodOptional<z.ZodBigInt>;
|
|
169
|
-
max_rate: z.ZodOptional<z.ZodBigInt>;
|
|
170
|
-
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
171
|
-
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
172
|
-
min_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
173
|
-
max_expiry: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
174
|
-
collateral_assets: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
175
|
-
collateral_oracles: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>>;
|
|
176
|
-
collateral_tuple: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
177
|
-
asset: string;
|
|
178
|
-
oracle: string | undefined;
|
|
179
|
-
lltv: (bigint & _morpho_dev_mempool.Brand<"LLTV">) | undefined;
|
|
180
|
-
}[], string>>>;
|
|
181
|
-
min_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
182
|
-
max_lltv: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
183
|
-
sort_by: z.ZodOptional<z.ZodEnum<{
|
|
184
|
-
amount: "amount";
|
|
185
|
-
rate: "rate";
|
|
186
|
-
maturity: "maturity";
|
|
187
|
-
expiry: "expiry";
|
|
188
|
-
}>>;
|
|
189
|
-
sort_order: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
190
|
-
asc: "asc";
|
|
191
|
-
desc: "desc";
|
|
192
|
-
}>>>;
|
|
193
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
194
|
-
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
195
|
-
}, z.core.$strip>;
|
|
196
|
-
readonly match_offers: z.ZodObject<{
|
|
197
|
-
side: z.ZodEnum<{
|
|
198
|
-
buy: "buy";
|
|
199
|
-
sell: "sell";
|
|
200
|
-
}>;
|
|
201
|
-
chain_id: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>;
|
|
202
|
-
rate: z.ZodOptional<z.ZodBigInt>;
|
|
203
|
-
collaterals: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
204
|
-
asset: string;
|
|
205
|
-
oracle: string;
|
|
206
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
207
|
-
}[], string>>>;
|
|
208
|
-
maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
209
|
-
min_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
210
|
-
max_maturity: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
211
|
-
loan_token: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
212
|
-
creator: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
|
|
213
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
214
|
-
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
215
|
-
}, z.core.$strip>;
|
|
778
|
+
/**
|
|
779
|
+
* Represents a liquidity pool with a unique ID and amount.
|
|
780
|
+
*/
|
|
781
|
+
type LiquidityPool = {
|
|
782
|
+
id: string;
|
|
783
|
+
amount: bigint;
|
|
216
784
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
785
|
+
/**
|
|
786
|
+
* Represents a hierarchical relationship between two liquidity pools.
|
|
787
|
+
*/
|
|
788
|
+
type LiquidityLink = {
|
|
789
|
+
parentPoolId: string;
|
|
790
|
+
childPoolId: string;
|
|
791
|
+
priority: number;
|
|
792
|
+
};
|
|
793
|
+
/**
|
|
794
|
+
* Represents the connection between an offer and its liquidity pools.
|
|
795
|
+
*/
|
|
796
|
+
type OfferLiquidityPool = {
|
|
797
|
+
offerHash: Offer["hash"];
|
|
798
|
+
poolId: string;
|
|
799
|
+
/**
|
|
800
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
801
|
+
* Meaning varies by pool type:
|
|
802
|
+
* - BuyWithEmptyCallback: Matches allowance amount from pool bellow
|
|
803
|
+
* - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
|
|
804
|
+
* - SellERC20Callback: Existing debt as negative value (reduces available capacity)
|
|
805
|
+
*/
|
|
806
|
+
amount: bigint;
|
|
226
807
|
};
|
|
227
808
|
/**
|
|
228
|
-
*
|
|
229
|
-
* @param
|
|
230
|
-
* @
|
|
809
|
+
* Calculate maximum debt capacity from collateral amount.
|
|
810
|
+
* @param amount - Collateral amount
|
|
811
|
+
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
812
|
+
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
813
|
+
* @returns Maximum debt capacity
|
|
814
|
+
*/
|
|
815
|
+
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
816
|
+
/**
|
|
817
|
+
* Generate pool ID for balance pools.
|
|
818
|
+
*/
|
|
819
|
+
declare function generateBalancePoolId(parameters: {
|
|
820
|
+
user: Address;
|
|
821
|
+
chainId: bigint;
|
|
822
|
+
token: Address;
|
|
823
|
+
}): string;
|
|
824
|
+
/**
|
|
825
|
+
* Generate pool ID for allowance pools.
|
|
826
|
+
*/
|
|
827
|
+
declare function generateAllowancePoolId(parameters: {
|
|
828
|
+
user: Address;
|
|
829
|
+
chainId: bigint;
|
|
830
|
+
token: Address;
|
|
831
|
+
}): string;
|
|
832
|
+
/**
|
|
833
|
+
* Generate pool ID for sell ERC20 callback pools.
|
|
834
|
+
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
835
|
+
*/
|
|
836
|
+
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
837
|
+
user: Address;
|
|
838
|
+
chainId: bigint;
|
|
839
|
+
obligationId: Hex;
|
|
840
|
+
token: Address;
|
|
841
|
+
offerHash: Hex;
|
|
842
|
+
}): string;
|
|
843
|
+
/**
|
|
844
|
+
* Generate pool ID for obligation collateral pools.
|
|
845
|
+
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
846
|
+
* These pools are shared across all offers with the same obligation.
|
|
847
|
+
*/
|
|
848
|
+
declare function generateObligationCollateralPoolId(parameters: {
|
|
849
|
+
user: Address;
|
|
850
|
+
chainId: bigint;
|
|
851
|
+
obligationId: Hex;
|
|
852
|
+
token: Address;
|
|
853
|
+
}): string;
|
|
854
|
+
/**
|
|
855
|
+
* Generate pool ID for buy vault callback pools.
|
|
856
|
+
*/
|
|
857
|
+
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
858
|
+
user: Address;
|
|
859
|
+
chainId: bigint;
|
|
860
|
+
vault: Address;
|
|
861
|
+
offerHash: Hex;
|
|
862
|
+
}): string;
|
|
863
|
+
/**
|
|
864
|
+
* Generate pool ID for debt pools.
|
|
865
|
+
*/
|
|
866
|
+
declare function generateDebtPoolId(parameters: {
|
|
867
|
+
user: Address;
|
|
868
|
+
chainId: bigint;
|
|
869
|
+
obligationId: Hex;
|
|
870
|
+
}): string;
|
|
871
|
+
/**
|
|
872
|
+
* Generate pool ID for user position in a vault.
|
|
873
|
+
*/
|
|
874
|
+
declare function generateUserVaultPositionPoolId(parameters: {
|
|
875
|
+
user: Address;
|
|
876
|
+
chainId: bigint;
|
|
877
|
+
vault: Address;
|
|
878
|
+
}): string;
|
|
879
|
+
/**
|
|
880
|
+
* Generate pool ID for vault position in a market.
|
|
231
881
|
*/
|
|
232
|
-
declare function
|
|
882
|
+
declare function generateVaultPositionPoolId(parameters: {
|
|
883
|
+
vault: Address;
|
|
884
|
+
chainId: bigint;
|
|
885
|
+
marketId: string;
|
|
886
|
+
}): string;
|
|
233
887
|
/**
|
|
234
|
-
*
|
|
235
|
-
* @param offerResponse - The router offer response to transform.
|
|
236
|
-
* @returns The router offer with all properties at the top level.
|
|
888
|
+
* Generate pool ID for market total liquidity.
|
|
237
889
|
*/
|
|
238
|
-
declare function
|
|
890
|
+
declare function generateMarketLiquidityPoolId(parameters: {
|
|
891
|
+
chainId: bigint;
|
|
892
|
+
marketId: string;
|
|
893
|
+
}): string;
|
|
239
894
|
|
|
240
|
-
type
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/** Maximum amount of assets in the offer */
|
|
256
|
-
maxAmount?: bigint;
|
|
257
|
-
/** Minimum rate per asset (in wei) */
|
|
258
|
-
minRate?: bigint;
|
|
259
|
-
/** Maximum rate per asset (in wei) */
|
|
260
|
-
maxRate?: bigint;
|
|
261
|
-
/** Minimum maturity timestamp (Unix timestamp in seconds) */
|
|
262
|
-
minMaturity?: Maturity.Maturity;
|
|
263
|
-
/** Maximum maturity timestamp (Unix timestamp in seconds) */
|
|
264
|
-
maxMaturity?: Maturity.Maturity;
|
|
265
|
-
/** Minimum expiry timestamp (Unix timestamp in seconds) */
|
|
266
|
-
minExpiry?: number;
|
|
267
|
-
/** Maximum expiry timestamp (Unix timestamp in seconds) */
|
|
268
|
-
maxExpiry?: number;
|
|
269
|
-
/** Filter by multiple collateral assets (comma-separated) */
|
|
270
|
-
collateralAssets?: string[];
|
|
271
|
-
/** Filter by multiple rate oracles (comma-separated) */
|
|
272
|
-
collateralOracles?: string[];
|
|
273
|
-
/** Filter by collateral combinations */
|
|
274
|
-
collateralTuple?: Array<{
|
|
275
|
-
asset: string;
|
|
276
|
-
oracle?: string;
|
|
277
|
-
lltv?: LLTV.LLTV;
|
|
278
|
-
}>;
|
|
279
|
-
/** Minimum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
|
|
280
|
-
minLltv?: LLTV.LLTV;
|
|
281
|
-
/** Maximum Loan-to-Value ratio (LLTV) for collateral (percentage as decimal) */
|
|
282
|
-
maxLltv?: LLTV.LLTV;
|
|
283
|
-
/** Field to sort results by */
|
|
284
|
-
sortBy?: "rate" | "maturity" | "expiry" | "amount";
|
|
285
|
-
/** Sort direction: asc (ascending) or desc (descending, default) */
|
|
286
|
-
sortOrder?: "asc" | "desc";
|
|
287
|
-
/** Pagination cursor in base64url-encoded format */
|
|
288
|
-
cursor?: string;
|
|
289
|
-
/** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
|
|
290
|
-
limit?: number;
|
|
291
|
-
};
|
|
292
|
-
type MatchParameters = {
|
|
293
|
-
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
294
|
-
side: "buy" | "sell";
|
|
295
|
-
/** The blockchain network chain ID */
|
|
296
|
-
chainId: number;
|
|
297
|
-
/** Rate per asset (in wei) for matching offers */
|
|
298
|
-
rate?: bigint;
|
|
299
|
-
/** Collateral requirements */
|
|
300
|
-
collaterals?: Array<{
|
|
301
|
-
asset: string;
|
|
302
|
-
oracle: string;
|
|
303
|
-
lltv: LLTV.LLTV;
|
|
304
|
-
}>;
|
|
305
|
-
/** Exact maturity timestamp (Unix timestamp in seconds) */
|
|
306
|
-
maturity?: Maturity.Maturity;
|
|
307
|
-
/** Minimum maturity timestamp (Unix timestamp in seconds, inclusive) */
|
|
308
|
-
minMaturity?: Maturity.Maturity;
|
|
309
|
-
/** Maximum maturity timestamp (Unix timestamp in seconds, inclusive) */
|
|
310
|
-
maxMaturity?: Maturity.Maturity;
|
|
311
|
-
/** The loan asset address to match against */
|
|
312
|
-
loanToken?: string;
|
|
313
|
-
/** Filter by a specific offer creator address */
|
|
314
|
-
creator?: string;
|
|
315
|
-
/** Filter by multiple statuses (comma-separated) */
|
|
316
|
-
status?: OfferStatus[];
|
|
317
|
-
/** Pagination cursor in base64url-encoded format */
|
|
318
|
-
cursor?: string;
|
|
319
|
-
/** Maximum number of offers to return. Defaults to 20. Maximum is 100. */
|
|
320
|
-
limit?: number;
|
|
321
|
-
};
|
|
322
|
-
type RouterApiClientConfig = {
|
|
323
|
-
readonly url: URL;
|
|
324
|
-
readonly headers: Headers;
|
|
325
|
-
};
|
|
326
|
-
type Client = Compute<RouterApiClientConfig & {
|
|
327
|
-
get: (parameters: GetParameters) => Promise<{
|
|
328
|
-
cursor: string | null;
|
|
329
|
-
offers: OfferResponse[];
|
|
330
|
-
}>;
|
|
331
|
-
match: (parameters: MatchParameters) => Promise<{
|
|
332
|
-
cursor: string | null;
|
|
333
|
-
offers: OfferResponse[];
|
|
334
|
-
}>;
|
|
335
|
-
}>;
|
|
336
|
-
declare function connect$1(opts?: {
|
|
337
|
-
url?: string;
|
|
338
|
-
apiKey?: string;
|
|
339
|
-
headers?: Headers;
|
|
340
|
-
}): Client;
|
|
341
|
-
declare namespace connect$1 {
|
|
342
|
-
type ErrorType = InvalidUrlError;
|
|
895
|
+
type Liquidity_LiquidityLink = LiquidityLink;
|
|
896
|
+
type Liquidity_LiquidityPool = LiquidityPool;
|
|
897
|
+
type Liquidity_OfferLiquidityPool = OfferLiquidityPool;
|
|
898
|
+
declare const Liquidity_calculateMaxDebt: typeof calculateMaxDebt;
|
|
899
|
+
declare const Liquidity_generateAllowancePoolId: typeof generateAllowancePoolId;
|
|
900
|
+
declare const Liquidity_generateBalancePoolId: typeof generateBalancePoolId;
|
|
901
|
+
declare const Liquidity_generateBuyVaultCallbackPoolId: typeof generateBuyVaultCallbackPoolId;
|
|
902
|
+
declare const Liquidity_generateDebtPoolId: typeof generateDebtPoolId;
|
|
903
|
+
declare const Liquidity_generateMarketLiquidityPoolId: typeof generateMarketLiquidityPoolId;
|
|
904
|
+
declare const Liquidity_generateObligationCollateralPoolId: typeof generateObligationCollateralPoolId;
|
|
905
|
+
declare const Liquidity_generateSellERC20CallbackPoolId: typeof generateSellERC20CallbackPoolId;
|
|
906
|
+
declare const Liquidity_generateUserVaultPositionPoolId: typeof generateUserVaultPositionPoolId;
|
|
907
|
+
declare const Liquidity_generateVaultPositionPoolId: typeof generateVaultPositionPoolId;
|
|
908
|
+
declare namespace Liquidity {
|
|
909
|
+
export { type Liquidity_LiquidityLink as LiquidityLink, type Liquidity_LiquidityPool as LiquidityPool, type Liquidity_OfferLiquidityPool as OfferLiquidityPool, Liquidity_calculateMaxDebt as calculateMaxDebt, Liquidity_generateAllowancePoolId as generateAllowancePoolId, Liquidity_generateBalancePoolId as generateBalancePoolId, Liquidity_generateBuyVaultCallbackPoolId as generateBuyVaultCallbackPoolId, Liquidity_generateDebtPoolId as generateDebtPoolId, Liquidity_generateMarketLiquidityPoolId as generateMarketLiquidityPoolId, Liquidity_generateObligationCollateralPoolId as generateObligationCollateralPoolId, Liquidity_generateSellERC20CallbackPoolId as generateSellERC20CallbackPoolId, Liquidity_generateUserVaultPositionPoolId as generateUserVaultPositionPoolId, Liquidity_generateVaultPositionPoolId as generateVaultPositionPoolId };
|
|
343
910
|
}
|
|
911
|
+
|
|
912
|
+
type Obligation = {
|
|
913
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
914
|
+
chainId: Id;
|
|
915
|
+
/** The token that is being borrowed for this obligation. */
|
|
916
|
+
loanToken: Address;
|
|
917
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
918
|
+
collaterals: Collateral[];
|
|
919
|
+
/** The maturity of the obligation. */
|
|
920
|
+
maturity: Maturity;
|
|
921
|
+
};
|
|
922
|
+
declare const ObligationSchema: z.ZodObject<{
|
|
923
|
+
chainId: z.ZodBigInt;
|
|
924
|
+
loanToken: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
925
|
+
collaterals: z.ZodArray<z.ZodObject<{
|
|
926
|
+
asset: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
927
|
+
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
928
|
+
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
929
|
+
}, z.core.$strip>>;
|
|
930
|
+
maturity: z.ZodPipe<z.ZodNumber, z.ZodTransform<Maturity, number>>;
|
|
931
|
+
}, z.core.$strip>;
|
|
344
932
|
/**
|
|
345
|
-
*
|
|
346
|
-
* @
|
|
933
|
+
* Creates an obligation from the given parameters.
|
|
934
|
+
* @constructor
|
|
935
|
+
* @param parameters - {@link from.Parameters}
|
|
936
|
+
* @returns The created obligation. {@link Obligation}
|
|
937
|
+
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
938
|
+
*
|
|
939
|
+
* @example
|
|
940
|
+
* ```ts
|
|
941
|
+
* const obligation = Obligation.from({
|
|
942
|
+
* chainId: 1n,
|
|
943
|
+
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
944
|
+
* collaterals: [
|
|
945
|
+
* Collateral.from({
|
|
946
|
+
* asset: privateKeyToAccount(generatePrivateKey()).address,
|
|
947
|
+
* oracle: privateKeyToAccount(generatePrivateKey()).address,
|
|
948
|
+
* lltv: 0.965
|
|
949
|
+
* }),
|
|
950
|
+
* ],
|
|
951
|
+
* maturity: Maturity.from("end_of_next_quarter"),
|
|
952
|
+
* });
|
|
953
|
+
* ```
|
|
347
954
|
*/
|
|
348
|
-
declare function
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
955
|
+
declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
|
|
956
|
+
declare namespace from$4 {
|
|
957
|
+
type Parameters = {
|
|
958
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
959
|
+
chainId: Id;
|
|
960
|
+
/** The token that is being borrowed for this obligation. */
|
|
961
|
+
loanToken: Address;
|
|
962
|
+
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
963
|
+
collaterals: from$7.Parameters[] | readonly from$7.Parameters[];
|
|
964
|
+
/** The maturity of the obligation. */
|
|
965
|
+
maturity: from$6.Parameters;
|
|
966
|
+
};
|
|
967
|
+
type ReturnType = Obligation;
|
|
968
|
+
type ErrorType = InvalidObligationError;
|
|
354
969
|
}
|
|
355
970
|
/**
|
|
356
|
-
*
|
|
357
|
-
* @
|
|
971
|
+
* Creates an obligation from a snake case object.
|
|
972
|
+
* @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
|
|
973
|
+
* @param input - {@link fromSnakeCase.Parameters}
|
|
974
|
+
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
358
975
|
*/
|
|
359
|
-
declare function
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
type ErrorType = GetApiErrorType;
|
|
976
|
+
declare function fromSnakeCase(input: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
977
|
+
declare namespace fromSnakeCase {
|
|
978
|
+
type Parameters = Snake<Obligation>;
|
|
979
|
+
type ReturnType = Obligation;
|
|
980
|
+
type ErrorType = InvalidObligationError;
|
|
365
981
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
982
|
+
/**
|
|
983
|
+
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
984
|
+
* The id is computed as keccak256(abi.encode(chainId, loanToken, collaterals, maturity)).
|
|
985
|
+
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
986
|
+
* @param obligation - {@link id.Parameters}
|
|
987
|
+
* @returns The obligation id as a 32-byte hex string. {@link id.ReturnType}
|
|
988
|
+
*
|
|
989
|
+
* @example
|
|
990
|
+
* ```ts
|
|
991
|
+
* const obligation = Obligation.random();
|
|
992
|
+
* const id = Obligation.id(obligation);
|
|
993
|
+
* console.log(id); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
994
|
+
* ```
|
|
995
|
+
*/
|
|
996
|
+
declare function id(obligation: id.Parameters): id.ReturnType;
|
|
997
|
+
declare namespace id {
|
|
998
|
+
type Parameters = Obligation;
|
|
999
|
+
type ReturnType = Hex;
|
|
1000
|
+
type ErrorType = CollateralsAreNotSortedError;
|
|
370
1001
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
1002
|
+
/**
|
|
1003
|
+
* Generates a random obligation.
|
|
1004
|
+
* @returns A randomly generated obligation. {@link random.ReturnType}
|
|
1005
|
+
*
|
|
1006
|
+
* @example
|
|
1007
|
+
* ```ts
|
|
1008
|
+
* const obligation = Obligation.random();
|
|
1009
|
+
* ```
|
|
1010
|
+
*/
|
|
1011
|
+
declare function random(): random.ReturnType;
|
|
1012
|
+
declare namespace random {
|
|
1013
|
+
type ReturnType = Obligation;
|
|
374
1014
|
}
|
|
375
|
-
declare class
|
|
376
|
-
name
|
|
377
|
-
constructor();
|
|
1015
|
+
declare class InvalidObligationError extends BaseError<z.ZodError | Error> {
|
|
1016
|
+
readonly name = "Obligation.InvalidObligationError";
|
|
1017
|
+
constructor(error: z.ZodError | Error);
|
|
378
1018
|
}
|
|
379
|
-
declare class
|
|
380
|
-
name
|
|
1019
|
+
declare class CollateralsAreNotSortedError extends BaseError {
|
|
1020
|
+
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
381
1021
|
constructor();
|
|
382
1022
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
1023
|
+
|
|
1024
|
+
type Obligation$1_CollateralsAreNotSortedError = CollateralsAreNotSortedError;
|
|
1025
|
+
declare const Obligation$1_CollateralsAreNotSortedError: typeof CollateralsAreNotSortedError;
|
|
1026
|
+
type Obligation$1_InvalidObligationError = InvalidObligationError;
|
|
1027
|
+
declare const Obligation$1_InvalidObligationError: typeof InvalidObligationError;
|
|
1028
|
+
type Obligation$1_Obligation = Obligation;
|
|
1029
|
+
declare const Obligation$1_ObligationSchema: typeof ObligationSchema;
|
|
1030
|
+
declare const Obligation$1_fromSnakeCase: typeof fromSnakeCase;
|
|
1031
|
+
declare const Obligation$1_id: typeof id;
|
|
1032
|
+
declare const Obligation$1_random: typeof random;
|
|
1033
|
+
declare namespace Obligation$1 {
|
|
1034
|
+
export { Obligation$1_CollateralsAreNotSortedError as CollateralsAreNotSortedError, Obligation$1_InvalidObligationError as InvalidObligationError, type Obligation$1_Obligation as Obligation, Obligation$1_ObligationSchema as ObligationSchema, from$4 as from, Obligation$1_fromSnakeCase as fromSnakeCase, Obligation$1_id as id, Obligation$1_random as random };
|
|
388
1035
|
}
|
|
389
1036
|
|
|
390
|
-
type
|
|
391
|
-
|
|
392
|
-
type Collector<name extends Name = Name> = {
|
|
393
|
-
/** The name of the collector. */
|
|
394
|
-
name: name;
|
|
395
|
-
/** Start collecting data from external sources.
|
|
396
|
-
* @yields The last block number processed by the collector.
|
|
397
|
-
*/
|
|
398
|
-
collect: () => AsyncGenerator<number, void, void>;
|
|
399
|
-
/** The last block number processed by the collector. */
|
|
400
|
-
lastSyncedBlock: () => Promise<number>;
|
|
401
|
-
/** The callback to call when a reorg is detected. */
|
|
402
|
-
onReorg(lastFinalizedBlockNumber: number): void;
|
|
1037
|
+
type Indexer = {
|
|
1038
|
+
start: () => () => void;
|
|
403
1039
|
};
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
*/
|
|
408
|
-
declare function start(collector: Collector): () => void;
|
|
409
|
-
|
|
410
|
-
declare function createBuyWithEmptyCallbackLiquidityCollector(params: {
|
|
411
|
-
client: PublicClient;
|
|
412
|
-
offerStore: OfferStore;
|
|
413
|
-
collectorBlockStore: CollectorBlockStore;
|
|
414
|
-
liquidityStore: LiquidityStore;
|
|
415
|
-
chain: Chain.Chain;
|
|
416
|
-
options?: {
|
|
417
|
-
maxBatchSize?: number;
|
|
418
|
-
interval?: number;
|
|
419
|
-
};
|
|
420
|
-
}): Collector<"buy_with_empty_callback_liquidity">;
|
|
421
|
-
|
|
422
|
-
declare function createChainReorgsCollector(parameters: {
|
|
423
|
-
client: PublicClient;
|
|
424
|
-
subscribers: Collector[];
|
|
425
|
-
collectorStore: CollectorBlockStore;
|
|
426
|
-
chain: Chain.Chain;
|
|
427
|
-
options?: {
|
|
428
|
-
maxBatchSize?: number;
|
|
429
|
-
interval?: number;
|
|
430
|
-
maxBlockNumber?: number;
|
|
431
|
-
};
|
|
432
|
-
}): Collector<"chain_reorgs">;
|
|
433
|
-
|
|
434
|
-
declare function createConsumedEventsCollector(parameters: {
|
|
435
|
-
client: PublicClient;
|
|
436
|
-
contractAddress: Address;
|
|
437
|
-
offerStore: OfferStore;
|
|
438
|
-
collectorBlockStore: CollectorBlockStore;
|
|
439
|
-
chainId: Chain.Id;
|
|
440
|
-
options?: {
|
|
441
|
-
maxBatchSize?: number;
|
|
442
|
-
interval?: number;
|
|
443
|
-
};
|
|
444
|
-
}): Collector<"consumed_events">;
|
|
445
|
-
|
|
446
|
-
declare function createMempoolCollector(parameters: {
|
|
447
|
-
mempool: Mempool.Client;
|
|
448
|
-
offerStore: OfferStore;
|
|
449
|
-
collectorBlockStore: CollectorBlockStore;
|
|
450
|
-
chain: Chain.Chain;
|
|
451
|
-
options?: {
|
|
452
|
-
maxBatchSize?: number;
|
|
453
|
-
interval?: number;
|
|
454
|
-
};
|
|
455
|
-
}): Collector<"mempool_offers">;
|
|
1040
|
+
declare function create$7(params: {
|
|
1041
|
+
collectors: Collector[];
|
|
1042
|
+
}): Indexer;
|
|
456
1043
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
collectorBlockStore: CollectorBlockStore;
|
|
461
|
-
liquidityStore: LiquidityStore;
|
|
462
|
-
chain: Chain.Chain;
|
|
463
|
-
options?: {
|
|
464
|
-
maxBatchSize?: number;
|
|
465
|
-
interval?: number;
|
|
466
|
-
};
|
|
467
|
-
}): Collector<"sell_erc20_callback_liquidity">;
|
|
468
|
-
|
|
469
|
-
type index$1_Collector<name extends Name = Name> = Collector<name>;
|
|
470
|
-
type index$1_Name = Name;
|
|
471
|
-
declare const index$1_createBuyWithEmptyCallbackLiquidityCollector: typeof createBuyWithEmptyCallbackLiquidityCollector;
|
|
472
|
-
declare const index$1_createChainReorgsCollector: typeof createChainReorgsCollector;
|
|
473
|
-
declare const index$1_createConsumedEventsCollector: typeof createConsumedEventsCollector;
|
|
474
|
-
declare const index$1_createMempoolCollector: typeof createMempoolCollector;
|
|
475
|
-
declare const index$1_createSellERC20CallbackLiquidityCollector: typeof createSellERC20CallbackLiquidityCollector;
|
|
476
|
-
declare const index$1_start: typeof start;
|
|
477
|
-
declare namespace index$1 {
|
|
478
|
-
export { type index$1_Collector as Collector, type index$1_Name as Name, index$1_createBuyWithEmptyCallbackLiquidityCollector as createBuyWithEmptyCallbackLiquidityCollector, index$1_createChainReorgsCollector as createChainReorgsCollector, index$1_createConsumedEventsCollector as createConsumedEventsCollector, index$1_createMempoolCollector as createMempoolCollector, index$1_createSellERC20CallbackLiquidityCollector as createSellERC20CallbackLiquidityCollector, index$1_start as start };
|
|
1044
|
+
type RouterIndexer_Indexer = Indexer;
|
|
1045
|
+
declare namespace RouterIndexer {
|
|
1046
|
+
export { type RouterIndexer_Indexer as Indexer, create$7 as create };
|
|
479
1047
|
}
|
|
480
1048
|
|
|
481
1049
|
type PgDB = ReturnType<typeof drizzle> & {
|
|
@@ -487,7 +1055,7 @@ type PGLiteDB = ReturnType<typeof drizzle$1> & {
|
|
|
487
1055
|
pool: PGlite;
|
|
488
1056
|
};
|
|
489
1057
|
type PG = PgDB | PGLiteDB;
|
|
490
|
-
declare function connect(parameters: {
|
|
1058
|
+
declare function connect$2(parameters: {
|
|
491
1059
|
type: "pg";
|
|
492
1060
|
endpoint: string;
|
|
493
1061
|
} | {
|
|
@@ -501,241 +1069,181 @@ type PG$1_PGLiteDB = PGLiteDB;
|
|
|
501
1069
|
type PG$1_PgDB = PgDB;
|
|
502
1070
|
declare const PG$1_applyMigrations: typeof applyMigrations;
|
|
503
1071
|
declare const PG$1_clean: typeof clean;
|
|
504
|
-
declare const PG$1_connect: typeof connect;
|
|
505
1072
|
declare namespace PG$1 {
|
|
506
|
-
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,
|
|
1073
|
+
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 };
|
|
507
1074
|
}
|
|
508
1075
|
|
|
509
|
-
type
|
|
510
|
-
/** Get the latest block number processed by a
|
|
511
|
-
getBlockNumber: (
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
1076
|
+
type ChainStore = {
|
|
1077
|
+
/** Get the latest block number processed by a given chain alongside its epoch. */
|
|
1078
|
+
getBlockNumber: (chainId: Id) => Promise<{
|
|
1079
|
+
blockNumber: number;
|
|
1080
|
+
epoch: bigint;
|
|
1081
|
+
}>;
|
|
1082
|
+
/** Get the latest block number processed for all chains, optionally filtered by chain id. */
|
|
1083
|
+
getBlockNumbers: (parameters?: {
|
|
1084
|
+
chainId?: Id;
|
|
1085
|
+
}) => Promise<Array<{
|
|
1086
|
+
chainId: Id;
|
|
1087
|
+
blockNumber: number;
|
|
1088
|
+
epoch: bigint;
|
|
1089
|
+
updatedAt: Date;
|
|
1090
|
+
}>>;
|
|
1091
|
+
/** Save the latest block number processed for a given chain alongside its epoch.*/
|
|
516
1092
|
saveBlockNumber: (parameters: {
|
|
517
|
-
|
|
518
|
-
chainId: Chain.Id;
|
|
1093
|
+
chainId: Id;
|
|
519
1094
|
blockNumber: number;
|
|
1095
|
+
epoch: bigint;
|
|
520
1096
|
}) => Promise<void>;
|
|
521
1097
|
};
|
|
522
1098
|
/** Postgres implementation. */
|
|
523
|
-
declare const create$
|
|
1099
|
+
declare const create$6: (config: {
|
|
524
1100
|
db: PG;
|
|
525
|
-
}) =>
|
|
526
|
-
declare function memory$1(): CollectorBlockStore;
|
|
1101
|
+
}) => ChainStore;
|
|
527
1102
|
|
|
528
|
-
type
|
|
529
|
-
declare namespace
|
|
530
|
-
export { type
|
|
1103
|
+
type ChainStore$1_ChainStore = ChainStore;
|
|
1104
|
+
declare namespace ChainStore$1 {
|
|
1105
|
+
export { type ChainStore$1_ChainStore as ChainStore, create$6 as create };
|
|
531
1106
|
}
|
|
532
1107
|
|
|
533
|
-
type
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
batchSize?: number;
|
|
563
|
-
retryAttempts?: number;
|
|
564
|
-
retryDelayMs?: number;
|
|
565
|
-
blockNumber?: number;
|
|
566
|
-
};
|
|
567
|
-
type LiquidityClient = {
|
|
568
|
-
/** Fetch liquidity for buy offers based on wallet token balances and allowances. */
|
|
569
|
-
fetchBuyLiquidity: (parameters: {
|
|
570
|
-
chainId: bigint;
|
|
571
|
-
spender: Address;
|
|
572
|
-
pairs: Array<{
|
|
573
|
-
user: Address;
|
|
574
|
-
loanToken: Address;
|
|
575
|
-
}>;
|
|
576
|
-
options?: FetchOptions;
|
|
577
|
-
}) => Promise<Liquidity[]>;
|
|
578
|
-
/** Fetch liquidity for sell offers based on collateral capacity and existing positions. */
|
|
579
|
-
fetchSellLiquidity: (parameters: {
|
|
580
|
-
chainId: bigint;
|
|
581
|
-
spender: Address;
|
|
582
|
-
morphoAddress: Address;
|
|
583
|
-
offers: Array<Offer.Offer>;
|
|
584
|
-
options?: FetchOptions;
|
|
585
|
-
}) => Promise<Liquidity[]>;
|
|
1108
|
+
type CollectorStore = {
|
|
1109
|
+
/** Get the latest block number processed by a collector for a given chain alongside the epoch. */
|
|
1110
|
+
getBlockNumber: (parameters: {
|
|
1111
|
+
collectorName: Name;
|
|
1112
|
+
chainId: Id;
|
|
1113
|
+
}) => Promise<{
|
|
1114
|
+
blockNumber: number;
|
|
1115
|
+
epoch: bigint;
|
|
1116
|
+
}>;
|
|
1117
|
+
/**
|
|
1118
|
+
* Get the latest block number processed by all collectors.
|
|
1119
|
+
* When a chainId is provided the result is filtered, otherwise all records are returned.
|
|
1120
|
+
*/
|
|
1121
|
+
getBlockNumbers: (parameters?: {
|
|
1122
|
+
chainId?: Id;
|
|
1123
|
+
}) => Promise<Array<{
|
|
1124
|
+
collectorName: Name;
|
|
1125
|
+
chainId: Id;
|
|
1126
|
+
blockNumber: number;
|
|
1127
|
+
epoch: bigint;
|
|
1128
|
+
updatedAt: Date;
|
|
1129
|
+
}>>;
|
|
1130
|
+
/** Save the latest block number processed by a collector for a given chain.*/
|
|
1131
|
+
saveBlockNumber: (parameters: {
|
|
1132
|
+
collectorName: Name;
|
|
1133
|
+
chainId: Id;
|
|
1134
|
+
blockNumber: number;
|
|
1135
|
+
epoch: bigint;
|
|
1136
|
+
}) => Promise<void>;
|
|
586
1137
|
};
|
|
587
|
-
/**
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
* @returns LiquidityClient
|
|
592
|
-
*/
|
|
593
|
-
declare const create$2: (config: {
|
|
594
|
-
client: Pick<PublicActions, "multicall">;
|
|
595
|
-
}) => LiquidityClient;
|
|
596
|
-
declare function serialize(liquidity: Liquidity): string;
|
|
1138
|
+
/** Postgres implementation. */
|
|
1139
|
+
declare const create$5: (config: {
|
|
1140
|
+
db: PG;
|
|
1141
|
+
}) => CollectorStore;
|
|
597
1142
|
|
|
598
|
-
type
|
|
599
|
-
|
|
600
|
-
type
|
|
601
|
-
type Liquidity$1_LiquidityQueue = LiquidityQueue;
|
|
602
|
-
type Liquidity$1_LiquidityQueueWithPool = LiquidityQueueWithPool;
|
|
603
|
-
type Liquidity$1_LiquidityUserPosition = LiquidityUserPosition;
|
|
604
|
-
declare const Liquidity$1_serialize: typeof serialize;
|
|
605
|
-
declare namespace Liquidity$1 {
|
|
606
|
-
export { type Liquidity$1_Liquidity as Liquidity, type Liquidity$1_LiquidityClient as LiquidityClient, type Liquidity$1_LiquidityPool as LiquidityPool, type Liquidity$1_LiquidityQueue as LiquidityQueue, type Liquidity$1_LiquidityQueueWithPool as LiquidityQueueWithPool, type Liquidity$1_LiquidityUserPosition as LiquidityUserPosition, create$2 as create, Liquidity$1_serialize as serialize };
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
declare enum CallbackType {
|
|
610
|
-
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
611
|
-
SellERC20Callback = "sell_erc20_callback"
|
|
612
|
-
}
|
|
613
|
-
declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
|
|
614
|
-
type BuildLiquidityParameters = {
|
|
615
|
-
type: CallbackType.BuyWithEmptyCallback;
|
|
616
|
-
user: Address;
|
|
617
|
-
loanToken: Address;
|
|
618
|
-
chainId: Chain.Id;
|
|
619
|
-
amount: bigint;
|
|
620
|
-
index?: number;
|
|
621
|
-
updatedAt?: Date;
|
|
622
|
-
} | {
|
|
623
|
-
type: CallbackType.SellERC20Callback;
|
|
624
|
-
user: Address;
|
|
625
|
-
termId: string;
|
|
626
|
-
offerHash: string;
|
|
627
|
-
chainId: Chain.Id;
|
|
628
|
-
amount: bigint;
|
|
629
|
-
collaterals: Array<{
|
|
630
|
-
collateralAddress: Address;
|
|
631
|
-
balance: bigint;
|
|
632
|
-
callbackAmount: bigint;
|
|
633
|
-
}>;
|
|
634
|
-
index?: number;
|
|
635
|
-
updatedAt?: Date;
|
|
636
|
-
};
|
|
637
|
-
declare function buildLiquidity(parameters: BuildLiquidityParameters): Liquidity;
|
|
638
|
-
declare function getCallbackIdForOffer(offer: Offer.Offer): string | null;
|
|
639
|
-
declare function decode$1(parameters: {
|
|
640
|
-
type: CallbackType;
|
|
641
|
-
data: Hex;
|
|
642
|
-
}): Array<{
|
|
643
|
-
collateral: Address;
|
|
644
|
-
amount: bigint;
|
|
645
|
-
}>;
|
|
646
|
-
declare function encode$1(parameters: {
|
|
647
|
-
type: CallbackType;
|
|
648
|
-
data: {
|
|
649
|
-
collaterals: Address[];
|
|
650
|
-
amounts: bigint[];
|
|
651
|
-
};
|
|
652
|
-
}): Hex;
|
|
653
|
-
|
|
654
|
-
type Callback_CallbackType = CallbackType;
|
|
655
|
-
declare const Callback_CallbackType: typeof CallbackType;
|
|
656
|
-
declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
|
|
657
|
-
declare const Callback_buildLiquidity: typeof buildLiquidity;
|
|
658
|
-
declare const Callback_getCallbackIdForOffer: typeof getCallbackIdForOffer;
|
|
659
|
-
declare namespace Callback {
|
|
660
|
-
export { Callback_CallbackType as CallbackType, Callback_WhitelistedCallbackAddresses as WhitelistedCallbackAddresses, Callback_buildLiquidity as buildLiquidity, decode$1 as decode, encode$1 as encode, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
|
|
1143
|
+
type CollectorStore$1_CollectorStore = CollectorStore;
|
|
1144
|
+
declare namespace CollectorStore$1 {
|
|
1145
|
+
export { type CollectorStore$1_CollectorStore as CollectorStore, create$5 as create };
|
|
661
1146
|
}
|
|
662
1147
|
|
|
663
1148
|
type LiquidityStore = {
|
|
664
|
-
/**
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
1149
|
+
/**
|
|
1150
|
+
* Get all liquidity pools.
|
|
1151
|
+
* @returns Array of all liquidity pools
|
|
1152
|
+
*/
|
|
1153
|
+
getAllPools: () => Promise<LiquidityPool[]>;
|
|
1154
|
+
/**
|
|
1155
|
+
* Get all liquidity links.
|
|
1156
|
+
* @returns Array of all liquidity links
|
|
1157
|
+
*/
|
|
1158
|
+
getAllLinks: () => Promise<LiquidityLink[]>;
|
|
1159
|
+
/**
|
|
1160
|
+
* Get all offer-pool mappings.
|
|
1161
|
+
* @returns Array of all offer liquidity pools
|
|
1162
|
+
*/
|
|
1163
|
+
getAllOfferPools: () => Promise<OfferLiquidityPool[]>;
|
|
1164
|
+
/**
|
|
1165
|
+
* Save or update liquidity data.
|
|
1166
|
+
* Accepts flat arrays of pools, links, and offer-pool mappings.
|
|
1167
|
+
*
|
|
1168
|
+
* Automatically cleans up stale links: for each parent pool being updated,
|
|
1169
|
+
* deletes any existing links with priority greater than the maximum priority
|
|
1170
|
+
* in the new links. This ensures that when priority-ordered relationships
|
|
1171
|
+
* shrink, old links are removed.
|
|
1172
|
+
*
|
|
1173
|
+
* @param parameters - Object containing arrays of pools, links, and offerPools
|
|
1174
|
+
*/
|
|
673
1175
|
save: (parameters: {
|
|
674
|
-
|
|
1176
|
+
pools: LiquidityPool[];
|
|
1177
|
+
links: LiquidityLink[];
|
|
1178
|
+
offerPools: OfferLiquidityPool[];
|
|
675
1179
|
}) => Promise<void>;
|
|
676
1180
|
};
|
|
677
1181
|
/** Postgres implementation. */
|
|
678
|
-
declare const create$
|
|
1182
|
+
declare const create$4: (config: {
|
|
679
1183
|
db: PG;
|
|
680
1184
|
}) => LiquidityStore;
|
|
681
|
-
declare function memory(): LiquidityStore;
|
|
682
1185
|
|
|
683
1186
|
type LiquidityStore$1_LiquidityStore = LiquidityStore;
|
|
684
|
-
declare const LiquidityStore$1_memory: typeof memory;
|
|
685
1187
|
declare namespace LiquidityStore$1 {
|
|
686
|
-
export { type LiquidityStore$1_LiquidityStore as LiquidityStore, create$
|
|
1188
|
+
export { type LiquidityStore$1_LiquidityStore as LiquidityStore, create$4 as create };
|
|
687
1189
|
}
|
|
688
1190
|
|
|
689
1191
|
/**
|
|
690
|
-
* The `OfferStore` is responsible for managing offer data
|
|
1192
|
+
* The `OfferStore` is responsible for managing offer-related data.
|
|
691
1193
|
*/
|
|
692
1194
|
type OfferStore = {
|
|
693
|
-
/** Create a single offer
|
|
1195
|
+
/** Create a single offer. */
|
|
694
1196
|
create: (parameters: {
|
|
695
|
-
offer: Offer
|
|
696
|
-
status: OfferStatus;
|
|
697
|
-
metadata?: OfferMetadata;
|
|
1197
|
+
offer: Offer;
|
|
698
1198
|
}) => Promise<string>;
|
|
699
|
-
/** Create multiple offers
|
|
1199
|
+
/** Create multiple offers. */
|
|
700
1200
|
createMany: (parameters: {
|
|
701
|
-
offer: Offer
|
|
702
|
-
status: OfferStatus;
|
|
703
|
-
metadata?: OfferMetadata;
|
|
1201
|
+
offer: Offer;
|
|
704
1202
|
}[]) => Promise<string[]>;
|
|
705
|
-
/** Get all offers
|
|
1203
|
+
/** Get all offers with optional filtering, sorting, and pagination. */
|
|
706
1204
|
getAll: (params?: GetAllParams) => Promise<{
|
|
707
|
-
offers:
|
|
1205
|
+
offers: Offer[];
|
|
708
1206
|
nextCursor: string | null;
|
|
709
1207
|
}>;
|
|
710
1208
|
/** Find offers that match the specified parameters, with cursor pagination. */
|
|
711
|
-
findMatchingOffers: (params: FindMatchingOffersParams
|
|
712
|
-
|
|
1209
|
+
findMatchingOffers: (params: FindMatchingOffersParams & {
|
|
1210
|
+
implementation?: "nodejs" | "sql";
|
|
1211
|
+
}) => Promise<{
|
|
1212
|
+
offers: Offer[];
|
|
713
1213
|
nextCursor: string | null;
|
|
1214
|
+
implementation?: "nodejs" | "sql";
|
|
714
1215
|
}>;
|
|
715
|
-
/** Delete an offer
|
|
716
|
-
delete: (hash: Offer
|
|
717
|
-
/** Delete multiple offers
|
|
718
|
-
deleteMany: (hashes: Offer
|
|
719
|
-
/**
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
status: OfferStatus;
|
|
723
|
-
metadata?: OfferMetadata;
|
|
724
|
-
}) => Promise<void>;
|
|
1216
|
+
/** Delete an offer by hash. */
|
|
1217
|
+
delete: (hash: Offer["hash"]) => Promise<boolean>;
|
|
1218
|
+
/** Delete multiple offers by hashes. */
|
|
1219
|
+
deleteMany: (hashes: Offer["hash"][]) => Promise<number>;
|
|
1220
|
+
/** Delete multiple offers by block number greater than or equal to the given value. */
|
|
1221
|
+
deleteManyByBlockNumberGte: (blockNumberGte: number) => Promise<number>;
|
|
1222
|
+
/** Update the consumed amount for a set of offers with the same chainId, offering, and nonce. */
|
|
725
1223
|
updateConsumedAmount: (parameters: {
|
|
726
1224
|
id: string;
|
|
727
|
-
chainId: Offer
|
|
728
|
-
offering: Offer
|
|
729
|
-
nonce: Offer
|
|
1225
|
+
chainId: Offer["chainId"];
|
|
1226
|
+
offering: Offer["offering"];
|
|
1227
|
+
nonce: Offer["nonce"];
|
|
730
1228
|
consumed: bigint;
|
|
1229
|
+
blockNumber: number;
|
|
731
1230
|
}) => Promise<void>;
|
|
1231
|
+
/** Delete multiple consumed amounts by block number greater than or equal to the given value. */
|
|
1232
|
+
deleteManyConsumedAmountsByBlockNumberGte: (blockNumberGte: number) => Promise<number>;
|
|
1233
|
+
/** Get all obligations */
|
|
1234
|
+
getAllObligations: (parameters?: {
|
|
1235
|
+
cursor?: string;
|
|
1236
|
+
limit?: number;
|
|
1237
|
+
}) => Promise<{
|
|
1238
|
+
obligations: Obligation[];
|
|
1239
|
+
nextCursor: string | null;
|
|
1240
|
+
}>;
|
|
732
1241
|
};
|
|
733
1242
|
type GetOffersFilters = {
|
|
734
1243
|
creators?: string[];
|
|
735
1244
|
side?: "buy" | "sell";
|
|
736
1245
|
chains?: number[];
|
|
737
1246
|
loanTokens?: string[];
|
|
738
|
-
status?: OfferStatus[];
|
|
739
1247
|
callbackAddresses?: string[];
|
|
740
1248
|
minAmount?: bigint;
|
|
741
1249
|
maxAmount?: bigint;
|
|
@@ -750,7 +1258,7 @@ type GetOffersFilters = {
|
|
|
750
1258
|
collateralTuple?: Array<{
|
|
751
1259
|
asset: string;
|
|
752
1260
|
oracle?: string;
|
|
753
|
-
lltv?: LLTV
|
|
1261
|
+
lltv?: LLTV;
|
|
754
1262
|
}>;
|
|
755
1263
|
minLltv?: number;
|
|
756
1264
|
maxLltv?: number;
|
|
@@ -760,19 +1268,10 @@ type GetOffersFilters = {
|
|
|
760
1268
|
limit?: number;
|
|
761
1269
|
};
|
|
762
1270
|
type FindMatchingOffersParams = {
|
|
1271
|
+
/** The side of the offer. */
|
|
763
1272
|
side: "buy" | "sell";
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
collaterals?: Array<{
|
|
767
|
-
asset: string;
|
|
768
|
-
oracle: string;
|
|
769
|
-
lltv: LLTV.LLTV;
|
|
770
|
-
}>;
|
|
771
|
-
maturity?: number;
|
|
772
|
-
minMaturity?: number;
|
|
773
|
-
maxMaturity?: number;
|
|
774
|
-
loanToken?: string;
|
|
775
|
-
creator?: string;
|
|
1273
|
+
/** The obligationId of the offer. */
|
|
1274
|
+
obligationId: Hex;
|
|
776
1275
|
/** Cursor string returned by a previous call, for pagination */
|
|
777
1276
|
cursor?: string;
|
|
778
1277
|
/** Page size; defaults to 20 */
|
|
@@ -785,233 +1284,245 @@ type PgConfig = {
|
|
|
785
1284
|
/** The database instance to use for operations. */
|
|
786
1285
|
db: PG;
|
|
787
1286
|
};
|
|
788
|
-
declare function create(config: PgConfig): OfferStore;
|
|
1287
|
+
declare function create$3(config: PgConfig): OfferStore;
|
|
789
1288
|
|
|
790
1289
|
type OfferStore$1_FindMatchingOffersParams = FindMatchingOffersParams;
|
|
791
1290
|
type OfferStore$1_GetAllParams = GetAllParams;
|
|
792
1291
|
type OfferStore$1_GetOffersFilters = GetOffersFilters;
|
|
793
1292
|
type OfferStore$1_OfferStore = OfferStore;
|
|
794
1293
|
type OfferStore$1_PgConfig = PgConfig;
|
|
795
|
-
declare const OfferStore$1_create: typeof create;
|
|
796
1294
|
declare namespace OfferStore$1 {
|
|
797
|
-
export { type OfferStore$1_FindMatchingOffersParams as FindMatchingOffersParams, type OfferStore$1_GetAllParams as GetAllParams, type OfferStore$1_GetOffersFilters as GetOffersFilters, type OfferStore$1_OfferStore as OfferStore, type OfferStore$1_PgConfig as PgConfig,
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
/**
|
|
801
|
-
* Start a local router server.
|
|
802
|
-
* @example
|
|
803
|
-
* ```ts
|
|
804
|
-
* import { Router } from "@morpho-dev/router";
|
|
805
|
-
* await Router.serve(); // local router server running on http://localhost:8081
|
|
806
|
-
* ```
|
|
807
|
-
*/
|
|
808
|
-
declare function serve(parameters: {
|
|
809
|
-
port: number;
|
|
810
|
-
store: OfferStore;
|
|
811
|
-
}): Promise<void>;
|
|
812
|
-
declare function error(error: unknown, c: Context): Response & hono.TypedResponse<{
|
|
813
|
-
statusCode: number;
|
|
814
|
-
body: string;
|
|
815
|
-
}, hono_utils_http_status.ContentfulStatusCode, "json">;
|
|
816
|
-
declare function success<T>(c: Context, { data, cursor, }: {
|
|
817
|
-
data: T | T[];
|
|
818
|
-
cursor?: string | null;
|
|
819
|
-
}): Response & hono.TypedResponse<{
|
|
820
|
-
status: string;
|
|
821
|
-
cursor: string | null | undefined;
|
|
822
|
-
data: T | T[];
|
|
823
|
-
meta: {
|
|
824
|
-
timestamp: string;
|
|
825
|
-
};
|
|
826
|
-
} extends hono_utils_types.JSONValue ? { [K in keyof {
|
|
827
|
-
status: string;
|
|
828
|
-
cursor: string | null | undefined;
|
|
829
|
-
data: T | T[];
|
|
830
|
-
meta: {
|
|
831
|
-
timestamp: string;
|
|
832
|
-
};
|
|
833
|
-
} as ({
|
|
834
|
-
status: string;
|
|
835
|
-
cursor: string | null | undefined;
|
|
836
|
-
data: T | T[];
|
|
837
|
-
meta: {
|
|
838
|
-
timestamp: string;
|
|
839
|
-
};
|
|
840
|
-
}[K] extends infer T_1 ? T_1 extends {
|
|
841
|
-
status: string;
|
|
842
|
-
cursor: string | null | undefined;
|
|
843
|
-
data: T | T[];
|
|
844
|
-
meta: {
|
|
845
|
-
timestamp: string;
|
|
846
|
-
};
|
|
847
|
-
}[K] ? T_1 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) extends true ? never : K]: boolean extends ({
|
|
848
|
-
status: string;
|
|
849
|
-
cursor: string | null | undefined;
|
|
850
|
-
data: T | T[];
|
|
851
|
-
meta: {
|
|
852
|
-
timestamp: string;
|
|
853
|
-
};
|
|
854
|
-
}[K] extends infer T_2 ? T_2 extends {
|
|
855
|
-
status: string;
|
|
856
|
-
cursor: string | null | undefined;
|
|
857
|
-
data: T | T[];
|
|
858
|
-
meta: {
|
|
859
|
-
timestamp: string;
|
|
860
|
-
};
|
|
861
|
-
}[K] ? T_2 extends hono_utils_types.InvalidJSONValue ? true : false : never : never) ? hono_utils_types.JSONParsed<{
|
|
862
|
-
status: string;
|
|
863
|
-
cursor: string | null | undefined;
|
|
864
|
-
data: T | T[];
|
|
865
|
-
meta: {
|
|
866
|
-
timestamp: string;
|
|
867
|
-
};
|
|
868
|
-
}[K]> | undefined : hono_utils_types.JSONParsed<{
|
|
869
|
-
status: string;
|
|
870
|
-
cursor: string | null | undefined;
|
|
871
|
-
data: T | T[];
|
|
872
|
-
meta: {
|
|
873
|
-
timestamp: string;
|
|
874
|
-
};
|
|
875
|
-
}[K]>; } : never, hono_utils_http_status.ContentfulStatusCode, "json">;
|
|
876
|
-
declare class APIError extends Error {
|
|
877
|
-
statusCode: number;
|
|
878
|
-
code: string;
|
|
879
|
-
details?: unknown | undefined;
|
|
880
|
-
constructor(statusCode: number, message: string, code: string, details?: unknown | undefined);
|
|
881
|
-
}
|
|
882
|
-
declare class ValidationError extends APIError {
|
|
883
|
-
constructor(message: string, details?: unknown);
|
|
884
|
-
}
|
|
885
|
-
declare class NotFoundError extends APIError {
|
|
886
|
-
constructor(message: string);
|
|
887
|
-
}
|
|
888
|
-
declare class InternalServerError extends APIError {
|
|
889
|
-
constructor(message?: string);
|
|
890
|
-
}
|
|
891
|
-
declare class BadRequestError extends APIError {
|
|
892
|
-
constructor(message?: string, details?: unknown);
|
|
893
|
-
}
|
|
894
|
-
declare function handleZodError(error: z.ZodError): ValidationError;
|
|
895
|
-
|
|
896
|
-
type index_APIError = APIError;
|
|
897
|
-
declare const index_APIError: typeof APIError;
|
|
898
|
-
type index_BadRequestError = BadRequestError;
|
|
899
|
-
declare const index_BadRequestError: typeof BadRequestError;
|
|
900
|
-
type index_Client = Client;
|
|
901
|
-
type index_GetParameters = GetParameters;
|
|
902
|
-
type index_HttpForbiddenError = HttpForbiddenError;
|
|
903
|
-
declare const index_HttpForbiddenError: typeof HttpForbiddenError;
|
|
904
|
-
type index_HttpGetOffersFailedError = HttpGetOffersFailedError;
|
|
905
|
-
declare const index_HttpGetOffersFailedError: typeof HttpGetOffersFailedError;
|
|
906
|
-
type index_HttpRateLimitError = HttpRateLimitError;
|
|
907
|
-
declare const index_HttpRateLimitError: typeof HttpRateLimitError;
|
|
908
|
-
type index_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
909
|
-
declare const index_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
910
|
-
type index_InternalServerError = InternalServerError;
|
|
911
|
-
declare const index_InternalServerError: typeof InternalServerError;
|
|
912
|
-
type index_InvalidUrlError = InvalidUrlError;
|
|
913
|
-
declare const index_InvalidUrlError: typeof InvalidUrlError;
|
|
914
|
-
type index_MatchParameters = MatchParameters;
|
|
915
|
-
type index_NotFoundError = NotFoundError;
|
|
916
|
-
declare const index_NotFoundError: typeof NotFoundError;
|
|
917
|
-
type index_OfferResponse = OfferResponse;
|
|
918
|
-
declare const index_OpenApi: typeof OpenApi;
|
|
919
|
-
type index_RouterApiClientConfig = RouterApiClientConfig;
|
|
920
|
-
type index_ValidationError = ValidationError;
|
|
921
|
-
declare const index_ValidationError: typeof ValidationError;
|
|
922
|
-
declare const index_error: typeof error;
|
|
923
|
-
declare const index_fromResponse: typeof fromResponse;
|
|
924
|
-
declare const index_get: typeof get;
|
|
925
|
-
declare const index_handleZodError: typeof handleZodError;
|
|
926
|
-
declare const index_match: typeof match;
|
|
927
|
-
declare const index_parse: typeof parse;
|
|
928
|
-
declare const index_safeParse: typeof safeParse;
|
|
929
|
-
declare const index_serve: typeof serve;
|
|
930
|
-
declare const index_success: typeof success;
|
|
931
|
-
declare const index_toResponse: typeof toResponse;
|
|
932
|
-
declare namespace index {
|
|
933
|
-
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_OfferResponse as OfferResponse, index_OpenApi as OpenApi, type index_RouterApiClientConfig as RouterApiClientConfig, index_ValidationError as ValidationError, connect$1 as connect, index_error as error, index_fromResponse as fromResponse, index_get as get, index_handleZodError as handleZodError, index_match as match, index_parse as parse, index_safeParse as safeParse, index_serve as serve, index_success as success, index_toResponse as toResponse };
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
type Cursor = {
|
|
937
|
-
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
938
|
-
dir: "asc" | "desc";
|
|
939
|
-
rate?: string;
|
|
940
|
-
maturity?: number;
|
|
941
|
-
expiry?: number;
|
|
942
|
-
assets?: string;
|
|
943
|
-
hash: string;
|
|
944
|
-
};
|
|
945
|
-
declare function validate(cursor: unknown): cursor is Cursor;
|
|
946
|
-
declare function encode(c: Cursor): string;
|
|
947
|
-
declare function decode(token?: string): Cursor | null;
|
|
948
|
-
|
|
949
|
-
type Cursor$1_Cursor = Cursor;
|
|
950
|
-
declare const Cursor$1_decode: typeof decode;
|
|
951
|
-
declare const Cursor$1_encode: typeof encode;
|
|
952
|
-
declare const Cursor$1_validate: typeof validate;
|
|
953
|
-
declare namespace Cursor$1 {
|
|
954
|
-
export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
declare const LogLevelValues: readonly ["trace", "debug", "info", "warn", "error", "fatal", "silent"];
|
|
958
|
-
type LogLevel = (typeof LogLevelValues)[number];
|
|
959
|
-
type LogEntry = Compute<{
|
|
960
|
-
msg: string;
|
|
961
|
-
} & Record<string, unknown>>;
|
|
962
|
-
type LogFn = (entry: LogEntry) => void;
|
|
963
|
-
type Logger = {
|
|
964
|
-
trace: LogFn;
|
|
965
|
-
debug: LogFn;
|
|
966
|
-
info: LogFn;
|
|
967
|
-
warn: LogFn;
|
|
968
|
-
error: LogFn;
|
|
969
|
-
fatal: LogFn;
|
|
970
|
-
};
|
|
971
|
-
declare function defaultLogger(minLevel?: LogLevel): Logger;
|
|
972
|
-
declare function silentLogger(): Logger;
|
|
973
|
-
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
974
|
-
declare function getLogger(): Logger;
|
|
975
|
-
|
|
976
|
-
type Logger$1_LogEntry = LogEntry;
|
|
977
|
-
type Logger$1_LogFn = LogFn;
|
|
978
|
-
type Logger$1_LogLevel = LogLevel;
|
|
979
|
-
declare const Logger$1_LogLevelValues: typeof LogLevelValues;
|
|
980
|
-
type Logger$1_Logger = Logger;
|
|
981
|
-
declare const Logger$1_defaultLogger: typeof defaultLogger;
|
|
982
|
-
declare const Logger$1_getLogger: typeof getLogger;
|
|
983
|
-
declare const Logger$1_runWithLogger: typeof runWithLogger;
|
|
984
|
-
declare const Logger$1_silentLogger: typeof silentLogger;
|
|
985
|
-
declare namespace Logger$1 {
|
|
986
|
-
export { type Logger$1_LogEntry as LogEntry, 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 };
|
|
1295
|
+
export { type OfferStore$1_FindMatchingOffersParams as FindMatchingOffersParams, type OfferStore$1_GetAllParams as GetAllParams, type OfferStore$1_GetOffersFilters as GetOffersFilters, type OfferStore$1_OfferStore as OfferStore, type OfferStore$1_PgConfig as PgConfig, create$3 as create };
|
|
987
1296
|
}
|
|
988
1297
|
|
|
989
|
-
type
|
|
990
|
-
chain: Chain
|
|
1298
|
+
type ServicesConfig = {
|
|
1299
|
+
chain: Chain;
|
|
991
1300
|
rpcUrl: string;
|
|
992
1301
|
dbConfig: {
|
|
993
1302
|
type: "pg" | "pglite";
|
|
994
1303
|
endpoint?: string;
|
|
995
1304
|
};
|
|
1305
|
+
collectorConfig?: {
|
|
1306
|
+
interval?: number;
|
|
1307
|
+
maxBatchSize?: number;
|
|
1308
|
+
maxBlockNumber?: number;
|
|
1309
|
+
};
|
|
996
1310
|
};
|
|
997
1311
|
type Services = {
|
|
1312
|
+
indexer: Indexer;
|
|
998
1313
|
offerStore: OfferStore;
|
|
999
|
-
|
|
1314
|
+
collectorStore: CollectorStore;
|
|
1000
1315
|
liquidityStore: LiquidityStore;
|
|
1316
|
+
chainStore: ChainStore;
|
|
1317
|
+
healthService: HealthService;
|
|
1001
1318
|
mempoolOffersCollector: Collector<"mempool_offers">;
|
|
1002
1319
|
consumedEventsCollector: Collector<"consumed_events">;
|
|
1003
1320
|
buyWithEmptyCallbackLiquidityCollector: Collector<"buy_with_empty_callback_liquidity">;
|
|
1321
|
+
buyVaultV1CallbackLiquidityCollector: Collector<"buy_vault_v1_callback_liquidity">;
|
|
1322
|
+
sellERC20CallbackLiquidityCollector: Collector<"sell_erc20_callback_liquidity">;
|
|
1004
1323
|
DB: PG;
|
|
1324
|
+
routerApi: RouterApi;
|
|
1005
1325
|
};
|
|
1006
|
-
declare function from(config:
|
|
1326
|
+
declare function from$3(config: ServicesConfig): Services;
|
|
1327
|
+
type Stores = ReturnType<typeof createStores>;
|
|
1328
|
+
declare function createStores(db: PG): {
|
|
1329
|
+
collectorStore: CollectorStore;
|
|
1330
|
+
offerStore: OfferStore;
|
|
1331
|
+
liquidityStore: LiquidityStore;
|
|
1332
|
+
chainStore: ChainStore;
|
|
1333
|
+
};
|
|
1334
|
+
declare function createWithTransaction<T>(db: PG): (fn: (s: ReturnType<typeof createStores>) => Promise<T>) => Promise<T>;
|
|
1007
1335
|
|
|
1008
1336
|
type Services$1_Services = Services;
|
|
1009
|
-
type Services$
|
|
1010
|
-
|
|
1337
|
+
type Services$1_ServicesConfig = ServicesConfig;
|
|
1338
|
+
type Services$1_Stores = Stores;
|
|
1339
|
+
declare const Services$1_createStores: typeof createStores;
|
|
1340
|
+
declare const Services$1_createWithTransaction: typeof createWithTransaction;
|
|
1011
1341
|
declare namespace Services$1 {
|
|
1012
|
-
export { type Services$1_Services as Services, type Services$
|
|
1342
|
+
export { type Services$1_Services as Services, type Services$1_ServicesConfig as ServicesConfig, type Services$1_Stores as Stores, Services$1_createStores as createStores, Services$1_createWithTransaction as createWithTransaction, from$3 as from };
|
|
1013
1343
|
}
|
|
1014
1344
|
|
|
1345
|
+
declare const names: readonly ["mempool_offers", "consumed_events", "buy_with_empty_callback_liquidity", "buy_vault_v1_callback_liquidity", "sell_erc20_callback_liquidity"];
|
|
1346
|
+
type Name = (typeof names)[number];
|
|
1347
|
+
/** A general collector interface. */
|
|
1348
|
+
type Collector<name extends Name = Name, chain extends Chain = Chain> = {
|
|
1349
|
+
/** The name of the collector. */
|
|
1350
|
+
readonly name: name;
|
|
1351
|
+
/** The chain the collector is running on. */
|
|
1352
|
+
readonly chain: chain;
|
|
1353
|
+
/** Start collecting data from external sources.
|
|
1354
|
+
* @yields The last block number processed by the collector.
|
|
1355
|
+
*/
|
|
1356
|
+
collect: () => AsyncGenerator<number, void, void>;
|
|
1357
|
+
};
|
|
1358
|
+
/** A collector’s collect function signature */
|
|
1359
|
+
type CollectFn<chain extends Chain, collector extends Name> = (parameters: CollectParameters<chain, collector>) => Promise<number>;
|
|
1360
|
+
/** Core parameters every collector gets at runtime */
|
|
1361
|
+
type CollectParameters<chain extends Chain, collector extends Name> = {
|
|
1362
|
+
/** The chain the collector is running on. */
|
|
1363
|
+
chain: chain;
|
|
1364
|
+
/** A public viem client. */
|
|
1365
|
+
client: PublicClient;
|
|
1366
|
+
/** The collector name. */
|
|
1367
|
+
collector: collector;
|
|
1368
|
+
/** The epoch the collector is running on. */
|
|
1369
|
+
epoch: bigint;
|
|
1370
|
+
/** The last block number processed by the collector. */
|
|
1371
|
+
lastBlockNumber: number;
|
|
1372
|
+
/** A function to execute database operations in a transaction. */
|
|
1373
|
+
withTransaction: <T>(fn: (s: Stores) => Promise<T>) => Promise<T>;
|
|
1374
|
+
};
|
|
1375
|
+
declare function create$2<name extends Name, chain extends Chain>({ name, collect, client, chain, withTransaction, collectorStore, options, }: {
|
|
1376
|
+
name: name;
|
|
1377
|
+
collect: CollectFn<chain, name>;
|
|
1378
|
+
chain: chain;
|
|
1379
|
+
client: PublicClient;
|
|
1380
|
+
withTransaction: <T>(fn: (s: Stores) => Promise<T>) => Promise<T>;
|
|
1381
|
+
collectorStore: CollectorStore;
|
|
1382
|
+
options: {
|
|
1383
|
+
interval: number;
|
|
1384
|
+
maxBlockNumber?: number;
|
|
1385
|
+
};
|
|
1386
|
+
}): Collector<name, chain>;
|
|
1387
|
+
/** Start a collector.
|
|
1388
|
+
* @param collector - The collector to start.
|
|
1389
|
+
* @returns A function to stop the collector.
|
|
1390
|
+
*/
|
|
1391
|
+
declare function start(collector: Collector): () => void;
|
|
1392
|
+
|
|
1393
|
+
type Builder<chain extends Chain = Chain> = {
|
|
1394
|
+
buildMempoolCollector: (parameters: {
|
|
1395
|
+
options?: {
|
|
1396
|
+
maxBatchSize?: number;
|
|
1397
|
+
};
|
|
1398
|
+
}) => Collector<"mempool_offers", chain>;
|
|
1399
|
+
buildConsumedEventsCollector: (parameters?: {
|
|
1400
|
+
options?: {
|
|
1401
|
+
maxBatchSize?: number;
|
|
1402
|
+
};
|
|
1403
|
+
}) => Collector<"consumed_events", chain>;
|
|
1404
|
+
buildBuyWithEmptyCallbackLiquidityCollector: (parameters?: {
|
|
1405
|
+
options?: {
|
|
1406
|
+
maxBatchSize?: number;
|
|
1407
|
+
};
|
|
1408
|
+
}) => Collector<"buy_with_empty_callback_liquidity", chain>;
|
|
1409
|
+
buildSellERC20CallbackLiquidityCollector: (parameters?: {
|
|
1410
|
+
options?: {
|
|
1411
|
+
maxBatchSize?: number;
|
|
1412
|
+
};
|
|
1413
|
+
}) => Collector<"sell_erc20_callback_liquidity", chain>;
|
|
1414
|
+
buildBuyVaultV1CallbackLiquidityCollector: (parameters?: {
|
|
1415
|
+
options?: {
|
|
1416
|
+
maxBatchSize?: number;
|
|
1417
|
+
};
|
|
1418
|
+
}) => Collector<"buy_vault_v1_callback_liquidity", chain>;
|
|
1419
|
+
};
|
|
1420
|
+
declare function createBuilder<chain extends Chain = Chain>(parameters: {
|
|
1421
|
+
client: PublicClient;
|
|
1422
|
+
chain: chain;
|
|
1423
|
+
db: PG;
|
|
1424
|
+
options: {
|
|
1425
|
+
interval: number;
|
|
1426
|
+
maxBlockNumber?: number;
|
|
1427
|
+
};
|
|
1428
|
+
}): Builder<chain>;
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Fetches ERC20 token balances and allowances using multicall.
|
|
1432
|
+
* Returns liquidity pools and links.
|
|
1433
|
+
*
|
|
1434
|
+
* @param parameters - Configuration for the fetch operation including user-token pairs
|
|
1435
|
+
* @returns Promise resolving to pools and links arrays
|
|
1436
|
+
*/
|
|
1437
|
+
declare function fetchBalancesAndAllowances(parameters: {
|
|
1438
|
+
client: Pick<PublicActions, "multicall">;
|
|
1439
|
+
chainId: bigint;
|
|
1440
|
+
spender: Address;
|
|
1441
|
+
pairs: Array<{
|
|
1442
|
+
user: Address;
|
|
1443
|
+
token: Address;
|
|
1444
|
+
}>;
|
|
1445
|
+
options?: {
|
|
1446
|
+
batchSize?: number;
|
|
1447
|
+
retryAttempts?: number;
|
|
1448
|
+
retryDelayMs?: number;
|
|
1449
|
+
blockNumber?: number;
|
|
1450
|
+
};
|
|
1451
|
+
}): Promise<{
|
|
1452
|
+
pools: LiquidityPool[];
|
|
1453
|
+
links: LiquidityLink[];
|
|
1454
|
+
}>;
|
|
1455
|
+
|
|
1456
|
+
/**
|
|
1457
|
+
* Fetches existing collateral and debt data from Morpho protocol for user-term-collateral combinations.
|
|
1458
|
+
* Returns liquidity pools for obligation collateral and debt.
|
|
1459
|
+
*
|
|
1460
|
+
* @param parameters - Configuration for the fetch operation
|
|
1461
|
+
* @returns Promise resolving to pools array (no links for obligation collateral/debt pools)
|
|
1462
|
+
*/
|
|
1463
|
+
declare function fetchCollateralAndDebt(parameters: {
|
|
1464
|
+
client: Pick<PublicActions, "multicall">;
|
|
1465
|
+
chainId: bigint;
|
|
1466
|
+
morphoAddress: Address;
|
|
1467
|
+
queries: Array<{
|
|
1468
|
+
user: Address;
|
|
1469
|
+
obligationId: Hex;
|
|
1470
|
+
collateralAssets: Address[];
|
|
1471
|
+
}>;
|
|
1472
|
+
options?: {
|
|
1473
|
+
batchSize?: number;
|
|
1474
|
+
retryAttempts?: number;
|
|
1475
|
+
retryDelayMs?: number;
|
|
1476
|
+
blockNumber?: number;
|
|
1477
|
+
};
|
|
1478
|
+
}): Promise<{
|
|
1479
|
+
pools: LiquidityPool[];
|
|
1480
|
+
}>;
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* Fetches prices from multiple oracle contracts using multicall.
|
|
1484
|
+
*
|
|
1485
|
+
* @param parameters - Configuration for the fetch operation
|
|
1486
|
+
* @returns Promise resolving to a Map: oracle address -> price
|
|
1487
|
+
*/
|
|
1488
|
+
declare function fetchOraclePrices(parameters: {
|
|
1489
|
+
client: Pick<PublicActions, "multicall">;
|
|
1490
|
+
oracles: Address[];
|
|
1491
|
+
options?: {
|
|
1492
|
+
batchSize?: number;
|
|
1493
|
+
retryAttempts?: number;
|
|
1494
|
+
retryDelayMs?: number;
|
|
1495
|
+
blockNumber?: number;
|
|
1496
|
+
};
|
|
1497
|
+
}): Promise<Map<Address, bigint>>;
|
|
1498
|
+
|
|
1499
|
+
/**
|
|
1500
|
+
* Fetches user positions in MetaMorpho vaults, vault positions in Morpho Blue markets, and total market liquidity.
|
|
1501
|
+
* Returns liquidity pools for user vault positions, vault positions, and market liquidity, along with hierarchical links.
|
|
1502
|
+
*
|
|
1503
|
+
* @param parameters - Configuration for the fetch operation
|
|
1504
|
+
* @param parameters.chain - The chain configuration containing chainId and Morpho Blue address
|
|
1505
|
+
* @param parameters.userVaults - Array of user-vault pairs to query (markets are determined from vault's withdrawQueue)
|
|
1506
|
+
* @returns Promise resolving to pools and links arrays
|
|
1507
|
+
*/
|
|
1508
|
+
declare function fetchUserVaultMarketLiquidity(parameters: {
|
|
1509
|
+
client: Pick<PublicActions, "multicall">;
|
|
1510
|
+
chain: Chain;
|
|
1511
|
+
userVaults: Array<{
|
|
1512
|
+
user: Address;
|
|
1513
|
+
vault: Address;
|
|
1514
|
+
}>;
|
|
1515
|
+
options?: {
|
|
1516
|
+
batchSize?: number;
|
|
1517
|
+
retryAttempts?: number;
|
|
1518
|
+
retryDelayMs?: number;
|
|
1519
|
+
blockNumber?: number;
|
|
1520
|
+
};
|
|
1521
|
+
}): Promise<{
|
|
1522
|
+
pools: LiquidityPool[];
|
|
1523
|
+
links: LiquidityLink[];
|
|
1524
|
+
}>;
|
|
1525
|
+
|
|
1015
1526
|
/**
|
|
1016
1527
|
* A validation rule.
|
|
1017
1528
|
*/
|
|
@@ -1054,285 +1565,955 @@ declare function single<Name extends string, T, Ctx = void>(name: Name, run: Sin
|
|
|
1054
1565
|
* @param run - The function that validates the rule.
|
|
1055
1566
|
* @returns The created rule.
|
|
1056
1567
|
*/
|
|
1057
|
-
declare function batch<Name extends string, T, Ctx = void>(name: Name, run: Batch<T, Name, Ctx>): Rule<T, Name, Ctx>;
|
|
1568
|
+
declare function batch$1<Name extends string, T, Ctx = void>(name: Name, run: Batch<T, Name, Ctx>): Rule<T, Name, Ctx>;
|
|
1058
1569
|
type MorphoContext = {
|
|
1059
|
-
chain: Chain
|
|
1570
|
+
chain: Chain;
|
|
1571
|
+
client: PublicClient;
|
|
1060
1572
|
};
|
|
1061
|
-
declare function morpho(): (Rule<
|
|
1062
|
-
readonly offering: Address;
|
|
1063
|
-
readonly assets: bigint;
|
|
1064
|
-
readonly rate: bigint;
|
|
1065
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1066
|
-
readonly expiry: number;
|
|
1067
|
-
readonly nonce: bigint;
|
|
1068
|
-
readonly buy: boolean;
|
|
1069
|
-
readonly chainId: bigint;
|
|
1070
|
-
readonly loanToken: Address;
|
|
1071
|
-
readonly start: number;
|
|
1072
|
-
readonly collaterals: readonly {
|
|
1073
|
-
asset: Address;
|
|
1074
|
-
oracle: Address;
|
|
1075
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1076
|
-
}[];
|
|
1077
|
-
readonly callback: {
|
|
1078
|
-
readonly address: Address;
|
|
1079
|
-
readonly data: viem.Hex;
|
|
1080
|
-
readonly gasLimit: bigint;
|
|
1081
|
-
};
|
|
1082
|
-
readonly hash: viem.Hex;
|
|
1083
|
-
signature?: viem.Hex;
|
|
1084
|
-
createdAt?: number;
|
|
1085
|
-
}, "chain_id", MorphoContext> | Rule<{
|
|
1086
|
-
readonly offering: Address;
|
|
1087
|
-
readonly assets: bigint;
|
|
1088
|
-
readonly rate: bigint;
|
|
1089
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1090
|
-
readonly expiry: number;
|
|
1091
|
-
readonly nonce: bigint;
|
|
1092
|
-
readonly buy: boolean;
|
|
1093
|
-
readonly chainId: bigint;
|
|
1094
|
-
readonly loanToken: Address;
|
|
1095
|
-
readonly start: number;
|
|
1096
|
-
readonly collaterals: readonly {
|
|
1097
|
-
asset: Address;
|
|
1098
|
-
oracle: Address;
|
|
1099
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1100
|
-
}[];
|
|
1101
|
-
readonly callback: {
|
|
1102
|
-
readonly address: Address;
|
|
1103
|
-
readonly data: viem.Hex;
|
|
1104
|
-
readonly gasLimit: bigint;
|
|
1105
|
-
};
|
|
1106
|
-
readonly hash: viem.Hex;
|
|
1107
|
-
signature?: viem.Hex;
|
|
1108
|
-
createdAt?: number;
|
|
1109
|
-
}, "loan_token", MorphoContext> | Rule<{
|
|
1110
|
-
readonly offering: Address;
|
|
1111
|
-
readonly assets: bigint;
|
|
1112
|
-
readonly rate: bigint;
|
|
1113
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1114
|
-
readonly expiry: number;
|
|
1115
|
-
readonly nonce: bigint;
|
|
1116
|
-
readonly buy: boolean;
|
|
1117
|
-
readonly chainId: bigint;
|
|
1118
|
-
readonly loanToken: Address;
|
|
1119
|
-
readonly start: number;
|
|
1120
|
-
readonly collaterals: readonly {
|
|
1121
|
-
asset: Address;
|
|
1122
|
-
oracle: Address;
|
|
1123
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1124
|
-
}[];
|
|
1125
|
-
readonly callback: {
|
|
1126
|
-
readonly address: Address;
|
|
1127
|
-
readonly data: viem.Hex;
|
|
1128
|
-
readonly gasLimit: bigint;
|
|
1129
|
-
};
|
|
1130
|
-
readonly hash: viem.Hex;
|
|
1131
|
-
signature?: viem.Hex;
|
|
1132
|
-
createdAt?: number;
|
|
1133
|
-
}, "expiry", MorphoContext> | Rule<{
|
|
1134
|
-
readonly offering: Address;
|
|
1135
|
-
readonly assets: bigint;
|
|
1136
|
-
readonly rate: bigint;
|
|
1137
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1138
|
-
readonly expiry: number;
|
|
1139
|
-
readonly nonce: bigint;
|
|
1140
|
-
readonly buy: boolean;
|
|
1141
|
-
readonly chainId: bigint;
|
|
1142
|
-
readonly loanToken: Address;
|
|
1143
|
-
readonly start: number;
|
|
1144
|
-
readonly collaterals: readonly {
|
|
1145
|
-
asset: Address;
|
|
1146
|
-
oracle: Address;
|
|
1147
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1148
|
-
}[];
|
|
1149
|
-
readonly callback: {
|
|
1150
|
-
readonly address: Address;
|
|
1151
|
-
readonly data: viem.Hex;
|
|
1152
|
-
readonly gasLimit: bigint;
|
|
1153
|
-
};
|
|
1154
|
-
readonly hash: viem.Hex;
|
|
1155
|
-
signature?: viem.Hex;
|
|
1156
|
-
createdAt?: number;
|
|
1157
|
-
}, "sell_offers_empty_callback", MorphoContext> | Rule<{
|
|
1158
|
-
readonly offering: Address;
|
|
1159
|
-
readonly assets: bigint;
|
|
1160
|
-
readonly rate: bigint;
|
|
1161
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1162
|
-
readonly expiry: number;
|
|
1163
|
-
readonly nonce: bigint;
|
|
1164
|
-
readonly buy: boolean;
|
|
1165
|
-
readonly chainId: bigint;
|
|
1166
|
-
readonly loanToken: Address;
|
|
1167
|
-
readonly start: number;
|
|
1168
|
-
readonly collaterals: readonly {
|
|
1169
|
-
asset: Address;
|
|
1170
|
-
oracle: Address;
|
|
1171
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1172
|
-
}[];
|
|
1173
|
-
readonly callback: {
|
|
1174
|
-
readonly address: Address;
|
|
1175
|
-
readonly data: viem.Hex;
|
|
1176
|
-
readonly gasLimit: bigint;
|
|
1177
|
-
};
|
|
1178
|
-
readonly hash: viem.Hex;
|
|
1179
|
-
signature?: viem.Hex;
|
|
1180
|
-
createdAt?: number;
|
|
1181
|
-
}, "buy_offers_non_empty_callback", MorphoContext> | Rule<{
|
|
1182
|
-
readonly offering: Address;
|
|
1183
|
-
readonly assets: bigint;
|
|
1184
|
-
readonly rate: bigint;
|
|
1185
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1186
|
-
readonly expiry: number;
|
|
1187
|
-
readonly nonce: bigint;
|
|
1188
|
-
readonly buy: boolean;
|
|
1189
|
-
readonly chainId: bigint;
|
|
1190
|
-
readonly loanToken: Address;
|
|
1191
|
-
readonly start: number;
|
|
1192
|
-
readonly collaterals: readonly {
|
|
1193
|
-
asset: Address;
|
|
1194
|
-
oracle: Address;
|
|
1195
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1196
|
-
}[];
|
|
1197
|
-
readonly callback: {
|
|
1198
|
-
readonly address: Address;
|
|
1199
|
-
readonly data: viem.Hex;
|
|
1200
|
-
readonly gasLimit: bigint;
|
|
1201
|
-
};
|
|
1202
|
-
readonly hash: viem.Hex;
|
|
1203
|
-
signature?: viem.Hex;
|
|
1204
|
-
createdAt?: number;
|
|
1205
|
-
}, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<{
|
|
1206
|
-
readonly offering: Address;
|
|
1207
|
-
readonly assets: bigint;
|
|
1208
|
-
readonly rate: bigint;
|
|
1209
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1210
|
-
readonly expiry: number;
|
|
1211
|
-
readonly nonce: bigint;
|
|
1212
|
-
readonly buy: boolean;
|
|
1213
|
-
readonly chainId: bigint;
|
|
1214
|
-
readonly loanToken: Address;
|
|
1215
|
-
readonly start: number;
|
|
1216
|
-
readonly collaterals: readonly {
|
|
1217
|
-
asset: Address;
|
|
1218
|
-
oracle: Address;
|
|
1219
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1220
|
-
}[];
|
|
1221
|
-
readonly callback: {
|
|
1222
|
-
readonly address: Address;
|
|
1223
|
-
readonly data: viem.Hex;
|
|
1224
|
-
readonly gasLimit: bigint;
|
|
1225
|
-
};
|
|
1226
|
-
readonly hash: viem.Hex;
|
|
1227
|
-
signature?: viem.Hex;
|
|
1228
|
-
createdAt?: number;
|
|
1229
|
-
}, "sell_offers_callback_data_invalid", MorphoContext> | Rule<{
|
|
1230
|
-
readonly offering: Address;
|
|
1231
|
-
readonly assets: bigint;
|
|
1232
|
-
readonly rate: bigint;
|
|
1233
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1234
|
-
readonly expiry: number;
|
|
1235
|
-
readonly nonce: bigint;
|
|
1236
|
-
readonly buy: boolean;
|
|
1237
|
-
readonly chainId: bigint;
|
|
1238
|
-
readonly loanToken: Address;
|
|
1239
|
-
readonly start: number;
|
|
1240
|
-
readonly collaterals: readonly {
|
|
1241
|
-
asset: Address;
|
|
1242
|
-
oracle: Address;
|
|
1243
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1244
|
-
}[];
|
|
1245
|
-
readonly callback: {
|
|
1246
|
-
readonly address: Address;
|
|
1247
|
-
readonly data: viem.Hex;
|
|
1248
|
-
readonly gasLimit: bigint;
|
|
1249
|
-
};
|
|
1250
|
-
readonly hash: viem.Hex;
|
|
1251
|
-
signature?: viem.Hex;
|
|
1252
|
-
createdAt?: number;
|
|
1253
|
-
}, "sell_offers_callback_collateral_invalid", MorphoContext> | Rule<{
|
|
1254
|
-
readonly offering: Address;
|
|
1255
|
-
readonly assets: bigint;
|
|
1256
|
-
readonly rate: bigint;
|
|
1257
|
-
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
1258
|
-
readonly expiry: number;
|
|
1259
|
-
readonly nonce: bigint;
|
|
1260
|
-
readonly buy: boolean;
|
|
1261
|
-
readonly chainId: bigint;
|
|
1262
|
-
readonly loanToken: Address;
|
|
1263
|
-
readonly start: number;
|
|
1264
|
-
readonly collaterals: readonly {
|
|
1265
|
-
asset: Address;
|
|
1266
|
-
oracle: Address;
|
|
1267
|
-
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
1268
|
-
}[];
|
|
1269
|
-
readonly callback: {
|
|
1270
|
-
readonly address: Address;
|
|
1271
|
-
readonly data: viem.Hex;
|
|
1272
|
-
readonly gasLimit: bigint;
|
|
1273
|
-
};
|
|
1274
|
-
readonly hash: viem.Hex;
|
|
1275
|
-
signature?: viem.Hex;
|
|
1276
|
-
createdAt?: number;
|
|
1277
|
-
}, "maturity", MorphoContext>)[];
|
|
1573
|
+
declare function morpho(): (Rule<Offer, "chain_id", MorphoContext> | Rule<Offer, "loan_token", MorphoContext> | Rule<Offer, "expiry", MorphoContext> | Rule<Offer, "sell_offers_empty_callback", MorphoContext> | Rule<Offer, "buy_offers_non_empty_callback", MorphoContext> | Rule<Offer, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<Offer, "sell_offers_callback_data_invalid", MorphoContext> | Rule<Offer, "sell_offers_callback_collateral_invalid", MorphoContext> | Rule<Offer, "buy_offers_callback_data_invalid", MorphoContext> | Rule<Offer, "buy_offers_callback_vault_invalid", MorphoContext> | Rule<Offer, "maturity", MorphoContext>)[];
|
|
1278
1574
|
|
|
1279
1575
|
type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
|
|
1280
1576
|
type ValidationRule_MorphoContext = MorphoContext;
|
|
1281
1577
|
type ValidationRule_Rule<T, Name extends string = string, Ctx = void> = Rule<T, Name, Ctx>;
|
|
1282
1578
|
type ValidationRule_RuleNames<Rules extends readonly {
|
|
1283
1579
|
name: string;
|
|
1284
|
-
}[]> = RuleNames<Rules>;
|
|
1285
|
-
type ValidationRule_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
|
|
1286
|
-
declare const
|
|
1287
|
-
declare const
|
|
1288
|
-
declare
|
|
1289
|
-
|
|
1290
|
-
|
|
1580
|
+
}[]> = RuleNames<Rules>;
|
|
1581
|
+
type ValidationRule_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
|
|
1582
|
+
declare const ValidationRule_morpho: typeof morpho;
|
|
1583
|
+
declare const ValidationRule_single: typeof single;
|
|
1584
|
+
declare namespace ValidationRule {
|
|
1585
|
+
export { type ValidationRule_Batch as Batch, type ValidationRule_MorphoContext as MorphoContext, type ValidationRule_Rule as Rule, type ValidationRule_RuleNames as RuleNames, type ValidationRule_Single as Single, batch$1 as batch, ValidationRule_morpho as morpho, ValidationRule_single as single };
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* A validation issue.
|
|
1590
|
+
*/
|
|
1591
|
+
type Issue<T, RuleName extends string = string> = {
|
|
1592
|
+
/** The name of the rule that caused the issue. */
|
|
1593
|
+
ruleName: RuleName;
|
|
1594
|
+
/** The message of the issue. */
|
|
1595
|
+
message: string;
|
|
1596
|
+
/** The item that was not valid. */
|
|
1597
|
+
item: T;
|
|
1598
|
+
};
|
|
1599
|
+
/**
|
|
1600
|
+
* The result of a validation.
|
|
1601
|
+
*/
|
|
1602
|
+
type Result<T, RuleName extends string = string> = {
|
|
1603
|
+
/** The items that were valid. */
|
|
1604
|
+
valid: T[];
|
|
1605
|
+
/** The reports of the failed validations. */
|
|
1606
|
+
issues: Issue<T, RuleName>[];
|
|
1607
|
+
};
|
|
1608
|
+
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name, void>[]>(parameters: {
|
|
1609
|
+
items: T[];
|
|
1610
|
+
rules: Rules;
|
|
1611
|
+
chunkSize?: number;
|
|
1612
|
+
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
1613
|
+
declare function run<T, Ctx, Name extends string, Rules extends readonly Rule<T, Name, Ctx>[]>(parameters: {
|
|
1614
|
+
items: T[];
|
|
1615
|
+
rules: Rules;
|
|
1616
|
+
ctx: Ctx;
|
|
1617
|
+
chunkSize?: number;
|
|
1618
|
+
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
1619
|
+
|
|
1620
|
+
type Validation_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
|
|
1621
|
+
type Validation_Result<T, RuleName extends string = string> = Result<T, RuleName>;
|
|
1622
|
+
declare const Validation_run: typeof run;
|
|
1623
|
+
declare namespace Validation {
|
|
1624
|
+
export { type Validation_Issue as Issue, type Validation_Result as Result, Validation_run as run };
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
type index$4_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
|
|
1628
|
+
type index$4_Builder<chain extends Chain = Chain> = Builder<chain>;
|
|
1629
|
+
type index$4_CollectFn<chain extends Chain, collector extends Name> = CollectFn<chain, collector>;
|
|
1630
|
+
type index$4_CollectParameters<chain extends Chain, collector extends Name> = CollectParameters<chain, collector>;
|
|
1631
|
+
type index$4_Collector<name extends Name = Name, chain extends Chain = Chain> = Collector<name, chain>;
|
|
1632
|
+
type index$4_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
|
|
1633
|
+
type index$4_MorphoContext = MorphoContext;
|
|
1634
|
+
type index$4_Name = Name;
|
|
1635
|
+
type index$4_Result<T, RuleName extends string = string> = Result<T, RuleName>;
|
|
1636
|
+
type index$4_Rule<T, Name extends string = string, Ctx = void> = Rule<T, Name, Ctx>;
|
|
1637
|
+
type index$4_RuleNames<Rules extends readonly {
|
|
1638
|
+
name: string;
|
|
1639
|
+
}[]> = RuleNames<Rules>;
|
|
1640
|
+
type index$4_Single<T, RuleName extends string, Ctx = void> = Single<T, RuleName, Ctx>;
|
|
1641
|
+
declare const index$4_createBuilder: typeof createBuilder;
|
|
1642
|
+
declare const index$4_fetchBalancesAndAllowances: typeof fetchBalancesAndAllowances;
|
|
1643
|
+
declare const index$4_fetchCollateralAndDebt: typeof fetchCollateralAndDebt;
|
|
1644
|
+
declare const index$4_fetchOraclePrices: typeof fetchOraclePrices;
|
|
1645
|
+
declare const index$4_fetchUserVaultMarketLiquidity: typeof fetchUserVaultMarketLiquidity;
|
|
1646
|
+
declare const index$4_morpho: typeof morpho;
|
|
1647
|
+
declare const index$4_names: typeof names;
|
|
1648
|
+
declare const index$4_run: typeof run;
|
|
1649
|
+
declare const index$4_single: typeof single;
|
|
1650
|
+
declare const index$4_start: typeof start;
|
|
1651
|
+
declare namespace index$4 {
|
|
1652
|
+
export { type index$4_Batch as Batch, type index$4_Builder as Builder, type index$4_CollectFn as CollectFn, type index$4_CollectParameters as CollectParameters, type index$4_Collector as Collector, type index$4_Issue as Issue, type index$4_MorphoContext as MorphoContext, type index$4_Name as Name, type index$4_Result as Result, type index$4_Rule as Rule, type index$4_RuleNames as RuleNames, type index$4_Single as Single, batch$1 as batch, create$2 as create, index$4_createBuilder as createBuilder, index$4_fetchBalancesAndAllowances as fetchBalancesAndAllowances, index$4_fetchCollateralAndDebt as fetchCollateralAndDebt, index$4_fetchOraclePrices as fetchOraclePrices, index$4_fetchUserVaultMarketLiquidity as fetchUserVaultMarketLiquidity, index$4_morpho as morpho, index$4_names as names, index$4_run as run, index$4_single as single, index$4_start as start };
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
type CollectorHealthStatus = "live" | "lagging" | "unknown";
|
|
1656
|
+
type RouterStatus = "live" | "syncing";
|
|
1657
|
+
type CollectorHealth$1 = {
|
|
1658
|
+
name: Name;
|
|
1659
|
+
chainId: Id;
|
|
1660
|
+
blockNumber: number | null;
|
|
1661
|
+
updatedAt: string | null;
|
|
1662
|
+
lag: number | null;
|
|
1663
|
+
status: CollectorHealthStatus;
|
|
1664
|
+
};
|
|
1665
|
+
type ChainHealth$1 = {
|
|
1666
|
+
chainId: Id;
|
|
1667
|
+
blockNumber: number;
|
|
1668
|
+
epoch: string;
|
|
1669
|
+
updatedAt: string;
|
|
1670
|
+
};
|
|
1671
|
+
type HealthService = {
|
|
1672
|
+
getStatus: () => Promise<RouterStatus>;
|
|
1673
|
+
getCollectors: () => Promise<CollectorHealth$1[]>;
|
|
1674
|
+
getChains: () => Promise<ChainHealth$1[]>;
|
|
1675
|
+
};
|
|
1676
|
+
type HealthServiceParameters = {
|
|
1677
|
+
collectorStore: CollectorStore;
|
|
1678
|
+
chainStore: ChainStore;
|
|
1679
|
+
/** Maximum number of blocks a collector can lag behind its chain before being considered lagging. */
|
|
1680
|
+
maxAllowedLag?: number;
|
|
1681
|
+
};
|
|
1682
|
+
/**
|
|
1683
|
+
* Create a health service that exposes collector and chain block numbers.
|
|
1684
|
+
*/
|
|
1685
|
+
declare function create$1(parameters: HealthServiceParameters): HealthService;
|
|
1686
|
+
|
|
1687
|
+
type Health_CollectorHealthStatus = CollectorHealthStatus;
|
|
1688
|
+
type Health_HealthService = HealthService;
|
|
1689
|
+
type Health_HealthServiceParameters = HealthServiceParameters;
|
|
1690
|
+
type Health_RouterStatus = RouterStatus;
|
|
1691
|
+
declare namespace Health {
|
|
1692
|
+
export { type ChainHealth$1 as ChainHealth, type CollectorHealth$1 as CollectorHealth, type Health_CollectorHealthStatus as CollectorHealthStatus, type Health_HealthService as HealthService, type Health_HealthServiceParameters as HealthServiceParameters, type Health_RouterStatus as RouterStatus, create$1 as create };
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
type RouterApiConfig = {
|
|
1696
|
+
store: OfferStore;
|
|
1697
|
+
healthService: HealthService;
|
|
1698
|
+
};
|
|
1699
|
+
type RouterApi = {
|
|
1700
|
+
serve: (parameters: {
|
|
1701
|
+
port: number;
|
|
1702
|
+
}) => void;
|
|
1703
|
+
};
|
|
1704
|
+
declare function create(config: RouterApiConfig): RouterApi;
|
|
1705
|
+
|
|
1706
|
+
declare const LogLevelValues: readonly ["trace", "debug", "info", "warn", "error", "fatal", "silent"];
|
|
1707
|
+
type LogLevel = (typeof LogLevelValues)[number];
|
|
1708
|
+
type LogEntry = Compute<{
|
|
1709
|
+
msg: string;
|
|
1710
|
+
} & Record<string, unknown>>;
|
|
1711
|
+
type LogFn = (entry: LogEntry) => void;
|
|
1712
|
+
type Logger = {
|
|
1713
|
+
trace: LogFn;
|
|
1714
|
+
debug: LogFn;
|
|
1715
|
+
info: LogFn;
|
|
1716
|
+
warn: LogFn;
|
|
1717
|
+
error: LogFn;
|
|
1718
|
+
fatal: LogFn;
|
|
1719
|
+
};
|
|
1720
|
+
declare function defaultLogger(minLevel?: LogLevel, pretty?: boolean): Logger;
|
|
1721
|
+
declare function silentLogger(): Logger;
|
|
1722
|
+
declare function runWithLogger<T>(logger: Logger, fn: () => Promise<T>): Promise<T>;
|
|
1723
|
+
declare function getLogger(): Logger;
|
|
1724
|
+
|
|
1725
|
+
type Logger$1_LogEntry = LogEntry;
|
|
1726
|
+
type Logger$1_LogFn = LogFn;
|
|
1727
|
+
type Logger$1_LogLevel = LogLevel;
|
|
1728
|
+
declare const Logger$1_LogLevelValues: typeof LogLevelValues;
|
|
1729
|
+
type Logger$1_Logger = Logger;
|
|
1730
|
+
declare const Logger$1_defaultLogger: typeof defaultLogger;
|
|
1731
|
+
declare const Logger$1_getLogger: typeof getLogger;
|
|
1732
|
+
declare const Logger$1_runWithLogger: typeof runWithLogger;
|
|
1733
|
+
declare const Logger$1_silentLogger: typeof silentLogger;
|
|
1734
|
+
declare namespace Logger$1 {
|
|
1735
|
+
export { type Logger$1_LogEntry as LogEntry, 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 };
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
declare enum STATUS_CODE {
|
|
1739
|
+
SUCCESS = 200,
|
|
1740
|
+
BAD_REQUEST = 400,
|
|
1741
|
+
NOT_FOUND = 404,
|
|
1742
|
+
INTERNAL_SERVER_ERROR = 500
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
declare function getHealth(healthService: HealthService): Promise<{
|
|
1746
|
+
statusCode: STATUS_CODE;
|
|
1747
|
+
body: {
|
|
1748
|
+
status: "success" | "error";
|
|
1749
|
+
meta: {
|
|
1750
|
+
timestamp: string;
|
|
1751
|
+
};
|
|
1752
|
+
} & ({
|
|
1753
|
+
error: {
|
|
1754
|
+
code: string;
|
|
1755
|
+
message: string;
|
|
1756
|
+
details?: unknown;
|
|
1757
|
+
};
|
|
1758
|
+
} | {
|
|
1759
|
+
cursor?: string | null;
|
|
1760
|
+
data: unknown;
|
|
1761
|
+
});
|
|
1762
|
+
}>;
|
|
1763
|
+
declare function getHealthChains(healthService: HealthService): Promise<{
|
|
1764
|
+
statusCode: STATUS_CODE;
|
|
1765
|
+
body: {
|
|
1766
|
+
status: "success" | "error";
|
|
1767
|
+
meta: {
|
|
1768
|
+
timestamp: string;
|
|
1769
|
+
};
|
|
1770
|
+
} & ({
|
|
1771
|
+
error: {
|
|
1772
|
+
code: string;
|
|
1773
|
+
message: string;
|
|
1774
|
+
details?: unknown;
|
|
1775
|
+
};
|
|
1776
|
+
} | {
|
|
1777
|
+
cursor?: string | null;
|
|
1778
|
+
data: unknown;
|
|
1779
|
+
});
|
|
1780
|
+
}>;
|
|
1781
|
+
declare function getHealthCollectors(healthService: HealthService): Promise<{
|
|
1782
|
+
statusCode: STATUS_CODE;
|
|
1783
|
+
body: {
|
|
1784
|
+
status: "success" | "error";
|
|
1785
|
+
meta: {
|
|
1786
|
+
timestamp: string;
|
|
1787
|
+
};
|
|
1788
|
+
} & ({
|
|
1789
|
+
error: {
|
|
1790
|
+
code: string;
|
|
1791
|
+
message: string;
|
|
1792
|
+
details?: unknown;
|
|
1793
|
+
};
|
|
1794
|
+
} | {
|
|
1795
|
+
cursor?: string | null;
|
|
1796
|
+
data: unknown;
|
|
1797
|
+
});
|
|
1798
|
+
}>;
|
|
1799
|
+
|
|
1800
|
+
declare function getObligations$1(queryParameters: object, store: OfferStore): Promise<{
|
|
1801
|
+
statusCode: STATUS_CODE;
|
|
1802
|
+
body: {
|
|
1803
|
+
status: "success" | "error";
|
|
1804
|
+
meta: {
|
|
1805
|
+
timestamp: string;
|
|
1806
|
+
};
|
|
1807
|
+
} & ({
|
|
1808
|
+
error: {
|
|
1809
|
+
code: string;
|
|
1810
|
+
message: string;
|
|
1811
|
+
details?: unknown;
|
|
1812
|
+
};
|
|
1813
|
+
} | {
|
|
1814
|
+
cursor?: string | null;
|
|
1815
|
+
data: unknown;
|
|
1816
|
+
});
|
|
1817
|
+
}>;
|
|
1818
|
+
|
|
1819
|
+
declare function getOffers$1(queryParameters: object, store: OfferStore): Promise<{
|
|
1820
|
+
statusCode: STATUS_CODE;
|
|
1821
|
+
body: {
|
|
1822
|
+
status: "success" | "error";
|
|
1823
|
+
meta: {
|
|
1824
|
+
timestamp: string;
|
|
1825
|
+
};
|
|
1826
|
+
} & ({
|
|
1827
|
+
error: {
|
|
1828
|
+
code: string;
|
|
1829
|
+
message: string;
|
|
1830
|
+
details?: unknown;
|
|
1831
|
+
};
|
|
1832
|
+
} | {
|
|
1833
|
+
cursor?: string | null;
|
|
1834
|
+
data: unknown;
|
|
1835
|
+
});
|
|
1836
|
+
}>;
|
|
1837
|
+
|
|
1838
|
+
declare const index$3_getHealth: typeof getHealth;
|
|
1839
|
+
declare const index$3_getHealthChains: typeof getHealthChains;
|
|
1840
|
+
declare const index$3_getHealthCollectors: typeof getHealthCollectors;
|
|
1841
|
+
declare namespace index$3 {
|
|
1842
|
+
export { index$3_getHealth as getHealth, index$3_getHealthChains as getHealthChains, index$3_getHealthCollectors as getHealthCollectors, getObligations$1 as getObligations, getOffers$1 as getOffers };
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
declare const CollectorHealth: z$1.ZodObject<{
|
|
1846
|
+
name: z$1.ZodString;
|
|
1847
|
+
chain_id: z$1.ZodNumber;
|
|
1848
|
+
block_number: z$1.ZodNullable<z$1.ZodNumber>;
|
|
1849
|
+
updated_at: z$1.ZodNullable<z$1.ZodString>;
|
|
1850
|
+
lag: z$1.ZodNullable<z$1.ZodNumber>;
|
|
1851
|
+
status: z$1.ZodEnum<{
|
|
1852
|
+
unknown: "unknown";
|
|
1853
|
+
live: "live";
|
|
1854
|
+
lagging: "lagging";
|
|
1855
|
+
}>;
|
|
1856
|
+
}, z$1.core.$strip>;
|
|
1857
|
+
declare const ChainHealth: z$1.ZodObject<{
|
|
1858
|
+
chain_id: z$1.ZodNumber;
|
|
1859
|
+
block_number: z$1.ZodNumber;
|
|
1860
|
+
updated_at: z$1.ZodString;
|
|
1861
|
+
}, z$1.core.$strip>;
|
|
1862
|
+
declare const CollectorsHealthResponse: z$1.ZodObject<{
|
|
1863
|
+
collectors: z$1.ZodArray<z$1.ZodObject<{
|
|
1864
|
+
name: z$1.ZodString;
|
|
1865
|
+
chain_id: z$1.ZodNumber;
|
|
1866
|
+
block_number: z$1.ZodNullable<z$1.ZodNumber>;
|
|
1867
|
+
updated_at: z$1.ZodNullable<z$1.ZodString>;
|
|
1868
|
+
lag: z$1.ZodNullable<z$1.ZodNumber>;
|
|
1869
|
+
status: z$1.ZodEnum<{
|
|
1870
|
+
unknown: "unknown";
|
|
1871
|
+
live: "live";
|
|
1872
|
+
lagging: "lagging";
|
|
1873
|
+
}>;
|
|
1874
|
+
}, z$1.core.$strip>>;
|
|
1875
|
+
}, z$1.core.$strip>;
|
|
1876
|
+
type CollectorsHealthResponse = z$1.infer<typeof CollectorsHealthResponse>;
|
|
1877
|
+
declare const ChainsHealthResponse: z$1.ZodObject<{
|
|
1878
|
+
chains: z$1.ZodArray<z$1.ZodObject<{
|
|
1879
|
+
chain_id: z$1.ZodNumber;
|
|
1880
|
+
block_number: z$1.ZodNumber;
|
|
1881
|
+
updated_at: z$1.ZodString;
|
|
1882
|
+
}, z$1.core.$strip>>;
|
|
1883
|
+
}, z$1.core.$strip>;
|
|
1884
|
+
type ChainsHealthResponse = z$1.infer<typeof ChainsHealthResponse>;
|
|
1885
|
+
declare const RouterStatusResponse: z$1.ZodObject<{
|
|
1886
|
+
status: z$1.ZodEnum<{
|
|
1887
|
+
live: "live";
|
|
1888
|
+
syncing: "syncing";
|
|
1889
|
+
}>;
|
|
1890
|
+
}, z$1.core.$strip>;
|
|
1891
|
+
type RouterStatusResponse = z$1.infer<typeof RouterStatusResponse>;
|
|
1892
|
+
|
|
1893
|
+
type ObligationResponse = Snake<Compute<{
|
|
1894
|
+
/** The obligation id. */
|
|
1895
|
+
id: Hex;
|
|
1896
|
+
} & Obligation>>;
|
|
1897
|
+
/**
|
|
1898
|
+
* Creates an `ObligationResponse` from a `Obligation`.
|
|
1899
|
+
* @constructor
|
|
1900
|
+
* @param obligation - {@link Obligation}
|
|
1901
|
+
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
1902
|
+
*/
|
|
1903
|
+
declare function from$2(obligation: Obligation): ObligationResponse;
|
|
1904
|
+
|
|
1905
|
+
type ObligationResponse$1_ObligationResponse = ObligationResponse;
|
|
1906
|
+
declare namespace ObligationResponse$1 {
|
|
1907
|
+
export { type ObligationResponse$1_ObligationResponse as ObligationResponse, from$2 as from };
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
type OfferResponse = Snake<Offer>;
|
|
1911
|
+
/**
|
|
1912
|
+
* Creates an `OfferResponse` from an `Offer`.
|
|
1913
|
+
* @constructor
|
|
1914
|
+
* @param offer - {@link Offer}
|
|
1915
|
+
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
1916
|
+
*/
|
|
1917
|
+
declare function from$1(offer: Offer): OfferResponse;
|
|
1918
|
+
|
|
1919
|
+
type OfferResponse$1_OfferResponse = OfferResponse;
|
|
1920
|
+
declare namespace OfferResponse$1 {
|
|
1921
|
+
export { type OfferResponse$1_OfferResponse as OfferResponse, from$1 as from };
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
1925
|
+
|
|
1926
|
+
declare const schemas: {
|
|
1927
|
+
readonly get_offers: z.ZodObject<{
|
|
1928
|
+
side: z.ZodEnum<{
|
|
1929
|
+
buy: "buy";
|
|
1930
|
+
sell: "sell";
|
|
1931
|
+
}>;
|
|
1932
|
+
obligation_id: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1933
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
1934
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
1935
|
+
}, z.core.$strip>;
|
|
1936
|
+
readonly get_obligations: z.ZodObject<{
|
|
1937
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
1938
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
1939
|
+
}, z.core.$strip>;
|
|
1940
|
+
};
|
|
1941
|
+
type Action = keyof typeof schemas;
|
|
1942
|
+
declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
|
|
1943
|
+
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
|
|
1944
|
+
|
|
1945
|
+
declare const index$2_ChainHealth: typeof ChainHealth;
|
|
1946
|
+
type index$2_ChainsHealthResponse = ChainsHealthResponse;
|
|
1947
|
+
declare const index$2_CollectorHealth: typeof CollectorHealth;
|
|
1948
|
+
type index$2_CollectorsHealthResponse = CollectorsHealthResponse;
|
|
1949
|
+
declare const index$2_OpenApi: typeof OpenApi;
|
|
1950
|
+
type index$2_RouterApi = RouterApi;
|
|
1951
|
+
type index$2_RouterApiConfig = RouterApiConfig;
|
|
1952
|
+
type index$2_RouterStatusResponse = RouterStatusResponse;
|
|
1953
|
+
declare const index$2_create: typeof create;
|
|
1954
|
+
declare const index$2_parse: typeof parse;
|
|
1955
|
+
declare const index$2_safeParse: typeof safeParse;
|
|
1956
|
+
declare namespace index$2 {
|
|
1957
|
+
export { index$2_ChainHealth as ChainHealth, type index$2_ChainsHealthResponse as ChainsHealthResponse, index$2_CollectorHealth as CollectorHealth, type index$2_CollectorsHealthResponse as CollectorsHealthResponse, index$3 as Controllers, ObligationResponse$1 as ObligationResponse, OfferResponse$1 as OfferResponse, index$2_OpenApi as OpenApi, type index$2_RouterApi as RouterApi, type index$2_RouterApiConfig as RouterApiConfig, type index$2_RouterStatusResponse as RouterStatusResponse, index$2_create as create, index$2_parse as parse, index$2_safeParse as safeParse };
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
type RouterClientConfig = {
|
|
1961
|
+
/** The URL of the router. */
|
|
1962
|
+
readonly url: URL;
|
|
1963
|
+
/** The default headers to use for each request. */
|
|
1964
|
+
readonly headers: Headers;
|
|
1965
|
+
};
|
|
1966
|
+
type Client$1 = Compute<RouterClientConfig & {
|
|
1967
|
+
/**
|
|
1968
|
+
* Get offers from the router.
|
|
1969
|
+
* @param parameters - {@link getOffers.Parameters}
|
|
1970
|
+
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
* ```ts
|
|
1974
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
1975
|
+
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
1976
|
+
* console.log(offers);
|
|
1977
|
+
* ```
|
|
1978
|
+
*/
|
|
1979
|
+
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
1980
|
+
/**
|
|
1981
|
+
* Get obligations from the router.
|
|
1982
|
+
* @param parameters - {@link getObligations.Parameters}
|
|
1983
|
+
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
1984
|
+
*
|
|
1985
|
+
* @example
|
|
1986
|
+
* ```ts
|
|
1987
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
1988
|
+
* const { obligations, cursor } = await router.getObligations();
|
|
1989
|
+
* console.log(obligations);
|
|
1990
|
+
* ```
|
|
1991
|
+
*/
|
|
1992
|
+
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
1993
|
+
}>;
|
|
1994
|
+
type ConnectOptions = {
|
|
1995
|
+
/** The URL of the router to interact with.
|
|
1996
|
+
* @default "https://router.morpho.dev"
|
|
1997
|
+
*/
|
|
1998
|
+
url?: string;
|
|
1999
|
+
/** The API key to use for the router API. */
|
|
2000
|
+
apiKey?: string;
|
|
2001
|
+
/** The default headers to use for each request. */
|
|
2002
|
+
headers?: Headers;
|
|
2003
|
+
};
|
|
2004
|
+
/**
|
|
2005
|
+
* Creates an instance of a router client.
|
|
2006
|
+
* @constructor
|
|
2007
|
+
* @param options - {@link ConnectOptions}
|
|
2008
|
+
* @returns A Router Client. {@link Client}
|
|
2009
|
+
*
|
|
2010
|
+
* @example
|
|
2011
|
+
* ```typescript
|
|
2012
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2013
|
+
* ```
|
|
2014
|
+
*/
|
|
2015
|
+
declare function connect$1(options?: ConnectOptions): connect$1.ReturnType;
|
|
2016
|
+
declare namespace connect$1 {
|
|
2017
|
+
type ReturnType = Client$1;
|
|
2018
|
+
type ErrorType = InvalidUrlError;
|
|
2019
|
+
}
|
|
2020
|
+
declare function getOffers(config: RouterClientConfig, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
2021
|
+
declare namespace getOffers {
|
|
2022
|
+
type Parameters = {
|
|
2023
|
+
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
2024
|
+
side: "buy" | "sell";
|
|
2025
|
+
/** The offers obligation id */
|
|
2026
|
+
obligationId: Hex;
|
|
2027
|
+
/** Pagination cursor in base64url-encoded format */
|
|
2028
|
+
cursor?: string;
|
|
2029
|
+
/** Maximum number of offers to return. @default 20 */
|
|
2030
|
+
limit?: number;
|
|
2031
|
+
};
|
|
2032
|
+
type ReturnType = {
|
|
2033
|
+
offers: Offer[];
|
|
2034
|
+
/** The pagination cursor. */
|
|
2035
|
+
cursor: string | null;
|
|
2036
|
+
};
|
|
2037
|
+
type ErrorType = GetApiErrorType;
|
|
2038
|
+
}
|
|
2039
|
+
declare function getObligations(config: RouterClientConfig, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
2040
|
+
declare namespace getObligations {
|
|
2041
|
+
type Parameters = {
|
|
2042
|
+
/** Pagination cursor is a 32-byte hex string. */
|
|
2043
|
+
cursor?: Hex;
|
|
2044
|
+
/** Maximum number of obligations to return. @default 20 */
|
|
2045
|
+
limit?: number;
|
|
2046
|
+
};
|
|
2047
|
+
type ReturnType = {
|
|
2048
|
+
obligations: Obligation[];
|
|
2049
|
+
/** The pagination cursor. */
|
|
2050
|
+
cursor: string | null;
|
|
2051
|
+
};
|
|
2052
|
+
type ErrorType = GetApiErrorType;
|
|
2053
|
+
}
|
|
2054
|
+
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
2055
|
+
declare class InvalidUrlError extends BaseError {
|
|
2056
|
+
name: string;
|
|
2057
|
+
constructor(url: string);
|
|
2058
|
+
}
|
|
2059
|
+
declare class HttpUnauthorizedError extends BaseError {
|
|
2060
|
+
name: string;
|
|
2061
|
+
constructor();
|
|
2062
|
+
}
|
|
2063
|
+
declare class HttpForbiddenError extends BaseError {
|
|
2064
|
+
name: string;
|
|
2065
|
+
constructor();
|
|
2066
|
+
}
|
|
2067
|
+
declare class HttpRateLimitError extends BaseError {
|
|
2068
|
+
name: string;
|
|
2069
|
+
constructor();
|
|
2070
|
+
}
|
|
2071
|
+
declare class HttpGetApiFailedError extends BaseError {
|
|
2072
|
+
name: string;
|
|
2073
|
+
constructor(message: string, { details }?: {
|
|
2074
|
+
details?: string;
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
type Client$2_ConnectOptions = ConnectOptions;
|
|
2079
|
+
type Client$2_HttpForbiddenError = HttpForbiddenError;
|
|
2080
|
+
declare const Client$2_HttpForbiddenError: typeof HttpForbiddenError;
|
|
2081
|
+
type Client$2_HttpGetApiFailedError = HttpGetApiFailedError;
|
|
2082
|
+
declare const Client$2_HttpGetApiFailedError: typeof HttpGetApiFailedError;
|
|
2083
|
+
type Client$2_HttpRateLimitError = HttpRateLimitError;
|
|
2084
|
+
declare const Client$2_HttpRateLimitError: typeof HttpRateLimitError;
|
|
2085
|
+
type Client$2_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
2086
|
+
declare const Client$2_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
2087
|
+
type Client$2_InvalidUrlError = InvalidUrlError;
|
|
2088
|
+
declare const Client$2_InvalidUrlError: typeof InvalidUrlError;
|
|
2089
|
+
declare const Client$2_getObligations: typeof getObligations;
|
|
2090
|
+
declare const Client$2_getOffers: typeof getOffers;
|
|
2091
|
+
declare namespace Client$2 {
|
|
2092
|
+
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 };
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
declare const users: Account[];
|
|
2096
|
+
declare const assetList: readonly ["USDC", "DAI"];
|
|
2097
|
+
declare const mockAddress: (asset: (typeof assetList)[number]) => `0x${string}`;
|
|
2098
|
+
declare const mockOracleAddress: `0x${string}`;
|
|
2099
|
+
declare const mockMorphoAddress: `0x${string}`;
|
|
2100
|
+
declare const mockFactoryAddress: `0x${string}`;
|
|
2101
|
+
declare const encodeConsumedEvent: (parameters: {
|
|
2102
|
+
user: Address;
|
|
2103
|
+
nonce: bigint;
|
|
2104
|
+
amount: bigint;
|
|
2105
|
+
}) => `0x${string}`;
|
|
2106
|
+
declare const assetMethods: readonly ["balanceOf", "allowance"];
|
|
2107
|
+
declare const oracleMethods: readonly ["price"];
|
|
2108
|
+
declare const morphoMethods: readonly ["debtOf", "collateralOf", "market", "position"];
|
|
2109
|
+
declare const vaultMethods: readonly ["asset", "balanceOf", "totalSupply", "totalAssets", "withdrawQueue"];
|
|
2110
|
+
declare const factoryMethods: readonly ["isMetaMorpho", "morpho"];
|
|
2111
|
+
type AssetMethod = (typeof assetMethods)[number];
|
|
2112
|
+
type OracleMethod = (typeof oracleMethods)[number];
|
|
2113
|
+
type MorphoMethod = (typeof morphoMethods)[number];
|
|
2114
|
+
type VaultMethod = (typeof vaultMethods)[number];
|
|
2115
|
+
type FactoryMethod = (typeof factoryMethods)[number];
|
|
2116
|
+
type MethodParameters = {
|
|
2117
|
+
balanceOf: {
|
|
2118
|
+
address: Address;
|
|
2119
|
+
value: bigint;
|
|
2120
|
+
};
|
|
2121
|
+
allowance: {
|
|
2122
|
+
owner: Address;
|
|
2123
|
+
spender: Address;
|
|
2124
|
+
value: bigint;
|
|
2125
|
+
};
|
|
2126
|
+
};
|
|
2127
|
+
type OracleMethodParameters = {
|
|
2128
|
+
price: {
|
|
2129
|
+
value: bigint;
|
|
2130
|
+
};
|
|
2131
|
+
};
|
|
2132
|
+
type MorphoMethodParameters = {
|
|
2133
|
+
debtOf: {
|
|
2134
|
+
user: Address;
|
|
2135
|
+
obligationId: Hex;
|
|
2136
|
+
value: bigint;
|
|
2137
|
+
};
|
|
2138
|
+
collateralOf: {
|
|
2139
|
+
user: Address;
|
|
2140
|
+
obligationId: Hex;
|
|
2141
|
+
collateralAsset: Address;
|
|
2142
|
+
value: bigint;
|
|
2143
|
+
};
|
|
2144
|
+
market: {
|
|
2145
|
+
marketId: Hex;
|
|
2146
|
+
totalSupplyAssets: bigint;
|
|
2147
|
+
totalSupplyShares: bigint;
|
|
2148
|
+
totalBorrowAssets: bigint;
|
|
2149
|
+
totalBorrowShares: bigint;
|
|
2150
|
+
lastUpdate: bigint;
|
|
2151
|
+
fee: bigint;
|
|
2152
|
+
};
|
|
2153
|
+
position: {
|
|
2154
|
+
marketId: Hex;
|
|
2155
|
+
user: Address;
|
|
2156
|
+
supplyShares: bigint;
|
|
2157
|
+
borrowShares: bigint;
|
|
2158
|
+
collateral: bigint;
|
|
2159
|
+
};
|
|
2160
|
+
};
|
|
2161
|
+
type VaultMethodParameters = {
|
|
2162
|
+
asset: {
|
|
2163
|
+
value: Address;
|
|
2164
|
+
};
|
|
2165
|
+
balanceOf: {
|
|
2166
|
+
user: Address;
|
|
2167
|
+
value: bigint;
|
|
2168
|
+
};
|
|
2169
|
+
totalSupply: {
|
|
2170
|
+
value: bigint;
|
|
2171
|
+
};
|
|
2172
|
+
totalAssets: {
|
|
2173
|
+
value: bigint;
|
|
2174
|
+
};
|
|
2175
|
+
withdrawQueue: {
|
|
2176
|
+
value: Hex[];
|
|
2177
|
+
};
|
|
2178
|
+
};
|
|
2179
|
+
type FactoryMethodParameters = {
|
|
2180
|
+
isMetaMorpho: {
|
|
2181
|
+
vault: Address;
|
|
2182
|
+
value: boolean;
|
|
2183
|
+
};
|
|
2184
|
+
morpho: {
|
|
2185
|
+
value: Address;
|
|
2186
|
+
};
|
|
2187
|
+
};
|
|
2188
|
+
type MockedAsset = {
|
|
2189
|
+
address: Address;
|
|
2190
|
+
set: (slot: Hex | AssetMethod, parameters: Hex | bigint | MethodParameters[AssetMethod]) => Promise<void>;
|
|
2191
|
+
};
|
|
2192
|
+
type MockedOracle = {
|
|
2193
|
+
address: Address;
|
|
2194
|
+
set: (method: OracleMethod, parameters: OracleMethodParameters[OracleMethod]) => Promise<void>;
|
|
2195
|
+
};
|
|
2196
|
+
type MockedMorpho = {
|
|
2197
|
+
address: Address;
|
|
2198
|
+
set: (method: MorphoMethod, parameters: MorphoMethodParameters[MorphoMethod]) => Promise<void>;
|
|
2199
|
+
};
|
|
2200
|
+
type MockedVault = {
|
|
2201
|
+
address: Address;
|
|
2202
|
+
set: (method: VaultMethod, parameters: VaultMethodParameters[VaultMethod]) => Promise<void>;
|
|
2203
|
+
};
|
|
2204
|
+
type MockedFactory = {
|
|
2205
|
+
address: Address;
|
|
2206
|
+
set: (method: FactoryMethod, parameters: FactoryMethodParameters[FactoryMethod]) => Promise<void>;
|
|
2207
|
+
};
|
|
2208
|
+
type Mocked = {
|
|
2209
|
+
name: string;
|
|
2210
|
+
client: WalletClient;
|
|
2211
|
+
mempoolAddress: Address;
|
|
2212
|
+
termsAddress: Address;
|
|
2213
|
+
mine: () => Promise<void>;
|
|
2214
|
+
reset: () => Promise<void>;
|
|
2215
|
+
deployVault: () => Promise<MockedVault>;
|
|
2216
|
+
oracle: MockedOracle;
|
|
2217
|
+
morpho: MockedMorpho;
|
|
2218
|
+
factory: MockedFactory;
|
|
2219
|
+
} & Record<(typeof assetList)[number], MockedAsset>;
|
|
2220
|
+
declare function mock(name: string): Promise<Mocked>;
|
|
2221
|
+
/**
|
|
2222
|
+
* Start a local anvil chain.
|
|
2223
|
+
* @example
|
|
2224
|
+
* ```ts
|
|
2225
|
+
* import { EVM } from "@morpho-dev/router";
|
|
2226
|
+
* EVM.serve(); // local chain rpc url running on http://localhost:8545
|
|
2227
|
+
* ```
|
|
2228
|
+
*/
|
|
2229
|
+
declare function serve(parameters: {
|
|
2230
|
+
port: number;
|
|
2231
|
+
forkUrl: string;
|
|
2232
|
+
blockNumber?: number;
|
|
2233
|
+
}): Promise<{
|
|
2234
|
+
rpcUrl: `http://localhost:${number}`;
|
|
2235
|
+
stop: () => boolean;
|
|
2236
|
+
}>;
|
|
2237
|
+
|
|
2238
|
+
type EVM_AssetMethod = AssetMethod;
|
|
2239
|
+
type EVM_FactoryMethod = FactoryMethod;
|
|
2240
|
+
type EVM_FactoryMethodParameters = FactoryMethodParameters;
|
|
2241
|
+
type EVM_MethodParameters = MethodParameters;
|
|
2242
|
+
type EVM_Mocked = Mocked;
|
|
2243
|
+
type EVM_MockedAsset = MockedAsset;
|
|
2244
|
+
type EVM_MockedFactory = MockedFactory;
|
|
2245
|
+
type EVM_MockedMorpho = MockedMorpho;
|
|
2246
|
+
type EVM_MockedOracle = MockedOracle;
|
|
2247
|
+
type EVM_MockedVault = MockedVault;
|
|
2248
|
+
type EVM_MorphoMethod = MorphoMethod;
|
|
2249
|
+
type EVM_MorphoMethodParameters = MorphoMethodParameters;
|
|
2250
|
+
type EVM_OracleMethod = OracleMethod;
|
|
2251
|
+
type EVM_OracleMethodParameters = OracleMethodParameters;
|
|
2252
|
+
type EVM_VaultMethod = VaultMethod;
|
|
2253
|
+
type EVM_VaultMethodParameters = VaultMethodParameters;
|
|
2254
|
+
declare const EVM_assetList: typeof assetList;
|
|
2255
|
+
declare const EVM_assetMethods: typeof assetMethods;
|
|
2256
|
+
declare const EVM_encodeConsumedEvent: typeof encodeConsumedEvent;
|
|
2257
|
+
declare const EVM_factoryMethods: typeof factoryMethods;
|
|
2258
|
+
declare const EVM_mock: typeof mock;
|
|
2259
|
+
declare const EVM_mockAddress: typeof mockAddress;
|
|
2260
|
+
declare const EVM_mockFactoryAddress: typeof mockFactoryAddress;
|
|
2261
|
+
declare const EVM_mockMorphoAddress: typeof mockMorphoAddress;
|
|
2262
|
+
declare const EVM_mockOracleAddress: typeof mockOracleAddress;
|
|
2263
|
+
declare const EVM_morphoMethods: typeof morphoMethods;
|
|
2264
|
+
declare const EVM_oracleMethods: typeof oracleMethods;
|
|
2265
|
+
declare const EVM_serve: typeof serve;
|
|
2266
|
+
declare const EVM_users: typeof users;
|
|
2267
|
+
declare const EVM_vaultMethods: typeof vaultMethods;
|
|
2268
|
+
declare namespace EVM {
|
|
2269
|
+
export { type EVM_AssetMethod as AssetMethod, type EVM_FactoryMethod as FactoryMethod, type EVM_FactoryMethodParameters as FactoryMethodParameters, type EVM_MethodParameters as MethodParameters, type EVM_Mocked as Mocked, type EVM_MockedAsset as MockedAsset, type EVM_MockedFactory as MockedFactory, type EVM_MockedMorpho as MockedMorpho, type EVM_MockedOracle as MockedOracle, type EVM_MockedVault as MockedVault, type EVM_MorphoMethod as MorphoMethod, type EVM_MorphoMethodParameters as MorphoMethodParameters, type EVM_OracleMethod as OracleMethod, type EVM_OracleMethodParameters as OracleMethodParameters, type EVM_VaultMethod as VaultMethod, type EVM_VaultMethodParameters as VaultMethodParameters, EVM_assetList as assetList, EVM_assetMethods as assetMethods, EVM_encodeConsumedEvent as encodeConsumedEvent, EVM_factoryMethods as factoryMethods, EVM_mock as mock, EVM_mockAddress as mockAddress, EVM_mockFactoryAddress as mockFactoryAddress, EVM_mockMorphoAddress as mockMorphoAddress, EVM_mockOracleAddress as mockOracleAddress, EVM_morphoMethods as morphoMethods, EVM_oracleMethods as oracleMethods, EVM_serve as serve, EVM_users as users, EVM_vaultMethods as vaultMethods };
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
type MempoolEVMClientConfig = {
|
|
2273
|
+
readonly client: WalletClient;
|
|
2274
|
+
readonly mempoolAddress: Address;
|
|
2275
|
+
readonly blockWindow: number;
|
|
2276
|
+
};
|
|
2277
|
+
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
2278
|
+
declare namespace from {
|
|
2279
|
+
type Parameters = {
|
|
2280
|
+
/** The viem client to use. */
|
|
2281
|
+
client: WalletClient;
|
|
2282
|
+
/** The mempool address. */
|
|
2283
|
+
mempoolAddress: Address;
|
|
2284
|
+
/** The block window to use for the mempool. Defaults to 100. */
|
|
2285
|
+
blockWindow?: number;
|
|
2286
|
+
};
|
|
2287
|
+
type ReturnType = Client;
|
|
2288
|
+
type ErrorType = null;
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Add an offer to the mempool.
|
|
2292
|
+
* @returns The created offer with its hash.
|
|
2293
|
+
* @throws WalletAccountNotSetError if the wallet account is not set.
|
|
2294
|
+
* @throws ViemClientError if the viem client throws an error.
|
|
2295
|
+
* @throws Offer.InvalidOfferError if the offer is invalid.
|
|
2296
|
+
*/
|
|
2297
|
+
declare function add(config: MempoolEVMClientConfig, parameters: AddParameters): Promise<{
|
|
2298
|
+
offer: Offer;
|
|
2299
|
+
txHash: Hex;
|
|
2300
|
+
}>;
|
|
2301
|
+
declare namespace add {
|
|
2302
|
+
type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
|
|
2303
|
+
}
|
|
2304
|
+
declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
|
|
2305
|
+
offers: Offer[];
|
|
2306
|
+
blockNumber: number;
|
|
2307
|
+
}, void, void>;
|
|
2308
|
+
declare namespace get {
|
|
2309
|
+
type ErrorType = streamOffersReturnType;
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Watch for new offers on a specific chain.
|
|
2313
|
+
* @returns A function to stop watching for new offers.
|
|
2314
|
+
*/
|
|
2315
|
+
declare function watch(config: MempoolEVMClientConfig, parameters: WatchParameters): () => boolean;
|
|
2316
|
+
declare namespace watch {
|
|
2317
|
+
type ErrorType = streamOffersReturnType;
|
|
2318
|
+
}
|
|
2319
|
+
type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
|
|
2320
|
+
declare class WalletAccountNotSetError extends BaseError {
|
|
2321
|
+
name: string;
|
|
2322
|
+
constructor();
|
|
2323
|
+
}
|
|
2324
|
+
declare class ViemClientError extends BaseError {
|
|
2325
|
+
name: string;
|
|
2326
|
+
}
|
|
2327
|
+
declare class ChainIdMismatchError extends BaseError {
|
|
2328
|
+
name: string;
|
|
2329
|
+
constructor(expected: bigint, actual: bigint);
|
|
1291
2330
|
}
|
|
1292
2331
|
|
|
2332
|
+
type AddParameters = {
|
|
2333
|
+
offer: Compute<Omit<Offer, "hash" | "createdAt">>;
|
|
2334
|
+
};
|
|
2335
|
+
type GetParameters = {
|
|
2336
|
+
/** The block number to get offers from. */
|
|
2337
|
+
blockNumberGte?: number;
|
|
2338
|
+
/** The block number to get offers to. */
|
|
2339
|
+
blockNumberLte?: number;
|
|
2340
|
+
/** The loan asset to get offers from. */
|
|
2341
|
+
loanToken?: string;
|
|
2342
|
+
/** The order to get offers. Defaults to "desc". */
|
|
2343
|
+
order?: "asc" | "desc";
|
|
2344
|
+
/** The options to get offers from. */
|
|
2345
|
+
options?: {
|
|
2346
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
2347
|
+
maxBatchSize?: number;
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2350
|
+
type WatchParameters = {
|
|
2351
|
+
/** The async function to get the last synced block number from which to start watching.
|
|
2352
|
+
* This function will be called periodically on each poll. It should be updated by the caller (e.g. using `onOffers` callback) to track the last synced block number.
|
|
2353
|
+
*/
|
|
2354
|
+
lastSyncedBlock: () => Promise<number>;
|
|
2355
|
+
/** The loan asset to watch. */
|
|
2356
|
+
loanToken?: string;
|
|
2357
|
+
/** The callback to call when a new batch of offers is found in the mempool.
|
|
2358
|
+
* @param offers The offers found in the mempool.
|
|
2359
|
+
* @param blockNumber The block number of the last processed offer. Block numbers will always ascend.
|
|
2360
|
+
*/
|
|
2361
|
+
onOffers: (offers: Offer[], blockNumber: number) => Promise<void>;
|
|
2362
|
+
/** The polling configuration. */
|
|
2363
|
+
polling?: {
|
|
2364
|
+
/** The interval in milliseconds to poll for new offers. Defaults to 30000. */
|
|
2365
|
+
interval?: number;
|
|
2366
|
+
/** The maximum number of offers that can be returned in a single batch.
|
|
2367
|
+
* Defaults to 100. Maximum is 1000. */
|
|
2368
|
+
maxBatchSize?: number;
|
|
2369
|
+
};
|
|
2370
|
+
};
|
|
1293
2371
|
/**
|
|
1294
|
-
*
|
|
2372
|
+
* Mempool client interface.
|
|
1295
2373
|
*/
|
|
1296
|
-
type
|
|
1297
|
-
/**
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
2374
|
+
type Client = {
|
|
2375
|
+
/**
|
|
2376
|
+
* Add an offer to the mempool.
|
|
2377
|
+
* @returns The created offer with its hash.
|
|
2378
|
+
*/
|
|
2379
|
+
add: (parameters: AddParameters) => Promise<{
|
|
2380
|
+
offer: Offer;
|
|
2381
|
+
txHash: Hex;
|
|
2382
|
+
}>;
|
|
2383
|
+
/** Get offers from the mempool. */
|
|
2384
|
+
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
2385
|
+
offers: Offer[];
|
|
2386
|
+
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
2387
|
+
blockNumber: number;
|
|
2388
|
+
}>;
|
|
2389
|
+
/**
|
|
2390
|
+
* Watch for new offers on a specific chain.
|
|
2391
|
+
* @returns A function to stop watching for new offers.
|
|
2392
|
+
*/
|
|
2393
|
+
watch: (parameters: WatchParameters) => () => boolean;
|
|
2394
|
+
/**
|
|
2395
|
+
* Stream offers from the mempool.
|
|
2396
|
+
* @returns A generator of offers alongside the last block number processed.
|
|
2397
|
+
*/
|
|
2398
|
+
stream: (parameters: Compute<Omit<GetParameters, "options"> & {
|
|
2399
|
+
options: GetParameters["options"] & {
|
|
2400
|
+
blockWindow?: number;
|
|
2401
|
+
};
|
|
2402
|
+
}>) => AsyncGenerator<{
|
|
2403
|
+
offers: Offer[];
|
|
2404
|
+
blockNumber: number;
|
|
2405
|
+
}>;
|
|
1303
2406
|
};
|
|
1304
2407
|
/**
|
|
1305
|
-
*
|
|
2408
|
+
* Client to interact with the Mempool contract on a specific chain.
|
|
1306
2409
|
*/
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
issues: Issue<T, RuleName>[];
|
|
1312
|
-
};
|
|
1313
|
-
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name, void>[]>(parameters: {
|
|
1314
|
-
items: T[];
|
|
1315
|
-
rules: Rules;
|
|
1316
|
-
chunkSize?: number;
|
|
1317
|
-
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
1318
|
-
declare function run<T, Ctx, Name extends string, Rules extends readonly Rule<T, Name, Ctx>[]>(parameters: {
|
|
1319
|
-
items: T[];
|
|
1320
|
-
rules: Rules;
|
|
1321
|
-
ctx: Ctx;
|
|
1322
|
-
chunkSize?: number;
|
|
1323
|
-
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
2410
|
+
declare function connect(parameters: from.Parameters): Client;
|
|
2411
|
+
declare namespace connect {
|
|
2412
|
+
type ErrorType = from.ErrorType;
|
|
2413
|
+
}
|
|
1324
2414
|
|
|
1325
|
-
type
|
|
1326
|
-
type
|
|
1327
|
-
declare const
|
|
1328
|
-
|
|
1329
|
-
|
|
2415
|
+
type index$1_AddParameters = AddParameters;
|
|
2416
|
+
type index$1_ChainIdMismatchError = ChainIdMismatchError;
|
|
2417
|
+
declare const index$1_ChainIdMismatchError: typeof ChainIdMismatchError;
|
|
2418
|
+
type index$1_Client = Client;
|
|
2419
|
+
type index$1_GetParameters = GetParameters;
|
|
2420
|
+
type index$1_ViemClientError = ViemClientError;
|
|
2421
|
+
declare const index$1_ViemClientError: typeof ViemClientError;
|
|
2422
|
+
type index$1_WalletAccountNotSetError = WalletAccountNotSetError;
|
|
2423
|
+
declare const index$1_WalletAccountNotSetError: typeof WalletAccountNotSetError;
|
|
2424
|
+
type index$1_WatchParameters = WatchParameters;
|
|
2425
|
+
declare const index$1_add: typeof add;
|
|
2426
|
+
declare const index$1_connect: typeof connect;
|
|
2427
|
+
declare const index$1_from: typeof from;
|
|
2428
|
+
declare const index$1_get: typeof get;
|
|
2429
|
+
declare const index$1_watch: typeof watch;
|
|
2430
|
+
declare namespace index$1 {
|
|
2431
|
+
export { type index$1_AddParameters as AddParameters, index$1_ChainIdMismatchError as ChainIdMismatchError, type index$1_Client as Client, type index$1_GetParameters as GetParameters, index$1_ViemClientError as ViemClientError, index$1_WalletAccountNotSetError as WalletAccountNotSetError, type index$1_WatchParameters as WatchParameters, index$1_add as add, index$1_connect as connect, index$1_from as from, index$1_get as get, index$1_watch as watch };
|
|
1330
2432
|
}
|
|
1331
2433
|
|
|
1332
|
-
declare const VERSION = "router_v1.
|
|
2434
|
+
declare const VERSION = "router_v1.4";
|
|
2435
|
+
declare const obligations: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2436
|
+
name: "obligations";
|
|
2437
|
+
schema: "router_v1.4";
|
|
2438
|
+
columns: {
|
|
2439
|
+
obligationId: drizzle_orm_pg_core.PgColumn<{
|
|
2440
|
+
name: "obligation_id";
|
|
2441
|
+
tableName: "obligations";
|
|
2442
|
+
dataType: "string";
|
|
2443
|
+
columnType: "PgVarchar";
|
|
2444
|
+
data: string;
|
|
2445
|
+
driverParam: string;
|
|
2446
|
+
notNull: true;
|
|
2447
|
+
hasDefault: false;
|
|
2448
|
+
isPrimaryKey: true;
|
|
2449
|
+
isAutoincrement: false;
|
|
2450
|
+
hasRuntimeDefault: false;
|
|
2451
|
+
enumValues: [string, ...string[]];
|
|
2452
|
+
baseColumn: never;
|
|
2453
|
+
identity: undefined;
|
|
2454
|
+
generated: undefined;
|
|
2455
|
+
}, {}, {
|
|
2456
|
+
length: 66;
|
|
2457
|
+
}>;
|
|
2458
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
2459
|
+
name: "chain_id";
|
|
2460
|
+
tableName: "obligations";
|
|
2461
|
+
dataType: "bigint";
|
|
2462
|
+
columnType: "PgBigInt64";
|
|
2463
|
+
data: bigint;
|
|
2464
|
+
driverParam: string;
|
|
2465
|
+
notNull: true;
|
|
2466
|
+
hasDefault: false;
|
|
2467
|
+
isPrimaryKey: false;
|
|
2468
|
+
isAutoincrement: false;
|
|
2469
|
+
hasRuntimeDefault: false;
|
|
2470
|
+
enumValues: undefined;
|
|
2471
|
+
baseColumn: never;
|
|
2472
|
+
identity: undefined;
|
|
2473
|
+
generated: undefined;
|
|
2474
|
+
}, {}, {}>;
|
|
2475
|
+
loanToken: drizzle_orm_pg_core.PgColumn<{
|
|
2476
|
+
name: "loan_token";
|
|
2477
|
+
tableName: "obligations";
|
|
2478
|
+
dataType: "string";
|
|
2479
|
+
columnType: "PgVarchar";
|
|
2480
|
+
data: string;
|
|
2481
|
+
driverParam: string;
|
|
2482
|
+
notNull: true;
|
|
2483
|
+
hasDefault: false;
|
|
2484
|
+
isPrimaryKey: false;
|
|
2485
|
+
isAutoincrement: false;
|
|
2486
|
+
hasRuntimeDefault: false;
|
|
2487
|
+
enumValues: [string, ...string[]];
|
|
2488
|
+
baseColumn: never;
|
|
2489
|
+
identity: undefined;
|
|
2490
|
+
generated: undefined;
|
|
2491
|
+
}, {}, {
|
|
2492
|
+
length: 42;
|
|
2493
|
+
}>;
|
|
2494
|
+
maturity: drizzle_orm_pg_core.PgColumn<{
|
|
2495
|
+
name: "maturity";
|
|
2496
|
+
tableName: "obligations";
|
|
2497
|
+
dataType: "number";
|
|
2498
|
+
columnType: "PgInteger";
|
|
2499
|
+
data: number;
|
|
2500
|
+
driverParam: string | number;
|
|
2501
|
+
notNull: true;
|
|
2502
|
+
hasDefault: false;
|
|
2503
|
+
isPrimaryKey: false;
|
|
2504
|
+
isAutoincrement: false;
|
|
2505
|
+
hasRuntimeDefault: false;
|
|
2506
|
+
enumValues: undefined;
|
|
2507
|
+
baseColumn: never;
|
|
2508
|
+
identity: undefined;
|
|
2509
|
+
generated: undefined;
|
|
2510
|
+
}, {}, {}>;
|
|
2511
|
+
};
|
|
2512
|
+
dialect: "pg";
|
|
2513
|
+
}>;
|
|
1333
2514
|
declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1334
2515
|
name: "offers";
|
|
1335
|
-
schema: "router_v1.
|
|
2516
|
+
schema: "router_v1.4";
|
|
1336
2517
|
columns: {
|
|
1337
2518
|
hash: drizzle_orm_pg_core.PgColumn<{
|
|
1338
2519
|
name: "hash";
|
|
@@ -1353,6 +2534,25 @@ declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1353
2534
|
}, {}, {
|
|
1354
2535
|
length: 66;
|
|
1355
2536
|
}>;
|
|
2537
|
+
obligationId: drizzle_orm_pg_core.PgColumn<{
|
|
2538
|
+
name: "obligation_id";
|
|
2539
|
+
tableName: "offers";
|
|
2540
|
+
dataType: "string";
|
|
2541
|
+
columnType: "PgVarchar";
|
|
2542
|
+
data: string;
|
|
2543
|
+
driverParam: string;
|
|
2544
|
+
notNull: true;
|
|
2545
|
+
hasDefault: false;
|
|
2546
|
+
isPrimaryKey: false;
|
|
2547
|
+
isAutoincrement: false;
|
|
2548
|
+
hasRuntimeDefault: false;
|
|
2549
|
+
enumValues: [string, ...string[]];
|
|
2550
|
+
baseColumn: never;
|
|
2551
|
+
identity: undefined;
|
|
2552
|
+
generated: undefined;
|
|
2553
|
+
}, {}, {
|
|
2554
|
+
length: 66;
|
|
2555
|
+
}>;
|
|
1356
2556
|
offering: drizzle_orm_pg_core.PgColumn<{
|
|
1357
2557
|
name: "offering";
|
|
1358
2558
|
tableName: "offers";
|
|
@@ -1568,143 +2768,26 @@ declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1568
2768
|
tableName: "offers";
|
|
1569
2769
|
dataType: "bigint";
|
|
1570
2770
|
columnType: "PgBigInt64";
|
|
1571
|
-
data: bigint;
|
|
1572
|
-
driverParam: string;
|
|
1573
|
-
notNull: true;
|
|
1574
|
-
hasDefault: false;
|
|
1575
|
-
isPrimaryKey: false;
|
|
1576
|
-
isAutoincrement: false;
|
|
1577
|
-
hasRuntimeDefault: false;
|
|
1578
|
-
enumValues: undefined;
|
|
1579
|
-
baseColumn: never;
|
|
1580
|
-
identity: undefined;
|
|
1581
|
-
generated: undefined;
|
|
1582
|
-
}, {}, {}>;
|
|
1583
|
-
signature: drizzle_orm_pg_core.PgColumn<{
|
|
1584
|
-
name: "signature";
|
|
1585
|
-
tableName: "offers";
|
|
1586
|
-
dataType: "string";
|
|
1587
|
-
columnType: "PgVarchar";
|
|
1588
|
-
data: string;
|
|
1589
|
-
driverParam: string;
|
|
1590
|
-
notNull: false;
|
|
1591
|
-
hasDefault: false;
|
|
1592
|
-
isPrimaryKey: false;
|
|
1593
|
-
isAutoincrement: false;
|
|
1594
|
-
hasRuntimeDefault: false;
|
|
1595
|
-
enumValues: [string, ...string[]];
|
|
1596
|
-
baseColumn: never;
|
|
1597
|
-
identity: undefined;
|
|
1598
|
-
generated: undefined;
|
|
1599
|
-
}, {}, {
|
|
1600
|
-
length: 132;
|
|
1601
|
-
}>;
|
|
1602
|
-
callbackId: drizzle_orm_pg_core.PgColumn<{
|
|
1603
|
-
name: "callback_id";
|
|
1604
|
-
tableName: "offers";
|
|
1605
|
-
dataType: "string";
|
|
1606
|
-
columnType: "PgVarchar";
|
|
1607
|
-
data: string;
|
|
1608
|
-
driverParam: string;
|
|
1609
|
-
notNull: false;
|
|
1610
|
-
hasDefault: false;
|
|
1611
|
-
isPrimaryKey: false;
|
|
1612
|
-
isAutoincrement: false;
|
|
1613
|
-
hasRuntimeDefault: false;
|
|
1614
|
-
enumValues: [string, ...string[]];
|
|
1615
|
-
baseColumn: never;
|
|
1616
|
-
identity: undefined;
|
|
1617
|
-
generated: undefined;
|
|
1618
|
-
}, {}, {
|
|
1619
|
-
length: 256;
|
|
1620
|
-
}>;
|
|
1621
|
-
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1622
|
-
name: "created_at";
|
|
1623
|
-
tableName: "offers";
|
|
1624
|
-
dataType: "date";
|
|
1625
|
-
columnType: "PgTimestamp";
|
|
1626
|
-
data: Date;
|
|
1627
|
-
driverParam: string;
|
|
1628
|
-
notNull: true;
|
|
1629
|
-
hasDefault: true;
|
|
1630
|
-
isPrimaryKey: false;
|
|
1631
|
-
isAutoincrement: false;
|
|
1632
|
-
hasRuntimeDefault: false;
|
|
1633
|
-
enumValues: undefined;
|
|
1634
|
-
baseColumn: never;
|
|
1635
|
-
identity: undefined;
|
|
1636
|
-
generated: undefined;
|
|
1637
|
-
}, {}, {}>;
|
|
1638
|
-
};
|
|
1639
|
-
dialect: "pg";
|
|
1640
|
-
}>;
|
|
1641
|
-
declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1642
|
-
name: "offer_collaterals";
|
|
1643
|
-
schema: "router_v1.1";
|
|
1644
|
-
columns: {
|
|
1645
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
1646
|
-
name: "id";
|
|
1647
|
-
tableName: "offer_collaterals";
|
|
1648
|
-
dataType: "number";
|
|
1649
|
-
columnType: "PgSerial";
|
|
1650
|
-
data: number;
|
|
1651
|
-
driverParam: number;
|
|
1652
|
-
notNull: true;
|
|
1653
|
-
hasDefault: true;
|
|
1654
|
-
isPrimaryKey: true;
|
|
1655
|
-
isAutoincrement: false;
|
|
1656
|
-
hasRuntimeDefault: false;
|
|
1657
|
-
enumValues: undefined;
|
|
1658
|
-
baseColumn: never;
|
|
1659
|
-
identity: undefined;
|
|
1660
|
-
generated: undefined;
|
|
1661
|
-
}, {}, {}>;
|
|
1662
|
-
offerHash: drizzle_orm_pg_core.PgColumn<{
|
|
1663
|
-
name: "offer_hash";
|
|
1664
|
-
tableName: "offer_collaterals";
|
|
1665
|
-
dataType: "string";
|
|
1666
|
-
columnType: "PgVarchar";
|
|
1667
|
-
data: string;
|
|
1668
|
-
driverParam: string;
|
|
1669
|
-
notNull: true;
|
|
1670
|
-
hasDefault: false;
|
|
1671
|
-
isPrimaryKey: false;
|
|
1672
|
-
isAutoincrement: false;
|
|
1673
|
-
hasRuntimeDefault: false;
|
|
1674
|
-
enumValues: [string, ...string[]];
|
|
1675
|
-
baseColumn: never;
|
|
1676
|
-
identity: undefined;
|
|
1677
|
-
generated: undefined;
|
|
1678
|
-
}, {}, {
|
|
1679
|
-
length: 66;
|
|
1680
|
-
}>;
|
|
1681
|
-
asset: drizzle_orm_pg_core.PgColumn<{
|
|
1682
|
-
name: "asset";
|
|
1683
|
-
tableName: "offer_collaterals";
|
|
1684
|
-
dataType: "string";
|
|
1685
|
-
columnType: "PgVarchar";
|
|
1686
|
-
data: string;
|
|
2771
|
+
data: bigint;
|
|
1687
2772
|
driverParam: string;
|
|
1688
2773
|
notNull: true;
|
|
1689
2774
|
hasDefault: false;
|
|
1690
2775
|
isPrimaryKey: false;
|
|
1691
2776
|
isAutoincrement: false;
|
|
1692
2777
|
hasRuntimeDefault: false;
|
|
1693
|
-
enumValues:
|
|
2778
|
+
enumValues: undefined;
|
|
1694
2779
|
baseColumn: never;
|
|
1695
2780
|
identity: undefined;
|
|
1696
2781
|
generated: undefined;
|
|
1697
|
-
}, {}, {
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
name: "oracle";
|
|
1702
|
-
tableName: "offer_collaterals";
|
|
2782
|
+
}, {}, {}>;
|
|
2783
|
+
signature: drizzle_orm_pg_core.PgColumn<{
|
|
2784
|
+
name: "signature";
|
|
2785
|
+
tableName: "offers";
|
|
1703
2786
|
dataType: "string";
|
|
1704
2787
|
columnType: "PgVarchar";
|
|
1705
2788
|
data: string;
|
|
1706
2789
|
driverParam: string;
|
|
1707
|
-
notNull:
|
|
2790
|
+
notNull: false;
|
|
1708
2791
|
hasDefault: false;
|
|
1709
2792
|
isPrimaryKey: false;
|
|
1710
2793
|
isAutoincrement: false;
|
|
@@ -1714,17 +2797,17 @@ declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1714
2797
|
identity: undefined;
|
|
1715
2798
|
generated: undefined;
|
|
1716
2799
|
}, {}, {
|
|
1717
|
-
length:
|
|
2800
|
+
length: 132;
|
|
1718
2801
|
}>;
|
|
1719
|
-
|
|
1720
|
-
name: "
|
|
1721
|
-
tableName: "
|
|
1722
|
-
dataType: "
|
|
1723
|
-
columnType: "
|
|
1724
|
-
data:
|
|
2802
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
2803
|
+
name: "created_at";
|
|
2804
|
+
tableName: "offers";
|
|
2805
|
+
dataType: "date";
|
|
2806
|
+
columnType: "PgTimestamp";
|
|
2807
|
+
data: Date;
|
|
1725
2808
|
driverParam: string;
|
|
1726
2809
|
notNull: true;
|
|
1727
|
-
hasDefault:
|
|
2810
|
+
hasDefault: true;
|
|
1728
2811
|
isPrimaryKey: false;
|
|
1729
2812
|
isAutoincrement: false;
|
|
1730
2813
|
hasRuntimeDefault: false;
|
|
@@ -1733,23 +2816,16 @@ declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1733
2816
|
identity: undefined;
|
|
1734
2817
|
generated: undefined;
|
|
1735
2818
|
}, {}, {}>;
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1740
|
-
name: "offer_status";
|
|
1741
|
-
schema: "router_v1.1";
|
|
1742
|
-
columns: {
|
|
1743
|
-
id: drizzle_orm_pg_core.PgColumn<{
|
|
1744
|
-
name: "id";
|
|
1745
|
-
tableName: "offer_status";
|
|
2819
|
+
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
2820
|
+
name: "block_number";
|
|
2821
|
+
tableName: "offers";
|
|
1746
2822
|
dataType: "number";
|
|
1747
|
-
columnType: "
|
|
2823
|
+
columnType: "PgBigInt53";
|
|
1748
2824
|
data: number;
|
|
1749
|
-
driverParam: number;
|
|
2825
|
+
driverParam: string | number;
|
|
1750
2826
|
notNull: true;
|
|
1751
|
-
hasDefault:
|
|
1752
|
-
isPrimaryKey:
|
|
2827
|
+
hasDefault: false;
|
|
2828
|
+
isPrimaryKey: false;
|
|
1753
2829
|
isAutoincrement: false;
|
|
1754
2830
|
hasRuntimeDefault: false;
|
|
1755
2831
|
enumValues: undefined;
|
|
@@ -1757,9 +2833,16 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1757
2833
|
identity: undefined;
|
|
1758
2834
|
generated: undefined;
|
|
1759
2835
|
}, {}, {}>;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2836
|
+
};
|
|
2837
|
+
dialect: "pg";
|
|
2838
|
+
}>;
|
|
2839
|
+
declare const obligationCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2840
|
+
name: "obligation_collaterals";
|
|
2841
|
+
schema: "router_v1.4";
|
|
2842
|
+
columns: {
|
|
2843
|
+
obligationId: drizzle_orm_pg_core.PgColumn<{
|
|
2844
|
+
name: "obligation_id";
|
|
2845
|
+
tableName: "obligation_collaterals";
|
|
1763
2846
|
dataType: "string";
|
|
1764
2847
|
columnType: "PgVarchar";
|
|
1765
2848
|
data: string;
|
|
@@ -1776,12 +2859,12 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1776
2859
|
}, {}, {
|
|
1777
2860
|
length: 66;
|
|
1778
2861
|
}>;
|
|
1779
|
-
|
|
1780
|
-
name: "
|
|
1781
|
-
tableName: "
|
|
2862
|
+
asset: drizzle_orm_pg_core.PgColumn<{
|
|
2863
|
+
name: "asset";
|
|
2864
|
+
tableName: "obligation_collaterals";
|
|
1782
2865
|
dataType: "string";
|
|
1783
|
-
columnType: "
|
|
1784
|
-
data:
|
|
2866
|
+
columnType: "PgVarchar";
|
|
2867
|
+
data: string;
|
|
1785
2868
|
driverParam: string;
|
|
1786
2869
|
notNull: true;
|
|
1787
2870
|
hasDefault: false;
|
|
@@ -1793,34 +2876,36 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1793
2876
|
identity: undefined;
|
|
1794
2877
|
generated: undefined;
|
|
1795
2878
|
}, {}, {
|
|
1796
|
-
|
|
2879
|
+
length: 42;
|
|
1797
2880
|
}>;
|
|
1798
|
-
|
|
1799
|
-
name: "
|
|
1800
|
-
tableName: "
|
|
1801
|
-
dataType: "
|
|
1802
|
-
columnType: "
|
|
1803
|
-
data:
|
|
1804
|
-
driverParam:
|
|
1805
|
-
notNull:
|
|
2881
|
+
oracle: drizzle_orm_pg_core.PgColumn<{
|
|
2882
|
+
name: "oracle";
|
|
2883
|
+
tableName: "obligation_collaterals";
|
|
2884
|
+
dataType: "string";
|
|
2885
|
+
columnType: "PgVarchar";
|
|
2886
|
+
data: string;
|
|
2887
|
+
driverParam: string;
|
|
2888
|
+
notNull: true;
|
|
1806
2889
|
hasDefault: false;
|
|
1807
2890
|
isPrimaryKey: false;
|
|
1808
2891
|
isAutoincrement: false;
|
|
1809
2892
|
hasRuntimeDefault: false;
|
|
1810
|
-
enumValues:
|
|
2893
|
+
enumValues: [string, ...string[]];
|
|
1811
2894
|
baseColumn: never;
|
|
1812
2895
|
identity: undefined;
|
|
1813
2896
|
generated: undefined;
|
|
1814
|
-
}, {}, {
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
2897
|
+
}, {}, {
|
|
2898
|
+
length: 42;
|
|
2899
|
+
}>;
|
|
2900
|
+
lltv: drizzle_orm_pg_core.PgColumn<{
|
|
2901
|
+
name: "lltv";
|
|
2902
|
+
tableName: "obligation_collaterals";
|
|
2903
|
+
dataType: "bigint";
|
|
2904
|
+
columnType: "PgBigInt64";
|
|
2905
|
+
data: bigint;
|
|
1821
2906
|
driverParam: string;
|
|
1822
2907
|
notNull: true;
|
|
1823
|
-
hasDefault:
|
|
2908
|
+
hasDefault: false;
|
|
1824
2909
|
isPrimaryKey: false;
|
|
1825
2910
|
isAutoincrement: false;
|
|
1826
2911
|
hasRuntimeDefault: false;
|
|
@@ -1834,7 +2919,7 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1834
2919
|
}>;
|
|
1835
2920
|
declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1836
2921
|
name: "consumed_per_user_and_nonce";
|
|
1837
|
-
schema: "router_v1.
|
|
2922
|
+
schema: "router_v1.4";
|
|
1838
2923
|
columns: {
|
|
1839
2924
|
id: drizzle_orm_pg_core.PgColumn<{
|
|
1840
2925
|
name: "id";
|
|
@@ -1925,6 +3010,23 @@ declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1925
3010
|
identity: undefined;
|
|
1926
3011
|
generated: undefined;
|
|
1927
3012
|
}, {}, {}>;
|
|
3013
|
+
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
3014
|
+
name: "block_number";
|
|
3015
|
+
tableName: "consumed_per_user_and_nonce";
|
|
3016
|
+
dataType: "number";
|
|
3017
|
+
columnType: "PgBigInt53";
|
|
3018
|
+
data: number;
|
|
3019
|
+
driverParam: string | number;
|
|
3020
|
+
notNull: true;
|
|
3021
|
+
hasDefault: false;
|
|
3022
|
+
isPrimaryKey: false;
|
|
3023
|
+
isAutoincrement: false;
|
|
3024
|
+
hasRuntimeDefault: false;
|
|
3025
|
+
enumValues: undefined;
|
|
3026
|
+
baseColumn: never;
|
|
3027
|
+
identity: undefined;
|
|
3028
|
+
generated: undefined;
|
|
3029
|
+
}, {}, {}>;
|
|
1928
3030
|
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1929
3031
|
name: "created_at";
|
|
1930
3032
|
tableName: "consumed_per_user_and_nonce";
|
|
@@ -1945,13 +3047,13 @@ declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1945
3047
|
};
|
|
1946
3048
|
dialect: "pg";
|
|
1947
3049
|
}>;
|
|
1948
|
-
declare const
|
|
1949
|
-
name: "
|
|
1950
|
-
schema: "router_v1.
|
|
3050
|
+
declare const collectors: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3051
|
+
name: "collectors";
|
|
3052
|
+
schema: "router_v1.4";
|
|
1951
3053
|
columns: {
|
|
1952
3054
|
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
1953
3055
|
name: "chain_id";
|
|
1954
|
-
tableName: "
|
|
3056
|
+
tableName: "collectors";
|
|
1955
3057
|
dataType: "bigint";
|
|
1956
3058
|
columnType: "PgBigInt64";
|
|
1957
3059
|
data: bigint;
|
|
@@ -1968,10 +3070,10 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1968
3070
|
}, {}, {}>;
|
|
1969
3071
|
name: drizzle_orm_pg_core.PgColumn<{
|
|
1970
3072
|
name: "name";
|
|
1971
|
-
tableName: "
|
|
3073
|
+
tableName: "collectors";
|
|
1972
3074
|
dataType: "string";
|
|
1973
3075
|
columnType: "PgText";
|
|
1974
|
-
data:
|
|
3076
|
+
data: "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "buy_vault_v1_callback_liquidity" | "sell_erc20_callback_liquidity";
|
|
1975
3077
|
driverParam: string;
|
|
1976
3078
|
notNull: true;
|
|
1977
3079
|
hasDefault: false;
|
|
@@ -1982,10 +3084,12 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1982
3084
|
baseColumn: never;
|
|
1983
3085
|
identity: undefined;
|
|
1984
3086
|
generated: undefined;
|
|
1985
|
-
}, {}, {
|
|
3087
|
+
}, {}, {
|
|
3088
|
+
$type: "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "buy_vault_v1_callback_liquidity" | "sell_erc20_callback_liquidity";
|
|
3089
|
+
}>;
|
|
1986
3090
|
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
1987
3091
|
name: "block_number";
|
|
1988
|
-
tableName: "
|
|
3092
|
+
tableName: "collectors";
|
|
1989
3093
|
dataType: "number";
|
|
1990
3094
|
columnType: "PgBigInt53";
|
|
1991
3095
|
data: number;
|
|
@@ -2000,9 +3104,26 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2000
3104
|
identity: undefined;
|
|
2001
3105
|
generated: undefined;
|
|
2002
3106
|
}, {}, {}>;
|
|
3107
|
+
epoch: drizzle_orm_pg_core.PgColumn<{
|
|
3108
|
+
name: "epoch";
|
|
3109
|
+
tableName: "collectors";
|
|
3110
|
+
dataType: "string";
|
|
3111
|
+
columnType: "PgNumeric";
|
|
3112
|
+
data: string;
|
|
3113
|
+
driverParam: string;
|
|
3114
|
+
notNull: true;
|
|
3115
|
+
hasDefault: true;
|
|
3116
|
+
isPrimaryKey: false;
|
|
3117
|
+
isAutoincrement: false;
|
|
3118
|
+
hasRuntimeDefault: false;
|
|
3119
|
+
enumValues: undefined;
|
|
3120
|
+
baseColumn: never;
|
|
3121
|
+
identity: undefined;
|
|
3122
|
+
generated: undefined;
|
|
3123
|
+
}, {}, {}>;
|
|
2003
3124
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2004
3125
|
name: "updated_at";
|
|
2005
|
-
tableName: "
|
|
3126
|
+
tableName: "collectors";
|
|
2006
3127
|
dataType: "date";
|
|
2007
3128
|
columnType: "PgTimestamp";
|
|
2008
3129
|
data: Date;
|
|
@@ -2020,38 +3141,53 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2020
3141
|
};
|
|
2021
3142
|
dialect: "pg";
|
|
2022
3143
|
}>;
|
|
2023
|
-
declare const
|
|
2024
|
-
name: "
|
|
2025
|
-
schema: "router_v1.
|
|
3144
|
+
declare const chains: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3145
|
+
name: "chains";
|
|
3146
|
+
schema: "router_v1.4";
|
|
2026
3147
|
columns: {
|
|
2027
|
-
|
|
2028
|
-
name: "
|
|
2029
|
-
tableName: "
|
|
2030
|
-
dataType: "
|
|
2031
|
-
columnType: "
|
|
2032
|
-
data:
|
|
3148
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
3149
|
+
name: "chain_id";
|
|
3150
|
+
tableName: "chains";
|
|
3151
|
+
dataType: "bigint";
|
|
3152
|
+
columnType: "PgBigInt64";
|
|
3153
|
+
data: bigint;
|
|
2033
3154
|
driverParam: string;
|
|
2034
3155
|
notNull: true;
|
|
2035
3156
|
hasDefault: false;
|
|
2036
|
-
isPrimaryKey:
|
|
3157
|
+
isPrimaryKey: false;
|
|
2037
3158
|
isAutoincrement: false;
|
|
2038
3159
|
hasRuntimeDefault: false;
|
|
2039
|
-
enumValues:
|
|
3160
|
+
enumValues: undefined;
|
|
2040
3161
|
baseColumn: never;
|
|
2041
3162
|
identity: undefined;
|
|
2042
3163
|
generated: undefined;
|
|
2043
|
-
}, {}, {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
3164
|
+
}, {}, {}>;
|
|
3165
|
+
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
3166
|
+
name: "block_number";
|
|
3167
|
+
tableName: "chains";
|
|
3168
|
+
dataType: "number";
|
|
3169
|
+
columnType: "PgBigInt53";
|
|
3170
|
+
data: number;
|
|
3171
|
+
driverParam: string | number;
|
|
3172
|
+
notNull: true;
|
|
3173
|
+
hasDefault: false;
|
|
3174
|
+
isPrimaryKey: false;
|
|
3175
|
+
isAutoincrement: false;
|
|
3176
|
+
hasRuntimeDefault: false;
|
|
3177
|
+
enumValues: undefined;
|
|
3178
|
+
baseColumn: never;
|
|
3179
|
+
identity: undefined;
|
|
3180
|
+
generated: undefined;
|
|
3181
|
+
}, {}, {}>;
|
|
3182
|
+
epoch: drizzle_orm_pg_core.PgColumn<{
|
|
3183
|
+
name: "epoch";
|
|
3184
|
+
tableName: "chains";
|
|
2049
3185
|
dataType: "string";
|
|
2050
3186
|
columnType: "PgNumeric";
|
|
2051
3187
|
data: string;
|
|
2052
3188
|
driverParam: string;
|
|
2053
3189
|
notNull: true;
|
|
2054
|
-
hasDefault:
|
|
3190
|
+
hasDefault: true;
|
|
2055
3191
|
isPrimaryKey: false;
|
|
2056
3192
|
isAutoincrement: false;
|
|
2057
3193
|
hasRuntimeDefault: false;
|
|
@@ -2062,7 +3198,7 @@ declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2062
3198
|
}, {}, {}>;
|
|
2063
3199
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2064
3200
|
name: "updated_at";
|
|
2065
|
-
tableName: "
|
|
3201
|
+
tableName: "chains";
|
|
2066
3202
|
dataType: "date";
|
|
2067
3203
|
columnType: "PgTimestamp";
|
|
2068
3204
|
data: Date;
|
|
@@ -2080,13 +3216,13 @@ declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2080
3216
|
};
|
|
2081
3217
|
dialect: "pg";
|
|
2082
3218
|
}>;
|
|
2083
|
-
declare const
|
|
2084
|
-
name: "
|
|
2085
|
-
schema: "router_v1.
|
|
3219
|
+
declare const offerLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3220
|
+
name: "offer_liquidity_pools";
|
|
3221
|
+
schema: "router_v1.4";
|
|
2086
3222
|
columns: {
|
|
2087
|
-
|
|
2088
|
-
name: "
|
|
2089
|
-
tableName: "
|
|
3223
|
+
offerHash: drizzle_orm_pg_core.PgColumn<{
|
|
3224
|
+
name: "offer_hash";
|
|
3225
|
+
tableName: "offer_liquidity_pools";
|
|
2090
3226
|
dataType: "string";
|
|
2091
3227
|
columnType: "PgVarchar";
|
|
2092
3228
|
data: string;
|
|
@@ -2101,11 +3237,11 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2101
3237
|
identity: undefined;
|
|
2102
3238
|
generated: undefined;
|
|
2103
3239
|
}, {}, {
|
|
2104
|
-
length:
|
|
3240
|
+
length: 66;
|
|
2105
3241
|
}>;
|
|
2106
|
-
|
|
2107
|
-
name: "
|
|
2108
|
-
tableName: "
|
|
3242
|
+
poolId: drizzle_orm_pg_core.PgColumn<{
|
|
3243
|
+
name: "pool_id";
|
|
3244
|
+
tableName: "offer_liquidity_pools";
|
|
2109
3245
|
dataType: "string";
|
|
2110
3246
|
columnType: "PgVarchar";
|
|
2111
3247
|
data: string;
|
|
@@ -2122,32 +3258,15 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2122
3258
|
}, {}, {
|
|
2123
3259
|
length: 255;
|
|
2124
3260
|
}>;
|
|
2125
|
-
|
|
2126
|
-
name: "
|
|
2127
|
-
tableName: "
|
|
2128
|
-
dataType: "number";
|
|
2129
|
-
columnType: "PgInteger";
|
|
2130
|
-
data: number;
|
|
2131
|
-
driverParam: string | number;
|
|
2132
|
-
notNull: true;
|
|
2133
|
-
hasDefault: false;
|
|
2134
|
-
isPrimaryKey: false;
|
|
2135
|
-
isAutoincrement: false;
|
|
2136
|
-
hasRuntimeDefault: false;
|
|
2137
|
-
enumValues: undefined;
|
|
2138
|
-
baseColumn: never;
|
|
2139
|
-
identity: undefined;
|
|
2140
|
-
generated: undefined;
|
|
2141
|
-
}, {}, {}>;
|
|
2142
|
-
callbackAmount: drizzle_orm_pg_core.PgColumn<{
|
|
2143
|
-
name: "callback_amount";
|
|
2144
|
-
tableName: "available_liquidity_queues";
|
|
3261
|
+
amount: drizzle_orm_pg_core.PgColumn<{
|
|
3262
|
+
name: "amount";
|
|
3263
|
+
tableName: "offer_liquidity_pools";
|
|
2145
3264
|
dataType: "string";
|
|
2146
3265
|
columnType: "PgNumeric";
|
|
2147
3266
|
data: string;
|
|
2148
3267
|
driverParam: string;
|
|
2149
3268
|
notNull: true;
|
|
2150
|
-
hasDefault:
|
|
3269
|
+
hasDefault: false;
|
|
2151
3270
|
isPrimaryKey: false;
|
|
2152
3271
|
isAutoincrement: false;
|
|
2153
3272
|
hasRuntimeDefault: false;
|
|
@@ -2158,7 +3277,7 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2158
3277
|
}, {}, {}>;
|
|
2159
3278
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2160
3279
|
name: "updated_at";
|
|
2161
|
-
tableName: "
|
|
3280
|
+
tableName: "offer_liquidity_pools";
|
|
2162
3281
|
dataType: "date";
|
|
2163
3282
|
columnType: "PgTimestamp";
|
|
2164
3283
|
data: Date;
|
|
@@ -2176,13 +3295,13 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2176
3295
|
};
|
|
2177
3296
|
dialect: "pg";
|
|
2178
3297
|
}>;
|
|
2179
|
-
declare const
|
|
2180
|
-
name: "
|
|
2181
|
-
schema: "router_v1.
|
|
3298
|
+
declare const liquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3299
|
+
name: "liquidity_pools";
|
|
3300
|
+
schema: "router_v1.4";
|
|
2182
3301
|
columns: {
|
|
2183
3302
|
id: drizzle_orm_pg_core.PgColumn<{
|
|
2184
3303
|
name: "id";
|
|
2185
|
-
tableName: "
|
|
3304
|
+
tableName: "liquidity_pools";
|
|
2186
3305
|
dataType: "string";
|
|
2187
3306
|
columnType: "PgVarchar";
|
|
2188
3307
|
data: string;
|
|
@@ -2199,11 +3318,11 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2199
3318
|
}, {}, {
|
|
2200
3319
|
length: 255;
|
|
2201
3320
|
}>;
|
|
2202
|
-
|
|
2203
|
-
name: "
|
|
2204
|
-
tableName: "
|
|
3321
|
+
amount: drizzle_orm_pg_core.PgColumn<{
|
|
3322
|
+
name: "amount";
|
|
3323
|
+
tableName: "liquidity_pools";
|
|
2205
3324
|
dataType: "string";
|
|
2206
|
-
columnType: "
|
|
3325
|
+
columnType: "PgNumeric";
|
|
2207
3326
|
data: string;
|
|
2208
3327
|
driverParam: string;
|
|
2209
3328
|
notNull: true;
|
|
@@ -2211,16 +3330,38 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2211
3330
|
isPrimaryKey: false;
|
|
2212
3331
|
isAutoincrement: false;
|
|
2213
3332
|
hasRuntimeDefault: false;
|
|
2214
|
-
enumValues:
|
|
3333
|
+
enumValues: undefined;
|
|
2215
3334
|
baseColumn: never;
|
|
2216
3335
|
identity: undefined;
|
|
2217
3336
|
generated: undefined;
|
|
2218
|
-
}, {}, {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
3337
|
+
}, {}, {}>;
|
|
3338
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
3339
|
+
name: "updated_at";
|
|
3340
|
+
tableName: "liquidity_pools";
|
|
3341
|
+
dataType: "date";
|
|
3342
|
+
columnType: "PgTimestamp";
|
|
3343
|
+
data: Date;
|
|
3344
|
+
driverParam: string;
|
|
3345
|
+
notNull: true;
|
|
3346
|
+
hasDefault: true;
|
|
3347
|
+
isPrimaryKey: false;
|
|
3348
|
+
isAutoincrement: false;
|
|
3349
|
+
hasRuntimeDefault: false;
|
|
3350
|
+
enumValues: undefined;
|
|
3351
|
+
baseColumn: never;
|
|
3352
|
+
identity: undefined;
|
|
3353
|
+
generated: undefined;
|
|
3354
|
+
}, {}, {}>;
|
|
3355
|
+
};
|
|
3356
|
+
dialect: "pg";
|
|
3357
|
+
}>;
|
|
3358
|
+
declare const liquidityLinks: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3359
|
+
name: "liquidity_links";
|
|
3360
|
+
schema: "router_v1.4";
|
|
3361
|
+
columns: {
|
|
3362
|
+
parentPoolId: drizzle_orm_pg_core.PgColumn<{
|
|
3363
|
+
name: "parent_pool_id";
|
|
3364
|
+
tableName: "liquidity_links";
|
|
2224
3365
|
dataType: "string";
|
|
2225
3366
|
columnType: "PgVarchar";
|
|
2226
3367
|
data: string;
|
|
@@ -2237,30 +3378,32 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2237
3378
|
}, {}, {
|
|
2238
3379
|
length: 255;
|
|
2239
3380
|
}>;
|
|
2240
|
-
|
|
2241
|
-
name: "
|
|
2242
|
-
tableName: "
|
|
2243
|
-
dataType: "
|
|
2244
|
-
columnType: "
|
|
2245
|
-
data:
|
|
3381
|
+
childPoolId: drizzle_orm_pg_core.PgColumn<{
|
|
3382
|
+
name: "child_pool_id";
|
|
3383
|
+
tableName: "liquidity_links";
|
|
3384
|
+
dataType: "string";
|
|
3385
|
+
columnType: "PgVarchar";
|
|
3386
|
+
data: string;
|
|
2246
3387
|
driverParam: string;
|
|
2247
3388
|
notNull: true;
|
|
2248
3389
|
hasDefault: false;
|
|
2249
3390
|
isPrimaryKey: false;
|
|
2250
3391
|
isAutoincrement: false;
|
|
2251
3392
|
hasRuntimeDefault: false;
|
|
2252
|
-
enumValues:
|
|
3393
|
+
enumValues: [string, ...string[]];
|
|
2253
3394
|
baseColumn: never;
|
|
2254
3395
|
identity: undefined;
|
|
2255
3396
|
generated: undefined;
|
|
2256
|
-
}, {}, {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
3397
|
+
}, {}, {
|
|
3398
|
+
length: 255;
|
|
3399
|
+
}>;
|
|
3400
|
+
priority: drizzle_orm_pg_core.PgColumn<{
|
|
3401
|
+
name: "priority";
|
|
3402
|
+
tableName: "liquidity_links";
|
|
3403
|
+
dataType: "number";
|
|
3404
|
+
columnType: "PgInteger";
|
|
3405
|
+
data: number;
|
|
3406
|
+
driverParam: string | number;
|
|
2264
3407
|
notNull: true;
|
|
2265
3408
|
hasDefault: false;
|
|
2266
3409
|
isPrimaryKey: false;
|
|
@@ -2273,7 +3416,7 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2273
3416
|
}, {}, {}>;
|
|
2274
3417
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2275
3418
|
name: "updated_at";
|
|
2276
|
-
tableName: "
|
|
3419
|
+
tableName: "liquidity_links";
|
|
2277
3420
|
dataType: "date";
|
|
2278
3421
|
columnType: "PgTimestamp";
|
|
2279
3422
|
data: Date;
|
|
@@ -2293,16 +3436,102 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2293
3436
|
}>;
|
|
2294
3437
|
|
|
2295
3438
|
declare const schema_VERSION: typeof VERSION;
|
|
2296
|
-
declare const
|
|
2297
|
-
declare const
|
|
2298
|
-
declare const schema_collectorBlockNumbers: typeof collectorBlockNumbers;
|
|
3439
|
+
declare const schema_chains: typeof chains;
|
|
3440
|
+
declare const schema_collectors: typeof collectors;
|
|
2299
3441
|
declare const schema_consumed: typeof consumed;
|
|
2300
|
-
declare const
|
|
2301
|
-
declare const
|
|
3442
|
+
declare const schema_liquidityLinks: typeof liquidityLinks;
|
|
3443
|
+
declare const schema_liquidityPools: typeof liquidityPools;
|
|
3444
|
+
declare const schema_obligationCollaterals: typeof obligationCollaterals;
|
|
3445
|
+
declare const schema_obligations: typeof obligations;
|
|
3446
|
+
declare const schema_offerLiquidityPools: typeof offerLiquidityPools;
|
|
2302
3447
|
declare const schema_offers: typeof offers;
|
|
2303
|
-
declare const schema_userPositions: typeof userPositions;
|
|
2304
3448
|
declare namespace schema {
|
|
2305
|
-
export { schema_VERSION as VERSION,
|
|
3449
|
+
export { schema_VERSION as VERSION, schema_chains as chains, schema_collectors as collectors, schema_consumed as consumed, schema_liquidityLinks as liquidityLinks, schema_liquidityPools as liquidityPools, schema_obligationCollaterals as obligationCollaterals, schema_obligations as obligations, schema_offerLiquidityPools as offerLiquidityPools, schema_offers as offers };
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
declare function max$1(a: bigint, b: bigint): bigint;
|
|
3453
|
+
declare function min(a: bigint, b: bigint): bigint;
|
|
3454
|
+
|
|
3455
|
+
/**
|
|
3456
|
+
* Splits an array into batches of a specified size.
|
|
3457
|
+
* @param array The array to split.
|
|
3458
|
+
* @param batchSize The size of each batch.
|
|
3459
|
+
* @returns An iterator that yields each batch.
|
|
3460
|
+
* @example
|
|
3461
|
+
* ```typescript
|
|
3462
|
+
* const array = [1, 2, 3, 4, 5];
|
|
3463
|
+
* for (const batch of batch(array, 2)) {
|
|
3464
|
+
* console.log(batch);
|
|
3465
|
+
* }
|
|
3466
|
+
* // Output:
|
|
3467
|
+
* // [1, 2]
|
|
3468
|
+
* // [3, 4]
|
|
3469
|
+
* // [5]
|
|
3470
|
+
* ```
|
|
3471
|
+
*/
|
|
3472
|
+
declare function batch<T>(array: Array<T>, batchSize: number): Generator<T[], void, unknown>;
|
|
3473
|
+
|
|
3474
|
+
/**
|
|
3475
|
+
* Helper function to execute multicall in batches with retry logic.
|
|
3476
|
+
* Abstracts the common pattern of batching calls, retrying, and collecting results.
|
|
3477
|
+
*
|
|
3478
|
+
* @param parameters - Configuration for batched multicall
|
|
3479
|
+
* @returns Promise resolving to flattened array of results
|
|
3480
|
+
*/
|
|
3481
|
+
declare function batchMulticall<TResult>(parameters: {
|
|
3482
|
+
client: Pick<PublicActions, "multicall">;
|
|
3483
|
+
calls: unknown[];
|
|
3484
|
+
batchSize: number;
|
|
3485
|
+
retryAttempts: number;
|
|
3486
|
+
retryDelayMs: number;
|
|
3487
|
+
blockNumber?: bigint;
|
|
3488
|
+
}): Promise<TResult[]>;
|
|
3489
|
+
|
|
3490
|
+
/**
|
|
3491
|
+
* Transform a polling function into an async generator.
|
|
3492
|
+
* @param fn - The polling function to transform.
|
|
3493
|
+
* @returns An async generator.
|
|
3494
|
+
*/
|
|
3495
|
+
declare function lazy<T>(pollFn: (emit: (value: T) => void, { stop }: {
|
|
3496
|
+
stop: () => void;
|
|
3497
|
+
}) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
|
|
3498
|
+
|
|
3499
|
+
/**
|
|
3500
|
+
* Polls a function at a specified interval.
|
|
3501
|
+
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
3502
|
+
*/
|
|
3503
|
+
declare function poll<data>(fn: ({ unpoll }: {
|
|
3504
|
+
unpoll: () => void;
|
|
3505
|
+
}) => Promise<data | undefined>, { interval }: {
|
|
3506
|
+
interval: number;
|
|
3507
|
+
}): () => boolean;
|
|
3508
|
+
|
|
3509
|
+
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
3510
|
+
|
|
3511
|
+
declare function now(): number;
|
|
3512
|
+
declare function max(): number;
|
|
3513
|
+
|
|
3514
|
+
declare const time_max: typeof max;
|
|
3515
|
+
declare const time_now: typeof now;
|
|
3516
|
+
declare namespace time {
|
|
3517
|
+
export { time_max as max, time_now as now };
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
declare function wait(time: number): Promise<unknown>;
|
|
3521
|
+
|
|
3522
|
+
type index_BaseError<cause extends Error | undefined = undefined> = BaseError<cause>;
|
|
3523
|
+
declare const index_BaseError: typeof BaseError;
|
|
3524
|
+
type index_GlobalErrorType<name extends string = "Error"> = GlobalErrorType<name>;
|
|
3525
|
+
type index_Snake<T> = Snake<T>;
|
|
3526
|
+
declare const index_batch: typeof batch;
|
|
3527
|
+
declare const index_batchMulticall: typeof batchMulticall;
|
|
3528
|
+
declare const index_lazy: typeof lazy;
|
|
3529
|
+
declare const index_min: typeof min;
|
|
3530
|
+
declare const index_poll: typeof poll;
|
|
3531
|
+
declare const index_retry: typeof retry;
|
|
3532
|
+
declare const index_wait: typeof wait;
|
|
3533
|
+
declare namespace index {
|
|
3534
|
+
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$2 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 };
|
|
2306
3535
|
}
|
|
2307
3536
|
|
|
2308
|
-
export { Callback,
|
|
3537
|
+
export { Abi, type Brand, BrandTypeId, Callback, Chain$1 as Chain, ChainHealth, ChainStore$1 as ChainStore, ChainsHealthResponse, Collateral$1 as Collateral, index$4 as Collector, CollectorHealth, CollectorStore$1 as CollectorStore, CollectorsHealthResponse, type Compute, Cursor$1 as Cursor, EVM, 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, index$2 as RouterApi, Client$2 as RouterClient, RouterIndexer, RouterStatusResponse, Services$1 as Services, time as Time, index as Utils, Validation, ValidationRule, parse, safeParse };
|