This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kien Ngo
committed
Nov 27, 2023
1 parent
0627d34
commit 50b3c43
Showing
6 changed files
with
177 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
slug: /wallet/defi-wallet | ||
title: Crypto.com Defi Wallet | ||
--- | ||
|
||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import CodeBlock from "@theme/CodeBlock"; | ||
|
||
Prompt users to connect to their [Defi wallet](https://crypto.com/defi-wallet). | ||
|
||
## Usage | ||
|
||
```javascript | ||
import { CryptoDefiWallet } from "@thirdweb-dev/wallets"; | ||
|
||
const wallet = new CryptoDefiWallet(); | ||
|
||
wallet.connect(); | ||
``` | ||
|
||
## Configuration | ||
|
||
Optionally, provide a configuration object when instantiating the `CryptoDefiWallet` class. | ||
|
||
<details> | ||
<summary>projectId (recommended) </summary> | ||
<div> | ||
|
||
This is only relevant if you want to use [WalletConnect](https://walletconnect.com/) for connecting to Defi wallet mobile app when MetaMask is not injected. | ||
|
||
This `projectId` can be obtained at [cloud.walletconnect.com](https://cloud.walletconnect.com/). It is highly recommended to use your own project id and only use the default one for testing purposes. | ||
|
||
```javascript | ||
import { CryptoDefiWallet } from "@thirdweb-dev/wallets"; | ||
|
||
const wallet = new CryptoDefiWallet( | ||
// highlight-start | ||
{ | ||
projectId: "YOUR_WALLET_CONNECT_PROJECT_ID", | ||
}, | ||
// highlight-end | ||
); | ||
``` | ||
|
||
</div> | ||
</details> | ||
|
||
<details> | ||
<summary>recommended (optional) </summary> | ||
<div> | ||
|
||
Show this wallet as "recommended" in the [ConnectWallet Modal](/react/react.connectwallet). | ||
|
||
```ts | ||
CryptoDefiWallet({ | ||
// highlight-start | ||
recommended: true, | ||
// highlight-end | ||
}); | ||
``` | ||
|
||
</div> | ||
</details> | ||
|
||
## Methods | ||
|
||
Inherits all the public methods from the [`AbstractClientWallet`](interfaces/abstract-client-wallet) class. |
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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
title: cryptoDefiWallet | ||
slug: /react.defiwallet | ||
displayed_sidebar: react | ||
--- | ||
|
||
import Tabs from "@theme/Tabs"; | ||
import TabItem from "@theme/TabItem"; | ||
import CodeBlock from "@theme/CodeBlock"; | ||
import { CustomizeWalletConfigurator } from "@components/build-wallet/CustomizeWalletConfigurator"; | ||
|
||
A wallet configurator for [Defi Wallet](/wallet/defi-wallet) which allows integrating the wallet with React. | ||
|
||
```tsx | ||
import { cryptoDefiWallet } from "@thirdweb-dev/react"; | ||
|
||
const cryptoDefiWalletConfig = cryptoDefiWallet(options); | ||
``` | ||
|
||
## options | ||
|
||
<details> | ||
<summary>projectId (recommended) </summary> | ||
<div> | ||
|
||
Your project's unique identifier that can be obtained at [cloud.walletconnect.com](https://cloud.walletconnect.com). | ||
|
||
Defaults to a common thirdweb projectId. We recommend getting your own projectId at | ||
[cloud.walletconnect.com](https://cloud.walletconnect.com) when launching your project. | ||
|
||
```javascript | ||
import { cryptoDefiWallet } from "@thirdweb-dev/react"; | ||
|
||
cryptoDefiWallet( | ||
// highlight-start | ||
{ | ||
projectId: "<PROJECT_ID>", | ||
}, | ||
// highlight-end | ||
); | ||
``` | ||
|
||
</div> | ||
</details> | ||
|
||
<details> | ||
<summary>recommended (optional) </summary> | ||
<div> | ||
|
||
Show this wallet as "recommended" in the [ConnectWallet Modal](/react/react.connectwallet). | ||
|
||
```ts | ||
cryptoDefiWallet({ | ||
// highlight-start | ||
recommended: true, | ||
// highlight-end | ||
}); | ||
``` | ||
|
||
</div> | ||
</details> | ||
|
||
## Usage with `ConnectWallet` | ||
|
||
To allow users to connect to this wallet using the [ConnectWallet](/react/react.connectwallet) component, you can add it to [ThirdwebProvider's supportedWallets](/react/react.thirdwebprovider#supportedwallets-optional) prop. | ||
|
||
```tsx | ||
<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](/react/react.connectwallet) component. | ||
|
||
The wallet also needs to be added in [ThirdwebProvider's supportedWallets](/react/react.thirdwebprovider#supportedwallets-optional) if you want the wallet to auto-connect on next page load. | ||
|
||
```tsx | ||
const cryptoDefiWalletConfig = cryptoDefiWallet(); | ||
|
||
function App() { | ||
const connect = useConnect(); | ||
|
||
const handleConnect = async () => { | ||
await connect(cryptoDefiWalletConfig, connectOptions); | ||
}; | ||
|
||
return <div> ... </div>; | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.