@ape.swap/bonds-sdk 4.0.0-test.3 → 4.0.0-test.5

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.
Files changed (2) hide show
  1. package/dist/main.js +161 -148
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -10,7 +10,7 @@ import { createSolanaRpc } from '@solana/rpc';
10
10
  import { address as address$1, getU64Codec } from '@solana/kit';
11
11
  import { getAddressDecoder } from '@solana/addresses';
12
12
  import { getStructDecoder, fixDecoderSize, getU32Decoder, getU8Decoder, getU64Decoder, getBytesDecoder } from '@solana/codecs';
13
- import { ConnectButton as ConnectButton$1, useConnectModal } from '@rainbow-me/rainbowkit';
13
+ import { useConnectModal, ConnectButton as ConnectButton$1 } from '@rainbow-me/rainbowkit';
14
14
  import { TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddress, getAccount, createAssociatedTokenAccountInstruction } from '@solana/spl-token';
15
15
 
16
16
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -19043,6 +19043,7 @@ const NETWORK_COLORS = {
19043
19043
  [types$1.ChainId.BLAST]: '#fcfc034d',
19044
19044
  [types$1.ChainId.CROSSFI]: '#7c80844d',
19045
19045
  [types$1.ChainId.MONAD_TESTNET]: '#836EF94d',
19046
+ [types$1.ChainId.SOL]: '#836EF94d',
19046
19047
  [types$1.ChainId.SONIC]: '#fb9a4c4d',
19047
19048
  [types$1.ChainId.BERACHAIN]: '#783e244d',
19048
19049
  };
@@ -63930,17 +63931,19 @@ const youSpendUSD = (bond, inputValue) => {
63930
63931
  };
63931
63932
  // receives depositAmount and returns the payoutTokens the user will receive. IT DOES SUBTRACT FEE
63932
63933
  const getPayoutAmount = (bond, inputValue, userPoints) => {
63933
- var _a, _b, _c, _d, _e, _f;
63934
+ var _a, _b, _c, _d, _e;
63934
63935
  if (!inputValue || !bond || !userPoints || !bond.trueBondPrices)
63935
63936
  return 0;
63936
63937
  const bigValue = new BigNumber$1(inputValue).times(
63937
63938
  //TODO: think a permanent solution for this
63938
63939
  new BigNumber$1(10).pow(bond.chainId === types$1.ChainId.SOL ? 18 : ((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId]) !== null && _c !== void 0 ? _c : 18)));
63939
63940
  const fee = (_d = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _d !== void 0 ? _d : 0;
63940
- const trueBondPrice = findHighestTrueBondPrice(userPoints, bond);
63941
- const billValue = bigValue.div(new BigNumber$1((_e = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.trueBondPrice) !== null && _e !== void 0 ? _e : '0').times((100 + fee) / 100));
63942
- console.log('raw estimation', bigValue.div(new BigNumber$1((_f = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.trueBondPrice) !== null && _f !== void 0 ? _f : '0')).toString());
63943
- console.log('estimation substracting feeInPayout', billValue.toString());
63941
+ const trueBondPriceObject = findHighestTrueBondPrice(userPoints, bond);
63942
+ const trueBondPrice = new BigNumber$1((_e = trueBondPriceObject === null || trueBondPriceObject === void 0 ? void 0 : trueBondPriceObject.trueBondPrice) !== null && _e !== void 0 ? _e : '0');
63943
+ const reverseFee = new BigNumber$1(fee / 100 / (1 - fee / 100));
63944
+ const billValue = bigValue.div(trueBondPrice.plus(trueBondPrice.times(reverseFee)));
63945
+ console.log('raw estimation', bigValue.div(trueBondPrice).toFixed(9));
63946
+ console.log('estimation substracting feeInPayout', billValue.toFixed(9));
63944
63947
  return billValue.toNumber();
63945
63948
  };
63946
63949
  const youGetUSD = (bond, inputValue, userPoints) => {
@@ -69710,7 +69713,7 @@ function getSolanaRpc() {
69710
69713
  return rpc;
69711
69714
  }
69712
69715
 
69713
- var address = "3U8S9Cwj8Z8EYqvvWPiaZHghsVrafRqFYVoT5wbJ2qXX";
69716
+ var address = "G9vabZ5mR2tF8bKuvSo9YWNUkbRkQyBZR6aM5mdDtZzh";
69714
69717
  var solanaProgramIdl = {
69715
69718
  address: address};
69716
69719
 
@@ -76387,25 +76390,105 @@ const UserBondRow = ({ bill }) => {
76387
76390
  : 'Claim' })) })] })] }));
76388
76391
  };
76389
76392
 
