Skip to content

BitcoinApi

martiliones edited this page Jun 12, 2023 · 1 revision

BTC: BitcoinApi

bitcoinApi.multiplier

Bitcoin base multiplier

  • Type

    interface BitcoinApi {
      multiplier: 100000000;
    }

bitcoinApi.createTransaction()

Creates base bitcoin transaction

  • Type

    interface BitcoinApi {
      createTransaction(
        address: string,
        amount: number,
        fee: number
      ): Promise<SignedJsonTx>;
    }
  • References

    SignedJsonTx

bitcoinApi.getBalance()

Gets the account's balance

  • Type

    interface BitcoinApi {
      getBalance(): Promise<number>;
    }

bitcoinApi.getFee()

Gets fee

  • Type

    interface BitcoinApi {
      getFee(): number;
    }

bitcoinApi.getFeeRate()

Gets fee rate

  • Type

    interface BitcoinApi {
      getFeeRate(): Promise<number>;
    }

bitcoinApi.getHeight()

Gets bitcoin height

  • Type

    interface BitcoinApi {
      getHeight(): Promise<number>;
    }

bitcoinApi.getTransaction()

Gets transaction by the specified id

  • Type

    interface BitcoinApi {
      getTransaction(transactionId: string): BitcoinBaseTransaction;
    }
  • References

    BitcoinBaseTransaction

bitcoinApi.getTransactions()

Gets list of transactions by specified filters

  • Type

    interface BitcoinApi {
      getTransactions(options: any): BitcoinBaseTransaction[];
    }
  • References

    BitcoinBaseTransaction

bitcoinApi.getUnspents()

Gets unspents

  • Type

    interface BitcoinApi {
      getUnspents(address: string): Promise<BitcoinUnspents>;
    }
    
    interface BitcoinUnspents {
      amount: number;
      txid: string;
      vout: { address: string; value: number }[];
    }

bitcoinApi.sendTransaction()

Sends a signed transaction

  • Type

    interface BitcoinApi {
      sendTransaction(signedTx: any): Promise<any>;
    }