Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into develop #343

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/bridge/_components/warning-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export default function WarningBanner() {
</div>
<div>
<Caption className="text-base!">
You'll need to switch back to Blast if you want to browse the rest
of the web app :{" "}
You'll need to switch back to a supported network if you want to
browse the rest of the web app :{" "}
<Button
className="text-md"
variant={"link"}
Expand Down
4 changes: 2 additions & 2 deletions app/faucet/_components/info-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as wagmiChains from "wagmi/chains"
/* eslint-disable @next/next/no-img-element */
import { Text } from "@/components/typography/text"
import { Title } from "@/components/typography/title"
import { useChainId } from "wagmi"
import { useAccount } from "wagmi"

export function InfoBanner() {
const chainId = useChainId()
const { chainId } = useAccount()
return (
<div className="w-full max-w-[1252px] bg-primary-dark-green rounded-lg mx-auto flex">
<div className="h-auto w-1/3 relative rounded-lg overflow-hidden hidden xl:block">
Expand Down
4 changes: 2 additions & 2 deletions app/faucet/_components/table/components/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Link from "next/link"
import { toast } from "sonner"
import { parseUnits, type Address } from "viem"
import {
useChainId,
useAccount,
useSimulateContract,
useWaitForTransactionReceipt,
useWriteContract,
Expand All @@ -21,7 +21,7 @@ type Props = {
}

export function Actions({ faucetToken }: Props) {
const chainId = useChainId()
const { chainId } = useAccount()
const isMgv = faucetToken.mgvTestToken
const tokenQuery = useTokenFromAddress(faucetToken.address as Address)
const mintLimit = useMintLimit(faucetToken.address as Address, !!isMgv)
Expand Down
4 changes: 2 additions & 2 deletions app/referrals/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"
import { createZodFetcher } from "zod-fetch"

import { Address, Hex, TypedDataDomain, parseAbiParameter } from "viem"
import { useAccount, useChainId, useWalletClient } from "wagmi"
import { useAccount, useWalletClient } from "wagmi"
import { startPostResponseSchema, startedGetResponseSchema } from "./schema"

const fetchWithZod = createZodFetcher()

export function useDomain() {
const chainId = useChainId()
const { chainId } = useAccount()
return {
chainId,
name: "MangroveReferral",
Expand Down
93 changes: 0 additions & 93 deletions app/strategies/(list)/_components/new-strategy-dialog.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"

import { useQuery } from "@tanstack/react-query"
import { useAccount, useChainId } from "wagmi"
import { useAccount } from "wagmi"

import { useTokens } from "@/hooks/use-addresses"
import useIndexerSdk from "@/providers/mangrove-indexer"
Expand All @@ -19,8 +19,7 @@ export function useStrategies<T = Strategy[]>({
filters: { first = 10, skip = 0 } = {},
select,
}: Params<T> = {}) {
const chainId = useChainId()
const { address, isConnected } = useAccount()
const { address, isConnected, chainId } = useAccount()
const { indexerSdk } = useIndexerSdk()
const tokens = useTokens()
const tokensList = tokens.map((token) => token.address.toLowerCase())
Expand Down
29 changes: 27 additions & 2 deletions app/strategies/(list)/_components/tables/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ import {
CustomRadioGroupItem,
} from "@/components/custom-radio-group"
import { CustomTabs } from "@/components/custom-tabs"
import { useAccount } from "wagmi"
import { Strategies } from "./strategies/strategies"
import { Vaults } from "./vaults/vaults"

import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip"

enum StrategyType {
PASSIVE = "Passive",
PRO = "Pro",
Expand All @@ -21,7 +29,7 @@ export function Tables({
hideCreateStrat: (bool: boolean) => void
}) {
const [strategiesType, setStrategiesType] = React.useState(StrategyType.PRO)

const { chain } = useAccount()
React.useEffect(() => {
if (strategiesType === "Passive") {
hideCreateStrat(true)
Expand All @@ -46,8 +54,25 @@ export function Tables({
value={action}
id={action}
className="capitalize"
disabled={
action === StrategyType.PASSIVE && chain?.name === "Arbitrum One"
}
>
{action}
<TooltipProvider>
<Tooltip delayDuration={200}>
<TooltipTrigger className="hover:opacity-80 transition-opacity">
{action}
</TooltipTrigger>
<TooltipContent
hidden={
action === StrategyType.PRO ||
chain?.name !== "Arbitrum One"
}
>
Please switch to a supported network
</TooltipContent>
</Tooltip>
</TooltipProvider>
</CustomRadioGroupItem>
))}
</CustomRadioGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"
import type { Vault } from "@/app/strategies/(list)/_schemas/vaults"
import { useQuery } from "@tanstack/react-query"
import { useAccount, useChainId, usePublicClient } from "wagmi"
import { useAccount, usePublicClient } from "wagmi"
import { getChainVaults, getVaultsInformation } from "../services/skate-vaults"

type Params<T> = {
Expand All @@ -16,22 +16,23 @@ export function useVaults<T = Vault[]>({
filters: { first = 10, skip = 0 } = {},
select,
}: Params<T> = {}) {
const chainId = useChainId()
const { chainId } = useAccount()
const publicClient = usePublicClient()
const { address: user } = useAccount()
const { data, ...rest } = useQuery({
queryKey: ["vaults", publicClient, user, chainId, first, skip],
queryFn: async (): Promise<Vault[]> => {
try {
if (!publicClient) throw new Error("Public client is not enabled")
if (!chainId) return []
const plainVaults = getChainVaults(chainId).slice(skip, skip + first)
return getVaultsInformation(publicClient, plainVaults, user)
} catch (error) {
console.error(error)
return []
}
},
enabled: !!publicClient,
enabled: !!publicClient && !!chainId,
initialData: [],
})
return {
Expand Down
58 changes: 0 additions & 58 deletions app/strategies/(list)/_providers/kandel-strategies.tsx

This file was deleted.

9 changes: 3 additions & 6 deletions app/strategies/(list)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Metadata } from "next"
import React from "react"

import { KandelStrategiesProvider } from "@/app/strategies/(list)/_providers/kandel-strategies"
import { Navbar } from "@/components/navbar"
import { IndexerSdkProvider } from "@/providers/mangrove-indexer"
import { MarketProvider } from "@/providers/market.new"
Expand All @@ -16,11 +15,9 @@ export default function Layout({ children }: React.PropsWithChildren) {
return (
<MarketProvider>
<IndexerSdkProvider>
<KandelStrategiesProvider>
<Navbar innerClasses="max-w-8xl mx-auto" />
<WarningBanner />
<main className="w-full">{children}</main>
</KandelStrategiesProvider>
<Navbar innerClasses="max-w-8xl mx-auto" />
<WarningBanner />
<main className="w-full">{children}</main>
</IndexerSdkProvider>
</MarketProvider>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ScaleLinear } from "d3-scale"

import { cn } from "@/utils"
import { BA } from "@mangrovedao/mgv/lib"
import { formatEther } from "viem"
import { TypedDistrubutionOffer } from "./geometric-distribution-dots"

type Props = {
Expand Down Expand Up @@ -44,7 +45,7 @@ export function GeometricOfferTooltip({
</div>
<div className="text-white">
<span className="text-cloud-300">Volume:</span>{" "}
{Number(hoveredGeometricOffer.gives).toFixed(
{Number(formatEther(hoveredGeometricOffer.gives, "wei")).toFixed(
(hoveredGeometricOffer.type === BA.bids ? quoteToken : baseToken)
?.displayDecimals,
)}{" "}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {
xScale: ScaleLinear<number, number>
onHover?: (offer: TypedDistrubutionOffer) => void
onHoverOut?: () => void
mergedOffer: OfferParsed
mergedOffer: OfferParsed & { formattedGives?: string }
baseToken: Token
quoteToken: Token
}
Expand Down Expand Up @@ -52,7 +52,6 @@ export function MergedOfferTooltip({
quoteToken,
}: Props) {
const isLive = mergedOffer.gives > 0

return (
<TooltipWithBounds
top={height - paddingBottom}
Expand All @@ -73,7 +72,7 @@ export function MergedOfferTooltip({
</div>
<div className="text-white">
<span className="text-cloud-300">Volume:</span>{" "}
{Number(mergedOffer.gives).toFixed(
{Number(mergedOffer.formattedGives).toFixed(
(mergedOffer.ba === BA.bids ? quoteToken : baseToken)
?.displayDecimals,
)}{" "}
Expand Down
Loading
Loading