cryptoDefiWallet
A wallet configurator for Defi Wallet which allows integrating the wallet with React.
import { cryptoDefiWallet } from "@thirdweb-dev/react";
const cryptoDefiWalletConfig = cryptoDefiWallet(options);
options
projectId (recommended)
Your project's unique identifier that can be obtained at cloud.walletconnect.com.
Defaults to a common thirdweb projectId. We recommend getting your own projectId at cloud.walletconnect.com when launching your project.
import { cryptoDefiWallet } from "@thirdweb-dev/react";
cryptoDefiWallet(
{
projectId: "<PROJECT_ID>",
},
);
recommended (optional)
Show this wallet as "recommended" in the ConnectWallet Modal.
cryptoDefiWallet({
recommended: true,
});
Usage with ConnectWallet
To allow users to connect to this wallet using the ConnectWallet component, you can add it to ThirdwebProvider's supportedWallets prop.
<ThirdwebProvider
supportedWallets={[cryptoDefiWallet()]}
clientId="your-client-id"
>
<YourApp />
</ThirdwebProvider>
Usage with useConnect
you can use the useConnect
hook to programmatically connect to the wallet without using the ConnectWallet component.
The wallet also needs to be added in ThirdwebProvider's supportedWallets if you want the wallet to auto-connect on next page load.
const cryptoDefiWalletConfig = cryptoDefiWallet();
function App() {
const connect = useConnect();
const handleConnect = async () => {
await connect(cryptoDefiWalletConfig, connectOptions);
};
return <div> ... </div>;
}