@ape.swap/bonds-sdk 1.0.779 → 1.1.0-seedify
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AccordionText/index.d.ts +9 -0
- package/dist/components/BondRows/BondRow.d.ts +3 -2
- package/dist/components/BondRows/BondRowHeader.d.ts +2 -3
- package/dist/components/BondRows/BondRowsByChain.d.ts +3 -3
- package/dist/components/BondRows/BondRowsWithTitle.d.ts +3 -3
- package/dist/components/DisconnectedPlaceholder/index.d.ts +3 -0
- package/dist/components/SlippageModal/index.d.ts +3 -0
- package/dist/components/TokenInfoAndName/index.d.ts +3 -2
- package/dist/components/TokenSelectorModal/TokenRow.d.ts +8 -0
- package/dist/components/TokenSelectorModal/index.d.ts +11 -0
- package/dist/components/TokenSelectorPanel/index.d.ts +15 -0
- package/dist/components/uikit-sdk/Modal/index.d.ts +1 -1
- package/dist/components/uikit-sdk/Toggle/index.d.ts +8 -0
- package/dist/components/uikit-sdk/Toggle/styles.d.ts +3 -0
- package/dist/components/uikit-sdk/TokenImage/index.d.ts +3 -2
- package/dist/components/uikit-sdk/index.d.ts +1 -0
- package/dist/config/abi/types/Banana.d.ts +103 -126
- package/dist/config/abi/types/Bond.d.ts +176 -221
- package/dist/config/abi/types/BondNft.d.ts +160 -207
- package/dist/config/abi/types/EnsPublicResolver.d.ts +129 -205
- package/dist/config/abi/types/EnsRegistrar.d.ts +62 -82
- package/dist/config/abi/types/Erc20.d.ts +40 -52
- package/dist/config/abi/types/Erc20_bytes32.d.ts +11 -11
- package/dist/config/abi/types/JungleChef.d.ts +64 -79
- package/dist/config/abi/types/LaunchBonds.d.ts +299 -355
- package/dist/config/abi/types/LensContract.d.ts +58 -77
- package/dist/config/abi/types/LockVeAbond.d.ts +328 -434
- package/dist/config/abi/types/MigrationBond.d.ts +268 -330
- package/dist/config/abi/types/MigrationFveAbond.d.ts +83 -89
- package/dist/config/abi/types/MiniComplexRewarder.d.ts +99 -145
- package/dist/config/abi/types/Multicallv2.d.ts +35 -46
- package/dist/config/abi/types/Multicallv3.d.ts +14 -14
- package/dist/config/abi/types/NonFungibleApes.d.ts +130 -170
- package/dist/config/abi/types/NonFungibleBananas.d.ts +135 -172
- package/dist/config/abi/types/PriceGetter.d.ts +218 -255
- package/dist/config/abi/types/PriceGetterLinea.d.ts +254 -287
- package/dist/config/abi/types/PriceGetterV2.d.ts +239 -276
- package/dist/config/abi/types/SousChef.d.ts +140 -177
- package/dist/config/abi/types/Treasury.d.ts +66 -69
- package/dist/config/abi/types/Weth.d.ts +53 -68
- package/dist/config/abi/types/Zap.d.ts +97 -141
- package/dist/config/abi/types/common.d.ts +3 -3
- package/dist/config/abi/types/factories/Banana__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/BondNft__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Bond__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/EnsPublicResolver__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/EnsRegistrar__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Erc20__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Erc20_bytes32__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/JungleChef__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/LaunchBonds__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/LensContract__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/LockVeAbond__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/MigrationBond__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/MigrationFveAbond__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/MiniComplexRewarder__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Multicallv2__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Multicallv3__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/NonFungibleApes__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/NonFungibleBananas__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/PriceGetterLinea__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/PriceGetterV2__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/PriceGetter__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/SousChef__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Treasury__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Weth__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/Zap__factory.d.ts +3 -3
- package/dist/config/abi/types/factories/index.d.ts +25 -25
- package/dist/config/abi/types/index.d.ts +51 -51
- package/dist/config/constants/addresses.d.ts +0 -8
- package/dist/config/constants/queryKeys.d.ts +10 -2
- package/dist/config/constants/tokens.d.ts +3 -6
- package/dist/config/constants/zapInputTokens.d.ts +2 -0
- package/dist/hooks/useTokenFromZapList.d.ts +3 -0
- package/dist/hooks/useTopThreeTags.d.ts +2 -2
- package/dist/main.d.ts +7 -0
- package/dist/main.js +73492 -0
- package/dist/providers/index.d.ts +0 -3
- package/dist/scss/AccordionText.scss +11 -0
- package/dist/scss/BondMenu.scss +2 -2
- package/dist/scss/BondModal.scss +305 -234
- package/dist/scss/BondRow.scss +5 -5
- package/dist/scss/BondRowHeader.scss +7 -7
- package/dist/scss/Bonds.scss +2 -1
- package/dist/scss/TokenInfoName.scss +60 -0
- package/dist/scss/YourBonds.scss +19 -14
- package/dist/scss/YourBondsModal.scss +3 -3
- package/dist/scss/index.scss +12 -0
- package/dist/state/allowance/useAllowance.d.ts +15 -0
- package/dist/state/balance/useCurrencyBalance.d.ts +4 -0
- package/dist/state/bonds/useBondNFTData.d.ts +5 -0
- package/dist/state/bonds/useBondsData.d.ts +4 -0
- package/dist/state/bonds/useBondsList.d.ts +4 -0
- package/dist/state/bonds/useHotBonds.d.ts +3 -0
- package/dist/state/bonds/useUserBonds.d.ts +5 -0
- package/dist/state/price/useCurrencyPrice.d.ts +3 -0
- package/dist/state/slippage/useSlippage.d.ts +1 -0
- package/dist/state/tokenPrices/useTokenPrices.d.ts +29 -0
- package/dist/state/zap/getChainParam.d.ts +12 -0
- package/dist/state/zap/useSoulZapBondQuote.d.ts +4 -0
- package/dist/state/zap/useSoulZapTokenQuote.d.ts +3 -0
- package/dist/types/bonds.d.ts +4 -41
- package/dist/types/yourbonds.d.ts +54 -69
- package/dist/utils/displayHelpers.d.ts +13 -0
- package/dist/utils/getNativeTicker.d.ts +3 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/views/BondModal/BondModal.d.ts +7 -6
- package/dist/views/BondModal/helper.d.ts +6 -6
- package/dist/views/BondModal/index.d.ts +2 -2
- package/dist/views/Bonds/Bonds.d.ts +7 -10
- package/dist/views/Bonds/components/CheckURL/index.d.ts +4 -0
- package/dist/views/Bonds/index.d.ts +4 -0
- package/dist/views/Bonds/utils.d.ts +14 -0
- package/dist/views/FullBondsView/FullBondsView.d.ts +7 -0
- package/dist/views/FullBondsView/index.d.ts +3 -0
- package/dist/views/YourBonds/YourBonds.d.ts +1 -11
- package/dist/views/YourBonds/components/UserBondRow/index.d.ts +6 -0
- package/dist/views/YourBonds/fetchBillsUser.d.ts +4 -5
- package/dist/views/YourBonds/index.d.ts +3 -0
- package/dist/views/YourBondsModal/YourBondsModal.d.ts +4 -5
- package/dist/views/ZapModal/index.d.ts +14 -0
- package/dist/views/ZapModal/styles.d.ts +2 -0
- package/package.json +24 -24
- package/dist/components/BondMenu/BondMenu.js +0 -40
- package/dist/components/BondMenu/useChainFilterOption.js +0 -30
- package/dist/components/BondRows/BondRow.js +0 -81
- package/dist/components/BondRows/BondRowHeader.js +0 -12
- package/dist/components/BondRows/BondRowsByChain.js +0 -13
- package/dist/components/BondRows/BondRowsWithTitle.js +0 -20
- package/dist/components/BondRows/ChainTitle.js +0 -18
- package/dist/components/MenuSelect/MenuSelect.js +0 -36
- package/dist/components/MenuSelect/RecommendationSelector.js +0 -32
- package/dist/components/MenuSelect/types.js +0 -1
- package/dist/components/NetworkFilter/index.js +0 -66
- package/dist/components/ProgressBar/ProgressBar.js +0 -10
- package/dist/components/ProgressBar/ProgressBarWrapper.js +0 -9
- package/dist/components/ProgressBar/styles.js +0 -82
- package/dist/components/TokenInfoAndName/index.js +0 -61
- package/dist/components/Tooltip/ButtonsRow.js +0 -21
- package/dist/components/Tooltip/Tooltip.js +0 -13
- package/dist/components/Tooltip/styles.js +0 -44
- package/dist/components/uikit-sdk/Button/Button.js +0 -91
- package/dist/components/uikit-sdk/Button/IconButton.js +0 -33
- package/dist/components/uikit-sdk/Button/index.js +0 -2
- package/dist/components/uikit-sdk/Button/styles.js +0 -30
- package/dist/components/uikit-sdk/Button/types.js +0 -37
- package/dist/components/uikit-sdk/Checkbox/index.js +0 -46
- package/dist/components/uikit-sdk/Checkbox/types.js +0 -5
- package/dist/components/uikit-sdk/Flex/index.js +0 -29
- package/dist/components/uikit-sdk/Input/Input.js +0 -72
- package/dist/components/uikit-sdk/Input/NumericInput.js +0 -35
- package/dist/components/uikit-sdk/Input/StyledInput.js +0 -26
- package/dist/components/uikit-sdk/Input/index.js +0 -3
- package/dist/components/uikit-sdk/Modal/ModalFooter.js +0 -21
- package/dist/components/uikit-sdk/Modal/ModalHeader.js +0 -31
- package/dist/components/uikit-sdk/Modal/index.js +0 -46
- package/dist/components/uikit-sdk/Modal/styles.js +0 -62
- package/dist/components/uikit-sdk/Modal/types.js +0 -1
- package/dist/components/uikit-sdk/Select/Select.js +0 -61
- package/dist/components/uikit-sdk/Select/SelectItem.js +0 -40
- package/dist/components/uikit-sdk/Select/index.js +0 -2
- package/dist/components/uikit-sdk/Select/styles.js +0 -50
- package/dist/components/uikit-sdk/Select/types.js +0 -37
- package/dist/components/uikit-sdk/Skeleton/index.js +0 -31
- package/dist/components/uikit-sdk/Skeleton/styles.js +0 -40
- package/dist/components/uikit-sdk/Skeleton/types.js +0 -10
- package/dist/components/uikit-sdk/Svg/Icons/AbondFullLogo.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/AbondSmallLogo.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/AccountMonkey.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/AllChains.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/ApebondLogo.js +0 -17
- package/dist/components/uikit-sdk/Svg/Icons/ApeswapSmallLogo.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Arrow.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Audit.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/BananaIcon.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/BillsM1.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/BillsM2.js +0 -17
- package/dist/components/uikit-sdk/Svg/Icons/BillsM3.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Bridge.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Bubble.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Calculator.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Calendar.js +0 -5
- package/dist/components/uikit-sdk/Svg/Icons/Cancelled.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Card.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Caret.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Chain.js +0 -9
- package/dist/components/uikit-sdk/Svg/Icons/Chart.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Chat.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Close.js +0 -9
- package/dist/components/uikit-sdk/Svg/Icons/Cog.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Collapse.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Copy.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Discord.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/DiscordNew.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Docs.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/DocsV2.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Ellipse.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Error.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Expand.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Explorer.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/External.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Farm.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Fav.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/FilledURL.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Fire.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Frame.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/FullLogo.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Gnana.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/GreenShield.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Hamburger.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/HamburgerClosed.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Home.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Hot.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Info.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/InfoSolid.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Insight.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Instagram.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Island.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Language.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/LanguageIcon.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/LineChart.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/LiquidityIcon.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Logout.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Medium.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/MenuSettings.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Message.js +0 -9
- package/dist/components/uikit-sdk/Svg/Icons/Migrate.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Moon.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/More.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/NFA.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/NavCaret.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/PlaceholderMonkey.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Play.js +0 -5
- package/dist/components/uikit-sdk/Svg/Icons/Pool.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Positions.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/ProfileDark.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/ProfileIcon.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/ProfileLight.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Question.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/QuestionCircle.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/QuestionFill.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Quiz.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Receipt.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Reddit.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Rocket.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/ScrollTop.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Search.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Send.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Settings.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Share.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Sort.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Success.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/SuccessOutline.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/SwapArrows.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/SwitchArrows.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Tag.js +0 -5
- package/dist/components/uikit-sdk/Svg/Icons/Telegram.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/TelegramNew.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/TextLogo.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/TickShield.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Trade.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Trash.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Twitter.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/URL.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Vaults.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Verified.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/Wallet.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Warning.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Watch.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/Website.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/WebsiteNew.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/WhitepaperNew.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/XNew.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/YellowQuestionMark.js +0 -6
- package/dist/components/uikit-sdk/Svg/Icons/ZapArrow.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/ZapIcon.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/index.js +0 -112
- package/dist/components/uikit-sdk/Svg/Icons/polygonNew.js +0 -16
- package/dist/components/uikit-sdk/Svg/Icons/types.js +0 -1
- package/dist/components/uikit-sdk/Svg/index.js +0 -347
- package/dist/components/uikit-sdk/Svg/styles.js +0 -16
- package/dist/components/uikit-sdk/Svg/tokens/ABOND.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/ARBITRUM.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/AVAX.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/BANANA.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/BASE.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/BNB.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/BSC.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/CELO.js +0 -5
- package/dist/components/uikit-sdk/Svg/tokens/CRONOS.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/ETH.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/FANTOM.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/GNANA.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/GNOSIS.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/INEVM.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/IOTA.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/LIGHTLINK.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/LINEA.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/OKX.js +0 -5
- package/dist/components/uikit-sdk/Svg/tokens/OPTIMISM.js +0 -8
- package/dist/components/uikit-sdk/Svg/tokens/POLYGON.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/POLYGONZK.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/TLOS.js +0 -6
- package/dist/components/uikit-sdk/Svg/tokens/index.js +0 -22
- package/dist/components/uikit-sdk/Svg/types.js +0 -165
- package/dist/components/uikit-sdk/Svg/walletIcons/BinanceChain.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/Bitkeep.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/Brave.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/Coinbase.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/MadWallet.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/MathWallet.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/Metamask.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/Nabox.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/OKX.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/OntoWallet.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/SafePalWallet.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/SocialLogin.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/TokenPocket.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/TorusWallet.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/TrustWallet.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/Unstoppable.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/WalletConnect.js +0 -6
- package/dist/components/uikit-sdk/Svg/walletIcons/WalletImage.js +0 -5
- package/dist/components/uikit-sdk/Svg/walletIcons/index.js +0 -18
- package/dist/components/uikit-sdk/Tag/ListTag.js +0 -20
- package/dist/components/uikit-sdk/Tag/Tag.js +0 -42
- package/dist/components/uikit-sdk/Tag/index.js +0 -2
- package/dist/components/uikit-sdk/Tag/styles.js +0 -44
- package/dist/components/uikit-sdk/Tag/types.js +0 -34
- package/dist/components/uikit-sdk/Text/index.js +0 -35
- package/dist/components/uikit-sdk/Text/types.js +0 -13
- package/dist/components/uikit-sdk/TokenImage/index.js +0 -18
- package/dist/components/uikit-sdk/TooltipBubble/index.js +0 -66
- package/dist/components/uikit-sdk/TooltipBubble/styles.js +0 -60
- package/dist/components/uikit-sdk/TooltipBubble/types.js +0 -8
- package/dist/components/uikit-sdk/index.js +0 -12
- package/dist/config/abi/bond.json +0 -450
- package/dist/config/abi/erc20.json +0 -117
- package/dist/config/abi/multicallv2.json +0 -143
- package/dist/config/abi/types/Banana.js +0 -1
- package/dist/config/abi/types/Bond.js +0 -1
- package/dist/config/abi/types/BondNft.js +0 -1
- package/dist/config/abi/types/EnsPublicResolver.js +0 -1
- package/dist/config/abi/types/EnsRegistrar.js +0 -1
- package/dist/config/abi/types/Erc20.js +0 -1
- package/dist/config/abi/types/Erc20_bytes32.js +0 -1
- package/dist/config/abi/types/JungleChef.js +0 -1
- package/dist/config/abi/types/LaunchBonds.js +0 -1
- package/dist/config/abi/types/LensContract.js +0 -1
- package/dist/config/abi/types/LockVeAbond.js +0 -1
- package/dist/config/abi/types/MigrationBond.js +0 -1
- package/dist/config/abi/types/MigrationFveAbond.js +0 -1
- package/dist/config/abi/types/MiniComplexRewarder.js +0 -1
- package/dist/config/abi/types/Multicallv2.js +0 -1
- package/dist/config/abi/types/Multicallv3.js +0 -1
- package/dist/config/abi/types/NonFungibleApes.js +0 -1
- package/dist/config/abi/types/NonFungibleBananas.js +0 -1
- package/dist/config/abi/types/PriceGetter.js +0 -1
- package/dist/config/abi/types/PriceGetterLinea.js +0 -1
- package/dist/config/abi/types/PriceGetterV2.js +0 -1
- package/dist/config/abi/types/SousChef.js +0 -1
- package/dist/config/abi/types/Treasury.js +0 -1
- package/dist/config/abi/types/Weth.js +0 -1
- package/dist/config/abi/types/Zap.js +0 -1
- package/dist/config/abi/types/common.js +0 -1
- package/dist/config/abi/types/factories/Banana__factory.js +0 -628
- package/dist/config/abi/types/factories/BondNft__factory.js +0 -951
- package/dist/config/abi/types/factories/Bond__factory.js +0 -1042
- package/dist/config/abi/types/factories/EnsPublicResolver__factory.js +0 -833
- package/dist/config/abi/types/factories/EnsRegistrar__factory.js +0 -439
- package/dist/config/abi/types/factories/Erc20__factory.js +0 -239
- package/dist/config/abi/types/factories/Erc20_bytes32__factory.js +0 -47
- package/dist/config/abi/types/factories/JungleChef__factory.js +0 -326
- package/dist/config/abi/types/factories/LaunchBonds__factory.js +0 -2031
- package/dist/config/abi/types/factories/LensContract__factory.js +0 -338
- package/dist/config/abi/types/factories/LockVeAbond__factory.js +0 -2215
- package/dist/config/abi/types/factories/MigrationBond__factory.js +0 -1656
- package/dist/config/abi/types/factories/MigrationFveAbond__factory.js +0 -346
- package/dist/config/abi/types/factories/MiniComplexRewarder__factory.js +0 -586
- package/dist/config/abi/types/factories/Multicallv2__factory.js +0 -160
- package/dist/config/abi/types/factories/Multicallv3__factory.js +0 -109
- package/dist/config/abi/types/factories/NonFungibleApes__factory.js +0 -810
- package/dist/config/abi/types/factories/NonFungibleBananas__factory.js +0 -756
- package/dist/config/abi/types/factories/PriceGetterLinea__factory.js +0 -1465
- package/dist/config/abi/types/factories/PriceGetterV2__factory.js +0 -1364
- package/dist/config/abi/types/factories/PriceGetter__factory.js +0 -1326
- package/dist/config/abi/types/factories/SousChef__factory.js +0 -666
- package/dist/config/abi/types/factories/Treasury__factory.js +0 -309
- package/dist/config/abi/types/factories/Weth__factory.js +0 -296
- package/dist/config/abi/types/factories/Zap__factory.js +0 -889
- package/dist/config/abi/types/factories/index.js +0 -28
- package/dist/config/abi/types/index.js +0 -26
- package/dist/config/constants/addresses.js +0 -116
- package/dist/config/constants/api.js +0 -6
- package/dist/config/constants/chains.js +0 -436
- package/dist/config/constants/lifiRouting.js +0 -6
- package/dist/config/constants/lists.js +0 -21
- package/dist/config/constants/meta.js +0 -92
- package/dist/config/constants/misc.js +0 -4
- package/dist/config/constants/networks.js +0 -44
- package/dist/config/constants/products.js +0 -58
- package/dist/config/constants/queryKeys.js +0 -24
- package/dist/config/constants/tokens.js +0 -452
- package/dist/config/constants/tutorials.js +0 -80
- package/dist/config/localization/languages.js +0 -83
- package/dist/config/localization/translations.json +0 -918
- package/dist/contexts/Localization/Provider.js +0 -134
- package/dist/contexts/Localization/helpers.js +0 -63
- package/dist/contexts/Localization/index.js +0 -2
- package/dist/contexts/Localization/types.js +0 -1
- package/dist/contexts/Localization/useTranslation.js +0 -10
- package/dist/contexts/ModalContext.js +0 -67
- package/dist/contexts/RefreshContext.js +0 -78
- package/dist/enum/apeswaplists.d.ts +0 -418
- package/dist/enum/apeswaplists.js +0 -152
- package/dist/enum/tooltips.js +0 -13
- package/dist/hooks/useCookie.js +0 -29
- package/dist/hooks/useIsAbond.js +0 -10
- package/dist/hooks/useModal.js +0 -39
- package/dist/hooks/usePendingVesting.js +0 -13
- package/dist/hooks/useRefresh.js +0 -7
- package/dist/hooks/useTimer.js +0 -13
- package/dist/hooks/useTopThreeTags.js +0 -25
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -6
- package/dist/providers/index.js +0 -12
- package/dist/theme/base.js +0 -123
- package/dist/theme/colors.js +0 -93
- package/dist/theme/components.js +0 -338
- package/dist/theme/display.js +0 -2
- package/dist/theme/index.js +0 -15
- package/dist/theme/types.js +0 -1
- package/dist/types/bonds.js +0 -1
- package/dist/types/yourbonds.js +0 -1
- package/dist/utils/convertToTokenValue.js +0 -24
- package/dist/utils/formatNumber.js +0 -34
- package/dist/utils/formatNumbers.js +0 -148
- package/dist/utils/getBalanceNumber.js +0 -18
- package/dist/utils/getTimePeriods.js +0 -44
- package/dist/utils/index.js +0 -127
- package/dist/utils/localStorageHelpers.js +0 -47
- package/dist/utils/multicall.js +0 -90
- package/dist/utils/numbers.js +0 -111
- package/dist/utils/roundNumber.js +0 -14
- package/dist/utils/track.js +0 -17
- package/dist/views/BondModal/BondModal.js +0 -277
- package/dist/views/BondModal/helper.js +0 -54
- package/dist/views/BondModal/index.js +0 -18
- package/dist/views/Bonds/Bonds.js +0 -174
- package/dist/views/YourBonds/YourBonds.js +0 -276
- package/dist/views/YourBonds/fetchBillsUser.js +0 -235
- package/dist/views/YourBonds/getBillNftData.js +0 -109
- package/dist/views/YourBondsModal/YourBondsModal.js +0 -173
- package/dist/views/YourBondsModal/styles.js +0 -12
- /package/dist/{enum → config/constants}/tooltips.d.ts +0 -0
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
38
|
-
/** @jsxImportSource theme-ui */
|
|
39
|
-
import React, { useEffect, useState } from 'react';
|
|
40
|
-
import { Flex, Input } from 'theme-ui';
|
|
41
|
-
import getTimePeriods from '../../utils/getTimePeriods';
|
|
42
|
-
import axios from 'axios';
|
|
43
|
-
import { BigNumber } from 'bignumber.js';
|
|
44
|
-
import { getFirstNonZeroDigits } from '../../utils/roundNumber';
|
|
45
|
-
import { isNumber } from '../../utils/numbers';
|
|
46
|
-
import { TooltipBubble, Button, Svg, ListTag, Modal } from '../../components/uikit-sdk';
|
|
47
|
-
import { TooltipText } from '../../enum/tooltips';
|
|
48
|
-
import { ethers } from 'ethers';
|
|
49
|
-
import convertToTokenValue, { adjustDecimals } from "../../utils/convertToTokenValue";
|
|
50
|
-
import TokenImage from '../../components/uikit-sdk/TokenImage';
|
|
51
|
-
import BOND_ABI from '../../config/abi/bond.json';
|
|
52
|
-
import ERC_20_ABI from '../../config/abi/erc20.json';
|
|
53
|
-
import { NETWORK_ICONS, NETWORK_LABEL } from '../../config/constants/chains';
|
|
54
|
-
import { formatUSDNumber, getPremiumColor, premium, youGet, youGetUSD, youSpend, youSpendUSD } from './helper';
|
|
55
|
-
import '../../scss/BondModal.scss';
|
|
56
|
-
import { useChainId, useSwitchChain, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
|
|
57
|
-
import { PUBLIC_RPC_URLS } from "../../config/constants/networks";
|
|
58
|
-
import useModal from "../../hooks/useModal";
|
|
59
|
-
var BondModal = function (_a) {
|
|
60
|
-
var account = _a.account, isActive = _a.isActive, isOpen = _a.isOpen, accountChainId = _a.accountChainId, onClose = _a.onClose, bondAddress = _a.bondAddress;
|
|
61
|
-
if (!isOpen)
|
|
62
|
-
return null;
|
|
63
|
-
var chainId = useChainId();
|
|
64
|
-
var _b = useSwitchChain(), chains = _b.chains, switchChain = _b.switchChain;
|
|
65
|
-
var _c = useState([]), bondData = _c[0], setBondData = _c[1];
|
|
66
|
-
var _d = useWriteContract(), hash = _d.data, isPending = _d.isPending, writeContract = _d.writeContract, writeContractAsync = _d.writeContractAsync;
|
|
67
|
-
var _e = useWaitForTransactionReceipt({
|
|
68
|
-
confirmations: 4,
|
|
69
|
-
chainId: chainId !== null && chainId !== void 0 ? chainId : accountChainId,
|
|
70
|
-
hash: hash,
|
|
71
|
-
}), isConfirming = _e.isLoading, isConfirmed = _e.isSuccess;
|
|
72
|
-
var _f = useState(null), approveTx = _f[0], setApproveTx = _f[1];
|
|
73
|
-
var _g = useState(null), toastMessage = _g[0], setToastMessage = _g[1];
|
|
74
|
-
var _h = useState(null), buyTx = _h[0], setBuyTx = _h[1];
|
|
75
|
-
var _j = useState(null), tokenBalance = _j[0], setTokenBalance = _j[1];
|
|
76
|
-
var _k = useState(null), tokenDecimals = _k[0], setTokenDecimals = _k[1];
|
|
77
|
-
var _l = useState(''), inputValue = _l[0], setInputValue = _l[1];
|
|
78
|
-
var handleInputChange = function (event) {
|
|
79
|
-
setInputValue(event.target.value);
|
|
80
|
-
};
|
|
81
|
-
var handleBuy = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
-
var billAddress, decimals, maxPrice, rawAmount, amount, tx, data, response, error_1;
|
|
83
|
-
return __generator(this, function (_a) {
|
|
84
|
-
switch (_a.label) {
|
|
85
|
-
case 0:
|
|
86
|
-
billAddress = bondData[0].billAddress;
|
|
87
|
-
decimals = tokenDecimals !== null && tokenDecimals !== void 0 ? tokenDecimals : 18;
|
|
88
|
-
_a.label = 1;
|
|
89
|
-
case 1:
|
|
90
|
-
_a.trys.push([1, 5, , 6]);
|
|
91
|
-
maxPrice = new BigNumber(bondData[0].trueBillPrice).times(102).div(100).toFixed(0);
|
|
92
|
-
rawAmount = adjustDecimals(inputValue);
|
|
93
|
-
amount = new BigNumber(rawAmount).times(new BigNumber(10).pow(decimals !== null && decimals !== void 0 ? decimals : 18)).toString();
|
|
94
|
-
return [4 /*yield*/, writeContractAsync({
|
|
95
|
-
address: billAddress,
|
|
96
|
-
abi: BOND_ABI,
|
|
97
|
-
functionName: 'deposit',
|
|
98
|
-
args: [amount, maxPrice, account],
|
|
99
|
-
})];
|
|
100
|
-
case 2:
|
|
101
|
-
tx = _a.sent();
|
|
102
|
-
if (!tx) return [3 /*break*/, 4];
|
|
103
|
-
setBuyTx(tx);
|
|
104
|
-
data = {
|
|
105
|
-
chainId: chainId,
|
|
106
|
-
transactionHash: tx,
|
|
107
|
-
referenceId: 'cgpt-sdk',
|
|
108
|
-
billContract: billAddress
|
|
109
|
-
};
|
|
110
|
-
return [4 /*yield*/, axios.post("https://api-v2.apeswap.finance/bills/widget", data)];
|
|
111
|
-
case 3:
|
|
112
|
-
response = _a.sent();
|
|
113
|
-
console.log(response);
|
|
114
|
-
_a.label = 4;
|
|
115
|
-
case 4: return [3 /*break*/, 6];
|
|
116
|
-
case 5:
|
|
117
|
-
error_1 = _a.sent();
|
|
118
|
-
console.error('Buy error', error_1);
|
|
119
|
-
return [3 /*break*/, 6];
|
|
120
|
-
case 6: return [2 /*return*/];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}); };
|
|
124
|
-
//You approve the token, not the contract (this code will have to be updated for zap)
|
|
125
|
-
var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
-
var tokenAddress, decimals, amount, tx, error_2;
|
|
127
|
-
return __generator(this, function (_a) {
|
|
128
|
-
switch (_a.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
tokenAddress = bondData[0].lpToken.address[chainId];
|
|
131
|
-
decimals = tokenDecimals !== null && tokenDecimals !== void 0 ? tokenDecimals : 18;
|
|
132
|
-
_a.label = 1;
|
|
133
|
-
case 1:
|
|
134
|
-
_a.trys.push([1, 3, , 4]);
|
|
135
|
-
amount = convertToTokenValue(inputValue, decimals);
|
|
136
|
-
return [4 /*yield*/, writeContractAsync({
|
|
137
|
-
address: tokenAddress,
|
|
138
|
-
abi: ERC_20_ABI,
|
|
139
|
-
functionName: 'approve',
|
|
140
|
-
args: [bondData[0].billAddress, amount]
|
|
141
|
-
})];
|
|
142
|
-
case 2:
|
|
143
|
-
tx = _a.sent();
|
|
144
|
-
if (tx) {
|
|
145
|
-
setApproveTx(tx);
|
|
146
|
-
}
|
|
147
|
-
return [3 /*break*/, 4];
|
|
148
|
-
case 3:
|
|
149
|
-
error_2 = _a.sent();
|
|
150
|
-
console.error('Approval failed:', error_2);
|
|
151
|
-
return [3 /*break*/, 4];
|
|
152
|
-
case 4: return [2 /*return*/];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}); };
|
|
156
|
-
// Confirmation message
|
|
157
|
-
useEffect(function () {
|
|
158
|
-
if (isConfirmed) {
|
|
159
|
-
setToastMessage("Transaction Complete.");
|
|
160
|
-
setTimeout(function () { return setToastMessage(null); }, 10000);
|
|
161
|
-
}
|
|
162
|
-
}, [approveTx, buyTx, isConfirmed]);
|
|
163
|
-
useEffect(function () {
|
|
164
|
-
if (isActive && account && bondData.length > 0) {
|
|
165
|
-
getTokenBalance(chainId, bondData[0].lpToken.address[chainId], account).then(function (_a) {
|
|
166
|
-
var roundedBalance = _a.roundedBalance, decimals = _a.decimals;
|
|
167
|
-
setTokenBalance(roundedBalance);
|
|
168
|
-
setTokenDecimals(decimals);
|
|
169
|
-
}).catch(function (error) {
|
|
170
|
-
console.error('Error fetching token balance', error);
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}, [isActive, account, bondData]);
|
|
174
|
-
var getTokenBalance = function (chainId, tokenAddress, walletAddress) { return __awaiter(void 0, void 0, void 0, function () {
|
|
175
|
-
var urls, provider, contract, decimals, balance, balanceInEther, roundedBalance, error_3;
|
|
176
|
-
return __generator(this, function (_a) {
|
|
177
|
-
switch (_a.label) {
|
|
178
|
-
case 0:
|
|
179
|
-
_a.trys.push([0, 3, , 4]);
|
|
180
|
-
urls = PUBLIC_RPC_URLS;
|
|
181
|
-
provider = new ethers.providers.JsonRpcProvider(urls[chainId][0]);
|
|
182
|
-
if (!provider) {
|
|
183
|
-
throw new Error("No provider found for chainId: ".concat(chainId));
|
|
184
|
-
}
|
|
185
|
-
contract = new ethers.Contract(tokenAddress, ERC_20_ABI, provider);
|
|
186
|
-
return [4 /*yield*/, contract.decimals()];
|
|
187
|
-
case 1:
|
|
188
|
-
decimals = _a.sent();
|
|
189
|
-
return [4 /*yield*/, contract.balanceOf(walletAddress)];
|
|
190
|
-
case 2:
|
|
191
|
-
balance = _a.sent();
|
|
192
|
-
balanceInEther = ethers.utils.formatUnits(balance, decimals);
|
|
193
|
-
roundedBalance = Number(balanceInEther).toFixed(4).toString();
|
|
194
|
-
return [2 /*return*/, { roundedBalance: roundedBalance, decimals: decimals }];
|
|
195
|
-
case 3:
|
|
196
|
-
error_3 = _a.sent();
|
|
197
|
-
console.error('Error fetching token balance', error_3);
|
|
198
|
-
return [2 /*return*/, { roundedBalance: '0', decimals: 0 }];
|
|
199
|
-
case 4: return [2 /*return*/];
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}); };
|
|
203
|
-
// Fetch data
|
|
204
|
-
useEffect(function () {
|
|
205
|
-
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
206
|
-
var bond = response.data.bonds.filter(function (x) {
|
|
207
|
-
return x.billAddress.toLowerCase() === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase());
|
|
208
|
-
});
|
|
209
|
-
setBondData(bond);
|
|
210
|
-
});
|
|
211
|
-
}, [bondAddress]);
|
|
212
|
-
// Functions for calculations
|
|
213
|
-
var getDiscountColor = function (discount) {
|
|
214
|
-
return discount < 0 ? 'discount-negative' : 'discount-positive';
|
|
215
|
-
};
|
|
216
|
-
var discountEarnTokenPrice = function (bond) {
|
|
217
|
-
var _a, _b;
|
|
218
|
-
var earnTokenPrice = parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
219
|
-
return getFirstNonZeroDigits(earnTokenPrice - earnTokenPrice * (((_b = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _b !== void 0 ? _b : 0) / 100));
|
|
220
|
-
};
|
|
221
|
-
var earnTokenPrice = function (bond) {
|
|
222
|
-
var _a;
|
|
223
|
-
return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
|
|
224
|
-
};
|
|
225
|
-
var vestingTime = function (vestingTerm) { return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true); };
|
|
226
|
-
var maxBuy = function (bond) {
|
|
227
|
-
var _a, _b, _c, _d;
|
|
228
|
-
var available = new BigNumber((_a = bond === null || bond === void 0 ? void 0 : bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0');
|
|
229
|
-
var threshold = 5;
|
|
230
|
-
var thresholdToShow = new BigNumber(threshold).div((_b = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _b !== void 0 ? _b : 0);
|
|
231
|
-
var safeAvailable = available.minus(thresholdToShow);
|
|
232
|
-
var singlePurchaseLimit = new BigNumber((_c = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _c !== void 0 ? _c : 0).div(new BigNumber(10).pow((_d = bond === null || bond === void 0 ? void 0 : bond.earnToken.decimals[chainId]) !== null && _d !== void 0 ? _d : 18));
|
|
233
|
-
return !available ? 0 : (singlePurchaseLimit.lt(safeAvailable) ? singlePurchaseLimit : safeAvailable);
|
|
234
|
-
};
|
|
235
|
-
var onAsd = useModal(_jsx(Modal, { sx: { zIndex: 5000 }, children: _jsx(_Fragment, { children: "asd!" }) }))[0];
|
|
236
|
-
// const ref = React.useRef<boolean>(false);
|
|
237
|
-
//
|
|
238
|
-
// useEffect(() => {
|
|
239
|
-
// if (!ref.current) {
|
|
240
|
-
// console.log('open modal!!')
|
|
241
|
-
// onAsd();
|
|
242
|
-
// ref.current = true;
|
|
243
|
-
// }
|
|
244
|
-
// }, []);
|
|
245
|
-
return (_jsx(_Fragment, { children: bondData.map(function (bond) {
|
|
246
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
247
|
-
return (_jsx(React.Fragment, { children: _jsx(Flex, { className: "modal-backdrop", onClick: onClose, children: _jsxs(Flex, { className: "modal-content", onClick: function (event) { return event.stopPropagation(); }, children: [toastMessage && (_jsx(Flex, { className: "toast", children: toastMessage })), _jsx(Flex, { className: "modal-header", children: _jsx(Flex, { className: "svg-close", onClick: onClose, children: _jsx(Svg, { icon: "close" }) }) }), _jsxs(Flex, { className: "modaltable-container", children: [_jsxs(Flex, { className: "modaltable-container title-container", children: [_jsx(Flex, { className: "title-container bondicon", children: _jsxs("div", { className: "icon-container", children: [_jsx(Svg, { width: 20, height: 20, icon: (_a = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond.chainId]) !== null && _a !== void 0 ? _a : 'question' }), _jsx(TokenImage, { symbol: (_b = bond.showcaseTokenName) !== null && _b !== void 0 ? _b : bond.earnToken.symbol, size: 50 })] }) }), _jsx(Flex, { className: "title-container bondname", children: bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName }), _jsxs(Flex, { className: "title-container price-container", children: [_jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bond)] }), _jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bond)] })] }), _jsx(Flex, { className: "title-container tokentags", children: _jsx(ListTag, { text: (_c = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _c === void 0 ? void 0 : _c[0], variant: ((_d = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _d === void 0 ? void 0 : _d[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) })] }), _jsx(Flex, { className: "modaltable-container description-container", children: bond === null || bond === void 0 ? void 0 : bond.shortDescription }), _jsxs(Flex, { className: "modaltable-container blocks-container", children: [_jsxs(Flex, { className: "modal-block block-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)), children: [_jsxs(Flex, { className: "block-header", children: ["Discount", _jsx(TooltipBubble, { className: "tooltip-bubble", body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: _jsx(Flex, { className: "header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), _jsx(Flex, { className: "block-content", children: "".concat((_e = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _e === void 0 ? void 0 : _e.toFixed(2), "%") })] }), _jsxs(Flex, { className: "modal-block block-arr", children: [_jsxs(Flex, { className: "block-header", children: ["ARR", _jsx(TooltipBubble, { className: "tooltip-bubble", body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: _jsx(Flex, { className: "header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), _jsx(Flex, { className: "block-content", children: "".concat(((((_f = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _f !== void 0 ? _f : 0) * 365) / vestingTime((_g = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _g !== void 0 ? _g : 0).days).toFixed(2), "%") })] }), _jsxs(Flex, { className: "modal-block block-term", children: [_jsxs(Flex, { className: "block-header", children: ["Terms", _jsx(TooltipBubble, { className: "tooltip-bubble", body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: _jsx(Flex, { className: "header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), _jsx(Flex, { className: "block-content", children: vestingTime((_h = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _h !== void 0 ? _h : 0).days ? "".concat(vestingTime((_j = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _j !== void 0 ? _j : 0).days, " D") : '-' })] }), _jsxs(Flex, { className: "modal-block block-maxbuy", children: [_jsxs(Flex, { className: "block-header", children: ["Max Buy", _jsx(TooltipBubble, { className: "tooltip-bubble", body: _jsx(Flex, { children: TooltipText.MaxBuy(bond.earnToken.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: _jsx(Flex, { className: "header-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), _jsx(Flex, { className: "block-content", children: (_k = parseFloat(maxBuy(bond).toFixed(0))) === null || _k === void 0 ? void 0 : _k.toLocaleString('en-US') })] })] }), _jsxs(Flex, { className: "modaltable-container text-container", children: [_jsxs(Flex, { className: "text-container row", children: [_jsx(Flex, { className: "row-container spend", children: "You spend:" }), _jsxs(Flex, { className: "row-container spend-val", children: [youSpend(inputValue), " ", bond.lpToken.symbol, " = $ ", formatUSDNumber(youSpendUSD(bond, inputValue))] })] }), _jsxs(Flex, { className: "text-container row", children: [_jsxs(Flex, { className: "row-container premium", children: ["Premium:", _jsx(TooltipBubble, { className: "tooltip-bubble", body: _jsx(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: _jsx(Flex, { className: "row-container premium-icon", children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), _jsxs(Flex, { className: "row-container premium-val ".concat(getPremiumColor(bond, inputValue)), children: ["$ ", premium(bond, inputValue)] })] }), _jsxs(Flex, { className: "text-container row", children: [_jsxs(Flex, { className: "row-container get", children: ["You get (over ", vestingTime((_l = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _l !== void 0 ? _l : 0).days, " days):"] }), _jsxs(Flex, { className: "row-container get-val", children: [youGet(bond, inputValue), " ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName, " = $ ", formatUSDNumber(youGetUSD(bond, inputValue))] })] })] }), _jsxs(Flex, { className: "modaltable-container buy-container", children: [_jsxs(Flex, { className: "input-container inputrow", children: [_jsx(Flex, { className: "input-container input", children: _jsx(Input, { placeholder: "0.0", value: inputValue, pattern: "^[0-9]*[.,]?[0-9]*$", onChange: handleInputChange, onInput: function (v) {
|
|
248
|
-
if (v.currentTarget.value.includes(',')) {
|
|
249
|
-
v.currentTarget.value = v.currentTarget.value.replace(/,/g, '.');
|
|
250
|
-
}
|
|
251
|
-
if (v.currentTarget.value.includes('%')) {
|
|
252
|
-
v.currentTarget.value = v.currentTarget.value.replace(/[^0-9]/g, '');
|
|
253
|
-
}
|
|
254
|
-
if (v.currentTarget.value === '.') {
|
|
255
|
-
v.currentTarget.value = '0.';
|
|
256
|
-
}
|
|
257
|
-
v.currentTarget.value =
|
|
258
|
-
!!v.currentTarget.value && isNumber(v.currentTarget.value) && parseFloat(v.currentTarget.value) >= 0
|
|
259
|
-
? v.currentTarget.value
|
|
260
|
-
: v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
|
|
261
|
-
} }) }), _jsxs(Flex, { className: "input-container token", children: [_jsx(Flex, { className: "input-container bondicon", children: _jsxs("div", { className: "icon-container-small", children: [_jsx(Svg, { width: 12, height: 12, icon: (_m = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond.chainId]) !== null && _m !== void 0 ? _m : 'question' }), _jsx(TokenImage, { symbol: (_o = bond.lpToken.symbol) !== null && _o !== void 0 ? _o : bond.earnToken.symbol, size: 30 })] }) }), _jsx(Flex, { className: "title-container tokenname-small", children: bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol })] })] }), isActive && account && (_jsxs(Flex, { className: "input-container balancerow", children: [_jsxs(Flex, { className: "balancerow text", children: ["Balance: ", tokenBalance] }), _jsx(Flex, { className: "balancerow max", children: _jsx(Button, { className: "max-button", onClick: function () {
|
|
262
|
-
setInputValue(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0');
|
|
263
|
-
}, children: "Max" }) })] }))] }), _jsxs(Flex, { className: "modaltable-container button-container", children: [_jsx(Flex, { className: "button-container get", children: _jsxs(Button, { className: "action-button", onClick: onAsd, children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.lpToken.symbol] }) }), _jsx(Flex, { className: "button-container buy", children: chainId !== bond.chainId
|
|
264
|
-
?
|
|
265
|
-
_jsxs(Button, { className: "switch-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: function (event) {
|
|
266
|
-
event.stopPropagation();
|
|
267
|
-
// Add your claim logic here
|
|
268
|
-
switchChain({ chainId: bond.chainId });
|
|
269
|
-
}, children: ["Switch to ", NETWORK_LABEL[bond.chainId]] })
|
|
270
|
-
:
|
|
271
|
-
approveTx != null && isConfirmed ?
|
|
272
|
-
_jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: handleBuy, children: isConfirming ? 'Confirming...' : "Buy ".concat(bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName) })
|
|
273
|
-
:
|
|
274
|
-
_jsx(Button, { className: "action-button", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut), onClick: handleApprove, children: isConfirming ? 'Confirming...' : 'Approve' }) })] })] })] }) }) }, bond.billAddress));
|
|
275
|
-
}) }));
|
|
276
|
-
};
|
|
277
|
-
export default BondModal;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import BigNumber from "bignumber.js";
|
|
2
|
-
import { formatNumberSI } from "../../utils/formatNumber";
|
|
3
|
-
function formatNumber(input) {
|
|
4
|
-
var number = new BigNumber(input);
|
|
5
|
-
if (number.isNaN())
|
|
6
|
-
return '0';
|
|
7
|
-
return number.gt(1000000)
|
|
8
|
-
? formatNumberSI(number.toNumber())
|
|
9
|
-
: number.gt(1000)
|
|
10
|
-
? number.toNumber().toLocaleString(undefined, { maximumFractionDigits: 0 })
|
|
11
|
-
: number.gt(0.01)
|
|
12
|
-
? parseFloat(number.toFixed(2)).toLocaleString(undefined)
|
|
13
|
-
: parseFloat(number.toPrecision(5)).toLocaleString(undefined);
|
|
14
|
-
}
|
|
15
|
-
function formatUSDNumber(input) {
|
|
16
|
-
var number = new BigNumber(input);
|
|
17
|
-
if (number.isNaN())
|
|
18
|
-
return '0';
|
|
19
|
-
// If the number is greater than 0 but less than 0.01
|
|
20
|
-
if (number.gt(0) && number.lt(0.01)) {
|
|
21
|
-
return '< 0.01';
|
|
22
|
-
}
|
|
23
|
-
// If the number is greater than 1k, round to no decimals.
|
|
24
|
-
if (number.gt(1000)) {
|
|
25
|
-
return number.toNumber().toLocaleString(undefined, { maximumFractionDigits: 0 });
|
|
26
|
-
}
|
|
27
|
-
// Note: Between 1k and 0.01 show 2 decimals
|
|
28
|
-
return parseFloat(number.toFixed(2)).toLocaleString(undefined);
|
|
29
|
-
}
|
|
30
|
-
var youSpend = function (inputValue) { return formatNumber(inputValue); };
|
|
31
|
-
var youSpendUSD = function (bond, inputValue) {
|
|
32
|
-
return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
|
|
33
|
-
};
|
|
34
|
-
var youGet = function (bond, inputValue) {
|
|
35
|
-
var _a;
|
|
36
|
-
var bigValue = new BigNumber(inputValue).times(new BigNumber(10).pow(18));
|
|
37
|
-
var billValue = bigValue.div(new BigNumber((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
38
|
-
return formatNumber(billValue.toString());
|
|
39
|
-
};
|
|
40
|
-
var youGetUSD = function (bond, inputValue) {
|
|
41
|
-
var _a;
|
|
42
|
-
var bigValue = new BigNumber(inputValue).times(new BigNumber(10).pow(18));
|
|
43
|
-
var billValue = bigValue.div(new BigNumber((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
44
|
-
return (billValue.toNumber() * parseFloat(bond.payoutTokenPrice)).toString();
|
|
45
|
-
};
|
|
46
|
-
var premium = function (bond, inputValue) {
|
|
47
|
-
var premiumUSD = parseFloat(youGetUSD(bond, inputValue)) - parseFloat(youSpendUSD(bond, inputValue));
|
|
48
|
-
return formatUSDNumber(premiumUSD.toString());
|
|
49
|
-
};
|
|
50
|
-
var getPremiumColor = function (bond, inputValue) {
|
|
51
|
-
var getPremium = premium(bond, inputValue);
|
|
52
|
-
return parseFloat(getPremium) < 0 ? 'premium-negative' : 'premium-positive';
|
|
53
|
-
};
|
|
54
|
-
export { formatNumber, formatUSDNumber, youSpend, youSpendUSD, youGet, youGetUSD, premium, getPremiumColor };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
import Providers from "../../providers";
|
|
14
|
-
import BondModal from "./BondModal";
|
|
15
|
-
var BondModalWithProviders = function (props) {
|
|
16
|
-
return (_jsx(Providers, { children: _jsx(BondModal, __assign({}, props)) }));
|
|
17
|
-
};
|
|
18
|
-
export default BondModalWithProviders;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
11
|
-
/** @jsxImportSource theme-ui */
|
|
12
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
13
|
-
import { Flex, Spinner, ThemeUIProvider } from 'theme-ui';
|
|
14
|
-
import axios from 'axios';
|
|
15
|
-
import getTimePeriods from '../../utils/getTimePeriods';
|
|
16
|
-
import { defaultTheme } from '../../theme';
|
|
17
|
-
import { BigNumber } from 'bignumber.js';
|
|
18
|
-
import { ChainId } from '../../enum/apeswaplists';
|
|
19
|
-
import '../../scss/Bonds.scss';
|
|
20
|
-
import BondRowHeader from '../../components/BondRows/BondRowHeader';
|
|
21
|
-
import BondRowsByChain from '../../components/BondRows/BondRowsByChain';
|
|
22
|
-
import { useTopTags } from '../../hooks/useTopThreeTags';
|
|
23
|
-
import useChainFilterOption from '../../components/BondMenu/useChainFilterOption';
|
|
24
|
-
var Bonds = function (_a) {
|
|
25
|
-
// const navigate = useNavigate();
|
|
26
|
-
var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive, _b = _a.chains, chains = _b === void 0 ? [] : _b;
|
|
27
|
-
// Fetch data
|
|
28
|
-
var _c = useState([]), bondData = _c[0], setBondData = _c[1];
|
|
29
|
-
var _d = useState([]), hotBonds = _d[0], setHotBonds = _d[1];
|
|
30
|
-
var isSoldOut = useCallback(function (bond) {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
var thresholdToHide = new BigNumber(100).div((_a = bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : 0);
|
|
33
|
-
if (bond.soldOut)
|
|
34
|
-
return true;
|
|
35
|
-
if (bond.discount == null)
|
|
36
|
-
return true;
|
|
37
|
-
if (!bond.tokensRemaining)
|
|
38
|
-
return false;
|
|
39
|
-
if (bond.discount && bond.discount > 25 && bond.chainId === ChainId.BASE /*BASE*/)
|
|
40
|
-
return true;
|
|
41
|
-
return ((_b = new BigNumber(bond.tokensRemaining)) === null || _b === void 0 ? void 0 : _b.lte(thresholdToHide)) || bond.discount === 100;
|
|
42
|
-
}, []);
|
|
43
|
-
useEffect(function () {
|
|
44
|
-
axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
|
|
45
|
-
var bonds = response.data.bonds;
|
|
46
|
-
setBondData(bonds);
|
|
47
|
-
});
|
|
48
|
-
}, []);
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds').then(function (response) {
|
|
51
|
-
var hotBondAddresses = response.data.map(function (bond) {
|
|
52
|
-
return bond.BondAddress.toLowerCase();
|
|
53
|
-
});
|
|
54
|
-
setHotBonds(hotBondAddresses);
|
|
55
|
-
});
|
|
56
|
-
}, [bondData]);
|
|
57
|
-
// Sort functions
|
|
58
|
-
var sortedHotBonds = bondData.sort(function (a, b) {
|
|
59
|
-
var _a, _b;
|
|
60
|
-
var aIsHot = hotBonds.includes(a.billAddress.toLowerCase()) && ((_a = a.discount) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
61
|
-
var bIsHot = hotBonds.includes(b.billAddress.toLowerCase()) && ((_b = b.discount) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
62
|
-
if (aIsHot && !bIsHot) {
|
|
63
|
-
return -1;
|
|
64
|
-
}
|
|
65
|
-
else if (!aIsHot && bIsHot) {
|
|
66
|
-
return 1;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
return b.discount - a.discount;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
var _e = useState(null), sortConfig = _e[0], setSortConfig = _e[1];
|
|
73
|
-
var _f = useState(sortedHotBonds), sortedBonds = _f[0], setSortedBonds = _f[1];
|
|
74
|
-
var handleSort = function (key) {
|
|
75
|
-
var direction = 'asc';
|
|
76
|
-
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'asc') {
|
|
77
|
-
direction = 'desc';
|
|
78
|
-
}
|
|
79
|
-
setSortConfig({ key: key, direction: direction });
|
|
80
|
-
};
|
|
81
|
-
useEffect(function () {
|
|
82
|
-
if (sortConfig === null) {
|
|
83
|
-
setSortedBonds(sortedHotBonds);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
var sorted = __spreadArray([], bondData, true).sort(function (a, b) {
|
|
87
|
-
var aValue, bValue;
|
|
88
|
-
if (sortConfig.key === 'arr') {
|
|
89
|
-
aValue = calculateARR(a);
|
|
90
|
-
bValue = calculateARR(b);
|
|
91
|
-
}
|
|
92
|
-
else if (sortConfig.key === 'tokensRemaining') {
|
|
93
|
-
aValue = remainingPercentage(a);
|
|
94
|
-
bValue = remainingPercentage(b);
|
|
95
|
-
}
|
|
96
|
-
else if (sortConfig.key === 'terms') {
|
|
97
|
-
aValue = vestingTime(a.vestingTerm).days;
|
|
98
|
-
bValue = vestingTime(b.vestingTerm).days;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
aValue = a[sortConfig.key];
|
|
102
|
-
bValue = b[sortConfig.key];
|
|
103
|
-
}
|
|
104
|
-
if (aValue < bValue) {
|
|
105
|
-
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
106
|
-
}
|
|
107
|
-
if (aValue > bValue) {
|
|
108
|
-
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
109
|
-
}
|
|
110
|
-
return 0;
|
|
111
|
-
});
|
|
112
|
-
setSortedBonds(sorted);
|
|
113
|
-
}, [sortConfig, bondData]);
|
|
114
|
-
// Functions for calcuations
|
|
115
|
-
var vestingTime = function (vestingTerm) {
|
|
116
|
-
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
117
|
-
};
|
|
118
|
-
var remainingPercentage = function (bond) {
|
|
119
|
-
var _a, _b;
|
|
120
|
-
var totalMaxPayout = new BigNumber((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber(10).pow(bond.earnToken.decimals[bond.chainId]));
|
|
121
|
-
var remainingTokens = new BigNumber((_b = bond.tokensRemaining) !== null && _b !== void 0 ? _b : '0');
|
|
122
|
-
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
123
|
-
};
|
|
124
|
-
var calculateARR = function (bond) {
|
|
125
|
-
var _a;
|
|
126
|
-
var discount = (_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0;
|
|
127
|
-
var vestingDays = vestingTime(bond.vestingTerm).days;
|
|
128
|
-
return parseFloat((((discount * 365) / vestingDays).toFixed(2)));
|
|
129
|
-
};
|
|
130
|
-
// Search logic
|
|
131
|
-
var _g = useState(''), inputValue = _g[0], setInputValue = _g[1];
|
|
132
|
-
var topTags = useTopTags(sortedBonds);
|
|
133
|
-
var filterOptions = __spreadArray(__spreadArray(['ALL'], topTags, true), ['SOLD OUT'], false);
|
|
134
|
-
var _h = useState(filterOptions[0]), filterOption = _h[0], setFilterOption = _h[1];
|
|
135
|
-
var _j = useChainFilterOption(), chainFilterOption = _j.data, setChainFilterOption = _j.setChainFilterOption;
|
|
136
|
-
var billstoRender = useMemo(function () {
|
|
137
|
-
var billsToReturn = sortedBonds !== null && sortedBonds !== void 0 ? sortedBonds : [];
|
|
138
|
-
if (inputValue) {
|
|
139
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bill) {
|
|
140
|
-
var _a;
|
|
141
|
-
return "".concat(bill.earnToken.symbol.toUpperCase(), ",\n ").concat(bill.lpToken.symbol.toUpperCase(), ",\n ").concat((_a = bill === null || bill === void 0 ? void 0 : bill.showcaseTokenName) === null || _a === void 0 ? void 0 : _a.toUpperCase()).includes(inputValue.toUpperCase());
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
if (topTags.includes(filterOption)) {
|
|
145
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bill) { var _a; return (_a = bill === null || bill === void 0 ? void 0 : bill.tags) === null || _a === void 0 ? void 0 : _a.includes(filterOption); });
|
|
146
|
-
}
|
|
147
|
-
if (!(chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes('All Chains'))) {
|
|
148
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bill) { return chainFilterOption === null || chainFilterOption === void 0 ? void 0 : chainFilterOption.includes(bill.chainId.toString()); });
|
|
149
|
-
}
|
|
150
|
-
if (filterOption !== 'SOLD OUT') {
|
|
151
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bond) { return !isSoldOut(bond); });
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
billsToReturn = billsToReturn === null || billsToReturn === void 0 ? void 0 : billsToReturn.filter(function (bond) { return bond.soldOut; });
|
|
155
|
-
}
|
|
156
|
-
return billsToReturn;
|
|
157
|
-
}, [filterOption, bondData, inputValue, chainFilterOption, topTags]);
|
|
158
|
-
var handleChangeFilterOption = useCallback(function (newOption) {
|
|
159
|
-
setFilterOption(newOption);
|
|
160
|
-
}, []);
|
|
161
|
-
var handleInputChange = function (event) {
|
|
162
|
-
setInputValue(event.target.value);
|
|
163
|
-
};
|
|
164
|
-
// Page render logic
|
|
165
|
-
var _k = useState(false), bondsRendered = _k[0], setBondsRendered = _k[1];
|
|
166
|
-
useEffect(function () {
|
|
167
|
-
if (billstoRender.length > 0) {
|
|
168
|
-
setBondsRendered(true);
|
|
169
|
-
}
|
|
170
|
-
}, [billstoRender]);
|
|
171
|
-
return (_jsx(ThemeUIProvider, { theme: defaultTheme, children: !bondsRendered ? (_jsxs(Flex, { className: "bonds-spinner", children: [" ", _jsx(Spinner, { size: 100 }), " "] }))
|
|
172
|
-
: (_jsxs(Flex, { className: "bonds-container table-container", children: [_jsx(BondRowHeader, { inputValue: inputValue, setChainFilterOption: setChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onInputChange: handleInputChange, onHandleQueryChange: setInputValue, onSort: handleSort }), _jsx(BondRowsByChain, { chains: chains, bonds: billstoRender, hotBonds: hotBonds, hideTitles: inputValue !== '' })] })) }));
|
|
173
|
-
};
|
|
174
|
-
export default Bonds;
|