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

@reown/walletkit

Package Overview
Dependencies
Maintainers
9
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reown/walletkit

WalletKit for WalletConnect Protocol

  • 1.1.1-rc-0
  • canary
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
decreased by-3.97%
Maintainers
9
Weekly downloads
 
Created
Source

@reown/walletkit

Description

The WalletKit SDK streamlines the integration process, making it easier for wallet developers to include the authentication and transaction signing features necessary for their users to connect and interact with all sorts of apps — now and in the future.

Getting Started

Install

npm install @reown/walletkit

Wallet Usage

  1. Initialization
import { Core } from "@walletconnect/core";
import { WalletKit } from "@reown/walletkit";

const core = new Core({
  projectId: process.env.PROJECT_ID,
});

const walletkit = await WalletKit.init({
  core, // <- pass the shared `core` instance
  metadata: {
    name: "Demo app",
    description: "Demo Client as Wallet/Peer",
    url: "www.walletconnect.com",
    icons: [],
  },
});
  1. Sign Session Approval
walletkit.on("session_proposal", async (proposal) => {
  const session = await walletkit.approveSession({
    id: proposal.id,
    namespaces,
  });
});
await walletkit.pair({ uri });
  1. Sign Session Rejection
walletkit.on("session_proposal", async (proposal) => {
  const session = await walletkit.rejectSession({
    id: proposal.id,
    reason: getSdkError("USER_REJECTED_METHODS"),
  });
});
  1. Sign Session Disconnect
await walletkit.disconnectSession({
  topic,
  reason: getSdkError("USER_DISCONNECTED"),
});
  1. Responding to Sign Session Requests
walletkit.on("session_request", async (event) => {
  const { id, method, params } = event.request;
  await walletkit.respondSessionRequest({ id, result: response });
});
  1. Updating a Sign Session
await walletkit.updateSession({ topic, namespaces: newNs });
  1. Updating a Sign Session
await walletkit.extendSession({ topic });
  1. Emit Sign Session Events
await walletkit.emitSessionEvent({
  topic,
  event: {
    name: "accountsChanged",
    data: ["0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb"],
  },
  chainId: "eip155:1",
});
  1. Handle Sign Events
walletkit.on("session_proposal", handler);
walletkit.on("session_request", handler);
walletkit.on("session_delete", handler);

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