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 numberwid wallet ID to get address numberstartPath or string - start index when number, path when string numberend end index (not include), only when startPath is number numberaccount account in BIP44, default 0, only when startPath is number boolinternal external or internal, default external(false), only when startPath is number objectopt 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 numberwid wallet ID to get address numberstartAccount - numberstartIndex - numbertotal number of addresses expected to return boolinternal discover internal address boolskipTxCheck 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