STATUS_CODES

src/api.js

An enum containing the common status codes returned via the TransportStatusError#statusCode field.

STATUS_CODES
Example
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');
  }
  // ..
});
Static Members
SECURITY_STATUS_NOT_SATISFIED
CONDITIONS_OF_USE_NOT_SATISFIED
INVALID_SIGNATURE
CACHE_MISS

BlockData

src/api.js

Union type of all of the valid block data configurations.

BlockData

Type: (OpenBlockData | ReceiveBlockData | SendBlockData | ChangeBlockData)

Properties
previousBlock (string?) : hash (in hex) of the previous block in the account chain
representative (string) : address of the representative (both nano and xrb addresses are supported)
balance (string) : new account balance after the transaction
sourceBlock (string?) : hash (in hex) of the block from which to receive the funds
recipient (string?) : address of the account to send Nano to (both nano and xrb addresses are supported)
Example

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"
};

CoinConfig

src/api.js

Coin configuration object used to pass coin implementation details to all the common API functions that the coins share.

CoinConfig

Type: {coinName: string, addressPrimaryPrefix: string, addressSecondaryPrefix: string}

Properties
coinName (string)
addressPrimaryPrefix (string)
addressSecondaryPrefix (string)

BaseAPI

src/api.js

Base class for all Nano-family coin APIs to derive from.

new BaseAPI(transport: Transport<any>, coin: CoinConfig)
Parameters
transport (Transport<any>)
coin (CoinConfig)
Instance Members
coin
getAppConfiguration()

encodeBalance

src/util.js

Encode the balance value (128bit big endian integer) as hex string

encodeBalance(value: string): string
Parameters
value (string) string representation of a base 10 number
Returns
string: a string that of hex encoded value of the value
Example
encodeBalance("14000000000000000000000000") == "00000000000B949D854F34FECE000000"

decodeBalance

src/util.js

Decode the balance value (128bit big endian integer) from hex string

decodeBalance(value: string): string
Parameters
value (string) hex encoded value
Returns
string: a string of the number in base 10
Example
decodeBalance("00000000000B949D854F34FECE000000") == "14000000000000000000000000"

Nano API (default export of this module)

new Nano(transport: Transport<any>)

Extends BaseAPI

Parameters
transport (Transport<any>)
Example
import Nano from "hw-app-nano";
const nano = new Nano(transport);
Instance Members
getAddress(path, boolDisplay?)
signBlock(path, blockData)
cacheBlock(path, blockData, signature)

Banano API

new Banano(transport: Transport<any>)

Extends BaseAPI

Parameters
transport (Transport<any>)
Example
import { Banano } from "hw-app-nano";
const ban = new Banano(transport);
Instance Members
getAddress(path, boolDisplay?)
signBlock(path, blockData)
cacheBlock(path, blockData, signature)

NOS API

new NOS(transport: Transport<any>)

Extends BaseAPI

Parameters
transport (Transport<any>)
Example
import { NOS } from "hw-app-nano";
const nos = new NOS(transport);
Instance Members
getAddress(path, boolDisplay?)
signBlock(path, blockData)
cacheBlock(path, blockData, signature)

NOLLAR API

new NOLLAR(transport: Transport<any>)

Extends BaseAPI

Parameters
transport (Transport<any>)
Example
import { NOLLAR } from "hw-app-nano";
const nollar = new NOLLAR(transport);
Instance Members
getAddress(path, boolDisplay?)
signBlock(path, blockData)
cacheBlock(path, blockData, signature)