JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q33305F
  • License MIT

SecuX Hardware Wallet BNB API

Package Exports

  • @secux/app-bnb
  • @secux/app-bnb/lib/app-bnb.js

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 (@secux/app-bnb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lerna view on npm npm module downloads

@secux/app-bnb

SecuX Hardware Wallet BNB API

Usage

import { SecuxBNB } from "@secux/app-bnb";

First, create instance of ITransport


Examples

  1. Get address of bip44 path
const path = "m/44'/714'/0'/0/0";
const address = await device.getAddress(path);

/*

// transfer data to hardware wallet by custom transport layer
const data = SecuxBNB.prepareAddress(path);
const response = await device.Exchange(data);
const address = SecuxBNB.resolveAddress(response);

*/
  1. Sign transaction
const { raw_tx, signature } = await deivce.sign(
"m/44'/714'/0'/0/0",
{
to: "bnb17jr3n9xaxm92fp5dznuazql2c2x6ypw2gvuvmy",
amount: 1e18
}
);

/*

// transfer data to hardware wallet by custom transport layer
const data = SecuxBNB.prepareSign(
"m/44'/714'/0'/0/0",
{
from: "bnb1rcxjc3a6va0ldwzerx2t58g3sz6ss6x7cglwyc",
to: "bnb17jr3n9xaxm92fp5dznuazql2c2x6ypw2gvuvmy",
amount: 1e18
}
);

*/

API Reference

BNB package for SecuX device

Kind: global class


SecuxBNB.prepareAddress ⇒ communicationData

Prepare data for address generation.

Returns: communicationData - data for sending to device

Param Type Description
path string m/44'/714'/...

SecuxBNB.addressConvert(publickey) ⇒ string

Convert secp256k1 publickey to BNB address.

Returns: string - BNB address

Param Type Description
publickey string | Buffer secp256k1 publickey

SecuxBNB.resolveAddress(response) ⇒ string

Generate address from response data.

Returns: string - BNB address

Param Type Description
response communicationData data from device

SecuxBNB.preparePublickey(path) ⇒ communicationData

Prepare data for secp256k1 publickey.

Returns: communicationData - data for sending to device

Param Type Description
path string m/44'/714'/...

SecuxBNB.resolvePublickey(response) ⇒ string

Resolve secp256k1 publickey from response data.

Returns: string - secp256k1 publickey (hex string)

Param Type Description
response communicationData data from device

SecuxBNB.prepareXPublickey(path) ⇒ communicationData

Prepare data for xpub.

Returns: communicationData - data for sending to device

Param Type Description
path string m/44'/714'/...

SecuxBNB.resolveXPublickey(response, path) ⇒ string

Resolve xpub from response data.

Returns: string - xpub

Param Type Description
response communicationData data from device
path string m/44'/714'/...

SecuxBNB.prepareSign(path, content) ⇒ prepared

Prepare data for signing.

Returns: prepared - return object

Param Type Description
path string m/44'/714'/...
content txDetail transaction object

SecuxBNB.resolveSignature(response) ⇒ string

Resolve signature from response data

Returns: string - signature (hex string)

Param Type Description
response communicationData data from device

SecuxBNB.resolveTransaction(response, serialized) ⇒ string

Resolve raw transaction for broadcasting

Returns: string - signed raw transaction

Param Type Description
response communicationData data from device
serialized communicationData


txDetail

Properties

Name Type Description
publickey string | Buffer sender's publickey
to string receiving address
amount number BNB has 8 decimals
[chainId] string use specific BNB network
[accountNumber] number for replay protection
[sequence] number for replay protection
[memo] string

prepared

Properties

Name Type Description
commandData communicationData data for sending to device
serialized communicationData


© 2018-21 SecuX Technology Inc.

authors:
andersonwu@secuxtech.com