JSPM

  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q48343F
  • License ISC

硬件签名

Package Exports

  • web-hd-sdk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (web-hd-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

web-hd-sdk

web-hd-sdk 主要集成了ledger和trezor两个硬件在web项目中签名,目前支持btc、eth (开发中.)。

Installing

For the latest stable version:

npm install web-hd-sdk

使用是说明

import {Transaction} from 'invault-hd-sdk';
import {toHex, numberToHex} from 'web3-utils';
import {convert} from 'ethereumjs-units';

const tx = new Transaction("ledger", "eth","m/44'/60'/72'/0/1");
const entity = {
    nonce: numberToHex(source_data.nonce),
    gasPrice: numberToHex(source_data.gasPrice),
    gasLimit: numberToHex(source_data.gasLimit),
    to: toHex(source_data.toAddress),
    value: numberToHex(convert('1', 'eth', 'wei')),
    data: '',
    chainId: numberToHex(source_data.chainId)
};
console.log(entity);
try {
    const res = await tx.signTransaction(entity);
} catch (e) {
    console.log(e.message);
}

####返回结果

res = {
    success: true,
    message: "",
    v: "",
    r: "",
    s: "",
};