Struct flow_rust_sdk::FlowConnection
source · [−]pub struct FlowConnection<T> {
pub client: AccessApiClient<T>,
}
Expand description
The FlowConnection object contains a single API connection.
The network transport layer can be optionally substitued by implementing a new FlowConnection
Fields
client: AccessApiClient<T>
Implementations
sourceimpl FlowConnection<Channel>
impl FlowConnection<Channel>
The default implementation of a FlowConnection, using tonic::transport::Channel
sourcepub async fn new(
network_address: &str
) -> Result<FlowConnection<Channel>, Box<dyn Error>>
pub async fn new(
network_address: &str
) -> Result<FlowConnection<Channel>, Box<dyn Error>>
Initializes a new connection and checks the availability of the node at the provided address
sourcepub async fn get_account(
&mut self,
account_address: &str
) -> Result<AccountResponse, Box<dyn Error>>
pub async fn get_account(
&mut self,
account_address: &str
) -> Result<AccountResponse, Box<dyn Error>>
get_account will return the flow::AccountResponse
of account_address
, else an error if it could not be accessed.
sourcepub async fn execute_script(
&mut self,
script: Vec<u8>,
arguments: Vec<Vec<u8>>,
block_height: Option<u64>,
block_id: Option<Vec<u8>>
) -> Result<ExecuteScriptResponse, Box<dyn Error>>
pub async fn execute_script(
&mut self,
script: Vec<u8>,
arguments: Vec<Vec<u8>>,
block_height: Option<u64>,
block_id: Option<Vec<u8>>
) -> Result<ExecuteScriptResponse, Box<dyn Error>>
execute_script will attempt to run the provided script (as bytes) and return the flow::ExecuteScriptResponse
or Error
sourcepub async fn send_transaction(
&mut self,
transaction: Option<Transaction>
) -> Result<SendTransactionResponse, Box<dyn Error>>
pub async fn send_transaction(
&mut self,
transaction: Option<Transaction>
) -> Result<SendTransactionResponse, Box<dyn Error>>
Sends the transaction to the blockchain. Make sure you signed the transactionsign_transaction first.
sourcepub async fn get_transaction_result(
&mut self,
id: Vec<u8>
) -> Result<TransactionResultResponse, Box<dyn Error>>
pub async fn get_transaction_result(
&mut self,
id: Vec<u8>
) -> Result<TransactionResultResponse, Box<dyn Error>>
get transaction result
sourcepub async fn get_block(
&mut self,
block_id: Option<String>,
block_height: Option<u64>,
is_sealed: Option<bool>
) -> Result<BlockResponse, Box<dyn Error>>
pub async fn get_block(
&mut self,
block_id: Option<String>,
block_height: Option<u64>,
is_sealed: Option<bool>
) -> Result<BlockResponse, Box<dyn Error>>
get_block accepts either the block_id or block_height. If neither are defined it returns the latest block.
sourcepub async fn get_events_for_height_range(
&mut self,
event_type: &str,
start_height: u64,
end_height: u64
) -> Result<EventsResponse, Box<dyn Error>>
pub async fn get_events_for_height_range(
&mut self,
event_type: &str,
start_height: u64,
end_height: u64
) -> Result<EventsResponse, Box<dyn Error>>
retrieve the specified events by type for the given height range
sourcepub async fn get_events_for_block_ids(
&mut self,
event_type: &str,
ids: Vec<Vec<u8>>
) -> Result<EventsResponse, Box<dyn Error>>
pub async fn get_events_for_block_ids(
&mut self,
event_type: &str,
ids: Vec<Vec<u8>>
) -> Result<EventsResponse, Box<dyn Error>>
retrieve the specified events by type for the given blocks
sourcepub async fn get_collection(
&mut self,
collection_id: Vec<u8>
) -> Result<CollectionResponse, Box<dyn Error>>
pub async fn get_collection(
&mut self,
collection_id: Vec<u8>
) -> Result<CollectionResponse, Box<dyn Error>>
retrieve the specified collections
sourcepub async fn create_account(
&mut self,
account_keys: Vec<String>,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<Account, Box<dyn Error>>
pub async fn create_account(
&mut self,
account_keys: Vec<String>,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<Account, Box<dyn Error>>
Create an account with the given account_keys
and payer
sourcepub async fn add_key(
&mut self,
public_key_to_add: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
pub async fn add_key(
&mut self,
public_key_to_add: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
add a key
sourcepub async fn remove_key(
&mut self,
key_to_remove: u64,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
pub async fn remove_key(
&mut self,
key_to_remove: u64,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
remove a key
sourcepub async fn add_contract(
&mut self,
contract_name: &str,
contract_code: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
pub async fn add_contract(
&mut self,
contract_name: &str,
contract_code: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
add a contract
sourcepub async fn update_contract(
&mut self,
contract_name: &str,
contract_code: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
pub async fn update_contract(
&mut self,
contract_name: &str,
contract_code: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
update a contract
sourcepub async fn remove_contract(
&mut self,
contract_name: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
pub async fn remove_contract(
&mut self,
contract_name: &str,
payer: &str,
payer_private_key: &str,
key_id: u32
) -> Result<SendTransactionResponse, Box<dyn Error>>
remove a contract
Auto Trait Implementations
impl<T> RefUnwindSafe for FlowConnection<T> where
T: RefUnwindSafe,
impl<T> Send for FlowConnection<T> where
T: Send,
impl<T> Sync for FlowConnection<T> where
T: Sync,
impl<T> Unpin for FlowConnection<T> where
T: Unpin,
impl<T> UnwindSafe for FlowConnection<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more