Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@walletconnect/core

Package Overview
Dependencies
Maintainers
12
Versions
601
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@walletconnect/core

Core for WalletConnect Protocol

  • 2.17.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
12
Created

What is @walletconnect/core?

@walletconnect/core is a core library for WalletConnect, a protocol for connecting decentralized applications (dApps) to mobile wallets with QR code scanning or deep linking. It allows developers to integrate WalletConnect functionality into their applications, enabling secure and seamless interactions between dApps and wallets.

What are @walletconnect/core's main functionalities?

Initialize WalletConnect

This code initializes a WalletConnect connector with a specified bridge server and QR code modal. The connector is the main interface for establishing a connection between a dApp and a wallet.

const WalletConnect = require('@walletconnect/core');
const connector = new WalletConnect({
  bridge: 'https://bridge.walletconnect.org',
  qrcodeModal: QRCodeModal,
});

Create Session

This code creates a new WalletConnect session and generates a URI that can be displayed as a QR code. The QR code allows users to scan and connect their wallet to the dApp.

connector.createSession().then(() => {
  const uri = connector.uri;
  QRCodeModal.open(uri, () => {
    console.log('QR Code Modal closed');
  });
});

Send Transaction

This code listens for a successful connection event and then sends a transaction from the connected wallet. The transaction details such as recipient address, amount, and gas limit are specified in the `tx` object.

connector.on('connect', (error, payload) => {
  if (error) {
    throw error;
  }
  const { accounts } = payload.params[0];
  const tx = {
    from: accounts[0],
    to: '0xRecipientAddress',
    value: '0xAmountInWei',
    gas: '0xGasLimit',
  };
  connector.sendTransaction(tx).then((result) => {
    console.log('Transaction sent:', result);
  }).catch((error) => {
    console.error('Transaction error:', error);
  });
});

Other packages similar to @walletconnect/core

Keywords

FAQs

Package last updated on 05 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc