Class: Chain

Chain

Asset definition

new Chain(string, number, Safe, table)

Constructor
Parameters:
Name Type Description
string name name of chain
number id identity number of chain defined in BIP44
Safe walletSafe Wallet safe
table walletStore Wallet table to store hd account info
Source:
hdwallet/chains/chain.js

Methods


<async> getAddress(number, number, number, number, bool, object)

Get addresses Get address in [start, end), if returned address is less than expected, that means BIP44 gap limit reached, we may not create address for user.
Parameters:
Name Type Description
number wid wallet ID to get address
number startPath or string - start index when number, path when string
number end end index (not include), only when startPath is number
number account account in BIP44, default 0, only when startPath is number
bool internal external or internal, default external(false), only when startPath is number
object opt option: { "password" : string, "chkfunc" : function, "forcechk" : bool, "includeWaddress" : bool }
Source:
hdwallet/chains/chain.js
Returns:
When startPath is number: { "start" : number, "addresses" : [ addressInfo ] } "start" -- the start index to scan, this may different from start in parameter, as wallet try to start from last known used index. "addressInfo" -- refer discoverAddress When startPath is string: { "path" : string, "pubKey" : string, "address" : string }
Type
object

<async> discoverAddress(number, number, number, number, bool, bool)

Discovery address as specified in BIP44
Parameters:
Name Type Description
number wid wallet ID to get address
number startAccount -
number startIndex -
number total number of addresses expected to return
bool internal discover internal address
bool skipTxCheck check transaction on discovered address or not
Source:
hdwallet/chains/chain.js
Returns:
- { "metadata" : { "totalDiscovered" : number, "lastScaned" : { "account" : number, "index" : number }, "lastUsedAddress" : { account : index } }, "addressInfo" : [ addressInfo ] } addressInfo: { "account" : number, "index" : number, "path" : string, "pubKey" : string, "address" : string }
Type
object

<async> getPrivateKey()

Get private for address specified by index
Source:
hdwallet/chains/chain.js

<async> signTransaction()

Sign transaction
Source:
hdwallet/chains/chain.js

<async> getTxCount()

Source:
hdwallet/chains/chain.js

toAddress()

Source:
hdwallet/chains/chain.js

_loadChainInfo()

Source:
hdwallet/chains/chain.js

<async> _getAddressByPath()

Source:
hdwallet/chains/chain.js

<async> _scanAddress()

Source:
hdwallet/chains/chain.js

_splitPath()

Source:
hdwallet/chains/chain.js