Skip to content

Commit

Permalink
removed some todo
Browse files Browse the repository at this point in the history
  • Loading branch information
gfusee committed May 29, 2024
1 parent a14683d commit aeef5de
Show file tree
Hide file tree
Showing 7 changed files with 1,266 additions and 12 deletions.
5 changes: 4 additions & 1 deletion executor/src/error/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ pub enum TransactionError {
CannotEncodeString { string: String },
CannotEncodeU64 { value: u64 },
CannotEncodeTransfer,
CannotSerializeTransactionData
CannotSerializeTransactionData,
CannotDecodeBase64,
CannotDecodeTopic,
WrongTopicsCountForSignalErrorEvent
}

impl From<TransactionError> for ExecutorError {
Expand Down
2 changes: 1 addition & 1 deletion executor/src/network/query/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl<Proxy: BlockchainProxy> QueryExecutor for QueryNetworkExecutor<Proxy> {
let sc_address = to.to_bech32_string()?;

let normalized = NormalizationInOut {
sender: sc_address.clone(), // TODO: allow custom sender
sender: sc_address.clone(),
receiver: sc_address,
function_name: Some(function),
arguments,
Expand Down
2 changes: 1 addition & 1 deletion executor/src/network/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl<Client: GatewayClient> TransactionExecutor for BaseSimulationNetworkExecuto
})
.collect();

let mut raw_result = find_smart_contract_result(&Some(scrs))?
let mut raw_result = find_smart_contract_result(&Some(scrs), None)?
.unwrap_or_default();

let Ok(output_managed) = OutputManaged::multi_decode(&mut raw_result) else {
Expand Down
5 changes: 4 additions & 1 deletion executor/src/network/transaction/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ impl<Interactor: BlockchainInteractor> TransactionExecutor for BaseTransactionNe
)
.await?;

let Some(mut sc_result) = find_smart_contract_result(&result.transaction.smart_contract_results)? else {
let Some(mut sc_result) = find_smart_contract_result(
&result.transaction.smart_contract_results,
Some(&result.transaction.logs)
)? else {
return Err(TransactionError::NoSmartContractResult.into())
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use serde::Deserialize;

use crate::utils::transaction::results::find_sc_error;

#[derive(Deserialize, Clone, Default)]
#[serde(rename_all = "camelCase")]
pub struct TransactionOnNetworkResponse {
Expand Down Expand Up @@ -43,11 +45,15 @@ pub struct TransactionOnNetworkTransactionLogsEvents {
pub address: String,
pub identifier: String,
pub topics: Vec<String>,
pub data: String
pub data: Option<String>
}

impl TransactionOnNetwork {
pub fn is_success(&self) -> bool {
true // TODO
if let Ok(None) = find_sc_error(&self.transaction.logs) {
true
} else {
false
}
}
}
Loading

0 comments on commit aeef5de

Please sign in to comment.