Blade Web3 Javascript API

Blade Web3 JavaScript API

npm version

A JavaScript/TypeScript library for development of DApps using Blade Wallet on Hedera Network


Read the TypeDoc API documentation

Example Usage

For example usage and testing the below APIs using a Demo App, please go here and setup the app locally:

Demo App - Local Setup

The hosted version of the Demo App can be used to try out some API calls:

Demo App - Hosted

Getting Started

Blade Wallet uses the Hedera Signature and Wallet Interface as defined here.


This package is available as a NPM package.

npm install @bladelabs/blade-web3.js

Minimum Hashgraph SDK version 2.16 is needed for connector npm i -S @hashgraph/sdk@^2.16


The BladeSigner class implements the Hashgraph Signer interface and allows access to Blade Wallet operations.

To interact with the Blade Extension programmatically, instantiate a BladeSigner object and create a new session.

import {BladeSigner, HederaNetwork} from '@bladelabs/blade-web3.js';


async function initBlade() {
const bladeSigner = new BladeSigner();
const params = {
network: HederaNetwork.Mainnet,
// dAppCode - optional while testing, request specific one by contacting us.
dAppCode: "yourAwesomeApp"
// create session with optional parameters.
await bladeSigner.createSession(params);

// bladeSigner object can now be used.

you can then communicate with the Extension using the BladeSigner object using the Hedera Signer interface:

API Description
bladeSigner.createSession(params:SessionParams) Optional params. Create session with Blade extension.
bladeSigner.getAccountId() Get accountId of active account.
bladeSigner.getAccountBalance( accountId:AccountId⎮string)
bladeSigner.getAccountInfo( accountId:AccountId⎮string) Get information about a Hedera account on the connected network.
bladeSigner.checkTransaction(transaction:Transaction) Check that a transaction is valid.
bladeSigner.populateTransaction(transaction:Transaction) Set transaction id with active account. Sign and execute a transaction with provider account.
bladeSigner.signTransaction(transaction:Transaction) Sign a transaction with active wallet account.
bladeSigner.getLedgerId() Ledger Id of the currently connected network.
bladeSigner.getMirrorNetwork() Return array of mirror nodes for the current network.
bladeSigner.getNetwork() Get map of nodes for the current hedera network.
bladeSigner.onAccountChanged(callback:Function) Run callback when the wallet account changes.
bladeSigner.onWalletLocked(callback:Function) Run callback when the wallet is locked.

Executing a Transfer:

import { TransferTransaction } from '@hashgraph/sdk';

const amount = new BigNumber(5);

const transaction = new TransferTransaction(
hbarTransfers: [{
accountId: destinationAccountId,
amount: amount
accountId: bladeSigner.getAccountId(),
amount: amount.negated()


const result = await;

Getting a transaction receipt:

import { TransactionReceiptQuery } from '@hashgraph/sdk';

const result = await new TransactionReceiptQuery({transactionId:transactionId}));


This repository is distributed under the terms of the Apache License (Version 2.0). See LICENSE for details.

Generated using TypeDoc