@ape.swap/bonds-sdk 6.2.27 → 6.2.28

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 (28) hide show
  1. package/dist/components/ConnectButton/index.js +1 -4
  2. package/dist/components/ConnectButton/index.js.map +1 -1
  3. package/dist/components/ConnectoToVmBanners/ConnectToAptosBanner.js +1 -1
  4. package/dist/components/ConnectoToVmBanners/ConnectToAptosBanner.js.map +1 -1
  5. package/dist/components/ConnectoToVmBanners/ConnectToEvmBanner.js +2 -1
  6. package/dist/components/ConnectoToVmBanners/ConnectToEvmBanner.js.map +1 -1
  7. package/dist/components/ConnectoToVmBanners/ConnectToSolanaBanner.js +2 -2
  8. package/dist/components/ConnectoToVmBanners/ConnectToSolanaBanner.js.map +1 -1
  9. package/dist/components/ConnectoToVmBanners/ConnectToSuiBanner.js +1 -1
  10. package/dist/components/ConnectoToVmBanners/ConnectToSuiBanner.js.map +1 -1
  11. package/dist/state/bonds/fetchBondsData/cleanBillsData.d.ts +4 -4
  12. package/dist/state/bonds/fetchBondsData/cleanBillsData.js +2 -105
  13. package/dist/state/bonds/fetchBondsData/cleanBillsData.js.map +1 -1
  14. package/dist/state/bonds/fetchBondsData/fetchBondsDataAptos.js +2 -25
  15. package/dist/state/bonds/fetchBondsData/fetchBondsDataAptos.js.map +1 -1
  16. package/dist/state/bonds/fetchBondsData/fetchBondsDataEVM.d.ts +2 -1
  17. package/dist/state/bonds/fetchBondsData/fetchBondsDataEVM.js +70 -3
  18. package/dist/state/bonds/fetchBondsData/fetchBondsDataEVM.js.map +1 -1
  19. package/dist/state/bonds/fetchBondsData/fetchBondsDataSOL.d.ts +2 -1
  20. package/dist/state/bonds/fetchBondsData/fetchBondsDataSOL.js +57 -2
  21. package/dist/state/bonds/fetchBondsData/fetchBondsDataSOL.js.map +1 -1
  22. package/dist/state/bonds/fetchBondsData/fetchBondsDataSui.js +2 -28
  23. package/dist/state/bonds/fetchBondsData/fetchBondsDataSui.js.map +1 -1
  24. package/dist/state/tokenPrices/resolveTokenPrice.d.ts +13 -0
  25. package/dist/state/tokenPrices/resolveTokenPrice.js +37 -0
  26. package/dist/state/tokenPrices/resolveTokenPrice.js.map +1 -0
  27. package/dist/styles.css +1 -1
  28. package/package.json +1 -1
@@ -1,11 +1,8 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import Button from '../uikit-sdk/Button/Button.js';
3
- import { openEvmWalletConnector } from '../../config/constants/walletConnectors.js';
4
- import { useSDKConfig } from '../../state/useSDKConfig.js';
5
3
 
6
4
  const ConnectButton = () => {
7
- const config = useSDKConfig();
8
- return (jsx(Button, { fullWidth: true, onClick: openEvmWalletConnector, disabled: !config?.openWalletConnectors?.evm, children: "Connect" }));
5
+ return jsx(Button, { fullWidth: true, children: "Connect" });
9
6
  };
10
7
 
11
8
  export { ConnectButton as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/ConnectButton/index.tsx"],"sourcesContent":["import React from 'react'\nimport Button from '../uikit-sdk/Button/Button'\nimport { openEvmWalletConnector } from '../../config/constants/walletConnectors'\nimport { useSDKConfig } from '../../state/useSDKConfig'\n\nconst ConnectButton = () => {\n const config = useSDKConfig()\n\n return (\n <Button fullWidth onClick={openEvmWalletConnector} disabled={!config?.openWalletConnectors?.evm}>\n Connect\n </Button>\n )\n}\n\nexport default ConnectButton\n"],"names":["_jsx"],"mappings":";;;;;AAKA,MAAM,aAAa,GAAG,MAAK;AACzB,IAAA,MAAM,MAAM,GAAG,YAAY,EAAE;IAE7B,QACEA,IAAC,MAAM,EAAA,EAAC,SAAS,EAAA,IAAA,EAAC,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,EAAA,QAAA,EAAA,SAAA,EAAA,CAEtF;AAEb;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/ConnectButton/index.tsx"],"sourcesContent":["import React from 'react'\nimport Button from '../uikit-sdk/Button/Button'\n\nconst ConnectButton = () => {\n return <Button fullWidth>Connect</Button>\n}\n\nexport default ConnectButton\n"],"names":["_jsx"],"mappings":";;;AAGA,MAAM,aAAa,GAAG,MAAK;AACzB,IAAA,OAAOA,GAAA,CAAC,MAAM,EAAA,EAAC,SAAS,8BAAiB;AAC3C;;;;"}
@@ -14,7 +14,7 @@ import APTOS from '../uikit-sdk/Svg/tokens/APTOS.js';
14
14
  function ConnectToAptosBanner() {
15
15
  const config = useSDKConfig();
16
16
  const handleConnect = config?.openWalletConnectors?.aptos ? openAptosWalletConnector : undefined;
17
- return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer", style: { background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx(Flex, { className: "ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden", children: jsx(APTOS, { width: "30" }) }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "18px", className: "ape:font-bold ape:flex ape:items-center", style: { lineHeight: '18.5px' }, children: ["Aptos", jsx(Text, { as: "span", size: "10px", className: "ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]", style: { color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }, children: "NEW" })] }), jsx(Text, { size: "11px", className: "ape:font-normal", style: { color: 'white', lineHeight: '1rem' }, children: "Connect your wallet to view your Aptos Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px]", children: jsx(Button, { onClick: handleConnect, className: "ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button", children: "Connect" }) })] }));
17
+ return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer ape:hover:opacity-90", style: { background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }, onClick: handleConnect, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx(Flex, { className: "ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden", children: jsx(APTOS, { width: "30" }) }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "15px", className: "ape:font-bold ape:flex ape:items-center", style: { lineHeight: '18.5px' }, children: ["Aptos", jsx(Text, { as: "span", size: "10px", className: "ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]", style: { color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }, children: "NEW" })] }), jsx("div", { className: "ape:font-normal ape:text-[10px] ape:text-gray-300", children: "Connect your wallet to view your Aptos Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px]", children: jsx(Button, { className: "ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button", children: "Connect" }) })] }));
18
18
  }
19
19
 
20
20
  export { ConnectToAptosBanner as default };
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectToAptosBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToAptosBanner.tsx"],"sourcesContent":["import { useSDKConfig } from '../../state/useSDKConfig'\nimport { openAptosWalletConnector } from '../../config/constants/walletConnectors'\nimport Flex from '../uikit-sdk/Flex'\nimport Button from '../uikit-sdk/Button/Button'\nimport Text from '../uikit-sdk/Text'\nimport APTOS from '../uikit-sdk/Svg/tokens/APTOS'\n\n// Banner rendered in Your Bonds when the user has not connected an Aptos\n// wallet. Uses the same visual language as `ConnectToSolanaBanner` (see the\n// sibling file) but hosts the Ant Design `WalletSelector` modal internally\n// — Aptos does not expose a global `useWalletModal` hook like Solana does,\n// so each entry point controls its own modal visibility.\nexport default function ConnectToAptosBanner() {\n const config = useSDKConfig()\n const handleConnect = config?.openWalletConnectors?.aptos ? openAptosWalletConnector : undefined\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer\"\n style={{ background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <Flex className=\"ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden\">\n <APTOS width=\"30\" />\n </Flex>\n <Flex className=\"ape:flex-col\">\n <Text size=\"18px\" className=\"ape:font-bold ape:flex ape:items-center\" style={{ lineHeight: '18.5px' }}>\n Aptos\n <Text\n as=\"span\"\n size=\"10px\"\n className=\"ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]\"\n style={{ color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }}\n >\n NEW\n </Text>\n </Text>\n <Text size=\"11px\" className=\"ape:font-normal\" style={{ color: 'white', lineHeight: '1rem' }}>\n Connect your wallet to view your Aptos Bonds!\n </Text>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px]\">\n <Button\n onClick={handleConnect}\n className=\"ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button\"\n >\n Connect\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACc,SAAU,oBAAoB,GAAA;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a,EACtB,SAAS,EAAC,iNAAiN,EAAA,QAAA,EAAA,SAAA,EAAA,CAGpN,EAAA,CACJ,CAAA,EAAA,CACF;AAEX;;;;"}
1
+ {"version":3,"file":"ConnectToAptosBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToAptosBanner.tsx"],"sourcesContent":["import { useSDKConfig } from '../../state/useSDKConfig'\nimport { openAptosWalletConnector } from '../../config/constants/walletConnectors'\nimport Flex from '../uikit-sdk/Flex'\nimport Button from '../uikit-sdk/Button/Button'\nimport Text from '../uikit-sdk/Text'\nimport APTOS from '../uikit-sdk/Svg/tokens/APTOS'\n\n// Banner rendered in Your Bonds when the user has not connected an Aptos\n// wallet. Uses the same visual language as `ConnectToSolanaBanner` (see the\n// sibling file) but hosts the Ant Design `WalletSelector` modal internally\n// — Aptos does not expose a global `useWalletModal` hook like Solana does,\n// so each entry point controls its own modal visibility.\nexport default function ConnectToAptosBanner() {\n const config = useSDKConfig()\n const handleConnect = config?.openWalletConnectors?.aptos ? openAptosWalletConnector : undefined\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer ape:hover:opacity-90\"\n style={{ background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }}\n onClick={handleConnect}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <Flex className=\"ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden\">\n <APTOS width=\"30\" />\n </Flex>\n <Flex className=\"ape:flex-col\">\n <Text size=\"15px\" className=\"ape:font-bold ape:flex ape:items-center\" style={{ lineHeight: '18.5px' }}>\n Aptos\n <Text\n as=\"span\"\n size=\"10px\"\n className=\"ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]\"\n style={{ color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }}\n >\n NEW\n </Text>\n </Text>\n <div className=\"ape:font-normal ape:text-[10px] ape:text-gray-300\">\n Connect your wallet to view your Aptos Bonds!\n </div>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px]\">\n <Button className=\"ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button\">\n Connect\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAOA;AACA;AACA;AACA;AACA;AACc,SAAU,oBAAoB,GAAA;AAC1C,IAAA,MAAM,MAAM,GAAG,YAAY,EAAE;AAC7B,IAAA,MAAM,aAAa,GAAG,MAAM,EAAE,oBAAoB,EAAE,KAAK,GAAG,wBAAwB,GAAG,SAAS;AAChG,IAAA,QACEA,IAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAC,sJAAsJ,EAChK,KAAK,EAAE,EAAE,UAAU,EAAE,mDAAmD,EAAE,EAC1E,OAAO,EAAE,aAAa,EAAA,QAAA,EAAA,CAEtBA,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CAC5EC,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,wEAAwE,EAAA,QAAA,EACtFA,GAAA,CAAC,KAAK,EAAA,EAAC,KAAK,EAAC,IAAI,EAAA,CAAG,EAAA,CACf,EACPD,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,CAC5BA,IAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,yCAAyC,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAA,QAAA,EAAA,CAAA,OAAA,EAEnGC,GAAA,CAAC,IAAI,EAAA,EACH,EAAE,EAAC,MAAM,EACT,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,+EAA+E,EACzF,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,0BAA0B,EAAE,UAAU,EAAE,KAAK,EAAE,EAAA,QAAA,EAAA,KAAA,EAAA,CAGjF,CAAA,EAAA,CACF,EACPA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,mDAAmD,EAAA,QAAA,EAAA,+CAAA,EAAA,CAE5D,CAAA,EAAA,CACD,CAAA,EAAA,CACF,EACPA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,mBAAmB,EAAA,QAAA,EACjCA,GAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,iNAAiN,EAAA,QAAA,EAAA,SAAA,EAAA,CAE1N,EAAA,CACJ,CAAA,EAAA,CACF;AAEX;;;;"}
@@ -2,9 +2,10 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import ConnectButton from '../ConnectButton/index.js';
3
3
  import Flex from '../uikit-sdk/Flex/index.js';
