0.5.2 • Published 6 years ago

exonum-bundle-client v0.5.2

Weekly downloads
49
License
-
Repository
github
Last release
6 years ago

Bundle client

npm version

Getting started

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)
ArgumentDescriptionType
hashHash as hexadecimal string.String
bytesExpected length in bytes. Optional, 32 by default.Number

Returns boolean.

Validate Bitcoin address

ExonumBundle.validateBTCAddress(address, networkType)
ArgumentDescriptionType
addressBitcoin address as string.String
networkTypeprod, testnet or both. Optional, prod by default.String

Returns boolean.

Validate Ethereum address

ExonumBundle.validateETHAddress(address)
ArgumentDescriptionType
addressEthereum address as string.String

Returns boolean.

Generate mnemonic phrase

ExonumBundle.generateMnemonic()

Returns String.

Generate a new random signing key pair

ExonumBundle.generateKeyPair(passphrase, password)
ArgumentDescriptionType
passphraseMnemonic phrase as string.String
passwordPassword as string.String

Returns promise.

Fulfilled response:

{
  "publicKey": "...",
  "secretKey": "..."
}

Register a new user

ExonumBundle.addUser(apiRoot, keyPair, BTCAddress, ETHAddress)
ArgumentDescriptionType
apiRootRoot URL for node public API.String
keyPairSigning key pair.Object
BTCAddressBitcoin address as string.String
ETHAddressEthereum address as string.String

Returns promise.

Fulfilled response:

{
  "tx_hash": "..."
}

Transfer tokens

ExonumBundle.transfer(apiRoot, keyPair, to, amount)
ArgumentDescriptionType
apiRootRoot URL for node public API.String
keyPairSigning key pair.Object
toReceiver's public key as hexadecimal string.String
amountUint64 number as string.String

Returns promise.

Fulfilled response:

{
  "tx_hash": "..."
}

Get user refund addresses

ExonumBundle.getWithdraw(apiRoot, publicKey)
ArgumentDescriptionType
apiRootRoot URL for node public API.String
publicKeyPublic 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)
ArgumentDescriptionType
apiRootRoot URL for node public API.String
publicKeyPublic 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)
ArgumentDescriptionType
apiRootRoot URL for node public API.String
publicKeyPublic 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)
ArgumentDescriptionType
apiRootRoot URL for node public API.String
publicKeyPublic 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,
      "protocol_version": 0,
      "service_id": 128,
      "signature": "..."
    }
  ]
}

Changelog

Detailed changes for each release are documented in the CHANGELOG file.

0.5.2

6 years ago

0.5.1

6 years ago

0.5.0

6 years ago

0.4.2

6 years ago

0.4.0

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago