Portal Team

Share the love

Want to stay updated? Subscribe below to keep in touch.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"> <mask id="mask0_996_165" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="2" y="1" width="46" height="46"> <path d="M47.2941 1.41177H2.11768V46.5882H47.2941V1.41177Z" fill="white"/> </mask> <g mask="url(#mask0_996_165)"> <path fill-rule="evenodd" clip-rule="evenodd" d="M16.2353 4.2353C16.2353 2.67591 17.4995 1.41177 19.0589 1.41177H44.4706C46.0301 1.41177 47.2941 2.67591 47.2941 4.2353V29.6471C47.2941 31.2065 46.0301 32.4706 44.4706 32.4706H38.8236V12.7059C38.8236 11.1465 37.5595 9.88236 36 9.88236H16.2353V4.2353ZM4.94121 15.5294C3.3818 15.5294 2.11768 16.7935 2.11768 18.353V43.7647C2.11768 45.3242 3.3818 46.5882 4.94121 46.5882H30.353C31.9124 46.5882 33.1765 45.3242 33.1765 43.7647V18.353C33.1765 16.7936 31.9124 15.5294 30.353 15.5294H4.94121Z" fill="currentColor"/> </g> </svg>
Product Updates
3 min read

How to integrate WalletConnect the easy way

WalletConnect is one of the most popular Web3 interface standards and Portal SDK makes it easy to integrate in about 50 lines of code.

August 8, 2023

How to integrate WalletConnect the easy way

Although most new users think of blockchain simply as trading crypto, Web3 is a big world touching a wide variety of industries and applications. Wallets that connect users to blockchain-based apps and protocols—known as Web3 wallets—are the gateway to that world. A business that wants to offer its users the depth and breadth of Web3 needs to offer wallets that can access it directly.

Prior to 2018, when Web3 wallets were still relatively new, there wasn’t a standard interface to connect apps to wallets. WalletConnect created a standard messaging protocol for Web3 apps to integrate with wallets. It removed the need for wallet developers to individually connect with every Web3 app. Now, by scanning a QR code, anyone can establish a connection between their wallet and thousands of apps securely. 

Portal SDK directly supports WalletConnect to ensure business customers have a simple way to implement access to thousands of ETH and EVM apps. 

Benefits of WalletConnect for organizations and their users

Currently most institutions such as exchanges, fintech firms, and banks offer their users custodial wallets only. Funds from these wallets are commingled, meaning they are not held in individually gated accounts per user. Their private keys are also controlled by the firm rather than the end user. For security, regulatory, and technical reasons, those wallets can’t provide users access to Web3 apps.

A Web3 wallet, such as the MPC wallet as a service offered by Portal, allows organizations to offer access to Web3 apps alongside traditional digital asset trading and storage functionality. Access to apps can be natively integrated with the MPC wallet or offered via WalletConnect, where the user simply needs to scan a QR code on an app to connect. 

Prior to WalletConnect, users had to install a browser extension to connect to desktop apps. Not all wallets supported these browser extensions and were often clunky and confusing. Even when a wallet was supported, the connection process was not standardized or transparent.  

WalletConnect changed this experience for users by building protocols that manage access, sessions, and transactions. WalletConnect opened up the possibility that any wallet, but most helpfully mobile wallets, could connect to any app—whether on your desktop, mobile browser, or wherever.

Benefits of Portal’s WalletConnect integration for developers

The Portal SDK removes the resource-intensive process developers face when integrating WalletConnect independently. The WalletConnect integration already embedded in the Portal SDK benefits developers in a few key ways:

Automatic patches and upgrades

Portal's implementation pushes all third-party integrations such as WalletConnect to the server. This design ensures Portal can patch breaking changes and upgrades from the third party provider before they become issues for customers.

For instance, if WalletConnect releases a V3.0, we've got you covered.

No dependencies

Because WalletConnect is integrated directly into the Portal SDK, a customer only needs to implement the functionality as per our documentation. In addition, if an organization determines they want to use WalletConnect later in their development cycle, the integration is just as simple and doesn’t require any reworking of the code. 

How to set up WalletConnect in Portal

Setting up WalletConnect V2.0 is straightforward and quick via the Portal SDK. Details can be found in Portal’s documentation for iOS, Android, or React Native.

Step 1: Install the @portal-hq/connect package in your project.

Step 2: To initialize PortalConnect, import and create an instance of PortalConnect.

Step 3: Set up the capability to connect to a WalletConnect URI like a QR code scanner.

Step 4: Add an event handler to your PortalConnect instance in order to bind to Session Requests.

The entire implementation is only about 50 lines. See below for what the final implementation code looks like:

Once setup is complete, users that generate a wallet can connect to any app that accepts WalletConnect by:

  1. Choosing WalletConnect as their wallet connection option.
  2. Scanning the QR code from their organization's white label Portal Web3 wallet.
  3. Approving the connection from the mobile wallet.
  4. Approving transactions from the mobile wallet.

After a session is initiated in the app, the user can continue to transact and take other actions without having to rescan the QR code while the session is ongoing.

Interested in getting your wallet as a service kit with a pre-built WalletConnect integration? Request access to the API or talk to Portal.