@ape.swap/bonds-sdk 3.0.72 → 3.0.73
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 +57 -3
- 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 = [
|
|
@@ -79026,6 +79078,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
79026
79078
|
const { data: userPoints } = useTierPoints();
|
|
79027
79079
|
const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, txChain);
|
|
79028
79080
|
const { switchChainAsync } = useSwitchChain();
|
|
79081
|
+
const SDKConfig = useSDKConfig();
|
|
79029
79082
|
// Flow
|
|
79030
79083
|
const initialChain = useMemo(() => chain === null || chain === void 0 ? void 0 : chain.id, []);
|
|
79031
79084
|
const showSwitchChainFlow = txChain !== initialChain;
|
|
@@ -79120,6 +79173,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
79120
79173
|
}, [buyTxHash, txReceipt, isSuccess]);
|
|
79121
79174
|
const currentStep = showSwitchChainFlow ? (hasToSwitchChain ? 1 : hasToApprove ? 2 : 3) : hasToApprove ? 1 : 2;
|
|
79122
79175
|
const splited = typeof inputToken !== 'string' ? (_b = inputToken === null || inputToken === void 0 ? void 0 : inputToken.symbol) === null || _b === void 0 ? void 0 : _b.split('-') : undefined;
|
|
79176
|
+
const trueBondPrice = findHighestTrueBondPrice((_c = TIERS_WEIGHT[getUserTier(userPoints)]) !== null && _c !== void 0 ? _c : '0', bondData);
|
|
79123
79177
|
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
79178
|
approveLoading ||
|
|
79125
79179
|
loadingTx ||
|
|
@@ -79141,14 +79195,14 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
79141
79195
|
borderRadius: 'normal',
|
|
79142
79196
|
color: 'textDisabledButton',
|
|
79143
79197
|
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,
|
|
79198
|
+
}, 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
79199
|
p: '5px',
|
|
79146
79200
|
borderRadius: 'normal',
|
|
79147
79201
|
border: '1px solid var(--theme-ui-colors-success)',
|
|
79148
79202
|
background: 'rgba(56, 166, 17, 0.13)',
|
|
79149
79203
|
color: 'success',
|
|
79150
79204
|
lineHeight: '18px',
|
|
79151
|
-
}, children: [(_d =
|
|
79205
|
+
}, 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
79206
|
? `$${formatUSDNumber(((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue)).toFixed(2))}`
|
|
79153
79207
|
: '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
79208
|
};
|