/** * Module to interact with Haskoin API * * Doc (SwaggerHub) https://app.swaggerhub.com/apis/eligecode/blockchain-api/0.0.1-oas3 * */ import { TxHash } from '@xchainjs/xchain-client'; import { BaseAmount } from '@xchainjs/xchain-util'; import { AddressBalance, AddressDTO, AddressParams, HaskoinNetwork, Transaction, TxConfirmedStatus, TxHashParams, TxUnspent } from './haskoin-api-types'; /** * Get account from address. * * @param {string} haskoinUrl The haskoin API url. * @param {string} address The BCH address. * @returns {AddressBalance} * * @throws {"failed to query account by a given address"} thrown if failed to query account by a given address */ export declare const getAccount: ({ haskoinUrl, network, address }: AddressParams) => Promise; /** * Get address information. * * @param {string} haskoinUrl The haskoin node url. * @param {string} network * @param {string} address * @returns {AddressDTO} */ export declare const getAddress: ({ haskoinUrl, network, address }: AddressParams) => Promise; /** * Get transaction by hash. * * @param {string} haskoinUrl The haskoin API url. * @param {string} txId The transaction id. * @returns {Transaction} * * @throws {"failed to query transaction by a given hash"} thrown if failed to query transaction by a given hash */ export declare const getTx: ({ haskoinUrl, txId, network }: TxHashParams) => Promise; /** * Get raw transaction by hash. * * @param {string} haskoinUrl The haskoin API url. * @param {string} txId The transaction id. * @returns {Transaction} * * @throws {"failed to query transaction by a given hash"} thrown if failed to query raw transaction by a given hash */ export declare const getRawTransaction: ({ haskoinUrl, network, txId }: TxHashParams) => Promise; /** * Get transactions * * @see https://haskoin.com/api#get-tx * * @param {string} haskoinUrl The haskoin node url. * @param {string} network network id * @param {string} hash The transaction hash. * @returns {Transactions} */ export declare const getTxs: ({ address, haskoinUrl, network, limit, offset, }: { address: string; haskoinUrl: string; network: HaskoinNetwork; limit: number; offset?: number; }) => Promise; /** * * @param param * @returns Returns BaseAmount */ export declare const getBalance: ({ haskoinUrl, haskoinNetwork, address, confirmedOnly, assetDecimals, }: { haskoinUrl: string; haskoinNetwork: string; address: string; confirmedOnly: boolean; assetDecimals: number; }) => Promise; /** * Get unspent transactions. * * @param {string} haskoinUrl The haskoin API url. * @param {string} address The BCH address. * @returns {TxUnspent[]} * * @throws {"failed to query unspent transactions"} thrown if failed to query unspent transactions */ export declare const getUnspentTxs: ({ haskoinUrl, network, address }: AddressParams) => Promise; /** * Get Tx Confirmation status * * @param {string} haskoinUrl The haskoin node url. * @param {Network} network * @param {string} hash tx id * @returns {TxConfirmedStatus} */ export declare const getIsTxConfirmed: ({ haskoinUrl, network, txId }: TxHashParams) => Promise; /** * Helper to get `confirmed` status of a tx. * * It will get it from cache or try to get it from haskoin (if not cached before) */ export declare const getConfirmedTxStatus: ({ txHash, haskoinUrl, network, }: { haskoinUrl: string; txHash: TxHash; network: HaskoinNetwork; }) => Promise; /** * Get unspent txs and filter out pending UTXOs * * @see https://haskoin.com/api#get-unspent-tx * * @param {string} haskoinUrl The haskoin node url. * @param {Network} network * @param {string} address * @returns {AddressUTXO[]} */ export declare const getConfirmedUnspentTxs: ({ haskoinUrl, network, address }: AddressParams) => Promise; /** * Helper to get `hex` of `Tx` * * It will try to get it from cache before requesting it from Sochain */ export declare const getTxHex: ({ haskoinUrl, network, txId }: TxHashParams) => Promise; /** * Get unspent transactions. * * @param {string} haskoinUrl The haskoin API url. * @param {string} address The BCH address. * @returns {TxUnspent[]} * * @throws {"failed to query unspent transactions"} thrown if failed to query unspent transactions */ export declare const getUnspentTransactions: ({ haskoinUrl, network, address }: AddressParams) => Promise; /** * Broadcast transaction. * * @see https://app.swaggerhub.com/apis/eligecode/blockchain-api/0.0.1-oas3#/blockchain/sendTransaction * * Note: Because of an Haskoin issue (@see https://github.com/haskoin/haskoin-store/issues/25), * we need to broadcast same tx several times in case of `500` errors * @see https://github.com/xchainjs/xchainjs-lib/issues/492 * * @param {BroadcastTxParams} params * @returns {TxHash} Transaction hash. */ export declare const broadcastTx: ({ txHex, haskoinUrl, haskoinNetwork, }: { txHex: string; haskoinUrl: string; haskoinNetwork: string; }) => Promise;