@ape.swap/bonds-sdk 4.0.0-test.11 → 4.0.0-test.12
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 +36 -21
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -76444,7 +76444,7 @@ const UserBondRow = ({ bill }) => {
|
|
|
76444
76444
|
event.stopPropagation();
|
|
76445
76445
|
// Add your claim logic here
|
|
76446
76446
|
switchChain({ chainId: (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.chainId });
|
|
76447
|
-
}, fullWidth: true, children: ["Switch to ", NETWORK_LABEL[(_u = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _u === void 0 ? void 0 : _u.chainId]] })) : (jsx$2(Button, { className: "button", disabled: claimable(bill) === 0 || load || isPendingCliff, load: load, onClick: (event) => {
|
|
76447
|
+
}, fullWidth: true, children: ["Switch to ", NETWORK_LABEL[(_u = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _u === void 0 ? void 0 : _u.chainId].replace(/testnet/i, '[T]')] })) : (jsx$2(Button, { className: "button", disabled: claimable(bill) === 0 || load || isPendingCliff, load: load, onClick: (event) => {
|
|
76448
76448
|
event.stopPropagation();
|
|
76449
76449
|
handleClaim(bill.id, bill.address);
|
|
76450
76450
|
}, fullWidth: true, children: isPendingCliff
|
|
@@ -82981,6 +82981,10 @@ function calculateSolanaTrueBillPrice(bondIssuanceAddress) {
|
|
|
82981
82981
|
transaction.feePayer = SOLANA_DUMMY_PUBLIC_KEY;
|
|
82982
82982
|
// Simulate the transaction
|
|
82983
82983
|
const simulated = yield connection.simulateTransaction(transaction);
|
|
82984
|
+
// if (bondIssuanceAddress.toLowerCase() === 'HmXQWRzwDCEdft3owvaL1yG41RL2FL8G26gbx2qVkL7s'.toLowerCase()) {
|
|
82985
|
+
// const asd = 'asd'
|
|
82986
|
+
// console.log(asd)
|
|
82987
|
+
// }
|
|
82984
82988
|
const returnData = simulated.value.returnData;
|
|
82985
82989
|
if (!returnData) {
|
|
82986
82990
|
throw new Error('No return data from simulation');
|
|
@@ -85848,9 +85852,9 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
85848
85852
|
background: 'rgba(56, 166, 17, 0.13)',
|
|
85849
85853
|
color: 'success',
|
|
85850
85854
|
lineHeight: '18px',
|
|
85851
|
-
}, children: [(_g = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _g === void 0 ? void 0 : _g.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: (_h =
|
|
85852
|
-
? `$${
|
|
85853
|
-
: '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:
|
|
85855
|
+
}, children: [(_g = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _g === void 0 ? void 0 : _g.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: (_h = formatNumberSI(inputValue, 4)) !== null && _h !== void 0 ? _h : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
|
|
85856
|
+
? `$${formatNumberSI((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue))}`
|
|
85857
|
+
: '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: formatNumberSI(preTGEEstimatedOutput, 4) }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["($", formatNumberSI(preTGEEstimatedOutputUSD), ")"] })] })] })] })) : (jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', mt: '20px' }, children: [jsxs(Flex, { sx: {
|
|
85854
85858
|
width: '100%',
|
|
85855
85859
|
background: 'white3',
|
|
85856
85860
|
p: '5px',
|
|
@@ -85864,9 +85868,9 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
85864
85868
|
background: 'rgba(56, 166, 17, 0.13)',
|
|
85865
85869
|
color: 'success',
|
|
85866
85870
|
lineHeight: '18px',
|
|
85867
|
-
}, children: [(_k = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _k === void 0 ? void 0 : _k.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: (_l =
|
|
85868
|
-
? `$${
|
|
85869
|
-
: '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:
|
|
85871
|
+
}, children: [(_k = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.bonusWithFee) === null || _k === void 0 ? void 0 : _k.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: (_l = formatNumberSI(inputValue, 4)) !== null && _l !== void 0 ? _l : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
|
|
85872
|
+
? `$${formatNumberSI((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue))}`
|
|
85873
|
+
: '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: formatNumberSI(estimatedOutputAmount, 4) }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["($", formatNumberSI(estimatedOutputUSD), ")"] })] })] })] })), 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" })) })] })] }));
|
|
85870
85874
|
};
|
|
85871
85875
|
|
|
85872
85876
|
const BuyBond$1 = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
|
|
@@ -86229,7 +86233,7 @@ const getTokenBalance = (currency, account) => __awaiter$9(void 0, void 0, void
|
|
|
86229
86233
|
});
|
|
86230
86234
|
|
|
86231
86235
|
const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }) => {
|
|
86232
|
-
var _a, _b, _c, _d, _e;
|
|
86236
|
+
var _a, _b, _c, _d, _e, _f;
|
|
86233
86237
|
const SDKConfig = useSDKConfig();
|
|
86234
86238
|
// Hooks
|
|
86235
86239
|
const { publicKey: accountSolana, signTransaction } = useWallet();
|
|
@@ -86415,13 +86419,16 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
86415
86419
|
justifyContent: 'center',
|
|
86416
86420
|
mt: '15px',
|
|
86417
86421
|
borderRadius: 'normal',
|
|
86418
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: "Testnet Bonds use fake tokens for testing purposes only." }) })), jsx$2(Flex, { className: "modaltable-container button-container", children: jsx$2(Flex, { className: "button-container buy", children: !accountSolana ? (jsx$2(ConnectSolanaWallet, {})) : (
|
|
86419
|
-
|
|
86420
|
-
|
|
86421
|
-
|
|
86422
|
-
|
|
86423
|
-
|
|
86424
|
-
|
|
86422
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: "Testnet Bonds use fake tokens for testing purposes only." }) })), jsx$2(Flex, { className: "modaltable-container button-container", children: jsx$2(Flex, { className: "button-container buy", children: !accountSolana ? (jsx$2(ConnectSolanaWallet, {})) : (jsxs(Flex, { sx: { width: '100%', gap: '10px', flexDirection: ['column', 'column', 'column', 'row'] }, children: [jsxs(Button, { variant: "secondary", onClick: () => {
|
|
86423
|
+
var _a, _b;
|
|
86424
|
+
return window.open(`https://jumper.exchange/?fromChain=1151111081099710&fromToken=11111111111111111111111111111111&toChain=1151111081099710&toToken=${(_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]}`, '_blank', 'noopener noreferrer');
|
|
86425
|
+
}, sx: { width: ['100%', '100%', '100%', '35%'] }, children: ["get ", (_f = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _f === void 0 ? void 0 : _f.symbol] }), jsx$2(Button, { className: "action-button", load: load, disabled: load ||
|
|
86426
|
+
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
86427
|
+
!accountSolana ||
|
|
86428
|
+
!inputValue ||
|
|
86429
|
+
parseFloat(inputValue) === 0 ||
|
|
86430
|
+
exceedsMaxBuy ||
|
|
86431
|
+
exceedsBalance, onClick: handleOpenModal, sx: { width: ['100%', '100%', '100%', '65%'] }, children: exceedsMaxBuy ? 'Exceeds Max Buy' : exceedsBalance ? 'Insufficient balance' : `buy` })] })) }) })] }) })) : (jsx$2(Fragment$1, {}));
|
|
86425
86432
|
};
|
|
86426
86433
|
|
|
86427
86434
|
const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, setBillId, }) => {
|
|
@@ -86576,7 +86583,7 @@ const PreTGEBuyComponent = ({ bondAddress, bondChain, onDismiss, handlePurchased
|
|
|
86576
86583
|
const { data: preTGEBonds } = useBondsData();
|
|
86577
86584
|
const bond = preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.find((bond) => { var _a, _b; return ((_b = (_a = bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === bondAddress.toLowerCase() && bond.chainId === bondChain; });
|
|
86578
86585
|
// Hooks
|
|
86579
|
-
const { address
|
|
86586
|
+
const { address } = useAccount();
|
|
86580
86587
|
const { data: principalTokenBalance } = useCurrencyBalance(bond.lpToken, address, bond.chainId);
|
|
86581
86588
|
// Local state
|
|
86582
86589
|
const [inputValue, setInputValue] = useState('');
|
|
@@ -86600,7 +86607,7 @@ const PreTGEBuyComponent = ({ bondAddress, bondChain, onDismiss, handlePurchased
|
|
|
86600
86607
|
const [loading, setLoading] = useState(false);
|
|
86601
86608
|
const [buyTxHash, setHash] = useState('');
|
|
86602
86609
|
// Approve logic
|
|
86603
|
-
const [approvalState, approveCallback] = useApproval(inputValue, bond.lpToken, bond === null || bond === void 0 ? void 0 : bond.contractAddress[bond.chainId], address, chainId);
|
|
86610
|
+
const [approvalState, approveCallback] = useApproval(inputValue, bond.lpToken, bond === null || bond === void 0 ? void 0 : bond.contractAddress[bond.chainId], address, bond.chainId);
|
|
86604
86611
|
const handleApprove = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
86605
86612
|
return approveCallback().then(() => {
|
|
86606
86613
|
track({
|
|
@@ -86708,7 +86715,7 @@ const ParticipationSuccessful = ({ onDismiss, bond, inputAmount, }) => {
|
|
|
86708
86715
|
}
|
|
86709
86716
|
};
|
|
86710
86717
|
const day = finishDate.getDate();
|
|
86711
|
-
const formattedFinishDate = `${month} ${getDayWithSuffix(day)} at
|
|
86718
|
+
const formattedFinishDate = `${month} ${getDayWithSuffix(day)} at 13 UTC.`; //TODO fix this
|
|
86712
86719
|
const initialReleaseAmount = userAllocation * initialRelease;
|
|
86713
86720
|
const initialReleaseUsd = initialReleaseAmount * ((_e = bond === null || bond === void 0 ? void 0 : bond.initPrice) !== null && _e !== void 0 ? _e : 0);
|
|
86714
86721
|
const vestedAmount = userAllocation * (1 - initialRelease);
|
|
@@ -86727,10 +86734,10 @@ const ParticipationSuccessful = ({ onDismiss, bond, inputAmount, }) => {
|
|
|
86727
86734
|
}, children: [getFirstNonZeroDigits(initialReleaseAmount, 2), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, jsxs(Flex, { sx: {
|
|
86728
86735
|
color: 'textDisabledButton',
|
|
86729
86736
|
ml: '5px',
|
|
86730
|
-
}, children: ["($", initialReleaseUsd.toFixed(2), ")"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Vested Tokens", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `Remaining tokens will vest linearly over ${getTimePeriods((_g = bond.vestingTerm) !== null && _g !== void 0 ? _g : 0).months} months after claiming the initial release.` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
|
|
86737
|
+
}, children: ["($", initialReleaseUsd.toFixed(2), ")"] })] })] }), initialRelease !== 1 && (jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '5px' }, children: [jsxs(Flex, { sx: { fontSize: '12px', fontWeight: 400 }, children: ["Vested Tokens", jsx$2(TooltipBubble, { placement: 'bottomLeft', transformTip: 'translate(-6%, 0%)', width: "250px", body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: `Remaining tokens will vest linearly over ${getTimePeriods((_g = bond.vestingTerm) !== null && _g !== void 0 ? _g : 0).months} months after claiming the initial release.` }), children: jsx$2(Flex, { sx: { alignItems: 'center', height: '100%', ml: '5px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { sx: {
|
|
86731
86738
|
fontSize: '12px',
|
|
86732
86739
|
fontWeight: 500,
|
|
86733
|
-
}, children: [getFirstNonZeroDigits(vestedAmount, 2), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", vestedAmountUsd.toFixed(2), ")"] })] })] }), jsx$2(Flex, { sx: { mt: '10px' }, children: `Your purchased bond can be found under the "Your Bonds" tab.` })] }), jsx$2(Button, { onClick: onDismiss, sx: { fontSize: '16px', width: '100%', mt: '15px' }, children: "Close" })] })] }));
|
|
86740
|
+
}, children: [getFirstNonZeroDigits(vestedAmount, 2), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, jsxs(Flex, { sx: { color: 'textDisabledButton', ml: '5px' }, children: ["($", vestedAmountUsd.toFixed(2), ")"] })] })] })), jsx$2(Flex, { sx: { mt: '10px' }, children: `Your purchased bond can be found under the "Your Bonds" tab.` })] }), jsx$2(Button, { onClick: onDismiss, sx: { fontSize: '16px', width: '100%', mt: '15px' }, children: "Close" })] })] }));
|
|
86734
86741
|
};
|
|
86735
86742
|
|
|
86736
86743
|
/*
|
|
@@ -87000,6 +87007,8 @@ const BANNER_INFO = {
|
|
|
87000
87007
|
const ChainBanner = ({ chainId }) => {
|
|
87001
87008
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
87002
87009
|
const { setVisible } = useWalletModal();
|
|
87010
|
+
const { publicKey } = useWallet();
|
|
87011
|
+
const isConnectedToSol = !!publicKey;
|
|
87003
87012
|
return (jsxs("div", { className: "banner-container", sx: {
|
|
87004
87013
|
backgroundImage: [
|
|
87005
87014
|
`url(${(_a = BANNER_INFO[chainId]) === null || _a === void 0 ? void 0 : _a.backgroundMobile})`,
|
|
@@ -87016,7 +87025,13 @@ const ChainBanner = ({ chainId }) => {
|
|
|
87016
87025
|
background: 'linear-gradient(93deg, #20EEA9 -19%, #9945FF 97.7%)',
|
|
87017
87026
|
},
|
|
87018
87027
|
},
|
|
87019
|
-
}, onClick: () =>
|
|
87028
|
+
}, onClick: () => {
|
|
87029
|
+
if (isConnectedToSol) {
|
|
87030
|
+
window.open('https://jumper.exchange/es?fromChain=1151111081099710&fromToken=11111111111111111111111111111111&toChain=1151111081099710&toToken=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', '_blank', 'noopener noreferrer');
|
|
87031
|
+
}
|
|
87032
|
+
else
|
|
87033
|
+
setVisible(true);
|
|
87034
|
+
}, children: "Get Started" }))] })] }, `banner-container-${chainId}`));
|
|
87020
87035
|
};
|
|
87021
87036
|
|
|
87022
87037
|
const BondRowsWithTitle = ({ chain, bonds, hideTitles, showHotBonds }) => {
|