1.3.0
An enum containing the common status codes returned via the TransportStatusError#statusCode field.
nano.getAddress("44'/165'/0'", true).then(o => {
// ...
}, err => {
if (err.statusCode == STATUS_CODES.CONDITIONS_OF_USE_NOT_SATISFIED) {
console.log('User cancelled the request');
}
// ..
});
Security status not satisfied is returned when the device is still locked
Conditions of use not satisfied is returned when the user declines the request to complete the action.
Failed to verify the provided signature.
Parent block data was not found in cache.
Union type of all of the valid block data configurations.
Type: (OpenBlockData | ReceiveBlockData | SendBlockData | ChangeBlockData)
(string?)
: hash (in hex) of the previous block in the account chain
(string)
: address of the representative (both nano and xrb addresses are supported)
(string)
: new account balance after the transaction
(string?)
: hash (in hex) of the block from which to receive the funds
(string?)
: address of the account to send Nano to (both nano and xrb addresses are supported)
Open block data
let openBlockData = {
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
};
Receive block data
let receiveBlockData = {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
};
Send block data
let sendBlockData = {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
recipient: "nano_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k"
};
Change block data
let changeBlockData = {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000"
};
Coin configuration object used to pass coin implementation details to all the common API functions that the coins share.
Type: {coinName: string, addressPrimaryPrefix: string, addressSecondaryPrefix: string}
Base class for all Nano-family coin APIs to derive from.
(Transport<any>)
(CoinConfig)
The coin configuration object for the current coin.
Type: CoinConfig
Get Nano-family application configuration. The returned coinName should be
verified to match that of inst.coin.coinName
. If it doesn't, then the user
has the wrong application open on their device and other API calls will fail.
Promise<{version: string, coinName: string}>
:
an object with a version and the coin name
inst.getAppConfiguration().then(c => {
if (c.coinName != inst.coin.coinName) { throw new Error("Wrong coin app"); }
return c.version;
})
Encode the balance value (128bit big endian integer) as hex string
(string)
string representation of a base 10 number
string
:
a string that of hex encoded value of the value
encodeBalance("14000000000000000000000000") == "00000000000B949D854F34FECE000000"
Decode the balance value (128bit big endian integer) from hex string
(string)
hex encoded value
string
:
a string of the number in base 10
decodeBalance("00000000000B949D854F34FECE000000") == "14000000000000000000000000"
Nano API (default export of this module)
Extends BaseAPI
(Transport<any>)
import Nano from "hw-app-nano";
const nano = new Nano(transport);
Generate a signature for a block
(string)
a path of the account in BIP 32 format
(BlockData)
block data to hash and sign
Promise<{blockHash: string, signature: string}>
Opening an account
nano.signBlock("44'/165'/0'", {
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
}).then(o => o.signature)
Sending funds
nano.signBlock("44'/165'/0'", {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
recipient: "nano_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k"
}).then(o => o.signature)
Cache block in Ledger device memory
(string)
a path of the account in BIP 32 format
(BlockData)
block data
(string)
signature (in hex) of the block
Promise<any>
nano.cacheBlock("44'/165'/0'", {
representative: "xrb_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
});
Banano API
Extends BaseAPI
(Transport<any>)
import { Banano } from "hw-app-nano";
const ban = new Banano(transport);
Generate a signature for a block
(string)
a path of the account in BIP 32 format
(BlockData)
block data to hash and sign
Promise<{blockHash: string, signature: string}>
Opening an account
ban.signBlock("44'/198'/0'", {
representative: "ban_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
}).then(o => o.signature)
Sending funds
ban.signBlock("44'/198'/0'", {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "ban_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
recipient: "ban_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k"
}).then(o => o.signature)
Cache block in Ledger device memory
(string)
a path of the account in BIP 32 format
(BlockData)
block data
(string)
signature (in hex) of the block
Promise<any>
ban.cacheBlock("44'/198'/0'", {
representative: "ban_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
});
NOS API
Extends BaseAPI
(Transport<any>)
import { NOS } from "hw-app-nano";
const nos = new NOS(transport);
Generate a signature for a block
(string)
a path of the account in BIP 32 format
(BlockData)
block data to hash and sign
Promise<{blockHash: string, signature: string}>
Opening an account
nos.signBlock("44'/229'/0'/0'", {
representative: "nos_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
}).then(o => o.signature)
Sending funds
nos.signBlock("44'/229'/0'/0'", {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "nos_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
recipient: "nos_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k"
}).then(o => o.signature)
Cache block in Ledger device memory
(string)
a path of the account in BIP 32 format
(BlockData)
block data
(string)
signature (in hex) of the block
Promise<any>
nos.cacheBlock("44'/229'/0'/0'", {
representative: "nos_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
});
NOLLAR API
Extends BaseAPI
(Transport<any>)
import { NOLLAR } from "hw-app-nano";
const nollar = new NOLLAR(transport);
Generate a signature for a block
(string)
a path of the account in BIP 32 format
(BlockData)
block data to hash and sign
Promise<{blockHash: string, signature: string}>
Opening an account
nollar.signBlock("44'/229'/840'/0'", {
representative: "usd_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
}).then(o => o.signature)
Sending funds
nollar.signBlock("44'/229'/840'/0'", {
previousBlock: "991CF190094C00F0B68E2E5F75F6BEE95A2E0BD93CEAA4A6734DB9F19B728948",
representative: "usd_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
recipient: "usd_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k"
}).then(o => o.signature)
Cache block in Ledger device memory
(string)
a path of the account in BIP 32 format
(BlockData)
block data
(string)
signature (in hex) of the block
Promise<any>
nollar.cacheBlock("44'/229'/840'/0'", {
representative: "usd_3hd4ezdgsp15iemx7h81in7xz5tpxi43b6b41zn3qmwiuypankocw3awes5k",
balance: "100000000000000000000000000000000",
sourceBlock: "06B95C8A7EC4116E5BD907CD6DC65D310E065992A2E1D02F337D1A8308DEBC14"
});