Bundle client

Install https://www.npmjs.com/package/exonum-bundle-client
package into your project.
npm install exonum-bundle-client
To include in Node.JS:
var bundle = require('exonum-bundle-client')
To use in browser include browser-ready library version into your page:
<script src="node_modules/exonum-bundle-client/dist/exonum-bundle-client.js"></script>
Init:
var apiRoot = 'http://127.0.0.1:8080';
var bundle = new ExonumBundle(apiRoot);
Also it is possible to use following root URL format:
var apiRoot = 'http://example.com';
API
Validate hexadecimal string
bundle.validateHexadecimal(hash, bytes)
Argument | Description | Type |
---|
hash | Hash as hexadecimal string. | String |
bytes | Expected length in bytes. Optional, 32 by default. | Number |
Validate Bitcoin address
bundle.validateBTCAddress(address, networkType)
Argument | Description | Type |
---|
address | Bitcoin address as string. | String |
networkType | prod , testnet or both . Optional, prod by default. | String |
Validate Ethereum address
bundle.validateETHAddress(address)
Argument | Description | Type |
---|
address | Ethereum address as string. | String |
Generate mnemonic phrase
bundle.generateMnemonic()
Generate a new random signing key pair
bundle.generateKeyPair(passphrase, password)
Returns:
{
"publicKey": "...",
"secretKey": "..."
}
Argument | Description | Type |
---|
passphrase | Mnemonic phrase as string. | String |
password | Password as string. | String |
Register new user
bundle.addUser(keyPair, BTCAddress, ETHAddress)
Argument | Description | Type |
---|
keyPair | Signing key pair. | Object |
BTCAddress | Bitcoin address as string. | String |
ETHAddress | Ethereum address as string. | String |
Transfer ETH
bundle.transfer(keyPair, to, amount)
Argument | Description | Type |
---|
keyPair | Signing key pair. | Object |
to | Ethereum address as string. | String |
amount | Uint64 number as string. | String |
getWithdraw
bundle.getWithdraw(publicKey)
Argument | Description | Type |
---|
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"btc_address": "...",
"eth_address": "...",
"pub_key": "..."
}
getShare
bundle.getShare(publicKey)
Argument | Description | Type |
---|
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"btc_address": "...",
"btc_balance": "...",
"eth_balance": "...",
"eth_contract_address": "...",
"pub_key": "..."
}
getDetail
bundle.getDetail(publicKey)
Argument | Description | Type |
---|
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"balance": "...",
"history_hash": "...",
"history_len": "...",
"pub_key": "..."
}
getHistory
bundle.getHistory(publicKey)
Argument | Description | Type |
---|
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"block_info": {
"block": {},
"precommits": []
},
"wallet": {
"mpt_proof": {},
"value": {}
},
"wallet_history": {
"mt_proof": {},
"values": []
}
}