76390
- const RainbowKitButton = () => {
76391
- return (jsx$2(ConnectButton$1.Custom, { children: ({ openConnectModal }) => {
76392
- return (jsx$2(Button, { fullWidth: true, onClick: () => {
76393
- openConnectModal();
76394
- track({
76395
- event: 'wallet_connect',
76396
- chain: 0,
76397
- data: {
76398
- wallet: 'rainbow',
76399
- },
76400
- });
76401
- }, sx: { height: '45px', padding: '10px 10px', alignItems: 'center', width: '100%' }, children: "Connect" }));
76402
- } }));
76393
+ const colors$1 = {
76394
+ // main background gradients
76395
+ white1: '#0E0D16', // base site background
76396
+ white2: '#161420',
76397
+ white3: '#1F1D29',
76398
+ white4: '#282632',
76399
+ white5: '#312F3A',
76400
+ primaryButton: '#6560C5', //this should've been called just "primary"
76401
+ success: '#38A611',
76402
+ error: '#DF4141',
76403
+ yellow: '#FFB300',
76404
+ // Button colors
76405
+ primaryButtonDisable: '#48475B',
76406
+ primaryButtonHovered: '#8480D1',
76407
+ textDisabledButton: '#73728E',
76408
+ // Text-related colors
76409
+ text: '#FAFAFA',
76410
+ textDisabled: '#424242',
76411
+ primaryBright: '#FAFAFA',
76412
+ abondGradient: 'linear-gradient(98.79deg, #6560C5 -2.37%, #E07753 100%)',
76413
+ modalOverlay: 'rgba(66, 66, 66, 0.5)',
76403
76414
  };
76404
76415
 
76405
- const ConnectButton = () => {
76406
- const config = useSDKConfig();
76407
- return (config === null || config === void 0 ? void 0 : config.useRainbowKit) ? (jsx$2(RainbowKitButton, {})) : (jsx$2(Button, { disabled: true, fullWidth: true, children: "Connect wallet" }));
76408
- };
76416
+ function ConnectToSolanaCard() {
76417
+ const { setVisible } = useWalletModal();
76418
+ return (jsxs(Flex, { sx: {
76419
+ width: '100%',
76420
+ height: '75px',
76421
+ background: `url('/images/connect-to-vm/solana-card-background.svg') no-repeat center center`,
76422
+ backgroundSize: 'cover',
76423
+ padding: '20px',
76424
+ borderRadius: '10px',
76425
+ justifyContent: 'space-between',
76426
+ alignItems: 'center',
76427
+ border: 'none',
76428
+ cursor: 'pointer',
76429
+ }, children: [jsxs(Flex, { sx: {
76430
+ gap: '10px',
76431
+ alignItems: 'center',
76432
+ }, children: [jsx$2("img", { src: "/images/connect-to-vm/solana-icon.svg", alt: "solana icon", width: 30, height: 30, style: { borderRadius: '10px' } }), jsxs(Flex, { sx: {
76433
+ flexDirection: 'column',
76434
+ }, children: [jsxs(Text, { sx: { fontSize: '18px', fontWeight: '700', lineHeight: '18.5px', display: 'flex', alignItems: 'center' }, children: ["Solana", jsx$2(Text, { sx: {
76435
+ fontSize: '10px',
76436
+ fontWeight: '600',
76437
+ lineHeight: '8px',
76438
+ color: '#FAFAFA',
76439
+ padding: '4px 6px',
76440
+ background: 'rgba(250, 250, 250, 0.3)',
76441
+ borderRadius: '4px',
76442
+ marginLeft: '6px',
76443
+ marginRight: '6px',
76444
+ }, children: "NEW" }), jsx$2("img", { src: "/images/connect-to-vm/svm-compatible-wallets.svg", alt: "solana compatible wallets", width: 43, height: 17 })] }), jsx$2(Text, { sx: { fontSize: '11px', fontWeight: '400', lineHeight: '16px', color: 'white' }, children: "Connect your Solana wallet to view your Solana Bonds!" })] })] }), jsx$2(Flex, { sx: { width: 'fit-content' }, children: jsx$2(Button, { onClick: () => setVisible(true), sx: {
76445
+ background: colors$1.text,
76446
+ color: colors$1.primaryButton,
76447
+ border: 'none',
76448
+ height: '31px',
76449
+ width: '125px',
76450
+ fontSize: '14px',
76451
+ fontWeight: '700',
76452
+ '&:hover': { color: colors$1.text },
76453
+ }, children: "Connect" }) })] }));
76454
+ }
76455
+
76456
+ function ConnectToEVMBanner() {
76457
+ const { openConnectModal } = useConnectModal();
76458
+ return (jsxs(Flex, { sx: {
76459
+ width: '100%',
76460
+ height: '75px',
76461
+ backgroundColor: colors$1.white4,
76462
+ padding: '20px',
76463
+ borderRadius: '10px',
76464
+ justifyContent: 'space-between',
76465
+ alignItems: 'center',
76466
+ cursor: 'pointer',
76467
+ }, children: [jsxs(Flex, { sx: {
76468
+ gap: '10px',
76469
+ alignItems: 'center',
76470
+ }, children: [jsx$2("img", { src: "/images/connect-to-vm/ethereum-icon.svg", alt: "ethereum icon", width: 30, height: 30 }), jsxs(Flex, { sx: {
76471
+ flexDirection: 'column',
76472
+ }, children: [jsxs(Text, { sx: { fontSize: '15px', fontWeight: '600', lineHeight: '18.5px', display: 'flex', alignItems: 'center' }, children: ["Ethereum", jsx$2(Text, { sx: {
76473
+ fontSize: '10px',
76474
+ fontWeight: '600',
76475
+ lineHeight: '8px',
76476
+ color: '#FAFAFA',
76477
+ padding: '4px 6px',
76478
+ background: 'rgba(250, 250, 250, 0.3)',
76479
+ borderRadius: '4px',
76480
+ marginLeft: '6px',
76481
+ marginRight: '6px',
76482
+ }, children: "Popular" }), jsx$2("img", { src: "/images/connect-to-vm/evm-compatible-wallets.svg", alt: "solana compatible wallets", width: 55, height: 17 })] }), jsx$2(Text, { sx: {
76483
+ fontSize: '10px',
76484
+ fontWeight: '400',
76485
+ lineHeight: '16px',
76486
+ color: 'rgba(255, 255, 255, 0.65)',
76487
+ display: 'flex',
76488
+ alignItems: 'center',
76489
+ gap: '4px',
76490
+ }, children: "Connect your EVM wallet to view your EVM Bonds!" })] })] }), jsx$2(Flex, { sx: { width: 'fit-content' }, children: jsx$2(Button, { onClick: () => openConnectModal === null || openConnectModal === void 0 ? void 0 : openConnectModal(), children: "Connect" }) })] }));
76491
+ }
76409
76492
 
76410
76493
  const PlaceholderMonkey = ({ text }) => {
76411
76494
  return (jsxs(Flex, { sx: {
@@ -76416,7 +76499,13 @@ const PlaceholderMonkey = ({ text }) => {
76416
76499
  alignItems: 'center',
76417
76500
  borderRadius: 'normal',
76418
76501
  mt: '15px',
76419
- }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Text, { sx: { fontWeight: 600, fontSize: '16px', mt: '15px', opacity: 0.6 }, children: text }), text === 'You are not connected.' && (jsx$2(Flex, { sx: { width: '150px', mt: '10px' }, children: jsx$2(ConnectButton, {}) }))] }));
76502
+ }, children: [jsx$2(Svg, { icon: "placeholderMonkey" }), jsx$2(Text, { sx: { fontWeight: 600, fontSize: '16px', mt: '15px', opacity: 0.6 }, children: text }), text === 'You are not connected.' && (jsxs(Flex, { sx: {
76503
+ width: '100%',
76504
+ flexDirection: ['column', 'column', 'column', 'row'],
76505
+ mt: '30px',
76506
+ px: ['10px', '10px', '10px', '20px'],
76507
+ gap: '15px',
76508
+ }, children: [jsx$2(ConnectToSolanaCard, {}), jsx$2(ConnectToEVMBanner, {})] }))] }));
76420
76509
  };
