@tradeport/sui-trading-sdk 0.1.34 → 0.1.35
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/CHANGELOG.md +6 -0
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/helpers/calculateRoyaltyFee.ts +14 -6
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1726,13 +1726,17 @@ function calculatePremium(price) {
|
|
|
1726
1726
|
|
|
1727
1727
|
// src/helpers/calculateRoyaltyFee.ts
|
|
1728
1728
|
function calculateRoyaltyFee(transferPolicyRules, price) {
|
|
1729
|
-
const
|
|
1729
|
+
const royaltyRule = transferPolicyRules?.filter(
|
|
1730
1730
|
(rule) => rule.type === "royalty_rule"
|
|
1731
|
-
);
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
);
|
|
1731
|
+
)?.[0];
|
|
1732
|
+
if (!royaltyRule || !royaltyRule.amount_bp && !royaltyRule.min_amount) {
|
|
1733
|
+
return 0n;
|
|
1734
|
+
}
|
|
1735
|
+
const royaltyFee = royaltyRule.amount_bp ? BigInt(royaltyRule.amount_bp) * price / 10000n : 0n;
|
|
1736
|
+
if (royaltyRule.min_amount && BigInt(royaltyRule.min_amount) > royaltyFee) {
|
|
1737
|
+
return BigInt(royaltyRule.min_amount);
|
|
1738
|
+
}
|
|
1739
|
+
return royaltyFee;
|
|
1736
1740
|
}
|
|
1737
1741
|
|
|
1738
1742
|
// src/graphql/queries/fetchLockById.ts
|