npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@hsuite/hedera-wallet-connect

v2.1.3

Published

A library to facilitate integrating Hedera with WalletConnect

Readme

Background

This library provides tools and recommendations on how to integrate Hedera into an application that requires communication with a wallet that supports Hedera. There are 2 different paths to integrate Hedera in this context. Both approaches use the WalletConnect network to send messages from apps to wallets and back.

Hedera APIs

Hedera natively operates using a gRPC API for write transactions and by default, a REST API for read transactions. Hedera implements EVM compatible smart contracts using Hyperledger Besu under the hood.

Ethereum developers and toolsets often expect to interact with Ethereum compatible chains using the Ethereum JSON-RPC. To achieve compatibility with this API, Hedera JSON-RPC Providers operate a software middlelayer that translates Ethereum JSON-RPC compatible API calls into Hedera gRPC and REST API calls.

Ethereum JSON-RPC vs. Hedera JSON-RPC vs. Hedera JSON-RPC Relay

When integrating, app developers can choose to use the Hedera native approach and send transactions to wallets over the WalletConnect network using the JSON-RPC spec defined for Hedera native transactions or use Ethereum JSON-RPC calls sent to a Hedera JSON-RPC Relay provider which then communicates with Hedera consensus and mirror nodes.

On a high level, JSON-RPC is a type of API structure, such as SOAP, gRPC, REST, GraphQL, etc. In the Hedera ecosystem, there are distinct concepts regarding JSON-RPC APIs to consider:

  • Ethereum JSON-RPC spec defines how to interact with Ethereum compatible networks
  • Hedera JSON-RPC Relay implements the Ethereum JSON-RPC spec for Hedera
  • Wallets in the Hedera ecosystem also support a separate specification that defines how to send transactions and messages to wallets over the WalletConnect network without relying on a Hedera JSON-RPC Relay provider. This is a Hedera specific specification defined for utilizing the WalletConnect network distinct from other JSON-RPC specs such as the one defined by the Ethereum network.

For more information see:

Getting started

In addition to choosing between the Hedera native JSON-RPC spec and the Ethereum JSON-RPC spec, when building with javascript/typescript, there are 2 supported options to utilize the WalletConnect network to send information from apps to wallets and back.

This README assumes an understanding of Hedera as well as the WalletConnect network and focusses on how to send a payload to a wallet for processing and presentation to an end user that is a Hedera account holder. We recommend reviewing the Hedera Docs and first submitting transactions directly to the Hedera network without requiring interaction with a Wallet when integrating Hedera for the first time. We also recommend reviewing the Reown docs.

Using this library and underlying WalletConnect libraries directly

  1. Add Hedera dependencies to your project:
npm install @hashgraph/hedera-wallet-connect @hashgraph/sdk @walletconnect/modal
  1. Initialize dApp Connector
import {
  HederaSessionEvent,
  HederaJsonRpcMethod,
  DAppConnector,
  HederaChainId,
} from '@hashgraph/hedera-wallet-connect'
import { LedgerId } from '@hashgraph/sdk'

const metadata = {
  name: 'Hedera Integration using Hedera DAppConnector - v1 approach',
  description: 'Hedera dAppConnector Example',
  url: 'https://example.com', // origin must match your domain & subdomain
  icons: ['https://avatars.githubusercontent.com/u/31002956'],
}

const dAppConnector = new DAppConnector(
  metadata,
  LedgerId.Mainnet,
  projectId,
  Object.values(HederaJsonRpcMethod),
  [HederaSessionEvent.ChainChanged, HederaSessionEvent.AccountsChanged],
  [HederaChainId.Mainnet, HederaChainId.Testnet],
)

await dAppConnector.init({ logger: 'error' })
  1. Connect to a wallet
await dAppConnector.openModal()
  1. Handle sessions, events, and payloads.

Examples, demos, and tools

Using Reown's AppKit

  1. Follow one of the quickstart instructions at https://docs.reown.com/appkit/overview#quickstart

  2. Add Hedera dependencies to your project:

npm install @hashgraph/[email protected] @hashgraph/sdk @walletconnect/universal-provider
  1. Update createAppKit with adapters and a universal provider for Hedera. Note the HederaAdapter will need to come before the WagmiAdapter in the adapters array.
import type UniversalProvider from '@walletconnect/universal-provider'

import {
  HederaProvider,
  HederaAdapter,
  HederaChainDefinition,
  hederaNamespace,
} from '@hashgraph/hedera-wallet-connect'

const metadata = {
  name: 'AppKit w/ Hedera',
  description: 'Hedera AppKit Example',
  url: 'https://example.com', // origin must match your domain & subdomain
  icons: ['https://avatars.githubusercontent.com/u/179229932']
}

const hederaEVMAdapter = new HederaAdapter({
  projectId,
  networks: [
    HederaChainDefinition.EVM.Mainnet,
    HederaChainDefinition.EVM.Testnet,
],
  namespace: 'eip155',
})

const universalProvider = (await HederaProvider.init({
  projectId: "YOUR_PROJECT_ID",
  metadata,
})) as unknown as UniversalProvider, // avoid type mismatch error due to missing of private properties in HederaProvider

// ...
createAppKit({
  adapters: [ hederaEVMAdapter ],
  //@ts-expect-error expected type error
  universalProvider,
  projectId,
  metadata,
  networks: [
    // EVM
    HederaChainDefinition.EVM.Mainnet,
    HederaChainDefinition.EVM.Testnet,
  ],
})

// ...
  1. Recommended: Add Hedera Native WalletConnect Adapter
import { HederaChainDefinition, hederaNamespace } from '@hashgraph/hedera-wallet-connect'

// ...

const hederaNativeAdapter = new HederaAdapter({
  projectId,
  networks: [HederaChainDefinition.Native.Mainnet, HederaChainDefinition.Native.Testnet],
  namespace: hederaNamespace, // 'hedera' as CaipNamespace,
})

// ...

createAppKit({
  adapters: [hederaEVMAdapter, hederaNativeAdapter],
  projectId,
  metadata,
  networks: [
    // EVM
    HederaChainDefinition.EVM.Mainnet,
    HederaChainDefinition.EVM.Testnet,
    // Native
    HederaChainDefinition.Native.Mainnet,
    HederaChainDefinition.Native.Testnet,
  ],
})

Examples, demos, and tools

Hedera Wallets

Upgrading from v1 to v2

Upgrading from v1 to v2 should be fairly straightforward. We have maintained compatibility with the v1 structure, while deprecating a few methods marked as deprecated. The v1 library did not explicitly offer support for Ethereum JSON-RPC function calls, so the only breaking changes refer to how to send transactions to wallets using the hedera:(mainnet|testnet) namespace. While minimal, the main breaking changes are:

  • remove WalletConnect v1 modals

    • these are very old, though in the spirit of semver, we kept the dependency until this library's v2 release
  • remove setting node id's within this library for transactions

    • initially, a transaction created by the Hedera Javascript SDK needed to have one or more consensus node ids set to be able to serialize into bytes, sent over a network, and deserialized by the SDK