Global

Members

(constant) BGL_RPC_NODE :string

Stable Bitgesell RPC endpoint to interact with.
Type:
  • string
Source:

Methods

(async) buildTransactionObject(from, to, fee, privateKey, amount) → {Promise.<{txObject, balance: number, success: boolean, error: null}>}

Shows how to construct, encode (hex format) and sign a transaction
Parameters:
Name Type Description
from BGL sender address
to BGL recepient address
fee amount to cover transaction cost: in satoshi units
privateKey sender address private key to sign the transaction
amount amount to send(should be converted to Satoshi units beforehand)
Source:
Returns:
Type
Promise.<{txObject, balance: number, success: boolean, error: null}>

(async) createHDWallet(index) → {Promise.<{mnemonic, address: *, index, privateKey: *}>}

Creates an HD wallet(index depth 0-9)
Parameters:
Name Type Description
index
Source:
Returns:
Type
Promise.<{mnemonic, address: *, index, privateKey: *}>

(async) getAccountBalance(bglAddress) → {Promise.<*>}

Returns balance object Tip: see preceding usage example how to convert bgl to satoshi units.
Parameters:
Name Type Description
bglAddress
Source:
Returns:
Type
Promise.<*>

(async) getAccountUTXO(bglAddress) → {Promise.<({utxo}|null)>}

Fetches Unspent Transaction Outputs for an address
Parameters:
Name Type Description
bglAddress
Source:
Returns:
Type
Promise.<({utxo}|null)>

(async) getAddressTxHistory(bglAddress)

Returns an array showing transaction history for an address.
Parameters:
Name Type Description
bglAddress
Source:
Returns:

(async) importWalletFromSeedPhrase(seedPhrase)

Import account from a mnemonic/seedphrase
Parameters:
Name Type Description
seedPhrase
Source:
Returns:

(async) importWalletWIFPrivateKey(privateKeyWif)

Import an account from a Private Key(in default WIF format)
Parameters:
Name Type Description
privateKeyWif
Source:
Returns:

(async) main() → {Promise.<void>}

An example on fetching UTXOs for an address with UTXOs Tip: switch with various addresses to see the output
Source:
Returns:
Type
Promise.<void>