@ape.swap/bonds-sdk 4.1.3-test.11 → 4.1.3-test.13
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 +40 -27
- package/dist/state/useSDKConfig.d.ts +2 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -63344,7 +63344,7 @@ const stagingUrls = {
|
|
|
63344
63344
|
};
|
|
63345
63345
|
const useSDKConfig = (config) => {
|
|
63346
63346
|
const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
|
|
63347
|
-
const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], hotBondChains: [types$1.ChainId.BSC, types$1.ChainId.MATIC], useHotBonds: true, connector: 'default', useTiers: false, useTGEBonds: false, showLowValueBonds: false, bondPartner: undefined, namingPreference: 'Bonus', useCardsView: false }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.2.0' });
|
|
63347
|
+
const initialData = Object.assign(Object.assign({ referenceId: '', chains: [], hotBondChains: [types$1.ChainId.BSC, types$1.ChainId.MATIC], useHotBonds: true, connector: 'default', useTiers: false, useTGEBonds: false, showLowValueBonds: false, bondPartner: undefined, namingPreference: 'Bonus', useCardsView: false, blockSales: false }, config), { urls: Object.assign(Object.assign({}, urls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.2.0' });
|
|
63348
63348
|
const { data } = useQuery({
|
|
63349
63349
|
queryKey: [QUERY_KEYS.SDK_CONFIG],
|
|
63350
63350
|
queryFn: () => {
|
|
@@ -80003,7 +80003,7 @@ const BonusComponent = ({ trueBondPrices, minTier, bonus, airdropTooltip, toolti
|
|
|
80003
80003
|
return new BigNumber$1(current.points).isGreaterThan(new BigNumber$1(max.points)) ? current : max;
|
|
80004
80004
|
}, trueBondPrices[0]);
|
|
80005
80005
|
const baseTrueBondPrice = findHighestTrueBondPrice('0', trueBondPrices);
|
|
80006
|
-
return (jsx$2(Flex, { children: trueBondPrices && (trueBondPrices === null || trueBondPrices === void 0 ? void 0 : trueBondPrices.length) > 1 && SDKConfig.useTiers ? (jsx$2(Flex, { sx: { alignItems: 'center' }, children: (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) && (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) > 0 ? (jsx$2(TooltipBubble, { width: "280px", placement: tooltipPosition, transformTip: tooltipPosition === 'bottomLeft' ? 'translate(0%, 0%)' : 'translate(0%, 0%)', body: jsx$2(BonusTable, { trueBondPrices: trueBondPrices, minTier: minTier }), children: jsxs(Flex, { sx: {
|
|
80006
|
+
return (jsx$2(Flex, { children: trueBondPrices && (trueBondPrices === null || trueBondPrices === void 0 ? void 0 : trueBondPrices.length) > 1 && SDKConfig.useTiers ? (jsx$2(Flex, { sx: { alignItems: 'center', minWidth: '20px' }, children: (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) && (highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) > 0 ? (jsx$2(TooltipBubble, { width: "280px", placement: tooltipPosition, transformTip: tooltipPosition === 'bottomLeft' ? 'translate(0%, 0%)' : 'translate(0%, 0%)', body: jsx$2(BonusTable, { trueBondPrices: trueBondPrices, minTier: minTier }), children: jsxs(Flex, { sx: {
|
|
80007
80007
|
p: '3px 6px',
|
|
80008
80008
|
border: '1px solid var(--theme-ui-colors-primaryButton)',
|
|
80009
80009
|
borderRadius: 'normal',
|
|
@@ -80026,7 +80026,7 @@ const BonusComponent = ({ trueBondPrices, minTier, bonus, airdropTooltip, toolti
|
|
|
80026
80026
|
? 'success'
|
|
80027
80027
|
: 'error',
|
|
80028
80028
|
fontSize: ['14px', '14px', '16px', '16px'],
|
|
80029
|
-
}, children: [(_a = highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%"] })] })] }) })) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : baseTrueBondPrice ? (jsx$2(Flex, { sx: { alignItems: 'center' }, className: `${getDiscountColor(+(baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee))}`, children: (baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) > 0 ? (`${(_b = baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) === null || _b === void 0 ? void 0 : _b.toFixed(2)}%`) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : (jsxs(Flex, { sx: { color: bonus && 'success', alignItems: 'center' }, children: [bonus || '-', airdropTooltip && (jsx$2(TooltipBubble, { body: jsx$2(Fragment$1, { children: airdropTooltip }), width: "230px", placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(9%, 6%)' : 'translate(-3%, 6%)', children: jsx$2(Flex, { sx: { width: '20px', height: '20px', alignItems: 'center', ml: '5px' }, children: jsx$2("img", { src: "https://res.cloudinary.com/dswmrqgwy/image/upload/v1750345773/airdrop_qvh4ow.png", alt: "airdrop-img", style: { width: '20px', height: '20px' } }) }) }))] })) }));
|
|
80029
|
+
}, children: [(_a = highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%"] })] })] }) })) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : baseTrueBondPrice ? (jsx$2(Flex, { sx: { alignItems: 'center', minWidth: '20px' }, className: `${getDiscountColor(+(baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee))}`, children: (baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) > 0 ? (`${(_b = baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) === null || _b === void 0 ? void 0 : _b.toFixed(2)}%`) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : (jsxs(Flex, { sx: { color: bonus && 'success', alignItems: 'center', minWidth: '20px' }, children: [bonus || '-', airdropTooltip && (jsx$2(TooltipBubble, { body: jsx$2(Fragment$1, { children: airdropTooltip }), width: "230px", placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(9%, 6%)' : 'translate(-3%, 6%)', children: jsx$2(Flex, { sx: { width: '20px', height: '20px', alignItems: 'center', ml: '5px' }, children: jsx$2("img", { src: "https://res.cloudinary.com/dswmrqgwy/image/upload/v1750345773/airdrop_qvh4ow.png", alt: "airdrop-img", style: { width: '20px', height: '20px' } }) }) }))] })) }));
|
|
80030
80030
|
};
|
|
80031
80031
|
|
|
80032
80032
|
const BondCards = ({ bondData }) => {
|
|
@@ -80483,8 +80483,8 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
80483
80483
|
|
|
80484
80484
|
const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView, }) => {
|
|
80485
80485
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
80486
|
-
const SDKConfig = useSDKConfig();
|
|
80487
80486
|
// Hooks
|
|
80487
|
+
const SDKConfig = useSDKConfig();
|
|
80488
80488
|
const userChainId = useChainId();
|
|
80489
80489
|
const { address: account } = useEVMAccount();
|
|
80490
80490
|
const { writeContractAsync } = useWriteContract();
|
|
@@ -80769,15 +80769,18 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
|
|
|
80769
80769
|
zapError ||
|
|
80770
80770
|
exceedsMaxBuy ||
|
|
80771
80771
|
exceedsBalance ||
|
|
80772
|
-
(isZap && !zapData)
|
|
80773
|
-
|
|
80774
|
-
|
|
80775
|
-
|
|
80776
|
-
|
|
80777
|
-
|
|
80778
|
-
|
|
80779
|
-
|
|
80780
|
-
|
|
80772
|
+
(isZap && !zapData) ||
|
|
80773
|
+
SDKConfig.blockSales, onClick: handleOpenModal, children: SDKConfig.blockSales
|
|
80774
|
+
? 'Complete KYC to Buy'
|
|
80775
|
+
: exceedsMaxBuy
|
|
80776
|
+
? 'Exceeds Max Buy'
|
|
80777
|
+
: exceedsBalance
|
|
80778
|
+
? 'Exceeds balance'
|
|
80779
|
+
: zapError
|
|
80780
|
+
? 'something went wrong'
|
|
80781
|
+
: !inputValue || parseFloat(inputValue) === 0
|
|
80782
|
+
? 'Insert amount'
|
|
80783
|
+
: `buy` })) })] })] }) })) : (jsx$2(Fragment$1, {}));
|
|
80781
80784
|
};
|
|
80782
80785
|
|
|
80783
80786
|
const ConnectSolanaWallet = ({ navBarFlag }) => {
|
|
@@ -81055,7 +81058,14 @@ const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView,
|
|
|
81055
81058
|
!inputValue ||
|
|
81056
81059
|
parseFloat(inputValue) === 0 ||
|
|
81057
81060
|
exceedsMaxBuy ||
|
|
81058
|
-
exceedsBalance
|
|
81061
|
+
exceedsBalance ||
|
|
81062
|
+
SDKConfig.blockSales, onClick: handleOpenModal, sx: { width: ['100%', '100%', '100%', '65%'] }, children: SDKConfig.blockSales
|
|
81063
|
+
? 'Complete KYC to Buy'
|
|
81064
|
+
: exceedsMaxBuy
|
|
81065
|
+
? 'Exceeds Max Buy'
|
|
81066
|
+
: exceedsBalance
|
|
81067
|
+
? 'Insufficient balance'
|
|
81068
|
+
: `buy` })] })) }) })] }) })) : (jsx$2(Fragment$1, {}));
|
|
81059
81069
|
};
|
|
81060
81070
|
|
|
81061
81071
|
const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, setBillId, }) => {
|
|
@@ -81298,6 +81308,7 @@ const BondCardsPreTGE = ({ bond }) => {
|
|
|
81298
81308
|
|
|
81299
81309
|
const BuyComponentPreTGE = ({ bondAddress, bondChain, onDismiss, handlePurchasedBond, }) => {
|
|
81300
81310
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
81311
|
+
const SDKConfig = useSDKConfig();
|
|
81301
81312
|
const { data: preTGEBonds } = useBondsData();
|
|
81302
81313
|
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; });
|
|
81303
81314
|
// Hooks
|
|
@@ -81371,19 +81382,21 @@ const BuyComponentPreTGE = ({ bondAddress, bondChain, onDismiss, handlePurchased
|
|
|
81371
81382
|
const now = new Date().getTime();
|
|
81372
81383
|
const saleHasStarted = now > saleStartTime;
|
|
81373
81384
|
const saleHasFinished = now > saleFinishTime || bond.finalized;
|
|
81374
|
-
const error =
|
|
81375
|
-
?
|
|
81376
|
-
:
|
|
81377
|
-
?
|
|
81378
|
-
:
|
|
81379
|
-
? '
|
|
81380
|
-
:
|
|
81381
|
-
? '
|
|
81382
|
-
:
|
|
81383
|
-
? '
|
|
81384
|
-
: !
|
|
81385
|
-
? '
|
|
81386
|
-
:
|
|
81385
|
+
const error = SDKConfig.blockSales
|
|
81386
|
+
? 'Complete KYC to Buy'
|
|
81387
|
+
: !saleHasStarted
|
|
81388
|
+
? `Sale hasn't started`
|
|
81389
|
+
: saleHasFinished
|
|
81390
|
+
? 'Sale Finished'
|
|
81391
|
+
: exceedsBalance
|
|
81392
|
+
? 'Exceeds balance'
|
|
81393
|
+
: percentageSold > 99.9
|
|
81394
|
+
? 'Soldout'
|
|
81395
|
+
: !inputValue || parseFloat(inputValue) === 0
|
|
81396
|
+
? 'Insert amount'
|
|
81397
|
+
: !bond
|
|
81398
|
+
? 'no bond'
|
|
81399
|
+
: null;
|
|
81387
81400
|
return (jsxs(Modal, { onDismiss: handleClose, sx: { width: '740px' }, children: [jsx$2(ModalHeader, { onDismiss: handleClose, hideDivider: true }), jsx$2(Flex, { sx: styles$a.buyContainer, children: jsxs(Flex, { sx: styles$a.cardContainer, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: jsxs(Flex, { children: [jsxs(Flex, { children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: bond.earnToken.symbol, size: 50, chain: bond.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bond.earnToken.symbol, jsx$2(ListTag, { text: (_j = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _j === void 0 ? void 0 : _j[0] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '15px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", bond.tgePrice] }), jsxs(Flex, { sx: { fontSize: '24px', fontWeight: 700 }, children: ["$", bond.initPrice] })] })] }) }), jsx$2(ProjectDescription, { description: bond.shortDescription, isProjectView: true }), jsx$2(BondCardsPreTGE, { bond: bond }), jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$a.infoRowsContainer), { mt: '10px' }), children: [jsxs(Flex, { sx: styles$a.infoRow, children: [jsx$2(Text, { sx: styles$a.infoTitle, children: "You Spend:" }), jsxs(Text, { sx: styles$a.infoData, children: [isNaN(parseFloat(inputValueToDisplay)) ? 0 : inputValueToDisplay, " ", bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol, " = $", isNaN(inputValueToDisplayUSD) ? '0' : inputValueToDisplayUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$a.infoRow, children: [jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$a.infoTitle), { alignItems: 'center' }), children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Text, { sx: Object.assign(Object.assign({}, styles$a.infoData), { color: 'success' }), children: ["$", isNaN(bonusUSD) ? '0' : bonusUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$a.infoRow, children: [jsx$2(Text, { sx: styles$a.infoTitle, children: "You Get:" }), jsxs(Text, { sx: styles$a.infoData, children: [isNaN(youGet) ? 0 : formatNumberSI(youGet, 0), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, " = $", isNaN(youGetUSD) ? '0' : youGetUSD.toFixed(2)] })] })] }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: bond === null || bond === void 0 ? void 0 : bond.lpToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(principalTokenBalance !== null && principalTokenBalance !== void 0 ? principalTokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: () => null, bondChainId: bond === null || bond === void 0 ? void 0 : bond.chainId, enableZap: false, bondPrincipalToken: bond === null || bond === void 0 ? void 0 : bond.lpToken, tokenBalance: principalTokenBalance !== null && principalTokenBalance !== void 0 ? principalTokenBalance : undefined, selectedTokenPrice: parseFloat((_k = bond === null || bond === void 0 ? void 0 : bond.principalTokenPrice) !== null && _k !== void 0 ? _k : '0'), inputDisabled: false }), jsx$2(Flex, { sx: {
|
|
81388
81401
|
width: '100%',
|
|
81389
81402
|
background: '#DE62F366',
|
|
@@ -13,6 +13,7 @@ export interface SDKPropsDTO {
|
|
|
13
13
|
urls?: Partial<Record<URLKeys, string>>;
|
|
14
14
|
theme?: any;
|
|
15
15
|
highestCompatibleVersion?: string;
|
|
16
|
+
blockSales?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface SDKProps {
|
|
18
19
|
referenceId: string;
|
|
@@ -31,6 +32,7 @@ export interface SDKProps {
|
|
|
31
32
|
evmAddress?: string;
|
|
32
33
|
solAddress?: string;
|
|
33
34
|
useCardsView?: boolean;
|
|
35
|
+
blockSales?: boolean;
|
|
34
36
|
}
|
|
35
37
|
export declare const useSDKConfig: (config?: SDKPropsDTO) => SDKProps;
|
|
36
38
|
export type URLKeys = 'apiV2' | 'realTimeApi' | 'mainUrl' | 'priceApi';
|