Install the dependencies on your application
npm i @cityofzion/wallet-connect-sdk-core
yarn add @cityofzion/wallet-connect-sdk-core
To begin development, first establish an account on the Wallet Connect website. Next, generate a new Project. This process is straightforward, requiring only a few form fields.
import WcSdk from '@cityofzion/wallet-connect-sdk-core'
import SignClient from '@walletconnect/sign-client'
const wcSdk = await WcSdk.init({
projectId: '<your wc project id>', // the ID of your project on Wallet Connect website
relayUrl: 'wss://relay.walletconnect.com', // we are using walletconnect's official relay server
metadata: {
name: 'MyApplicationName', // your application name to be displayed on the wallet
description: 'My Application description', // description to be shown on the wallet
url: 'https://myapplicationdescription.app/', // url to be linked on the wallet
icons: ['https://myapplicationdescription.app/myappicon.png'] // icon to be shown on the wallet
}
})
There is another way to initialize the SDK by passing signClient from @walletconnect/sign-client lib as a parameter to the SDK constructor method.
Just after initializing the client you can call manageSession
, just once, it will reload the user's connected session and subscribe to the disconnect
event.
await wcSdk.manageSession()
Check this Usage Guide to see how to use this SDK on your application.
There is more information of each method on the documentation website