Make sure you have added the following modules as your dependencies:
You should have also decided which blockchains will be supported in your application and what transport layers to use to establish the communication. Make sure you have added the appropriate Blockchain and Transport modules as your dependencies as well.
See the Installation page for more information about the modules and how to install them.
Follow the steps below to learn how to interact with a dApp. The guide assumes all blockchains and transport layers are supported.
BeaconWalletClient instance by providing your app's name, registering supported blockchains and transport layers that will be used for communication.
The example below creates a new
BeaconWalletClient instance with default settings. See the Configuration guide to learn about more advanced setups.
Currently only one instance of
BeaconWalletClient should be created per application.
To connect to a new dApp take the pairing request (obtained from, for example, a paring QR code) and transform it to
P2pPeer. Next, register the new instance of
P2pPeer in your wallet client.
Having received a request, you can create a response and send it back to the dApp. The response should always be created from an incoming request. Attempting to send a response that was not created from a request awaiting answer will result in an error.
The first request your app receives from a dApp is a permission request. The example below shows how to respond to it in the most basic way. To get more information about other kinds of requests or learn more advanced use cases see the Blockchain guides.