Struct fuels_signers::provider::Provider
source · pub struct Provider {
pub client: FuelClient,
}
Expand description
Encapsulates common client operations in the SDK.
Note that you may also use client
, which is an instance
of FuelClient
, directly, which provides a broader API.
Fields§
§client: FuelClient
Implementations§
source§impl Provider
impl Provider
pub fn new(client: FuelClient) -> Self
sourcepub async fn send_transaction<T: Transaction + Clone>(
&self,
tx: &T
) -> Result<Vec<Receipt>>
pub async fn send_transaction<T: Transaction + Clone>( &self, tx: &T ) -> Result<Vec<Receipt>>
Sends a transaction to the underlying Provider’s client.
sourcepub async fn connect(url: impl AsRef<str>) -> Result<Provider>
pub async fn connect(url: impl AsRef<str>) -> Result<Provider>
Connects to an existing node at the given address.
pub async fn chain_info(&self) -> Result<ChainInfo, ProviderError>
pub async fn consensus_parameters( &self ) -> Result<ConsensusParameters, ProviderError>
pub async fn node_info(&self) -> Result<NodeInfo, ProviderError>
pub async fn dry_run<T: Transaction + Clone>( &self, tx: &T ) -> Result<Vec<Receipt>>
pub async fn dry_run_no_validation<T: Transaction + Clone>( &self, tx: &T ) -> Result<Vec<Receipt>>
sourcepub async fn get_coins(
&self,
from: &Bech32Address,
asset_id: AssetId
) -> Result<Vec<Coin>, ProviderError>
pub async fn get_coins( &self, from: &Bech32Address, asset_id: AssetId ) -> Result<Vec<Coin>, ProviderError>
Gets all unspent coins owned by address from
, with asset ID asset_id
.
sourcepub async fn get_spendable_resources(
&self,
filter: ResourceFilter
) -> Result<Vec<Resource>, ProviderError>
pub async fn get_spendable_resources( &self, filter: ResourceFilter ) -> Result<Vec<Resource>, ProviderError>
Get some spendable coins of asset asset_id
for address from
that add up at least to
amount amount
. The returned coins (UTXOs) are actual coins that can be spent. The number
of coins (UXTOs) is optimized to prevent dust accumulation.
sourcepub async fn get_asset_inputs(
&self,
filter: ResourceFilter,
witness_index: u8
) -> Result<Vec<Input>>
pub async fn get_asset_inputs( &self, filter: ResourceFilter, witness_index: u8 ) -> Result<Vec<Input>>
Returns a vector consisting of Input::Coin
s and Input::Message
s for the given
ResourceFilter
. The witness_index
is the position of the witness (signature)
in the transaction’s list of witnesses. In the validation process, the node will
use the witness at this index to validate the coins returned by this method.
sourcepub async fn get_asset_balance(
&self,
address: &Bech32Address,
asset_id: AssetId
) -> Result<u64, ProviderError>
pub async fn get_asset_balance( &self, address: &Bech32Address, asset_id: AssetId ) -> Result<u64, ProviderError>
Get the balance of all spendable coins asset_id
for address address
. This is different
from getting coins because we are just returning a number (the sum of UTXOs amount) instead
of the UTXOs.
sourcepub async fn get_contract_asset_balance(
&self,
contract_id: &Bech32ContractId,
asset_id: AssetId
) -> Result<u64, ProviderError>
pub async fn get_contract_asset_balance( &self, contract_id: &Bech32ContractId, asset_id: AssetId ) -> Result<u64, ProviderError>
Get the balance of all spendable coins asset_id
for contract with id contract_id
.
sourcepub async fn get_balances(
&self,
address: &Bech32Address
) -> Result<HashMap<String, u64>, ProviderError>
pub async fn get_balances( &self, address: &Bech32Address ) -> Result<HashMap<String, u64>, ProviderError>
Get all the spendable balances of all assets for address address
. This is different from
getting the coins because we are only returning the numbers (the sum of UTXOs coins amount
for each asset id) and not the UTXOs coins themselves
sourcepub async fn get_contract_balances(
&self,
contract_id: &Bech32ContractId
) -> Result<HashMap<String, u64>, ProviderError>
pub async fn get_contract_balances( &self, contract_id: &Bech32ContractId ) -> Result<HashMap<String, u64>, ProviderError>
Get all balances of all assets for the contract with id contract_id
.
pub async fn get_transaction_by_id( &self, tx_id: &str ) -> Result<Option<TransactionResponse>, ProviderError>
pub async fn get_transactions( &self, request: PaginationRequest<String> ) -> Result<PaginatedResult<TransactionResponse, String>, ProviderError>
pub async fn get_transactions_by_owner( &self, owner: &Bech32Address, request: PaginationRequest<String> ) -> Result<PaginatedResult<TransactionResponse, String>, ProviderError>
pub async fn latest_block_height(&self) -> Result<u64, ProviderError>
pub async fn latest_block_time( &self ) -> Result<Option<DateTime<Utc>>, ProviderError>
pub async fn produce_blocks( &self, amount: u64, time: Option<TimeParameters> ) -> Result<u64>
sourcepub async fn block(
&self,
block_id: &str
) -> Result<Option<Block>, ProviderError>
pub async fn block( &self, block_id: &str ) -> Result<Option<Block>, ProviderError>
Get block by id.
pub async fn get_blocks( &self, request: PaginationRequest<String> ) -> Result<PaginatedResult<Block, String>, ProviderError>
pub async fn estimate_transaction_cost<T: Transaction + Clone>( &self, tx: &T, tolerance: Option<f64> ) -> Result<TransactionCost>
pub async fn get_messages( &self, from: &Bech32Address ) -> Result<Vec<Message>, ProviderError>
pub async fn get_message_proof( &self, tx_id: &str, message_id: &str ) -> Result<Option<MessageProof>, ProviderError>
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Provider
impl Send for Provider
impl Sync for Provider
impl Unpin for Provider
impl UnwindSafe for Provider
Blanket Implementations§
source§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
source§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Any
.