pub struct Contract {}Implementations§
Source§impl Contract
impl Contract
Sourcepub async fn read(
client: Arc<Aptos>,
contract_call: &ContractCall,
) -> Result<ContractReadResult, String>
pub async fn read( client: Arc<Aptos>, contract_call: &ContractCall, ) -> Result<ContractReadResult, String>
read contract data (view read)
Sourcepub async fn write(
client: Arc<Aptos>,
wallet: Arc<Wallet>,
contract_call: ContractCall,
) -> Result<ContractWriteResult, String>
pub async fn write( client: Arc<Aptos>, wallet: Arc<Wallet>, contract_call: ContractCall, ) -> Result<ContractWriteResult, String>
write contract
Sourcepub async fn batch_read(
client: Arc<Aptos>,
calls: Vec<ContractCall>,
) -> Result<Vec<ContractReadResult>, String>
pub async fn batch_read( client: Arc<Aptos>, calls: Vec<ContractCall>, ) -> Result<Vec<ContractReadResult>, String>
batch read
Sourcepub async fn listen_events(
client: Arc<Aptos>,
address: &str,
event_type: &str,
callback: impl Fn(Result<Value, String>),
interval_secs: u64,
) -> Result<(), ()>
pub async fn listen_events( client: Arc<Aptos>, address: &str, event_type: &str, callback: impl Fn(Result<Value, String>), interval_secs: u64, ) -> Result<(), ()>
listen contract events
Sourcepub async fn listen_events_all_info(
client: Arc<Aptos>,
address: &str,
event_type: &str,
callback: impl Fn(Result<Event, String>),
interval_secs: u64,
) -> Result<(), ()>
pub async fn listen_events_all_info( client: Arc<Aptos>, address: &str, event_type: &str, callback: impl Fn(Result<Event, String>), interval_secs: u64, ) -> Result<(), ()>
Event Listener - contains complete event information
Sourcepub async fn get_contract_resource(
client: Arc<Aptos>,
address: &str,
resource_type: &str,
) -> Result<Option<Value>, String>
pub async fn get_contract_resource( client: Arc<Aptos>, address: &str, resource_type: &str, ) -> Result<Option<Value>, String>
get contract resource
Sourcepub async fn get_contract_state_snapshot(
client: Arc<Aptos>,
address: &str,
resource_types: Vec<&str>,
) -> Result<HashMap<String, Option<Value>>, String>
pub async fn get_contract_state_snapshot( client: Arc<Aptos>, address: &str, resource_types: Vec<&str>, ) -> Result<HashMap<String, Option<Value>>, String>
Get contract status snapshot
Sourcepub fn validate_contract_call(
contract_call: &ContractCall,
) -> Result<(), String>
pub fn validate_contract_call( contract_call: &ContractCall, ) -> Result<(), String>
Verify contract call parameters
Sourcepub async fn estimate_gas_cost(
client: Arc<Aptos>,
wallet: Arc<Wallet>,
contract_call: &ContractCall,
) -> Result<u64, String>
pub async fn estimate_gas_cost( client: Arc<Aptos>, wallet: Arc<Wallet>, contract_call: &ContractCall, ) -> Result<u64, String>
Estimating contract call gas fees
Sourcepub async fn retry_failed_call(
client: Arc<Aptos>,
wallet: Arc<Wallet>,
contract_call: ContractCall,
max_retries: u32,
retry_delay_secs: u64,
) -> Result<ContractWriteResult, String>
pub async fn retry_failed_call( client: Arc<Aptos>, wallet: Arc<Wallet>, contract_call: ContractCall, max_retries: u32, retry_delay_secs: u64, ) -> Result<ContractWriteResult, String>
Retry failed contract calls
Sourcepub async fn batch_get_resources(
client: Arc<Aptos>,
address: &str,
resource_types: Vec<&str>,
) -> Result<HashMap<String, Option<Value>>, String>
pub async fn batch_get_resources( client: Arc<Aptos>, address: &str, resource_types: Vec<&str>, ) -> Result<HashMap<String, Option<Value>>, String>
Batch resource query
Sourcepub async fn batch_write(
client: Arc<Aptos>,
wallet: Arc<Wallet>,
calls: Vec<ContractCall>,
) -> Result<Vec<Value>, String>
pub async fn batch_write( client: Arc<Aptos>, wallet: Arc<Wallet>, calls: Vec<ContractCall>, ) -> Result<Vec<Value>, String>
Batch call contract write function
Sourcepub async fn simulate_call_contract(
client: Arc<Aptos>,
wallet: Arc<Wallet>,
contract_call: &ContractCall,
) -> Result<Value, String>
pub async fn simulate_call_contract( client: Arc<Aptos>, wallet: Arc<Wallet>, contract_call: &ContractCall, ) -> Result<Value, String>
Simulate contract call execution (estimate Gas)
Sourcepub async fn get_contract_abi(
client: Arc<Aptos>,
module_address: &str,
module_name: &str,
) -> Result<Option<Value>, String>
pub async fn get_contract_abi( client: Arc<Aptos>, module_address: &str, module_name: &str, ) -> Result<Option<Value>, String>
Get the ABI information of the contract
Sourcepub async fn is_contract_deployed(
client: Arc<Aptos>,
module_address: &str,
module_name: &str,
) -> Result<bool, String>
pub async fn is_contract_deployed( client: Arc<Aptos>, module_address: &str, module_name: &str, ) -> Result<bool, String>
Check if the contract has been published
Sourcepub async fn get_contract_events(
client: Arc<Aptos>,
address: &str,
event_handle: &str,
limit: Option<u64>,
start: Option<u64>,
) -> Result<Vec<Value>, String>
pub async fn get_contract_events( client: Arc<Aptos>, address: &str, event_handle: &str, limit: Option<u64>, start: Option<u64>, ) -> Result<Vec<Value>, String>
Get contract event list
Sourcepub fn parse_complex_type_arguments(type_args: Vec<&str>) -> Vec<String>
pub fn parse_complex_type_arguments(type_args: Vec<&str>) -> Vec<String>
Parsing complex type parameters
Sourcepub fn build_complex_arguments(args: Vec<&str>) -> Vec<Value>
pub fn build_complex_arguments(args: Vec<&str>) -> Vec<Value>
Constructing complex call parameters
Sourcepub fn analyze_contract_result(result: &Value) -> HashMap<String, String>
pub fn analyze_contract_result(result: &Value) -> HashMap<String, String>
Contract call result analyzer
Auto Trait Implementations§
impl Freeze for Contract
impl RefUnwindSafe for Contract
impl Send for Contract
impl Sync for Contract
impl Unpin for Contract
impl UnwindSafe for Contract
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more