Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Expose and use message result
  • Loading branch information
ascjones committed Jan 30, 2023
commit c8d7bdeb9b2cd362bb9e94d433efe2df9e036f14
11 changes: 11 additions & 0 deletions crates/e2e/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ where
E: Environment,
V: scale::Decode,
{
/// Returns the [`MessageResult`] from the execution of the dry-run message
/// call.
///
/// # Panics
/// - if the dry-run message call failed to execute.
/// - if message result cannot be decoded into the expected return value
/// type.
pub fn message_result(&self) -> MessageResult<V> {
self.dry_run.message_result()
}

/// Returns the decoded return value of the message from the dry-run.
///
/// Panics if the value could not be decoded. The raw bytes can be accessed
Expand Down
2 changes: 1 addition & 1 deletion examples/lang-err-integration-tests/contract-ref/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mod contract_ref {
.await
.expect("Calling `flip` failed");
assert!(
flip_call_result.dry_run.exec_result.result.is_ok(),
flip_call_result.message_result().is_ok(),
"Messages now return a `Result`, which should be `Ok` here."
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub mod integration_flipper {
.await
.expect("Calling `flip` failed");
assert!(
flip_call_result.value.is_ok(),
flip_call_result.message_result().is_ok(),
"Messages now return a `Result`, which should be `Ok` here."
);

Expand Down Expand Up @@ -142,7 +142,7 @@ pub mod integration_flipper {
));

let flipped_value = client
.call(&ink_e2e::bob(), &get, 0, None)
.call_dry_run(&ink_e2e::bob(), &get, 0, None)
.await
.return_value();
assert!(flipped_value == initial_value);
Expand Down