@morpho-dev/router 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/chunk-jass6xSI.mjs +13 -0
- package/dist/cli.js +7202 -7027
- 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/migrations/0015_add-lots-table.sql +12 -0
- package/dist/drizzle/migrations/0016_merkle-metadata.sql +26 -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/0003_snapshot.json → migrations/meta/0013_snapshot.json} +535 -708
- package/dist/drizzle/migrations/meta/0014_snapshot.json +1290 -0
- package/dist/drizzle/{router_v1.5/meta/0001_snapshot.json → migrations/meta/0015_snapshot.json} +580 -619
- package/dist/drizzle/{router_v1.5/meta/0002_snapshot.json → migrations/meta/0016_snapshot.json} +714 -646
- package/dist/drizzle/migrations/meta/_journal.json +118 -0
- package/dist/index.browser.d.mts +3008 -0
- package/dist/index.browser.d.mts.map +1 -0
- package/dist/index.browser.d.ts +2418 -1818
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +4099 -2890
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +3903 -2841
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.mts +5657 -0
- package/dist/index.node.d.mts.map +1 -0
- package/dist/index.node.d.ts +4965 -4426
- package/dist/index.node.d.ts.map +1 -0
- package/dist/index.node.js +8465 -7154
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +8205 -7105
- package/dist/index.node.mjs.map +1 -1
- package/package.json +16 -7
- 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/_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,378 @@
|
|
|
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 { BuyVaultV1CallbackData, CallbackType, SellERC20CallbackData, 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
|
+
type BuyVaultV1CallbackData = {
|
|
346
|
+
vaults: Address[];
|
|
347
|
+
amounts: bigint[];
|
|
348
|
+
};
|
|
349
|
+
type SellERC20CallbackData = {
|
|
350
|
+
collaterals: Address[];
|
|
351
|
+
amounts: bigint[];
|
|
352
|
+
};
|
|
353
|
+
declare function encode$3(type: CallbackType.BuyVaultV1Callback, data: BuyVaultV1CallbackData): Hex;
|
|
354
|
+
declare function encode$3(type: CallbackType.SellERC20Callback, data: SellERC20CallbackData): Hex;
|
|
245
355
|
declare function decodeBuyVaultV1Callback(data: Hex): Array<{
|
|
246
|
-
|
|
247
|
-
|
|
356
|
+
contract: Address;
|
|
357
|
+
amount: bigint;
|
|
248
358
|
}>;
|
|
249
359
|
declare function decodeSellERC20Callback(data: Hex): Array<{
|
|
250
|
-
|
|
251
|
-
|
|
360
|
+
contract: Address;
|
|
361
|
+
amount: bigint;
|
|
252
362
|
}>;
|
|
253
363
|
declare function encodeBuyVaultV1Callback(parameters: {
|
|
254
|
-
|
|
255
|
-
|
|
364
|
+
vaults: Address[];
|
|
365
|
+
amounts: bigint[];
|
|
256
366
|
}): Hex;
|
|
257
367
|
declare function encodeSellERC20Callback(parameters: {
|
|
258
|
-
|
|
259
|
-
|
|
368
|
+
collaterals: Address[];
|
|
369
|
+
amounts: bigint[];
|
|
260
370
|
}): 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 };
|
|
371
|
+
declare namespace Errors_d_exports {
|
|
372
|
+
export { BaseError, GlobalErrorType, ReorgError };
|
|
271
373
|
}
|
|
272
|
-
|
|
273
374
|
type GlobalErrorType<name extends string = "Error"> = Error & {
|
|
274
|
-
|
|
375
|
+
name: name;
|
|
275
376
|
};
|
|
276
377
|
/**
|
|
277
378
|
* Base error class inherited by all errors thrown by mempool.
|
|
@@ -283,115 +384,94 @@ type GlobalErrorType<name extends string = "Error"> = Error & {
|
|
|
283
384
|
* ```
|
|
284
385
|
*/
|
|
285
386
|
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;
|
|
387
|
+
details: string;
|
|
388
|
+
shortMessage: string;
|
|
389
|
+
cause: cause;
|
|
390
|
+
name: string;
|
|
391
|
+
constructor(shortMessage: string, options?: {
|
|
392
|
+
cause?: cause | undefined;
|
|
393
|
+
details?: string | undefined;
|
|
394
|
+
metaMessages?: (string | undefined)[] | undefined;
|
|
395
|
+
});
|
|
396
|
+
walk(): Error;
|
|
397
|
+
walk(fn: (err: unknown) => boolean): Error | null;
|
|
398
|
+
}
|
|
399
|
+
declare class ReorgError extends BaseError {
|
|
400
|
+
name: string;
|
|
401
|
+
constructor(blockNumber: number);
|
|
402
|
+
}
|
|
403
|
+
declare namespace Chain_d_exports {
|
|
404
|
+
export { Chain$1 as Chain, ChainId, Id, InvalidBatchSizeError, InvalidBlockRangeError, InvalidBlockWindowError, MissingBlockNumberError, Name, chainIds, chainNames, chains$1 as chains, getChain, getWhitelistedChains, streamLogs };
|
|
405
|
+
}
|
|
406
|
+
type Chain$1 = Compute<Chain<ChainFormatters, {
|
|
407
|
+
morpho: ChainContract;
|
|
408
|
+
morphoBlue: ChainContract;
|
|
409
|
+
mempool: ChainContract;
|
|
410
|
+
vaults: {
|
|
411
|
+
factories: {
|
|
412
|
+
v1_0: ChainContract;
|
|
413
|
+
v1_1: ChainContract;
|
|
314
414
|
};
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
415
|
+
};
|
|
416
|
+
}> & {
|
|
417
|
+
id: Id;
|
|
418
|
+
name: Name;
|
|
419
|
+
}>;
|
|
319
420
|
declare const ChainId: {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
421
|
+
readonly ETHEREUM: 1;
|
|
422
|
+
readonly BASE: 8453;
|
|
423
|
+
readonly "ETHEREUM-VIRTUAL-TESTNET": 109111114;
|
|
424
|
+
readonly ANVIL: 505050505;
|
|
324
425
|
};
|
|
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>;
|
|
426
|
+
type Name = Lowercase<keyof typeof ChainId>;
|
|
427
|
+
declare const chainNames: readonly Name[];
|
|
428
|
+
type Id = (typeof ChainId)[Uppercase<Name>];
|
|
429
|
+
declare const chainIds: readonly Id[];
|
|
430
|
+
declare function getChain(chainId: Id): Chain$1 | undefined;
|
|
431
|
+
declare const getWhitelistedChains: () => Chain$1[];
|
|
432
|
+
declare const chains$1: Record<Lowercase<Name>, Chain$1>;
|
|
341
433
|
declare function streamLogs<abiEvent extends AbiEvent | undefined = undefined>(parameters: {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
434
|
+
client: PublicClient;
|
|
435
|
+
contractAddress?: Address;
|
|
436
|
+
event?: abiEvent;
|
|
437
|
+
blockNumberGte?: number;
|
|
438
|
+
blockNumberLte?: number;
|
|
439
|
+
order: "asc" | "desc";
|
|
440
|
+
options: {
|
|
441
|
+
maxBatchSize?: number;
|
|
442
|
+
blockWindow?: number;
|
|
443
|
+
};
|
|
352
444
|
}): AsyncGenerator<{
|
|
353
|
-
|
|
354
|
-
|
|
445
|
+
logs: GetLogsReturnType<abiEvent | undefined>;
|
|
446
|
+
blockNumber: number;
|
|
355
447
|
}, void, void>;
|
|
356
448
|
declare class InvalidBlockRangeError extends BaseError {
|
|
357
|
-
|
|
358
|
-
|
|
449
|
+
name: string;
|
|
450
|
+
constructor(fromBlock: bigint, toBlock: bigint);
|
|
359
451
|
}
|
|
360
452
|
declare class InvalidBlockWindowError extends BaseError {
|
|
361
|
-
|
|
362
|
-
|
|
453
|
+
name: string;
|
|
454
|
+
constructor(blockWindow: number);
|
|
363
455
|
}
|
|
364
456
|
declare class InvalidBatchSizeError extends BaseError {
|
|
365
|
-
|
|
366
|
-
|
|
457
|
+
name: string;
|
|
458
|
+
constructor(maxBatchSize: number);
|
|
367
459
|
}
|
|
368
460
|
declare class MissingBlockNumberError extends BaseError {
|
|
369
|
-
|
|
370
|
-
|
|
461
|
+
name: string;
|
|
462
|
+
constructor();
|
|
371
463
|
}
|
|
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 };
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/core/types.d.ts
|
|
466
|
+
/** Combines members of an intersection into a readable type. */
|
|
467
|
+
type Compute<type> = { [key in keyof type]: type[key] } & unknown;
|
|
468
|
+
declare const BrandTypeId: unique symbol;
|
|
469
|
+
type Brand<in out ID extends string | symbol> = {
|
|
470
|
+
readonly [BrandTypeId]: { readonly [id in ID]: ID };
|
|
471
|
+
};
|
|
472
|
+
declare namespace LLTV_d_exports {
|
|
473
|
+
export { InvalidLLTVError, InvalidOptionError$1 as InvalidOptionError, LLTV, LLTVSchema, Options, from$12 as from };
|
|
393
474
|
}
|
|
394
|
-
|
|
395
475
|
type LLTV = bigint & Brand<"LLTV">;
|
|
396
476
|
declare const Options: readonly [0.385, 0.5, 0.625, 0.77, 0.86, 0.915, 0.945, 0.965, 0.98];
|
|
397
477
|
type Options = (typeof Options)[number];
|
|
@@ -400,55 +480,48 @@ type Options = (typeof Options)[number];
|
|
|
400
480
|
* @param lltv - The LLTV option or the scaled LLTV.
|
|
401
481
|
* @returns The LLTV.
|
|
402
482
|
*/
|
|
403
|
-
declare function from$
|
|
404
|
-
declare namespace from$
|
|
405
|
-
|
|
483
|
+
declare function from$12(lltv: Options | bigint): LLTV;
|
|
484
|
+
declare namespace from$12 {
|
|
485
|
+
type ErrorType = InvalidOptionError$1 | InvalidLLTVError;
|
|
406
486
|
}
|
|
407
487
|
declare class InvalidOptionError$1 extends BaseError {
|
|
408
|
-
|
|
409
|
-
|
|
488
|
+
readonly name = "LLTV.InvalidOptionError";
|
|
489
|
+
constructor(input: number);
|
|
410
490
|
}
|
|
411
491
|
declare class InvalidLLTVError extends BaseError {
|
|
412
|
-
|
|
413
|
-
|
|
492
|
+
readonly name = "LLTV.InvalidLLTVError";
|
|
493
|
+
constructor(input: bigint);
|
|
414
494
|
}
|
|
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 };
|
|
495
|
+
declare const LLTVSchema: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
496
|
+
declare namespace Collateral_d_exports {
|
|
497
|
+
export { Collateral, CollateralSchema, CollateralsSchema, from$11 as from, random$3 as random };
|
|
424
498
|
}
|
|
425
|
-
|
|
426
499
|
type Collateral = {
|
|
427
|
-
|
|
500
|
+
/** Asset being used as collateral. */
|
|
501
|
+
asset: Address;
|
|
502
|
+
/** Liquidation Loan-to-Value of the collateral. */
|
|
503
|
+
lltv: LLTV;
|
|
504
|
+
/** Oracle contract used to price the collateral. */
|
|
505
|
+
oracle: Address;
|
|
506
|
+
};
|
|
507
|
+
declare const CollateralSchema: z$1.ZodObject<{
|
|
508
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
509
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
510
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
511
|
+
}, z$1.core.$strip>;
|
|
512
|
+
declare const CollateralsSchema: z$1.ZodArray<z$1.ZodObject<{
|
|
513
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
514
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
515
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
516
|
+
}, z$1.core.$strip>>;
|
|
517
|
+
declare const from$11: (parameters: from$11.Parameters) => from$11.ReturnType;
|
|
518
|
+
declare namespace from$11 {
|
|
519
|
+
type Parameters = {
|
|
428
520
|
asset: Address;
|
|
429
|
-
|
|
430
|
-
lltv: LLTV;
|
|
431
|
-
/** Oracle contract used to price the collateral. */
|
|
521
|
+
lltv: Options | bigint;
|
|
432
522
|
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;
|
|
523
|
+
};
|
|
524
|
+
type ReturnType = Collateral;
|
|
452
525
|
}
|
|
453
526
|
/**
|
|
454
527
|
* Generates a random collateral.
|
|
@@ -461,34 +534,107 @@ declare namespace from$8 {
|
|
|
461
534
|
*/
|
|
462
535
|
declare function random$3(): random$3.ReturnType;
|
|
463
536
|
declare namespace random$3 {
|
|
464
|
-
|
|
537
|
+
type ReturnType = Collateral;
|
|
465
538
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
539
|
+
declare namespace ERC4626_d_exports {
|
|
540
|
+
export { DenominatorIsZeroError, convertToAssets, convertToShares, decimalsOffset };
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Calculate the decimals offset used by the ERC4626 implementation.
|
|
544
|
+
* @param parameters - {@link decimalsOffset.Parameters}.
|
|
545
|
+
* @returns The decimals offset.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```ts
|
|
549
|
+
* const decimalsOffset = decimalsOffset({ underlyingDecimals: 6 });
|
|
550
|
+
* // decimalsOffset = 12
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
declare function decimalsOffset(parameters: decimalsOffset.Parameters): number;
|
|
554
|
+
declare namespace decimalsOffset {
|
|
555
|
+
type Parameters = {
|
|
556
|
+
/** The number of decimals of the underlying asset. */
|
|
557
|
+
underlyingDecimals: number;
|
|
558
|
+
};
|
|
559
|
+
type ReturnType = number;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Convert shares to assets.
|
|
563
|
+
* @throws If the denominator is 0. {@link DenominatorIsZeroError}
|
|
564
|
+
* @param parameters - {@link convertToAssets.Parameters}.
|
|
565
|
+
* @returns The amount of assets.
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```ts
|
|
569
|
+
* const assets = convertToAssets(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 18 });
|
|
570
|
+
* // assets = 100n
|
|
571
|
+
* ```
|
|
572
|
+
*/
|
|
573
|
+
declare function convertToAssets(parameters: convertToAssets.Parameters): convertToAssets.ReturnType;
|
|
574
|
+
declare namespace convertToAssets {
|
|
575
|
+
type Parameters = {
|
|
576
|
+
/** The amount of shares to convert. */
|
|
577
|
+
shares: bigint;
|
|
578
|
+
/** Total amount of assets in the vault. */
|
|
579
|
+
totalAssets: bigint;
|
|
580
|
+
/** Total amount of shares in the vault. */
|
|
581
|
+
totalSupply: bigint;
|
|
582
|
+
/**
|
|
583
|
+
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
584
|
+
* Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
|
|
585
|
+
* precision between shares and assets.
|
|
586
|
+
*/
|
|
587
|
+
decimalsOffset: number;
|
|
588
|
+
};
|
|
589
|
+
type ReturnType = bigint;
|
|
590
|
+
type ErrorType = DenominatorIsZeroError;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Convert assets to shares.
|
|
594
|
+
* @throws If the denominator is 0. {@link DenominatorIsZeroError}
|
|
595
|
+
* @param parameters - {@link convertToShares.Parameters}.
|
|
596
|
+
* @returns The amount of shares.
|
|
597
|
+
*
|
|
598
|
+
* @example
|
|
599
|
+
* ```ts
|
|
600
|
+
* const shares = convertToShares(100n, { totalAssets: 1000n, totalSupply: 1000n, decimalsOffset: 12 });
|
|
601
|
+
* // shares = 100n
|
|
602
|
+
* ```
|
|
603
|
+
*/
|
|
604
|
+
declare function convertToShares(parameters: convertToShares.Parameters): convertToShares.ReturnType;
|
|
605
|
+
declare namespace convertToShares {
|
|
606
|
+
type Parameters = {
|
|
607
|
+
/** The amount of assets to convert. */
|
|
608
|
+
assets: bigint;
|
|
609
|
+
/** Total amount of assets in the vault. */
|
|
610
|
+
totalAssets: bigint;
|
|
611
|
+
/** Total amount of shares in the vault. */
|
|
612
|
+
totalSupply: bigint;
|
|
613
|
+
/**
|
|
614
|
+
* OpenZeppelin decimals offset used by the ERC4626 implementation.
|
|
615
|
+
* Calculated to be `max(0, 18 - underlyingDecimals)` at construction, so the initial conversion rate maximizes
|
|
616
|
+
* precision between shares and assets.
|
|
617
|
+
*/
|
|
618
|
+
decimalsOffset: number;
|
|
619
|
+
};
|
|
620
|
+
type ReturnType = bigint;
|
|
621
|
+
type ErrorType = DenominatorIsZeroError;
|
|
622
|
+
}
|
|
623
|
+
declare class DenominatorIsZeroError extends BaseError {
|
|
624
|
+
readonly name = "ERC4626.DenominatorIsZeroError";
|
|
625
|
+
constructor();
|
|
626
|
+
}
|
|
627
|
+
declare namespace Format_d_exports {
|
|
628
|
+
export { Snake, fromSnakeCase$3 as fromSnakeCase, stringifyBigint, toSnakeCase$1 as toSnakeCase };
|
|
472
629
|
}
|
|
473
|
-
|
|
474
630
|
/** The snake case representation of a type with bigint values stringified. */
|
|
475
631
|
type Snake<T> = DeepMutable<SnakeKeys<StringifiedBigint<T>>>;
|
|
476
632
|
/** 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;
|
|
633
|
+
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
634
|
/** 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;
|
|
635
|
+
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
636
|
/** 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;
|
|
637
|
+
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
638
|
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
639
|
/**
|
|
494
640
|
* Formats object keys to snake case.
|
|
@@ -505,33 +651,29 @@ declare function toSnakeCase$1<T>(obj: T): Snake<T>;
|
|
|
505
651
|
*/
|
|
506
652
|
declare function fromSnakeCase$3<T>(obj: Snake<T>): T;
|
|
507
653
|
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 };
|
|
654
|
+
declare namespace Maturity_d_exports {
|
|
655
|
+
export { InvalidDateError, InvalidFormatError, InvalidOptionError, Maturity, MaturityOptions, MaturitySchema, MaturityType, from$10 as from };
|
|
513
656
|
}
|
|
514
|
-
|
|
515
657
|
/**
|
|
516
658
|
* Maturity is a number that represents a date in seconds.
|
|
517
659
|
*/
|
|
518
660
|
type Maturity = number & Brand<"Maturity">;
|
|
519
|
-
declare const MaturitySchema: z.ZodPipe<z.ZodNumber, z.ZodTransform<Maturity, number>>;
|
|
661
|
+
declare const MaturitySchema: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
520
662
|
declare enum MaturityType {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
663
|
+
EndOfWeek = "end_of_week",
|
|
664
|
+
EndOfNextWeek = "end_of_next_week",
|
|
665
|
+
EndOfMonth = "end_of_month",
|
|
666
|
+
EndOfNextMonth = "end_of_next_month",
|
|
667
|
+
EndOfQuarter = "end_of_quarter",
|
|
668
|
+
EndOfNextQuarter = "end_of_next_quarter",
|
|
527
669
|
}
|
|
528
670
|
declare const MaturityOptions: {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
671
|
+
readonly end_of_week: () => Maturity;
|
|
672
|
+
readonly end_of_next_week: () => Maturity;
|
|
673
|
+
readonly end_of_month: () => Maturity;
|
|
674
|
+
readonly end_of_next_month: () => Maturity;
|
|
675
|
+
readonly end_of_quarter: () => Maturity;
|
|
676
|
+
readonly end_of_next_quarter: () => Maturity;
|
|
535
677
|
};
|
|
536
678
|
type MaturityOptions = keyof typeof MaturityOptions;
|
|
537
679
|
/**
|
|
@@ -540,118 +682,117 @@ type MaturityOptions = keyof typeof MaturityOptions;
|
|
|
540
682
|
* @throws {InvalidDateError} If the maturity is in seconds but not a valid date.
|
|
541
683
|
* @throws {InvalidOptionError} If the maturity is not a valid option.
|
|
542
684
|
*/
|
|
543
|
-
declare function from$
|
|
544
|
-
declare namespace from$
|
|
545
|
-
|
|
546
|
-
|
|
685
|
+
declare function from$10(ts: from$10.Parameters): Maturity;
|
|
686
|
+
declare namespace from$10 {
|
|
687
|
+
type Parameters = number | MaturityOptions;
|
|
688
|
+
type ErrorType = InvalidFormatError | InvalidDateError | InvalidOptionError;
|
|
547
689
|
}
|
|
548
690
|
declare class InvalidFormatError extends BaseError {
|
|
549
|
-
|
|
550
|
-
|
|
691
|
+
readonly name = "Maturity.InvalidFormatError";
|
|
692
|
+
constructor();
|
|
551
693
|
}
|
|
552
694
|
declare class InvalidDateError extends BaseError {
|
|
553
|
-
|
|
554
|
-
|
|
695
|
+
readonly name = "Maturity.InvalidDateError";
|
|
696
|
+
constructor(input: number);
|
|
555
697
|
}
|
|
556
698
|
declare class InvalidOptionError extends BaseError {
|
|
557
|
-
|
|
558
|
-
|
|
699
|
+
readonly name = "Maturity.InvalidOptionError";
|
|
700
|
+
constructor(input: string);
|
|
559
701
|
}
|
|
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 };
|
|
702
|
+
declare namespace Offer_d_exports {
|
|
703
|
+
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, serialize, sign, signatureMsg, toSnakeCase, types };
|
|
574
704
|
}
|
|
575
|
-
|
|
576
705
|
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
|
-
|
|
706
|
+
/** The address that made the offer. */
|
|
707
|
+
readonly offering: Address;
|
|
708
|
+
/** The amount of assets offered. */
|
|
709
|
+
readonly assets: bigint;
|
|
710
|
+
/**
|
|
711
|
+
* The amount of assets that can be taken from the offer. takeable = min(max - consumed, available)
|
|
712
|
+
* Where available is the total amount of assets retrievable from offering positions.
|
|
713
|
+
*/
|
|
714
|
+
readonly takeable: bigint;
|
|
715
|
+
/** The interest rate (with 18 decimals). */
|
|
716
|
+
readonly rate: bigint;
|
|
717
|
+
/** The date at which all interests will be paid. */
|
|
718
|
+
readonly maturity: Maturity;
|
|
719
|
+
/** The date at which the offer will expire. */
|
|
720
|
+
readonly expiry: number;
|
|
721
|
+
/** The date at which the offer will start. */
|
|
722
|
+
readonly start: number;
|
|
723
|
+
/** The nonce. Used for OCO (One-Cancelled-Other) mechanism. */
|
|
724
|
+
readonly nonce: bigint;
|
|
725
|
+
/** The side of the offer. `true` for buy, `false` for sell. */
|
|
726
|
+
readonly buy: boolean;
|
|
727
|
+
/** The chain id where the liquidity for this offer is located. */
|
|
728
|
+
readonly chainId: Id;
|
|
729
|
+
/** The token that is being borrowed. */
|
|
730
|
+
readonly loanToken: Address;
|
|
731
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
732
|
+
readonly collaterals: readonly Collateral[];
|
|
733
|
+
/** The optional callback data to retrieve the maker funds. */
|
|
734
|
+
readonly callback: {
|
|
735
|
+
readonly address: Address;
|
|
736
|
+
readonly data: Hex;
|
|
737
|
+
readonly gasLimit: bigint;
|
|
738
|
+
};
|
|
739
|
+
/** The amount of assets consumed from the offer. */
|
|
740
|
+
consumed: bigint;
|
|
741
|
+
/** The hash of the offer. */
|
|
742
|
+
readonly hash: Hex;
|
|
743
|
+
/** The block number at which the offer was created. */
|
|
744
|
+
readonly blockNumber: number;
|
|
745
|
+
/** The signature of the offer. */
|
|
746
|
+
signature?: Hex;
|
|
613
747
|
};
|
|
614
|
-
declare enum
|
|
615
|
-
|
|
616
|
-
|
|
748
|
+
declare enum Status {
|
|
749
|
+
VALID = "VALID",
|
|
750
|
+
SIMULATION_ERROR = "SIMULATION_ERROR",
|
|
617
751
|
}
|
|
618
|
-
|
|
752
|
+
type Validation = {
|
|
753
|
+
offerHash: Hex;
|
|
754
|
+
status: Status;
|
|
755
|
+
};
|
|
756
|
+
declare const OfferHashSchema: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
619
757
|
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
|
-
|
|
758
|
+
omitHash?: boolean;
|
|
759
|
+
}) => z$1.ZodObject<{
|
|
760
|
+
offering: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
761
|
+
assets: z$1.ZodBigInt;
|
|
762
|
+
rate: z$1.ZodBigInt;
|
|
763
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
764
|
+
expiry: z$1.ZodNumber;
|
|
765
|
+
start: z$1.ZodNumber;
|
|
766
|
+
nonce: z$1.ZodBigInt;
|
|
767
|
+
buy: z$1.ZodBoolean;
|
|
768
|
+
chainId: z$1.ZodNumber;
|
|
769
|
+
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
770
|
+
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
771
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
772
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
773
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
774
|
+
}, z$1.core.$strip>>;
|
|
775
|
+
callback: z$1.ZodObject<{
|
|
776
|
+
address: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
777
|
+
data: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
778
|
+
gasLimit: z$1.ZodBigInt;
|
|
779
|
+
}, z$1.core.$strip>;
|
|
780
|
+
signature: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
781
|
+
consumed: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
782
|
+
takeable: z$1.ZodOptional<z$1.ZodBigInt>;
|
|
783
|
+
blockNumber: z$1.ZodOptional<z$1.ZodNumber>;
|
|
784
|
+
}, z$1.core.$strip>;
|
|
646
785
|
/**
|
|
647
786
|
* Creates an offer from a plain object.
|
|
648
787
|
* @throws {InvalidOfferError} If the offer is invalid.
|
|
649
788
|
* @param input - The offer to create.
|
|
650
789
|
* @returns The created offer with its hash.
|
|
651
790
|
*/
|
|
652
|
-
declare function from$
|
|
653
|
-
|
|
654
|
-
|
|
791
|
+
declare function from$9(input: Compute<Omit<Offer, "chainId" | "hash"> & {
|
|
792
|
+
chainId: number;
|
|
793
|
+
}>): Offer;
|
|
794
|
+
declare namespace from$9 {
|
|
795
|
+
type ErrorType = InvalidOfferError;
|
|
655
796
|
}
|
|
656
797
|
/**
|
|
657
798
|
* Creates an offer from a snake case object.
|
|
@@ -659,34 +800,69 @@ declare namespace from$6 {
|
|
|
659
800
|
* @param input - The offer to create.
|
|
660
801
|
* @returns The created offer with its hash.
|
|
661
802
|
*/
|
|
662
|
-
declare function fromSnakeCase$2(input: Snake<Omit<Offer, "hash"
|
|
803
|
+
declare function fromSnakeCase$2(input: Snake<Omit<Offer, "chainId" | "hash"> & {
|
|
804
|
+
chainId: number;
|
|
805
|
+
}>): Offer;
|
|
663
806
|
/**
|
|
664
807
|
* Converts an offer to a snake case object.
|
|
665
808
|
* @param offer - The offer to convert.
|
|
666
809
|
* @returns The converted offer.
|
|
667
810
|
*/
|
|
668
811
|
declare function toSnakeCase(offer: Offer): Snake<Offer>;
|
|
812
|
+
/**
|
|
813
|
+
* Serializes an offer for merkle tree encoding.
|
|
814
|
+
* Converts BigInt fields to strings for JSON compatibility.
|
|
815
|
+
*
|
|
816
|
+
* @param offer - Offer to serialize
|
|
817
|
+
* @returns JSON-serializable offer object
|
|
818
|
+
*/
|
|
819
|
+
declare const serialize: (offer: Offer) => {
|
|
820
|
+
offering: `0x${string}`;
|
|
821
|
+
assets: string;
|
|
822
|
+
rate: string;
|
|
823
|
+
maturity: number;
|
|
824
|
+
expiry: number;
|
|
825
|
+
start: number;
|
|
826
|
+
nonce: string;
|
|
827
|
+
buy: boolean;
|
|
828
|
+
chainId: Id;
|
|
829
|
+
loanToken: `0x${string}`;
|
|
830
|
+
collaterals: {
|
|
831
|
+
asset: `0x${string}`;
|
|
832
|
+
oracle: `0x${string}`;
|
|
833
|
+
lltv: string;
|
|
834
|
+
}[];
|
|
835
|
+
callback: {
|
|
836
|
+
address: `0x${string}`;
|
|
837
|
+
data: `0x${string}`;
|
|
838
|
+
gasLimit: string;
|
|
839
|
+
};
|
|
840
|
+
signature: `0x${string}` | undefined;
|
|
841
|
+
hash: `0x${string}`;
|
|
842
|
+
};
|
|
669
843
|
type RandomConfig = {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
844
|
+
chains?: Chain$1[];
|
|
845
|
+
loanTokens?: Address[];
|
|
846
|
+
collateralTokens?: Address[];
|
|
847
|
+
assetsDecimals?: Record<Address, number>;
|
|
848
|
+
buy?: boolean;
|
|
849
|
+
assets?: bigint;
|
|
850
|
+
consumed?: bigint;
|
|
851
|
+
takeable?: bigint;
|
|
852
|
+
offering?: Address;
|
|
853
|
+
maturity?: Maturity;
|
|
854
|
+
start?: number;
|
|
855
|
+
expiry?: number;
|
|
856
|
+
nonce?: bigint;
|
|
857
|
+
rate?: bigint;
|
|
858
|
+
callback?: {
|
|
859
|
+
address: Address;
|
|
860
|
+
data: Hex;
|
|
861
|
+
gasLimit: bigint;
|
|
862
|
+
};
|
|
863
|
+
collaterals?: readonly Collateral[];
|
|
864
|
+
signature?: Hex;
|
|
865
|
+
blockNumber?: number;
|
|
690
866
|
};
|
|
691
867
|
/**
|
|
692
868
|
* Generates a random Offer.
|
|
@@ -700,9 +876,9 @@ declare function random$2(config?: RandomConfig): Offer;
|
|
|
700
876
|
* @param chainId - The chain ID.
|
|
701
877
|
* @returns The EIP-712 domain object.
|
|
702
878
|
*/
|
|
703
|
-
declare const domain: (chainId:
|
|
704
|
-
|
|
705
|
-
|
|
879
|
+
declare const domain: (chainId: number) => {
|
|
880
|
+
chainId: bigint;
|
|
881
|
+
verifyingContract: "0x0000000000000000000000000000000000000000";
|
|
706
882
|
};
|
|
707
883
|
/**
|
|
708
884
|
* The EIP-712 types for the offer.
|
|
@@ -710,64 +886,64 @@ declare const domain: (chainId: bigint) => {
|
|
|
710
886
|
* @returns The EIP-712 types.
|
|
711
887
|
*/
|
|
712
888
|
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
|
-
|
|
889
|
+
readonly EIP712Domain: readonly [{
|
|
890
|
+
readonly name: "chainId";
|
|
891
|
+
readonly type: "uint256";
|
|
892
|
+
}, {
|
|
893
|
+
readonly name: "verifyingContract";
|
|
894
|
+
readonly type: "address";
|
|
895
|
+
}];
|
|
896
|
+
readonly Offer: readonly [{
|
|
897
|
+
readonly name: "offering";
|
|
898
|
+
readonly type: "address";
|
|
899
|
+
}, {
|
|
900
|
+
readonly name: "assets";
|
|
901
|
+
readonly type: "uint256";
|
|
902
|
+
}, {
|
|
903
|
+
readonly name: "rate";
|
|
904
|
+
readonly type: "uint256";
|
|
905
|
+
}, {
|
|
906
|
+
readonly name: "maturity";
|
|
907
|
+
readonly type: "uint256";
|
|
908
|
+
}, {
|
|
909
|
+
readonly name: "expiry";
|
|
910
|
+
readonly type: "uint256";
|
|
911
|
+
}, {
|
|
912
|
+
readonly name: "nonce";
|
|
913
|
+
readonly type: "uint256";
|
|
914
|
+
}, {
|
|
915
|
+
readonly name: "buy";
|
|
916
|
+
readonly type: "bool";
|
|
917
|
+
}, {
|
|
918
|
+
readonly name: "loanToken";
|
|
919
|
+
readonly type: "address";
|
|
920
|
+
}, {
|
|
921
|
+
readonly name: "collaterals";
|
|
922
|
+
readonly type: "Collateral[]";
|
|
923
|
+
}, {
|
|
924
|
+
readonly name: "callback";
|
|
925
|
+
readonly type: "Callback";
|
|
926
|
+
}];
|
|
927
|
+
readonly Collateral: readonly [{
|
|
928
|
+
readonly name: "asset";
|
|
929
|
+
readonly type: "address";
|
|
930
|
+
}, {
|
|
931
|
+
readonly name: "oracle";
|
|
932
|
+
readonly type: "address";
|
|
933
|
+
}, {
|
|
934
|
+
readonly name: "lltv";
|
|
935
|
+
readonly type: "uint256";
|
|
936
|
+
}];
|
|
937
|
+
readonly Callback: readonly [{
|
|
938
|
+
readonly name: "address";
|
|
939
|
+
readonly type: "address";
|
|
940
|
+
}, {
|
|
941
|
+
readonly name: "data";
|
|
942
|
+
readonly type: "bytes";
|
|
943
|
+
}, {
|
|
944
|
+
readonly name: "gasLimit";
|
|
945
|
+
readonly type: "uint256";
|
|
946
|
+
}];
|
|
771
947
|
};
|
|
772
948
|
/**
|
|
773
949
|
* Signs an array of offers.
|
|
@@ -789,108 +965,88 @@ declare function obligationId(offer: Offer): Hex;
|
|
|
789
965
|
declare function encode$2(offer: Offer): `0x${string}`;
|
|
790
966
|
declare function decode$2(data: Hex, blockNumber: number | bigint): Offer;
|
|
791
967
|
type OfferConsumed = {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
968
|
+
id: string;
|
|
969
|
+
chainId: Id;
|
|
970
|
+
offering: Address;
|
|
971
|
+
nonce: bigint;
|
|
972
|
+
amount: bigint;
|
|
973
|
+
blockNumber: number;
|
|
798
974
|
};
|
|
799
975
|
/**
|
|
800
976
|
* ABI for the Consumed event emitted by the Obligation contract.
|
|
801
977
|
*/
|
|
802
978
|
declare const consumedEvent: {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
979
|
+
readonly type: "event";
|
|
980
|
+
readonly name: "Consumed";
|
|
981
|
+
readonly inputs: readonly [{
|
|
982
|
+
readonly name: "user";
|
|
983
|
+
readonly type: "address";
|
|
984
|
+
readonly indexed: true;
|
|
985
|
+
readonly internalType: "address";
|
|
986
|
+
}, {
|
|
987
|
+
readonly name: "nonce";
|
|
988
|
+
readonly type: "uint256";
|
|
989
|
+
readonly indexed: true;
|
|
990
|
+
readonly internalType: "uint256";
|
|
991
|
+
}, {
|
|
992
|
+
readonly name: "amount";
|
|
993
|
+
readonly type: "uint256";
|
|
994
|
+
readonly indexed: false;
|
|
995
|
+
readonly internalType: "uint256";
|
|
996
|
+
}];
|
|
997
|
+
readonly anonymous: false;
|
|
822
998
|
};
|
|
823
|
-
declare
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
999
|
+
declare class InvalidOfferError extends BaseError<z$1.ZodError | Error> {
|
|
1000
|
+
readonly name = "Offer.InvalidOfferError";
|
|
1001
|
+
constructor(error: z$1.ZodError | Error);
|
|
1002
|
+
/**
|
|
1003
|
+
* Formats ZodError issues into a human-readable string with line breaks.
|
|
1004
|
+
* @example
|
|
1005
|
+
* "- 'assets': too small, expected >= 0
|
|
1006
|
+
* - 'start': must be before expiry"
|
|
1007
|
+
*/
|
|
1008
|
+
static formatDetails(error: z$1.ZodError | Error): string;
|
|
1009
|
+
/**
|
|
1010
|
+
* Returns the formatted human-readable message.
|
|
1011
|
+
*/
|
|
1012
|
+
get formattedMessage(): string;
|
|
835
1013
|
}
|
|
836
1014
|
declare class AccountNotSetError extends BaseError {
|
|
837
|
-
|
|
838
|
-
|
|
1015
|
+
readonly name = "Offer.AccountNotSetError";
|
|
1016
|
+
constructor();
|
|
839
1017
|
}
|
|
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 };
|
|
1018
|
+
declare namespace Liquidity_d_exports {
|
|
1019
|
+
export { LiquidityLink, LiquidityPool, OfferLiquidityPool, calculateMaxDebt, generateAllowancePoolId, generateBalancePoolId, generateBuyVaultCallbackPoolId, generateDebtPoolId, generateMarketLiquidityPoolId, generateObligationCollateralPoolId, generateSellERC20CallbackPoolId, generateUserVaultPositionPoolId, generateVaultPositionPoolId };
|
|
863
1020
|
}
|
|
864
|
-
|
|
865
1021
|
/**
|
|
866
1022
|
* Represents a liquidity pool with a unique ID and amount.
|
|
867
1023
|
*/
|
|
868
1024
|
type LiquidityPool = {
|
|
869
|
-
|
|
870
|
-
|
|
1025
|
+
id: string;
|
|
1026
|
+
amount: bigint;
|
|
871
1027
|
};
|
|
872
1028
|
/**
|
|
873
1029
|
* Represents a hierarchical relationship between two liquidity pools.
|
|
874
1030
|
*/
|
|
875
1031
|
type LiquidityLink = {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1032
|
+
parentPoolId: string;
|
|
1033
|
+
childPoolId: string;
|
|
1034
|
+
priority: number;
|
|
879
1035
|
};
|
|
880
1036
|
/**
|
|
881
1037
|
* Represents the connection between an offer and its liquidity pools.
|
|
882
1038
|
*/
|
|
883
1039
|
type OfferLiquidityPool = {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1040
|
+
offerHash: Offer["hash"];
|
|
1041
|
+
poolId: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* The available capacity/liquidity from this pool for this offer.
|
|
1044
|
+
* Meaning varies by pool type:
|
|
1045
|
+
* - BuyWithEmptyCallback: Matches allowance amount from pool bellow
|
|
1046
|
+
* - SellERC20Callback: Sell Callback/Predeposited -> Maximum debt capacity calculated from collateral (collateralAmount * oraclePrice * lltv)
|
|
1047
|
+
* - SellERC20Callback: Existing debt as negative value (reduces available capacity)
|
|
1048
|
+
*/
|
|
1049
|
+
amount: bigint;
|
|
894
1050
|
};
|
|
895
1051
|
/**
|
|
896
1052
|
* Calculate maximum debt capacity from collateral amount.
|
|
@@ -904,28 +1060,28 @@ declare function calculateMaxDebt(amount: bigint, oraclePrice: bigint, lltv: big
|
|
|
904
1060
|
* Generate pool ID for balance pools.
|
|
905
1061
|
*/
|
|
906
1062
|
declare function generateBalancePoolId(parameters: {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1063
|
+
user: Address;
|
|
1064
|
+
chainId: Id;
|
|
1065
|
+
token: Address;
|
|
910
1066
|
}): string;
|
|
911
1067
|
/**
|
|
912
1068
|
* Generate pool ID for allowance pools.
|
|
913
1069
|
*/
|
|
914
1070
|
declare function generateAllowancePoolId(parameters: {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
1071
|
+
user: Address;
|
|
1072
|
+
chainId: Id;
|
|
1073
|
+
token: Address;
|
|
918
1074
|
}): string;
|
|
919
1075
|
/**
|
|
920
1076
|
* Generate pool ID for sell ERC20 callback pools.
|
|
921
1077
|
* Each offer has its own callback pool to prevent liquidity conflicts.
|
|
922
1078
|
*/
|
|
923
1079
|
declare function generateSellERC20CallbackPoolId(parameters: {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1080
|
+
user: Address;
|
|
1081
|
+
chainId: Id;
|
|
1082
|
+
obligationId: Hex;
|
|
1083
|
+
token: Address;
|
|
1084
|
+
offerHash: Hex;
|
|
929
1085
|
}): string;
|
|
930
1086
|
/**
|
|
931
1087
|
* Generate pool ID for obligation collateral pools.
|
|
@@ -933,89 +1089,74 @@ declare function generateSellERC20CallbackPoolId(parameters: {
|
|
|
933
1089
|
* These pools are shared across all offers with the same obligation.
|
|
934
1090
|
*/
|
|
935
1091
|
declare function generateObligationCollateralPoolId(parameters: {
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1092
|
+
user: Address;
|
|
1093
|
+
chainId: Id;
|
|
1094
|
+
obligationId: Hex;
|
|
1095
|
+
token: Address;
|
|
940
1096
|
}): string;
|
|
941
1097
|
/**
|
|
942
1098
|
* Generate pool ID for buy vault callback pools.
|
|
943
1099
|
*/
|
|
944
1100
|
declare function generateBuyVaultCallbackPoolId(parameters: {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1101
|
+
user: Address;
|
|
1102
|
+
chainId: Id;
|
|
1103
|
+
vault: Address;
|
|
1104
|
+
offerHash: Hex;
|
|
949
1105
|
}): string;
|
|
950
1106
|
/**
|
|
951
1107
|
* Generate pool ID for debt pools.
|
|
952
1108
|
*/
|
|
953
1109
|
declare function generateDebtPoolId(parameters: {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
1110
|
+
user: Address;
|
|
1111
|
+
chainId: Id;
|
|
1112
|
+
obligationId: Hex;
|
|
957
1113
|
}): string;
|
|
958
1114
|
/**
|
|
959
1115
|
* Generate pool ID for user position in a vault.
|
|
960
1116
|
*/
|
|
961
1117
|
declare function generateUserVaultPositionPoolId(parameters: {
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1118
|
+
user: Address;
|
|
1119
|
+
chainId: Id;
|
|
1120
|
+
vault: Address;
|
|
965
1121
|
}): string;
|
|
966
1122
|
/**
|
|
967
1123
|
* Generate pool ID for vault position in a market.
|
|
968
1124
|
*/
|
|
969
1125
|
declare function generateVaultPositionPoolId(parameters: {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1126
|
+
vault: Address;
|
|
1127
|
+
chainId: Id;
|
|
1128
|
+
marketId: string;
|
|
973
1129
|
}): string;
|
|
974
1130
|
/**
|
|
975
1131
|
* Generate pool ID for market total liquidity.
|
|
976
1132
|
*/
|
|
977
1133
|
declare function generateMarketLiquidityPoolId(parameters: {
|
|
978
|
-
|
|
979
|
-
|
|
1134
|
+
chainId: Id;
|
|
1135
|
+
marketId: string;
|
|
980
1136
|
}): 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 };
|
|
1137
|
+
declare namespace Obligation_d_exports {
|
|
1138
|
+
export { CollateralsAreNotSortedError, InvalidObligationError, Obligation, ObligationSchema, from$8 as from, fromSnakeCase$1 as fromSnakeCase, id, random$1 as random };
|
|
997
1139
|
}
|
|
998
|
-
|
|
999
1140
|
type Obligation = {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1141
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
1142
|
+
chainId: Id;
|
|
1143
|
+
/** The token that is being borrowed for this obligation. */
|
|
1144
|
+
loanToken: Address;
|
|
1145
|
+
/** The exact set of collaterals required to borrow the loan token. */
|
|
1146
|
+
collaterals: Collateral[];
|
|
1147
|
+
/** The maturity of the obligation. */
|
|
1148
|
+
maturity: Maturity;
|
|
1008
1149
|
};
|
|
1009
|
-
declare const ObligationSchema: z.ZodObject<{
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
}, z.core.$strip>;
|
|
1150
|
+
declare const ObligationSchema: z$1.ZodObject<{
|
|
1151
|
+
chainId: z$1.ZodNumber;
|
|
1152
|
+
loanToken: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1153
|
+
collaterals: z$1.ZodArray<z$1.ZodObject<{
|
|
1154
|
+
asset: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1155
|
+
oracle: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1156
|
+
lltv: z$1.ZodPipe<z$1.ZodBigInt, z$1.ZodTransform<LLTV, bigint>>;
|
|
1157
|
+
}, z$1.core.$strip>>;
|
|
1158
|
+
maturity: z$1.ZodPipe<z$1.ZodNumber, z$1.ZodTransform<Maturity, number>>;
|
|
1159
|
+
}, z$1.core.$strip>;
|
|
1019
1160
|
/**
|
|
1020
1161
|
* Creates an obligation from the given parameters.
|
|
1021
1162
|
* @constructor
|
|
@@ -1026,7 +1167,7 @@ declare const ObligationSchema: z.ZodObject<{
|
|
|
1026
1167
|
* @example
|
|
1027
1168
|
* ```ts
|
|
1028
1169
|
* const obligation = Obligation.from({
|
|
1029
|
-
* chainId:
|
|
1170
|
+
* chainId: 1,
|
|
1030
1171
|
* loanToken: privateKeyToAccount(generatePrivateKey()).address,
|
|
1031
1172
|
* collaterals: [
|
|
1032
1173
|
* Collateral.from({
|
|
@@ -1039,20 +1180,20 @@ declare const ObligationSchema: z.ZodObject<{
|
|
|
1039
1180
|
* });
|
|
1040
1181
|
* ```
|
|
1041
1182
|
*/
|
|
1042
|
-
declare function from$
|
|
1043
|
-
declare namespace from$
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1183
|
+
declare function from$8(parameters: from$8.Parameters): from$8.ReturnType;
|
|
1184
|
+
declare namespace from$8 {
|
|
1185
|
+
type Parameters = {
|
|
1186
|
+
/** The chain id where the liquidity for this obligation is located. */
|
|
1187
|
+
chainId: number;
|
|
1188
|
+
/** The token that is being borrowed for this obligation. */
|
|
1189
|
+
loanToken: Address;
|
|
1190
|
+
/** The exact set of collaterals required to borrow the loan token. Must be sorted alphabetically by address. */
|
|
1191
|
+
collaterals: from$11.Parameters[] | readonly from$11.Parameters[];
|
|
1192
|
+
/** The maturity of the obligation. */
|
|
1193
|
+
maturity: from$10.Parameters;
|
|
1194
|
+
};
|
|
1195
|
+
type ReturnType = Obligation;
|
|
1196
|
+
type ErrorType = InvalidObligationError;
|
|
1056
1197
|
}
|
|
1057
1198
|
/**
|
|
1058
1199
|
* Creates an obligation from a snake case object.
|
|
@@ -1062,9 +1203,11 @@ declare namespace from$5 {
|
|
|
1062
1203
|
*/
|
|
1063
1204
|
declare function fromSnakeCase$1(input: fromSnakeCase$1.Parameters): fromSnakeCase$1.ReturnType;
|
|
1064
1205
|
declare namespace fromSnakeCase$1 {
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1206
|
+
type Parameters = Snake<Omit<Obligation, "chainId"> & {
|
|
1207
|
+
chainId: number;
|
|
1208
|
+
}>;
|
|
1209
|
+
type ReturnType = Obligation;
|
|
1210
|
+
type ErrorType = InvalidObligationError;
|
|
1068
1211
|
}
|
|
1069
1212
|
/**
|
|
1070
1213
|
* Calculates the obligation id based on the smart contract's Obligation struct.
|
|
@@ -1082,9 +1225,9 @@ declare namespace fromSnakeCase$1 {
|
|
|
1082
1225
|
*/
|
|
1083
1226
|
declare function id(obligation: id.Parameters): id.ReturnType;
|
|
1084
1227
|
declare namespace id {
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1228
|
+
type Parameters = Obligation;
|
|
1229
|
+
type ReturnType = Hex;
|
|
1230
|
+
type ErrorType = CollateralsAreNotSortedError;
|
|
1088
1231
|
}
|
|
1089
1232
|
/**
|
|
1090
1233
|
* Generates a random obligation.
|
|
@@ -1097,49 +1240,150 @@ declare namespace id {
|
|
|
1097
1240
|
*/
|
|
1098
1241
|
declare function random$1(): random$1.ReturnType;
|
|
1099
1242
|
declare namespace random$1 {
|
|
1100
|
-
|
|
1243
|
+
type ReturnType = Obligation;
|
|
1101
1244
|
}
|
|
1102
|
-
declare class InvalidObligationError extends BaseError<z.ZodError | Error> {
|
|
1103
|
-
|
|
1104
|
-
|
|
1245
|
+
declare class InvalidObligationError extends BaseError<z$1.ZodError | Error> {
|
|
1246
|
+
readonly name = "Obligation.InvalidObligationError";
|
|
1247
|
+
constructor(error: z$1.ZodError | Error);
|
|
1105
1248
|
}
|
|
1106
1249
|
declare class CollateralsAreNotSortedError extends BaseError {
|
|
1107
|
-
|
|
1108
|
-
|
|
1250
|
+
readonly name = "Obligation.CollateralsAreNotSortedError";
|
|
1251
|
+
constructor();
|
|
1109
1252
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1253
|
+
declare namespace Oracle_d_exports {
|
|
1254
|
+
export { Conversion, Oracle, from$7 as from };
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* An oracle contract that provides price information for assets.
|
|
1258
|
+
*/
|
|
1259
|
+
type Oracle = {
|
|
1260
|
+
/** The chain id where the oracle is deployed. */
|
|
1261
|
+
readonly chainId: Id;
|
|
1262
|
+
/** The address of the oracle contract. */
|
|
1263
|
+
readonly address: Address;
|
|
1264
|
+
/** The price returned by the oracle (in the oracle's native units), null if no price available. */
|
|
1265
|
+
readonly price: bigint | null;
|
|
1266
|
+
/** The block number at which the price was fetched. */
|
|
1267
|
+
readonly blockNumber: number;
|
|
1268
|
+
};
|
|
1269
|
+
/**
|
|
1270
|
+
* Create an Oracle from a plain object.
|
|
1271
|
+
* @param data - The data to create the oracle from.
|
|
1272
|
+
* @returns The created oracle.
|
|
1273
|
+
*/
|
|
1274
|
+
declare function from$7(data: from$7.Parameters): from$7.ReturnType;
|
|
1275
|
+
declare namespace from$7 {
|
|
1276
|
+
type Parameters = {
|
|
1277
|
+
chainId: Id;
|
|
1278
|
+
address: Address;
|
|
1279
|
+
price: string | null;
|
|
1280
|
+
blockNumber: number;
|
|
1281
|
+
};
|
|
1282
|
+
type ReturnType = Oracle;
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Conversion utilities for converting between collateral and loan token amounts
|
|
1286
|
+
* using oracle prices and LLTV
|
|
1287
|
+
*/
|
|
1288
|
+
declare namespace Conversion {
|
|
1289
|
+
/**
|
|
1290
|
+
* Converts a collateral amount to loan token
|
|
1291
|
+
* Uses the formula: (amount * price / 10^36) * lltv / 10^18
|
|
1292
|
+
*
|
|
1293
|
+
* @param amount - The collateral amount to convert
|
|
1294
|
+
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1295
|
+
* @returns The equivalent loan token amount
|
|
1296
|
+
*/
|
|
1297
|
+
function collateralToLoan(amount: bigint, params: {
|
|
1298
|
+
price: bigint;
|
|
1299
|
+
lltv: bigint;
|
|
1300
|
+
}): bigint;
|
|
1301
|
+
/**
|
|
1302
|
+
* Converts a loan token amount to collateral
|
|
1303
|
+
* Uses the inverse formula: (amount * 10^36 / price) * 10^18 / lltv
|
|
1304
|
+
* Returns 0n if price or lltv is zero (invalid conversion).
|
|
1305
|
+
*
|
|
1306
|
+
* @param amount - The loan token amount to convert
|
|
1307
|
+
* @param params - Conversion parameters containing price (36 decimals) and lltv (18 decimals)
|
|
1308
|
+
* @returns The equivalent collateral amount, or 0n if conversion is invalid
|
|
1309
|
+
*/
|
|
1310
|
+
function loanToCollateral(amount: bigint, params: {
|
|
1311
|
+
price: bigint;
|
|
1312
|
+
lltv: bigint;
|
|
1313
|
+
}): bigint;
|
|
1314
|
+
}
|
|
1315
|
+
declare namespace Position_d_exports {
|
|
1316
|
+
export { Position, Type, from$6 as from };
|
|
1317
|
+
}
|
|
1318
|
+
type Position = {
|
|
1319
|
+
/** The chain id. */
|
|
1320
|
+
chainId: Id;
|
|
1321
|
+
/** The contract address from which the position is called.
|
|
1322
|
+
* While balances are obviously tracked on ERC20 contracts, we prefer to track which contract is called to know the balance.
|
|
1323
|
+
* 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.
|
|
1324
|
+
*/
|
|
1325
|
+
contract: Address;
|
|
1326
|
+
/** The user address. */
|
|
1327
|
+
user: Address;
|
|
1328
|
+
/** The type of position. */
|
|
1329
|
+
type: Type;
|
|
1330
|
+
/** The balance of the position. */
|
|
1331
|
+
balance?: bigint;
|
|
1332
|
+
/** The underlying asset of the position.
|
|
1333
|
+
* For ERC20 positions, this equals the contract address.
|
|
1334
|
+
* For vault positions, this is the vault's underlying asset.
|
|
1335
|
+
*/
|
|
1336
|
+
asset?: Address;
|
|
1337
|
+
/** The block number at which the position was last updated. */
|
|
1338
|
+
blockNumber: number;
|
|
1339
|
+
};
|
|
1340
|
+
declare enum Type {
|
|
1341
|
+
ERC20 = "erc20",
|
|
1342
|
+
VAULT_V1 = "vault_v1",
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* @constructor
|
|
1346
|
+
* Creates a Position.
|
|
1347
|
+
* @param parameters - {@link from.Parameters}
|
|
1348
|
+
* @returns The created Position. {@link from.ReturnType}
|
|
1349
|
+
*/
|
|
1350
|
+
declare function from$6(parameters: from$6.Parameters): from$6.ReturnType;
|
|
1351
|
+
declare namespace from$6 {
|
|
1352
|
+
type Parameters = {
|
|
1353
|
+
chainId: Id;
|
|
1354
|
+
contract: Address;
|
|
1355
|
+
user: Address;
|
|
1356
|
+
type: Type;
|
|
1357
|
+
balance?: bigint;
|
|
1358
|
+
asset?: Address;
|
|
1359
|
+
blockNumber: number;
|
|
1360
|
+
};
|
|
1361
|
+
type ReturnType = Position;
|
|
1362
|
+
}
|
|
1363
|
+
declare namespace Quote_d_exports {
|
|
1364
|
+
export { InvalidQuoteError, Quote, QuoteSchema, from$5 as from, fromSnakeCase, random };
|
|
1120
1365
|
}
|
|
1121
|
-
|
|
1122
1366
|
type Quote = {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1367
|
+
/** The obligation id. */
|
|
1368
|
+
obligationId: Hex;
|
|
1369
|
+
ask: {
|
|
1370
|
+
/** The highest interest rate the seller will accept to pay for the obligation. (18 decimals). */
|
|
1371
|
+
rate: bigint;
|
|
1372
|
+
};
|
|
1373
|
+
bid: {
|
|
1374
|
+
/** The lowest interest rate a buyer is willing to be paid for the obligation. (18 decimals). */
|
|
1375
|
+
rate: bigint;
|
|
1376
|
+
};
|
|
1133
1377
|
};
|
|
1134
|
-
declare const QuoteSchema: z.ZodObject<{
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
}, z.core.$strip>;
|
|
1378
|
+
declare const QuoteSchema: z$1.ZodObject<{
|
|
1379
|
+
obligationId: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
1380
|
+
ask: z$1.ZodObject<{
|
|
1381
|
+
rate: z$1.ZodBigInt;
|
|
1382
|
+
}, z$1.core.$strip>;
|
|
1383
|
+
bid: z$1.ZodObject<{
|
|
1384
|
+
rate: z$1.ZodBigInt;
|
|
1385
|
+
}, z$1.core.$strip>;
|
|
1386
|
+
}, z$1.core.$strip>;
|
|
1143
1387
|
/**
|
|
1144
1388
|
* Creates a quote for a given obligation.
|
|
1145
1389
|
* @constructor
|
|
@@ -1152,11 +1396,11 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
1152
1396
|
* const quote = Quote.from({ obligationId: "0x123", ask: { assets: 100n, rate: 100n }, bid: { assets: 100n, rate: 100n } });
|
|
1153
1397
|
* ```
|
|
1154
1398
|
*/
|
|
1155
|
-
declare function from$
|
|
1156
|
-
declare namespace from$
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1399
|
+
declare function from$5(parameters: from$5.Parameters): from$5.ReturnType;
|
|
1400
|
+
declare namespace from$5 {
|
|
1401
|
+
type Parameters = Quote;
|
|
1402
|
+
type ReturnType = Quote;
|
|
1403
|
+
type ErrorType = InvalidQuoteError;
|
|
1160
1404
|
}
|
|
1161
1405
|
/**
|
|
1162
1406
|
* Creates a quote from a snake case object.
|
|
@@ -1166,9 +1410,9 @@ declare namespace from$4 {
|
|
|
1166
1410
|
*/
|
|
1167
1411
|
declare function fromSnakeCase(snake: fromSnakeCase.Parameters): fromSnakeCase.ReturnType;
|
|
1168
1412
|
declare namespace fromSnakeCase {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1413
|
+
type Parameters = Snake<Quote>;
|
|
1414
|
+
type ReturnType = Quote;
|
|
1415
|
+
type ErrorType = from$5.ErrorType;
|
|
1172
1416
|
}
|
|
1173
1417
|
/**
|
|
1174
1418
|
* Generates a random quote.
|
|
@@ -1181,622 +1425,961 @@ declare namespace fromSnakeCase {
|
|
|
1181
1425
|
*/
|
|
1182
1426
|
declare function random(): random.ReturnType;
|
|
1183
1427
|
declare namespace random {
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
}
|
|
1188
|
-
declare class InvalidQuoteError extends BaseError<z.ZodError | Error> {
|
|
1189
|
-
|
|
1190
|
-
|
|
1428
|
+
type Parameters = never;
|
|
1429
|
+
type ReturnType = Quote;
|
|
1430
|
+
type ErrorType = from$5.ErrorType;
|
|
1431
|
+
}
|
|
1432
|
+
declare class InvalidQuoteError extends BaseError<z$1.ZodError | Error> {
|
|
1433
|
+
readonly name = "Quote.InvalidQuoteError";
|
|
1434
|
+
constructor(error: z$1.ZodError | Error);
|
|
1435
|
+
}
|
|
1436
|
+
declare namespace Transfer_d_exports {
|
|
1437
|
+
export { Transfer, from$4 as from };
|
|
1438
|
+
}
|
|
1439
|
+
type Transfer = {
|
|
1440
|
+
id: string;
|
|
1441
|
+
chainId: Id;
|
|
1442
|
+
contract: Address;
|
|
1443
|
+
from: Address;
|
|
1444
|
+
to: Address;
|
|
1445
|
+
value: bigint;
|
|
1446
|
+
blockNumber: number;
|
|
1447
|
+
};
|
|
1448
|
+
/**
|
|
1449
|
+
* @constructor
|
|
1450
|
+
*
|
|
1451
|
+
* Creates a {@link Transfer}.
|
|
1452
|
+
* @param parameters - {@link from.Parameters}
|
|
1453
|
+
* @returns The created Transfer. {@link from.ReturnType}
|
|
1454
|
+
*
|
|
1455
|
+
* @example
|
|
1456
|
+
* ```ts
|
|
1457
|
+
* const transfer = Transfer.from({ id: "1", chainId: 1, contract: "0x123", from: "0x456", to: "0x789", value: 100n, blockNumber: 100n });
|
|
1458
|
+
* ```
|
|
1459
|
+
*/
|
|
1460
|
+
declare function from$4(parameters: from$4.Parameters): from$4.ReturnType;
|
|
1461
|
+
declare namespace from$4 {
|
|
1462
|
+
type Parameters = {
|
|
1463
|
+
id: string;
|
|
1464
|
+
chainId: Id;
|
|
1465
|
+
contract: Address;
|
|
1466
|
+
from: Address;
|
|
1467
|
+
to: Address;
|
|
1468
|
+
value: bigint;
|
|
1469
|
+
blockNumber: number;
|
|
1470
|
+
};
|
|
1471
|
+
type ReturnType = Transfer;
|
|
1191
1472
|
}
|
|
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 };
|
|
1473
|
+
declare namespace Tree_d_exports {
|
|
1474
|
+
export { DecodeError, EncodeError, Proof, Tree, TreeError, VERSION, decode$1 as decode, encode$1 as encode, encodeUnsigned, from$3 as from, proofs };
|
|
1201
1475
|
}
|
|
1202
|
-
|
|
1476
|
+
/**
|
|
1477
|
+
* A merkle tree of offers built from offer hashes.
|
|
1478
|
+
* Constructed via {@link from}. The tree root can be signed for onchain broadcast.
|
|
1479
|
+
*/
|
|
1203
1480
|
type Tree = Compute<StandardMerkleTree<[Hex]> & {
|
|
1204
|
-
|
|
1205
|
-
|
|
1481
|
+
/** The offers in the tree. */
|
|
1482
|
+
offers: Offer[];
|
|
1483
|
+
/** The root of the tree. */
|
|
1484
|
+
root: Hex;
|
|
1206
1485
|
}>;
|
|
1486
|
+
type Proof = {
|
|
1487
|
+
/** The offer that the proof is for. */
|
|
1488
|
+
offer: Offer;
|
|
1489
|
+
/** The merkle proof path for the offer. */
|
|
1490
|
+
path: Hex[];
|
|
1491
|
+
};
|
|
1207
1492
|
declare const VERSION = 1;
|
|
1208
1493
|
/**
|
|
1209
1494
|
* Builds a Merkle tree from a list of offers.
|
|
1210
1495
|
*
|
|
1211
1496
|
* Leaves are the offer `hash` values as `bytes32` and are deterministically
|
|
1212
|
-
* ordered
|
|
1213
|
-
* regardless of the input order.
|
|
1497
|
+
* ordered following the StandardMerkleTree leaf ordering so that the resulting
|
|
1498
|
+
* root is stable regardless of the input order.
|
|
1214
1499
|
*
|
|
1215
1500
|
* @param offers - Offers to include in the tree.
|
|
1216
1501
|
* @returns A `StandardMerkleTree` of `bytes32` leaves representing the offers.
|
|
1502
|
+
* @throws {TreeError} If tree building fails due to offer inconsistencies.
|
|
1217
1503
|
*/
|
|
1218
1504
|
declare const from$3: (offers: Offer[]) => Tree;
|
|
1219
1505
|
/**
|
|
1220
|
-
*
|
|
1506
|
+
* Generates merkle proofs for all offers in a tree.
|
|
1507
|
+
*
|
|
1508
|
+
* Each proof allows independent verification that an offer is included in the tree
|
|
1509
|
+
* without requiring the full tree. Proofs are ordered by StandardMerkleTree leaf ordering.
|
|
1510
|
+
*
|
|
1511
|
+
* @param tree - The {@link Tree} to generate proofs for.
|
|
1512
|
+
* @returns Array of proofs - {@link Proof}
|
|
1513
|
+
*/
|
|
1514
|
+
declare const proofs: (tree: Tree) => Proof[];
|
|
1515
|
+
/**
|
|
1516
|
+
* Encodes a merkle tree with signature into hex calldata for onchain broadcast.
|
|
1517
|
+
*
|
|
1518
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}{signature}` where:
|
|
1519
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1520
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1521
|
+
* - `{root}`: 32-byte merkle root
|
|
1522
|
+
* - `{signature}`: 65-byte EIP-191 signature over raw root bytes
|
|
1523
|
+
*
|
|
1524
|
+
* Validates signature authenticity and root integrity before encoding.
|
|
1525
|
+
*
|
|
1526
|
+
* @example
|
|
1527
|
+
* ```typescript
|
|
1528
|
+
* const tree = Tree.from(offers);
|
|
1529
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1530
|
+
* const calldata = await Tree.encode(tree, signature);
|
|
1531
|
+
* await broadcast(calldata);
|
|
1532
|
+
* ```
|
|
1221
1533
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1534
|
+
* @example
|
|
1535
|
+
* Manual construction (for advanced users):
|
|
1536
|
+
* ```typescript
|
|
1537
|
+
* const tree = Tree.from(offers);
|
|
1538
|
+
* const compressed = gzip(JSON.stringify(tree.offers.map(Offer.serialize)));
|
|
1539
|
+
* const partial = `0x01${bytesToHex(compressed)}${tree.root.slice(2)}`;
|
|
1540
|
+
* const signature = await wallet.signMessage({ message: { raw: tree.root } });
|
|
1541
|
+
* const calldata = `${partial}${signature.slice(2)}`;
|
|
1542
|
+
* ```
|
|
1224
1543
|
*
|
|
1225
|
-
* @param tree -
|
|
1226
|
-
* @
|
|
1227
|
-
* @
|
|
1544
|
+
* @param tree - Merkle tree of offers
|
|
1545
|
+
* @param signature - EIP-191 signature over raw root bytes
|
|
1546
|
+
* @returns Hex-encoded calldata ready for onchain broadcast
|
|
1547
|
+
* @throws {EncodeError} If signature verification fails or root mismatch
|
|
1228
1548
|
*/
|
|
1229
|
-
declare const encode$1: (tree: Tree) => Hex
|
|
1549
|
+
declare const encode$1: (tree: Tree, signature: Hex) => Promise<Hex>;
|
|
1230
1550
|
/**
|
|
1231
|
-
*
|
|
1551
|
+
* Encodes a merkle tree without a signature into hex payload for client-side signing.
|
|
1232
1552
|
*
|
|
1233
|
-
*
|
|
1234
|
-
* -
|
|
1553
|
+
* Layout: `0x{vv}{gzip([...offers])}{root}` where:
|
|
1554
|
+
* - `{vv}`: 1-byte version (currently 0x01)
|
|
1555
|
+
* - `{gzip([...offers])}`: gzipped JSON array of serialized offers
|
|
1556
|
+
* - `{root}`: 32-byte merkle root
|
|
1235
1557
|
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
* @
|
|
1558
|
+
* Validates root integrity before encoding.
|
|
1559
|
+
*
|
|
1560
|
+
* @param tree - Merkle tree of offers
|
|
1561
|
+
* @returns Hex-encoded unsigned payload
|
|
1562
|
+
* @throws {EncodeError} If root mismatch
|
|
1239
1563
|
*/
|
|
1240
|
-
declare const
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1564
|
+
declare const encodeUnsigned: (tree: Tree) => Hex;
|
|
1565
|
+
/**
|
|
1566
|
+
* Decodes hex calldata into a validated merkle tree.
|
|
1567
|
+
*
|
|
1568
|
+
* Validates signature before decompression for fail-fast rejection of invalid payloads.
|
|
1569
|
+
* Returns the tree with separately validated signature and recovered signer address.
|
|
1570
|
+
*
|
|
1571
|
+
* Validation order:
|
|
1572
|
+
* 1. Version check
|
|
1573
|
+
* 2. Signature verification (fail-fast, before decompression)
|
|
1574
|
+
* 3. Decompression (only if signature valid)
|
|
1575
|
+
* 4. Root verification (computed from offers vs embedded root)
|
|
1576
|
+
*
|
|
1577
|
+
* @example
|
|
1578
|
+
* ```typescript
|
|
1579
|
+
* const { tree, signature, signer } = await Tree.decode(calldata);
|
|
1580
|
+
* console.log(`Tree signed by ${signer} with ${tree.offers.length} offers`);
|
|
1581
|
+
* ```
|
|
1582
|
+
*
|
|
1583
|
+
* @param encoded - Hex calldata in format `0x{vv}{gzip}{root}{signature}`
|
|
1584
|
+
* @returns Validated tree, signature, and recovered signer address
|
|
1585
|
+
* @throws {DecodeError} If version invalid, signature invalid, or root mismatch
|
|
1586
|
+
*/
|
|
1587
|
+
declare const decode$1: (encoded: Hex) => Promise<{
|
|
1588
|
+
tree: Tree;
|
|
1589
|
+
signature: Hex;
|
|
1590
|
+
signer: Address;
|
|
1591
|
+
}>;
|
|
1592
|
+
/**
|
|
1593
|
+
* Error thrown during tree building operations.
|
|
1594
|
+
* Indicates structural issues with the tree (missing offers, inconsistent state).
|
|
1595
|
+
*/
|
|
1596
|
+
declare class TreeError extends BaseError {
|
|
1597
|
+
name: string;
|
|
1598
|
+
constructor(reason: string);
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Error thrown during tree encoding.
|
|
1602
|
+
* Indicates validation failures (signature, root mismatch, mixed makers).
|
|
1603
|
+
*/
|
|
1604
|
+
declare class EncodeError extends BaseError {
|
|
1605
|
+
name: string;
|
|
1606
|
+
constructor(reason: string);
|
|
1246
1607
|
}
|
|
1247
|
-
|
|
1608
|
+
/**
|
|
1609
|
+
* Error thrown during tree decoding.
|
|
1610
|
+
* Indicates payload corruption, version mismatch, or validation failures.
|
|
1611
|
+
*/
|
|
1612
|
+
declare class DecodeError extends BaseError {
|
|
1613
|
+
name: string;
|
|
1614
|
+
constructor(reason: string);
|
|
1615
|
+
}
|
|
1616
|
+
//#endregion
|
|
1617
|
+
//#region src/api/Schema/generated/swagger.d.ts
|
|
1248
1618
|
/**
|
|
1249
1619
|
* This file was auto-generated by openapi-typescript.
|
|
1250
1620
|
* Do not make direct changes to the file.
|
|
1251
1621
|
*/
|
|
1252
1622
|
|
|
1253
1623
|
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;
|
|
1624
|
+
"/v1/books/{obligationId}/{side}": {
|
|
1625
|
+
parameters: {
|
|
1626
|
+
query?: never;
|
|
1627
|
+
header?: never;
|
|
1628
|
+
path?: never;
|
|
1629
|
+
cookie?: never;
|
|
1319
1630
|
};
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
cursor?: string;
|
|
1338
|
-
};
|
|
1339
|
-
header?: never;
|
|
1340
|
-
path?: never;
|
|
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
|
-
};
|
|
1631
|
+
/**
|
|
1632
|
+
* Get aggregated book
|
|
1633
|
+
* @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).
|
|
1634
|
+
*/
|
|
1635
|
+
get: {
|
|
1636
|
+
parameters: {
|
|
1637
|
+
query?: {
|
|
1638
|
+
/**
|
|
1639
|
+
* @description Maximum number of rate levels to return.
|
|
1640
|
+
* @example 10
|
|
1641
|
+
*/
|
|
1642
|
+
limit?: number;
|
|
1643
|
+
/**
|
|
1644
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
1645
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
1646
|
+
*/
|
|
1647
|
+
cursor?: string;
|
|
1364
1648
|
};
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1649
|
+
header?: never;
|
|
1650
|
+
path?: never;
|
|
1651
|
+
cookie?: never;
|
|
1652
|
+
};
|
|
1653
|
+
requestBody?: never;
|
|
1654
|
+
responses: {
|
|
1655
|
+
/** @description Success */
|
|
1656
|
+
200: {
|
|
1657
|
+
headers: {
|
|
1658
|
+
[name: string]: unknown;
|
|
1659
|
+
};
|
|
1660
|
+
content: {
|
|
1661
|
+
"application/json": components["schemas"]["BookListResponse"];
|
|
1662
|
+
};
|
|
1379
1663
|
};
|
|
1380
|
-
/**
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
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
|
-
};
|
|
1664
|
+
/** @description Bad Request */
|
|
1665
|
+
400: {
|
|
1666
|
+
headers: {
|
|
1667
|
+
[name: string]: unknown;
|
|
1668
|
+
};
|
|
1669
|
+
content: {
|
|
1670
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1671
|
+
};
|
|
1412
1672
|
};
|
|
1413
|
-
|
|
1414
|
-
post?: never;
|
|
1415
|
-
delete?: never;
|
|
1416
|
-
options?: never;
|
|
1417
|
-
head?: never;
|
|
1418
|
-
patch?: never;
|
|
1419
|
-
trace?: never;
|
|
1673
|
+
};
|
|
1420
1674
|
};
|
|
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;
|
|
1675
|
+
put?: never;
|
|
1676
|
+
post?: never;
|
|
1677
|
+
delete?: never;
|
|
1678
|
+
options?: never;
|
|
1679
|
+
head?: never;
|
|
1680
|
+
patch?: never;
|
|
1681
|
+
trace?: never;
|
|
1682
|
+
};
|
|
1683
|
+
"/v1/offers": {
|
|
1684
|
+
parameters: {
|
|
1685
|
+
query?: never;
|
|
1686
|
+
header?: never;
|
|
1687
|
+
path?: never;
|
|
1688
|
+
cookie?: never;
|
|
1459
1689
|
};
|
|
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
|
-
|
|
1690
|
+
/**
|
|
1691
|
+
* List all offers
|
|
1692
|
+
* @description Returns offers. Provide either `obligation_id` + `side` (order book) or `offering` (by maker).
|
|
1693
|
+
*/
|
|
1694
|
+
get: {
|
|
1695
|
+
parameters: {
|
|
1696
|
+
query?: {
|
|
1697
|
+
/**
|
|
1698
|
+
* @description Maximum number of offers to return.
|
|
1699
|
+
* @example 10
|
|
1700
|
+
*/
|
|
1701
|
+
limit?: number;
|
|
1702
|
+
/**
|
|
1703
|
+
* @description Pagination cursor in base64url-encoded format.
|
|
1704
|
+
* @example eyJvZmZzZXQiOjEwMH0
|
|
1705
|
+
*/
|
|
1706
|
+
cursor?: string;
|
|
1707
|
+
/**
|
|
1708
|
+
* @description Maker address to filter offers by. Alternative to obligation_id + side.
|
|
1709
|
+
* @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401
|
|
1710
|
+
*/
|
|
1711
|
+
offering?: string;
|
|
1712
|
+
/**
|
|
1713
|
+
* @description Obligation id used to filter offers. Required when not using offering.
|
|
1714
|
+
* @example 0x1234567890123456789012345678901234567890123456789012345678901234
|
|
1715
|
+
*/
|
|
1716
|
+
obligation_id?: string;
|
|
1717
|
+
/**
|
|
1718
|
+
* @description Side of the offer. Required when using obligation_id.
|
|
1719
|
+
* @example buy
|
|
1720
|
+
*/
|
|
1721
|
+
side?: "buy" | "sell";
|
|
1490
1722
|
};
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1723
|
+
header?: never;
|
|
1724
|
+
path?: never;
|
|
1725
|
+
cookie?: never;
|
|
1726
|
+
};
|
|
1727
|
+
requestBody?: never;
|
|
1728
|
+
responses: {
|
|
1729
|
+
/** @description Success */
|
|
1730
|
+
200: {
|
|
1731
|
+
headers: {
|
|
1732
|
+
[name: string]: unknown;
|
|
1733
|
+
};
|
|
1734
|
+
content: {
|
|
1735
|
+
"application/json": components["schemas"]["OfferListResponse"];
|
|
1736
|
+
};
|
|
1505
1737
|
};
|
|
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
|
-
};
|
|
1738
|
+
/** @description Bad Request */
|
|
1739
|
+
400: {
|
|
1740
|
+
headers: {
|
|
1741
|
+
[name: string]: unknown;
|
|
1742
|
+
};
|
|
1743
|
+
content: {
|
|
1744
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1745
|
+
};
|
|
1529
1746
|
};
|
|
1530
|
-
|
|
1531
|
-
post?: never;
|
|
1532
|
-
delete?: never;
|
|
1533
|
-
options?: never;
|
|
1534
|
-
head?: never;
|
|
1535
|
-
patch?: never;
|
|
1536
|
-
trace?: never;
|
|
1747
|
+
};
|
|
1537
1748
|
};
|
|
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"][];
|
|
1749
|
+
put?: never;
|
|
1750
|
+
post?: never;
|
|
1751
|
+
delete?: never;
|
|
1752
|
+
options?: never;
|
|
1753
|
+
head?: never;
|
|
1754
|
+
patch?: never;
|
|
1755
|
+
trace?: never;
|
|
1756
|
+
};
|
|
1757
|
+
"/v1/obligations": {
|
|
1758
|
+
parameters: {
|
|
1759
|
+
query?: never;
|
|
1760
|
+
header?: never;
|
|
1761
|
+
path?: never;
|
|
1762
|
+
cookie?: never;
|
|
1763
|
+
};
|
|
1764
|
+
/**
|
|
1765
|
+
* List all obligations
|
|
1766
|
+
* @description Returns a list of obligations with their current best ask and bid. Obligations are sorted by their id in ascending order by default.
|
|
1767
|
+
*/
|
|
1768
|
+
get: {
|
|
1769
|
+
parameters: {
|
|
1770
|
+
query?: {
|
|
1771
|
+
/** @example 10 */
|
|
1772
|
+
limit?: number;
|
|
1773
|
+
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
1774
|
+
cursor?: string;
|
|
1682
1775
|
};
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1776
|
+
header?: never;
|
|
1777
|
+
path?: never;
|
|
1778
|
+
cookie?: never;
|
|
1779
|
+
};
|
|
1780
|
+
requestBody?: never;
|
|
1781
|
+
responses: {
|
|
1782
|
+
/** @description Success */
|
|
1783
|
+
200: {
|
|
1784
|
+
headers: {
|
|
1785
|
+
[name: string]: unknown;
|
|
1786
|
+
};
|
|
1787
|
+
content: {
|
|
1788
|
+
"application/json": components["schemas"]["ObligationListResponse"];
|
|
1789
|
+
};
|
|
1695
1790
|
};
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1791
|
+
/** @description Bad Request */
|
|
1792
|
+
400: {
|
|
1793
|
+
headers: {
|
|
1794
|
+
[name: string]: unknown;
|
|
1795
|
+
};
|
|
1796
|
+
content: {
|
|
1797
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1798
|
+
};
|
|
1699
1799
|
};
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1800
|
+
};
|
|
1801
|
+
};
|
|
1802
|
+
put?: never;
|
|
1803
|
+
post?: never;
|
|
1804
|
+
delete?: never;
|
|
1805
|
+
options?: never;
|
|
1806
|
+
head?: never;
|
|
1807
|
+
patch?: never;
|
|
1808
|
+
trace?: never;
|
|
1809
|
+
};
|
|
1810
|
+
"/v1/obligations/{obligationId}": {
|
|
1811
|
+
parameters: {
|
|
1812
|
+
query?: never;
|
|
1813
|
+
header?: never;
|
|
1814
|
+
path?: never;
|
|
1815
|
+
cookie?: never;
|
|
1816
|
+
};
|
|
1817
|
+
/**
|
|
1818
|
+
* Get an obligation
|
|
1819
|
+
* @description Returns an obligation by its id.
|
|
1820
|
+
*/
|
|
1821
|
+
get: {
|
|
1822
|
+
parameters: {
|
|
1823
|
+
query?: never;
|
|
1824
|
+
header?: never;
|
|
1825
|
+
path?: never;
|
|
1826
|
+
cookie?: never;
|
|
1827
|
+
};
|
|
1828
|
+
requestBody?: never;
|
|
1829
|
+
responses: {
|
|
1830
|
+
/** @description Success */
|
|
1831
|
+
200: {
|
|
1832
|
+
headers: {
|
|
1833
|
+
[name: string]: unknown;
|
|
1834
|
+
};
|
|
1835
|
+
content: {
|
|
1836
|
+
"application/json": components["schemas"]["ObligationSingleSuccessResponse"];
|
|
1837
|
+
};
|
|
1703
1838
|
};
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1839
|
+
/** @description Bad Request */
|
|
1840
|
+
400: {
|
|
1841
|
+
headers: {
|
|
1842
|
+
[name: string]: unknown;
|
|
1843
|
+
};
|
|
1844
|
+
content: {
|
|
1845
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
1846
|
+
};
|
|
1712
1847
|
};
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1848
|
+
};
|
|
1849
|
+
};
|
|
1850
|
+
put?: never;
|
|
1851
|
+
post?: never;
|
|
1852
|
+
delete?: never;
|
|
1853
|
+
options?: never;
|
|
1854
|
+
head?: never;
|
|
1855
|
+
patch?: never;
|
|
1856
|
+
trace?: never;
|
|
1857
|
+
};
|
|
1858
|
+
"/v1/health": {
|
|
1859
|
+
parameters: {
|
|
1860
|
+
query?: never;
|
|
1861
|
+
header?: never;
|
|
1862
|
+
path?: never;
|
|
1863
|
+
cookie?: never;
|
|
1864
|
+
};
|
|
1865
|
+
/**
|
|
1866
|
+
* Retrieve global health
|
|
1867
|
+
* @description Returns the aggregated status of the router.
|
|
1868
|
+
*/
|
|
1869
|
+
get: {
|
|
1870
|
+
parameters: {
|
|
1871
|
+
query?: never;
|
|
1872
|
+
header?: never;
|
|
1873
|
+
path?: never;
|
|
1874
|
+
cookie?: never;
|
|
1875
|
+
};
|
|
1876
|
+
requestBody?: never;
|
|
1877
|
+
responses: {
|
|
1878
|
+
/** @description Success */
|
|
1879
|
+
200: {
|
|
1880
|
+
headers: {
|
|
1881
|
+
[name: string]: unknown;
|
|
1882
|
+
};
|
|
1883
|
+
content: {
|
|
1884
|
+
"application/json": components["schemas"]["RouterStatusSuccessResponse"];
|
|
1885
|
+
};
|
|
1724
1886
|
};
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1887
|
+
};
|
|
1888
|
+
};
|
|
1889
|
+
put?: never;
|
|
1890
|
+
post?: never;
|
|
1891
|
+
delete?: never;
|
|
1892
|
+
options?: never;
|
|
1893
|
+
head?: never;
|
|
1894
|
+
patch?: never;
|
|
1895
|
+
trace?: never;
|
|
1896
|
+
};
|
|
1897
|
+
"/v1/health/collectors": {
|
|
1898
|
+
parameters: {
|
|
1899
|
+
query?: never;
|
|
1900
|
+
header?: never;
|
|
1901
|
+
path?: never;
|
|
1902
|
+
cookie?: never;
|
|
1903
|
+
};
|
|
1904
|
+
/**
|
|
1905
|
+
* Retrieve collectors health
|
|
1906
|
+
* @description Returns the latest block numbers processed by collectors and their sync status.
|
|
1907
|
+
*/
|
|
1908
|
+
get: {
|
|
1909
|
+
parameters: {
|
|
1910
|
+
query?: never;
|
|
1911
|
+
header?: never;
|
|
1912
|
+
path?: never;
|
|
1913
|
+
cookie?: never;
|
|
1914
|
+
};
|
|
1915
|
+
requestBody?: never;
|
|
1916
|
+
responses: {
|
|
1917
|
+
/** @description Success */
|
|
1918
|
+
200: {
|
|
1919
|
+
headers: {
|
|
1920
|
+
[name: string]: unknown;
|
|
1921
|
+
};
|
|
1922
|
+
content: {
|
|
1923
|
+
"application/json": components["schemas"]["CollectorsHealthSuccessResponse"];
|
|
1924
|
+
};
|
|
1731
1925
|
};
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1926
|
+
};
|
|
1927
|
+
};
|
|
1928
|
+
put?: never;
|
|
1929
|
+
post?: never;
|
|
1930
|
+
delete?: never;
|
|
1931
|
+
options?: never;
|
|
1932
|
+
head?: never;
|
|
1933
|
+
patch?: never;
|
|
1934
|
+
trace?: never;
|
|
1935
|
+
};
|
|
1936
|
+
"/v1/health/chains": {
|
|
1937
|
+
parameters: {
|
|
1938
|
+
query?: never;
|
|
1939
|
+
header?: never;
|
|
1940
|
+
path?: never;
|
|
1941
|
+
cookie?: never;
|
|
1942
|
+
};
|
|
1943
|
+
/**
|
|
1944
|
+
* Retrieve chains health
|
|
1945
|
+
* @description Returns the latest block that can be processed by collectors for each chain.
|
|
1946
|
+
*/
|
|
1947
|
+
get: {
|
|
1948
|
+
parameters: {
|
|
1949
|
+
query?: never;
|
|
1950
|
+
header?: never;
|
|
1951
|
+
path?: never;
|
|
1952
|
+
cookie?: never;
|
|
1953
|
+
};
|
|
1954
|
+
requestBody?: never;
|
|
1955
|
+
responses: {
|
|
1956
|
+
/** @description Success */
|
|
1957
|
+
200: {
|
|
1958
|
+
headers: {
|
|
1959
|
+
[name: string]: unknown;
|
|
1960
|
+
};
|
|
1961
|
+
content: {
|
|
1962
|
+
"application/json": components["schemas"]["ChainsHealthSuccessResponse"];
|
|
1963
|
+
};
|
|
1750
1964
|
};
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1965
|
+
};
|
|
1966
|
+
};
|
|
1967
|
+
put?: never;
|
|
1968
|
+
post?: never;
|
|
1969
|
+
delete?: never;
|
|
1970
|
+
options?: never;
|
|
1971
|
+
head?: never;
|
|
1972
|
+
patch?: never;
|
|
1973
|
+
trace?: never;
|
|
1974
|
+
};
|
|
1975
|
+
"/v1/validate": {
|
|
1976
|
+
parameters: {
|
|
1977
|
+
query?: never;
|
|
1978
|
+
header?: never;
|
|
1979
|
+
path?: never;
|
|
1980
|
+
cookie?: never;
|
|
1981
|
+
};
|
|
1982
|
+
get?: never;
|
|
1983
|
+
put?: never;
|
|
1984
|
+
/**
|
|
1985
|
+
* Validate offers
|
|
1986
|
+
* @description Validates offers against router validation rules. Returns unsigned payload + root on success, or issues only on validation failure.
|
|
1987
|
+
*
|
|
1988
|
+
* **Available validation rules:**
|
|
1989
|
+
* - **parse_error**: Returns when an offer fails to parse due to invalid format or missing required fields
|
|
1990
|
+
* - **mixed_maker**: Validates that all offers in a batch have the same maker (offering address)
|
|
1991
|
+
* - **chain_ids**: Validates that offer chain is one of: [109111114]
|
|
1992
|
+
* - **maturity**: Validates that offer maturity is one of: [end_of_month, end_of_next_month]
|
|
1993
|
+
* - **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]
|
|
1994
|
+
* - **token**: Validates that offer loan token and collateral tokens are in the allowed assets list
|
|
1995
|
+
*/
|
|
1996
|
+
post: {
|
|
1997
|
+
parameters: {
|
|
1998
|
+
query?: never;
|
|
1999
|
+
header?: never;
|
|
2000
|
+
path?: never;
|
|
2001
|
+
cookie?: never;
|
|
2002
|
+
};
|
|
2003
|
+
requestBody?: {
|
|
2004
|
+
content: {
|
|
2005
|
+
"application/json": components["schemas"]["ValidateOffersRequest"];
|
|
1767
2006
|
};
|
|
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"][];
|
|
2007
|
+
};
|
|
2008
|
+
responses: {
|
|
2009
|
+
/** @description Success */
|
|
2010
|
+
200: {
|
|
2011
|
+
headers: {
|
|
2012
|
+
[name: string]: unknown;
|
|
2013
|
+
};
|
|
2014
|
+
content: {
|
|
2015
|
+
"application/json": components["schemas"]["ValidationSuccessResponse"];
|
|
2016
|
+
};
|
|
1783
2017
|
};
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
2018
|
+
/** @description Bad Request */
|
|
2019
|
+
400: {
|
|
2020
|
+
headers: {
|
|
2021
|
+
[name: string]: unknown;
|
|
2022
|
+
};
|
|
2023
|
+
content: {
|
|
2024
|
+
"application/json": components["schemas"]["BadRequestResponse"];
|
|
2025
|
+
};
|
|
1791
2026
|
};
|
|
2027
|
+
};
|
|
1792
2028
|
};
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
2029
|
+
delete?: never;
|
|
2030
|
+
options?: never;
|
|
2031
|
+
head?: never;
|
|
2032
|
+
patch?: never;
|
|
2033
|
+
trace?: never;
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
interface components {
|
|
2037
|
+
schemas: {
|
|
2038
|
+
BookListResponse: {
|
|
2039
|
+
meta: components["schemas"]["Meta"];
|
|
2040
|
+
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2041
|
+
cursor: string | null;
|
|
2042
|
+
/** @description Aggregated book levels grouped by rate. */
|
|
2043
|
+
data: components["schemas"]["BookLevelResponse"][];
|
|
2044
|
+
};
|
|
2045
|
+
Meta: {
|
|
2046
|
+
/** @example 2024-01-01T12:00:00.000Z */
|
|
2047
|
+
timestamp: string;
|
|
2048
|
+
};
|
|
2049
|
+
BookLevelResponse: {
|
|
2050
|
+
/** @example 2750000000000000000 */
|
|
2051
|
+
rate: string;
|
|
2052
|
+
/** @example 369216000000000000000000 */
|
|
2053
|
+
assets: string;
|
|
2054
|
+
/** @example 5 */
|
|
2055
|
+
count: number;
|
|
2056
|
+
};
|
|
2057
|
+
BadRequestResponse: {
|
|
2058
|
+
error: components["schemas"]["ErrorResponse"];
|
|
2059
|
+
meta: components["schemas"]["Meta"];
|
|
2060
|
+
};
|
|
2061
|
+
ErrorResponse: {
|
|
2062
|
+
/**
|
|
2063
|
+
* @example VALIDATION_ERROR
|
|
2064
|
+
* @enum {string}
|
|
2065
|
+
*/
|
|
2066
|
+
code: "VALIDATION_ERROR" | "NOT_FOUND" | "INTERNAL_SERVER_ERROR" | "BAD_REQUEST";
|
|
2067
|
+
/** @example Limit must be greater than 0. */
|
|
2068
|
+
message: string;
|
|
2069
|
+
/**
|
|
2070
|
+
* @example [
|
|
2071
|
+
* {
|
|
2072
|
+
* "field": "limit",
|
|
2073
|
+
* "issue": "Limit must be greater than 0."
|
|
2074
|
+
* }
|
|
2075
|
+
* ]
|
|
2076
|
+
*/
|
|
2077
|
+
details: Record<string, never>;
|
|
2078
|
+
};
|
|
2079
|
+
OfferListResponse: {
|
|
2080
|
+
meta: components["schemas"]["Meta"];
|
|
2081
|
+
/** @example eyJvZmZzZXQiOjEwMH0 */
|
|
2082
|
+
cursor: string | null;
|
|
2083
|
+
/**
|
|
2084
|
+
* @description Offers matching the provided filters.
|
|
2085
|
+
* @example [
|
|
2086
|
+
* {
|
|
2087
|
+
* "hash": "0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427",
|
|
2088
|
+
* "offering": "0x7b093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2089
|
+
* "assets": "369216000000000000000000",
|
|
2090
|
+
* "rate": "2750000000000000000",
|
|
2091
|
+
* "maturity": 1761922799,
|
|
2092
|
+
* "expiry": 1761922799,
|
|
2093
|
+
* "start": 1761922790,
|
|
2094
|
+
* "nonce": "571380",
|
|
2095
|
+
* "buy": false,
|
|
2096
|
+
* "chain_id": 1,
|
|
2097
|
+
* "loan_token": "0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078",
|
|
2098
|
+
* "collaterals": [
|
|
2099
|
+
* {
|
|
2100
|
+
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2101
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2102
|
+
* "lltv": "860000000000000000"
|
|
2103
|
+
* }
|
|
2104
|
+
* ],
|
|
2105
|
+
* "callback": {
|
|
2106
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2107
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2108
|
+
* "gas_limit": "500000"
|
|
2109
|
+
* },
|
|
2110
|
+
* "consumed": "0",
|
|
2111
|
+
* "takeable": "369216000000000000000000",
|
|
2112
|
+
* "block_number": 2942933377146801,
|
|
2113
|
+
* "root": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
|
|
2114
|
+
* "proof": [
|
|
2115
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
2116
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2117
|
+
* ],
|
|
2118
|
+
* "signature": "0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400"
|
|
2119
|
+
* }
|
|
2120
|
+
* ]
|
|
2121
|
+
*/
|
|
2122
|
+
data: components["schemas"]["OfferListItemResponse"][];
|
|
2123
|
+
};
|
|
2124
|
+
OfferListItemResponse: {
|
|
2125
|
+
/** @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427 */
|
|
2126
|
+
hash: string;
|
|
2127
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2128
|
+
offering: string;
|
|
2129
|
+
/** @example 369216000000000000000000 */
|
|
2130
|
+
assets: string;
|
|
2131
|
+
/** @example 2750000000000000000 */
|
|
2132
|
+
rate: string;
|
|
2133
|
+
/** @example 1761922799 */
|
|
2134
|
+
maturity: number;
|
|
2135
|
+
/** @example 1761922799 */
|
|
2136
|
+
expiry: number;
|
|
2137
|
+
/** @example 1761922790 */
|
|
2138
|
+
start: number;
|
|
2139
|
+
/** @example 571380 */
|
|
2140
|
+
nonce: string;
|
|
2141
|
+
/** @example false */
|
|
2142
|
+
buy: boolean;
|
|
2143
|
+
/** @example 1 */
|
|
2144
|
+
chain_id: number;
|
|
2145
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2146
|
+
loan_token: string;
|
|
2147
|
+
/**
|
|
2148
|
+
* @example [
|
|
2149
|
+
* {
|
|
2150
|
+
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2151
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2152
|
+
* "lltv": "860000000000000000"
|
|
2153
|
+
* }
|
|
2154
|
+
* ]
|
|
2155
|
+
*/
|
|
2156
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2157
|
+
/**
|
|
2158
|
+
* @example {
|
|
2159
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2160
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2161
|
+
* "gas_limit": "500000"
|
|
2162
|
+
* }
|
|
2163
|
+
*/
|
|
2164
|
+
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2165
|
+
/** @example 369216000000000000000000 */
|
|
2166
|
+
takeable: string;
|
|
2167
|
+
/** @example 0 */
|
|
2168
|
+
consumed: string;
|
|
2169
|
+
/** @example 2942933377146801 */
|
|
2170
|
+
block_number: number;
|
|
2171
|
+
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef */
|
|
2172
|
+
root: string | null;
|
|
2173
|
+
/**
|
|
2174
|
+
* @example [
|
|
2175
|
+
* "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
|
|
2176
|
+
* "0x9876543210fedcba9876543210fedcba9876543210fedcba9876543210fedcba"
|
|
2177
|
+
* ]
|
|
2178
|
+
*/
|
|
2179
|
+
proof: string[] | null;
|
|
2180
|
+
/** @example 0x1234567890123456789012345678901234567890123456789012345678901234123456789012345678901234567890123456789012345678901234567890123400 */
|
|
2181
|
+
signature: string | null;
|
|
2182
|
+
};
|
|
2183
|
+
CollateralResponse: {
|
|
2184
|
+
/** @example 0x34Cf890dB685FC536E05652FB41f02090c3fb751 */
|
|
2185
|
+
asset: string;
|
|
2186
|
+
/** @example 0x45093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2187
|
+
oracle: string;
|
|
2188
|
+
/** @example 860000000000000000 */
|
|
2189
|
+
lltv: string;
|
|
2190
|
+
};
|
|
2191
|
+
OfferCallbackResponse: {
|
|
2192
|
+
/** @example 0x1111111111111111111111111111111111111111 */
|
|
2193
|
+
address: string;
|
|
2194
|
+
/** @example 0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000 */
|
|
2195
|
+
data: string;
|
|
2196
|
+
/** @example 500000 */
|
|
2197
|
+
gas_limit: string;
|
|
2198
|
+
};
|
|
2199
|
+
ObligationListResponse: {
|
|
2200
|
+
meta: components["schemas"]["Meta"];
|
|
2201
|
+
/** @example 0x25690ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9abc */
|
|
2202
|
+
cursor: string | null;
|
|
2203
|
+
/** @description List of obligations with takable offers. */
|
|
2204
|
+
data: components["schemas"]["ObligationResponse"][];
|
|
2205
|
+
};
|
|
2206
|
+
ObligationResponse: {
|
|
2207
|
+
/** @example 0x12590ae1aee324a005be565f3bcdd16dbf8daf7969b26c181c8b8f467dad9f67 */
|
|
2208
|
+
id: string;
|
|
2209
|
+
/** @example 1 */
|
|
2210
|
+
chain_id: number;
|
|
2211
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2212
|
+
loan_token: string;
|
|
2213
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2214
|
+
/** @example 1761922800 */
|
|
2215
|
+
maturity: number;
|
|
2216
|
+
ask: components["schemas"]["AskResponse"];
|
|
2217
|
+
bid: components["schemas"]["BidResponse"];
|
|
2218
|
+
};
|
|
2219
|
+
AskResponse: {
|
|
2220
|
+
/** @example 1000000000000000000 */
|
|
2221
|
+
rate: string;
|
|
2222
|
+
};
|
|
2223
|
+
BidResponse: {
|
|
2224
|
+
/** @example 1000000000000000000 */
|
|
2225
|
+
rate: string;
|
|
2226
|
+
};
|
|
2227
|
+
ObligationSingleSuccessResponse: {
|
|
2228
|
+
meta: components["schemas"]["Meta"];
|
|
2229
|
+
/** @example null */
|
|
2230
|
+
cursor: string | null;
|
|
2231
|
+
/** @description Obligation details. */
|
|
2232
|
+
data: components["schemas"]["ObligationResponse"];
|
|
2233
|
+
};
|
|
2234
|
+
RouterStatusSuccessResponse: {
|
|
2235
|
+
meta: components["schemas"]["Meta"];
|
|
2236
|
+
/**
|
|
2237
|
+
* @description Aggregated router status.
|
|
2238
|
+
* @example {
|
|
2239
|
+
* "status": "live"
|
|
2240
|
+
* }
|
|
2241
|
+
*/
|
|
2242
|
+
data: components["schemas"]["RouterStatusDataResponse"];
|
|
2243
|
+
};
|
|
2244
|
+
RouterStatusDataResponse: {
|
|
2245
|
+
/**
|
|
2246
|
+
* @example live
|
|
2247
|
+
* @enum {string}
|
|
2248
|
+
*/
|
|
2249
|
+
status: "live" | "syncing";
|
|
2250
|
+
};
|
|
2251
|
+
CollectorsHealthSuccessResponse: {
|
|
2252
|
+
meta: components["schemas"]["Meta"];
|
|
2253
|
+
/**
|
|
2254
|
+
* @description Collectors health details and sync status.
|
|
2255
|
+
* @example [
|
|
2256
|
+
* {
|
|
2257
|
+
* "name": "offers",
|
|
2258
|
+
* "chain_id": 1,
|
|
2259
|
+
* "block_number": 21345678,
|
|
2260
|
+
* "updated_at": "2024-01-01T12:00:00.000Z",
|
|
2261
|
+
* "lag": 0,
|
|
2262
|
+
* "status": "live"
|
|
2263
|
+
* }
|
|
2264
|
+
* ]
|
|
2265
|
+
*/
|
|
2266
|
+
data: components["schemas"]["CollectorHealthResponse"][];
|
|
2267
|
+
};
|
|
2268
|
+
CollectorHealthResponse: {
|
|
2269
|
+
/** @example offers */
|
|
2270
|
+
name: string;
|
|
2271
|
+
/** @example 1 */
|
|
2272
|
+
chain_id: number;
|
|
2273
|
+
/** @example 21345678 */
|
|
2274
|
+
block_number: number | null;
|
|
2275
|
+
/** @example 2024-01-01T12:00:00.000Z */
|
|
2276
|
+
updated_at: string | null;
|
|
2277
|
+
/** @example 0 */
|
|
2278
|
+
lag: number | null;
|
|
2279
|
+
/**
|
|
2280
|
+
* @example live
|
|
2281
|
+
* @enum {string}
|
|
2282
|
+
*/
|
|
2283
|
+
status: "live" | "lagging" | "unknown";
|
|
2284
|
+
};
|
|
2285
|
+
ChainsHealthSuccessResponse: {
|
|
2286
|
+
meta: components["schemas"]["Meta"];
|
|
2287
|
+
/**
|
|
2288
|
+
* @description Latest processed block per chain.
|
|
2289
|
+
* @example [
|
|
2290
|
+
* {
|
|
2291
|
+
* "chain_id": 1,
|
|
2292
|
+
* "local_block_number": 21345678,
|
|
2293
|
+
* "remote_block_number": 21345690,
|
|
2294
|
+
* "updated_at": "2024-01-01T12:00:00.000Z"
|
|
2295
|
+
* }
|
|
2296
|
+
* ]
|
|
2297
|
+
*/
|
|
2298
|
+
data: components["schemas"]["ChainHealthResponse"][];
|
|
2299
|
+
};
|
|
2300
|
+
ChainHealthResponse: {
|
|
2301
|
+
/** @example 1 */
|
|
2302
|
+
chain_id: number;
|
|
2303
|
+
/** @example 21345678 */
|
|
2304
|
+
local_block_number: number;
|
|
2305
|
+
/** @example 21345690 */
|
|
2306
|
+
remote_block_number: number | null;
|
|
2307
|
+
/** @example 2024-01-01T12:00:00.000Z */
|
|
2308
|
+
updated_at: string;
|
|
2309
|
+
};
|
|
2310
|
+
ValidateOffersRequest: {
|
|
2311
|
+
/** @description Array of offers in snake_case format. Required, non-empty. */
|
|
2312
|
+
offers: components["schemas"]["ValidateOfferRequest"][];
|
|
2313
|
+
};
|
|
2314
|
+
ValidateOfferRequest: {
|
|
2315
|
+
/** @example 0x7b093658BE7f90B63D7c359e8f408e503c2D9401 */
|
|
2316
|
+
offering: string;
|
|
2317
|
+
/** @example 369216000000000000000000 */
|
|
2318
|
+
assets: string;
|
|
2319
|
+
/** @example 2750000000000000000 */
|
|
2320
|
+
rate: string;
|
|
2321
|
+
/** @example 1761922799 */
|
|
2322
|
+
maturity: number;
|
|
2323
|
+
/** @example 1761922799 */
|
|
2324
|
+
expiry: number;
|
|
2325
|
+
/** @example 1761922790 */
|
|
2326
|
+
start: number;
|
|
2327
|
+
/** @example 571380 */
|
|
2328
|
+
nonce: string;
|
|
2329
|
+
/** @example false */
|
|
2330
|
+
buy: boolean;
|
|
2331
|
+
/** @example 1 */
|
|
2332
|
+
chain_id: number;
|
|
2333
|
+
/** @example 0xC9A9C45C0eB717f8b5F193Af6bAa05A1c0Ac5078 */
|
|
2334
|
+
loan_token: string;
|
|
2335
|
+
/**
|
|
2336
|
+
* @example [
|
|
2337
|
+
* {
|
|
2338
|
+
* "asset": "0x34Cf890dB685FC536E05652FB41f02090c3fb751",
|
|
2339
|
+
* "oracle": "0x45093658BE7f90B63D7c359e8f408e503c2D9401",
|
|
2340
|
+
* "lltv": "860000000000000000"
|
|
2341
|
+
* }
|
|
2342
|
+
* ]
|
|
2343
|
+
*/
|
|
2344
|
+
collaterals: components["schemas"]["CollateralResponse"][];
|
|
2345
|
+
/**
|
|
2346
|
+
* @example {
|
|
2347
|
+
* "address": "0x1111111111111111111111111111111111111111",
|
|
2348
|
+
* "data": "0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000034cf890db685fc536e05652fb41f02090c3fb751000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000108e644e3ab01184155270aa92a00000000000",
|
|
2349
|
+
* "gas_limit": "500000"
|
|
2350
|
+
* }
|
|
2351
|
+
*/
|
|
2352
|
+
callback: components["schemas"]["OfferCallbackResponse"];
|
|
2353
|
+
};
|
|
2354
|
+
ValidationSuccessResponse: {
|
|
2355
|
+
meta: components["schemas"]["Meta"];
|
|
2356
|
+
/** @example null */
|
|
2357
|
+
cursor: string | null;
|
|
2358
|
+
/** @description Payload and root for client-side signing. */
|
|
2359
|
+
data: components["schemas"]["ValidationSuccessDataResponse"];
|
|
2360
|
+
};
|
|
2361
|
+
ValidationSuccessDataResponse: {
|
|
2362
|
+
/**
|
|
2363
|
+
* @description Unsigned payload: version (1B) + gzip(offers) + root (32B).
|
|
2364
|
+
* @example 0x01789c...
|
|
2365
|
+
*/
|
|
2366
|
+
payload: string;
|
|
2367
|
+
/**
|
|
2368
|
+
* @description Merkle tree root to sign with EIP-191.
|
|
2369
|
+
* @example 0xac4bd8318ec914f89f8af913f162230575b0ac0696a19256bc12138c5cfe1427
|
|
2370
|
+
*/
|
|
2371
|
+
root: string;
|
|
2372
|
+
};
|
|
2373
|
+
};
|
|
2374
|
+
responses: never;
|
|
2375
|
+
parameters: never;
|
|
2376
|
+
requestBodies: never;
|
|
2377
|
+
headers: never;
|
|
2378
|
+
pathItems: never;
|
|
2379
|
+
}
|
|
2380
|
+
declare namespace ObligationResponse_d_exports {
|
|
2381
|
+
export { ObligationResponse, from$2 as from };
|
|
1798
2382
|
}
|
|
1799
|
-
|
|
1800
2383
|
type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
1801
2384
|
/**
|
|
1802
2385
|
* Creates an `ObligationResponse` from a `Obligation`.
|
|
@@ -1805,258 +2388,26 @@ type ObligationResponse = paths["/v1/obligations"]["get"]["responses"]["200"]["c
|
|
|
1805
2388
|
* @returns The created `ObligationResponse`. {@link ObligationResponse}
|
|
1806
2389
|
*/
|
|
1807
2390
|
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 };
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
1815
|
-
/**
|
|
1816
|
-
* Creates an `OfferResponse` from an `Offer`.
|
|
1817
|
-
* @constructor
|
|
1818
|
-
* @param offer - {@link Offer}
|
|
1819
|
-
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
1820
|
-
*/
|
|
1821
|
-
declare function from$1(offer: Offer): OfferResponse;
|
|
1822
|
-
|
|
1823
|
-
type OfferResponse$1_OfferResponse = OfferResponse;
|
|
1824
|
-
declare namespace OfferResponse$1 {
|
|
1825
|
-
export { type OfferResponse$1_OfferResponse as OfferResponse, from$1 as from };
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
declare class OffersController {
|
|
1829
|
-
getOffers(): Promise<void>;
|
|
1830
|
-
}
|
|
1831
|
-
declare class HealthController {
|
|
1832
|
-
getRouterStatus(): Promise<void>;
|
|
1833
|
-
getCollectorsHealth(): Promise<void>;
|
|
1834
|
-
getChainsHealth(): Promise<void>;
|
|
1835
|
-
}
|
|
1836
|
-
declare class ObligationsController {
|
|
1837
|
-
getObligations(): Promise<void>;
|
|
1838
|
-
getObligation(): Promise<void>;
|
|
2391
|
+
declare namespace Gate_d_exports {
|
|
2392
|
+
export { Batch, Issue, Result, Rule, RuleNames, Single, batch$1 as batch, run, single };
|
|
1839
2393
|
}
|
|
1840
|
-
declare const OpenApi: () => Promise<OpenAPIDocument>;
|
|
1841
|
-
|
|
1842
|
-
declare const schemas: {
|
|
1843
|
-
readonly get_offers: z.ZodObject<{
|
|
1844
|
-
side: z.ZodEnum<{
|
|
1845
|
-
buy: "buy";
|
|
1846
|
-
sell: "sell";
|
|
1847
|
-
}>;
|
|
1848
|
-
obligation_id: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1849
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
1850
|
-
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
1851
|
-
}, z.core.$strip>;
|
|
1852
|
-
readonly get_obligations: z.ZodObject<{
|
|
1853
|
-
cursor: z.ZodOptional<z.ZodString>;
|
|
1854
|
-
limit: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>, z.ZodNumber>>>;
|
|
1855
|
-
}, z.core.$strip>;
|
|
1856
|
-
readonly get_obligation: z.ZodObject<{
|
|
1857
|
-
obligation_id: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
1858
|
-
}, z.core.$strip>;
|
|
1859
|
-
};
|
|
1860
|
-
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
|
-
declare const index$1_ChainHealth: typeof ChainHealth;
|
|
1865
|
-
type index$1_ChainsHealthResponse = ChainsHealthResponse;
|
|
1866
|
-
declare const index$1_CollectorHealth: typeof CollectorHealth;
|
|
1867
|
-
type index$1_CollectorsHealthResponse = CollectorsHealthResponse;
|
|
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 };
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
type RouterClientConfig = {
|
|
1883
|
-
/** The URL of the router. */
|
|
1884
|
-
readonly url: URL;
|
|
1885
|
-
/** The default headers to use for each request. */
|
|
1886
|
-
readonly headers: Headers;
|
|
1887
|
-
};
|
|
1888
|
-
type Client$1 = Compute<RouterClientConfig & {
|
|
1889
|
-
/**
|
|
1890
|
-
* Get offers from the router.
|
|
1891
|
-
* @param parameters - {@link getOffers.Parameters}
|
|
1892
|
-
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
1893
|
-
* @throws If the request fails - {@link getOffers.ErrorType}
|
|
1894
|
-
*
|
|
1895
|
-
* @example
|
|
1896
|
-
* ```ts
|
|
1897
|
-
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
1898
|
-
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
1899
|
-
* console.log(offers);
|
|
1900
|
-
* ```
|
|
1901
|
-
*/
|
|
1902
|
-
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
1903
|
-
/**
|
|
1904
|
-
* Get obligations from the router.
|
|
1905
|
-
* @param parameters - {@link getObligations.Parameters}
|
|
1906
|
-
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
1907
|
-
* @throws If the request fails - {@link getObligations.ErrorType}
|
|
1908
|
-
*
|
|
1909
|
-
* @example
|
|
1910
|
-
* ```ts
|
|
1911
|
-
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
1912
|
-
* const { obligations, cursor } = await router.getObligations();
|
|
1913
|
-
* console.log(obligations[0].id()); // 0x123...456
|
|
1914
|
-
* ```
|
|
1915
|
-
*/
|
|
1916
|
-
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
1917
|
-
}>;
|
|
1918
|
-
type ConnectOptions = {
|
|
1919
|
-
/** The URL of the router to interact with.
|
|
1920
|
-
* @default "https://router.morpho.dev"
|
|
1921
|
-
*/
|
|
1922
|
-
url?: string;
|
|
1923
|
-
/** The API key to use for the router API. */
|
|
1924
|
-
apiKey?: string;
|
|
1925
|
-
/** The default headers to use for each request. */
|
|
1926
|
-
headers?: Headers;
|
|
1927
|
-
};
|
|
1928
|
-
/**
|
|
1929
|
-
* Creates an instance of a router client.
|
|
1930
|
-
* @constructor
|
|
1931
|
-
* @param parameters - {@link connect.Parameters}
|
|
1932
|
-
* @returns A Router Client. {@link connect.ReturnType}
|
|
1933
|
-
*
|
|
1934
|
-
* @example
|
|
1935
|
-
* ```typescript
|
|
1936
|
-
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
1937
|
-
* ```
|
|
1938
|
-
*/
|
|
1939
|
-
declare function connect$1(parameters?: connect$1.Parameters): connect$1.ReturnType;
|
|
1940
|
-
declare namespace connect$1 {
|
|
1941
|
-
type Parameters = ConnectOptions;
|
|
1942
|
-
type ReturnType = Client$1;
|
|
1943
|
-
type ErrorType = InvalidUrlError;
|
|
1944
|
-
}
|
|
1945
|
-
declare function getOffers(apiClient: Client$3<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
1946
|
-
declare namespace getOffers {
|
|
1947
|
-
type Parameters = {
|
|
1948
|
-
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
1949
|
-
side: "buy" | "sell";
|
|
1950
|
-
/** The offers obligation id */
|
|
1951
|
-
obligationId: Hex;
|
|
1952
|
-
/** Pagination cursor in base64url-encoded format */
|
|
1953
|
-
cursor?: string;
|
|
1954
|
-
/** Maximum number of offers to return. @default 20 */
|
|
1955
|
-
limit?: number;
|
|
1956
|
-
};
|
|
1957
|
-
type ReturnType = {
|
|
1958
|
-
offers: Offer[];
|
|
1959
|
-
/** The pagination cursor. */
|
|
1960
|
-
cursor: string | null;
|
|
1961
|
-
};
|
|
1962
|
-
type ErrorType = GetApiErrorType;
|
|
1963
|
-
}
|
|
1964
|
-
declare function getObligations(apiClient: Client$3<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
1965
|
-
declare namespace getObligations {
|
|
1966
|
-
type Parameters = {
|
|
1967
|
-
/** Pagination cursor is a 32-byte hex string. */
|
|
1968
|
-
cursor?: Hex;
|
|
1969
|
-
/** Maximum number of obligations to return. @default 20 */
|
|
1970
|
-
limit?: number;
|
|
1971
|
-
};
|
|
1972
|
-
type ReturnType = {
|
|
1973
|
-
obligations: Compute<{
|
|
1974
|
-
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
1975
|
-
id: () => Hex;
|
|
1976
|
-
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
1977
|
-
/** The pagination cursor. */
|
|
1978
|
-
cursor: string | null;
|
|
1979
|
-
};
|
|
1980
|
-
type ErrorType = GetApiErrorType;
|
|
1981
|
-
}
|
|
1982
|
-
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
1983
|
-
declare class InvalidUrlError extends BaseError {
|
|
1984
|
-
name: string;
|
|
1985
|
-
constructor(url: string);
|
|
1986
|
-
}
|
|
1987
|
-
declare class HttpUnauthorizedError extends BaseError {
|
|
1988
|
-
name: string;
|
|
1989
|
-
constructor();
|
|
1990
|
-
}
|
|
1991
|
-
declare class HttpForbiddenError extends BaseError {
|
|
1992
|
-
name: string;
|
|
1993
|
-
constructor();
|
|
1994
|
-
}
|
|
1995
|
-
declare class HttpRateLimitError extends BaseError {
|
|
1996
|
-
name: string;
|
|
1997
|
-
constructor();
|
|
1998
|
-
}
|
|
1999
|
-
declare class HttpGetApiFailedError extends BaseError {
|
|
2000
|
-
name: string;
|
|
2001
|
-
constructor(message: string, { details }?: {
|
|
2002
|
-
details?: string;
|
|
2003
|
-
});
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
type Client$2_ConnectOptions = ConnectOptions;
|
|
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 };
|
|
2021
|
-
}
|
|
2022
|
-
|
|
2023
|
-
type Cursor = {
|
|
2024
|
-
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
2025
|
-
dir: "asc" | "desc";
|
|
2026
|
-
rate?: string;
|
|
2027
|
-
maturity?: number;
|
|
2028
|
-
expiry?: number;
|
|
2029
|
-
assets?: string;
|
|
2030
|
-
hash: string;
|
|
2031
|
-
page?: number;
|
|
2032
|
-
};
|
|
2033
|
-
declare function validate(cursor: unknown): cursor is Cursor;
|
|
2034
|
-
declare function encode(c: Cursor): string;
|
|
2035
|
-
declare function decode(token?: string): Cursor | null;
|
|
2036
|
-
|
|
2037
|
-
type Cursor$1_Cursor = Cursor;
|
|
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 };
|
|
2043
|
-
}
|
|
2044
|
-
|
|
2045
2394
|
/**
|
|
2046
2395
|
* A validation rule.
|
|
2047
2396
|
*/
|
|
2048
|
-
type Rule<T, Name extends string = string> = {
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2397
|
+
type Rule<T, Name$1 extends string = string> = {
|
|
2398
|
+
kind: "single";
|
|
2399
|
+
name: Name$1;
|
|
2400
|
+
description: string;
|
|
2401
|
+
run: Single<T, Name$1>;
|
|
2052
2402
|
} | {
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2403
|
+
kind: "batch";
|
|
2404
|
+
name: Name$1;
|
|
2405
|
+
description: string;
|
|
2406
|
+
run: Batch<T, Name$1>;
|
|
2056
2407
|
};
|
|
2057
|
-
type RuleNames<Rules extends readonly {
|
|
2058
|
-
|
|
2059
|
-
}[]> = Rules[number]["name"];
|
|
2408
|
+
type RuleNames<Rules$1 extends readonly {
|
|
2409
|
+
name: string;
|
|
2410
|
+
}[]> = Rules$1[number]["name"];
|
|
2060
2411
|
/**
|
|
2061
2412
|
* A single item validation rule.
|
|
2062
2413
|
* @param item - The item to validate.
|
|
@@ -2072,81 +2423,83 @@ type Batch<T, RuleName extends string> = (items: T[]) => Map<number, Omit<Issue<
|
|
|
2072
2423
|
/**
|
|
2073
2424
|
* Create a validation rule iterating over a single item at a time.
|
|
2074
2425
|
* @param name - The name of the rule.
|
|
2426
|
+
* @param description - A human-readable description of the rule.
|
|
2075
2427
|
* @param run - The function that validates the rule.
|
|
2076
2428
|
* @returns The created rule.
|
|
2077
2429
|
*/
|
|
2078
|
-
declare function single<Name extends string, T>(name: Name, run: Single<T, Name>): Rule<T, Name>;
|
|
2430
|
+
declare function single<Name$1 extends string, T>(name: Name$1, description: string, run: Single<T, Name$1>): Rule<T, Name$1>;
|
|
2079
2431
|
/**
|
|
2080
2432
|
* Create a validation rule iterating over a batch of items at a time.
|
|
2081
2433
|
* @param name - The name of the rule.
|
|
2434
|
+
* @param description - A human-readable description of the rule.
|
|
2082
2435
|
* @param run - The function that validates the rule.
|
|
2083
2436
|
* @returns The created rule.
|
|
2084
2437
|
*/
|
|
2085
|
-
declare function batch$1<Name extends string, T>(name: Name, run: Batch<T, Name>): Rule<T, Name>;
|
|
2438
|
+
declare function batch$1<Name$1 extends string, T>(name: Name$1, description: string, run: Batch<T, Name$1>): Rule<T, Name$1>;
|
|
2086
2439
|
/**
|
|
2087
2440
|
* A validation issue.
|
|
2088
2441
|
*/
|
|
2089
2442
|
type Issue<T, RuleName extends string = string> = {
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2443
|
+
/** The name of the rule that caused the issue. */
|
|
2444
|
+
ruleName: RuleName;
|
|
2445
|
+
/** The message of the issue. */
|
|
2446
|
+
message: string;
|
|
2447
|
+
/** The item that was not valid. */
|
|
2448
|
+
item: T;
|
|
2096
2449
|
};
|
|
2097
2450
|
/**
|
|
2098
2451
|
* The result of a validation.
|
|
2099
2452
|
*/
|
|
2100
2453
|
type Result<T, RuleName extends string = string> = {
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2454
|
+
/** The items that were valid. */
|
|
2455
|
+
valid: T[];
|
|
2456
|
+
/** The reports of the failed validations. */
|
|
2457
|
+
issues: Issue<T, RuleName>[];
|
|
2105
2458
|
};
|
|
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
|
-
|
|
2114
|
-
type
|
|
2115
|
-
type
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
}
|
|
2119
|
-
type
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
declare
|
|
2123
|
-
|
|
2459
|
+
declare function run<T, Name$1 extends string, Rules$1 extends readonly Rule<T, Name$1>[]>(parameters: {
|
|
2460
|
+
items: T[];
|
|
2461
|
+
rules: Rules$1;
|
|
2462
|
+
chunkSize?: number;
|
|
2463
|
+
}): Promise<Result<T, RuleNames<Rules$1>>>;
|
|
2464
|
+
declare namespace Gatekeeper_d_exports {
|
|
2465
|
+
export { Gatekeeper, Rules, create };
|
|
2466
|
+
}
|
|
2467
|
+
type Rules = readonly Rule<Offer, string>[];
|
|
2468
|
+
type Gatekeeper = {
|
|
2469
|
+
rules: Rules;
|
|
2470
|
+
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2471
|
+
};
|
|
2472
|
+
type GatekeeperParameters = {
|
|
2473
|
+
rules: Rules;
|
|
2474
|
+
};
|
|
2475
|
+
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
2476
|
+
declare namespace GateConfig_d_exports {
|
|
2477
|
+
export { CallbackConfig, GateConfig, assets$1 as assets, configs, getCallback, getCallbackAddresses, getCallbackType, getCallbackTypeAddresses };
|
|
2124
2478
|
}
|
|
2125
|
-
|
|
2126
2479
|
type GateConfig = {
|
|
2127
|
-
|
|
2128
|
-
|
|
2480
|
+
callbacks?: CallbackConfig[];
|
|
2481
|
+
maturities?: MaturityType[];
|
|
2129
2482
|
};
|
|
2130
2483
|
type CallbackConfig = {
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2484
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2485
|
+
addresses: Address[];
|
|
2486
|
+
vaultFactories: Address[];
|
|
2134
2487
|
} | {
|
|
2135
|
-
|
|
2136
|
-
|
|
2488
|
+
type: CallbackType.SellERC20Callback;
|
|
2489
|
+
addresses: Address[];
|
|
2137
2490
|
} | {
|
|
2138
|
-
|
|
2491
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2139
2492
|
};
|
|
2140
|
-
declare function getCallback(chain:
|
|
2141
|
-
|
|
2493
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyVaultV1Callback): Extract<CallbackConfig, {
|
|
2494
|
+
type: CallbackType.BuyVaultV1Callback;
|
|
2142
2495
|
}> | undefined;
|
|
2143
|
-
declare function getCallback(chain:
|
|
2144
|
-
|
|
2496
|
+
declare function getCallback(chain: Name, type: CallbackType.SellERC20Callback): Extract<CallbackConfig, {
|
|
2497
|
+
type: CallbackType.SellERC20Callback;
|
|
2145
2498
|
}> | undefined;
|
|
2146
|
-
declare function getCallback(chain:
|
|
2147
|
-
|
|
2499
|
+
declare function getCallback(chain: Name, type: CallbackType.BuyWithEmptyCallback): Extract<CallbackConfig, {
|
|
2500
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
2148
2501
|
}> | undefined;
|
|
2149
|
-
declare function getCallback(chain:
|
|
2502
|
+
declare function getCallback(chain: Name, type: CallbackType): CallbackConfig | undefined;
|
|
2150
2503
|
/**
|
|
2151
2504
|
* Attempts to infer the configured callback type from a callback address on a chain.
|
|
2152
2505
|
* Skips the empty callback type as it does not carry addresses.
|
|
@@ -2155,54 +2508,31 @@ declare function getCallback(chain: ChainName, type: CallbackType): CallbackConf
|
|
|
2155
2508
|
* @param address - Callback contract address
|
|
2156
2509
|
* @returns The callback type when found, otherwise undefined
|
|
2157
2510
|
*/
|
|
2158
|
-
declare function getCallbackType(chain:
|
|
2511
|
+
declare function getCallbackType(chain: Name, address: Address): CallbackType | undefined;
|
|
2159
2512
|
/**
|
|
2160
2513
|
* Returns the callback addresses for a given chain and callback type, if it exists.
|
|
2161
2514
|
* @param chain - Chain name for which to read the validation configuration
|
|
2162
2515
|
* @param type - Callback type to retrieve
|
|
2163
2516
|
* @returns The matching callback addresses or an empty array if not configured
|
|
2164
2517
|
*/
|
|
2165
|
-
declare function getCallbackTypeAddresses(chain:
|
|
2518
|
+
declare function getCallbackTypeAddresses(chain: Name, type: CallbackType): Address[];
|
|
2166
2519
|
/**
|
|
2167
2520
|
* Returns the list of allowed non-empty callback addresses for a chain.
|
|
2168
2521
|
*
|
|
2169
2522
|
* @param chain - Chain name
|
|
2170
2523
|
* @returns Array of allowed callback addresses (lowercased). Empty when none configured
|
|
2171
2524
|
*/
|
|
2172
|
-
declare const getCallbackAddresses: (chain:
|
|
2173
|
-
declare const assets: Record<string, Address[]>;
|
|
2174
|
-
declare const configs: Record<
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
declare
|
|
2179
|
-
|
|
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 };
|
|
2525
|
+
declare const getCallbackAddresses: (chain: Name) => Address[];
|
|
2526
|
+
declare const assets$1: Record<string, Address[]>;
|
|
2527
|
+
declare const configs: Record<Name, GateConfig>;
|
|
2528
|
+
//#endregion
|
|
2529
|
+
//#region src/gatekeeper/morphoRules.d.ts
|
|
2530
|
+
declare const morphoRules: (chains: Chain$1[]) => (Rule<Offer, "mixed_maker"> | Rule<Offer, "chain_ids"> | Rule<Offer, "maturity"> | Rule<Offer, "callback"> | Rule<Offer, "token">)[];
|
|
2531
|
+
declare namespace Rules_d_exports {
|
|
2532
|
+
export { ValidityParameters, callback, chains, maturity, sameMaker, token, validity };
|
|
2186
2533
|
}
|
|
2187
|
-
|
|
2188
|
-
type Rules$1 = readonly Rule<Offer, string>[];
|
|
2189
|
-
type Gatekeeper = {
|
|
2190
|
-
isAllowed: (offers: Offer[]) => Promise<Result<Offer, string>>;
|
|
2191
|
-
};
|
|
2192
|
-
type GatekeeperParameters = {
|
|
2193
|
-
rules: Rules$1;
|
|
2194
|
-
};
|
|
2195
|
-
declare function create(parameters: GatekeeperParameters): Gatekeeper;
|
|
2196
|
-
|
|
2197
|
-
type Gatekeeper$1_Gatekeeper = Gatekeeper;
|
|
2198
|
-
declare const Gatekeeper$1_create: typeof create;
|
|
2199
|
-
declare namespace Gatekeeper$1 {
|
|
2200
|
-
export { type Gatekeeper$1_Gatekeeper as Gatekeeper, type Rules$1 as Rules, Gatekeeper$1_create as create };
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
2534
|
type ValidityParameters = {
|
|
2204
|
-
|
|
2205
|
-
client: PublicClient;
|
|
2535
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2206
2536
|
};
|
|
2207
2537
|
/**
|
|
2208
2538
|
* set of rules to validate offers.
|
|
@@ -2210,113 +2540,353 @@ type ValidityParameters = {
|
|
|
2210
2540
|
* @param parameters - Validity parameters with chain and client
|
|
2211
2541
|
* @returns Array of validation rules to evaluate against offers
|
|
2212
2542
|
*/
|
|
2213
|
-
declare function validity(parameters: ValidityParameters): (Rule<Offer, "
|
|
2214
|
-
declare const
|
|
2215
|
-
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
|
|
2543
|
+
declare function validity(parameters: ValidityParameters): (Rule<Offer, "expiry"> | Rule<Offer, "sell_erc20_callback_invalid"> | Rule<Offer, "buy_offers_callback_vault_invalid">)[];
|
|
2544
|
+
declare const chains: ({
|
|
2545
|
+
chains
|
|
2546
|
+
}: {
|
|
2547
|
+
chains: Chain$1[];
|
|
2548
|
+
}) => Rule<Offer, "chain_ids">;
|
|
2549
|
+
declare const maturity: ({
|
|
2550
|
+
maturities
|
|
2551
|
+
}: {
|
|
2552
|
+
maturities: MaturityType[];
|
|
2219
2553
|
}) => Rule<Offer, "maturity">;
|
|
2220
|
-
declare const callback: ({
|
|
2221
|
-
|
|
2222
|
-
|
|
2554
|
+
declare const callback: ({
|
|
2555
|
+
callbacks,
|
|
2556
|
+
allowedAddresses
|
|
2557
|
+
}: {
|
|
2558
|
+
callbacks: CallbackType[];
|
|
2559
|
+
allowedAddresses: Address[];
|
|
2223
2560
|
}) => Rule<Offer, "callback">;
|
|
2224
2561
|
/**
|
|
2225
2562
|
* A validation rule that checks if the offer's token is allowed.
|
|
2226
2563
|
* @param offer - The offer to validate.
|
|
2227
2564
|
* @returns The issue that was found. If the offer is valid, this will be undefined.
|
|
2228
2565
|
*/
|
|
2229
|
-
declare const token: ({
|
|
2230
|
-
|
|
2566
|
+
declare const token: ({
|
|
2567
|
+
assets
|
|
2568
|
+
}: {
|
|
2569
|
+
assets: Address[];
|
|
2231
2570
|
}) => Rule<Offer, "token">;
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
declare const
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2571
|
+
/**
|
|
2572
|
+
* A batch validation rule that ensures all offers in a tree have the same maker (offering address).
|
|
2573
|
+
* Returns an issue only for the first non-conforming offer.
|
|
2574
|
+
* This rule is signing-agnostic; signer verification is handled at the collector level.
|
|
2575
|
+
*/
|
|
2576
|
+
declare const sameMaker: () => Rule<Offer, "mixed_maker">;
|
|
2577
|
+
//#endregion
|
|
2578
|
+
//#region src/database/domains/Trees.d.ts
|
|
2579
|
+
/**
|
|
2580
|
+
* Attestation data for a single offer, containing the merkle root, signature, and proof.
|
|
2581
|
+
*/
|
|
2582
|
+
type Attestation = {
|
|
2583
|
+
root: Hex;
|
|
2584
|
+
signature: Hex;
|
|
2585
|
+
proof: Hex[];
|
|
2586
|
+
};
|
|
2587
|
+
declare namespace OfferResponse_d_exports {
|
|
2588
|
+
export { OfferResponse, from$1 as from };
|
|
2241
2589
|
}
|
|
2242
|
-
|
|
2590
|
+
type OfferResponse = paths["/v1/offers"]["get"]["responses"]["200"]["content"]["application/json"]["data"][number];
|
|
2591
|
+
/**
|
|
2592
|
+
* Creates an `OfferResponse` from an `Offer`.
|
|
2593
|
+
* @constructor
|
|
2594
|
+
* @param offer - {@link Offer}
|
|
2595
|
+
* @param attestation - {@link Attestation}
|
|
2596
|
+
* @returns The created `OfferResponse`. {@link OfferResponse}
|
|
2597
|
+
*/
|
|
2598
|
+
declare function from$1(offer: Offer, attestation?: Attestation): OfferResponse;
|
|
2599
|
+
//#endregion
|
|
2600
|
+
//#region src/api/Schema/openapi.d.ts
|
|
2601
|
+
declare class BooksController {
|
|
2602
|
+
getBook(): Promise<void>;
|
|
2603
|
+
}
|
|
2604
|
+
declare class ValidateController {
|
|
2605
|
+
validateOffers(): Promise<void>;
|
|
2606
|
+
}
|
|
2607
|
+
declare class OffersController {
|
|
2608
|
+
getOffers(): Promise<void>;
|
|
2609
|
+
}
|
|
2610
|
+
declare class HealthController {
|
|
2611
|
+
getRouterStatus(): Promise<void>;
|
|
2612
|
+
getCollectorsHealth(): Promise<void>;
|
|
2613
|
+
getChainsHealth(): Promise<void>;
|
|
2614
|
+
}
|
|
2615
|
+
declare class ObligationsController {
|
|
2616
|
+
getObligations(): Promise<void>;
|
|
2617
|
+
getObligation(): Promise<void>;
|
|
2618
|
+
}
|
|
2619
|
+
type RuleInfo = {
|
|
2620
|
+
name: string;
|
|
2621
|
+
description: string;
|
|
2622
|
+
};
|
|
2623
|
+
type OpenApiOptions = {
|
|
2624
|
+
rules?: RuleInfo[];
|
|
2625
|
+
};
|
|
2626
|
+
declare const OpenApi: (options?: OpenApiOptions) => Promise<OpenAPIDocument>;
|
|
2627
|
+
//#endregion
|
|
2628
|
+
//#region src/api/Schema/requests.d.ts
|
|
2629
|
+
declare const schemas: {
|
|
2630
|
+
readonly get_offers: z$1.ZodObject<{
|
|
2631
|
+
side: z$1.ZodOptional<z$1.ZodEnum<{
|
|
2632
|
+
buy: "buy";
|
|
2633
|
+
sell: "sell";
|
|
2634
|
+
}>>;
|
|
2635
|
+
obligation_id: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2636
|
+
offering: z$1.ZodOptional<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>>;
|
|
2637
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2638
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2639
|
+
}, z$1.core.$strip>;
|
|
2640
|
+
readonly get_obligations: z$1.ZodObject<{
|
|
2641
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2642
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2643
|
+
}, z$1.core.$strip>;
|
|
2644
|
+
readonly get_obligation: z$1.ZodObject<{
|
|
2645
|
+
obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2646
|
+
}, z$1.core.$strip>;
|
|
2647
|
+
readonly get_book: z$1.ZodObject<{
|
|
2648
|
+
obligation_id: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<`0x${string}`, string>>;
|
|
2649
|
+
side: z$1.ZodEnum<{
|
|
2650
|
+
buy: "buy";
|
|
2651
|
+
sell: "sell";
|
|
2652
|
+
}>;
|
|
2653
|
+
cursor: z$1.ZodOptional<z$1.ZodString>;
|
|
2654
|
+
limit: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodPipe<z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<number, string>>, z$1.ZodNumber>>>;
|
|
2655
|
+
}, z$1.core.$strip>;
|
|
2656
|
+
readonly validate_offers: z$1.ZodObject<{
|
|
2657
|
+
offers: z$1.ZodArray<z$1.ZodUnknown>;
|
|
2658
|
+
}, z$1.core.$strict>;
|
|
2659
|
+
};
|
|
2660
|
+
type Action = keyof typeof schemas;
|
|
2661
|
+
declare function parse<A extends Action>(action: A, query: unknown): z$1.infer<(typeof schemas)[A]>;
|
|
2662
|
+
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]>>;
|
|
2663
|
+
declare namespace index_d_exports$1 {
|
|
2664
|
+
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 };
|
|
2665
|
+
}
|
|
2666
|
+
declare namespace Client_d_exports {
|
|
2667
|
+
export { Client$2 as Client, ConnectOptions, HttpForbiddenError, HttpGetApiFailedError, HttpRateLimitError, HttpUnauthorizedError, InvalidUrlError, connect$1 as connect, getObligations, getOffers };
|
|
2668
|
+
}
|
|
2669
|
+
type RouterClientConfig = {
|
|
2670
|
+
/** The URL of the router. */
|
|
2671
|
+
readonly url: URL;
|
|
2672
|
+
/** The default headers to use for each request. */
|
|
2673
|
+
readonly headers: Headers;
|
|
2674
|
+
};
|
|
2675
|
+
type Client$2 = Compute<RouterClientConfig & {
|
|
2676
|
+
/**
|
|
2677
|
+
* Get offers from the router.
|
|
2678
|
+
* @param parameters - {@link getOffers.Parameters}
|
|
2679
|
+
* @returns The offers with pagination cursor. {@link getOffers.ReturnType}
|
|
2680
|
+
* @throws If the request fails - {@link getOffers.ErrorType}
|
|
2681
|
+
*
|
|
2682
|
+
* @example
|
|
2683
|
+
* ```ts
|
|
2684
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2685
|
+
* const { offers, cursor } = await router.getOffers({ side: "buy", obligationId: "0xa1c...d2f" });
|
|
2686
|
+
* console.log(offers);
|
|
2687
|
+
* ```
|
|
2688
|
+
*/
|
|
2689
|
+
getOffers: (parameters: getOffers.Parameters) => Promise<getOffers.ReturnType>;
|
|
2690
|
+
/**
|
|
2691
|
+
* Get obligations from the router.
|
|
2692
|
+
* @param parameters - {@link getObligations.Parameters}
|
|
2693
|
+
* @returns The obligations with pagination cursor. {@link getObligations.ReturnType}
|
|
2694
|
+
* @throws If the request fails - {@link getObligations.ErrorType}
|
|
2695
|
+
*
|
|
2696
|
+
* @example
|
|
2697
|
+
* ```ts
|
|
2698
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2699
|
+
* const { obligations, cursor } = await router.getObligations();
|
|
2700
|
+
* console.log(obligations[0].id()); // 0x123...456
|
|
2701
|
+
* ```
|
|
2702
|
+
*/
|
|
2703
|
+
getObligations: (parameters?: getObligations.Parameters) => Promise<getObligations.ReturnType>;
|
|
2704
|
+
}>;
|
|
2705
|
+
type ConnectOptions = {
|
|
2706
|
+
/** The URL of the router to interact with.
|
|
2707
|
+
* @default "https://router.morpho.dev"
|
|
2708
|
+
*/
|
|
2709
|
+
url?: string;
|
|
2710
|
+
/** The API key to use for the router API. */
|
|
2711
|
+
apiKey?: string;
|
|
2712
|
+
/** The default headers to use for each request. */
|
|
2713
|
+
headers?: Headers;
|
|
2714
|
+
};
|
|
2715
|
+
/**
|
|
2716
|
+
* Creates an instance of a router client.
|
|
2717
|
+
* @constructor
|
|
2718
|
+
* @param parameters - {@link connect.Parameters}
|
|
2719
|
+
* @returns A Router Client. {@link connect.ReturnType}
|
|
2720
|
+
*
|
|
2721
|
+
* @example
|
|
2722
|
+
* ```typescript
|
|
2723
|
+
* const router = RouterClient.connect({ url: "https://router.morpho.dev" });
|
|
2724
|
+
* ```
|
|
2725
|
+
*/
|
|
2726
|
+
declare function connect$1(parameters?: connect$1.Parameters): connect$1.ReturnType;
|
|
2727
|
+
declare namespace connect$1 {
|
|
2728
|
+
type Parameters = ConnectOptions;
|
|
2729
|
+
type ReturnType = Client$2;
|
|
2730
|
+
type ErrorType = InvalidUrlError;
|
|
2731
|
+
}
|
|
2732
|
+
declare function getOffers(apiClient: Client<paths>, parameters: getOffers.Parameters): Promise<getOffers.ReturnType>;
|
|
2733
|
+
declare namespace getOffers {
|
|
2734
|
+
type Parameters = {
|
|
2735
|
+
/** The desired side of the match: 'buy' if you want to buy, 'sell' if you want to sell */
|
|
2736
|
+
side: "buy" | "sell";
|
|
2737
|
+
/** The offers obligation id */
|
|
2738
|
+
obligationId: Hex;
|
|
2739
|
+
/** Pagination cursor in base64url-encoded format */
|
|
2740
|
+
cursor?: string;
|
|
2741
|
+
/** Maximum number of offers to return. @default 20 */
|
|
2742
|
+
limit?: number;
|
|
2743
|
+
};
|
|
2744
|
+
type ReturnType = {
|
|
2745
|
+
offers: Compute<Offer & {
|
|
2746
|
+
/** 32-byte merkle root. */
|
|
2747
|
+
root?: Hex;
|
|
2748
|
+
/** Sibling hashes for the merkle proof. */
|
|
2749
|
+
proof?: Hex[];
|
|
2750
|
+
}>[];
|
|
2751
|
+
/** The pagination cursor. */
|
|
2752
|
+
cursor: string | null;
|
|
2753
|
+
};
|
|
2754
|
+
type ErrorType = GetApiErrorType;
|
|
2755
|
+
}
|
|
2756
|
+
declare function getObligations(apiClient: Client<paths>, parameters?: getObligations.Parameters): Promise<getObligations.ReturnType>;
|
|
2757
|
+
declare namespace getObligations {
|
|
2758
|
+
type Parameters = {
|
|
2759
|
+
/** Pagination cursor is a 32-byte hex string. */
|
|
2760
|
+
cursor?: Hex;
|
|
2761
|
+
/** Maximum number of obligations to return. @default 20 */
|
|
2762
|
+
limit?: number;
|
|
2763
|
+
};
|
|
2764
|
+
type ReturnType = {
|
|
2765
|
+
obligations: Compute<{
|
|
2766
|
+
/** The obligation id. Uses {@link Obligation.id} to calculate the id.*/
|
|
2767
|
+
id: () => Hex;
|
|
2768
|
+
} & Obligation & Omit<Quote, "obligationId">>[];
|
|
2769
|
+
/** The pagination cursor. */
|
|
2770
|
+
cursor: string | null;
|
|
2771
|
+
};
|
|
2772
|
+
type ErrorType = GetApiErrorType;
|
|
2773
|
+
}
|
|
2774
|
+
type GetApiErrorType = HttpGetApiFailedError | HttpUnauthorizedError | HttpForbiddenError | HttpRateLimitError;
|
|
2775
|
+
declare class InvalidUrlError extends BaseError {
|
|
2776
|
+
name: string;
|
|
2777
|
+
constructor(url: string);
|
|
2778
|
+
}
|
|
2779
|
+
declare class HttpUnauthorizedError extends BaseError {
|
|
2780
|
+
name: string;
|
|
2781
|
+
constructor();
|
|
2782
|
+
}
|
|
2783
|
+
declare class HttpForbiddenError extends BaseError {
|
|
2784
|
+
name: string;
|
|
2785
|
+
constructor();
|
|
2786
|
+
}
|
|
2787
|
+
declare class HttpRateLimitError extends BaseError {
|
|
2788
|
+
name: string;
|
|
2789
|
+
constructor();
|
|
2790
|
+
}
|
|
2791
|
+
declare class HttpGetApiFailedError extends BaseError {
|
|
2792
|
+
name: string;
|
|
2793
|
+
constructor(message: string, {
|
|
2794
|
+
details
|
|
2795
|
+
}?: {
|
|
2796
|
+
details?: string;
|
|
2797
|
+
});
|
|
2798
|
+
}
|
|
2799
|
+
declare namespace Cursor_d_exports {
|
|
2800
|
+
export { Cursor, decode, encode, validate };
|
|
2801
|
+
}
|
|
2802
|
+
type Cursor = {
|
|
2803
|
+
sort: "rate" | "maturity" | "expiry" | "amount";
|
|
2804
|
+
dir: "asc" | "desc";
|
|
2805
|
+
rate?: string;
|
|
2806
|
+
maturity?: number;
|
|
2807
|
+
expiry?: number;
|
|
2808
|
+
assets?: string;
|
|
2809
|
+
hash: string;
|
|
2810
|
+
page?: number;
|
|
2811
|
+
};
|
|
2812
|
+
declare function validate(cursor: unknown): cursor is Cursor;
|
|
2813
|
+
declare function encode(c: Cursor): string;
|
|
2814
|
+
declare function decode(token?: string): Cursor | null;
|
|
2815
|
+
//#endregion
|
|
2816
|
+
//#region src/mempool/MempoolEVMClient.d.ts
|
|
2243
2817
|
declare function from(parameters: from.Parameters): from.ReturnType;
|
|
2244
2818
|
declare namespace from {
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2819
|
+
type Parameters = {
|
|
2820
|
+
/** The viem client to use. */
|
|
2821
|
+
client: WalletClient;
|
|
2822
|
+
/** The mempool address. */
|
|
2823
|
+
mempoolAddress: Address;
|
|
2824
|
+
/** The block window to use for the mempool. Defaults to 100. */
|
|
2825
|
+
blockWindow?: number;
|
|
2826
|
+
};
|
|
2827
|
+
type ReturnType = Client$1;
|
|
2828
|
+
type ErrorType = null;
|
|
2829
|
+
}
|
|
2830
|
+
declare namespace MempoolClient_d_exports {
|
|
2831
|
+
export { AddParameters, Client$1 as Client, GetParameters, connect };
|
|
2255
2832
|
}
|
|
2256
|
-
|
|
2257
2833
|
type AddParameters = Compute<Omit<Offer, "hash" | "createdAt">[]>;
|
|
2258
2834
|
type GetParameters = {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2835
|
+
/** The block number to get offers from. */
|
|
2836
|
+
blockNumberGte?: number;
|
|
2837
|
+
/** The block number to get offers to. */
|
|
2838
|
+
blockNumberLte?: number;
|
|
2839
|
+
/** The loan asset to get offers from. */
|
|
2840
|
+
loanToken?: string;
|
|
2841
|
+
/** The order to get offers. Defaults to "desc". */
|
|
2842
|
+
order?: "asc" | "desc";
|
|
2843
|
+
/** The options to get offers from. */
|
|
2844
|
+
options?: {
|
|
2845
|
+
/** The maximum number of offers to return. Defaults to 100. Maximum is 1000. */
|
|
2846
|
+
maxBatchSize?: number;
|
|
2847
|
+
};
|
|
2272
2848
|
};
|
|
2273
2849
|
/**
|
|
2274
2850
|
* Mempool client interface.
|
|
2275
2851
|
*/
|
|
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
|
-
|
|
2852
|
+
type Client$1 = {
|
|
2853
|
+
/**
|
|
2854
|
+
* Add an offer to the mempool.
|
|
2855
|
+
* @returns The created offer with its hash.
|
|
2856
|
+
*/
|
|
2857
|
+
add: (parameters: AddParameters) => Promise<Hex>;
|
|
2858
|
+
/** Get offers from the mempool. */
|
|
2859
|
+
get: (parameters?: GetParameters) => AsyncGenerator<{
|
|
2860
|
+
offers: Offer[];
|
|
2861
|
+
/** The block number of the last processed offer. Depends on the `order` parameter, block numbers will ascend or descend. */
|
|
2862
|
+
blockNumber: number;
|
|
2863
|
+
}>;
|
|
2864
|
+
/**
|
|
2865
|
+
* Stream offers from the mempool.
|
|
2866
|
+
* @returns A generator of offers alongside the last block number processed.
|
|
2867
|
+
*/
|
|
2868
|
+
stream: (parameters: Compute<Omit<GetParameters, "options"> & {
|
|
2869
|
+
options: GetParameters["options"] & {
|
|
2870
|
+
blockWindow?: number;
|
|
2871
|
+
};
|
|
2872
|
+
}>) => AsyncGenerator<{
|
|
2873
|
+
offers: Offer[];
|
|
2874
|
+
blockNumber: number;
|
|
2875
|
+
}>;
|
|
2300
2876
|
};
|
|
2301
2877
|
/**
|
|
2302
2878
|
* Client to interact with the Mempool contract on a specific chain.
|
|
2303
2879
|
*/
|
|
2304
|
-
declare function connect(parameters: from.Parameters): Client;
|
|
2880
|
+
declare function connect(parameters: from.Parameters): Client$1;
|
|
2305
2881
|
declare namespace connect {
|
|
2306
|
-
|
|
2882
|
+
type ErrorType = from.ErrorType;
|
|
2307
2883
|
}
|
|
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
|
-
|
|
2884
|
+
//#endregion
|
|
2885
|
+
//#region src/utils/BigMath.d.ts
|
|
2317
2886
|
declare function max$1(a: bigint, b: bigint): bigint;
|
|
2318
2887
|
declare function min(a: bigint, b: bigint): bigint;
|
|
2319
|
-
|
|
2888
|
+
//#endregion
|
|
2889
|
+
//#region src/utils/batch.d.ts
|
|
2320
2890
|
/**
|
|
2321
2891
|
* Splits an array into batches of a specified size.
|
|
2322
2892
|
* @param array The array to split.
|
|
@@ -2334,8 +2904,9 @@ declare function min(a: bigint, b: bigint): bigint;
|
|
|
2334
2904
|
* // [5]
|
|
2335
2905
|
* ```
|
|
2336
2906
|
*/
|
|
2337
|
-
declare function batch<T>(array:
|
|
2338
|
-
|
|
2907
|
+
declare function batch<T>(array: T[] | readonly T[], batchSize: number): Generator<T[], void, unknown>;
|
|
2908
|
+
//#endregion
|
|
2909
|
+
//#region src/utils/batchMulticall.d.ts
|
|
2339
2910
|
/**
|
|
2340
2911
|
* Helper function to execute multicall in batches with retry logic.
|
|
2341
2912
|
* Abstracts the common pattern of batching calls, retrying, and collecting results.
|
|
@@ -2344,60 +2915,89 @@ declare function batch<T>(array: Array<T>, batchSize: number): Generator<T[], vo
|
|
|
2344
2915
|
* @returns Promise resolving to flattened array of results
|
|
2345
2916
|
*/
|
|
2346
2917
|
declare function batchMulticall<TResult>(parameters: {
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2918
|
+
client: PublicClient<Transport, Chain$1>;
|
|
2919
|
+
calls: MulticallParameters["contracts"];
|
|
2920
|
+
batchSize: number;
|
|
2921
|
+
retryAttempts: number;
|
|
2922
|
+
retryDelayMs: number;
|
|
2923
|
+
blockNumber?: bigint;
|
|
2353
2924
|
}): Promise<TResult[]>;
|
|
2354
|
-
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region src/utils/lazy.d.ts
|
|
2355
2927
|
/**
|
|
2356
2928
|
* Transform a polling function into an async generator.
|
|
2357
2929
|
* @param fn - The polling function to transform.
|
|
2358
2930
|
* @returns An async generator.
|
|
2359
2931
|
*/
|
|
2360
|
-
declare function lazy<T>(pollFn: (emit: (value: T) => void, {
|
|
2361
|
-
|
|
2932
|
+
declare function lazy<T>(pollFn: (emit: (value: T) => void, {
|
|
2933
|
+
stop
|
|
2934
|
+
}: {
|
|
2935
|
+
stop: () => void;
|
|
2362
2936
|
}) => () => boolean): () => AsyncGenerator<Awaited<NonNullable<T>>, void, unknown>;
|
|
2363
|
-
|
|
2937
|
+
//#endregion
|
|
2938
|
+
//#region src/utils/poll.d.ts
|
|
2364
2939
|
/**
|
|
2365
2940
|
* Polls a function at a specified interval.
|
|
2366
2941
|
* Inspired by https://github.com/wevm/viem/blob/845994d20275d08ff892018e237a4b599eeefb6a/src/utils/poll.ts
|
|
2367
2942
|
*/
|
|
2368
|
-
declare function poll<data>(fn: ({
|
|
2369
|
-
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2943
|
+
declare function poll<data>(fn: ({
|
|
2944
|
+
unpoll
|
|
2945
|
+
}: {
|
|
2946
|
+
unpoll: () => void;
|
|
2947
|
+
}) => Promise<data | undefined>, {
|
|
2948
|
+
interval
|
|
2949
|
+
}: {
|
|
2950
|
+
interval: () => Promise<number>;
|
|
2372
2951
|
}): () => boolean;
|
|
2373
|
-
|
|
2952
|
+
declare namespace Random_d_exports {
|
|
2953
|
+
export { address, bool, bytes, float, hex, int, seed, withSeed };
|
|
2954
|
+
}
|
|
2955
|
+
/**
|
|
2956
|
+
* Runs a function with a deterministic RNG derived from the given seed.
|
|
2957
|
+
*/
|
|
2958
|
+
declare function withSeed<T>(seed: string, fn: () => T): T;
|
|
2959
|
+
/**
|
|
2960
|
+
* Seeds the global RNG for deterministic test runs.
|
|
2961
|
+
*/
|
|
2962
|
+
declare function seed(seed: string): void;
|
|
2963
|
+
/**
|
|
2964
|
+
* Returns a deterministic random float in [0, 1).
|
|
2965
|
+
*/
|
|
2966
|
+
declare function float(): number;
|
|
2967
|
+
/**
|
|
2968
|
+
* Returns a deterministic random integer in [min, maxExclusive).
|
|
2969
|
+
*/
|
|
2970
|
+
declare function int(maxExclusive: number, min?: number): number;
|
|
2971
|
+
/**
|
|
2972
|
+
* Returns a deterministic random boolean.
|
|
2973
|
+
*/
|
|
2974
|
+
declare function bool(probability?: number): boolean;
|
|
2975
|
+
/**
|
|
2976
|
+
* Returns deterministic random bytes.
|
|
2977
|
+
*/
|
|
2978
|
+
declare function bytes(length: number): Uint8Array;
|
|
2979
|
+
/**
|
|
2980
|
+
* Returns a deterministic random hex string for the given byte length.
|
|
2981
|
+
*/
|
|
2982
|
+
declare function hex(byteLength: number): Hex;
|
|
2983
|
+
/**
|
|
2984
|
+
* Returns a deterministic random address.
|
|
2985
|
+
*/
|
|
2986
|
+
declare function address(): Address;
|
|
2987
|
+
//#endregion
|
|
2988
|
+
//#region src/utils/retry.d.ts
|
|
2374
2989
|
declare const retry: <T>(fn: () => Promise<T>, attempts?: number, delayMs?: number) => Promise<T>;
|
|
2375
|
-
|
|
2990
|
+
declare namespace time_d_exports {
|
|
2991
|
+
export { max, now };
|
|
2992
|
+
}
|
|
2376
2993
|
declare function now(): number;
|
|
2377
2994
|
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
|
-
|
|
2995
|
+
//#endregion
|
|
2996
|
+
//#region src/utils/wait.d.ts
|
|
2385
2997
|
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 };
|
|
2998
|
+
declare namespace index_d_exports$2 {
|
|
2999
|
+
export { BaseError, GlobalErrorType, Random_d_exports as Random, 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
3000
|
}
|
|
2402
|
-
|
|
2403
|
-
export { Abi,
|
|
3001
|
+
//#endregion
|
|
3002
|
+
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 };
|
|
3003
|
+
//# sourceMappingURL=index.browser.d.ts.map
|