Skip to main content

Client

Struct Client 

Source
pub struct Client(pub Client);
Expand description

A Liquid RPC client.

This type implements both the bitcoincore_rpc::RpcApi trait as the [liquid_rpc::LiquidRpcApi] trait. Methods that are shared between Liquid and Bitcoin Core can be used from the former and changed or new methods are provided by the latter.

Tuple Fields§

§0: Client

Implementations§

Source§

impl Client

Source

pub fn new(url: String, auth: Auth) -> Result<Self>

Creates a client to a liquidd JSON-RPC server.

Source

pub fn from_jsonrpc(client: Client) -> Self

Create a new Client.

Trait Implementations§

Source§

impl LiquidRpcApi for Client

Source§

fn call<T: for<'a> Deserialize<'a>>( &self, cmd: &str, args: &[Value], ) -> Result<T>

Source§

fn get_block_header_raw(&self, hash: &Hash) -> Result<BlockHeader>

Source§

fn get_block_header_verbose(&self, hash: &Hash) -> Result<GetBlockHeaderResult>

Source§

fn get_blockchain_info(&self) -> Result<GetBlockchainInfoResult>

Returns a data structure containing various state info regarding blockchain processing.
Source§

fn get_raw_transaction( &self, txid: &Hash, block_hash: Option<&Hash>, ) -> Result<Transaction>

Source§

fn get_raw_transaction_verbose( &self, txid: &Hash, block_hash: Option<&Hash>, ) -> Result<GetRawTransactionResult>

Source§

fn send_to_address( &self, address: &str, amount: f64, comment: Option<&str>, comment_to: Option<&str>, substract_fee: Option<bool>, replaceable: Option<bool>, confirmation_target: Option<u32>, estimate_mode: Option<EstimateMode>, asset_label: Option<&str>, ignore_blind_fail: Option<bool>, ) -> Result<Hash>

Source§

fn create_raw_transaction_hex( &self, utxos: &[CreateRawTransactionInput], outs: &HashMap<String, f64>, locktime: Option<i64>, replaceable: Option<bool>, assets: Option<&HashMap<String, AssetId>>, ) -> Result<String>

Source§

fn create_raw_transaction( &self, utxos: &[CreateRawTransactionInput], outs: &HashMap<String, f64>, locktime: Option<i64>, replaceable: Option<bool>, assets: Option<&HashMap<String, AssetId>>, ) -> Result<Transaction>

Source§

fn fund_raw_transaction<R: RawTx>( &self, tx: R, options: Option<&FundRawTransactionOptions>, is_witness: Option<bool>, ) -> Result<FundRawTransactionResult>

Source§

fn sign_raw_transaction_with_wallet<R: RawTx>( &self, tx: R, utxos: Option<&[SignRawTransactionInput]>, sighash_type: Option<SigHashType>, ) -> Result<SignRawTransactionResult>

Source§

fn sign_raw_transaction_with_key<R: RawTx>( &self, tx: R, privkeys: &[PrivateKey], prevtxs: Option<&[SignRawTransactionInput]>, sighash_type: Option<SigHashType>, ) -> Result<SignRawTransactionResult>

We use bitcoin::PrivateKey because the keys need to be WIF-encoded. Use bitcoin::Network::Bitcoin for Liquid and bitcoin::Network::Regtest for Elements Regtest.
Source§

fn send_raw_transaction<R: RawTx>(&self, tx: R) -> Result<Hash>

Source§

fn list_unspent( &self, minconf: Option<usize>, maxconf: Option<usize>, addresses: Option<&[&str]>, include_unsafe: Option<bool>, query_options: Option<&ListUnspentQueryOptions>, ) -> Result<Vec<ListUnspentResultEntry>>

Source§

fn list_transactions( &self, count: Option<usize>, skip: Option<usize>, include_watch_only: Option<bool>, ) -> Result<Vec<ListTransactionsResultEntry>>

Source§

fn list_since_block( &self, block_hash: Option<&Hash>, target_confirmations: Option<u32>, include_watch_only: Option<bool>, include_removed: Option<bool>, ) -> Result<ListSinceBlockResult>

Source§

fn get_new_address( &self, label: Option<&str>, address_type: Option<AddressType>, ) -> Result<String>

