3.0.1 • Published 3 years ago

secux-sdk v3.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

lerna view on npm npm module downloads

secux-sdk

A JavaScript library for SecuX hardware wallet

Installation

npm install --save secux-sdk

Getting Started

If you are using javascript projecct, here are packages for connecting to SecuX harware wallet:

If not, please refer to our develop portal for integrating with other programming languages. (comming soon)

Examples (using usb)

Example for connecting SecuX hardware wallet by usb:

import { SecuxWebUSB } from "@secux/transport-webusb";
require("secux-sdk");


const device = await SecuxWebUSB.Create(
    () => console.log("connected"),
    () => console.log("disconnected")
);
await device.Connect();
  • Get address by BIP32 path.

    // BTC native segwit address
    const address = await device.getAddress("m/84'/0'/0'/0/0");
    // ETH address
    const address = await device.getAddress("m/44'/60'/0'/0/0");
  • Get extended publickey by BIP32 path. (support xpub, ypub, zpub)

    const xpub = await device.getXPublickey("m/84'/0'/0'/0/0");
  • Signing.
    // for ETH EIP-1559
    const { raw_tx, signature } = await device.sign(
        "m/44'/60'/0'/0/0",
        {
            nonce: 0,
            to: "0xD080156885651fADbD6df14145051b934660a748",
            value: 1e10,
            chainId: 1,
            maxPriorityFeePerGas: 1e4,
            maxFeePerGas: 1e6,
            gasLimit: 25000
        }
    );

Modules API Reference

Please refer to related blockchain api for use.


© 2018-21 SecuX Technology Inc.

authors: andersonwu@secuxtech.com