@morpho-org/midnight-sdk 1.4.0-next.0 → 1.4.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/version.generated.d.ts +1 -1
- package/lib/cjs/api/version.generated.js +1 -1
- package/lib/cjs/offers/OfferUtils.js +6 -9
- package/lib/cjs/queries/GetPosition.d.ts +1 -1
- package/lib/cjs/queries/GetPosition.js +1 -1
- package/lib/esm/api/version.generated.d.ts +1 -1
- package/lib/esm/api/version.generated.js +1 -1
- package/lib/esm/offers/OfferUtils.js +6 -9
- package/lib/esm/queries/GetPosition.d.ts +1 -1
- package/lib/esm/queries/GetPosition.js +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal Installed Midnight SDK package version. */
|
|
2
|
-
export declare const MIDNIGHT_SDK_VERSION = "1.4.0
|
|
2
|
+
export declare const MIDNIGHT_SDK_VERSION = "1.4.0";
|
|
@@ -868,23 +868,20 @@ var OfferUtils;
|
|
|
868
868
|
return 0n;
|
|
869
869
|
if (continuousFeeCap < BigInt(market.continuousFee))
|
|
870
870
|
return 0n;
|
|
871
|
+
const settlementFee = market.getSettlementFee(market.timeToMaturity(timestamp));
|
|
872
|
+
// Validates the settlement fee against the offer price for both cap modes.
|
|
873
|
+
const { sellerPrice, buyerPrice } = index_js_2.TakeAmountsLib.prices({
|
|
874
|
+
offer,
|
|
875
|
+
settlementFee,
|
|
876
|
+
});
|
|
871
877
|
if (maxUnits > 0n)
|
|
872
878
|
return morpho_ts_1.MathLib.zeroFloorSub(maxUnits, consumed);
|
|
873
879
|
const remainingAssets = morpho_ts_1.MathLib.zeroFloorSub(maxAssets, consumed);
|
|
874
|
-
const settlementFee = market.getSettlementFee(market.timeToMaturity(timestamp));
|
|
875
880
|
if (!offer.buy) {
|
|
876
|
-
const { sellerPrice } = index_js_2.TakeAmountsLib.prices({
|
|
877
|
-
offer,
|
|
878
|
-
settlementFee,
|
|
879
|
-
});
|
|
880
881
|
if (sellerPrice === 0n)
|
|
881
882
|
return morpho_ts_1.MathLib.MAX_UINT_256;
|
|
882
883
|
return morpho_ts_1.MathLib.mulDivDown(remainingAssets, morpho_ts_1.MathLib.WAD, sellerPrice);
|
|
883
884
|
}
|
|
884
|
-
const { buyerPrice } = index_js_2.TakeAmountsLib.prices({
|
|
885
|
-
offer,
|
|
886
|
-
settlementFee,
|
|
887
|
-
});
|
|
888
885
|
if (buyerPrice === 0n)
|
|
889
886
|
return morpho_ts_1.MathLib.MAX_UINT_256;
|
|
890
887
|
return ((remainingAssets + 1n) * morpho_ts_1.MathLib.WAD - 1n) / buyerPrice;
|
|
@@ -52,4 +52,4 @@ export declare const abi: readonly [{
|
|
|
52
52
|
readonly type: "function";
|
|
53
53
|
}];
|
|
54
54
|
/** @internal Deployless `GetPosition` query bytecode. */
|
|
55
|
-
export declare const code = "
|
|
55
|
+
export declare const code = "0x60808060405234601557610362908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c63d8f172c414610025575f80fd5b346101b85760603660031901126101b8576004356001600160a01b03811691908290036101b857602435906044356001600160a01b038116908190036101b85760e0820182811067ffffffffffffffff8211176102e2576040525f825260208201925f845260408301925f8452606081015f8152608082015f815260a08301915f835260c0840196611000604051906100be81836102f6565b36823788526040516349e2903160e11b8152600481018790526024810188905260c0816044818e5afa9081156101c4575f905f925f91885f925f925f91610243575b506001600160801b039081169091529081168852908116865290811684529182168b521685525f5b60808110156101cf5760405163ecdcc72d60e01b8152600481018890526024810189905260448101829052906020826064818f5afa80156101c4575f90610187575b600192506001600160801b038b519116908260051b015201610128565b506020823d82116101bc575b816101a0602093836102f6565b810103126101b8576101b3600192610318565b61016a565b5f80fd5b3d9150610193565b6040513d5f823e3d90fd5b506001600160801b039283899593818094818e816040519c51168c52511660208b0152511660408901525116606087015251166080850152511660a08301525160c082015f905b60808210610224576110c084f35b6020806001926001600160801b03865116815201930191019091610216565b965050505050505060c0813d60c0116102da575b8161026460c093836102f6565b810103126101b857806001600160801b0361027f8193610318565b918161028d60208301610318565b938161029b60408501610318565b93816102a960608301610318565b938d826102c460a06102bd60808801610318565b9601610318565b929a989694929550509497509450509396610100565b3d9150610257565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176102e257604052565b51906001600160801b03821682036101b85756fea26469706673582212200eb5ee2c25180818e6f54eaf74e6f626bff5ff8c68ec38bf86f24bc97a4fe77264736f6c63430008240033";
|
|
@@ -71,4 +71,4 @@ exports.abi = [
|
|
|
71
71
|
},
|
|
72
72
|
];
|
|
73
73
|
/** @internal Deployless `GetPosition` query bytecode. */
|
|
74
|
-
exports.code = "
|
|
74
|
+
exports.code = "0x60808060405234601557610362908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c63d8f172c414610025575f80fd5b346101b85760603660031901126101b8576004356001600160a01b03811691908290036101b857602435906044356001600160a01b038116908190036101b85760e0820182811067ffffffffffffffff8211176102e2576040525f825260208201925f845260408301925f8452606081015f8152608082015f815260a08301915f835260c0840196611000604051906100be81836102f6565b36823788526040516349e2903160e11b8152600481018790526024810188905260c0816044818e5afa9081156101c4575f905f925f91885f925f925f91610243575b506001600160801b039081169091529081168852908116865290811684529182168b521685525f5b60808110156101cf5760405163ecdcc72d60e01b8152600481018890526024810189905260448101829052906020826064818f5afa80156101c4575f90610187575b600192506001600160801b038b519116908260051b015201610128565b506020823d82116101bc575b816101a0602093836102f6565b810103126101b8576101b3600192610318565b61016a565b5f80fd5b3d9150610193565b6040513d5f823e3d90fd5b506001600160801b039283899593818094818e816040519c51168c52511660208b0152511660408901525116606087015251166080850152511660a08301525160c082015f905b60808210610224576110c084f35b6020806001926001600160801b03865116815201930191019091610216565b965050505050505060c0813d60c0116102da575b8161026460c093836102f6565b810103126101b857806001600160801b0361027f8193610318565b918161028d60208301610318565b938161029b60408501610318565b93816102a960608301610318565b938d826102c460a06102bd60808801610318565b9601610318565b929a989694929550509497509450509396610100565b3d9150610257565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176102e257604052565b51906001600160801b03821682036101b85756fea26469706673582212200eb5ee2c25180818e6f54eaf74e6f626bff5ff8c68ec38bf86f24bc97a4fe77264736f6c63430008240033";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal Installed Midnight SDK package version. */
|
|
2
|
-
export declare const MIDNIGHT_SDK_VERSION = "1.4.0
|
|
2
|
+
export declare const MIDNIGHT_SDK_VERSION = "1.4.0";
|
|
@@ -865,23 +865,20 @@ export var OfferUtils;
|
|
|
865
865
|
return 0n;
|
|
866
866
|
if (continuousFeeCap < BigInt(market.continuousFee))
|
|
867
867
|
return 0n;
|
|
868
|
+
const settlementFee = market.getSettlementFee(market.timeToMaturity(timestamp));
|
|
869
|
+
// Validates the settlement fee against the offer price for both cap modes.
|
|
870
|
+
const { sellerPrice, buyerPrice } = TakeAmountsLib.prices({
|
|
871
|
+
offer,
|
|
872
|
+
settlementFee,
|
|
873
|
+
});
|
|
868
874
|
if (maxUnits > 0n)
|
|
869
875
|
return MathLib.zeroFloorSub(maxUnits, consumed);
|
|
870
876
|
const remainingAssets = MathLib.zeroFloorSub(maxAssets, consumed);
|
|
871
|
-
const settlementFee = market.getSettlementFee(market.timeToMaturity(timestamp));
|
|
872
877
|
if (!offer.buy) {
|
|
873
|
-
const { sellerPrice } = TakeAmountsLib.prices({
|
|
874
|
-
offer,
|
|
875
|
-
settlementFee,
|
|
876
|
-
});
|
|
877
878
|
if (sellerPrice === 0n)
|
|
878
879
|
return MathLib.MAX_UINT_256;
|
|
879
880
|
return MathLib.mulDivDown(remainingAssets, MathLib.WAD, sellerPrice);
|
|
880
881
|
}
|
|
881
|
-
const { buyerPrice } = TakeAmountsLib.prices({
|
|
882
|
-
offer,
|
|
883
|
-
settlementFee,
|
|
884
|
-
});
|
|
885
882
|
if (buyerPrice === 0n)
|
|
886
883
|
return MathLib.MAX_UINT_256;
|
|
887
884
|
return ((remainingAssets + 1n) * MathLib.WAD - 1n) / buyerPrice;
|
|
@@ -52,4 +52,4 @@ export declare const abi: readonly [{
|
|
|
52
52
|
readonly type: "function";
|
|
53
53
|
}];
|
|
54
54
|
/** @internal Deployless `GetPosition` query bytecode. */
|
|
55
|
-
export declare const code = "
|
|
55
|
+
export declare const code = "0x60808060405234601557610362908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c63d8f172c414610025575f80fd5b346101b85760603660031901126101b8576004356001600160a01b03811691908290036101b857602435906044356001600160a01b038116908190036101b85760e0820182811067ffffffffffffffff8211176102e2576040525f825260208201925f845260408301925f8452606081015f8152608082015f815260a08301915f835260c0840196611000604051906100be81836102f6565b36823788526040516349e2903160e11b8152600481018790526024810188905260c0816044818e5afa9081156101c4575f905f925f91885f925f925f91610243575b506001600160801b039081169091529081168852908116865290811684529182168b521685525f5b60808110156101cf5760405163ecdcc72d60e01b8152600481018890526024810189905260448101829052906020826064818f5afa80156101c4575f90610187575b600192506001600160801b038b519116908260051b015201610128565b506020823d82116101bc575b816101a0602093836102f6565b810103126101b8576101b3600192610318565b61016a565b5f80fd5b3d9150610193565b6040513d5f823e3d90fd5b506001600160801b039283899593818094818e816040519c51168c52511660208b0152511660408901525116606087015251166080850152511660a08301525160c082015f905b60808210610224576110c084f35b6020806001926001600160801b03865116815201930191019091610216565b965050505050505060c0813d60c0116102da575b8161026460c093836102f6565b810103126101b857806001600160801b0361027f8193610318565b918161028d60208301610318565b938161029b60408501610318565b93816102a960608301610318565b938d826102c460a06102bd60808801610318565b9601610318565b929a989694929550509497509450509396610100565b3d9150610257565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176102e257604052565b51906001600160801b03821682036101b85756fea26469706673582212200eb5ee2c25180818e6f54eaf74e6f626bff5ff8c68ec38bf86f24bc97a4fe77264736f6c63430008240033";
|
|
@@ -68,4 +68,4 @@ export const abi = [
|
|
|
68
68
|
},
|
|
69
69
|
];
|
|
70
70
|
/** @internal Deployless `GetPosition` query bytecode. */
|
|
71
|
-
export const code = "
|
|
71
|
+
export const code = "0x60808060405234601557610362908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c63d8f172c414610025575f80fd5b346101b85760603660031901126101b8576004356001600160a01b03811691908290036101b857602435906044356001600160a01b038116908190036101b85760e0820182811067ffffffffffffffff8211176102e2576040525f825260208201925f845260408301925f8452606081015f8152608082015f815260a08301915f835260c0840196611000604051906100be81836102f6565b36823788526040516349e2903160e11b8152600481018790526024810188905260c0816044818e5afa9081156101c4575f905f925f91885f925f925f91610243575b506001600160801b039081169091529081168852908116865290811684529182168b521685525f5b60808110156101cf5760405163ecdcc72d60e01b8152600481018890526024810189905260448101829052906020826064818f5afa80156101c4575f90610187575b600192506001600160801b038b519116908260051b015201610128565b506020823d82116101bc575b816101a0602093836102f6565b810103126101b8576101b3600192610318565b61016a565b5f80fd5b3d9150610193565b6040513d5f823e3d90fd5b506001600160801b039283899593818094818e816040519c51168c52511660208b0152511660408901525116606087015251166080850152511660a08301525160c082015f905b60808210610224576110c084f35b6020806001926001600160801b03865116815201930191019091610216565b965050505050505060c0813d60c0116102da575b8161026460c093836102f6565b810103126101b857806001600160801b0361027f8193610318565b918161028d60208301610318565b938161029b60408501610318565b93816102a960608301610318565b938d826102c460a06102bd60808801610318565b9601610318565b929a989694929550509497509450509396610100565b3d9150610257565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff8211176102e257604052565b51906001600160801b03821682036101b85756fea26469706673582212200eb5ee2c25180818e6f54eaf74e6f626bff5ff8c68ec38bf86f24bc97a4fe77264736f6c63430008240033";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.0
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"author": "Morpho Association <contact@morpho.org>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Rubilmax <rmilon@gmail.com>"
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"typescript": "7.0.2",
|
|
52
52
|
"viem": "^2.55.10",
|
|
53
53
|
"vitest": "^4.1.10",
|
|
54
|
-
"@morpho-org/morpho-ts": "^2.
|
|
54
|
+
"@morpho-org/morpho-ts": "^2.12.0",
|
|
55
55
|
"@morpho-org/test": "^2.10.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
|
-
"prepublish": "
|
|
58
|
+
"prepublish": "pnpm build",
|
|
59
59
|
"compile": "node ../../scripts/compile-solidity.js midnight-sdk",
|
|
60
|
-
"build": "
|
|
60
|
+
"build": "pnpm generate:version && tsc --noEmit && pnpm build:cjs && pnpm build:esm",
|
|
61
61
|
"build:cjs": "tsc --build tsconfig.build.cjs.json && echo '{\"type\":\"commonjs\"}' > lib/cjs/package.json",
|
|
62
62
|
"build:esm": "tsc --build tsconfig.build.esm.json && echo '{\"type\":\"module\"}' > lib/esm/package.json",
|
|
63
63
|
"generate:version": "node ../../scripts/release/generate-midnight-package-version.mjs",
|