Source§

fn get_raw_change_address( &self, address_type: Option<AddressType>, ) -> Result<String>

Source§

fn validate_address(&self, address: &str) -> Result<ValidateAddressResult>

Source§

fn get_address_info(&self, address: &str) -> Result<GetAddressInfoResult>

Source§

fn get_tx_out( &self, txid: &Hash, vout: u32, include_mempool: Option<bool>, ) -> Result<Option<GetTxOutResult>>

Source§

fn get_balance( &self, min_confirmations: Option<u32>, include_watch_only: Option<bool>, ) -> Result<HashMap<String, Amount>>

Source§

fn get_balance_asset( &self, asset_label: &str, min_confirmations: Option<u32>, include_watch_only: Option<bool>, ) -> Result<Amount>

Source§

fn get_unconfirmed_balance(&self) -> Result<HashMap<String, Amount>>

Source§

fn get_received_by_address( &self, address: &str, min_confirmations: Option<u32>, ) -> Result<HashMap<String, Amount>>

Source§

fn get_received_by_address_asset( &self, address: &str, asset_label: &str, min_confirmations: Option<u32>, ) -> Result<Amount>

Source§

fn get_sidechain_info(&self) -> Result<GetSidechainInfoResult>

Source§

fn get_pegin_address(&self) -> Result<GetPeginAddressResult>

Source§

fn create_raw_pegin<R: RawTx, B: AsRef<[u8]>>( &self, raw_bitcoin_tx: R, txout_proof: B, claim_script: Option<&Script>, ) -> Result<CreateRawPeginResult>

Source§

fn claim_pegin<R: RawTx, B: AsRef<[u8]>>( &self, raw_bitcoin_tx: R, txout_proof: B, claim_script: Option<&Script>, ) -> Result<Hash>

Source§

fn init_pegout_wallet( &self, bitcoin_descriptor: &ExtendedPubKey, bip32_counter: Option<ChildNumber>, liquid_pak: Option<&str>, ) -> Result<InitPegoutWalletResult>

Source§

fn send_to_main_chain( &self, amount: Amount, subtract_fee_from_amount: Option<bool>, ) -> Result<SendToMainChainResult>

Source§

fn get_wallet_pak_info(&self) -> Result<GetWalletPakInfoResult>

Source§

fn get_pak_info(&self) -> Result<GetPakInfoResult>

Source§

fn tweak_fedpeg_script( &self, claim_script: &Script, ) -> Result<TweakFedpegScriptResult>

Source§

fn list_issuances( &self, asset: Option<AssetId>, ) -> Result<Vec<ListIssuancesResult>>

Source§

fn issue_asset( &self, asset_amount: Amount, token_amount: Amount, blind: Option<bool>, ) -> Result<IssueAssetResult>

Source§

fn reissue_asset( &self, asset: AssetId, asset_amount: Amount, ) -> Result<ReissueAssetResult>

Source§

fn raw_issue_asset<R: RawTx>( &self, raw_tx: R, issuances: &[RawIssuanceDetails], ) -> Result<IssueAssetResult>

Source§

fn raw_reissue_asset<R: RawTx>( &self, raw_tx: R, issuances: &[RawReissuanceDetails], ) -> Result<RawReissueAssetResult>

Source§

fn dump_asset_labels(&self) -> Result<HashMap<String, AssetId>>

Source§

fn destroy_amount( &self, asset: AssetId, amount: Amount, comment: Option<&str>, ) -> Result<Hash>

Source§

fn blind_raw_transaction<R: RawTx, B: AsRef<[u8]>>( &self, raw_tx: R, ignore_blind_fail: Option<bool>, asset_commitments: Option<&[B]>, blind_issuances: Option<bool>, ) -> Result<Transaction>

Source§

fn unblind_raw_transaction<R: RawTx>( &self, raw_tx: R, ) -> Result<UnblindRawTransactionResult>

Source§

fn raw_blind_raw_transaction<R: RawTx, B: AsRef<[u8]>>( &self, raw_tx: R, input_amount_blinding_factors: &[B], input_amounts: &[Amount], input_assets: &[AssetId], input_asset_blinding_factors: &[B], ignore_blind_fail: Option<bool>, ) -> Result<Transaction>

