Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@colorplatformjs/color-ledger

colorplatform0MIT0.1.0TypeScript support: included

JS frontend to the Color Ledger app

color, color platform, color wallet, color signer, ledger, color javascript, color sdk, color-sdk

readme

Color Ledger App wrapper

This library helps interfacing with Color Ledger App. It provides a developer friendly interface and user friendly error messages.

THANK YOU

This library is based on ledger-cosmos-js by Juan Leni who implemented the Cosmos Ledger App. Thank you Juan!

Install

yarn add @colorplatform/color-ledger

Usage

Sign using the Ledger

import Ledger from "@colorplatform/color-ledger"

const signMessage = ... message to sign, generate messages with "@colorplatformjs/color-api"

const ledger = await Ledger().connect()

const signature = await ledger.sign(signMessage)

Using with Color-js

import Ledger from "@colorplatformjs/color-ledger"
import Color from "@colorplatformjs/color-api"

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

// init Color sender
const Color = Color(STARGATE_URL, ADDRESS)

// create message
const msg = Color
  .MsgSend({toAddress: 'Color1abcd09876', amounts: [{ denom: 'stake', amount: 10 }})

// create a signer from this local js signer library
const ledgerSigner = async (signMessage) => {
  const 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)

// await tx to be included in a block
await included()

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

[0.0.5] - 2019-06-12

Fixed

  • Fixed address confirmation @faboweb

[0.0.4] - 2019-06-12

Fixed

  • Removed webusb due to lack of support @faboweb

[0.0.3] - 2019-06-05

Repository

  • Simplified and unified repository (using webpack) @faboweb
  • Migrated to cosmos ledger lib v2 @faboweb

[0.0.2] - 2019-05-24

Added

  • Extracted the Ledger Cosmos App wrapper from Lunie into this repo @faboweb