WalletConnect v1 Adapter
deprecated
Wallet Connect V1 is going to be deprecated, please use Wallet Connect v2 Adapter.
@web3auth/wallet-connect-v1-adapter
Wallet connect v1 adapter allows you login with wallet connect v1. You can read more about wallet connect sunsetting here.
Basic Details
Adapter Name: wallet-connect-v1
Package Name: @web3auth/wallet-connect-v1-adapter
authMode: DAPP
chainNamespace: EIP155
Default: YES
Installation
- npm
- Yarn
- pnpm
npm install --save @web3auth/wallet-connect-v1-adapter
yarn add @web3auth/wallet-connect-v1-adapter
pnpm add @web3auth/wallet-connect-v1-adapter
Arguments
- Table
- Interface
Parameter | type |
---|---|
adapterSettings? | IAdapterSettings |
chainConfig? | CustomChainConfig |
sessionTime? | number |
clientId? | string |
web3AuthNetwork? | WEB3AUTH_NETWORK_TYPE |
interface WalletConnectV1AdapterOptions {
adapterSettings?: IAdapterSettings;
chainConfig?: CustomChainConfig;
sessionTime?: number;
clientId?: string;
web3AuthNetwork?: WEB3AUTH_NETWORK_TYPE;
}
Custom Chain Config
chainConfig
warning
While you can pass your chainConfig
here, but it is not required since you can directly pass it
over to the Web3Auth
/ Web3AuthNoModal
configuration while instantiating it.
Read more about it in their respective sections:
warning
If you pass chainConfig
in an Adapter, it overwrites the chainConfig
passed over to the
Web3Auth
/ Web3AuthNoModal
constructor.
IAdapter Settings
adapterSettings
interface IAdapterSettings extends IWalletConnectOptions {
skipNetworkSwitching?: boolean;
networkSwitchModal?: INetworkSwitch;
}
interface IWalletConnectOptions {
bridge?: string;
uri?: string;
storageId?: string;
signingMethods?: string[];
session?: IWalletConnectSession;
storage?: ISessionStorage;
clientMeta?: IClientMeta;
qrcodeModal?: IQRCodeModal;
qrcodeModalOptions?: IQRCodeModalOptions;
}
interface IQRCodeModal {
open(uri: string, cb: any, opts?: any): void;
close(): void;
}
interface IQRCodeModalOptions {
registryUrl?: string;
mobileLinks?: string[];
desktopLinks?: string[];
}
Change Adapter Settings
You can change the adapter settings by calling the setAdapterSettings()
function on the adapter
instance.
Arguments
- Table
- Interface
Parameter | type |
---|---|
clientId? | string |
sessionTime? | number |
chainConfig? | CustomChainConfig |
web3AuthNetwork? | WEB3AUTH_NETWORK_TYPE |
interface BaseAdapterSettings {
clientId?: string;
sessionTime?: number;
chainConfig?: CustomChainConfig;
web3AuthNetwork?: WEB3AUTH_NETWORK_TYPE;
}
Example
import { WalletConnectV1Adapter } from "@web3auth/wallet-connect-v1-adapter";
const walletConnectV1Adapter = new WalletConnectV1Adapter({
adapterSettings: {
bridge: "https://bridge.walletconnect.org",
},
clientId:
"BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ",
sessionTime: 3600, // 1 day in seconds
});
web3auth.configureAdapter(walletConnectV1Adapter);
// You can also change the adapter settings by calling the setAdapterSettings() function on the adapter instance.
walletConnectV1Adapter.setAdapterSettings({
sessionTime: 86400, // 1 day in seconds
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: "0x1",
rpcTarget: "https://rpc.ankr.com/eth", // This is the public RPC we have added, please pass on your own endpoint while creating an app
},
web3AuthNetwork: "sapphire_mainnet",
});