Skip to content

Commit

Permalink
Merge pull request #950 from Web3Auth/add-solana-to-walletconnect
Browse files Browse the repository at this point in the history
Added Solana to WalletConnectV2Adapter page
  • Loading branch information
ihsraham authored Oct 17, 2024
2 parents 0653143 + 62f99d0 commit d4372ee
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions docs/sdk/pnp/web/adapters/wallet-connect-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ description: "Web3Auth PnP Web Adapter SDKs - Wallet Connect v2 | Documentation
import TabItem from "@theme/TabItem";
import Tabs from "@theme/Tabs";

:::info

With Web3Auth Web SDK v9.2.0 and above, WalletConnect V2 Adapter can be used to log in with Solana
chain namespace as well. Have a look at the example
[here](/sdk/pnp/web/adapters/wallet-connect-v2#example).

:::

## [`@web3auth/wallet-connect-v2-adapter`](https://npmjs.com/package/@web3auth/wallet-connect-v2-adapter)

Wallet connect v2 adapter allows you to log in with wallet connect v2. You can read more about
Expand Down Expand Up @@ -162,6 +170,9 @@ export interface IAdapterSettings {

## Example

<Tabs>
<TabItem value="evm" label="EVM">

```tsx
import { WalletConnectModal } from "@walletconnect/modal";
import {
Expand All @@ -172,10 +183,10 @@ import {
const defaultWcSettings = await getWalletConnectV2Settings(
"eip155",
["1"],
"04309ed1007e77d1f119b85205bb779d",
"YOUR_WALLETCONNECT_PROJECT_ID", // Get your walletconnect project id and register it on the Web3Auth Dashboard in your project add-ons.
);
const walletConnectModal = new WalletConnectModal({
projectId: "04309ed1007e77d1f119b85205bb779d",
projectId: "YOUR_WALLETCONNECT_PROJECT_ID", // Get your walletconnect project id and register it on the Web3Auth Dashboard in your project add-ons.
});
const walletConnectV2Adapter = new WalletConnectV2Adapter({
adapterSettings: { qrcodeModal: walletConnectModal, ...defaultWcSettings.adapterSettings },
Expand All @@ -184,3 +195,36 @@ const walletConnectV2Adapter = new WalletConnectV2Adapter({

web3auth.configureAdapter(walletConnectV2Adapter);
```

</TabItem>
<TabItem value="solana" label="Solana" default>

```tsx
import { WalletConnectModal } from "@walletconnect/modal";
import {
getWalletConnectV2Settings,
WalletConnectV2Adapter,
} from "@web3auth/wallet-connect-v2-adapter";

// adding wallet connect v2 adapter
const defaultWcSettings = await getWalletConnectV2Settings(
"solana",
["0x1"],
"YOUR_WALLETCONNECT_PROJECT_ID", // Get your walletconnect project id and register it on the Web3Auth Dashboard in your project add-ons.
);
const walletConnectModal = new WalletConnectModal({
projectId: "YOUR_WALLETCONNECT_PROJECT_ID", // Get your walletconnect project id and register it on the Web3Auth Dashboard in your project add-ons.
});
const walletConnectV2Adapter = new WalletConnectV2Adapter({
adapterSettings: {
qrcodeModal: walletConnectModal,
...defaultWcSettings.adapterSettings,
},
loginSettings: { ...defaultWcSettings.loginSettings },
});

web3auth.configureAdapter(walletConnectV2Adapter);
```

</TabItem>
</Tabs>

0 comments on commit d4372ee

Please sign in to comment.