-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: update style * style tuning * feat: wagmi v2 support * chore: update example * chore: update docs deps * Resolve conflict * fix: next build * 0.1.0-beta.0 * 0.1.0-beta.1 * 0.1.0-beta.1 * chore: update [email protected] * fix: type * changeset * 0.1.0-beta.2 * update doc * 0.1.0
- Loading branch information
Showing
73 changed files
with
15,526 additions
and
8,362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,25 +7,31 @@ RabbyKit offers a true web3 solution to help connect your Dapp with wallets, eff | |
#### npm | ||
|
||
```sh | ||
npm i @rabby-wallet/rabbykit @wagmi/core@1 viem@1 | ||
npm i @rabby-wallet/rabbykit @wagmi/core@2 viem@2.x | ||
``` | ||
|
||
#### yarn | ||
|
||
```sh | ||
yarn add @rabby-wallet/rabbykit @wagmi/core@1 viem@1 | ||
yarn add @rabby-wallet/rabbykit @wagmi/core@2 viem@2.x | ||
``` | ||
|
||
#### pnpm | ||
|
||
```sh | ||
pnpm add @rabby-wallet/rabbykit @wagmi/core@1 viem@1 | ||
pnpm add @rabby-wallet/rabbykit @wagmi/core@2 viem@2.x | ||
``` | ||
|
||
#### bun | ||
|
||
```sh | ||
bun add @rabby-wallet/rabbykit @wagmi/core@1 viem@1 | ||
bun add @rabby-wallet/rabbykit @wagmi/core@2 [email protected] | ||
``` | ||
|
||
## Not ready to migrate to @wagmi/core@2 yet? | ||
|
||
```sh | ||
npm i @rabby-wallet/[email protected] @wagmi/core@1 viem@1 | ||
``` | ||
|
||
## Documentation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,23 @@ | ||
"use client"; | ||
|
||
import * as React from "react"; | ||
import { WagmiConfig } from "wagmi"; | ||
// import { createModal } from "@rabby-wallet/rabbykit"; | ||
import { WagmiProvider } from "wagmi"; | ||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; | ||
|
||
import { config } from "../wagmi"; | ||
|
||
// export let rabbyKit = () => { | ||
// let kit: ReturnType<typeof createModal> | undefined; | ||
|
||
// return (p: Parameters<typeof createModal>) => { | ||
// if (!kit) { | ||
// kit = createModal(...p); | ||
// } | ||
// return kit; | ||
// }; | ||
// }; | ||
const queryClient = new QueryClient(); | ||
|
||
export function Providers({ children }: { children: React.ReactNode }) { | ||
const [mounted, setMounted] = React.useState(false); | ||
React.useEffect(() => { | ||
setMounted(true); | ||
// createModal({ | ||
// wagmi: config, | ||
// appName: "test", | ||
// projectId: "58a22d2bc1c793fc31c117ad9ceba8d9", | ||
// }); | ||
}, []); | ||
return <WagmiConfig config={config}>{mounted && children}</WagmiConfig>; | ||
return ( | ||
<WagmiProvider config={config}> | ||
<QueryClientProvider client={queryClient}> | ||
{mounted && children} | ||
</QueryClientProvider> | ||
</WagmiProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
'use client' | ||
"use client"; | ||
|
||
import { useNetwork, useSwitchNetwork } from 'wagmi' | ||
import { useAccount, useSwitchChain } from "wagmi"; | ||
|
||
export function NetworkSwitcher() { | ||
const { chain } = useNetwork() | ||
const { chains, error, isLoading, pendingChainId, switchNetwork } = | ||
useSwitchNetwork() | ||
const { chain } = useAccount(); | ||
const { chains, error, isPending, variables, switchChain } = useSwitchChain(); | ||
|
||
return ( | ||
<div> | ||
<div> | ||
Connected to {chain?.name ?? chain?.id} | ||
{chain?.unsupported && ' (unsupported)'} | ||
{/* {chain?.unsupported && " (unsupported)"} */} | ||
</div> | ||
<br /> | ||
{switchNetwork && ( | ||
{switchChain && ( | ||
<div> | ||
Switch to:{' '} | ||
Switch to:{" "} | ||
{chains.map((x) => | ||
x.id === chain?.id ? null : ( | ||
<button key={x.id} onClick={() => switchNetwork(x.id)}> | ||
<button key={x.id} onClick={() => switchChain({ chainId: x.id })}> | ||
{x.name} | ||
{isLoading && x.id === pendingChainId && ' (switching)'} | ||
{isPending && x.id === variables.chainId && " (switching)"} | ||
</button> | ||
), | ||
) | ||
)} | ||
</div> | ||
)} | ||
|
||
<div>{error?.message}</div> | ||
</div> | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.