Source§

fn create_blinded_address( &self, address: &str, blinding_pubkey: &PublicKey, ) -> Result<String>

Source§

fn dump_blinding_key(&self, address: &str) -> Result<SecretKey>

Source§

fn import_blinding_key( &self, address: &str, blinding_key: &SecretKey, ) -> Result<()>

Source§

fn dump_master_blinding_key(&self) -> Result<SecretKey>

Source§

fn import_master_blinding_key( &self, master_blinding_key: &SecretKey, ) -> Result<()>

Source§

fn dump_issuance_blinding_key(&self, txid: &Hash, vin: u32) -> Result<SecretKey>

Source§

fn import_issuance_blinding_key( &self, txid: &Hash, vin: u32, blinding_key: &SecretKey, ) -> Result<()>

Source§

fn get_new_block(&self, min_tx_age_secs: Option<usize>) -> Result<Block>

Source§

fn sign_block(&self, block: &Block) -> Result<Vec<SignedBlockSignature>>

Source§

fn combine_block_signatures( &self, block: &Block, signatures: &[SignedBlockSignature], ) -> Result<CombineBlockSigsResult>

Source§

fn test_proposed_block( &self, block: &Block, accept_non_standard: Option<bool>, ) -> Result<()>

Source§

fn submit_block(&self, block: &Block) -> Result<String>

Source§

impl RpcApi for Client

Source§

fn call<T: for<'a> Deserialize<'a>>( &self, cmd: &str, args: &[Value], ) -> Result<T>

Call a cmd rpc with given args list
Source§

fn get_by_id<T>(&self, id: &<T as Queryable<Self>>::Id) -> Result<T, Error>
where T: Queryable<Self>,

Query an object implementing Querable type
Source§

fn get_network_info(&self) -> Result<GetNetworkInfoResult, Error>

Source§

fn version(&self) -> Result<usize, Error>

Source§

