@ape.swap/bonds-sdk 4.0.0-test.36 → 4.0.0-test.38
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/dist/main.js +4 -4
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -64123,7 +64123,7 @@ const getPayoutAmount = (bond, inputValue, userPoints) => {
|
|
|
64123
64123
|
return 0;
|
|
64124
64124
|
const bigValue = new BigNumber$1(inputValue).times(
|
|
64125
64125
|
//TODO: think a permanent solution for this
|
|
64126
|
-
new BigNumber$1(10).pow(bond.chainId === types$1.ChainId.SOL ? 18 : ((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.
|
|
64126
|
+
new BigNumber$1(10).pow(bond.chainId === types$1.ChainId.SOL ? 18 : ((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : 18)));
|
|
64127
64127
|
const fee = (_d = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _d !== void 0 ? _d : 0;
|
|
64128
64128
|
const trueBondPriceObject = findHighestTrueBondPrice(userPoints, bond === null || bond === void 0 ? void 0 : bond.trueBondPrices);
|
|
64129
64129
|
const trueBondPrice = new BigNumber$1((_e = trueBondPriceObject === null || trueBondPriceObject === void 0 ? void 0 : trueBondPriceObject.trueBondPrice) !== null && _e !== void 0 ? _e : '0');
|
|
@@ -83162,7 +83162,7 @@ const fetchBondsData = (chainId, bills, apiUrl, tokenPrices) => __awaiter$9(void
|
|
|
83162
83162
|
});
|
|
83163
83163
|
const cleanBillsData = (billIds, chunkedBills, chainId, bills, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
83164
83164
|
const data = yield Promise.all(chunkedBills === null || chunkedBills === void 0 ? void 0 : chunkedBills.map((chunk, index) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
83165
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
83165
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
83166
83166
|
const bill = bills === null || bills === void 0 ? void 0 : bills.find((bill) => (bill === null || bill === void 0 ? void 0 : bill.index) === billIds[index]);
|
|
83167
83167
|
const lpPrice = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices.find((tokenPrice) => {
|
|
83168
83168
|
var _a, _b, _c, _d;
|
|
@@ -83182,7 +83182,7 @@ const cleanBillsData = (billIds, chunkedBills, chainId, bills, tokenPrices) => _
|
|
|
83182
83182
|
.minus(new BigNumber$1(totalPayoutGiven))
|
|
83183
83183
|
.div(new BigNumber$1(10).pow((_e = bill === null || bill === void 0 ? void 0 : bill.earnToken.decimals[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _e !== void 0 ? _e : 18))
|
|
83184
83184
|
.toNumber();
|
|
83185
|
-
const treasuryBalance = getBalanceNumber(customTreasuryBalance);
|
|
83185
|
+
const treasuryBalance = getBalanceNumber(customTreasuryBalance, (_h = (_g = (_f = bill === null || bill === void 0 ? void 0 : bill.earnToken) === null || _f === void 0 ? void 0 : _f.decimals) === null || _g === void 0 ? void 0 : _g[bill === null || bill === void 0 ? void 0 : bill.chainId]) !== null && _h !== void 0 ? _h : 18);
|
|
83186
83186
|
if (chainId === types$1.ChainId.SOL) {
|
|
83187
83187
|
const principalDecimals = bill === null || bill === void 0 ? void 0 : bill.lpToken.decimals[types$1.ChainId.SOL];
|
|
83188
83188
|
const payoutDecimals = bill === null || bill === void 0 ? void 0 : bill.earnToken.decimals[types$1.ChainId.SOL];
|
|
@@ -83213,7 +83213,7 @@ const cleanBillsData = (billIds, chunkedBills, chainId, bills, tokenPrices) => _
|
|
|
83213
83213
|
];
|
|
83214
83214
|
}
|
|
83215
83215
|
const cleanedData = Object.assign(Object.assign({}, bill), { feeInPayout,
|
|
83216
|
-
feeInPrincipal, showcaseTokenName: (
|
|
83216
|
+
feeInPrincipal, showcaseTokenName: (_l = (_k = (_j = bill === null || bill === void 0 ? void 0 : bill.showcaseToken) === null || _j === void 0 ? void 0 : _j.symbol) !== null && _k !== void 0 ? _k : bill === null || bill === void 0 ? void 0 : bill.earnToken.symbol) !== null && _l !== void 0 ? _l : '', trueBondPrices, principalTokenPrice: (_m = lpPrice === null || lpPrice === void 0 ? void 0 : lpPrice.toString()) !== null && _m !== void 0 ? _m : '0', payoutTokenPrice: (_o = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.toString()) !== null && _o !== void 0 ? _o : '0', tokensRemaining: treasuryBalance
|
|
83217
83217
|
? Math.min(treasuryBalance, tokensRemaining).toString()
|
|
83218
83218
|
: tokensRemaining.toString(), maxTotalPayout: maxTotalPayout === null || maxTotalPayout === void 0 ? void 0 : maxTotalPayout.toString(), maxPayout: maxPayout === null || maxPayout === void 0 ? void 0 : maxPayout.toString(), totalPayoutGiven: totalPayoutGiven === null || totalPayoutGiven === void 0 ? void 0 : totalPayoutGiven.toString(), vestingTerm: typeof vestingTerm === 'number' ? vestingTerm : vestingTerm.toNumber() });
|
|
83219
83219
|
return cleanedData;
|