-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tx -> Step conversion refactor - part 1
- Loading branch information
1 parent
5390e22
commit 3506d25
Showing
18 changed files
with
448 additions
and
284 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
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
175 changes: 0 additions & 175 deletions
175
framework/scenario/src/facade/world_tx/scenario_env_util.rs
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
mod step_annotation; | ||
mod step_wrapper; | ||
mod tx_to_step_call; | ||
mod tx_to_step_deploy; | ||
mod tx_to_step_query; | ||
mod tx_to_step_trait; | ||
mod tx_to_step_transfer; | ||
|
||
pub use step_annotation::*; | ||
pub use step_wrapper::StepWrapper; | ||
pub use tx_to_step_trait::*; |
40 changes: 40 additions & 0 deletions
40
framework/scenario/src/scenario/tx_to_step/step_annotation.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,40 @@ | ||
use multiversx_chain_scenario_format::serde_raw::ValueSubTree; | ||
use multiversx_sc::types::{AnnotatedValue, Code, ManagedAddress, TxCodeValue, TxEnv, TxGas}; | ||
|
||
use crate::scenario_model::{AddressValue, BytesValue, U64Value}; | ||
|
||
pub fn address_annotated<Env, Addr>(env: &Env, from: Addr) -> AddressValue | ||
where | ||
Env: TxEnv, | ||
Addr: AnnotatedValue<Env, ManagedAddress<Env::Api>>, | ||
{ | ||
let annotation = from.annotation(env).to_string(); | ||
AddressValue { | ||
value: from.into_value(env).to_address(), | ||
original: ValueSubTree::Str(annotation), | ||
} | ||
} | ||
|
||
pub fn code_annotated<Env, CodeValue>(env: &Env, code: Code<CodeValue>) -> BytesValue | ||
where | ||
Env: TxEnv, | ||
CodeValue: TxCodeValue<Env>, | ||
{ | ||
let annotation = code.0.annotation(env).to_string(); | ||
BytesValue { | ||
value: code.0.into_value(env).to_vec(), | ||
original: ValueSubTree::Str(annotation), | ||
} | ||
} | ||
|
||
pub fn gas_annotated<Env, Gas>(env: &Env, gas: Gas) -> U64Value | ||
where | ||
Env: TxEnv, | ||
Gas: TxGas<Env>, | ||
{ | ||
let annotation = gas.gas_annotation(env).to_string(); | ||
U64Value { | ||
value: gas.gas_value(env), | ||
original: ValueSubTree::Str(annotation), | ||
} | ||
} |
Oops, something went wrong.