This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
496 additions
and
95 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
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
53 changes: 53 additions & 0 deletions
53
src/app/typescript/v5/react/connecting-wallets/hooks/page.mdx
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { ArticleIconCard, createMetadata, DocImage, Stack } from "@doc"; | ||
import { Wallet2Icon } from "lucide-react"; | ||
import { ComponentIcon } from "lucide-react"; | ||
|
||
export const metadata = createMetadata({ | ||
image: { | ||
title: "Connecting Wallets", | ||
icon: "react", | ||
}, | ||
title: "Connecting Wallets in thirdweb React SDK", | ||
description: | ||
"Connect wallets using ConnectButton, ConnectEmbed or useConnect hook", | ||
}); | ||
|
||
# Connecting Wallets | ||
|
||
## Using Hooks | ||
|
||
You can build a completely custom UI for connecting the wallet using the [`useConnect`](/references/typescript/v5/useConnect) hook to connect any of [supported wallets](/typescript/v5/supported-wallets). | ||
|
||
```tsx | ||
import { createThirdwebClient } from "thirdweb"; | ||
import { useConnect } from "thirdweb/react"; | ||
import { createWallet, injectedProvider } from "thirdweb/wallets"; | ||
|
||
const client = createThirdwebClient({ clientId }); | ||
|
||
function Example() { | ||
const { connect, isConnecting, error } = useConnect(); | ||
return ( | ||
<button | ||
onClick={() => | ||
connect(async () => { | ||
// create a wallet instance | ||
const metamask = createWallet("io.metamask"); // autocomplete the wallet id | ||
// trigger the connection | ||
await metamask.connect({ client }); | ||
// return the wallet | ||
return metamask; | ||
}) | ||
} | ||
> | ||
Connect | ||
</button> | ||
); | ||
} | ||
``` | ||
|
||
Refer to [`createWallet`](/references/typescript/v5/createWallet) and [`injectedProvider`](/references/typescript/v5/injectedProvider) for more information. | ||
|
||
## Post Connection | ||
|
||
Once the wallet is connected, you can use the [Wallet Connection hooks](/references/typescript/v5/hooks#wallet-connection) to get information about the connected wallet like getting the address, account, etc |
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
46 changes: 46 additions & 0 deletions
46
src/app/typescript/v5/react/connecting-wallets/ui-components/page.mdx
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ArticleIconCard, createMetadata, DocImage, Stack } from "@doc"; | ||
import { Wallet2Icon } from "lucide-react"; | ||
import ConnectWalletHeroImage from "../../components/ConnectButton/images/connect-wallet-hero.webp"; | ||
import { ComponentIcon } from "lucide-react"; | ||
|
||
export const metadata = createMetadata({ | ||
image: { | ||
title: "Connecting Wallets", | ||
icon: "react", | ||
}, | ||
title: "Connecting Wallets in thirdweb React SDK", | ||
description: | ||
"Connect wallets using ConnectButton, ConnectEmbed or useConnect hook", | ||
}); | ||
|
||
# Connecting Wallets (UI Components) | ||
|
||
## Using Components | ||
|
||
You can use [`ConnectButton`](/typescript/v5/react/components/ConnectButton) or [`ConnectEmbed`](/typescript/v5/react/components/ConnectEmbed) component for a quick, easy and customizable UI. | ||
|
||
These components provide a beautiful UI for connecting various wallets and take care of a lot of wallet-specific edge cases - so you can focus on building your app. | ||
|
||
These components support over 300+ wallets, including support in-app wallets and account abstraction. | ||
|
||
It also automatically shows all installed `EIP-6963` compliant wallet extensions installed by the user. | ||
|
||
<DocImage src={ConnectWalletHeroImage} /> | ||
|
||
The SDK supports 350+ wallets out of the box, all you need to pass is their id. | ||
|
||
<Stack> | ||
|
||
<ArticleIconCard | ||
title="Supported Wallets" | ||
icon={ComponentIcon} | ||
href="/typescript/v5/supported-wallets" | ||
description="See all 350+ wallets supported by the Connect SDK" | ||
/> | ||
|
||
</Stack> | ||
|
||
## Post Connection | ||
|
||
Once the wallet is connected, you can use the [Wallet Connection hooks](/references/typescript/v5/hooks#wallet-connection) to get information about the connected wallet like getting the address, account, etc | ||
|
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.