README
@secux/app-xlm
SecuX Hardware Wallet XLM API
Usage
import { SecuxXLM } from "@secux/app-xlm";
First, create instance of ITransport
Examples
- 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);
*/
- 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
- .addressConvert(publickey) ⇒
string
- .resolveAddress(response) ⇒
string
- .preparePublickey(path) ⇒
communicationData
- .resolvePublickey(response) ⇒
string
- .prepareSign(path, content) ⇒
prepared
- .resolveSignature(response) ⇒
string
- .resolveTransaction(response, serialized) ⇒
string
- .prepareAddress ⇒
communicationData
SecuxXLM.prepareAddress ⇒ 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' |
string
SecuxXLM.addressConvert(publickey) ⇒ Convert ED25519 publickey to XLM address.
Returns: string
- XLM address
Param | Type | Description |
---|---|---|
publickey | string | Buffer |
ed25519 publickey |
string
SecuxXLM.resolveAddress(response) ⇒ Generate XLM address from response data.
Returns: string
- XLM address
Param | Type | Description |
---|---|---|
response | communicationData |
data from device |
communicationData
SecuxXLM.preparePublickey(path) ⇒ 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' |
string
SecuxXLM.resolvePublickey(response) ⇒ Resove ed25519 publickey from response data.
Returns: string
- ed2519 publickey (hex string)
Param | Type | Description |
---|---|---|
response | communicationData |
data from device |
prepared
SecuxXLM.prepareSign(path, content) ⇒ 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 |
string
SecuxXLM.resolveSignature(response) ⇒ Resolve signature from response data.
Returns: string
- signature (hex string)
Param | Type | Description |
---|---|---|
response | communicationData |
data from device |
string
SecuxXLM.resolveTransaction(response, serialized) ⇒ 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