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

@kava-labs/cosmos-ledger

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kava-labs/cosmos-ledger

provide simple Ledger tooling for the Kava Ledger App with user friendly errors

  • 0.1.0-beta.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Kava Ledger

Kava Ledger is a fork of Lunie's library for interacting with the Cosmos Ledger Nano App. It provides a developer-friendly interface and user friendly error messages for an improved Ledger Nano development experience.

This library is based on ledger-cosmos-js by Juan Leni who also implemented the official Cosmos Ledger Nano App.

Thank you Juan! 🙌

Installation

yarn add @lunie/cosmos-ledger

Usage

Signing with the Ledger Nano

import Ledger from "@lunie/cosmos-ledger"

// generate messages with "@lunie/cosmos-api"
const signMessage = {} || ``
const ledger = await Ledger().connect()
const signature = await ledger.sign(signMessage)

Using with cosmos-api

import Ledger from "@lunie/cosmos-ledger"
import Cosmos from "@lunie/cosmos-api"

const privateKey = Buffer.from(...)
const publicKey = Buffer.from(...)

// init cosmos API object
const cosmos = Cosmos(API_URL, ADDRESS)

// create a message
const msg = cosmos
  .MsgSend({
    toAddress: 'cosmos1abcd09876', 
    amounts: [{ denom: 'stake', amount: 10 }]
  })

// create a signer
const ledgerSigner = async (signMessage) => {
  const ledger = new Ledger()
  await ledger.connect()
  const publicKey = await ledger.getPubKey()
  const signature = await ledger.sign(signMessage)

  return {
    signature,
    publicKey
  }
}

// send the transaction
const { included } = await msg.send({ gas: 200000 }, ledgerSigner)

// wait for the transaction to be included in a block
await included()

Constructor options

Ledger(
  { testModeAllowed = false },
  hdPath = [44, 118, 0, 0, 0], // HDPATH
  hrp = 'cosmos', // BECH32PREFIX
);

Keywords

FAQs

Package last updated on 31 Jul 2020

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