@morpho-dev/router 0.10.0 → 0.12.0
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 +20 -5
- package/dist/cli.js +14944 -8994
- package/dist/drizzle/migrations/0031_sell-takeable-reindex.sql +254 -0
- package/dist/drizzle/migrations/0032_callback-type.sql +3 -0
- package/dist/drizzle/migrations/0033_obligation-id-bytes20.sql +255 -0
- package/dist/drizzle/migrations/0034_chain-checkpoints.sql +1 -0
- package/dist/drizzle/migrations/0035_chain-tip-hash-cas.sql +1 -0
- package/dist/drizzle/migrations/0036_pending-links.sql +22 -0
- package/dist/drizzle/migrations/0037_chain-finalized-anchor.sql +2 -0
- package/dist/drizzle/migrations/0038_add-obligation-rcf-threshold.sql +2 -0
- package/dist/drizzle/migrations/0039_add-offers-composite-indexes.sql +2 -0
- package/dist/drizzle/migrations/0040_drop-redundant-offers-indexes.sql +2 -0
- package/dist/drizzle/migrations/0041_add-group-winner-expression-index.sql +10 -0
- package/dist/drizzle/migrations/0042_contract-sync-v1.14.sql +284 -0
- package/dist/drizzle/migrations/0043_add-obligation-side-tick-index.sql +1 -0
- package/dist/drizzle/migrations/0044_index-audit-cleanup.sql +27 -0
- package/dist/drizzle/migrations/0045_add-lots-offsets-availability-indexes.sql +5 -0
- package/dist/drizzle/migrations/0046_add-offers-active-tick-index.sql +1 -0
- package/dist/drizzle/migrations/0047_add-offers-book-winners-index.sql +1 -0
- package/dist/drizzle/migrations/0048_covering-indexes-for-winners-queries.sql +34 -0
- package/dist/drizzle/migrations/0049_contract-sync-v1.15.sql +305 -0
- package/dist/drizzle/migrations/meta/0031_snapshot.json +1652 -0
- package/dist/drizzle/migrations/meta/0033_snapshot.json +1658 -0
- package/dist/drizzle/migrations/meta/0036_snapshot.json +1864 -0
- package/dist/drizzle/migrations/meta/0037_snapshot.json +1876 -0
- package/dist/drizzle/migrations/meta/0038_snapshot.json +1882 -0
- package/dist/drizzle/migrations/meta/0039_snapshot.json +1960 -0
- package/dist/drizzle/migrations/meta/0040_snapshot.json +1912 -0
- package/dist/drizzle/migrations/meta/0041_snapshot.json +1912 -0
- package/dist/drizzle/migrations/meta/0042_snapshot.json +1882 -0
- package/dist/drizzle/migrations/meta/0043_snapshot.json +1909 -0
- package/dist/drizzle/migrations/meta/0044_snapshot.json +1853 -0
- package/dist/drizzle/migrations/meta/0045_snapshot.json +1921 -0
- package/dist/drizzle/migrations/meta/0046_snapshot.json +1966 -0
- package/dist/drizzle/migrations/meta/0047_snapshot.json +2005 -0
- package/dist/drizzle/migrations/meta/0048_snapshot.json +2035 -0
- package/dist/drizzle/migrations/meta/0049_snapshot.json +2035 -0
- package/dist/drizzle/migrations/meta/_journal.json +133 -0
- package/dist/evm/bytecode/morpho.txt +1 -1
- package/dist/index.browser.d.mts +784 -282
- package/dist/index.browser.d.mts.map +1 -1
- package/dist/index.browser.mjs +1516 -675
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +1676 -602
- package/dist/index.node.d.mts.map +1 -1
- package/dist/index.node.mjs +10121 -5251
- package/dist/index.node.mjs.map +1 -1
- package/dist/register-otel-hook.js +7 -0
- package/dist/server-D4xxddev.js +9573 -0
- package/dist/server.js +9617 -0
- package/docs/integrator.md +14 -24
- package/package.json +36 -29
- package/dist/index.browser.d.ts +0 -5007
- package/dist/index.browser.d.ts.map +0 -1
- package/dist/index.browser.js +0 -5825
- package/dist/index.browser.js.map +0 -1
- package/dist/index.node.d.ts +0 -8263
- package/dist/index.node.d.ts.map +0 -1
- package/dist/index.node.js +0 -12566
- package/dist/index.node.js.map +0 -1
package/dist/index.browser.d.ts
DELETED
|
@@ -1,5007 +0,0 @@
|
|
|
1
|
-
import { z } from "zod/v4";
|
|
2
|
-
import { AbiEvent, Address, ChainContract, ChainFormatters, GetLogsReturnType, Hex, MulticallParameters, PublicClient, Transport, WalletClient } from "viem";
|
|
3
|
-
import { Chain } from "viem/chains";
|
|
4
|
-
import * as z$1 from "zod";
|
|
5
|
-
import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
|
|
6
|
-
import { OpenAPIDocument } from "openapi-metadata";
|
|
7
|
-
import { Client } from "openapi-fetch";
|
|
8
|
-
|
|
9
|
-
//#region rolldown:runtime
|
|
10
|
-
declare namespace BookResponse_d_exports {
|
|
11
|
-
export { BookLevelResponse, from$15 as from };
|
|
12
|
-
}
|
|
13
|
-
type BookLevelResponse = {
|
|
14
|
-
tick: number;
|
|
15
|
-
price: string;
|
|
16
|
-
assets: string;
|
|
17
|
-
count: number;
|
|
18
|
-
};
|
|
19
|
-
type Input$1 = {
|
|
20
|
-
tick: number;
|
|
21
|
-
assets: bigint;
|
|
22
|
-
count: number;
|
|
23
|
-
};
|
|
24
|
-
declare function from$15(level: Input$1): BookLevelResponse;
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/api/Schema/health.d.ts
|
|
27
|
-
declare const CollectorHealth: z.ZodObject<{
|
|
28
|
-
name: z.ZodString;
|
|
29
|
-
chain_id: z.ZodNumber;
|
|
30
|
-
block_number: z.ZodNullable<z.ZodNumber>;
|
|
31
|
-
updated_at: z.ZodNullable<z.ZodString>;
|
|
32
|
-
lag: z.ZodNullable<z.ZodNumber>;
|
|
33
|
-
status: z.ZodEnum<{
|
|
34
|
-
unknown: "unknown";
|
|
35
|
-
live: "live";
|
|
36
|
-
lagging: "lagging";
|
|
37
|
-
}>;
|
|
38
|
-
initialized: z.ZodBoolean;
|
|
39
|
-
}, z.core.$strip>;
|
|
40
|
-
declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
41
|
-
name: z.ZodString;
|
|
42
|
-
chain_id: z.ZodNumber;
|
|
43
|
-
block_number: z.ZodNullable<z.ZodNumber>;
|
|
44
|
-
updated_at: z.ZodNullable<z.ZodString>;
|
|
45
|
-
lag: z.ZodNullable<z.ZodNumber>;
|
|
46
|
-
status: z.ZodEnum<{
|
|
47
|
-
unknown: "unknown";
|
|
48
|
-
live: "live";
|
|
49
|
-
lagging: "lagging";
|
|
50
|
-
}>;
|
|
51
|
-
initialized: z.ZodBoolean;
|
|
52
|
-
}, z.core.$strip>>;
|
|
53
|
-
declare const ChainHealth: z.ZodObject<{
|
|
54
|
-
chain_id: z.ZodNumber;
|
|
55
|
-
local_block_number: z.ZodNullable<z.ZodNumber>;
|
|
56
|
-
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
57
|
-
updated_at: z.ZodNullable<z.ZodString>;
|
|
58
|
-
initialized: z.ZodBoolean;
|
|
59
|
-
}, z.core.$strip>;
|
|
60
|
-
declare const ChainsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
61
|
-
chain_id: z.ZodNumber;
|
|
62
|
-
local_block_number: z.ZodNullable<z.ZodNumber>;
|
|
63
|
-
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
64
|
-
updated_at: z.ZodNullable<z.ZodString>;
|
|
65
|
-
initialized: z.ZodBoolean;
|
|
66
|
-
}, z.core.$strip>>;
|
|
67
|
-
declare const RouterStatusResponse: z.ZodObject<{
|
|
68
|
-
status: z.ZodEnum<{
|
|
69
|
-
live: "live";
|
|
70
|
-
syncing: "syncing";
|
|
71
|
-
}>;
|
|
72
|
-
initialized: z.ZodBoolean;
|
|
73
|
-
missing_chains: z.ZodArray<z.ZodNumber>;
|
|
74
|
-
missing_collectors: z.ZodArray<z.ZodObject<{
|
|
75
|
-
chain_id: z.ZodNumber;
|
|
76
|
-
name: z.ZodString;
|
|
77
|
-
}, z.core.$strip>>;
|
|
78
|
-
}, z.core.$strip>;
|
|
79
|
-
type CollectorsHealthResponse = z.infer<typeof CollectorsHealthResponse>;
|
|
80
|
-
type ChainsHealthResponse = z.infer<typeof ChainsHealthResponse>;
|
|
81
|
-
type RouterStatusResponse = z.infer<typeof RouterStatusResponse>;
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/core/Abi/MetaMorpho.d.ts
|
|
84
|
-
declare const MetaMorpho: readonly [{
|
|
85
|
-
readonly name: "balanceOf";
|
|
86
|
-
readonly type: "function";
|
|
87
|
-
readonly stateMutability: "view";
|
|
88
|
-
readonly inputs: readonly [{
|
|
89
|
-
readonly type: "address";
|
|
90
|
-
readonly name: "account";
|
|
91
|
-
}];
|
|
92
|
-
readonly outputs: readonly [{
|
|
93
|
-
readonly type: "uint256";
|
|
94
|
-
}];
|
|
95
|
-
}, {
|
|
96
|
-
readonly name: "DECIMALS_OFFSET";
|
|
97
|
-
readonly type: "function";
|
|
98
|
-
readonly stateMutability: "view";
|
|
99
|
-
readonly inputs: readonly [];
|
|
100
|
-
readonly outputs: readonly [{
|
|
101
|
-
readonly type: "uint8";
|
|
102
|
-
}];
|
|
103
|
-
}, {
|
|
104
|
-
readonly name: "totalAssets";
|
|
105
|
-
readonly type: "function";
|
|
106
|
-
readonly stateMutability: "view";
|
|
107
|
-
readonly inputs: readonly [];
|
|
108
|
-
readonly outputs: readonly [{
|
|
109
|
-
readonly type: "uint256";
|
|
110
|
-
}];
|
|
111
|
-
}, {
|
|
112
|
-
readonly name: "totalSupply";
|
|
113
|
-
readonly type: "function";
|
|
114
|
-
readonly stateMutability: "view";
|
|
115
|
-
readonly inputs: readonly [];
|
|
116
|
-
readonly outputs: readonly [{
|
|
117
|
-
readonly type: "uint256";
|
|
118
|
-
}];
|
|
119
|
-
}, {
|
|
120
|
-
readonly name: "maxWithdraw";
|
|
121
|
-
readonly type: "function";
|
|
122
|
-
readonly stateMutability: "view";
|
|
123
|
-
readonly inputs: readonly [{
|
|
124
|
-
readonly type: "address";
|
|
125
|
-
readonly name: "owner";
|
|
126
|
-
}];
|
|
127
|
-
readonly outputs: readonly [{
|
|
128
|
-
readonly type: "uint256";
|
|
129
|
-
readonly name: "assets";
|
|
130
|
-
}];
|
|
131
|
-
}, {
|
|
132
|
-
readonly name: "asset";
|
|
133
|
-
readonly type: "function";
|
|
134
|
-
readonly stateMutability: "view";
|
|
135
|
-
readonly inputs: readonly [];
|
|
136
|
-
readonly outputs: readonly [{
|
|
137
|
-
readonly type: "address";
|
|
138
|
-
}];
|
|
139
|
-
}, {
|
|
140
|
-
readonly name: "Transfer";
|
|
141
|
-
readonly type: "event";
|
|
142
|
-
readonly inputs: readonly [{
|
|
143
|
-
readonly type: "address";
|
|
144
|
-
readonly name: "from";
|
|
145
|
-
readonly indexed: true;
|
|
146
|
-
}, {
|
|
147
|
-
readonly type: "address";
|
|
148
|
-
readonly name: "to";
|
|
149
|
-
readonly indexed: true;
|
|
150
|
-
}, {
|
|
151
|
-
readonly type: "uint256";
|
|
152
|
-
readonly name: "value";
|
|
153
|
-
}];
|
|
154
|
-
}, {
|
|
155
|
-
readonly name: "withdrawQueue";
|
|
156
|
-
readonly type: "function";
|
|
157
|
-
readonly stateMutability: "view";
|
|
158
|
-
readonly inputs: readonly [{
|
|
159
|
-
readonly type: "uint256";
|
|
160
|
-
readonly name: "index";
|
|
161
|
-
}];
|
|
162
|
-
readonly outputs: readonly [{
|
|
163
|
-
readonly type: "bytes32";
|
|
164
|
-
}];
|
|
165
|
-
}, {
|
|
166
|
-
readonly name: "withdrawQueueLength";
|
|
167
|
-
readonly type: "function";
|
|
168
|
-
readonly stateMutability: "view";
|
|
169
|
-
readonly inputs: readonly [];
|
|
170
|
-
readonly outputs: readonly [{
|
|
171
|
-
readonly type: "uint256";
|
|
172
|
-
}];
|
|
173
|
-
}];
|
|
174
|
-
type MetaMorpho = typeof MetaMorpho;
|
|
175
|
-
//#endregion
|
|
176
|
-
//#region src/core/Abi/MetaMorphoFactory.d.ts
|
|
177
|
-
declare const MetaMorphoFactory: readonly [{
|
|
178
|
-
readonly name: "CreateMetaMorpho";
|
|
179
|
-
readonly type: "event";
|
|
180
|
-
readonly inputs: readonly [{
|
|
181
|
-
readonly type: "address";
|
|
182
|
-
readonly name: "metaMorpho";
|
|
183
|
-
readonly indexed: true;
|
|
184
|
-
}, {
|
|
185
|
-
readonly type: "address";
|
|
186
|
-
readonly name: "caller";
|
|
187
|
-
readonly indexed: true;
|
|
188
|
-
}, {
|
|
189
|
-
readonly type: "address";
|
|
190
|
-
readonly name: "initialOwner";
|
|
191
|
-
}, {
|
|
192
|
-
readonly type: "uint256";
|
|
193
|
-
readonly name: "initialTimelock";
|
|
194
|
-
}, {
|
|
195
|
-
readonly type: "address";
|
|
196
|
-
readonly name: "asset";
|
|
197
|
-
readonly indexed: true;
|
|
198
|
-
}, {
|
|
199
|
-
readonly type: "string";
|
|
200
|
-
readonly name: "name";
|
|
201
|
-
}, {
|
|
202
|
-
readonly type: "string";
|
|
203
|
-
readonly name: "symbol";
|
|
204
|
-
}, {
|
|
205
|
-
readonly type: "bytes32";
|
|
206
|
-
readonly name: "salt";
|
|
207
|
-
}];
|
|
208
|
-
}, {
|
|
209
|
-
readonly name: "isMetaMorpho";
|
|
210
|
-
readonly type: "function";
|
|
211
|
-
readonly stateMutability: "view";
|
|
212
|
-
readonly inputs: readonly [{
|
|
213
|
-
readonly type: "address";
|
|
214
|
-
}];
|
|
215
|
-
readonly outputs: readonly [{
|
|
216
|
-
readonly type: "bool";
|
|
217
|
-
}];
|
|
218
|
-
}];
|
|
219
|
-
type MetaMorphoFactory = typeof MetaMorphoFactory;
|
|
220
|
-
//#endregion
|
|
221
|
-
//#region src/core/Abi/MorphoV2.d.ts
|
|
222
|
-
declare const MorphoV2: readonly [{
|
|
223
|
-
readonly type: "constructor";
|
|
224
|
-
readonly stateMutability: "nonpayable";
|
|
225
|
-
readonly inputs: readonly [];
|
|
226
|
-
}, {
|
|
227
|
-
readonly name: "collateralOf";
|
|
228
|
-
readonly type: "function";
|
|
229
|
-
readonly stateMutability: "view";
|
|
230
|
-
readonly inputs: readonly [{
|
|
231
|
-
readonly type: "bytes32";
|
|
232
|
-
readonly name: "id";
|
|
233
|
-
}, {
|
|
234
|
-
readonly type: "address";
|
|
235
|
-
readonly name: "user";
|
|
236
|
-
}, {
|
|
237
|
-
readonly type: "address";
|
|
238
|
-
readonly name: "collateralToken";
|
|
239
|
-
}];
|
|
240
|
-
readonly outputs: readonly [{
|
|
241
|
-
readonly type: "uint256";
|
|
242
|
-
}];
|
|
243
|
-
}, {
|
|
244
|
-
readonly name: "consume";
|
|
245
|
-
readonly type: "function";
|
|
246
|
-
readonly stateMutability: "nonpayable";
|
|
247
|
-
readonly inputs: readonly [{
|
|
248
|
-
readonly type: "bytes32";
|
|
249
|
-
readonly name: "group";
|
|
250
|
-
}, {
|
|
251
|
-
readonly type: "uint256";
|
|
252
|
-
readonly name: "amount";
|
|
253
|
-
}];
|
|
254
|
-
readonly outputs: readonly [];
|
|
255
|
-
}, {
|
|
256
|
-
readonly name: "consumed";
|
|
257
|
-
readonly type: "function";
|
|
258
|
-
readonly stateMutability: "view";
|
|
259
|
-
readonly inputs: readonly [{
|
|
260
|
-
readonly type: "address";
|
|
261
|
-
readonly name: "user";
|
|
262
|
-
}, {
|
|
263
|
-
readonly type: "bytes32";
|
|
264
|
-
readonly name: "group";
|
|
265
|
-
}];
|
|
266
|
-
readonly outputs: readonly [{
|
|
267
|
-
readonly type: "uint256";
|
|
268
|
-
}];
|
|
269
|
-
}, {
|
|
270
|
-
readonly name: "debtOf";
|
|
271
|
-
readonly type: "function";
|
|
272
|
-
readonly stateMutability: "view";
|
|
273
|
-
readonly inputs: readonly [{
|
|
274
|
-
readonly type: "bytes32";
|
|
275
|
-
readonly name: "id";
|
|
276
|
-
}, {
|
|
277
|
-
readonly type: "address";
|
|
278
|
-
readonly name: "user";
|
|
279
|
-
}];
|
|
280
|
-
readonly outputs: readonly [{
|
|
281
|
-
readonly type: "uint256";
|
|
282
|
-
}];
|
|
283
|
-
}, {
|
|
284
|
-
readonly name: "defaultFees";
|
|
285
|
-
readonly type: "function";
|
|
286
|
-
readonly stateMutability: "view";
|
|
287
|
-
readonly inputs: readonly [{
|
|
288
|
-
readonly type: "address";
|
|
289
|
-
readonly name: "loanToken";
|
|
290
|
-
}, {
|
|
291
|
-
readonly type: "uint256";
|
|
292
|
-
readonly name: "index";
|
|
293
|
-
}];
|
|
294
|
-
readonly outputs: readonly [{
|
|
295
|
-
readonly type: "uint16";
|
|
296
|
-
}];
|
|
297
|
-
}, {
|
|
298
|
-
readonly name: "feeSetter";
|
|
299
|
-
readonly type: "function";
|
|
300
|
-
readonly stateMutability: "view";
|
|
301
|
-
readonly inputs: readonly [];
|
|
302
|
-
readonly outputs: readonly [{
|
|
303
|
-
readonly type: "address";
|
|
304
|
-
}];
|
|
305
|
-
}, {
|
|
306
|
-
readonly name: "fees";
|
|
307
|
-
readonly type: "function";
|
|
308
|
-
readonly stateMutability: "view";
|
|
309
|
-
readonly inputs: readonly [{
|
|
310
|
-
readonly type: "bytes32";
|
|
311
|
-
readonly name: "id";
|
|
312
|
-
}];
|
|
313
|
-
readonly outputs: readonly [{
|
|
314
|
-
readonly type: "uint16[6]";
|
|
315
|
-
}];
|
|
316
|
-
}, {
|
|
317
|
-
readonly name: "flashLoan";
|
|
318
|
-
readonly type: "function";
|
|
319
|
-
readonly stateMutability: "nonpayable";
|
|
320
|
-
readonly inputs: readonly [{
|
|
321
|
-
readonly type: "address";
|
|
322
|
-
readonly name: "token";
|
|
323
|
-
}, {
|
|
324
|
-
readonly type: "uint256";
|
|
325
|
-
readonly name: "assets";
|
|
326
|
-
}, {
|
|
327
|
-
readonly type: "address";
|
|
328
|
-
readonly name: "callback";
|
|
329
|
-
}, {
|
|
330
|
-
readonly type: "bytes";
|
|
331
|
-
readonly name: "data";
|
|
332
|
-
}];
|
|
333
|
-
readonly outputs: readonly [];
|
|
334
|
-
}, {
|
|
335
|
-
readonly name: "isHealthy";
|
|
336
|
-
readonly type: "function";
|
|
337
|
-
readonly stateMutability: "view";
|
|
338
|
-
readonly inputs: readonly [{
|
|
339
|
-
readonly type: "tuple";
|
|
340
|
-
readonly components: readonly [{
|
|
341
|
-
readonly type: "address";
|
|
342
|
-
readonly name: "loanToken";
|
|
343
|
-
}, {
|
|
344
|
-
readonly type: "tuple[]";
|
|
345
|
-
readonly components: readonly [{
|
|
346
|
-
readonly type: "address";
|
|
347
|
-
readonly name: "token";
|
|
348
|
-
}, {
|
|
349
|
-
readonly type: "uint256";
|
|
350
|
-
readonly name: "lltv";
|
|
351
|
-
}, {
|
|
352
|
-
readonly type: "address";
|
|
353
|
-
readonly name: "oracle";
|
|
354
|
-
}];
|
|
355
|
-
readonly name: "collaterals";
|
|
356
|
-
}, {
|
|
357
|
-
readonly type: "uint256";
|
|
358
|
-
readonly name: "maturity";
|
|
359
|
-
}];
|
|
360
|
-
readonly name: "obligation";
|
|
361
|
-
}, {
|
|
362
|
-
readonly type: "bytes32";
|
|
363
|
-
readonly name: "id";
|
|
364
|
-
}, {
|
|
365
|
-
readonly type: "address";
|
|
366
|
-
readonly name: "borrower";
|
|
367
|
-
}];
|
|
368
|
-
readonly outputs: readonly [{
|
|
369
|
-
readonly type: "bool";
|
|
370
|
-
}];
|
|
371
|
-
}, {
|
|
372
|
-
readonly name: "liquidate";
|
|
373
|
-
readonly type: "function";
|
|
374
|
-
readonly stateMutability: "nonpayable";
|
|
375
|
-
readonly inputs: readonly [{
|
|
376
|
-
readonly type: "tuple";
|
|
377
|
-
readonly components: readonly [{
|
|
378
|
-
readonly type: "address";
|
|
379
|
-
readonly name: "loanToken";
|
|
380
|
-
}, {
|
|
381
|
-
readonly type: "tuple[]";
|
|
382
|
-
readonly components: readonly [{
|
|
383
|
-
readonly type: "address";
|
|
384
|
-
readonly name: "token";
|
|
385
|
-
}, {
|
|
386
|
-
readonly type: "uint256";
|
|
387
|
-
readonly name: "lltv";
|
|
388
|
-
}, {
|
|
389
|
-
readonly type: "address";
|
|
390
|
-
readonly name: "oracle";
|
|
391
|
-
}];
|
|
392
|
-
readonly name: "collaterals";
|
|
393
|
-
}, {
|
|
394
|
-
readonly type: "uint256";
|
|
395
|
-
readonly name: "maturity";
|
|
396
|
-
}];
|
|
397
|
-
readonly name: "obligation";
|
|
398
|
-
}, {
|
|
399
|
-
readonly type: "tuple[]";
|
|
400
|
-
readonly components: readonly [{
|
|
401
|
-
readonly type: "uint256";
|
|
402
|
-
readonly name: "collateralIndex";
|
|
403
|
-
}, {
|
|
404
|
-
readonly type: "uint256";
|
|
405
|
-
readonly name: "repaid";
|
|
406
|
-
}, {
|
|
407
|
-
readonly type: "uint256";
|
|
408
|
-
readonly name: "seized";
|
|
409
|
-
}];
|
|
410
|
-
readonly name: "seizures";
|
|
411
|
-
}, {
|
|
412
|
-
readonly type: "address";
|
|
413
|
-
readonly name: "borrower";
|
|
414
|
-
}, {
|
|
415
|
-
readonly type: "bytes";
|
|
416
|
-
readonly name: "data";
|
|
417
|
-
}];
|
|
418
|
-
readonly outputs: readonly [{
|
|
419
|
-
readonly type: "tuple[]";
|
|
420
|
-
readonly components: readonly [{
|
|
421
|
-
readonly type: "uint256";
|
|
422
|
-
readonly name: "collateralIndex";
|
|
423
|
-
}, {
|
|
424
|
-
readonly type: "uint256";
|
|
425
|
-
readonly name: "repaid";
|
|
426
|
-
}, {
|
|
427
|
-
readonly type: "uint256";
|
|
428
|
-
readonly name: "seized";
|
|
429
|
-
}];
|
|
430
|
-
}];
|
|
431
|
-
}, {
|
|
432
|
-
readonly name: "multicall";
|
|
433
|
-
readonly type: "function";
|
|
434
|
-
readonly stateMutability: "nonpayable";
|
|
435
|
-
readonly inputs: readonly [{
|
|
436
|
-
readonly type: "bytes[]";
|
|
437
|
-
readonly name: "calls";
|
|
438
|
-
}];
|
|
439
|
-
readonly outputs: readonly [];
|
|
440
|
-
}, {
|
|
441
|
-
readonly name: "obligationCreated";
|
|
442
|
-
readonly type: "function";
|
|
443
|
-
readonly stateMutability: "view";
|
|
444
|
-
readonly inputs: readonly [{
|
|
445
|
-
readonly type: "bytes32";
|
|
446
|
-
readonly name: "id";
|
|
447
|
-
}];
|
|
448
|
-
readonly outputs: readonly [{
|
|
449
|
-
readonly type: "bool";
|
|
450
|
-
}];
|
|
451
|
-
}, {
|
|
452
|
-
readonly name: "obligationState";
|
|
453
|
-
readonly type: "function";
|
|
454
|
-
readonly stateMutability: "view";
|
|
455
|
-
readonly inputs: readonly [{
|
|
456
|
-
readonly type: "bytes32";
|
|
457
|
-
readonly name: "id";
|
|
458
|
-
}];
|
|
459
|
-
readonly outputs: readonly [{
|
|
460
|
-
readonly type: "uint128";
|
|
461
|
-
readonly name: "totalUnits";
|
|
462
|
-
}, {
|
|
463
|
-
readonly type: "uint128";
|
|
464
|
-
readonly name: "totalShares";
|
|
465
|
-
}, {
|
|
466
|
-
readonly type: "uint256";
|
|
467
|
-
readonly name: "withdrawable";
|
|
468
|
-
}, {
|
|
469
|
-
readonly type: "bool";
|
|
470
|
-
readonly name: "created";
|
|
471
|
-
}];
|
|
472
|
-
}, {
|
|
473
|
-
readonly name: "owner";
|
|
474
|
-
readonly type: "function";
|
|
475
|
-
readonly stateMutability: "view";
|
|
476
|
-
readonly inputs: readonly [];
|
|
477
|
-
readonly outputs: readonly [{
|
|
478
|
-
readonly type: "address";
|
|
479
|
-
}];
|
|
480
|
-
}, {
|
|
481
|
-
readonly name: "repay";
|
|
482
|
-
readonly type: "function";
|
|
483
|
-
readonly stateMutability: "nonpayable";
|
|
484
|
-
readonly inputs: readonly [{
|
|
485
|
-
readonly type: "tuple";
|
|
486
|
-
readonly components: readonly [{
|
|
487
|
-
readonly type: "address";
|
|
488
|
-
readonly name: "loanToken";
|
|
489
|
-
}, {
|
|
490
|
-
readonly type: "tuple[]";
|
|
491
|
-
readonly components: readonly [{
|
|
492
|
-
readonly type: "address";
|
|
493
|
-
readonly name: "token";
|
|
494
|
-
}, {
|
|
495
|
-
readonly type: "uint256";
|
|
496
|
-
readonly name: "lltv";
|
|
497
|
-
}, {
|
|
498
|
-
readonly type: "address";
|
|
499
|
-
readonly name: "oracle";
|
|
500
|
-
}];
|
|
501
|
-
readonly name: "collaterals";
|
|
502
|
-
}, {
|
|
503
|
-
readonly type: "uint256";
|
|
504
|
-
readonly name: "maturity";
|
|
505
|
-
}];
|
|
506
|
-
readonly name: "obligation";
|
|
507
|
-
}, {
|
|
508
|
-
readonly type: "uint256";
|
|
509
|
-
readonly name: "obligationUnits";
|
|
510
|
-
}, {
|
|
511
|
-
readonly type: "address";
|
|
512
|
-
readonly name: "onBehalf";
|
|
513
|
-
}];
|
|
514
|
-
readonly outputs: readonly [];
|
|
515
|
-
}, {
|
|
516
|
-
readonly name: "session";
|
|
517
|
-
readonly type: "function";
|
|
518
|
-
readonly stateMutability: "view";
|
|
519
|
-
readonly inputs: readonly [{
|
|
520
|
-
readonly type: "address";
|
|
521
|
-
readonly name: "user";
|
|
522
|
-
}];
|
|
523
|
-
readonly outputs: readonly [{
|
|
524
|
-
readonly type: "bytes32";
|
|
525
|
-
}];
|
|
526
|
-
}, {
|
|
527
|
-
readonly name: "setDefaultTradingFee";
|
|
528
|
-
readonly type: "function";
|
|
529
|
-
readonly stateMutability: "nonpayable";
|
|
530
|
-
readonly inputs: readonly [{
|
|
531
|
-
readonly type: "address";
|
|
532
|
-
readonly name: "loanToken";
|
|
533
|
-
}, {
|
|
534
|
-
readonly type: "uint256";
|
|
535
|
-
readonly name: "index";
|
|
536
|
-
}, {
|
|
537
|
-
readonly type: "uint256";
|
|
538
|
-
readonly name: "newTradingFee";
|
|
539
|
-
}];
|
|
540
|
-
readonly outputs: readonly [];
|
|
541
|
-
}, {
|
|
542
|
-
readonly name: "setFeeSetter";
|
|
543
|
-
readonly type: "function";
|
|
544
|
-
readonly stateMutability: "nonpayable";
|
|
545
|
-
readonly inputs: readonly [{
|
|
546
|
-
readonly type: "address";
|
|
547
|
-
readonly name: "newFeeSetter";
|
|
548
|
-
}];
|
|
549
|
-
readonly outputs: readonly [];
|
|
550
|
-
}, {
|
|
551
|
-
readonly name: "setObligationTradingFee";
|
|
552
|
-
readonly type: "function";
|
|
553
|
-
readonly stateMutability: "nonpayable";
|
|
554
|
-
readonly inputs: readonly [{
|
|
555
|
-
readonly type: "bytes32";
|
|
556
|
-
readonly name: "id";
|
|
557
|
-
}, {
|
|
558
|
-
readonly type: "uint256";
|
|
559
|
-
readonly name: "index";
|
|
560
|
-
}, {
|
|
561
|
-
readonly type: "uint256";
|
|
562
|
-
readonly name: "newTradingFee";
|
|
563
|
-
}];
|
|
564
|
-
readonly outputs: readonly [];
|
|
565
|
-
}, {
|
|
566
|
-
readonly name: "setOwner";
|
|
567
|
-
readonly type: "function";
|
|
568
|
-
readonly stateMutability: "nonpayable";
|
|
569
|
-
readonly inputs: readonly [{
|
|
570
|
-
readonly type: "address";
|
|
571
|
-
readonly name: "newOwner";
|
|
572
|
-
}];
|
|
573
|
-
readonly outputs: readonly [];
|
|
574
|
-
}, {
|
|
575
|
-
readonly name: "setTradingFeeRecipient";
|
|
576
|
-
readonly type: "function";
|
|
577
|
-
readonly stateMutability: "nonpayable";
|
|
578
|
-
readonly inputs: readonly [{
|
|
579
|
-
readonly type: "address";
|
|
580
|
-
readonly name: "feeRecipient";
|
|
581
|
-
}];
|
|
582
|
-
readonly outputs: readonly [];
|
|
583
|
-
}, {
|
|
584
|
-
readonly name: "sharesOf";
|
|
585
|
-
readonly type: "function";
|
|
586
|
-
readonly stateMutability: "view";
|
|
587
|
-
readonly inputs: readonly [{
|
|
588
|
-
readonly type: "bytes32";
|
|
589
|
-
readonly name: "id";
|
|
590
|
-
}, {
|
|
591
|
-
readonly type: "address";
|
|
592
|
-
readonly name: "user";
|
|
593
|
-
}];
|
|
594
|
-
readonly outputs: readonly [{
|
|
595
|
-
readonly type: "uint256";
|
|
596
|
-
}];
|
|
597
|
-
}, {
|
|
598
|
-
readonly name: "shuffleSession";
|
|
599
|
-
readonly type: "function";
|
|
600
|
-
readonly stateMutability: "nonpayable";
|
|
601
|
-
readonly inputs: readonly [];
|
|
602
|
-
readonly outputs: readonly [];
|
|
603
|
-
}, {
|
|
604
|
-
readonly name: "supplyCollateral";
|
|
605
|
-
readonly type: "function";
|
|
606
|
-
readonly stateMutability: "nonpayable";
|
|
607
|
-
readonly inputs: readonly [{
|
|
608
|
-
readonly type: "tuple";
|
|
609
|
-
readonly components: readonly [{
|
|
610
|
-
readonly type: "address";
|
|
611
|
-
readonly name: "loanToken";
|
|
612
|
-
}, {
|
|
613
|
-
readonly type: "tuple[]";
|
|
614
|
-
readonly components: readonly [{
|
|
615
|
-
readonly type: "address";
|
|
616
|
-
readonly name: "token";
|
|
617
|
-
}, {
|
|
618
|
-
readonly type: "uint256";
|
|
619
|
-
readonly name: "lltv";
|
|
620
|
-
}, {
|
|
621
|
-
readonly type: "address";
|
|
622
|
-
readonly name: "oracle";
|
|
623
|
-
}];
|
|
624
|
-
readonly name: "collaterals";
|
|
625
|
-
}, {
|
|
626
|
-
readonly type: "uint256";
|
|
627
|
-
readonly name: "maturity";
|
|
628
|
-
}];
|
|
629
|
-
readonly name: "obligation";
|
|
630
|
-
}, {
|
|
631
|
-
readonly type: "address";
|
|
632
|
-
readonly name: "collateral";
|
|
633
|
-
}, {
|
|
634
|
-
readonly type: "uint256";
|
|
635
|
-
readonly name: "assets";
|
|
636
|
-
}, {
|
|
637
|
-
readonly type: "address";
|
|
638
|
-
readonly name: "onBehalf";
|
|
639
|
-
}];
|
|
640
|
-
readonly outputs: readonly [];
|
|
641
|
-
}, {
|
|
642
|
-
readonly name: "take";
|
|
643
|
-
readonly type: "function";
|
|
644
|
-
readonly stateMutability: "nonpayable";
|
|
645
|
-
readonly inputs: readonly [{
|
|
646
|
-
readonly type: "uint256";
|
|
647
|
-
readonly name: "buyerAssets";
|
|
648
|
-
}, {
|
|
649
|
-
readonly type: "uint256";
|
|
650
|
-
readonly name: "sellerAssets";
|
|
651
|
-
}, {
|
|
652
|
-
readonly type: "uint256";
|
|
653
|
-
readonly name: "obligationUnits";
|
|
654
|
-
}, {
|
|
655
|
-
readonly type: "uint256";
|
|
656
|
-
readonly name: "obligationShares";
|
|
657
|
-
}, {
|
|
658
|
-
readonly type: "address";
|
|
659
|
-
readonly name: "taker";
|
|
660
|
-
}, {
|
|
661
|
-
readonly type: "address";
|
|
662
|
-
readonly name: "takerCallback";
|
|
663
|
-
}, {
|
|
664
|
-
readonly type: "bytes";
|
|
665
|
-
readonly name: "takerCallbackData";
|
|
666
|
-
}, {
|
|
667
|
-
readonly type: "address";
|
|
668
|
-
readonly name: "receiverIfTakerIsSeller";
|
|
669
|
-
}, {
|
|
670
|
-
readonly type: "tuple";
|
|
671
|
-
readonly components: readonly [{
|
|
672
|
-
readonly type: "tuple";
|
|
673
|
-
readonly components: readonly [{
|
|
674
|
-
readonly type: "address";
|
|
675
|
-
readonly name: "loanToken";
|
|
676
|
-
}, {
|
|
677
|
-
readonly type: "tuple[]";
|
|
678
|
-
readonly components: readonly [{
|
|
679
|
-
readonly type: "address";
|
|
680
|
-
readonly name: "token";
|
|
681
|
-
}, {
|
|
682
|
-
readonly type: "uint256";
|
|
683
|
-
readonly name: "lltv";
|
|
684
|
-
}, {
|
|
685
|
-
readonly type: "address";
|
|
686
|
-
readonly name: "oracle";
|
|
687
|
-
}];
|
|
688
|
-
readonly name: "collaterals";
|
|
689
|
-
}, {
|
|
690
|
-
readonly type: "uint256";
|
|
691
|
-
readonly name: "maturity";
|
|
692
|
-
}];
|
|
693
|
-
readonly name: "obligation";
|
|
694
|
-
}, {
|
|
695
|
-
readonly type: "bool";
|
|
696
|
-
readonly name: "buy";
|
|
697
|
-
}, {
|
|
698
|
-
readonly type: "address";
|
|
699
|
-
readonly name: "maker";
|
|
700
|
-
}, {
|
|
701
|
-
readonly type: "uint256";
|
|
702
|
-
readonly name: "assets";
|
|
703
|
-
}, {
|
|
704
|
-
readonly type: "uint256";
|
|
705
|
-
readonly name: "obligationUnits";
|
|
706
|
-
}, {
|
|
707
|
-
readonly type: "uint256";
|
|
708
|
-
readonly name: "obligationShares";
|
|
709
|
-
}, {
|
|
710
|
-
readonly type: "uint256";
|
|
711
|
-
readonly name: "start";
|
|
712
|
-
}, {
|
|
713
|
-
readonly type: "uint256";
|
|
714
|
-
readonly name: "expiry";
|
|
715
|
-
}, {
|
|
716
|
-
readonly type: "uint256";
|
|
717
|
-
readonly name: "tick";
|
|
718
|
-
}, {
|
|
719
|
-
readonly type: "bytes32";
|
|
720
|
-
readonly name: "group";
|
|
721
|
-
}, {
|
|
722
|
-
readonly type: "bytes32";
|
|
723
|
-
readonly name: "session";
|
|
724
|
-
}, {
|
|
725
|
-
readonly type: "address";
|
|
726
|
-
readonly name: "callback";
|
|
727
|
-
}, {
|
|
728
|
-
readonly type: "bytes";
|
|
729
|
-
readonly name: "callbackData";
|
|
730
|
-
}, {
|
|
731
|
-
readonly type: "address";
|
|
732
|
-
readonly name: "receiverIfMakerIsSeller";
|
|
733
|
-
}];
|
|
734
|
-
readonly name: "offer";
|
|
735
|
-
}, {
|
|
736
|
-
readonly type: "tuple";
|
|
737
|
-
readonly components: readonly [{
|
|
738
|
-
readonly type: "uint8";
|
|
739
|
-
readonly name: "v";
|
|
740
|
-
}, {
|
|
741
|
-
readonly type: "bytes32";
|
|
742
|
-
readonly name: "r";
|
|
743
|
-
}, {
|
|
744
|
-
readonly type: "bytes32";
|
|
745
|
-
readonly name: "s";
|
|
746
|
-
}];
|
|
747
|
-
readonly name: "sig";
|
|
748
|
-
}, {
|
|
749
|
-
readonly type: "bytes32";
|
|
750
|
-
readonly name: "root";
|
|
751
|
-
}, {
|
|
752
|
-
readonly type: "bytes32[]";
|
|
753
|
-
readonly name: "proof";
|
|
754
|
-
}];
|
|
755
|
-
readonly outputs: readonly [{
|
|
756
|
-
readonly type: "uint256";
|
|
757
|
-
}, {
|
|
758
|
-
readonly type: "uint256";
|
|
759
|
-
}, {
|
|
760
|
-
readonly type: "uint256";
|
|
761
|
-
}, {
|
|
762
|
-
readonly type: "uint256";
|
|
763
|
-
}];
|
|
764
|
-
}, {
|
|
765
|
-
readonly name: "totalShares";
|
|
766
|
-
readonly type: "function";
|
|
767
|
-
readonly stateMutability: "view";
|
|
768
|
-
readonly inputs: readonly [{
|
|
769
|
-
readonly type: "bytes32";
|
|
770
|
-
readonly name: "id";
|
|
771
|
-
}];
|
|
772
|
-
readonly outputs: readonly [{
|
|
773
|
-
readonly type: "uint256";
|
|
774
|
-
}];
|
|
775
|
-
}, {
|
|
776
|
-
readonly name: "totalUnits";
|
|
777
|
-
readonly type: "function";
|
|
778
|
-
readonly stateMutability: "view";
|
|
779
|
-
readonly inputs: readonly [{
|
|
780
|
-
readonly type: "bytes32";
|
|
781
|
-
readonly name: "id";
|
|
782
|
-
}];
|
|
783
|
-
readonly outputs: readonly [{
|
|
784
|
-
readonly type: "uint256";
|
|
785
|
-
}];
|
|
786
|
-
}, {
|
|
787
|
-
readonly name: "touchObligation";
|
|
788
|
-
readonly type: "function";
|
|
789
|
-
readonly stateMutability: "nonpayable";
|
|
790
|
-
readonly inputs: readonly [{
|
|
791
|
-
readonly type: "tuple";
|
|
792
|
-
readonly components: readonly [{
|
|
793
|
-
readonly type: "address";
|
|
794
|
-
readonly name: "loanToken";
|
|
795
|
-
}, {
|
|
796
|
-
readonly type: "tuple[]";
|
|
797
|
-
readonly components: readonly [{
|
|
798
|
-
readonly type: "address";
|
|
799
|
-
readonly name: "token";
|
|
800
|
-
}, {
|
|
801
|
-
readonly type: "uint256";
|
|
802
|
-
readonly name: "lltv";
|
|
803
|
-
}, {
|
|
804
|
-
readonly type: "address";
|
|
805
|
-
readonly name: "oracle";
|
|
806
|
-
}];
|
|
807
|
-
readonly name: "collaterals";
|
|
808
|
-
}, {
|
|
809
|
-
readonly type: "uint256";
|
|
810
|
-
readonly name: "maturity";
|
|
811
|
-
}];
|
|
812
|
-
readonly name: "obligation";
|
|
813
|
-
}];
|
|
814
|
-
readonly outputs: readonly [{
|
|
815
|
-
readonly type: "bytes32";
|
|
816
|
-
}];
|
|
817
|
-
}, {
|
|
818
|
-
readonly name: "tradingFee";
|
|
819
|
-
readonly type: "function";
|
|
820
|
-
readonly stateMutability: "view";
|
|
821
|
-
readonly inputs: readonly [{
|
|
822
|
-
readonly type: "bytes32";
|
|
823
|
-
readonly name: "id";
|
|
824
|
-
}, {
|
|
825
|
-
readonly type: "uint256";
|
|
826
|
-
readonly name: "timeToMaturity";
|
|
827
|
-
}];
|
|
828
|
-
readonly outputs: readonly [{
|
|
829
|
-
readonly type: "uint256";
|
|
830
|
-
}];
|
|
831
|
-
}, {
|
|
832
|
-
readonly name: "tradingFeeRecipient";
|
|
833
|
-
readonly type: "function";
|
|
834
|
-
readonly stateMutability: "view";
|
|
835
|
-
readonly inputs: readonly [];
|
|
836
|
-
readonly outputs: readonly [{
|
|
837
|
-
readonly type: "address";
|
|
838
|
-
}];
|
|
839
|
-
}, {
|
|
840
|
-
readonly name: "withdraw";
|
|
841
|
-
readonly type: "function";
|
|
842
|
-
readonly stateMutability: "nonpayable";
|
|
843
|
-
readonly inputs: readonly [{
|
|
844
|
-
readonly type: "tuple";
|
|
845
|
-
readonly components: readonly [{
|
|
846
|
-
readonly type: "address";
|
|
847
|
-
readonly name: "loanToken";
|
|
848
|
-
}, {
|
|
849
|
-
readonly type: "tuple[]";
|
|
850
|
-
readonly components: readonly [{
|
|
851
|
-
readonly type: "address";
|
|
852
|
-
readonly name: "token";
|
|
853
|
-
}, {
|
|
854
|
-
readonly type: "uint256";
|
|
855
|
-
readonly name: "lltv";
|
|
856
|
-
}, {
|
|
857
|
-
readonly type: "address";
|
|
858
|
-
readonly name: "oracle";
|
|
859
|
-
}];
|
|
860
|
-
readonly name: "collaterals";
|
|
861
|
-
}, {
|
|
862
|
-
readonly type: "uint256";
|
|
863
|
-
readonly name: "maturity";
|
|
864
|
-
}];
|
|
865
|
-
readonly name: "obligation";
|
|
866
|
-
}, {
|
|
867
|
-
readonly type: "uint256";
|
|
868
|
-
readonly name: "obligationUnits";
|
|
869
|
-
}, {
|
|
870
|
-
readonly type: "uint256";
|
|
871
|
-
readonly name: "shares";
|
|
872
|
-
}, {
|
|
873
|
-
readonly type: "address";
|
|
874
|
-
readonly name: "onBehalf";
|
|
875
|
-
}, {
|
|
876
|
-
readonly type: "address";
|
|
877
|
-
readonly name: "receiver";
|
|
878
|
-
}];
|
|
879
|
-
readonly outputs: readonly [{
|
|
880
|
-
readonly type: "uint256";
|
|
881
|
-
}, {
|
|
882
|
-
readonly type: "uint256";
|
|
883
|
-
}];
|
|
884
|
-
}, {
|
|
885
|
-
readonly name: "withdrawCollateral";
|
|
886
|
-
readonly type: "function";
|
|
887
|
-
readonly stateMutability: "nonpayable";
|
|
888
|
-
readonly inputs: readonly [{
|
|
889
|
-
readonly type: "tuple";
|
|
890
|
-
readonly components: readonly [{
|
|
891
|
-
readonly type: "address";
|
|
892
|
-
readonly name: "loanToken";
|
|
893
|
-
}, {
|
|
894
|
-
readonly type: "tuple[]";
|
|
895
|
-
readonly components: readonly [{
|
|
896
|
-
readonly type: "address";
|
|
897
|
-
readonly name: "token";
|
|
898
|
-
}, {
|
|
899
|
-
readonly type: "uint256";
|
|
900
|
-
readonly name: "lltv";
|
|
901
|
-
}, {
|
|
902
|
-
readonly type: "address";
|
|
903
|
-
readonly name: "oracle";
|
|
904
|
-
}];
|
|
905
|
-
readonly name: "collaterals";
|
|
906
|
-
}, {
|
|
907
|
-
readonly type: "uint256";
|
|
908
|
-
readonly name: "maturity";
|
|
909
|
-
}];
|
|
910
|
-
readonly name: "obligation";
|
|
911
|
-
}, {
|
|
912
|
-
readonly type: "address";
|
|
913
|
-
readonly name: "collateral";
|
|
914
|
-
}, {
|
|
915
|
-
readonly type: "uint256";
|
|
916
|
-
readonly name: "assets";
|
|
917
|
-
}, {
|
|
918
|
-
readonly type: "address";
|
|
919
|
-
readonly name: "onBehalf";
|
|
920
|
-
}, {
|
|
921
|
-
readonly type: "address";
|
|
922
|
-
readonly name: "receiver";
|
|
923
|
-
}];
|
|
924
|
-
readonly outputs: readonly [];
|
|
925
|
-
}, {
|
|
926
|
-
readonly name: "withdrawable";
|
|
927
|
-
readonly type: "function";
|
|
928
|
-
readonly stateMutability: "view";
|
|
929
|
-
readonly inputs: readonly [{
|
|
930
|
-
readonly type: "bytes32";
|
|
931
|
-
readonly name: "id";
|
|
932
|
-
}];
|
|
933
|
-
readonly outputs: readonly [{
|
|
934
|
-
readonly type: "uint256";
|
|
935
|
-
}];
|
|
936
|
-
}, {
|
|
937
|
-
readonly name: "Constructor";
|
|
938
|
-
readonly type: "event";
|
|
939
|
-
readonly inputs: readonly [{
|
|
940
|
-
readonly type: "address";
|
|
941
|
-
readonly name: "owner";
|
|
942
|
-
readonly indexed: true;
|
|
943
|
-
}];
|
|
944
|
-
}, {
|
|
945
|
-
readonly name: "Consume";
|
|
946
|
-
readonly type: "event";
|
|
947
|
-
readonly inputs: readonly [{
|
|
948
|
-
readonly type: "address";
|
|
949
|
-
readonly name: "user";
|
|
950
|
-
readonly indexed: true;
|
|
951
|
-
}, {
|
|
952
|
-
readonly type: "bytes32";
|
|
953
|
-
readonly name: "group";
|
|
954
|
-
readonly indexed: true;
|
|
955
|
-
}, {
|
|
956
|
-
readonly type: "uint256";
|
|
957
|
-
readonly name: "amount";
|
|
958
|
-
}];
|
|
959
|
-
}, {
|
|
960
|
-
readonly name: "FlashLoan";
|
|
961
|
-
readonly type: "event";
|
|
962
|
-
readonly inputs: readonly [{
|
|
963
|
-
readonly type: "address";
|
|
964
|
-
readonly name: "caller";
|
|
965
|
-
readonly indexed: true;
|
|
966
|
-
}, {
|
|
967
|
-
readonly type: "address";
|
|
968
|
-
readonly name: "token";
|
|
969
|
-
readonly indexed: true;
|
|
970
|
-
}, {
|
|
971
|
-
readonly type: "uint256";
|
|
972
|
-
readonly name: "assets";
|
|
973
|
-
}];
|
|
974
|
-
}, {
|
|
975
|
-
readonly name: "Liquidate";
|
|
976
|
-
readonly type: "event";
|
|
977
|
-
readonly inputs: readonly [{
|
|
978
|
-
readonly type: "address";
|
|
979
|
-
readonly name: "caller";
|
|
980
|
-
readonly indexed: true;
|
|
981
|
-
}, {
|
|
982
|
-
readonly type: "bytes32";
|
|
983
|
-
readonly name: "id";
|
|
984
|
-
readonly indexed: true;
|
|
985
|
-
}, {
|
|
986
|
-
readonly type: "tuple[]";
|
|
987
|
-
readonly components: readonly [{
|
|
988
|
-
readonly type: "uint256";
|
|
989
|
-
readonly name: "collateralIndex";
|
|
990
|
-
}, {
|
|
991
|
-
readonly type: "uint256";
|
|
992
|
-
readonly name: "repaid";
|
|
993
|
-
}, {
|
|
994
|
-
readonly type: "uint256";
|
|
995
|
-
readonly name: "seized";
|
|
996
|
-
}];
|
|
997
|
-
readonly name: "seizures";
|
|
998
|
-
}, {
|
|
999
|
-
readonly type: "address";
|
|
1000
|
-
readonly name: "borrower";
|
|
1001
|
-
readonly indexed: true;
|
|
1002
|
-
}, {
|
|
1003
|
-
readonly type: "uint256";
|
|
1004
|
-
readonly name: "totalRepaid";
|
|
1005
|
-
}, {
|
|
1006
|
-
readonly type: "uint256";
|
|
1007
|
-
readonly name: "badDebt";
|
|
1008
|
-
}];
|
|
1009
|
-
}, {
|
|
1010
|
-
readonly name: "ObligationCreated";
|
|
1011
|
-
readonly type: "event";
|
|
1012
|
-
readonly inputs: readonly [{
|
|
1013
|
-
readonly type: "bytes32";
|
|
1014
|
-
readonly name: "id";
|
|
1015
|
-
readonly indexed: true;
|
|
1016
|
-
}, {
|
|
1017
|
-
readonly type: "tuple";
|
|
1018
|
-
readonly components: readonly [{
|
|
1019
|
-
readonly type: "address";
|
|
1020
|
-
readonly name: "loanToken";
|
|
1021
|
-
}, {
|
|
1022
|
-
readonly type: "tuple[]";
|
|
1023
|
-
readonly components: readonly [{
|
|
1024
|
-
readonly type: "address";
|
|
1025
|
-
readonly name: "token";
|
|
1026
|
-
}, {
|
|
1027
|
-
readonly type: "uint256";
|
|
1028
|
-
readonly name: "lltv";
|
|
1029
|
-
}, {
|
|
1030
|
-
readonly type: "address";
|
|
1031
|
-
readonly name: "oracle";
|
|
1032
|
-
}];
|
|
1033
|
-
readonly name: "collaterals";
|
|
1034
|
-
}, {
|
|
1035
|
-
readonly type: "uint256";
|
|
1036
|
-
readonly name: "maturity";
|
|
1037
|
-
}];
|
|
1038
|
-
readonly name: "obligation";
|
|
1039
|
-
}];
|
|
1040
|
-
}, {
|
|
1041
|
-
readonly name: "Repay";
|
|
1042
|
-
readonly type: "event";
|
|
1043
|
-
readonly inputs: readonly [{
|
|
1044
|
-
readonly type: "address";
|
|
1045
|
-
readonly name: "caller";
|
|
1046
|
-
readonly indexed: true;
|
|
1047
|
-
}, {
|
|
1048
|
-
readonly type: "bytes32";
|
|
1049
|
-
readonly name: "id";
|
|
1050
|
-
readonly indexed: true;
|
|
1051
|
-
}, {
|
|
1052
|
-
readonly type: "uint256";
|
|
1053
|
-
readonly name: "obligationUnits";
|
|
1054
|
-
}, {
|
|
1055
|
-
readonly type: "address";
|
|
1056
|
-
readonly name: "onBehalf";
|
|
1057
|
-
readonly indexed: true;
|
|
1058
|
-
}];
|
|
1059
|
-
}, {
|
|
1060
|
-
readonly name: "SetDefaultTradingFee";
|
|
1061
|
-
readonly type: "event";
|
|
1062
|
-
readonly inputs: readonly [{
|
|
1063
|
-
readonly type: "address";
|
|
1064
|
-
readonly name: "loanToken";
|
|
1065
|
-
readonly indexed: true;
|
|
1066
|
-
}, {
|
|
1067
|
-
readonly type: "uint256";
|
|
1068
|
-
readonly name: "index";
|
|
1069
|
-
readonly indexed: true;
|
|
1070
|
-
}, {
|
|
1071
|
-
readonly type: "uint256";
|
|
1072
|
-
readonly name: "newTradingFee";
|
|
1073
|
-
}];
|
|
1074
|
-
}, {
|
|
1075
|
-
readonly name: "SetFeeSetter";
|
|
1076
|
-
readonly type: "event";
|
|
1077
|
-
readonly inputs: readonly [{
|
|
1078
|
-
readonly type: "address";
|
|
1079
|
-
readonly name: "feeSetter";
|
|
1080
|
-
readonly indexed: true;
|
|
1081
|
-
}];
|
|
1082
|
-
}, {
|
|
1083
|
-
readonly name: "SetObligationTradingFee";
|
|
1084
|
-
readonly type: "event";
|
|
1085
|
-
readonly inputs: readonly [{
|
|
1086
|
-
readonly type: "bytes32";
|
|
1087
|
-
readonly name: "id";
|
|
1088
|
-
readonly indexed: true;
|
|
1089
|
-
}, {
|
|
1090
|
-
readonly type: "uint256";
|
|
1091
|
-
readonly name: "index";
|
|
1092
|
-
readonly indexed: true;
|
|
1093
|
-
}, {
|
|
1094
|
-
readonly type: "uint256";
|
|
1095
|
-
readonly name: "newTradingFee";
|
|
1096
|
-
}];
|
|
1097
|
-
}, {
|
|
1098
|
-
readonly name: "SetOwner";
|
|
1099
|
-
readonly type: "event";
|
|
1100
|
-
readonly inputs: readonly [{
|
|
1101
|
-
readonly type: "address";
|
|
1102
|
-
readonly name: "owner";
|
|
1103
|
-
readonly indexed: true;
|
|
1104
|
-
}];
|
|
1105
|
-
}, {
|
|
1106
|
-
readonly name: "SetTradingFeeRecipient";
|
|
1107
|
-
readonly type: "event";
|
|
1108
|
-
readonly inputs: readonly [{
|
|
1109
|
-
readonly type: "address";
|
|
1110
|
-
readonly name: "feeRecipient";
|
|
1111
|
-
readonly indexed: true;
|
|
1112
|
-
}];
|
|
1113
|
-
}, {
|
|
1114
|
-
readonly name: "ShuffleSession";
|
|
1115
|
-
readonly type: "event";
|
|
1116
|
-
readonly inputs: readonly [{
|
|
1117
|
-
readonly type: "address";
|
|
1118
|
-
readonly name: "user";
|
|
1119
|
-
readonly indexed: true;
|
|
1120
|
-
}, {
|
|
1121
|
-
readonly type: "bytes32";
|
|
1122
|
-
readonly name: "session";
|
|
1123
|
-
}];
|
|
1124
|
-
}, {
|
|
1125
|
-
readonly name: "SupplyCollateral";
|
|
1126
|
-
readonly type: "event";
|
|
1127
|
-
readonly inputs: readonly [{
|
|
1128
|
-
readonly type: "address";
|
|
1129
|
-
readonly name: "caller";
|
|
1130
|
-
}, {
|
|
1131
|
-
readonly type: "bytes32";
|
|
1132
|
-
readonly name: "id";
|
|
1133
|
-
readonly indexed: true;
|
|
1134
|
-
}, {
|
|
1135
|
-
readonly type: "address";
|
|
1136
|
-
readonly name: "collateral";
|
|
1137
|
-
readonly indexed: true;
|
|
1138
|
-
}, {
|
|
1139
|
-
readonly type: "uint256";
|
|
1140
|
-
readonly name: "assets";
|
|
1141
|
-
}, {
|
|
1142
|
-
readonly type: "address";
|
|
1143
|
-
readonly name: "onBehalf";
|
|
1144
|
-
readonly indexed: true;
|
|
1145
|
-
}];
|
|
1146
|
-
}, {
|
|
1147
|
-
readonly name: "Take";
|
|
1148
|
-
readonly type: "event";
|
|
1149
|
-
readonly inputs: readonly [{
|
|
1150
|
-
readonly type: "address";
|
|
1151
|
-
readonly name: "caller";
|
|
1152
|
-
}, {
|
|
1153
|
-
readonly type: "bytes32";
|
|
1154
|
-
readonly name: "id";
|
|
1155
|
-
readonly indexed: true;
|
|
1156
|
-
}, {
|
|
1157
|
-
readonly type: "address";
|
|
1158
|
-
readonly name: "maker";
|
|
1159
|
-
readonly indexed: true;
|
|
1160
|
-
}, {
|
|
1161
|
-
readonly type: "address";
|
|
1162
|
-
readonly name: "taker";
|
|
1163
|
-
readonly indexed: true;
|
|
1164
|
-
}, {
|
|
1165
|
-
readonly type: "bool";
|
|
1166
|
-
readonly name: "offerIsBuy";
|
|
1167
|
-
}, {
|
|
1168
|
-
readonly type: "uint256";
|
|
1169
|
-
readonly name: "buyerAssets";
|
|
1170
|
-
}, {
|
|
1171
|
-
readonly type: "uint256";
|
|
1172
|
-
readonly name: "sellerAssets";
|
|
1173
|
-
}, {
|
|
1174
|
-
readonly type: "uint256";
|
|
1175
|
-
readonly name: "obligationUnits";
|
|
1176
|
-
}, {
|
|
1177
|
-
readonly type: "uint256";
|
|
1178
|
-
readonly name: "obligationShares";
|
|
1179
|
-
}, {
|
|
1180
|
-
readonly type: "bool";
|
|
1181
|
-
readonly name: "buyerIsLender";
|
|
1182
|
-
}, {
|
|
1183
|
-
readonly type: "bool";
|
|
1184
|
-
readonly name: "sellerIsBorrower";
|
|
1185
|
-
}, {
|
|
1186
|
-
readonly type: "address";
|
|
1187
|
-
readonly name: "sellerReceiver";
|
|
1188
|
-
}, {
|
|
1189
|
-
readonly type: "bytes32";
|
|
1190
|
-
readonly name: "group";
|
|
1191
|
-
}, {
|
|
1192
|
-
readonly type: "uint256";
|
|
1193
|
-
readonly name: "consumed";
|
|
1194
|
-
}];
|
|
1195
|
-
}, {
|
|
1196
|
-
readonly name: "Withdraw";
|
|
1197
|
-
readonly type: "event";
|
|
1198
|
-
readonly inputs: readonly [{
|
|
1199
|
-
readonly type: "address";
|
|
1200
|
-
readonly name: "caller";
|
|
1201
|
-
}, {
|
|
1202
|
-
readonly type: "bytes32";
|
|
1203
|
-
readonly name: "id";
|
|
1204
|
-
readonly indexed: true;
|
|
1205
|
-
}, {
|
|
1206
|
-
readonly type: "uint256";
|
|
1207
|
-
readonly name: "obligationUnits";
|
|
1208
|
-
}, {
|
|
1209
|
-
readonly type: "uint256";
|
|
1210
|
-
readonly name: "shares";
|
|
1211
|
-
}, {
|
|
1212
|
-
readonly type: "address";
|
|
1213
|
-
readonly name: "onBehalf";
|
|
1214
|
-
readonly indexed: true;
|
|
1215
|
-
}, {
|
|
1216
|
-
readonly type: "address";
|
|
1217
|
-
readonly name: "receiver";
|
|
1218
|
-
readonly indexed: true;
|
|
1219
|
-
}];
|
|
1220
|
-
}, {
|
|
1221
|
-
readonly name: "WithdrawCollateral";
|
|
1222
|
-
readonly type: "event";
|
|
1223
|
-
readonly inputs: readonly [{
|
|
1224
|
-
readonly type: "address";
|
|
1225
|
-
readonly name: "caller";
|
|
1226
|
-
}, {
|
|
1227
|
-
readonly type: "bytes32";
|
|
1228
|
-
readonly name: "id";
|
|
1229
|
-
readonly indexed: true;
|
|
1230
|
-
}, {
|
|
1231
|
-
readonly type: "address";
|
|
1232
|
-
readonly name: "collateral";
|
|
1233
|
-
readonly indexed: true;
|
|
1234
|
-
}, {
|
|
1235
|
-
readonly type: "uint256";
|
|
1236
|
-
readonly name: "assets";
|
|
1237
|
-
}, {
|
|
1238
|
-
readonly type: "address";
|
|
1239
|
-
readonly name: "onBehalf";
|
|
1240
|
-
readonly indexed: true;
|
|
1241
|
-
}, {
|
|
1242
|
-
readonly type: "address";
|
|
1243
|
-
readonly name: "receiver";
|
|
1244
|
-
}];
|
|
1245
|
-
}];
|
|
1246
|
-
type MorphoV2 = typeof MorphoV2;
|
|
1247
|
-
declare namespace index_d_exports {
|
|
1248
|
-
export { ERC4626, MetaMorpho, MetaMorphoFactory, Morpho, MorphoV2, Oracle$1 as Oracle };
|
|
1249
|
-
}
|
|
1250
|
-
declare const Oracle$1: readonly [{
|
|
1251
|
-
readonly type: "function";
|
|
1252
|
-
readonly name: "price";
|
|
1253
|
-
readonly inputs: readonly [];
|
|
1254
|
-
readonly outputs: readonly [{
|
|
1255
|
-
readonly name: "";
|
|
1256
|
-
readonly type: "uint256";
|
|
1257
|
-
}];
|
|
1258
|
-
readonly stateMutability: "view";
|
|
1259
|
-
}];
|
|
1260
|
-
declare const ERC4626: readonly [{
|
|
1261
|
-
readonly type: "function";
|
|
1262
|
-
readonly name: "asset";
|
|
1263
|
-
readonly inputs: readonly [];
|
|
1264
|
-
readonly outputs: readonly [{
|
|
1265
|
-
readonly name: "";
|
|
1266
|
-
readonly type: "address";
|
|
1267
|
-
}];
|
|
1268
|
-
readonly stateMutability: "view";
|
|
1269
|
-
}];
|
|
1270
|
-
declare const Morpho: readonly [{
|
|
1271
|
-
readonly type: "function";
|
|
1272
|
-
readonly name: "collateralOf";
|
|
1273
|
-
readonly inputs: readonly [{
|
|
1274
|
-
readonly name: "";
|
|
1275
|
-
readonly type: "address";
|
|
1276
|
-
readonly internalType: "address";
|
|
1277
|
-
}, {
|
|
1278
|
-
readonly name: "";
|
|
1279
|
-
readonly type: "bytes32";
|
|
1280
|
-
readonly internalType: "bytes32";
|
|
1281
|
-
}, {
|
|
1282
|
-
readonly name: "";
|
|
1283
|
-
readonly type: "address";
|
|
1284
|
-
readonly internalType: "address";
|
|
1285
|
-
}];
|
|
1286
|
-
readonly outputs: readonly [{
|
|
1287
|
-
readonly name: "";
|
|
1288
|
-
readonly type: "uint256";
|
|
1289
|
-
readonly internalType: "uint256";
|
|
1290
|
-
}];
|
|
1291
|
-
readonly stateMutability: "view";
|
|
1292
|
-
}, {
|
|
1293
|
-
readonly type: "function";
|
|
1294
|
-
readonly name: "debtOf";
|
|
1295
|
-
readonly inputs: readonly [{
|
|
1296
|
-
readonly name: "";
|
|
1297
|
-
readonly type: "address";
|
|
1298
|
-
readonly internalType: "address";
|
|
1299
|
-
}, {
|
|
1300
|
-
readonly name: "";
|
|
1301
|
-
readonly type: "bytes32";
|
|
1302
|
-
readonly internalType: "bytes32";
|
|
1303
|
-
}];
|
|
1304
|
-
readonly outputs: readonly [{
|
|
1305
|
-
readonly name: "";
|
|
1306
|
-
readonly type: "uint256";
|
|
1307
|
-
readonly internalType: "uint256";
|
|
1308
|
-
}];
|
|
1309
|
-
readonly stateMutability: "view";
|
|
1310
|
-
}, {
|
|
1311
|
-
readonly type: "function";
|
|
1312
|
-
readonly name: "market";
|
|
1313
|
-
readonly inputs: readonly [{
|
|
1314
|
-
readonly name: "id";
|
|
1315
|
-
readonly type: "bytes32";
|
|
1316
|
-
readonly internalType: "Id";
|
|
1317
|
-
}];
|
|
1318
|
-
readonly outputs: readonly [{
|
|
1319
|
-
readonly name: "totalSupplyAssets";
|
|
1320
|
-
readonly type: "uint128";
|
|
1321
|
-
readonly internalType: "uint128";
|
|
1322
|
-
}, {
|
|
1323
|
-
readonly name: "totalSupplyShares";
|
|
1324
|
-
readonly type: "uint128";
|
|
1325
|
-
readonly internalType: "uint128";
|
|
1326
|
-
}, {
|
|
1327
|
-
readonly name: "totalBorrowAssets";
|
|
1328
|
-
readonly type: "uint128";
|
|
1329
|
-
readonly internalType: "uint128";
|
|
1330
|
-
}, {
|
|
1331
|
-
readonly name: "totalBorrowShares";
|
|
1332
|
-
readonly type: "uint128";
|
|
1333
|
-
readonly internalType: "uint128";
|
|
1334
|
-
}, {
|
|
1335
|
-
readonly name: "lastUpdate";
|
|
1336
|
-
readonly type: "uint128";
|
|
1337
|
-
readonly internalType: "uint128";
|
|
1338
|
-
}, {
|
|
1339
|
-
readonly name: "fee";
|
|
1340
|
-
readonly type: "uint128";
|
|
1341
|
-
readonly internalType: "uint128";
|
|
1342
|
-
}];
|
|
1343
|
-
readonly stateMutability: "view";
|
|
1344
|
-
}, {
|
|
1345
|
-
readonly type: "function";
|
|
1346
|
-
readonly name: "position";
|
|
1347
|
-
readonly inputs: readonly [{
|
|
1348
|
-
readonly name: "id";
|
|
1349
|
-
readonly type: "bytes32";
|
|
1350
|
-
readonly internalType: "Id";
|
|
1351
|
-
}, {
|
|
1352
|
-
readonly name: "user";
|
|
1353
|
-
readonly type: "address";
|
|
1354
|
-
readonly internalType: "address";
|
|
1355
|
-
}];
|
|
1356
|
-
readonly outputs: readonly [{
|
|
1357
|
-
readonly name: "supplyShares";
|
|
1358
|
-
readonly type: "uint256";
|
|
1359
|
-
readonly internalType: "uint256";
|
|
1360
|
-
}, {
|
|
1361
|
-
readonly name: "borrowShares";
|
|
1362
|
-
readonly type: "uint128";
|
|
1363
|
-
readonly internalType: "uint128";
|
|
1364
|
-
}, {
|
|
1365
|
-
readonly name: "collateral";
|
|
1366
|
-
readonly type: "uint128";
|
|
1367
|
-
readonly internalType: "uint128";
|
|
1368
|
-
}];
|
|
1369
|
-
readonly stateMutability: "view";
|
|
1370
|
-
}];
|
|
1371
|
-
declare namespace Callback_d_exports {
|
|
1372
|
-
export { Callback, Type$1 as Type, isEmptyCallback };
|
|
1373
|
-
}
|
|
1374
|
-
type Callback = {
|
|
1375
|
-
type: Type$1.BuyWithEmptyCallback;
|
|
1376
|
-
} | {
|
|
1377
|
-
type: Type$1.SellWithEmptyCallback;
|
|
1378
|
-
};
|
|
1379
|
-
declare enum Type$1 {
|
|
1380
|
-
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
1381
|
-
SellWithEmptyCallback = "sell_with_empty_callback"
|
|
1382
|
-
}
|
|
1383
|
-
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
1384
|
-
declare namespace Errors_d_exports {
|
|
1385
|
-
export { BaseError, GlobalErrorType, ReorgError };
|
|
1386
|
-
}
|
|
1387
|
-
type GlobalErrorType<name extends string = "Error"> = Error & {
|
|
1388
|
-
name: name;
|
|
1389
|
-
};
|
|
1390
|
-
/**
|
|
1391
|
-
* Base error class inherited by all errors thrown by mempool.
|
|
1392
|
-
*
|
|
1393
|
-
* @example
|
|
1394
|
-
* ```ts
|
|
1395
|
-
* import { Errors } from 'mempool'
|
|
1396
|
-
* throw new Errors.BaseError('An error occurred')
|
|
1397
|
-
* ```
|
|
1398
|
-
*/
|
|
1399
|
-
declare class BaseError<cause extends Error | undefined = undefined> extends Error {
|
|
1400
|
-
details: string;
|
|
1401
|
-
shortMessage: string;
|
|
1402
|
-
cause: cause;
|
|
1403
|
-
name: string;
|
|
1404
|
-
constructor(shortMessage: string, options?: {
|
|
1405
|
-
cause?: cause | undefined;
|
|
1406
|
-
details?: string | undefined;
|
|
1407
|
-
metaMessages?: (string | undefined)[] | undefined;
|
|
1408
|
-
});
|
|
1409
|
-
walk(): Error;
|
|
1410
|
-
walk(fn: (err: unknown) => boolean): Error | null;
|
|
1411
|
-
}
|
|
1412
|
-
declare class ReorgError extends BaseError {
|
|
1413
|
-
name: string;
|
|
1414
|
-
constructor(blockNumber: number);
|
|
1415
|
-
}
|
|
1416
|
-
declare namespace Chain_d_exports {
|
|
1417
|
-
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains, getChain, getWhitelistedChains, streamLogs };
|
|
1418
|
-
}
|
|
1419
|
-
type Chain$1 = Compute<Omit<Chain<ChainFormatters, {
|
|
1420
|
-
morpho: ChainContract;
|
|
1421
|
-
morphoBlue: ChainContract;
|
|
1422
|
-
mempool: ChainContract;
|
|
1423
|
-
vaults: {
|
|
1424
|
-
factories: {
|
|
1425
|
-
v1_0: ChainContract;
|
|
1426
|
-
v1_1: ChainContract;
|
|
1427
|
-
};
|
|
1428
|
-
};
|
|
1429
|
-
callbacks: Callback[];
|
|
1430
|
-
}>, "custom"> & {
|
|
1431
|
-
id: Id;
|
|
1432
|
-
name: Name;
|
|
1433
|
-
custom: {
|
|
1434
|
-
morpho: ChainContract;
|
|
1435
|
-
morphoBlue: ChainContract;
|
|
1436
|
-
mempool: ChainContract;
|
|
1437
|
-
vaults: {
|
|
1438
|
-
factories: {
|
|
1439
|
-
v1_0: ChainContract;
|
|
1440
|
-
v1_1: ChainContract;
|
|
1441
|
-
};
|
|
1442
|
-
};
|
|
1443
|
-
callbacks: Callback[];
|
|
1444
|
-
};
|
|
1445
|
-
}>;
|
|
1446
|
-
declare const ChainId: {
|
|
1447
|
-
readonly ETHEREUM: 1;
|
|
1448
|
-
readonly BASE: 8453;
|
|
1449
|
-
readonly "ETHEREUM-VIRTUAL-TESTNET": 109111114;
|
|
1450
|
-
readonly ANVIL: 505050505;
|
|
1451
|
-
};
|
|
1452
|
-
type Name = Lowercase<keyof typeof ChainId>;
|
|
1453
|
-
declare const chainNames: readonly Name[];
|
|
1454
|
-
type Id = (typeof ChainId)[Uppercase<Name>];
|
|
1455
|
-
declare const chainIds: readonly Id[];
|
|
1456
|
-
declare function getChain(chainId: Id): Chain$1 | undefined;
|
|
1457
|
-
declare const getWhitelistedChains: () => Chain$1[];
|
|
1458
|
-
declare const chains: Record<Lowercase<Name>, Chain$1>;
|
|
1459
|
-
declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
|
|
1460
|
-
client: PublicClient;
|
|
1461
|
-
contractAddress?: Address;
|
|
1462
|
-
event?: abiEvent;
|
|
1463
|
-
blockNumberGte?: number;
|
|
1464
|
-
blockNumberLte?: number;
|
|
1465
|
-
order: "asc" | "desc";
|
|
1466
|
-
options: {
|
|
1467
|
-
maxBatchSize?: number;
|
|
1468
|
-
blockWindow?: number;
|
|
1469
|
-
};
|
|
1470
|
-
}): AsyncGenerator<{
|
|
1471
|
-
logs: GetLogsReturnType<abiEvent | undefined>;
|
|
1472
|
-
blockNumber: number;
|
|
1473
|
-
}, void, void>;
|
|
1474
|
-
declare class InvalidBlockRangeError extends BaseError {
|
|
1475
|
-
name: string;
|
|
1476
|
-
constructor(fromBlock: bigint, toBlock: bigint);
|
|
1477
|
-
}
|
|
1478
|
-
declare class InvalidBlockWindowError extends BaseError {
|
|
1479
|
-
name: string;
|
|
1480
|
-
constructor(blockWindow: number);
|
|
1481
|
-
}
|
|
1482
|
-
declare class InvalidBatchSizeError extends BaseError {
|
|
1483
|
-
name: string;
|
|
1484
|
-
constructor(maxBatchSize: number);
|
|
1485
|
-
}
|
|
1486
|
-
declare class MissingBlockNumberError extends BaseError {
|
|
1487
|
-
name: string;
|
|
1488
|
-
constructor();
|
|
1489
|
-
}
|
|
1490
|
-
declare namespace ChainRegistry_d_exports {
|
|
1491
|
-
export { ChainRegistry, create$1 as create };
|
|
1492
|
-
}
|
|
1493
|
-
type ChainRegistry = {
|
|
1494
|
-
getById: (chainId: Id) => Chain$1 | undefined;
|
|
1495
|
-
list: () => Chain$1[];
|
|
1496
|
-
};
|
|
1497
|
-
/**
|
|
1498
|
-
* Creates a chain registry from a list of chains.
|
|
1499
|
-
* @param chains - Array of chain objects to register.
|
|
1500
|
-
* @returns A registry for looking up chains by ID. {@link ChainRegistry}
|
|
1501
|
-
*/
|
|
1502
|
-
declare function create$1(chains: Chain$1[]): ChainRegistry;
|
|
1503
|
-
//#endregion
|
|
1504
|
-
//#region src/core/types.d.ts
|
|
1505
|
-
/** Combines members of an intersection into a readable type. */
|
|
1506
|
-
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
1507
|
-
declare const BrandTypeId: unique symbol;
|
|
1508
|
-
type Brand<in out ID extends string | symbol> = {
|
|
1509
|
-
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
1510
|
-
};
|
|
1511
|
-
declare namespace LLTV_d_exports {
|
|
1512
|
-
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$14 as from };
|
|
1513
|
-
}
|
|
1514
|
-
type LLTV = bigint & Brand<"LLTV">;
|
|
1515
|
-
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
1516
|
-
type Options = (typeof Options)[number];
|
|
1517
|
-
/**
|
|
1518
|
-
* Convert a LLTV option or a scaled LLTV to a LLTV.
|
|
1519
|
-
* @param lltv - The LLTV option or the scaled LLTV.
|
|
1520
|
-
* @returns The LLTV.
|
|
1521
|
-
*/
|
|
1522
|
-
declare function from$14(lltv: Options | bigint): LLTV;
|
|
1523
|
-
declare namespace from$14 {
|
|
1524
|
-
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
1525
|
-
}
|
|
1526
|
-
declare class InvalidOptionError$1 extends BaseError {
|
|
1527
|
-
readonly name = "LLTV.InvalidOptionError";
|
|
1528
|
-
constructor(input: number);
|
|
1529
|
-
}
|
|
1530
|
-
declare class InvalidLLTVError extends BaseError {
|
|
1531
|
-
readonly name = "LLTV.InvalidLLTVError";
|
|
1532
|
-
constructor(input: bigint);
|
|
1533
|
-
}
|
|
1534
|
-
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1535
|
-
declare namespace Collateral_d_exports {
|
|
1536
|
-
export { Collateral, CollateralSchema, CollateralsSchema, abi$1 as abi, from$13 as from, random$3 as random };
|
|
1537
|
-
}
|
|
1538
|
-
type Collateral = {
|
|
1539
|
-
/** Asset being used as collateral. */asset: Address; /** Liquidation Loan-to-Value of the collateral. */
|
|
1540
|
-
lltv: LLTV; /** Oracle contract used to price the collateral. */
|
|
1541
|
-
oracle: Address;
|
|
1542
|
-
};
|
|
1543
|
-
declare const abi$1: readonly [{
|
|
1544
|
-
readonly type: "address";
|
|
1545
|
-
readonly name: "token";
|
|
1546
|
-
}, {
|
|
1547
|
-
readonly type: "uint256";
|
|
1548
|
-
readonly name: "lltv";
|
|
1549
|
-
}, {
|
|
1550
|
-
readonly type: "address";
|
|
1551
|
-
readonly name: "oracle";
|
|
1552
|
-
}];
|
|
1553
|
-
declare const CollateralSchema: z$1.ZodObject<{
|
|
1554
|
-
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1555
|
-
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1556
|
-
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1557
|
-
}, z$1.core.$strip>;
|
|
1558
|
-
declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
1559
|
-
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1560
|
-
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1561
|
-
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1562
|
-
}, z$1.core.$strip>>;
|
|
1563
|
-
declare const from$13: (parameters: from$13.Parameters) => from$13.ReturnType;
|
|
1564
|
-
declare namespace from$13 {
|
|
1565
|
-
type Parameters = {
|
|
1566
|
-
asset: Address;
|
|
1567
|
-
lltv: Options | bigint;
|
|
1568
|
-
oracle: Address;
|
|
1569
|
-
};
|
|
1570
|
-
type ReturnType = Collateral;
|
|
1571
|
-
}
|
|
1572
|
-
/**
|
|
1573
|
-
* Generates a random collateral.
|
|
1574
|
-
* @returns A randomly generated collateral. {@link random.ReturnType}
|
|
1575
|
-
*
|
|
1576
|
-
* @example
|
|
1577
|
-
* ```ts
|
|
1578
|
-
* const collateral = Collateral.random();
|
|
1579
|
-
* ```
|
|
1580
|
-
*/
|
|
1581
|
-
declare function random$3(): random$3.ReturnType;
|
|
1582
|
-
declare namespace random$3 {
|
|
1583
|
-
type ReturnType = Collateral;
|
|
1584
|
-
}
|
|
1585
|
-
declare namespace ERC4626_d_exports {
|
|
1586
|
-
export { DenominatorIsZeroError, convertToAssets, convertToShares, decimalsOffset };
|
|
1587
|
-
}
|
|
1588
|
-
/**
|
|
1589
|
-
* Calculate the decimals offset used by the ERC4626 implementation.
|
|
1590
|
-
* @param parameters - {@link decimalsOffset.Parameters}.
|
|
1591
|
-
* @returns The decimals offset.
|
|
1592
|
-
*
|
|
1593
|
-
* @example
|
|
1594
|
-
* ```ts
|
|
1595
|
-
* const decimalsOffset = decimalsOffset({ underlyingDecimals: 6 });
|
|
1596
|
-
* // decimalsOffset = 12
|
|
1597
|
-
* ```
|
|
1598
|
-
*/
|
|
1599
|
-
declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
|
|
1600
|
-
declare namespace decimalsOffset {
|
|
1601
|
-
type Parameters = {
|
|
1602
|
-
/** The number of decimals of the underlying asset. */underlyingDecimals: number;
|
|
1603
|
-
};
|
|
1604
|
-
type ReturnType = number;
|
|
1605
|
-
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Convert shares to assets.
|
|
1608
|
-
* @throws If the denominator is 0. {@link DenominatorIsZeroError}
|
|
1609
|
-
* @param parameters - {@link convertToAssets.Parameters}.
|
|
1610
|
-
* @returns The amount of assets.
|
|
1611
|
-
*
|
|
1612
|
-
* @example
|
|
1613
|
-
* ```ts
|
|
1614
|
-
* const assets = convertToAssets(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 18 });
|
|
1615
|
-
* // assets = 100n
|
|
1616
|
-
* ```
|
|
1617
|
-
*/
|
|
1618
|
-
declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
|
|
1619
|
-
declare namespace convertToAssets {
|
|
1620
|
-
type Parameters = {
|
|
1621
|
-
/** The amount of shares to convert. */shares: bigint; /** Total amount of assets in the vault. */
|
|
1622
|
-
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
1623
|
-
totalSupply: bigint;
|
|
1624
|
-
/**
|
|
1625
|
-
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
1626
|
-
* Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
|
|
1627
|
-
* precision between shares and assets.
|
|
1628
|
-
*/
|
|
1629
|
-
decimalsOffset: number;
|
|
1630
|
-
};
|
|
1631
|
-
type ReturnType = bigint;
|
|
1632
|
-
type ErrorType = DenominatorIsZeroError;
|
|
1633
|
-
}
|
|
1634
|
-
/**
|
|
1635
|
-
* Convert assets to shares.
|
|
1636
|
-
* @throws If the denominator is 0. {@link DenominatorIsZeroError}
|
|
1637
|
-
* @param parameters - {@link convertToShares.Parameters}.
|
|
1638
|
-
* @returns The amount of shares.
|
|
1639
|
-
*
|
|
1640
|
-
* @example
|
|
1641
|
-
* ```ts
|
|
1642
|
-
* const shares = convertToShares(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 12 });
|
|
1643
|
-
* // shares = 100n
|
|
1644
|
-
* ```
|
|
1645
|
-
*/
|
|
1646
|
-
declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
|
|
1647
|
-
declare namespace convertToShares {
|
|
1648
|
-
type Parameters = {
|
|
1649
|
-
/** The amount of assets to convert. */assets: bigint; /** Total amount of assets in the vault. */
|
|
1650
|
-
totalAssets: bigint; /** Total amount of shares in the vault. */
|
|
1651
|
-
totalSupply: bigint;
|
|
1652
|
-
/**
|
|
1653
|
-
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
1654
|
-
* Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
|
|
1655
|
-
* precision between shares and assets.
|
|
1656
|
-
*/
|
|
1657
|
-
decimalsOffset: number;
|
|
1658
|
-
};
|
|
1659
|
-
type ReturnType = bigint;
|
|
1660
|
-
type ErrorType = DenominatorIsZeroError;
|
|
1661
|
-
}
|
|
1662
|
-
declare class DenominatorIsZeroError extends BaseError {
|
|
1663
|
-
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
1664
|
-
constructor();
|
|
1665
|
-
}
|
|
1666
|
-
declare namespace Format_d_exports {
|
|
1667
|
-
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
1668
|
-
}
|
|
1669
|
-
/** The snake case representation of a type with bigint values stringified. */
|
|
1670
|
-
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
1671
|
-
/** Make arrays/tuples and object props mutable, deeply. */
|
|
1672
|
-
type DeepMutable<T> = T extends ((...args: unknown[]) => unknown) ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? { -readonly [K in keyof R]: DeepMutable<R[K]> } : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? { -readonly [K in keyof T]: DeepMutable<T[K]> } : T;
|
|
1673
|
-
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
1674
|
-
type StringifiedBigint<T> = [T] extends [bigint] ? string : [T] extends [`0x${string}`] ? 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 ? { [K in keyof T]: StringifiedBigint<T[K]> } : T;
|
|
1675
|
-
/** Key remapping that also preserves branded primitives. */
|
|
1676
|
-
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? { [K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]> } : T;
|
|
1677
|
-
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;
|
|
1678
|
-
/**
|
|
1679
|
-
* Formats object keys to snake case.
|
|
1680
|
-
* Preserves ethereum addresses as is.
|
|
1681
|
-
* Converts ethereum addresses to checksummed if used as values.
|
|
1682
|
-
* Stringifies bigint values to strings.
|
|
1683
|
-
*/
|
|
1684
|
-
declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
1685
|
-
/**
|
|
1686
|
-
* Formats a snake case object to its camel case type.
|
|
1687
|
-
* Preserves ethereum addresses as is.
|
|
1688
|
-
* Converts checksummed ethereum addresses to lowercase if used as values.
|
|
1689
|
-
* @warning Does not unstringify bigint values.
|
|
1690
|
-
*/
|
|
1691
|
-
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
1692
|
-
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
1693
|
-
declare namespace Maturity_d_exports {
|
|
1694
|
-
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$12 as from };
|
|
1695
|
-
}
|
|
1696
|
-
/**
|
|
1697
|
-
* Maturity is a number that represents a date in seconds.
|
|
1698
|
-
*/
|
|
1699
|
-
type Maturity = number & Brand<"Maturity">;
|
|
1700
|
-
declare const MaturitySchema: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1701
|
-
declare enum MaturityType {
|
|
1702
|
-
EndOfWeek = "end_of_week",
|
|
1703
|
-
EndOfNextWeek = "end_of_next_week",
|
|
1704
|
-
EndOfMonth = "end_of_month",
|
|
1705
|
-
EndOfNextMonth = "end_of_next_month",
|
|
1706
|
-
EndOfQuarter = "end_of_quarter",
|
|
1707
|
-
EndOfNextQuarter = "end_of_next_quarter"
|
|
1708
|
-
}
|
|
1709
|
-
declare const MaturityOptions: {
|
|
1710
|
-
readonly end_of_week: () => Maturity;
|
|
1711
|
-
readonly end_of_next_week: () => Maturity;
|
|
1712
|
-
readonly end_of_month: () => Maturity;
|
|
1713
|
-
readonly end_of_next_month: () => Maturity;
|
|
1714
|
-
readonly end_of_quarter: () => Maturity;
|
|
1715
|
-
readonly end_of_next_quarter: () => Maturity;
|
|
1716
|
-
};
|
|
1717
|
-
type MaturityOptions = keyof typeof MaturityOptions;
|
|
1718
|
-
/**
|
|
1719
|
-
* Creates a maturity from a timestamp in seconds or a maturity option.
|
|
1720
|
-
* @throws {InvalidFormatError} If the maturity is in milliseconds.
|
|
1721
|
-
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
1722
|
-
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
1723
|
-
*/
|
|
1724
|
-
declare function from$12(ts: from$12.Parameters): Maturity;
|
|
1725
|
-
declare namespace from$12 {
|
|
1726
|
-
type Parameters = number | MaturityOptions;
|
|
1727
|
-
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
1728
|
-
}
|
|
1729
|
-
declare class InvalidFormatError extends BaseError {
|
|
1730
|
-
readonly name = "Maturity.InvalidFormatError";
|
|
1731
|
-
constructor();
|
|
1732
|
-
}
|
|
1733
|
-
declare class InvalidDateError extends BaseError {
|
|
1734
|
-
readonly name = "Maturity.InvalidDateError";
|
|
1735
|
-
constructor(input: number);
|
|
1736
|
-
}
|
|
1737
|
-
declare class InvalidOptionError extends BaseError {
|
|
1738
|
-
readonly name = "Maturity.InvalidOptionError";
|
|
1739
|
-
constructor(input: string);
|
|
1740
|
-
}
|
|
1741
|
-
declare namespace Obligation_d_exports {
|
|
1742
|
-
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation$1 as Obligation, ObligationSchema, abi, from$11 as from, fromOffer$1 as fromOffer, fromSnakeCase$2 as fromSnakeCase, key$1 as key, random$2 as random, tupleAbi };
|
|
1743
|
-
}
|
|
1744
|
-
type Obligation$1 = {
|
|
1745
|
-
/** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
1746
|
-
collaterals: Collateral[]; /** The maturity of the obligation. */
|
|
1747
|
-
maturity: Maturity;
|
|
1748
|
-
};
|
|
1749
|
-
declare const ObligationSchema: z$1.ZodObject<{
|
|
1750
|
-
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1751
|
-
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1752
|
-
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1753
|
-
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1754
|
-
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1755
|
-
}, z$1.core.$strip>>;
|
|
1756
|
-
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1757
|
-
}, z$1.core.$strip>;
|
|
1758
|
-
declare const abi: readonly [{
|
|
1759
|
-
readonly type: "address";
|
|
1760
|
-
readonly name: "loanToken";
|
|
1761
|
-
}, {
|
|
1762
|
-
readonly type: "tuple[]";
|
|
1763
|
-
readonly name: "collaterals";
|
|
1764
|
-
readonly components: readonly [{
|
|
1765
|
-
readonly type: "address";
|
|
1766
|
-
readonly name: "token";
|
|
1767
|
-
}, {
|
|
1768
|
-
readonly type: "uint256";
|
|
1769
|
-
readonly name: "lltv";
|
|
1770
|
-
}, {
|
|
1771
|
-
readonly type: "address";
|
|
1772
|
-
readonly name: "oracle";
|
|
1773
|
-
}];
|
|
1774
|
-
}, {
|
|
1775
|
-
readonly type: "uint256";
|
|
1776
|
-
readonly name: "maturity";
|
|
1777
|
-
}];
|
|
1778
|
-
declare const tupleAbi: readonly [{
|
|
1779
|
-
readonly type: "tuple";
|
|
1780
|
-
readonly components: readonly [{
|
|
1781
|
-
readonly type: "address";
|
|
1782
|
-
readonly name: "loanToken";
|
|
1783
|
-
}, {
|
|
1784
|
-
readonly type: "tuple[]";
|
|
1785
|
-
readonly name: "collaterals";
|
|
1786
|
-
readonly components: readonly [{
|
|
1787
|
-
readonly type: "address";
|
|
1788
|
-
readonly name: "token";
|
|
1789
|
-
}, {
|
|
1790
|
-
readonly type: "uint256";
|
|
1791
|
-
readonly name: "lltv";
|
|
1792
|
-
}, {
|
|
1793
|
-
readonly type: "address";
|
|
1794
|
-
readonly name: "oracle";
|
|
1795
|
-
}];
|
|
1796
|
-
}, {
|
|
1797
|
-
readonly type: "uint256";
|
|
1798
|
-
readonly name: "maturity";
|
|
1799
|
-
}];
|
|
1800
|
-
}];
|
|
1801
|
-
/**
|
|
1802
|
-
* Creates an obligation from the given parameters.
|
|
1803
|
-
* @constructor
|
|
1804
|
-
* @param parameters - {@link from.Parameters}
|
|
1805
|
-
* @returns The created obligation. {@link Obligation}
|
|
1806
|
-
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1807
|
-
*
|
|
1808
|
-
* @example
|
|
1809
|
-
* ```ts
|
|
1810
|
-
* const obligation = Obligation.from({
|
|
1811
|
-
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1812
|
-
* collaterals: [
|
|
1813
|
-
* Collateral.from({
|
|
1814
|
-
* asset: privateKeyToAccount(generatePrivateKey()).address,
|
|
1815
|
-
* oracle: privateKeyToAccount(generatePrivateKey()).address,
|
|
1816
|
-
* lltv: 0.965
|
|
1817
|
-
* }),
|
|
1818
|
-
* ],
|
|
1819
|
-
* maturity: Maturity.from("end_of_next_quarter"),
|
|
1820
|
-
* });
|
|
1821
|
-
* ```
|
|
1822
|
-
*/
|
|
1823
|
-
declare function from$11(parameters: from$11.Parameters): from$11.ReturnType;
|
|
1824
|
-
declare namespace from$11 {
|
|
1825
|
-
type Parameters = {
|
|
1826
|
-
/** The token that is being borrowed for this obligation. */loanToken: Address; /** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1827
|
-
collaterals: from$13.Parameters[] | readonly from$13.Parameters[]; /** The maturity of the obligation. */
|
|
1828
|
-
maturity: from$12.Parameters;
|
|
1829
|
-
};
|
|
1830
|
-
type ReturnType = Obligation$1;
|
|
1831
|
-
type ErrorType = InvalidObligationError;
|
|
1832
|
-
}
|
|
1833
|
-
/**
|
|
1834
|
-
* Creates an obligation from a snake case object.
|
|
1835
|
-
* @throws If the obligation is invalid. {@link fromSnakeCase.ErrorType}
|
|
1836
|
-
* @param input - {@link fromSnakeCase.Parameters}
|
|
1837
|
-
* @returns The created obligation. {@link fromSnakeCase.ReturnType}
|
|
1838
|
-
*/
|
|
1839
|
-
declare function fromSnakeCase$2(input: fromSnakeCase$2.Parameters): fromSnakeCase$2.ReturnType;
|
|
1840
|
-
declare namespace fromSnakeCase$2 {
|
|
1841
|
-
type Parameters = Snake<Obligation$1>;
|
|
1842
|
-
type ReturnType = Obligation$1;
|
|
1843
|
-
type ErrorType = InvalidObligationError;
|
|
1844
|
-
}
|
|
1845
|
-
/**
|
|
1846
|
-
* Calculates a canonical key for an obligation payload.
|
|
1847
|
-
* The key is computed as keccak256(abi.encode(loanToken, collaterals, maturity)).
|
|
1848
|
-
* @throws If the collaterals are not sorted alphabetically by address. {@link CollateralsAreNotSortedError}
|
|
1849
|
-
* @param parameters - {@link key.Parameters}
|
|
1850
|
-
* @returns The obligation key as a 32-byte hex string. {@link key.ReturnType}
|
|
1851
|
-
*
|
|
1852
|
-
* @example
|
|
1853
|
-
* ```ts
|
|
1854
|
-
* const obligation = Obligation.random();
|
|
1855
|
-
* const key = Obligation.key(obligation);
|
|
1856
|
-
* console.log(key); // 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1857
|
-
* ```
|
|
1858
|
-
*/
|
|
1859
|
-
declare function key$1(parameters: key$1.Parameters): key$1.ReturnType;
|
|
1860
|
-
declare namespace key$1 {
|
|
1861
|
-
type Parameters = {
|
|
1862
|
-
loanToken: Address;
|
|
1863
|
-
collaterals: {
|
|
1864
|
-
asset: Address;
|
|
1865
|
-
lltv: bigint;
|
|
1866
|
-
oracle: Address;
|
|
1867
|
-
}[];
|
|
1868
|
-
maturity: number;
|
|
1869
|
-
};
|
|
1870
|
-
type ReturnType = Hex;
|
|
1871
|
-
type ErrorType = CollateralsAreNotSortedError;
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* Generates a random obligation.
|
|
1875
|
-
* @returns A randomly generated obligation. {@link random.ReturnType}
|
|
1876
|
-
*
|
|
1877
|
-
* @example
|
|
1878
|
-
* ```ts
|
|
1879
|
-
* const obligation = Obligation.random();
|
|
1880
|
-
* ```
|
|
1881
|
-
*/
|
|
1882
|
-
declare function random$2(): random$2.ReturnType;
|
|
1883
|
-
declare namespace random$2 {
|
|
1884
|
-
type ReturnType = Obligation$1;
|
|
1885
|
-
}
|
|
1886
|
-
/**
|
|
1887
|
-
* Creates an obligation from an offer.
|
|
1888
|
-
* @constructor
|
|
1889
|
-
*
|
|
1890
|
-
* @param offer - The offer to create the obligation from.
|
|
1891
|
-
* @returns The created obligation. {@link fromOffer.ReturnType}
|
|
1892
|
-
*/
|
|
1893
|
-
declare function fromOffer$1(offer: Offer): fromOffer$1.ReturnType;
|
|
1894
|
-
declare namespace fromOffer$1 {
|
|
1895
|
-
type Parameters = Offer;
|
|
1896
|
-
type ReturnType = Obligation$1;
|
|
1897
|
-
}
|
|
1898
|
-
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1899
|
-
readonly name = "Obligation.InvalidObligationError";
|
|
1900
|
-
constructor(error: z$1.ZodError | Error);
|
|
1901
|
-
}
|
|
1902
|
-
declare class CollateralsAreNotSortedError extends BaseError {
|
|
1903
|
-
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1904
|
-
constructor();
|
|
1905
|
-
}
|
|
1906
|
-
declare namespace Id_d_exports {
|
|
1907
|
-
export { Obligation, creationCode, toId };
|
|
1908
|
-
}
|
|
1909
|
-
type Obligation = Obligation$1;
|
|
1910
|
-
/**
|
|
1911
|
-
* Builds the same creation code as `IdLib.creationCode` in Solidity.
|
|
1912
|
-
*
|
|
1913
|
-
* Layout: `prefix (11 bytes) + chainId (32 bytes) + morphoV2 (20 bytes) + abi.encode(obligation)`.
|
|
1914
|
-
*
|
|
1915
|
-
* @param parameters - {@link creationCode.Parameters}
|
|
1916
|
-
* @returns The CREATE2 init code bytes. {@link creationCode.ReturnType}
|
|
1917
|
-
*/
|
|
1918
|
-
declare function creationCode(parameters: creationCode.Parameters): creationCode.ReturnType;
|
|
1919
|
-
declare namespace creationCode {
|
|
1920
|
-
type Parameters = {
|
|
1921
|
-
obligation: Obligation;
|
|
1922
|
-
chainId: Id;
|
|
1923
|
-
morphoV2: Address;
|
|
1924
|
-
};
|
|
1925
|
-
type ReturnType = Hex;
|
|
1926
|
-
}
|
|
1927
|
-
/**
|
|
1928
|
-
* Computes the same id as `IdLib.toId` in Solidity.
|
|
1929
|
-
* @param parameters - {@link toId.Parameters}
|
|
1930
|
-
* @returns The obligation id. {@link toId.ReturnType}
|
|
1931
|
-
*/
|
|
1932
|
-
declare function toId(parameters: toId.Parameters): toId.ReturnType;
|
|
1933
|
-
declare namespace toId {
|
|
1934
|
-
type Parameters = creationCode.Parameters;
|
|
1935
|
-
type ReturnType = Hex;
|
|
1936
|
-
}
|
|
1937
|
-
declare namespace Liquidity_d_exports {
|
|
1938
|
-
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
1939
|
-
}
|
|
1940
|
-
/**
|
|
1941
|
-
* Represents a liquidity pool with a unique ID and amount.
|
|
1942
|
-
*/
|
|
1943
|
-
type LiquidityPool = {
|
|
1944
|
-
id: string;
|
|
1945
|
-
amount: bigint;
|
|
1946
|
-
};
|
|
1947
|
-
/**
|
|
1948
|
-
* Represents a hierarchical relationship between two liquidity pools.
|
|
1949
|
-
*/
|
|
1950
|
-
type LiquidityLink = {
|
|
1951
|
-
parentPoolId: string;
|
|
1952
|
-
childPoolId: string;
|
|
1953
|
-
priority: number;
|
|
1954
|
-
};
|
|
1955
|
-
/**
|
|
1956
|
-
* Represents the connection between an offer and its liquidity pools.
|
|
1957
|
-
*/
|
|
1958
|
-
type OfferLiquidityPool = {
|
|
1959
|
-
offerHash: Hex;
|
|
1960
|
-
poolId: string;
|
|
1961
|
-
/**
|
|
1962
|
-
* The available capacity/liquidity from this pool for this offer.
|
|
1963
|
-
* Matches allowance amount from pool below.
|
|
1964
|
-
*/
|
|
1965
|
-
amount: bigint;
|
|
1966
|
-
};
|
|
1967
|
-
/**
|
|
1968
|
-
* Calculate maximum debt capacity from collateral amount.
|
|
1969
|
-
* @param amount - Collateral amount
|
|
1970
|
-
* @param oraclePrice - Oracle price (scaled to 36 decimals)
|
|
1971
|
-
* @param lltv - Loan-to-value ratio (scaled to 18 decimals)
|
|
1972
|
-
* @returns Maximum debt capacity
|
|
1973
|
-
*/
|
|
1974
|
-
declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: bigint): bigint;
|
|
1975
|
-
/**
|
|
1976
|
-
* Generate pool ID for balance pools.
|
|
1977
|
-
*/
|
|
1978
|
-
declare function generateBalancePoolId(parameters: {
|
|
1979
|
-
user: Address;
|
|
1980
|
-
chainId: Id;
|
|
1981
|
-
token: Address;
|
|
1982
|
-
}): string;
|
|
1983
|
-
/**
|
|
1984
|
-
* Generate pool ID for allowance pools.
|
|
1985
|
-
*/
|
|
1986
|
-
declare function generateAllowancePoolId(parameters: {
|
|
1987
|
-
user: Address;
|
|
1988
|
-
chainId: Id;
|
|
1989
|
-
token: Address;
|
|
1990
|
-
}): string;
|
|
1991
|
-
/**
|
|
1992
|
-
* Generate pool ID for obligation collateral pools.
|
|
1993
|
-
* Obligation collateral pools represent collateral already deposited in the obligation.
|
|
1994
|
-
* These pools are shared across all offers with the same obligation.
|
|
1995
|
-
*/
|
|
1996
|
-
declare function generateObligationCollateralPoolId(parameters: {
|
|
1997
|
-
user: Address;
|
|
1998
|
-
chainId: Id;
|
|
1999
|
-
obligationId: Hex;
|
|
2000
|
-
token: Address;
|
|
2001
|
-
}): string;
|
|
2002
|
-
/**
|
|
2003
|
-
* Generate pool ID for debt pools.
|
|
2004
|
-
*/
|
|
2005
|
-
declare function generateDebtPoolId(parameters: {
|
|
2006
|
-
user: Address;
|
|
2007
|
-
chainId: Id;
|
|
2008
|
-
obligationId: Hex;
|
|
2009
|
-
}): string;
|
|
2010
|
-
/**
|
|
2011
|
-
* Generate pool ID for user position in a vault.
|
|
2012
|
-
*/
|
|
2013
|
-
declare function generateUserVaultPositionPoolId(parameters: {
|
|
2014
|
-
user: Address;
|
|
2015
|
-
chainId: Id;
|
|
2016
|
-
vault: Address;
|
|
2017
|
-
}): string;
|
|
2018
|
-
/**
|
|
2019
|
-
* Generate pool ID for vault position in a market.
|
|
2020
|
-
*/
|
|
2021
|
-
declare function generateVaultPositionPoolId(parameters: {
|
|
2022
|
-
vault: Address;
|
|
2023
|
-
chainId: Id;
|
|
2024
|
-
marketId: string;
|
|
2025
|
-
}): string;
|
|
2026
|
-
/**
|
|
2027
|
-
* Generate pool ID for market total liquidity.
|
|
2028
|
-
*/
|
|
2029
|
-
declare function generateMarketLiquidityPoolId(parameters: {
|
|
2030
|
-
chainId: Id;
|
|
2031
|
-
marketId: string;
|
|
2032
|
-
}): string;
|
|
2033
|
-
declare namespace Offer_d_exports {
|
|
2034
|
-
export { InvalidOfferError, Offer, OfferConsumed, OfferInput, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$1 as decode, encode$1 as encode, from$10 as from, fromSnakeCase$1 as fromSnakeCase, hash, liquidateEvent, obligationId, random$1 as random, repayEvent, serialize, supplyCollateralEvent, takeEvent, toSnakeCase, withdrawCollateralEvent };
|
|
2035
|
-
}
|
|
2036
|
-
type Offer = {
|
|
2037
|
-
/** The address that made the offer. */readonly maker: Address; /** The amount of assets offered. Mutually exclusive with obligationUnits and obligationShares. */
|
|
2038
|
-
readonly assets: bigint; /** The max debt units to trade. Mutually exclusive with assets and obligationShares. */
|
|
2039
|
-
readonly obligationUnits: bigint; /** The max lending shares to trade. Mutually exclusive with assets and obligationUnits. */
|
|
2040
|
-
readonly obligationShares: bigint; /** The offer tick. */
|
|
2041
|
-
readonly tick: number; /** The date at which all interests will be paid. */
|
|
2042
|
-
readonly maturity: Maturity; /** The date at which the offer will expire. */
|
|
2043
|
-
readonly expiry: number; /** The date at which the offer will start. */
|
|
2044
|
-
readonly start: number; /** The group. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
2045
|
-
readonly group: Hex; /** The session. Used for session-based offer management. */
|
|
2046
|
-
readonly session: Hex; /** The side of the offer. `true` for buy, `false` for sell. */
|
|
2047
|
-
readonly buy: boolean; /** The token that is being borrowed. */
|
|
2048
|
-
readonly loanToken: Address; /** The exact set of collaterals required to borrow the loan token. */
|
|
2049
|
-
readonly collaterals: readonly Collateral[]; /** The optional callback data to retrieve the maker funds. */
|
|
2050
|
-
readonly callback: {
|
|
2051
|
-
readonly address: Address;
|
|
2052
|
-
readonly data: Hex;
|
|
2053
|
-
}; /** Receiver of loan token proceeds when maker is seller on `take()`. */
|
|
2054
|
-
readonly receiverIfMakerIsSeller: Address;
|
|
2055
|
-
};
|
|
2056
|
-
declare enum Status {
|
|
2057
|
-
VALID = "VALID",
|
|
2058
|
-
SIMULATION_ERROR = "SIMULATION_ERROR"
|
|
2059
|
-
}
|
|
2060
|
-
type Validation = {
|
|
2061
|
-
offerHash: Hex;
|
|
2062
|
-
obligationId: Hex;
|
|
2063
|
-
status: Status;
|
|
2064
|
-
};
|
|
2065
|
-
declare const OfferSchema: () => z$1.ZodObject<{
|
|
2066
|
-
maker: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2067
|
-
assets: z$1.ZodBigInt;
|
|
2068
|
-
obligationUnits: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
2069
|
-
obligationShares: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBigInt>>;
|
|
2070
|
-
tick: z$1.ZodCoercedNumber<unknown>;
|
|
2071
|
-
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
2072
|
-
expiry: z$1.ZodNumber;
|
|
2073
|
-
start: z$1.ZodNumber;
|
|
2074
|
-
group: z$1.ZodPipe<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
2075
|
-
session: z$1.ZodPipe<z$1.ZodDefault<z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNumber, z$1.ZodBigInt]>>>, z$1.ZodTransform<`0x${string}`, string | number | bigint>>;
|
|
2076
|
-
buy: z$1.ZodBoolean;
|
|
2077
|
-
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2078
|
-
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
2079
|
-
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2080
|
-
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2081
|
-
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
2082
|
-
}, z$1.core.$strip>>;
|
|
2083
|
-
callback: z$1.ZodObject<{
|
|
2084
|
-
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2085
|
-
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2086
|
-
}, z$1.core.$strip>;
|
|
2087
|
-
receiverIfMakerIsSeller: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2088
|
-
}, z$1.core.$strip>;
|
|
2089
|
-
/**
|
|
2090
|
-
* Input type for creating offers. Accepts flexible group types that will be coerced to Hex.
|
|
2091
|
-
*
|
|
2092
|
-
* The `group` field accepts multiple input formats:
|
|
2093
|
-
* - **Hex string** (`0x...`): Padded to 32 bytes if needed
|
|
2094
|
-
* - **Numeric string**: Converted to hex (e.g., `"123"` -> `"0x...7b"`)
|
|
2095
|
-
* - **Number**: Non-negative safe integer, converted to hex
|
|
2096
|
-
* - **BigInt**: Non-negative, must fit in bytes32
|
|
2097
|
-
*
|
|
2098
|
-
* All values validated to be non-negative and within bytes32 range.
|
|
2099
|
-
*/
|
|
2100
|
-
type OfferInput = Compute<Omit<Offer, "group" | "session" | "obligationUnits" | "obligationShares" | "receiverIfMakerIsSeller"> & {
|
|
2101
|
-
group: Hex | bigint | number | string; /** Optional: defaults to zero bytes32. */
|
|
2102
|
-
session?: Hex | bigint | number | string; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationShares. */
|
|
2103
|
-
obligationUnits?: bigint; /** Optional: defaults to 0n. Mutually exclusive with assets and obligationUnits. */
|
|
2104
|
-
obligationShares?: bigint; /** Optional: defaults to maker for backward compatibility. */
|
|
2105
|
-
receiverIfMakerIsSeller?: Address;
|
|
2106
|
-
}>;
|
|
2107
|
-
/**
|
|
2108
|
-
* Creates an offer from a plain object.
|
|
2109
|
-
* @throws {InvalidOfferError} If the offer is invalid.
|
|
2110
|
-
* @param input - The offer to create.
|
|
2111
|
-
* @returns The created offer.
|
|
2112
|
-
*/
|
|
2113
|
-
declare function from$10(input: OfferInput): Offer;
|
|
2114
|
-
declare namespace from$10 {
|
|
2115
|
-
type ErrorType = InvalidOfferError;
|
|
2116
|
-
}
|
|
2117
|
-
/**
|
|
2118
|
-
* Creates an offer from a snake case object.
|
|
2119
|
-
* @throws {InvalidOfferError} If the offer is invalid.
|
|
2120
|
-
* @param input - The offer to create.
|
|
2121
|
-
* @returns The created offer.
|
|
2122
|
-
*/
|
|
2123
|
-
declare function fromSnakeCase$1(input: Snake<Omit<Offer, "session" | "receiverIfMakerIsSeller"> & {
|
|
2124
|
-
session?: Hex;
|
|
2125
|
-
receiverIfMakerIsSeller?: Address;
|
|
2126
|
-
}>): Offer;
|
|
2127
|
-
/**
|
|
2128
|
-
* Converts an offer to a snake case object.
|
|
2129
|
-
* @param offer - The offer to convert.
|
|
2130
|
-
* @returns The converted offer.
|
|
2131
|
-
*/
|
|
2132
|
-
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
2133
|
-
/**
|
|
2134
|
-
* Serializes an offer for merkle tree encoding.
|
|
2135
|
-
* Converts BigInt fields to strings for JSON compatibility.
|
|
2136
|
-
*
|
|
2137
|
-
* @param offer - Offer to serialize
|
|
2138
|
-
* @returns JSON-serializable offer object
|
|
2139
|
-
*/
|
|
2140
|
-
declare const serialize: (offer: Offer) => {
|
|
2141
|
-
maker: `0x${string}`;
|
|
2142
|
-
assets: string;
|
|
2143
|
-
obligationUnits: string;
|
|
2144
|
-
obligationShares: string;
|
|
2145
|
-
tick: number;
|
|
2146
|
-
maturity: number;
|
|
2147
|
-
expiry: number;
|
|
2148
|
-
start: number;
|
|
2149
|
-
group: `0x${string}`;
|
|
2150
|
-
session: `0x${string}`;
|
|
2151
|
-
buy: boolean;
|
|
2152
|
-
loanToken: `0x${string}`;
|
|
2153
|
-
collaterals: {
|
|
2154
|
-
asset: `0x${string}`;
|
|
2155
|
-
oracle: `0x${string}`;
|
|
2156
|
-
lltv: string;
|
|
2157
|
-
}[];
|
|
2158
|
-
callback: {
|
|
2159
|
-
address: `0x${string}`;
|
|
2160
|
-
data: `0x${string}`;
|
|
2161
|
-
};
|
|
2162
|
-
receiverIfMakerIsSeller: `0x${string}`;
|
|
2163
|
-
hash: `0x${string}`;
|
|
2164
|
-
};
|
|
2165
|
-
type RandomConfig = {
|
|
2166
|
-
loanTokens?: Address[];
|
|
2167
|
-
collateralTokens?: Address[];
|
|
2168
|
-
assetsDecimals?: Record<Address, number>;
|
|
2169
|
-
buy?: boolean;
|
|
2170
|
-
assets?: bigint;
|
|
2171
|
-
obligationUnits?: bigint;
|
|
2172
|
-
obligationShares?: bigint;
|
|
2173
|
-
maker?: Address;
|
|
2174
|
-
maturity?: Maturity;
|
|
2175
|
-
start?: number;
|
|
2176
|
-
expiry?: number;
|
|
2177
|
-
group?: Hex | bigint | number | string;
|
|
2178
|
-
session?: Hex | bigint | number | string;
|
|
2179
|
-
tick?: number;
|
|
2180
|
-
callback?: {
|
|
2181
|
-
address: Address;
|
|
2182
|
-
data: Hex;
|
|
2183
|
-
};
|
|
2184
|
-
receiverIfMakerIsSeller?: Address;
|
|
2185
|
-
collaterals?: readonly Collateral[];
|
|
2186
|
-
};
|
|
2187
|
-
/**
|
|
2188
|
-
* Generates a random Offer.
|
|
2189
|
-
* The returned Offer contains randomly generated values.
|
|
2190
|
-
* @warning The generated Offer should not be used for production usage.
|
|
2191
|
-
* @returns {Offer} A randomly generated Offer object.
|
|
2192
|
-
*/
|
|
2193
|
-
declare function random$1(config?: RandomConfig): Offer;
|
|
2194
|
-
/**
|
|
2195
|
-
* Computes the canonical chain-agnostic offer hash.
|
|
2196
|
-
* The hash is `keccak256(abi.encode(offer))` using {@link encode}.
|
|
2197
|
-
*
|
|
2198
|
-
* @param offer - Offer payload to hash.
|
|
2199
|
-
* @returns 32-byte offer hash.
|
|
2200
|
-
*/
|
|
2201
|
-
declare function hash(offer: Offer): Hex;
|
|
2202
|
-
/**
|
|
2203
|
-
* Calculates the onchain obligation id for an offer.
|
|
2204
|
-
* The id is computed with {@link Id.toId}.
|
|
2205
|
-
* @param offer - The offer to calculate the obligation id for.
|
|
2206
|
-
* @param parameters - The chain context used by the onchain id function.
|
|
2207
|
-
* @returns The obligation id as a 32-byte hex string.
|
|
2208
|
-
*/
|
|
2209
|
-
declare function obligationId(offer: Offer, parameters: obligationId.Parameters): obligationId.ReturnType;
|
|
2210
|
-
declare namespace obligationId {
|
|
2211
|
-
type Parameters = {
|
|
2212
|
-
chainId: Id;
|
|
2213
|
-
morphoV2: Address;
|
|
2214
|
-
};
|
|
2215
|
-
type ReturnType = Hex;
|
|
2216
|
-
}
|
|
2217
|
-
declare function encode$1(offer: Offer): `0x${string}`;
|
|
2218
|
-
declare function decode$1(data: Hex): Offer;
|
|
2219
|
-
type OfferConsumed = {
|
|
2220
|
-
id: string;
|
|
2221
|
-
chainId: Id;
|
|
2222
|
-
maker: Address;
|
|
2223
|
-
group: Hex;
|
|
2224
|
-
amount: bigint;
|
|
2225
|
-
blockNumber: number;
|
|
2226
|
-
};
|
|
2227
|
-
/**
|
|
2228
|
-
* ABI for the Take event emitted by the Morpho V2 contract.
|
|
2229
|
-
*/
|
|
2230
|
-
declare const takeEvent: {
|
|
2231
|
-
readonly type: "event";
|
|
2232
|
-
readonly name: "Take";
|
|
2233
|
-
readonly inputs: readonly [{
|
|
2234
|
-
readonly name: "caller";
|
|
2235
|
-
readonly type: "address";
|
|
2236
|
-
readonly indexed: false;
|
|
2237
|
-
readonly internalType: "address";
|
|
2238
|
-
}, {
|
|
2239
|
-
readonly name: "id";
|
|
2240
|
-
readonly type: "bytes32";
|
|
2241
|
-
readonly indexed: true;
|
|
2242
|
-
readonly internalType: "bytes32";
|
|
2243
|
-
}, {
|
|
2244
|
-
readonly name: "maker";
|
|
2245
|
-
readonly type: "address";
|
|
2246
|
-
readonly indexed: true;
|
|
2247
|
-
readonly internalType: "address";
|
|
2248
|
-
}, {
|
|
2249
|
-
readonly name: "taker";
|
|
2250
|
-
readonly type: "address";
|
|
2251
|
-
readonly indexed: true;
|
|
2252
|
-
readonly internalType: "address";
|
|
2253
|
-
}, {
|
|
2254
|
-
readonly name: "offerIsBuy";
|
|
2255
|
-
readonly type: "bool";
|
|
2256
|
-
readonly indexed: false;
|
|
2257
|
-
readonly internalType: "bool";
|
|
2258
|
-
}, {
|
|
2259
|
-
readonly name: "buyerAssets";
|
|
2260
|
-
readonly type: "uint256";
|
|
2261
|
-
readonly indexed: false;
|
|
2262
|
-
readonly internalType: "uint256";
|
|
2263
|
-
}, {
|
|
2264
|
-
readonly name: "sellerAssets";
|
|
2265
|
-
readonly type: "uint256";
|
|
2266
|
-
readonly indexed: false;
|
|
2267
|
-
readonly internalType: "uint256";
|
|
2268
|
-
}, {
|
|
2269
|
-
readonly name: "obligationUnits";
|
|
2270
|
-
readonly type: "uint256";
|
|
2271
|
-
readonly indexed: false;
|
|
2272
|
-
readonly internalType: "uint256";
|
|
2273
|
-
}, {
|
|
2274
|
-
readonly name: "obligationShares";
|
|
2275
|
-
readonly type: "uint256";
|
|
2276
|
-
readonly indexed: false;
|
|
2277
|
-
readonly internalType: "uint256";
|
|
2278
|
-
}, {
|
|
2279
|
-
readonly name: "buyerIsLender";
|
|
2280
|
-
readonly type: "bool";
|
|
2281
|
-
readonly indexed: false;
|
|
2282
|
-
readonly internalType: "bool";
|
|
2283
|
-
}, {
|
|
2284
|
-
readonly name: "sellerIsBorrower";
|
|
2285
|
-
readonly type: "bool";
|
|
2286
|
-
readonly indexed: false;
|
|
2287
|
-
readonly internalType: "bool";
|
|
2288
|
-
}, {
|
|
2289
|
-
readonly name: "sellerReceiver";
|
|
2290
|
-
readonly type: "address";
|
|
2291
|
-
readonly indexed: false;
|
|
2292
|
-
readonly internalType: "address";
|
|
2293
|
-
}, {
|
|
2294
|
-
readonly name: "group";
|
|
2295
|
-
readonly type: "bytes32";
|
|
2296
|
-
readonly indexed: false;
|
|
2297
|
-
readonly internalType: "bytes32";
|
|
2298
|
-
}, {
|
|
2299
|
-
readonly name: "consumed";
|
|
2300
|
-
readonly type: "uint256";
|
|
2301
|
-
readonly indexed: false;
|
|
2302
|
-
readonly internalType: "uint256";
|
|
2303
|
-
}];
|
|
2304
|
-
readonly anonymous: false;
|
|
2305
|
-
};
|
|
2306
|
-
/**
|
|
2307
|
-
* ABI for the Consume event emitted by the Obligation contract.
|
|
2308
|
-
*/
|
|
2309
|
-
declare const consumedEvent: {
|
|
2310
|
-
readonly type: "event";
|
|
2311
|
-
readonly name: "Consume";
|
|
2312
|
-
readonly inputs: readonly [{
|
|
2313
|
-
readonly name: "user";
|
|
2314
|
-
readonly type: "address";
|
|
2315
|
-
readonly indexed: true;
|
|
2316
|
-
readonly internalType: "address";
|
|
2317
|
-
}, {
|
|
2318
|
-
readonly name: "group";
|
|
2319
|
-
readonly type: "bytes32";
|
|
2320
|
-
readonly indexed: true;
|
|
2321
|
-
readonly internalType: "bytes32";
|
|
2322
|
-
}, {
|
|
2323
|
-
readonly name: "amount";
|
|
2324
|
-
readonly type: "uint256";
|
|
2325
|
-
readonly indexed: false;
|
|
2326
|
-
readonly internalType: "uint256";
|
|
2327
|
-
}];
|
|
2328
|
-
readonly anonymous: false;
|
|
2329
|
-
};
|
|
2330
|
-
/**
|
|
2331
|
-
* ABI for the Repay event emitted by the MorphoV2 contract.
|
|
2332
|
-
*/
|
|
2333
|
-
declare const repayEvent: {
|
|
2334
|
-
readonly type: "event";
|
|
2335
|
-
readonly name: "Repay";
|
|
2336
|
-
readonly inputs: readonly [{
|
|
2337
|
-
readonly name: "caller";
|
|
2338
|
-
readonly type: "address";
|
|
2339
|
-
readonly indexed: true;
|
|
2340
|
-
readonly internalType: "address";
|
|
2341
|
-
}, {
|
|
2342
|
-
readonly name: "id";
|
|
2343
|
-
readonly type: "bytes32";
|
|
2344
|
-
readonly indexed: true;
|
|
2345
|
-
readonly internalType: "bytes32";
|
|
2346
|
-
}, {
|
|
2347
|
-
readonly name: "obligationUnits";
|
|
2348
|
-
readonly type: "uint256";
|
|
2349
|
-
readonly indexed: false;
|
|
2350
|
-
readonly internalType: "uint256";
|
|
2351
|
-
}, {
|
|
2352
|
-
readonly name: "onBehalf";
|
|
2353
|
-
readonly type: "address";
|
|
2354
|
-
readonly indexed: true;
|
|
2355
|
-
readonly internalType: "address";
|
|
2356
|
-
}];
|
|
2357
|
-
readonly anonymous: false;
|
|
2358
|
-
};
|
|
2359
|
-
/**
|
|
2360
|
-
* ABI for the Liquidate event emitted by the MorphoV2 contract.
|
|
2361
|
-
*/
|
|
2362
|
-
declare const liquidateEvent: {
|
|
2363
|
-
readonly type: "event";
|
|
2364
|
-
readonly name: "Liquidate";
|
|
2365
|
-
readonly inputs: readonly [{
|
|
2366
|
-
readonly name: "caller";
|
|
2367
|
-
readonly type: "address";
|
|
2368
|
-
readonly indexed: true;
|
|
2369
|
-
readonly internalType: "address";
|
|
2370
|
-
}, {
|
|
2371
|
-
readonly name: "id";
|
|
2372
|
-
readonly type: "bytes32";
|
|
2373
|
-
readonly indexed: true;
|
|
2374
|
-
readonly internalType: "bytes32";
|
|
2375
|
-
}, {
|
|
2376
|
-
readonly name: "seizures";
|
|
2377
|
-
readonly type: "tuple[]";
|
|
2378
|
-
readonly indexed: false;
|
|
2379
|
-
readonly internalType: "struct IMorphoV2.Seizure[]";
|
|
2380
|
-
readonly components: readonly [{
|
|
2381
|
-
readonly name: "collateralIndex";
|
|
2382
|
-
readonly type: "uint256";
|
|
2383
|
-
readonly internalType: "uint256";
|
|
2384
|
-
}, {
|
|
2385
|
-
readonly name: "repaid";
|
|
2386
|
-
readonly type: "uint256";
|
|
2387
|
-
readonly internalType: "uint256";
|
|
2388
|
-
}, {
|
|
2389
|
-
readonly name: "seized";
|
|
2390
|
-
readonly type: "uint256";
|
|
2391
|
-
readonly internalType: "uint256";
|
|
2392
|
-
}];
|
|
2393
|
-
}, {
|
|
2394
|
-
readonly name: "borrower";
|
|
2395
|
-
readonly type: "address";
|
|
2396
|
-
readonly indexed: true;
|
|
2397
|
-
readonly internalType: "address";
|
|
2398
|
-
}, {
|
|
2399
|
-
readonly name: "totalRepaid";
|
|
2400
|
-
readonly type: "uint256";
|
|
2401
|
-
readonly indexed: false;
|
|
2402
|
-
readonly internalType: "uint256";
|
|
2403
|
-
}, {
|
|
2404
|
-
readonly name: "badDebt";
|
|
2405
|
-
readonly type: "uint256";
|
|
2406
|
-
readonly indexed: false;
|
|
2407
|
-
readonly internalType: "uint256";
|
|
2408
|
-
}];
|
|
2409
|
-
readonly anonymous: false;
|
|
2410
|
-
};
|
|
2411
|
-
/**
|
|
2412
|
-
* ABI for the SupplyCollateral event emitted by the MorphoV2 contract.
|
|
2413
|
-
*/
|
|
2414
|
-
declare const supplyCollateralEvent: {
|
|
2415
|
-
readonly type: "event";
|
|
2416
|
-
readonly name: "SupplyCollateral";
|
|
2417
|
-
readonly inputs: readonly [{
|
|
2418
|
-
readonly name: "caller";
|
|
2419
|
-
readonly type: "address";
|
|
2420
|
-
readonly indexed: false;
|
|
2421
|
-
readonly internalType: "address";
|
|
2422
|
-
}, {
|
|
2423
|
-
readonly name: "id";
|
|
2424
|
-
readonly type: "bytes32";
|
|
2425
|
-
readonly indexed: true;
|
|
2426
|
-
readonly internalType: "bytes32";
|
|
2427
|
-
}, {
|
|
2428
|
-
readonly name: "collateral";
|
|
2429
|
-
readonly type: "address";
|
|
2430
|
-
readonly indexed: true;
|
|
2431
|
-
readonly internalType: "address";
|
|
2432
|
-
}, {
|
|
2433
|
-
readonly name: "assets";
|
|
2434
|
-
readonly type: "uint256";
|
|
2435
|
-
readonly indexed: false;
|
|
2436
|
-
readonly internalType: "uint256";
|
|
2437
|
-
}, {
|
|
2438
|
-
readonly name: "onBehalf";
|
|
2439
|
-
readonly type: "address";
|
|
2440
|
-
readonly indexed: true;
|
|
2441
|
-
readonly internalType: "address";
|
|
2442
|
-
}];
|
|
2443
|
-
readonly anonymous: false;
|
|
2444
|
-
};
|
|
2445
|
-
/**
|
|
2446
|
-
* ABI for the WithdrawCollateral event emitted by the MorphoV2 contract.
|
|
2447
|
-
*/
|
|
2448
|
-
declare const withdrawCollateralEvent: {
|
|
2449
|
-
readonly type: "event";
|
|
2450
|
-
readonly name: "WithdrawCollateral";
|
|
2451
|
-
readonly inputs: readonly [{
|
|
2452
|
-
readonly name: "caller";
|
|
2453
|
-
readonly type: "address";
|
|
2454
|
-
readonly indexed: false;
|
|
2455
|
-
readonly internalType: "address";
|
|
2456
|
-
}, {
|
|
2457
|
-
readonly name: "id";
|
|
2458
|
-
readonly type: "bytes32";
|
|
2459
|
-
readonly indexed: true;
|
|
2460
|
-
readonly internalType: "bytes32";
|
|
2461
|
-
}, {
|
|
2462
|
-
readonly name: "collateral";
|
|
2463
|
-
readonly type: "address";
|
|
2464
|
-
readonly indexed: true;
|
|
2465
|
-
readonly internalType: "address";
|
|
2466
|
-
}, {
|
|
2467
|
-
readonly name: "assets";
|
|
2468
|
-
readonly type: "uint256";
|
|
2469
|
-
readonly indexed: false;
|
|
2470
|
-
readonly internalType: "uint256";
|
|
2471
|
-
}, {
|
|
2472
|
-
readonly name: "onBehalf";
|
|
2473
|
-
readonly type: "address";
|
|
2474
|
-
readonly indexed: true;
|
|
2475
|
-
readonly internalType: "address";
|
|
2476
|
-
}, {
|
|
2477
|
-
readonly name: "receiver";
|
|
2478
|
-
readonly type: "address";
|
|
2479
|
-
readonly indexed: false;
|
|
2480
|
-
readonly internalType: "address";
|
|
2481
|
-
}];
|
|
2482
|
-
readonly anonymous: false;
|
|
2483
|
-
};
|
|
2484
|
-
declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
2485
|
-
readonly name = "Offer.InvalidOfferError";
|
|
2486
|
-
constructor(error: z$1.ZodError | Error);
|
|
2487
|
-
/**
|
|
2488
|
-
* Formats ZodError issues into a human-readable string with line breaks.
|
|
2489
|
-
* @example
|
|
2490
|
-
* "- 'assets': too small, expected >= 0
|
|
2491
|
-
* - 'start': must be before expiry"
|
|
2492
|
-
*/
|
|
2493
|
-
static formatDetails(error: z$1.ZodError | Error): string;
|
|
2494
|
-
/**
|
|
2495
|
-
* Returns the formatted human-readable message.
|
|
2496
|
-
*/
|
|
2497
|
-
get formattedMessage(): string;
|
|
2498
|
-
}
|
|
2499
|
-
declare namespace Oracle_d_exports {
|
|
2500
|
-
export { Conversion, Oracle, from$9 as from, fromCollateral, fromOffer, fromOffers };
|
|
2501
|
-
}
|
|
2502
|
-
/**
|
|
2503
|
-
* An oracle contract that provides price information for assets.
|
|
2504
|
-
*/
|
|
2505
|
-
type Oracle = {
|
|
2506
|
-
/** The chain id where the oracle is deployed. */readonly chainId: Id; /** The address of the oracle contract. */
|
|
2507
|
-
readonly address: Address; /** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
2508
|
-
readonly price: bigint | null; /** The block number at which the price was fetched. */
|
|
2509
|
-
readonly blockNumber: number;
|
|
2510
|
-
};
|
|
2511
|
-
/**
|
|
2512
|
-
* Create an Oracle from a plain object.
|
|
2513
|
-
* @param data - The data to create the oracle from.
|
|
2514
|
-
* @returns The created oracle.
|
|
2515
|
-
*/
|
|
2516
|
-
declare function from$9(data: from$9.Parameters): from$9.ReturnType;
|
|
2517
|
-
declare namespace from$9 {
|
|
2518
|
-
type Parameters = {
|
|
2519
|
-
chainId: Id;
|
|
2520
|
-
address: Address;
|
|
2521
|
-
price: string | null;
|
|
2522
|
-
blockNumber: number;
|
|
2523
|
-
};
|
|
2524
|
-
type ReturnType = Oracle;
|
|
2525
|
-
}
|
|
2526
|
-
/**
|
|
2527
|
-
* Creates an oracle from a collateral.
|
|
2528
|
-
* @constructor
|
|
2529
|
-
*
|
|
2530
|
-
* @param parameters - {@link fromCollateral.Parameters}
|
|
2531
|
-
* @returns The created oracle. {@link fromCollateral.ReturnType}
|
|
2532
|
-
*/
|
|
2533
|
-
declare function fromCollateral(parameters: fromCollateral.Parameters): fromCollateral.ReturnType;
|
|
2534
|
-
declare namespace fromCollateral {
|
|
2535
|
-
type Parameters = {
|
|
2536
|
-
chainId: Id;
|
|
2537
|
-
collateral: Collateral;
|
|
2538
|
-
blockNumber: number;
|
|
2539
|
-
price?: bigint | null;
|
|
2540
|
-
};
|
|
2541
|
-
type ReturnType = Oracle;
|
|
2542
|
-
}
|
|
2543
|
-
/**
|
|
2544
|
-
* Creates oracles from a single offer.
|
|
2545
|
-
* @constructor
|
|
2546
|
-
*
|
|
2547
|
-
* @param parameters - {@link fromOffer.Parameters}
|
|
2548
|
-
* @returns The created oracles. {@link fromOffer.ReturnType}
|
|
2549
|
-
*/
|
|
2550
|
-
declare function fromOffer(parameters: fromOffer.Parameters): fromOffer.ReturnType;
|
|
2551
|
-
declare namespace fromOffer {
|
|
2552
|
-
type Parameters = {
|
|
2553
|
-
chainId: Id;
|
|
2554
|
-
offer: Offer;
|
|
2555
|
-
blockNumber: number;
|
|
2556
|
-
price?: bigint | null;
|
|
2557
|
-
};
|
|
2558
|
-
type ReturnType = Oracle[];
|
|
2559
|
-
}
|
|
2560
|
-
/**
|
|
2561
|
-
* Creates oracles from a list of offers.
|
|
2562
|
-
* @constructor
|
|
2563
|
-
*
|
|
2564
|
-
* @param parameters - {@link fromOffers.Parameters}
|
|
2565
|
-
* @returns The created oracles. {@link fromOffers.ReturnType}
|
|
2566
|
-
*/
|
|
2567
|
-
declare function fromOffers(parameters: fromOffers.Parameters): fromOffers.ReturnType;
|
|
2568
|
-
declare namespace fromOffers {
|
|
2569
|
-
type Parameters = {
|
|
2570
|
-
chainId: Id;
|
|
2571
|
-
offers: Offer[];
|
|
2572
|
-
blockNumber: number;
|
|
2573
|
-
price?: bigint | null;
|
|
2574
|
-
};
|
|
2575
|
-
type ReturnType = Oracle[];
|
|
2576
|
-
}
|
|
2577
|
-
/**
|
|
2578
|
-
* Conversion utilities for converting between collateral and loan token amounts
|
|
2579
|
-
* using oracle prices and LLTV
|
|
2580
|
-
*/
|
|
2581
|
-
declare namespace Conversion {
|
|
2582
|
-
/**
|
|
2583
|
-
* Converts a collateral amount to loan token
|
|
2584
|
-
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
2585
|
-
*
|
|
2586
|
-
* @param amount - The collateral amount to convert
|
|
2587
|
-
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
2588
|
-
* @returns The equivalent loan token amount
|
|
2589
|
-
*/
|
|
2590
|
-
function collateralToLoan(amount: bigint, params: {
|
|
2591
|
-
price: bigint;
|
|
2592
|
-
lltv: bigint;
|
|
2593
|
-
}): bigint;
|
|
2594
|
-
/**
|
|
2595
|
-
* Converts a loan token amount to collateral
|
|
2596
|
-
* Uses the inverse formula: (amount * 10^36 / price) * 10^18 / lltv
|
|
2597
|
-
* Returns 0n if price or lltv is zero (invalid conversion).
|
|
2598
|
-
*
|
|
2599
|
-
* @param amount - The loan token amount to convert
|
|
2600
|
-
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
2601
|
-
* @returns The equivalent collateral amount, or 0n if conversion is invalid
|
|
2602
|
-
*/
|
|
2603
|
-
function loanToCollateral(amount: bigint, params: {
|
|
2604
|
-
price: bigint;
|
|
2605
|
-
lltv: bigint;
|
|
2606
|
-
}): bigint;
|
|
2607
|
-
}
|
|
2608
|
-
declare namespace Position_d_exports {
|
|
2609
|
-
export { Position, Type, from$8 as from, positionTypeId };
|
|
2610
|
-
}
|
|
2611
|
-
type Position = {
|
|
2612
|
-
/** The chain id. */chainId: Id;
|
|
2613
|
-
/** The contract address from which the position is called.
|
|
2614
|
-
* While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
|
|
2615
|
-
* For example, when depositing into a vault, we would specify the vault contract address as the contract not the underlying vault's ERC20 token address.
|
|
2616
|
-
*/
|
|
2617
|
-
contract: Address; /** The user address. */
|
|
2618
|
-
user: Address; /** The type of position. */
|
|
2619
|
-
type: Type; /** The balance of the position. */
|
|
2620
|
-
balance?: bigint;
|
|
2621
|
-
/** The underlying asset of the position.
|
|
2622
|
-
* For ERC20 positions, this equals the contract address.
|
|
2623
|
-
* For vault positions, this is the vault's underlying asset.
|
|
2624
|
-
* For debt positions, this is the zero address (sentinel).
|
|
2625
|
-
* For collateral positions, this is the collateral token address.
|
|
2626
|
-
*/
|
|
2627
|
-
asset: Address; /** The block number at which the position was last updated. */
|
|
2628
|
-
blockNumber: number;
|
|
2629
|
-
};
|
|
2630
|
-
declare enum Type {
|
|
2631
|
-
ERC20 = "erc20",
|
|
2632
|
-
VAULT_V1 = "vault_v1",
|
|
2633
|
-
DEBT_OF = "debtOf",
|
|
2634
|
-
COLLATERAL_OF = "collateralOf"
|
|
2635
|
-
}
|
|
2636
|
-
/**
|
|
2637
|
-
* @constructor
|
|
2638
|
-
* Creates a Position.
|
|
2639
|
-
* @param parameters - {@link from.Parameters}
|
|
2640
|
-
* @returns The created Position. {@link from.ReturnType}
|
|
2641
|
-
*/
|
|
2642
|
-
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
2643
|
-
declare namespace from$8 {
|
|
2644
|
-
type Parameters = {
|
|
2645
|
-
chainId: Id;
|
|
2646
|
-
contract: Address;
|
|
2647
|
-
user: Address;
|
|
2648
|
-
type: Type;
|
|
2649
|
-
balance?: bigint;
|
|
2650
|
-
asset: Address;
|
|
2651
|
-
blockNumber: number;
|
|
2652
|
-
};
|
|
2653
|
-
type ReturnType = Position;
|
|
2654
|
-
}
|
|
2655
|
-
/**
|
|
2656
|
-
* Maps a {@link Type} enum value to its 1-based integer ID used in the database.
|
|
2657
|
-
* @param type - The position type.
|
|
2658
|
-
* @returns The 1-based integer ID.
|
|
2659
|
-
*/
|
|
2660
|
-
declare const positionTypeId: (type: Type) => number;
|
|
2661
|
-
declare namespace Quote_d_exports {
|
|
2662
|
-
export { InvalidQuoteError, Quote, QuoteInput, Side, from$7 as from, fromSnakeCase, random };
|
|
2663
|
-
}
|
|
2664
|
-
type Side = {
|
|
2665
|
-
/** The best side tick, or null when no active quote exists. */tick: number | null; /** The side price for the obligation. (18 decimals). */
|
|
2666
|
-
price: bigint;
|
|
2667
|
-
};
|
|
2668
|
-
type QuoteInput = {
|
|
2669
|
-
/** The obligation id. */obligationId: Hex;
|
|
2670
|
-
ask: {
|
|
2671
|
-
/** The best ask tick, or null when there is no active ask quote. */tick: number | null;
|
|
2672
|
-
};
|
|
2673
|
-
bid: {
|
|
2674
|
-
/** The best bid tick, or null when there is no active bid quote. */tick: number | null;
|
|
2675
|
-
};
|
|
2676
|
-
};
|
|
2677
|
-
type Quote = {
|
|
2678
|
-
/** The obligation id. */obligationId: Hex;
|
|
2679
|
-
ask: Side;
|
|
2680
|
-
bid: Side;
|
|
2681
|
-
};
|
|
2682
|
-
/**
|
|
2683
|
-
* Creates a quote for a given obligation.
|
|
2684
|
-
* @constructor
|
|
2685
|
-
* @param parameters - {@link from.Parameters}
|
|
2686
|
-
* @returns The created quote. {@link Quote}
|
|
2687
|
-
* @throws If the quote is invalid. {@link InvalidQuoteError}
|
|
2688
|
-
*
|
|
2689
|
-
* @example
|
|
2690
|
-
* ```ts
|
|
2691
|
-
* const quote = Quote.from({ obligationId: "0x123", ask: { tick: 500 }, bid: { tick: 510 } });
|
|
2692
|
-
* ```
|
|
2693
|
-
*/
|
|
2694
|
-
declare function from$7(parameters: from$7.Parameters): from$7.ReturnType;
|
|
2695
|
-
declare namespace from$7 {
|
|
2696
|
-
type Parameters = QuoteInput;
|
|
2697
|
-
type ReturnType = Quote;
|
|
2698
|
-
type ErrorType = InvalidQuoteError;
|
|
2699
|
-
}
|
|
2700
|
-
/**
|
|
2701
|
-
* Creates a quote from a snake case object.
|
|
2702
|
-
* @throws If the quote is invalid. {@link InvalidQuoteError}
|
|
2703
|
-
* @param snake - {@link fromSnakeCase.Parameters}
|
|
2704
|
-
* @returns The created quote. {@link fromSnakeCase.ReturnType}
|
|
2705
|
-
*/
|
|
2706
|
-
declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
2707
|
-
declare namespace fromSnakeCase {
|
|
2708
|
-
type Parameters = Snake<QuoteInput>;
|
|
2709
|
-
type ReturnType = Quote;
|
|
2710
|
-
type ErrorType = from$7.ErrorType;
|
|
2711
|
-
}
|
|
2712
|
-
/**
|
|
2713
|
-
* Generates a random quote.
|
|
2714
|
-
* @returns A randomly generated quote. {@link random.ReturnType}
|
|
2715
|
-
*
|
|
2716
|
-
* @example
|
|
2717
|
-
* ```ts
|
|
2718
|
-
* const quote = Quote.random();
|
|
2719
|
-
* ```
|
|
2720
|
-
*/
|
|
2721
|
-
declare function random(): random.ReturnType;
|
|
2722
|
-
declare namespace random {
|
|
2723
|
-
type Parameters = never;
|
|
2724
|
-
type ReturnType = Quote;
|
|
2725
|
-
type ErrorType = from$7.ErrorType;
|
|
2726
|
-
}
|
|
2727
|
-
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
2728
|
-
readonly name = "Quote.InvalidQuoteError";
|
|
2729
|
-
constructor(error: z$1.ZodError | Error);
|
|
2730
|
-
}
|
|
2731
|
-
declare namespace Tick_d_exports {
|
|
2732
|
-
export { InvalidPriceError, InvalidTickError, MAX_PRICE, TICK_RANGE, priceToTick, tickToPrice };
|
|
2733
|
-
}
|
|
2734
|
-
/** Tick domain supported by Morpho V2. */
|
|
2735
|
-
declare const TICK_RANGE = 990;
|
|
2736
|
-
/** Max allowed price (1e18 in wad). */
|
|
2737
|
-
declare const MAX_PRICE: bigint;
|
|
2738
|
-
/**
|
|
2739
|
-
* Converts a tick to a wad price using the same approximation and rounding as TickLib.
|
|
2740
|
-
* @param tick - Tick value in the inclusive range [0, 990].
|
|
2741
|
-
* @returns The price in wad units.
|
|
2742
|
-
* @throws {@link InvalidTickError} If tick is not an integer in range [0, 990].
|
|
2743
|
-
*/
|
|
2744
|
-
declare function tickToPrice(tick: number): bigint;
|
|
2745
|
-
declare namespace tickToPrice {
|
|
2746
|
-
type ErrorType = InvalidTickError;
|
|
2747
|
-
}
|
|
2748
|
-
/**
|
|
2749
|
-
* Returns the lowest tick with a higher-or-equal price.
|
|
2750
|
-
* @param price - Price in wad units.
|
|
2751
|
-
* @returns The first tick whose {@link tickToPrice} is greater than or equal to `price`.
|
|
2752
|
-
* @throws {@link InvalidPriceError} If price is outside [0, 1e18].
|
|
2753
|
-
*/
|
|
2754
|
-
declare function priceToTick(price: bigint): number;
|
|
2755
|
-
declare namespace priceToTick {
|
|
2756
|
-
type ErrorType = InvalidPriceError;
|
|
2757
|
-
}
|
|
2758
|
-
declare class InvalidTickError extends BaseError {
|
|
2759
|
-
readonly name = "Tick.InvalidTickError";
|
|
2760
|
-
constructor(tick: number);
|
|
2761
|
-
}
|
|
2762
|
-
declare class InvalidPriceError extends BaseError {
|
|
2763
|
-
readonly name = "Tick.InvalidPriceError";
|
|
2764
|
-
constructor(price: bigint);
|
|
2765
|
-
}
|
|
2766
|
-
declare namespace TradingFee_d_exports {
|
|
2767
|
-
export { BREAKPOINTS, Fees, InvalidFeeError, InvalidFeesLengthError, TradingFee, WAD, activate, compute, deactivate, from$6 as from, getFees, isActivated };
|
|
2768
|
-
}
|
|
2769
|
-
/**
|
|
2770
|
-
* Time breakpoints in seconds for piecewise linear fee interpolation.
|
|
2771
|
-
* Matches on-chain constants: 0d, 1d, 7d, 30d, 90d, 180d.
|
|
2772
|
-
*/
|
|
2773
|
-
declare const BREAKPOINTS: readonly [0n, 86400n, 604800n, 2592000n, 7776000n, 15552000n];
|
|
2774
|
-
/** WAD constant (1e18) for fee scaling. */
|
|
2775
|
-
declare const WAD: bigint;
|
|
2776
|
-
/** Tuple type for the 6 fee values at each breakpoint. */
|
|
2777
|
-
type Fees = readonly [bigint, bigint, bigint, bigint, bigint, bigint];
|
|
2778
|
-
/**
|
|
2779
|
-
* TradingFee represents a piecewise linear fee curve with 6 breakpoints.
|
|
2780
|
-
* The internal storage mimics on-chain bitmap behavior but uses a struct for clarity.
|
|
2781
|
-
*/
|
|
2782
|
-
type TradingFee = {
|
|
2783
|
-
readonly _activated: boolean;
|
|
2784
|
-
readonly _fees: Fees;
|
|
2785
|
-
} & Brand<"TradingFee">;
|
|
2786
|
-
/**
|
|
2787
|
-
* Create a TradingFee from an activation flag and 6 fee values.
|
|
2788
|
-
* @param activated - Whether the fee is active.
|
|
2789
|
-
* @param fees - Tuple of 6 fee values in WAD (one per breakpoint: 0d, 1d, 7d, 30d, 90d, 180d).
|
|
2790
|
-
* @returns A new TradingFee instance.
|
|
2791
|
-
* @throws {@link InvalidFeeError} if any fee exceeds WAD (100%).
|
|
2792
|
-
* @throws {@link InvalidFeesLengthError} if fees array doesn't have exactly 6 elements.
|
|
2793
|
-
*/
|
|
2794
|
-
declare function from$6(activated: boolean, fees: Fees): TradingFee;
|
|
2795
|
-
declare namespace from$6 {
|
|
2796
|
-
type ErrorType = InvalidFeeError | InvalidFeesLengthError;
|
|
2797
|
-
}
|
|
2798
|
-
/**
|
|
2799
|
-
* Compute the trading fee for a given time to maturity using piecewise linear interpolation.
|
|
2800
|
-
* @param tradingFee - The TradingFee instance.
|
|
2801
|
-
* @param timeToMaturity - Time to maturity in seconds.
|
|
2802
|
-
* @returns The interpolated fee in WAD. Returns 0n if not activated.
|
|
2803
|
-
*/
|
|
2804
|
-
declare function compute(tradingFee: TradingFee, timeToMaturity: number): bigint;
|
|
2805
|
-
/**
|
|
2806
|
-
* Check if the trading fee is activated.
|
|
2807
|
-
* @param tradingFee - The TradingFee instance.
|
|
2808
|
-
* @returns True if activated, false otherwise.
|
|
2809
|
-
*/
|
|
2810
|
-
declare function isActivated(tradingFee: TradingFee): boolean;
|
|
2811
|
-
/**
|
|
2812
|
-
* Create a new TradingFee with activation enabled.
|
|
2813
|
-
* @param tradingFee - The TradingFee instance.
|
|
2814
|
-
* @returns A new TradingFee with activated set to true.
|
|
2815
|
-
*/
|
|
2816
|
-
declare function activate(tradingFee: TradingFee): TradingFee;
|
|
2817
|
-
/**
|
|
2818
|
-
* Create a new TradingFee with activation disabled.
|
|
2819
|
-
* @param tradingFee - The TradingFee instance.
|
|
2820
|
-
* @returns A new TradingFee with activated set to false.
|
|
2821
|
-
*/
|
|
2822
|
-
declare function deactivate(tradingFee: TradingFee): TradingFee;
|
|
2823
|
-
/**
|
|
2824
|
-
* Get the fee values at each breakpoint.
|
|
2825
|
-
* @param tradingFee - The TradingFee instance.
|
|
2826
|
-
* @returns The tuple of 6 fee values.
|
|
2827
|
-
*/
|
|
2828
|
-
declare function getFees(tradingFee: TradingFee): Fees;
|
|
2829
|
-
/** Error thrown when a fee value is invalid (negative or exceeds WAD). */
|
|
2830
|
-
declare class InvalidFeeError extends BaseError {
|
|
2831
|
-
readonly name = "TradingFee.InvalidFeeError";
|
|
2832
|
-
constructor(fee: bigint, index: number);
|
|
2833
|
-
}
|
|
2834
|
-
/** Error thrown when fees array doesn't have exactly 6 elements. */
|
|
2835
|
-
declare class InvalidFeesLengthError extends BaseError {
|
|
2836
|
-
readonly name = "TradingFee.InvalidFeesLengthError";
|
|
2837
|
-
constructor(length: number);
|
|
2838
|
-
}
|
|
2839
|
-
declare namespace Transfer_d_exports {
|
|
2840
|
-
export { Transfer, from$5 as from };
|
|
2841
|
-
}
|
|
2842
|
-
type Transfer = {
|
|
2843
|
-
id: string;
|
|
2844
|
-
chainId: Id;
|
|
2845
|
-
contract: Address;
|
|
2846
|
-
from: Address;
|
|
2847
|
-
to: Address;
|
|
2848
|
-
value: bigint;
|
|
2849
|
-
type: Type; /** The underlying asset of the transfer's position. */
|
|
2850
|
-
asset: Address;
|
|
2851
|
-
blockNumber: number;
|
|
2852
|
-
};
|
|
2853
|
-
/**
|
|
2854
|
-
* @constructor
|
|
2855
|
-
*
|
|
2856
|
-
* Creates a {@link Transfer}.
|
|
2857
|
-
* @param parameters - {@link from.Parameters}
|
|
2858
|
-
* @returns The created Transfer. {@link from.ReturnType}
|
|
2859
|
-
*
|
|
2860
|
-
* @example
|
|
2861
|
-
* ```ts
|
|
2862
|
-
* const transfer = Transfer.from({ id: "1", chainId: 1, contract: "0x123", from: "0x456", to: "0x789", value: 100n, blockNumber: 100n });
|
|
2863
|
-
* ```
|
|
2864
|
-
*/
|
|
2865
|
-
declare function from$5(parameters: from$5.Parameters): from$5.ReturnType;
|
|
2866
|
-
declare namespace from$5 {
|
|
2867
|
-
type Parameters = {
|
|
2868
|
-
id: string;
|
|
2869
|
-
chainId: Id;
|
|
2870
|
-
contract: Address;
|
|
2871
|
-
from: Address;
|
|
2872
|
-
to: Address;
|
|
2873
|
-
value: bigint;
|
|
2874
|
-
type: Type;
|
|
2875
|
-
asset: Address;
|
|
2876
|
-
blockNumber: number;
|
|
2877
|
-
};
|
|
2878
|
-
type ReturnType = Transfer;
|
|
2879
|
-
}
|
|
2880
|
-
declare namespace Tree_d_exports {
|
|
2881
|
-
export { DecodeError, EncodeError, NormalizedSignatureDomain, Proof, SignatureDomain, SignatureDomainError, Tree, TreeError, VERSION, decode, encode, encodeUnsigned, from$4 as from, proofs, signatureDomain, signatureTypes };
|
|
2882
|
-
}
|
|
2883
|
-
/**
|
|
2884
|
-
* A merkle tree of offers built from offer hashes.
|
|
2885
|
-
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
2886
|
-
*/
|
|
2887
|
-
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
2888
|
-
/** The offers in the tree. */offers: Offer[]; /** The root of the tree. */
|
|
2889
|
-
root: Hex;
|
|
2890
|
-
}>;
|
|
2891
|
-
type Proof = {
|
|
2892
|
-
/** The offer that the proof is for. */offer: Offer; /** The merkle proof path for the offer. */
|
|
2893
|
-
path: Hex[];
|
|
2894
|
-
};
|
|
2895
|
-
declare const VERSION = 1;
|
|
2896
|
-
type SignatureDomain = {
|
|
2897
|
-
/** Chain id used in the EIP-712 domain. */chainId: number | bigint; /** MorphoV2 contract address used as verifying contract. */
|
|
2898
|
-
verifyingContract: Address;
|
|
2899
|
-
};
|
|
2900
|
-
/** Normalized Root signature domain (BigInt chain id, lowercase address). */
|
|
2901
|
-
type NormalizedSignatureDomain = {
|
|
2902
|
-
chainId: bigint;
|
|
2903
|
-
verifyingContract: Address;
|
|
2904
|
-
};
|
|
2905
|
-
/**
|
|
2906
|
-
* EIP-712 types for signing the tree root (Root(bytes32 root)).
|
|
2907
|
-
*/
|
|
2908
|
-
declare const signatureTypes: {
|
|
2909
|
-
readonly EIP712Domain: readonly [{
|
|
2910
|
-
readonly name: "chainId";
|
|
2911
|
-
readonly type: "uint256";
|
|
2912
|
-
}, {
|
|
2913
|
-
readonly name: "verifyingContract";
|
|
2914
|
-
readonly type: "address";
|
|
2915
|
-
}];
|
|
2916
|
-
readonly Root: readonly [{
|
|
2917
|
-
readonly name: "root";
|
|
2918
|
-
readonly type: "bytes32";
|
|
2919
|
-
}];
|
|
2920
|
-
};
|
|
2921
|
-
/**
|
|
2922
|
-
* Builds a Merkle tree from a list of offers.
|
|
2923
|
-
*
|
|
2924
|
-
* Leaves are the offer `hash` values as `bytes32` and are deterministically
|
|
2925
|
-
* ordered following the StandardMerkleTree leaf ordering so that the resulting
|
|
2926
|
-
* root is stable regardless of the input order.
|
|
2927
|
-
*
|
|
2928
|
-
* @param offers - Offers to include in the tree.
|
|
2929
|
-
* @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
|
|
2930
|
-
* @throws {TreeError} If tree building fails due to offer inconsistencies.
|
|
2931
|
-
*/
|
|
2932
|
-
declare const from$4: (offers: Offer[]) => Tree;
|
|
2933
|
-
/**
|
|
2934
|
-
* Generates merkle proofs for all offers in a tree.
|
|
2935
|
-
*
|
|
2936
|
-
* Each proof allows independent verification that an offer is included in the tree
|
|
2937
|
-
* without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
|
|
2938
|
-
*
|
|
2939
|
-
* @param tree - The {@link Tree} to generate proofs for.
|
|
2940
|
-
* @returns Array of proofs - {@link Proof}
|
|
2941
|
-
*/
|
|
2942
|
-
declare const proofs: (tree: Tree) => Proof[];
|
|
2943
|
-
/**
|
|
2944
|
-
* Normalizes a Root signature domain (BigInt chain id, lowercase address).
|
|
2945
|
-
* @throws {SignatureDomainError} When the domain is invalid.
|
|
2946
|
-
*/
|
|
2947
|
-
declare const signatureDomain: (domain: SignatureDomain) => NormalizedSignatureDomain;
|
|
2948
|
-
/**
|
|
2949
|
-
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
2950
|
-
*
|
|
2951
|
-
* Layout: `0x{vv}{gzip([...offers])}{root}{signature}` where:
|
|
2952
|
-
* - `{vv}`: 1-byte version (currently 0x01)
|
|
2953
|
-
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
2954
|
-
* - `{root}`: 32-byte merkle root
|
|
2955
|
-
* - `{signature}`: 65-byte EIP-712 signature over Root(bytes32 root)
|
|
2956
|
-
*
|
|
2957
|
-
* Validates signature authenticity and root integrity before encoding.
|
|
2958
|
-
*
|
|
2959
|
-
* @example
|
|
2960
|
-
* ```typescript
|
|
2961
|
-
* const tree = Tree.from(offers);
|
|
2962
|
-
* const signature = await wallet.signTypedData({
|
|
2963
|
-
* account: wallet.account,
|
|
2964
|
-
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
2965
|
-
* types: Tree.signatureTypes,
|
|
2966
|
-
* primaryType: "Root",
|
|
2967
|
-
* message: { root: tree.root },
|
|
2968
|
-
* });
|
|
2969
|
-
* const calldata = await Tree.encode(tree, signature, { chainId, verifyingContract });
|
|
2970
|
-
* await broadcast(calldata);
|
|
2971
|
-
* ```
|
|
2972
|
-
*
|
|
2973
|
-
* @example
|
|
2974
|
-
* Manual construction (for advanced users):
|
|
2975
|
-
* ```typescript
|
|
2976
|
-
* const tree = Tree.from(offers);
|
|
2977
|
-
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
2978
|
-
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
2979
|
-
* const signature = await wallet.signTypedData({
|
|
2980
|
-
* account: wallet.account,
|
|
2981
|
-
* domain: Tree.signatureDomain({ chainId, verifyingContract }),
|
|
2982
|
-
* types: Tree.signatureTypes,
|
|
2983
|
-
* primaryType: "Root",
|
|
2984
|
-
* message: { root: tree.root },
|
|
2985
|
-
* });
|
|
2986
|
-
* const calldata = `${partial}${signature.slice(2)}`;
|
|
2987
|
-
* ```
|
|
2988
|
-
*
|
|
2989
|
-
* @param tree - Merkle tree of offers
|
|
2990
|
-
* @param signature - EIP-712 signature over Root(bytes32 root)
|
|
2991
|
-
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
2992
|
-
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
2993
|
-
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
2994
|
-
*/
|
|
2995
|
-
declare const encode: (tree: Tree, signature: Hex, domain: SignatureDomain) => Promise<Hex>;
|
|
2996
|
-
/**
|
|
2997
|
-
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
2998
|
-
*
|
|
2999
|
-
* Layout: `0x{vv}{gzip([...offers])}{root}` where:
|
|
3000
|
-
* - `{vv}`: 1-byte version (currently 0x01)
|
|
3001
|
-
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
3002
|
-
* - `{root}`: 32-byte merkle root
|
|
3003
|
-
*
|
|
3004
|
-
* Validates root integrity before encoding.
|
|
3005
|
-
*
|
|
3006
|
-
* @param tree - Merkle tree of offers
|
|
3007
|
-
* @returns Hex-encoded unsigned payload
|
|
3008
|
-
* @throws {EncodeError} If root mismatch
|
|
3009
|
-
*/
|
|
3010
|
-
declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
3011
|
-
/**
|
|
3012
|
-
* Decodes hex calldata into a validated merkle tree.
|
|
3013
|
-
*
|
|
3014
|
-
* Validates signature before decompression for fail-fast rejection of invalid payloads.
|
|
3015
|
-
* Returns the tree with separately validated signature and recovered signer address.
|
|
3016
|
-
*
|
|
3017
|
-
* Validation order:
|
|
3018
|
-
* 1. Version check
|
|
3019
|
-
* 2. Signature verification (fail-fast, before decompression)
|
|
3020
|
-
* 3. Decompression (only if signature valid)
|
|
3021
|
-
* 4. Root verification (computed from offers vs embedded root)
|
|
3022
|
-
*
|
|
3023
|
-
* @example
|
|
3024
|
-
* ```typescript
|
|
3025
|
-
* const { tree, signature, signer } = await Tree.decode(calldata, { chainId, verifyingContract });
|
|
3026
|
-
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
3027
|
-
* ```
|
|
3028
|
-
*
|
|
3029
|
-
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
3030
|
-
* @param domain - EIP-712 domain with chain id and verifying contract
|
|
3031
|
-
* @returns Validated tree, signature, and recovered signer address
|
|
3032
|
-
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
3033
|
-
*/
|
|
3034
|
-
declare const decode: (encoded: Hex, domain: SignatureDomain) => Promise<{
|
|
3035
|
-
tree: Tree;
|
|
3036
|
-
signature: Hex;
|
|
3037
|
-
signer: Address;
|
|
3038
|
-
}>;
|
|
3039
|
-
/**
|
|
3040
|
-
* Error thrown during tree building operations.
|
|
3041
|
-
* Indicates structural issues with the tree (missing offers, inconsistent state).
|
|
3042
|
-
*/
|
|
3043
|
-
declare class TreeError extends BaseError {
|
|
3044
|
-
name: string;
|
|
3045
|
-
constructor(reason: string);
|
|
3046
|
-
}
|
|
3047
|
-
/**
|
|
3048
|
-
* Error thrown during tree encoding.
|
|
3049
|
-
* Indicates validation failures (signature, root mismatch, mixed makers).
|
|
3050
|
-
*/
|
|
3051
|
-
declare class EncodeError extends BaseError {
|
|
3052
|
-
name: string;
|
|
3053
|
-
constructor(reason: string);
|
|
3054
|
-
}
|
|
3055
|
-
/**
|
|
3056
|
-
* Error thrown during tree decoding.
|
|
3057
|
-
* Indicates payload corruption, version mismatch, or validation failures.
|
|
3058
|
-
*/
|
|
3059
|
-
declare class DecodeError extends BaseError {
|
|
3060
|
-
name: string;
|
|
3061
|
-
constructor(reason: string);
|
|
3062
|
-
}
|
|
3063
|
-
/**
|
|
3064
|
-
* Error thrown when an invalid signature domain is supplied.
|
|
3065
|
-
*/
|
|
3066
|
-
declare class SignatureDomainError extends BaseError {
|
|
3067
|
-
name: string;
|
|
3068
|
-
constructor(reason: string);
|
|
3069
|
-
}
|
|
3070
|
-
//#endregion
|
|
3071
|
-
//#region src/api/Schema/generated/swagger.d.ts
|
|
3072
|
-
/**
|
|
3073
|
-
* This file was auto-generated by openapi-typescript.
|
|
3074
|
-
* Do not make direct changes to the file.
|
|
3075
|
-
*/
|
|
3076
|
-
interface paths {
|
|
3077
|
-
"/v1/books/{obligationId}/{side}": {
|
|
3078
|
-
parameters: {
|
|
3079
|
-
query?: never;
|
|
3080
|
-
header?: never;
|
|
3081
|
-
path?: never;
|
|
3082
|
-
cookie?: never;
|
|
3083
|
-
};
|
|
3084
|
-
/**
|
|
3085
|
-
* Get aggregated book
|
|
3086
|
-
* @description Returns aggregated book data for a given obligation and side. Offers are grouped by tick with summed takeable amounts, and each level includes the corresponding wad-scaled price. Book levels are sorted by tick (ascending for sell side, descending for buy side).
|
|
3087
|
-
*/
|
|
3088
|
-
get: {
|
|
3089
|
-
parameters: {
|
|
3090
|
-
query?: {
|
|
3091
|
-
/**
|
|
3092
|
-
* @description Maximum number of tick levels to return.
|
|
3093
|
-
* @example 10
|
|
3094
|
-
*/
|
|
3095
|
-
limit?: number;
|
|
3096
|
-
/**
|
|
3097
|
-
* @description Pagination cursor in base64url-encoded format.
|
|
3098
|
-
* @example eyJvZmZzZXQiOjEwMH0
|
|
3099
|
-
*/
|
|
3100
|
-
cursor?: string;
|
|
3101
|
-
};
|
|
3102
|
-
header?: never;
|
|
3103
|
-
path: {
|
|
3104
|
-
/**
|
|
3105
|
-
* @description Book side (buy or sell).
|
|
3106
|
-
* @example buy
|
|
3107
|
-
*/
|
|
3108
|
-
side: "buy" | "sell";
|
|
3109
|
-
/**
|
|
3110
|
-
* @description Obligation id.
|
|
3111
|
-
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
3112
|
-
*/
|
|
3113
|
-
obligationId: string;
|
|
3114
|
-
};
|
|
3115
|
-
cookie?: never;
|
|
3116
|
-
};
|
|
3117
|
-
requestBody?: never;
|
|
3118
|
-
responses: {
|
|
3119
|
-
/** @description Success */200: {
|
|
3120
|
-
headers: {
|
|
3121
|
-
[name: string]: unknown;
|
|
3122
|
-
};
|
|
3123
|
-
content: {
|
|
3124
|
-
"application/json": components["schemas"]["BookListResponse"];
|
|
3125
|
-
};
|
|
3126
|
-
}; /** @description Bad Request */
|
|
3127
|
-
400: {
|
|
3128
|
-
headers: {
|
|
3129
|
-
[name: string]: unknown;
|
|
3130
|
-
};
|
|
3131
|
-
content: {
|
|
3132
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3133
|
-
};
|
|
3134
|
-
};
|
|
3135
|
-
};
|
|
3136
|
-
};
|
|
3137
|
-
put?: never;
|
|
3138
|
-
post?: never;
|
|
3139
|
-
delete?: never;
|
|
3140
|
-
options?: never;
|
|
3141
|
-
head?: never;
|
|
3142
|
-
patch?: never;
|
|
3143
|
-
trace?: never;
|
|
3144
|
-
};
|
|
3145
|
-
"/v1/config/contracts": {
|
|
3146
|
-
parameters: {
|
|
3147
|
-
query?: never;
|
|
3148
|
-
header?: never;
|
|
3149
|
-
path?: never;
|
|
3150
|
-
cookie?: never;
|
|
3151
|
-
};
|
|
3152
|
-
/**
|
|
3153
|
-
* Get indexer contract configuration
|
|
3154
|
-
* @description Returns contract addresses used by indexers (mempool, v2) and multicall for indexed chains.
|
|
3155
|
-
*/
|
|
3156
|
-
get: {
|
|
3157
|
-
parameters: {
|
|
3158
|
-
query?: {
|
|
3159
|
-
/**
|
|
3160
|
-
* @description Filter by chain IDs (comma-separated).
|
|
3161
|
-
* @example 1,8453
|
|
3162
|
-
*/
|
|
3163
|
-
chains?: number[];
|
|
3164
|
-
/**
|
|
3165
|
-
* @description Maximum number of contracts to return (max 1000).
|
|
3166
|
-
* @example 1000
|
|
3167
|
-
*/
|
|
3168
|
-
limit?: number;
|
|
3169
|
-
/**
|
|
3170
|
-
* @description Pagination cursor in chain_id:address format (lowercase address).
|
|
3171
|
-
* @example 505050505:0xd946246695a9259f3b33a78629026f61b3ab40af
|
|
3172
|
-
*/
|
|
3173
|
-
cursor?: string;
|
|
3174
|
-
};
|
|
3175
|
-
header?: never;
|
|
3176
|
-
path?: never;
|
|
3177
|
-
cookie?: never;
|
|
3178
|
-
};
|
|
3179
|
-
requestBody?: never;
|
|
3180
|
-
responses: {
|
|
3181
|
-
/** @description Success */200: {
|
|
3182
|
-
headers: {
|
|
3183
|
-
[name: string]: unknown;
|
|
3184
|
-
};
|
|
3185
|
-
content: {
|
|
3186
|
-
"application/json": components["schemas"]["ConfigContractsSuccessResponse"];
|
|
3187
|
-
};
|
|
3188
|
-
};
|
|
3189
|
-
};
|
|
3190
|
-
};
|
|
3191
|
-
put?: never;
|
|
3192
|
-
post?: never;
|
|
3193
|
-
delete?: never;
|
|
3194
|
-
options?: never;
|
|
3195
|
-
head?: never;
|
|
3196
|
-
patch?: never;
|
|
3197
|
-
trace?: never;
|
|
3198
|
-
};
|
|
3199
|
-
"/v1/config/rules": {
|
|
3200
|
-
parameters: {
|
|
3201
|
-
query?: never;
|
|
3202
|
-
header?: never;
|
|
3203
|
-
path?: never;
|
|
3204
|
-
cookie?: never;
|
|
3205
|
-
};
|
|
3206
|
-
/**
|
|
3207
|
-
* Get config rules
|
|
3208
|
-
* @description Returns configured rules (maturities, loan tokens, collateral tokens, oracles) for supported chains.
|
|
3209
|
-
*/
|
|
3210
|
-
get: {
|
|
3211
|
-
parameters: {
|
|
3212
|
-
query?: {
|
|
3213
|
-
/**
|
|
3214
|
-
* @description Filter by chain IDs (comma-separated).
|
|
3215
|
-
* @example 1,8453
|
|
3216
|
-
*/
|
|
3217
|
-
chains?: number[];
|
|
3218
|
-
/**
|
|
3219
|
-
* @description Filter by rule types (comma-separated).
|
|
3220
|
-
* @example maturity,loan_token,collateral_token,oracle
|
|
3221
|
-
*/
|
|
3222
|
-
types?: string[];
|
|
3223
|
-
/**
|
|
3224
|
-
* @description Maximum number of rules to return (max 1000).
|
|
3225
|
-
* @example 100
|
|
3226
|
-
*/
|
|
3227
|
-
limit?: number;
|
|
3228
|
-
/**
|
|
3229
|
-
* @description Pagination cursor in type:chain_id:<value> format.
|
|
3230
|
-
* @example maturity:1:1730415600:end_of_next_month
|
|
3231
|
-
*/
|
|
3232
|
-
cursor?: string;
|
|
3233
|
-
};
|
|
3234
|
-
header?: never;
|
|
3235
|
-
path?: never;
|
|
3236
|
-
cookie?: never;
|
|
3237
|
-
};
|
|
3238
|
-
requestBody?: never;
|
|
3239
|
-
responses: {
|
|
3240
|
-
/** @description Success */200: {
|
|
3241
|
-
headers: {
|
|
3242
|
-
[name: string]: unknown;
|
|
3243
|
-
};
|
|
3244
|
-
content: {
|
|
3245
|
-
"application/json": components["schemas"]["ConfigRulesSuccessResponse"];
|
|
3246
|
-
};
|
|
3247
|
-
};
|
|
3248
|
-
};
|
|
3249
|
-
};
|
|
3250
|
-
put?: never;
|
|
3251
|
-
post?: never;
|
|
3252
|
-
delete?: never;
|
|
3253
|
-
options?: never;
|
|
3254
|
-
head?: never;
|
|
3255
|
-
patch?: never;
|
|
3256
|
-
trace?: never;
|
|
3257
|
-
};
|
|
3258
|
-
"/v1/offers": {
|
|
3259
|
-
parameters: {
|
|
3260
|
-
query?: never;
|
|
3261
|
-
header?: never;
|
|
3262
|
-
path?: never;
|
|
3263
|
-
cookie?: never;
|
|
3264
|
-
};
|
|
3265
|
-
/**
|
|
3266
|
-
* List all offers
|
|
3267
|
-
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `maker` (by maker address).
|
|
3268
|
-
*/
|
|
3269
|
-
get: {
|
|
3270
|
-
parameters: {
|
|
3271
|
-
query?: {
|
|
3272
|
-
/**
|
|
3273
|
-
* @description Maximum number of offers to return.
|
|
3274
|
-
* @example 10
|
|
3275
|
-
*/
|
|
3276
|
-
limit?: number;
|
|
3277
|
-
/**
|
|
3278
|
-
* @description Pagination cursor in base64url-encoded format.
|
|
3279
|
-
* @example eyJvZmZzZXQiOjEwMH0
|
|
3280
|
-
*/
|
|
3281
|
-
cursor?: string;
|
|
3282
|
-
/**
|
|
3283
|
-
* @description Maker address to filter offers by. Alternative to obligation_id + side.
|
|
3284
|
-
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
3285
|
-
*/
|
|
3286
|
-
maker?: string;
|
|
3287
|
-
/**
|
|
3288
|
-
* @description Obligation id used to filter offers. Required when not using maker.
|
|
3289
|
-
* @example 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
3290
|
-
*/
|
|
3291
|
-
obligation_id?: string;
|
|
3292
|
-
/**
|
|
3293
|
-
* @description Side of the offer. Required when using obligation_id.
|
|
3294
|
-
* @example buy
|
|
3295
|
-
*/
|
|
3296
|
-
side?: "buy" | "sell";
|
|
3297
|
-
};
|
|
3298
|
-
header?: never;
|
|
3299
|
-
path?: never;
|
|
3300
|
-
cookie?: never;
|
|
3301
|
-
};
|
|
3302
|
-
requestBody?: never;
|
|
3303
|
-
responses: {
|
|
3304
|
-
/** @description Success */200: {
|
|
3305
|
-
headers: {
|
|
3306
|
-
[name: string]: unknown;
|
|
3307
|
-
};
|
|
3308
|
-
content: {
|
|
3309
|
-
"application/json": components["schemas"]["OfferListResponse"];
|
|
3310
|
-
};
|
|
3311
|
-
}; /** @description Bad Request */
|
|
3312
|
-
400: {
|
|
3313
|
-
headers: {
|
|
3314
|
-
[name: string]: unknown;
|
|
3315
|
-
};
|
|
3316
|
-
content: {
|
|
3317
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3318
|
-
};
|
|
3319
|
-
};
|
|
3320
|
-
};
|
|
3321
|
-
};
|
|
3322
|
-
put?: never;
|
|
3323
|
-
post?: never;
|
|
3324
|
-
delete?: never;
|
|
3325
|
-
options?: never;
|
|
3326
|
-
head?: never;
|
|
3327
|
-
patch?: never;
|
|
3328
|
-
trace?: never;
|
|
3329
|
-
};
|
|
3330
|
-
"/v1/obligations": {
|
|
3331
|
-
parameters: {
|
|
3332
|
-
query?: never;
|
|
3333
|
-
header?: never;
|
|
3334
|
-
path?: never;
|
|
3335
|
-
cookie?: never;
|
|
3336
|
-
};
|
|
3337
|
-
/**
|
|
3338
|
-
* List all obligations
|
|
3339
|
-
* @description Returns a list of obligations with their current best ask and bid. Sorting is customizable with the sort parameter and defaults to id ascending.
|
|
3340
|
-
*/
|
|
3341
|
-
get: {
|
|
3342
|
-
parameters: {
|
|
3343
|
-
query?: {
|
|
3344
|
-
/**
|
|
3345
|
-
* @description Sort order as comma-separated fields (`id`, `ask`, `bid`, `maturity`). Prefix with `-` for descending order. Max 3 fields.
|
|
3346
|
-
* @example -ask,bid,maturity
|
|
3347
|
-
*/
|
|
3348
|
-
sort?: string;
|
|
3349
|
-
/**
|
|
3350
|
-
* @description Filter by exact maturity timestamps (comma-separated, unix seconds).
|
|
3351
|
-
* @example 1761922800,1764524800
|
|
3352
|
-
*/
|
|
3353
|
-
maturities?: number[];
|
|
3354
|
-
/**
|
|
3355
|
-
* @description Filter by collateral tokens (comma-separated, matches any collateral).
|
|
3356
|
-
* @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751,0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078
|
|
3357
|
-
*/
|
|
3358
|
-
collateral_tokens?: string[];
|
|
3359
|
-
/**
|
|
3360
|
-
* @description Filter by loan token addresses (comma-separated).
|
|
3361
|
-
* @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078,0x34Cf890dB685FC536E05652FB41f02090c3fb751
|
|
3362
|
-
*/
|
|
3363
|
-
loan_tokens?: string[];
|
|
3364
|
-
/**
|
|
3365
|
-
* @description Filter by chain IDs (comma-separated).
|
|
3366
|
-
* @example 1,8453
|
|
3367
|
-
*/
|
|
3368
|
-
chains?: number[];
|
|
3369
|
-
/**
|
|
3370
|
-
* @description Maximum number of obligations to return.
|
|
3371
|
-
* @example 10
|
|
3372
|
-
*/
|
|
3373
|
-
limit?: number;
|
|
3374
|
-
/**
|
|
3375
|
-
* @description Pagination cursor in base64url-encoded format.
|
|
3376
|
-
* @example eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAiLCJhc2siOiIwIiwiYmlkIjoiMCIsIm1hdHVyaXR5IjoxNzYxOTIyODAwfQ
|
|
3377
|
-
*/
|
|
3378
|
-
cursor?: string;
|
|
3379
|
-
};
|
|
3380
|
-
header?: never;
|
|
3381
|
-
path?: never;
|
|
3382
|
-
cookie?: never;
|
|
3383
|
-
};
|
|
3384
|
-
requestBody?: never;
|
|
3385
|
-
responses: {
|
|
3386
|
-
/** @description Success */200: {
|
|
3387
|
-
headers: {
|
|
3388
|
-
[name: string]: unknown;
|
|
3389
|
-
};
|
|
3390
|
-
content: {
|
|
3391
|
-
"application/json": components["schemas"]["ObligationListResponse"];
|
|
3392
|
-
};
|
|
3393
|
-
}; /** @description Bad Request */
|
|
3394
|
-
400: {
|
|
3395
|
-
headers: {
|
|
3396
|
-
[name: string]: unknown;
|
|
3397
|
-
};
|
|
3398
|
-
content: {
|
|
3399
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3400
|
-
};
|
|
3401
|
-
};
|
|
3402
|
-
};
|
|
3403
|
-
};
|
|
3404
|
-
put?: never;
|
|
3405
|
-
post?: never;
|
|
3406
|
-
delete?: never;
|
|
3407
|
-
options?: never;
|
|
3408
|
-
head?: never;
|
|
3409
|
-
patch?: never;
|
|
3410
|
-
trace?: never;
|
|
3411
|
-
};
|
|
3412
|
-
"/v1/obligations/{obligationId}": {
|
|
3413
|
-
parameters: {
|
|
3414
|
-
query?: never;
|
|
3415
|
-
header?: never;
|
|
3416
|
-
path?: never;
|
|
3417
|
-
cookie?: never;
|
|
3418
|
-
};
|
|
3419
|
-
/**
|
|
3420
|
-
* Get an obligation
|
|
3421
|
-
* @description Returns an obligation by its id.
|
|
3422
|
-
*/
|
|
3423
|
-
get: {
|
|
3424
|
-
parameters: {
|
|
3425
|
-
query?: never;
|
|
3426
|
-
header?: never;
|
|
3427
|
-
path: {
|
|
3428
|
-
/**
|
|
3429
|
-
* @description Obligation id.
|
|
3430
|
-
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
3431
|
-
*/
|
|
3432
|
-
obligationId: string;
|
|
3433
|
-
};
|
|
3434
|
-
cookie?: never;
|
|
3435
|
-
};
|
|
3436
|
-
requestBody?: never;
|
|
3437
|
-
responses: {
|
|
3438
|
-
/** @description Success */200: {
|
|
3439
|
-
headers: {
|
|
3440
|
-
[name: string]: unknown;
|
|
3441
|
-
};
|
|
3442
|
-
content: {
|
|
3443
|
-
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
3444
|
-
};
|
|
3445
|
-
}; /** @description Bad Request */
|
|
3446
|
-
400: {
|
|
3447
|
-
headers: {
|
|
3448
|
-
[name: string]: unknown;
|
|
3449
|
-
};
|
|
3450
|
-
content: {
|
|
3451
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3452
|
-
};
|
|
3453
|
-
};
|
|
3454
|
-
};
|
|
3455
|
-
};
|
|
3456
|
-
put?: never;
|
|
3457
|
-
post?: never;
|
|
3458
|
-
delete?: never;
|
|
3459
|
-
options?: never;
|
|
3460
|
-
head?: never;
|
|
3461
|
-
patch?: never;
|
|
3462
|
-
trace?: never;
|
|
3463
|
-
};
|
|
3464
|
-
"/v1/health": {
|
|
3465
|
-
parameters: {
|
|
3466
|
-
query?: never;
|
|
3467
|
-
header?: never;
|
|
3468
|
-
path?: never;
|
|
3469
|
-
cookie?: never;
|
|
3470
|
-
};
|
|
3471
|
-
/**
|
|
3472
|
-
* Retrieve global health
|
|
3473
|
-
* @description Returns the aggregated status of the router.
|
|
3474
|
-
*/
|
|
3475
|
-
get: {
|
|
3476
|
-
parameters: {
|
|
3477
|
-
query?: {
|
|
3478
|
-
/**
|
|
3479
|
-
* @description Fail the request if initialization is incomplete.
|
|
3480
|
-
* @example true
|
|
3481
|
-
*/
|
|
3482
|
-
strict?: boolean;
|
|
3483
|
-
};
|
|
3484
|
-
header?: never;
|
|
3485
|
-
path?: never;
|
|
3486
|
-
cookie?: never;
|
|
3487
|
-
};
|
|
3488
|
-
requestBody?: never;
|
|
3489
|
-
responses: {
|
|
3490
|
-
/** @description Success */200: {
|
|
3491
|
-
headers: {
|
|
3492
|
-
[name: string]: unknown;
|
|
3493
|
-
};
|
|
3494
|
-
content: {
|
|
3495
|
-
"application/json": components["schemas"]["RouterStatusSuccessResponse"];
|
|
3496
|
-
};
|
|
3497
|
-
};
|
|
3498
|
-
};
|
|
3499
|
-
};
|
|
3500
|
-
put?: never;
|
|
3501
|
-
post?: never;
|
|
3502
|
-
delete?: never;
|
|
3503
|
-
options?: never;
|
|
3504
|
-
head?: never;
|
|
3505
|
-
patch?: never;
|
|
3506
|
-
trace?: never;
|
|
3507
|
-
};
|
|
3508
|
-
"/v1/health/collectors": {
|
|
3509
|
-
parameters: {
|
|
3510
|
-
query?: never;
|
|
3511
|
-
header?: never;
|
|
3512
|
-
path?: never;
|
|
3513
|
-
cookie?: never;
|
|
3514
|
-
};
|
|
3515
|
-
/**
|
|
3516
|
-
* Retrieve collectors health
|
|
3517
|
-
* @description Returns the latest block numbers processed by collectors and their sync status.
|
|
3518
|
-
*/
|
|
3519
|
-
get: {
|
|
3520
|
-
parameters: {
|
|
3521
|
-
query?: {
|
|
3522
|
-
/**
|
|
3523
|
-
* @description Fail the request if initialization is incomplete.
|
|
3524
|
-
* @example true
|
|
3525
|
-
*/
|
|
3526
|
-
strict?: boolean;
|
|
3527
|
-
};
|
|
3528
|
-
header?: never;
|
|
3529
|
-
path?: never;
|
|
3530
|
-
cookie?: never;
|
|
3531
|
-
};
|
|
3532
|
-
requestBody?: never;
|
|
3533
|
-
responses: {
|
|
3534
|
-
/** @description Success */200: {
|
|
3535
|
-
headers: {
|
|
3536
|
-
[name: string]: unknown;
|
|
3537
|
-
};
|
|
3538
|
-
content: {
|
|
3539
|
-
"application/json": components["schemas"]["CollectorsHealthSuccessResponse"];
|
|
3540
|
-
};
|
|
3541
|
-
};
|
|
3542
|
-
};
|
|
3543
|
-
};
|
|
3544
|
-
put?: never;
|
|
3545
|
-
post?: never;
|
|
3546
|
-
delete?: never;
|
|
3547
|
-
options?: never;
|
|
3548
|
-
head?: never;
|
|
3549
|
-
patch?: never;
|
|
3550
|
-
trace?: never;
|
|
3551
|
-
};
|
|
3552
|
-
"/v1/health/chains": {
|
|
3553
|
-
parameters: {
|
|
3554
|
-
query?: never;
|
|
3555
|
-
header?: never;
|
|
3556
|
-
path?: never;
|
|
3557
|
-
cookie?: never;
|
|
3558
|
-
};
|
|
3559
|
-
/**
|
|
3560
|
-
* Retrieve chains health
|
|
3561
|
-
* @description Returns the latest block that can be processed by collectors for each chain.
|
|
3562
|
-
*/
|
|
3563
|
-
get: {
|
|
3564
|
-
parameters: {
|
|
3565
|
-
query?: {
|
|
3566
|
-
/**
|
|
3567
|
-
* @description Fail the request if initialization is incomplete.
|
|
3568
|
-
* @example true
|
|
3569
|
-
*/
|
|
3570
|
-
strict?: boolean;
|
|
3571
|
-
};
|
|
3572
|
-
header?: never;
|
|
3573
|
-
path?: never;
|
|
3574
|
-
cookie?: never;
|
|
3575
|
-
};
|
|
3576
|
-
requestBody?: never;
|
|
3577
|
-
responses: {
|
|
3578
|
-
/** @description Success */200: {
|
|
3579
|
-
headers: {
|
|
3580
|
-
[name: string]: unknown;
|
|
3581
|
-
};
|
|
3582
|
-
content: {
|
|
3583
|
-
"application/json": components["schemas"]["ChainsHealthSuccessResponse"];
|
|
3584
|
-
};
|
|
3585
|
-
};
|
|
3586
|
-
};
|
|
3587
|
-
};
|
|
3588
|
-
put?: never;
|
|
3589
|
-
post?: never;
|
|
3590
|
-
delete?: never;
|
|
3591
|
-
options?: never;
|
|
3592
|
-
head?: never;
|
|
3593
|
-
patch?: never;
|
|
3594
|
-
trace?: never;
|
|
3595
|
-
};
|
|
3596
|
-
"/v1/users/{userAddress}/positions": {
|
|
3597
|
-
parameters: {
|
|
3598
|
-
query?: never;
|
|
3599
|
-
header?: never;
|
|
3600
|
-
path?: never;
|
|
3601
|
-
cookie?: never;
|
|
3602
|
-
};
|
|
3603
|
-
/**
|
|
3604
|
-
* Get user positions
|
|
3605
|
-
* @description Returns positions for a user with reserved balance per obligation. Each (position, obligation) pair is returned as a separate row. Positions with no lots return a single row with obligation_id = null and reserved = 0.
|
|
3606
|
-
*/
|
|
3607
|
-
get: {
|
|
3608
|
-
parameters: {
|
|
3609
|
-
query?: {
|
|
3610
|
-
/**
|
|
3611
|
-
* @description Maximum number of positions to return.
|
|
3612
|
-
* @example 10
|
|
3613
|
-
*/
|
|
3614
|
-
limit?: number;
|
|
3615
|
-
/**
|
|
3616
|
-
* @description Pagination cursor in base64url-encoded format.
|
|
3617
|
-
* @example eyJvZmZzZXQiOjEwMH0
|
|
3618
|
-
*/
|
|
3619
|
-
cursor?: string;
|
|
3620
|
-
};
|
|
3621
|
-
header?: never;
|
|
3622
|
-
path: {
|
|
3623
|
-
/**
|
|
3624
|
-
* @description User address to get positions for.
|
|
3625
|
-
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
3626
|
-
*/
|
|
3627
|
-
userAddress: string;
|
|
3628
|
-
};
|
|
3629
|
-
cookie?: never;
|
|
3630
|
-
};
|
|
3631
|
-
requestBody?: never;
|
|
3632
|
-
responses: {
|
|
3633
|
-
/** @description Success */200: {
|
|
3634
|
-
headers: {
|
|
3635
|
-
[name: string]: unknown;
|
|
3636
|
-
};
|
|
3637
|
-
content: {
|
|
3638
|
-
"application/json": components["schemas"]["PositionListResponse"];
|
|
3639
|
-
};
|
|
3640
|
-
}; /** @description Bad Request */
|
|
3641
|
-
400: {
|
|
3642
|
-
headers: {
|
|
3643
|
-
[name: string]: unknown;
|
|
3644
|
-
};
|
|
3645
|
-
content: {
|
|
3646
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3647
|
-
};
|
|
3648
|
-
};
|
|
3649
|
-
};
|
|
3650
|
-
};
|
|
3651
|
-
put?: never;
|
|
3652
|
-
post?: never;
|
|
3653
|
-
delete?: never;
|
|
3654
|
-
options?: never;
|
|
3655
|
-
head?: never;
|
|
3656
|
-
patch?: never;
|
|
3657
|
-
trace?: never;
|
|
3658
|
-
};
|
|
3659
|
-
"/v1/validate": {
|
|
3660
|
-
parameters: {
|
|
3661
|
-
query?: never;
|
|
3662
|
-
header?: never;
|
|
3663
|
-
path?: never;
|
|
3664
|
-
cookie?: never;
|
|
3665
|
-
};
|
|
3666
|
-
get?: never;
|
|
3667
|
-
put?: never;
|
|
3668
|
-
/**
|
|
3669
|
-
* Validate offers
|
|
3670
|
-
* @description Validates offers against router validation rules. Only empty callbacks (zero address, 0x data) are accepted. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
3671
|
-
*/
|
|
3672
|
-
post: {
|
|
3673
|
-
parameters: {
|
|
3674
|
-
query?: never;
|
|
3675
|
-
header?: never;
|
|
3676
|
-
path?: never;
|
|
3677
|
-
cookie?: never;
|
|
3678
|
-
};
|
|
3679
|
-
requestBody?: {
|
|
3680
|
-
content: {
|
|
3681
|
-
"application/json": components["schemas"]["ValidateOffersRequest"];
|
|
3682
|
-
};
|
|
3683
|
-
};
|
|
3684
|
-
responses: {
|
|
3685
|
-
/** @description Success */200: {
|
|
3686
|
-
headers: {
|
|
3687
|
-
[name: string]: unknown;
|
|
3688
|
-
};
|
|
3689
|
-
content: {
|
|
3690
|
-
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
3691
|
-
};
|
|
3692
|
-
}; /** @description Bad Request */
|
|
3693
|
-
400: {
|
|
3694
|
-
headers: {
|
|
3695
|
-
[name: string]: unknown;
|
|
3696
|
-
};
|
|
3697
|
-
content: {
|
|
3698
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
3699
|
-
};
|
|
3700
|
-
};
|
|
3701
|
-
};
|
|
3702
|
-
};
|
|
3703
|
-
delete?: never;
|
|
3704
|
-
options?: never;
|
|
3705
|
-
head?: never;
|
|
3706
|
-
patch?: never;
|
|
3707
|
-
trace?: never;
|
|
3708
|
-
};
|
|
3709
|
-
}
|
|
3710
|
-
interface components {
|
|
3711
|
-
schemas: {
|
|
3712
|
-
BookListResponse: {
|
|
3713
|
-
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
3714
|
-
cursor: string | null; /** @description Aggregated book levels grouped by offer tick. */
|
|
3715
|
-
data: components["schemas"]["BookLevelResponse"][];
|
|
3716
|
-
};
|
|
3717
|
-
Meta: {
|
|
3718
|
-
/** @example 2024-01-01T12:00:00.000Z */timestamp: string;
|
|
3719
|
-
};
|
|
3720
|
-
BookLevelResponse: {
|
|
3721
|
-
/** @example 495 */tick: number;
|
|
3722
|
-
/**
|
|
3723
|
-
* @description Price derived from tick, scaled by 1e18.
|
|
3724
|
-
* @example 500000000000000000
|
|
3725
|
-
*/
|
|
3726
|
-
price: string; /** @example 369216000000000000000000 */
|
|
3727
|
-
assets: string; /** @example 5 */
|
|
3728
|
-
count: number;
|
|
3729
|
-
};
|
|
3730
|
-
BadRequestResponse: {
|
|
3731
|
-
error: components["schemas"]["ErrorResponse"];
|
|
3732
|
-
meta: components["schemas"]["Meta"];
|
|
3733
|
-
};
|
|
3734
|
-
ErrorResponse: {
|
|
3735
|
-
/**
|
|
3736
|
-
* @example VALIDATION_ERROR
|
|
3737
|
-
* @enum {string}
|
|
3738
|
-
*/
|
|
3739
|
-
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST"; /** @example Limit must be greater than 0. */
|
|
3740
|
-
message: string;
|
|
3741
|
-
/**
|
|
3742
|
-
* @example [
|
|
3743
|
-
* {
|
|
3744
|
-
* "field": "limit",
|
|
3745
|
-
* "issue": "Limit must be greater than 0."
|
|
3746
|
-
* }
|
|
3747
|
-
* ]
|
|
3748
|
-
*/
|
|
3749
|
-
details: Record<string, never>;
|
|
3750
|
-
};
|
|
3751
|
-
ConfigContractsSuccessResponse: {
|
|
3752
|
-
meta: components["schemas"]["Meta"]; /** @example null */
|
|
3753
|
-
cursor: string | null;
|
|
3754
|
-
/**
|
|
3755
|
-
* @description Indexer contract configuration for all indexed chains.
|
|
3756
|
-
* @example [
|
|
3757
|
-
* {
|
|
3758
|
-
* "chain_id": 505050505,
|
|
3759
|
-
* "address": "0xD946246695A9259F3B33a78629026F61B3Ab40aF",
|
|
3760
|
-
* "name": "mempool"
|
|
3761
|
-
* },
|
|
3762
|
-
* {
|
|
3763
|
-
* "chain_id": 505050505,
|
|
3764
|
-
* "address": "0x8A409D5D6394fC197c596d4E6E2c35e5d13f8a4d",
|
|
3765
|
-
* "name": "multicall"
|
|
3766
|
-
* },
|
|
3767
|
-
* {
|
|
3768
|
-
* "chain_id": 505050505,
|
|
3769
|
-
* "address": "0x23DFBc4B8B80C14CC5e25011B8491f268395BAd6",
|
|
3770
|
-
* "name": "v2"
|
|
3771
|
-
* }
|
|
3772
|
-
* ]
|
|
3773
|
-
*/
|
|
3774
|
-
data: components["schemas"]["ConfigContractResponse"][];
|
|
3775
|
-
};
|
|
3776
|
-
ConfigContractResponse: {
|
|
3777
|
-
/** @example 505050505 */chain_id: number; /** @example 0xD946246695A9259F3B33a78629026F61B3Ab40aF */
|
|
3778
|
-
address: string;
|
|
3779
|
-
/**
|
|
3780
|
-
* @example mempool
|
|
3781
|
-
* @enum {string}
|
|
3782
|
-
*/
|
|
3783
|
-
name: "mempool" | "multicall" | "v2";
|
|
3784
|
-
};
|
|
3785
|
-
ConfigRulesSuccessResponse: {
|
|
3786
|
-
meta: components["schemas"]["ConfigRulesMeta"]; /** @example null */
|
|
3787
|
-
cursor: string | null;
|
|
3788
|
-
/**
|
|
3789
|
-
* @description Configured rules returned by the router API.
|
|
3790
|
-
* @example [
|
|
3791
|
-
* {
|
|
3792
|
-
* "type": "maturity",
|
|
3793
|
-
* "chain_id": 1,
|
|
3794
|
-
* "name": "end_of_next_month",
|
|
3795
|
-
* "timestamp": 1730415600
|
|
3796
|
-
* },
|
|
3797
|
-
* {
|
|
3798
|
-
* "type": "loan_token",
|
|
3799
|
-
* "chain_id": 1,
|
|
3800
|
-
* "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
3801
|
-
* },
|
|
3802
|
-
* {
|
|
3803
|
-
* "type": "collateral_token",
|
|
3804
|
-
* "chain_id": 1,
|
|
3805
|
-
* "address": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0"
|
|
3806
|
-
* },
|
|
3807
|
-
* {
|
|
3808
|
-
* "type": "oracle",
|
|
3809
|
-
* "chain_id": 1,
|
|
3810
|
-
* "address": "0xDddd770BADd886dF3864029e4B377B5F6a2B6b83"
|
|
3811
|
-
* }
|
|
3812
|
-
* ]
|
|
3813
|
-
*/
|
|
3814
|
-
data: components["schemas"]["ConfigRulesRuleResponse"][];
|
|
3815
|
-
};
|
|
3816
|
-
ConfigRulesMeta: {
|
|
3817
|
-
/** @example 2024-01-01T12:00:00.000Z */timestamp: string; /** @example f1d2d2f924e986ac86fdf7b36c94bcdf */
|
|
3818
|
-
checksum: string;
|
|
3819
|
-
};
|
|
3820
|
-
ConfigRulesRuleResponse: {
|
|
3821
|
-
/** @example maturity */type: string; /** @example 1 */
|
|
3822
|
-
chain_id: number; /** @example end_of_next_month */
|
|
3823
|
-
name?: string; /** @example 1730415600 */
|
|
3824
|
-
timestamp?: number; /** @example 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 */
|
|
3825
|
-
address?: string;
|
|
3826
|
-
};
|
|
3827
|
-
OfferListResponse: {
|
|
3828
|
-
meta: components["schemas"]["Meta"];
|
|
3829
|
-
/**
|
|
3830
|
-
* @description Pagination cursor. Offer hash (0x...) for maker queries; base64url-encoded cursor for obligation queries.
|
|
3831
|
-
* @example eyJvZmZzZXQiOjEwMH0
|
|
3832
|
-
*/
|
|
3833
|
-
cursor: string | null;
|
|
3834
|
-
/**
|
|
3835
|
-
* @description Offers matching the provided filters.
|
|
3836
|
-
* @example [
|
|
3837
|
-
* {
|
|
3838
|
-
* "offer": {
|
|
3839
|
-
* "obligation": {
|
|
3840
|
-
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3841
|
-
* "collaterals": [
|
|
3842
|
-
* {
|
|
3843
|
-
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3844
|
-
* "lltv": "860000000000000000",
|
|
3845
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3846
|
-
* }
|
|
3847
|
-
* ],
|
|
3848
|
-
* "maturity": 1761922799
|
|
3849
|
-
* },
|
|
3850
|
-
* "buy": false,
|
|
3851
|
-
* "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
3852
|
-
* "assets": "369216000000000000000000",
|
|
3853
|
-
* "obligation_units": "0",
|
|
3854
|
-
* "obligation_shares": "0",
|
|
3855
|
-
* "start": 1761922790,
|
|
3856
|
-
* "expiry": 1761922799,
|
|
3857
|
-
* "tick": 495,
|
|
3858
|
-
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
3859
|
-
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3860
|
-
* "callback": "0x0000000000000000000000000000000000000000",
|
|
3861
|
-
* "callback_data": "0x",
|
|
3862
|
-
* "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3863
|
-
* },
|
|
3864
|
-
* "offer_hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
3865
|
-
* "obligation_id": "0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc",
|
|
3866
|
-
* "chain_id": 1,
|
|
3867
|
-
* "consumed": "0",
|
|
3868
|
-
* "takeable": "369216000000000000000000",
|
|
3869
|
-
* "block_number": 2942933377146801,
|
|
3870
|
-
* "root": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
|
3871
|
-
* "proof": [
|
|
3872
|
-
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
3873
|
-
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
3874
|
-
* ],
|
|
3875
|
-
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400"
|
|
3876
|
-
* }
|
|
3877
|
-
* ]
|
|
3878
|
-
*/
|
|
3879
|
-
data: components["schemas"]["OfferListItemResponse"][];
|
|
3880
|
-
};
|
|
3881
|
-
OfferListItemResponse: {
|
|
3882
|
-
/**
|
|
3883
|
-
* @example {
|
|
3884
|
-
* "obligation": {
|
|
3885
|
-
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3886
|
-
* "collaterals": [
|
|
3887
|
-
* {
|
|
3888
|
-
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3889
|
-
* "lltv": "860000000000000000",
|
|
3890
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3891
|
-
* }
|
|
3892
|
-
* ],
|
|
3893
|
-
* "maturity": 1761922799
|
|
3894
|
-
* },
|
|
3895
|
-
* "buy": false,
|
|
3896
|
-
* "maker": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
3897
|
-
* "assets": "369216000000000000000000",
|
|
3898
|
-
* "obligation_units": "0",
|
|
3899
|
-
* "obligation_shares": "0",
|
|
3900
|
-
* "start": 1761922790,
|
|
3901
|
-
* "expiry": 1761922799,
|
|
3902
|
-
* "tick": 495,
|
|
3903
|
-
* "group": "0x000000000000000000000000000000000000000000000000000000000008b8f4",
|
|
3904
|
-
* "session": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
3905
|
-
* "callback": "0x0000000000000000000000000000000000000000",
|
|
3906
|
-
* "callback_data": "0x",
|
|
3907
|
-
* "receiver_if_maker_is_seller": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3908
|
-
* }
|
|
3909
|
-
*/
|
|
3910
|
-
offer: components["schemas"]["OfferDataResponse"]; /** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
3911
|
-
offer_hash: string; /** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
3912
|
-
obligation_id: string; /** @example 1 */
|
|
3913
|
-
chain_id: number; /** @example 0 */
|
|
3914
|
-
consumed: string; /** @example 369216000000000000000000 */
|
|
3915
|
-
takeable: string; /** @example 2942933377146801 */
|
|
3916
|
-
block_number: number; /** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
3917
|
-
root: string | null;
|
|
3918
|
-
/**
|
|
3919
|
-
* @example [
|
|
3920
|
-
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
3921
|
-
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
3922
|
-
* ]
|
|
3923
|
-
*/
|
|
3924
|
-
proof: string[] | null; /** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
3925
|
-
signature: string | null;
|
|
3926
|
-
};
|
|
3927
|
-
OfferDataResponse: {
|
|
3928
|
-
/**
|
|
3929
|
-
* @example {
|
|
3930
|
-
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
3931
|
-
* "collaterals": [
|
|
3932
|
-
* {
|
|
3933
|
-
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3934
|
-
* "lltv": "860000000000000000",
|
|
3935
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3936
|
-
* }
|
|
3937
|
-
* ],
|
|
3938
|
-
* "maturity": 1761922799
|
|
3939
|
-
* }
|
|
3940
|
-
*/
|
|
3941
|
-
obligation: components["schemas"]["ObligationOfferResponse"]; /** @example false */
|
|
3942
|
-
buy: boolean; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3943
|
-
maker: string; /** @example 369216000000000000000000 */
|
|
3944
|
-
assets: string; /** @example 0 */
|
|
3945
|
-
obligation_units: string; /** @example 0 */
|
|
3946
|
-
obligation_shares: string; /** @example 1761922790 */
|
|
3947
|
-
start: number; /** @example 1761922799 */
|
|
3948
|
-
expiry: number; /** @example 495 */
|
|
3949
|
-
tick: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
3950
|
-
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
3951
|
-
session: string; /** @example 0x0000000000000000000000000000000000000000 */
|
|
3952
|
-
callback: string; /** @example 0x */
|
|
3953
|
-
callback_data: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3954
|
-
receiver_if_maker_is_seller: string;
|
|
3955
|
-
};
|
|
3956
|
-
ObligationOfferResponse: {
|
|
3957
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */loan_token: string;
|
|
3958
|
-
/**
|
|
3959
|
-
* @example [
|
|
3960
|
-
* {
|
|
3961
|
-
* "token": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
3962
|
-
* "lltv": "860000000000000000",
|
|
3963
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401"
|
|
3964
|
-
* }
|
|
3965
|
-
* ]
|
|
3966
|
-
*/
|
|
3967
|
-
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922799 */
|
|
3968
|
-
maturity: number;
|
|
3969
|
-
};
|
|
3970
|
-
CollateralResponse: {
|
|
3971
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */token: string; /** @example 860000000000000000 */
|
|
3972
|
-
lltv: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
3973
|
-
oracle: string;
|
|
3974
|
-
};
|
|
3975
|
-
ObligationListResponse: {
|
|
3976
|
-
meta: components["schemas"]["Meta"]; /** @example eyJzb3J0IjpbImlkIl0sImlkIjoiMHgxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAiLCJhc2siOiIwIiwiYmlkIjoiMCIsIm1hdHVyaXR5IjoxNzYxOTIyODAwfQ */
|
|
3977
|
-
cursor: string | null; /** @description List of obligations with takable offers. */
|
|
3978
|
-
data: components["schemas"]["ObligationResponse"][];
|
|
3979
|
-
};
|
|
3980
|
-
ObligationResponse: {
|
|
3981
|
-
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */id: string; /** @example 1 */
|
|
3982
|
-
chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
3983
|
-
loan_token: string;
|
|
3984
|
-
collaterals: components["schemas"]["CollateralResponse"][]; /** @example 1761922800 */
|
|
3985
|
-
maturity: number;
|
|
3986
|
-
ask: components["schemas"]["AskResponse"];
|
|
3987
|
-
bid: components["schemas"]["BidResponse"];
|
|
3988
|
-
};
|
|
3989
|
-
AskResponse: {
|
|
3990
|
-
/**
|
|
3991
|
-
* @description Best ask tick. Null when there is no active ask quote.
|
|
3992
|
-
* @example 500
|
|
3993
|
-
*/
|
|
3994
|
-
tick: number | null; /** @example 1000000000000000000 */
|
|
3995
|
-
price: string;
|
|
3996
|
-
};
|
|
3997
|
-
BidResponse: {
|
|
3998
|
-
/**
|
|
3999
|
-
* @description Best bid tick. Null when there is no active bid quote.
|
|
4000
|
-
* @example 500
|
|
4001
|
-
*/
|
|
4002
|
-
tick: number | null; /** @example 1000000000000000000 */
|
|
4003
|
-
price: string;
|
|
4004
|
-
};
|
|
4005
|
-
ObligationSingleSuccessResponse: {
|
|
4006
|
-
meta: components["schemas"]["Meta"]; /** @example null */
|
|
4007
|
-
cursor: string | null; /** @description Obligation details. */
|
|
4008
|
-
data: components["schemas"]["ObligationResponse"];
|
|
4009
|
-
};
|
|
4010
|
-
RouterStatusSuccessResponse: {
|
|
4011
|
-
meta: components["schemas"]["Meta"];
|
|
4012
|
-
/**
|
|
4013
|
-
* @description Aggregated router status.
|
|
4014
|
-
* @example {
|
|
4015
|
-
* "status": "live",
|
|
4016
|
-
* "initialized": true,
|
|
4017
|
-
* "missing_chains": [],
|
|
4018
|
-
* "missing_collectors": []
|
|
4019
|
-
* }
|
|
4020
|
-
*/
|
|
4021
|
-
data: components["schemas"]["RouterStatusDataResponse"];
|
|
4022
|
-
};
|
|
4023
|
-
RouterStatusDataResponse: {
|
|
4024
|
-
/**
|
|
4025
|
-
* @example live
|
|
4026
|
-
* @enum {string}
|
|
4027
|
-
*/
|
|
4028
|
-
status: "live" | "syncing"; /** @example true */
|
|
4029
|
-
initialized: boolean;
|
|
4030
|
-
/**
|
|
4031
|
-
* @description Configured chain ids missing initialization rows.
|
|
4032
|
-
* @example []
|
|
4033
|
-
*/
|
|
4034
|
-
missing_chains: number[];
|
|
4035
|
-
/**
|
|
4036
|
-
* @description Collectors missing initialization rows.
|
|
4037
|
-
* @example []
|
|
4038
|
-
*/
|
|
4039
|
-
missing_collectors: components["schemas"]["MissingCollectorResponse"][];
|
|
4040
|
-
};
|
|
4041
|
-
MissingCollectorResponse: {
|
|
4042
|
-
/** @example 1 */chain_id: number; /** @example offers */
|
|
4043
|
-
name: string;
|
|
4044
|
-
};
|
|
4045
|
-
CollectorsHealthSuccessResponse: {
|
|
4046
|
-
meta: components["schemas"]["Meta"];
|
|
4047
|
-
/**
|
|
4048
|
-
* @description Collectors health details and sync status.
|
|
4049
|
-
* @example [
|
|
4050
|
-
* {
|
|
4051
|
-
* "name": "offers",
|
|
4052
|
-
* "chain_id": 1,
|
|
4053
|
-
* "block_number": 21345678,
|
|
4054
|
-
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
4055
|
-
* "lag": 0,
|
|
4056
|
-
* "status": "live",
|
|
4057
|
-
* "initialized": true
|
|
4058
|
-
* }
|
|
4059
|
-
* ]
|
|
4060
|
-
*/
|
|
4061
|
-
data: components["schemas"]["CollectorHealthResponse"][];
|
|
4062
|
-
};
|
|
4063
|
-
CollectorHealthResponse: {
|
|
4064
|
-
/** @example offers */name: string; /** @example 1 */
|
|
4065
|
-
chain_id: number; /** @example 21345678 */
|
|
4066
|
-
block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
4067
|
-
updated_at: string | null; /** @example 0 */
|
|
4068
|
-
lag: number | null;
|
|
4069
|
-
/**
|
|
4070
|
-
* @example live
|
|
4071
|
-
* @enum {string}
|
|
4072
|
-
*/
|
|
4073
|
-
status: "live" | "lagging" | "unknown"; /** @example true */
|
|
4074
|
-
initialized: boolean;
|
|
4075
|
-
};
|
|
4076
|
-
ChainsHealthSuccessResponse: {
|
|
4077
|
-
meta: components["schemas"]["Meta"];
|
|
4078
|
-
/**
|
|
4079
|
-
* @description Latest processed block per chain.
|
|
4080
|
-
* @example [
|
|
4081
|
-
* {
|
|
4082
|
-
* "chain_id": 1,
|
|
4083
|
-
* "local_block_number": 21345678,
|
|
4084
|
-
* "remote_block_number": 21345690,
|
|
4085
|
-
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
4086
|
-
* "initialized": true
|
|
4087
|
-
* }
|
|
4088
|
-
* ]
|
|
4089
|
-
*/
|
|
4090
|
-
data: components["schemas"]["ChainHealthResponse"][];
|
|
4091
|
-
};
|
|
4092
|
-
ChainHealthResponse: {
|
|
4093
|
-
/** @example 1 */chain_id: number; /** @example 21345678 */
|
|
4094
|
-
local_block_number: number | null; /** @example 21345690 */
|
|
4095
|
-
remote_block_number: number | null; /** @example 2024-01-01T12:00:00.000Z */
|
|
4096
|
-
updated_at: string | null; /** @example true */
|
|
4097
|
-
initialized: boolean;
|
|
4098
|
-
};
|
|
4099
|
-
PositionListResponse: {
|
|
4100
|
-
meta: components["schemas"]["Meta"]; /** @example eyJvZmZzZXQiOjEwMH0 */
|
|
4101
|
-
cursor: string | null;
|
|
4102
|
-
/**
|
|
4103
|
-
* @description User positions with reserved balances from active offers.
|
|
4104
|
-
* @example [
|
|
4105
|
-
* {
|
|
4106
|
-
* "chain_id": 1,
|
|
4107
|
-
* "contract": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
4108
|
-
* "user": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
4109
|
-
* "obligation_id": "0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67",
|
|
4110
|
-
* "reserved": "200000000000000000000",
|
|
4111
|
-
* "block_number": 21345678
|
|
4112
|
-
* }
|
|
4113
|
-
* ]
|
|
4114
|
-
*/
|
|
4115
|
-
data: components["schemas"]["PositionListItemResponse"][];
|
|
4116
|
-
};
|
|
4117
|
-
PositionListItemResponse: {
|
|
4118
|
-
/** @example 1 */chain_id: number; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
4119
|
-
contract: string; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
4120
|
-
user: string;
|
|
4121
|
-
/**
|
|
4122
|
-
* @description Obligation id this reserved amount belongs to, or null if no lots exist.
|
|
4123
|
-
* @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67
|
|
4124
|
-
*/
|
|
4125
|
-
obligation_id: string | null; /** @example 200000000000000000000 */
|
|
4126
|
-
reserved: string; /** @example 21345678 */
|
|
4127
|
-
block_number: number;
|
|
4128
|
-
};
|
|
4129
|
-
ValidateOffersRequest: {
|
|
4130
|
-
/**
|
|
4131
|
-
* @description Chain id used for chain-scoped validation rules.
|
|
4132
|
-
* @example 1
|
|
4133
|
-
*/
|
|
4134
|
-
chain_id: number; /** @description Array of offers in snake_case format. Required, non-empty. */
|
|
4135
|
-
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
4136
|
-
};
|
|
4137
|
-
ValidateOfferRequest: {
|
|
4138
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */maker: string; /** @example 369216000000000000000000 */
|
|
4139
|
-
assets: string; /** @example 0 */
|
|
4140
|
-
obligation_units?: string; /** @example 0 */
|
|
4141
|
-
obligation_shares?: string; /** @example 495 */
|
|
4142
|
-
tick: number; /** @example 1761922799 */
|
|
4143
|
-
maturity: number; /** @example 1761922799 */
|
|
4144
|
-
expiry: number; /** @example 1761922790 */
|
|
4145
|
-
start: number; /** @example 0x000000000000000000000000000000000000000000000000000000000008b8f4 */
|
|
4146
|
-
group: string; /** @example 0x0000000000000000000000000000000000000000000000000000000000000000 */
|
|
4147
|
-
session: string; /** @example false */
|
|
4148
|
-
buy: boolean; /** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
4149
|
-
loan_token: string;
|
|
4150
|
-
/**
|
|
4151
|
-
* @example [
|
|
4152
|
-
* {
|
|
4153
|
-
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
4154
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
4155
|
-
* "lltv": "860000000000000000"
|
|
4156
|
-
* }
|
|
4157
|
-
* ]
|
|
4158
|
-
*/
|
|
4159
|
-
collaterals: components["schemas"]["ValidateCollateralRequest"][];
|
|
4160
|
-
/**
|
|
4161
|
-
* @example {
|
|
4162
|
-
* "address": "0x0000000000000000000000000000000000000000",
|
|
4163
|
-
* "data": "0x"
|
|
4164
|
-
* }
|
|
4165
|
-
*/
|
|
4166
|
-
callback: components["schemas"]["ValidateCallbackRequest"]; /** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
4167
|
-
receiver_if_maker_is_seller: string;
|
|
4168
|
-
};
|
|
4169
|
-
ValidateCollateralRequest: {
|
|
4170
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */asset: string; /** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
4171
|
-
oracle: string; /** @example 860000000000000000 */
|
|
4172
|
-
lltv: string;
|
|
4173
|
-
};
|
|
4174
|
-
ValidateCallbackRequest: {
|
|
4175
|
-
/** @example 0x0000000000000000000000000000000000000000 */address: string; /** @example 0x */
|
|
4176
|
-
data: string;
|
|
4177
|
-
};
|
|
4178
|
-
ValidationSuccessResponse: {
|
|
4179
|
-
meta: components["schemas"]["Meta"]; /** @example null */
|
|
4180
|
-
cursor: string | null; /** @description Payload and root for client-side signing. */
|
|
4181
|
-
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
4182
|
-
};
|
|
4183
|
-
ValidationSuccessDataResponse: {
|
|
4184
|
-
/**
|
|
4185
|
-
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
4186
|
-
* @example 0x01789c...
|
|
4187
|
-
*/
|
|
4188
|
-
payload: string;
|
|
4189
|
-
/**
|
|
4190
|
-
* @description Merkle tree root to sign with EIP-191.
|
|
4191
|
-
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
4192
|
-
*/
|
|
4193
|
-
root: string;
|
|
4194
|
-
};
|
|
4195
|
-
};
|
|
4196
|
-
responses: never;
|
|
4197
|
-
parameters: never;
|
|
4198
|
-
requestBodies: never;
|
|
4199
|
-
headers: never;
|
|
4200
|
-
pathItems: never;
|
|
4201
|
-
}
|
|
4202
|
-
declare namespace ObligationResponse_d_exports {
|
|
4203
|
-
export { ObligationResponse, from$3 as from };
|
|
4204
|
-
}
|
|
4205
|
-
type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
4206
|
-
/**
|
|
4207
|
-
* Creates an `ObligationResponse` from a `Obligation`.
|
|
4208
|
-
* @constructor
|
|
4209
|
-
* @param obligation - {@link Obligation}
|
|
4210
|
-
* @param quote - {@link Quote}
|
|
4211
|
-
* @param chainId - The chain id used to compute `id`.
|
|
4212
|
-
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
4213
|
-
*/
|
|
4214
|
-
declare function from$3(obligation: Obligation$1, quote: Quote, chainId: Id): ObligationResponse;
|
|
4215
|
-
declare namespace OfferResponse_d_exports {
|
|
4216
|
-
export { Input, OfferResponse, from$2 as from };
|
|
4217
|
-
}
|
|
4218
|
-
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
4219
|
-
type Input = Readonly<{
|
|
4220
|
-
hash: Hex;
|
|
4221
|
-
obligationId: Hex;
|
|
4222
|
-
maker: Address;
|
|
4223
|
-
assets: bigint;
|
|
4224
|
-
obligationUnits: bigint;
|
|
4225
|
-
obligationShares: bigint;
|
|
4226
|
-
tick: number;
|
|
4227
|
-
maturity: number;
|
|
4228
|
-
expiry: number;
|
|
4229
|
-
start: number;
|
|
4230
|
-
group: Hex;
|
|
4231
|
-
session: Hex;
|
|
4232
|
-
buy: boolean;
|
|
4233
|
-
chainId: number;
|
|
4234
|
-
loanToken: Address;
|
|
4235
|
-
collaterals: Readonly<{
|
|
4236
|
-
asset: Address;
|
|
4237
|
-
lltv: bigint;
|
|
4238
|
-
oracle: Address;
|
|
4239
|
-
}[]>;
|
|
4240
|
-
callback: {
|
|
4241
|
-
address: Address;
|
|
4242
|
-
data: Hex;
|
|
4243
|
-
};
|
|
4244
|
-
receiverIfMakerIsSeller: Address;
|
|
4245
|
-
root?: Hex | undefined;
|
|
4246
|
-
proof?: Hex[] | undefined;
|
|
4247
|
-
signature?: Hex | undefined;
|
|
4248
|
-
consumed: bigint;
|
|
4249
|
-
takeable: bigint;
|
|
4250
|
-
blockNumber: number;
|
|
4251
|
-
}>;
|
|
4252
|
-
/**
|
|
4253
|
-
* Creates an `OfferResponse` matching the Solidity Offer struct layout.
|
|
4254
|
-
* @constructor
|
|
4255
|
-
* @param input - {@link Input}
|
|
4256
|
-
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
4257
|
-
*/
|
|
4258
|
-
declare function from$2(input: Input): OfferResponse;
|
|
4259
|
-
//#endregion
|
|
4260
|
-
//#region src/api/Schema/openapi.d.ts
|
|
4261
|
-
declare class BooksController {
|
|
4262
|
-
getBook(): Promise<void>;
|
|
4263
|
-
}
|
|
4264
|
-
declare class ValidateController {
|
|
4265
|
-
validateOffers(): Promise<void>;
|
|
4266
|
-
}
|
|
4267
|
-
declare class OffersController {
|
|
4268
|
-
getOffers(): Promise<void>;
|
|
4269
|
-
}
|
|
4270
|
-
declare class HealthController {
|
|
4271
|
-
getRouterStatus(): Promise<void>;
|
|
4272
|
-
getCollectorsHealth(): Promise<void>;
|
|
4273
|
-
getChainsHealth(): Promise<void>;
|
|
4274
|
-
}
|
|
4275
|
-
declare class ConfigContractsController {
|
|
4276
|
-
getConfigContracts(): Promise<void>;
|
|
4277
|
-
}
|
|
4278
|
-
declare class ConfigRulesController {
|
|
4279
|
-
getConfigRules(): Promise<void>;
|
|
4280
|
-
}
|
|
4281
|
-
declare class ObligationsController {
|
|
4282
|
-
getObligations(): Promise<void>;
|
|
4283
|
-
getObligation(): Promise<void>;
|
|
4284
|
-
}
|
|
4285
|
-
declare class UsersController {
|
|
4286
|
-
getUserPositions(): Promise<void>;
|
|
4287
|
-
}
|
|
4288
|
-
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
4289
|
-
//#endregion
|
|
4290
|
-
//#region src/database/domains/Positions.d.ts
|
|
4291
|
-
type PaginationParams = {
|
|
4292
|
-
/** Cursor string returned by a previous call, for pagination */cursor?: string; /** Page size; defaults to {@link DEFAULT_LIMIT} */
|
|
4293
|
-
limit?: number;
|
|
4294
|
-
};
|
|
4295
|
-
declare namespace getByUser {
|
|
4296
|
-
type Parameters = PaginationParams & {
|
|
4297
|
-
/** The user address to get positions for. */user: Address; /** The type of position to get. Default is all types. */
|
|
4298
|
-
type?: Type;
|
|
4299
|
-
};
|
|
4300
|
-
type PositionWithReserved = {
|
|
4301
|
-
chainId: Id;
|
|
4302
|
-
contract: Address;
|
|
4303
|
-
user: Address;
|
|
4304
|
-
blockNumber: number; /** The obligation this reserved amount belongs to, or null if no lots exist */
|
|
4305
|
-
obligationId: string | null; /** The amount reserved by active offers: max(lot.upper) - offset - consumed */
|
|
4306
|
-
reserved: bigint;
|
|
4307
|
-
};
|
|
4308
|
-
type ReturnType = {
|
|
4309
|
-
positions: PositionWithReserved[];
|
|
4310
|
-
nextCursor: string | null;
|
|
4311
|
-
};
|
|
4312
|
-
}
|
|
4313
|
-
declare namespace PositionResponse_d_exports {
|
|
4314
|
-
export { PositionResponse, PositionWithReserved$1 as PositionWithReserved, from$1 as from };
|
|
4315
|
-
}
|
|
4316
|
-
type PositionResponse = {
|
|
4317
|
-
chain_id: Id;
|
|
4318
|
-
contract: Address;
|
|
4319
|
-
user: Address;
|
|
4320
|
-
obligation_id: string | null;
|
|
4321
|
-
reserved: string;
|
|
4322
|
-
block_number: number;
|
|
4323
|
-
};
|
|
4324
|
-
type PositionWithReserved$1 = getByUser.PositionWithReserved;
|
|
4325
|
-
/**
|
|
4326
|
-
* Creates a `PositionResponse` from a `PositionWithReserved`.
|
|
4327
|
-
* @param position - {@link PositionWithReserved}
|
|
4328
|
-
* @returns The created `PositionResponse`. {@link PositionResponse}
|
|
4329
|
-
*/
|
|
4330
|
-
declare function from$1(position: PositionWithReserved$1): PositionResponse;
|
|
4331
|
-
//#endregion
|
|
4332
|
-
//#region src/api/Schema/requests.d.ts
|
|
4333
|
-
declare const schemas: {
|
|
4334
|
-
readonly get_health: z$1.ZodObject<{
|
|
4335
|
-
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
4336
|
-
0: "0";
|
|
4337
|
-
1: "1";
|
|
4338
|
-
true: "true";
|
|
4339
|
-
false: "false";
|
|
4340
|
-
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
4341
|
-
}, z$1.core.$strip>;
|
|
4342
|
-
readonly get_health_collectors: z$1.ZodObject<{
|
|
4343
|
-
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
4344
|
-
0: "0";
|
|
4345
|
-
1: "1";
|
|
4346
|
-
true: "true";
|
|
4347
|
-
false: "false";
|
|
4348
|
-
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
4349
|
-
}, z$1.core.$strip>;
|
|
4350
|
-
readonly get_health_chains: z$1.ZodObject<{
|
|
4351
|
-
strict: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodEnum<{
|
|
4352
|
-
0: "0";
|
|
4353
|
-
1: "1";
|
|
4354
|
-
true: "true";
|
|
4355
|
-
false: "false";
|
|
4356
|
-
}>, z$1.ZodTransform<boolean, "0" | "1" | "true" | "false">>>;
|
|
4357
|
-
}, z$1.core.$strip>;
|
|
4358
|
-
readonly get_config_contracts: z$1.ZodObject<{
|
|
4359
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4360
|
-
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4361
|
-
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
4362
|
-
}, z$1.core.$strip>;
|
|
4363
|
-
readonly get_config_rules: z$1.ZodObject<{
|
|
4364
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4365
|
-
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4366
|
-
types: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodEnum<{
|
|
4367
|
-
maturity: "maturity";
|
|
4368
|
-
callback: "callback";
|
|
4369
|
-
loan_token: "loan_token";
|
|
4370
|
-
collateral_token: "collateral_token";
|
|
4371
|
-
oracle: "oracle";
|
|
4372
|
-
}>>>>;
|
|
4373
|
-
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
4374
|
-
}, z$1.core.$strip>;
|
|
4375
|
-
readonly get_offers: z$1.ZodPipe<z$1.ZodObject<{
|
|
4376
|
-
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4377
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4378
|
-
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
4379
|
-
buy: "buy";
|
|
4380
|
-
sell: "sell";
|
|
4381
|
-
}>>;
|
|
4382
|
-
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
4383
|
-
maker: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
4384
|
-
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
4385
|
-
limit: number;
|
|
4386
|
-
cursor?: string | undefined;
|
|
4387
|
-
side?: "buy" | "sell" | undefined;
|
|
4388
|
-
obligation_id?: `0x${string}` | undefined;
|
|
4389
|
-
maker?: `0x${string}` | undefined;
|
|
4390
|
-
}, {
|
|
4391
|
-
limit: number;
|
|
4392
|
-
cursor?: string | undefined;
|
|
4393
|
-
side?: "buy" | "sell" | undefined;
|
|
4394
|
-
obligation_id?: `0x${string}` | undefined;
|
|
4395
|
-
maker?: `0x${string}` | undefined;
|
|
4396
|
-
}>>;
|
|
4397
|
-
readonly get_obligations: z$1.ZodObject<{
|
|
4398
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4399
|
-
chains: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
4400
|
-
loan_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
|
|
4401
|
-
collateral_tokens: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>>>;
|
|
4402
|
-
maturities: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>>>>;
|
|
4403
|
-
sort: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodTransform<{} | null | undefined, unknown>, z$1.ZodArray<z$1.ZodString>>>;
|
|
4404
|
-
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4405
|
-
}, z$1.core.$strip>;
|
|
4406
|
-
readonly get_obligation: z$1.ZodObject<{
|
|
4407
|
-
obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
4408
|
-
}, z$1.core.$strip>;
|
|
4409
|
-
readonly get_book: z$1.ZodObject<{
|
|
4410
|
-
obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
4411
|
-
side: z$1.ZodEnum<{
|
|
4412
|
-
buy: "buy";
|
|
4413
|
-
sell: "sell";
|
|
4414
|
-
}>;
|
|
4415
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4416
|
-
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4417
|
-
}, z$1.core.$strip>;
|
|
4418
|
-
readonly validate_offers: z$1.ZodObject<{
|
|
4419
|
-
chain_id: z$1.ZodNumber;
|
|
4420
|
-
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
4421
|
-
}, z$1.core.$strict>;
|
|
4422
|
-
readonly get_user_positions: z$1.ZodObject<{
|
|
4423
|
-
user_address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
4424
|
-
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
4425
|
-
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
4426
|
-
}, z$1.core.$strip>;
|
|
4427
|
-
};
|
|
4428
|
-
type Action = keyof typeof schemas;
|
|
4429
|
-
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
4430
|
-
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z$1.core.$ZodErrorMap<z$1.core.$ZodIssue>): z$1.ZodSafeParseResult<z$1.infer<(typeof schemas)[A]>>;
|
|
4431
|
-
declare namespace index_d_exports$1 {
|
|
4432
|
-
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, ConfigContractsController, ConfigRulesController, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, PositionResponse_d_exports as PositionResponse, RouterStatusResponse, UsersController, ValidateController, parse, safeParse };
|
|
4433
|
-
}
|
|
4434
|
-
declare namespace Client_d_exports$1 {
|
|
4435
|
-
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
4436
|
-
}
|
|
4437
|
-
type RouterClientConfig = {
|
|
4438
|
-
/** The URL of the router. */readonly url: URL; /** The default headers to use for each request. */
|
|
4439
|
-
readonly headers: Headers;
|
|
4440
|
-
};
|
|
4441
|
-
type Client$2 = Compute<RouterClientConfig & {
|
|
4442
|
-
/**
|
|
4443
|
-
* Get offers from the router.
|
|
4444
|
-
* @param parameters - {@link getOffers.Parameters}
|
|
4445
|
-
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
4446
|
-
* @throws If the request fails - {@link getOffers.ErrorType}
|
|
4447
|
-
*
|
|
4448
|
-
* @example
|
|
4449
|
-
* ```ts
|
|
4450
|
-
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
4451
|
-
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
4452
|
-
* console.log(offers);
|
|
4453
|
-
* ```
|
|
4454
|
-
*/
|
|
4455
|
-
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
4456
|
-
/**
|
|
4457
|
-
* Get obligations from the router.
|
|
4458
|
-
* @param parameters - {@link getObligations.Parameters}
|
|
4459
|
-
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
4460
|
-
* @throws If the request fails - {@link getObligations.ErrorType}
|
|
4461
|
-
*
|
|
4462
|
-
* @example
|
|
4463
|
-
* ```ts
|
|
4464
|
-
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
4465
|
-
* const { obligations, cursor } = await router.getObligations();
|
|
4466
|
-
* console.log(obligations[0].id()); // 0x123...456
|
|
4467
|
-
* ```
|
|
4468
|
-
*/
|
|
4469
|
-
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
4470
|
-
}>;
|
|
4471
|
-
type ConnectOptions = {
|
|
4472
|
-
/** The URL of the router to interact with.
|
|
4473
|
-
* @default "https://router.morpho.dev"
|
|
4474
|
-
*/
|
|
4475
|
-
url?: string; /** The API key to use for the router API. */
|
|
4476
|
-
apiKey?: string; /** The default headers to use for each request. */
|
|
4477
|
-
headers?: Headers;
|
|
4478
|
-
};
|
|
4479
|
-
/**
|
|
4480
|
-
* Creates an instance of a router client.
|
|
4481
|
-
* @constructor
|
|
4482
|
-
* @param parameters - {@link connect.Parameters}
|
|
4483
|
-
* @returns A Router Client. {@link connect.ReturnType}
|
|
4484
|
-
*
|
|
4485
|
-
* @example
|
|
4486
|
-
* ```typescript
|
|
4487
|
-
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
4488
|
-
* ```
|
|
4489
|
-
*/
|
|
4490
|
-
declare function connect$1(parameters?: connect$1.Parameters): connect$1.ReturnType;
|
|
4491
|
-
declare namespace connect$1 {
|
|
4492
|
-
type Parameters = ConnectOptions;
|
|
4493
|
-
type ReturnType = Client$2;
|
|
4494
|
-
type ErrorType = InvalidUrlError;
|
|
4495
|
-
}
|
|
4496
|
-
declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
4497
|
-
declare namespace getOffers {
|
|
4498
|
-
type Parameters = {
|
|
4499
|
-
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */side: "buy" | "sell"; /** The offers obligation id */
|
|
4500
|
-
obligationId: Hex; /** Pagination cursor in base64url-encoded format */
|
|
4501
|
-
cursor?: string; /** Maximum number of offers to return. @default 20 */
|
|
4502
|
-
limit?: number;
|
|
4503
|
-
};
|
|
4504
|
-
type ReturnType = {
|
|
4505
|
-
offers: Compute<Offer & {
|
|
4506
|
-
hash: Hex;
|
|
4507
|
-
blockNumber: number;
|
|
4508
|
-
consumed: bigint;
|
|
4509
|
-
takeable: bigint;
|
|
4510
|
-
} & {
|
|
4511
|
-
/** 32-byte merkle root. */root?: Hex; /** Sibling hashes for the merkle proof. */
|
|
4512
|
-
proof?: Hex[]; /** Offer signature from the Merkle tree. */
|
|
4513
|
-
signature?: Hex;
|
|
4514
|
-
}>[]; /** The pagination cursor. */
|
|
4515
|
-
cursor: string | null;
|
|
4516
|
-
};
|
|
4517
|
-
type ErrorType = GetApiErrorType;
|
|
4518
|
-
}
|
|
4519
|
-
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
4520
|
-
declare namespace getObligations {
|
|
4521
|
-
type SortField = "id" | "ask" | "bid" | "maturity";
|
|
4522
|
-
type SortEntry = SortField | `-${SortField}`;
|
|
4523
|
-
type Parameters = {
|
|
4524
|
-
/** Pagination cursor in base64url-encoded format. */cursor?: string; /** Maximum number of obligations to return. @default 20 */
|
|
4525
|
-
limit?: number; /** Filter by chain IDs (comma-separated). */
|
|
4526
|
-
chainIds?: number[]; /** Filter by loan token addresses (comma-separated). */
|
|
4527
|
-
loanTokens?: Address[]; /** Filter by collateral tokens (comma-separated, matches any collateral). */
|
|
4528
|
-
collateralTokens?: Address[]; /** Filter by exact maturity timestamps (comma-separated, unix seconds). */
|
|
4529
|
-
maturities?: number[]; /** Sort order entries in priority order. Prefix with '-' for descending. Max 3 fields. */
|
|
4530
|
-
sort?: SortEntry[];
|
|
4531
|
-
};
|
|
4532
|
-
type ReturnType = {
|
|
4533
|
-
obligations: Compute<{
|
|
4534
|
-
/** The obligation id returned by the API. */id: Hex; /** The chain id used to compute the obligation id. */
|
|
4535
|
-
chainId: Id;
|
|
4536
|
-
} & Obligation$1 & Omit<Quote, "obligationId">>[]; /** The pagination cursor. */
|
|
4537
|
-
cursor: string | null;
|
|
4538
|
-
};
|
|
4539
|
-
type ErrorType = GetApiErrorType;
|
|
4540
|
-
}
|
|
4541
|
-
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
4542
|
-
declare class InvalidUrlError extends BaseError {
|
|
4543
|
-
name: string;
|
|
4544
|
-
constructor(url: string);
|
|
4545
|
-
}
|
|
4546
|
-
declare class HttpUnauthorizedError extends BaseError {
|
|
4547
|
-
name: string;
|
|
4548
|
-
constructor();
|
|
4549
|
-
}
|
|
4550
|
-
declare class HttpForbiddenError extends BaseError {
|
|
4551
|
-
name: string;
|
|
4552
|
-
constructor();
|
|
4553
|
-
}
|
|
4554
|
-
declare class HttpRateLimitError extends BaseError {
|
|
4555
|
-
name: string;
|
|
4556
|
-
constructor();
|
|
4557
|
-
}
|
|
4558
|
-
declare class HttpGetApiFailedError extends BaseError {
|
|
4559
|
-
name: string;
|
|
4560
|
-
constructor(message: string, {
|
|
4561
|
-
details
|
|
4562
|
-
}?: {
|
|
4563
|
-
details?: string;
|
|
4564
|
-
});
|
|
4565
|
-
}
|
|
4566
|
-
declare namespace Gate_d_exports {
|
|
4567
|
-
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
4568
|
-
}
|
|
4569
|
-
/**
|
|
4570
|
-
* A validation rule.
|
|
4571
|
-
*/
|
|
4572
|
-
type Rule<T, Name extends string = string> = {
|
|
4573
|
-
kind: "single";
|
|
4574
|
-
name: Name;
|
|
4575
|
-
description: string;
|
|
4576
|
-
run: Single<T, Name>;
|
|
4577
|
-
} | {
|
|
4578
|
-
kind: "batch";
|
|
4579
|
-
name: Name;
|
|
4580
|
-
description: string;
|
|
4581
|
-
run: Batch<T, Name>;
|
|
4582
|
-
};
|
|
4583
|
-
type RuleNames<Rules extends readonly {
|
|
4584
|
-
name: string;
|
|
4585
|
-
}[]> = Rules[number]["name"];
|
|
4586
|
-
/**
|
|
4587
|
-
* A single item validation rule.
|
|
4588
|
-
* @param item - The item to validate.
|
|
4589
|
-
* @returns The issue that was found. If the item is valid, this will be undefined.
|
|
4590
|
-
*/
|
|
4591
|
-
type Single<T, RuleName extends string> = (item: T) => Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined | Promise<Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>;
|
|
4592
|
-
/**
|
|
4593
|
-
* A batch item validation rule.
|
|
4594
|
-
* @param items - The items to validate.
|
|
4595
|
-
* @returns A map of the items to the issue that was found.
|
|
4596
|
-
*/
|
|
4597
|
-
type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined> | Promise<Map<number, Omit<Issue<T, RuleName>, "ruleName" | "item"> | undefined>>;
|
|
4598
|
-
/**
|
|
4599
|
-
* Create a validation rule iterating over a single item at a time.
|
|
4600
|
-
* @param name - The name of the rule.
|
|
4601
|
-
* @param description - A human-readable description of the rule.
|
|
4602
|
-
* @param run - The function that validates the rule.
|
|
4603
|
-
* @returns The created rule.
|
|
4604
|
-
*/
|
|
4605
|
-
declare function single<Name extends string, T>(name: Name, description: string, run: Single<T, Name>): Rule<T, Name>;
|
|
4606
|
-
/**
|
|
4607
|
-
* Create a validation rule iterating over a batch of items at a time.
|
|
4608
|
-
* @param name - The name of the rule.
|
|
4609
|
-
* @param description - A human-readable description of the rule.
|
|
4610
|
-
* @param run - The function that validates the rule.
|
|
4611
|
-
* @returns The created rule.
|
|
4612
|
-
*/
|
|
4613
|
-
declare function batch$1<Name extends string, T>(name: Name, description: string, run: Batch<T, Name>): Rule<T, Name>;
|
|
4614
|
-
/**
|
|
4615
|
-
* A validation issue.
|
|
4616
|
-
*/
|
|
4617
|
-
type Issue<T, RuleName extends string = string> = {
|
|
4618
|
-
/** The name of the rule that caused the issue. */ruleName: RuleName; /** The message of the issue. */
|
|
4619
|
-
message: string; /** The item that was not valid. */
|
|
4620
|
-
item: T;
|
|
4621
|
-
};
|
|
4622
|
-
/**
|
|
4623
|
-
* The result of a validation.
|
|
4624
|
-
*/
|
|
4625
|
-
type Result<T, RuleName extends string = string> = {
|
|
4626
|
-
/** The items that were valid. */valid: T[]; /** The reports of the failed validations. */
|
|
4627
|
-
issues: Issue<T, RuleName>[];
|
|
4628
|
-
};
|
|
4629
|
-
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
|
|
4630
|
-
items: T[];
|
|
4631
|
-
rules: Rules;
|
|
4632
|
-
chunkSize?: number;
|
|
4633
|
-
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
4634
|
-
//#endregion
|
|
4635
|
-
//#region src/gatekeeper/types.d.ts
|
|
4636
|
-
type ConfigRule = {
|
|
4637
|
-
type: "maturity";
|
|
4638
|
-
chain_id: Id;
|
|
4639
|
-
name: MaturityType;
|
|
4640
|
-
timestamp: Maturity;
|
|
4641
|
-
} | {
|
|
4642
|
-
type: "callback";
|
|
4643
|
-
chain_id: Id;
|
|
4644
|
-
address: Address;
|
|
4645
|
-
callback_type: Exclude<Type$1, Type$1.BuyWithEmptyCallback>;
|
|
4646
|
-
} | {
|
|
4647
|
-
type: "loan_token";
|
|
4648
|
-
chain_id: Id;
|
|
4649
|
-
address: Address;
|
|
4650
|
-
} | {
|
|
4651
|
-
type: "collateral_token";
|
|
4652
|
-
chain_id: Id;
|
|
4653
|
-
address: Address;
|
|
4654
|
-
} | {
|
|
4655
|
-
type: "oracle";
|
|
4656
|
-
chain_id: Id;
|
|
4657
|
-
address: Address;
|
|
4658
|
-
};
|
|
4659
|
-
type ValidationIssue = {
|
|
4660
|
-
index: number;
|
|
4661
|
-
rule: string;
|
|
4662
|
-
message: string;
|
|
4663
|
-
};
|
|
4664
|
-
type ValidateOffersSuccess = {
|
|
4665
|
-
payload: Hex;
|
|
4666
|
-
root: Hex;
|
|
4667
|
-
};
|
|
4668
|
-
type ValidateOffersIssues = {
|
|
4669
|
-
issues: ValidationIssue[];
|
|
4670
|
-
};
|
|
4671
|
-
type ValidateOffersData = ValidateOffersSuccess | ValidateOffersIssues;
|
|
4672
|
-
type ConfigRulesPayload = SuccessPayload<ConfigRule[]> | ErrorPayload;
|
|
4673
|
-
type SuccessPayload<T> = {
|
|
4674
|
-
meta: {
|
|
4675
|
-
timestamp: string;
|
|
4676
|
-
checksum?: string;
|
|
4677
|
-
};
|
|
4678
|
-
cursor: string | null;
|
|
4679
|
-
data: T;
|
|
4680
|
-
};
|
|
4681
|
-
type ErrorPayload = {
|
|
4682
|
-
meta: {
|
|
4683
|
-
timestamp: string;
|
|
4684
|
-
checksum?: string;
|
|
4685
|
-
};
|
|
4686
|
-
error: {
|
|
4687
|
-
code: string;
|
|
4688
|
-
message: string;
|
|
4689
|
-
details?: unknown;
|
|
4690
|
-
};
|
|
4691
|
-
};
|
|
4692
|
-
declare namespace Client_d_exports {
|
|
4693
|
-
export { ClientConfig, GatekeeperClient, createHttpClient };
|
|
4694
|
-
}
|
|
4695
|
-
type GatekeeperClient = {
|
|
4696
|
-
/** Validate offers and return the raw response payload. */validate: (body: unknown) => Promise<{
|
|
4697
|
-
statusCode: number;
|
|
4698
|
-
body: unknown;
|
|
4699
|
-
}>; /** Get configured rules for supported chains. */
|
|
4700
|
-
getConfigRules: (query?: {
|
|
4701
|
-
cursor?: string;
|
|
4702
|
-
limit?: number | string;
|
|
4703
|
-
types?: Array<ConfigRule["type"]> | ConfigRule["type"];
|
|
4704
|
-
}) => Promise<{
|
|
4705
|
-
statusCode: number;
|
|
4706
|
-
body: ConfigRulesPayload;
|
|
4707
|
-
}>; /** Validate offers and return decision results. */
|
|
4708
|
-
isAllowed: (parameters: {
|
|
4709
|
-
offers: Offer[];
|
|
4710
|
-
chainId: number;
|
|
4711
|
-
}) => Promise<Result<Offer, string>>; /** Base URL for the gatekeeper service. */
|
|
4712
|
-
baseUrl: string;
|
|
4713
|
-
};
|
|
4714
|
-
type ClientConfig = {
|
|
4715
|
-
baseUrl: string;
|
|
4716
|
-
timeoutMs?: number;
|
|
4717
|
-
fetchFn?: typeof fetch;
|
|
4718
|
-
originSecret?: string;
|
|
4719
|
-
};
|
|
4720
|
-
/**
|
|
4721
|
-
* Create an HTTP client for a gatekeeper service.
|
|
4722
|
-
* @param config - Gatekeeper client configuration. {@link ClientConfig}
|
|
4723
|
-
* @returns An HTTP-backed gatekeeper client. {@link GatekeeperClient}
|
|
4724
|
-
*/
|
|
4725
|
-
declare function createHttpClient(config: ClientConfig): GatekeeperClient;
|
|
4726
|
-
declare namespace Gatekeeper_d_exports {
|
|
4727
|
-
export { Gatekeeper, Rules, RulesFactory, create };
|
|
4728
|
-
}
|
|
4729
|
-
type Rules = readonly Rule<Offer, string>[];
|
|
4730
|
-
type RulesFactory = (chainId: Id) => Rules;
|
|
4731
|
-
type Gatekeeper = {
|
|
4732
|
-
isAllowed: (parameters: {
|
|
4733
|
-
offers: Offer[];
|
|
4734
|
-
chainId: Id;
|
|
4735
|
-
}) => Promise<Result<Offer, string>>;
|
|
4736
|
-
};
|
|
4737
|
-
type GatekeeperParameters = {
|
|
4738
|
-
rules: RulesFactory;
|
|
4739
|
-
};
|
|
4740
|
-
/**
|
|
4741
|
-
* Create a gatekeeper instance with the provided rules.
|
|
4742
|
-
* @param parameters - Gatekeeper parameters. {@link GatekeeperParameters}
|
|
4743
|
-
* @returns Gatekeeper instance. {@link Gatekeeper}
|
|
4744
|
-
*/
|
|
4745
|
-
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
4746
|
-
//#endregion
|
|
4747
|
-
//#region src/gatekeeper/morphoRules.d.ts
|
|
4748
|
-
declare const morphoRules: (parameters: {
|
|
4749
|
-
chains: Chain$1[];
|
|
4750
|
-
chainId: Id;
|
|
4751
|
-
}) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "amount_mutual_exclusivity"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "loan_token"> | Rule<Offer, "collateral_token"> | Rule<Offer, "oracle">)[];
|
|
4752
|
-
declare namespace Rules_d_exports {
|
|
4753
|
-
export { amountMutualExclusivity, callback, collateralToken, loanToken, maturity, oracle, sameMaker };
|
|
4754
|
-
}
|
|
4755
|
-
declare const maturity: ({
|
|
4756
|
-
maturities
|
|
4757
|
-
}: {
|
|
4758
|
-
maturities: MaturityType[];
|
|
4759
|
-
}) => Rule<Offer, "maturity">;
|
|
4760
|
-
declare const callback: ({
|
|
4761
|
-
callbacks
|
|
4762
|
-
}: {
|
|
4763
|
-
callbacks: Type$1[];
|
|
4764
|
-
allowedAddresses: Address[];
|
|
4765
|
-
}) => Rule<Offer, "callback">;
|
|
4766
|
-
/**
|
|
4767
|
-
* A validation rule that checks if the offer's loan token is allowed for its chain.
|
|
4768
|
-
* @param assetsByChainId - Allowed loan tokens indexed by chain id.
|
|
4769
|
-
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4770
|
-
*/
|
|
4771
|
-
declare const loanToken: ({
|
|
4772
|
-
assetsByChainId,
|
|
4773
|
-
chainId
|
|
4774
|
-
}: {
|
|
4775
|
-
assetsByChainId: Partial<Record<Id, Address[]>>;
|
|
4776
|
-
chainId: Id;
|
|
4777
|
-
}) => Rule<Offer, "loan_token">;
|
|
4778
|
-
/**
|
|
4779
|
-
* A validation rule that checks if the offer's collateral tokens are allowed for its chain.
|
|
4780
|
-
* @param collateralAssetsByChainId - Allowed collateral tokens indexed by chain id.
|
|
4781
|
-
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4782
|
-
*/
|
|
4783
|
-
declare const collateralToken: ({
|
|
4784
|
-
collateralAssetsByChainId,
|
|
4785
|
-
chainId
|
|
4786
|
-
}: {
|
|
4787
|
-
collateralAssetsByChainId: Partial<Record<Id, Address[]>>;
|
|
4788
|
-
chainId: Id;
|
|
4789
|
-
}) => Rule<Offer, "collateral_token">;
|
|
4790
|
-
/**
|
|
4791
|
-
* A validation rule that checks if the offer's oracle addresses are allowed for its chain.
|
|
4792
|
-
* @param oraclesByChainId - Allowed oracles indexed by chain id.
|
|
4793
|
-
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
4794
|
-
*/
|
|
4795
|
-
declare const oracle: ({
|
|
4796
|
-
oraclesByChainId,
|
|
4797
|
-
chainId
|
|
4798
|
-
}: {
|
|
4799
|
-
oraclesByChainId: Partial<Record<Id, Address[]>>;
|
|
4800
|
-
chainId: Id;
|
|
4801
|
-
}) => Rule<Offer, "oracle">;
|
|
4802
|
-
/**
|
|
4803
|
-
* A batch validation rule that ensures all offers in a tree have the same maker address.
|
|
4804
|
-
* Returns an issue only for the first non-conforming offer.
|
|
4805
|
-
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
4806
|
-
*/
|
|
4807
|
-
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
4808
|
-
/**
|
|
4809
|
-
* A validation rule that ensures mutual exclusivity of offer amount fields.
|
|
4810
|
-
* At most one of (assets, obligationUnits, obligationShares) can be non-zero.
|
|
4811
|
-
* Matches contract requirement: `atMostOneNonZero(offer.assets, offer.obligationUnits, offer.obligationShares)`.
|
|
4812
|
-
*/
|
|
4813
|
-
declare const amountMutualExclusivity: () => Rule<Offer, "amount_mutual_exclusivity">;
|
|
4814
|
-
//#endregion
|
|
4815
|
-
//#region src/mempool/MempoolEVMClient.d.ts
|
|
4816
|
-
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
4817
|
-
declare namespace from {
|
|
4818
|
-
type Parameters = {
|
|
4819
|
-
/** The viem client to use. */client: WalletClient; /** The mempool address. */
|
|
4820
|
-
mempoolAddress: Address; /** The MorphoV2 contract address used for signature verification. */
|
|
4821
|
-
morphoAddress?: Address; /** The block window to use for the mempool. Defaults to 100. */
|
|
4822
|
-
blockWindow?: number;
|
|
4823
|
-
};
|
|
4824
|
-
type ReturnType = Client$1;
|
|
4825
|
-
type ErrorType = null;
|
|
4826
|
-
}
|
|
4827
|
-
declare namespace MempoolClient_d_exports {
|
|
4828
|
-
export { AddParameters, Client$1 as Client, GetParameters, connect };
|
|
4829
|
-
}
|
|
4830
|
-
type AddParameters = Compute<Omit<Offer, "createdAt">[]>;
|
|
4831
|
-
type GetParameters = {
|
|
4832
|
-
/** The block number to get offers from. */blockNumberGte?: number; /** The block number to get offers to. */
|
|
4833
|
-
blockNumberLte?: number; /** The loan asset to get offers from. */
|
|
4834
|
-
loanToken?: string; /** The order to get offers. Defaults to "desc". */
|
|
4835
|
-
order?: "asc" | "desc"; /** The options to get offers from. */
|
|
4836
|
-
options?: {
|
|
4837
|
-
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */maxBatchSize?: number;
|
|
4838
|
-
};
|
|
4839
|
-
};
|
|
4840
|
-
/**
|
|
4841
|
-
* Mempool client interface.
|
|
4842
|
-
*/
|
|
4843
|
-
type Client$1 = {
|
|
4844
|
-
/**
|
|
4845
|
-
* Add an offer to the mempool.
|
|
4846
|
-
* @returns The created offer with its hash.
|
|
4847
|
-
*/
|
|
4848
|
-
add: (parameters: AddParameters) => Promise<Hex>; /** Get offers from the mempool. */
|
|
4849
|
-
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
4850
|
-
offers: Offer[]; /** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
4851
|
-
blockNumber: number;
|
|
4852
|
-
}>;
|
|
4853
|
-
/**
|
|
4854
|
-
* Stream offers from the mempool.
|
|
4855
|
-
* @returns A generator of offers alongside the last block number processed.
|
|
4856
|
-
*/
|
|
4857
|
-
stream: (parameters: Compute<Omit<GetParameters, "options"> & {
|
|
4858
|
-
options: GetParameters["options"] & {
|
|
4859
|
-
blockWindow?: number;
|
|
4860
|
-
};
|
|
4861
|
-
}>) => AsyncGenerator<{
|
|
4862
|
-
offers: Offer[];
|
|
4863
|
-
blockNumber: number;
|
|
4864
|
-
}>;
|
|
4865
|
-
};
|
|
4866
|
-
/**
|
|
4867
|
-
* Client to interact with the Mempool contract on a specific chain.
|
|
4868
|
-
*/
|
|
4869
|
-
declare function connect(parameters: from.Parameters): Client$1;
|
|
4870
|
-
declare namespace connect {
|
|
4871
|
-
type ErrorType = from.ErrorType;
|
|
4872
|
-
}
|
|
4873
|
-
//#endregion
|
|
4874
|
-
//#region src/utils/BigMath.d.ts
|
|
4875
|
-
declare function max$1(a: bigint, b: bigint): bigint;
|
|
4876
|
-
declare function min(a: bigint, b: bigint): bigint;
|
|
4877
|
-
/**
|
|
4878
|
-
* Checks if at most one of the given values is non-zero.
|
|
4879
|
-
* @param values - The bigint values to check.
|
|
4880
|
-
* @returns True if zero or one value is non-zero, false if two or more are non-zero.
|
|
4881
|
-
*/
|
|
4882
|
-
declare function atMostOneNonZero(...values: bigint[]): boolean;
|
|
4883
|
-
//#endregion
|
|
4884
|
-
//#region src/utils/batch.d.ts
|
|
4885
|
-
/**
|
|
4886
|
-
* Splits an array into batches of a specified size.
|
|
4887
|
-
* @param array The array to split.
|
|
4888
|
-
* @param batchSize The size of each batch.
|
|
4889
|
-
* @returns An iterator that yields each batch.
|
|
4890
|
-
* @example
|
|
4891
|
-
* ```typescript
|
|
4892
|
-
* const array = [1, 2, 3, 4, 5];
|
|
4893
|
-
* for (const batch of batch(array, 2)) {
|
|
4894
|
-
* console.log(batch);
|
|
4895
|
-
* }
|
|
4896
|
-
* // Output:
|
|
4897
|
-
* // [1, 2]
|
|
4898
|
-
* // [3, 4]
|
|
4899
|
-
* // [5]
|
|
4900
|
-
* ```
|
|
4901
|
-
*/
|
|
4902
|
-
declare function batch<T>(array: T[] | readonly T[], batchSize: number): Generator<T[], void, unknown>;
|
|
4903
|
-
//#endregion
|
|
4904
|
-
//#region src/utils/batchMulticall.d.ts
|
|
4905
|
-
/**
|
|
4906
|
-
* Helper function to execute multicall in batches with retry logic.
|
|
4907
|
-
* Abstracts the common pattern of batching calls, retrying, and collecting results.
|
|
4908
|
-
*
|
|
4909
|
-
* @param parameters - Configuration for batched multicall
|
|
4910
|
-
* @returns Promise resolving to flattened array of results
|
|
4911
|
-
*/
|
|
4912
|
-
declare function batchMulticall<TResult>(parameters: {
|
|
4913
|
-
client: PublicClient<Transport, Chain$1>;
|
|
4914
|
-
calls: MulticallParameters["contracts"];
|
|
4915
|
-
batchSize: number;
|
|
4916
|
-
retryAttempts: number;
|
|
4917
|
-
retryDelayMs: number;
|
|
4918
|
-
blockNumber?: bigint;
|
|
4919
|
-
}): Promise<TResult[]>;
|
|
4920
|
-
declare namespace Group_d_exports {
|
|
4921
|
-
export { fromNumber };
|
|
4922
|
-
}
|
|
4923
|
-
/**
|
|
4924
|
-
* Creates a bytes32 group identifier from a number.
|
|
4925
|
-
* @param n - A non-negative integer.
|
|
4926
|
-
* @throws {Error} If n is negative or not an integer.
|
|
4927
|
-
*/
|
|
4928
|
-
declare const fromNumber: (n: number) => Hex;
|
|
4929
|
-
//#endregion
|
|
4930
|
-
//#region src/utils/lazy.d.ts
|
|
4931
|
-
/**
|
|
4932
|
-
* Transform a polling function into an async generator.
|
|
4933
|
-
* @param fn - The polling function to transform.
|
|
4934
|
-
* @returns An async generator.
|
|
4935
|
-
*/
|
|
4936
|
-
declare function lazy<T>(pollFn: (emit: (value: T) => void, {
|
|
4937
|
-
stop
|
|
4938
|
-
}: {
|
|
4939
|
-
stop: () => void;
|
|
4940
|
-
}) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
|
|
4941
|
-
//#endregion
|
|
4942
|
-
//#region src/utils/poll.d.ts
|
|
4943
|
-
/**
|
|
4944
|
-
* Polls a function at a specified interval.
|
|
4945
|
-
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
4946
|
-
*/
|
|
4947
|
-
declare function poll<data>(fn: ({
|
|
4948
|
-
unpoll
|
|
4949
|
-
}: {
|
|
4950
|
-
unpoll: () => void;
|
|
4951
|
-
}) => Promise<data | undefined>, {
|
|
4952
|
-
interval
|
|
4953
|
-
}: {
|
|
4954
|
-
interval: () => Promise<number>;
|
|
4955
|
-
}): () => boolean;
|
|
4956
|
-
declare namespace Random_d_exports {
|
|
4957
|
-
export { address, bool, bytes, float, hex, int, seed, withSeed };
|
|
4958
|
-
}
|
|
4959
|
-
/**
|
|
4960
|
-
* Runs a function with a deterministic RNG derived from the given seed.
|
|
4961
|
-
*/
|
|
4962
|
-
declare function withSeed<T>(seed: string, fn: () => T): T;
|
|
4963
|
-
/**
|
|
4964
|
-
* Seeds the global RNG for deterministic test runs.
|
|
4965
|
-
*/
|
|
4966
|
-
declare function seed(seed: string): void;
|
|
4967
|
-
/**
|
|
4968
|
-
* Returns a deterministic random float in [0, 1).
|
|
4969
|
-
*/
|
|
4970
|
-
declare function float(): number;
|
|
4971
|
-
/**
|
|
4972
|
-
* Returns a deterministic random integer in [min, maxExclusive).
|
|
4973
|
-
*/
|
|
4974
|
-
declare function int(maxExclusive: number, min?: number): number;
|
|
4975
|
-
/**
|
|
4976
|
-
* Returns a deterministic random boolean.
|
|
4977
|
-
*/
|
|
4978
|
-
declare function bool(probability?: number): boolean;
|
|
4979
|
-
/**
|
|
4980
|
-
* Returns deterministic random bytes.
|
|
4981
|
-
*/
|
|
4982
|
-
declare function bytes(length: number): Uint8Array;
|
|
4983
|
-
/**
|
|
4984
|
-
* Returns a deterministic random hex string for the given byte length.
|
|
4985
|
-
*/
|
|
4986
|
-
declare function hex(byteLength: number): Hex;
|
|
4987
|
-
/**
|
|
4988
|
-
* Returns a deterministic random address.
|
|
4989
|
-
*/
|
|
4990
|
-
declare function address(): Address;
|
|
4991
|
-
//#endregion
|
|
4992
|
-
//#region src/utils/retry.d.ts
|
|
4993
|
-
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
4994
|
-
declare namespace time_d_exports {
|
|
4995
|
-
export { max, now };
|
|
4996
|
-
}
|
|
4997
|
-
declare function now(): number;
|
|
4998
|
-
declare function max(): number;
|
|
4999
|
-
//#endregion
|
|
5000
|
-
//#region src/utils/wait.d.ts
|
|
5001
|
-
declare function wait(time: number): Promise<unknown>;
|
|
5002
|
-
declare namespace index_d_exports$2 {
|
|
5003
|
-
export { BaseError, GlobalErrorType, Group_d_exports as Group, Random_d_exports as Random, ReorgError, Snake, time_d_exports as Time, atMostOneNonZero, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
5004
|
-
}
|
|
5005
|
-
//#endregion
|
|
5006
|
-
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, ChainRegistry_d_exports as ChainRegistry, Collateral_d_exports as Collateral, Compute, ConfigRule, ConfigRulesPayload, ERC4626_d_exports as ERC4626, ErrorPayload, Errors_d_exports as Errors, Format_d_exports as Format, Gatekeeper_d_exports as Gatekeeper, Client_d_exports as GatekeeperClient, Id_d_exports as Id, LLTV_d_exports as LLTV, Liquidity_d_exports as Liquidity, Maturity_d_exports as Maturity, MempoolClient_d_exports as Mempool, Obligation_d_exports as Obligation, Offer_d_exports as Offer, Oracle_d_exports as Oracle, Position_d_exports as Position, Quote_d_exports as Quote, index_d_exports$1 as RouterApi, Client_d_exports$1 as RouterClient, Rules_d_exports as Rules, SuccessPayload, Tick_d_exports as Tick, time_d_exports as Time, TradingFee_d_exports as TradingFee, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, ValidateOffersData, ValidateOffersIssues, ValidateOffersSuccess, Gate_d_exports as Validation, ValidationIssue, morphoRules };
|
|
5007
|
-
//# sourceMappingURL=index.browser.d.ts.map
|