@morpho-dev/router 0.2.0 → 0.2.1
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 +3 -3
- package/dist/chunk-jass6xSI.mjs +13 -0
- package/dist/cli.js +6566 -7032
- package/dist/drizzle/migrations/0000_setup_single_migration_folder.sql +204 -0
- package/dist/drizzle/{router_v1.5/0006_add-trigger-for-consumed-events.sql → migrations/0001_add-trigger-for-consumed-events.sql} +6 -6
- package/dist/drizzle/migrations/0002_insert-status-code.sql +1 -0
- package/dist/drizzle/migrations/0003_update-triggers-for-consumed-events.sql +3 -0
- package/dist/drizzle/migrations/0004_drop-status-offers-foreign-key-constraint.sql +1 -0
- package/dist/drizzle/migrations/0005_add-index-to-boost-group-query-and-offer-hash.sql +1 -0
- package/dist/drizzle/migrations/0006_add-callbacks-and-positions-relations.sql +37 -0
- package/dist/drizzle/migrations/0008_validation.sql +15 -0
- package/dist/drizzle/migrations/0009_add-transfers-table.sql +14 -0
- package/dist/drizzle/migrations/0010_add-price.sql +1 -0
- package/dist/drizzle/migrations/0011_nullable-callback-amount.sql +1 -0
- package/dist/drizzle/migrations/0012_add-position-asset.sql +1 -0
- package/dist/drizzle/migrations/0013_remove-depecrated-domains.sql +13 -0
- package/dist/drizzle/migrations/0014_rename-offers-v2-into-offers.sql +23 -0
- package/dist/drizzle/{router_v1.5/meta/0008_snapshot.json → migrations/meta/0000_snapshot.json} +50 -50
- package/dist/drizzle/{router_v1.5/meta/0006_snapshot.json → migrations/meta/0001_snapshot.json} +150 -62
- package/dist/drizzle/migrations/meta/0002_snapshot.json +1752 -0
- package/dist/drizzle/migrations/meta/0003_snapshot.json +1752 -0
- package/dist/drizzle/{router_v1.5/meta/0007_snapshot.json → migrations/meta/0004_snapshot.json} +57 -67
- package/dist/drizzle/{router_v1.5 → migrations}/meta/0005_snapshot.json +181 -70
- package/dist/drizzle/{router_v1.5/meta/0004_snapshot.json → migrations/meta/0006_snapshot.json} +466 -62
- package/dist/drizzle/migrations/meta/0008_snapshot.json +1955 -0
- package/dist/drizzle/migrations/meta/0009_snapshot.json +2078 -0
- package/dist/drizzle/migrations/meta/0010_snapshot.json +2084 -0
- package/dist/drizzle/{router_v1.5/meta/0001_snapshot.json → migrations/meta/0013_snapshot.json} +492 -606
- package/dist/drizzle/{router_v1.5/meta/0002_snapshot.json → migrations/meta/0014_snapshot.json} +538 -711
- package/dist/drizzle/migrations/meta/_journal.json +104 -0
- package/dist/index.browser.d.mts +2794 -0
- package/dist/index.browser.d.mts.map +1 -0
- package/dist/index.browser.d.ts +2127 -1737
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +3789 -2911
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +3581 -2850
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +4987 -0
- package/dist/index.node.d.mts.map +1 -0
- package/dist/index.node.d.ts +4279 -4410
- package/dist/index.node.d.ts.map +1 -0
- package/dist/index.node.js +7742 -7158
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +7479 -7106
- package/dist/index.node.mjs.map +1 -1
- package/package.json +16 -6
- package/dist/cli.js.map +0 -1
- package/dist/drizzle/VERSION.ts +0 -3
- package/dist/drizzle/drizzle.config.ts +0 -18
- package/dist/drizzle/index.ts +0 -2
- package/dist/drizzle/router_v1.5/0000_add_block_number_to_liquidity_graph_and_offer_liquidity_pools_relation.sql +0 -122
- package/dist/drizzle/router_v1.5/0001_create_new_relations_to_prepare_new_liquidity_model.sql +0 -55
- package/dist/drizzle/router_v1.5/0002_add_new_offer_status_relation.sql +0 -9
- package/dist/drizzle/router_v1.5/0003_insert-status-code.sql +0 -1
- package/dist/drizzle/router_v1.5/0004_add_index_for_fast_book_lookup.sql +0 -3
- package/dist/drizzle/router_v1.5/0005_add_group_consumed_events_table.sql +0 -12
- package/dist/drizzle/router_v1.5/0007_update_index_for_fast_book_lookup.sql +0 -5
- package/dist/drizzle/router_v1.5/0008_rename_consumed_events_table.sql +0 -8
- package/dist/drizzle/router_v1.5/meta/0000_snapshot.json +0 -1028
- package/dist/drizzle/router_v1.5/meta/0003_snapshot.json +0 -1463
- package/dist/drizzle/router_v1.5/meta/_journal.json +0 -69
- package/dist/drizzle/schema.ts +0 -363
- package/dist/index.browser.d.cts +0 -2403
- package/dist/index.node.d.cts +0 -5119
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,277 +1,369 @@
|
|
|
1
|
-
import { z
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
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
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
9
|
+
//#region rolldown:runtime
|
|
10
|
+
declare namespace BookResponse_d_exports {
|
|
11
|
+
export { BookLevelResponse, from$13 as from };
|
|
12
|
+
}
|
|
13
|
+
type BookLevelResponse = {
|
|
14
|
+
rate: string;
|
|
15
|
+
assets: string;
|
|
16
|
+
count: number;
|
|
17
|
+
};
|
|
18
|
+
declare function from$13(level: {
|
|
19
|
+
rate: bigint;
|
|
20
|
+
assets: bigint;
|
|
21
|
+
count: number;
|
|
22
|
+
}): BookLevelResponse;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/api/Schema/health.d.ts
|
|
25
|
+
declare const CollectorHealth: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
chain_id: z.ZodNumber;
|
|
28
|
+
block_number: z.ZodNullable<z.ZodNumber>;
|
|
29
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
30
|
+
lag: z.ZodNullable<z.ZodNumber>;
|
|
31
|
+
status: z.ZodEnum<{
|
|
32
|
+
live: "live";
|
|
33
|
+
lagging: "lagging";
|
|
34
|
+
unknown: "unknown";
|
|
35
|
+
}>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
declare const CollectorsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
chain_id: z.ZodNumber;
|
|
40
|
+
block_number: z.ZodNullable<z.ZodNumber>;
|
|
41
|
+
updated_at: z.ZodNullable<z.ZodString>;
|
|
42
|
+
lag: z.ZodNullable<z.ZodNumber>;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
live: "live";
|
|
45
|
+
lagging: "lagging";
|
|
46
|
+
unknown: "unknown";
|
|
47
|
+
}>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
declare const ChainHealth: z.ZodObject<{
|
|
50
|
+
chain_id: z.ZodNumber;
|
|
51
|
+
local_block_number: z.ZodNumber;
|
|
52
|
+
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
53
|
+
updated_at: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
declare const ChainsHealthResponse: z.ZodArray<z.ZodObject<{
|
|
56
|
+
chain_id: z.ZodNumber;
|
|
57
|
+
local_block_number: z.ZodNumber;
|
|
58
|
+
remote_block_number: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
updated_at: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
declare const RouterStatusResponse: z.ZodObject<{
|
|
62
|
+
status: z.ZodEnum<{
|
|
63
|
+
live: "live";
|
|
64
|
+
syncing: "syncing";
|
|
65
|
+
}>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
type CollectorsHealthResponse = z.infer<typeof CollectorsHealthResponse>;
|
|
68
|
+
type ChainsHealthResponse = z.infer<typeof ChainsHealthResponse>;
|
|
69
|
+
type RouterStatusResponse = z.infer<typeof RouterStatusResponse>;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/core/Abi/MetaMorpho.d.ts
|
|
72
|
+
declare const MetaMorpho: readonly [{
|
|
73
|
+
readonly name: "balanceOf";
|
|
74
|
+
readonly type: "function";
|
|
75
|
+
readonly stateMutability: "view";
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly type: "address";
|
|
78
|
+
readonly name: "account";
|
|
79
|
+
}];
|
|
80
|
+
readonly outputs: readonly [{
|
|
81
|
+
readonly type: "uint256";
|
|
82
|
+
}];
|
|
83
|
+
}, {
|
|
84
|
+
readonly name: "DECIMALS_OFFSET";
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
readonly stateMutability: "view";
|
|
87
|
+
readonly inputs: readonly [];
|
|
88
|
+
readonly outputs: readonly [{
|
|
89
|
+
readonly type: "uint8";
|
|
90
|
+
}];
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "totalAssets";
|
|
93
|
+
readonly type: "function";
|
|
94
|
+
readonly stateMutability: "view";
|
|
95
|
+
readonly inputs: readonly [];
|
|
96
|
+
readonly outputs: readonly [{
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
}];
|
|
99
|
+
}, {
|
|
100
|
+
readonly name: "totalSupply";
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
readonly stateMutability: "view";
|
|
103
|
+
readonly inputs: readonly [];
|
|
104
|
+
readonly outputs: readonly [{
|
|
105
|
+
readonly type: "uint256";
|
|
106
|
+
}];
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "maxWithdraw";
|
|
109
|
+
readonly type: "function";
|
|
110
|
+
readonly stateMutability: "view";
|
|
111
|
+
readonly inputs: readonly [{
|
|
112
|
+
readonly type: "address";
|
|
113
|
+
readonly name: "owner";
|
|
114
|
+
}];
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly type: "uint256";
|
|
117
|
+
readonly name: "assets";
|
|
118
|
+
}];
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "asset";
|
|
121
|
+
readonly type: "function";
|
|
122
|
+
readonly stateMutability: "view";
|
|
123
|
+
readonly inputs: readonly [];
|
|
124
|
+
readonly outputs: readonly [{
|
|
125
|
+
readonly type: "address";
|
|
126
|
+
}];
|
|
127
|
+
}, {
|
|
128
|
+
readonly name: "Transfer";
|
|
129
|
+
readonly type: "event";
|
|
130
|
+
readonly inputs: readonly [{
|
|
131
|
+
readonly type: "address";
|
|
132
|
+
readonly name: "from";
|
|
133
|
+
readonly indexed: true;
|
|
134
|
+
}, {
|
|
135
|
+
readonly type: "address";
|
|
136
|
+
readonly name: "to";
|
|
137
|
+
readonly indexed: true;
|
|
138
|
+
}, {
|
|
139
|
+
readonly type: "uint256";
|
|
140
|
+
readonly name: "value";
|
|
141
|
+
}];
|
|
142
|
+
}, {
|
|
143
|
+
readonly name: "withdrawQueue";
|
|
144
|
+
readonly type: "function";
|
|
145
|
+
readonly stateMutability: "view";
|
|
146
|
+
readonly inputs: readonly [{
|
|
147
|
+
readonly type: "uint256";
|
|
148
|
+
readonly name: "index";
|
|
149
|
+
}];
|
|
150
|
+
readonly outputs: readonly [{
|
|
151
|
+
readonly type: "bytes32";
|
|
152
|
+
}];
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "withdrawQueueLength";
|
|
155
|
+
readonly type: "function";
|
|
156
|
+
readonly stateMutability: "view";
|
|
157
|
+
readonly inputs: readonly [];
|
|
158
|
+
readonly outputs: readonly [{
|
|
159
|
+
readonly type: "uint256";
|
|
160
|
+
}];
|
|
62
161
|
}];
|
|
63
|
-
|
|
64
|
-
|
|
162
|
+
type MetaMorpho = typeof MetaMorpho;
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/core/Abi/MetaMorphoFactory.d.ts
|
|
165
|
+
declare const MetaMorphoFactory: readonly [{
|
|
166
|
+
readonly name: "CreateMetaMorpho";
|
|
167
|
+
readonly type: "event";
|
|
168
|
+
readonly inputs: readonly [{
|
|
169
|
+
readonly type: "address";
|
|
170
|
+
readonly name: "metaMorpho";
|
|
171
|
+
readonly indexed: true;
|
|
172
|
+
}, {
|
|
173
|
+
readonly type: "address";
|
|
174
|
+
readonly name: "caller";
|
|
175
|
+
readonly indexed: true;
|
|
176
|
+
}, {
|
|
177
|
+
readonly type: "address";
|
|
178
|
+
readonly name: "initialOwner";
|
|
179
|
+
}, {
|
|
180
|
+
readonly type: "uint256";
|
|
181
|
+
readonly name: "initialTimelock";
|
|
182
|
+
}, {
|
|
183
|
+
readonly type: "address";
|
|
65
184
|
readonly name: "asset";
|
|
66
|
-
readonly
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
readonly
|
|
185
|
+
readonly indexed: true;
|
|
186
|
+
}, {
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
readonly name: "name";
|
|
189
|
+
}, {
|
|
190
|
+
readonly type: "string";
|
|
191
|
+
readonly name: "symbol";
|
|
192
|
+
}, {
|
|
193
|
+
readonly type: "bytes32";
|
|
194
|
+
readonly name: "salt";
|
|
195
|
+
}];
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "isMetaMorpho";
|
|
198
|
+
readonly type: "function";
|
|
199
|
+
readonly stateMutability: "view";
|
|
200
|
+
readonly inputs: readonly [{
|
|
201
|
+
readonly type: "address";
|
|
202
|
+
}];
|
|
203
|
+
readonly outputs: readonly [{
|
|
204
|
+
readonly type: "bool";
|
|
205
|
+
}];
|
|
72
206
|
}];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
207
|
+
type MetaMorphoFactory = typeof MetaMorphoFactory;
|
|
208
|
+
declare namespace index_d_exports {
|
|
209
|
+
export { ERC4626, MetaMorpho, MetaMorphoFactory, Morpho, Oracle$1 as Oracle };
|
|
210
|
+
}
|
|
211
|
+
declare const Oracle$1: readonly [{
|
|
212
|
+
readonly type: "function";
|
|
213
|
+
readonly name: "price";
|
|
214
|
+
readonly inputs: readonly [];
|
|
215
|
+
readonly outputs: readonly [{
|
|
216
|
+
readonly name: "";
|
|
217
|
+
readonly type: "uint256";
|
|
218
|
+
}];
|
|
219
|
+
readonly stateMutability: "view";
|
|
85
220
|
}];
|
|
86
|
-
declare const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
readonly type: "bytes32";
|
|
96
|
-
}];
|
|
97
|
-
readonly stateMutability: "view";
|
|
98
|
-
}, {
|
|
99
|
-
readonly type: "function";
|
|
100
|
-
readonly name: "withdrawQueueLength";
|
|
101
|
-
readonly inputs: readonly [];
|
|
102
|
-
readonly outputs: readonly [{
|
|
103
|
-
readonly name: "";
|
|
104
|
-
readonly type: "uint256";
|
|
105
|
-
}];
|
|
106
|
-
readonly stateMutability: "view";
|
|
107
|
-
}, {
|
|
108
|
-
readonly type: "function";
|
|
109
|
-
readonly name: "maxWithdraw";
|
|
110
|
-
readonly inputs: readonly [{
|
|
111
|
-
readonly name: "owner";
|
|
112
|
-
readonly type: "address";
|
|
113
|
-
}];
|
|
114
|
-
readonly outputs: readonly [{
|
|
115
|
-
readonly name: "";
|
|
116
|
-
readonly type: "uint256";
|
|
117
|
-
}];
|
|
118
|
-
readonly stateMutability: "view";
|
|
221
|
+
declare const ERC4626: readonly [{
|
|
222
|
+
readonly type: "function";
|
|
223
|
+
readonly name: "asset";
|
|
224
|
+
readonly inputs: readonly [];
|
|
225
|
+
readonly outputs: readonly [{
|
|
226
|
+
readonly name: "";
|
|
227
|
+
readonly type: "address";
|
|
228
|
+
}];
|
|
229
|
+
readonly stateMutability: "view";
|
|
119
230
|
}];
|
|
120
231
|
declare const Morpho: readonly [{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
232
|
+
readonly type: "function";
|
|
233
|
+
readonly name: "collateralOf";
|
|
234
|
+
readonly inputs: readonly [{
|
|
235
|
+
readonly name: "";
|
|
236
|
+
readonly type: "address";
|
|
237
|
+
readonly internalType: "address";
|
|
238
|
+
}, {
|
|
239
|
+
readonly name: "";
|
|
240
|
+
readonly type: "bytes32";
|
|
241
|
+
readonly internalType: "bytes32";
|
|
242
|
+
}, {
|
|
243
|
+
readonly name: "";
|
|
244
|
+
readonly type: "address";
|
|
245
|
+
readonly internalType: "address";
|
|
246
|
+
}];
|
|
247
|
+
readonly outputs: readonly [{
|
|
248
|
+
readonly name: "";
|
|
249
|
+
readonly type: "uint256";
|
|
250
|
+
readonly internalType: "uint256";
|
|
251
|
+
}];
|
|
252
|
+
readonly stateMutability: "view";
|
|
142
253
|
}, {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
254
|
+
readonly type: "function";
|
|
255
|
+
readonly name: "debtOf";
|
|
256
|
+
readonly inputs: readonly [{
|
|
257
|
+
readonly name: "";
|
|
258
|
+
readonly type: "address";
|
|
259
|
+
readonly internalType: "address";
|
|
260
|
+
}, {
|
|
261
|
+
readonly name: "";
|
|
262
|
+
readonly type: "bytes32";
|
|
263
|
+
readonly internalType: "bytes32";
|
|
264
|
+
}];
|
|
265
|
+
readonly outputs: readonly [{
|
|
266
|
+
readonly name: "";
|
|
267
|
+
readonly type: "uint256";
|
|
268
|
+
readonly internalType: "uint256";
|
|
269
|
+
}];
|
|
270
|
+
readonly stateMutability: "view";
|
|
160
271
|
}, {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
272
|
+
readonly type: "function";
|
|
273
|
+
readonly name: "market";
|
|
274
|
+
readonly inputs: readonly [{
|
|
275
|
+
readonly name: "id";
|
|
276
|
+
readonly type: "bytes32";
|
|
277
|
+
readonly internalType: "Id";
|
|
278
|
+
}];
|
|
279
|
+
readonly outputs: readonly [{
|
|
280
|
+
readonly name: "totalSupplyAssets";
|
|
281
|
+
readonly type: "uint128";
|
|
282
|
+
readonly internalType: "uint128";
|
|
283
|
+
}, {
|
|
284
|
+
readonly name: "totalSupplyShares";
|
|
285
|
+
readonly type: "uint128";
|
|
286
|
+
readonly internalType: "uint128";
|
|
287
|
+
}, {
|
|
288
|
+
readonly name: "totalBorrowAssets";
|
|
289
|
+
readonly type: "uint128";
|
|
290
|
+
readonly internalType: "uint128";
|
|
291
|
+
}, {
|
|
292
|
+
readonly name: "totalBorrowShares";
|
|
293
|
+
readonly type: "uint128";
|
|
294
|
+
readonly internalType: "uint128";
|
|
295
|
+
}, {
|
|
296
|
+
readonly name: "lastUpdate";
|
|
297
|
+
readonly type: "uint128";
|
|
298
|
+
readonly internalType: "uint128";
|
|
299
|
+
}, {
|
|
300
|
+
readonly name: "fee";
|
|
301
|
+
readonly type: "uint128";
|
|
302
|
+
readonly internalType: "uint128";
|
|
303
|
+
}];
|
|
304
|
+
readonly stateMutability: "view";
|
|
194
305
|
}, {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
306
|
+
readonly type: "function";
|
|
307
|
+
readonly name: "position";
|
|
308
|
+
readonly inputs: readonly [{
|
|
309
|
+
readonly name: "id";
|
|
310
|
+
readonly type: "bytes32";
|
|
311
|
+
readonly internalType: "Id";
|
|
312
|
+
}, {
|
|
313
|
+
readonly name: "user";
|
|
314
|
+
readonly type: "address";
|
|
315
|
+
readonly internalType: "address";
|
|
316
|
+
}];
|
|
317
|
+
readonly outputs: readonly [{
|
|
318
|
+
readonly name: "supplyShares";
|
|
319
|
+
readonly type: "uint256";
|
|
320
|
+
readonly internalType: "uint256";
|
|
321
|
+
}, {
|
|
322
|
+
readonly name: "borrowShares";
|
|
323
|
+
readonly type: "uint128";
|
|
324
|
+
readonly internalType: "uint128";
|
|
325
|
+
}, {
|
|
326
|
+
readonly name: "collateral";
|
|
327
|
+
readonly type: "uint128";
|
|
328
|
+
readonly internalType: "uint128";
|
|
329
|
+
}];
|
|
330
|
+
readonly stateMutability: "view";
|
|
220
331
|
}];
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
declare const Abi_MetaMorpho: typeof MetaMorpho;
|
|
224
|
-
declare const Abi_MetaMorphoFactory: typeof MetaMorphoFactory;
|
|
225
|
-
declare const Abi_Morpho: typeof Morpho;
|
|
226
|
-
declare const Abi_Oracle: typeof Oracle;
|
|
227
|
-
declare namespace Abi {
|
|
228
|
-
export { Abi_ERC4626 as ERC4626, Abi_MetaMorpho as MetaMorpho, Abi_MetaMorphoFactory as MetaMorphoFactory, Abi_Morpho as Morpho, Abi_Oracle as Oracle };
|
|
332
|
+
declare namespace Callback_d_exports {
|
|
333
|
+
export { CallbackType, decode$3 as decode, decodeBuyVaultV1Callback, decodeSellERC20Callback, encode$3 as encode, encodeBuyVaultV1Callback, encodeSellERC20Callback, isEmptyCallback };
|
|
229
334
|
}
|
|
230
|
-
|
|
231
335
|
declare enum CallbackType {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
336
|
+
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
337
|
+
BuyVaultV1Callback = "buy_vault_v1_callback",
|
|
338
|
+
SellERC20Callback = "sell_erc20_callback",
|
|
235
339
|
}
|
|
236
340
|
declare const isEmptyCallback: (offer: Offer) => boolean;
|
|
237
341
|
declare function decode$3(type: CallbackType, data: Hex): {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}[] | {
|
|
241
|
-
collateral: Address;
|
|
242
|
-
amount: bigint;
|
|
342
|
+
contract: Address;
|
|
343
|
+
amount: bigint;
|
|
243
344
|
}[];
|
|
244
345
|
declare function encode$3(type: CallbackType, data: any): Hex;
|
|
245
346
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
246
|
-
|
|
247
|
-
|
|
347
|
+
contract: Address;
|
|
348
|
+
amount: bigint;
|
|
248
349
|
}>;
|
|
249
350
|
declare function decodeSellERC20Callback(data: Hex): Array<{
|
|
250
|
-
|
|
251
|
-
|
|
351
|
+
contract: Address;
|
|
352
|
+
amount: bigint;
|
|
252
353
|
}>;
|
|
253
354
|
declare function encodeBuyVaultV1Callback(parameters: {
|
|
254
|
-
|
|
255
|
-
|
|
355
|
+
vaults: Address[];
|
|
356
|
+
amounts: bigint[];
|
|
256
357
|
}): Hex;
|
|
257
358
|
declare function encodeSellERC20Callback(parameters: {
|
|
258
|
-
|
|
259
|
-
|
|
359
|
+
collaterals: Address[];
|
|
360
|
+
amounts: bigint[];
|
|
260
361
|
}): Hex;
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
declare const Callback_CallbackType: typeof CallbackType;
|
|
264
|
-
declare const Callback_decodeBuyVaultV1Callback: typeof decodeBuyVaultV1Callback;
|
|
265
|
-
declare const Callback_decodeSellERC20Callback: typeof decodeSellERC20Callback;
|
|
266
|
-
declare const Callback_encodeBuyVaultV1Callback: typeof encodeBuyVaultV1Callback;
|
|
267
|
-
declare const Callback_encodeSellERC20Callback: typeof encodeSellERC20Callback;
|
|
268
|
-
declare const Callback_isEmptyCallback: typeof isEmptyCallback;
|
|
269
|
-
declare namespace Callback {
|
|
270
|
-
export { Callback_CallbackType as CallbackType, decode$3 as decode, Callback_decodeBuyVaultV1Callback as decodeBuyVaultV1Callback, Callback_decodeSellERC20Callback as decodeSellERC20Callback, encode$3 as encode, Callback_encodeBuyVaultV1Callback as encodeBuyVaultV1Callback, Callback_encodeSellERC20Callback as encodeSellERC20Callback, Callback_isEmptyCallback as isEmptyCallback };
|
|
362
|
+
declare namespace Errors_d_exports {
|
|
363
|
+
export { BaseError, GlobalErrorType, ReorgError };
|
|
271
364
|
}
|
|
272
|
-
|
|
273
365
|
type GlobalErrorType<name extends string = "Error"> = Error & {
|
|
274
|
-
|
|
366
|
+
name: name;
|
|
275
367
|
};
|
|
276
368
|
/**
|
|
277
369
|
* Base error class inherited by all errors thrown by mempool.
|
|
@@ -283,115 +375,94 @@ type GlobalErrorType<name extends string = "Error"> = Error & {
|
|
|
283
375
|
* ```
|
|
284
376
|
*/
|
|
285
377
|
declare class BaseError<cause extends Error | undefined = undefined> extends Error {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
declare namespace
|
|
303
|
-
export {
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
readonly [id in ID]: ID;
|
|
378
|
+
details: string;
|
|
379
|
+
shortMessage: string;
|
|
380
|
+
cause: cause;
|
|
381
|
+
name: string;
|
|
382
|
+
constructor(shortMessage: string, options?: {
|
|
383
|
+
cause?: cause | undefined;
|
|
384
|
+
details?: string | undefined;
|
|
385
|
+
metaMessages?: (string | undefined)[] | undefined;
|
|
386
|
+
});
|
|
387
|
+
walk(): Error;
|
|
388
|
+
walk(fn: (err: unknown) => boolean): Error | null;
|
|
389
|
+
}
|
|
390
|
+
declare class ReorgError extends BaseError {
|
|
391
|
+
name: string;
|
|
392
|
+
constructor(blockNumber: number);
|
|
393
|
+
}
|
|
394
|
+
declare namespace Chain_d_exports {
|
|
395
|
+
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
|
|
396
|
+
}
|
|
397
|
+
type Chain$1 = Compute<Chain<ChainFormatters, {
|
|
398
|
+
morpho: ChainContract;
|
|
399
|
+
morphoBlue: ChainContract;
|
|
400
|
+
mempool: ChainContract;
|
|
401
|
+
vaults: {
|
|
402
|
+
factories: {
|
|
403
|
+
v1_0: ChainContract;
|
|
404
|
+
v1_1: ChainContract;
|
|
314
405
|
};
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
406
|
+
};
|
|
407
|
+
}> & {
|
|
408
|
+
id: Id;
|
|
409
|
+
name: Name;
|
|
410
|
+
}>;
|
|
319
411
|
declare const ChainId: {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
412
|
+
readonly ETHEREUM: 1;
|
|
413
|
+
readonly BASE: 8453;
|
|
414
|
+
readonly "ETHEREUM-VIRTUAL-TESTNET": 109111114;
|
|
415
|
+
readonly ANVIL: 505050505;
|
|
324
416
|
};
|
|
325
|
-
type
|
|
326
|
-
declare const
|
|
327
|
-
type
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
mempool: {
|
|
333
|
-
address: Address;
|
|
334
|
-
deploymentBlock: number;
|
|
335
|
-
reindexBuffer: number;
|
|
336
|
-
};
|
|
337
|
-
}>;
|
|
338
|
-
declare function getChain(chainId: Id): Chain | undefined;
|
|
339
|
-
declare const getWhitelistedChains: () => Chain[];
|
|
340
|
-
declare const chains: Record<ChainName, Chain>;
|
|
417
|
+
type Name = Lowercase<keyof typeof ChainId>;
|
|
418
|
+
declare const chainNames: readonly Name[];
|
|
419
|
+
type Id = (typeof ChainId)[Uppercase<Name>];
|
|
420
|
+
declare const chainIds: readonly Id[];
|
|
421
|
+
declare function getChain(chainId: Id): Chain$1 | undefined;
|
|
422
|
+
declare const getWhitelistedChains: () => Chain$1[];
|
|
423
|
+
declare const chains$1: Record<Lowercase<Name>, Chain$1>;
|
|
341
424
|
declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
425
|
+
client: PublicClient;
|
|
426
|
+
contractAddress?: Address;
|
|
427
|
+
event?: abiEvent;
|
|
428
|
+
blockNumberGte?: number;
|
|
429
|
+
blockNumberLte?: number;
|
|
430
|
+
order: "asc" | "desc";
|
|
431
|
+
options: {
|
|
432
|
+
maxBatchSize?: number;
|
|
433
|
+
blockWindow?: number;
|
|
434
|
+
};
|
|
352
435
|
}): AsyncGenerator<{
|
|
353
|
-
|
|
354
|
-
|
|
436
|
+
logs: GetLogsReturnType<abiEvent | undefined>;
|
|
437
|
+
blockNumber: number;
|
|
355
438
|
}, void, void>;
|
|
356
439
|
declare class InvalidBlockRangeError extends BaseError {
|
|
357
|
-
|
|
358
|
-
|
|
440
|
+
name: string;
|
|
441
|
+
constructor(fromBlock: bigint, toBlock: bigint);
|
|
359
442
|
}
|
|
360
443
|
declare class InvalidBlockWindowError extends BaseError {
|
|
361
|
-
|
|
362
|
-
|
|
444
|
+
name: string;
|
|
445
|
+
constructor(blockWindow: number);
|
|
363
446
|
}
|
|
364
447
|
declare class InvalidBatchSizeError extends BaseError {
|
|
365
|
-
|
|
366
|
-
|
|
448
|
+
name: string;
|
|
449
|
+
constructor(maxBatchSize: number);
|
|
367
450
|
}
|
|
368
451
|
declare class MissingBlockNumberError extends BaseError {
|
|
369
|
-
|
|
370
|
-
|
|
452
|
+
name: string;
|
|
453
|
+
constructor();
|
|
371
454
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
type
|
|
376
|
-
|
|
377
|
-
type
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
declare
|
|
381
|
-
|
|
382
|
-
declare const Chain$1_InvalidBlockWindowError: typeof InvalidBlockWindowError;
|
|
383
|
-
type Chain$1_MissingBlockNumberError = MissingBlockNumberError;
|
|
384
|
-
declare const Chain$1_MissingBlockNumberError: typeof MissingBlockNumberError;
|
|
385
|
-
declare const Chain$1_chainIds: typeof chainIds;
|
|
386
|
-
declare const Chain$1_chainNames: typeof chainNames;
|
|
387
|
-
declare const Chain$1_chains: typeof chains;
|
|
388
|
-
declare const Chain$1_getChain: typeof getChain;
|
|
389
|
-
declare const Chain$1_getWhitelistedChains: typeof getWhitelistedChains;
|
|
390
|
-
declare const Chain$1_streamLogs: typeof streamLogs;
|
|
391
|
-
declare namespace Chain$1 {
|
|
392
|
-
export { type Chain$1_Chain as Chain, Chain$1_ChainId as ChainId, type Chain$1_ChainName as ChainName, type Chain$1_Id as Id, Chain$1_InvalidBatchSizeError as InvalidBatchSizeError, Chain$1_InvalidBlockRangeError as InvalidBlockRangeError, Chain$1_InvalidBlockWindowError as InvalidBlockWindowError, Chain$1_MissingBlockNumberError as MissingBlockNumberError, Chain$1_chainIds as chainIds, Chain$1_chainNames as chainNames, Chain$1_chains as chains, Chain$1_getChain as getChain, Chain$1_getWhitelistedChains as getWhitelistedChains, Chain$1_streamLogs as streamLogs };
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/core/types.d.ts
|
|
457
|
+
/** Combines members of an intersection into a readable type. */
|
|
458
|
+
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
459
|
+
declare const BrandTypeId: unique symbol;
|
|
460
|
+
type Brand<in out ID extends string | symbol> = {
|
|
461
|
+
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
462
|
+
};
|
|
463
|
+
declare namespace LLTV_d_exports {
|
|
464
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$12 as from };
|
|
393
465
|
}
|
|
394
|
-
|
|
395
466
|
type LLTV = bigint & Brand<"LLTV">;
|
|
396
467
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
397
468
|
type Options = (typeof Options)[number];
|
|
@@ -400,55 +471,48 @@ type Options = (typeof Options)[number];
|
|
|
400
471
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
401
472
|
* @returns The LLTV.
|
|
402
473
|
*/
|
|
403
|
-
declare function from$
|
|
404
|
-
declare namespace from$
|
|
405
|
-
|
|
474
|
+
declare function from$12(lltv: Options | bigint): LLTV;
|
|
475
|
+
declare namespace from$12 {
|
|
476
|
+
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
406
477
|
}
|
|
407
478
|
declare class InvalidOptionError$1 extends BaseError {
|
|
408
|
-
|
|
409
|
-
|
|
479
|
+
readonly name = "LLTV.InvalidOptionError";
|
|
480
|
+
constructor(input: number);
|
|
410
481
|
}
|
|
411
482
|
declare class InvalidLLTVError extends BaseError {
|
|
412
|
-
|
|
413
|
-
|
|
483
|
+
readonly name = "LLTV.InvalidLLTVError";
|
|
484
|
+
constructor(input: bigint);
|
|
414
485
|
}
|
|
415
|
-
declare const LLTVSchema: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
declare const LLTV$1_InvalidLLTVError: typeof InvalidLLTVError;
|
|
419
|
-
type LLTV$1_LLTV = LLTV;
|
|
420
|
-
declare const LLTV$1_LLTVSchema: typeof LLTVSchema;
|
|
421
|
-
type LLTV$1_Options = Options;
|
|
422
|
-
declare namespace LLTV$1 {
|
|
423
|
-
export { LLTV$1_InvalidLLTVError as InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, type LLTV$1_LLTV as LLTV, LLTV$1_LLTVSchema as LLTVSchema, type LLTV$1_Options as Options, from$9 as from };
|
|
486
|
+
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
487
|
+
declare namespace Collateral_d_exports {
|
|
488
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$11 as from, random$3 as random };
|
|
424
489
|
}
|
|
425
|
-
|
|
426
490
|
type Collateral = {
|
|
427
|
-
|
|
491
|
+
/** Asset being used as collateral. */
|
|
492
|
+
asset: Address;
|
|
493
|
+
/** Liquidation Loan-to-Value of the collateral. */
|
|
494
|
+
lltv: LLTV;
|
|
495
|
+
/** Oracle contract used to price the collateral. */
|
|
496
|
+
oracle: Address;
|
|
497
|
+
};
|
|
498
|
+
declare const CollateralSchema: z$1.ZodObject<{
|
|
499
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
500
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
501
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
502
|
+
}, z$1.core.$strip>;
|
|
503
|
+
declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
504
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
505
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
506
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
507
|
+
}, z$1.core.$strip>>;
|
|
508
|
+
declare const from$11: (parameters: from$11.Parameters) => from$11.ReturnType;
|
|
509
|
+
declare namespace from$11 {
|
|
510
|
+
type Parameters = {
|
|
428
511
|
asset: Address;
|
|
429
|
-
|
|
430
|
-
lltv: LLTV;
|
|
431
|
-
/** Oracle contract used to price the collateral. */
|
|
512
|
+
lltv: Options | bigint;
|
|
432
513
|
oracle: Address;
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
asset: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
436
|
-
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
437
|
-
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
438
|
-
}, z.core.$strip>;
|
|
439
|
-
declare const CollateralsSchema: z.ZodArray<z.ZodObject<{
|
|
440
|
-
asset: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
441
|
-
oracle: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
442
|
-
lltv: z.ZodPipe<z.ZodBigInt, z.ZodTransform<LLTV, bigint>>;
|
|
443
|
-
}, z.core.$strip>>;
|
|
444
|
-
declare const from$8: (parameters: from$8.Parameters) => from$8.ReturnType;
|
|
445
|
-
declare namespace from$8 {
|
|
446
|
-
type Parameters = {
|
|
447
|
-
asset: Address;
|
|
448
|
-
lltv: Options | bigint;
|
|
449
|
-
oracle: Address;
|
|
450
|
-
};
|
|
451
|
-
type ReturnType = Collateral;
|
|
514
|
+
};
|
|
515
|
+
type ReturnType = Collateral;
|
|
452
516
|
}
|
|
453
517
|
/**
|
|
454
518
|
* Generates a random collateral.
|
|
@@ -461,34 +525,107 @@ declare namespace from$8 {
|
|
|
461
525
|
*/
|
|
462
526
|
declare function random$3(): random$3.ReturnType;
|
|
463
527
|
declare namespace random$3 {
|
|
464
|
-
|
|
528
|
+
type ReturnType = Collateral;
|
|
465
529
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
530
|
+
declare namespace ERC4626_d_exports {
|
|
531
|
+
export { DenominatorIsZeroError, convertToAssets, convertToShares, decimalsOffset };
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Calculate the decimals offset used by the ERC4626 implementation.
|
|
535
|
+
* @param parameters - {@link decimalsOffset.Parameters}.
|
|
536
|
+
* @returns The decimals offset.
|
|
537
|
+
*
|
|
538
|
+
* @example
|
|
539
|
+
* ```ts
|
|
540
|
+
* const decimalsOffset = decimalsOffset({ underlyingDecimals: 6 });
|
|
541
|
+
* // decimalsOffset = 12
|
|
542
|
+
* ```
|
|
543
|
+
*/
|
|
544
|
+
declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
|
|
545
|
+
declare namespace decimalsOffset {
|
|
546
|
+
type Parameters = {
|
|
547
|
+
/** The number of decimals of the underlying asset. */
|
|
548
|
+
underlyingDecimals: number;
|
|
549
|
+
};
|
|
550
|
+
type ReturnType = number;
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Convert shares to assets.
|
|
554
|
+
* @throws If the denominator is 0. {@link DenominatorIsZeroError}
|
|
555
|
+
* @param parameters - {@link convertToAssets.Parameters}.
|
|
556
|
+
* @returns The amount of assets.
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```ts
|
|
560
|
+
* const assets = convertToAssets(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 18 });
|
|
561
|
+
* // assets = 100n
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
|
|
565
|
+
declare namespace convertToAssets {
|
|
566
|
+
type Parameters = {
|
|
567
|
+
/** The amount of shares to convert. */
|
|
568
|
+
shares: bigint;
|
|
569
|
+
/** Total amount of assets in the vault. */
|
|
570
|
+
totalAssets: bigint;
|
|
571
|
+
/** Total amount of shares in the vault. */
|
|
572
|
+
totalSupply: bigint;
|
|
573
|
+
/**
|
|
574
|
+
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
575
|
+
* Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
|
|
576
|
+
* precision between shares and assets.
|
|
577
|
+
*/
|
|
578
|
+
decimalsOffset: number;
|
|
579
|
+
};
|
|
580
|
+
type ReturnType = bigint;
|
|
581
|
+
type ErrorType = DenominatorIsZeroError;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Convert assets to shares.
|
|
585
|
+
* @throws If the denominator is 0. {@link DenominatorIsZeroError}
|
|
586
|
+
* @param parameters - {@link convertToShares.Parameters}.
|
|
587
|
+
* @returns The amount of shares.
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```ts
|
|
591
|
+
* const shares = convertToShares(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 12 });
|
|
592
|
+
* // shares = 100n
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
|
|
596
|
+
declare namespace convertToShares {
|
|
597
|
+
type Parameters = {
|
|
598
|
+
/** The amount of assets to convert. */
|
|
599
|
+
assets: bigint;
|
|
600
|
+
/** Total amount of assets in the vault. */
|
|
601
|
+
totalAssets: bigint;
|
|
602
|
+
/** Total amount of shares in the vault. */
|
|
603
|
+
totalSupply: bigint;
|
|
604
|
+
/**
|
|
605
|
+
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
606
|
+
* Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
|
|
607
|
+
* precision between shares and assets.
|
|
608
|
+
*/
|
|
609
|
+
decimalsOffset: number;
|
|
610
|
+
};
|
|
611
|
+
type ReturnType = bigint;
|
|
612
|
+
type ErrorType = DenominatorIsZeroError;
|
|
613
|
+
}
|
|
614
|
+
declare class DenominatorIsZeroError extends BaseError {
|
|
615
|
+
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
616
|
+
constructor();
|
|
617
|
+
}
|
|
618
|
+
declare namespace Format_d_exports {
|
|
619
|
+
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
472
620
|
}
|
|
473
|
-
|
|
474
621
|
/** The snake case representation of a type with bigint values stringified. */
|
|
475
622
|
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
476
623
|
/** Make arrays/tuples and object props mutable, deeply. */
|
|
477
|
-
type DeepMutable<T> = T extends (...args: unknown[]) => unknown ? T : T extends number | string | boolean | symbol | bigint | null | undefined ? T : T extends readonly [...infer R] ? {
|
|
478
|
-
-readonly [K in keyof R]: DeepMutable<R[K]>;
|
|
479
|
-
} : T extends ReadonlyArray<infer U> ? Array<DeepMutable<U>> : T extends object ? {
|
|
480
|
-
-readonly [K in keyof T]: DeepMutable<T[K]>;
|
|
481
|
-
} : T;
|
|
624
|
+
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;
|
|
482
625
|
/** Stringifies bigint values to strings and preserves branded primitives. */
|
|
483
|
-
type StringifiedBigint<T> = [
|
|
484
|
-
T
|
|
485
|
-
] 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 ? {
|
|
486
|
-
[K in keyof T]: StringifiedBigint<T[K]>;
|
|
487
|
-
} : T;
|
|
626
|
+
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;
|
|
488
627
|
/** Key remapping that also preserves branded primitives. */
|
|
489
|
-
type SnakeKeys<T> = T extends readonly (infer U)[] ? readonly SnakeKeys<U>[] : T extends number | string | boolean | symbol | null | undefined ? T : T extends object ? {
|
|
490
|
-
[K in keyof T as ToSnakeCase<Extract<K, string>>]: SnakeKeys<T[K]>;
|
|
491
|
-
} : T;
|
|
628
|
+
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;
|
|
492
629
|
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;
|
|
493
630
|
/**
|
|
494
631
|
* Formats object keys to snake case.
|
|
@@ -505,33 +642,29 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
505
642
|
*/
|
|
506
643
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
507
644
|
declare function stringifyBigint<T>(value: T): StringifiedBigint<T>;
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
declare const Format_stringifyBigint: typeof stringifyBigint;
|
|
511
|
-
declare namespace Format {
|
|
512
|
-
export { type Format_Snake as Snake, fromSnakeCase$3 as fromSnakeCase, Format_stringifyBigint as stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
645
|
+
declare namespace Maturity_d_exports {
|
|
646
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$10 as from };
|
|
513
647
|
}
|
|
514
|
-
|
|
515
648
|
/**
|
|
516
649
|
* Maturity is a number that represents a date in seconds.
|
|
517
650
|
*/
|
|
518
651
|
type Maturity = number & Brand<"Maturity">;
|
|
519
|
-
declare const MaturitySchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<Maturity, number>>;
|
|
652
|
+
declare const MaturitySchema: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
520
653
|
declare enum MaturityType {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
654
|
+
EndOfWeek = "end_of_week",
|
|
655
|
+
EndOfNextWeek = "end_of_next_week",
|
|
656
|
+
EndOfMonth = "end_of_month",
|
|
657
|
+
EndOfNextMonth = "end_of_next_month",
|
|
658
|
+
EndOfQuarter = "end_of_quarter",
|
|
659
|
+
EndOfNextQuarter = "end_of_next_quarter",
|
|
527
660
|
}
|
|
528
661
|
declare const MaturityOptions: {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
662
|
+
readonly end_of_week: () => Maturity;
|
|
663
|
+
readonly end_of_next_week: () => Maturity;
|
|
664
|
+
readonly end_of_month: () => Maturity;
|
|
665
|
+
readonly end_of_next_month: () => Maturity;
|
|
666
|
+
readonly end_of_quarter: () => Maturity;
|
|
667
|
+
readonly end_of_next_quarter: () => Maturity;
|
|
535
668
|
};
|
|
536
669
|
type MaturityOptions = keyof typeof MaturityOptions;
|
|
537
670
|
/**
|
|
@@ -540,118 +673,117 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
540
673
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
541
674
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
542
675
|
*/
|
|
543
|
-
declare function from$
|
|
544
|
-
declare namespace from$
|
|
545
|
-
|
|
546
|
-
|
|
676
|
+
declare function from$10(ts: from$10.Parameters): Maturity;
|
|
677
|
+
declare namespace from$10 {
|
|
678
|
+
type Parameters = number | MaturityOptions;
|
|
679
|
+
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
547
680
|
}
|
|
548
681
|
declare class InvalidFormatError extends BaseError {
|
|
549
|
-
|
|
550
|
-
|
|
682
|
+
readonly name = "Maturity.InvalidFormatError";
|
|
683
|
+
constructor();
|
|
551
684
|
}
|
|
552
685
|
declare class InvalidDateError extends BaseError {
|
|
553
|
-
|
|
554
|
-
|
|
686
|
+
readonly name = "Maturity.InvalidDateError";
|
|
687
|
+
constructor(input: number);
|
|
555
688
|
}
|
|
556
689
|
declare class InvalidOptionError extends BaseError {
|
|
557
|
-
|
|
558
|
-
|
|
690
|
+
readonly name = "Maturity.InvalidOptionError";
|
|
691
|
+
constructor(input: string);
|
|
559
692
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
declare const Maturity$1_InvalidDateError: typeof InvalidDateError;
|
|
563
|
-
type Maturity$1_InvalidFormatError = InvalidFormatError;
|
|
564
|
-
declare const Maturity$1_InvalidFormatError: typeof InvalidFormatError;
|
|
565
|
-
type Maturity$1_InvalidOptionError = InvalidOptionError;
|
|
566
|
-
declare const Maturity$1_InvalidOptionError: typeof InvalidOptionError;
|
|
567
|
-
type Maturity$1_Maturity = Maturity;
|
|
568
|
-
type Maturity$1_MaturityOptions = MaturityOptions;
|
|
569
|
-
declare const Maturity$1_MaturitySchema: typeof MaturitySchema;
|
|
570
|
-
type Maturity$1_MaturityType = MaturityType;
|
|
571
|
-
declare const Maturity$1_MaturityType: typeof MaturityType;
|
|
572
|
-
declare namespace Maturity$1 {
|
|
573
|
-
export { Maturity$1_InvalidDateError as InvalidDateError, Maturity$1_InvalidFormatError as InvalidFormatError, Maturity$1_InvalidOptionError as InvalidOptionError, type Maturity$1_Maturity as Maturity, type Maturity$1_MaturityOptions as MaturityOptions, Maturity$1_MaturitySchema as MaturitySchema, Maturity$1_MaturityType as MaturityType, from$7 as from };
|
|
693
|
+
declare namespace Offer_d_exports {
|
|
694
|
+
export { AccountNotSetError, InvalidOfferError, Offer, OfferConsumed, OfferHashSchema, OfferSchema, RandomConfig, Status, Validation, consumedEvent, decode$2 as decode, domain, encode$2 as encode, from$9 as from, fromSnakeCase$2 as fromSnakeCase, hash, obligationId, random$2 as random, sign, signatureMsg, toSnakeCase, types };
|
|
574
695
|
}
|
|
575
|
-
|
|
576
696
|
type Offer = {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
readonly
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
697
|
+
/** The address that made the offer. */
|
|
698
|
+
readonly offering: Address;
|
|
699
|
+
/** The amount of assets offered. */
|
|
700
|
+
readonly assets: bigint;
|
|
701
|
+
/**
|
|
702
|
+
* The amount of assets that can be taken from the offer. takeable = min(max - consumed, available)
|
|
703
|
+
* Where available is the total amount of assets retrievable from offering positions.
|
|
704
|
+
*/
|
|
705
|
+
readonly takeable: bigint;
|
|
706
|
+
/** The interest rate (with 18 decimals). */
|
|
707
|
+
readonly rate: bigint;
|
|
708
|
+
/** The date at which all interests will be paid. */
|
|
709
|
+
readonly maturity: Maturity;
|
|
710
|
+
/** The date at which the offer will expire. */
|
|
711
|
+
readonly expiry: number;
|
|
712
|
+
/** The date at which the offer will start. */
|
|
713
|
+
readonly start: number;
|
|
714
|
+
/** The nonce. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
715
|
+
readonly nonce: bigint;
|
|
716
|
+
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
717
|
+
readonly buy: boolean;
|
|
718
|
+
/** The chain id where the liquidity for this offer is located. */
|
|
719
|
+
readonly chainId: Id;
|
|
720
|
+
/** The token that is being borrowed. */
|
|
721
|
+
readonly loanToken: Address;
|
|
722
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
723
|
+
readonly collaterals: readonly Collateral[];
|
|
724
|
+
/** The optional callback data to retrieve the maker funds. */
|
|
725
|
+
readonly callback: {
|
|
726
|
+
readonly address: Address;
|
|
727
|
+
readonly data: Hex;
|
|
728
|
+
readonly gasLimit: bigint;
|
|
729
|
+
};
|
|
730
|
+
/** The amount of assets consumed from the offer. */
|
|
731
|
+
consumed: bigint;
|
|
732
|
+
/** The hash of the offer. */
|
|
733
|
+
readonly hash: Hex;
|
|
734
|
+
/** The block number at which the offer was created. */
|
|
735
|
+
readonly blockNumber: number;
|
|
736
|
+
/** The signature of the offer. */
|
|
737
|
+
signature?: Hex;
|
|
613
738
|
};
|
|
614
|
-
declare enum
|
|
615
|
-
|
|
616
|
-
|
|
739
|
+
declare enum Status {
|
|
740
|
+
VALID = "VALID",
|
|
741
|
+
SIMULATION_ERROR = "SIMULATION_ERROR",
|
|
617
742
|
}
|
|
618
|
-
|
|
743
|
+
type Validation = {
|
|
744
|
+
offerHash: Hex;
|
|
745
|
+
status: Status;
|
|
746
|
+
};
|
|
747
|
+
declare const OfferHashSchema: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
619
748
|
declare const OfferSchema: (parameters?: {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
749
|
+
omitHash?: boolean;
|
|
750
|
+
}) => z$1.ZodObject<{
|
|
751
|
+
offering: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
752
|
+
assets: z$1.ZodBigInt;
|
|
753
|
+
rate: z$1.ZodBigInt;
|
|
754
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
755
|
+
expiry: z$1.ZodNumber;
|
|
756
|
+
start: z$1.ZodNumber;
|
|
757
|
+
nonce: z$1.ZodBigInt;
|
|
758
|
+
buy: z$1.ZodBoolean;
|
|
759
|
+
chainId: z$1.ZodNumber;
|
|
760
|
+
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
761
|
+
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
762
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
763
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
764
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
765
|
+
}, z$1.core.$strip>>;
|
|
766
|
+
callback: z$1.ZodObject<{
|
|
767
|
+
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
768
|
+
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
769
|
+
gasLimit: z$1.ZodBigInt;
|
|
770
|
+
}, z$1.core.$strip>;
|
|
771
|
+
signature: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
772
|
+
consumed: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
773
|
+
takeable: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
774
|
+
blockNumber: z$1.ZodOptional<z$1.ZodNumber>;
|
|
775
|
+
}, z$1.core.$strip>;
|
|
646
776
|
/**
|
|
647
777
|
* Creates an offer from a plain object.
|
|
648
778
|
* @throws {InvalidOfferError} If the offer is invalid.
|
|
649
779
|
* @param input - The offer to create.
|
|
650
780
|
* @returns The created offer with its hash.
|
|
651
781
|
*/
|
|
652
|
-
declare function from$
|
|
653
|
-
|
|
654
|
-
|
|
782
|
+
declare function from$9(input: Compute<Omit<Offer, "chainId" | "hash"> & {
|
|
783
|
+
chainId: number;
|
|
784
|
+
}>): Offer;
|
|
785
|
+
declare namespace from$9 {
|
|
786
|
+
type ErrorType = InvalidOfferError;
|
|
655
787
|
}
|
|
656
788
|
/**
|
|
657
789
|
* Creates an offer from a snake case object.
|
|
@@ -659,7 +791,9 @@ declare namespace from$6 {
|
|
|
659
791
|
* @param input - The offer to create.
|
|
660
792
|
* @returns The created offer with its hash.
|
|
661
793
|
*/
|
|
662
|
-
declare function fromSnakeCase$2(input: Snake<Omit<Offer, "hash"
|
|
794
|
+
declare function fromSnakeCase$2(input: Snake<Omit<Offer, "chainId" | "hash"> & {
|
|
795
|
+
chainId: number;
|
|
796
|
+
}>): Offer;
|
|
663
797
|
/**
|
|
664
798
|
* Converts an offer to a snake case object.
|
|
665
799
|
* @param offer - The offer to convert.
|
|
@@ -667,26 +801,28 @@ declare function fromSnakeCase$2(input: Snake<Omit<Offer, "hash">>): Offer;
|
|
|
667
801
|
*/
|
|
668
802
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
669
803
|
type RandomConfig = {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
804
|
+
chains?: Chain$1[];
|
|
805
|
+
loanTokens?: Address[];
|
|
806
|
+
collateralTokens?: Address[];
|
|
807
|
+
assetsDecimals?: Record<Address, number>;
|
|
808
|
+
buy?: boolean;
|
|
809
|
+
assets?: bigint;
|
|
810
|
+
consumed?: bigint;
|
|
811
|
+
takeable?: bigint;
|
|
812
|
+
offering?: Address;
|
|
813
|
+
maturity?: Maturity;
|
|
814
|
+
start?: number;
|
|
815
|
+
expiry?: number;
|
|
816
|
+
nonce?: bigint;
|
|
817
|
+
rate?: bigint;
|
|
818
|
+
callback?: {
|
|
819
|
+
address: Address;
|
|
820
|
+
data: Hex;
|
|
821
|
+
gasLimit: bigint;
|
|
822
|
+
};
|
|
823
|
+
collaterals?: readonly Collateral[];
|
|
824
|
+
signature?: Hex;
|
|
825
|
+
blockNumber?: number;
|
|
690
826
|
};
|
|
691
827
|
/**
|
|
692
828
|
* Generates a random Offer.
|
|
@@ -700,9 +836,9 @@ declare function random$2(config?: RandomConfig): Offer;
|
|
|
700
836
|
* @param chainId - The chain ID.
|
|
701
837
|
* @returns The EIP-712 domain object.
|
|
702
838
|
*/
|
|
703
|
-
declare const domain: (chainId:
|
|
704
|
-
|
|
705
|
-
|
|
839
|
+
declare const domain: (chainId: number) => {
|
|
840
|
+
chainId: bigint;
|
|
841
|
+
verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
706
842
|
};
|
|
707
843
|
/**
|
|
708
844
|
* The EIP-712 types for the offer.
|
|
@@ -710,64 +846,64 @@ declare const domain: (chainId: bigint) => {
|
|
|
710
846
|
* @returns The EIP-712 types.
|
|
711
847
|
*/
|
|
712
848
|
declare const types: {
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
849
|
+
readonly EIP712Domain: readonly [{
|
|
850
|
+
readonly name: "chainId";
|
|
851
|
+
readonly type: "uint256";
|
|
852
|
+
}, {
|
|
853
|
+
readonly name: "verifyingContract";
|
|
854
|
+
readonly type: "address";
|
|
855
|
+
}];
|
|
856
|
+
readonly Offer: readonly [{
|
|
857
|
+
readonly name: "offering";
|
|
858
|
+
readonly type: "address";
|
|
859
|
+
}, {
|
|
860
|
+
readonly name: "assets";
|
|
861
|
+
readonly type: "uint256";
|
|
862
|
+
}, {
|
|
863
|
+
readonly name: "rate";
|
|
864
|
+
readonly type: "uint256";
|
|
865
|
+
}, {
|
|
866
|
+
readonly name: "maturity";
|
|
867
|
+
readonly type: "uint256";
|
|
868
|
+
}, {
|
|
869
|
+
readonly name: "expiry";
|
|
870
|
+
readonly type: "uint256";
|
|
871
|
+
}, {
|
|
872
|
+
readonly name: "nonce";
|
|
873
|
+
readonly type: "uint256";
|
|
874
|
+
}, {
|
|
875
|
+
readonly name: "buy";
|
|
876
|
+
readonly type: "bool";
|
|
877
|
+
}, {
|
|
878
|
+
readonly name: "loanToken";
|
|
879
|
+
readonly type: "address";
|
|
880
|
+
}, {
|
|
881
|
+
readonly name: "collaterals";
|
|
882
|
+
readonly type: "Collateral[]";
|
|
883
|
+
}, {
|
|
884
|
+
readonly name: "callback";
|
|
885
|
+
readonly type: "Callback";
|
|
886
|
+
}];
|
|
887
|
+
readonly Collateral: readonly [{
|
|
888
|
+
readonly name: "asset";
|
|
889
|
+
readonly type: "address";
|
|
890
|
+
}, {
|
|
891
|
+
readonly name: "oracle";
|
|
892
|
+
readonly type: "address";
|
|
893
|
+
}, {
|
|
894
|
+
readonly name: "lltv";
|
|
895
|
+
readonly type: "uint256";
|
|
896
|
+
}];
|
|
897
|
+
readonly Callback: readonly [{
|
|
898
|
+
readonly name: "address";
|
|
899
|
+
readonly type: "address";
|
|
900
|
+
}, {
|
|
901
|
+
readonly name: "data";
|
|
902
|
+
readonly type: "bytes";
|
|
903
|
+
}, {
|
|
904
|
+
readonly name: "gasLimit";
|
|
905
|
+
readonly type: "uint256";
|
|
906
|
+
}];
|
|
771
907
|
};
|
|
772
908
|
/**
|
|
773
909
|
* Signs an array of offers.
|
|
@@ -789,108 +925,88 @@ declare function obligationId(offer: Offer): Hex;
|
|
|
789
925
|
declare function encode$2(offer: Offer): `0x${string}`;
|
|
790
926
|
declare function decode$2(data: Hex, blockNumber: number | bigint): Offer;
|
|
791
927
|
type OfferConsumed = {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
928
|
+
id: string;
|
|
929
|
+
chainId: Id;
|
|
930
|
+
offering: Address;
|
|
931
|
+
nonce: bigint;
|
|
932
|
+
amount: bigint;
|
|
933
|
+
blockNumber: number;
|
|
798
934
|
};
|
|
799
935
|
/**
|
|
800
936
|
* ABI for the Consumed event emitted by the Obligation contract.
|
|
801
937
|
*/
|
|
802
938
|
declare const consumedEvent: {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
939
|
+
readonly type: "event";
|
|
940
|
+
readonly name: "Consumed";
|
|
941
|
+
readonly inputs: readonly [{
|
|
942
|
+
readonly name: "user";
|
|
943
|
+
readonly type: "address";
|
|
944
|
+
readonly indexed: true;
|
|
945
|
+
readonly internalType: "address";
|
|
946
|
+
}, {
|
|
947
|
+
readonly name: "nonce";
|
|
948
|
+
readonly type: "uint256";
|
|
949
|
+
readonly indexed: true;
|
|
950
|
+
readonly internalType: "uint256";
|
|
951
|
+
}, {
|
|
952
|
+
readonly name: "amount";
|
|
953
|
+
readonly type: "uint256";
|
|
954
|
+
readonly indexed: false;
|
|
955
|
+
readonly internalType: "uint256";
|
|
956
|
+
}];
|
|
957
|
+
readonly anonymous: false;
|
|
822
958
|
};
|
|
823
|
-
declare
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
959
|
+
declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
960
|
+
readonly name = "Offer.InvalidOfferError";
|
|
961
|
+
constructor(error: z$1.ZodError | Error);
|
|
962
|
+
/**
|
|
963
|
+
* Formats ZodError issues into a human-readable string with line breaks.
|
|
964
|
+
* @example
|
|
965
|
+
* "- 'assets': too small, expected >= 0
|
|
966
|
+
* - 'start': must be before expiry"
|
|
967
|
+
*/
|
|
968
|
+
static formatDetails(error: z$1.ZodError | Error): string;
|
|
969
|
+
/**
|
|
970
|
+
* Returns the formatted human-readable message.
|
|
971
|
+
*/
|
|
972
|
+
get formattedMessage(): string;
|
|
835
973
|
}
|
|
836
974
|
declare class AccountNotSetError extends BaseError {
|
|
837
|
-
|
|
838
|
-
|
|
975
|
+
readonly name = "Offer.AccountNotSetError";
|
|
976
|
+
constructor();
|
|
839
977
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
declare const Offer$1_AccountNotSetError: typeof AccountNotSetError;
|
|
843
|
-
type Offer$1_InvalidOfferError = InvalidOfferError;
|
|
844
|
-
declare const Offer$1_InvalidOfferError: typeof InvalidOfferError;
|
|
845
|
-
type Offer$1_Offer = Offer;
|
|
846
|
-
type Offer$1_OfferConsumed = OfferConsumed;
|
|
847
|
-
declare const Offer$1_OfferHashSchema: typeof OfferHashSchema;
|
|
848
|
-
declare const Offer$1_OfferSchema: typeof OfferSchema;
|
|
849
|
-
type Offer$1_RandomConfig = RandomConfig;
|
|
850
|
-
type Offer$1_StatusCode = StatusCode;
|
|
851
|
-
declare const Offer$1_StatusCode: typeof StatusCode;
|
|
852
|
-
declare const Offer$1_consumedEvent: typeof consumedEvent;
|
|
853
|
-
declare const Offer$1_domain: typeof domain;
|
|
854
|
-
declare const Offer$1_fromConsumedLog: typeof fromConsumedLog;
|
|
855
|
-
declare const Offer$1_hash: typeof hash;
|
|
856
|
-
declare const Offer$1_obligationId: typeof obligationId;
|
|
857
|
-
declare const Offer$1_sign: typeof sign;
|
|
858
|
-
declare const Offer$1_signatureMsg: typeof signatureMsg;
|
|
859
|
-
declare const Offer$1_toSnakeCase: typeof toSnakeCase;
|
|
860
|
-
declare const Offer$1_types: typeof types;
|
|
861
|
-
declare namespace Offer$1 {
|
|
862
|
-
export { Offer$1_AccountNotSetError as AccountNotSetError, Offer$1_InvalidOfferError as InvalidOfferError, type Offer$1_Offer as Offer, type Offer$1_OfferConsumed as OfferConsumed, Offer$1_OfferHashSchema as OfferHashSchema, Offer$1_OfferSchema as OfferSchema, type Offer$1_RandomConfig as RandomConfig, Offer$1_StatusCode as StatusCode, Offer$1_consumedEvent as consumedEvent, decode$2 as decode, Offer$1_domain as domain, encode$2 as encode, from$6 as from, Offer$1_fromConsumedLog as fromConsumedLog, fromSnakeCase$2 as fromSnakeCase, Offer$1_hash as hash, Offer$1_obligationId as obligationId, random$2 as random, Offer$1_sign as sign, Offer$1_signatureMsg as signatureMsg, Offer$1_toSnakeCase as toSnakeCase, Offer$1_types as types };
|
|
978
|
+
declare namespace Liquidity_d_exports {
|
|
979
|
+
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
863
980
|
}
|
|
864
|
-
|
|
865
981
|
/**
|
|
866
982
|
* Represents a liquidity pool with a unique ID and amount.
|
|
867
983
|
*/
|
|
868
984
|
type LiquidityPool = {
|
|
869
|
-
|
|
870
|
-
|
|
985
|
+
id: string;
|
|
986
|
+
amount: bigint;
|
|
871
987
|
};
|
|
872
988
|
/**
|
|
873
989
|
* Represents a hierarchical relationship between two liquidity pools.
|
|
874
990
|
*/
|
|
875
991
|
type LiquidityLink = {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
992
|
+
parentPoolId: string;
|
|
993
|
+
childPoolId: string;
|
|
994
|
+
priority: number;
|
|
879
995
|
};
|
|
880
996
|
/**
|
|
881
997
|
* Represents the connection between an offer and its liquidity pools.
|
|
882
998
|
*/
|
|
883
999
|
type OfferLiquidityPool = {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1000
|
+
offerHash: Offer["hash"];
|
|
1001
|
+
poolId: string;
|
|
1002
|
+
/**
|
|
1003
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
1004
|
+
* Meaning varies by pool type:
|
|
1005
|
+
* - BuyWithEmptyCallback: Matches allowance amount from pool bellow
|
|
1006
|
+
* - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
|
|
1007
|
+
* - SellERC20Callback: Existing debt as negative value (reduces available capacity)
|
|
1008
|
+
*/
|
|
1009
|
+
amount: bigint;
|
|
894
1010
|
};
|
|
895
1011
|
/**
|
|
896
1012
|
* Calculate maximum debt capacity from collateral amount.
|
|
@@ -904,28 +1020,28 @@ declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: big
|
|
|
904
1020
|
* Generate pool ID for balance pools.
|
|
905
1021
|
*/
|
|
906
1022
|
declare function generateBalancePoolId(parameters: {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1023
|
+
user: Address;
|
|
1024
|
+
chainId: Id;
|
|
1025
|
+
token: Address;
|
|
910
1026
|
}): string;
|
|
911
1027
|
/**
|
|
912
1028
|
* Generate pool ID for allowance pools.
|
|
913
1029
|
*/
|
|
914
1030
|
declare function generateAllowancePoolId(parameters: {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1031
|
+
user: Address;
|
|
1032
|
+
chainId: Id;
|
|
1033
|
+
token: Address;
|
|
918
1034
|
}): string;
|
|
919
1035
|
/**
|
|
920
1036
|
* Generate pool ID for sell ERC20 callback pools.
|
|
921
1037
|
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
922
1038
|
*/
|
|
923
1039
|
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1040
|
+
user: Address;
|
|
1041
|
+
chainId: Id;
|
|
1042
|
+
obligationId: Hex;
|
|
1043
|
+
token: Address;
|
|
1044
|
+
offerHash: Hex;
|
|
929
1045
|
}): string;
|
|
930
1046
|
/**
|
|
931
1047
|
* Generate pool ID for obligation collateral pools.
|
|
@@ -933,89 +1049,74 @@ declare function generateSellERC20CallbackPoolId(parameters: {
|
|
|
933
1049
|
* These pools are shared across all offers with the same obligation.
|
|
934
1050
|
*/
|
|
935
1051
|
declare function generateObligationCollateralPoolId(parameters: {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1052
|
+
user: Address;
|
|
1053
|
+
chainId: Id;
|
|
1054
|
+
obligationId: Hex;
|
|
1055
|
+
token: Address;
|
|
940
1056
|
}): string;
|
|
941
1057
|
/**
|
|
942
1058
|
* Generate pool ID for buy vault callback pools.
|
|
943
1059
|
*/
|
|
944
1060
|
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1061
|
+
user: Address;
|
|
1062
|
+
chainId: Id;
|
|
1063
|
+
vault: Address;
|
|
1064
|
+
offerHash: Hex;
|
|
949
1065
|
}): string;
|
|
950
1066
|
/**
|
|
951
1067
|
* Generate pool ID for debt pools.
|
|
952
1068
|
*/
|
|
953
1069
|
declare function generateDebtPoolId(parameters: {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1070
|
+
user: Address;
|
|
1071
|
+
chainId: Id;
|
|
1072
|
+
obligationId: Hex;
|
|
957
1073
|
}): string;
|
|
958
1074
|
/**
|
|
959
1075
|
* Generate pool ID for user position in a vault.
|
|
960
1076
|
*/
|
|
961
1077
|
declare function generateUserVaultPositionPoolId(parameters: {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1078
|
+
user: Address;
|
|
1079
|
+
chainId: Id;
|
|
1080
|
+
vault: Address;
|
|
965
1081
|
}): string;
|
|
966
1082
|
/**
|
|
967
1083
|
* Generate pool ID for vault position in a market.
|
|
968
1084
|
*/
|
|
969
1085
|
declare function generateVaultPositionPoolId(parameters: {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1086
|
+
vault: Address;
|
|
1087
|
+
chainId: Id;
|
|
1088
|
+
marketId: string;
|
|
973
1089
|
}): string;
|
|
974
1090
|
/**
|
|
975
1091
|
* Generate pool ID for market total liquidity.
|
|
976
1092
|
*/
|
|
977
1093
|
declare function generateMarketLiquidityPoolId(parameters: {
|
|
978
|
-
|
|
979
|
-
|
|
1094
|
+
chainId: Id;
|
|
1095
|
+
marketId: string;
|
|
980
1096
|
}): string;
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
type Liquidity_LiquidityPool = LiquidityPool;
|
|
984
|
-
type Liquidity_OfferLiquidityPool = OfferLiquidityPool;
|
|
985
|
-
declare const Liquidity_calculateMaxDebt: typeof calculateMaxDebt;
|
|
986
|
-
declare const Liquidity_generateAllowancePoolId: typeof generateAllowancePoolId;
|
|
987
|
-
declare const Liquidity_generateBalancePoolId: typeof generateBalancePoolId;
|
|
988
|
-
declare const Liquidity_generateBuyVaultCallbackPoolId: typeof generateBuyVaultCallbackPoolId;
|
|
989
|
-
declare const Liquidity_generateDebtPoolId: typeof generateDebtPoolId;
|
|
990
|
-
declare const Liquidity_generateMarketLiquidityPoolId: typeof generateMarketLiquidityPoolId;
|
|
991
|
-
declare const Liquidity_generateObligationCollateralPoolId: typeof generateObligationCollateralPoolId;
|
|
992
|
-
declare const Liquidity_generateSellERC20CallbackPoolId: typeof generateSellERC20CallbackPoolId;
|
|
993
|
-
declare const Liquidity_generateUserVaultPositionPoolId: typeof generateUserVaultPositionPoolId;
|
|
994
|
-
declare const Liquidity_generateVaultPositionPoolId: typeof generateVaultPositionPoolId;
|
|
995
|
-
declare namespace Liquidity {
|
|
996
|
-
export { type Liquidity_LiquidityLink as LiquidityLink, type Liquidity_LiquidityPool as LiquidityPool, type Liquidity_OfferLiquidityPool as OfferLiquidityPool, Liquidity_calculateMaxDebt as calculateMaxDebt, Liquidity_generateAllowancePoolId as generateAllowancePoolId, Liquidity_generateBalancePoolId as generateBalancePoolId, Liquidity_generateBuyVaultCallbackPoolId as generateBuyVaultCallbackPoolId, Liquidity_generateDebtPoolId as generateDebtPoolId, Liquidity_generateMarketLiquidityPoolId as generateMarketLiquidityPoolId, Liquidity_generateObligationCollateralPoolId as generateObligationCollateralPoolId, Liquidity_generateSellERC20CallbackPoolId as generateSellERC20CallbackPoolId, Liquidity_generateUserVaultPositionPoolId as generateUserVaultPositionPoolId, Liquidity_generateVaultPositionPoolId as generateVaultPositionPoolId };
|
|
1097
|
+
declare namespace Obligation_d_exports {
|
|
1098
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$8 as from, fromSnakeCase$1 as fromSnakeCase, id, random$1 as random };
|
|
997
1099
|
}
|
|
998
|
-
|
|
999
1100
|
type Obligation = {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1101
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
1102
|
+
chainId: Id;
|
|
1103
|
+
/** The token that is being borrowed for this obligation. */
|
|
1104
|
+
loanToken: Address;
|
|
1105
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
1106
|
+
collaterals: Collateral[];
|
|
1107
|
+
/** The maturity of the obligation. */
|
|
1108
|
+
maturity: Maturity;
|
|
1008
1109
|
};
|
|
1009
|
-
declare const ObligationSchema: z.ZodObject<{
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
}, z.core.$strip>;
|
|
1110
|
+
declare const ObligationSchema: z$1.ZodObject<{
|
|
1111
|
+
chainId: z$1.ZodNumber;
|
|
1112
|
+
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1113
|
+
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1114
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1115
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1116
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1117
|
+
}, z$1.core.$strip>>;
|
|
1118
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1119
|
+
}, z$1.core.$strip>;
|
|
1019
1120
|
/**
|
|
1020
1121
|
* Creates an obligation from the given parameters.
|
|
1021
1122
|
* @constructor
|
|
@@ -1026,7 +1127,7 @@ declare const ObligationSchema: z.ZodObject<{
|
|
|
1026
1127
|
* @example
|
|
1027
1128
|
* ```ts
|
|
1028
1129
|
* const obligation = Obligation.from({
|
|
1029
|
-
* chainId:
|
|
1130
|
+
* chainId: 1,
|
|
1030
1131
|
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1031
1132
|
* collaterals: [
|
|
1032
1133
|
* Collateral.from({
|
|
@@ -1039,20 +1140,20 @@ declare const ObligationSchema: z.ZodObject<{
|
|
|
1039
1140
|
* });
|
|
1040
1141
|
* ```
|
|
1041
1142
|
*/
|
|
1042
|
-
declare function from$
|
|
1043
|
-
declare namespace from$
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1143
|
+
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1144
|
+
declare namespace from$8 {
|
|
1145
|
+
type Parameters = {
|
|
1146
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
1147
|
+
chainId: number;
|
|
1148
|
+
/** The token that is being borrowed for this obligation. */
|
|
1149
|
+
loanToken: Address;
|
|
1150
|
+
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1151
|
+
collaterals: from$11.Parameters[] | readonly from$11.Parameters[];
|
|
1152
|
+
/** The maturity of the obligation. */
|
|
1153
|
+
maturity: from$10.Parameters;
|
|
1154
|
+
};
|
|
1155
|
+
type ReturnType = Obligation;
|
|
1156
|
+
type ErrorType = InvalidObligationError;
|
|
1056
1157
|
}
|
|
1057
1158
|
/**
|
|
1058
1159
|
* Creates an obligation from a snake case object.
|
|
@@ -1062,9 +1163,11 @@ declare namespace from$5 {
|
|
|
1062
1163
|
*/
|
|
1063
1164
|
declare function fromSnakeCase$1(input: fromSnakeCase$1.Parameters): fromSnakeCase$1.ReturnType;
|
|
1064
1165
|
declare namespace fromSnakeCase$1 {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1166
|
+
type Parameters = Snake<Omit<Obligation, "chainId"> & {
|
|
1167
|
+
chainId: number;
|
|
1168
|
+
}>;
|
|
1169
|
+
type ReturnType = Obligation;
|
|
1170
|
+
type ErrorType = InvalidObligationError;
|
|
1068
1171
|
}
|
|
1069
1172
|
/**
|
|
1070
1173
|
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
@@ -1082,9 +1185,9 @@ declare namespace fromSnakeCase$1 {
|
|
|
1082
1185
|
*/
|
|
1083
1186
|
declare function id(obligation: id.Parameters): id.ReturnType;
|
|
1084
1187
|
declare namespace id {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1188
|
+
type Parameters = Obligation;
|
|
1189
|
+
type ReturnType = Hex;
|
|
1190
|
+
type ErrorType = CollateralsAreNotSortedError;
|
|
1088
1191
|
}
|
|
1089
1192
|
/**
|
|
1090
1193
|
* Generates a random obligation.
|
|
@@ -1097,49 +1200,150 @@ declare namespace id {
|
|
|
1097
1200
|
*/
|
|
1098
1201
|
declare function random$1(): random$1.ReturnType;
|
|
1099
1202
|
declare namespace random$1 {
|
|
1100
|
-
|
|
1203
|
+
type ReturnType = Obligation;
|
|
1101
1204
|
}
|
|
1102
|
-
declare class InvalidObligationError extends BaseError<z.ZodError | Error> {
|
|
1103
|
-
|
|
1104
|
-
|
|
1205
|
+
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1206
|
+
readonly name = "Obligation.InvalidObligationError";
|
|
1207
|
+
constructor(error: z$1.ZodError | Error);
|
|
1105
1208
|
}
|
|
1106
1209
|
declare class CollateralsAreNotSortedError extends BaseError {
|
|
1107
|
-
|
|
1108
|
-
|
|
1210
|
+
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1211
|
+
constructor();
|
|
1109
1212
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1213
|
+
declare namespace Oracle_d_exports {
|
|
1214
|
+
export { Conversion, Oracle, from$7 as from };
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* An oracle contract that provides price information for assets.
|
|
1218
|
+
*/
|
|
1219
|
+
type Oracle = {
|
|
1220
|
+
/** The chain id where the oracle is deployed. */
|
|
1221
|
+
readonly chainId: Id;
|
|
1222
|
+
/** The address of the oracle contract. */
|
|
1223
|
+
readonly address: Address;
|
|
1224
|
+
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1225
|
+
readonly price: bigint | null;
|
|
1226
|
+
/** The block number at which the price was fetched. */
|
|
1227
|
+
readonly blockNumber: number;
|
|
1228
|
+
};
|
|
1229
|
+
/**
|
|
1230
|
+
* Create an Oracle from a plain object.
|
|
1231
|
+
* @param data - The data to create the oracle from.
|
|
1232
|
+
* @returns The created oracle.
|
|
1233
|
+
*/
|
|
1234
|
+
declare function from$7(data: from$7.Parameters): from$7.ReturnType;
|
|
1235
|
+
declare namespace from$7 {
|
|
1236
|
+
type Parameters = {
|
|
1237
|
+
chainId: Id;
|
|
1238
|
+
address: Address;
|
|
1239
|
+
price: string | null;
|
|
1240
|
+
blockNumber: number;
|
|
1241
|
+
};
|
|
1242
|
+
type ReturnType = Oracle;
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* Conversion utilities for converting between collateral and loan token amounts
|
|
1246
|
+
* using oracle prices and LLTV
|
|
1247
|
+
*/
|
|
1248
|
+
declare namespace Conversion {
|
|
1249
|
+
/**
|
|
1250
|
+
* Converts a collateral amount to loan token
|
|
1251
|
+
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
1252
|
+
*
|
|
1253
|
+
* @param amount - The collateral amount to convert
|
|
1254
|
+
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1255
|
+
* @returns The equivalent loan token amount
|
|
1256
|
+
*/
|
|
1257
|
+
function collateralToLoan(amount: bigint, params: {
|
|
1258
|
+
price: bigint;
|
|
1259
|
+
lltv: bigint;
|
|
1260
|
+
}): bigint;
|
|
1261
|
+
/**
|
|
1262
|
+
* Converts a loan token amount to collateral
|
|
1263
|
+
* Uses the inverse formula: (amount * 10^36 / price) * 10^18 / lltv
|
|
1264
|
+
* Returns 0n if price or lltv is zero (invalid conversion).
|
|
1265
|
+
*
|
|
1266
|
+
* @param amount - The loan token amount to convert
|
|
1267
|
+
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1268
|
+
* @returns The equivalent collateral amount, or 0n if conversion is invalid
|
|
1269
|
+
*/
|
|
1270
|
+
function loanToCollateral(amount: bigint, params: {
|
|
1271
|
+
price: bigint;
|
|
1272
|
+
lltv: bigint;
|
|
1273
|
+
}): bigint;
|
|
1274
|
+
}
|
|
1275
|
+
declare namespace Position_d_exports {
|
|
1276
|
+
export { Position, Type, from$6 as from };
|
|
1277
|
+
}
|
|
1278
|
+
type Position = {
|
|
1279
|
+
/** The chain id. */
|
|
1280
|
+
chainId: Id;
|
|
1281
|
+
/** The contract address from which the position is called.
|
|
1282
|
+
* While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
|
|
1283
|
+
* 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.
|
|
1284
|
+
*/
|
|
1285
|
+
contract: Address;
|
|
1286
|
+
/** The user address. */
|
|
1287
|
+
user: Address;
|
|
1288
|
+
/** The type of position. */
|
|
1289
|
+
type: Type;
|
|
1290
|
+
/** The balance of the position. */
|
|
1291
|
+
balance?: bigint;
|
|
1292
|
+
/** The underlying asset of the position.
|
|
1293
|
+
* For ERC20 positions, this equals the contract address.
|
|
1294
|
+
* For vault positions, this is the vault's underlying asset.
|
|
1295
|
+
*/
|
|
1296
|
+
asset?: Address;
|
|
1297
|
+
/** The block number at which the position was last updated. */
|
|
1298
|
+
blockNumber: number;
|
|
1299
|
+
};
|
|
1300
|
+
declare enum Type {
|
|
1301
|
+
ERC20 = "erc20",
|
|
1302
|
+
VAULT_V1 = "vault_v1",
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* @constructor
|
|
1306
|
+
* Creates a Position.
|
|
1307
|
+
* @param parameters - {@link from.Parameters}
|
|
1308
|
+
* @returns The created Position. {@link from.ReturnType}
|
|
1309
|
+
*/
|
|
1310
|
+
declare function from$6(parameters: from$6.Parameters): from$6.ReturnType;
|
|
1311
|
+
declare namespace from$6 {
|
|
1312
|
+
type Parameters = {
|
|
1313
|
+
chainId: Id;
|
|
1314
|
+
contract: Address;
|
|
1315
|
+
user: Address;
|
|
1316
|
+
type: Type;
|
|
1317
|
+
balance?: bigint;
|
|
1318
|
+
asset?: Address;
|
|
1319
|
+
blockNumber: number;
|
|
1320
|
+
};
|
|
1321
|
+
type ReturnType = Position;
|
|
1322
|
+
}
|
|
1323
|
+
declare namespace Quote_d_exports {
|
|
1324
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$5 as from, fromSnakeCase, random };
|
|
1120
1325
|
}
|
|
1121
|
-
|
|
1122
1326
|
type Quote = {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1327
|
+
/** The obligation id. */
|
|
1328
|
+
obligationId: Hex;
|
|
1329
|
+
ask: {
|
|
1330
|
+
/** The highest interest rate the seller will accept to pay for the obligation. (18 decimals). */
|
|
1331
|
+
rate: bigint;
|
|
1332
|
+
};
|
|
1333
|
+
bid: {
|
|
1334
|
+
/** The lowest interest rate a buyer is willing to be paid for the obligation. (18 decimals). */
|
|
1335
|
+
rate: bigint;
|
|
1336
|
+
};
|
|
1133
1337
|
};
|
|
1134
|
-
declare const QuoteSchema: z.ZodObject<{
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
}, z.core.$strip>;
|
|
1338
|
+
declare const QuoteSchema: z$1.ZodObject<{
|
|
1339
|
+
obligationId: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1340
|
+
ask: z$1.ZodObject<{
|
|
1341
|
+
rate: z$1.ZodBigInt;
|
|
1342
|
+
}, z$1.core.$strip>;
|
|
1343
|
+
bid: z$1.ZodObject<{
|
|
1344
|
+
rate: z$1.ZodBigInt;
|
|
1345
|
+
}, z$1.core.$strip>;
|
|
1346
|
+
}, z$1.core.$strip>;
|
|
1143
1347
|
/**
|
|
1144
1348
|
* Creates a quote for a given obligation.
|
|
1145
1349
|
* @constructor
|
|
@@ -1152,11 +1356,11 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
1152
1356
|
* const quote = Quote.from({ obligationId: "0x123", ask: { assets: 100n, rate: 100n }, bid: { assets: 100n, rate: 100n } });
|
|
1153
1357
|
* ```
|
|
1154
1358
|
*/
|
|
1155
|
-
declare function from$
|
|
1156
|
-
declare namespace from$
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1359
|
+
declare function from$5(parameters: from$5.Parameters): from$5.ReturnType;
|
|
1360
|
+
declare namespace from$5 {
|
|
1361
|
+
type Parameters = Quote;
|
|
1362
|
+
type ReturnType = Quote;
|
|
1363
|
+
type ErrorType = InvalidQuoteError;
|
|
1160
1364
|
}
|
|
1161
1365
|
/**
|
|
1162
1366
|
* Creates a quote from a snake case object.
|
|
@@ -1166,9 +1370,9 @@ declare namespace from$4 {
|
|
|
1166
1370
|
*/
|
|
1167
1371
|
declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
1168
1372
|
declare namespace fromSnakeCase {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1373
|
+
type Parameters = Snake<Quote>;
|
|
1374
|
+
type ReturnType = Quote;
|
|
1375
|
+
type ErrorType = from$5.ErrorType;
|
|
1172
1376
|
}
|
|
1173
1377
|
/**
|
|
1174
1378
|
* Generates a random quote.
|
|
@@ -1181,28 +1385,57 @@ declare namespace fromSnakeCase {
|
|
|
1181
1385
|
*/
|
|
1182
1386
|
declare function random(): random.ReturnType;
|
|
1183
1387
|
declare namespace random {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
}
|
|
1188
|
-
declare class InvalidQuoteError extends BaseError<z.ZodError | Error> {
|
|
1189
|
-
|
|
1190
|
-
|
|
1388
|
+
type Parameters = never;
|
|
1389
|
+
type ReturnType = Quote;
|
|
1390
|
+
type ErrorType = from$5.ErrorType;
|
|
1391
|
+
}
|
|
1392
|
+
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1393
|
+
readonly name = "Quote.InvalidQuoteError";
|
|
1394
|
+
constructor(error: z$1.ZodError | Error);
|
|
1395
|
+
}
|
|
1396
|
+
declare namespace Transfer_d_exports {
|
|
1397
|
+
export { Transfer, from$4 as from };
|
|
1398
|
+
}
|
|
1399
|
+
type Transfer = {
|
|
1400
|
+
id: string;
|
|
1401
|
+
chainId: Id;
|
|
1402
|
+
contract: Address;
|
|
1403
|
+
from: Address;
|
|
1404
|
+
to: Address;
|
|
1405
|
+
value: bigint;
|
|
1406
|
+
blockNumber: number;
|
|
1407
|
+
};
|
|
1408
|
+
/**
|
|
1409
|
+
* @constructor
|
|
1410
|
+
*
|
|
1411
|
+
* Creates a {@link Transfer}.
|
|
1412
|
+
* @param parameters - {@link from.Parameters}
|
|
1413
|
+
* @returns The created Transfer. {@link from.ReturnType}
|
|
1414
|
+
*
|
|
1415
|
+
* @example
|
|
1416
|
+
* ```ts
|
|
1417
|
+
* const transfer = Transfer.from({ id: "1", chainId: 1, contract: "0x123", from: "0x456", to: "0x789", value: 100n, blockNumber: 100n });
|
|
1418
|
+
* ```
|
|
1419
|
+
*/
|
|
1420
|
+
declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
|
|
1421
|
+
declare namespace from$4 {
|
|
1422
|
+
type Parameters = {
|
|
1423
|
+
id: string;
|
|
1424
|
+
chainId: Id;
|
|
1425
|
+
contract: Address;
|
|
1426
|
+
from: Address;
|
|
1427
|
+
to: Address;
|
|
1428
|
+
value: bigint;
|
|
1429
|
+
blockNumber: number;
|
|
1430
|
+
};
|
|
1431
|
+
type ReturnType = Transfer;
|
|
1191
1432
|
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
declare const Quote$1_InvalidQuoteError: typeof InvalidQuoteError;
|
|
1195
|
-
type Quote$1_Quote = Quote;
|
|
1196
|
-
declare const Quote$1_QuoteSchema: typeof QuoteSchema;
|
|
1197
|
-
declare const Quote$1_fromSnakeCase: typeof fromSnakeCase;
|
|
1198
|
-
declare const Quote$1_random: typeof random;
|
|
1199
|
-
declare namespace Quote$1 {
|
|
1200
|
-
export { Quote$1_InvalidQuoteError as InvalidQuoteError, type Quote$1_Quote as Quote, Quote$1_QuoteSchema as QuoteSchema, from$4 as from, Quote$1_fromSnakeCase as fromSnakeCase, Quote$1_random as random };
|
|
1433
|
+
declare namespace Tree_d_exports {
|
|
1434
|
+
export { Tree, VERSION, decode$1 as decode, encode$1 as encode, from$3 as from };
|
|
1201
1435
|
}
|
|
1202
|
-
|
|
1203
1436
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1204
|
-
|
|
1205
|
-
|
|
1437
|
+
offers: Offer[];
|
|
1438
|
+
root: Hex;
|
|
1206
1439
|
}>;
|
|
1207
1440
|
declare const VERSION = 1;
|
|
1208
1441
|
/**
|
|
@@ -1238,565 +1471,761 @@ declare const encode$1: (tree: Tree) => Hex;
|
|
|
1238
1471
|
* @throws Error if the version is invalid or the root does not match the offers.
|
|
1239
1472
|
*/
|
|
1240
1473
|
declare const decode$1: (encoded: Hex) => Tree;
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
declare const Tree$1_VERSION: typeof VERSION;
|
|
1244
|
-
declare namespace Tree$1 {
|
|
1245
|
-
export { type Tree$1_Tree as Tree, Tree$1_VERSION as VERSION, decode$1 as decode, encode$1 as encode, from$3 as from };
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1474
|
+
//#endregion
|
|
1475
|
+
//#region src/api/Schema/generated/swagger.d.ts
|
|
1248
1476
|
/**
|
|
1249
1477
|
* This file was auto-generated by openapi-typescript.
|
|
1250
1478
|
* Do not make direct changes to the file.
|
|
1251
1479
|
*/
|
|
1252
1480
|
|
|
1253
1481
|
interface paths {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
};
|
|
1261
|
-
/**
|
|
1262
|
-
* List all offers
|
|
1263
|
-
* @description Returns a list of offers for a given obligation and side. Offers are sorted by the best rate (depending on the side), their block number (older offers first) and their assets (bigger offers first).
|
|
1264
|
-
*/
|
|
1265
|
-
get: {
|
|
1266
|
-
parameters: {
|
|
1267
|
-
query: {
|
|
1268
|
-
/**
|
|
1269
|
-
* @description Maximum number of offers to return.
|
|
1270
|
-
* @example 10
|
|
1271
|
-
*/
|
|
1272
|
-
limit?: number;
|
|
1273
|
-
/**
|
|
1274
|
-
* @description Pagination cursor in base64url-encoded format.
|
|
1275
|
-
* @example eyJvZmZzZXQiOjEwMH0
|
|
1276
|
-
*/
|
|
1277
|
-
cursor?: string;
|
|
1278
|
-
/**
|
|
1279
|
-
* @description Obligation id used to filter offers.
|
|
1280
|
-
* @example 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1281
|
-
*/
|
|
1282
|
-
obligation_id: string;
|
|
1283
|
-
/** @example buy */
|
|
1284
|
-
side: "buy" | "sell";
|
|
1285
|
-
};
|
|
1286
|
-
header?: never;
|
|
1287
|
-
path?: never;
|
|
1288
|
-
cookie?: never;
|
|
1289
|
-
};
|
|
1290
|
-
requestBody?: never;
|
|
1291
|
-
responses: {
|
|
1292
|
-
/** @description Success */
|
|
1293
|
-
200: {
|
|
1294
|
-
headers: {
|
|
1295
|
-
[name: string]: unknown;
|
|
1296
|
-
};
|
|
1297
|
-
content: {
|
|
1298
|
-
"application/json": components["schemas"]["OfferListResponse"];
|
|
1299
|
-
};
|
|
1300
|
-
};
|
|
1301
|
-
/** @description Bad Request */
|
|
1302
|
-
400: {
|
|
1303
|
-
headers: {
|
|
1304
|
-
[name: string]: unknown;
|
|
1305
|
-
};
|
|
1306
|
-
content: {
|
|
1307
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1308
|
-
};
|
|
1309
|
-
};
|
|
1310
|
-
};
|
|
1311
|
-
};
|
|
1312
|
-
put?: never;
|
|
1313
|
-
post?: never;
|
|
1314
|
-
delete?: never;
|
|
1315
|
-
options?: never;
|
|
1316
|
-
head?: never;
|
|
1317
|
-
patch?: never;
|
|
1318
|
-
trace?: never;
|
|
1482
|
+
"/v1/books/{obligationId}/{side}": {
|
|
1483
|
+
parameters: {
|
|
1484
|
+
query?: never;
|
|
1485
|
+
header?: never;
|
|
1486
|
+
path?: never;
|
|
1487
|
+
cookie?: never;
|
|
1319
1488
|
};
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1489
|
+
/**
|
|
1490
|
+
* Get aggregated book
|
|
1491
|
+
* @description Returns aggregated book data for a given obligation and side. Offers are grouped by rate with summed takeable amounts. Book levels are sorted by rate (ascending for buy side, descending for sell side).
|
|
1492
|
+
*/
|
|
1493
|
+
get: {
|
|
1494
|
+
parameters: {
|
|
1495
|
+
query?: {
|
|
1496
|
+
/**
|
|
1497
|
+
* @description Maximum number of rate levels to return.
|
|
1498
|
+
* @example 10
|
|
1499
|
+
*/
|
|
1500
|
+
limit?: number;
|
|
1501
|
+
/**
|
|
1502
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
1503
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
1504
|
+
*/
|
|
1505
|
+
cursor?: string;
|
|
1326
1506
|
};
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
cookie?: never;
|
|
1342
|
-
};
|
|
1343
|
-
requestBody?: never;
|
|
1344
|
-
responses: {
|
|
1345
|
-
/** @description Success */
|
|
1346
|
-
200: {
|
|
1347
|
-
headers: {
|
|
1348
|
-
[name: string]: unknown;
|
|
1349
|
-
};
|
|
1350
|
-
content: {
|
|
1351
|
-
"application/json": components["schemas"]["ObligationListResponse"];
|
|
1352
|
-
};
|
|
1353
|
-
};
|
|
1354
|
-
/** @description Bad Request */
|
|
1355
|
-
400: {
|
|
1356
|
-
headers: {
|
|
1357
|
-
[name: string]: unknown;
|
|
1358
|
-
};
|
|
1359
|
-
content: {
|
|
1360
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1361
|
-
};
|
|
1362
|
-
};
|
|
1363
|
-
};
|
|
1507
|
+
header?: never;
|
|
1508
|
+
path?: never;
|
|
1509
|
+
cookie?: never;
|
|
1510
|
+
};
|
|
1511
|
+
requestBody?: never;
|
|
1512
|
+
responses: {
|
|
1513
|
+
/** @description Success */
|
|
1514
|
+
200: {
|
|
1515
|
+
headers: {
|
|
1516
|
+
[name: string]: unknown;
|
|
1517
|
+
};
|
|
1518
|
+
content: {
|
|
1519
|
+
"application/json": components["schemas"]["BookListResponse"];
|
|
1520
|
+
};
|
|
1364
1521
|
};
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
"/v1/obligations/{obligationId}": {
|
|
1374
|
-
parameters: {
|
|
1375
|
-
query?: never;
|
|
1376
|
-
header?: never;
|
|
1377
|
-
path?: never;
|
|
1378
|
-
cookie?: never;
|
|
1522
|
+
/** @description Bad Request */
|
|
1523
|
+
400: {
|
|
1524
|
+
headers: {
|
|
1525
|
+
[name: string]: unknown;
|
|
1526
|
+
};
|
|
1527
|
+
content: {
|
|
1528
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1529
|
+
};
|
|
1379
1530
|
};
|
|
1380
|
-
|
|
1381
|
-
* Get an obligation
|
|
1382
|
-
* @description Returns an obligation by its id.
|
|
1383
|
-
*/
|
|
1384
|
-
get: {
|
|
1385
|
-
parameters: {
|
|
1386
|
-
query?: never;
|
|
1387
|
-
header?: never;
|
|
1388
|
-
path?: never;
|
|
1389
|
-
cookie?: never;
|
|
1390
|
-
};
|
|
1391
|
-
requestBody?: never;
|
|
1392
|
-
responses: {
|
|
1393
|
-
/** @description Success */
|
|
1394
|
-
200: {
|
|
1395
|
-
headers: {
|
|
1396
|
-
[name: string]: unknown;
|
|
1397
|
-
};
|
|
1398
|
-
content: {
|
|
1399
|
-
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
1400
|
-
};
|
|
1401
|
-
};
|
|
1402
|
-
/** @description Bad Request */
|
|
1403
|
-
400: {
|
|
1404
|
-
headers: {
|
|
1405
|
-
[name: string]: unknown;
|
|
1406
|
-
};
|
|
1407
|
-
content: {
|
|
1408
|
-
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1409
|
-
};
|
|
1410
|
-
};
|
|
1411
|
-
};
|
|
1412
|
-
};
|
|
1413
|
-
put?: never;
|
|
1414
|
-
post?: never;
|
|
1415
|
-
delete?: never;
|
|
1416
|
-
options?: never;
|
|
1417
|
-
head?: never;
|
|
1418
|
-
patch?: never;
|
|
1419
|
-
trace?: never;
|
|
1531
|
+
};
|
|
1420
1532
|
};
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
header?: never;
|
|
1436
|
-
path?: never;
|
|
1437
|
-
cookie?: never;
|
|
1438
|
-
};
|
|
1439
|
-
requestBody?: never;
|
|
1440
|
-
responses: {
|
|
1441
|
-
/** @description Success */
|
|
1442
|
-
200: {
|
|
1443
|
-
headers: {
|
|
1444
|
-
[name: string]: unknown;
|
|
1445
|
-
};
|
|
1446
|
-
content: {
|
|
1447
|
-
"application/json": components["schemas"]["RouterStatusSuccessResponse"];
|
|
1448
|
-
};
|
|
1449
|
-
};
|
|
1450
|
-
};
|
|
1451
|
-
};
|
|
1452
|
-
put?: never;
|
|
1453
|
-
post?: never;
|
|
1454
|
-
delete?: never;
|
|
1455
|
-
options?: never;
|
|
1456
|
-
head?: never;
|
|
1457
|
-
patch?: never;
|
|
1458
|
-
trace?: never;
|
|
1533
|
+
put?: never;
|
|
1534
|
+
post?: never;
|
|
1535
|
+
delete?: never;
|
|
1536
|
+
options?: never;
|
|
1537
|
+
head?: never;
|
|
1538
|
+
patch?: never;
|
|
1539
|
+
trace?: never;
|
|
1540
|
+
};
|
|
1541
|
+
"/v1/offers": {
|
|
1542
|
+
parameters: {
|
|
1543
|
+
query?: never;
|
|
1544
|
+
header?: never;
|
|
1545
|
+
path?: never;
|
|
1546
|
+
cookie?: never;
|
|
1459
1547
|
};
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1548
|
+
/**
|
|
1549
|
+
* List all offers
|
|
1550
|
+
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `offering` (by maker).
|
|
1551
|
+
*/
|
|
1552
|
+
get: {
|
|
1553
|
+
parameters: {
|
|
1554
|
+
query?: {
|
|
1555
|
+
/**
|
|
1556
|
+
* @description Maximum number of offers to return.
|
|
1557
|
+
* @example 10
|
|
1558
|
+
*/
|
|
1559
|
+
limit?: number;
|
|
1560
|
+
/**
|
|
1561
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
1562
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
1563
|
+
*/
|
|
1564
|
+
cursor?: string;
|
|
1565
|
+
/**
|
|
1566
|
+
* @description Maker address to filter offers by. Alternative to obligation_id + side.
|
|
1567
|
+
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
1568
|
+
*/
|
|
1569
|
+
offering?: string;
|
|
1570
|
+
/**
|
|
1571
|
+
* @description Obligation id used to filter offers. Required when not using offering.
|
|
1572
|
+
* @example 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1573
|
+
*/
|
|
1574
|
+
obligation_id?: string;
|
|
1575
|
+
/**
|
|
1576
|
+
* @description Side of the offer. Required when using obligation_id.
|
|
1577
|
+
* @example buy
|
|
1578
|
+
*/
|
|
1579
|
+
side?: "buy" | "sell";
|
|
1490
1580
|
};
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1581
|
+
header?: never;
|
|
1582
|
+
path?: never;
|
|
1583
|
+
cookie?: never;
|
|
1584
|
+
};
|
|
1585
|
+
requestBody?: never;
|
|
1586
|
+
responses: {
|
|
1587
|
+
/** @description Success */
|
|
1588
|
+
200: {
|
|
1589
|
+
headers: {
|
|
1590
|
+
[name: string]: unknown;
|
|
1591
|
+
};
|
|
1592
|
+
content: {
|
|
1593
|
+
"application/json": components["schemas"]["OfferListResponse"];
|
|
1594
|
+
};
|
|
1505
1595
|
};
|
|
1506
|
-
/**
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
path?: never;
|
|
1515
|
-
cookie?: never;
|
|
1516
|
-
};
|
|
1517
|
-
requestBody?: never;
|
|
1518
|
-
responses: {
|
|
1519
|
-
/** @description Success */
|
|
1520
|
-
200: {
|
|
1521
|
-
headers: {
|
|
1522
|
-
[name: string]: unknown;
|
|
1523
|
-
};
|
|
1524
|
-
content: {
|
|
1525
|
-
"application/json": components["schemas"]["ChainsHealthSuccessResponse"];
|
|
1526
|
-
};
|
|
1527
|
-
};
|
|
1528
|
-
};
|
|
1596
|
+
/** @description Bad Request */
|
|
1597
|
+
400: {
|
|
1598
|
+
headers: {
|
|
1599
|
+
[name: string]: unknown;
|
|
1600
|
+
};
|
|
1601
|
+
content: {
|
|
1602
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1603
|
+
};
|
|
1529
1604
|
};
|
|
1530
|
-
|
|
1531
|
-
post?: never;
|
|
1532
|
-
delete?: never;
|
|
1533
|
-
options?: never;
|
|
1534
|
-
head?: never;
|
|
1535
|
-
patch?: never;
|
|
1536
|
-
trace?: never;
|
|
1605
|
+
};
|
|
1537
1606
|
};
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
1565
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
1566
|
-
* "lltv": "860000000000000000"
|
|
1567
|
-
* }
|
|
1568
|
-
* ],
|
|
1569
|
-
* "callback": {
|
|
1570
|
-
* "address": "0x1111111111111111111111111111111111111111",
|
|
1571
|
-
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
1572
|
-
* "gas_limit": "500000"
|
|
1573
|
-
* },
|
|
1574
|
-
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
|
|
1575
|
-
* "consumed": "0",
|
|
1576
|
-
* "block_number": 2942933377146801
|
|
1577
|
-
* }
|
|
1578
|
-
* ]
|
|
1579
|
-
*/
|
|
1580
|
-
data: components["schemas"]["OfferListItemResponse"][];
|
|
1581
|
-
};
|
|
1582
|
-
Meta: {
|
|
1583
|
-
/** @example 2024-01-01T12:00:00.000Z */
|
|
1584
|
-
timestamp: string;
|
|
1585
|
-
};
|
|
1586
|
-
OfferListItemResponse: {
|
|
1587
|
-
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
1588
|
-
hash: string;
|
|
1589
|
-
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
1590
|
-
offering: string;
|
|
1591
|
-
/** @example 369216000000000000000000 */
|
|
1592
|
-
assets: string;
|
|
1593
|
-
/** @example 2750000000000000000 */
|
|
1594
|
-
rate: string;
|
|
1595
|
-
/** @example 1761922799 */
|
|
1596
|
-
maturity: number;
|
|
1597
|
-
/** @example 1761922799 */
|
|
1598
|
-
expiry: number;
|
|
1599
|
-
/** @example 1761922790 */
|
|
1600
|
-
start: number;
|
|
1601
|
-
/** @example 571380 */
|
|
1602
|
-
nonce: string;
|
|
1603
|
-
/** @example false */
|
|
1604
|
-
buy: boolean;
|
|
1605
|
-
/** @example 1 */
|
|
1606
|
-
chain_id: string;
|
|
1607
|
-
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
1608
|
-
loan_token: string;
|
|
1609
|
-
/**
|
|
1610
|
-
* @example [
|
|
1611
|
-
* {
|
|
1612
|
-
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
1613
|
-
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
1614
|
-
* "lltv": "860000000000000000"
|
|
1615
|
-
* }
|
|
1616
|
-
* ]
|
|
1617
|
-
*/
|
|
1618
|
-
collaterals: components["schemas"]["CollateralResponse"][];
|
|
1619
|
-
/**
|
|
1620
|
-
* @example {
|
|
1621
|
-
* "address": "0x1111111111111111111111111111111111111111",
|
|
1622
|
-
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
1623
|
-
* "gas_limit": "500000"
|
|
1624
|
-
* }
|
|
1625
|
-
*/
|
|
1626
|
-
callback: components["schemas"]["OfferCallbackResponse"];
|
|
1627
|
-
/** @example 0 */
|
|
1628
|
-
consumed: string;
|
|
1629
|
-
/** @example 2942933377146801 */
|
|
1630
|
-
block_number: number;
|
|
1631
|
-
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
1632
|
-
signature: string | null;
|
|
1633
|
-
};
|
|
1634
|
-
CollateralResponse: {
|
|
1635
|
-
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
1636
|
-
asset: string;
|
|
1637
|
-
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
1638
|
-
oracle: string;
|
|
1639
|
-
/** @example 860000000000000000 */
|
|
1640
|
-
lltv: string;
|
|
1641
|
-
};
|
|
1642
|
-
OfferCallbackResponse: {
|
|
1643
|
-
/** @example 0x1111111111111111111111111111111111111111 */
|
|
1644
|
-
address: string;
|
|
1645
|
-
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
1646
|
-
data: string;
|
|
1647
|
-
/** @example 500000 */
|
|
1648
|
-
gas_limit: string;
|
|
1649
|
-
};
|
|
1650
|
-
BadRequestResponse: {
|
|
1651
|
-
/** @enum {string} */
|
|
1652
|
-
status: "error";
|
|
1653
|
-
error: components["schemas"]["ErrorResponse"];
|
|
1654
|
-
meta: components["schemas"]["Meta"];
|
|
1655
|
-
};
|
|
1656
|
-
ErrorResponse: {
|
|
1657
|
-
/**
|
|
1658
|
-
* @example VALIDATION_ERROR
|
|
1659
|
-
* @enum {string}
|
|
1660
|
-
*/
|
|
1661
|
-
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
|
|
1662
|
-
/** @example Limit must be greater than 0. */
|
|
1663
|
-
message: string;
|
|
1664
|
-
/**
|
|
1665
|
-
* @example [
|
|
1666
|
-
* {
|
|
1667
|
-
* "field": "limit",
|
|
1668
|
-
* "issue": "Limit must be greater than 0."
|
|
1669
|
-
* }
|
|
1670
|
-
* ]
|
|
1671
|
-
*/
|
|
1672
|
-
details: Record<string, never>;
|
|
1673
|
-
};
|
|
1674
|
-
ObligationListResponse: {
|
|
1675
|
-
/** @enum {string} */
|
|
1676
|
-
status: "success";
|
|
1677
|
-
meta: components["schemas"]["Meta"];
|
|
1678
|
-
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
1679
|
-
cursor: string | null;
|
|
1680
|
-
/** @description List of obligations with takable offers. */
|
|
1681
|
-
data: components["schemas"]["ObligationResponse"][];
|
|
1607
|
+
put?: never;
|
|
1608
|
+
post?: never;
|
|
1609
|
+
delete?: never;
|
|
1610
|
+
options?: never;
|
|
1611
|
+
head?: never;
|
|
1612
|
+
patch?: never;
|
|
1613
|
+
trace?: never;
|
|
1614
|
+
};
|
|
1615
|
+
"/v1/obligations": {
|
|
1616
|
+
parameters: {
|
|
1617
|
+
query?: never;
|
|
1618
|
+
header?: never;
|
|
1619
|
+
path?: never;
|
|
1620
|
+
cookie?: never;
|
|
1621
|
+
};
|
|
1622
|
+
/**
|
|
1623
|
+
* List all obligations
|
|
1624
|
+
* @description Returns a list of obligations with their current best ask and bid. Obligations are sorted by their id in ascending order by default.
|
|
1625
|
+
*/
|
|
1626
|
+
get: {
|
|
1627
|
+
parameters: {
|
|
1628
|
+
query?: {
|
|
1629
|
+
/** @example 10 */
|
|
1630
|
+
limit?: number;
|
|
1631
|
+
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
1632
|
+
cursor?: string;
|
|
1682
1633
|
};
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1634
|
+
header?: never;
|
|
1635
|
+
path?: never;
|
|
1636
|
+
cookie?: never;
|
|
1637
|
+
};
|
|
1638
|
+
requestBody?: never;
|
|
1639
|
+
responses: {
|
|
1640
|
+
/** @description Success */
|
|
1641
|
+
200: {
|
|
1642
|
+
headers: {
|
|
1643
|
+
[name: string]: unknown;
|
|
1644
|
+
};
|
|
1645
|
+
content: {
|
|
1646
|
+
"application/json": components["schemas"]["ObligationListResponse"];
|
|
1647
|
+
};
|
|
1695
1648
|
};
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1649
|
+
/** @description Bad Request */
|
|
1650
|
+
400: {
|
|
1651
|
+
headers: {
|
|
1652
|
+
[name: string]: unknown;
|
|
1653
|
+
};
|
|
1654
|
+
content: {
|
|
1655
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1656
|
+
};
|
|
1699
1657
|
};
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1658
|
+
};
|
|
1659
|
+
};
|
|
1660
|
+
put?: never;
|
|
1661
|
+
post?: never;
|
|
1662
|
+
delete?: never;
|
|
1663
|
+
options?: never;
|
|
1664
|
+
head?: never;
|
|
1665
|
+
patch?: never;
|
|
1666
|
+
trace?: never;
|
|
1667
|
+
};
|
|
1668
|
+
"/v1/obligations/{obligationId}": {
|
|
1669
|
+
parameters: {
|
|
1670
|
+
query?: never;
|
|
1671
|
+
header?: never;
|
|
1672
|
+
path?: never;
|
|
1673
|
+
cookie?: never;
|
|
1674
|
+
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Get an obligation
|
|
1677
|
+
* @description Returns an obligation by its id.
|
|
1678
|
+
*/
|
|
1679
|
+
get: {
|
|
1680
|
+
parameters: {
|
|
1681
|
+
query?: never;
|
|
1682
|
+
header?: never;
|
|
1683
|
+
path?: never;
|
|
1684
|
+
cookie?: never;
|
|
1685
|
+
};
|
|
1686
|
+
requestBody?: never;
|
|
1687
|
+
responses: {
|
|
1688
|
+
/** @description Success */
|
|
1689
|
+
200: {
|
|
1690
|
+
headers: {
|
|
1691
|
+
[name: string]: unknown;
|
|
1692
|
+
};
|
|
1693
|
+
content: {
|
|
1694
|
+
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
1695
|
+
};
|
|
1703
1696
|
};
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1697
|
+
/** @description Bad Request */
|
|
1698
|
+
400: {
|
|
1699
|
+
headers: {
|
|
1700
|
+
[name: string]: unknown;
|
|
1701
|
+
};
|
|
1702
|
+
content: {
|
|
1703
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1704
|
+
};
|
|
1712
1705
|
};
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1706
|
+
};
|
|
1707
|
+
};
|
|
1708
|
+
put?: never;
|
|
1709
|
+
post?: never;
|
|
1710
|
+
delete?: never;
|
|
1711
|
+
options?: never;
|
|
1712
|
+
head?: never;
|
|
1713
|
+
patch?: never;
|
|
1714
|
+
trace?: never;
|
|
1715
|
+
};
|
|
1716
|
+
"/v1/health": {
|
|
1717
|
+
parameters: {
|
|
1718
|
+
query?: never;
|
|
1719
|
+
header?: never;
|
|
1720
|
+
path?: never;
|
|
1721
|
+
cookie?: never;
|
|
1722
|
+
};
|
|
1723
|
+
/**
|
|
1724
|
+
* Retrieve global health
|
|
1725
|
+
* @description Returns the aggregated status of the router.
|
|
1726
|
+
*/
|
|
1727
|
+
get: {
|
|
1728
|
+
parameters: {
|
|
1729
|
+
query?: never;
|
|
1730
|
+
header?: never;
|
|
1731
|
+
path?: never;
|
|
1732
|
+
cookie?: never;
|
|
1733
|
+
};
|
|
1734
|
+
requestBody?: never;
|
|
1735
|
+
responses: {
|
|
1736
|
+
/** @description Success */
|
|
1737
|
+
200: {
|
|
1738
|
+
headers: {
|
|
1739
|
+
[name: string]: unknown;
|
|
1740
|
+
};
|
|
1741
|
+
content: {
|
|
1742
|
+
"application/json": components["schemas"]["RouterStatusSuccessResponse"];
|
|
1743
|
+
};
|
|
1724
1744
|
};
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1745
|
+
};
|
|
1746
|
+
};
|
|
1747
|
+
put?: never;
|
|
1748
|
+
post?: never;
|
|
1749
|
+
delete?: never;
|
|
1750
|
+
options?: never;
|
|
1751
|
+
head?: never;
|
|
1752
|
+
patch?: never;
|
|
1753
|
+
trace?: never;
|
|
1754
|
+
};
|
|
1755
|
+
"/v1/health/collectors": {
|
|
1756
|
+
parameters: {
|
|
1757
|
+
query?: never;
|
|
1758
|
+
header?: never;
|
|
1759
|
+
path?: never;
|
|
1760
|
+
cookie?: never;
|
|
1761
|
+
};
|
|
1762
|
+
/**
|
|
1763
|
+
* Retrieve collectors health
|
|
1764
|
+
* @description Returns the latest block numbers processed by collectors and their sync status.
|
|
1765
|
+
*/
|
|
1766
|
+
get: {
|
|
1767
|
+
parameters: {
|
|
1768
|
+
query?: never;
|
|
1769
|
+
header?: never;
|
|
1770
|
+
path?: never;
|
|
1771
|
+
cookie?: never;
|
|
1772
|
+
};
|
|
1773
|
+
requestBody?: never;
|
|
1774
|
+
responses: {
|
|
1775
|
+
/** @description Success */
|
|
1776
|
+
200: {
|
|
1777
|
+
headers: {
|
|
1778
|
+
[name: string]: unknown;
|
|
1779
|
+
};
|
|
1780
|
+
content: {
|
|
1781
|
+
"application/json": components["schemas"]["CollectorsHealthSuccessResponse"];
|
|
1782
|
+
};
|
|
1731
1783
|
};
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1784
|
+
};
|
|
1785
|
+
};
|
|
1786
|
+
put?: never;
|
|
1787
|
+
post?: never;
|
|
1788
|
+
delete?: never;
|
|
1789
|
+
options?: never;
|
|
1790
|
+
head?: never;
|
|
1791
|
+
patch?: never;
|
|
1792
|
+
trace?: never;
|
|
1793
|
+
};
|
|
1794
|
+
"/v1/health/chains": {
|
|
1795
|
+
parameters: {
|
|
1796
|
+
query?: never;
|
|
1797
|
+
header?: never;
|
|
1798
|
+
path?: never;
|
|
1799
|
+
cookie?: never;
|
|
1800
|
+
};
|
|
1801
|
+
/**
|
|
1802
|
+
* Retrieve chains health
|
|
1803
|
+
* @description Returns the latest block that can be processed by collectors for each chain.
|
|
1804
|
+
*/
|
|
1805
|
+
get: {
|
|
1806
|
+
parameters: {
|
|
1807
|
+
query?: never;
|
|
1808
|
+
header?: never;
|
|
1809
|
+
path?: never;
|
|
1810
|
+
cookie?: never;
|
|
1811
|
+
};
|
|
1812
|
+
requestBody?: never;
|
|
1813
|
+
responses: {
|
|
1814
|
+
/** @description Success */
|
|
1815
|
+
200: {
|
|
1816
|
+
headers: {
|
|
1817
|
+
[name: string]: unknown;
|
|
1818
|
+
};
|
|
1819
|
+
content: {
|
|
1820
|
+
"application/json": components["schemas"]["ChainsHealthSuccessResponse"];
|
|
1821
|
+
};
|
|
1750
1822
|
};
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1823
|
+
};
|
|
1824
|
+
};
|
|
1825
|
+
put?: never;
|
|
1826
|
+
post?: never;
|
|
1827
|
+
delete?: never;
|
|
1828
|
+
options?: never;
|
|
1829
|
+
head?: never;
|
|
1830
|
+
patch?: never;
|
|
1831
|
+
trace?: never;
|
|
1832
|
+
};
|
|
1833
|
+
"/v1/validate": {
|
|
1834
|
+
parameters: {
|
|
1835
|
+
query?: never;
|
|
1836
|
+
header?: never;
|
|
1837
|
+
path?: never;
|
|
1838
|
+
cookie?: never;
|
|
1839
|
+
};
|
|
1840
|
+
get?: never;
|
|
1841
|
+
put?: never;
|
|
1842
|
+
/**
|
|
1843
|
+
* Validate offers
|
|
1844
|
+
* @description Validates offers against router validation rules. Returns validation status for each offer.
|
|
1845
|
+
*
|
|
1846
|
+
* **Available validation rules:**
|
|
1847
|
+
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
1848
|
+
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
1849
|
+
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
1850
|
+
* - **callback**: Validates callbacks: buy empty callback is allowed; sell offers must use a non-empty callback; non-empty callbacks must target one of [0x3333333333333333333333333333333333333333, 0x4444444444444444444444444444444444444444, 0x1111111111111111111111111111111111111111, 0x2222222222222222222222222222222222222222]
|
|
1851
|
+
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list
|
|
1852
|
+
*/
|
|
1853
|
+
post: {
|
|
1854
|
+
parameters: {
|
|
1855
|
+
query?: never;
|
|
1856
|
+
header?: never;
|
|
1857
|
+
path?: never;
|
|
1858
|
+
cookie?: never;
|
|
1859
|
+
};
|
|
1860
|
+
requestBody?: {
|
|
1861
|
+
content: {
|
|
1862
|
+
"application/json": components["schemas"]["ValidateOffersRequest"];
|
|
1767
1863
|
};
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
* "updated_at": "2024-01-01T12:00:00.000Z"
|
|
1779
|
-
* }
|
|
1780
|
-
* ]
|
|
1781
|
-
*/
|
|
1782
|
-
data: components["schemas"]["ChainHealthResponse"][];
|
|
1864
|
+
};
|
|
1865
|
+
responses: {
|
|
1866
|
+
/** @description Success */
|
|
1867
|
+
200: {
|
|
1868
|
+
headers: {
|
|
1869
|
+
[name: string]: unknown;
|
|
1870
|
+
};
|
|
1871
|
+
content: {
|
|
1872
|
+
"application/json": components["schemas"]["ValidateOffersListResponse"];
|
|
1873
|
+
};
|
|
1783
1874
|
};
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1875
|
+
/** @description Bad Request */
|
|
1876
|
+
400: {
|
|
1877
|
+
headers: {
|
|
1878
|
+
[name: string]: unknown;
|
|
1879
|
+
};
|
|
1880
|
+
content: {
|
|
1881
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1882
|
+
};
|
|
1791
1883
|
};
|
|
1884
|
+
};
|
|
1792
1885
|
};
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1886
|
+
delete?: never;
|
|
1887
|
+
options?: never;
|
|
1888
|
+
head?: never;
|
|
1889
|
+
patch?: never;
|
|
1890
|
+
trace?: never;
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
interface components {
|
|
1894
|
+
schemas: {
|
|
1895
|
+
BookListResponse: {
|
|
1896
|
+
meta: components["schemas"]["Meta"];
|
|
1897
|
+
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
1898
|
+
cursor: string | null;
|
|
1899
|
+
/** @description Aggregated book levels grouped by rate. */
|
|
1900
|
+
data: components["schemas"]["BookLevelResponse"][];
|
|
1901
|
+
};
|
|
1902
|
+
Meta: {
|
|
1903
|
+
/** @example 2024-01-01T12:00:00.000Z */
|
|
1904
|
+
timestamp: string;
|
|
1905
|
+
};
|
|
1906
|
+
BookLevelResponse: {
|
|
1907
|
+
/** @example 2750000000000000000 */
|
|
1908
|
+
rate: string;
|
|
1909
|
+
/** @example 369216000000000000000000 */
|
|
1910
|
+
assets: string;
|
|
1911
|
+
/** @example 5 */
|
|
1912
|
+
count: number;
|
|
1913
|
+
};
|
|
1914
|
+
BadRequestResponse: {
|
|
1915
|
+
error: components["schemas"]["ErrorResponse"];
|
|
1916
|
+
meta: components["schemas"]["Meta"];
|
|
1917
|
+
};
|
|
1918
|
+
ErrorResponse: {
|
|
1919
|
+
/**
|
|
1920
|
+
* @example VALIDATION_ERROR
|
|
1921
|
+
* @enum {string}
|
|
1922
|
+
*/
|
|
1923
|
+
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
|
|
1924
|
+
/** @example Limit must be greater than 0. */
|
|
1925
|
+
message: string;
|
|
1926
|
+
/**
|
|
1927
|
+
* @example [
|
|
1928
|
+
* {
|
|
1929
|
+
* "field": "limit",
|
|
1930
|
+
* "issue": "Limit must be greater than 0."
|
|
1931
|
+
* }
|
|
1932
|
+
* ]
|
|
1933
|
+
*/
|
|
1934
|
+
details: Record<string, never>;
|
|
1935
|
+
};
|
|
1936
|
+
OfferListResponse: {
|
|
1937
|
+
meta: components["schemas"]["Meta"];
|
|
1938
|
+
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
1939
|
+
cursor: string | null;
|
|
1940
|
+
/**
|
|
1941
|
+
* @description Offers matching the provided filters.
|
|
1942
|
+
* @example [
|
|
1943
|
+
* {
|
|
1944
|
+
* "hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
1945
|
+
* "offering": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
1946
|
+
* "assets": "369216000000000000000000",
|
|
1947
|
+
* "rate": "2750000000000000000",
|
|
1948
|
+
* "maturity": 1761922799,
|
|
1949
|
+
* "expiry": 1761922799,
|
|
1950
|
+
* "start": 1761922790,
|
|
1951
|
+
* "nonce": "571380",
|
|
1952
|
+
* "buy": false,
|
|
1953
|
+
* "chain_id": 1,
|
|
1954
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
1955
|
+
* "collaterals": [
|
|
1956
|
+
* {
|
|
1957
|
+
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
1958
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
1959
|
+
* "lltv": "860000000000000000"
|
|
1960
|
+
* }
|
|
1961
|
+
* ],
|
|
1962
|
+
* "callback": {
|
|
1963
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
1964
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
1965
|
+
* "gas_limit": "500000"
|
|
1966
|
+
* },
|
|
1967
|
+
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400",
|
|
1968
|
+
* "consumed": "0",
|
|
1969
|
+
* "takeable": "369216000000000000000000",
|
|
1970
|
+
* "block_number": 2942933377146801
|
|
1971
|
+
* }
|
|
1972
|
+
* ]
|
|
1973
|
+
*/
|
|
1974
|
+
data: components["schemas"]["OfferListItemResponse"][];
|
|
1975
|
+
};
|
|
1976
|
+
OfferListItemResponse: {
|
|
1977
|
+
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
1978
|
+
hash: string;
|
|
1979
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
1980
|
+
offering: string;
|
|
1981
|
+
/** @example 369216000000000000000000 */
|
|
1982
|
+
assets: string;
|
|
1983
|
+
/** @example 2750000000000000000 */
|
|
1984
|
+
rate: string;
|
|
1985
|
+
/** @example 1761922799 */
|
|
1986
|
+
maturity: number;
|
|
1987
|
+
/** @example 1761922799 */
|
|
1988
|
+
expiry: number;
|
|
1989
|
+
/** @example 1761922790 */
|
|
1990
|
+
start: number;
|
|
1991
|
+
/** @example 571380 */
|
|
1992
|
+
nonce: string;
|
|
1993
|
+
/** @example false */
|
|
1994
|
+
buy: boolean;
|
|
1995
|
+
/** @example 1 */
|
|
1996
|
+
chain_id: number;
|
|
1997
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
1998
|
+
loan_token: string;
|
|
1999
|
+
/**
|
|
2000
|
+
* @example [
|
|
2001
|
+
* {
|
|
2002
|
+
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2003
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2004
|
+
* "lltv": "860000000000000000"
|
|
2005
|
+
* }
|
|
2006
|
+
* ]
|
|
2007
|
+
*/
|
|
2008
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2009
|
+
/**
|
|
2010
|
+
* @example {
|
|
2011
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2012
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2013
|
+
* "gas_limit": "500000"
|
|
2014
|
+
* }
|
|
2015
|
+
*/
|
|
2016
|
+
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2017
|
+
/** @example 369216000000000000000000 */
|
|
2018
|
+
takeable: string;
|
|
2019
|
+
/** @example 0 */
|
|
2020
|
+
consumed: string;
|
|
2021
|
+
/** @example 2942933377146801 */
|
|
2022
|
+
block_number: number;
|
|
2023
|
+
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2024
|
+
signature: string | null;
|
|
2025
|
+
};
|
|
2026
|
+
CollateralResponse: {
|
|
2027
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2028
|
+
asset: string;
|
|
2029
|
+
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2030
|
+
oracle: string;
|
|
2031
|
+
/** @example 860000000000000000 */
|
|
2032
|
+
lltv: string;
|
|
2033
|
+
};
|
|
2034
|
+
OfferCallbackResponse: {
|
|
2035
|
+
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2036
|
+
address: string;
|
|
2037
|
+
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2038
|
+
data: string;
|
|
2039
|
+
/** @example 500000 */
|
|
2040
|
+
gas_limit: string;
|
|
2041
|
+
};
|
|
2042
|
+
ObligationListResponse: {
|
|
2043
|
+
meta: components["schemas"]["Meta"];
|
|
2044
|
+
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2045
|
+
cursor: string | null;
|
|
2046
|
+
/** @description List of obligations with takable offers. */
|
|
2047
|
+
data: components["schemas"]["ObligationResponse"][];
|
|
2048
|
+
};
|
|
2049
|
+
ObligationResponse: {
|
|
2050
|
+
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
|
|
2051
|
+
id: string;
|
|
2052
|
+
/** @example 1 */
|
|
2053
|
+
chain_id: number;
|
|
2054
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2055
|
+
loan_token: string;
|
|
2056
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2057
|
+
/** @example 1761922800 */
|
|
2058
|
+
maturity: number;
|
|
2059
|
+
ask: components["schemas"]["AskResponse"];
|
|
2060
|
+
bid: components["schemas"]["BidResponse"];
|
|
2061
|
+
};
|
|
2062
|
+
AskResponse: {
|
|
2063
|
+
/** @example 1000000000000000000 */
|
|
2064
|
+
rate: string;
|
|
2065
|
+
};
|
|
2066
|
+
BidResponse: {
|
|
2067
|
+
/** @example 1000000000000000000 */
|
|
2068
|
+
rate: string;
|
|
2069
|
+
};
|
|
2070
|
+
ObligationSingleSuccessResponse: {
|
|
2071
|
+
meta: components["schemas"]["Meta"];
|
|
2072
|
+
/** @example null */
|
|
2073
|
+
cursor: string | null;
|
|
2074
|
+
/** @description Obligation details. */
|
|
2075
|
+
data: components["schemas"]["ObligationResponse"];
|
|
2076
|
+
};
|
|
2077
|
+
RouterStatusSuccessResponse: {
|
|
2078
|
+
meta: components["schemas"]["Meta"];
|
|
2079
|
+
/**
|
|
2080
|
+
* @description Aggregated router status.
|
|
2081
|
+
* @example {
|
|
2082
|
+
* "status": "live"
|
|
2083
|
+
* }
|
|
2084
|
+
*/
|
|
2085
|
+
data: components["schemas"]["RouterStatusDataResponse"];
|
|
2086
|
+
};
|
|
2087
|
+
RouterStatusDataResponse: {
|
|
2088
|
+
/**
|
|
2089
|
+
* @example live
|
|
2090
|
+
* @enum {string}
|
|
2091
|
+
*/
|
|
2092
|
+
status: "live" | "syncing";
|
|
2093
|
+
};
|
|
2094
|
+
CollectorsHealthSuccessResponse: {
|
|
2095
|
+
meta: components["schemas"]["Meta"];
|
|
2096
|
+
/**
|
|
2097
|
+
* @description Collectors health details and sync status.
|
|
2098
|
+
* @example [
|
|
2099
|
+
* {
|
|
2100
|
+
* "name": "offers",
|
|
2101
|
+
* "chain_id": 1,
|
|
2102
|
+
* "block_number": 21345678,
|
|
2103
|
+
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
2104
|
+
* "lag": 0,
|
|
2105
|
+
* "status": "live"
|
|
2106
|
+
* }
|
|
2107
|
+
* ]
|
|
2108
|
+
*/
|
|
2109
|
+
data: components["schemas"]["CollectorHealthResponse"][];
|
|
2110
|
+
};
|
|
2111
|
+
CollectorHealthResponse: {
|
|
2112
|
+
/** @example offers */
|
|
2113
|
+
name: string;
|
|
2114
|
+
/** @example 1 */
|
|
2115
|
+
chain_id: number;
|
|
2116
|
+
/** @example 21345678 */
|
|
2117
|
+
block_number: number | null;
|
|
2118
|
+
/** @example 2024-01-01T12:00:00.000Z */
|
|
2119
|
+
updated_at: string | null;
|
|
2120
|
+
/** @example 0 */
|
|
2121
|
+
lag: number | null;
|
|
2122
|
+
/**
|
|
2123
|
+
* @example live
|
|
2124
|
+
* @enum {string}
|
|
2125
|
+
*/
|
|
2126
|
+
status: "live" | "lagging" | "unknown";
|
|
2127
|
+
};
|
|
2128
|
+
ChainsHealthSuccessResponse: {
|
|
2129
|
+
meta: components["schemas"]["Meta"];
|
|
2130
|
+
/**
|
|
2131
|
+
* @description Latest processed block per chain.
|
|
2132
|
+
* @example [
|
|
2133
|
+
* {
|
|
2134
|
+
* "chain_id": 1,
|
|
2135
|
+
* "local_block_number": 21345678,
|
|
2136
|
+
* "remote_block_number": 21345690,
|
|
2137
|
+
* "updated_at": "2024-01-01T12:00:00.000Z"
|
|
2138
|
+
* }
|
|
2139
|
+
* ]
|
|
2140
|
+
*/
|
|
2141
|
+
data: components["schemas"]["ChainHealthResponse"][];
|
|
2142
|
+
};
|
|
2143
|
+
ChainHealthResponse: {
|
|
2144
|
+
/** @example 1 */
|
|
2145
|
+
chain_id: number;
|
|
2146
|
+
/** @example 21345678 */
|
|
2147
|
+
local_block_number: number;
|
|
2148
|
+
/** @example 21345690 */
|
|
2149
|
+
remote_block_number: number | null;
|
|
2150
|
+
/** @example 2024-01-01T12:00:00.000Z */
|
|
2151
|
+
updated_at: string;
|
|
2152
|
+
};
|
|
2153
|
+
ValidateOffersRequest: {
|
|
2154
|
+
/** @description Array of offers in snake_case format. Mutually exclusive with 'calldata'. */
|
|
2155
|
+
offers?: components["schemas"]["ValidateOfferRequest"][];
|
|
2156
|
+
/**
|
|
2157
|
+
* @description Encoded tree calldata as a hex string (0x-prefixed). Mutually exclusive with 'offers'.
|
|
2158
|
+
* @example 0x01...
|
|
2159
|
+
*/
|
|
2160
|
+
calldata?: string;
|
|
2161
|
+
};
|
|
2162
|
+
ValidateOfferRequest: {
|
|
2163
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2164
|
+
offering: string;
|
|
2165
|
+
/** @example 369216000000000000000000 */
|
|
2166
|
+
assets: string;
|
|
2167
|
+
/** @example 2750000000000000000 */
|
|
2168
|
+
rate: string;
|
|
2169
|
+
/** @example 1761922799 */
|
|
2170
|
+
maturity: number;
|
|
2171
|
+
/** @example 1761922799 */
|
|
2172
|
+
expiry: number;
|
|
2173
|
+
/** @example 1761922790 */
|
|
2174
|
+
start: number;
|
|
2175
|
+
/** @example 571380 */
|
|
2176
|
+
nonce: string;
|
|
2177
|
+
/** @example false */
|
|
2178
|
+
buy: boolean;
|
|
2179
|
+
/** @example 1 */
|
|
2180
|
+
chain_id: number;
|
|
2181
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2182
|
+
loan_token: string;
|
|
2183
|
+
/**
|
|
2184
|
+
* @example [
|
|
2185
|
+
* {
|
|
2186
|
+
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2187
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2188
|
+
* "lltv": "860000000000000000"
|
|
2189
|
+
* }
|
|
2190
|
+
* ]
|
|
2191
|
+
*/
|
|
2192
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2193
|
+
/**
|
|
2194
|
+
* @example {
|
|
2195
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2196
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2197
|
+
* "gas_limit": "500000"
|
|
2198
|
+
* }
|
|
2199
|
+
*/
|
|
2200
|
+
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2201
|
+
};
|
|
2202
|
+
ValidateOffersListResponse: {
|
|
2203
|
+
meta: components["schemas"]["Meta"];
|
|
2204
|
+
/** @example null */
|
|
2205
|
+
cursor: string | null;
|
|
2206
|
+
/** @description Validation results for each offer. */
|
|
2207
|
+
data: components["schemas"]["ValidateOfferResultResponse"][];
|
|
2208
|
+
};
|
|
2209
|
+
ValidateOfferResultResponse: {
|
|
2210
|
+
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2211
|
+
offer_hash: string;
|
|
2212
|
+
/** @example false */
|
|
2213
|
+
valid: boolean;
|
|
2214
|
+
/** @example parse_error */
|
|
2215
|
+
rule: string | null;
|
|
2216
|
+
/** @example Invalid offer. 'offering': invalid address */
|
|
2217
|
+
message: string | null;
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
responses: never;
|
|
2221
|
+
parameters: never;
|
|
2222
|
+
requestBodies: never;
|
|
2223
|
+
headers: never;
|
|
2224
|
+
pathItems: never;
|
|
2225
|
+
}
|
|
2226
|
+
declare namespace ObligationResponse_d_exports {
|
|
2227
|
+
export { ObligationResponse, from$2 as from };
|
|
1798
2228
|
}
|
|
1799
|
-
|
|
1800
2229
|
type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
1801
2230
|
/**
|
|
1802
2231
|
* Creates an `ObligationResponse` from a `Obligation`.
|
|
@@ -1805,12 +2234,9 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
|
|
|
1805
2234
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
1806
2235
|
*/
|
|
1807
2236
|
declare function from$2(obligation: Obligation, quote: Quote): ObligationResponse;
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
declare namespace ObligationResponse$1 {
|
|
1811
|
-
export { type ObligationResponse$1_ObligationResponse as ObligationResponse, from$2 as from };
|
|
2237
|
+
declare namespace OfferResponse_d_exports {
|
|
2238
|
+
export { OfferResponse, from$1 as from };
|
|
1812
2239
|
}
|
|
1813
|
-
|
|
1814
2240
|
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
1815
2241
|
/**
|
|
1816
2242
|
* Creates an `OfferResponse` from an `Offer`.
|
|
@@ -1819,111 +2245,122 @@ type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["
|
|
|
1819
2245
|
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
1820
2246
|
*/
|
|
1821
2247
|
declare function from$1(offer: Offer): OfferResponse;
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
declare
|
|
1825
|
-
|
|
2248
|
+
//#endregion
|
|
2249
|
+
//#region src/api/Schema/openapi.d.ts
|
|
2250
|
+
declare class BooksController {
|
|
2251
|
+
getBook(): Promise<void>;
|
|
2252
|
+
}
|
|
2253
|
+
declare class ValidateController {
|
|
2254
|
+
validateOffers(): Promise<void>;
|
|
1826
2255
|
}
|
|
1827
|
-
|
|
1828
2256
|
declare class OffersController {
|
|
1829
|
-
|
|
2257
|
+
getOffers(): Promise<void>;
|
|
1830
2258
|
}
|
|
1831
2259
|
declare class HealthController {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
2260
|
+
getRouterStatus(): Promise<void>;
|
|
2261
|
+
getCollectorsHealth(): Promise<void>;
|
|
2262
|
+
getChainsHealth(): Promise<void>;
|
|
1835
2263
|
}
|
|
1836
2264
|
declare class ObligationsController {
|
|
1837
|
-
|
|
1838
|
-
|
|
2265
|
+
getObligations(): Promise<void>;
|
|
2266
|
+
getObligation(): Promise<void>;
|
|
1839
2267
|
}
|
|
1840
|
-
|
|
1841
|
-
|
|
2268
|
+
type RuleInfo = {
|
|
2269
|
+
name: string;
|
|
2270
|
+
description: string;
|
|
2271
|
+
};
|
|
2272
|
+
type OpenApiOptions = {
|
|
2273
|
+
rules?: RuleInfo[];
|
|
2274
|
+
};
|
|
2275
|
+
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
2276
|
+
//#endregion
|
|
2277
|
+
//#region src/api/Schema/requests.d.ts
|
|
1842
2278
|
declare const schemas: {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
2279
|
+
readonly get_offers: z$1.ZodObject<{
|
|
2280
|
+
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2281
|
+
buy: "buy";
|
|
2282
|
+
sell: "sell";
|
|
2283
|
+
}>>;
|
|
2284
|
+
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2285
|
+
offering: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2286
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2287
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2288
|
+
}, z$1.core.$strip>;
|
|
2289
|
+
readonly get_obligations: z$1.ZodObject<{
|
|
2290
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2291
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2292
|
+
}, z$1.core.$strip>;
|
|
2293
|
+
readonly get_obligation: z$1.ZodObject<{
|
|
2294
|
+
obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2295
|
+
}, z$1.core.$strip>;
|
|
2296
|
+
readonly get_book: z$1.ZodObject<{
|
|
2297
|
+
obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2298
|
+
side: z$1.ZodEnum<{
|
|
2299
|
+
buy: "buy";
|
|
2300
|
+
sell: "sell";
|
|
2301
|
+
}>;
|
|
2302
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2303
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2304
|
+
}, z$1.core.$strip>;
|
|
2305
|
+
readonly validate_offers: z$1.ZodObject<{
|
|
2306
|
+
offers: z$1.ZodAny;
|
|
2307
|
+
calldata: z$1.ZodOptional<z$1.ZodString>;
|
|
2308
|
+
}, z$1.core.$strip>;
|
|
1859
2309
|
};
|
|
1860
2310
|
type Action = keyof typeof schemas;
|
|
1861
|
-
declare function parse<A extends Action>(action: A, query: unknown): z.infer<(typeof schemas)[A]>;
|
|
1862
|
-
declare function safeParse<A extends Action>(action: A, query: unknown, error?: z.core.$ZodErrorMap<z.core.$ZodIssue>): z.ZodSafeParseResult<z.infer<(typeof schemas)[A]>>;
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
declare
|
|
1867
|
-
|
|
1868
|
-
type index$1_HealthController = HealthController;
|
|
1869
|
-
declare const index$1_HealthController: typeof HealthController;
|
|
1870
|
-
type index$1_ObligationsController = ObligationsController;
|
|
1871
|
-
declare const index$1_ObligationsController: typeof ObligationsController;
|
|
1872
|
-
type index$1_OffersController = OffersController;
|
|
1873
|
-
declare const index$1_OffersController: typeof OffersController;
|
|
1874
|
-
declare const index$1_OpenApi: typeof OpenApi;
|
|
1875
|
-
type index$1_RouterStatusResponse = RouterStatusResponse;
|
|
1876
|
-
declare const index$1_parse: typeof parse;
|
|
1877
|
-
declare const index$1_safeParse: typeof safeParse;
|
|
1878
|
-
declare namespace index$1 {
|
|
1879
|
-
export { index$1_ChainHealth as ChainHealth, type index$1_ChainsHealthResponse as ChainsHealthResponse, index$1_CollectorHealth as CollectorHealth, type index$1_CollectorsHealthResponse as CollectorsHealthResponse, index$1_HealthController as HealthController, ObligationResponse$1 as ObligationResponse, index$1_ObligationsController as ObligationsController, OfferResponse$1 as OfferResponse, index$1_OffersController as OffersController, index$1_OpenApi as OpenApi, type index$1_RouterStatusResponse as RouterStatusResponse, index$1_parse as parse, index$1_safeParse as safeParse };
|
|
2311
|
+
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2312
|
+
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]>>;
|
|
2313
|
+
declare namespace index_d_exports$1 {
|
|
2314
|
+
export { BookResponse_d_exports as BookResponse, BooksController, ChainHealth, ChainsHealthResponse, CollectorHealth, CollectorsHealthResponse, HealthController, ObligationResponse_d_exports as ObligationResponse, ObligationsController, OfferResponse_d_exports as OfferResponse, OffersController, OpenApi, OpenApiOptions, RouterStatusResponse, RuleInfo, ValidateController, parse, safeParse };
|
|
2315
|
+
}
|
|
2316
|
+
declare namespace Client_d_exports {
|
|
2317
|
+
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
1880
2318
|
}
|
|
1881
|
-
|
|
1882
2319
|
type RouterClientConfig = {
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
2320
|
+
/** The URL of the router. */
|
|
2321
|
+
readonly url: URL;
|
|
2322
|
+
/** The default headers to use for each request. */
|
|
2323
|
+
readonly headers: Headers;
|
|
1887
2324
|
};
|
|
1888
|
-
type Client$
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2325
|
+
type Client$2 = Compute<RouterClientConfig & {
|
|
2326
|
+
/**
|
|
2327
|
+
* Get offers from the router.
|
|
2328
|
+
* @param parameters - {@link getOffers.Parameters}
|
|
2329
|
+
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
2330
|
+
* @throws If the request fails - {@link getOffers.ErrorType}
|
|
2331
|
+
*
|
|
2332
|
+
* @example
|
|
2333
|
+
* ```ts
|
|
2334
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2335
|
+
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
2336
|
+
* console.log(offers);
|
|
2337
|
+
* ```
|
|
2338
|
+
*/
|
|
2339
|
+
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
2340
|
+
/**
|
|
2341
|
+
* Get obligations from the router.
|
|
2342
|
+
* @param parameters - {@link getObligations.Parameters}
|
|
2343
|
+
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
2344
|
+
* @throws If the request fails - {@link getObligations.ErrorType}
|
|
2345
|
+
*
|
|
2346
|
+
* @example
|
|
2347
|
+
* ```ts
|
|
2348
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2349
|
+
* const { obligations, cursor } = await router.getObligations();
|
|
2350
|
+
* console.log(obligations[0].id()); // 0x123...456
|
|
2351
|
+
* ```
|
|
2352
|
+
*/
|
|
2353
|
+
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
1917
2354
|
}>;
|
|
1918
2355
|
type ConnectOptions = {
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
2356
|
+
/** The URL of the router to interact with.
|
|
2357
|
+
* @default "https://router.morpho.dev"
|
|
2358
|
+
*/
|
|
2359
|
+
url?: string;
|
|
2360
|
+
/** The API key to use for the router API. */
|
|
2361
|
+
apiKey?: string;
|
|
2362
|
+
/** The default headers to use for each request. */
|
|
2363
|
+
headers?: Headers;
|
|
1927
2364
|
};
|
|
1928
2365
|
/**
|
|
1929
2366
|
* Creates an instance of a router client.
|
|
@@ -1938,125 +2375,108 @@ type ConnectOptions = {
|
|
|
1938
2375
|
*/
|
|
1939
2376
|
declare function connect$1(parameters?: connect$1.Parameters): connect$1.ReturnType;
|
|
1940
2377
|
declare namespace connect$1 {
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
2378
|
+
type Parameters = ConnectOptions;
|
|
2379
|
+
type ReturnType = Client$2;
|
|
2380
|
+
type ErrorType = InvalidUrlError;
|
|
1944
2381
|
}
|
|
1945
|
-
declare function getOffers(apiClient: Client
|
|
2382
|
+
declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
1946
2383
|
declare namespace getOffers {
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2384
|
+
type Parameters = {
|
|
2385
|
+
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
2386
|
+
side: "buy" | "sell";
|
|
2387
|
+
/** The offers obligation id */
|
|
2388
|
+
obligationId: Hex;
|
|
2389
|
+
/** Pagination cursor in base64url-encoded format */
|
|
2390
|
+
cursor?: string;
|
|
2391
|
+
/** Maximum number of offers to return. @default 20 */
|
|
2392
|
+
limit?: number;
|
|
2393
|
+
};
|
|
2394
|
+
type ReturnType = {
|
|
2395
|
+
offers: Offer[];
|
|
2396
|
+
/** The pagination cursor. */
|
|
2397
|
+
cursor: string | null;
|
|
2398
|
+
};
|
|
2399
|
+
type ErrorType = GetApiErrorType;
|
|
1963
2400
|
}
|
|
1964
|
-
declare function getObligations(apiClient: Client
|
|
2401
|
+
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
1965
2402
|
declare namespace getObligations {
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2403
|
+
type Parameters = {
|
|
2404
|
+
/** Pagination cursor is a 32-byte hex string. */
|
|
2405
|
+
cursor?: Hex;
|
|
2406
|
+
/** Maximum number of obligations to return. @default 20 */
|
|
2407
|
+
limit?: number;
|
|
2408
|
+
};
|
|
2409
|
+
type ReturnType = {
|
|
2410
|
+
obligations: Compute<{
|
|
2411
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
2412
|
+
id: () => Hex;
|
|
2413
|
+
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
2414
|
+
/** The pagination cursor. */
|
|
2415
|
+
cursor: string | null;
|
|
2416
|
+
};
|
|
2417
|
+
type ErrorType = GetApiErrorType;
|
|
1981
2418
|
}
|
|
1982
2419
|
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
1983
2420
|
declare class InvalidUrlError extends BaseError {
|
|
1984
|
-
|
|
1985
|
-
|
|
2421
|
+
name: string;
|
|
2422
|
+
constructor(url: string);
|
|
1986
2423
|
}
|
|
1987
2424
|
declare class HttpUnauthorizedError extends BaseError {
|
|
1988
|
-
|
|
1989
|
-
|
|
2425
|
+
name: string;
|
|
2426
|
+
constructor();
|
|
1990
2427
|
}
|
|
1991
2428
|
declare class HttpForbiddenError extends BaseError {
|
|
1992
|
-
|
|
1993
|
-
|
|
2429
|
+
name: string;
|
|
2430
|
+
constructor();
|
|
1994
2431
|
}
|
|
1995
2432
|
declare class HttpRateLimitError extends BaseError {
|
|
1996
|
-
|
|
1997
|
-
|
|
2433
|
+
name: string;
|
|
2434
|
+
constructor();
|
|
1998
2435
|
}
|
|
1999
2436
|
declare class HttpGetApiFailedError extends BaseError {
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2437
|
+
name: string;
|
|
2438
|
+
constructor(message: string, {
|
|
2439
|
+
details
|
|
2440
|
+
}?: {
|
|
2441
|
+
details?: string;
|
|
2442
|
+
});
|
|
2004
2443
|
}
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
type Client$2_HttpForbiddenError = HttpForbiddenError;
|
|
2008
|
-
declare const Client$2_HttpForbiddenError: typeof HttpForbiddenError;
|
|
2009
|
-
type Client$2_HttpGetApiFailedError = HttpGetApiFailedError;
|
|
2010
|
-
declare const Client$2_HttpGetApiFailedError: typeof HttpGetApiFailedError;
|
|
2011
|
-
type Client$2_HttpRateLimitError = HttpRateLimitError;
|
|
2012
|
-
declare const Client$2_HttpRateLimitError: typeof HttpRateLimitError;
|
|
2013
|
-
type Client$2_HttpUnauthorizedError = HttpUnauthorizedError;
|
|
2014
|
-
declare const Client$2_HttpUnauthorizedError: typeof HttpUnauthorizedError;
|
|
2015
|
-
type Client$2_InvalidUrlError = InvalidUrlError;
|
|
2016
|
-
declare const Client$2_InvalidUrlError: typeof InvalidUrlError;
|
|
2017
|
-
declare const Client$2_getObligations: typeof getObligations;
|
|
2018
|
-
declare const Client$2_getOffers: typeof getOffers;
|
|
2019
|
-
declare namespace Client$2 {
|
|
2020
|
-
export { type Client$1 as Client, type Client$2_ConnectOptions as ConnectOptions, Client$2_HttpForbiddenError as HttpForbiddenError, Client$2_HttpGetApiFailedError as HttpGetApiFailedError, Client$2_HttpRateLimitError as HttpRateLimitError, Client$2_HttpUnauthorizedError as HttpUnauthorizedError, Client$2_InvalidUrlError as InvalidUrlError, connect$1 as connect, Client$2_getObligations as getObligations, Client$2_getOffers as getOffers };
|
|
2444
|
+
declare namespace Cursor_d_exports {
|
|
2445
|
+
export { Cursor, decode, encode, validate };
|
|
2021
2446
|
}
|
|
2022
|
-
|
|
2023
2447
|
type Cursor = {
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2448
|
+
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
2449
|
+
dir: "asc" | "desc";
|
|
2450
|
+
rate?: string;
|
|
2451
|
+
maturity?: number;
|
|
2452
|
+
expiry?: number;
|
|
2453
|
+
assets?: string;
|
|
2454
|
+
hash: string;
|
|
2455
|
+
page?: number;
|
|
2032
2456
|
};
|
|
2033
2457
|
declare function validate(cursor: unknown): cursor is Cursor;
|
|
2034
2458
|
declare function encode(c: Cursor): string;
|
|
2035
2459
|
declare function decode(token?: string): Cursor | null;
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
declare const Cursor$1_decode: typeof decode;
|
|
2039
|
-
declare const Cursor$1_encode: typeof encode;
|
|
2040
|
-
declare const Cursor$1_validate: typeof validate;
|
|
2041
|
-
declare namespace Cursor$1 {
|
|
2042
|
-
export { type Cursor$1_Cursor as Cursor, Cursor$1_decode as decode, Cursor$1_encode as encode, Cursor$1_validate as validate };
|
|
2460
|
+
declare namespace Gate_d_exports {
|
|
2461
|
+
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
2043
2462
|
}
|
|
2044
|
-
|
|
2045
2463
|
/**
|
|
2046
2464
|
* A validation rule.
|
|
2047
2465
|
*/
|
|
2048
|
-
type Rule<T, Name extends string = string> = {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2466
|
+
type Rule<T, Name$1 extends string = string> = {
|
|
2467
|
+
kind: "single";
|
|
2468
|
+
name: Name$1;
|
|
2469
|
+
description: string;
|
|
2470
|
+
run: Single<T, Name$1>;
|
|
2052
2471
|
} | {
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2472
|
+
kind: "batch";
|
|
2473
|
+
name: Name$1;
|
|
2474
|
+
description: string;
|
|
2475
|
+
run: Batch<T, Name$1>;
|
|
2056
2476
|
};
|
|
2057
|
-
type RuleNames<Rules extends readonly {
|
|
2058
|
-
|
|
2059
|
-
}[]> = Rules[number]["name"];
|
|
2477
|
+
type RuleNames<Rules$1 extends readonly {
|
|
2478
|
+
name: string;
|
|
2479
|
+
}[]> = Rules$1[number]["name"];
|
|
2060
2480
|
/**
|
|
2061
2481
|
* A single item validation rule.
|
|
2062
2482
|
* @param item - The item to validate.
|
|
@@ -2072,81 +2492,71 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
|
|
|
2072
2492
|
/**
|
|
2073
2493
|
* Create a validation rule iterating over a single item at a time.
|
|
2074
2494
|
* @param name - The name of the rule.
|
|
2495
|
+
* @param description - A human-readable description of the rule.
|
|
2075
2496
|
* @param run - The function that validates the rule.
|
|
2076
2497
|
* @returns The created rule.
|
|
2077
2498
|
*/
|
|
2078
|
-
declare function single<Name extends string, T>(name: Name, run: Single<T, Name>): Rule<T, Name>;
|
|
2499
|
+
declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
|
|
2079
2500
|
/**
|
|
2080
2501
|
* Create a validation rule iterating over a batch of items at a time.
|
|
2081
2502
|
* @param name - The name of the rule.
|
|
2503
|
+
* @param description - A human-readable description of the rule.
|
|
2082
2504
|
* @param run - The function that validates the rule.
|
|
2083
2505
|
* @returns The created rule.
|
|
2084
2506
|
*/
|
|
2085
|
-
declare function batch$1<Name extends string, T>(name: Name, run: Batch<T, Name>): Rule<T, Name>;
|
|
2507
|
+
declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
|
|
2086
2508
|
/**
|
|
2087
2509
|
* A validation issue.
|
|
2088
2510
|
*/
|
|
2089
2511
|
type Issue<T, RuleName extends string = string> = {
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2512
|
+
/** The name of the rule that caused the issue. */
|
|
2513
|
+
ruleName: RuleName;
|
|
2514
|
+
/** The message of the issue. */
|
|
2515
|
+
message: string;
|
|
2516
|
+
/** The item that was not valid. */
|
|
2517
|
+
item: T;
|
|
2096
2518
|
};
|
|
2097
2519
|
/**
|
|
2098
2520
|
* The result of a validation.
|
|
2099
2521
|
*/
|
|
2100
2522
|
type Result<T, RuleName extends string = string> = {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2523
|
+
/** The items that were valid. */
|
|
2524
|
+
valid: T[];
|
|
2525
|
+
/** The reports of the failed validations. */
|
|
2526
|
+
issues: Issue<T, RuleName>[];
|
|
2105
2527
|
};
|
|
2106
|
-
declare function run<T, Name extends string, Rules extends readonly Rule<T, Name>[]>(parameters: {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
}): Promise<Result<T, RuleNames<Rules>>>;
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
type Gate_Issue<T, RuleName extends string = string> = Issue<T, RuleName>;
|
|
2114
|
-
type Gate_Result<T, RuleName extends string = string> = Result<T, RuleName>;
|
|
2115
|
-
type Gate_Rule<T, Name extends string = string> = Rule<T, Name>;
|
|
2116
|
-
type Gate_RuleNames<Rules extends readonly {
|
|
2117
|
-
name: string;
|
|
2118
|
-
}[]> = RuleNames<Rules>;
|
|
2119
|
-
type Gate_Single<T, RuleName extends string> = Single<T, RuleName>;
|
|
2120
|
-
declare const Gate_run: typeof run;
|
|
2121
|
-
declare const Gate_single: typeof single;
|
|
2122
|
-
declare namespace Gate {
|
|
2123
|
-
export { type Gate_Batch as Batch, type Gate_Issue as Issue, type Gate_Result as Result, type Gate_Rule as Rule, type Gate_RuleNames as RuleNames, type Gate_Single as Single, batch$1 as batch, Gate_run as run, Gate_single as single };
|
|
2528
|
+
declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
|
|
2529
|
+
items: T[];
|
|
2530
|
+
rules: Rules$1;
|
|
2531
|
+
chunkSize?: number;
|
|
2532
|
+
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
2533
|
+
declare namespace GateConfig_d_exports {
|
|
2534
|
+
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
2124
2535
|
}
|
|
2125
|
-
|
|
2126
2536
|
type GateConfig = {
|
|
2127
|
-
|
|
2128
|
-
|
|
2537
|
+
callbacks?: CallbackConfig[];
|
|
2538
|
+
maturities?: MaturityType[];
|
|
2129
2539
|
};
|
|
2130
2540
|
type CallbackConfig = {
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2541
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2542
|
+
addresses: Address[];
|
|
2543
|
+
vaultFactories: Address[];
|
|
2134
2544
|
} | {
|
|
2135
|
-
|
|
2136
|
-
|
|
2545
|
+
type: CallbackType.SellERC20Callback;
|
|
2546
|
+
addresses: Address[];
|
|
2137
2547
|
} | {
|
|
2138
|
-
|
|
2548
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2139
2549
|
};
|
|
2140
|
-
declare function getCallback(chain:
|
|
2141
|
-
|
|
2550
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
2551
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2142
2552
|
}> | undefined;
|
|
2143
|
-
declare function getCallback(chain:
|
|
2144
|
-
|
|
2553
|
+
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
2554
|
+
type: CallbackType.SellERC20Callback;
|
|
2145
2555
|
}> | undefined;
|
|
2146
|
-
declare function getCallback(chain:
|
|
2147
|
-
|
|
2556
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
2557
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2148
2558
|
}> | undefined;
|
|
2149
|
-
declare function getCallback(chain:
|
|
2559
|
+
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
2150
2560
|
/**
|
|
2151
2561
|
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
2152
2562
|
* Skips the empty callback type as it does not carry addresses.
|
|
@@ -2155,54 +2565,43 @@ declare function getCallback(chain: ChainName, type: CallbackType): CallbackConf
|
|
|
2155
2565
|
* @param address - Callback contract address
|
|
2156
2566
|
* @returns The callback type when found, otherwise undefined
|
|
2157
2567
|
*/
|
|
2158
|
-
declare function getCallbackType(chain:
|
|
2568
|
+
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
2159
2569
|
/**
|
|
2160
2570
|
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
2161
2571
|
* @param chain - Chain name for which to read the validation configuration
|
|
2162
2572
|
* @param type - Callback type to retrieve
|
|
2163
2573
|
* @returns The matching callback addresses or an empty array if not configured
|
|
2164
2574
|
*/
|
|
2165
|
-
declare function getCallbackTypeAddresses(chain:
|
|
2575
|
+
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
2166
2576
|
/**
|
|
2167
2577
|
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
2168
2578
|
*
|
|
2169
2579
|
* @param chain - Chain name
|
|
2170
2580
|
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
2171
2581
|
*/
|
|
2172
|
-
declare const getCallbackAddresses: (chain:
|
|
2173
|
-
declare const assets: Record<string, Address[]>;
|
|
2174
|
-
declare const configs: Record<
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
type GateConfig$1_GateConfig = GateConfig;
|
|
2178
|
-
declare const GateConfig$1_assets: typeof assets;
|
|
2179
|
-
declare const GateConfig$1_configs: typeof configs;
|
|
2180
|
-
declare const GateConfig$1_getCallback: typeof getCallback;
|
|
2181
|
-
declare const GateConfig$1_getCallbackAddresses: typeof getCallbackAddresses;
|
|
2182
|
-
declare const GateConfig$1_getCallbackType: typeof getCallbackType;
|
|
2183
|
-
declare const GateConfig$1_getCallbackTypeAddresses: typeof getCallbackTypeAddresses;
|
|
2184
|
-
declare namespace GateConfig$1 {
|
|
2185
|
-
export { type GateConfig$1_CallbackConfig as CallbackConfig, type GateConfig$1_GateConfig as GateConfig, GateConfig$1_assets as assets, GateConfig$1_configs as configs, GateConfig$1_getCallback as getCallback, GateConfig$1_getCallbackAddresses as getCallbackAddresses, GateConfig$1_getCallbackType as getCallbackType, GateConfig$1_getCallbackTypeAddresses as getCallbackTypeAddresses };
|
|
2582
|
+
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
2583
|
+
declare const assets$1: Record<string, Address[]>;
|
|
2584
|
+
declare const configs: Record<Name, GateConfig>;
|
|
2585
|
+
declare namespace Gatekeeper_d_exports {
|
|
2586
|
+
export { Gatekeeper, Rules, create };
|
|
2186
2587
|
}
|
|
2187
|
-
|
|
2188
|
-
type Rules$1 = readonly Rule<Offer, string>[];
|
|
2588
|
+
type Rules = readonly Rule<Offer, string>[];
|
|
2189
2589
|
type Gatekeeper = {
|
|
2190
|
-
|
|
2590
|
+
rules: Rules;
|
|
2591
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2191
2592
|
};
|
|
2192
2593
|
type GatekeeperParameters = {
|
|
2193
|
-
|
|
2594
|
+
rules: Rules;
|
|
2194
2595
|
};
|
|
2195
2596
|
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
declare const
|
|
2199
|
-
declare namespace
|
|
2200
|
-
export {
|
|
2597
|
+
//#endregion
|
|
2598
|
+
//#region src/gatekeeper/morphoRules.d.ts
|
|
2599
|
+
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
2600
|
+
declare namespace Rules_d_exports {
|
|
2601
|
+
export { ValidityParameters, callback, chains, maturity, token, validity };
|
|
2201
2602
|
}
|
|
2202
|
-
|
|
2203
2603
|
type ValidityParameters = {
|
|
2204
|
-
|
|
2205
|
-
client: PublicClient;
|
|
2604
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2206
2605
|
};
|
|
2207
2606
|
/**
|
|
2208
2607
|
* set of rules to validate offers.
|
|
@@ -2210,113 +2609,109 @@ type ValidityParameters = {
|
|
|
2210
2609
|
* @param parameters - Validity parameters with chain and client
|
|
2211
2610
|
* @returns Array of validation rules to evaluate against offers
|
|
2212
2611
|
*/
|
|
2213
|
-
declare function validity(parameters: ValidityParameters): (Rule<Offer, "
|
|
2214
|
-
declare const
|
|
2215
|
-
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
|
|
2612
|
+
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
2613
|
+
declare const chains: ({
|
|
2614
|
+
chains
|
|
2615
|
+
}: {
|
|
2616
|
+
chains: Chain$1[];
|
|
2617
|
+
}) => Rule<Offer, "chain_ids">;
|
|
2618
|
+
declare const maturity: ({
|
|
2619
|
+
maturities
|
|
2620
|
+
}: {
|
|
2621
|
+
maturities: MaturityType[];
|
|
2219
2622
|
}) => Rule<Offer, "maturity">;
|
|
2220
|
-
declare const callback: ({
|
|
2221
|
-
|
|
2222
|
-
|
|
2623
|
+
declare const callback: ({
|
|
2624
|
+
callbacks,
|
|
2625
|
+
allowedAddresses
|
|
2626
|
+
}: {
|
|
2627
|
+
callbacks: CallbackType[];
|
|
2628
|
+
allowedAddresses: Address[];
|
|
2223
2629
|
}) => Rule<Offer, "callback">;
|
|
2224
2630
|
/**
|
|
2225
2631
|
* A validation rule that checks if the offer's token is allowed.
|
|
2226
2632
|
* @param offer - The offer to validate.
|
|
2227
2633
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
2228
2634
|
*/
|
|
2229
|
-
declare const token: ({
|
|
2230
|
-
|
|
2635
|
+
declare const token: ({
|
|
2636
|
+
assets
|
|
2637
|
+
}: {
|
|
2638
|
+
assets: Address[];
|
|
2231
2639
|
}) => Rule<Offer, "token">;
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
declare const Rules_callback: typeof callback;
|
|
2235
|
-
declare const Rules_chain: typeof chain;
|
|
2236
|
-
declare const Rules_maturity: typeof maturity;
|
|
2237
|
-
declare const Rules_token: typeof token;
|
|
2238
|
-
declare const Rules_validity: typeof validity;
|
|
2239
|
-
declare namespace Rules {
|
|
2240
|
-
export { type Rules_ValidityParameters as ValidityParameters, Rules_callback as callback, Rules_chain as chain, Rules_maturity as maturity, Rules_token as token, Rules_validity as validity };
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2640
|
+
//#endregion
|
|
2641
|
+
//#region src/mempool/MempoolEVMClient.d.ts
|
|
2243
2642
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
2244
2643
|
declare namespace from {
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2644
|
+
type Parameters = {
|
|
2645
|
+
/** The viem client to use. */
|
|
2646
|
+
client: WalletClient;
|
|
2647
|
+
/** The mempool address. */
|
|
2648
|
+
mempoolAddress: Address;
|
|
2649
|
+
/** The block window to use for the mempool. Defaults to 100. */
|
|
2650
|
+
blockWindow?: number;
|
|
2651
|
+
};
|
|
2652
|
+
type ReturnType = Client$1;
|
|
2653
|
+
type ErrorType = null;
|
|
2654
|
+
}
|
|
2655
|
+
declare namespace MempoolClient_d_exports {
|
|
2656
|
+
export { AddParameters, Client$1 as Client, GetParameters, connect };
|
|
2255
2657
|
}
|
|
2256
|
-
|
|
2257
2658
|
type AddParameters = Compute<Omit<Offer, "hash" | "createdAt">[]>;
|
|
2258
2659
|
type GetParameters = {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2660
|
+
/** The block number to get offers from. */
|
|
2661
|
+
blockNumberGte?: number;
|
|
2662
|
+
/** The block number to get offers to. */
|
|
2663
|
+
blockNumberLte?: number;
|
|
2664
|
+
/** The loan asset to get offers from. */
|
|
2665
|
+
loanToken?: string;
|
|
2666
|
+
/** The order to get offers. Defaults to "desc". */
|
|
2667
|
+
order?: "asc" | "desc";
|
|
2668
|
+
/** The options to get offers from. */
|
|
2669
|
+
options?: {
|
|
2670
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
2671
|
+
maxBatchSize?: number;
|
|
2672
|
+
};
|
|
2272
2673
|
};
|
|
2273
2674
|
/**
|
|
2274
2675
|
* Mempool client interface.
|
|
2275
2676
|
*/
|
|
2276
|
-
type Client = {
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2677
|
+
type Client$1 = {
|
|
2678
|
+
/**
|
|
2679
|
+
* Add an offer to the mempool.
|
|
2680
|
+
* @returns The created offer with its hash.
|
|
2681
|
+
*/
|
|
2682
|
+
add: (parameters: AddParameters) => Promise<Hex>;
|
|
2683
|
+
/** Get offers from the mempool. */
|
|
2684
|
+
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
2685
|
+
offers: Offer[];
|
|
2686
|
+
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
2687
|
+
blockNumber: number;
|
|
2688
|
+
}>;
|
|
2689
|
+
/**
|
|
2690
|
+
* Stream offers from the mempool.
|
|
2691
|
+
* @returns A generator of offers alongside the last block number processed.
|
|
2692
|
+
*/
|
|
2693
|
+
stream: (parameters: Compute<Omit<GetParameters, "options"> & {
|
|
2694
|
+
options: GetParameters["options"] & {
|
|
2695
|
+
blockWindow?: number;
|
|
2696
|
+
};
|
|
2697
|
+
}>) => AsyncGenerator<{
|
|
2698
|
+
offers: Offer[];
|
|
2699
|
+
blockNumber: number;
|
|
2700
|
+
}>;
|
|
2300
2701
|
};
|
|
2301
2702
|
/**
|
|
2302
2703
|
* Client to interact with the Mempool contract on a specific chain.
|
|
2303
2704
|
*/
|
|
2304
|
-
declare function connect(parameters: from.Parameters): Client;
|
|
2705
|
+
declare function connect(parameters: from.Parameters): Client$1;
|
|
2305
2706
|
declare namespace connect {
|
|
2306
|
-
|
|
2707
|
+
type ErrorType = from.ErrorType;
|
|
2307
2708
|
}
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
type MempoolClient_Client = Client;
|
|
2311
|
-
type MempoolClient_GetParameters = GetParameters;
|
|
2312
|
-
declare const MempoolClient_connect: typeof connect;
|
|
2313
|
-
declare namespace MempoolClient {
|
|
2314
|
-
export { type MempoolClient_AddParameters as AddParameters, type MempoolClient_Client as Client, type MempoolClient_GetParameters as GetParameters, MempoolClient_connect as connect };
|
|
2315
|
-
}
|
|
2316
|
-
|
|
2709
|
+
//#endregion
|
|
2710
|
+
//#region src/utils/BigMath.d.ts
|
|
2317
2711
|
declare function max$1(a: bigint, b: bigint): bigint;
|
|
2318
2712
|
declare function min(a: bigint, b: bigint): bigint;
|
|
2319
|
-
|
|
2713
|
+
//#endregion
|
|
2714
|
+
//#region src/utils/batch.d.ts
|
|
2320
2715
|
/**
|
|
2321
2716
|
* Splits an array into batches of a specified size.
|
|
2322
2717
|
* @param array The array to split.
|
|
@@ -2334,8 +2729,9 @@ declare function min(a: bigint, b: bigint): bigint;
|
|
|
2334
2729
|
* // [5]
|
|
2335
2730
|
* ```
|
|
2336
2731
|
*/
|
|
2337
|
-
declare function batch<T>(array:
|
|
2338
|
-
|
|
2732
|
+
declare function batch<T>(array: T[] | readonly T[], batchSize: number): Generator<T[], void, unknown>;
|
|
2733
|
+
//#endregion
|
|
2734
|
+
//#region src/utils/batchMulticall.d.ts
|
|
2339
2735
|
/**
|
|
2340
2736
|
* Helper function to execute multicall in batches with retry logic.
|
|
2341
2737
|
* Abstracts the common pattern of batching calls, retrying, and collecting results.
|
|
@@ -2344,60 +2740,54 @@ declare function batch<T>(array: Array<T>, batchSize: number): Generator<T[], vo
|
|
|
2344
2740
|
* @returns Promise resolving to flattened array of results
|
|
2345
2741
|
*/
|
|
2346
2742
|
declare function batchMulticall<TResult>(parameters: {
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2743
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2744
|
+
calls: MulticallParameters["contracts"];
|
|
2745
|
+
batchSize: number;
|
|
2746
|
+
retryAttempts: number;
|
|
2747
|
+
retryDelayMs: number;
|
|
2748
|
+
blockNumber?: bigint;
|
|
2353
2749
|
}): Promise<TResult[]>;
|
|
2354
|
-
|
|
2750
|
+
//#endregion
|
|
2751
|
+
//#region src/utils/lazy.d.ts
|
|
2355
2752
|
/**
|
|
2356
2753
|
* Transform a polling function into an async generator.
|
|
2357
2754
|
* @param fn - The polling function to transform.
|
|
2358
2755
|
* @returns An async generator.
|
|
2359
2756
|
*/
|
|
2360
|
-
declare function lazy<T>(pollFn: (emit: (value: T) => void, {
|
|
2361
|
-
|
|
2757
|
+
declare function lazy<T>(pollFn: (emit: (value: T) => void, {
|
|
2758
|
+
stop
|
|
2759
|
+
}: {
|
|
2760
|
+
stop: () => void;
|
|
2362
2761
|
}) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
|
|
2363
|
-
|
|
2762
|
+
//#endregion
|
|
2763
|
+
//#region src/utils/poll.d.ts
|
|
2364
2764
|
/**
|
|
2365
2765
|
* Polls a function at a specified interval.
|
|
2366
2766
|
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
2367
2767
|
*/
|
|
2368
|
-
declare function poll<data>(fn: ({
|
|
2369
|
-
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2768
|
+
declare function poll<data>(fn: ({
|
|
2769
|
+
unpoll
|
|
2770
|
+
}: {
|
|
2771
|
+
unpoll: () => void;
|
|
2772
|
+
}) => Promise<data | undefined>, {
|
|
2773
|
+
interval
|
|
2774
|
+
}: {
|
|
2775
|
+
interval: () => Promise<number>;
|
|
2372
2776
|
}): () => boolean;
|
|
2373
|
-
|
|
2777
|
+
//#endregion
|
|
2778
|
+
//#region src/utils/retry.d.ts
|
|
2374
2779
|
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
2375
|
-
|
|
2780
|
+
declare namespace time_d_exports {
|
|
2781
|
+
export { max, now };
|
|
2782
|
+
}
|
|
2376
2783
|
declare function now(): number;
|
|
2377
2784
|
declare function max(): number;
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
declare const time_now: typeof now;
|
|
2381
|
-
declare namespace time {
|
|
2382
|
-
export { time_max as max, time_now as now };
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2785
|
+
//#endregion
|
|
2786
|
+
//#region src/utils/wait.d.ts
|
|
2385
2787
|
declare function wait(time: number): Promise<unknown>;
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
declare const index_BaseError: typeof BaseError;
|
|
2389
|
-
type index_GlobalErrorType<name extends string = "Error"> = GlobalErrorType<name>;
|
|
2390
|
-
type index_Snake<T> = Snake<T>;
|
|
2391
|
-
declare const index_batch: typeof batch;
|
|
2392
|
-
declare const index_batchMulticall: typeof batchMulticall;
|
|
2393
|
-
declare const index_lazy: typeof lazy;
|
|
2394
|
-
declare const index_min: typeof min;
|
|
2395
|
-
declare const index_poll: typeof poll;
|
|
2396
|
-
declare const index_retry: typeof retry;
|
|
2397
|
-
declare const index_stringifyBigint: typeof stringifyBigint;
|
|
2398
|
-
declare const index_wait: typeof wait;
|
|
2399
|
-
declare namespace index {
|
|
2400
|
-
export { index_BaseError as BaseError, type index_GlobalErrorType as GlobalErrorType, type index_Snake as Snake, time as Time, index_batch as batch, index_batchMulticall as batchMulticall, fromSnakeCase$3 as fromSnakeCase, index_lazy as lazy, max$1 as max, index_min as min, index_poll as poll, index_retry as retry, index_stringifyBigint as stringifyBigint, toSnakeCase$1 as toSnakeCase, index_wait as wait };
|
|
2788
|
+
declare namespace index_d_exports$2 {
|
|
2789
|
+
export { BaseError, GlobalErrorType, ReorgError, Snake, time_d_exports as Time, batch, batchMulticall, fromSnakeCase$3 as fromSnakeCase, lazy, max$1 as max, min, poll, retry, stringifyBigint, toSnakeCase$1 as toSnakeCase, wait };
|
|
2401
2790
|
}
|
|
2402
|
-
|
|
2403
|
-
export { Abi,
|
|
2791
|
+
//#endregion
|
|
2792
|
+
export { index_d_exports as Abi, Brand, BrandTypeId, Callback_d_exports as Callback, Chain_d_exports as Chain, Collateral_d_exports as Collateral, Compute, Cursor_d_exports as Cursor, ERC4626_d_exports as ERC4626, Errors_d_exports as Errors, Format_d_exports as Format, GateConfig_d_exports as GateConfig, Gatekeeper_d_exports as Gatekeeper, 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 as RouterClient, Rules_d_exports as Rules, time_d_exports as Time, Transfer_d_exports as Transfer, Tree_d_exports as Tree, index_d_exports$2 as Utils, Gate_d_exports as Validation, morphoRules };
|
|
2793
|
+
//# sourceMappingURL=index.browser.d.ts.map
|