Sochain Api

getAddress

Get address information.

Parameters

Returns BtcAddressDTO

getTx

Get transaction by hash.

Parameters

  • $0 Object
    • $0.sochainUrl
    • $0.network
    • $0.hash
  • sochainUrl string The sochain node url.
  • network string network id
  • hash string The transaction hash.

Returns Transactions

getBalance

Get address balance.

Parameters

  • $0 Object
    • $0.sochainUrl
    • $0.network
    • $0.address
    • $0.confirmedOnly
  • sochainUrl string The sochain node url.
  • network string Network
  • address string Address
  • confirmedOnly boolean Flag whether to get balances of confirmed txs only or for all

Returns number

getUnspentTxs

Get unspent txs

Parameters

  • $0 Object
    • $0.sochainUrl
    • $0.network
    • $0.address
    • $0.startingFromTxId
  • sochainUrl string The sochain node url.
  • network string
  • address string

Returns Array<BtcAddressUTXO>

getIsTxConfirmed

Get Tx Confirmation status

Parameters

  • $0 Object
    • $0.sochainUrl
    • $0.network
    • $0.hash
  • sochainUrl string The sochain node url.
  • network Network
  • hash string tx id

Returns TxConfirmedStatus

confirmedTxs

List of confirmed txs

Stores a list of confirmed txs (hashes) in memory to avoid requesting same data

getConfirmedTxStatus

Helper to get confirmed status of a tx.

It will get it from cache or try to get it from Sochain (if not cached before)

Parameters

  • $0 Object
    • $0.txHash
    • $0.sochainUrl
    • $0.network

getConfirmedUnspentTxs

Get unspent txs and filter out pending UTXOs

Parameters

  • $0 Object
    • $0.sochainUrl
    • $0.network
    • $0.address
  • sochainUrl string The sochain node url.
  • network Network
  • address string

Returns Array<BtcAddressUTXO>

getSuggestedTxFee

Get Bitcoin suggested transaction fee.

Returns number The Bitcoin suggested transaction fee per bytes in sat.