@velora-dex/widget 0.0.13 → 0.0.15
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/ui/accordion.js +0 -10
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/badge.js +0 -10
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.js +0 -10
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.js +0 -10
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/counter.js +0 -10
- package/dist/components/ui/counter.js.map +1 -1
- package/dist/components/ui/dialog.js +0 -10
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.js +0 -10
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js +19 -35
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/header.js +0 -10
- package/dist/components/ui/header.js.map +1 -1
- package/dist/components/ui/input.js +0 -10
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/select.js +0 -10
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/skeleton.js +0 -10
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/sonner.js +0 -10
- package/dist/components/ui/sonner.js.map +1 -1
- package/dist/components/ui/switch.js +0 -10
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/tooltip.js +0 -10
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/ui/vaul/browser.js +0 -10
- package/dist/components/ui/vaul/browser.js.map +1 -1
- package/dist/components/ui/vaul/constants.js +0 -10
- package/dist/components/ui/vaul/constants.js.map +1 -1
- package/dist/components/ui/vaul/context.js +0 -10
- package/dist/components/ui/vaul/context.js.map +1 -1
- package/dist/components/ui/vaul/helpers.js +0 -10
- package/dist/components/ui/vaul/helpers.js.map +1 -1
- package/dist/components/ui/vaul/index.js +1 -11
- package/dist/components/ui/vaul/index.js.map +1 -1
- package/dist/components/ui/vaul/use-composed-refs.js +0 -10
- package/dist/components/ui/vaul/use-composed-refs.js.map +1 -1
- package/dist/components/ui/vaul/use-controllable-state.js +0 -10
- package/dist/components/ui/vaul/use-controllable-state.js.map +1 -1
- package/dist/components/ui/vaul/use-position-fixed.js +0 -10
- package/dist/components/ui/vaul/use-position-fixed.js.map +1 -1
- package/dist/components/ui/vaul/use-prevent-scroll.js +0 -10
- package/dist/components/ui/vaul/use-prevent-scroll.js.map +1 -1
- package/dist/components/ui/vaul/use-scale-background.js +0 -10
- package/dist/components/ui/vaul/use-scale-background.js.map +1 -1
- package/dist/components/ui/vaul/use-snap-points.js +0 -10
- package/dist/components/ui/vaul/use-snap-points.js.map +1 -1
- package/dist/components/web3/AccountButton.js +0 -10
- package/dist/components/web3/AccountButton.js.map +1 -1
- package/dist/components/web3/ConnectWallets/WalletConnectButtons.js +0 -10
- package/dist/components/web3/ConnectWallets/WalletConnectButtons.js.map +1 -1
- package/dist/components/web3/ConnectWallets/index.js +0 -10
- package/dist/components/web3/ConnectWallets/index.js.map +1 -1
- package/dist/components/web3/ConnectWallets/privy/button.js +0 -10
- package/dist/components/web3/ConnectWallets/privy/button.js.map +1 -1
- package/dist/components/web3/ConnectWallets/privy/connectRunner.js +0 -10
- package/dist/components/web3/ConnectWallets/privy/connectRunner.js.map +1 -1
- package/dist/components/web3/ConnectWallets/privy/iframe.js +0 -10
- package/dist/components/web3/ConnectWallets/privy/iframe.js.map +1 -1
- package/dist/components/web3/ConnectWallets/privy/provider.js +0 -10
- package/dist/components/web3/ConnectWallets/privy/provider.js.map +1 -1
- package/dist/components/web3/ConnectWallets/walletIcons.js +0 -10
- package/dist/components/web3/ConnectWallets/walletIcons.js.map +1 -1
- package/dist/components/web3/providers.js +0 -10
- package/dist/components/web3/providers.js.map +1 -1
- package/dist/components/widget/AppHeader/ActivityButton.js +0 -10
- package/dist/components/widget/AppHeader/ActivityButton.js.map +1 -1
- package/dist/components/widget/AppHeader/AppHeader.js +0 -10
- package/dist/components/widget/AppHeader/AppHeader.js.map +1 -1
- package/dist/components/widget/Details/DetailWithTooltip.js +0 -10
- package/dist/components/widget/Details/DetailWithTooltip.js.map +1 -1
- package/dist/components/widget/Details/DetailWithValueList.js +0 -10
- package/dist/components/widget/Details/DetailWithValueList.js.map +1 -1
- package/dist/components/widget/Details/DetailWithValueListExpandable.js +0 -10
- package/dist/components/widget/Details/DetailWithValueListExpandable.js.map +1 -1
- package/dist/components/widget/Details/SwapDetailsExpandable.js +0 -10
- package/dist/components/widget/Details/SwapDetailsExpandable.js.map +1 -1
- package/dist/components/widget/Dialog/ConnectWalletDialog/ConnectWalletDialog.js +0 -10
- package/dist/components/widget/Dialog/ConnectWalletDialog/ConnectWalletDialog.js.map +1 -1
- package/dist/components/widget/Dialog/DialogRoot.js +0 -10
- package/dist/components/widget/Dialog/DialogRoot.js.map +1 -1
- package/dist/components/widget/Dialog/ReceiverAddressDialog/ReceiverAddressDialog.js +0 -10
- package/dist/components/widget/Dialog/ReceiverAddressDialog/ReceiverAddressDialog.js.map +1 -1
- package/dist/components/widget/Dialog/ReceiverAddressDialog/ReceiverAddressInput.js +0 -10
- package/dist/components/widget/Dialog/ReceiverAddressDialog/ReceiverAddressInput.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/SelectTokenDialog.js +0 -10
- package/dist/components/widget/Dialog/SelectTokenDialog/SelectTokenDialog.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/AcrossTokenList.js +0 -10
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/AcrossTokenList.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/RegularTokenList.js +0 -10
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/RegularTokenList.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/TokenListBody.js +0 -10
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/TokenListBody.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenSearch.js +0 -10
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenSearch.js.map +1 -1
- package/dist/components/widget/Dialog/dialogByType.js +0 -10
- package/dist/components/widget/Dialog/dialogByType.js.map +1 -1
- package/dist/components/widget/Dialog/state/dialogAtom.js +1 -12
- package/dist/components/widget/Dialog/state/dialogAtom.js.map +1 -1
- package/dist/components/widget/Drawer/index.js +0 -10
- package/dist/components/widget/Drawer/index.js.map +1 -1
- package/dist/components/widget/Drawer/state/useDrawerControls.d.ts +1 -1
- package/dist/components/widget/Drawer/state/useDrawerControls.d.ts.map +1 -1
- package/dist/components/widget/Drawer/state/useDrawerControls.js +36 -36
- package/dist/components/widget/Drawer/state/useDrawerControls.js.map +1 -1
- package/dist/components/widget/Dropdown/DropdownWithItems.js +0 -10
- package/dist/components/widget/Dropdown/DropdownWithItems.js.map +1 -1
- package/dist/components/widget/Icon/CheckIcon.js +0 -10
- package/dist/components/widget/Icon/CheckIcon.js.map +1 -1
- package/dist/components/widget/Icon/ChevronIcon.js +0 -10
- package/dist/components/widget/Icon/ChevronIcon.js.map +1 -1
- package/dist/components/widget/Icon/DeltaIcon.js +0 -10
- package/dist/components/widget/Icon/DeltaIcon.js.map +1 -1
- package/dist/components/widget/Icon/EllipseIcon.js +0 -10
- package/dist/components/widget/Icon/EllipseIcon.js.map +1 -1
- package/dist/components/widget/Icon/InfoIcon.js +0 -10
- package/dist/components/widget/Icon/InfoIcon.js.map +1 -1
- package/dist/components/widget/Icon/MarketIcon.js +0 -10
- package/dist/components/widget/Icon/MarketIcon.js.map +1 -1
- package/dist/components/widget/Icon/SliderIcon.js +0 -10
- package/dist/components/widget/Icon/SliderIcon.js.map +1 -1
- package/dist/components/widget/Informative/Informative.js +0 -10
- package/dist/components/widget/Informative/Informative.js.map +1 -1
- package/dist/components/widget/Line/Line.js +0 -10
- package/dist/components/widget/Line/Line.js.map +1 -1
- package/dist/components/widget/NetworkIcon/NetworkIconSquare.js +0 -10
- package/dist/components/widget/NetworkIcon/NetworkIconSquare.js.map +1 -1
- package/dist/components/widget/NetworkSwitcher/CompactNetworkSwitcher.js +0 -10
- package/dist/components/widget/NetworkSwitcher/CompactNetworkSwitcher.js.map +1 -1
- package/dist/components/widget/NetworkSwitcher/NetworkSwitcherDropdown.js +0 -10
- package/dist/components/widget/NetworkSwitcher/NetworkSwitcherDropdown.js.map +1 -1
- package/dist/components/widget/NetworkWithIcon/NetworkIconWithChevron.js +0 -10
- package/dist/components/widget/NetworkWithIcon/NetworkIconWithChevron.js.map +1 -1
- package/dist/components/widget/NetworkWithIcon/NetworkWithIcon.js +0 -10
- package/dist/components/widget/NetworkWithIcon/NetworkWithIcon.js.map +1 -1
- package/dist/components/widget/PoweredBy/PoweredBy.js +0 -10
- package/dist/components/widget/PoweredBy/PoweredBy.js.map +1 -1
- package/dist/components/widget/ReceiverAddress/ReceiverAddress.js +0 -10
- package/dist/components/widget/ReceiverAddress/ReceiverAddress.js.map +1 -1
- package/dist/components/widget/ReceiverAddress/state/receiverAddressAtom.js +1 -12
- package/dist/components/widget/ReceiverAddress/state/receiverAddressAtom.js.map +1 -1
- package/dist/components/widget/ReceiverAddress/state/subscriptions.js +0 -10
- package/dist/components/widget/ReceiverAddress/state/subscriptions.js.map +1 -1
- package/dist/components/widget/RowVirtualizer/RowVirtualizerFixed.js +0 -10
- package/dist/components/widget/RowVirtualizer/RowVirtualizerFixed.js.map +1 -1
- package/dist/components/widget/SelectToken/SelectTokenButton.js +0 -11
- package/dist/components/widget/SelectToken/SelectTokenButton.js.map +1 -1
- package/dist/components/widget/SwapModeSwitcher/SwapModeSwitcherExpandable.js +0 -10
- package/dist/components/widget/SwapModeSwitcher/SwapModeSwitcherExpandable.js.map +1 -1
- package/dist/components/widget/SwapModeSwitcher/state/swapModeActionsAtom.js +2 -13
- package/dist/components/widget/SwapModeSwitcher/state/swapModeActionsAtom.js.map +1 -1
- package/dist/components/widget/SwapModeSwitcher/state/swapModeAtom.js +3 -15
- package/dist/components/widget/SwapModeSwitcher/state/swapModeAtom.js.map +1 -1
- package/dist/components/widget/SwapModeSwitcher/state/swapSideAtom.js +2 -13
- package/dist/components/widget/SwapModeSwitcher/state/swapSideAtom.js.map +1 -1
- package/dist/components/widget/SwapRate/SwapRate.js +0 -10
- package/dist/components/widget/SwapRate/SwapRate.js.map +1 -1
- package/dist/components/widget/TokenBadge/TokenBadge.js +0 -10
- package/dist/components/widget/TokenBadge/TokenBadge.js.map +1 -1
- package/dist/components/widget/TokenInput/EmptyInput.js +0 -10
- package/dist/components/widget/TokenInput/EmptyInput.js.map +1 -1
- package/dist/components/widget/TokenInput/index.js +0 -10
- package/dist/components/widget/TokenInput/index.js.map +1 -1
- package/dist/components/widget/TokenSwitcher/TokenSwitcher.js +0 -10
- package/dist/components/widget/TokenSwitcher/TokenSwitcher.js.map +1 -1
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.js +0 -10
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.js.map +1 -1
- package/dist/components/widget/TradeOverview/MarketSwapTradeOverview.js +0 -10
- package/dist/components/widget/TradeOverview/MarketSwapTradeOverview.js.map +1 -1
- package/dist/components/widget/TradeOverview/Step.js +0 -10
- package/dist/components/widget/TradeOverview/Step.js.map +1 -1
- package/dist/components/widget/TradeOverview/Stepper.js +0 -10
- package/dist/components/widget/TradeOverview/Stepper.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteFooter.js +0 -10
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteFooter.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.js +0 -10
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompletedDetails.js +0 -10
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompletedDetails.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/index.js +0 -10
- package/dist/components/widget/TradeOverview/TradeComplete/index.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.js +0 -10
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/utils.js +0 -10
- package/dist/components/widget/TradeOverview/TradeComplete/utils.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeDetails.js +0 -10
- package/dist/components/widget/TradeOverview/TradeDetails.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeDetailsDisplay.js +0 -10
- package/dist/components/widget/TradeOverview/TradeDetailsDisplay.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeOverview.js +0 -10
- package/dist/components/widget/TradeOverview/TradeOverview.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeOverviewFooter.js +0 -10
- package/dist/components/widget/TradeOverview/TradeOverviewFooter.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeOverviewHeader.js +0 -10
- package/dist/components/widget/TradeOverview/TradeOverviewHeader.js.map +1 -1
- package/dist/components/widget/TradeOverview/VerticalDash.js +0 -10
- package/dist/components/widget/TradeOverview/VerticalDash.js.map +1 -1
- package/dist/components/widget/TradeOverview/steps.js +0 -10
- package/dist/components/widget/TradeOverview/steps.js.map +1 -1
- package/dist/components/widget/TradeOverview/tradeFlowContext.js +0 -10
- package/dist/components/widget/TradeOverview/tradeFlowContext.js.map +1 -1
- package/dist/components/widget/TradeParameters/DeltaParameter.js +0 -10
- package/dist/components/widget/TradeParameters/DeltaParameter.js.map +1 -1
- package/dist/components/widget/TradeParameters/SlippageParameter/CustomSlippageInput.js +0 -10
- package/dist/components/widget/TradeParameters/SlippageParameter/CustomSlippageInput.js.map +1 -1
- package/dist/components/widget/TradeParameters/SlippageParameter/EditSlippage.js +0 -10
- package/dist/components/widget/TradeParameters/SlippageParameter/EditSlippage.js.map +1 -1
- package/dist/components/widget/TradeParameters/SlippageParameter/SlippageParameter.js +0 -10
- package/dist/components/widget/TradeParameters/SlippageParameter/SlippageParameter.js.map +1 -1
- package/dist/components/widget/TradeParameters/SlippageParameter/hooks/useCustomSlippageProps.js +0 -10
- package/dist/components/widget/TradeParameters/SlippageParameter/hooks/useCustomSlippageProps.js.map +1 -1
- package/dist/components/widget/TradeParameters/TradeParameters.js +0 -10
- package/dist/components/widget/TradeParameters/TradeParameters.js.map +1 -1
- package/dist/components/widget/TradeParameters/hooks/useIsNotDefaultAnyParameter.js +0 -10
- package/dist/components/widget/TradeParameters/hooks/useIsNotDefaultAnyParameter.js.map +1 -1
- package/dist/components/widget/TradeParameters/state/constants.js +0 -10
- package/dist/components/widget/TradeParameters/state/constants.js.map +1 -1
- package/dist/components/widget/TradeParameters/state/deltaParamActionsAtom.js +2 -13
- package/dist/components/widget/TradeParameters/state/deltaParamActionsAtom.js.map +1 -1
- package/dist/components/widget/TradeParameters/state/deltaParamAtom.js +3 -15
- package/dist/components/widget/TradeParameters/state/deltaParamAtom.js.map +1 -1
- package/dist/components/widget/TradeParameters/state/slippageParamActionsAtom.js +2 -13
- package/dist/components/widget/TradeParameters/state/slippageParamActionsAtom.js.map +1 -1
- package/dist/components/widget/TradeParameters/state/slippageParamAtom.js +3 -15
- package/dist/components/widget/TradeParameters/state/slippageParamAtom.js.map +1 -1
- package/dist/components/widget/Warning/InsufficientBalanceMessage.js +0 -10
- package/dist/components/widget/Warning/InsufficientBalanceMessage.js.map +1 -1
- package/dist/components/widget/Warning/Warning.js +0 -10
- package/dist/components/widget/Warning/Warning.js.map +1 -1
- package/dist/components/widget/Warning/WarningMessage.js +0 -10
- package/dist/components/widget/Warning/WarningMessage.js.map +1 -1
- package/dist/components/widget/WrapEth/WrapEthContent.js +0 -10
- package/dist/components/widget/WrapEth/WrapEthContent.js.map +1 -1
- package/dist/components/widget/WrapEth/WrapEthDrawerButton.js +0 -10
- package/dist/components/widget/WrapEth/WrapEthDrawerButton.js.map +1 -1
- package/dist/components/widget/WrapEth/hooks/useSubmitDepositTxMutation.js +0 -10
- package/dist/components/widget/WrapEth/hooks/useSubmitDepositTxMutation.js.map +1 -1
- package/dist/components/widget/WrapEth/hooks/useWrapEthProps.js +0 -10
- package/dist/components/widget/WrapEth/hooks/useWrapEthProps.js.map +1 -1
- package/dist/components/widget/YouGet/YouGet.js +0 -10
- package/dist/components/widget/YouGet/YouGet.js.map +1 -1
- package/dist/hooks/gas/config.js +0 -10
- package/dist/hooks/gas/config.js.map +1 -1
- package/dist/hooks/gas/useGasPrices.js +0 -10
- package/dist/hooks/gas/useGasPrices.js.map +1 -1
- package/dist/hooks/gas/utils.js +0 -10
- package/dist/hooks/gas/utils.js.map +1 -1
- package/dist/hooks/getCode/query.js +0 -10
- package/dist/hooks/getCode/query.js.map +1 -1
- package/dist/hooks/getCode/useIsAccountContract.js +0 -10
- package/dist/hooks/getCode/useIsAccountContract.js.map +1 -1
- package/dist/hooks/getCode/useIsContractAtAddress.js +0 -10
- package/dist/hooks/getCode/useIsContractAtAddress.js.map +1 -1
- package/dist/hooks/permit/hooks/useGetPermitInfo.js +0 -10
- package/dist/hooks/permit/hooks/useGetPermitInfo.js.map +1 -1
- package/dist/hooks/permit/hooks/useGetSafePermitInfo.js +0 -10
- package/dist/hooks/permit/hooks/useGetSafePermitInfo.js.map +1 -1
- package/dist/hooks/permit/hooks/usePermit1Nonce.js +1 -12
- package/dist/hooks/permit/hooks/usePermit1Nonce.js.map +1 -1
- package/dist/hooks/permit/hooks/useSignArbitraryTypedData.js +0 -10
- package/dist/hooks/permit/hooks/useSignArbitraryTypedData.js.map +1 -1
- package/dist/hooks/permit/hooks/useSignPermit.js +0 -10
- package/dist/hooks/permit/hooks/useSignPermit.js.map +1 -1
- package/dist/hooks/permit/hooks/useSignTokenFromPermit1.js +0 -10
- package/dist/hooks/permit/hooks/useSignTokenFromPermit1.js.map +1 -1
- package/dist/hooks/permit/hooks/useTokenFromPermit1Nonce.js +0 -10
- package/dist/hooks/permit/hooks/useTokenFromPermit1Nonce.js.map +1 -1
- package/dist/hooks/permit/hooks/useTokenFromPermitInfo.js +0 -10
- package/dist/hooks/permit/hooks/useTokenFromPermitInfo.js.map +1 -1
- package/dist/hooks/permit/hooks/useTryToSignPermit1.js +0 -10
- package/dist/hooks/permit/hooks/useTryToSignPermit1.js.map +1 -1
- package/dist/hooks/permit/utils/abi.js +0 -10
- package/dist/hooks/permit/utils/abi.js.map +1 -1
- package/dist/hooks/permit/utils/constants.js +0 -10
- package/dist/hooks/permit/utils/constants.js.map +1 -1
- package/dist/hooks/permit/utils/construct.js +0 -10
- package/dist/hooks/permit/utils/construct.js.map +1 -1
- package/dist/hooks/permit/utils/detect.js +0 -10
- package/dist/hooks/permit/utils/detect.js.map +1 -1
- package/dist/hooks/permit/utils/domainSeparator.js +0 -10
- package/dist/hooks/permit/utils/domainSeparator.js.map +1 -1
- package/dist/hooks/permit/utils/encodeArgs.js +0 -10
- package/dist/hooks/permit/utils/encodeArgs.js.map +1 -1
- package/dist/hooks/permit/utils/trySignPermit1.js +0 -10
- package/dist/hooks/permit/utils/trySignPermit1.js.map +1 -1
- package/dist/hooks/permit/utils/utils.js +0 -10
- package/dist/hooks/permit/utils/utils.js.map +1 -1
- package/dist/hooks/sdk/useGetContracts.js +0 -10
- package/dist/hooks/sdk/useGetContracts.js.map +1 -1
- package/dist/hooks/sdk/useSpender.js +0 -10
- package/dist/hooks/sdk/useSpender.js.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/utils.js +0 -10
- package/dist/hooks/swap/prices/delta/bridge/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.js +0 -10
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.js +0 -10
- package/dist/hooks/swap/prices/delta/orders/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useBridgeInfo.js +0 -10
- package/dist/hooks/swap/prices/delta/queries/useBridgeInfo.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js +0 -10
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.js +0 -10
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js +0 -10
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/market/mutations/useBuildTx.js +0 -10
- package/dist/hooks/swap/prices/market/mutations/useBuildTx.js.map +1 -1
- package/dist/hooks/swap/prices/market/mutations/useSendMarketSwapTx.js +0 -10
- package/dist/hooks/swap/prices/market/mutations/useSendMarketSwapTx.js.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.js +0 -10
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useSpenderAndContracts.js +0 -10
- package/dist/hooks/swap/prices/market/queries/useSpenderAndContracts.js.map +1 -1
- package/dist/hooks/swap/prices/usePricesParams.js +0 -10
- package/dist/hooks/swap/prices/usePricesParams.js.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.js +0 -11
- package/dist/hooks/swap/prices/useSwapPrices.js.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js +0 -10
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/errors.js +0 -10
- package/dist/hooks/swap/tradeFlow/common/errors.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js +2 -13
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js +2 -11
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useMarketFlow.js +2 -13
- package/dist/hooks/swap/tradeFlow/useMarketFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useMarketSwapStep.js +2 -11
- package/dist/hooks/swap/tradeFlow/useMarketSwapStep.js.map +1 -1
- package/dist/hooks/tokens/allowance/useGenericTokenAllowance.js +0 -10
- package/dist/hooks/tokens/allowance/useGenericTokenAllowance.js.map +1 -1
- package/dist/hooks/tokens/allowance/useTokenAllowance.js +0 -10
- package/dist/hooks/tokens/allowance/useTokenAllowance.js.map +1 -1
- package/dist/hooks/tokens/balances/queries.js +0 -10
- package/dist/hooks/tokens/balances/queries.js.map +1 -1
- package/dist/hooks/tokens/balances/useAttachTokenBalanceMultichain.js +0 -10
- package/dist/hooks/tokens/balances/useAttachTokenBalanceMultichain.js.map +1 -1
- package/dist/hooks/tokens/balances/useInvalidateTokenData.js +0 -10
- package/dist/hooks/tokens/balances/useInvalidateTokenData.js.map +1 -1
- package/dist/hooks/tokens/balances/useIsInsufficientTokenBalance.js +0 -10
- package/dist/hooks/tokens/balances/useIsInsufficientTokenBalance.js.map +1 -1
- package/dist/hooks/tokens/balances/useMultichainTokenBalances.js +0 -10
- package/dist/hooks/tokens/balances/useMultichainTokenBalances.js.map +1 -1
- package/dist/hooks/tokens/balances/useTokenBalance.js +0 -10
- package/dist/hooks/tokens/balances/useTokenBalance.js.map +1 -1
- package/dist/hooks/tokens/prices/queries.js +0 -10
- package/dist/hooks/tokens/prices/queries.js.map +1 -1
- package/dist/hooks/tokens/prices/useMultichainTokenPrices.js +0 -10
- package/dist/hooks/tokens/prices/useMultichainTokenPrices.js.map +1 -1
- package/dist/hooks/tokens/prices/useTokenPrices.js +0 -10
- package/dist/hooks/tokens/prices/useTokenPrices.js.map +1 -1
- package/dist/hooks/tokens/useNativeToken.js +0 -10
- package/dist/hooks/tokens/useNativeToken.js.map +1 -1
- package/dist/hooks/tokens/useTokenLists.js +0 -10
- package/dist/hooks/tokens/useTokenLists.js.map +1 -1
- package/dist/hooks/tokens/useTokensByAddress.js +0 -10
- package/dist/hooks/tokens/useTokensByAddress.js.map +1 -1
- package/dist/hooks/tokens/useTokensFromAcross.js +0 -10
- package/dist/hooks/tokens/useTokensFromAcross.js.map +1 -1
- package/dist/hooks/txs/mutations/useApprove.js +0 -10
- package/dist/hooks/txs/mutations/useApprove.js.map +1 -1
- package/dist/hooks/txs/mutations/useDepositWeth.js +0 -10
- package/dist/hooks/txs/mutations/useDepositWeth.js.map +1 -1
- package/dist/hooks/txs/mutations/useSendTx.js +0 -10
- package/dist/hooks/txs/mutations/useSendTx.js.map +1 -1
- package/dist/hooks/txs/queries/useAwaitTx.js +0 -10
- package/dist/hooks/txs/queries/useAwaitTx.js.map +1 -1
- package/dist/hooks/useAvailableCrosses.js +0 -10
- package/dist/hooks/useAvailableCrosses.js.map +1 -1
- package/dist/hooks/useBridgeInfo.js +0 -10
- package/dist/hooks/useBridgeInfo.js.map +1 -1
- package/dist/hooks/useCurrentChain.js +0 -10
- package/dist/hooks/useCurrentChain.js.map +1 -1
- package/dist/hooks/useDebouncedInputState.js +0 -10
- package/dist/hooks/useDebouncedInputState.js.map +1 -1
- package/dist/hooks/useGlobalDeltaEnabled.js +0 -10
- package/dist/hooks/useGlobalDeltaEnabled.js.map +1 -1
- package/dist/hooks/useIsCrosschainPossible.js +0 -10
- package/dist/hooks/useIsCrosschainPossible.js.map +1 -1
- package/dist/hooks/useMinViemClient.js +0 -10
- package/dist/hooks/useMinViemClient.js.map +1 -1
- package/dist/hooks/useSDK.js +0 -10
- package/dist/hooks/useSDK.js.map +1 -1
- package/dist/hooks/useSlippage.js +0 -10
- package/dist/hooks/useSlippage.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/constants/delta.js +0 -10
- package/dist/lib/constants/delta.js.map +1 -1
- package/dist/lib/constants/index.js +0 -10
- package/dist/lib/constants/index.js.map +1 -1
- package/dist/lib/constants/time.js +0 -10
- package/dist/lib/constants/time.js.map +1 -1
- package/dist/lib/constants/weth.js +0 -10
- package/dist/lib/constants/weth.js.map +1 -1
- package/dist/lib/ipfs.js +0 -10
- package/dist/lib/ipfs.js.map +1 -1
- package/dist/lib/queryClient.js +0 -10
- package/dist/lib/queryClient.js.map +1 -1
- package/dist/lib/utils/delta.js +0 -10
- package/dist/lib/utils/delta.js.map +1 -1
- package/dist/lib/utils/dexes.js +0 -10
- package/dist/lib/utils/dexes.js.map +1 -1
- package/dist/lib/utils/explorer.js +0 -10
- package/dist/lib/utils/explorer.js.map +1 -1
- package/dist/lib/utils/fee.js +0 -10
- package/dist/lib/utils/fee.js.map +1 -1
- package/dist/lib/utils/formatFiatPrice.js +0 -10
- package/dist/lib/utils/formatFiatPrice.js.map +1 -1
- package/dist/lib/utils/formatTokenBalance.js +0 -10
- package/dist/lib/utils/formatTokenBalance.js.map +1 -1
- package/dist/lib/utils/index.js +0 -10
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/price.js +0 -10
- package/dist/lib/utils/price.js.map +1 -1
- package/dist/lib/utils/priceImpact.js +0 -10
- package/dist/lib/utils/priceImpact.js.map +1 -1
- package/dist/lib/utils/rate.js +0 -10
- package/dist/lib/utils/rate.js.map +1 -1
- package/dist/lib/utils/removeZeroDecimals.js +0 -10
- package/dist/lib/utils/removeZeroDecimals.js.map +1 -1
- package/dist/lib/utils/slippage.js +0 -10
- package/dist/lib/utils/slippage.js.map +1 -1
- package/dist/lib/utils/toDecimal.js +0 -10
- package/dist/lib/utils/toDecimal.js.map +1 -1
- package/dist/lib/utils/toasts.js +0 -10
- package/dist/lib/utils/toasts.js.map +1 -1
- package/dist/lib/web3/privy/config.js +1 -11
- package/dist/lib/web3/privy/config.js.map +1 -1
- package/dist/lib/web3/wagmi/config.js +1 -11
- package/dist/lib/web3/wagmi/config.js.map +1 -1
- package/dist/lib/web3/wagmi/constants.js +0 -10
- package/dist/lib/web3/wagmi/constants.js.map +1 -1
- package/dist/lib/web3/wagmi/transports.js +0 -10
- package/dist/lib/web3/wagmi/transports.js.map +1 -1
- package/dist/lib/web3/wagmi/utils.js +0 -10
- package/dist/lib/web3/wagmi/utils.js.map +1 -1
- package/dist/styles.css +5 -265
- package/dist/styles2.css +256 -0
- package/dist/test/TestButton.d.ts +2 -0
- package/dist/test/TestButton.d.ts.map +1 -0
- package/dist/test/connect/AccountDisplay.js +0 -10
- package/dist/test/connect/AccountDisplay.js.map +1 -1
- package/dist/test/connect/App.js +0 -10
- package/dist/test/connect/App.js.map +1 -1
- package/dist/test/connect/ConnectWallet.js +0 -10
- package/dist/test/connect/ConnectWallet.js.map +1 -1
- package/dist/test/connect/WagmiProfile.js +0 -10
- package/dist/test/connect/WagmiProfile.js.map +1 -1
- package/dist/test/connect/WalletActions.js +0 -10
- package/dist/test/connect/WalletActions.js.map +1 -1
- package/dist/test/logger-demo.d.ts +5 -0
- package/dist/test/logger-demo.d.ts.map +1 -0
- package/dist/tokens/blacklist.js +0 -10
- package/dist/tokens/blacklist.js.map +1 -1
- package/dist/tokens/constants.js +0 -10
- package/dist/tokens/constants.js.map +1 -1
- package/dist/tokens/constructor.js +0 -10
- package/dist/tokens/constructor.js.map +1 -1
- package/dist/tokens/defaultTokens.js +0 -10
- package/dist/tokens/defaultTokens.js.map +1 -1
- package/dist/tokens/hooks.js +0 -10
- package/dist/tokens/hooks.js.map +1 -1
- package/dist/tokens/lists/constants.js +0 -10
- package/dist/tokens/lists/constants.js.map +1 -1
- package/dist/tokens/lists/download.js +0 -10
- package/dist/tokens/lists/download.js.map +1 -1
- package/dist/tokens/lists/hooks.js +0 -10
- package/dist/tokens/lists/hooks.js.map +1 -1
- package/dist/tokens/lists/state/observer.js +0 -10
- package/dist/tokens/lists/state/observer.js.map +1 -1
- package/dist/tokens/lists/state/tokenListsActionsAtom.js +2 -13
- package/dist/tokens/lists/state/tokenListsActionsAtom.js.map +1 -1
- package/dist/tokens/lists/state/tokenListsStateAtom.js +2 -14
- package/dist/tokens/lists/state/tokenListsStateAtom.js.map +1 -1
- package/dist/tokens/lists/utils.js +0 -10
- package/dist/tokens/lists/utils.js.map +1 -1
- package/dist/tokens/overrides.js +0 -10
- package/dist/tokens/overrides.js.map +1 -1
- package/dist/tokens/queries.js +0 -10
- package/dist/tokens/queries.js.map +1 -1
- package/dist/tokens/stabeCoins/hooks.js +0 -10
- package/dist/tokens/stabeCoins/hooks.js.map +1 -1
- package/dist/tokens/stabeCoins/index.js +0 -10
- package/dist/tokens/stabeCoins/index.js.map +1 -1
- package/dist/tokens/state/constructTokens.js +0 -10
- package/dist/tokens/state/constructTokens.js.map +1 -1
- package/dist/tokens/state/tokensAtom.js +2 -13
- package/dist/tokens/state/tokensAtom.js.map +1 -1
- package/dist/tokens/utils/areTokensSame.js +0 -10
- package/dist/tokens/utils/areTokensSame.js.map +1 -1
- package/dist/tokens/utils/eth.js +0 -10
- package/dist/tokens/utils/eth.js.map +1 -1
- package/dist/tokens/utils/filtering.js +0 -10
- package/dist/tokens/utils/filtering.js.map +1 -1
- package/dist/tokens/utils/sets.js +0 -10
- package/dist/tokens/utils/sets.js.map +1 -1
- package/dist/tokens/utils/sorting.js +0 -10
- package/dist/tokens/utils/sorting.js.map +1 -1
- package/dist/widget/DevTools.d.ts +2 -0
- package/dist/widget/DevTools.d.ts.map +1 -0
- package/dist/widget/DevTools.js +24 -0
- package/dist/widget/DevTools.js.map +1 -0
- package/dist/widget/Updaters.js +0 -10
- package/dist/widget/Updaters.js.map +1 -1
- package/dist/widget/across/utils.js +0 -10
- package/dist/widget/across/utils.js.map +1 -1
- package/dist/widget/button/hooks/useWidgetButtonExtraProps.js +0 -10
- package/dist/widget/button/hooks/useWidgetButtonExtraProps.js.map +1 -1
- package/dist/widget/constants.js +0 -10
- package/dist/widget/constants.js.map +1 -1
- package/dist/widget/index.d.ts.map +1 -1
- package/dist/widget/index.js +34 -28
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/inputs/hooks/useTokenFromInputProps.js +0 -11
- package/dist/widget/inputs/hooks/useTokenFromInputProps.js.map +1 -1
- package/dist/widget/inputs/hooks/useTokenSwitcherProps.js +0 -10
- package/dist/widget/inputs/hooks/useTokenSwitcherProps.js.map +1 -1
- package/dist/widget/inputs/hooks/useTokenToInputProps.js +0 -10
- package/dist/widget/inputs/hooks/useTokenToInputProps.js.map +1 -1
- package/dist/widget/inputs/state/inputAmountAtom.js +6 -20
- package/dist/widget/inputs/state/inputAmountAtom.js.map +1 -1
- package/dist/widget/inputs/state/selectedTokenActionsAtom.js +6 -19
- package/dist/widget/inputs/state/selectedTokenActionsAtom.js.map +1 -1
- package/dist/widget/inputs/state/selectedTokenAtom.js +2 -15
- package/dist/widget/inputs/state/selectedTokenAtom.js.map +1 -1
- package/dist/widget/inputs/state/subscriptions.js +0 -10
- package/dist/widget/inputs/state/subscriptions.js.map +1 -1
- package/dist/widget/state/chainToAtom.js +2 -13
- package/dist/widget/state/chainToAtom.js.map +1 -1
- package/dist/widget/state/configActionsAtom.js +2 -13
- package/dist/widget/state/configActionsAtom.js.map +1 -1
- package/dist/widget/state/configAtom.js +1 -12
- package/dist/widget/state/configAtom.js.map +1 -1
- package/dist/widget/state/containerAtom.js +1 -12
- package/dist/widget/state/containerAtom.js.map +1 -1
- package/dist/widget/state/currentSwapInputAtom.js +1 -12
- package/dist/widget/state/currentSwapInputAtom.js.map +1 -1
- package/dist/widget/state/isCrosschainAtom.js +2 -13
- package/dist/widget/state/isCrosschainAtom.js.map +1 -1
- package/dist/widget/subscriptions.js +0 -10
- package/dist/widget/subscriptions.js.map +1 -1
- package/dist/widget/swapDetails/fees.js +0 -10
- package/dist/widget/swapDetails/fees.js.map +1 -1
- package/dist/widget/swapDetails/orderRouting.js +0 -10
- package/dist/widget/swapDetails/orderRouting.js.map +1 -1
- package/dist/widget/swapDetails/priceImpact.js +0 -10
- package/dist/widget/swapDetails/priceImpact.js.map +1 -1
- package/dist/widget/swapDetails/useSwapDetailsListProps.js +0 -10
- package/dist/widget/swapDetails/useSwapDetailsListProps.js.map +1 -1
- package/dist/widget/swapDetails/youGet.js +0 -10
- package/dist/widget/swapDetails/youGet.js.map +1 -1
- package/package.json +2 -1
- package/dist/components/widget/SwapModeSwitcher/state/types.js +0 -11
- package/dist/components/widget/SwapModeSwitcher/state/types.js.map +0 -1
- package/dist/components/widget/TokenBadge/types.js +0 -11
- package/dist/components/widget/TokenBadge/types.js.map +0 -1
- package/dist/hooks/txs/index.js +0 -13
- package/dist/hooks/txs/index.js.map +0 -1
- package/dist/lib/utils/logger.js +0 -11
- package/dist/lib/utils/logger.js.map +0 -1
- package/dist/tokens/state/types.js +0 -11
- package/dist/tokens/state/types.js.map +0 -1
package/dist/lib/ipfs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ipfs.js","sources":["../../src/lib/ipfs.ts"],"sourcesContent":["import axios, { type AxiosResponse } from \"axios\";\n\nconst ipfsRegEx = /^(ipfs|ipns):\\/\\/(.*)$/i;\n\nexport const IPFStransformer: TransformURI = (uri) => {\n const match = uri.match(ipfsRegEx);\n // likely http:// , https:// or // uri\n if (!match) return null;\n\n const [, protocol, hash] = match;\n if (!protocol || !hash) return null;\n\n return `https://ipfs.io/${protocol}/${hash}/`;\n};\n\n// takes URI, returns string if applicable or null\ntype TransformURI = (uri: string) => string | null;\n\nconst createURItoHttpURLTransformer = (\n ...transformers: TransformURI[]\n): ((uri: string) => string) => {\n return (uri) => {\n // try each transformer\n const httpURL = transformers.reduce<string | null>(\n (result, transformer) => {\n // as soon as transformer returns string, skip further transformers\n if (result !== null) return result;\n // no transformer returned string yet, so try current transformer\n return transformer(uri);\n },\n null\n );\n\n return httpURL || uri;\n };\n};\n\n// uri can be\n// IPFS ipfs://QmV8AfDE8GFSGQvt3vck8EwAzsPuNTmtP8VcQJE3qxRPaZ\n// IPNS ipns://app.uniswap.org\n// http, https or // (match current protocol)\n\nexport const uriToHttpURL = createURItoHttpURLTransformer(IPFStransformer);\n\nconst constructIpfsFetcher =\n (baseUrl: string) =>\n async <T>(ipfsHash: string, signal?: AbortSignal) =>\n axios.get<T>(baseUrl + ipfsHash, { signal });\nconst pinataFetcher = constructIpfsFetcher(\n \"https://gateway.pinata.cloud/ipfs/\"\n);\nconst cloudflareFetcher = constructIpfsFetcher(\n \"https://cloudflare-ipfs.com/ipfs/\"\n);\n\nexport const fetchDataOnIpfs = async <T>(\n ipfsHash: string,\n signal?: AbortSignal\n): Promise<AxiosResponse<T>> => {\n try {\n return await pinataFetcher<T>(ipfsHash, signal);\n } catch {\n return await cloudflareFetcher<T>(ipfsHash, signal);\n }\n};\n"],"names":["ipfsRegEx","IPFStransformer","uri","match","protocol","hash","createURItoHttpURLTransformer","transformers","httpURL","reduce","result","transformer","uriToHttpURL"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ipfs.js","sources":["../../src/lib/ipfs.ts"],"sourcesContent":["import axios, { type AxiosResponse } from \"axios\";\n\nconst ipfsRegEx = /^(ipfs|ipns):\\/\\/(.*)$/i;\n\nexport const IPFStransformer: TransformURI = (uri) => {\n const match = uri.match(ipfsRegEx);\n // likely http:// , https:// or // uri\n if (!match) return null;\n\n const [, protocol, hash] = match;\n if (!protocol || !hash) return null;\n\n return `https://ipfs.io/${protocol}/${hash}/`;\n};\n\n// takes URI, returns string if applicable or null\ntype TransformURI = (uri: string) => string | null;\n\nconst createURItoHttpURLTransformer = (\n ...transformers: TransformURI[]\n): ((uri: string) => string) => {\n return (uri) => {\n // try each transformer\n const httpURL = transformers.reduce<string | null>(\n (result, transformer) => {\n // as soon as transformer returns string, skip further transformers\n if (result !== null) return result;\n // no transformer returned string yet, so try current transformer\n return transformer(uri);\n },\n null\n );\n\n return httpURL || uri;\n };\n};\n\n// uri can be\n// IPFS ipfs://QmV8AfDE8GFSGQvt3vck8EwAzsPuNTmtP8VcQJE3qxRPaZ\n// IPNS ipns://app.uniswap.org\n// http, https or // (match current protocol)\n\nexport const uriToHttpURL = createURItoHttpURLTransformer(IPFStransformer);\n\nconst constructIpfsFetcher =\n (baseUrl: string) =>\n async <T>(ipfsHash: string, signal?: AbortSignal) =>\n axios.get<T>(baseUrl + ipfsHash, { signal });\nconst pinataFetcher = constructIpfsFetcher(\n \"https://gateway.pinata.cloud/ipfs/\"\n);\nconst cloudflareFetcher = constructIpfsFetcher(\n \"https://cloudflare-ipfs.com/ipfs/\"\n);\n\nexport const fetchDataOnIpfs = async <T>(\n ipfsHash: string,\n signal?: AbortSignal\n): Promise<AxiosResponse<T>> => {\n try {\n return await pinataFetcher<T>(ipfsHash, signal);\n } catch {\n return await cloudflareFetcher<T>(ipfsHash, signal);\n }\n};\n"],"names":["ipfsRegEx","IPFStransformer","uri","match","protocol","hash","createURItoHttpURLTransformer","transformers","httpURL","reduce","result","transformer","uriToHttpURL"],"mappings":";;AAEA,MAAMA,SAAAA,GAAY,yBAAA;AAEX,MAAMC,kBAAiCC,CAAAA,GAAAA,KAAQ;AACpD,EAAA,MAAMC,KAAAA,GAAQD,GAAAA,CAAIC,KAAAA,CAAMH,SAAS,CAAA;AAEjC,EAAA,IAAI,CAACG,OAAO,OAAO,IAAA;AAEnB,EAAA,MAAM,GAAGC,QAAAA,EAAUC,IAAI,CAAA,GAAIF,KAAAA;AAC3B,EAAA,IAAI,CAACC,QAAAA,IAAY,CAACC,IAAAA,EAAM,OAAO,IAAA;AAE/B,EAAA,OAAO,CAAA,gBAAA,EAAmBD,QAAQ,CAAA,CAAA,EAAIC,IAAI,CAAA,CAAA,CAAA;AAC5C;AAKA,MAAMC,6BAAAA,GAAgCA,IACjCC,YAAAA,KAC2B;AAC9B,EAAA,OAAQL,CAAAA,GAAAA,KAAQ;AAEd,IAAA,MAAMM,OAAAA,GAAUD,YAAAA,CAAaE,MAAAA,CAC3B,CAACC,QAAQC,WAAAA,KAAgB;AAEvB,MAAA,IAAID,MAAAA,KAAW,MAAM,OAAOA,MAAAA;AAE5B,MAAA,OAAOC,YAAYT,GAAG,CAAA;AAAA,OAExB,IACF,CAAA;AAEA,IAAA,OAAOM,OAAAA,IAAWN,GAAAA;AAAAA,GACpB;AACF,CAAA;AAOO,MAAMU,YAAAA,GAAeN,8BAA8BL,eAAe;;;;"}
|
package/dist/lib/queryClient.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
const queryClient = new QueryClient();
|
|
14
4
|
|
|
15
5
|
export { queryClient };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryClient.js","sources":["../../src/lib/queryClient.ts"],"sourcesContent":["import { QueryClient } from \"@tanstack/react-query\";\n\nexport const queryClient = new QueryClient();\n"],"names":["queryClient","QueryClient"],"mappings":"
|
|
1
|
+
{"version":3,"file":"queryClient.js","sources":["../../src/lib/queryClient.ts"],"sourcesContent":["import { QueryClient } from \"@tanstack/react-query\";\n\nexport const queryClient = new QueryClient();\n"],"names":["queryClient","QueryClient"],"mappings":";;AAEO,MAAMA,WAAAA,GAAc,IAAIC,WAAAA;;;;"}
|
package/dist/lib/utils/delta.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
function getErrorData(error) {
|
|
14
4
|
if (!axios.isAxiosError(error)) return null;
|
|
15
5
|
const errorData = error.response?.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delta.js","sources":["../../../src/lib/utils/delta.ts"],"sourcesContent":["import axios from \"axios\";\n\nfunction getErrorData(error: Error): Record<string, unknown> | null {\n if (!axios.isAxiosError(error)) return null;\n\n const errorData = error.response?.data;\n if (!errorData || typeof errorData !== \"object\") return null;\n\n return errorData;\n}\n\n// API Errors Across Error\ntype KnownErrorTypes = \"UnsupportedToken\" | \"BridgeQuoteFailed\";\n\n/**\n * Parses a Delta API error and extracts known error types and descriptions.\n */\nexport function parseDeltaApiError(\n error: Error | null\n):\n | { errorType: string | KnownErrorTypes; description: string }\n | { errorType?: undefined; description?: undefined } {\n if (!axios.isAxiosError(error)) return {};\n\n const errorData = getErrorData(error);\n\n if (!errorData) return {};\n\n if (\"errorType\" in errorData) {\n const errorType = errorData[\"errorType\"];\n const description =\n errorData[\"description\"] || errorData[\"message\"] || errorData[\"details\"]; // Across error has .details\n\n if (typeof errorType === \"string\" && typeof description === \"string\")\n return { errorType, description };\n }\n\n return {};\n}\n"],"names":["getErrorData","error","axios","isAxiosError","errorData","response","data","parseDeltaApiError","errorType","description"],"mappings":"
|
|
1
|
+
{"version":3,"file":"delta.js","sources":["../../../src/lib/utils/delta.ts"],"sourcesContent":["import axios from \"axios\";\n\nfunction getErrorData(error: Error): Record<string, unknown> | null {\n if (!axios.isAxiosError(error)) return null;\n\n const errorData = error.response?.data;\n if (!errorData || typeof errorData !== \"object\") return null;\n\n return errorData;\n}\n\n// API Errors Across Error\ntype KnownErrorTypes = \"UnsupportedToken\" | \"BridgeQuoteFailed\";\n\n/**\n * Parses a Delta API error and extracts known error types and descriptions.\n */\nexport function parseDeltaApiError(\n error: Error | null\n):\n | { errorType: string | KnownErrorTypes; description: string }\n | { errorType?: undefined; description?: undefined } {\n if (!axios.isAxiosError(error)) return {};\n\n const errorData = getErrorData(error);\n\n if (!errorData) return {};\n\n if (\"errorType\" in errorData) {\n const errorType = errorData[\"errorType\"];\n const description =\n errorData[\"description\"] || errorData[\"message\"] || errorData[\"details\"]; // Across error has .details\n\n if (typeof errorType === \"string\" && typeof description === \"string\")\n return { errorType, description };\n }\n\n return {};\n}\n"],"names":["getErrorData","error","axios","isAxiosError","errorData","response","data","parseDeltaApiError","errorType","description"],"mappings":";;AAEA,SAASA,aAAaC,KAAAA,EAA8C;AAClE,EAAA,IAAI,CAACC,KAAAA,CAAMC,YAAAA,CAAaF,KAAK,GAAG,OAAO,IAAA;AAEvC,EAAA,MAAMG,SAAAA,GAAYH,MAAMI,QAAAA,EAAUC,IAAAA;AAClC,EAAA,IAAI,CAACF,SAAAA,IAAa,OAAOA,SAAAA,KAAc,UAAU,OAAO,IAAA;AAExD,EAAA,OAAOA,SAAAA;AACT;AAQO,SAASG,mBACdN,KAAAA,EAGqD;AACrD,EAAA,IAAI,CAACC,KAAAA,CAAMC,YAAAA,CAAaF,KAAK,CAAA,SAAU,EAAC;AAExC,EAAA,MAAMG,SAAAA,GAAYJ,aAAaC,KAAK,CAAA;AAEpC,EAAA,IAAI,CAACG,SAAAA,EAAW,OAAO,EAAC;AAExB,EAAA,IAAI,eAAeA,SAAAA,EAAW;AAC5B,IAAA,MAAMI,SAAAA,GAAYJ,UAAU,WAAW,CAAA;AACvC,IAAA,MAAMK,WAAAA,GACJL,UAAU,aAAa,CAAA,IAAKA,UAAU,SAAS,CAAA,IAAKA,UAAU,SAAS,CAAA;AAEzE,IAAA,IAAI,OAAOI,SAAAA,KAAc,QAAA,IAAY,OAAOC,WAAAA,KAAgB,UAC1D,OAAO;AAAA,MAAED,SAAAA;AAAAA,MAAWC;AAAAA,KAAY;AAAA;AAGpC,EAAA,OAAO,EAAC;AACV;;;;"}
|
package/dist/lib/utils/dexes.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
2
|
-
cache: /* @__PURE__ */ new Map(),
|
|
3
|
-
get(name, inst) {
|
|
4
|
-
if (this.cache.has(name)) {
|
|
5
|
-
return this.cache.get(name);
|
|
6
|
-
}
|
|
7
|
-
this.cache.set(name, inst);
|
|
8
|
-
return inst;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
1
|
const isSimplePath = (bestRoute) => {
|
|
12
2
|
return bestRoute.length === 1 && bestRoute[0]?.swaps.length === 1;
|
|
13
3
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dexes.js","sources":["../../../src/lib/utils/dexes.ts"],"sourcesContent":["import type { OptimalRate } from \"@velora-dex/sdk\";\n\ntype OptimalRoute = OptimalRate[\"bestRoute\"][0];\ntype OptimalSwap = OptimalRoute[\"swaps\"][0];\n\n// e.g.\n// USDC -- 66% ParaswapPool1 -- USDT\n// USDC -- 34% ParaswapPool2 -- USDT\n// bestRoute.length === 1 && swaps.length === 1\nexport const isSimplePath = (\n bestRoute: OptimalRoute[]\n): bestRoute is [{ percent: number; swaps: [OptimalSwap] }] => {\n return bestRoute.length === 1 && bestRoute[0]?.swaps.length === 1;\n};\n\n// e.g. MATIC -- USDC -- maUSDC\n// bestRoute.length === 1 && swaps.length > 1\nexport const isMultiSwap = (\n bestRoute: OptimalRoute[]\n): bestRoute is [\n { percent: number; swaps: [OptimalSwap, OptimalSwap, ...OptimalSwap[]] },\n] => {\n return !!(\n bestRoute.length === 1 &&\n bestRoute[0] &&\n bestRoute[0].swaps.length > 1\n );\n};\n\n/**\n e.g.\n MATIC --------- USDC\n MATIC -- ETH -- USDC\n */\n// bestRoute.length > 1\nexport const isMegaSwap = (\n bestRoute: OptimalRoute[]\n): bestRoute is [OptimalRoute, OptimalRoute, ...OptimalRoute[]] => {\n return bestRoute.length > 1;\n};\n"],"names":["isSimplePath","bestRoute","length","swaps","isMultiSwap","isMegaSwap"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dexes.js","sources":["../../../src/lib/utils/dexes.ts"],"sourcesContent":["import type { OptimalRate } from \"@velora-dex/sdk\";\n\ntype OptimalRoute = OptimalRate[\"bestRoute\"][0];\ntype OptimalSwap = OptimalRoute[\"swaps\"][0];\n\n// e.g.\n// USDC -- 66% ParaswapPool1 -- USDT\n// USDC -- 34% ParaswapPool2 -- USDT\n// bestRoute.length === 1 && swaps.length === 1\nexport const isSimplePath = (\n bestRoute: OptimalRoute[]\n): bestRoute is [{ percent: number; swaps: [OptimalSwap] }] => {\n return bestRoute.length === 1 && bestRoute[0]?.swaps.length === 1;\n};\n\n// e.g. MATIC -- USDC -- maUSDC\n// bestRoute.length === 1 && swaps.length > 1\nexport const isMultiSwap = (\n bestRoute: OptimalRoute[]\n): bestRoute is [\n { percent: number; swaps: [OptimalSwap, OptimalSwap, ...OptimalSwap[]] },\n] => {\n return !!(\n bestRoute.length === 1 &&\n bestRoute[0] &&\n bestRoute[0].swaps.length > 1\n );\n};\n\n/**\n e.g.\n MATIC --------- USDC\n MATIC -- ETH -- USDC\n */\n// bestRoute.length > 1\nexport const isMegaSwap = (\n bestRoute: OptimalRoute[]\n): bestRoute is [OptimalRoute, OptimalRoute, ...OptimalRoute[]] => {\n return bestRoute.length > 1;\n};\n"],"names":["isSimplePath","bestRoute","length","swaps","isMultiSwap","isMegaSwap"],"mappings":"AASO,MAAMA,YAAAA,GAAeA,CAC1BC,SAAAA,KAC6D;AAC7D,EAAA,OAAOA,UAAUC,MAAAA,KAAW,CAAA,IAAKD,UAAU,CAAC,CAAA,EAAGE,MAAMD,MAAAA,KAAW,CAAA;AAClE;AAIO,MAAME,WAAAA,GAAcA,CACzBH,SAAAA,KAGG;AACH,EAAA,OAAO,CAAC,EACNA,SAAAA,CAAUC,MAAAA,KAAW,CAAA,IACrBD,SAAAA,CAAU,CAAC,CAAA,IACXA,SAAAA,CAAU,CAAC,CAAA,CAAEE,KAAAA,CAAMD,MAAAA,GAAS,CAAA,CAAA;AAEhC;AAQO,MAAMG,UAAAA,GAAaA,CACxBJ,SAAAA,KACiE;AACjE,EAAA,OAAOA,UAAUC,MAAAA,GAAS,CAAA;AAC5B;;;;"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { chainConfigMap } from '../web3/wagmi/constants.js';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
const constructAddressLink = (explorer, address) => {
|
|
14
4
|
return `${explorer}/address/${address}`;
|
|
15
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"explorer.js","sources":["../../../src/lib/utils/explorer.ts"],"sourcesContent":["import type { SupportedChainId } from \"../web3/wagmi/types\";\nimport { chainConfigMap } from \"../web3/wagmi/constants\";\nimport type { Address } from \"viem\";\n\nexport const constructAddressLink = (\n explorer: string,\n address: string\n): string => {\n return `${explorer}/address/${address}`;\n};\nexport const constructTxLink = (explorer: string, address: string): string => {\n return `${explorer}/tx/${address}`;\n};\n\nconst VELORA_EXPLORER_URL = \"https://explorer.velora.xyz\";\n\nexport function constructExplorerOrderDetailsLink(orderId: string): string {\n return `${VELORA_EXPLORER_URL}/order/${orderId}`;\n}\n\nexport function constructExplorerUserDetailsLink(userAddress: Address): string {\n return `${VELORA_EXPLORER_URL}/address/${userAddress}`;\n}\n\ntype ConstructAddressLinkForChainInput = {\n chainId: SupportedChainId;\n address: string;\n};\n\nexport const constructAddressLinkForChain = ({\n chainId,\n address,\n}: ConstructAddressLinkForChainInput): string | undefined => {\n const explorer = chainConfigMap[chainId].blockExplorers?.default.url;\n if (!explorer) return;\n\n return constructAddressLink(explorer, address);\n};\n\ntype ConstructTxLinkForChainInput = {\n chainId: SupportedChainId;\n txHash: string;\n};\n\nexport const constructTxLinkForChain = ({\n chainId,\n txHash,\n}: ConstructTxLinkForChainInput): string | undefined => {\n const explorer = chainConfigMap[chainId].blockExplorers?.default.url;\n if (!explorer) return;\n\n return constructTxLink(explorer, txHash);\n};\n"],"names":["constructAddressLink","explorer","address","constructTxLink","VELORA_EXPLORER_URL","constructExplorerOrderDetailsLink","orderId","constructExplorerUserDetailsLink","userAddress","constructAddressLinkForChain","chainId","chainConfigMap","blockExplorers","default","url","constructTxLinkForChain","txHash"],"mappings":"
|
|
1
|
+
{"version":3,"file":"explorer.js","sources":["../../../src/lib/utils/explorer.ts"],"sourcesContent":["import type { SupportedChainId } from \"../web3/wagmi/types\";\nimport { chainConfigMap } from \"../web3/wagmi/constants\";\nimport type { Address } from \"viem\";\n\nexport const constructAddressLink = (\n explorer: string,\n address: string\n): string => {\n return `${explorer}/address/${address}`;\n};\nexport const constructTxLink = (explorer: string, address: string): string => {\n return `${explorer}/tx/${address}`;\n};\n\nconst VELORA_EXPLORER_URL = \"https://explorer.velora.xyz\";\n\nexport function constructExplorerOrderDetailsLink(orderId: string): string {\n return `${VELORA_EXPLORER_URL}/order/${orderId}`;\n}\n\nexport function constructExplorerUserDetailsLink(userAddress: Address): string {\n return `${VELORA_EXPLORER_URL}/address/${userAddress}`;\n}\n\ntype ConstructAddressLinkForChainInput = {\n chainId: SupportedChainId;\n address: string;\n};\n\nexport const constructAddressLinkForChain = ({\n chainId,\n address,\n}: ConstructAddressLinkForChainInput): string | undefined => {\n const explorer = chainConfigMap[chainId].blockExplorers?.default.url;\n if (!explorer) return;\n\n return constructAddressLink(explorer, address);\n};\n\ntype ConstructTxLinkForChainInput = {\n chainId: SupportedChainId;\n txHash: string;\n};\n\nexport const constructTxLinkForChain = ({\n chainId,\n txHash,\n}: ConstructTxLinkForChainInput): string | undefined => {\n const explorer = chainConfigMap[chainId].blockExplorers?.default.url;\n if (!explorer) return;\n\n return constructTxLink(explorer, txHash);\n};\n"],"names":["constructAddressLink","explorer","address","constructTxLink","VELORA_EXPLORER_URL","constructExplorerOrderDetailsLink","orderId","constructExplorerUserDetailsLink","userAddress","constructAddressLinkForChain","chainId","chainConfigMap","blockExplorers","default","url","constructTxLinkForChain","txHash"],"mappings":";;AAIO,MAAMA,oBAAAA,GAAuBA,CAClCC,QAAAA,EACAC,OAAAA,KACW;AACX,EAAA,OAAO,CAAA,EAAGD,QAAQ,CAAA,SAAA,EAAYC,OAAO,CAAA,CAAA;AACvC;AACO,MAAMC,eAAAA,GAAkBA,CAACF,QAAAA,EAAkBC,OAAAA,KAA4B;AAC5E,EAAA,OAAO,CAAA,EAAGD,QAAQ,CAAA,IAAA,EAAOC,OAAO,CAAA,CAAA;AAClC;AAEA,MAAME,mBAAAA,GAAsB,6BAAA;AAErB,SAASC,kCAAkCC,OAAAA,EAAyB;AACzE,EAAA,OAAO,CAAA,EAAGF,mBAAmB,CAAA,OAAA,EAAUE,OAAO,CAAA,CAAA;AAChD;AAEO,SAASC,iCAAiCC,WAAAA,EAA8B;AAC7E,EAAA,OAAO,CAAA,EAAGJ,mBAAmB,CAAA,SAAA,EAAYI,WAAW,CAAA,CAAA;AACtD;AAOO,MAAMC,+BAA+BA,CAAC;AAAA,EAC3CC,OAAAA;AAAAA,EACAR;AACiC,CAAA,KAA0B;AAC3D,EAAA,MAAMD,QAAAA,GAAWU,cAAAA,CAAeD,OAAO,CAAA,CAAEE,gBAAgBC,OAAAA,CAAQC,GAAAA;AACjE,EAAA,IAAI,CAACb,QAAAA,EAAU;AAEf,EAAA,OAAOD,oBAAAA,CAAqBC,UAAUC,OAAO,CAAA;AAC/C;AAOO,MAAMa,0BAA0BA,CAAC;AAAA,EACtCL,OAAAA;AAAAA,EACAM;AAC4B,CAAA,KAA0B;AACtD,EAAA,MAAMf,QAAAA,GAAWU,cAAAA,CAAeD,OAAO,CAAA,CAAEE,gBAAgBC,OAAAA,CAAQC,GAAAA;AACjE,EAAA,IAAI,CAACb,QAAAA,EAAU;AAEf,EAAA,OAAOE,eAAAA,CAAgBF,UAAUe,MAAM,CAAA;AACzC;;;;"}
|
package/dist/lib/utils/fee.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import Big from 'big.js';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
function calculateFeeUSD(partnerFeePercent, destUSD) {
|
|
14
4
|
if (partnerFeePercent === 0 || destUSD === "0") return Big(0);
|
|
15
5
|
return Big(destUSD).times(partnerFeePercent).div(100);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee.js","sources":["../../../src/lib/utils/fee.ts"],"sourcesContent":["import Big from \"big.js\";\n\nexport function calculateFeeUSD(partnerFeePercent: number, destUSD: string) {\n if (partnerFeePercent === 0 || destUSD === \"0\") return Big(0);\n\n return Big(destUSD).times(partnerFeePercent).div(100);\n}\n\nexport function subtractFee(\n amount: string | Big,\n fee: number // e.g. 1 for 1%\n): string {\n if (fee === 0) return amount.toString();\n\n const feePercent = Big(fee).div(100);\n const multiplier = Big(1).minus(feePercent);\n return Big(amount).mul(multiplier).toFixed(0);\n}\n"],"names":["calculateFeeUSD","partnerFeePercent","destUSD","Big","times","div","subtractFee","amount","fee","toString","feePercent","multiplier","minus","mul","toFixed"],"mappings":"
|
|
1
|
+
{"version":3,"file":"fee.js","sources":["../../../src/lib/utils/fee.ts"],"sourcesContent":["import Big from \"big.js\";\n\nexport function calculateFeeUSD(partnerFeePercent: number, destUSD: string) {\n if (partnerFeePercent === 0 || destUSD === \"0\") return Big(0);\n\n return Big(destUSD).times(partnerFeePercent).div(100);\n}\n\nexport function subtractFee(\n amount: string | Big,\n fee: number // e.g. 1 for 1%\n): string {\n if (fee === 0) return amount.toString();\n\n const feePercent = Big(fee).div(100);\n const multiplier = Big(1).minus(feePercent);\n return Big(amount).mul(multiplier).toFixed(0);\n}\n"],"names":["calculateFeeUSD","partnerFeePercent","destUSD","Big","times","div","subtractFee","amount","fee","toString","feePercent","multiplier","minus","mul","toFixed"],"mappings":";;AAEO,SAASA,eAAAA,CAAgBC,mBAA2BC,OAAAA,EAAiB;AAC1E,EAAA,IAAID,sBAAsB,CAAA,IAAKC,OAAAA,KAAY,GAAA,EAAK,OAAOC,IAAI,CAAC,CAAA;AAE5D,EAAA,OAAOA,IAAID,OAAO,CAAA,CAAEE,MAAMH,iBAAiB,CAAA,CAAEI,IAAI,GAAG,CAAA;AACtD;AAEO,SAASC,WAAAA,CACdC,QACAC,GAAAA,EACQ;AACR,EAAA,IAAIA,GAAAA,KAAQ,CAAA,EAAG,OAAOD,MAAAA,CAAOE,QAAAA,EAAS;AAEtC,EAAA,MAAMC,UAAAA,GAAaP,GAAAA,CAAIK,GAAG,CAAA,CAAEH,IAAI,GAAG,CAAA;AACnC,EAAA,MAAMM,UAAAA,GAAaR,GAAAA,CAAI,CAAC,CAAA,CAAES,MAAMF,UAAU,CAAA;AAC1C,EAAA,OAAOP,IAAII,MAAM,CAAA,CAAEM,IAAIF,UAAU,CAAA,CAAEG,QAAQ,CAAC,CAAA;AAC9C;;;;"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
2
|
-
cache: /* @__PURE__ */ new Map(),
|
|
3
|
-
get(name, inst) {
|
|
4
|
-
if (this.cache.has(name)) {
|
|
5
|
-
return this.cache.get(name);
|
|
6
|
-
}
|
|
7
|
-
this.cache.set(name, inst);
|
|
8
|
-
return inst;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
1
|
function formatFiatPrice(price, currency = "USD") {
|
|
12
2
|
if (price === null || price === void 0) return "-";
|
|
13
3
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatFiatPrice.js","sources":["../../../src/lib/utils/formatFiatPrice.ts"],"sourcesContent":["type Nullish<T> = T | null | undefined;\n\n/** Formats USD and non-USD prices */\nexport function formatFiatPrice(\n price: Nullish<number>,\n currency = \"USD\"\n): string {\n if (price === null || price === undefined) return \"-\";\n return new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency }).format(\n price\n );\n}\n"],"names":["formatFiatPrice","price","currency","undefined","Intl","NumberFormat","style","format"],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatFiatPrice.js","sources":["../../../src/lib/utils/formatFiatPrice.ts"],"sourcesContent":["type Nullish<T> = T | null | undefined;\n\n/** Formats USD and non-USD prices */\nexport function formatFiatPrice(\n price: Nullish<number>,\n currency = \"USD\"\n): string {\n if (price === null || price === undefined) return \"-\";\n return new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency }).format(\n price\n );\n}\n"],"names":["formatFiatPrice","price","currency","undefined","Intl","NumberFormat","style","format"],"mappings":"AAGO,SAASA,eAAAA,CACdC,KAAAA,EACAC,QAAAA,GAAW,KAAA,EACH;AACR,EAAA,IAAID,KAAAA,KAAU,IAAA,IAAQA,KAAAA,KAAUE,MAAAA,EAAW,OAAO,GAAA;AAClD,EAAA,OAAO,IAAIC,IAAAA,CAAKC,YAAAA,CAAa,OAAA,EAAS;AAAA,IAAEC,KAAAA,EAAO,UAAA;AAAA,IAAYJ;AAAAA,GAAU,CAAA,CAAEK,MAAAA,CACrEN,KACF,CAAA;AACF;;;;"}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { formatUnits } from 'viem';
|
|
2
2
|
import { removeTrailingZeros } from './removeZeroDecimals.js';
|
|
3
3
|
|
|
4
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
5
|
-
cache: /* @__PURE__ */ new Map(),
|
|
6
|
-
get(name, inst) {
|
|
7
|
-
if (this.cache.has(name)) {
|
|
8
|
-
return this.cache.get(name);
|
|
9
|
-
}
|
|
10
|
-
this.cache.set(name, inst);
|
|
11
|
-
return inst;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
4
|
function formatTokenBalance(balance, decimals, precision = 6) {
|
|
15
5
|
if (!balance || balance === "0") return "0";
|
|
16
6
|
const tokenUnits = formatUnits(BigInt(balance), decimals);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatTokenBalance.js","sources":["../../../src/lib/utils/formatTokenBalance.ts"],"sourcesContent":["import { formatUnits } from \"viem\";\nimport { removeTrailingZeros } from \"./removeZeroDecimals\";\n\n/**\n * Formats a token balance from wei to human-readable format with specified precision\n * @param balance - Balance in wei as string or bigint\n * @param decimals - Token decimals\n * @param precision - Number of decimal places to show (default: 6)\n * @returns Formatted balance string\n */\nexport function formatTokenBalance(\n balance: string | bigint,\n decimals: number,\n precision: number = 6\n): string {\n if (!balance || balance === \"0\") return \"0\";\n\n // Convert wei to token units using viem\n const tokenUnits = formatUnits(BigInt(balance), decimals);\n\n // Convert to number for precision handling\n const num = Number(tokenUnits);\n\n // Handle very large numbers (show as whole numbers)\n const maxPrecision = 10 ** precision;\n if (num >= maxPrecision) {\n return num.toFixed(0);\n }\n\n // Format with specified precision\n return num.toFixed(precision);\n}\n\n/**\n * Formats a token balance and removes trailing zeros\n * @param balance - Balance in wei as string or bigint\n * @param decimals - Token decimals\n * @param precision - Number of decimal places to show (default: 6)\n * @returns Formatted balance string with trailing zeros removed\n */\nexport function formatTokenBalanceClean(\n balance: string | bigint,\n decimals: number,\n precision: number = 6\n): string {\n const formatted = formatTokenBalance(balance, decimals, precision);\n return removeTrailingZeros(formatted);\n}\n\n/**\n * Formats a token amount (already in token units) with nice formatting for large numbers\n * @param amount - Amount in token units (e.g., 12.4335)\n * @param maxDecimals - Maximum decimal places to show (default: 6)\n * @returns Formatted amount string with K/M/B suffixes for large numbers\n */\nexport function formatTokenAmount(\n amount: number | string | bigint,\n maxDecimals: number = 6\n): string {\n // Convert to number\n const num = Number(amount);\n\n if (!num || num === 0) return \"0\";\n\n // Handle amounts less than 100 with maximum precision\n if (num < 100) {\n return removeTrailingZeros(num.toFixed(maxDecimals));\n }\n\n // Handle large numbers with K/M/B suffixes\n if (num >= 1e9) {\n return removeTrailingZeros((num / 1e9).toFixed(2)) + \"B\";\n } else if (num >= 1e6) {\n return removeTrailingZeros((num / 1e6).toFixed(2)) + \"M\";\n } else if (num >= 1e3) {\n return removeTrailingZeros((num / 1e3).toFixed(2)) + \"K\";\n } else {\n // For numbers between 100 and 1000, show up to 2 decimal places\n return removeTrailingZeros(num.toFixed(2));\n }\n}\n\n/**\n * Formats an amount with nice formatting for large numbers\n * @param amount - Amount in token units (e.g., 12.4335)\n * @param maxDecimals - Maximum decimal places to show (default: 6)\n * @returns Formatted amount string without trailing zeros\n */\nexport function formatAmount(\n amount: number | string | bigint,\n maxDecimals: number = 6\n): string {\n const num = Number(amount);\n\n if (!num || num === 0) return \"0\";\n\n return removeTrailingZeros(num.toFixed(maxDecimals));\n}\n"],"names":["formatTokenBalance","balance","decimals","precision","tokenUnits","formatUnits","BigInt","num","Number","maxPrecision","toFixed","formatTokenBalanceClean","formatted","removeTrailingZeros","formatTokenAmount","amount","maxDecimals"],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatTokenBalance.js","sources":["../../../src/lib/utils/formatTokenBalance.ts"],"sourcesContent":["import { formatUnits } from \"viem\";\nimport { removeTrailingZeros } from \"./removeZeroDecimals\";\n\n/**\n * Formats a token balance from wei to human-readable format with specified precision\n * @param balance - Balance in wei as string or bigint\n * @param decimals - Token decimals\n * @param precision - Number of decimal places to show (default: 6)\n * @returns Formatted balance string\n */\nexport function formatTokenBalance(\n balance: string | bigint,\n decimals: number,\n precision: number = 6\n): string {\n if (!balance || balance === \"0\") return \"0\";\n\n // Convert wei to token units using viem\n const tokenUnits = formatUnits(BigInt(balance), decimals);\n\n // Convert to number for precision handling\n const num = Number(tokenUnits);\n\n // Handle very large numbers (show as whole numbers)\n const maxPrecision = 10 ** precision;\n if (num >= maxPrecision) {\n return num.toFixed(0);\n }\n\n // Format with specified precision\n return num.toFixed(precision);\n}\n\n/**\n * Formats a token balance and removes trailing zeros\n * @param balance - Balance in wei as string or bigint\n * @param decimals - Token decimals\n * @param precision - Number of decimal places to show (default: 6)\n * @returns Formatted balance string with trailing zeros removed\n */\nexport function formatTokenBalanceClean(\n balance: string | bigint,\n decimals: number,\n precision: number = 6\n): string {\n const formatted = formatTokenBalance(balance, decimals, precision);\n return removeTrailingZeros(formatted);\n}\n\n/**\n * Formats a token amount (already in token units) with nice formatting for large numbers\n * @param amount - Amount in token units (e.g., 12.4335)\n * @param maxDecimals - Maximum decimal places to show (default: 6)\n * @returns Formatted amount string with K/M/B suffixes for large numbers\n */\nexport function formatTokenAmount(\n amount: number | string | bigint,\n maxDecimals: number = 6\n): string {\n // Convert to number\n const num = Number(amount);\n\n if (!num || num === 0) return \"0\";\n\n // Handle amounts less than 100 with maximum precision\n if (num < 100) {\n return removeTrailingZeros(num.toFixed(maxDecimals));\n }\n\n // Handle large numbers with K/M/B suffixes\n if (num >= 1e9) {\n return removeTrailingZeros((num / 1e9).toFixed(2)) + \"B\";\n } else if (num >= 1e6) {\n return removeTrailingZeros((num / 1e6).toFixed(2)) + \"M\";\n } else if (num >= 1e3) {\n return removeTrailingZeros((num / 1e3).toFixed(2)) + \"K\";\n } else {\n // For numbers between 100 and 1000, show up to 2 decimal places\n return removeTrailingZeros(num.toFixed(2));\n }\n}\n\n/**\n * Formats an amount with nice formatting for large numbers\n * @param amount - Amount in token units (e.g., 12.4335)\n * @param maxDecimals - Maximum decimal places to show (default: 6)\n * @returns Formatted amount string without trailing zeros\n */\nexport function formatAmount(\n amount: number | string | bigint,\n maxDecimals: number = 6\n): string {\n const num = Number(amount);\n\n if (!num || num === 0) return \"0\";\n\n return removeTrailingZeros(num.toFixed(maxDecimals));\n}\n"],"names":["formatTokenBalance","balance","decimals","precision","tokenUnits","formatUnits","BigInt","num","Number","maxPrecision","toFixed","formatTokenBalanceClean","formatted","removeTrailingZeros","formatTokenAmount","amount","maxDecimals"],"mappings":";;;AAUO,SAASA,kBAAAA,CACdC,OAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAoB,CAAA,EACZ;AACR,EAAA,IAAI,CAACF,OAAAA,IAAWA,OAAAA,KAAY,GAAA,EAAK,OAAO,GAAA;AAGxC,EAAA,MAAMG,UAAAA,GAAaC,WAAAA,CAAYC,MAAAA,CAAOL,OAAO,GAAGC,QAAQ,CAAA;AAGxD,EAAA,MAAMK,GAAAA,GAAMC,OAAOJ,UAAU,CAAA;AAG7B,EAAA,MAAMK,eAAe,EAAA,IAAMN,SAAAA;AAC3B,EAAA,IAAII,OAAOE,YAAAA,EAAc;AACvB,IAAA,OAAOF,GAAAA,CAAIG,QAAQ,CAAC,CAAA;AAAA;AAItB,EAAA,OAAOH,GAAAA,CAAIG,QAAQP,SAAS,CAAA;AAC9B;AASO,SAASQ,uBAAAA,CACdV,OAAAA,EACAC,QAAAA,EACAC,SAAAA,GAAoB,CAAA,EACZ;AACR,EAAA,MAAMS,SAAAA,GAAYZ,kBAAAA,CAAmBC,OAAAA,EAASC,QAAAA,EAAUC,SAAS,CAAA;AACjE,EAAA,OAAOU,oBAAoBD,SAAS,CAAA;AACtC;AAQO,SAASE,iBAAAA,CACdC,MAAAA,EACAC,WAAAA,GAAsB,CAAA,EACd;AAER,EAAA,MAAMT,GAAAA,GAAMC,OAAOO,MAAM,CAAA;AAEzB,EAAA,IAAI,CAACR,GAAAA,IAAOA,GAAAA,KAAQ,CAAA,EAAG,OAAO,GAAA;AAG9B,EAAA,IAAIA,MAAM,GAAA,EAAK;AACb,IAAA,OAAOM,mBAAAA,CAAoBN,GAAAA,CAAIG,OAAAA,CAAQM,WAAW,CAAC,CAAA;AAAA;AAIrD,EAAA,IAAIT,OAAO,GAAA,EAAK;AACd,IAAA,OAAOM,qBAAqBN,GAAAA,GAAM,GAAA,EAAKG,OAAAA,CAAQ,CAAC,CAAC,CAAA,GAAI,GAAA;AAAA,GACvD,MAAA,IAAWH,OAAO,GAAA,EAAK;AACrB,IAAA,OAAOM,qBAAqBN,GAAAA,GAAM,GAAA,EAAKG,OAAAA,CAAQ,CAAC,CAAC,CAAA,GAAI,GAAA;AAAA,GACvD,MAAA,IAAWH,OAAO,GAAA,EAAK;AACrB,IAAA,OAAOM,qBAAqBN,GAAAA,GAAM,GAAA,EAAKG,OAAAA,CAAQ,CAAC,CAAC,CAAA,GAAI,GAAA;AAAA,GACvD,MAAO;AAEL,IAAA,OAAOG,mBAAAA,CAAoBN,GAAAA,CAAIG,OAAAA,CAAQ,CAAC,CAAC,CAAA;AAAA;AAE7C;;;;"}
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
3
|
|
|
4
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
5
|
-
cache: /* @__PURE__ */ new Map(),
|
|
6
|
-
get(name, inst) {
|
|
7
|
-
if (this.cache.has(name)) {
|
|
8
|
-
return this.cache.get(name);
|
|
9
|
-
}
|
|
10
|
-
this.cache.set(name, inst);
|
|
11
|
-
return inst;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
4
|
function cn(...inputs) {
|
|
15
5
|
return twMerge(clsx(inputs));
|
|
16
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/lib/utils/index.ts"],"sourcesContent":["import type { Token } from \"@/tokens/state/types\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n// reduce element[] to Object{key: prop, val?: element}\n// for example\n// gatherObjectsByProp(Token[], token => token.address) => Record<address, Token|undefined>\nexport function gatherObjectsByProp<T>(\n elements: T[],\n pickProp: (elem: T) => string\n): Record<string, T>;\nexport function gatherObjectsByProp<T, U>(\n elements: T[],\n pickProp: (elem: T) => string,\n transform: (elem: T, accumElem?: U) => U\n): Record<string, U>;\nexport function gatherObjectsByProp<T, U>(\n elements: T[],\n pickProp: (elem: T) => string,\n transform?: (elem: T, accumElem?: U) => U\n): Record<string, T> | Record<string, U> {\n return elements.reduce<Record<string, T> | Record<string, U>>(\n (accum, element) => {\n const key = pickProp(element);\n\n const accumElem: T | U | undefined = accum[key];\n const transformedElement = transform\n ? // if transform is available, can only be U | undefined\n transform(element, accumElem as U | undefined)\n : element;\n\n accum[key] = transformedElement;\n\n return accum;\n },\n {}\n );\n}\n\nexport function filterUnique<T, U>(\n elements: T[],\n // supports multikey filtering, if only one key required return [U]\n constructUniqueKeys: (element: T) => U[]\n): T[] {\n if (elements.length <= 1) return elements;\n const hasSeen = new Set<U>();\n\n return elements.filter((element) => {\n const keys = constructUniqueKeys(element);\n if (keys.some((key) => hasSeen.has(key))) return false;\n\n keys.forEach((key) => hasSeen.add(key));\n return true;\n });\n}\n\nexport const isTruthy = <T>(x: T | false | 0 | \"\" | null | undefined): x is T =>\n !!x;\n\nexport function hasCorrectAddressLength(maybeAddress: string): boolean {\n return maybeAddress.length === 42;\n}\n\nexport const filterInvalidTokenAddress = ({\n address,\n}: Pick<Token, \"address\">) => hasCorrectAddressLength(address);\n\nexport const stringIncludes = (a: string, b: string): boolean => {\n return a.toLowerCase().includes(b.toLowerCase());\n};\n\n// Logger utilities\nexport { createLogger, devLogger } from \"./logger\";\n\n/**\n * Shorten any string with more than 6 characters (included) by inserting ellipsis placeholder in between\n *\n * @param {string} str the string to shorten\n * @param {number} start how much to leave off the start\n * @param {number} [end=0] how much to leave off the end\n * @returns {string} shortened text\n */\nexport const shortenText = (\n str: string,\n start: number,\n end: number = 0\n): string => {\n const regexp = new RegExp(`(.{${start}}).{3,}(.{${end}})`);\n return str.replace(regexp, \"$1...$2\");\n};\n\nexport function shortenAddress(\n address: string,\n slashIndex = 6,\n rightCutLength = 4\n): string {\n // An ethereum address has 42 characters\n return shortenText(address, slashIndex, rightCutLength);\n}\n"],"names":["cn","inputs","twMerge","clsx","gatherObjectsByProp","elements","pickProp","transform","reduce","accum","element","key","accumElem","transformedElement","filterUnique","constructUniqueKeys","length","hasSeen","Set","filter","keys","some","has","forEach","add","isTruthy","x","hasCorrectAddressLength","maybeAddress","filterInvalidTokenAddress","address","stringIncludes","a","b","toLowerCase","includes","shortenText","str","start","end","regexp","RegExp","replace","shortenAddress","slashIndex","rightCutLength"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/lib/utils/index.ts"],"sourcesContent":["import type { Token } from \"@/tokens/state/types\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n// reduce element[] to Object{key: prop, val?: element}\n// for example\n// gatherObjectsByProp(Token[], token => token.address) => Record<address, Token|undefined>\nexport function gatherObjectsByProp<T>(\n elements: T[],\n pickProp: (elem: T) => string\n): Record<string, T>;\nexport function gatherObjectsByProp<T, U>(\n elements: T[],\n pickProp: (elem: T) => string,\n transform: (elem: T, accumElem?: U) => U\n): Record<string, U>;\nexport function gatherObjectsByProp<T, U>(\n elements: T[],\n pickProp: (elem: T) => string,\n transform?: (elem: T, accumElem?: U) => U\n): Record<string, T> | Record<string, U> {\n return elements.reduce<Record<string, T> | Record<string, U>>(\n (accum, element) => {\n const key = pickProp(element);\n\n const accumElem: T | U | undefined = accum[key];\n const transformedElement = transform\n ? // if transform is available, can only be U | undefined\n transform(element, accumElem as U | undefined)\n : element;\n\n accum[key] = transformedElement;\n\n return accum;\n },\n {}\n );\n}\n\nexport function filterUnique<T, U>(\n elements: T[],\n // supports multikey filtering, if only one key required return [U]\n constructUniqueKeys: (element: T) => U[]\n): T[] {\n if (elements.length <= 1) return elements;\n const hasSeen = new Set<U>();\n\n return elements.filter((element) => {\n const keys = constructUniqueKeys(element);\n if (keys.some((key) => hasSeen.has(key))) return false;\n\n keys.forEach((key) => hasSeen.add(key));\n return true;\n });\n}\n\nexport const isTruthy = <T>(x: T | false | 0 | \"\" | null | undefined): x is T =>\n !!x;\n\nexport function hasCorrectAddressLength(maybeAddress: string): boolean {\n return maybeAddress.length === 42;\n}\n\nexport const filterInvalidTokenAddress = ({\n address,\n}: Pick<Token, \"address\">) => hasCorrectAddressLength(address);\n\nexport const stringIncludes = (a: string, b: string): boolean => {\n return a.toLowerCase().includes(b.toLowerCase());\n};\n\n// Logger utilities\nexport { createLogger, devLogger } from \"./logger\";\n\n/**\n * Shorten any string with more than 6 characters (included) by inserting ellipsis placeholder in between\n *\n * @param {string} str the string to shorten\n * @param {number} start how much to leave off the start\n * @param {number} [end=0] how much to leave off the end\n * @returns {string} shortened text\n */\nexport const shortenText = (\n str: string,\n start: number,\n end: number = 0\n): string => {\n const regexp = new RegExp(`(.{${start}}).{3,}(.{${end}})`);\n return str.replace(regexp, \"$1...$2\");\n};\n\nexport function shortenAddress(\n address: string,\n slashIndex = 6,\n rightCutLength = 4\n): string {\n // An ethereum address has 42 characters\n return shortenText(address, slashIndex, rightCutLength);\n}\n"],"names":["cn","inputs","twMerge","clsx","gatherObjectsByProp","elements","pickProp","transform","reduce","accum","element","key","accumElem","transformedElement","filterUnique","constructUniqueKeys","length","hasSeen","Set","filter","keys","some","has","forEach","add","isTruthy","x","hasCorrectAddressLength","maybeAddress","filterInvalidTokenAddress","address","stringIncludes","a","b","toLowerCase","includes","shortenText","str","start","end","regexp","RegExp","replace","shortenAddress","slashIndex","rightCutLength"],"mappings":";;;AAIO,SAASA,MAAMC,MAAAA,EAAsB;AAC1C,EAAA,OAAOC,OAAAA,CAAQC,IAAAA,CAAKF,MAAM,CAAC,CAAA;AAC7B;AAcO,SAASG,mBAAAA,CACdC,QAAAA,EACAC,QAAAA,EACAC,SAAAA,EACuC;AACvC,EAAA,OAAOF,QAAAA,CAASG,MAAAA,CACd,CAACC,KAAAA,EAAOC,OAAAA,KAAY;AAClB,IAAA,MAAMC,GAAAA,GAAML,SAASI,OAAO,CAAA;AAE5B,IAAA,MAAME,SAAAA,GAA+BH,MAAME,GAAG,CAAA;AAC9C,IAAA,MAAME,kBAAAA,GAAqBN,SAAAA;AAAAA;AAAAA,MAEvBA,SAAAA,CAAUG,SAASE,SAA0B;AAAA,QAC7CF,OAAAA;AAEJD,IAAAA,KAAAA,CAAME,GAAG,CAAA,GAAIE,kBAAAA;AAEb,IAAA,OAAOJ,KAAAA;AAAAA,GACT,EACA,EACF,CAAA;AACF;AAEO,SAASK,YAAAA,CACdT,UAEAU,mBAAAA,EACK;AACL,EAAA,IAAIV,QAAAA,CAASW,MAAAA,IAAU,CAAA,EAAG,OAAOX,QAAAA;AACjC,EAAA,MAAMY,OAAAA,uBAAcC,GAAAA,EAAO;AAE3B,EAAA,OAAOb,QAAAA,CAASc,OAAQT,CAAAA,OAAAA,KAAY;AAClC,IAAA,MAAMU,IAAAA,GAAOL,oBAAoBL,OAAO,CAAA;AACxC,IAAA,IAAIU,IAAAA,CAAKC,KAAMV,CAAAA,GAAAA,KAAQM,OAAAA,CAAQK,IAAIX,GAAG,CAAC,GAAG,OAAO,KAAA;AAEjDS,IAAAA,IAAAA,CAAKG,OAAAA,CAASZ,CAAAA,GAAAA,KAAQM,OAAAA,CAAQO,GAAAA,CAAIb,GAAG,CAAC,CAAA;AACtC,IAAA,OAAO,IAAA;AAAA,GACR,CAAA;AACH;AAEO,MAAMc,QAAAA,GAAW,CAAIC,CAAAA,KAC1B,CAAC,CAACA;AAEG,SAASC,wBAAwBC,YAAAA,EAA+B;AACrE,EAAA,OAAOA,aAAaZ,MAAAA,KAAW,EAAA;AACjC;AAEO,MAAMa,4BAA4BA,CAAC;AAAA,EACxCC;AACsB,CAAA,KAAMH,wBAAwBG,OAAO;AAEtD,MAAMC,cAAAA,GAAiBA,CAACC,CAAAA,EAAWC,CAAAA,KAAuB;AAC/D,EAAA,OAAOD,EAAEE,WAAAA,EAAY,CAAEC,QAAAA,CAASF,CAAAA,CAAEC,aAAa,CAAA;AACjD;AAaO,MAAME,WAAAA,GAAcA,CACzBC,GAAAA,EACAC,KAAAA,EACAC,MAAc,CAAA,KACH;AACX,EAAA,MAAMC,SAAS,IAAIC,MAAAA,CAAO,MAAMH,KAAK,CAAA,UAAA,EAAaC,GAAG,CAAA,EAAA,CAAI,CAAA;AACzD,EAAA,OAAOF,GAAAA,CAAIK,OAAAA,CAAQF,MAAAA,EAAQ,SAAS,CAAA;AACtC;AAEO,SAASG,cAAAA,CACdb,OAAAA,EACAc,UAAAA,GAAa,CAAA,EACbC,iBAAiB,CAAA,EACT;AAER,EAAA,OAAOT,WAAAA,CAAYN,OAAAA,EAASc,UAAAA,EAAYC,cAAc,CAAA;AACxD;;;;"}
|
package/dist/lib/utils/price.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { amountAfterSlippage, subtractSlippage } from './slippage.js';
|
|
2
2
|
import { subtractFee } from './fee.js';
|
|
3
3
|
|
|
4
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
5
|
-
cache: /* @__PURE__ */ new Map(),
|
|
6
|
-
get(name, inst) {
|
|
7
|
-
if (this.cache.has(name)) {
|
|
8
|
-
return this.cache.get(name);
|
|
9
|
-
}
|
|
10
|
-
this.cache.set(name, inst);
|
|
11
|
-
return inst;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
4
|
function applySlippage({
|
|
15
5
|
srcAmount,
|
|
16
6
|
destAmount
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.js","sources":["../../../src/lib/utils/price.ts"],"sourcesContent":["import type { DeltaOrMarketPrice } from \"@/hooks/swap/prices/types\";\nimport { amountAfterSlippage, subtractSlippage } from \"./slippage\";\nimport { subtractFee } from \"./fee\";\n\n/**\n * Applies slippage to the srcAmount and destAmount of a DeltaOrMarketPrice.\n *\n * @param srcAmount - The source amount of the trade.\n * @param destAmount - The destination amount of the trade.\n * @param slippage - The slippage percentage to apply (e.g., 0.5 for 0.5%).\n * @param side - The side of the trade, either \"BUY\" or \"SELL\".\n * @returns An object containing the adjusted srcAmount and destAmount after applying slippage.\n */\nexport function applySlippage(\n {\n srcAmount,\n destAmount,\n }: Pick<DeltaOrMarketPrice, \"srcAmount\" | \"destAmount\">,\n slippage: number,\n side: \"BUY\" | \"SELL\"\n) {\n if (side === \"BUY\") {\n const srcAmountAfterSlippage = amountAfterSlippage(\n srcAmount,\n slippage,\n side\n ).toFixed(0);\n\n return {\n srcAmount: srcAmountAfterSlippage,\n destAmount,\n };\n }\n\n const destAmountAfterSlippage = amountAfterSlippage(\n destAmount,\n slippage,\n side\n ).toFixed(0);\n\n return {\n srcAmount,\n destAmount: destAmountAfterSlippage,\n };\n}\n\n/**\n * Calculates the destination amount after applying partner fee.\n *\n * @param price - The DeltaOrMarketPrice object containing destAmounts and partnerFee.\n * @param priceMode - The mode of the price, either \"delta\" or \"market\".\n * @returns The destination amount after applying partner fee.\n */\nexport function getDestAmountAfterFee({\n price,\n priceMode,\n}: {\n price: DeltaOrMarketPrice;\n priceMode: \"delta\" | \"market\";\n}) {\n const isDelta = priceMode === \"delta\";\n if (isDelta) {\n // For Delta: price.destAmount | price.destAmountAfterBridge are amounts after fee\n return \"destAmountAfterBridge\" in price\n ? price.destAmountAfterBridge\n : price.destAmount;\n }\n\n // For Market: price.destAmount is amount before fee\n return subtractFee(price.destAmount, price.partnerFee);\n}\n\n/**\n * Calculates the destination amount after applying partner fee and slippage.\n *\n * @param price - The DeltaOrMarketPrice object containing destAmounts and partnerFee.\n * @param slippagePercent - The slippage percentage to apply.\n * @param priceMode - The mode of the price, either \"delta\" or \"market\".\n * @returns The destination amount after applying partner fee and slippage.\n */\nexport function getDestAmountAfterFeeAndSlippage({\n price,\n slippagePercent,\n priceMode,\n}: {\n price: DeltaOrMarketPrice;\n slippagePercent: number;\n priceMode: \"delta\" | \"market\";\n}) {\n const destAmountAfterFee = getDestAmountAfterFee({ price, priceMode });\n return subtractSlippage(destAmountAfterFee, slippagePercent);\n}\n"],"names":["applySlippage","srcAmount","destAmount","slippage","side","srcAmountAfterSlippage","amountAfterSlippage","toFixed","destAmountAfterSlippage","getDestAmountAfterFee","price","priceMode","isDelta","destAmountAfterBridge","subtractFee","partnerFee","getDestAmountAfterFeeAndSlippage","slippagePercent","destAmountAfterFee","subtractSlippage"],"mappings":"
|
|
1
|
+
{"version":3,"file":"price.js","sources":["../../../src/lib/utils/price.ts"],"sourcesContent":["import type { DeltaOrMarketPrice } from \"@/hooks/swap/prices/types\";\nimport { amountAfterSlippage, subtractSlippage } from \"./slippage\";\nimport { subtractFee } from \"./fee\";\n\n/**\n * Applies slippage to the srcAmount and destAmount of a DeltaOrMarketPrice.\n *\n * @param srcAmount - The source amount of the trade.\n * @param destAmount - The destination amount of the trade.\n * @param slippage - The slippage percentage to apply (e.g., 0.5 for 0.5%).\n * @param side - The side of the trade, either \"BUY\" or \"SELL\".\n * @returns An object containing the adjusted srcAmount and destAmount after applying slippage.\n */\nexport function applySlippage(\n {\n srcAmount,\n destAmount,\n }: Pick<DeltaOrMarketPrice, \"srcAmount\" | \"destAmount\">,\n slippage: number,\n side: \"BUY\" | \"SELL\"\n) {\n if (side === \"BUY\") {\n const srcAmountAfterSlippage = amountAfterSlippage(\n srcAmount,\n slippage,\n side\n ).toFixed(0);\n\n return {\n srcAmount: srcAmountAfterSlippage,\n destAmount,\n };\n }\n\n const destAmountAfterSlippage = amountAfterSlippage(\n destAmount,\n slippage,\n side\n ).toFixed(0);\n\n return {\n srcAmount,\n destAmount: destAmountAfterSlippage,\n };\n}\n\n/**\n * Calculates the destination amount after applying partner fee.\n *\n * @param price - The DeltaOrMarketPrice object containing destAmounts and partnerFee.\n * @param priceMode - The mode of the price, either \"delta\" or \"market\".\n * @returns The destination amount after applying partner fee.\n */\nexport function getDestAmountAfterFee({\n price,\n priceMode,\n}: {\n price: DeltaOrMarketPrice;\n priceMode: \"delta\" | \"market\";\n}) {\n const isDelta = priceMode === \"delta\";\n if (isDelta) {\n // For Delta: price.destAmount | price.destAmountAfterBridge are amounts after fee\n return \"destAmountAfterBridge\" in price\n ? price.destAmountAfterBridge\n : price.destAmount;\n }\n\n // For Market: price.destAmount is amount before fee\n return subtractFee(price.destAmount, price.partnerFee);\n}\n\n/**\n * Calculates the destination amount after applying partner fee and slippage.\n *\n * @param price - The DeltaOrMarketPrice object containing destAmounts and partnerFee.\n * @param slippagePercent - The slippage percentage to apply.\n * @param priceMode - The mode of the price, either \"delta\" or \"market\".\n * @returns The destination amount after applying partner fee and slippage.\n */\nexport function getDestAmountAfterFeeAndSlippage({\n price,\n slippagePercent,\n priceMode,\n}: {\n price: DeltaOrMarketPrice;\n slippagePercent: number;\n priceMode: \"delta\" | \"market\";\n}) {\n const destAmountAfterFee = getDestAmountAfterFee({ price, priceMode });\n return subtractSlippage(destAmountAfterFee, slippagePercent);\n}\n"],"names":["applySlippage","srcAmount","destAmount","slippage","side","srcAmountAfterSlippage","amountAfterSlippage","toFixed","destAmountAfterSlippage","getDestAmountAfterFee","price","priceMode","isDelta","destAmountAfterBridge","subtractFee","partnerFee","getDestAmountAfterFeeAndSlippage","slippagePercent","destAmountAfterFee","subtractSlippage"],"mappings":";;;AAaO,SAASA,aAAAA,CACd;AAAA,EACEC,SAAAA;AAAAA,EACAC;AACoD,CAAA,EACtDC,UACAC,IAAAA,EACA;AACA,EAAA,IAAIA,SAAS,KAAA,EAAO;AAClB,IAAA,MAAMC,yBAAyBC,mBAAAA,CAC7BL,SAAAA,EACAE,UACAC,IACF,CAAA,CAAEG,QAAQ,CAAC,CAAA;AAEX,IAAA,OAAO;AAAA,MACLN,SAAAA,EAAWI,sBAAAA;AAAAA,MACXH;AAAAA,KACF;AAAA;AAGF,EAAA,MAAMM,0BAA0BF,mBAAAA,CAC9BJ,UAAAA,EACAC,UACAC,IACF,CAAA,CAAEG,QAAQ,CAAC,CAAA;AAEX,EAAA,OAAO;AAAA,IACLN,SAAAA;AAAAA,IACAC,UAAAA,EAAYM;AAAAA,GACd;AACF;AASO,SAASC,qBAAAA,CAAsB;AAAA,EACpCC,KAAAA;AAAAA,EACAC;AAIF,CAAA,EAAG;AACD,EAAA,MAAMC,UAAUD,SAAAA,KAAc,OAAA;AAC9B,EAAA,IAAIC,OAAAA,EAAS;AAEX,IAAA,OAAO,uBAAA,IAA2BF,KAAAA,GAC9BA,KAAAA,CAAMG,qBAAAA,GACNH,KAAAA,CAAMR,UAAAA;AAAAA;AAIZ,EAAA,OAAOY,WAAAA,CAAYJ,KAAAA,CAAMR,UAAAA,EAAYQ,KAAAA,CAAMK,UAAU,CAAA;AACvD;AAUO,SAASC,gCAAAA,CAAiC;AAAA,EAC/CN,KAAAA;AAAAA,EACAO,eAAAA;AAAAA,EACAN;AAKF,CAAA,EAAG;AACD,EAAA,MAAMO,qBAAqBT,qBAAAA,CAAsB;AAAA,IAAEC,KAAAA;AAAAA,IAAOC;AAAAA,GAAW,CAAA;AACrE,EAAA,OAAOQ,gBAAAA,CAAiBD,oBAAoBD,eAAe,CAAA;AAC7D;;;;"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import Big from 'big.js';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
function calculatePriceImpactPercent(fromUSD, toUSD) {
|
|
14
4
|
if (fromUSD === "0" || toUSD === "0") {
|
|
15
5
|
return new Big(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceImpact.js","sources":["../../../src/lib/utils/priceImpact.ts"],"sourcesContent":["import type { DeltaOrMarketPrice } from \"@/hooks/swap/prices/types\";\nimport Big from \"big.js\";\n\nexport function calculatePriceImpactPercent(\n fromUSD: string,\n toUSD: string\n): Big {\n if (fromUSD === \"0\" || toUSD === \"0\") {\n return new Big(0);\n }\n\n const toBN = Big(toUSD);\n if (toBN.gte(fromUSD)) return Big(0);\n const calculatedImpact = Big(1).minus(toBN.div(fromUSD)).times(100);\n\n return Big(Math.min(calculatedImpact.toNumber(), 100));\n}\n\nexport function getPriceImpact(price: DeltaOrMarketPrice): {\n priceImpact: number;\n isHighImpact: boolean;\n} {\n const srcUSD = price.srcUSD;\n const destUSD = price.destUSD;\n\n const impact =\n // can't calc priceImpact without knowing USD prices of tokens\n srcUSD && destUSD ? calculatePriceImpactPercent(srcUSD, destUSD) : null;\n\n if (impact === null) {\n return {\n priceImpact: 0,\n isHighImpact: false,\n };\n }\n\n const impactAbsoluteValue = impact.abs();\n\n return {\n priceImpact: impactAbsoluteValue.toNumber(),\n isHighImpact: impactAbsoluteValue.gt(5),\n };\n}\n"],"names":["calculatePriceImpactPercent","fromUSD","toUSD","Big","toBN","gte","calculatedImpact","minus","div","times","Math","min","toNumber","getPriceImpact","price","srcUSD","destUSD","impact","priceImpact","isHighImpact","impactAbsoluteValue","abs","gt"],"mappings":"
|
|
1
|
+
{"version":3,"file":"priceImpact.js","sources":["../../../src/lib/utils/priceImpact.ts"],"sourcesContent":["import type { DeltaOrMarketPrice } from \"@/hooks/swap/prices/types\";\nimport Big from \"big.js\";\n\nexport function calculatePriceImpactPercent(\n fromUSD: string,\n toUSD: string\n): Big {\n if (fromUSD === \"0\" || toUSD === \"0\") {\n return new Big(0);\n }\n\n const toBN = Big(toUSD);\n if (toBN.gte(fromUSD)) return Big(0);\n const calculatedImpact = Big(1).minus(toBN.div(fromUSD)).times(100);\n\n return Big(Math.min(calculatedImpact.toNumber(), 100));\n}\n\nexport function getPriceImpact(price: DeltaOrMarketPrice): {\n priceImpact: number;\n isHighImpact: boolean;\n} {\n const srcUSD = price.srcUSD;\n const destUSD = price.destUSD;\n\n const impact =\n // can't calc priceImpact without knowing USD prices of tokens\n srcUSD && destUSD ? calculatePriceImpactPercent(srcUSD, destUSD) : null;\n\n if (impact === null) {\n return {\n priceImpact: 0,\n isHighImpact: false,\n };\n }\n\n const impactAbsoluteValue = impact.abs();\n\n return {\n priceImpact: impactAbsoluteValue.toNumber(),\n isHighImpact: impactAbsoluteValue.gt(5),\n };\n}\n"],"names":["calculatePriceImpactPercent","fromUSD","toUSD","Big","toBN","gte","calculatedImpact","minus","div","times","Math","min","toNumber","getPriceImpact","price","srcUSD","destUSD","impact","priceImpact","isHighImpact","impactAbsoluteValue","abs","gt"],"mappings":";;AAGO,SAASA,2BAAAA,CACdC,SACAC,KAAAA,EACK;AACL,EAAA,IAAID,OAAAA,KAAY,GAAA,IAAOC,KAAAA,KAAU,GAAA,EAAK;AACpC,IAAA,OAAO,IAAIC,IAAI,CAAC,CAAA;AAAA;AAGlB,EAAA,MAAMC,IAAAA,GAAOD,IAAID,KAAK,CAAA;AACtB,EAAA,IAAIE,KAAKC,GAAAA,CAAIJ,OAAO,CAAA,EAAG,OAAOE,IAAI,CAAC,CAAA;AACnC,EAAA,MAAMG,gBAAAA,GAAmBH,GAAAA,CAAI,CAAC,CAAA,CAAEI,KAAAA,CAAMH,IAAAA,CAAKI,GAAAA,CAAIP,OAAO,CAAC,CAAA,CAAEQ,KAAAA,CAAM,GAAG,CAAA;AAElE,EAAA,OAAON,IAAIO,IAAAA,CAAKC,GAAAA,CAAIL,iBAAiBM,QAAAA,EAAS,EAAG,GAAG,CAAC,CAAA;AACvD;AAEO,SAASC,eAAeC,KAAAA,EAG7B;AACA,EAAA,MAAMC,SAASD,KAAAA,CAAMC,MAAAA;AACrB,EAAA,MAAMC,UAAUF,KAAAA,CAAME,OAAAA;AAEtB,EAAA,MAAMC,MAAAA;AAAAA;AAAAA,IAEJF,MAAAA,IAAUC,OAAAA,GAAUhB,2BAAAA,CAA4Be,MAAAA,EAAQC,OAAO,CAAA,GAAI;AAAA,GAAA;AAErE,EAAA,IAAIC,WAAW,IAAA,EAAM;AACnB,IAAA,OAAO;AAAA,MACLC,WAAAA,EAAa,CAAA;AAAA,MACbC,YAAAA,EAAc;AAAA,KAChB;AAAA;AAGF,EAAA,MAAMC,mBAAAA,GAAsBH,OAAOI,GAAAA,EAAI;AAEvC,EAAA,OAAO;AAAA,IACLH,WAAAA,EAAaE,oBAAoBR,QAAAA,EAAS;AAAA,IAC1CO,YAAAA,EAAcC,mBAAAA,CAAoBE,EAAAA,CAAG,CAAC;AAAA,GACxC;AACF;;;;"}
|
package/dist/lib/utils/rate.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import Big from 'big.js';
|
|
2
2
|
import { removeTrailingZeros } from './removeZeroDecimals.js';
|
|
3
3
|
|
|
4
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
5
|
-
cache: /* @__PURE__ */ new Map(),
|
|
6
|
-
get(name, inst) {
|
|
7
|
-
if (this.cache.has(name)) {
|
|
8
|
-
return this.cache.get(name);
|
|
9
|
-
}
|
|
10
|
-
this.cache.set(name, inst);
|
|
11
|
-
return inst;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
4
|
function calcRate(fromAmount, toAmount) {
|
|
15
5
|
const fromUnits = Big(fromAmount);
|
|
16
6
|
const toUnits = Big(toAmount);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate.js","sources":["../../../src/lib/utils/rate.ts"],"sourcesContent":["import Big from \"big.js\";\nimport { removeTrailingZeros } from \"./removeZeroDecimals\";\n\nexport function calcRate(\n fromAmount: string | number | Big,\n toAmount: string | number | Big\n): {\n rate: Big;\n rateFormatted: string;\n} | null {\n const fromUnits = Big(fromAmount);\n const toUnits = Big(toAmount);\n if (fromUnits.eq(0) || toUnits.eq(0)) return null;\n\n const rate = toUnits.div(fromUnits);\n\n const decimalPrecision = rate.gt(1e6)\n ? 0 // no need fraction digits for big numbers\n : rate.gt(1e-1)\n ? 4 // 4 digits for smaller numbers (between 1 mil and 0.1)\n : 10; // at the time of writing 1 PSP = 0.0000001827 WBTC\n\n const rateFormatted = removeTrailingZeros(\n rate.toFixed(decimalPrecision, Big.roundDown)\n );\n\n return {\n rate,\n rateFormatted,\n };\n}\n"],"names":["calcRate","fromAmount","toAmount","fromUnits","Big","toUnits","eq","rate","div","decimalPrecision","gt","rateFormatted","removeTrailingZeros","toFixed","roundDown"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rate.js","sources":["../../../src/lib/utils/rate.ts"],"sourcesContent":["import Big from \"big.js\";\nimport { removeTrailingZeros } from \"./removeZeroDecimals\";\n\nexport function calcRate(\n fromAmount: string | number | Big,\n toAmount: string | number | Big\n): {\n rate: Big;\n rateFormatted: string;\n} | null {\n const fromUnits = Big(fromAmount);\n const toUnits = Big(toAmount);\n if (fromUnits.eq(0) || toUnits.eq(0)) return null;\n\n const rate = toUnits.div(fromUnits);\n\n const decimalPrecision = rate.gt(1e6)\n ? 0 // no need fraction digits for big numbers\n : rate.gt(1e-1)\n ? 4 // 4 digits for smaller numbers (between 1 mil and 0.1)\n : 10; // at the time of writing 1 PSP = 0.0000001827 WBTC\n\n const rateFormatted = removeTrailingZeros(\n rate.toFixed(decimalPrecision, Big.roundDown)\n );\n\n return {\n rate,\n rateFormatted,\n };\n}\n"],"names":["calcRate","fromAmount","toAmount","fromUnits","Big","toUnits","eq","rate","div","decimalPrecision","gt","rateFormatted","removeTrailingZeros","toFixed","roundDown"],"mappings":";;;AAGO,SAASA,QAAAA,CACdC,YACAC,QAAAA,EAIO;AACP,EAAA,MAAMC,SAAAA,GAAYC,IAAIH,UAAU,CAAA;AAChC,EAAA,MAAMI,OAAAA,GAAUD,IAAIF,QAAQ,CAAA;AAC5B,EAAA,IAAIC,SAAAA,CAAUG,GAAG,CAAC,CAAA,IAAKD,QAAQC,EAAAA,CAAG,CAAC,GAAG,OAAO,IAAA;AAE7C,EAAA,MAAMC,IAAAA,GAAOF,OAAAA,CAAQG,GAAAA,CAAIL,SAAS,CAAA;AAElC,EAAA,MAAMM,gBAAAA,GAAmBF,IAAAA,CAAKG,EAAAA,CAAG,GAAG,CAAA,GAChC,IACAH,IAAAA,CAAKG,EAAAA,CAAG,GAAI,CAAA,GACV,CAAA,GACA,EAAA;AAEN,EAAA,MAAMC,gBAAgBC,mBAAAA,CACpBL,IAAAA,CAAKM,QAAQJ,gBAAAA,EAAkBL,GAAAA,CAAIU,SAAS,CAC9C,CAAA;AAEA,EAAA,OAAO;AAAA,IACLP,IAAAA;AAAAA,IACAI;AAAAA,GACF;AACF;;;;"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
2
|
-
cache: /* @__PURE__ */ new Map(),
|
|
3
|
-
get(name, inst) {
|
|
4
|
-
if (this.cache.has(name)) {
|
|
5
|
-
return this.cache.get(name);
|
|
6
|
-
}
|
|
7
|
-
this.cache.set(name, inst);
|
|
8
|
-
return inst;
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
1
|
function getFirstTrailingZeroIndex(value) {
|
|
12
2
|
for (let i = value.length - 1; i > 0; i--) {
|
|
13
3
|
if (value[i] !== "0") return i + 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeZeroDecimals.js","sources":["../../../src/lib/utils/removeZeroDecimals.ts"],"sourcesContent":["/**\n * Returns the index of the first non-zero character from the end of the string.\n * If all characters are zero, it returns the length of the string.\n * * Examples:\n * - 0.1000 -> 5\n * - 0.0000 -> 6\n * - 1.0000 -> 2\n * - 1000 -> 4\n * - 0 -> 1\n */\nfunction getFirstTrailingZeroIndex(value: string): number {\n for (let i = value.length - 1; i > 0; i--) {\n if (value[i] !== \"0\") return i + 1;\n }\n\n return value.length;\n}\n\n/**\n * Returns the trimmed value by removing trailing zeros.\n * * Examples:\n * - 0.10 -> 0.1\n * - 0.00 -> 0\n * - 1.00 -> 1\n */\nexport function removeTrailingZeros(value: string, separator = \".\"): string {\n if (!value.includes(separator)) return value;\n\n const trimmed = value.slice(0, getFirstTrailingZeroIndex(value));\n\n // Remove trailing zeros after the decimal point\n if (trimmed[trimmed.length - 1] === separator) return trimmed.slice(0, -1);\n\n return trimmed;\n}\n"],"names":["getFirstTrailingZeroIndex","value","i","length","removeTrailingZeros","separator","includes","trimmed","slice"],"mappings":"
|
|
1
|
+
{"version":3,"file":"removeZeroDecimals.js","sources":["../../../src/lib/utils/removeZeroDecimals.ts"],"sourcesContent":["/**\n * Returns the index of the first non-zero character from the end of the string.\n * If all characters are zero, it returns the length of the string.\n * * Examples:\n * - 0.1000 -> 5\n * - 0.0000 -> 6\n * - 1.0000 -> 2\n * - 1000 -> 4\n * - 0 -> 1\n */\nfunction getFirstTrailingZeroIndex(value: string): number {\n for (let i = value.length - 1; i > 0; i--) {\n if (value[i] !== \"0\") return i + 1;\n }\n\n return value.length;\n}\n\n/**\n * Returns the trimmed value by removing trailing zeros.\n * * Examples:\n * - 0.10 -> 0.1\n * - 0.00 -> 0\n * - 1.00 -> 1\n */\nexport function removeTrailingZeros(value: string, separator = \".\"): string {\n if (!value.includes(separator)) return value;\n\n const trimmed = value.slice(0, getFirstTrailingZeroIndex(value));\n\n // Remove trailing zeros after the decimal point\n if (trimmed[trimmed.length - 1] === separator) return trimmed.slice(0, -1);\n\n return trimmed;\n}\n"],"names":["getFirstTrailingZeroIndex","value","i","length","removeTrailingZeros","separator","includes","trimmed","slice"],"mappings":"AAUA,SAASA,0BAA0BC,KAAAA,EAAuB;AACxD,EAAA,KAAA,IAASC,IAAID,KAAAA,CAAME,MAAAA,GAAS,CAAA,EAAGD,CAAAA,GAAI,GAAGA,CAAAA,EAAAA,EAAK;AACzC,IAAA,IAAID,KAAAA,CAAMC,CAAC,CAAA,KAAM,GAAA,SAAYA,CAAAA,GAAI,CAAA;AAAA;AAGnC,EAAA,OAAOD,KAAAA,CAAME,MAAAA;AACf;AASO,SAASC,mBAAAA,CAAoBH,KAAAA,EAAeI,SAAAA,GAAY,GAAA,EAAa;AAC1E,EAAA,IAAI,CAACJ,KAAAA,CAAMK,QAAAA,CAASD,SAAS,GAAG,OAAOJ,KAAAA;AAEvC,EAAA,MAAMM,UAAUN,KAAAA,CAAMO,KAAAA,CAAM,CAAA,EAAGR,yBAAAA,CAA0BC,KAAK,CAAC,CAAA;AAG/D,EAAA,IAAIM,OAAAA,CAAQA,OAAAA,CAAQJ,MAAAA,GAAS,CAAC,CAAA,KAAME,WAAW,OAAOE,OAAAA,CAAQC,KAAAA,CAAM,CAAA,EAAG,EAAE,CAAA;AAEzE,EAAA,OAAOD,OAAAA;AACT;;;;"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import Big from 'big.js';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
function subtractSlippage(amount, slippagePercent) {
|
|
14
4
|
if (slippagePercent === 0) return amount.toString();
|
|
15
5
|
const multiplier = Big(1).minus(slippagePercent / 100);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slippage.js","sources":["../../../src/lib/utils/slippage.ts"],"sourcesContent":["import Big from \"big.js\";\n\nexport function subtractSlippage(\n amount: string | Big,\n slippagePercent: number // e.g. 0.5 for 0.5%\n): string {\n if (slippagePercent === 0) return amount.toString();\n\n const multiplier = Big(1).minus(slippagePercent / 100);\n return Big(amount).mul(multiplier).toFixed(0);\n}\n\nexport function amountAfterSlippage(\n amount: string,\n slippage: number, // e.g. 0.5 for 0.5%\n type: \"SELL\" | \"BUY\"\n): Big {\n const multiplier = type === \"BUY\" ? 1 + slippage / 100 : 1 - slippage / 100;\n return new Big(amount).mul(multiplier);\n}\n"],"names":["subtractSlippage","amount","slippagePercent","toString","multiplier","Big","minus","mul","toFixed","amountAfterSlippage","slippage","type"],"mappings":"
|
|
1
|
+
{"version":3,"file":"slippage.js","sources":["../../../src/lib/utils/slippage.ts"],"sourcesContent":["import Big from \"big.js\";\n\nexport function subtractSlippage(\n amount: string | Big,\n slippagePercent: number // e.g. 0.5 for 0.5%\n): string {\n if (slippagePercent === 0) return amount.toString();\n\n const multiplier = Big(1).minus(slippagePercent / 100);\n return Big(amount).mul(multiplier).toFixed(0);\n}\n\nexport function amountAfterSlippage(\n amount: string,\n slippage: number, // e.g. 0.5 for 0.5%\n type: \"SELL\" | \"BUY\"\n): Big {\n const multiplier = type === \"BUY\" ? 1 + slippage / 100 : 1 - slippage / 100;\n return new Big(amount).mul(multiplier);\n}\n"],"names":["subtractSlippage","amount","slippagePercent","toString","multiplier","Big","minus","mul","toFixed","amountAfterSlippage","slippage","type"],"mappings":";;AAEO,SAASA,gBAAAA,CACdC,QACAC,eAAAA,EACQ;AACR,EAAA,IAAIA,eAAAA,KAAoB,CAAA,EAAG,OAAOD,MAAAA,CAAOE,QAAAA,EAAS;AAElD,EAAA,MAAMC,aAAaC,GAAAA,CAAI,CAAC,CAAA,CAAEC,KAAAA,CAAMJ,kBAAkB,GAAG,CAAA;AACrD,EAAA,OAAOG,IAAIJ,MAAM,CAAA,CAAEM,IAAIH,UAAU,CAAA,CAAEI,QAAQ,CAAC,CAAA;AAC9C;AAEO,SAASC,mBAAAA,CACdR,MAAAA,EACAS,QAAAA,EACAC,IAAAA,EACK;AACL,EAAA,MAAMP,aAAaO,IAAAA,KAAS,KAAA,GAAQ,IAAID,QAAAA,GAAW,GAAA,GAAM,IAAIA,QAAAA,GAAW,GAAA;AACxE,EAAA,OAAO,IAAIL,GAAAA,CAAIJ,MAAM,CAAA,CAAEM,IAAIH,UAAU,CAAA;AACvC;;;;"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import Big from 'big.js';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
const DECIMAL_PRECISION = 6;
|
|
14
4
|
const TEN_POWER_DECIMAL_PRECISION = 10 ** DECIMAL_PRECISION;
|
|
15
5
|
const MAX_DECIMAL_PLACES = 30;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDecimal.js","sources":["../../../src/lib/utils/toDecimal.ts"],"sourcesContent":["import Big from \"big.js\";\n\nconst DECIMAL_PRECISION = 6;\nconst TEN_POWER_DECIMAL_PRECISION = 10 ** DECIMAL_PRECISION;\n\nconst MAX_DECIMAL_PLACES = 30;\n\n/*\n Let's set the rounding mode to round down.\n\n The reason its because the div function in Big always applies rounding,\n so we want it to round below the user balance (otherwise swap could fail)\n\n Also, let's set decimal places to 30, the reason is that the default on Big is 20\n and there are tokens that have 18 decimals (i.e ETH) and if a user wants to trade\n 0.0001 ETH, we wont have the entire value when converting it to decimals (WEI).\n*/\nBig.RM = Big.roundDown; // ex: 1.23456789 -> 1.234567\nBig.DP = MAX_DECIMAL_PLACES;\n\n/*\n Let's be careful about which rounding mode we use with `Big.toFixed()`:\n\n If the value of this Big number in normal notation has more digits to the right of the decimal point than is specified by dp, \n the return value will be rounded to dp decimal places using rounding mode rm.\n\n If the value of this Big number in normal notation has fewer fraction digits then is specified by dp,\n the return value will be appended with zeros accordingly.\n*/\n\nexport const toDecimal = (number: number): string => {\n if (number > TEN_POWER_DECIMAL_PRECISION) return number.toFixed(0);\n\n // if number - render to string without losing precision via toString\n const asNumeric = number.toString(10);\n\n if (asNumeric === \"NaN\") return \"\";\n\n return new Big(number.toString()).toPrecision(DECIMAL_PRECISION);\n};\n"],"names":["DECIMAL_PRECISION","TEN_POWER_DECIMAL_PRECISION","MAX_DECIMAL_PLACES","Big","RM","roundDown","DP","toDecimal","number","toFixed","asNumeric","toString","toPrecision"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toDecimal.js","sources":["../../../src/lib/utils/toDecimal.ts"],"sourcesContent":["import Big from \"big.js\";\n\nconst DECIMAL_PRECISION = 6;\nconst TEN_POWER_DECIMAL_PRECISION = 10 ** DECIMAL_PRECISION;\n\nconst MAX_DECIMAL_PLACES = 30;\n\n/*\n Let's set the rounding mode to round down.\n\n The reason its because the div function in Big always applies rounding,\n so we want it to round below the user balance (otherwise swap could fail)\n\n Also, let's set decimal places to 30, the reason is that the default on Big is 20\n and there are tokens that have 18 decimals (i.e ETH) and if a user wants to trade\n 0.0001 ETH, we wont have the entire value when converting it to decimals (WEI).\n*/\nBig.RM = Big.roundDown; // ex: 1.23456789 -> 1.234567\nBig.DP = MAX_DECIMAL_PLACES;\n\n/*\n Let's be careful about which rounding mode we use with `Big.toFixed()`:\n\n If the value of this Big number in normal notation has more digits to the right of the decimal point than is specified by dp, \n the return value will be rounded to dp decimal places using rounding mode rm.\n\n If the value of this Big number in normal notation has fewer fraction digits then is specified by dp,\n the return value will be appended with zeros accordingly.\n*/\n\nexport const toDecimal = (number: number): string => {\n if (number > TEN_POWER_DECIMAL_PRECISION) return number.toFixed(0);\n\n // if number - render to string without losing precision via toString\n const asNumeric = number.toString(10);\n\n if (asNumeric === \"NaN\") return \"\";\n\n return new Big(number.toString()).toPrecision(DECIMAL_PRECISION);\n};\n"],"names":["DECIMAL_PRECISION","TEN_POWER_DECIMAL_PRECISION","MAX_DECIMAL_PLACES","Big","RM","roundDown","DP","toDecimal","number","toFixed","asNumeric","toString","toPrecision"],"mappings":";;AAEA,MAAMA,iBAAAA,GAAoB,CAAA;AAC1B,MAAMC,8BAA8B,EAAA,IAAMD,iBAAAA;AAE1C,MAAME,kBAAAA,GAAqB,EAAA;AAY3BC,GAAAA,CAAIC,KAAKD,GAAAA,CAAIE,SAAAA;AACbF,GAAAA,CAAIG,EAAAA,GAAKJ,kBAAAA;AAYF,MAAMK,SAAAA,GAAYA,CAACC,MAAAA,KAA2B;AACnD,EAAA,IAAIA,MAAAA,GAASP,2BAAAA,EAA6B,OAAOO,MAAAA,CAAOC,QAAQ,CAAC,CAAA;AAGjE,EAAA,MAAMC,SAAAA,GAAYF,MAAAA,CAAOG,QAAAA,CAAS,EAAE,CAAA;AAEpC,EAAA,IAAID,SAAAA,KAAc,OAAO,OAAO,EAAA;AAEhC,EAAA,OAAO,IAAIP,GAAAA,CAAIK,MAAAA,CAAOG,UAAU,CAAA,CAAEC,YAAYZ,iBAAiB,CAAA;AACjE;;;;"}
|
package/dist/lib/utils/toasts.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { toast } from 'sonner';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
function handleTxSent(txSent) {
|
|
14
4
|
let toastOptions;
|
|
15
5
|
switch (txSent.actionType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toasts.js","sources":["../../../src/lib/utils/toasts.ts"],"sourcesContent":["import type { DeltaOrderFromAPI } from \"@/hooks/swap/prices/delta/queries/useDeltaOrders\";\nimport type { MaybeVeloraDeltaAuction } from \"@/hooks/swap/prices/delta/queries/useWatchDeltaOrder\";\nimport { toast } from \"sonner\";\nimport type { Hash, TransactionReceipt } from \"viem\";\n\nexport type TxSentObject = {\n txHash: Hash;\n actionType: \"approve\" | \"swap\" | \"wrapETH\" ;\n receiptPromise: Promise<TransactionReceipt>;\n};\n\nexport type OrderSentObject = {\n order: DeltaOrderFromAPI;\n lastOrderState: Promise<MaybeVeloraDeltaAuction>;\n};\n\nexport function handleTxSent(txSent: TxSentObject): void {\n let toastOptions;\n switch (txSent.actionType) {\n case \"approve\":\n toastOptions = {\n loading: \"Approving...\",\n success: \"Approved\",\n error: \"Approval failed\",\n };\n break;\n case \"wrapETH\":\n toastOptions = {\n loading: \"Wrapping ETH...\",\n success: \"ETH wrapped\",\n error: \"Wrapping ETH failed\",\n };\n break;\n case \"swap\":\n toastOptions = {\n loading: \"Swapping...\",\n success: \"Swap successful\",\n error: \"Swap failed\",\n };\n break;\n }\n toast.promise(txSent.receiptPromise, toastOptions);\n}\n\nexport function handleOrderSent(orderSent: OrderSentObject): void {\n const toastOptions = {\n loading: \"Order executing...\",\n success: \"Order executed\",\n error: \"Order execution failed\",\n };\n toast.promise(orderSent.lastOrderState, toastOptions);\n}\n"],"names":["handleTxSent","txSent","toastOptions","actionType","loading","success","error","toast","promise","receiptPromise","handleOrderSent","orderSent","lastOrderState"],"mappings":"
|
|
1
|
+
{"version":3,"file":"toasts.js","sources":["../../../src/lib/utils/toasts.ts"],"sourcesContent":["import type { DeltaOrderFromAPI } from \"@/hooks/swap/prices/delta/queries/useDeltaOrders\";\nimport type { MaybeVeloraDeltaAuction } from \"@/hooks/swap/prices/delta/queries/useWatchDeltaOrder\";\nimport { toast } from \"sonner\";\nimport type { Hash, TransactionReceipt } from \"viem\";\n\nexport type TxSentObject = {\n txHash: Hash;\n actionType: \"approve\" | \"swap\" | \"wrapETH\" ;\n receiptPromise: Promise<TransactionReceipt>;\n};\n\nexport type OrderSentObject = {\n order: DeltaOrderFromAPI;\n lastOrderState: Promise<MaybeVeloraDeltaAuction>;\n};\n\nexport function handleTxSent(txSent: TxSentObject): void {\n let toastOptions;\n switch (txSent.actionType) {\n case \"approve\":\n toastOptions = {\n loading: \"Approving...\",\n success: \"Approved\",\n error: \"Approval failed\",\n };\n break;\n case \"wrapETH\":\n toastOptions = {\n loading: \"Wrapping ETH...\",\n success: \"ETH wrapped\",\n error: \"Wrapping ETH failed\",\n };\n break;\n case \"swap\":\n toastOptions = {\n loading: \"Swapping...\",\n success: \"Swap successful\",\n error: \"Swap failed\",\n };\n break;\n }\n toast.promise(txSent.receiptPromise, toastOptions);\n}\n\nexport function handleOrderSent(orderSent: OrderSentObject): void {\n const toastOptions = {\n loading: \"Order executing...\",\n success: \"Order executed\",\n error: \"Order execution failed\",\n };\n toast.promise(orderSent.lastOrderState, toastOptions);\n}\n"],"names":["handleTxSent","txSent","toastOptions","actionType","loading","success","error","toast","promise","receiptPromise","handleOrderSent","orderSent","lastOrderState"],"mappings":";;AAgBO,SAASA,aAAaC,MAAAA,EAA4B;AACvD,EAAA,IAAIC,YAAAA;AACJ,EAAA,QAAQD,OAAOE,UAAAA;AAAU,IACvB,KAAK,SAAA;AACHD,MAAAA,YAAAA,GAAe;AAAA,QACbE,OAAAA,EAAS,cAAA;AAAA,QACTC,OAAAA,EAAS,UAAA;AAAA,QACTC,KAAAA,EAAO;AAAA,OACT;AACA,MAAA;AAAA,IACF,KAAK,SAAA;AACHJ,MAAAA,YAAAA,GAAe;AAAA,QACbE,OAAAA,EAAS,iBAAA;AAAA,QACTC,OAAAA,EAAS,aAAA;AAAA,QACTC,KAAAA,EAAO;AAAA,OACT;AACA,MAAA;AAAA,IACF,KAAK,MAAA;AACHJ,MAAAA,YAAAA,GAAe;AAAA,QACbE,OAAAA,EAAS,aAAA;AAAA,QACTC,OAAAA,EAAS,iBAAA;AAAA,QACTC,KAAAA,EAAO;AAAA,OACT;AACA,MAAA;AAAA;AAEJC,EAAAA,KAAAA,CAAMC,OAAAA,CAAQP,MAAAA,CAAOQ,cAAAA,EAAgBP,YAAY,CAAA;AACnD;AAEO,SAASQ,gBAAgBC,SAAAA,EAAkC;AAChE,EAAA,MAAMT,YAAAA,GAAe;AAAA,IACnBE,OAAAA,EAAS,oBAAA;AAAA,IACTC,OAAAA,EAAS,gBAAA;AAAA,IACTC,KAAAA,EAAO;AAAA,GACT;AACAC,EAAAA,KAAAA,CAAMC,OAAAA,CAAQG,SAAAA,CAAUC,cAAAA,EAAgBV,YAAY,CAAA;AACtD;;;;"}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { chains } from '../wagmi/constants.js';
|
|
2
2
|
import '@privy-io/react-auth';
|
|
3
3
|
|
|
4
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
5
|
-
cache: /* @__PURE__ */ new Map(),
|
|
6
|
-
get(name, inst) {
|
|
7
|
-
if (this.cache.has(name)) {
|
|
8
|
-
return this.cache.get(name);
|
|
9
|
-
}
|
|
10
|
-
this.cache.set(name, inst);
|
|
11
|
-
return inst;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
4
|
const privyConfig = {
|
|
15
5
|
// appearance: {
|
|
16
6
|
// // showWalletLoginFirst: true,
|
|
@@ -38,7 +28,7 @@ const privyConfig = {
|
|
|
38
28
|
},
|
|
39
29
|
// another option is to give an invalid ID,
|
|
40
30
|
// but then it retries indefinitely
|
|
41
|
-
walletConnectCloudProjectId: "
|
|
31
|
+
walletConnectCloudProjectId: "c8f04a733607c84d1028e2823a66c17c",
|
|
42
32
|
// Privy doesn't accept const Chain[]
|
|
43
33
|
supportedChains: chains
|
|
44
34
|
// defaultChain: chains[0], @TODO set to App's selected chain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../../src/lib/web3/privy/config.ts"],"sourcesContent":["import { chains } from \"@/lib/web3/wagmi/constants\";\nimport { type PrivyClientConfig } from \"@privy-io/react-auth\";\nimport type { Mutable } from \"viem\";\n\nexport const privyConfig: PrivyClientConfig = {\n // appearance: {\n // // showWalletLoginFirst: true,\n // walletChainType: \"ethereum-only\",\n // // @TODO customize theming\n // },\n // loginMethods: [\"wallet\", \"email\"],\n loginMethods: [\"email\"],\n // loginMethodsAndOrder: {\n // primary: [\"metamask\", \"wallet_connect\", \"email\", \"rainbow\"],\n // // overflow: [\"wallet\", \"email\"],\n // }, // can be used to reorder wallets in Connect Wallet Privy modal\n // Create embedded wallets for users who don't have a wallet\n embeddedWallets: {\n ethereum: {\n createOnLogin: \"users-without-wallets\",\n },\n },\n externalWallets: {\n disableAllExternalWallets: true,\n walletConnect: {\n // this doesn't do anything\n enabled: false,\n },\n },\n // another option is to give an invalid ID,\n // but then it retries indefinitely\n walletConnectCloudProjectId: import.meta.env.VITE_WALLET_CONNECT_ID,\n // Privy doesn't accept const Chain[]\n supportedChains: chains as Mutable<typeof chains>,\n // defaultChain: chains[0], @TODO set to App's selected chain\n};\n"],"names":["privyConfig","loginMethods","embeddedWallets","ethereum","createOnLogin","externalWallets","disableAllExternalWallets","walletConnect","enabled","walletConnectCloudProjectId","import","supportedChains","chains"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../../src/lib/web3/privy/config.ts"],"sourcesContent":["import { chains } from \"@/lib/web3/wagmi/constants\";\nimport { type PrivyClientConfig } from \"@privy-io/react-auth\";\nimport type { Mutable } from \"viem\";\n\nexport const privyConfig: PrivyClientConfig = {\n // appearance: {\n // // showWalletLoginFirst: true,\n // walletChainType: \"ethereum-only\",\n // // @TODO customize theming\n // },\n // loginMethods: [\"wallet\", \"email\"],\n loginMethods: [\"email\"],\n // loginMethodsAndOrder: {\n // primary: [\"metamask\", \"wallet_connect\", \"email\", \"rainbow\"],\n // // overflow: [\"wallet\", \"email\"],\n // }, // can be used to reorder wallets in Connect Wallet Privy modal\n // Create embedded wallets for users who don't have a wallet\n embeddedWallets: {\n ethereum: {\n createOnLogin: \"users-without-wallets\",\n },\n },\n externalWallets: {\n disableAllExternalWallets: true,\n walletConnect: {\n // this doesn't do anything\n enabled: false,\n },\n },\n // another option is to give an invalid ID,\n // but then it retries indefinitely\n walletConnectCloudProjectId: import.meta.env.VITE_WALLET_CONNECT_ID,\n // Privy doesn't accept const Chain[]\n supportedChains: chains as Mutable<typeof chains>,\n // defaultChain: chains[0], @TODO set to App's selected chain\n};\n"],"names":["privyConfig","loginMethods","embeddedWallets","ethereum","createOnLogin","externalWallets","disableAllExternalWallets","walletConnect","enabled","walletConnectCloudProjectId","import","supportedChains","chains"],"mappings":";;;AAIO,MAAMA,WAAAA,GAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO5CC,YAAAA,EAAc,CAAC,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMtBC,eAAAA,EAAiB;AAAA,IACfC,QAAAA,EAAU;AAAA,MACRC,aAAAA,EAAe;AAAA;AACjB,GACF;AAAA,EACAC,eAAAA,EAAiB;AAAA,IACfC,yBAAAA,EAA2B,IAAA;AAAA,IAC3BC,aAAAA,EAAe;AAAA;AAAA,MAEbC,OAAAA,EAAS;AAAA;AACX,GACF;AAAA;AAAA;AAAA,EAGAC,2BAAAA,EAA6BC,kCAAAA;AAAAA;AAAAA,EAE7BC,eAAAA,EAAiBC;AAAAA;AAEnB;;;;"}
|
|
@@ -3,16 +3,6 @@ import { injected, coinbaseWallet, walletConnect } from 'wagmi/connectors';
|
|
|
3
3
|
import { chains } from './constants.js';
|
|
4
4
|
import { transports } from './transports.js';
|
|
5
5
|
|
|
6
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
7
|
-
cache: /* @__PURE__ */ new Map(),
|
|
8
|
-
get(name, inst) {
|
|
9
|
-
if (this.cache.has(name)) {
|
|
10
|
-
return this.cache.get(name);
|
|
11
|
-
}
|
|
12
|
-
this.cache.set(name, inst);
|
|
13
|
-
return inst;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
6
|
const connectors = [
|
|
17
7
|
injected(),
|
|
18
8
|
// raw returned types result in
|
|
@@ -21,7 +11,7 @@ const connectors = [
|
|
|
21
11
|
// safe() as CreateConnectorFn, // I don't know how this one works, maybe only inside Safe iframes?
|
|
22
12
|
coinbaseWallet(),
|
|
23
13
|
walletConnect({
|
|
24
|
-
projectId: "
|
|
14
|
+
projectId: "c8f04a733607c84d1028e2823a66c17c"
|
|
25
15
|
})
|
|
26
16
|
// getPrivyWalletConnector(), // only CorssApp Privy connector is available, not our use case
|
|
27
17
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sources":["../../../../src/lib/web3/wagmi/config.ts"],"sourcesContent":["import { createConfig, type CreateConnectorFn } from \"wagmi\";\nimport {\n injected,\n // metaMask,\n // safe,\n walletConnect,\n coinbaseWallet,\n} from \"wagmi/connectors\";\nimport { chains } from \"./constants\";\nimport { transports } from \"./transports\";\n\n// can add more connectors to cover wallets Privy doesn't support, but need to change UI to allow connection\nconst connectors = [\n injected() as CreateConnectorFn,\n // raw returned types result in\n // The inferred type of 'config' cannot be named without a reference to '.pnpm/@safe-global+safe-apps-provider@0.18.6_typescript@5.8.3/node_modules/@safe-global/safe-apps-provider'. This is likely not portable. A type annotation is necessary.\n\n // metaMask() as CreateConnectorFn, // injected() detects metamask already\n // safe() as CreateConnectorFn, // I don't know how this one works, maybe only inside Safe iframes?\n coinbaseWallet() as CreateConnectorFn,\n walletConnect({\n projectId: import.meta.env.VITE_WALLET_CONNECT_ID,\n }) as CreateConnectorFn,\n // getPrivyWalletConnector(), // only CorssApp Privy connector is available, not our use case\n] as const;\n// @TODO see how we can implement Ledger connector, borrow it from rainbowkit?\n\nexport const wagmiConfig = createConfig({\n chains,\n connectors,\n transports,\n});\n\ndeclare module \"wagmi\" {\n interface Register {\n config: typeof wagmiConfig;\n }\n}\n"],"names":["connectors","injected","coinbaseWallet","walletConnect","projectId","import","wagmiConfig","createConfig","chains","transports"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../../../../src/lib/web3/wagmi/config.ts"],"sourcesContent":["import { createConfig, type CreateConnectorFn } from \"wagmi\";\nimport {\n injected,\n // metaMask,\n // safe,\n walletConnect,\n coinbaseWallet,\n} from \"wagmi/connectors\";\nimport { chains } from \"./constants\";\nimport { transports } from \"./transports\";\n\n// can add more connectors to cover wallets Privy doesn't support, but need to change UI to allow connection\nconst connectors = [\n injected() as CreateConnectorFn,\n // raw returned types result in\n // The inferred type of 'config' cannot be named without a reference to '.pnpm/@safe-global+safe-apps-provider@0.18.6_typescript@5.8.3/node_modules/@safe-global/safe-apps-provider'. This is likely not portable. A type annotation is necessary.\n\n // metaMask() as CreateConnectorFn, // injected() detects metamask already\n // safe() as CreateConnectorFn, // I don't know how this one works, maybe only inside Safe iframes?\n coinbaseWallet() as CreateConnectorFn,\n walletConnect({\n projectId: import.meta.env.VITE_WALLET_CONNECT_ID,\n }) as CreateConnectorFn,\n // getPrivyWalletConnector(), // only CorssApp Privy connector is available, not our use case\n] as const;\n// @TODO see how we can implement Ledger connector, borrow it from rainbowkit?\n\nexport const wagmiConfig = createConfig({\n chains,\n connectors,\n transports,\n});\n\ndeclare module \"wagmi\" {\n interface Register {\n config: typeof wagmiConfig;\n }\n}\n"],"names":["connectors","injected","coinbaseWallet","walletConnect","projectId","import","wagmiConfig","createConfig","chains","transports"],"mappings":";;;;;AAYA,MAAMA,UAAAA,GAAa;AAAA,EACjBC,QAAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMTC,cAAAA,EAAe;AAAA,EACfC,aAAAA,CAAc;AAAA,IACZC,SAAAA,EAAWC;AAAAA,GACZ;AAAA;AACD,CAAA;AAIK,MAAMC,cAAcC,YAAAA,CAAa;AAAA,EACtCC,MAAAA;AAAAA,EACAR,UAAAA;AAAAA,EACAS;AACF,CAAC;;;;"}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { gnosis, base, optimism, arbitrum, avalanche, bsc, polygonZkEvm, polygon, mainnet } from 'wagmi/chains';
|
|
2
2
|
|
|
3
|
-
globalThis.jotaiAtomCache = globalThis.jotaiAtomCache || {
|
|
4
|
-
cache: /* @__PURE__ */ new Map(),
|
|
5
|
-
get(name, inst) {
|
|
6
|
-
if (this.cache.has(name)) {
|
|
7
|
-
return this.cache.get(name);
|
|
8
|
-
}
|
|
9
|
-
this.cache.set(name, inst);
|
|
10
|
-
return inst;
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
3
|
const chains = [mainnet, polygon, polygonZkEvm, bsc, avalanche, arbitrum, optimism, base, gnosis];
|
|
14
4
|
const supportedChainIds = chains.map((chain) => chain.id);
|
|
15
5
|
const chainConfigMap = {
|