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