@morpho-dev/router 0.1.12 → 0.1.16
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 +6041 -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 +2380 -1328
- package/dist/index.node.d.ts +2380 -1328
- package/dist/index.node.js +5744 -3514
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +5703 -3513
- package/dist/index.node.mjs.map +1 -1
- package/package.json +20 -16
- 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 } 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_CXzxKPFp_js from 'node_modules/zod-openapi/dist/components-CXzxKPFp.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;
|
|
34
385
|
};
|
|
35
|
-
declare const
|
|
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;
|
|
554
|
+
};
|
|
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
|
-
|
|
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 };
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
declare const OpenApi: node_modules_zod_openapi_dist_components_DkyUTLcs_js.OpenAPIObject;
|
|
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();
|
|
754
|
+
}
|
|
154
755
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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>;
|
|
216
|
-
};
|
|
217
|
-
type Action = keyof typeof schemas;
|
|
218
|
-
declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
|
|
219
|
-
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
|
|
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
|
+
}
|
|
220
777
|
|
|
221
|
-
type OfferResponse = {
|
|
222
|
-
offer: Offer.Offer;
|
|
223
|
-
consumed: bigint;
|
|
224
|
-
status: OfferStatus;
|
|
225
|
-
metadata?: OfferMetadata;
|
|
226
|
-
};
|
|
227
778
|
/**
|
|
228
|
-
*
|
|
229
|
-
* @param routerOffer - The router offer to transform.
|
|
230
|
-
* @returns The router offer response with offer as a nested property.
|
|
779
|
+
* Represents a liquidity pool with a unique ID and amount.
|
|
231
780
|
*/
|
|
232
|
-
|
|
781
|
+
type LiquidityPool = {
|
|
782
|
+
id: string;
|
|
783
|
+
amount: bigint;
|
|
784
|
+
};
|
|
233
785
|
/**
|
|
234
|
-
*
|
|
235
|
-
* @param offerResponse - The router offer response to transform.
|
|
236
|
-
* @returns The router offer with all properties at the top level.
|
|
786
|
+
* Represents a hierarchical relationship between two liquidity pools.
|
|
237
787
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
creators?: string[];
|
|
243
|
-
/** Filter by offer type: buy offers or sell offers */
|
|
244
|
-
side?: "buy" | "sell";
|
|
245
|
-
/** Filter by multiple blockchain networks (comma-separated chain IDs) */
|
|
246
|
-
chains?: number[];
|
|
247
|
-
/** Filter by multiple loan assets (comma-separated) */
|
|
248
|
-
loanTokens?: string[];
|
|
249
|
-
/** Filter by multiple statuses (comma-separated) */
|
|
250
|
-
status?: OfferStatus[];
|
|
251
|
-
/** Filter by multiple callback addresses (comma-separated) */
|
|
252
|
-
callbackAddresses?: string[];
|
|
253
|
-
/** Minimum amount of assets in the offer */
|
|
254
|
-
minAmount?: bigint;
|
|
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;
|
|
788
|
+
type LiquidityLink = {
|
|
789
|
+
parentPoolId: string;
|
|
790
|
+
childPoolId: string;
|
|
791
|
+
priority: number;
|
|
321
792
|
};
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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;
|
|
325
807
|
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
808
|
+
/**
|
|
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.
|
|
881
|
+
*/
|
|
882
|
+
declare function generateVaultPositionPoolId(parameters: {
|
|
883
|
+
vault: Address;
|
|
884
|
+
chainId: bigint;
|
|
885
|
+
marketId: string;
|
|
886
|
+
}): string;
|
|
887
|
+
/**
|
|
888
|
+
* Generate pool ID for market total liquidity.
|
|
889
|
+
*/
|
|
890
|
+
declare function generateMarketLiquidityPoolId(parameters: {
|
|
891
|
+
chainId: bigint;
|
|
892
|
+
marketId: string;
|
|
893
|
+
}): string;
|
|
894
|
+
|
|
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 };
|
|
1074
|
+
}
|
|
1075
|
+
|
|
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.*/
|
|
1092
|
+
saveBlockNumber: (parameters: {
|
|
1093
|
+
chainId: Id;
|
|
1094
|
+
blockNumber: number;
|
|
1095
|
+
epoch: bigint;
|
|
1096
|
+
}) => Promise<void>;
|
|
1097
|
+
};
|
|
1098
|
+
/** Postgres implementation. */
|
|
1099
|
+
declare const create$6: (config: {
|
|
1100
|
+
db: PG;
|
|
1101
|
+
}) => ChainStore;
|
|
1102
|
+
|
|
1103
|
+
type ChainStore$1_ChainStore = ChainStore;
|
|
1104
|
+
declare namespace ChainStore$1 {
|
|
1105
|
+
export { type ChainStore$1_ChainStore as ChainStore, create$6 as create };
|
|
507
1106
|
}
|
|
508
1107
|
|
|
509
|
-
type
|
|
510
|
-
/** Get the latest block number processed by a collector for a given chain. */
|
|
1108
|
+
type CollectorStore = {
|
|
1109
|
+
/** Get the latest block number processed by a collector for a given chain alongside the epoch. */
|
|
511
1110
|
getBlockNumber: (parameters: {
|
|
512
1111
|
collectorName: Name;
|
|
513
|
-
chainId:
|
|
514
|
-
}) => Promise<
|
|
515
|
-
|
|
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.*/
|
|
516
1131
|
saveBlockNumber: (parameters: {
|
|
517
1132
|
collectorName: Name;
|
|
518
|
-
chainId:
|
|
1133
|
+
chainId: Id;
|
|
519
1134
|
blockNumber: number;
|
|
1135
|
+
epoch: bigint;
|
|
520
1136
|
}) => Promise<void>;
|
|
521
1137
|
};
|
|
522
1138
|
/** Postgres implementation. */
|
|
523
|
-
declare const create$
|
|
1139
|
+
declare const create$5: (config: {
|
|
524
1140
|
db: PG;
|
|
525
|
-
}) =>
|
|
526
|
-
declare function memory$1(): CollectorBlockStore;
|
|
1141
|
+
}) => CollectorStore;
|
|
527
1142
|
|
|
528
|
-
type
|
|
529
|
-
declare namespace
|
|
530
|
-
export { type
|
|
1143
|
+
type CollectorStore$1_CollectorStore = CollectorStore;
|
|
1144
|
+
declare namespace CollectorStore$1 {
|
|
1145
|
+
export { type CollectorStore$1_CollectorStore as CollectorStore, create$5 as create };
|
|
531
1146
|
}
|
|
532
1147
|
|
|
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
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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[]>;
|
|
1148
|
+
type LiquidityStore = {
|
|
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
|
+
*/
|
|
1175
|
+
save: (parameters: {
|
|
1176
|
+
pools: LiquidityPool[];
|
|
1177
|
+
links: LiquidityLink[];
|
|
1178
|
+
offerPools: OfferLiquidityPool[];
|
|
1179
|
+
}) => Promise<void>;
|
|
586
1180
|
};
|
|
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;
|
|
1181
|
+
/** Postgres implementation. */
|
|
1182
|
+
declare const create$4: (config: {
|
|
1183
|
+
db: PG;
|
|
1184
|
+
}) => LiquidityStore;
|
|
597
1185
|
|
|
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 };
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
type LiquidityStore = {
|
|
664
|
-
/** Get a liquidity entry by user position id, including queues and pools. */
|
|
665
|
-
getByUserPositionId: (parameters: {
|
|
666
|
-
userPositionId: string;
|
|
667
|
-
}) => Promise<Liquidity | null>;
|
|
668
|
-
/** Get all liquidity entries, grouped by user position, including queues and pools. */
|
|
669
|
-
getAll: (parameters?: {
|
|
670
|
-
callbackType?: CallbackType;
|
|
671
|
-
}) => Promise<Liquidity[]>;
|
|
672
|
-
/** Save or update a liquidity entry (transactional upsert across all three tables). */
|
|
673
|
-
save: (parameters: {
|
|
674
|
-
liquidity: Liquidity;
|
|
675
|
-
}) => Promise<void>;
|
|
676
|
-
};
|
|
677
|
-
/** Postgres implementation. */
|
|
678
|
-
declare const create$1: (config: {
|
|
679
|
-
db: PG;
|
|
680
|
-
}) => LiquidityStore;
|
|
681
|
-
declare function memory(): LiquidityStore;
|
|
682
|
-
|
|
683
|
-
type LiquidityStore$1_LiquidityStore = LiquidityStore;
|
|
684
|
-
declare const LiquidityStore$1_memory: typeof memory;
|
|
685
|
-
declare namespace LiquidityStore$1 {
|
|
686
|
-
export { type LiquidityStore$1_LiquidityStore as LiquidityStore, create$1 as create, LiquidityStore$1_memory as memory };
|
|
1186
|
+
type LiquidityStore$1_LiquidityStore = LiquidityStore;
|
|
1187
|
+
declare namespace LiquidityStore$1 {
|
|
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,778 @@ 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_CXzxKPFp_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
|
+
type MempoolEVMClientConfig = {
|
|
2096
|
+
readonly client: WalletClient;
|
|
2097
|
+
readonly mempoolAddress: Address;
|
|
2098
|
+
readonly blockWindow: number;
|
|
2099
|
+
};
|
|
2100
|
+
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
2101
|
+
declare namespace from {
|
|
2102
|
+
type Parameters = {
|
|
2103
|
+
/** The viem client to use. */
|
|
2104
|
+
client: WalletClient;
|
|
2105
|
+
/** The mempool address. */
|
|
2106
|
+
mempoolAddress: Address;
|
|
2107
|
+
/** The block window to use for the mempool. Defaults to 100. */
|
|
2108
|
+
blockWindow?: number;
|
|
2109
|
+
};
|
|
2110
|
+
type ReturnType = Client;
|
|
2111
|
+
type ErrorType = null;
|
|
2112
|
+
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Add an offer to the mempool.
|
|
2115
|
+
* @returns The created offer with its hash.
|
|
2116
|
+
* @throws WalletAccountNotSetError if the wallet account is not set.
|
|
2117
|
+
* @throws ViemClientError if the viem client throws an error.
|
|
2118
|
+
* @throws Offer.InvalidOfferError if the offer is invalid.
|
|
2119
|
+
*/
|
|
2120
|
+
declare function add(config: MempoolEVMClientConfig, parameters: AddParameters): Promise<{
|
|
2121
|
+
offer: Offer;
|
|
2122
|
+
txHash: Hex;
|
|
2123
|
+
}>;
|
|
2124
|
+
declare namespace add {
|
|
2125
|
+
type ErrorType = WalletAccountNotSetError | ViemClientError | InvalidOfferError | ChainIdMismatchError;
|
|
2126
|
+
}
|
|
2127
|
+
declare function get(config: MempoolEVMClientConfig, parameters?: GetParameters): AsyncGenerator<{
|
|
2128
|
+
offers: Offer[];
|
|
2129
|
+
blockNumber: number;
|
|
2130
|
+
}, void, void>;
|
|
2131
|
+
declare namespace get {
|
|
2132
|
+
type ErrorType = streamOffersReturnType;
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Watch for new offers on a specific chain.
|
|
2136
|
+
* @returns A function to stop watching for new offers.
|
|
2137
|
+
*/
|
|
2138
|
+
declare function watch(config: MempoolEVMClientConfig, parameters: WatchParameters): () => boolean;
|
|
2139
|
+
declare namespace watch {
|
|
2140
|
+
type ErrorType = streamOffersReturnType;
|
|
2141
|
+
}
|
|
2142
|
+
type streamOffersReturnType = WalletAccountNotSetError | ChainIdMismatchError;
|
|
2143
|
+
declare class WalletAccountNotSetError extends BaseError {
|
|
2144
|
+
name: string;
|
|
2145
|
+
constructor();
|
|
2146
|
+
}
|
|
2147
|
+
declare class ViemClientError extends BaseError {
|
|
2148
|
+
name: string;
|
|
2149
|
+
}
|
|
2150
|
+
declare class ChainIdMismatchError extends BaseError {
|
|
2151
|
+
name: string;
|
|
2152
|
+
constructor(expected: bigint, actual: bigint);
|
|
1291
2153
|
}
|
|
1292
2154
|
|
|
2155
|
+
type AddParameters = {
|
|
2156
|
+
offer: Compute<Omit<Offer, "hash" | "createdAt">>;
|
|
2157
|
+
};
|
|
2158
|
+
type GetParameters = {
|
|
2159
|
+
/** The block number to get offers from. */
|
|
2160
|
+
blockNumberGte?: number;
|
|
2161
|
+
/** The block number to get offers to. */
|
|
2162
|
+
blockNumberLte?: number;
|
|
2163
|
+
/** The loan asset to get offers from. */
|
|
2164
|
+
loanToken?: string;
|
|
2165
|
+
/** The order to get offers. Defaults to "desc". */
|
|
2166
|
+
order?: "asc" | "desc";
|
|
2167
|
+
/** The options to get offers from. */
|
|
2168
|
+
options?: {
|
|
2169
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
2170
|
+
maxBatchSize?: number;
|
|
2171
|
+
};
|
|
2172
|
+
};
|
|
2173
|
+
type WatchParameters = {
|
|
2174
|
+
/** The async function to get the last synced block number from which to start watching.
|
|
2175
|
+
* 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.
|
|
2176
|
+
*/
|
|
2177
|
+
lastSyncedBlock: () => Promise<number>;
|
|
2178
|
+
/** The loan asset to watch. */
|
|
2179
|
+
loanToken?: string;
|
|
2180
|
+
/** The callback to call when a new batch of offers is found in the mempool.
|
|
2181
|
+
* @param offers The offers found in the mempool.
|
|
2182
|
+
* @param blockNumber The block number of the last processed offer. Block numbers will always ascend.
|
|
2183
|
+
*/
|
|
2184
|
+
onOffers: (offers: Offer[], blockNumber: number) => Promise<void>;
|
|
2185
|
+
/** The polling configuration. */
|
|
2186
|
+
polling?: {
|
|
2187
|
+
/** The interval in milliseconds to poll for new offers. Defaults to 30000. */
|
|
2188
|
+
interval?: number;
|
|
2189
|
+
/** The maximum number of offers that can be returned in a single batch.
|
|
2190
|
+
* Defaults to 100. Maximum is 1000. */
|
|
2191
|
+
maxBatchSize?: number;
|
|
2192
|
+
};
|
|
2193
|
+
};
|
|
1293
2194
|
/**
|
|
1294
|
-
*
|
|
2195
|
+
* Mempool client interface.
|
|
1295
2196
|
*/
|
|
1296
|
-
type
|
|
1297
|
-
/**
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
2197
|
+
type Client = {
|
|
2198
|
+
/**
|
|
2199
|
+
* Add an offer to the mempool.
|
|
2200
|
+
* @returns The created offer with its hash.
|
|
2201
|
+
*/
|
|
2202
|
+
add: (parameters: AddParameters) => Promise<{
|
|
2203
|
+
offer: Offer;
|
|
2204
|
+
txHash: Hex;
|
|
2205
|
+
}>;
|
|
2206
|
+
/** Get offers from the mempool. */
|
|
2207
|
+
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
2208
|
+
offers: Offer[];
|
|
2209
|
+
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
2210
|
+
blockNumber: number;
|
|
2211
|
+
}>;
|
|
2212
|
+
/**
|
|
2213
|
+
* Watch for new offers on a specific chain.
|
|
2214
|
+
* @returns A function to stop watching for new offers.
|
|
2215
|
+
*/
|
|
2216
|
+
watch: (parameters: WatchParameters) => () => boolean;
|
|
2217
|
+
/**
|
|
2218
|
+
* Stream offers from the mempool.
|
|
2219
|
+
* @returns A generator of offers alongside the last block number processed.
|
|
2220
|
+
*/
|
|
2221
|
+
stream: (parameters: Compute<Omit<GetParameters, "options"> & {
|
|
2222
|
+
options: GetParameters["options"] & {
|
|
2223
|
+
blockWindow?: number;
|
|
2224
|
+
};
|
|
2225
|
+
}>) => AsyncGenerator<{
|
|
2226
|
+
offers: Offer[];
|
|
2227
|
+
blockNumber: number;
|
|
2228
|
+
}>;
|
|
1303
2229
|
};
|
|
1304
2230
|
/**
|
|
1305
|
-
*
|
|
2231
|
+
* Client to interact with the Mempool contract on a specific chain.
|
|
1306
2232
|
*/
|
|
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>>>;
|
|
2233
|
+
declare function connect(parameters: from.Parameters): Client;
|
|
2234
|
+
declare namespace connect {
|
|
2235
|
+
type ErrorType = from.ErrorType;
|
|
2236
|
+
}
|
|
1324
2237
|
|
|
1325
|
-
type
|
|
1326
|
-
type
|
|
1327
|
-
declare const
|
|
1328
|
-
|
|
1329
|
-
|
|
2238
|
+
type index$1_AddParameters = AddParameters;
|
|
2239
|
+
type index$1_ChainIdMismatchError = ChainIdMismatchError;
|
|
2240
|
+
declare const index$1_ChainIdMismatchError: typeof ChainIdMismatchError;
|
|
2241
|
+
type index$1_Client = Client;
|
|
2242
|
+
type index$1_GetParameters = GetParameters;
|
|
2243
|
+
type index$1_ViemClientError = ViemClientError;
|
|
2244
|
+
declare const index$1_ViemClientError: typeof ViemClientError;
|
|
2245
|
+
type index$1_WalletAccountNotSetError = WalletAccountNotSetError;
|
|
2246
|
+
declare const index$1_WalletAccountNotSetError: typeof WalletAccountNotSetError;
|
|
2247
|
+
type index$1_WatchParameters = WatchParameters;
|
|
2248
|
+
declare const index$1_add: typeof add;
|
|
2249
|
+
declare const index$1_connect: typeof connect;
|
|
2250
|
+
declare const index$1_from: typeof from;
|
|
2251
|
+
declare const index$1_get: typeof get;
|
|
2252
|
+
declare const index$1_watch: typeof watch;
|
|
2253
|
+
declare namespace index$1 {
|
|
2254
|
+
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
2255
|
}
|
|
1331
2256
|
|
|
1332
|
-
declare const VERSION = "router_v1.
|
|
2257
|
+
declare const VERSION = "router_v1.4";
|
|
2258
|
+
declare const obligations: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2259
|
+
name: "obligations";
|
|
2260
|
+
schema: "router_v1.4";
|
|
2261
|
+
columns: {
|
|
2262
|
+
obligationId: drizzle_orm_pg_core.PgColumn<{
|
|
2263
|
+
name: "obligation_id";
|
|
2264
|
+
tableName: "obligations";
|
|
2265
|
+
dataType: "string";
|
|
2266
|
+
columnType: "PgVarchar";
|
|
2267
|
+
data: string;
|
|
2268
|
+
driverParam: string;
|
|
2269
|
+
notNull: true;
|
|
2270
|
+
hasDefault: false;
|
|
2271
|
+
isPrimaryKey: true;
|
|
2272
|
+
isAutoincrement: false;
|
|
2273
|
+
hasRuntimeDefault: false;
|
|
2274
|
+
enumValues: [string, ...string[]];
|
|
2275
|
+
baseColumn: never;
|
|
2276
|
+
identity: undefined;
|
|
2277
|
+
generated: undefined;
|
|
2278
|
+
}, {}, {
|
|
2279
|
+
length: 66;
|
|
2280
|
+
}>;
|
|
2281
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
2282
|
+
name: "chain_id";
|
|
2283
|
+
tableName: "obligations";
|
|
2284
|
+
dataType: "bigint";
|
|
2285
|
+
columnType: "PgBigInt64";
|
|
2286
|
+
data: bigint;
|
|
2287
|
+
driverParam: string;
|
|
2288
|
+
notNull: true;
|
|
2289
|
+
hasDefault: false;
|
|
2290
|
+
isPrimaryKey: false;
|
|
2291
|
+
isAutoincrement: false;
|
|
2292
|
+
hasRuntimeDefault: false;
|
|
2293
|
+
enumValues: undefined;
|
|
2294
|
+
baseColumn: never;
|
|
2295
|
+
identity: undefined;
|
|
2296
|
+
generated: undefined;
|
|
2297
|
+
}, {}, {}>;
|
|
2298
|
+
loanToken: drizzle_orm_pg_core.PgColumn<{
|
|
2299
|
+
name: "loan_token";
|
|
2300
|
+
tableName: "obligations";
|
|
2301
|
+
dataType: "string";
|
|
2302
|
+
columnType: "PgVarchar";
|
|
2303
|
+
data: string;
|
|
2304
|
+
driverParam: string;
|
|
2305
|
+
notNull: true;
|
|
2306
|
+
hasDefault: false;
|
|
2307
|
+
isPrimaryKey: false;
|
|
2308
|
+
isAutoincrement: false;
|
|
2309
|
+
hasRuntimeDefault: false;
|
|
2310
|
+
enumValues: [string, ...string[]];
|
|
2311
|
+
baseColumn: never;
|
|
2312
|
+
identity: undefined;
|
|
2313
|
+
generated: undefined;
|
|
2314
|
+
}, {}, {
|
|
2315
|
+
length: 42;
|
|
2316
|
+
}>;
|
|
2317
|
+
maturity: drizzle_orm_pg_core.PgColumn<{
|
|
2318
|
+
name: "maturity";
|
|
2319
|
+
tableName: "obligations";
|
|
2320
|
+
dataType: "number";
|
|
2321
|
+
columnType: "PgInteger";
|
|
2322
|
+
data: number;
|
|
2323
|
+
driverParam: string | number;
|
|
2324
|
+
notNull: true;
|
|
2325
|
+
hasDefault: false;
|
|
2326
|
+
isPrimaryKey: false;
|
|
2327
|
+
isAutoincrement: false;
|
|
2328
|
+
hasRuntimeDefault: false;
|
|
2329
|
+
enumValues: undefined;
|
|
2330
|
+
baseColumn: never;
|
|
2331
|
+
identity: undefined;
|
|
2332
|
+
generated: undefined;
|
|
2333
|
+
}, {}, {}>;
|
|
2334
|
+
};
|
|
2335
|
+
dialect: "pg";
|
|
2336
|
+
}>;
|
|
1333
2337
|
declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1334
2338
|
name: "offers";
|
|
1335
|
-
schema: "router_v1.
|
|
2339
|
+
schema: "router_v1.4";
|
|
1336
2340
|
columns: {
|
|
1337
2341
|
hash: drizzle_orm_pg_core.PgColumn<{
|
|
1338
2342
|
name: "hash";
|
|
@@ -1353,6 +2357,25 @@ declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1353
2357
|
}, {}, {
|
|
1354
2358
|
length: 66;
|
|
1355
2359
|
}>;
|
|
2360
|
+
obligationId: drizzle_orm_pg_core.PgColumn<{
|
|
2361
|
+
name: "obligation_id";
|
|
2362
|
+
tableName: "offers";
|
|
2363
|
+
dataType: "string";
|
|
2364
|
+
columnType: "PgVarchar";
|
|
2365
|
+
data: string;
|
|
2366
|
+
driverParam: string;
|
|
2367
|
+
notNull: true;
|
|
2368
|
+
hasDefault: false;
|
|
2369
|
+
isPrimaryKey: false;
|
|
2370
|
+
isAutoincrement: false;
|
|
2371
|
+
hasRuntimeDefault: false;
|
|
2372
|
+
enumValues: [string, ...string[]];
|
|
2373
|
+
baseColumn: never;
|
|
2374
|
+
identity: undefined;
|
|
2375
|
+
generated: undefined;
|
|
2376
|
+
}, {}, {
|
|
2377
|
+
length: 66;
|
|
2378
|
+
}>;
|
|
1356
2379
|
offering: drizzle_orm_pg_core.PgColumn<{
|
|
1357
2380
|
name: "offering";
|
|
1358
2381
|
tableName: "offers";
|
|
@@ -1568,143 +2591,26 @@ declare const offers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1568
2591
|
tableName: "offers";
|
|
1569
2592
|
dataType: "bigint";
|
|
1570
2593
|
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;
|
|
2594
|
+
data: bigint;
|
|
1687
2595
|
driverParam: string;
|
|
1688
2596
|
notNull: true;
|
|
1689
2597
|
hasDefault: false;
|
|
1690
2598
|
isPrimaryKey: false;
|
|
1691
2599
|
isAutoincrement: false;
|
|
1692
2600
|
hasRuntimeDefault: false;
|
|
1693
|
-
enumValues:
|
|
2601
|
+
enumValues: undefined;
|
|
1694
2602
|
baseColumn: never;
|
|
1695
2603
|
identity: undefined;
|
|
1696
2604
|
generated: undefined;
|
|
1697
|
-
}, {}, {
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
name: "oracle";
|
|
1702
|
-
tableName: "offer_collaterals";
|
|
2605
|
+
}, {}, {}>;
|
|
2606
|
+
signature: drizzle_orm_pg_core.PgColumn<{
|
|
2607
|
+
name: "signature";
|
|
2608
|
+
tableName: "offers";
|
|
1703
2609
|
dataType: "string";
|
|
1704
2610
|
columnType: "PgVarchar";
|
|
1705
2611
|
data: string;
|
|
1706
2612
|
driverParam: string;
|
|
1707
|
-
notNull:
|
|
2613
|
+
notNull: false;
|
|
1708
2614
|
hasDefault: false;
|
|
1709
2615
|
isPrimaryKey: false;
|
|
1710
2616
|
isAutoincrement: false;
|
|
@@ -1714,17 +2620,17 @@ declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1714
2620
|
identity: undefined;
|
|
1715
2621
|
generated: undefined;
|
|
1716
2622
|
}, {}, {
|
|
1717
|
-
length:
|
|
2623
|
+
length: 132;
|
|
1718
2624
|
}>;
|
|
1719
|
-
|
|
1720
|
-
name: "
|
|
1721
|
-
tableName: "
|
|
1722
|
-
dataType: "
|
|
1723
|
-
columnType: "
|
|
1724
|
-
data:
|
|
2625
|
+
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
2626
|
+
name: "created_at";
|
|
2627
|
+
tableName: "offers";
|
|
2628
|
+
dataType: "date";
|
|
2629
|
+
columnType: "PgTimestamp";
|
|
2630
|
+
data: Date;
|
|
1725
2631
|
driverParam: string;
|
|
1726
2632
|
notNull: true;
|
|
1727
|
-
hasDefault:
|
|
2633
|
+
hasDefault: true;
|
|
1728
2634
|
isPrimaryKey: false;
|
|
1729
2635
|
isAutoincrement: false;
|
|
1730
2636
|
hasRuntimeDefault: false;
|
|
@@ -1733,23 +2639,16 @@ declare const offerCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1733
2639
|
identity: undefined;
|
|
1734
2640
|
generated: undefined;
|
|
1735
2641
|
}, {}, {}>;
|
|
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";
|
|
2642
|
+
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
2643
|
+
name: "block_number";
|
|
2644
|
+
tableName: "offers";
|
|
1746
2645
|
dataType: "number";
|
|
1747
|
-
columnType: "
|
|
2646
|
+
columnType: "PgBigInt53";
|
|
1748
2647
|
data: number;
|
|
1749
|
-
driverParam: number;
|
|
2648
|
+
driverParam: string | number;
|
|
1750
2649
|
notNull: true;
|
|
1751
|
-
hasDefault:
|
|
1752
|
-
isPrimaryKey:
|
|
2650
|
+
hasDefault: false;
|
|
2651
|
+
isPrimaryKey: false;
|
|
1753
2652
|
isAutoincrement: false;
|
|
1754
2653
|
hasRuntimeDefault: false;
|
|
1755
2654
|
enumValues: undefined;
|
|
@@ -1757,9 +2656,16 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1757
2656
|
identity: undefined;
|
|
1758
2657
|
generated: undefined;
|
|
1759
2658
|
}, {}, {}>;
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2659
|
+
};
|
|
2660
|
+
dialect: "pg";
|
|
2661
|
+
}>;
|
|
2662
|
+
declare const obligationCollaterals: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2663
|
+
name: "obligation_collaterals";
|
|
2664
|
+
schema: "router_v1.4";
|
|
2665
|
+
columns: {
|
|
2666
|
+
obligationId: drizzle_orm_pg_core.PgColumn<{
|
|
2667
|
+
name: "obligation_id";
|
|
2668
|
+
tableName: "obligation_collaterals";
|
|
1763
2669
|
dataType: "string";
|
|
1764
2670
|
columnType: "PgVarchar";
|
|
1765
2671
|
data: string;
|
|
@@ -1776,12 +2682,12 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1776
2682
|
}, {}, {
|
|
1777
2683
|
length: 66;
|
|
1778
2684
|
}>;
|
|
1779
|
-
|
|
1780
|
-
name: "
|
|
1781
|
-
tableName: "
|
|
2685
|
+
asset: drizzle_orm_pg_core.PgColumn<{
|
|
2686
|
+
name: "asset";
|
|
2687
|
+
tableName: "obligation_collaterals";
|
|
1782
2688
|
dataType: "string";
|
|
1783
|
-
columnType: "
|
|
1784
|
-
data:
|
|
2689
|
+
columnType: "PgVarchar";
|
|
2690
|
+
data: string;
|
|
1785
2691
|
driverParam: string;
|
|
1786
2692
|
notNull: true;
|
|
1787
2693
|
hasDefault: false;
|
|
@@ -1793,34 +2699,36 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1793
2699
|
identity: undefined;
|
|
1794
2700
|
generated: undefined;
|
|
1795
2701
|
}, {}, {
|
|
1796
|
-
|
|
2702
|
+
length: 42;
|
|
1797
2703
|
}>;
|
|
1798
|
-
|
|
1799
|
-
name: "
|
|
1800
|
-
tableName: "
|
|
1801
|
-
dataType: "
|
|
1802
|
-
columnType: "
|
|
1803
|
-
data:
|
|
1804
|
-
driverParam:
|
|
1805
|
-
notNull:
|
|
2704
|
+
oracle: drizzle_orm_pg_core.PgColumn<{
|
|
2705
|
+
name: "oracle";
|
|
2706
|
+
tableName: "obligation_collaterals";
|
|
2707
|
+
dataType: "string";
|
|
2708
|
+
columnType: "PgVarchar";
|
|
2709
|
+
data: string;
|
|
2710
|
+
driverParam: string;
|
|
2711
|
+
notNull: true;
|
|
1806
2712
|
hasDefault: false;
|
|
1807
2713
|
isPrimaryKey: false;
|
|
1808
2714
|
isAutoincrement: false;
|
|
1809
2715
|
hasRuntimeDefault: false;
|
|
1810
|
-
enumValues:
|
|
2716
|
+
enumValues: [string, ...string[]];
|
|
1811
2717
|
baseColumn: never;
|
|
1812
2718
|
identity: undefined;
|
|
1813
2719
|
generated: undefined;
|
|
1814
|
-
}, {}, {
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
2720
|
+
}, {}, {
|
|
2721
|
+
length: 42;
|
|
2722
|
+
}>;
|
|
2723
|
+
lltv: drizzle_orm_pg_core.PgColumn<{
|
|
2724
|
+
name: "lltv";
|
|
2725
|
+
tableName: "obligation_collaterals";
|
|
2726
|
+
dataType: "bigint";
|
|
2727
|
+
columnType: "PgBigInt64";
|
|
2728
|
+
data: bigint;
|
|
1821
2729
|
driverParam: string;
|
|
1822
2730
|
notNull: true;
|
|
1823
|
-
hasDefault:
|
|
2731
|
+
hasDefault: false;
|
|
1824
2732
|
isPrimaryKey: false;
|
|
1825
2733
|
isAutoincrement: false;
|
|
1826
2734
|
hasRuntimeDefault: false;
|
|
@@ -1834,7 +2742,7 @@ declare const offerStatus: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1834
2742
|
}>;
|
|
1835
2743
|
declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
1836
2744
|
name: "consumed_per_user_and_nonce";
|
|
1837
|
-
schema: "router_v1.
|
|
2745
|
+
schema: "router_v1.4";
|
|
1838
2746
|
columns: {
|
|
1839
2747
|
id: drizzle_orm_pg_core.PgColumn<{
|
|
1840
2748
|
name: "id";
|
|
@@ -1925,6 +2833,23 @@ declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1925
2833
|
identity: undefined;
|
|
1926
2834
|
generated: undefined;
|
|
1927
2835
|
}, {}, {}>;
|
|
2836
|
+
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
2837
|
+
name: "block_number";
|
|
2838
|
+
tableName: "consumed_per_user_and_nonce";
|
|
2839
|
+
dataType: "number";
|
|
2840
|
+
columnType: "PgBigInt53";
|
|
2841
|
+
data: number;
|
|
2842
|
+
driverParam: string | number;
|
|
2843
|
+
notNull: true;
|
|
2844
|
+
hasDefault: false;
|
|
2845
|
+
isPrimaryKey: false;
|
|
2846
|
+
isAutoincrement: false;
|
|
2847
|
+
hasRuntimeDefault: false;
|
|
2848
|
+
enumValues: undefined;
|
|
2849
|
+
baseColumn: never;
|
|
2850
|
+
identity: undefined;
|
|
2851
|
+
generated: undefined;
|
|
2852
|
+
}, {}, {}>;
|
|
1928
2853
|
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
1929
2854
|
name: "created_at";
|
|
1930
2855
|
tableName: "consumed_per_user_and_nonce";
|
|
@@ -1945,13 +2870,13 @@ declare const consumed: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1945
2870
|
};
|
|
1946
2871
|
dialect: "pg";
|
|
1947
2872
|
}>;
|
|
1948
|
-
declare const
|
|
1949
|
-
name: "
|
|
1950
|
-
schema: "router_v1.
|
|
2873
|
+
declare const collectors: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2874
|
+
name: "collectors";
|
|
2875
|
+
schema: "router_v1.4";
|
|
1951
2876
|
columns: {
|
|
1952
2877
|
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
1953
2878
|
name: "chain_id";
|
|
1954
|
-
tableName: "
|
|
2879
|
+
tableName: "collectors";
|
|
1955
2880
|
dataType: "bigint";
|
|
1956
2881
|
columnType: "PgBigInt64";
|
|
1957
2882
|
data: bigint;
|
|
@@ -1968,10 +2893,10 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1968
2893
|
}, {}, {}>;
|
|
1969
2894
|
name: drizzle_orm_pg_core.PgColumn<{
|
|
1970
2895
|
name: "name";
|
|
1971
|
-
tableName: "
|
|
2896
|
+
tableName: "collectors";
|
|
1972
2897
|
dataType: "string";
|
|
1973
2898
|
columnType: "PgText";
|
|
1974
|
-
data:
|
|
2899
|
+
data: "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "buy_vault_v1_callback_liquidity" | "sell_erc20_callback_liquidity";
|
|
1975
2900
|
driverParam: string;
|
|
1976
2901
|
notNull: true;
|
|
1977
2902
|
hasDefault: false;
|
|
@@ -1982,10 +2907,12 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1982
2907
|
baseColumn: never;
|
|
1983
2908
|
identity: undefined;
|
|
1984
2909
|
generated: undefined;
|
|
1985
|
-
}, {}, {
|
|
2910
|
+
}, {}, {
|
|
2911
|
+
$type: "mempool_offers" | "consumed_events" | "buy_with_empty_callback_liquidity" | "buy_vault_v1_callback_liquidity" | "sell_erc20_callback_liquidity";
|
|
2912
|
+
}>;
|
|
1986
2913
|
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
1987
2914
|
name: "block_number";
|
|
1988
|
-
tableName: "
|
|
2915
|
+
tableName: "collectors";
|
|
1989
2916
|
dataType: "number";
|
|
1990
2917
|
columnType: "PgBigInt53";
|
|
1991
2918
|
data: number;
|
|
@@ -2000,9 +2927,26 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2000
2927
|
identity: undefined;
|
|
2001
2928
|
generated: undefined;
|
|
2002
2929
|
}, {}, {}>;
|
|
2930
|
+
epoch: drizzle_orm_pg_core.PgColumn<{
|
|
2931
|
+
name: "epoch";
|
|
2932
|
+
tableName: "collectors";
|
|
2933
|
+
dataType: "string";
|
|
2934
|
+
columnType: "PgNumeric";
|
|
2935
|
+
data: string;
|
|
2936
|
+
driverParam: string;
|
|
2937
|
+
notNull: true;
|
|
2938
|
+
hasDefault: true;
|
|
2939
|
+
isPrimaryKey: false;
|
|
2940
|
+
isAutoincrement: false;
|
|
2941
|
+
hasRuntimeDefault: false;
|
|
2942
|
+
enumValues: undefined;
|
|
2943
|
+
baseColumn: never;
|
|
2944
|
+
identity: undefined;
|
|
2945
|
+
generated: undefined;
|
|
2946
|
+
}, {}, {}>;
|
|
2003
2947
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2004
2948
|
name: "updated_at";
|
|
2005
|
-
tableName: "
|
|
2949
|
+
tableName: "collectors";
|
|
2006
2950
|
dataType: "date";
|
|
2007
2951
|
columnType: "PgTimestamp";
|
|
2008
2952
|
data: Date;
|
|
@@ -2020,38 +2964,53 @@ declare const collectorBlockNumbers: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2020
2964
|
};
|
|
2021
2965
|
dialect: "pg";
|
|
2022
2966
|
}>;
|
|
2023
|
-
declare const
|
|
2024
|
-
name: "
|
|
2025
|
-
schema: "router_v1.
|
|
2967
|
+
declare const chains: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2968
|
+
name: "chains";
|
|
2969
|
+
schema: "router_v1.4";
|
|
2026
2970
|
columns: {
|
|
2027
|
-
|
|
2028
|
-
name: "
|
|
2029
|
-
tableName: "
|
|
2030
|
-
dataType: "
|
|
2031
|
-
columnType: "
|
|
2032
|
-
data:
|
|
2971
|
+
chainId: drizzle_orm_pg_core.PgColumn<{
|
|
2972
|
+
name: "chain_id";
|
|
2973
|
+
tableName: "chains";
|
|
2974
|
+
dataType: "bigint";
|
|
2975
|
+
columnType: "PgBigInt64";
|
|
2976
|
+
data: bigint;
|
|
2033
2977
|
driverParam: string;
|
|
2034
2978
|
notNull: true;
|
|
2035
2979
|
hasDefault: false;
|
|
2036
|
-
isPrimaryKey:
|
|
2980
|
+
isPrimaryKey: false;
|
|
2037
2981
|
isAutoincrement: false;
|
|
2038
2982
|
hasRuntimeDefault: false;
|
|
2039
|
-
enumValues:
|
|
2983
|
+
enumValues: undefined;
|
|
2040
2984
|
baseColumn: never;
|
|
2041
2985
|
identity: undefined;
|
|
2042
2986
|
generated: undefined;
|
|
2043
|
-
}, {}, {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2987
|
+
}, {}, {}>;
|
|
2988
|
+
blockNumber: drizzle_orm_pg_core.PgColumn<{
|
|
2989
|
+
name: "block_number";
|
|
2990
|
+
tableName: "chains";
|
|
2991
|
+
dataType: "number";
|
|
2992
|
+
columnType: "PgBigInt53";
|
|
2993
|
+
data: number;
|
|
2994
|
+
driverParam: string | number;
|
|
2995
|
+
notNull: true;
|
|
2996
|
+
hasDefault: false;
|
|
2997
|
+
isPrimaryKey: false;
|
|
2998
|
+
isAutoincrement: false;
|
|
2999
|
+
hasRuntimeDefault: false;
|
|
3000
|
+
enumValues: undefined;
|
|
3001
|
+
baseColumn: never;
|
|
3002
|
+
identity: undefined;
|
|
3003
|
+
generated: undefined;
|
|
3004
|
+
}, {}, {}>;
|
|
3005
|
+
epoch: drizzle_orm_pg_core.PgColumn<{
|
|
3006
|
+
name: "epoch";
|
|
3007
|
+
tableName: "chains";
|
|
2049
3008
|
dataType: "string";
|
|
2050
3009
|
columnType: "PgNumeric";
|
|
2051
3010
|
data: string;
|
|
2052
3011
|
driverParam: string;
|
|
2053
3012
|
notNull: true;
|
|
2054
|
-
hasDefault:
|
|
3013
|
+
hasDefault: true;
|
|
2055
3014
|
isPrimaryKey: false;
|
|
2056
3015
|
isAutoincrement: false;
|
|
2057
3016
|
hasRuntimeDefault: false;
|
|
@@ -2062,7 +3021,7 @@ declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2062
3021
|
}, {}, {}>;
|
|
2063
3022
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2064
3023
|
name: "updated_at";
|
|
2065
|
-
tableName: "
|
|
3024
|
+
tableName: "chains";
|
|
2066
3025
|
dataType: "date";
|
|
2067
3026
|
columnType: "PgTimestamp";
|
|
2068
3027
|
data: Date;
|
|
@@ -2080,13 +3039,13 @@ declare const availableLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2080
3039
|
};
|
|
2081
3040
|
dialect: "pg";
|
|
2082
3041
|
}>;
|
|
2083
|
-
declare const
|
|
2084
|
-
name: "
|
|
2085
|
-
schema: "router_v1.
|
|
3042
|
+
declare const offerLiquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3043
|
+
name: "offer_liquidity_pools";
|
|
3044
|
+
schema: "router_v1.4";
|
|
2086
3045
|
columns: {
|
|
2087
|
-
|
|
2088
|
-
name: "
|
|
2089
|
-
tableName: "
|
|
3046
|
+
offerHash: drizzle_orm_pg_core.PgColumn<{
|
|
3047
|
+
name: "offer_hash";
|
|
3048
|
+
tableName: "offer_liquidity_pools";
|
|
2090
3049
|
dataType: "string";
|
|
2091
3050
|
columnType: "PgVarchar";
|
|
2092
3051
|
data: string;
|
|
@@ -2101,11 +3060,11 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2101
3060
|
identity: undefined;
|
|
2102
3061
|
generated: undefined;
|
|
2103
3062
|
}, {}, {
|
|
2104
|
-
length:
|
|
3063
|
+
length: 66;
|
|
2105
3064
|
}>;
|
|
2106
|
-
|
|
2107
|
-
name: "
|
|
2108
|
-
tableName: "
|
|
3065
|
+
poolId: drizzle_orm_pg_core.PgColumn<{
|
|
3066
|
+
name: "pool_id";
|
|
3067
|
+
tableName: "offer_liquidity_pools";
|
|
2109
3068
|
dataType: "string";
|
|
2110
3069
|
columnType: "PgVarchar";
|
|
2111
3070
|
data: string;
|
|
@@ -2122,32 +3081,15 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2122
3081
|
}, {}, {
|
|
2123
3082
|
length: 255;
|
|
2124
3083
|
}>;
|
|
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";
|
|
3084
|
+
amount: drizzle_orm_pg_core.PgColumn<{
|
|
3085
|
+
name: "amount";
|
|
3086
|
+
tableName: "offer_liquidity_pools";
|
|
2145
3087
|
dataType: "string";
|
|
2146
3088
|
columnType: "PgNumeric";
|
|
2147
3089
|
data: string;
|
|
2148
3090
|
driverParam: string;
|
|
2149
3091
|
notNull: true;
|
|
2150
|
-
hasDefault:
|
|
3092
|
+
hasDefault: false;
|
|
2151
3093
|
isPrimaryKey: false;
|
|
2152
3094
|
isAutoincrement: false;
|
|
2153
3095
|
hasRuntimeDefault: false;
|
|
@@ -2158,7 +3100,7 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2158
3100
|
}, {}, {}>;
|
|
2159
3101
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2160
3102
|
name: "updated_at";
|
|
2161
|
-
tableName: "
|
|
3103
|
+
tableName: "offer_liquidity_pools";
|
|
2162
3104
|
dataType: "date";
|
|
2163
3105
|
columnType: "PgTimestamp";
|
|
2164
3106
|
data: Date;
|
|
@@ -2176,13 +3118,13 @@ declare const availableLiquidityQueues: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2176
3118
|
};
|
|
2177
3119
|
dialect: "pg";
|
|
2178
3120
|
}>;
|
|
2179
|
-
declare const
|
|
2180
|
-
name: "
|
|
2181
|
-
schema: "router_v1.
|
|
3121
|
+
declare const liquidityPools: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3122
|
+
name: "liquidity_pools";
|
|
3123
|
+
schema: "router_v1.4";
|
|
2182
3124
|
columns: {
|
|
2183
3125
|
id: drizzle_orm_pg_core.PgColumn<{
|
|
2184
3126
|
name: "id";
|
|
2185
|
-
tableName: "
|
|
3127
|
+
tableName: "liquidity_pools";
|
|
2186
3128
|
dataType: "string";
|
|
2187
3129
|
columnType: "PgVarchar";
|
|
2188
3130
|
data: string;
|
|
@@ -2199,11 +3141,11 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2199
3141
|
}, {}, {
|
|
2200
3142
|
length: 255;
|
|
2201
3143
|
}>;
|
|
2202
|
-
|
|
2203
|
-
name: "
|
|
2204
|
-
tableName: "
|
|
3144
|
+
amount: drizzle_orm_pg_core.PgColumn<{
|
|
3145
|
+
name: "amount";
|
|
3146
|
+
tableName: "liquidity_pools";
|
|
2205
3147
|
dataType: "string";
|
|
2206
|
-
columnType: "
|
|
3148
|
+
columnType: "PgNumeric";
|
|
2207
3149
|
data: string;
|
|
2208
3150
|
driverParam: string;
|
|
2209
3151
|
notNull: true;
|
|
@@ -2211,16 +3153,38 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2211
3153
|
isPrimaryKey: false;
|
|
2212
3154
|
isAutoincrement: false;
|
|
2213
3155
|
hasRuntimeDefault: false;
|
|
2214
|
-
enumValues:
|
|
3156
|
+
enumValues: undefined;
|
|
2215
3157
|
baseColumn: never;
|
|
2216
3158
|
identity: undefined;
|
|
2217
3159
|
generated: undefined;
|
|
2218
|
-
}, {}, {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
3160
|
+
}, {}, {}>;
|
|
3161
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
3162
|
+
name: "updated_at";
|
|
3163
|
+
tableName: "liquidity_pools";
|
|
3164
|
+
dataType: "date";
|
|
3165
|
+
columnType: "PgTimestamp";
|
|
3166
|
+
data: Date;
|
|
3167
|
+
driverParam: string;
|
|
3168
|
+
notNull: true;
|
|
3169
|
+
hasDefault: true;
|
|
3170
|
+
isPrimaryKey: false;
|
|
3171
|
+
isAutoincrement: false;
|
|
3172
|
+
hasRuntimeDefault: false;
|
|
3173
|
+
enumValues: undefined;
|
|
3174
|
+
baseColumn: never;
|
|
3175
|
+
identity: undefined;
|
|
3176
|
+
generated: undefined;
|
|
3177
|
+
}, {}, {}>;
|
|
3178
|
+
};
|
|
3179
|
+
dialect: "pg";
|
|
3180
|
+
}>;
|
|
3181
|
+
declare const liquidityLinks: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
3182
|
+
name: "liquidity_links";
|
|
3183
|
+
schema: "router_v1.4";
|
|
3184
|
+
columns: {
|
|
3185
|
+
parentPoolId: drizzle_orm_pg_core.PgColumn<{
|
|
3186
|
+
name: "parent_pool_id";
|
|
3187
|
+
tableName: "liquidity_links";
|
|
2224
3188
|
dataType: "string";
|
|
2225
3189
|
columnType: "PgVarchar";
|
|
2226
3190
|
data: string;
|
|
@@ -2237,30 +3201,32 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2237
3201
|
}, {}, {
|
|
2238
3202
|
length: 255;
|
|
2239
3203
|
}>;
|
|
2240
|
-
|
|
2241
|
-
name: "
|
|
2242
|
-
tableName: "
|
|
2243
|
-
dataType: "
|
|
2244
|
-
columnType: "
|
|
2245
|
-
data:
|
|
3204
|
+
childPoolId: drizzle_orm_pg_core.PgColumn<{
|
|
3205
|
+
name: "child_pool_id";
|
|
3206
|
+
tableName: "liquidity_links";
|
|
3207
|
+
dataType: "string";
|
|
3208
|
+
columnType: "PgVarchar";
|
|
3209
|
+
data: string;
|
|
2246
3210
|
driverParam: string;
|
|
2247
3211
|
notNull: true;
|
|
2248
3212
|
hasDefault: false;
|
|
2249
3213
|
isPrimaryKey: false;
|
|
2250
3214
|
isAutoincrement: false;
|
|
2251
3215
|
hasRuntimeDefault: false;
|
|
2252
|
-
enumValues:
|
|
3216
|
+
enumValues: [string, ...string[]];
|
|
2253
3217
|
baseColumn: never;
|
|
2254
3218
|
identity: undefined;
|
|
2255
3219
|
generated: undefined;
|
|
2256
|
-
}, {}, {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
3220
|
+
}, {}, {
|
|
3221
|
+
length: 255;
|
|
3222
|
+
}>;
|
|
3223
|
+
priority: drizzle_orm_pg_core.PgColumn<{
|
|
3224
|
+
name: "priority";
|
|
3225
|
+
tableName: "liquidity_links";
|
|
3226
|
+
dataType: "number";
|
|
3227
|
+
columnType: "PgInteger";
|
|
3228
|
+
data: number;
|
|
3229
|
+
driverParam: string | number;
|
|
2264
3230
|
notNull: true;
|
|
2265
3231
|
hasDefault: false;
|
|
2266
3232
|
isPrimaryKey: false;
|
|
@@ -2273,7 +3239,7 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2273
3239
|
}, {}, {}>;
|
|
2274
3240
|
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2275
3241
|
name: "updated_at";
|
|
2276
|
-
tableName: "
|
|
3242
|
+
tableName: "liquidity_links";
|
|
2277
3243
|
dataType: "date";
|
|
2278
3244
|
columnType: "PgTimestamp";
|
|
2279
3245
|
data: Date;
|
|
@@ -2293,16 +3259,102 @@ declare const userPositions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2293
3259
|
}>;
|
|
2294
3260
|
|
|
2295
3261
|
declare const schema_VERSION: typeof VERSION;
|
|
2296
|
-
declare const
|
|
2297
|
-
declare const
|
|
2298
|
-
declare const schema_collectorBlockNumbers: typeof collectorBlockNumbers;
|
|
3262
|
+
declare const schema_chains: typeof chains;
|
|
3263
|
+
declare const schema_collectors: typeof collectors;
|
|
2299
3264
|
declare const schema_consumed: typeof consumed;
|
|
2300
|
-
declare const
|
|
2301
|
-
declare const
|
|
3265
|
+
declare const schema_liquidityLinks: typeof liquidityLinks;
|
|
3266
|
+
declare const schema_liquidityPools: typeof liquidityPools;
|
|
3267
|
+
declare const schema_obligationCollaterals: typeof obligationCollaterals;
|
|
3268
|
+
declare const schema_obligations: typeof obligations;
|
|
3269
|
+
declare const schema_offerLiquidityPools: typeof offerLiquidityPools;
|
|
2302
3270
|
declare const schema_offers: typeof offers;
|
|
2303
|
-
declare const schema_userPositions: typeof userPositions;
|
|
2304
3271
|
declare namespace schema {
|
|
2305
|
-
export { schema_VERSION as VERSION,
|
|
3272
|
+
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 };
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
declare function max$1(a: bigint, b: bigint): bigint;
|
|
3276
|
+
declare function min(a: bigint, b: bigint): bigint;
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* Splits an array into batches of a specified size.
|
|
3280
|
+
* @param array The array to split.
|
|
3281
|
+
* @param batchSize The size of each batch.
|
|
3282
|
+
* @returns An iterator that yields each batch.
|
|
3283
|
+
* @example
|
|
3284
|
+
* ```typescript
|
|
3285
|
+
* const array = [1, 2, 3, 4, 5];
|
|
3286
|
+
* for (const batch of batch(array, 2)) {
|
|
3287
|
+
* console.log(batch);
|
|
3288
|
+
* }
|
|
3289
|
+
* // Output:
|
|
3290
|
+
* // [1, 2]
|
|
3291
|
+
* // [3, 4]
|
|
3292
|
+
* // [5]
|
|
3293
|
+
* ```
|
|
3294
|
+
*/
|
|
3295
|
+
declare function batch<T>(array: Array<T>, batchSize: number): Generator<T[], void, unknown>;
|
|
3296
|
+
|
|
3297
|
+
/**
|
|
3298
|
+
* Helper function to execute multicall in batches with retry logic.
|
|
3299
|
+
* Abstracts the common pattern of batching calls, retrying, and collecting results.
|
|
3300
|
+
*
|
|
3301
|
+
* @param parameters - Configuration for batched multicall
|
|
3302
|
+
* @returns Promise resolving to flattened array of results
|
|
3303
|
+
*/
|
|
3304
|
+
declare function batchMulticall<TResult>(parameters: {
|
|
3305
|
+
client: Pick<PublicActions, "multicall">;
|
|
3306
|
+
calls: unknown[];
|
|
3307
|
+
batchSize: number;
|
|
3308
|
+
retryAttempts: number;
|
|
3309
|
+
retryDelayMs: number;
|
|
3310
|
+
blockNumber?: bigint;
|
|
3311
|
+
}): Promise<TResult[]>;
|
|
3312
|
+
|
|
3313
|
+
/**
|
|
3314
|
+
* Transform a polling function into an async generator.
|
|
3315
|
+
* @param fn - The polling function to transform.
|
|
3316
|
+
* @returns An async generator.
|
|
3317
|
+
*/
|
|
3318
|
+
declare function lazy<T>(pollFn: (emit: (value: T) => void, { stop }: {
|
|
3319
|
+
stop: () => void;
|
|
3320
|
+
}) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
|
|
3321
|
+
|
|
3322
|
+
/**
|
|
3323
|
+
* Polls a function at a specified interval.
|
|
3324
|
+
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
3325
|
+
*/
|
|
3326
|
+
declare function poll<data>(fn: ({ unpoll }: {
|
|
3327
|
+
unpoll: () => void;
|
|
3328
|
+
}) => Promise<data | undefined>, { interval }: {
|
|
3329
|
+
interval: number;
|
|
3330
|
+
}): () => boolean;
|
|
3331
|
+
|
|
3332
|
+
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
3333
|
+
|
|
3334
|
+
declare function now(): number;
|
|
3335
|
+
declare function max(): number;
|
|
3336
|
+
|
|
3337
|
+
declare const time_max: typeof max;
|
|
3338
|
+
declare const time_now: typeof now;
|
|
3339
|
+
declare namespace time {
|
|
3340
|
+
export { time_max as max, time_now as now };
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
declare function wait(time: number): Promise<unknown>;
|
|
3344
|
+
|
|
3345
|
+
type index_BaseError<cause extends Error | undefined = undefined> = BaseError<cause>;
|
|
3346
|
+
declare const index_BaseError: typeof BaseError;
|
|
3347
|
+
type index_GlobalErrorType<name extends string = "Error"> = GlobalErrorType<name>;
|
|
3348
|
+
type index_Snake<T> = Snake<T>;
|
|
3349
|
+
declare const index_batch: typeof batch;
|
|
3350
|
+
declare const index_batchMulticall: typeof batchMulticall;
|
|
3351
|
+
declare const index_lazy: typeof lazy;
|
|
3352
|
+
declare const index_min: typeof min;
|
|
3353
|
+
declare const index_poll: typeof poll;
|
|
3354
|
+
declare const index_retry: typeof retry;
|
|
3355
|
+
declare const index_wait: typeof wait;
|
|
3356
|
+
declare namespace index {
|
|
3357
|
+
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
3358
|
}
|
|
2307
3359
|
|
|
2308
|
-
export { Callback,
|
|
3360
|
+
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, 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 };
|