@morpho-org/midnight-sdk 1.6.0 → 1.7.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/lib/cjs/api/MidnightApi.d.ts +16 -14
- package/lib/cjs/api/MidnightApi.js +26 -16
- package/lib/cjs/api/helpers.d.ts +14 -2
- package/lib/cjs/api/helpers.js +71 -11
- package/lib/cjs/api/index.d.ts +1 -1
- package/lib/cjs/api/index.js +2 -1
- package/lib/cjs/api/types.d.ts +1 -1
- package/lib/cjs/api/version.generated.d.ts +1 -1
- package/lib/cjs/api/version.generated.js +1 -1
- package/lib/cjs/errors.d.ts +13 -0
- package/lib/cjs/errors.js +18 -1
- package/lib/cjs/market/Market.d.ts +6 -30
- package/lib/cjs/market/Market.js +7 -31
- package/lib/cjs/market/MarketUtils.d.ts +14 -0
- package/lib/cjs/market/MarketUtils.js +17 -1
- package/lib/cjs/offers/Offer.d.ts +1 -1
- package/lib/cjs/offers/Offer.js +1 -1
- package/lib/cjs/offers/OfferChainUtils.d.ts +6 -2
- package/lib/cjs/offers/OfferChainUtils.js +6 -2
- package/lib/cjs/position/Position.d.ts +5 -25
- package/lib/cjs/position/Position.js +5 -25
- package/lib/esm/api/MidnightApi.d.ts +16 -14
- package/lib/esm/api/MidnightApi.js +28 -18
- package/lib/esm/api/helpers.d.ts +14 -2
- package/lib/esm/api/helpers.js +71 -12
- package/lib/esm/api/index.d.ts +1 -1
- package/lib/esm/api/index.js +1 -1
- package/lib/esm/api/types.d.ts +1 -1
- package/lib/esm/api/version.generated.d.ts +1 -1
- package/lib/esm/api/version.generated.js +1 -1
- package/lib/esm/errors.d.ts +13 -0
- package/lib/esm/errors.js +16 -0
- package/lib/esm/market/Market.d.ts +6 -30
- package/lib/esm/market/Market.js +7 -31
- package/lib/esm/market/MarketUtils.d.ts +14 -0
- package/lib/esm/market/MarketUtils.js +18 -2
- package/lib/esm/offers/Offer.d.ts +1 -1
- package/lib/esm/offers/Offer.js +1 -1
- package/lib/esm/offers/OfferChainUtils.d.ts +6 -2
- package/lib/esm/offers/OfferChainUtils.js +6 -2
- package/lib/esm/position/Position.d.ts +5 -25
- package/lib/esm/position/Position.js +5 -25
- package/package.json +3 -6
package/lib/esm/offers/Offer.js
CHANGED
|
@@ -476,7 +476,7 @@ export class Offer {
|
|
|
476
476
|
* @param params.tickSpacing - Optional market tick spacing; defaults to `DEFAULT_TICK_SPACING`.
|
|
477
477
|
* @param params.maxUnits - Optional unit cap; defaults to zero.
|
|
478
478
|
* @param params.maxAssets - Optional buyer or seller asset cap; defaults to zero.
|
|
479
|
-
* @param params.continuousFeeCap - Optional maximum market continuous fee accepted by this offer; defaults to `
|
|
479
|
+
* @param params.continuousFeeCap - Optional maximum market continuous fee accepted by this offer; defaults to `0n` (fail-closed: no market continuous fee accepted unless set explicitly).
|
|
480
480
|
* @param params.start - Optional offer start timestamp; defaults to zero.
|
|
481
481
|
* @param params.expiry - Offer expiry timestamp.
|
|
482
482
|
* @param params.callback - Optional callback address; defaults to the zero address.
|
|
@@ -67,7 +67,8 @@ export declare namespace OfferChainUtils {
|
|
|
67
67
|
* Use before a make-borrow or supply-collateral-and-make-borrow flow when a
|
|
68
68
|
* borrower wants one displayed fixed borrow rate across a longer window. Map
|
|
69
69
|
* the returned legs to `Offer.create({ buy: false, ... })`, then group and
|
|
70
|
-
* submit them through the maker flow.
|
|
70
|
+
* submit them through the maker flow. Pass the same market tick spacing to
|
|
71
|
+
* `Offer.create` so leg validation uses the chain's grid.
|
|
71
72
|
*
|
|
72
73
|
* Borrow chains read their target rate at each leg's expiry edge. If a leg
|
|
73
74
|
* would need to extend past `chainEndTimestamp`, it is dropped rather than
|
|
@@ -97,6 +98,7 @@ export declare namespace OfferChainUtils {
|
|
|
97
98
|
* ...baseOffer,
|
|
98
99
|
* buy: false,
|
|
99
100
|
* tick: leg.tick,
|
|
101
|
+
* tickSpacing: market.tickSpacing,
|
|
100
102
|
* start: leg.startTimestamp,
|
|
101
103
|
* expiry: leg.expiryTimestamp,
|
|
102
104
|
* }),
|
|
@@ -110,7 +112,8 @@ export declare namespace OfferChainUtils {
|
|
|
110
112
|
* Use before a make-lend flow when a lender wants one displayed fixed lend
|
|
111
113
|
* rate across a longer window. Map the returned legs to
|
|
112
114
|
* `Offer.create({ buy: true, ... })`, then group and submit them through the
|
|
113
|
-
* maker flow.
|
|
115
|
+
* maker flow. Pass the same market tick spacing to `Offer.create` so leg
|
|
116
|
+
* validation uses the chain's grid.
|
|
114
117
|
*
|
|
115
118
|
* Lend chains read their target rate at each leg's start edge. The first leg
|
|
116
119
|
* may start before `chainStartTimestamp`; clamping that edge would move the
|
|
@@ -140,6 +143,7 @@ export declare namespace OfferChainUtils {
|
|
|
140
143
|
* ...baseOffer,
|
|
141
144
|
* buy: true,
|
|
142
145
|
* tick: leg.tick,
|
|
146
|
+
* tickSpacing: market.tickSpacing,
|
|
143
147
|
* start: leg.startTimestamp,
|
|
144
148
|
* expiry: leg.expiryTimestamp,
|
|
145
149
|
* }),
|
|
@@ -55,7 +55,8 @@ export var OfferChainUtils;
|
|
|
55
55
|
* Use before a make-borrow or supply-collateral-and-make-borrow flow when a
|
|
56
56
|
* borrower wants one displayed fixed borrow rate across a longer window. Map
|
|
57
57
|
* the returned legs to `Offer.create({ buy: false, ... })`, then group and
|
|
58
|
-
* submit them through the maker flow.
|
|
58
|
+
* submit them through the maker flow. Pass the same market tick spacing to
|
|
59
|
+
* `Offer.create` so leg validation uses the chain's grid.
|
|
59
60
|
*
|
|
60
61
|
* Borrow chains read their target rate at each leg's expiry edge. If a leg
|
|
61
62
|
* would need to extend past `chainEndTimestamp`, it is dropped rather than
|
|
@@ -85,6 +86,7 @@ export var OfferChainUtils;
|
|
|
85
86
|
* ...baseOffer,
|
|
86
87
|
* buy: false,
|
|
87
88
|
* tick: leg.tick,
|
|
89
|
+
* tickSpacing: market.tickSpacing,
|
|
88
90
|
* start: leg.startTimestamp,
|
|
89
91
|
* expiry: leg.expiryTimestamp,
|
|
90
92
|
* }),
|
|
@@ -201,7 +203,8 @@ export var OfferChainUtils;
|
|
|
201
203
|
* Use before a make-lend flow when a lender wants one displayed fixed lend
|
|
202
204
|
* rate across a longer window. Map the returned legs to
|
|
203
205
|
* `Offer.create({ buy: true, ... })`, then group and submit them through the
|
|
204
|
-
* maker flow.
|
|
206
|
+
* maker flow. Pass the same market tick spacing to `Offer.create` so leg
|
|
207
|
+
* validation uses the chain's grid.
|
|
205
208
|
*
|
|
206
209
|
* Lend chains read their target rate at each leg's start edge. The first leg
|
|
207
210
|
* may start before `chainStartTimestamp`; clamping that edge would move the
|
|
@@ -231,6 +234,7 @@ export var OfferChainUtils;
|
|
|
231
234
|
* ...baseOffer,
|
|
232
235
|
* buy: true,
|
|
233
236
|
* tick: leg.tick,
|
|
237
|
+
* tickSpacing: market.tickSpacing,
|
|
234
238
|
* start: leg.startTimestamp,
|
|
235
239
|
* expiry: leg.expiryTimestamp,
|
|
236
240
|
* }),
|
|
@@ -120,11 +120,7 @@ export interface IAccrualPosition extends Omit<IPosition, "marketId"> {
|
|
|
120
120
|
* registerCustomAddresses({
|
|
121
121
|
* addresses: {
|
|
122
122
|
* 31337: {
|
|
123
|
-
*
|
|
124
|
-
* bundler3: {
|
|
125
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
126
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
127
|
-
* },
|
|
123
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
128
124
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
129
125
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
130
126
|
* },
|
|
@@ -244,11 +240,7 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
|
|
|
244
240
|
* registerCustomAddresses({
|
|
245
241
|
* addresses: {
|
|
246
242
|
* 31337: {
|
|
247
|
-
*
|
|
248
|
-
* bundler3: {
|
|
249
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
250
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
251
|
-
* },
|
|
243
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
252
244
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
253
245
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
254
246
|
* },
|
|
@@ -311,11 +303,7 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
|
|
|
311
303
|
* registerCustomAddresses({
|
|
312
304
|
* addresses: {
|
|
313
305
|
* 31337: {
|
|
314
|
-
*
|
|
315
|
-
* bundler3: {
|
|
316
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
317
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
318
|
-
* },
|
|
306
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
319
307
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
320
308
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
321
309
|
* },
|
|
@@ -379,11 +367,7 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
|
|
|
379
367
|
* registerCustomAddresses({
|
|
380
368
|
* addresses: {
|
|
381
369
|
* 31337: {
|
|
382
|
-
*
|
|
383
|
-
* bundler3: {
|
|
384
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
385
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
386
|
-
* },
|
|
370
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
387
371
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
388
372
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
389
373
|
* },
|
|
@@ -449,11 +433,7 @@ export declare class AccrualPosition extends Position implements IAccrualPositio
|
|
|
449
433
|
* registerCustomAddresses({
|
|
450
434
|
* addresses: {
|
|
451
435
|
* 31337: {
|
|
452
|
-
*
|
|
453
|
-
* bundler3: {
|
|
454
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
455
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
456
|
-
* },
|
|
436
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
457
437
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
458
438
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
459
439
|
* },
|
|
@@ -90,11 +90,7 @@ export class Position {
|
|
|
90
90
|
* registerCustomAddresses({
|
|
91
91
|
* addresses: {
|
|
92
92
|
* 31337: {
|
|
93
|
-
*
|
|
94
|
-
* bundler3: {
|
|
95
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
96
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
97
|
-
* },
|
|
93
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
98
94
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
99
95
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
100
96
|
* },
|
|
@@ -225,11 +221,7 @@ export class AccrualPosition extends Position {
|
|
|
225
221
|
* registerCustomAddresses({
|
|
226
222
|
* addresses: {
|
|
227
223
|
* 31337: {
|
|
228
|
-
*
|
|
229
|
-
* bundler3: {
|
|
230
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
231
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
232
|
-
* },
|
|
224
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
233
225
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
234
226
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
235
227
|
* },
|
|
@@ -297,11 +289,7 @@ export class AccrualPosition extends Position {
|
|
|
297
289
|
* registerCustomAddresses({
|
|
298
290
|
* addresses: {
|
|
299
291
|
* 31337: {
|
|
300
|
-
*
|
|
301
|
-
* bundler3: {
|
|
302
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
303
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
304
|
-
* },
|
|
292
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
305
293
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
306
294
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
307
295
|
* },
|
|
@@ -368,11 +356,7 @@ export class AccrualPosition extends Position {
|
|
|
368
356
|
* registerCustomAddresses({
|
|
369
357
|
* addresses: {
|
|
370
358
|
* 31337: {
|
|
371
|
-
*
|
|
372
|
-
* bundler3: {
|
|
373
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
374
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
375
|
-
* },
|
|
359
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
376
360
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
377
361
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
378
362
|
* },
|
|
@@ -440,11 +424,7 @@ export class AccrualPosition extends Position {
|
|
|
440
424
|
* registerCustomAddresses({
|
|
441
425
|
* addresses: {
|
|
442
426
|
* 31337: {
|
|
443
|
-
*
|
|
444
|
-
* bundler3: {
|
|
445
|
-
* bundler3: "0x0000000000000000000000000000000000000002",
|
|
446
|
-
* generalAdapter1: "0x0000000000000000000000000000000000000003",
|
|
447
|
-
* },
|
|
427
|
+
* blue: "0x0000000000000000000000000000000000000001",
|
|
448
428
|
* adaptiveCurveIrm: "0x0000000000000000000000000000000000000004",
|
|
449
429
|
* midnight: "0x0000000000000000000000000000000000001000",
|
|
450
430
|
* },
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morpho-org/midnight-sdk",
|
|
3
3
|
"description": "Viem-based package for Morpho Midnight that exports protocol utilities, fetch helpers, and Midnight API utilities under a dedicated API subpath.",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
|
-
"contributors": [
|
|
7
|
-
"Rubilmax <rmilon@gmail.com>"
|
|
8
|
-
],
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
8
|
"url": "github:morpho-org/sdks"
|
|
@@ -43,7 +40,7 @@
|
|
|
43
40
|
"lib"
|
|
44
41
|
],
|
|
45
42
|
"peerDependencies": {
|
|
46
|
-
"@morpho-org/morpho-ts": "^2.8.0",
|
|
43
|
+
"@morpho-org/morpho-ts": "^2.8.0 || ^3.0.0",
|
|
47
44
|
"viem": "^2.0.0"
|
|
48
45
|
},
|
|
49
46
|
"devDependencies": {
|
|
@@ -51,7 +48,7 @@
|
|
|
51
48
|
"typescript": "7.0.2",
|
|
52
49
|
"viem": "^2.55.10",
|
|
53
50
|
"vitest": "^4.1.11",
|
|
54
|
-
"@morpho-org/morpho-ts": "^
|
|
51
|
+
"@morpho-org/morpho-ts": "^3.0.0",
|
|
55
52
|
"@morpho-org/test": "^2.10.0"
|
|
56
53
|
},
|
|
57
54
|
"scripts": {
|