Add FCL Support for WalletConnect 2.0
To improve developer experience and streamline Flow dApp integration with WalletConnect 2.0 wallets, FCL
^1.3.0 introduces support for
discovery-service plugins. These
ServicePlugins allow for injection of client configured services, service methods, and the execution strategies required to interact with them.
FCL dApps can opt-in through use of the fcl-wc package and FCL Plugin Registry.
When using FCL Discovery for authentication, dApps are able to support most FCL-compatible wallets and their users on Flow without any custom integrations or changes needed to the dApp code.
These instructions explain how dApps can also add support for FCL compatible wallets that use the WalletConnect 2.0 protocol.
How does it work?
fc-wcpackage is used to initialize a WalletConnect 2.0
SignClientinstance, and build a
ServicePluginbased on dApp specified options.
discovery-serviceplugins are used to add opt-in wallets and other services to FCL Wallet Discovery (UI/API).
- The FCL Plugin Registry offers dApps the ability to add new services, methods, and the execution strategies needed to interact with them.
|1||Add required packages||Install and import minimum |
|2||Obtain a WalletConnect ||Visit WalletConnect Cloud Registry and register for public relay server access and an application |
|3||Initialize WalletConnect ||Initialize WalletConnect |
|4||Add ||Inject |
1. Add required packages
_10npm install @onflow/fcl@ @onflow/fcl-wc
2. Obtain a WalletConnect projectID
Visit WalletConnect Cloud Registry and register for public relay server access and an application
3. Initialize WalletConnect
In addition to the WalletConnect
init method of
fcl-wc returns a
ServicePlugin object. This object can be injected using the FCL Plugin Registry to add support for new service methods and their corresponding execution strategies (like
WC/RPC for WalletConnect ).
ServicePlugin may also include additional opt-in wallets to offer your users through FCL Wallet Discovery.