4
4
  import Text from '../uikit-sdk/Text/index.js';
5
+ import { openEvmWalletConnector } from '../../config/constants/walletConnectors.js';
5
6
 
6
7
  function ConnectToEVMBanner() {
7
- return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:bg-white2 ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:cursor-pointer", children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx("img", { src: "https://ape.bond/images/connect-to-vm/ethereum-icon.png", alt: "ethereum icon", width: 30, height: 30, style: { borderRadius: '50px' } }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "15px", className: "ape:font-semibold ape:flex ape:items-center ape:gap-[5px]", style: { lineHeight: '18.5px' }, children: ["Ethereum", jsx("img", { src: "https://ape.bond/images/connect-to-vm/evm-compatible-wallets.png", alt: "solana compatible wallets", width: 55, height: 17 })] }), jsx(Text, { size: "10px", className: "ape:font-normal ape:flex ape:items-center ape:gap-[4px]", style: { color: 'rgba(255, 255, 255, 0.65)', lineHeight: '1rem' }, children: "Connect your wallet to view your EVM Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px] ape:w-[210px] ape:xl:w-[100px] ape:[&>*]:w-[210px] ape:xl:[&>*]:w-[100px] ape:[&>*]:h-[31px]! ape:[&>*]:text-[14px]!", children: jsx(ConnectButton, {}) })] }));
8
+ return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:bg-white2 ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:cursor-pointer ape:hover:bg-white3", onClick: openEvmWalletConnector, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx("img", { src: "https://ape.bond/images/connect-to-vm/ethereum-icon.png", alt: "ethereum icon", width: 30, height: 30, style: { borderRadius: '50px', minWidth: '30px', minHeight: '30px' } }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "15px", className: "ape:font-semibold ape:flex ape:items-center ape:gap-[5px]", style: { lineHeight: '18.5px' }, children: ["Ethereum", jsx("img", { src: "https://ape.bond/images/connect-to-vm/evm-compatible-wallets.png", alt: "solana compatible wallets", width: 55, height: 17 })] }), jsx("div", { className: "ape:font-normal ape:text-[10px] ape:text-gray-300", children: "Connect your wallet to view your EVM Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px] ape:w-[210px] ape:xl:w-[100px] ape:[&>*]:w-[210px] ape:xl:[&>*]:w-[100px] ape:[&>*]:h-[31px]! ape:[&>*]:text-[14px]!", children: jsx(ConnectButton, {}) })] }));
8
9
  }
9
10
 
10
11
  export { ConnectToEVMBanner as default };
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectToEvmBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToEvmBanner.tsx"],"sourcesContent":["import ConnectButton from '../ConnectButton'\nimport Flex from '../uikit-sdk/Flex'\nimport Text from '../uikit-sdk/Text'\n\nexport default function ConnectToEVMBanner() {\n return (\n <Flex className=\"ape:w-full ape:h-[75px] ape:bg-white2 ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:cursor-pointer\">\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <img\n src=\"https://ape.bond/images/connect-to-vm/ethereum-icon.png\"\n alt=\"ethereum icon\"\n width={30}\n height={30}\n style={{ borderRadius: '50px' }}\n />\n <Flex className=\"ape:flex-col\">\n <Text\n size=\"15px\"\n className=\"ape:font-semibold ape:flex ape:items-center ape:gap-[5px]\"\n style={{ lineHeight: '18.5px' }}\n >\n Ethereum\n <img\n src=\"https://ape.bond/images/connect-to-vm/evm-compatible-wallets.png\"\n alt=\"solana compatible wallets\"\n width={55}\n height={17}\n />\n </Text>\n <Text\n size=\"10px\"\n className=\"ape:font-normal ape:flex ape:items-center ape:gap-[4px]\"\n style={{ color: 'rgba(255, 255, 255, 0.65)', lineHeight: '1rem' }}\n >\n Connect your wallet to view your EVM Bonds!\n </Text>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px] ape:w-[210px] ape:xl:w-[100px] ape:[&>*]:w-[210px] ape:xl:[&>*]:w-[100px] ape:[&>*]:h-[31px]! ape:[&>*]:text-[14px]!\">\n <ConnectButton />\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;AAIc,SAAU,kBAAkB,GAAA;AACxC,IAAA,QACEA,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,+HAA+H,EAAA,QAAA,EAAA,CAC7IA,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CAC5EC,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAC,yDAAyD,EAC7D,GAAG,EAAC,eAAe,EACnB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,EAAA,CAC/B,EACFD,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,CAC5BA,IAAA,CAAC,IAAI,EAAA,EACH,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,2DAA2D,EACrE,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAA,QAAA,EAAA,CAAA,UAAA,EAG/BC,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAC,kEAAkE,EACtE,GAAG,EAAC,2BAA2B,EAC/B,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EAAA,CACV,CAAA,EAAA,CACG,EACPA,GAAA,CAAC,IAAI,EAAA,EACH,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,yDAAyD,EACnE,KAAK,EAAE,EAAE,KAAK,EAAE,2BAA2B,EAAE,UAAU,EAAE,MAAM,EAAE,EAAA,QAAA,EAAA,6CAAA,EAAA,CAG5D,CAAA,EAAA,CACF,CAAA,EAAA,CACF,EACPA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,wIAAwI,EAAA,QAAA,EACtJA,GAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAA,CACZ,CAAA,EAAA,CACF;AAEX;;;;"}
1
+ {"version":3,"file":"ConnectToEvmBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToEvmBanner.tsx"],"sourcesContent":["import ConnectButton from '../ConnectButton'\nimport Flex from '../uikit-sdk/Flex'\nimport Text from '../uikit-sdk/Text'\nimport { openEvmWalletConnector } from '../../config/constants/walletConnectors'\n\nexport default function ConnectToEVMBanner() {\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:bg-white2 ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:cursor-pointer ape:hover:bg-white3\"\n onClick={openEvmWalletConnector}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <img\n src=\"https://ape.bond/images/connect-to-vm/ethereum-icon.png\"\n alt=\"ethereum icon\"\n width={30}\n height={30}\n style={{ borderRadius: '50px', minWidth: '30px', minHeight: '30px' }}\n />\n <Flex className=\"ape:flex-col\">\n <Text\n size=\"15px\"\n className=\"ape:font-semibold ape:flex ape:items-center ape:gap-[5px]\"\n style={{ lineHeight: '18.5px' }}\n >\n Ethereum\n <img\n src=\"https://ape.bond/images/connect-to-vm/evm-compatible-wallets.png\"\n alt=\"solana compatible wallets\"\n width={55}\n height={17}\n />\n </Text>\n <div className=\"ape:font-normal ape:text-[10px] ape:text-gray-300\">\n Connect your wallet to view your EVM Bonds!\n </div>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px] ape:w-[210px] ape:xl:w-[100px] ape:[&>*]:w-[210px] ape:xl:[&>*]:w-[100px] ape:[&>*]:h-[31px]! ape:[&>*]:text-[14px]!\">\n <ConnectButton />\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;AAKc,SAAU,kBAAkB,GAAA;IACxC,QACEA,IAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAC,mJAAmJ,EAC7J,OAAO,EAAE,sBAAsB,EAAA,QAAA,EAAA,CAE/BA,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,8DAA8D,EAAA,QAAA,EAAA,CAC5EC,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAC,yDAAyD,EAC7D,GAAG,EAAC,eAAe,EACnB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAA,CACpE,EACFD,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,cAAc,aAC5BA,IAAA,CAAC,IAAI,EAAA,EACH,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,2DAA2D,EACrE,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAA,QAAA,EAAA,CAAA,UAAA,EAG/BC,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAC,kEAAkE,EACtE,GAAG,EAAC,2BAA2B,EAC/B,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EAAA,CACV,CAAA,EAAA,CACG,EACPA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,mDAAmD,EAAA,QAAA,EAAA,6CAAA,EAAA,CAE5D,CAAA,EAAA,CACD,CAAA,EAAA,CACF,EACPA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,wIAAwI,EAAA,QAAA,EACtJA,GAAA,CAAC,aAAa,EAAA,EAAA,CAAG,EAAA,CACZ,CAAA,EAAA,CACF;AAEX;;;;"}
@@ -8,10 +8,10 @@ import Text from '../uikit-sdk/Text/index.js';
8
8
  function ConnectToSolanaCard() {
9
9
  const config = useSDKConfig();
10
10
  const handleConnect = config?.openWalletConnectors?.sol ? openSolWalletConnector : undefined;
11
- return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:bg-cover ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer", style: {
11
+ return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:bg-cover ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer ape:hover:opacity-90", style: {
12
12
  background: `url('https://ape.bond/images/connect-to-vm/solana-card-background.png') no-repeat center center`,
13
13
  backgroundSize: 'cover',
14
- }, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx("img", { src: "https://ape.bond/images/connect-to-vm/solana-icon.png", alt: "solana icon", width: 30, height: 30, style: { borderRadius: '50px' } }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "18px", className: "ape:font-bold ape:flex ape:items-center ape:gap-[5px]", style: { lineHeight: '18.5px' }, children: ["Solana", jsx("img", { src: "https://ape.bond/images/connect-to-vm/svm-compatible-wallets.png", alt: "solana compatible wallets", width: 43, height: 17 })] }), jsx(Text, { size: "11px", className: "ape:font-normal", style: { color: 'white', lineHeight: '1rem' }, children: "Connect your wallet to view your Solana Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px]", children: jsx(Button, { onClick: handleConnect, className: "ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button", children: "Connect" }) })] }));
14
+ }, onClick: handleConnect, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx("img", { src: "https://ape.bond/images/connect-to-vm/solana-icon.png", alt: "solana icon", width: 30, height: 30, style: { borderRadius: '50px' } }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "15px", className: "ape:font-bold ape:flex ape:items-center ape:gap-[5px]", style: { lineHeight: '18.5px' }, children: ["Solana", jsx("img", { src: "https://ape.bond/images/connect-to-vm/svm-compatible-wallets.png", alt: "solana compatible wallets", width: 43, height: 17 })] }), jsx("div", { className: "ape:font-normal ape:text-[10px] ape:text-gray-300", children: "Connect your wallet to view your Solana Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px]", children: jsx(Button, { className: "ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button", children: "Connect" }) })] }));
15
15
  }
