-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
819c438
commit d28adf0
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
mod returns_message; | ||
mod returns_status; | ||
mod with_tx_raw_response; | ||
|
||
pub use returns_message::ReturnsMessage; | ||
pub use returns_status::ReturnsStatus; | ||
pub use with_tx_raw_response::WithRawTxResponse; |
26 changes: 26 additions & 0 deletions
26
framework/scenario/src/facade/result_handlers/returns_message.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use multiversx_sc::types::{RHListItem, RHListItemExec, TxEnv}; | ||
|
||
use crate::scenario_model::TxResponse; | ||
|
||
/// Indicates that the error status will be returned. | ||
pub struct ReturnsMessage; | ||
|
||
impl<Env, Original> RHListItem<Env, Original> for ReturnsMessage | ||
where | ||
Env: TxEnv, | ||
{ | ||
type Returns = String; | ||
} | ||
|
||
impl<Env, Original> RHListItemExec<TxResponse, Env, Original> for ReturnsMessage | ||
where | ||
Env: TxEnv, | ||
{ | ||
fn is_error_handled(&self) -> bool { | ||
true | ||
} | ||
|
||
fn item_process_result(self, raw_result: &TxResponse) -> Self::Returns { | ||
raw_result.tx_error.message.clone() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
framework/scenario/src/facade/result_handlers/returns_status.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use multiversx_sc::types::{RHListItem, RHListItemExec, TxEnv}; | ||
|
||
use crate::scenario_model::TxResponse; | ||
|
||
/// Indicates that the error status will be returned. | ||
pub struct ReturnsStatus; | ||
|
||
impl<Env, Original> RHListItem<Env, Original> for ReturnsStatus | ||
where | ||
Env: TxEnv, | ||
{ | ||
type Returns = u64; | ||
} | ||
|
||
impl<Env, Original> RHListItemExec<TxResponse, Env, Original> for ReturnsStatus | ||
where | ||
Env: TxEnv, | ||
{ | ||
fn is_error_handled(&self) -> bool { | ||
true | ||
} | ||
|
||
fn item_process_result(self, raw_result: &TxResponse) -> Self::Returns { | ||
raw_result.tx_error.status | ||
} | ||
} |