@ape.swap/bonds-sdk 2.0.2 → 2.0.4
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/config/constants/variables.d.ts +2 -2
- package/dist/main.js +32 -15
- package/package.json +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChainId } from '@ape.swap/apeswap-lists';
|
|
2
2
|
export declare const supportedByLIFI: ChainId[];
|
|
3
3
|
export declare const APESWAP_LIST_REPO = "https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging";
|
|
4
|
-
export declare const STRAPI_URL = "https://
|
|
5
|
-
export declare const SOUL_ZAP_API = "https://
|
|
4
|
+
export declare const STRAPI_URL = "https://strapi-api.ape.bond";
|
|
5
|
+
export declare const SOUL_ZAP_API = "https://zap-api.ape.bond/zap?batch=1";
|
package/dist/main.js
CHANGED
|
@@ -18517,8 +18517,8 @@ const supportedByLIFI = [
|
|
|
18517
18517
|
];
|
|
18518
18518
|
// we should be good just by using staging on this, as it is only used for token images
|
|
18519
18519
|
const APESWAP_LIST_REPO = `https://raw.githubusercontent.com/ApeSwapFinance/apeswap-token-lists/staging`;
|
|
18520
|
-
const STRAPI_URL = `https://
|
|
18521
|
-
const SOUL_ZAP_API = `https://
|
|
18520
|
+
const STRAPI_URL = `https://strapi-api.ape.bond`;
|
|
18521
|
+
const SOUL_ZAP_API = `https://zap-api.ape.bond/zap?batch=1`;
|
|
18522
18522
|
|
|
18523
18523
|
const TokenImage = ({ symbol, symbol2, size, chain, }) => {
|
|
18524
18524
|
var _a, _b;
|
|
@@ -73650,8 +73650,7 @@ const BondRowsByChain = ({ bonds, hideTitles }) => {
|
|
|
73650
73650
|
const getUserApiStats = (account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73651
73651
|
if (!account)
|
|
73652
73652
|
return null;
|
|
73653
|
-
const { data } = yield axios.get(`
|
|
73654
|
-
https://bonds-dashboard-api-deaf0d7d55b7.herokuapp.com/collector/userSalesInfo/purchased/${account}`);
|
|
73653
|
+
const { data } = yield axios.get(`https://dashboard-api.ape.bond/collector/userSalesInfo/purchased/${account}`);
|
|
73655
73654
|
return data;
|
|
73656
73655
|
});
|
|
73657
73656
|
function useUserApiStats() {
|
|
@@ -74867,7 +74866,7 @@ const NavPanel = ({ contractAddress }) => {
|
|
|
74867
74866
|
justifyContent: 'space-between',
|
|
74868
74867
|
alignItems: 'center',
|
|
74869
74868
|
mb: ['15px', '15px', '15px', '0px'],
|
|
74870
|
-
}, children: [jsxs(Flex, { onClick: () => window.open(`${window.location.origin}/bonds`, '_self'), sx: { cursor: 'pointer' }, children: ['< ', jsx$2(Flex, { sx: { ml: '4px' }, children: "All Bonds" })] }), jsx$2(Flex, { children: jsxs(Flex, { sx: { p: '5px 10px', background: 'white3', borderRadius: 'small', cursor: 'pointer' }, onClick: () => window.open(`https://
|
|
74869
|
+
}, children: [jsxs(Flex, { onClick: () => window.open(`${window.location.origin}/bonds`, '_self'), sx: { cursor: 'pointer' }, children: ['< ', jsx$2(Flex, { sx: { ml: '4px' }, children: "All Bonds" })] }), jsx$2(Flex, { children: jsxs(Flex, { sx: { p: '5px 10px', background: 'white3', borderRadius: 'small', cursor: 'pointer' }, onClick: () => window.open(`https://dashboard.ape.bond/bond/${contractAddress}`, '_blank', 'noreferrer'), children: ["View insights", jsx$2(Flex, { sx: { ml: '3px' }, children: jsx$2(Svg, { icon: "insight" }) })] }) })] }));
|
|
74871
74870
|
};
|
|
74872
74871
|
|
|
74873
74872
|
const styles$3 = {
|
|
@@ -89387,8 +89386,7 @@ const styles$2 = {
|
|
|
89387
89386
|
};
|
|
89388
89387
|
|
|
89389
89388
|
const getBondApiStats = (contractAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
89390
|
-
const { data } = yield axios.get(`
|
|
89391
|
-
https://bonds-dashboard-api-deaf0d7d55b7.herokuapp.com/collector/salesInfo/bond/${contractAddress}/0`);
|
|
89389
|
+
const { data } = yield axios.get(`https://dashboard-api.ape.bond/collector/salesInfo/bond/${contractAddress}/0`);
|
|
89392
89390
|
return data;
|
|
89393
89391
|
});
|
|
89394
89392
|
function useGetBondApiStats(contractAddress) {
|
|
@@ -89466,7 +89464,7 @@ const BondStats = ({ selectedBond }) => {
|
|
|
89466
89464
|
});
|
|
89467
89465
|
}
|
|
89468
89466
|
}, [bondStats]);
|
|
89469
|
-
return (jsxs(Flex, { sx: styles$2.bondStatsContainer, children: [jsxs(Flex, { sx: styles$2.titleContainer, children: [jsx$2(Flex, { sx: { fontSize: '22px' }, children: "Bond Stats" }), jsxs(Link, { href: `https://
|
|
89467
|
+
return (jsxs(Flex, { sx: styles$2.bondStatsContainer, children: [jsxs(Flex, { sx: styles$2.titleContainer, children: [jsx$2(Flex, { sx: { fontSize: '22px' }, children: "Bond Stats" }), jsxs(Link, { href: `https://dashboard.ape.bond/bond/${selectedBond.billAddress}`, sx: styles$2.link, target: "_blank", rel: "noopener noreferrer", children: ["View More ", '>'] })] }), jsxs(Flex, { sx: styles$2.chartsContainer, children: [jsxs(Flex, { sx: styles$2.salesChart, children: [jsx$2(Flex, { sx: { width: '150px' }, children: jsx$2(MenuSelect, { selectedOption: chartOption, setOption: setChartOption, options: chartOptions }) }), jsx$2(Flex, { sx: { width: '100%', height: '100%', minHeight: '225px' }, children: chartOption === 'amount' ? (jsx$2(Line, { options: options, data: salesAmountChartData })) : (jsx$2(Line, { options: options, data: salesCountChartData })) })] }), (bondStats === null || bondStats === void 0 ? void 0 : bondStats.percentageSold) && (jsxs(Flex, { sx: styles$2.percentageSoldChart, children: [jsxs(Flex, { sx: { mb: '10px' }, children: [selectedBond.earnToken.symbol, " Sold"] }), jsx$2(Knob, { value: bondStats === null || bondStats === void 0 ? void 0 : bondStats.percentageSold, size: 176, valueTemplate: `${(_f = bondStats === null || bondStats === void 0 ? void 0 : bondStats.percentageSold) === null || _f === void 0 ? void 0 : _f.toFixed()}%`, valueColor: "#6560C5", rangeColor: "rgba(250, 250, 250, 0.05)", textColor: "#f6f6f6" }), jsxs(Flex, { sx: { fontSize: '14px', fontWeight: 500, color: 'textDisabledButton' }, children: [soldTokens, " / ", maxTotalPayout === null || maxTotalPayout === void 0 ? void 0 : maxTotalPayout.toLocaleString(), " ", selectedBond.earnToken.symbol] })] }))] })] }));
|
|
89470
89468
|
};
|
|
89471
89469
|
|
|
89472
89470
|
const styles$1 = {
|
|
@@ -90297,7 +90295,7 @@ const PriceChart = ({ selectedBond, historicalPrices, }) => {
|
|
|
90297
90295
|
};
|
|
90298
90296
|
|
|
90299
90297
|
const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
90300
|
-
var _a, _b, _c, _d, _e, _f
|
|
90298
|
+
var _a, _b, _c, _d, _e, _f;
|
|
90301
90299
|
const { data: bonds } = useBondsData();
|
|
90302
90300
|
const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => {
|
|
90303
90301
|
var _a;
|
|
@@ -90313,13 +90311,20 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90313
90311
|
const sendReferenceId = useSendReferenceId();
|
|
90314
90312
|
const [buyTxHash, setBuyTxHash] = useState();
|
|
90315
90313
|
const [inputValue, setInputValue] = useState('');
|
|
90316
|
-
const [inputTokenString, setInputTokenString] = useState(
|
|
90314
|
+
const [inputTokenString, setInputTokenString] = useState('');
|
|
90315
|
+
useEffect(() => {
|
|
90316
|
+
var _a, _b;
|
|
90317
|
+
const inputTokenStr = (_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.chainId];
|
|
90318
|
+
if (!inputTokenString && bondData && inputTokenStr) {
|
|
90319
|
+
setInputTokenString(inputTokenStr);
|
|
90320
|
+
}
|
|
90321
|
+
}, [bondData]);
|
|
90317
90322
|
// Data
|
|
90318
90323
|
const inputToken = useTokenFromZapList(inputTokenString, bondData === null || bondData === void 0 ? void 0 : bondData.chainId, bondData === null || bondData === void 0 ? void 0 : bondData.lpToken);
|
|
90319
|
-
const isZap = (inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) !== ((
|
|
90324
|
+
const isZap = (inputTokenString === null || inputTokenString === void 0 ? void 0 : inputTokenString.toLowerCase()) !== ((_c = (_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]) === null || _c === void 0 ? void 0 : _c.toLowerCase());
|
|
90320
90325
|
const [fetchingZapQuote, zapData, zapEstimatedOutput, zapError] = useSoulZapBondQuote(inputValue, inputToken, bondData, account);
|
|
90321
90326
|
const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, parseInt(bondChain));
|
|
90322
|
-
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (
|
|
90327
|
+
const { data: inputCurrencyBalance } = useCurrencyBalance(inputToken !== null && inputToken !== void 0 ? inputToken : null, account !== null && account !== void 0 ? account : null, (_d = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _d !== void 0 ? _d : null);
|
|
90323
90328
|
// Estimations
|
|
90324
90329
|
const normalEstimatedOutput = youGet(bondData, inputValue);
|
|
90325
90330
|
const estimatedOutput = isZap ? zapEstimatedOutput : normalEstimatedOutput;
|
|
@@ -90336,7 +90341,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90336
90341
|
// Modals
|
|
90337
90342
|
const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, account: account, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), true, true, 'zapModal');
|
|
90338
90343
|
// Approve & Purchase Functions
|
|
90339
|
-
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (
|
|
90344
|
+
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_e = (isZap ? SoulZapTokenManager === null || SoulZapTokenManager === void 0 ? void 0 : SoulZapTokenManager[bondData === null || bondData === void 0 ? void 0 : bondData.chainId] : bondData === null || bondData === void 0 ? void 0 : bondData.billAddress)) !== null && _e !== void 0 ? _e : null, account !== null && account !== void 0 ? account : null, (_f = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _f !== void 0 ? _f : null);
|
|
90340
90345
|
const handleApprove = () => {
|
|
90341
90346
|
approveCallback().then(() => {
|
|
90342
90347
|
track({
|
|
@@ -90419,6 +90424,18 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90419
90424
|
window.open(`https://ape.bond/swap?outputcurrency=${bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.address[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]}&outputChain=${bondData === null || bondData === void 0 ? void 0 : bondData.chainId}`, '_blank');
|
|
90420
90425
|
}
|
|
90421
90426
|
};
|
|
90427
|
+
const handleOpenZapModal = () => {
|
|
90428
|
+
var _a;
|
|
90429
|
+
onOpenZapModal();
|
|
90430
|
+
track({
|
|
90431
|
+
event: 'getTokenClick',
|
|
90432
|
+
chain: bondData === null || bondData === void 0 ? void 0 : bondData.chainId,
|
|
90433
|
+
data: {
|
|
90434
|
+
bond: bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol,
|
|
90435
|
+
token: (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken) === null || _a === void 0 ? void 0 : _a.symbol,
|
|
90436
|
+
},
|
|
90437
|
+
});
|
|
90438
|
+
};
|
|
90422
90439
|
return (jsxs(Flex, { sx: styles$4.mainViewContainer, children: [jsx$2(RecommendationCards, {}), jsx$2(NavPanel, { contractAddress: bondData === null || bondData === void 0 ? void 0 : bondData.billAddress }), bondData ? (jsx$2(Fragment$1, { children: jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', mt: '10px' }, children: [jsx$2(Flex, { sx: {
|
|
90423
90440
|
width: '100%',
|
|
90424
90441
|
display: ['none', 'none', 'none', 'block'],
|
|
@@ -90432,7 +90449,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90432
90449
|
p: '20px',
|
|
90433
90450
|
borderRadius: '10px',
|
|
90434
90451
|
mt: '5px',
|
|
90435
|
-
}, children: [jsx$2(BondModalHeader, { bondData: bondData }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, estimatedOutput: estimatedOutput, inputTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { className: "modaltable-container button-container", children: [jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () =>
|
|
90452
|
+
}, children: [jsx$2(BondModalHeader, { bondData: bondData }), jsx$2(ProjectDescription, { description: bondData.shortDescription }), jsx$2(Estimations, { bondData: bondData, inputValue: inputValue, inputToken: inputToken, estimatedOutput: estimatedOutput, inputTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { className: "modaltable-container button-container", children: [jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? handleOpenZapModal() : openExternal(), variant: "secondary", children: ["Get ", getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)] }) }), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
|
|
90436
90453
|
event.stopPropagation();
|
|
90437
90454
|
switchChain({ chainId: bondData.chainId });
|
|
90438
90455
|
}, style: { fontSize: '14px', padding: '6px', marginLeft: '0px' }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
|
|
@@ -90441,7 +90458,7 @@ const ProjectView = ({ bondAddress, bondChain, historicalPrices }) => {
|
|
|
90441
90458
|
!inputValue ||
|
|
90442
90459
|
parseFloat(inputValue) === 0 ||
|
|
90443
90460
|
fetchingZapQuote ||
|
|
90444
|
-
zapError, onClick: handleBothPurchases, children: zapError ? 'something went wrong' : `buy
|
|
90461
|
+
zapError, onClick: handleBothPurchases, children: zapError ? 'something went wrong' : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
|
|
90445
90462
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
90446
90463
|
!account ||
|
|
90447
90464
|
!inputValue ||
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Ape Bond SDK",
|
|
4
4
|
"author": "Ape Bond",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "2.0.
|
|
6
|
+
"version": "2.0.4",
|
|
7
7
|
"module": "dist/main.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "dist/main.d.ts",
|
|
@@ -79,5 +79,6 @@
|
|
|
79
79
|
"last 1 firefox version",
|
|
80
80
|
"last 1 safari version"
|
|
81
81
|
]
|
|
82
|
-
}
|
|
82
|
+
},
|
|
83
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
83
84
|
}
|