fn add_multisig_address( &self, nrequired: usize, keys: &[PubKeyOrAddress<'_>], label: Option<&str>, address_type: Option<AddressType>, ) -> Result<AddMultiSigAddressResult, Error>

Source§

fn load_wallet(&self, wallet: &str) -> Result<LoadWalletResult, Error>

Source§

fn unload_wallet(&self, wallet: Option<&str>) -> Result<(), Error>

Source§

fn create_wallet( &self, wallet: &str, disable_private_keys: Option<bool>, ) -> Result<LoadWalletResult, Error>

Source§

fn backup_wallet(&self, destination: Option<&str>) -> Result<(), Error>

Source§

fn dump_private_key(&self, address: &Address) -> Result<PrivateKey, Error>

Source§

fn encrypt_wallet(&self, passphrase: &str) -> Result<(), Error>

Source§

fn get_difficulty(&self) -> Result<f64, Error>

Source§

fn get_connection_count(&self) -> Result<usize, Error>

Source§

fn get_block(&self, hash: &BlockHash) -> Result<Block, Error>

Source§

fn get_block_hex(&self, hash: &BlockHash) -> Result<String, Error>

Source§

fn get_block_info(&self, hash: &BlockHash) -> Result<GetBlockResult, Error>

Source§

fn get_block_header(&self, hash: &BlockHash) -> Result<BlockHeader, Error>

Source§

fn get_block_header_info( &self, hash: &BlockHash, ) -> Result<GetBlockHeaderResult, Error>

Source§

fn get_mining_info(&self) -> Result<GetMiningInfoResult, Error>

Source§

fn get_blockchain_info(&self) -> Result<GetBlockchainInfoResult, Error>

Returns a data structure containing various state info regarding blockchain processing.
Source§

fn get_block_count(&self) -> Result<u64, Error>

Returns the numbers of block in the longest chain.
Source§

fn get_best_block_hash(&self) -> Result<BlockHash, Error>

Returns the hash of the best (tip) block in the longest blockchain.
Source§

fn get_block_hash(&self, height: u64) -> Result<BlockHash, Error>

Get block hash at a given height
Source§

fn get_raw_transaction( &self, txid: &Txid, block_hash: Option<&BlockHash>, ) -> Result<Transaction, Error>

Source§

fn get_raw_transaction_hex( &self, txid: &Txid, block_hash: Option<&BlockHash>, ) -> Result<String, Error>

Source§

fn get_raw_transaction_info( &self, txid: &Txid, block_hash: Option<&BlockHash>, ) -> Result<GetRawTransactionResult, Error>

Source§

fn get_block_filter( &self, block_hash: &BlockHash, ) -> Result<GetBlockFilterResult, Error>

Source§

fn get_balance( &self, minconf: Option<usize>, include_watchonly: Option<bool>, ) -> Result<Amount, Error>

Source§

fn get_received_by_address( &self, address: &Address, minconf: Option<u32>, ) -> Result<Amount, Error>

Source§

fn get_transaction( &self, txid: &Txid, include_watchonly: Option<bool>, ) -> Result<GetTransactionResult, Error>

Source§

fn list_transactions( &self, label: Option<&str>, count: Option<usize>, skip: Option<usize>, include_watchonly: Option<bool>, ) -> Result<Vec<ListTransactionResult>, Error>

Source§

fn get_tx_out( &self, txid: &Txid, vout: u32, include_mempool: Option<bool>, ) -> Result<Option<GetTxOutResult>, Error>

Source§

fn get_tx_out_proof( &self, txids: &[Txid], block_hash: Option<&BlockHash>, ) -> Result<Vec<u8>, Error>

Source§

fn import_public_key( &self, pubkey: &PublicKey, label: Option<&str>, rescan: Option<bool>, ) -> Result<(), Error>

Source§

fn import_private_key( &self, privkey: &PrivateKey, label: Option<&str>, rescan: Option<bool>, ) -> Result<(), Error>

Source§

fn import_address( &self, address: &Address, label: Option<&str>, rescan: Option<bool>, ) -> Result<(), Error>

Source§

fn import_address_script( &self, script: &Script, label: Option<&str>, rescan: Option<bool>, p2sh: Option<bool>, ) -> Result<(), Error>

Source§

fn import_multi( &self, requests: &[ImportMultiRequest<'_>], options: Option<&ImportMultiOptions>, ) -> Result<Vec<ImportMultiResult>, Error>

Source§

fn set_label(&self, address: &Address, label: &str) -> Result<(), Error>

Source§

fn key_pool_refill(&self, new_size: Option<usize>) -> Result<(), Error>

Source§

fn list_unspent( &self, minconf: Option<usize>, maxconf: Option<usize>, addresses: Option<&[&Address]>, include_unsafe: Option<bool>, query_options: Option<ListUnspentQueryOptions>, ) -> Result<Vec<ListUnspentResultEntry>, Error>

Source§

fn lock_unspent(&self, outputs: &[OutPoint]) -> Result<bool, Error>

To unlock, use [unlock_unspent].
Source§

fn unlock_unspent(&self, outputs: &[OutPoint]) -> Result<bool, Error>

Source§

fn list_received_by_address( &self, address_filter: Option<&Address>, minconf: Option<u32>, include_empty: Option<bool>, include_watchonly: Option<bool>, ) -> Result<Vec<ListReceivedByAddressResult>, Error>

Source§

fn create_raw_transaction_hex( &self, utxos: &[CreateRawTransactionInput], outs: &HashMap<String, Amount>, locktime: Option<i64>, replaceable: Option<bool>, ) -> Result<String, Error>

Source§

fn create_raw_transaction( &self, utxos: &[CreateRawTransactionInput], outs: &HashMap<String, Amount>, locktime: Option<i64>, replaceable: Option<bool>, ) -> Result<Transaction, Error>

Source§

fn fund_raw_transaction<R>( &self, tx: R, options: Option<&FundRawTransactionOptions>, is_witness: Option<bool>, ) -> Result<FundRawTransactionResult, Error>
where R: RawTx,

Source§

fn sign_raw_transaction<R>( &self, tx: R, utxos: Option<&[SignRawTransactionInput]>, private_keys: Option<&[PrivateKey]>, sighash_type: Option<SigHashType>, ) -> Result<SignRawTransactionResult, Error>
where R: RawTx,

👎Deprecated
Source§

fn sign_raw_transaction_with_wallet<R>( &self, tx: R, utxos: Option<&[SignRawTransactionInput]>, sighash_type: Option<SigHashType>, ) -> Result<SignRawTransactionResult, Error>
where R: RawTx,

Source§

fn sign_raw_transaction_with_key<R>( &self, tx: R, privkeys: &[PrivateKey], prevtxs: Option<&[SignRawTransactionInput]>, sighash_type: Option<SigHashType>, ) -> Result<SignRawTransactionResult, Error>
where R: RawTx,

Source§

fn test_mempool_accept<R>( &self, rawtxs: &[R], ) -> Result<Vec<TestMempoolAcceptResult>, Error>
where R: RawTx,

Source§

fn stop(&self) -> Result<String, Error>

Source§

fn verify_message( &self, address: &Address, signature: &Signature, message: &str, ) -> Result<bool, Error>

Source§

fn get_new_address( &self, label: Option<&str>, address_type: Option<AddressType>, ) -> Result<Address, Error>

Generate new address under own control
Source§

fn get_address_info( &self, address: &Address, ) -> Result<GetAddressInfoResult, Error>

Source§

fn generate_to_address( &self, block_num: u64, address: &Address, ) -> Result<Vec<BlockHash>, Error>

Mine block_num blocks and pay coinbase to address Read more
Source§

fn generate( &self, block_num: u64, maxtries: Option<u64>, ) -> Result<Vec<BlockHash>, Error>

Mine up to block_num blocks immediately (before the RPC call returns) to an address in the wallet.
Source§

fn invalidate_block(&self, block_hash: &BlockHash) -> Result<(), Error>

Mark a block as invalid by block_hash
Source§

fn reconsider_block(&self, block_hash: &BlockHash) -> Result<(), Error>

Mark a block as valid by block_hash
Source§

fn get_raw_mempool(&self) -> Result<Vec<Txid>, Error>

Get txids of all transactions in a memory pool
Source§

fn send_to_address( &self, address: &Address, amount: Amount, comment: Option<&str>, comment_to: Option<&str>, subtract_fee: Option<bool>, replaceable: Option<bool>, confirmation_target: Option<u32>, estimate_mode: Option<EstimateMode>, ) -> Result<Txid, Error>

Source§

fn get_peer_info(&self) -> Result<Vec<GetPeerInfoResult>, Error>

Returns data about each connected network node as an array of PeerInfo
Source§

fn ping(&self) -> Result<(), Error>

Requests that a ping be sent to all other nodes, to measure ping time. Read more
Source§

fn send_raw_transaction<R>(&self, tx: R) -> Result<Txid, Error>
where R: RawTx,

Source§

fn estimate_smart_fee( &self, conf_target: u16, estimate_mode: Option<EstimateMode>, ) -> Result<EstimateSmartFeeResult, Error>

Source§

fn wait_for_new_block(&self, timeout: u64) -> Result<BlockRef, Error>

Waits for a specific new block and returns useful info about it. Returns the current block on timeout or exit. Read more
Source§

fn wait_for_block( &self, blockhash: &BlockHash, timeout: u64, ) -> Result<BlockRef, Error>

Waits for a specific new block and returns useful info about it. Returns the current block on timeout or exit. Read more
Source§

fn wallet_create_funded_psbt( &self, inputs: &[CreateRawTransactionInput], outputs: &HashMap<String, Amount>, locktime: Option<i64>, options: Option<WalletCreateFundedPsbtOptions>, bip32derivs: Option<bool>, ) -> Result<WalletCreateFundedPsbtResult, Error>

Source§

fn get_descriptor_info( &self, desc: &str, ) -> Result<GetDescriptorInfoResult, Error>

Source§

fn combine_psbt(&self, psbts: &[String]) -> Result<String, Error>

Source§

fn finalize_psbt( &self, psbt: &str, extract: Option<bool>, ) -> Result<FinalizePsbtResult, Error>

Source§

fn derive_addresses( &self, descriptor: &str, range: Option<[u32; 2]>, ) -> Result<Vec<Address>, Error>

Source§

fn rescan_blockchain( &self, start_from: Option<usize>, stop_height: Option<usize>, ) -> Result<(usize, Option<usize>), Error>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Typeable for T
where T: Any,

Source§

fn get_type(&self) -> TypeId

Get the TypeId of this object.