76421
76510
 
76422
76511
  function useChainFilterOption() {
@@ -79698,106 +79787,6 @@ const UserBondRowSolana = ({ bill }) => {
79698
79787
  : 'Claim' })) })] })] }));
79699
79788
  };
79700
79789
 
79701
- const colors$1 = {
79702
- // main background gradients
79703
- white1: '#0E0D16', // base site background
79704
- white2: '#161420',
79705
- white3: '#1F1D29',
79706
- white4: '#282632',
79707
- white5: '#312F3A',
79708
- primaryButton: '#6560C5', //this should've been called just "primary"
79709
- success: '#38A611',
79710
- error: '#DF4141',
79711
- yellow: '#FFB300',
79712
- // Button colors
79713
- primaryButtonDisable: '#48475B',
79714
- primaryButtonHovered: '#8480D1',
79715
- textDisabledButton: '#73728E',
79716
- // Text-related colors
79717
- text: '#FAFAFA',
79718
- textDisabled: '#424242',
79719
- primaryBright: '#FAFAFA',
79720
- abondGradient: 'linear-gradient(98.79deg, #6560C5 -2.37%, #E07753 100%)',
79721
- modalOverlay: 'rgba(66, 66, 66, 0.5)',
79722
- };
79723
-
79724
- function ConnectToSolanaCard() {
79725
- const { setVisible } = useWalletModal();
79726
- return (jsxs(Flex, { sx: {
79727
- width: '100%',
79728
- height: '75px',
79729
- background: `url('/images/connect-to-vm/solana-card-background.svg') no-repeat center center`,
79730
- backgroundSize: 'cover',
79731
- padding: '20px',
79732
- borderRadius: '10px',
79733
- justifyContent: 'space-between',
79734
- alignItems: 'center',
79735
- border: 'none',
79736
- cursor: 'pointer',
79737
- }, children: [jsxs(Flex, { sx: {
79738
- gap: '10px',
79739
- alignItems: 'center',
79740
- }, children: [jsx$2("img", { src: "/images/connect-to-vm/solana-icon.svg", alt: "solana icon", width: 30, height: 30, style: { borderRadius: '10px' } }), jsxs(Flex, { sx: {
79741
- flexDirection: 'column',
79742
- }, children: [jsxs(Text, { sx: { fontSize: '18px', fontWeight: '700', lineHeight: '18.5px', display: 'flex', alignItems: 'center' }, children: ["Solana", jsx$2(Text, { sx: {
79743
- fontSize: '10px',
79744
- fontWeight: '600',
79745
- lineHeight: '8px',
79746
- color: '#FAFAFA',
79747
- padding: '4px 6px',
79748
- background: 'rgba(250, 250, 250, 0.3)',
79749
- borderRadius: '4px',
79750
- marginLeft: '6px',
79751
- marginRight: '6px',
79752
- }, children: "NEW" }), jsx$2("img", { src: "/images/connect-to-vm/svm-compatible-wallets.svg", alt: "solana compatible wallets", width: 43, height: 17 })] }), jsx$2(Text, { sx: { fontSize: '11px', fontWeight: '400', lineHeight: '16px', color: 'white' }, children: "Connect your Solana wallet to view your Solana Bonds!" })] })] }), jsx$2(Flex, { sx: { width: 'fit-content' }, children: jsx$2(Button, { onClick: () => setVisible(true), sx: {
79753
- background: colors$1.text,
79754
- color: colors$1.primaryButton,
79755
- border: 'none',
79756
- height: '31px',
79757
- width: '125px',
79758
- fontSize: '14px',
79759
- fontWeight: '700',
79760
- '&:hover': { color: colors$1.text },
79761
- }, children: "Connect" }) })] }));
79762
- }
79763
-
79764
- function ConnectToEVMBanner() {
79765
- const { openConnectModal } = useConnectModal();
79766
- return (jsxs(Flex, { sx: {
79767
- width: '100%',
79768
- height: '75px',
79769
- backgroundColor: colors$1.white4,
79770
- padding: '20px',
79771
- borderRadius: '10px',
79772
- justifyContent: 'space-between',
79773
- alignItems: 'center',
79774
- cursor: 'pointer',
79775
- }, children: [jsxs(Flex, { sx: {
79776
- gap: '10px',
79777
- alignItems: 'center',
79778
- }, children: [jsx$2("img", { src: "/images/connect-to-vm/ethereum-icon.svg", alt: "ethereum icon", width: 30, height: 30 }), jsxs(Flex, { sx: {
79779
- flexDirection: 'column',
79780
- }, children: [jsxs(Text, { sx: { fontSize: '15px', fontWeight: '600', lineHeight: '18.5px', display: 'flex', alignItems: 'center' }, children: ["Ethereum", jsx$2(Text, { sx: {
79781
- fontSize: '10px',
79782
- fontWeight: '600',
79783
- lineHeight: '8px',
79784
- color: '#FAFAFA',
79785
- padding: '4px 6px',
79786
- background: 'rgba(250, 250, 250, 0.3)',
79787
- borderRadius: '4px',
79788
- marginLeft: '6px',
79789
- marginRight: '6px',
79790
- }, children: "Popular" }), jsx$2("img", { src: "/images/connect-to-vm/evm-compatible-wallets.svg", alt: "solana compatible wallets", width: 55, height: 17 })] }), jsx$2(Text, { sx: {
79791
- fontSize: '10px',
79792
- fontWeight: '400',
79793
- lineHeight: '16px',
79794
- color: 'rgba(255, 255, 255, 0.65)',
79795
- display: 'flex',
79796
- alignItems: 'center',
79797
- gap: '4px',
79798
- }, children: "Connect your EVM wallet to view your EVM Bonds!" })] })] }), jsx$2(Flex, { sx: { width: 'fit-content' }, children: jsx$2(Button, { onClick: () => openConnectModal === null || openConnectModal === void 0 ? void 0 : openConnectModal(), children: "Connect" }) })] }));
79799
- }
79800
-
79801
79790
  const YourBonds = ({ showOnly }) => {
79802
79791
  useTokenPrices();
79803
79792
  // Hooks
@@ -79927,7 +79916,7 @@ const YourBonds = ({ showOnly }) => {
79927
79916
  const hasBonds = useMemo(() => {
79928
79917
  return bondsToRender && (bondsToRender.SOL.length > 0 || bondsToRender.EVM.length > 0);
79929
79918
  }, [bondsToRender]);
79930
- return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account && !solanaAccount ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected' })) : hasBonds ? (jsxs(Fragment$1, { children: [preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.map((userBond, index) => jsx$2(PreTgeUserRow, { userBond: userBond }, index)), jsxs(Flex$1, { sx: { mb: '16px', flexDirection: 'column', width: '100%' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: '500', ml: '10px', mb: '18px', color: colors$1.primaryButtonHovered }, children: "SOLANA BONDS" }), solanaAccount ? (bondsToRender.SOL.map((bill) => {
79919
+ return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account && !solanaAccount ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected.' })) : hasBonds ? (jsxs(Fragment$1, { children: [preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.map((userBond, index) => jsx$2(PreTgeUserRow, { userBond: userBond }, index)), jsxs(Flex$1, { sx: { mb: '16px', flexDirection: 'column', width: '100%' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: '500', ml: '10px', mb: '18px', color: colors$1.primaryButtonHovered }, children: "SOLANA BONDS" }), solanaAccount ? (bondsToRender.SOL.map((bill) => {
79931
79920
  return jsx$2(UserBondRowSolana, { bill: bill }, bill.id);
79932
79921
  })) : (jsx$2(Flex$1, { children: jsx$2(ConnectToSolanaCard, {}) }))] }), jsxs(Flex$1, { sx: { mb: '16px', flexDirection: 'column', width: '100%' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: '500', ml: '10px', mb: '18px', color: colors$1.primaryButtonHovered }, children: "EVM BONDS" }), account ? (bondsToRender.EVM.map((bill) => {
79933
79922
  return jsx$2(UserBondRow, { bill: bill }, bill.id);
@@ -82897,8 +82886,10 @@ function calculateSolanaTrueBillPrice(bondIssuanceAddress) {
82897
82886
  throw new Error('Bond issuance account not found');
82898
82887
  }
82899
82888
  const principalFee = new BigNumber$1((_b = (_a = bondIssuanceAccount.feeInPrincipal) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '0');
82900
- const trueBillPriceE9 = trueBillPrice.minus(principalFee).multipliedBy(1e9);
82901
- const trueBillPriceWithoutFeeE9 = trueBillPrice.multipliedBy(1e9);
82889
+ // const trueBillPriceE9 = trueBillPrice.minus(principalFee).multipliedBy(1e9)
82890
+ // const trueBillPriceWithoutFeeE9 = trueBillPrice.multipliedBy(1e9)
82891
+ const trueBillPriceE9 = trueBillPrice.multipliedBy(1e6);
82892
+ const trueBillPriceWithoutFeeE9 = trueBillPrice.multipliedBy(1e6);
82902
82893
  return { trueBillPriceWithoutFeeE9, trueBillPriceE9 };
82903
82894
  }
82904
82895
  catch (e) {
@@ -83455,6 +83446,7 @@ const TokenSelectorPanel = ({ typedValue, setTypedValue, selectedToken, chainId,
83455
83446
  setTypedValue(event.target.value);
83456
83447
  };
83457
83448
  const [onTokenSelectorModal] = useModal(jsx$2(TokenSelectorModal, { bondPrincipalToken: bondPrincipalToken, handleCurrencySelect: handleCurrencySelect, chainId: chainId }), true, false, `tokenSelectorOnLiquidityModal${(_b = bondPrincipalToken === null || bondPrincipalToken === void 0 ? void 0 : bondPrincipalToken.address) === null || _b === void 0 ? void 0 : _b[chainId]}-${bondPrincipalToken === null || bondPrincipalToken === void 0 ? void 0 : bondPrincipalToken.symbol}`);
83449
+ const showBalance = !!account || !!solanaAccount;
83458
83450
  return (jsxs(Flex$1, { className: "token-selector-panel", sx: { borderRadius: 'normal' }, children: [jsxs(Flex$1, { className: "input-container inputrow", children: [jsx$2(Flex$1, { className: "input-container input", children: jsx$2(Input$1, { placeholder: "0.0", value: typedValue, pattern: "^[0-9]*[.,]?[0-9]*$", onChange: handleInputChange, onInput: (v) => {
83459
83451
  if (v.currentTarget.value.includes(',')) {
83460
83452
  v.currentTarget.value = v.currentTarget.value.replace(/,/g, '.');
@@ -83471,7 +83463,7 @@ const TokenSelectorPanel = ({ typedValue, setTypedValue, selectedToken, chainId,
83471
83463
  : v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
83472
83464
  }, disabled: inputDisabled }) }), jsxs(Flex$1, { className: "input-container token", onClick: () => (enableZap ? onTokenSelectorModal() : null), sx: { cursor: enableZap ? 'pointer' : 'default', borderRadius: 'normal' }, children: [jsxs(Flex$1, { children: [jsx$2(Flex$1, { className: "input-container bondicon", children: lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28, chain: chainId })) : (jsx$2(TokenImage, { symbol: getSymbol(selectedToken, chainId), size: 28, chain: chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: getSymbol(selectedToken, chainId) })] }), enableZap && (jsx$2(Flex$1, { sx: { mr: '8px' }, children: jsx$2(Svg, { icon: "caret" }) }))] })] }), jsxs(Flex$1, { className: "input-container balancerow", children: [jsx$2(Flex$1, { children: selectedTokenPrice && typedValue
83473
83465
  ? `$${formatUSDNumber((selectedTokenPrice * parseFloat(typedValue)).toFixed(2))}`
83474
- : '' }), jsxs(Flex$1, { children: [account || (solanaAccount && jsxs(Flex$1, { className: "balancerow text", children: ["Balance: ", tokenBalanceString] })), jsx$2(Flex$1, { className: "balancerow max", children: tokenBalance && tokenBalance !== '0' && handleValueBtn && (jsx$2(Fragment$1, { children: jsx$2(Button, { className: "max-button", onClick: () => { var _a; return handleValueBtn((_a = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, children: "Max" }) })) })] })] })] }));
83466
+ : '' }), jsxs(Flex$1, { children: [showBalance && jsxs(Flex$1, { className: "balancerow text", children: ["Balance: ", tokenBalanceString] }), jsx$2(Flex$1, { className: "balancerow max", children: tokenBalance && tokenBalance !== '0' && handleValueBtn && (jsx$2(Fragment$1, { children: jsx$2(Button, { className: "max-button", onClick: () => { var _a; return handleValueBtn((_a = new BigNumber$1(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, children: "Max" }) })) })] })] })] }));
83475
83467
  };
83476
83468
 
83477
83469
  var NetworkNames;
@@ -84744,6 +84736,26 @@ const SlippageModal = () => {
84744
84736
  }, children: jsx$2(Text, { weight: 700, children: "%" }) })] })] })] }) }) }) }));
