@ape.swap/bonds-sdk 3.0.72 → 3.0.74
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 +59 -9
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -58580,7 +58580,7 @@ const discountEarnTokenPriceForUser = (bond, useTiers, userTier) => {
|
|
|
58580
58580
|
var _a, _b, _c;
|
|
58581
58581
|
const fee = (_a = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _a !== void 0 ? _a : 0;
|
|
58582
58582
|
const principalTokenPrice = parseFloat((_b = bond.principalTokenPrice) !== null && _b !== void 0 ? _b : '0');
|
|
58583
|
-
const trueBondPrice = (_c = findHighestTrueBondPrice(TIERS_WEIGHT[userTier] , bond)) === null || _c === void 0 ? void 0 : _c.trueBondPrice;
|
|
58583
|
+
const trueBondPrice = (_c = findHighestTrueBondPrice(useTiers ? TIERS_WEIGHT[userTier] : '0', bond)) === null || _c === void 0 ? void 0 : _c.trueBondPrice;
|
|
58584
58584
|
const trueBondPriceWithFee = getBalanceNumber(new BigNumber$1(trueBondPrice).times((100 + fee) / 100));
|
|
58585
58585
|
return getFirstNonZeroDigits(principalTokenPrice * trueBondPriceWithFee);
|
|
58586
58586
|
};
|
|
@@ -68937,6 +68937,58 @@ const zapInputTokens = {
|
|
|
68937
68937
|
active: true,
|
|
68938
68938
|
},
|
|
68939
68939
|
],
|
|
68940
|
+
[types.ChainId.SONIC]: [
|
|
68941
|
+
{
|
|
68942
|
+
symbol: 'wS',
|
|
68943
|
+
address: {
|
|
68944
|
+
[types.ChainId.SONIC]: '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38',
|
|
68945
|
+
},
|
|
68946
|
+
decimals: {
|
|
68947
|
+
[types.ChainId.SONIC]: 18,
|
|
68948
|
+
},
|
|
68949
|
+
active: true,
|
|
68950
|
+
},
|
|
68951
|
+
{
|
|
68952
|
+
symbol: 'USDC',
|
|
68953
|
+
address: {
|
|
68954
|
+
[types.ChainId.SONIC]: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
|
|
68955
|
+
},
|
|
68956
|
+
decimals: {
|
|
68957
|
+
[types.ChainId.SONIC]: 6,
|
|
68958
|
+
},
|
|
68959
|
+
active: true,
|
|
68960
|
+
},
|
|
68961
|
+
{
|
|
68962
|
+
symbol: 'USDT',
|
|
68963
|
+
address: {
|
|
68964
|
+
[types.ChainId.SONIC]: '0x6047828dc181963ba44974801FF68e538dA5eaF9',
|
|
68965
|
+
},
|
|
68966
|
+
decimals: {
|
|
68967
|
+
[types.ChainId.SONIC]: 6,
|
|
68968
|
+
},
|
|
68969
|
+
active: true,
|
|
68970
|
+
},
|
|
68971
|
+
{
|
|
68972
|
+
symbol: 'BTC',
|
|
68973
|
+
address: {
|
|
68974
|
+
[types.ChainId.SONIC]: '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c',
|
|
68975
|
+
},
|
|
68976
|
+
decimals: {
|
|
68977
|
+
[types.ChainId.SONIC]: 8,
|
|
68978
|
+
},
|
|
68979
|
+
active: true,
|
|
68980
|
+
},
|
|
68981
|
+
{
|
|
68982
|
+
symbol: 'wETH',
|
|
68983
|
+
address: {
|
|
68984
|
+
[types.ChainId.SONIC]: '0x50c42dEAcD8Fc9773493ED674b675bE577f2634b',
|
|
68985
|
+
},
|
|
68986
|
+
decimals: {
|
|
68987
|
+
[types.ChainId.SONIC]: 18,
|
|
68988
|
+
},
|
|
68989
|
+
active: true,
|
|
68990
|
+
},
|
|
68991
|
+
],
|
|
68940
68992
|
};
|
|
68941
68993
|
|
|
68942
68994
|
var PRICE_GETTER_V3_ABI = [
|
|
@@ -78410,13 +78462,11 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account, tierProof
|
|
|
78410
78462
|
];
|
|
78411
78463
|
}, [zapInputData]);
|
|
78412
78464
|
const fetchZapDetails = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
78413
|
-
var _a, _b, _c
|
|
78414
|
-
console.log('Making Bond Zap call');
|
|
78465
|
+
var _a, _b, _c;
|
|
78415
78466
|
const response = yield axios.post(SOUL_ZAP_API, {
|
|
78416
78467
|
'0': zapInputData,
|
|
78417
78468
|
});
|
|
78418
|
-
|
|
78419
|
-
return (_f = (_e = (_d = response.data) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.result) === null || _f === void 0 ? void 0 : _f.data;
|
|
78469
|
+
return (_c = (_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.data;
|
|
78420
78470
|
});
|
|
78421
78471
|
const { data: response, isLoading, isFetching, error, } = useQuery({
|
|
78422
78472
|
queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
|
|
@@ -79026,6 +79076,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
79026
79076
|
const { data: userPoints } = useTierPoints();
|
|
79027
79077
|
const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, txChain);
|
|
79028
79078
|
const { switchChainAsync } = useSwitchChain();
|
|
79079
|
+
const SDKConfig = useSDKConfig();
|
|
79029
79080
|
// Flow
|
|
79030
79081
|
const initialChain = useMemo(() => chain === null || chain === void 0 ? void 0 : chain.id, []);
|
|
79031
79082
|
const showSwitchChainFlow = txChain !== initialChain;
|
|
@@ -79120,6 +79171,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
79120
79171
|
}, [buyTxHash, txReceipt, isSuccess]);
|
|
79121
79172
|
const currentStep = showSwitchChainFlow ? (hasToSwitchChain ? 1 : hasToApprove ? 2 : 3) : hasToApprove ? 1 : 2;
|
|
79122
79173
|
const splited = typeof inputToken !== 'string' ? (_b = inputToken === null || inputToken === void 0 ? void 0 : inputToken.symbol) === null || _b === void 0 ? void 0 : _b.split('-') : undefined;
|
|
79174
|
+
const trueBondPrice = findHighestTrueBondPrice((_c = TIERS_WEIGHT[getUserTier(userPoints)]) !== null && _c !== void 0 ? _c : '0', bondData);
|
|
79123
79175
|
return (jsxs(Modal, { children: [jsx$2(ModalHeader, { onDismiss: onDismiss, hideDivider: true }), jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', alignItems: 'center', p: '10px' }, children: [showSwitchChainFlow && (jsx$2(StepBubble, { number: 1, title: 'Switch Chain', currentStep: currentStep, loading: loadingSwitchChain })), jsx$2(StepBubble, { number: showSwitchChainFlow ? 2 : 1, title: 'Approve', currentStep: currentStep, loading: approveLoading || approvalState === ApprovalState.PENDING }), jsx$2(StepBubble, { number: showSwitchChainFlow ? 3 : 2, title: 'Buy', currentStep: currentStep, loading: loadingTx || verifyingTx, hideBar: true })] }), jsx$2(Flex, { sx: { width: '100%', mt: '40px', justifyContent: 'center' }, children: jsx$2(LoadingSpinner, { isLoading: loadingSwitchChain ||
|
|
79124
79176
|
approveLoading ||
|
|
79125
79177
|
loadingTx ||
|
|
@@ -79141,14 +79193,14 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
79141
79193
|
borderRadius: 'normal',
|
|
79142
79194
|
color: 'textDisabledButton',
|
|
79143
79195
|
justifyContent: 'center',
|
|
79144
|
-
}, children: [bondData.earnToken.symbol, " (", getVestingTermsString(bondData), ")"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsx$2(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: earnTokenPrice(bondData) }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", discountEarnTokenPriceForUser(bondData,
|
|
79196
|
+
}, children: [bondData.earnToken.symbol, " (", getVestingTermsString(bondData), ")"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsx$2(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: earnTokenPrice(bondData) }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", discountEarnTokenPriceForUser(bondData, SDKConfig.useTiers, getUserTier(userPoints))] })] }), jsxs(Flex, { sx: {
|
|
79145
79197
|
p: '5px',
|
|
79146
79198
|
borderRadius: 'normal',
|
|
79147
79199
|
border: '1px solid var(--theme-ui-colors-success)',
|
|
79148
79200
|
background: 'rgba(56, 166, 17, 0.13)',
|
|
79149
79201
|
color: 'success',
|
|
79150
79202
|
lineHeight: '18px',
|
|
79151
|
-
}, children: [(_d =
|
|
79203
|
+
}, children: [(_d = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _d === void 0 ? void 0 : _d.toFixed(2), " % Bonus"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '10px' }, children: [jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 20, chain: txChain })) : (jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain })), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_e = formatNumber$1(inputValue)) !== null && _e !== void 0 ? _e : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
|
|
79152
79204
|
? `$${formatUSDNumber(((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue)).toFixed(2))}`
|
|
79153
79205
|
: '0.00', ")"] })] }), jsx$2(Svg, { icon: 'arrow', direction: 'right', width: '10px' }), jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [jsx$2(TokenImage, { symbol: getSymbol(bondData.earnToken, txChain), chain: txChain, size: 20 }), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: formatNumber$1(estimatedOutputAmount.toString()) }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["($", formatUSDNumber(estimatedOutputUSD.toString()), ")"] })] })] })] }), jsx$2(Flex, { sx: { mt: '20px' }, children: hasToSwitchChain ? (jsxs(Button, { load: loadingSwitchChain, disabled: loadingSwitchChain, onClick: handleSwitchChain, fullWidth: true, children: ["switch to ", NETWORK_LABEL[txChain]] })) : !hasToApprove ? (jsx$2(Button, { load: loadingTx || verifyingTx, disabled: loadingTx || verifyingTx, onClick: txCallback, fullWidth: true, children: "buy" })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING || approveLoading, disabled: approvalState === ApprovalState.PENDING || approveLoading, onClick: handleApprove, fullWidth: true, children: "Approve" })) })] })] }));
|
|
79154
79206
|
};
|
|
@@ -79412,7 +79464,6 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79412
79464
|
zapEnabled &&
|
|
79413
79465
|
(sortedZapList === null || sortedZapList === void 0 ? void 0 : sortedZapList.length) > 0 &&
|
|
79414
79466
|
sortedZapList[0].usdValue !== 0) {
|
|
79415
|
-
console.log('setting input token');
|
|
79416
79467
|
setHasChecked(true);
|
|
79417
79468
|
setInputTokenString(sortedZapList[0].token === 'NATIVE' ? 'NATIVE' : sortedZapList[0].token.address[bondChain]);
|
|
79418
79469
|
}
|
|
@@ -79954,7 +80005,6 @@ function useHotBonds() {
|
|
|
79954
80005
|
}
|
|
79955
80006
|
const getHotBondsContracts = (apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79956
80007
|
try {
|
|
79957
|
-
console.log('call!');
|
|
79958
80008
|
const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
|
|
79959
80009
|
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
79960
80010
|
}
|