@secux/app-xlm

SecuX Hardware Wallet XLM API

Usage no npm install needed!

<script type="module">
  import secuxAppXlm from 'https://cdn.skypack.dev/@secux/app-xlm';
</script>

README

lerna view on npm npm module downloads

@secux/app-xlm

SecuX Hardware Wallet XLM API

Usage

import { SecuxXLM } from "@secux/app-xlm";

First, create instance of ITransport


Examples

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

/*

// transfer data to hardware wallet by custom transport layer.
const data = SecuxXLM.prepareAddress("m/44'/148'/0'");
const response = await device.Exchange(data);
const address = SecuxXLM.resolve(response);

*/
  1. Sign transaction
const content = {
    to: "GDATJJ7NZIQ5GR4JBZVUHOGVVSPFEQF2JQ4KIOFZMBDJCH2PJFZJU7UK",
    amount: "123.456",
    sequence: 115521361698357411,
    fee: 100,
    // for new address that don't have on-chain data
    // needCreateAccount: true
}

const { raw_tx, signature } = await device.sign("m/44'/148'/0'", content);

/*

// transfer data to hardware wallet by custom transport layer.
const { commandData, serialized } = SecuxXLM.prepareSign("m/44'/148'/0'", content);
const response = await device.Exchange(commandData);
const raw_tx = SecuxXLM.resolveTransaction(response, serialized);

*/

API Reference

XLM package for SecuX device

Kind: global class


SecuxXLM.prepareAddress ⇒ communicationData

Prepare data for XLM address.

Returns: communicationData - data for sending to device

Param Type Description
path string BIP32 path (hardened child key), ex: m/44'/148'/0'

SecuxXLM.addressConvert(publickey) ⇒ string

Convert ED25519 publickey to XLM address.

Returns: string - XLM address

Param Type Description
publickey string | Buffer ed25519 publickey

SecuxXLM.resolveAddress(response) ⇒ string

Generate XLM address from response data.

Returns: string - XLM address

Param Type Description
response communicationData data from device

SecuxXLM.preparePublickey(path) ⇒ communicationData

Prepare data for ed25519 publickey.

Returns: communicationData - data for sending to device

Param Type Description
path string BIP32 path (hardened child key), ex: m/44'/148'/0'

SecuxXLM.resolvePublickey(response) ⇒ string

Resove ed25519 publickey from response data.

Returns: string - ed2519 publickey (hex string)

Param Type Description
response communicationData data from device

SecuxXLM.prepareSign(path, content) ⇒ prepared

Prepare data for signing.

Returns: prepared - prepared object

Param Type Description
path string BIP32 path (hardened child key), ex: m/44'/148'/0'
content txDetail transaction object

SecuxXLM.resolveSignature(response) ⇒ string

Resolve signature from response data.

Returns: string - signature (hex string)

Param Type Description
response communicationData data from device

SecuxXLM.resolveTransaction(response, serialized) ⇒ string

Generate raw transaction for broadcasting.

Returns: string - signed raw transaction

Param Type Description
response communicationData data from device
serialized communicationData serialized object


txDetail

Properties

Name Type Description
from string sending address
to string receiving address
amount string transfer amount
sequence string | number
fee string | number
[memo] memoObj
[networkPassphrase] string network for XLM, default is mainnet
[needCreateAccount] boolean pay for creating new account, default: false

memoObj

Properties

Name Type Description
Type string MemoType
Value string

prepared

Properties

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


© 2018-21 SecuX Technology Inc.

authors:
andersonwu@secuxtech.com