16
16
 
17
17
  export { ConnectToSolanaCard as default };
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectToSolanaBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToSolanaBanner.tsx"],"sourcesContent":["import { useSDKConfig } from '../../state/useSDKConfig'\nimport { openSolWalletConnector } from '../../config/constants/walletConnectors'\nimport Flex from '../uikit-sdk/Flex'\nimport Button from '../uikit-sdk/Button/Button'\nimport Text from '../uikit-sdk/Text'\n\nexport default function ConnectToSolanaCard() {\n const config = useSDKConfig()\n const handleConnect = config?.openWalletConnectors?.sol ? openSolWalletConnector : undefined\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:bg-cover ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer\"\n style={{\n background: `url('https://ape.bond/images/connect-to-vm/solana-card-background.png') no-repeat center center`,\n backgroundSize: 'cover',\n }}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <img\n src=\"https://ape.bond/images/connect-to-vm/solana-icon.png\"\n alt=\"solana icon\"\n width={30}\n height={30}\n style={{ borderRadius: '50px' }}\n />\n <Flex className=\"ape:flex-col\">\n <Text\n size=\"18px\"\n className=\"ape:font-bold ape:flex ape:items-center ape:gap-[5px]\"\n style={{ lineHeight: '18.5px' }}\n >\n Solana\n <img\n src=\"https://ape.bond/images/connect-to-vm/svm-compatible-wallets.png\"\n alt=\"solana compatible wallets\"\n width={43}\n height={17}\n />\n </Text>\n <Text size=\"11px\" className=\"ape:font-normal\" style={{ color: 'white', lineHeight: '1rem' }}>\n Connect your wallet to view your Solana Bonds!\n </Text>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px]\">\n <Button\n onClick={handleConnect}\n className=\"ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button\"\n >\n Connect\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;AAMc,SAAU,mBAAmB,GAAA;AACzC,IAAA,MAAM,MAAM,GAAG,YAAY,EAAE;AAC7B,IAAA,MAAM,aAAa,GAAG,MAAM,EAAE,oBAAoB,EAAE,GAAG,GAAG,sBAAsB,GAAG,SA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A,SAAA,EAAA,CAGpN,EAAA,CACJ,CAAA,EAAA,CACF;AAEX;;;;"}
1
+ {"version":3,"file":"ConnectToSolanaBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToSolanaBanner.tsx"],"sourcesContent":["import { useSDKConfig } from '../../state/useSDKConfig'\nimport { openSolWalletConnector } from '../../config/constants/walletConnectors'\nimport Flex from '../uikit-sdk/Flex'\nimport Button from '../uikit-sdk/Button/Button'\nimport Text from '../uikit-sdk/Text'\n\nexport default function ConnectToSolanaCard() {\n const config = useSDKConfig()\n const handleConnect = config?.openWalletConnectors?.sol ? openSolWalletConnector : undefined\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:bg-cover ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer ape:hover:opacity-90\"\n style={{\n background: `url('https://ape.bond/images/connect-to-vm/solana-card-background.png') no-repeat center center`,\n backgroundSize: 'cover',\n }}\n onClick={handleConnect}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <img\n src=\"https://ape.bond/images/connect-to-vm/solana-icon.png\"\n alt=\"solana icon\"\n width={30}\n height={30}\n style={{ borderRadius: '50px' }}\n />\n <Flex className=\"ape:flex-col\">\n <Text\n size=\"15px\"\n className=\"ape:font-bold ape:flex ape:items-center ape:gap-[5px]\"\n style={{ lineHeight: '18.5px' }}\n >\n Solana\n <img\n src=\"https://ape.bond/images/connect-to-vm/svm-compatible-wallets.png\"\n alt=\"solana compatible wallets\"\n width={43}\n height={17}\n />\n </Text>\n <div className=\"ape:font-normal ape:text-[10px] ape:text-gray-300\">\n Connect your wallet to view your Solana Bonds!\n </div>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px]\">\n <Button className=\"ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button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AAA,EACjCA,GAAA,CAAC,MAAM,EAAA,EAAC,SAAS,EAAC,iNAAiN,EAAA,QAAA,EAAA,SAAA,EAAA,CAE1N,EAAA,CACJ,CAAA,EAAA,CACF;AAEX;;;;"}
@@ -9,7 +9,7 @@ import SUI from '../uikit-sdk/Svg/tokens/SUI.js';
9
9
  function ConnectToSuiBanner() {
10
10
  const config = useSDKConfig();
11
11
  const handleConnect = config?.openWalletConnectors?.sui ? openSuiWalletConnector : undefined;
12
- return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer", style: { background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx(Flex, { className: "ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden", children: jsx(SUI, { width: "30" }) }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "18px", className: "ape:font-bold ape:flex ape:items-center", style: { lineHeight: '18.5px' }, children: ["Sui", jsx(Text, { as: "span", size: "10px", className: "ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]", style: { color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }, children: "NEW" })] }), jsx(Text, { size: "11px", className: "ape:font-normal", style: { color: 'white', lineHeight: '1rem' }, children: "Connect your wallet to view your Sui Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px]", children: jsx(Button, { onClick: handleConnect, className: "ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button", children: "Connect" }) })] }));
12
+ return (jsxs(Flex, { className: "ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer ape:hover:opacity-90", style: { background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }, onClick: handleConnect, children: [jsxs(Flex, { className: "ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center", children: [jsx(Flex, { className: "ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden", children: jsx(SUI, { width: "30" }) }), jsxs(Flex, { className: "ape:flex-col", children: [jsxs(Text, { size: "15px", className: "ape:font-bold ape:flex ape:items-center", style: { lineHeight: '18.5px' }, children: ["Sui", jsx(Text, { as: "span", size: "10px", className: "ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]", style: { color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }, children: "NEW" })] }), jsx("div", { className: "ape:font-normal ape:text-[10px] ape:text-gray-300", children: "Connect your wallet to view your Sui Bonds!" })] })] }), jsx(Flex, { className: "ape:min-w-[100px]", children: jsx(Button, { className: "ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button", children: "Connect" }) })] }));
13
13
  }
14
14
 
