Haskoin Api

isErrorResponse

Check error response.

Parameters

  • response any The api response.

Returns boolean

getAccount

Get account from address.

Parameters

  • $0 Object
    • $0.haskoinUrl
    • $0.address
  • haskoinUrl string The haskoin API url.
  • address string The BCH address.

  • Throws "failed to query account by a given address" thrown if failed to query account by a given address

Returns AddressBalance

getTransaction

Get transaction by hash.

Parameters

  • $0 Object
    • $0.haskoinUrl
    • $0.txId
  • haskoinUrl string The haskoin API url.
  • txId string The transaction id.

  • Throws "failed to query transaction by a given hash" thrown if failed to query transaction by a given hash

Returns Transaction

getRawTransaction

Get raw transaction by hash.

Parameters

  • $0 Object
    • $0.haskoinUrl
    • $0.txId
  • haskoinUrl string The haskoin API url.
  • txId string The transaction id.

  • Throws "failed to query transaction by a given hash" thrown if failed to query raw transaction by a given hash

Returns Transaction

getTransactions

Get transaction history.

Parameters

  • $0 Object
    • $0.haskoinUrl
    • $0.address
    • $0.params
  • haskoinUrl string The haskoin API url.
  • address string The BCH address.
  • params TransactionsQueryParam The API query parameters.

  • Throws "failed to query transactions" thrown if failed to query transactions

Returns Array<Transaction>

getUnspentTransactions

Get unspent transactions.

Parameters

  • $0 Object
    • $0.haskoinUrl
    • $0.address
  • haskoinUrl string The haskoin API url.
  • address string The BCH address.

  • Throws "failed to query unspent transactions" thrown if failed to query unspent transactions

Returns Array<TxUnspent>

getSuggestedFee

Get suggested fee amount for Bitcoin cash. (fee per byte)

Returns number The Bitcoin cash stats.

broadcastTx

Broadcast transaction.

Parameters

  • params BroadcastTxParams
    • params.txHex
    • params.haskoinUrl

Returns TxHash Transaction hash.