84745
84737
  };
84746
84738
 
84739
+ const RainbowKitButton = () => {
84740
+ return (jsx$2(ConnectButton$1.Custom, { children: ({ openConnectModal }) => {
84741
+ return (jsx$2(Button, { fullWidth: true, onClick: () => {
84742
+ openConnectModal();
84743
+ track({
84744
+ event: 'wallet_connect',
84745
+ chain: 0,
84746
+ data: {
84747
+ wallet: 'rainbow',
84748
+ },
84749
+ });
84750
+ }, sx: { height: '45px', padding: '10px 10px', alignItems: 'center', width: '100%' }, children: "Connect" }));
84751
+ } }));
84752
+ };
84753
+
84754
+ const ConnectButton = () => {
84755
+ const config = useSDKConfig();
84756
+ return (config === null || config === void 0 ? void 0 : config.useRainbowKit) ? (jsx$2(RainbowKitButton, {})) : (jsx$2(Button, { disabled: true, fullWidth: true, children: "Connect wallet" }));
84757
+ };
84758
+
84747
84759
  const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
84748
84760
  var _a, _b, _c, _d, _e, _f, _g;
84749
84761
  // State
@@ -85053,7 +85065,7 @@ const BondModalHeader = ({ bondData, onDismiss, showProjectInfoButton, }) => {
85053
85065
  height: '30px',
85054
85066
  mb: ['10px', '10px', '10px', '0px'],
85055
85067
  justifyContent: ['space-between', 'space-between', 'space-between', 'flex-end'],
85056
- }, children: [jsx$2(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none'] }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) }), jsx$2(Flex, { sx: { cursor: 'pointer' }, children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(Flex, { sx: { mx: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) }), jsx$2(Flex, { onClick: handleClose, children: jsx$2(Svg, { icon: "close", color: "text" }) })] })) : (jsx$2(Flex, { sx: { py: '3px', mt: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }), jsxs(Flex, { sx: { width: '100%' }, children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_b = bondData.showcaseTokenName) !== null && _b !== void 0 ? _b : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_c = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _c === void 0 ? void 0 : _c[0] })] }), jsxs(Flex, { className: "title-container price-container", sx: { flexDirection: 'column', pl: '20px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), SDKConfig.useTiers ? (jsxs(Flex, { sx: {
85068
+ }, children: [jsx$2(Flex, { sx: { display: ['flex', 'flex', 'flex', 'none'] }, children: jsx$2(BondModalMinTierHeader, { minTier: minTier }) }), jsx$2(Flex, { sx: { cursor: 'pointer' }, children: onDismiss ? (jsxs(Fragment$1, { children: [showProjectInfoButton && jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation }), jsx$2(Flex, { sx: { mx: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) }), jsx$2(Flex, { onClick: handleClose, children: jsx$2(Svg, { icon: "close", color: "text" }) })] })) : (jsx$2(Flex, { sx: { py: '3px', mt: '10px' }, onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })) })] }), jsxs(Flex, { sx: { width: '100%' }, children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_b = bondData.showcaseTokenName) !== null && _b !== void 0 ? _b : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, jsx$2(ListTag, { text: (_c = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _c === void 0 ? void 0 : _c[0] })] }), jsxs(Flex, { className: "title-container price-container", sx: { flexDirection: 'column', pl: '20px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), SDKConfig.useTiers && bondData.billVersion === types$1.BillVersion.V4 ? (jsxs(Flex, { sx: {
85057
85069
  p: '3px 6px',
85058
85070
  border: '1px solid var(--theme-ui-colors-primaryButton)',
85059
85071
  borderRadius: 'normal',
@@ -86083,7 +86095,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView }) => {
86083
86095
  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.trueBondPriceWithoutFee;
86084
86096
  const maxPrice = new BigNumber$1(trueBondPriceWithoutFee !== null && trueBondPriceWithoutFee !== void 0 ? trueBondPriceWithoutFee : '0')
86085
86097
  .times(1.02)
86086
- .dividedBy(new BigNumber$1('1000000000'))
86098
+ .dividedBy(new BigNumber$1(1e6))
86087
86099
  .toFixed(0);
86088
86100
  // Static addresses
86089
86101
  const bondIssuancePda = new PublicKey(bondData.contractAddress[bondData.chainId]);
@@ -86202,7 +86214,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView }) => {
86202
86214
  }
