@ape.swap/bonds-sdk 4.0.0-test.16 → 4.0.0-test.18
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 +12 -10
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -86288,7 +86288,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
86288
86288
|
setInputTokenString(newInputToken);
|
|
86289
86289
|
}, []);
|
|
86290
86290
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
86291
|
-
var _a, _b, _c, _d, _e, _f
|
|
86291
|
+
var _a, _b, _c, _d, _e, _f;
|
|
86292
86292
|
if (!accountSolana || !bondData || !inputValue || !inputToken || !bondData)
|
|
86293
86293
|
return;
|
|
86294
86294
|
try {
|
|
@@ -86299,8 +86299,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
86299
86299
|
const amountBigInt = BigInt(depositAmount.toFixed(0));
|
|
86300
86300
|
const user = accountSolana;
|
|
86301
86301
|
const trueBondPriceWithoutFee = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.trueBondPrices) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.trueBondPrice;
|
|
86302
|
-
const
|
|
86303
|
-
const slippage = feeInPrincipal + 2;
|
|
86302
|
+
const slippage = 4;
|
|
86304
86303
|
const maxPrice = new BigNumber$1(trueBondPriceWithoutFee !== null && trueBondPriceWithoutFee !== void 0 ? trueBondPriceWithoutFee : '0')
|
|
86305
86304
|
.times((100 + slippage) / 100)
|
|
86306
86305
|
.dividedBy(new BigNumber$1(1e6))
|
|
@@ -86384,10 +86383,10 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
86384
86383
|
if (nftMint.publicKey.toString()) {
|
|
86385
86384
|
setBillId === null || setBillId === void 0 ? void 0 : setBillId(nftMint.publicKey.toString());
|
|
86386
86385
|
}
|
|
86387
|
-
const inputAmountUSD = parseFloat(inputValue) * parseFloat((
|
|
86388
|
-
axios.post(`${(
|
|
86386
|
+
const inputAmountUSD = parseFloat(inputValue) * parseFloat((_c = bondData === null || bondData === void 0 ? void 0 : bondData.principalTokenPrice) !== null && _c !== void 0 ? _c : '0');
|
|
86387
|
+
axios.post(`${(_d = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _d === void 0 ? void 0 : _d.apiV2}/bills/galxe/quest`, {
|
|
86389
86388
|
wallet: accountSolana === null || accountSolana === void 0 ? void 0 : accountSolana.toString(),
|
|
86390
|
-
bond: (
|
|
86389
|
+
bond: (_e = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _e === void 0 ? void 0 : _e[bondData === null || bondData === void 0 ? void 0 : bondData.chainId],
|
|
86391
86390
|
amount: inputAmountUSD,
|
|
86392
86391
|
});
|
|
86393
86392
|
}
|
|
@@ -86395,7 +86394,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
86395
86394
|
console.error('Error during bond purchase:', error);
|
|
86396
86395
|
addToastError((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error');
|
|
86397
86396
|
reportError$1({
|
|
86398
|
-
apiUrl: (
|
|
86397
|
+
apiUrl: (_f = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _f === void 0 ? void 0 : _f.apiV2,
|
|
86399
86398
|
error: error.message,
|
|
86400
86399
|
extraInfo: { type: 'solanaBuyBond', error: error.message },
|
|
86401
86400
|
chainId: bondChain,
|
|
@@ -88218,7 +88217,7 @@ const styles$5 = {
|
|
|
88218
88217
|
};
|
|
88219
88218
|
|
|
88220
88219
|
const Toast = ({ popIndex, popup }) => {
|
|
88221
|
-
var _a, _b, _c, _d, _e;
|
|
88220
|
+
var _a, _b, _c, _d, _e, _f;
|
|
88222
88221
|
const { variant, title, description, url } = popup;
|
|
88223
88222
|
const { removePopup } = usePopups();
|
|
88224
88223
|
const [show, setShow] = useState(true);
|
|
@@ -88236,11 +88235,14 @@ const Toast = ({ popIndex, popup }) => {
|
|
|
88236
88235
|
((_c = popup === null || popup === void 0 ? void 0 : popup.description) === null || _c === void 0 ? void 0 : _c.includes('Slippage')) ||
|
|
88237
88236
|
((_d = popup === null || popup === void 0 ? void 0 : popup.description) === null || _d === void 0 ? void 0 : _d.includes('Return amount is not enough'));
|
|
88238
88237
|
const isTimeoutError = (_e = popup === null || popup === void 0 ? void 0 : popup.description) === null || _e === void 0 ? void 0 : _e.includes('Blockhash not found');
|
|
88238
|
+
const isInsufficientFundsError = (_f = popup === null || popup === void 0 ? void 0 : popup.description) === null || _f === void 0 ? void 0 : _f.includes('insufficient funds');
|
|
88239
88239
|
const parsedErrorString = isSlippageError
|
|
88240
88240
|
? 'Slippage error. Try increasing Slippage in the cog icon ⚙️.'
|
|
88241
88241
|
: isTimeoutError
|
|
88242
|
-
? 'Tx timeout. Please try again'
|
|
88243
|
-
:
|
|
88242
|
+
? 'Tx timeout. Please try again.'
|
|
88243
|
+
: isInsufficientFundsError
|
|
88244
|
+
? 'Insufficient funds.'
|
|
88245
|
+
: popup === null || popup === void 0 ? void 0 : popup.description;
|
|
88244
88246
|
return (jsx$2(AnimatePresence, { children: show && (jsxs(motion.div, { initial: { right: '-300px' }, animate: { right: '10px' }, transition: { duration: 0.5 }, exit: { right: '-300px' }, sx: Object.assign(Object.assign({}, styles$5.alert), { top: 108 * popIndex, zIndex: 103 }), children: [jsx$2(Flex, { children: jsx$2(Svg, { icon: variant, color: variant, width: "30px" }) }), jsxs(Flex, { sx: styles$5.content, children: [jsx$2(Text, { sx: { color: variant, fontSize: '14px', fontWeight: 500 }, children: title }), description && (jsx$2(Text, { sx: {
|
|
88245
88247
|
fontSize: '12px',
|
|
88246
88248
|
fontWeight: 400,
|