🚀
Tonomy Developer Docs
  • Introduction
    • Features
  • Build Web4 Apps
    • Install
    • Register your Web4 App
    • Login
    • User Data and Logout
    • Sign Verifiable Credentials
    • Server Authentication
    • Smart Contracts
      • Develop
      • Deploy
      • 1-Click Transactions
      • Wallet Signing
    • Send P2P Messages
    • Troubleshooting
  • Multi-Chain Transactions + Crypto
    • Wallet Connect
    • Antelope Sigining Request (ESR)
  • Run Tonomy Infrastructure
    • Overview
      • Configuration
      • What software to run?
    • Node Setup
      • Setup
      • Run an API Node
      • Run a Block Producer Node
      • Becoming a Block Producer on Tonomy
    • API Endpoints
    • Hardware Requirement
    • Troubleshooting
  • Connect as an Exchange
  • Run Tonomy Gov OS
    • Technical requirements
    • Deploy Tonomy ID
    • Deploy a web wallet with the SDK
    • Reference
      • Application Interface (API)
      • Software Development Kit (SDK)
    • Troubleshooting
Powered by GitBook
On this page
  • Supported features
  • Pairing
  • Session Management
  • Transaction Handling
  1. Multi-Chain Transactions + Crypto

Wallet Connect

PreviousMulti-Chain Transactions + CryptoNextAntelope Sigining Request (ESR)

Last updated 3 months ago

Wallet Connect enables a seamless connection between your dAPP and a wallet. We setting up Wallet Connect for multichain transactions on Ethereum, Ethereum Sepolia, and Polygon. For detailed information and advanced configurations, refer to the

Supported features

  • Pairing: Establishing a connection between a wallet and a dAPP.

  • Session Management: Connecting, approving, rejecting, and disconnecting sessions.

  • Transaction Handling: Sending and managing transactions.

Pairing

To establish a pairing, use the following code:

const uri = 'xxx'; // pairing uri
try {
    await web3wallet.core.pairing.pair({ uri })
} catch (error) {
    // catch error happens while pairing
}

Session Management

When a dApp sends a session proposal to a wallet, it triggers a session_proposal event. To handle a session_proposal event, you need to set up an event listener and define the logic for processing the proposal.

web3wallet.on('session_proposal', onSessionProposal);

Approve Session

To approve a session proposal, construct the appropriate namespaces and call the approveSession method:

await web3wallet.approveSession({
    id: proposal.id,
    namespaces,
});

Reject Session

To reject a session proposal, use the rejectSession method, providing the session ID and a reason for the rejection:

import { getSdkError } from '@walletconnect/utils';

await web3wallet.rejectSession({
    id: proposal.id,
    reason: getSdkError('USER_REJECTED'),
});

Transaction Handling

When a dApp sends a transaction request to a wallet, it triggers a session_request event. To handle this event, you need to set up an event listener and define the logic for processing the request.

web3wallet.on('session_request', onSessionRequest);

Approve Transaction

To approve a transaction request, construct the appropriate transaction details and call the approveTransaction method:

await web3wallet.respondSessionRequest({ topic: session.topic, response });

Reject Transaction

To reject a transaction request, use the rejectTransaction method, providing the request ID and a reason for the rejection:

import { getSdkError } from '@walletconnect/utils';

await web3wallet.rejectTransaction({
    id: proposal.id,
    reason: getSdkError('USER_REJECTED'),
});

Wallet Connect documentation.