15
15
  export { ConnectToSuiBanner as default };
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectToSuiBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToSuiBanner.tsx"],"sourcesContent":["import { useSDKConfig } from '../../state/useSDKConfig'\nimport { openSuiWalletConnector } from '../../config/constants/walletConnectors'\nimport Flex from '../uikit-sdk/Flex'\nimport Button from '../uikit-sdk/Button/Button'\nimport Text from '../uikit-sdk/Text'\nimport SUI from '../uikit-sdk/Svg/tokens/SUI'\n\nexport default function ConnectToSuiBanner() {\n const config = useSDKConfig()\n const handleConnect = config?.openWalletConnectors?.sui ? openSuiWalletConnector : undefined\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer\"\n style={{ background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <Flex className=\"ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden\">\n <SUI width=\"30\" />\n </Flex>\n <Flex className=\"ape:flex-col\">\n <Text size=\"18px\" className=\"ape:font-bold ape:flex ape:items-center\" style={{ lineHeight: '18.5px' }}>\n Sui\n <Text\n as=\"span\"\n size=\"10px\"\n className=\"ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]\"\n style={{ color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }}\n >\n NEW\n </Text>\n </Text>\n <Text size=\"11px\" className=\"ape:font-normal\" style={{ color: 'white', lineHeight: '1rem' }}>\n Connect your wallet to view your Sui Bonds!\n </Text>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px]\">\n <Button\n onClick={handleConnect}\n className=\"ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button\"\n >\n Connect\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAOc,SAAU,kBAAkB,GAAA;AACxC,IAAA,MAAM,MAAM,GAAG,YAAY,EAAE;AAC7B,IAAA,MAAM,aAAa,GAAG,MAAM,EAAE,oBAAoB,EAAE,GAAG,GAAG,sBAAsB,GAAG,SAAS;AAC5F,IAAA,QACEA,IAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAC,iIAAiI,EAC3I,KAAK,EAAE,EAAE,UAAU,EAAE,mDAAmD,EAAE,EAAA,QAAA,EAAA,CAE1EA,IAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,8DAA8D,aAC5EC,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,wEAAwE,EAAA,QAAA,EACtFA,GAAA,CAAC,GAAG,IAAC,KAAK,EAAC,IAAI,EAAA,CAAG,EAAA,CACb,EACPD,IAAA,CAAC,IAAI,IAAC,SAAS,EAAC,cAAc,EAAA,QAAA,EAAA,CAC5BA,IAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,yCAAyC,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAEnGC,GAAA,CAAC,IAAI,EAAA,EACH,EAAE,EAAC,MAAM,EACT,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,+EAA+E,EACzF,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,0BAA0B,EAAE,UAAU,EAAE,KAAK,EAAE,EAAA,QAAA,EAAA,KAAA,EAAA,CAGjF,IACF,EACPA,GAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,iBAAiB,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,4DAEpF,CAAA,EAAA,CACF,CAAA,EAAA,CACF,EACPA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,mBAAmB,EAAA,QAAA,EACjCA,GAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAE,aAAa,EACtB,SAAS,EAAC,iNAAiN,EAAA,QAAA,EAAA,SAAA,EAAA,CAGpN,EAAA,CACJ,CAAA,EAAA,CACF;AAEX;;;;"}
1
+ {"version":3,"file":"ConnectToSuiBanner.js","sources":["../../../src/components/ConnectoToVmBanners/ConnectToSuiBanner.tsx"],"sourcesContent":["import { useSDKConfig } from '../../state/useSDKConfig'\nimport { openSuiWalletConnector } from '../../config/constants/walletConnectors'\nimport Flex from '../uikit-sdk/Flex'\nimport Button from '../uikit-sdk/Button/Button'\nimport Text from '../uikit-sdk/Text'\nimport SUI from '../uikit-sdk/Svg/tokens/SUI'\n\nexport default function ConnectToSuiBanner() {\n const config = useSDKConfig()\n const handleConnect = config?.openWalletConnectors?.sui ? openSuiWalletConnector : undefined\n return (\n <Flex\n className=\"ape:w-full ape:h-[75px] ape:p-[10px] ape:rounded-[10px] ape:justify-between ape:items-center ape:border-none ape:cursor-pointer ape:hover:opacity-90\"\n style={{ background: 'linear-gradient(135deg, #2B2B2B 0%, #1A1A2E 100%)' }}\n onClick={handleConnect}\n >\n <Flex className=\"ape:w-full ape:max-w-[300px] ape:gap-[10px] ape:items-center\">\n <Flex className=\"ape:min-w-[30px] ape:min-h-[30px] ape:rounded-full ape:overflow-hidden\">\n <SUI width=\"30\" />\n </Flex>\n <Flex className=\"ape:flex-col\">\n <Text size=\"15px\" className=\"ape:font-bold ape:flex ape:items-center\" style={{ lineHeight: '18.5px' }}>\n Sui\n <Text\n as=\"span\"\n size=\"10px\"\n className=\"ape:font-semibold ape:p-[4px_6px] ape:rounded-[4px] ape:ml-[6px] ape:mr-[6px]\"\n style={{ color: '#FAFAFA', background: 'rgba(250, 250, 250, 0.3)', lineHeight: '8px' }}\n >\n NEW\n </Text>\n </Text>\n <div className=\"ape:font-normal ape:text-[10px] ape:text-gray-300\">\n Connect your wallet to view your Sui Bonds!\n </div>\n </Flex>\n </Flex>\n <Flex className=\"ape:min-w-[100px]\">\n <Button className=\"ape:border-none ape:h-[31px] ape:w-[210px] ape:xl:w-[100px] ape:text-[14px]! ape:font-bold ape:bg-text ape:border-text ape:enabled:hover:text-text ape:enabled:hover:bg-primary-button ape:text-primary-button\">\n Connect\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAOc,SAAU,kBAAkB,GAAA;AACxC,IAAA,MAAM,MAAM,GAAG,YAAY,EAAE;AAC7B,IAAA,MAAM,aAAa,GAAG,MA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AA,CACJ,CAAA,EAAA,CACF;AAEX;;;;"}
@@ -1,4 +1,4 @@
1
- import { BillsConfig, ChainId } from '@ape.swap/apeswap-lists';
2
- import { TokenPrices } from '../../tokenPrices/useTokenPrices';
3
- import { BondsData } from '../../../types/bonds';
4
- export declare const cleanBillsData: (billIds: number[], chunkedBills: any[], chainId: ChainId, bills: BillsConfig[], tokenPrices?: TokenPrices[]) => Promise<BondsData[]>;
1
+ export declare const getBonusWithFee: (feeInPayout: number, tierBoostRate: number, trueBillPrice: string, lpPrice: number, earnTokenPrice: number) => number;
2
+ export declare const getRawBonus: (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => number;
3
+ export declare const getRawDiscount: (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => number;
4
+ export declare const getDiscountWithFee: (feeInPayout: number, tierBoostRate: number, trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => number;
@@ -1,109 +1,6 @@
1
- import { ChainId, BillVersion } from '@ape.swap/apeswap-lists';
2
- import { apiGet } from '../../../utils/httpClient.js';
3
1
  import { getBalanceNumber } from '../../../utils/getBalanceNumber.js';
4
- import { calculateTrueBondPrice } from '../../../utils/calculateSolanaTrueBillPrice.js';
5
- import { TIER_MAPPING } from '../../tiers/useTierPoints.js';
6
- import { formatUnits, mulDivRound, parseUnits } from '../../../utils/fixedPoint.js';
7
- import { PRICE_API_URL } from '../../../config/constants/variables.js';
2
+ import { mulDivRound, parseUnits } from '../../../utils/fixedPoint.js';
8
3
 
9
- const cleanBillsData = async (billIds, chunkedBills, chainId, bills, tokenPrices) => {
10
- const data = await Promise.all(chunkedBills?.map(async (chunk, index) => {
11
- const bill = bills?.find((bill) => bill?.index === billIds[index]);
12
- let principalTokenPrice = tokenPrices?.find((tokenPrice) => tokenPrice?.tokenAddress?.toLowerCase() === bill?.lpToken?.address?.[bill?.chainId]?.toLowerCase() &&
13
- tokenPrice?.chainId === chainId);
14
- if (principalTokenPrice === undefined || !!principalTokenPrice.error) {
15
- try {
16
- // Missing token price, therefor make a single call to api to fetch it
17
- const price = await apiGet(`${PRICE_API_URL}/realtime/price?token=${bill?.lpToken?.address?.[bill?.chainId]}&chain=${bill?.chainId}`);
18
- console.log('Individual call for: ', bill.lpToken.symbol, '. Price: ', price.price);
19
- principalTokenPrice = price;
20
- }
21
- catch {
22
- console.error('Failed to fetch price for: ', bill.lpToken.symbol);
23
- }
24
- }
25
- let payoutTokenPrice = tokenPrices?.find((tokenPrice) => tokenPrice?.tokenAddress?.toLowerCase() === bill?.earnToken?.address?.[bill?.chainId]?.toLowerCase() &&
26
- tokenPrice?.chainId === chainId);
27
- if (payoutTokenPrice === undefined || !!payoutTokenPrice.error) {
28
- try {
29
- // Missing token price, therefor make a single call to api to fetch it
30
- const price = await apiGet(`${PRICE_API_URL}/realtime/price?token=${bill?.earnToken?.address?.[bill?.chainId]}&chain=${bill?.chainId}`);
31
- console.log('Individual call for: ', bill.earnToken.symbol, '. Price: ', price.price);
32
- payoutTokenPrice = price;
33
- }
34
- catch {
35
- console.error('Failed to fetch price for: ', bill.earnToken.symbol);
36
- }
37
- }
38
- const lpPrice = principalTokenPrice?.price ?? 0;
39
- const earnTokenPrice = payoutTokenPrice?.price ?? 0;
40
- const [trueBillPriceFromChunk, totalPayoutGiven, terms, maxTotalPayout, feeInPayoutRaw, feeInPrincipalRaw, paused, , customTreasuryBalance, bondPricing, bondTerms,] = chunk;
41
- let trueBillPrice = trueBillPriceFromChunk;
42
- const feeInPayout = Number(feeInPayoutRaw / 10000);
43
- const feeInPrincipal = Number(feeInPrincipalRaw / 10000);
44
- const tierBoostRate = bill.tierBoostRate === undefined ? 1 : bill.tierBoostRate;
45
- const [, vestingTerm, , maxPayout] = terms;
46
- const tokensRemaining = Number(formatUnits(BigInt(maxTotalPayout ?? '0') - BigInt(totalPayoutGiven), bill?.earnToken.decimals[bill?.chainId] ?? 18));
47
- const treasuryBalance = customTreasuryBalance
48
- ? getBalanceNumber(customTreasuryBalance, bill?.earnToken?.decimals?.[bill?.chainId] ?? 18)
49
- : null;
50
- if (chainId === ChainId.SOL) {
51
- const principalDecimals = bill?.lpToken.decimals[ChainId.SOL];
52
- const payoutDecimals = bill?.earnToken.decimals[ChainId.SOL];
53
- const timeStamp = Math.floor(Date.now() / 1000);
54
- trueBillPrice = calculateTrueBondPrice(bondPricing, bondTerms, timeStamp, principalDecimals, payoutDecimals, feeInPrincipal);
55
- }
56
- let trueBondPrices = [];
57
- if (bill?.billVersion === BillVersion.V4) {
58
- trueBondPrices = trueBillPrice[0].map((data) => {
59
- return {
60
- points: data?.points?.toString(),
61
- trueBondPrice: data?.trueBondPrice.toString(),
62
- discount: getRawDiscount(data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
63
- bonus: getRawBonus(data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
64
- discountWithFee: getDiscountWithFee(feeInPayout, tierBoostRate, data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
65
- bonusWithFee: getBonusWithFee(feeInPayout, tierBoostRate, data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
66
- boost: TIER_MAPPING[data?.points?.toString()],
67
- };
68
- });
69
- }
70
- else {
71
- const bonus = getRawBonus(trueBillPrice, lpPrice, earnTokenPrice);
72
- const bonusWithFee = getBonusWithFee(feeInPayout, tierBoostRate, trueBillPrice, lpPrice, earnTokenPrice);
73
- const discount = getRawDiscount(trueBillPrice, lpPrice, earnTokenPrice);
74
- const discountWithFee = getDiscountWithFee(feeInPayout, tierBoostRate, trueBillPrice, lpPrice, earnTokenPrice);
75
- trueBondPrices = [
76
- {
77
- points: '0',
78
- boost: 0,
79
- trueBondPrice: trueBillPrice.toString(),
80
- bonus,
81
- bonusWithFee,
82
- discount,
83
- discountWithFee,
84
- },
85
- ];
86
- }
87
- const cleanedData = {
88
- ...bill,
89
- soldOut: paused[0] ? true : bill.soldOut,
90
- feeInPayout,
91
- feeInPrincipal,
92
- showcaseTokenName: bill?.showcaseToken?.symbol ?? bill?.earnToken.symbol ?? '',
93
- trueBondPrices,
94
- principalTokenPrice: lpPrice?.toString(),
95
- payoutTokenPrice: earnTokenPrice?.toString(),
96
- tokensRemaining: treasuryBalance !== null ? Math.min(treasuryBalance, tokensRemaining).toString() : tokensRemaining.toString(),
97
- maxTotalPayout: maxTotalPayout?.toString(),
98
- maxPayout: maxPayout?.toString(),
99
- totalPayoutGiven: totalPayoutGiven?.toString(),
100
- vestingTerm: typeof vestingTerm === 'number' ? vestingTerm : parseInt(vestingTerm),
101
- tierBoostRate: bill.tierBoostRate === undefined ? 1 : bill.tierBoostRate,
102
- };
103
- return cleanedData;
104
- }));
105
- return data;
106
- };
107
4
  // Scale used to carry percentage ratios (tier boost, reverse fee) into integer math
108
5
  // alongside the wei-scale `trueBillPrice`, so the huge integer never round-trips through
109
6
  // a JS float before the final getBalanceNumber() conversion.
@@ -138,5 +35,5 @@ const getDiscountWithFee = (feeInPayout, tierBoostRate, trueBillPrice, lpPrice,
138
35
  return discountToReturn;
139
36
  };
140
37
 
141
- export { cleanBillsData };
38
+ export { getBonusWithFee, getDiscountWithFee, getRawBonus, getRawDiscount };
142
39
  //# sourceMappingURL=cleanBillsData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanBillsData.js","sources":["../../../../src/state/bonds/fetchBondsData/cleanBillsData.ts"],"sourcesContent":["import { BillsConfig, BillVersion, ChainId } from '@ape.swap/apeswap-lists'\nimport { TokenPrices } from '../../tokenPrices/useTokenPrices'\nimport { BondsData, TrueBondPrices } from '../../../types/bonds'\nimport { apiGet } from '../../../utils/httpClient'\nimport { getBalanceNumber } from '../../../utils/getBalanceNumber'\nimport { calculateTrueBondPrice } from '../../../utils/calculateSolanaTrueBillPrice'\nimport { TIER_MAPPING } from '../../tiers/useTierPoints'\nimport { formatUnits, mulDivRound, parseUnits } from '../../../utils/fixedPoint'\nimport { PRICE_API_URL } from '../../../config/constants/variables'\n\nexport const cleanBillsData = async (\n billIds: number[],\n chunkedBills: any[],\n chainId: ChainId,\n bills: BillsConfig[],\n tokenPrices?: TokenPrices[],\n): Promise<BondsData[]> => {\n const data: BondsData[] = await Promise.all(\n chunkedBills?.map(async (chunk, index) => {\n const bill = bills?.find((bill) => bill?.index === billIds[index]) as BillsConfig\n\n let principalTokenPrice = tokenPrices?.find(\n (tokenPrice) =>\n tokenPrice?.tokenAddress?.toLowerCase() === bill?.lpToken?.address?.[bill?.chainId]?.toLowerCase() &&\n tokenPrice?.chainId === chainId,\n )\n\n if (principalTokenPrice === undefined || !!principalTokenPrice.error) {\n try {\n // Missing token price, therefor make a single call to api to fetch it\n const price = await apiGet<TokenPrices>(\n `${PRICE_API_URL}/realtime/price?token=${bill?.lpToken?.address?.[bill?.chainId]}&chain=${bill?.chainId}`,\n )\n console.log('Individual call for: ', bill.lpToken.symbol, '. Price: ', price.price)\n principalTokenPrice = price\n } catch {\n console.error('Failed to fetch price for: ', bill.lpToken.symbol)\n }\n }\n\n let payoutTokenPrice = tokenPrices?.find(\n (tokenPrice) =>\n tokenPrice?.tokenAddress?.toLowerCase() === bill?.earnToken?.address?.[bill?.chainId]?.toLowerCase() &&\n tokenPrice?.chainId === chainId,\n )\n\n if (payoutTokenPrice === undefined || !!payoutTokenPrice.error) {\n try {\n // Missing token price, therefor make a single call to api to fetch it\n const price = await apiGet<TokenPrices>(\n `${PRICE_API_URL}/realtime/price?token=${bill?.earnToken?.address?.[bill?.chainId]}&chain=${bill?.chainId}`,\n )\n console.log('Individual call for: ', bill.earnToken.symbol, '. Price: ', price.price)\n payoutTokenPrice = price\n } catch {\n console.error('Failed to fetch price for: ', bill.earnToken.symbol)\n }\n }\n const lpPrice = principalTokenPrice?.price ?? 0\n const earnTokenPrice = payoutTokenPrice?.price ?? 0\n\n const [\n trueBillPriceFromChunk,\n totalPayoutGiven,\n terms,\n maxTotalPayout,\n feeInPayoutRaw,\n feeInPrincipalRaw,\n paused,\n ,\n customTreasuryBalance,\n bondPricing,\n bondTerms,\n ] = chunk\n let trueBillPrice = trueBillPriceFromChunk\n\n const feeInPayout = Number(feeInPayoutRaw / 10000)\n const feeInPrincipal = Number(feeInPrincipalRaw / 10000)\n const tierBoostRate = bill.tierBoostRate === undefined ? 1 : bill.tierBoostRate\n const [, vestingTerm, , maxPayout] = terms\n const tokensRemaining = Number(\n formatUnits(\n BigInt(maxTotalPayout ?? '0') - BigInt(totalPayoutGiven),\n bill?.earnToken.decimals[bill?.chainId] ?? 18,\n ),\n )\n const treasuryBalance = customTreasuryBalance\n ? getBalanceNumber(customTreasuryBalance, bill?.earnToken?.decimals?.[bill?.chainId] ?? 18)\n : null\n\n if (chainId === ChainId.SOL) {\n const principalDecimals = bill?.lpToken.decimals[ChainId.SOL] as number\n const payoutDecimals = bill?.earnToken.decimals[ChainId.SOL] as number\n const timeStamp = Math.floor(Date.now() / 1000)\n trueBillPrice = calculateTrueBondPrice(\n bondPricing,\n bondTerms,\n timeStamp,\n principalDecimals,\n payoutDecimals,\n feeInPrincipal,\n )\n }\n\n let trueBondPrices: TrueBondPrices[] = []\n if (bill?.billVersion === BillVersion.V4) {\n trueBondPrices = trueBillPrice[0].map((data: any) => {\n return {\n points: data?.points?.toString(),\n trueBondPrice: data?.trueBondPrice.toString(),\n discount: getRawDiscount(data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),\n bonus: getRawBonus(data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),\n discountWithFee: getDiscountWithFee(\n feeInPayout,\n tierBoostRate,\n data?.trueBondPrice.toString(),\n lpPrice,\n earnTokenPrice,\n ),\n bonusWithFee: getBonusWithFee(\n feeInPayout,\n tierBoostRate,\n data?.trueBondPrice.toString(),\n lpPrice,\n earnTokenPrice,\n ),\n boost: TIER_MAPPING[data?.points?.toString() as keyof typeof TIER_MAPPING],\n }\n })\n } else {\n const bonus = getRawBonus(trueBillPrice, lpPrice, earnTokenPrice)\n const bonusWithFee = getBonusWithFee(feeInPayout, tierBoostRate, trueBillPrice, lpPrice, earnTokenPrice)\n const discount = getRawDiscount(trueBillPrice, lpPrice, earnTokenPrice)\n const discountWithFee = getDiscountWithFee(feeInPayout, tierBoostRate, trueBillPrice, lpPrice, earnTokenPrice)\n trueBondPrices = [\n {\n points: '0',\n boost: 0,\n trueBondPrice: trueBillPrice.toString(),\n bonus,\n bonusWithFee,\n discount,\n discountWithFee,\n },\n ]\n }\n const cleanedData: BondsData = {\n ...bill,\n soldOut: paused[0] ? true : bill.soldOut,\n feeInPayout,\n feeInPrincipal,\n showcaseTokenName: bill?.showcaseToken?.symbol ?? bill?.earnToken.symbol ?? '',\n trueBondPrices,\n principalTokenPrice: lpPrice?.toString(),\n payoutTokenPrice: earnTokenPrice?.toString(),\n tokensRemaining:\n treasuryBalance !== null ? Math.min(treasuryBalance, tokensRemaining).toString() : tokensRemaining.toString(),\n maxTotalPayout: maxTotalPayout?.toString(),\n maxPayout: maxPayout?.toString(),\n totalPayoutGiven: totalPayoutGiven?.toString(),\n vestingTerm: typeof vestingTerm === 'number' ? vestingTerm : parseInt(vestingTerm),\n tierBoostRate: bill.tierBoostRate === undefined ? 1 : bill.tierBoostRate,\n }\n return cleanedData\n }),\n )\n return data\n}\n\n// Scale used to carry percentage ratios (tier boost, reverse fee) into integer math\n// alongside the wei-scale `trueBillPrice`, so the huge integer never round-trips through\n// a JS float before the final getBalanceNumber() conversion.\nconst RATIO_SCALE = 1_000_000_000_000n // 1e12\nconst scaleRatio = (ratio: number): bigint => parseUnits(ratio.toString(), 12)\n\nconst getBonusWithFee = (\n feeInPayout: number,\n tierBoostRate: number,\n trueBillPrice: string,\n lpPrice: number,\n earnTokenPrice: number,\n) => {\n const fee = feeInPayout ?? 0\n const reverseFee = fee / 100 / (1 - fee / 100)\n const trueBillPriceBig = BigInt(trueBillPrice)\n const tierAdjusted = mulDivRound(trueBillPriceBig, scaleRatio((100 + tierBoostRate) / 100), RATIO_SCALE)\n const feeAdjusted = mulDivRound(trueBillPriceBig, scaleRatio(reverseFee), RATIO_SCALE)\n const trueBondPrice = tierAdjusted + feeAdjusted\n const priceUSDMinusFee = getBalanceNumber(trueBondPrice) * lpPrice\n const bonusWithoutFee = ((earnTokenPrice - priceUSDMinusFee) / earnTokenPrice) * 100\n const validatedBonus = bonusWithoutFee > 0 ? (bonusWithoutFee / (100 - bonusWithoutFee)) * 100 : 0\n return validatedBonus\n}\n\nconst getRawBonus = (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => {\n const priceUsd = getBalanceNumber(trueBillPrice.toString()) * lpPrice\n const discount: number = ((earnTokenPrice - priceUsd) / earnTokenPrice) * 100\n return discount > 0 ? (discount / (100 - discount)) * 100 : 0\n}\n\nconst getRawDiscount = (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => {\n const trueBondPrice = getBalanceNumber(trueBillPrice.toString())\n\n return ((earnTokenPrice - lpPrice * trueBondPrice) / earnTokenPrice) * 100\n}\n\nconst getDiscountWithFee = (\n feeInPayout: number,\n tierBoostRate: number,\n trueBillPrice: any,\n lpPrice: number,\n earnTokenPrice: number,\n) => {\n const trueBondPrice = getBalanceNumber(trueBillPrice.toString())\n const trueBondPriceWithFee = trueBondPrice * (1 / ((100 - (feeInPayout ?? 0)) / 100))\n const discount = ((earnTokenPrice - lpPrice * trueBondPriceWithFee) / earnTokenPrice) * 100\n const discountToReturn = 100 - ((100 - discount) / (100 - tierBoostRate)) * 100\n return discountToReturn\n}\n"],"names":[],"mappings":";;;;;;;;AAUO,MAAM,cAAc,GAAG,OAC5B,OAAiB,EACjB,YAAmB,EACnB,OAAgB,EAChB,KAAoB,EACpB,WAA2B,KACH;AACxB,IAAA,MAAM,IAAI,GAAgB,MAAM,OAAO,CAAC,GAAG,CACzC,YAAY,EAAE,GAAG,CAAC,OAAO,KAAK,EAAE,KAAK,KAAI;QACvC,MAAM,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,KAAK,CAAC,CAAgB;AAEjF,QAAA,IAAI,mBAAmB,GAAG,WAAW,EAAE,IAAI,CAC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AAG,GAAG,QAAQ,KAAK,GAAG,GAAG,aAAa,CAAC,IAAI,GAAG;AAC/E,IAAA,OAAO,gBAAgB;AACzB,CAAC;;;;"}
1
+ {"version":3,"file":"cleanBillsData.js","sources":["../../../../src/state/bonds/fetchBondsData/cleanBillsData.ts"],"sourcesContent":["import { getBalanceNumber } from '../../../utils/getBalanceNumber'\nimport { mulDivRound, parseUnits } from '../../../utils/fixedPoint'\n\n// Scale used to carry percentage ratios (tier boost, reverse fee) into integer math\n// alongside the wei-scale `trueBillPrice`, so the huge integer never round-trips through\n// a JS float before the final getBalanceNumber() conversion.\nconst RATIO_SCALE = 1_000_000_000_000n // 1e12\nconst scaleRatio = (ratio: number): bigint => parseUnits(ratio.toString(), 12)\n\nexport const getBonusWithFee = (\n feeInPayout: number,\n tierBoostRate: number,\n trueBillPrice: string,\n lpPrice: number,\n earnTokenPrice: number,\n) => {\n const fee = feeInPayout ?? 0\n const reverseFee = fee / 100 / (1 - fee / 100)\n const trueBillPriceBig = BigInt(trueBillPrice)\n const tierAdjusted = mulDivRound(trueBillPriceBig, scaleRatio((100 + tierBoostRate) / 100), RATIO_SCALE)\n const feeAdjusted = mulDivRound(trueBillPriceBig, scaleRatio(reverseFee), RATIO_SCALE)\n const trueBondPrice = tierAdjusted + feeAdjusted\n const priceUSDMinusFee = getBalanceNumber(trueBondPrice) * lpPrice\n const bonusWithoutFee = ((earnTokenPrice - priceUSDMinusFee) / earnTokenPrice) * 100\n const validatedBonus = bonusWithoutFee > 0 ? (bonusWithoutFee / (100 - bonusWithoutFee)) * 100 : 0\n return validatedBonus\n}\n\nexport const getRawBonus = (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => {\n const priceUsd = getBalanceNumber(trueBillPrice.toString()) * lpPrice\n const discount: number = ((earnTokenPrice - priceUsd) / earnTokenPrice) * 100\n return discount > 0 ? (discount / (100 - discount)) * 100 : 0\n}\n\nexport const getRawDiscount = (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => {\n const trueBondPrice = getBalanceNumber(trueBillPrice.toString())\n\n return ((earnTokenPrice - lpPrice * trueBondPrice) / earnTokenPrice) * 100\n}\n\nexport const getDiscountWithFee = (\n feeInPayout: number,\n tierBoostRate: number,\n trueBillPrice: any,\n lpPrice: number,\n earnTokenPrice: number,\n) => {\n const trueBondPrice = getBalanceNumber(trueBillPrice.toString())\n const trueBondPriceWithFee = trueBondPrice * (1 / ((100 - (feeInPayout ?? 0)) / 100))\n const discount = ((earnTokenPrice - lpPrice * trueBondPriceWithFee) / earnTokenPrice) * 100\n const discountToReturn = 100 - ((100 - discount) / (100 - tierBoostRate)) * 100\n return discountToReturn\n}\n"],"names":[],"mappings":";;;AAGA;AACA;AACA;AACA,MAAM,WAAW,GAAG,cAAkB,CAAA;AACtC,MAAM,UAAU,GAAG,CAAC,KAAa,KAAa,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC;AAEvE,MAAM,eAAe,GAAG,CAC7B,WAAmB,EACnB,aAAqB,EACrB,aAAqB,EACrB,OAAe,EACf,cAAsB,KACpB;AACF,IAAA,MAAM,GAAG,GAAG,WAAW,IAAI,CAAC;AAC5B,IAAA,MAAM,UAAU,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC;AAC9C,IAAA,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC;AAC9C,IAAA,MAAM,YAAY,GAAG,WAAW,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,GAAG,GAAG,aAAa,IAAI,GAAG,CAAC,EAAE,WAAW,CAAC;AACxG,IAAA,MAAM,WAAW,GAAG,WAAW,CAAC,gBAAgB,EAAE,UAAU,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC;AACtF,IAAA,MAAM,aAAa,GAAG,YAAY,GAAG,WAAW;IAChD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,aAAa,CAAC,GAAG,OAAO;AAClE,IAAA,MAAM,eAAe,GA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G,GAAG,QAAQ,KAAK,GAAG,GAAG,aAAa,CAAC,IAAI,GAAG;AAC/E,IAAA,OAAO,gBAAgB;AACzB;;;;"}
@@ -1,8 +1,7 @@
1
1
  import { ChainId } from '@ape.swap/apeswap-lists';
2
+ import { resolveBondTokenPrices } from '../../tokenPrices/resolveTokenPrice.js';
2
3
  import { readAptosMarketInfo } from '../../../utils/aptosHelpers.js';
3
4
  import { formatUnits } from '../../../utils/fixedPoint.js';
4
- import { apiGet } from '../../../utils/httpClient.js';
5
- import { PRICE_API_URL } from '../../../config/constants/variables.js';
6
5
 
7
6
  // =============================================================================
8
7
  // Aptos bond enrichment — builds BondsData[] from BillsConfig[] + prices
@@ -30,30 +29,8 @@ const fetchBondsDataAptos = async (bonds, aptosPrices) => {
30
29
  return null;
31
30
  try {
32
31
  // Firstly we fetch prices
33
- let principalPrice = aptosPrices?.find((t) => t.tokenAddress.toLowerCase() === principalAddr)?.price;
34
- if (principalPrice === undefined) {
35
- try {
36
- const res = await apiGet(`${PRICE_API_URL}/realtime/price?token=${bond?.lpToken?.address?.[bond?.chainId]}&chain=${bond?.chainId}`);
37
- principalPrice = res.price ?? 0;
38
- }
39
- catch {
40
- principalPrice = 0;
41
- }
42
- }
43
- let payoutPrice = aptosPrices?.find((t) => t.tokenAddress.toLowerCase() === payoutAddr)?.price;
44
- if (payoutPrice === undefined) {
45
- try {
46
- // Missing token price, therefor make a single call to api to fetch it
47
- const res = await apiGet(`${PRICE_API_URL}/realtime/price?token=${bond?.earnToken?.address?.[bond?.chainId]}&chain=${bond?.chainId}`);
48
- payoutPrice = res.price ?? 0;
49
- }
50
- catch {
51
- payoutPrice = 0;
52
- }
53
- }
32
+ const { lpPrice: principalPrice, earnTokenPrice: payoutPrice } = await resolveBondTokenPrices(bond, aptosPrices);
54
33
  const info = await readAptosMarketInfo(marketAddr);
55
- const principalAddr = bond.lpToken.address[APTOS_KEY]?.toLowerCase();
56
- const payoutAddr = bond.earnToken.address[APTOS_KEY]?.toLowerCase();
57
34
  // Convert on-chain u64 (scaled 1e8) to the SDK's legacy 1e18 scale
58
35
  const trueBillPriceU64 = info[17];
59
36
  const trueBondPriceScaled = (BigInt(trueBillPriceU64) * 10n ** 10n).toString();
@@ -1 +1 @@
1
- {"version":3,"file":"fetchBondsDataAptos.js","sources":["../../../../src/state/bonds/fetchBondsData/fetchBondsDataAptos.ts"],"sourcesContent":["// =============================================================================\n// Aptos bond enrichment — builds BondsData[] from BillsConfig[] + prices\n// =============================================================================\n//\n// On-chain first: reads bond::market_info via view function for each config\n// and projects the tuple onto BondsData. No backend dependency (realtime-api\n// does not support Aptos).\n\nimport { BillsConfig, ChainId } from '@ape.swap/apeswap-lists'\nimport { BondsData } from '../../../types/bonds'\nimport { TokenPrices } from '../../tokenPrices/useTokenPrices'\nimport { readAptosMarketInfo } from '../../../utils/aptosHelpers'\nimport { formatUnits } from '../../../utils/fixedPoint'\nimport { apiGet } from '../../../utils/httpClient'\nimport { PRICE_API_URL } from '../../../config/constants/variables'\n\nconst APTOS_KEY = ChainId.APTOS\n\n/**\n * Enrich Aptos bond configs into full BondsData objects.\n *\n * Calls `bond::market_info(market)` for each config and projects the tuple\n * onto BondsData. Scale conversion: contract returns `true_bill_price` as u64\n * scaled by PRICE_DECIMALS = 1e8; the SDK stores `trueBondPrice` scaled by\n * 1e18 (legacy EVM format) → multiply by 1e10.\n */\nexport const fetchBondsDataAptos = async (bonds?: BillsConfig[], aptosPrices?: TokenPrices[]): Promise<BondsData[]> => {\n const aptosConfigs = bonds?.filter((b) => !b.soldOut)\n if (!aptosConfigs || aptosConfigs?.length === 0) return []\n\n const enriched = await Promise.all(\n aptosConfigs.map(async (bond): Promise<BondsData | null> => {\n const marketAddr = bond.contractAddress[APTOS_KEY]\n if (!marketAddr) return null\n try {\n // Firstly we fetch prices\n let principalPrice = aptosPrices?.find((t) => t.tokenAddress.toLowerCase() === principalAddr)?.price!\n if (principalPrice === undefined) {\n try {\n const res = await apiGet<{ price: number }>(\n `${PRICE_API_URL}/realtime/price?token=${bond?.lpToken?.address?.[bond?.chainId]}&chain=${bond?.chainId}`,\n )\n principalPrice = res.price ?? 0\n } catch {\n principalPrice = 0\n }\n }\n\n let payoutPrice = aptosPrices?.find((t) => t.tokenAddress.toLowerCase() === payoutAddr)?.price!\n if (payoutPrice === undefined) {\n try {\n // Missing token price, therefor make a single call to api to fetch it\n const res = await apiGet<{ price: number }>(\n `${PRICE_API_URL}/realtime/price?token=${bond?.earnToken?.address?.[bond?.chainId]}&chain=${bond?.chainId}`,\n )\n payoutPrice = res.price ?? 0\n } catch {\n payoutPrice = 0\n }\n }\n\n const info = await readAptosMarketInfo(marketAddr)\n const principalAddr = bond.lpToken.address[APTOS_KEY]?.toLowerCase()\n const payoutAddr = bond.earnToken.address[APTOS_KEY]?.toLowerCase()\n\n // Convert on-chain u64 (scaled 1e8) to the SDK's legacy 1e18 scale\n const trueBillPriceU64 = info[17]\n const trueBondPriceScaled = (BigInt(trueBillPriceU64) * 10n ** 10n).toString()\n const trueBondPriceHuman = Number(trueBillPriceU64) / 1e8\n\n // Same formula as getRawDiscount / getRawBonus in state/bonds/utils.ts\n const discount = payoutPrice > 0 ? ((payoutPrice - principalPrice * trueBondPriceHuman) / payoutPrice) * 100 : 0\n const bonus = discount > 0 && discount < 100 ? (discount / (100 - discount)) * 100 : 0\n\n // Fees: u64 in PERCENTAGE_BASE (1e6) → divide by 10_000 for human %\n const feeInPayout = Number(info[14]) / 10_000\n const feeInPrincipal = Number(info[13]) / 10_000\n const trueBondPriceWithFee =\n feeInPayout < 100 ? trueBondPriceHuman * (1 / ((100 - feeInPayout) / 100)) : trueBondPriceHuman\n const discountWithFee =\n payoutPrice > 0 ? ((payoutPrice - principalPrice * trueBondPriceWithFee) / payoutPrice) * 100 : 0\n const bonusWithFee =\n discountWithFee > 0 && discountWithFee < 100 ? (discountWithFee / (100 - discountWithFee)) * 100 : 0\n\n const payoutDecimals = bond.earnToken.decimals[APTOS_KEY] ?? 8\n const tokensRemaining = formatUnits(BigInt(info[23]) - BigInt(info[5]), payoutDecimals)\n\n return {\n ...bond,\n soldOut: info[2] || info[3] ? true : bond.soldOut,\n maxTotalPayout: String(info[23]),\n totalPayoutGiven: String(info[5]),\n maxPayout: String(info[21]),\n tokensRemaining,\n showcaseTokenName: bond.earnToken.symbol,\n vestingTerm: Number(info[19]),\n feeInPayout,\n feeInPrincipal,\n trueBondPrices: [\n {\n trueBondPrice: trueBondPriceScaled,\n points: '0',\n discount,\n discountWithFee,\n bonus,\n bonusWithFee,\n boost: 0,\n },\n ],\n principalTokenPrice: principalPrice.toString(),\n payoutTokenPrice: payoutPrice.toString(),\n }\n } catch (e) {\n console.warn(`[Aptos] Failed to read market_info for ${marketAddr}`, e)\n // Hide the bond from the list when on-chain data is unavailable —\n // showing a card with all zeros is confusing for users.\n return null\n }\n }),\n )\n return enriched.filter((b): b is BondsData => b !== null)\n}\n"],"names":[],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK;AAE/B;;;;;;;AAOG;AACI,MAAM,mBAAmB,GAAG,OAAO,KAAqB,EAAE,WAA2B,KAA0B;AACpH,IAAA,MAAM,YAAY,GAAG,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;AACrD,IAAA,IAAI,CAAC,YAAY,IAAI,YAAY,EAAE,MAAM,KAAK,CAAC;AAAE,QAAA,OAAO,EAAE;AAE1D,IAAA,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,YAAY,CAAC,GAAG,CAAC,OAAO,IAAI,KAA+B;QACzD,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC;AAClD,QAAA,IAAI,CAAC,UAAU;AAAE,YAAA,OAAO,IAAI;AAC5B,QAAA,IAAI;;YAEF,IAAI,cAAc,GAAG,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,KAA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ts"],"sourcesContent":["// =============================================================================\n// Aptos bond enrichment — builds BondsData[] from BillsConfig[] + prices\n// =============================================================================\n//\n// On-chain first: reads bond::market_info via view function for each config\n// and projects the tuple onto BondsData. No backend dependency (realtime-api\n// does not support Aptos).\n\nimport { BillsConfig, ChainId } from '@ape.swap/apeswap-lists'\nimport { BondsData } from '../../../types/bonds'\nimport { TokenPrices } from '../../tokenPrices/useTokenPrices'\nimport { resolveBondTokenPrices } from '../../tokenPrices/resolveTokenPrice'\nimport { readAptosMarketInfo } from '../../../utils/aptosHelpers'\nimport { formatUnits } from '../../../utils/fixedPoint'\n\nconst APTOS_KEY = ChainId.APTOS\n\n/**\n * Enrich Aptos bond configs into full BondsData objects.\n *\n * Calls `bond::market_info(market)` for each config and projects the tuple\n * onto BondsData. Scale conversion: contract returns `true_bill_price` as u64\n * scaled by PRICE_DECIMALS = 1e8; the SDK stores `trueBondPrice` scaled by\n * 1e18 (legacy EVM format) → multiply by 1e10.\n */\nexport const fetchBondsDataAptos = async (bonds?: BillsConfig[], aptosPrices?: TokenPrices[]): Promise<BondsData[]> => {\n const aptosConfigs = bonds?.filter((b) => !b.soldOut)\n if (!aptosConfigs || aptosConfigs?.length === 0) return []\n\n const enriched = await Promise.all(\n aptosConfigs.map(async (bond): Promise<BondsData | null> => {\n const marketAddr = bond.contractAddress[APTOS_KEY]\n if (!marketAddr) return null\n try {\n // Firstly we fetch prices\n const { lpPrice: principalPrice, earnTokenPrice: payoutPrice } = await resolveBondTokenPrices(bond, aptosPrices)\n\n const info = await readAptosMarketInfo(marketAddr)\n\n // Convert on-chain u64 (scaled 1e8) to the SDK's legacy 1e18 scale\n const trueBillPriceU64 = info[17]\n const trueBondPriceScaled = (BigInt(trueBillPriceU64) * 10n ** 10n).toString()\n const trueBondPriceHuman = Number(trueBillPriceU64) / 1e8\n\n // Same formula as getRawDiscount / getRawBonus in state/bonds/utils.ts\n const discount = payoutPrice > 0 ? ((payoutPrice - principalPrice * trueBondPriceHuman) / payoutPrice) * 100 : 0\n const bonus = discount > 0 && discount < 100 ? (discount / (100 - discount)) * 100 : 0\n\n // Fees: u64 in PERCENTAGE_BASE (1e6) → divide by 10_000 for human %\n const feeInPayout = Number(info[14]) / 10_000\n const feeInPrincipal = Number(info[13]) / 10_000\n const trueBondPriceWithFee =\n feeInPayout < 100 ? trueBondPriceHuman * (1 / ((100 - feeInPayout) / 100)) : trueBondPriceHuman\n const discountWithFee =\n payoutPrice > 0 ? ((payoutPrice - principalPrice * trueBondPriceWithFee) / payoutPrice) * 100 : 0\n const bonusWithFee =\n discountWithFee > 0 && discountWithFee < 100 ? (discountWithFee / (100 - discountWithFee)) * 100 : 0\n\n const payoutDecimals = bond.earnToken.decimals[APTOS_KEY] ?? 8\n const tokensRemaining = formatUnits(BigInt(info[23]) - BigInt(info[5]), payoutDecimals)\n\n return {\n ...bond,\n soldOut: info[2] || info[3] ? true : bond.soldOut,\n maxTotalPayout: String(info[23]),\n totalPayoutGiven: String(info[5]),\n maxPayout: String(info[21]),\n tokensRemaining,\n showcaseTokenName: bond.earnToken.symbol,\n vestingTerm: Number(info[19]),\n feeInPayout,\n feeInPrincipal,\n trueBondPrices: [\n {\n trueBondPrice: trueBondPriceScaled,\n points: '0',\n discount,\n discountWithFee,\n bonus,\n bonusWithFee,\n boost: 0,\n },\n ],\n principalTokenPrice: principalPrice.toString(),\n payoutTokenPrice: payoutPrice.toString(),\n }\n } catch (e) {\n console.warn(`[Aptos] Failed to read market_info for ${marketAddr}`, e)\n // Hide the bond from the list when on-chain data is unavailable —\n // showing a card with all zeros is confusing for users.\n return null\n }\n }),\n )\n return enriched.filter((b): b is BondsData => b !== null)\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AASA,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK;AAE/B;;;;;;;AAOG;AACI,MAAM,mBAAmB,GAAG,OAAO,KAAqB,EAAE,WAA2B,KAA0B;AACpH,IAAA,MAAM,YAAY,GAAG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E,wBAAA,aAAa,EAAE,mBAAmB;AAClC,wBAAA,MAAM,EAAE,GAAG;wBACX,QAAQ;wBACR,eAAe;wBACf,KAAK;wBACL,YAAY;AACZ,wBAAA,KAAK,EAAE,CAAC;AACT,qBAAA;AACF,iBAAA;AACD,gBAAA,mBAAmB,EAAE,cAAc,CAAC,QAAQ,EAAE;AAC9C,gBAAA,gBAAgB,EAAE,WAAW,CAAC,QAAQ,EAAE;aACzC;QACH;QAAE,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,CAAA,uCAAA,EAA0C,UAAU,CAAA,CAAE,EAAE,CAAC,CAAC;;;AAGvE,YAAA,OAAO,IAAI;QACb;IACF,CAAC,CAAC,CACH;AACD,IAAA,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,KAAqB,CAAC,KAAK,IAAI,CAAC;AAC3D;;;;"}
@@ -1,3 +1,4 @@
1
1
  import { BillsConfig } from '@ape.swap/apeswap-lists';
2
2
  import { TokenPrices } from '../../tokenPrices/useTokenPrices';
3
- export declare const fetchBondsDataEVM: (chainId: number, bonds: BillsConfig[], apiUrl: string, tokenPrices?: TokenPrices[]) => Promise<import("../../../types/bonds").BondsData[]>;
3
+ import { BondsData } from '../../../types/bonds';
4
+ export declare const fetchBondsDataEVM: (chainId: number, bonds: BillsConfig[], apiUrl: string, tokenPrices?: TokenPrices[]) => Promise<BondsData[]>;
@@ -3,7 +3,11 @@ import multicall from '../../../utils/multicall.js';
3
3
  import BOND_ABI from '../../../config/abi/BOND_2_4_0.json.js';
4
4
  import erc20ABI from '../../../config/abi/erc20.json.js';
5
5
  import chunk from 'lodash-es/chunk.js';
6
- import { cleanBillsData } from './cleanBillsData.js';
6
+ import { getBonusWithFee, getDiscountWithFee, getRawBonus, getRawDiscount } from './cleanBillsData.js';
7
+ import { formatUnits } from '../../../utils/fixedPoint.js';
8
+ import { getBalanceNumber } from '../../../utils/getBalanceNumber.js';
9
+ import { TIER_MAPPING } from '../../tiers/useTierPoints.js';
10
+ import { resolveBondTokenPrices } from '../../tokenPrices/resolveTokenPrice.js';
7
11
 
8
12
  const fetchBondsDataEVM = async (chainId, bonds, apiUrl, tokenPrices) => {
9
13
  try {
@@ -49,7 +53,7 @@ const fetchBondsDataEVM = async (chainId, bonds, apiUrl, tokenPrices) => {
49
53
  });
50
54
  const vals = await multicall(chainId, BOND_ABI, billCalls);
51
55
  // The following lines basically grab the values from customTreasury returned from bills contract and then,
52
- // appends the treasury contract's balance to the chunk that will be passed to cleanBillsData
56
+ // appends the treasury contract's balance to each bill's chunk
53
57
  // appendIndex value assumes customTreasury will be at the end of the billCalls array
54
58
  const appendIndex = billCalls.length / bills.length;
55
59
  const treasuryAddresses = vals
@@ -72,7 +76,70 @@ const fetchBondsDataEVM = async (chainId, bonds, apiUrl, tokenPrices) => {
72
76
  }, []);
73
77
  const chunkSize = updatedVals?.length / bills?.length;
74
78
  const chunkedBills = chunk(updatedVals, chunkSize);
75
- return await cleanBillsData(billIds, chunkedBills, chainId, bills, tokenPrices);
79
+ return await Promise.all(chunkedBills?.map(async (chunk, index) => {
80
+ const bill = bills?.find((bill) => bill?.index === billIds[index]);
81
+ const { lpPrice, earnTokenPrice } = await resolveBondTokenPrices(bill, tokenPrices);
82
+ const [trueBillPriceFromChunk, totalPayoutGiven, terms, maxTotalPayout, feeInPayoutRaw, feeInPrincipalRaw, paused, , customTreasuryBalance,] = chunk;
83
+ const trueBillPrice = trueBillPriceFromChunk;
84
+ const feeInPayout = Number(feeInPayoutRaw / 10000);
85
+ const feeInPrincipal = Number(feeInPrincipalRaw / 10000);
86
+ const tierBoostRate = bill.tierBoostRate === undefined ? 1 : bill.tierBoostRate;
87
+ const [, vestingTerm, , maxPayout] = terms;
88
+ const tokensRemaining = Number(formatUnits(BigInt(maxTotalPayout ?? '0') - BigInt(totalPayoutGiven), bill?.earnToken.decimals[bill?.chainId] ?? 18));
89
+ const treasuryBalance = customTreasuryBalance
90
+ ? getBalanceNumber(customTreasuryBalance, bill?.earnToken?.decimals?.[bill?.chainId] ?? 18)
91
+ : null;
92
+ let trueBondPrices = [];
93
+ if (bill?.billVersion === BillVersion.V4) {
94
+ trueBondPrices = trueBillPrice[0].map((data) => {
95
+ return {
96
+ points: data?.points?.toString(),
97
+ trueBondPrice: data?.trueBondPrice.toString(),
98
+ discount: getRawDiscount(data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
99
+ bonus: getRawBonus(data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
100
+ discountWithFee: getDiscountWithFee(feeInPayout, tierBoostRate, data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
101
+ bonusWithFee: getBonusWithFee(feeInPayout, tierBoostRate, data?.trueBondPrice.toString(), lpPrice, earnTokenPrice),
102
+ boost: TIER_MAPPING[data?.points?.toString()],
103
+ };
104
+ });
105
+ }
106
+ else {
107
+ const bonus = getRawBonus(trueBillPrice, lpPrice, earnTokenPrice);
108
+ const bonusWithFee = getBonusWithFee(feeInPayout, tierBoostRate, trueBillPrice, lpPrice, earnTokenPrice);
109
+ const discount = getRawDiscount(trueBillPrice, lpPrice, earnTokenPrice);
110
+ const discountWithFee = getDiscountWithFee(feeInPayout, tierBoostRate, trueBillPrice, lpPrice, earnTokenPrice);
111
+ trueBondPrices = [
112
+ {
113
+ points: '0',
114
+ boost: 0,
115
+ trueBondPrice: trueBillPrice.toString(),
116
+ bonus,
117
+ bonusWithFee,
118
+ discount,
119
+ discountWithFee,
120
+ },
121
+ ];
122
+ }
123
+ const cleanedData = {
124
+ ...bill,
125
+ soldOut: paused[0] ? true : bill.soldOut,
126
+ feeInPayout,
127
+ feeInPrincipal,
128
+ showcaseTokenName: bill?.showcaseToken?.symbol ?? bill?.earnToken.symbol ?? '',
129
+ trueBondPrices,
130
+ principalTokenPrice: lpPrice?.toString(),
131
+ payoutTokenPrice: earnTokenPrice?.toString(),
132
+ tokensRemaining: treasuryBalance !== null
133
+ ? Math.min(treasuryBalance, tokensRemaining).toString()
134
+ : tokensRemaining.toString(),
135
+ maxTotalPayout: maxTotalPayout?.toString(),
136
+ maxPayout: maxPayout?.toString(),
137
+ totalPayoutGiven: totalPayoutGiven?.toString(),
138
+ vestingTerm: typeof vestingTerm === 'number' ? vestingTerm : parseInt(vestingTerm),
139
+ tierBoostRate: bill.tierBoostRate === undefined ? 1 : bill.tierBoostRate,
140
+ };
141
+ return cleanedData;
142
+ }));
76
143
  }
77
144
  catch (e) {
78
145
  console.error(e);