use std::collections::HashMap;
use crate::contracts::AbiEncode;
use crate::domain::address::TronAddress;
use crate::domain::trx::Trx;
use crate::domain::{self, Hash32};
use crate::Result;
pub mod grpc;
#[cfg(feature = "mock-provider")]
pub mod mock;
#[async_trait::async_trait]
pub trait TronProvider {
async fn trasnfer_contract(
&self,
owner: TronAddress,
to: TronAddress,
amount: Trx,
) -> Result<domain::transaction::TransactionExtention>;
async fn trigger_smart_contract<A: AbiEncode + Send>(
&self,
owner: TronAddress,
contract: TronAddress,
call: A,
) -> Result<domain::transaction::TransactionExtention>;
async fn broadcast_transaction(
&self,
transaction: domain::transaction::Transaction,
) -> Result<()>;
async fn estimate_energy(
&self,
contract: domain::contract::TriggerSmartContract,
) -> Result<i64>;
async fn get_account(
&self,
address: TronAddress,
) -> Result<domain::account::Account>;
async fn get_account_resources(
&self,
address: TronAddress,
) -> Result<domain::account::AccountResourceUsage>;
async fn trigger_constant_contract(
&self,
contract: domain::contract::TriggerSmartContract,
) -> Result<domain::transaction::TransactionExtention>;
async fn get_now_block(&self) -> Result<domain::block::BlockExtention>;
async fn account_permission_update(
&self,
contract: domain::contract::AccountPermissionUpdateContract,
) -> Result<domain::transaction::TransactionExtention>;
async fn get_transaction_by_id(
&self,
txid: Hash32,
) -> Result<domain::transaction::Transaction>;
async fn get_transaction_info(
&self,
txid: Hash32,
) -> Result<domain::transaction::TransactionInfo>;
async fn chain_parameters(&self) -> Result<HashMap<String, i64>>;
async fn freeze_balance(
&self,
contract: domain::contract::FreezeBalanceV2Contract,
) -> Result<domain::transaction::TransactionExtention>;
async fn unfreeze_balance(
&self,
contract: domain::contract::UnfreezeBalanceV2Contract,
) -> Result<domain::transaction::TransactionExtention>;
async fn get_reward(&self, address: TronAddress) -> Result<Trx>;
async fn get_delegated_resource(
&self,
from_address: TronAddress,
to_address: TronAddress,
) -> Result<Vec<domain::account::DelegatedResource>>;
async fn get_delegated_resource_account(
&self,
address: TronAddress,
) -> Result<domain::account::DelegatedResourceAccountIndex>;
}