npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@secux/protocol-transaction

v3.1.5

Published

SecuX Hardware Wallet transcation related protocol API

Downloads

59

Readme

lerna view on npm npm module downloads

@secux/protocol-transaction

SecuX Hardware Wallet transcation related protocol API

Usage

import { EllipticCurve, SecuxTransactionTool } from "@secux/protocol-transaction";

First, create instance of ITransport

Examples

  1. Query publickey from SecuX Hardware Wallet
const data = SecuxTransactionTool.getPublickey("m/44'/0'/0'/0/0", EllipticCurve.SECP256K1);
const response = await device.Exchange(data);
const publickey = SecuxTransactionTool.resolvePublickey(
    response, 
    EllipticCurve.SECP256K1,
    true // SECP256K1 compress flag
);
  1. Query extended publickey from SecuX Hardware Wallet
const data = SecuxTransactionTool.getXPublickey("m/44'/0'/0'/0/0");
const response = await device.Exchange(data);
const xpub = SecuxTransactionTool.resolveXPublickey(response, "m/44'/0'/0'/0/0");

API Reference

Protocol layer of transaction related method

Kind: global class

SecuxTransactionTool.resolveResponse(response) ⇒ IAPDUResponse

Resolve response from device.

Returns: IAPDUResponse - response object

| Param | Type | Description | | --- | --- | --- | | response | communicationData | data from device |

SecuxTransactionTool.getPublickey(path, curve) ⇒ communicationData

Query publickey (uncompressed) command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | path | string | BIP32 | | curve | EllipticCurve | 0: SECP256K1, 1: ED25519 |

SecuxTransactionTool.resolvePublickey(response, curve, compressed) ⇒ string

Reslove publickey from SecuX device.

Returns: string - publickey (base64 encoded)

| Param | Type | Default | Description | | --- | --- | --- | --- | | response | communicationData | | data from device | | curve | EllipticCurve | | 0: SECP256K1, 1: ED25519 | | compressed | boolean | true | setting for secp256k1 |

SecuxTransactionTool.getXPublickey(path) ⇒ communicationData

Query extended publickey command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | path | string | BIP32 |

SecuxTransactionTool.resolveXPublickey(response, path) ⇒ string

Reslove extended publickey from SecuX device.

Returns: string - xpub

| Param | Type | Description | | --- | --- | --- | | response | communicationData | data from device | | path | string | BIP32 |

SecuxTransactionTool.signTransaction(path, tx, [option]) ⇒ communicationData

Sign a hashed transcation command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | path | string | BIP32 | | tx | communicationData | prepared transaction data | | [option] | TransactionOption | |

SecuxTransactionTool.resolveSignature(response) ⇒ string

Reslove signature from SecuX device.

Returns: string - signature (base64 encoded)

| Param | Type | Description | | --- | --- | --- | | response | communicationData | data from device |

SecuxTransactionTool.signTransactionList(paths, txs, [otpion]) ⇒ communicationData

Sign hashed transactions command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | paths | Array.<string> | BIP32 | | txs | Array.<Buffer> | prepared transaction data corresponding to above path | | [otpion] | TransactionOption | |

SecuxTransactionTool.resolveSignatureList(response) ⇒ Array.<string>

Reslove signature from SecuX device.

Returns: Array.<string> - signature array of base64 string

| Param | Type | Description | | --- | --- | --- | | response | communicationData | data from device |

SecuxTransactionTool.signRawTransaction(path, tx, [option]) ⇒ communicationData

Sign a transcation command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | path | string | BIP32 | | tx | communicationData | prepared transaction data | | [option] | TransactionOption | |

SecuxTransactionTool.signRawTransactionList(paths, txs, [confirm], [otpion]) ⇒ communicationData

Sign transactions command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | paths | Array.<string> | BIP32 | | txs | Array.<Buffer> | prepared transaction data corresponding to above path | | [confirm] | communicationData | | | [otpion] | TransactionOption | |

SecuxTransactionTool.signMessage(path, msg, [option]) ⇒ communicationData

Sign message command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | path | string | BIP32 | | msg | communicationData | | | [option] | MessageOption | |

SecuxTransactionTool.signTypedMessage(path, typedMessageHash, [option]) ⇒ communicationData

Sign typed message command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | path | string | BIP32 | | typedMessageHash | communicationData | | | [option] | MessageOption | |

~~SecuxTransactionTool.txPrepare(path, inputId, tx, confirm, [isToken]) ⇒ communicationData~~

Deprecated

Send utxo command.

Returns: communicationData - data for sending to device

| Param | Type | Default | Description | | --- | --- | --- | --- | | path | string | | BIP32 | | inputId | number | | uint8 | | tx | communicationData | | | | confirm | communicationData | | | | [isToken] | boolean | false | |

~~SecuxTransactionTool.txBegin(amount, toAddress, [showConfirm]) ⇒ communicationData~~

Deprecated

Begin signing command.

Returns: communicationData - data for sending to device

| Param | Type | Default | | --- | --- | --- | | amount | string | | | toAddress | string | | | [showConfirm] | boolean | false |

~~SecuxTransactionTool.txEnd() ⇒ communicationData~~

Deprecated

End signing command.

Returns: communicationData - data for sending to device

~~SecuxTransactionTool.txSign(inputId) ⇒ communicationData~~

Deprecated

Sign command.

Returns: communicationData - data for sending to device

| Param | Type | Description | | --- | --- | --- | | inputId | number | uint8 |

IAPDUResponse

Properties

| Name | Type | Description | | --- | --- | --- | | status | number | StatusCode | | data | string | base64 encoded | | dataLength | number | length of the data |

StatusCode

Properties

| Name | Type | Description | | --- | --- | --- | | DATA_ERROR | number | 0x5001 | | CLA_ERROR | number | 0x5002 | | INS_ERROR | number | 0x5003 | | SUCCESS | number | 0x9000 |

TransactionType

Properties

| Name | Type | Description | | --- | --- | --- | | NORMAL | number | 0 | | TOKEN | number | 1 | | NFT | number | 2 |

EllipticCurve

Properties

| Name | Type | Description | | --- | --- | --- | | SECP256K1 | number | 0 | | ED25519 | number | 1 |

TransactionOption

Properties

| Name | Type | | --- | --- | | tp | TransactionType | | curve | EllipticCurve | | chainId | number |


© 2018-21 SecuX Technology Inc.

authors: [email protected]