86203
86215
  /* eslint-disable react-hooks/exhaustive-deps */
86204
86216
  }, [inputCurrencyBalance]);
86205
- return bondData ? (jsx$2(Flex, { className: "modal-content", children: jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards$1, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { 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, inputDisabled: false }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), ((_e = NETWORK_LABEL[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('testnet')) && (jsx$2(Flex, { sx: {
86217
+ return bondData ? (jsx$2(Flex, { className: "modal-content", children: jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards$1, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { 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, inputDisabled: false }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), ((_e = NETWORK_LABEL[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) === null || _e === void 0 ? void 0 : _e.toLowerCase().includes('testnet')) && (jsx$2(Flex, { sx: {
86206
86218
  width: '100%',
86207
86219
  background: '#DE62F366',
86208
86220
  justifyContent: 'center',
@@ -86787,12 +86799,19 @@ const BannerTestnet = ({ chainId }) => {
86787
86799
  const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
86788
86800
  const key = chain;
86789
86801
  const [isOpen, setIsOpen] = useState(true);
86790
- return (jsx$2(Flex$1, { className: "bondrowswithtitle", children: jsxs(AnimatePresence, { initial: false, children: [jsx$2(Flex$1, { onClick: () => setIsOpen(!isOpen), sx: { cursor: 'pointer' }, children: jsx$2(ChainTitle, { chain: chain, pt: '5px', hideTitles: bonds.length <= 0 && chain !== types$1.ChainId.SOL, isOpen: isOpen }) }), bonds.length > 0 && isOpen && (jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
86802
+ return (jsx$2(Flex$1, { className: "bondrowswithtitle", children: jsxs(AnimatePresence, { initial: false, children: [jsx$2(Flex$1, { onClick: () => setIsOpen(!isOpen), sx: { cursor: 'pointer' }, children: jsx$2(ChainTitle, { chain: chain, pt: '5px', hideTitles: bonds.length <= 0 && chain !== types$1.ChainId.SOL, isOpen: isOpen }) }), isOpen && (bonds.length > 0 || chain === types$1.ChainId.SOL) && (jsxs(motion.div, { initial: { height: 0, overflow: 'hidden' }, animate: { height: 'fit-content', overflow: 'hidden', transitionEnd: { overflow: 'visible' } }, exit: { height: 0, overflow: 'hidden' }, sx: {
86791
86803
  position: 'relative',
86792
86804
  overflow: 'hidden',
86793
86805
  width: '100%',
86794
86806
  marginTop: '0px',
86795
- }, className: "bonds-card-container", children: [TESTNET_CHAINS.includes(chain) && jsx$2(BannerTestnet, { chainId: chain }), bonds === null || bonds === void 0 ? void 0 : bonds.map((bondFromMap, index) => {
86807
+ }, className: "bonds-card-container", children: [bonds.length <= 0 && chain === types$1.ChainId.SOL && (jsx$2(Flex$1, { sx: { width: '100%', flexDirection: 'column' }, className: "bonds-card-container", children: Array.from({ length: 3 }).map((_, index) => {
86808
+ return (jsx$2(Skeleton, { animation: "waves", sx: {
86809
+ width: '100%',
86810
+ height: '70px',
86811
+ borderRadius: 'normal',
86812
+ mb: '5px',
86813
+ } }, `sol-shadow-${index}`));
86814
+ }) }, key)), TESTNET_CHAINS.includes(chain) && jsx$2(BannerTestnet, { chainId: chain }), bonds === null || bonds === void 0 ? void 0 : bonds.map((bondFromMap, index) => {
86796
86815
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
86797
86816
  if (bondFromMap.soldOut) {
86798
86817
  const bond = bondFromMap;
@@ -86817,14 +86836,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
86817
86836
  const remainingTokensString = getRemainingTokensString(bond);
86818
86837
  return (jsx$2(BondRow, { bondAddress: bondAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, billType: bond.billType, tag: (_w = bond.tags) === null || _w === void 0 ? void 0 : _w[0], trueBondPrices: bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bondAddress}-${bond.chainId}-${index}`));
86819
86838
  }
86820
- }), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key)), bonds.length <= 0 && chain === types$1.ChainId.SOL && (jsx$2(Flex$1, { sx: { width: '100%', flexDirection: 'column' }, className: "bonds-card-container", children: Array.from({ length: 3 }).map((_, index) => {
86821
- return (jsx$2(Skeleton, { animation: "waves", sx: {
86822
- width: '100%',
86823
- height: '70px',
86824
- borderRadius: 'normal',
86825
- mb: '5px',
86826
- } }, `sol-shadow-${index}`));
86827
- }) }, key))] }) }, key));
86839
+ }), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
86828
86840
  };
86829
86841
 
86830
86842
  const BondRowsByChain = ({ bonds, hideTitles }) => {
@@ -87038,7 +87050,7 @@ const BuyAgainRow = () => {
87038
87050
  };
87039
87051
 
87040
87052
  const LoadingSkeleton = () => {
87041
- return (jsxs(Flex$1, { sx: { width: '100%', flexDirection: 'column', mt: '35px' }, children: [Array.from({ length: 6 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
87053
+ return (jsxs(Flex$1, { sx: { width: '100%', flexDirection: 'column', mt: '35px' }, children: [Array.from({ length: 5 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
87042
87054
  width: '100%',
87043
87055
  height: '70px',
87044
87056
  borderRadius: 'normal',
@@ -87048,7 +87060,12 @@ const LoadingSkeleton = () => {
87048
87060
  height: '125px',
87049
87061
  borderRadius: 'normal',
87050
87062
  mb: '5px',
87051
- } }, `hot-card-shadow${index}`))) })] }));
87063
+ } }, `hot-card-shadow${index}`))) }), jsx$2(Flex$1, { sx: { width: '100%', flexDirection: 'column', mt: '25px' }, children: Array.from({ length: 3 }).map((_, index) => (jsx$2(Skeleton, { animation: "waves", sx: {
87064
+ width: '100%',
87065
+ height: '70px',
87066
+ borderRadius: 'normal',
87067
+ mb: '5px',
87068
+ } }, `second-row-shadow-${index}`))) })] }));
87052
87069
  };
87053
87070
 
87054
87071
  const Bonds = () => {
@@ -87060,10 +87077,6 @@ const Bonds = () => {
87060
87077
  const { data: allPreBonds } = usePreTGEList();
87061
87078
  const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
87062
87079
  const { data: tokenPrices } = useTokenPrices();
87063
- // const rtc = tokenPrices?.find(
87064
- // (token) => token?.address?.toLowerCase() === '0x188b8e23CefFCA7a58e8C64C2a7A9771Ab3596A7'.toLowerCase(),
87065
- // )
87066
- // console.log('rtc: ', rtc)
87067
87080
  const SDKConfig = useSDKConfig();
87068
87081
  useEffect(() => {
87069
87082
  const hash = window.location.hash;
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": "4.0.0-test.3",
6
+ "version": "4.0.0-test.5",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",