Merge branch 'main' into dev
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
useOpSignSettingsModal,
|
||||
useUpgradeAccountModal,
|
||||
useSelectCharactersModal,
|
||||
useAccountBalance,
|
||||
} from "@crossbell/connect-kit"
|
||||
import { useAccountSites } from "~/queries/site"
|
||||
import { Avatar } from "~/components/ui/Avatar"
|
||||
@@ -34,7 +35,6 @@ import {
|
||||
useShowNotificationModal,
|
||||
useNotifications,
|
||||
} from "@crossbell/notification"
|
||||
import { useAccountBalance } from "~/hooks/use-account-balance"
|
||||
import { Menu } from "~/components/ui/Menu"
|
||||
import { useTranslation } from "next-i18next"
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import { useBalance } from "wagmi"
|
||||
import {
|
||||
useAccountState,
|
||||
useAccountBalance as _useAccountBalance,
|
||||
} from "@crossbell/connect-kit"
|
||||
|
||||
export function useAccountBalance(): ReturnType<typeof _useAccountBalance> {
|
||||
const account = useAccountState((s) => s.computed.account)
|
||||
const walletBalance = useBalance({
|
||||
address: account?.address as `0x${string}` | undefined,
|
||||
})
|
||||
const accountBalance = _useAccountBalance()
|
||||
|
||||
if (account?.type === "email") {
|
||||
return accountBalance
|
||||
} else {
|
||||
return {
|
||||
balance: walletBalance.data,
|
||||
isLoading: walletBalance.isLoading,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useAccountBalance as _useAccountBalance } from "@crossbell/connect-kit"
|
||||
import { useAccountSites } from "~/queries/site"
|
||||
import { useGetSite, useIsOperators } from "~/queries/site"
|
||||
import { useAccountState } from "@crossbell/connect-kit"
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import { configureChains } from "wagmi"
|
||||
import { crossbell } from "wagmi/chains"
|
||||
import { jsonRpcProvider } from "wagmi/providers/jsonRpc"
|
||||
import { MetaMaskConnector } from "wagmi/connectors/metaMask"
|
||||
import { WalletConnectConnector } from "wagmi/connectors/walletConnect"
|
||||
import { CoinbaseWalletConnector } from "wagmi/connectors/coinbaseWallet"
|
||||
import { InjectedConnector } from "wagmi/connectors/injected"
|
||||
|
||||
import { APP_NAME } from "~/lib/env"
|
||||
|
||||
export const { chains, provider } = configureChains(
|
||||
[crossbell],
|
||||
[
|
||||
jsonRpcProvider({
|
||||
rpc: () => ({ http: crossbell.rpcUrls.default.http[0] }),
|
||||
}),
|
||||
],
|
||||
{ pollingInterval: 1000 },
|
||||
)
|
||||
|
||||
export const connectors = [
|
||||
new InjectedConnector({
|
||||
chains,
|
||||
options: {
|
||||
shimDisconnect: true,
|
||||
name: (detectedName) =>
|
||||
`Injected (${
|
||||
typeof detectedName === "string"
|
||||
? detectedName
|
||||
: detectedName.join(", ")
|
||||
})`,
|
||||
},
|
||||
}),
|
||||
new MetaMaskConnector({
|
||||
chains,
|
||||
options: {
|
||||
shimDisconnect: true,
|
||||
shimChainChangedDisconnect: false,
|
||||
UNSTABLE_shimOnConnectSelectAccount: true,
|
||||
},
|
||||
}),
|
||||
new CoinbaseWalletConnector({
|
||||
chains,
|
||||
options: {
|
||||
appName: APP_NAME,
|
||||
headlessMode: true,
|
||||
},
|
||||
}),
|
||||
new WalletConnectConnector({
|
||||
chains,
|
||||
options: {
|
||||
qrcode: false,
|
||||
},
|
||||
}),
|
||||
]
|
||||
+20
-25
@@ -6,26 +6,23 @@ import { createClient, WagmiConfig } from "wagmi"
|
||||
import { Hydrate, QueryClient } from "@tanstack/react-query"
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"
|
||||
import { ConnectKitProvider, contractConfig } from "@crossbell/connect-kit"
|
||||
import {
|
||||
ConnectKitProvider,
|
||||
getDefaultClientConfig,
|
||||
} from "@crossbell/connect-kit"
|
||||
import { NotificationModal } from "@crossbell/notification"
|
||||
import { InitContractProvider } from "@crossbell/contract"
|
||||
import NextNProgress from "nextjs-progressbar"
|
||||
import { Network } from "crossbell.js"
|
||||
import { appWithTranslation } from "next-i18next"
|
||||
|
||||
import { IPFS_GATEWAY } from "~/lib/env"
|
||||
import { APP_NAME, IPFS_GATEWAY } from "~/lib/env"
|
||||
import { toGateway } from "~/lib/ipfs-parser"
|
||||
import { connectors, provider } from "~/lib/wallet-config"
|
||||
import { createIDBPersister } from "~/lib/persister.client"
|
||||
import { urlComposer } from "~/lib/url-composer"
|
||||
|
||||
Network.setIpfsGateway(IPFS_GATEWAY)
|
||||
|
||||
const wagmiClient = createClient({
|
||||
autoConnect: true,
|
||||
connectors,
|
||||
provider,
|
||||
})
|
||||
const wagmiClient = createClient(getDefaultClientConfig({ appName: APP_NAME }))
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
@@ -46,22 +43,20 @@ function MyApp({ Component, pageProps }: any) {
|
||||
client={queryClient}
|
||||
persistOptions={{ persister }}
|
||||
>
|
||||
<InitContractProvider {...contractConfig}>
|
||||
<ConnectKitProvider
|
||||
ipfsLinkToHttpLink={toGateway}
|
||||
urlComposer={urlComposer}
|
||||
>
|
||||
<Hydrate state={pageProps.dehydratedState}>
|
||||
{/* <ReactQueryDevtools /> */}
|
||||
<NextNProgress
|
||||
options={{ easing: "linear", speed: 500, trickleSpeed: 100 }}
|
||||
/>
|
||||
{getLayout(<Component {...pageProps} />)}
|
||||
<Toaster />
|
||||
<NotificationModal />
|
||||
</Hydrate>
|
||||
</ConnectKitProvider>
|
||||
</InitContractProvider>
|
||||
<ConnectKitProvider
|
||||
ipfsLinkToHttpLink={toGateway}
|
||||
urlComposer={urlComposer}
|
||||
>
|
||||
<Hydrate state={pageProps.dehydratedState}>
|
||||
{/* <ReactQueryDevtools /> */}
|
||||
<NextNProgress
|
||||
options={{ easing: "linear", speed: 500, trickleSpeed: 100 }}
|
||||
/>
|
||||
{getLayout(<Component {...pageProps} />)}
|
||||
<Toaster />
|
||||
<NotificationModal />
|
||||
</Hydrate>
|
||||
</ConnectKitProvider>
|
||||
</PersistQueryClientProvider>
|
||||
</WagmiConfig>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user