@ape.swap/bonds-sdk 1.0.780 → 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/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 +2 -2
- package/dist/components/TokenSelectorPanel/index.d.ts +1 -2
- 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 +1 -1
- 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 +7 -2
- package/dist/config/constants/tokens.d.ts +2 -2
- package/dist/hooks/useTokenFromZapList.d.ts +1 -1
- package/dist/hooks/useTopThreeTags.d.ts +2 -2
- package/dist/main.d.ts +7 -0
- package/dist/main.js +73492 -0
- package/dist/scss/BondMenu.scss +2 -2
- package/dist/scss/BondModal.scss +74 -73
- package/dist/scss/BondRow.scss +5 -5
- package/dist/scss/BondRowHeader.scss +7 -7
- package/dist/scss/Bonds.scss +2 -1
- 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 +8 -4
- 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 +1 -17
- 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 +1 -1
- package/dist/state/zap/useSoulZapBondQuote.d.ts +2 -2
- 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 -3
- package/dist/utils/index.d.ts +1 -1
- package/dist/views/BondModal/BondModal.d.ts +4 -7
- 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 +6 -9
- package/dist/views/Bonds/components/CheckURL/index.d.ts +4 -0
- package/dist/views/Bonds/index.d.ts +2 -2
- 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/package.json +19 -24
- package/dist/components/AccordionText/index.js +0 -17
- 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 -34
- package/dist/components/TokenSelectorModal/TokenRow.js +0 -18
- package/dist/components/TokenSelectorModal/index.js +0 -56
- package/dist/components/TokenSelectorPanel/index.js +0 -36
- 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 -41
- 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/price-getter-linea.json +0 -1448
- package/dist/config/abi/price-getter.json +0 -1309
- 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 -47
- package/dist/config/constants/tokens.js +0 -64
- package/dist/config/constants/tutorials.js +0 -80
- package/dist/config/constants/zapInputTokens.js +0 -356
- 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/useTokenFromZapList.js +0 -10
- 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 -18
- package/dist/state/allowance/useAllowance.js +0 -148
- package/dist/state/balance/useCurrencyBalance.js +0 -80
- package/dist/state/price/useCurrencyPrice.js +0 -397
- package/dist/state/zap/getChainParam.js +0 -34
- package/dist/state/zap/useSoulZapBondQuote.js +0 -177
- package/dist/state/zap/useSoulZapTokenQuote.js +0 -167
- 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/getNativeTicker.js +0 -8
- 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 -300
- 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/Bonds/index.js +0 -18
- 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/views/ZapModal/index.js +0 -150
- package/dist/views/ZapModal/styles.js +0 -35
- /package/dist/{enum → config/constants}/tooltips.d.ts +0 -0
|
@@ -1,397 +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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
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);
|
|
23
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
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;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
|
-
if (ar || !(i in from)) {
|
|
51
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
52
|
-
ar[i] = from[i];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
|
-
};
|
|
57
|
-
import { useQuery } from '@tanstack/react-query';
|
|
58
|
-
import { ChainId, defaultDexFactories, dexFactories, Protocols } from '@ape.swap/apeswap-lists';
|
|
59
|
-
import { LiquidityDex } from '@ape.swap/apeswap-lists';
|
|
60
|
-
import { cloneDeep } from 'lodash';
|
|
61
|
-
import axios from 'axios';
|
|
62
|
-
import { QUERY_KEYS } from '../../config/constants/queryKeys';
|
|
63
|
-
import { WNATIVE } from '../../config/constants/tokens';
|
|
64
|
-
import { getBalanceNumber } from '../../utils/getBalanceNumber';
|
|
65
|
-
import { PRICE_GETTER_ADDRESSES } from '../../config/constants/addresses';
|
|
66
|
-
import multicall from '../../utils/multicall';
|
|
67
|
-
import PRICE_GETTER_ABI from '../../config/abi/price-getter.json';
|
|
68
|
-
import PRICE_GETTER_ABI_LINEA from '../../config/abi/price-getter-linea.json';
|
|
69
|
-
import ERC20ABI from '../../config/abi/erc20.json';
|
|
70
|
-
import { ZERO_ADDRESS } from '../../config/constants/misc';
|
|
71
|
-
export default function useCurrencyPrice(currency, chainId) {
|
|
72
|
-
var _a;
|
|
73
|
-
return useQuery({
|
|
74
|
-
queryKey: [
|
|
75
|
-
QUERY_KEYS.CURRENCY_PRICE,
|
|
76
|
-
currency === 'NATIVE' ? currency : ((_a = currency === null || currency === void 0 ? void 0 : currency.address[chainId]) !== null && _a !== void 0 ? _a : ''),
|
|
77
|
-
chainId,
|
|
78
|
-
],
|
|
79
|
-
queryFn: function () { return getTokenPrice(currency, chainId); },
|
|
80
|
-
refetchInterval: 15000, // i.e. 10 sec
|
|
81
|
-
refetchOnWindowFocus: false,
|
|
82
|
-
retry: 1,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
export var getTokenPrice = function (currency, chainId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
-
var token, tokens, dexScreenerTokensToCall, filterTokensToCall, filterLpTokensToCall, arrayFilterTokens, parsedDexscreenerTokens, dexScreenerResults, tokenResults, lpTokenResults, parsedTokenResults, parsedLpTokenResults, prices;
|
|
87
|
-
var _a;
|
|
88
|
-
var _b;
|
|
89
|
-
return __generator(this, function (_c) {
|
|
90
|
-
switch (_c.label) {
|
|
91
|
-
case 0:
|
|
92
|
-
if (!currency || !chainId)
|
|
93
|
-
return [2 /*return*/, null];
|
|
94
|
-
token = currency === 'NATIVE' ? WNATIVE[chainId] : currency;
|
|
95
|
-
if (!token)
|
|
96
|
-
return [2 /*return*/, null];
|
|
97
|
-
tokens = (_a = {}, _a[token.address[chainId]] = token, _a);
|
|
98
|
-
dexScreenerTokensToCall = Object.fromEntries(Object.entries(tokens).filter(function (_a) {
|
|
99
|
-
var _b;
|
|
100
|
-
var token = _a[1];
|
|
101
|
-
return ((_b = token === null || token === void 0 ? void 0 : token.liquidityDex) === null || _b === void 0 ? void 0 : _b[chainId]) === LiquidityDex.External;
|
|
102
|
-
}));
|
|
103
|
-
filterTokensToCall = Object.fromEntries(Object.entries(tokens).filter(function (_a) {
|
|
104
|
-
var _b, _c;
|
|
105
|
-
var token = _a[1];
|
|
106
|
-
return ((token === null || token === void 0 ? void 0 : token.active) &&
|
|
107
|
-
!(token === null || token === void 0 ? void 0 : token.lpToken) &&
|
|
108
|
-
token.address[chainId] &&
|
|
109
|
-
((_b = token.decimals) === null || _b === void 0 ? void 0 : _b[chainId]) &&
|
|
110
|
-
((_c = token === null || token === void 0 ? void 0 : token.liquidityDex) === null || _c === void 0 ? void 0 : _c[chainId]) !== LiquidityDex.External);
|
|
111
|
-
}));
|
|
112
|
-
filterLpTokensToCall = Object.fromEntries(Object.entries(tokens).filter(function (_a) {
|
|
113
|
-
var _b, _c;
|
|
114
|
-
var token = _a[1];
|
|
115
|
-
return ((token === null || token === void 0 ? void 0 : token.active) &&
|
|
116
|
-
(token === null || token === void 0 ? void 0 : token.lpToken) &&
|
|
117
|
-
token.address[chainId] &&
|
|
118
|
-
((_b = token.decimals) === null || _b === void 0 ? void 0 : _b[chainId]) &&
|
|
119
|
-
((_c = token === null || token === void 0 ? void 0 : token.liquidityDex) === null || _c === void 0 ? void 0 : _c[chainId]) !== LiquidityDex.External);
|
|
120
|
-
}));
|
|
121
|
-
arrayFilterTokens = Object.values(filterTokensToCall);
|
|
122
|
-
parsedDexscreenerTokens = Object.values(dexScreenerTokensToCall).map(function (token) {
|
|
123
|
-
var _a, _b, _c, _d;
|
|
124
|
-
return __assign(__assign({}, token), { address: (_a = token.address[chainId]) !== null && _a !== void 0 ? _a : '', decimals: (_c = (_b = token === null || token === void 0 ? void 0 : token.decimals) === null || _b === void 0 ? void 0 : _b[chainId]) !== null && _c !== void 0 ? _c : 18, lpToken: (_d = token.lpToken) !== null && _d !== void 0 ? _d : false });
|
|
125
|
-
});
|
|
126
|
-
return [4 /*yield*/, getBatchTokenPriceWithDexscreener({ chainId: chainId, tokens: parsedDexscreenerTokens })];
|
|
127
|
-
case 1:
|
|
128
|
-
dexScreenerResults = _c.sent();
|
|
129
|
-
return [4 /*yield*/, getTokenPricesV2FromPriceGetter(filterTokensToCall, chainId, false)];
|
|
130
|
-
case 2:
|
|
131
|
-
tokenResults = _c.sent();
|
|
132
|
-
return [4 /*yield*/, getTokenPricesV2FromPriceGetter(filterLpTokensToCall, chainId, true)];
|
|
133
|
-
case 3:
|
|
134
|
-
lpTokenResults = _c.sent();
|
|
135
|
-
parsedTokenResults = arrayFilterTokens.map(function (token, i) {
|
|
136
|
-
var _a, _b, _c;
|
|
137
|
-
var price = getBalanceNumber((_a = tokenResults === null || tokenResults === void 0 ? void 0 : tokenResults[i]) === null || _a === void 0 ? void 0 : _a.toString(), 18);
|
|
138
|
-
return {
|
|
139
|
-
symbol: token.symbol,
|
|
140
|
-
address: token.address[chainId],
|
|
141
|
-
price: price !== null && price !== void 0 ? price : undefined,
|
|
142
|
-
decimals: (_c = (_b = token.decimals) === null || _b === void 0 ? void 0 : _b[chainId]) !== null && _c !== void 0 ? _c : undefined,
|
|
143
|
-
chainId: chainId,
|
|
144
|
-
};
|
|
145
|
-
});
|
|
146
|
-
parsedLpTokenResults = Object.values(filterLpTokensToCall).map(function (token, i) {
|
|
147
|
-
var _a, _b;
|
|
148
|
-
return {
|
|
149
|
-
symbol: token.symbol,
|
|
150
|
-
address: token.address[chainId],
|
|
151
|
-
price: getBalanceNumber(lpTokenResults[i].toString(), 18),
|
|
152
|
-
decimals: (_b = (_a = token.decimals) === null || _a === void 0 ? void 0 : _a[chainId]) !== null && _b !== void 0 ? _b : undefined,
|
|
153
|
-
chainId: chainId,
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
prices = __spreadArray(__spreadArray(__spreadArray([], parsedTokenResults, true), parsedLpTokenResults, true), dexScreenerResults, true);
|
|
157
|
-
return [2 /*return*/, (_b = prices.find(function (tokenPrice) { return !!tokenPrice; })) !== null && _b !== void 0 ? _b : null];
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}); };
|
|
161
|
-
var getBatchTokenPriceWithDexscreener = function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
162
|
-
var chainId, tokens, tokensCopy, baseURL_1, totalSupplies_1, chains_1, chainName_1, calls, result, error_1;
|
|
163
|
-
return __generator(this, function (_a) {
|
|
164
|
-
switch (_a.label) {
|
|
165
|
-
case 0:
|
|
166
|
-
chainId = params.chainId, tokens = params.tokens;
|
|
167
|
-
tokensCopy = cloneDeep(tokens);
|
|
168
|
-
_a.label = 1;
|
|
169
|
-
case 1:
|
|
170
|
-
_a.trys.push([1, 3, , 4]);
|
|
171
|
-
baseURL_1 = 'https://api.dexscreener.com/latest/dex';
|
|
172
|
-
totalSupplies_1 = [];
|
|
173
|
-
chains_1 = [];
|
|
174
|
-
chainName_1 = getDexScreenerChainName(chainId);
|
|
175
|
-
calls = tokensCopy.map(function (token) { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
|
-
var symbol, lpToken, totalSupply, decimals, endpoint, calls_1, supply, _a, url, response, error_2;
|
|
177
|
-
return __generator(this, function (_b) {
|
|
178
|
-
switch (_b.label) {
|
|
179
|
-
case 0:
|
|
180
|
-
symbol = token.symbol, lpToken = token.lpToken, totalSupply = token.totalSupply, decimals = token.decimals;
|
|
181
|
-
if (['USDT', 'USDC'].includes(symbol)) {
|
|
182
|
-
chains_1.push('injective');
|
|
183
|
-
return [2 /*return*/, {
|
|
184
|
-
pairs: [
|
|
185
|
-
{
|
|
186
|
-
chainId: chainName_1,
|
|
187
|
-
baseToken: {
|
|
188
|
-
address: token.address,
|
|
189
|
-
},
|
|
190
|
-
liquidity: {
|
|
191
|
-
usd: 1,
|
|
192
|
-
},
|
|
193
|
-
priceUsd: 1,
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
}];
|
|
197
|
-
}
|
|
198
|
-
if (symbol.toLowerCase() === 'inj' || symbol.toLowerCase() === 'winj') {
|
|
199
|
-
token.address = 'inj';
|
|
200
|
-
}
|
|
201
|
-
if (!chainName_1) {
|
|
202
|
-
console.log("Chain ".concat(chainId, " is not supported by dexscreener."));
|
|
203
|
-
return [2 /*return*/, null];
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
chains_1.push(chainName_1);
|
|
207
|
-
}
|
|
208
|
-
if (!lpToken) return [3 /*break*/, 4];
|
|
209
|
-
if (!!totalSupply) return [3 /*break*/, 2];
|
|
210
|
-
calls_1 = [
|
|
211
|
-
{
|
|
212
|
-
address: token.address,
|
|
213
|
-
name: 'totalSupply',
|
|
214
|
-
},
|
|
215
|
-
];
|
|
216
|
-
_a = getBalanceNumber;
|
|
217
|
-
return [4 /*yield*/, multicall(chainId, ERC20ABI, calls_1)];
|
|
218
|
-
case 1:
|
|
219
|
-
supply = _a.apply(void 0, [(_b.sent())[0], decimals]);
|
|
220
|
-
totalSupplies_1.push(supply);
|
|
221
|
-
return [3 /*break*/, 3];
|
|
222
|
-
case 2:
|
|
223
|
-
totalSupplies_1.push(totalSupply);
|
|
224
|
-
_b.label = 3;
|
|
225
|
-
case 3:
|
|
226
|
-
endpoint = "pairs/".concat(chainName_1);
|
|
227
|
-
return [3 /*break*/, 5];
|
|
228
|
-
case 4:
|
|
229
|
-
endpoint = "tokens";
|
|
230
|
-
_b.label = 5;
|
|
231
|
-
case 5:
|
|
232
|
-
url = "".concat(baseURL_1, "/").concat(endpoint, "/").concat(token.address);
|
|
233
|
-
_b.label = 6;
|
|
234
|
-
case 6:
|
|
235
|
-
_b.trys.push([6, 8, , 9]);
|
|
236
|
-
return [4 /*yield*/, axios.get(url)];
|
|
237
|
-
case 7:
|
|
238
|
-
response = _b.sent();
|
|
239
|
-
return [2 /*return*/, response.data];
|
|
240
|
-
case 8:
|
|
241
|
-
error_2 = _b.sent();
|
|
242
|
-
console.log("Failed to fetch data for token ".concat(token.address, ": ").concat(error_2));
|
|
243
|
-
return [2 /*return*/, null];
|
|
244
|
-
case 9: return [2 /*return*/];
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}); });
|
|
248
|
-
return [4 /*yield*/, Promise.all(calls)];
|
|
249
|
-
case 2:
|
|
250
|
-
result = _a.sent();
|
|
251
|
-
return [2 /*return*/, result.map(function (response, index) {
|
|
252
|
-
var _a;
|
|
253
|
-
if (!response || !response.pairs) {
|
|
254
|
-
return __assign(__assign({}, tokensCopy === null || tokensCopy === void 0 ? void 0 : tokensCopy[index]), { price: undefined, chainId: chainId });
|
|
255
|
-
}
|
|
256
|
-
var supply = totalSupplies_1[index];
|
|
257
|
-
var token = tokensCopy[index];
|
|
258
|
-
var price;
|
|
259
|
-
try {
|
|
260
|
-
if (token.lpToken) {
|
|
261
|
-
var liquidity = response.pair.liquidity.usd;
|
|
262
|
-
price = liquidity / supply;
|
|
263
|
-
}
|
|
264
|
-
else {
|
|
265
|
-
var pairs = response.pairs;
|
|
266
|
-
price = (_a = pairs
|
|
267
|
-
.filter(function (pair) {
|
|
268
|
-
return pair.chainId === chainName_1 && pair.baseToken.address.toLowerCase() === token.address.toLowerCase();
|
|
269
|
-
})
|
|
270
|
-
.sort(function (a, b) { var _a, _b; return ((_a = b === null || b === void 0 ? void 0 : b.liquidity) === null || _a === void 0 ? void 0 : _a.usd) - ((_b = a === null || a === void 0 ? void 0 : a.liquidity) === null || _b === void 0 ? void 0 : _b.usd); })[0]) === null || _a === void 0 ? void 0 : _a.priceUsd;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
catch (error) {
|
|
274
|
-
price = undefined;
|
|
275
|
-
}
|
|
276
|
-
return __assign(__assign({}, tokensCopy === null || tokensCopy === void 0 ? void 0 : tokensCopy[index]), { address: token.address === 'inj' ? '0x4569348D39cc38F4d6a1180573Df73B7b03251d9' : token.address, chainId: chainId, price: parseFloat(price !== null && price !== void 0 ? price : '0') });
|
|
277
|
-
})];
|
|
278
|
-
case 3:
|
|
279
|
-
error_1 = _a.sent();
|
|
280
|
-
console.log("Failed to get price from dexscreener for chain ".concat(chainId, "."));
|
|
281
|
-
return [2 /*return*/, tokensCopy.map(function (token) {
|
|
282
|
-
return __assign(__assign({}, token), { chainId: chainId, price: undefined });
|
|
283
|
-
})];
|
|
284
|
-
case 4: return [2 /*return*/];
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}); };
|
|
288
|
-
export var getDexScreenerChainName = function (chainId) {
|
|
289
|
-
var _a;
|
|
290
|
-
var chainsName = (_a = {},
|
|
291
|
-
_a[ChainId.MAINNET] = 'ethereum',
|
|
292
|
-
_a[ChainId.TLOS] = 'telos',
|
|
293
|
-
_a[ChainId.BSC] = 'bsc',
|
|
294
|
-
_a[ChainId.MATIC] = 'polygon',
|
|
295
|
-
_a[ChainId.ARBITRUM] = 'arbitrum',
|
|
296
|
-
_a[ChainId.INEVM] = 'injective',
|
|
297
|
-
_a[ChainId.LINEA] = 'linea',
|
|
298
|
-
_a);
|
|
299
|
-
//@ts-ignore
|
|
300
|
-
return chainsName[chainId];
|
|
301
|
-
};
|
|
302
|
-
export function getTokenPricesV2FromPriceGetter(tokensToCall_1, chain_1) {
|
|
303
|
-
return __awaiter(this, arguments, void 0, function (tokensToCall, chain, lpTokens) {
|
|
304
|
-
var tokenCalls, calls, tokenResults;
|
|
305
|
-
if (lpTokens === void 0) { lpTokens = false; }
|
|
306
|
-
return __generator(this, function (_a) {
|
|
307
|
-
switch (_a.label) {
|
|
308
|
-
case 0:
|
|
309
|
-
tokenCalls = getPriceGetterCallData(tokensToCall, chain, lpTokens);
|
|
310
|
-
calls = tokenCalls.map(function (t) { return ({
|
|
311
|
-
address: PRICE_GETTER_ADDRESSES[chain],
|
|
312
|
-
name: lpTokens ? 'getLPPriceFromFactory' : 'getPriceFromFactory',
|
|
313
|
-
params: t,
|
|
314
|
-
}); });
|
|
315
|
-
return [4 /*yield*/, multicall(+chain, [ChainId.LINEA, ChainId.LIGHTLINK, ChainId.IOTA, ChainId.BASE, ChainId.ARBITRUM].includes(chain)
|
|
316
|
-
? PRICE_GETTER_ABI_LINEA
|
|
317
|
-
: PRICE_GETTER_ABI, calls)];
|
|
318
|
-
case 1:
|
|
319
|
-
tokenResults = _a.sent();
|
|
320
|
-
return [2 /*return*/, tokenResults];
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
export function getPriceGetterCallData(tokensToCall, // replace 'any' with the actual type
|
|
326
|
-
supportedChainId, lpTokens) {
|
|
327
|
-
return Object.values(tokensToCall).map(function (token) {
|
|
328
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
329
|
-
var liquidityDex = (_a = token.liquidityDex) === null || _a === void 0 ? void 0 : _a[supportedChainId];
|
|
330
|
-
var dexFactory;
|
|
331
|
-
var protocol = 2;
|
|
332
|
-
var factoryV2 = (_c = (_b = defaultDexFactories === null || defaultDexFactories === void 0 ? void 0 : defaultDexFactories[supportedChainId]) === null || _b === void 0 ? void 0 : _b[2]) !== null && _c !== void 0 ? _c : ZERO_ADDRESS;
|
|
333
|
-
var factoryV3 = (_e = (_d = defaultDexFactories === null || defaultDexFactories === void 0 ? void 0 : defaultDexFactories[supportedChainId]) === null || _d === void 0 ? void 0 : _d[3]) !== null && _e !== void 0 ? _e : ZERO_ADDRESS;
|
|
334
|
-
var factoryAlgebra = (_g = (_f = defaultDexFactories === null || defaultDexFactories === void 0 ? void 0 : defaultDexFactories[supportedChainId]) === null || _f === void 0 ? void 0 : _f[4]) !== null && _g !== void 0 ? _g : ZERO_ADDRESS;
|
|
335
|
-
var factorySolidly = (_j = (_h = defaultDexFactories === null || defaultDexFactories === void 0 ? void 0 : defaultDexFactories[supportedChainId]) === null || _h === void 0 ? void 0 : _h[7]) !== null && _j !== void 0 ? _j : ZERO_ADDRESS;
|
|
336
|
-
var factoryXFAI = (_l = (_k = defaultDexFactories === null || defaultDexFactories === void 0 ? void 0 : defaultDexFactories[supportedChainId]) === null || _k === void 0 ? void 0 : _k[8]) !== null && _l !== void 0 ? _l : ZERO_ADDRESS;
|
|
337
|
-
if (liquidityDex) {
|
|
338
|
-
dexFactory = (_m = dexFactories[supportedChainId]) === null || _m === void 0 ? void 0 : _m[liquidityDex];
|
|
339
|
-
protocol = (_o = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.protocol) !== null && _o !== void 0 ? _o : Protocols.V2;
|
|
340
|
-
switch (protocol) {
|
|
341
|
-
case Protocols.V2:
|
|
342
|
-
factoryV2 = (_p = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _p !== void 0 ? _p : factoryV2;
|
|
343
|
-
break;
|
|
344
|
-
case Protocols.V3:
|
|
345
|
-
factoryV3 = (_q = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _q !== void 0 ? _q : factoryV3;
|
|
346
|
-
break;
|
|
347
|
-
case Protocols.Algebra:
|
|
348
|
-
factoryAlgebra = (_r = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _r !== void 0 ? _r : factoryAlgebra;
|
|
349
|
-
break;
|
|
350
|
-
case Protocols.Solidly:
|
|
351
|
-
factorySolidly = (_s = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _s !== void 0 ? _s : factorySolidly;
|
|
352
|
-
break;
|
|
353
|
-
case Protocols.XFAI:
|
|
354
|
-
factoryXFAI = (_t = dexFactory === null || dexFactory === void 0 ? void 0 : dexFactory.factory) !== null && _t !== void 0 ? _t : factoryXFAI;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
var errMsg = "No default dex factory found for retrieving price. For Protocol: ".concat(protocol, ".");
|
|
358
|
-
switch (protocol) {
|
|
359
|
-
case Protocols.Both:
|
|
360
|
-
if (factoryV2 === ZERO_ADDRESS || factoryV3 === ZERO_ADDRESS) {
|
|
361
|
-
throw new Error(errMsg);
|
|
362
|
-
}
|
|
363
|
-
break;
|
|
364
|
-
case Protocols.V2:
|
|
365
|
-
if (factoryV2 === ZERO_ADDRESS) {
|
|
366
|
-
throw new Error(errMsg);
|
|
367
|
-
}
|
|
368
|
-
break;
|
|
369
|
-
case Protocols.V3:
|
|
370
|
-
if (factoryV3 === ZERO_ADDRESS) {
|
|
371
|
-
throw new Error(errMsg);
|
|
372
|
-
}
|
|
373
|
-
break;
|
|
374
|
-
}
|
|
375
|
-
// TODO: Not sure if this is the best way to handle this. It requires all tokens to be either LP or not
|
|
376
|
-
if (lpTokens && protocol == Protocols.Algebra) {
|
|
377
|
-
protocol = Protocols.Gamma;
|
|
378
|
-
}
|
|
379
|
-
if (lpTokens && protocol == Protocols.V3 && supportedChainId !== ChainId.ARBITRUM) {
|
|
380
|
-
protocol = Protocols.Steer;
|
|
381
|
-
}
|
|
382
|
-
if ([ChainId.LINEA, ChainId.LIGHTLINK, ChainId.IOTA, ChainId.BASE, ChainId.ARBITRUM].includes(supportedChainId) &&
|
|
383
|
-
!token.lpToken) {
|
|
384
|
-
return [
|
|
385
|
-
token.address[supportedChainId],
|
|
386
|
-
protocol,
|
|
387
|
-
factoryV2,
|
|
388
|
-
factoryV3,
|
|
389
|
-
factoryAlgebra,
|
|
390
|
-
factorySolidly,
|
|
391
|
-
factoryXFAI,
|
|
392
|
-
];
|
|
393
|
-
}
|
|
394
|
-
else
|
|
395
|
-
return [token.address[supportedChainId], protocol, factoryV2, factoryV3, factoryAlgebra, factorySolidly];
|
|
396
|
-
});
|
|
397
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ChainId, Protocols } from "@ape.swap/apeswap-lists";
|
|
2
|
-
var NetworkNames;
|
|
3
|
-
(function (NetworkNames) {
|
|
4
|
-
NetworkNames["ETHEREUM"] = "eth";
|
|
5
|
-
NetworkNames["BNB"] = "bnb";
|
|
6
|
-
NetworkNames["POLYGON"] = "pol";
|
|
7
|
-
NetworkNames["ARBITRUM"] = "arb";
|
|
8
|
-
NetworkNames["LINEA"] = "lna";
|
|
9
|
-
NetworkNames["BASE"] = "bas";
|
|
10
|
-
})(NetworkNames || (NetworkNames = {}));
|
|
11
|
-
export var getChainParam = function (chain) {
|
|
12
|
-
return chain === ChainId.LINEA
|
|
13
|
-
? NetworkNames.LINEA
|
|
14
|
-
: chain === ChainId.MATIC
|
|
15
|
-
? NetworkNames.POLYGON
|
|
16
|
-
: chain === ChainId.BSC
|
|
17
|
-
? NetworkNames.BNB
|
|
18
|
-
: chain === ChainId.BASE
|
|
19
|
-
? NetworkNames.BASE
|
|
20
|
-
: chain === ChainId.ARBITRUM
|
|
21
|
-
? NetworkNames.ARBITRUM
|
|
22
|
-
: null;
|
|
23
|
-
};
|
|
24
|
-
export var getLpType = function (protocol) {
|
|
25
|
-
return protocol === Protocols.Algebra
|
|
26
|
-
? 'ichi'
|
|
27
|
-
: protocol === Protocols.Solidly
|
|
28
|
-
? 'solidly'
|
|
29
|
-
: protocol === Protocols.V2
|
|
30
|
-
? 'univ2'
|
|
31
|
-
: protocol === Protocols.V3 // This might be a hot fix. Lets revisit this on the future
|
|
32
|
-
? 'ichi'
|
|
33
|
-
: null;
|
|
34
|
-
};
|
|
@@ -1,177 +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
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
-
if (ar || !(i in from)) {
|
|
40
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
-
ar[i] = from[i];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
-
};
|
|
46
|
-
import { useMemo } from 'react';
|
|
47
|
-
import BigNumber from 'bignumber.js';
|
|
48
|
-
import { dexFactories } from '@ape.swap/apeswap-lists';
|
|
49
|
-
import { getChainParam, getLpType } from './getChainParam';
|
|
50
|
-
import axios from 'axios';
|
|
51
|
-
import { useQuery } from '@tanstack/react-query';
|
|
52
|
-
import { QUERY_KEYS } from '../../config/constants/queryKeys';
|
|
53
|
-
import { zapInputTokens } from '../../config/constants/zapInputTokens';
|
|
54
|
-
import useCurrencyPrice from '../../state/price/useCurrencyPrice';
|
|
55
|
-
var useSoulZapBondQuote = function (typedValue, inputCurrency, bond, account) {
|
|
56
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
57
|
-
var allowedSlippage = '0.5';
|
|
58
|
-
var principalToken = bond === null || bond === void 0 ? void 0 : bond.lpToken;
|
|
59
|
-
var bondContractAddress = bond === null || bond === void 0 ? void 0 : bond.billAddress;
|
|
60
|
-
var chainId = bond === null || bond === void 0 ? void 0 : bond.chainId;
|
|
61
|
-
var inputCurrencyString = inputCurrency === 'NATIVE' ? '0x0000000000000000000000000000000000000000' : inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.address[chainId];
|
|
62
|
-
var inputCurrencyDecimals = inputCurrency === 'NATIVE' ? 18 : inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.decimals[chainId];
|
|
63
|
-
var principalContractAddress = principalToken === null || principalToken === void 0 ? void 0 : principalToken.address[chainId];
|
|
64
|
-
var chainName = getChainParam(chainId);
|
|
65
|
-
var isReserveBond = (bond === null || bond === void 0 ? void 0 : bond.type) === 'reserve';
|
|
66
|
-
var liquidityDex = (_a = principalToken === null || principalToken === void 0 ? void 0 : principalToken.liquidityDex) === null || _a === void 0 ? void 0 : _a[chainId];
|
|
67
|
-
var protocol = (_c = (_b = dexFactories[chainId]) === null || _b === void 0 ? void 0 : _b[liquidityDex]) === null || _c === void 0 ? void 0 : _c.protocol;
|
|
68
|
-
var lpType = isReserveBond ? 'single' : getLpType(protocol);
|
|
69
|
-
var ichiUnderlyingDex = principalToken === null || principalToken === void 0 ? void 0 : principalToken.ichiUnderlyingDex;
|
|
70
|
-
var vault = (_d = principalToken === null || principalToken === void 0 ? void 0 : principalToken.address) === null || _d === void 0 ? void 0 : _d[chainId];
|
|
71
|
-
var router = (_f = (_e = dexFactories[chainId]) === null || _e === void 0 ? void 0 : _e[liquidityDex]) === null || _f === void 0 ? void 0 : _f.router;
|
|
72
|
-
// Validates that the user did not pass an amount with 19 decimals or more
|
|
73
|
-
var validated18DecimalAmount = new BigNumber(typedValue !== null && typedValue !== void 0 ? typedValue : '0').toFixed(18, 5);
|
|
74
|
-
var bigishInputAmount = new BigNumber(validated18DecimalAmount !== null && validated18DecimalAmount !== void 0 ? validated18DecimalAmount : '0')
|
|
75
|
-
.times(new BigNumber(10).pow(inputCurrencyDecimals !== null && inputCurrencyDecimals !== void 0 ? inputCurrencyDecimals : 18))
|
|
76
|
-
.toString();
|
|
77
|
-
var zapInputData = useMemo(function () {
|
|
78
|
-
if (inputCurrencyString &&
|
|
79
|
-
inputCurrencyDecimals &&
|
|
80
|
-
bigishInputAmount !== 'NaN' &&
|
|
81
|
-
bigishInputAmount !== '0' &&
|
|
82
|
-
principalContractAddress &&
|
|
83
|
-
chainName &&
|
|
84
|
-
bondContractAddress &&
|
|
85
|
-
(inputCurrency === 'NATIVE' || (inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.address[chainId]) !== principalToken.address[chainId])) {
|
|
86
|
-
return {
|
|
87
|
-
chain: chainName,
|
|
88
|
-
recipient: account !== null && account !== void 0 ? account : '',
|
|
89
|
-
user: account !== null && account !== void 0 ? account : '',
|
|
90
|
-
lpData: {
|
|
91
|
-
lpType: lpType,
|
|
92
|
-
fromToken: inputCurrencyString,
|
|
93
|
-
fromAmount: bigishInputAmount,
|
|
94
|
-
underlyingDex: ichiUnderlyingDex,
|
|
95
|
-
vault: isReserveBond ? undefined : vault,
|
|
96
|
-
slippage: parseFloat(allowedSlippage !== null && allowedSlippage !== void 0 ? allowedSlippage : '0.5'),
|
|
97
|
-
lpAddress: lpType === 'solidly' || lpType === 'univ2' ? vault : undefined,
|
|
98
|
-
router: lpType === 'solidly' || lpType === 'univ2' ? router : undefined,
|
|
99
|
-
toToken: isReserveBond ? vault : undefined,
|
|
100
|
-
},
|
|
101
|
-
protocolData: {
|
|
102
|
-
protocol: 'ApeBond',
|
|
103
|
-
bond: bondContractAddress,
|
|
104
|
-
depositer: account !== null && account !== void 0 ? account : null,
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
}, [bigishInputAmount, principalContractAddress, chainName, account, ichiUnderlyingDex, vault, lpType, router]);
|
|
112
|
-
var queryKey = useMemo(function () {
|
|
113
|
-
var _a, _b;
|
|
114
|
-
if (!zapInputData)
|
|
115
|
-
return null;
|
|
116
|
-
return [
|
|
117
|
-
'zapBondDetails',
|
|
118
|
-
zapInputData.chain,
|
|
119
|
-
zapInputData.user,
|
|
120
|
-
zapInputData.lpData.lpType,
|
|
121
|
-
zapInputData.lpData.fromToken,
|
|
122
|
-
zapInputData.lpData.fromAmount,
|
|
123
|
-
(_a = zapInputData.lpData.underlyingDex) !== null && _a !== void 0 ? _a : '',
|
|
124
|
-
zapInputData.lpData.vault,
|
|
125
|
-
zapInputData.lpData.slippage,
|
|
126
|
-
zapInputData.lpData.lpAddress,
|
|
127
|
-
(_b = zapInputData.lpData.router) !== null && _b !== void 0 ? _b : '',
|
|
128
|
-
];
|
|
129
|
-
}, [zapInputData]);
|
|
130
|
-
var fetchZapDetails = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
131
|
-
var response;
|
|
132
|
-
var _a, _b, _c, _d, _e, _f;
|
|
133
|
-
return __generator(this, function (_g) {
|
|
134
|
-
switch (_g.label) {
|
|
135
|
-
case 0:
|
|
136
|
-
console.log('Making Bond Zap call');
|
|
137
|
-
return [4 /*yield*/, axios.post('https://soulsolidity-zap-api-902f1d839e8d.herokuapp.com/zap?batch=1', {
|
|
138
|
-
'0': zapInputData,
|
|
139
|
-
})];
|
|
140
|
-
case 1:
|
|
141
|
-
response = _g.sent();
|
|
142
|
-
console.log((_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.result) === null || _c === void 0 ? void 0 : _c.data);
|
|
143
|
-
return [2 /*return*/, (_f = (_e = (_d = response.data) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.result) === null || _f === void 0 ? void 0 : _f.data];
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}); };
|
|
147
|
-
var _4 = useQuery({
|
|
148
|
-
queryKey: [QUERY_KEYS.ZAP_TOKEN_QUOTE, queryKey],
|
|
149
|
-
queryFn: fetchZapDetails,
|
|
150
|
-
enabled: !!queryKey,
|
|
151
|
-
}), response = _4.data, isLoading = _4.isLoading;
|
|
152
|
-
var tokenList = zapInputTokens[chainId] ? zapInputTokens[chainId] : [];
|
|
153
|
-
// toToken0 data
|
|
154
|
-
var toToken0Estimate = (_g = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _g === void 0 ? void 0 : _g.token0.fromAmountEstimate;
|
|
155
|
-
var toToken0 = (_h = __spreadArray(__spreadArray([], tokenList, true), [principalToken], false)) === null || _h === void 0 ? void 0 : _h.find(function (token) { var _a, _b, _c, _d, _e; return ((_b = (_a = token === null || token === void 0 ? void 0 : token.address) === null || _a === void 0 ? void 0 : _a[chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_e = (_d = (_c = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _c === void 0 ? void 0 : _c.token0) === null || _d === void 0 ? void 0 : _d.address) === null || _e === void 0 ? void 0 : _e.toLowerCase()); });
|
|
156
|
-
var toToken0Price = useCurrencyPrice(toToken0 !== null && toToken0 !== void 0 ? toToken0 : null, chainId).data;
|
|
157
|
-
// toToken1 data
|
|
158
|
-
var toToken1Estimate = (_k = (_j = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _j === void 0 ? void 0 : _j.token1) === null || _k === void 0 ? void 0 : _k.fromAmountEstimate;
|
|
159
|
-
var toToken1 = (_l = zapInputTokens[chainId]) === null || _l === void 0 ? void 0 : _l.find(function (token) { var _a, _b, _c, _d; return ((_a = token.address[chainId]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _b === void 0 ? void 0 : _b.token1) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d.toLowerCase()); });
|
|
160
|
-
var toToken1Price = useCurrencyPrice(toToken1 !== null && toToken1 !== void 0 ? toToken1 : null, chainId).data;
|
|
161
|
-
var toToken0USD = (_p = (_m = new BigNumber(toToken0Estimate !== null && toToken0Estimate !== void 0 ? toToken0Estimate : '0')) === null || _m === void 0 ? void 0 : _m.div(new BigNumber(10).pow((_o = toToken0 === null || toToken0 === void 0 ? void 0 : toToken0.decimals[chainId]) !== null && _o !== void 0 ? _o : 18)) // this is amount of swap output
|
|
162
|
-
) === null || _p === void 0 ? void 0 : _p.times(new BigNumber((_q = toToken0Price === null || toToken0Price === void 0 ? void 0 : toToken0Price.price) !== null && _q !== void 0 ? _q : 0)); // convert it to usd price
|
|
163
|
-
if ((_s = (_r = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _r === void 0 ? void 0 : _r.token0) === null || _s === void 0 ? void 0 : _s.fromAmountUSD) {
|
|
164
|
-
toToken0USD = new BigNumber((_u = (_t = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _t === void 0 ? void 0 : _t.token0) === null || _u === void 0 ? void 0 : _u.fromAmountUSD);
|
|
165
|
-
}
|
|
166
|
-
var toToken1USD = (_x = (_v = new BigNumber(toToken1Estimate !== null && toToken1Estimate !== void 0 ? toToken1Estimate : '0')) === null || _v === void 0 ? void 0 : _v.div(new BigNumber(10).pow((_w = toToken1 === null || toToken1 === void 0 ? void 0 : toToken1.decimals[chainId]) !== null && _w !== void 0 ? _w : 18)) // this is amount of swap output
|
|
167
|
-
) === null || _x === void 0 ? void 0 : _x.times(new BigNumber((_y = toToken1Price === null || toToken1Price === void 0 ? void 0 : toToken1Price.price) !== null && _y !== void 0 ? _y : 0)); // convert it to usd price
|
|
168
|
-
if ((_0 = (_z = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _z === void 0 ? void 0 : _z.token0) === null || _0 === void 0 ? void 0 : _0.fromAmountUSD) {
|
|
169
|
-
toToken1USD = new BigNumber((_2 = (_1 = response === null || response === void 0 ? void 0 : response.lpQuote) === null || _1 === void 0 ? void 0 : _1.token1) === null || _2 === void 0 ? void 0 : _2.fromAmountUSD);
|
|
170
|
-
}
|
|
171
|
-
var totalUSDAmount = toToken0USD.plus(toToken1USD);
|
|
172
|
-
var ouputTokenPrice = useCurrencyPrice(principalToken !== null && principalToken !== void 0 ? principalToken : null, chainId).data;
|
|
173
|
-
var lpAmount = totalUSDAmount.div((_3 = ouputTokenPrice === null || ouputTokenPrice === void 0 ? void 0 : ouputTokenPrice.price) !== null && _3 !== void 0 ? _3 : 0); // then we divide the lp USD price to get the amount of LP tokens
|
|
174
|
-
var estimateOutput = lpAmount.toFixed(18);
|
|
175
|
-
return [isLoading, response, estimateOutput];
|
|
176
|
-
};
|
|
177
|
-
export default useSoulZapBondQuote;
|