Bundle client

Install exonum-bundle-client
package into your project.
npm install exonum-bundle-client
To include in Node.JS:
var ExonumBundle = require('exonum-bundle-client')
To use in browser:
<script src="node_modules/exonum-bundle-client/dist/exonum-bundle-client.js"></script>
API
Validate hexadecimal string
ExonumBundle.validateHexadecimal(hash, bytes)
Argument | Description | Type |
---|
hash | Hash as hexadecimal string. | String |
bytes | Expected length in bytes. Optional, 32 by default. | Number |
Returns boolean
.
Validate Bitcoin address
ExonumBundle.validateBTCAddress(address, networkType)
Argument | Description | Type |
---|
address | Bitcoin address as string. | String |
networkType | prod , testnet or both . Optional, prod by default. | String |
Returns boolean
.
Validate Ethereum address
ExonumBundle.validateETHAddress(address)
Argument | Description | Type |
---|
address | Ethereum address as string. | String |
Returns boolean
.
Generate mnemonic phrase
ExonumBundle.generateMnemonic()
Returns String
.
Generate a new random signing key pair
ExonumBundle.generateKeyPair(passphrase, password)
Argument | Description | Type |
---|
passphrase | Mnemonic phrase as string. | String |
password | Password as string. | String |
Returns promise.
Fulfilled response:
{
"publicKey": "...",
"secretKey": "..."
}
Register a new user
ExonumBundle.addUser(apiRoot, keyPair, BTCAddress, ETHAddress)
Argument | Description | Type |
---|
apiRoot | Root URL for node public API. | String |
keyPair | Signing key pair. | Object |
BTCAddress | Bitcoin address as string. | String |
ETHAddress | Ethereum address as string. | String |
Returns promise.
Fulfilled response:
{
"tx_hash": "..."
}
Transfer tokens
ExonumBundle.transfer(apiRoot, keyPair, to, amount)
Argument | Description | Type |
---|
apiRoot | Root URL for node public API. | String |
keyPair | Signing key pair. | Object |
to | Receiver's public key as hexadecimal string. | String |
amount | Uint64 number as string. | String |
Returns promise.
Fulfilled response:
{
"tx_hash": "..."
}
Get user refund addresses
ExonumBundle.getWithdraw(apiRoot, publicKey)
Argument | Description | Type |
---|
apiRoot | Root URL for node public API. | String |
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"btc_address": "...",
"eth_address": "...",
"pub_key": "..."
}
Get user balances and investment addresses
ExonumBundle.getShare(apiRoot, publicKey)
Argument | Description | Type |
---|
apiRoot | Root URL for node public API. | String |
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"btc_address": "...",
"btc_balance": "...",
"eth_balance": "...",
"eth_contract_address": "...",
"pub_key": "..."
}
Get user token balance
ExonumBundle.getDetail(apiRoot, publicKey)
Argument | Description | Type |
---|
apiRoot | Root URL for node public API. | String |
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"balance": "...",
"history_hash": "...",
"history_len": "...",
"pub_key": "..."
}
Get wallet and transactions as cryptographic proof
ExonumBundle.getHistory(apiRoot, publicKey)
Argument | Description | Type |
---|
apiRoot | Root URL for node public API. | String |
publicKey | Public key as hexadecimal string. | String |
Returns promise.
Fulfilled response:
{
"wallet": {
"balance": "...",
"history_hash": "...",
"history_len": "...",
"pub_key": "..."
},
"history": [
{
"body": {
"btc_address": "...",
"eth_address": "...",
"pub_key": "..."
},
"message_id": 10,
"network_id": 0,
"protocol_version": 0,
"service_id": 128,
"signature": "..."
}
]
}