bsv_rpc v1.0.0-alpha3 BsvRpc View Source

Documentation for BsvRpc.

Link to this section Summary

Functions

Broadcasts a signed transaction to the network.

Gets addresses for the default account.

Gets addresses for the account.

Gets server's total balance.

Returns node state info.

Returns node memory usage info.

Gets new address for the default account.

Gets new address.

Gets a transaction.

Gets wallet unconfirmed balance.

Gets the wallet info.

Signs a transaction and returns the signed transaction.

Stops the node.

Returns the node uptime info.

Link to this section Functions

Link to this function

broadcast_transaction(transaction)

View Source
broadcast_transaction(BsvRpc.Transaction.t()) ::
  {:ok, String.t()} | {:error, String.t()}

Broadcasts a signed transaction to the network.

Link to this function

get_addresses()

View Source
get_addresses() :: {:ok, [BsvRpc.Address.t()]} | {:error, String.t()}

Gets addresses for the default account.

Link to this function

get_addresses_by_account(account)

View Source
get_addresses_by_account(String.t()) ::
  {:ok, [BsvRpc.Address.t()]} | {:error, String.t()}

Gets addresses for the account.

Args:

  • account - The account name to get addresses for.
Link to this function

get_balance()

View Source
get_balance() :: {:ok, float()} | {:error, String.t()}

Gets server's total balance.

Link to this function

get_balance(account, minconf, include_watchonly)

View Source
get_balance(String.t(), integer(), boolean()) ::
  {:ok, float()} | {:error, String.t()}

Gets wallet balance.

Args:

  • account - The account name to get balance for.
  • minconf - Only include transactions with at least this many transactions.
  • include_watchonly - Also include balance in watch-only addresses.
Link to this function

get_info()

View Source
get_info() :: {:ok, map()} | {:error, String.t()}

Returns node state info.

Link to this function

get_memory_info()

View Source
get_memory_info() :: {:ok, map()} | {:error, String.t()}

Returns node memory usage info.

Link to this function

get_new_address()

View Source
get_new_address() :: {:ok, BsvRpc.Address.t()} | {:error, String.t()}

Gets new address for the default account.

Link to this function

get_new_address(account)

View Source
get_new_address(String.t()) :: {:ok, BsvRpc.Address.t()} | {:error, String.t()}

Gets new address.

Args:

  • account - (Deprecated, Optional) The account name to get address for.
Link to this function

get_transaction(hash)

View Source
get_transaction(String.t()) ::
  {:ok,
   %BsvRpc.Transaction{
     block: term(),
     confirmations: term(),
     hash: term(),
     inputs: term(),
     locktime: term(),
     outputs: term(),
     size: term(),
     time: term(),
     version: term()
   }}
  | {:error, String.t()}

Gets a transaction.

Link to this function

get_unconfirmed_balance()

View Source
get_unconfirmed_balance() :: {:ok, float()} | {:error, String.t()}

Gets wallet unconfirmed balance.

Link to this function

get_wallet_info()

View Source
get_wallet_info() :: {:ok, map()} | {:error, String.t()}

Gets the wallet info.

Link to this function

list_accounts(minconf \\ 1, include_watchonly \\ false)

View Source
list_accounts(integer(), boolean()) :: {:ok, map()} | {:error, String.t()}

Lists wallet accounts.

Args:

  • minconf - (Optional) Only include transactions with at least this many transactions.
  • include_watchonly - (Optional) Include watch-only addreses.
Link to this function

list_unspent(addresses, min_confirmations \\ 1, max_confirmations \\ 9999999, include_unsafe \\ true)

View Source
list_unspent(
  [%BsvRpc.Address{address: term(), network: term(), type: term()}],
  non_neg_integer(),
  non_neg_integer(),
  bool()
) ::
  {:ok,
   [
     %BsvRpc.UTXO{
       output: term(),
       script_pubkey: term(),
       transaction: term(),
       value: term()
     }
   ]}
  | {:error, String.t()}

Lists unspent transaction outputs (UTXOs) for addresses.

Arguments

  • addresses - List of addresses to get UTXOs for.
  • min_confirmations - Optional number of minimum confirmations (default: 1).
  • max_confirmations - Optional number of maximum confirmations (default: 9_999_999).
  • include_unsafe - Optional flag to include/exclude unsafe UTXOs (default: true).
Link to this function

sign_transaction(transaction)

View Source
sign_transaction(%BsvRpc.Transaction{
  block: term(),
  confirmations: term(),
  hash: term(),
  inputs: term(),
  locktime: term(),
  outputs: term(),
  size: term(),
  time: term(),
  version: term()
}) ::
  {:ok,
   %BsvRpc.Transaction{
     block: term(),
     confirmations: term(),
     hash: term(),
     inputs: term(),
     locktime: term(),
     outputs: term(),
     size: term(),
     time: term(),
     version: term()
   }}
  | {:error, String.t()}

Signs a transaction and returns the signed transaction.

Link to this function

stop()

View Source
stop() :: {:ok, String.t()} | {:error, String.t()}

Stops the node.

Link to this function

uptime()

View Source
uptime() :: {:ok, integer()} | {:error, String.t()}

Returns the node uptime info.