Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward full information about the contract interaction result #83

Merged
merged 10 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
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
8 changes: 5 additions & 3 deletions ink-wrapper-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ink-wrapper-types"
version = "0.8.0"
version = "0.9.0"
pmikolajczyk41 marked this conversation as resolved.
Show resolved Hide resolved
description = "Helper library for contract client code generated with ink-wrapper."
categories = ["development-tools::build-utils"]
authors = ["Cardinal Cryptography", "Cardinal"]
Expand All @@ -22,12 +22,14 @@ anyhow = { version = "1.0.51" }
thiserror = { version = "1.0.40" }

# drink specific integration.
drink = { version = "0.8", optional = true }
drink = { version = "0.8.7", optional = true }
drink-test-macro = { version = "0.8.7", optional = true }
ink_metadata = { version = "4.3.0", optional = true }
pallet-contracts-primitives = { version = "26.0.0", optional = true }
pmikolajczyk41 marked this conversation as resolved.
Show resolved Hide resolved

# See https://github.com/rust-lang/rust/issues/86161#issuecomment-1885012778
ahash = "0.8.6"

[features]
default = ["drink"]
drink = ["dep:drink", "dep:ink_metadata"]
drink = ["dep:drink", "drink-test-macro", "dep:ink_metadata", "pallet-contracts-primitives"]
4 changes: 4 additions & 0 deletions ink-wrapper-types/src/drink_types/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ impl Connection<MinimalRuntime> for Session<MinimalRuntime> {
result: contract_address,
events,
reverted: false,
debug_message: instantiate_contract_result.debug_message,
storage_deposit: instantiate_contract_result.storage_deposit,
})
}

Expand Down Expand Up @@ -134,6 +136,8 @@ fn call_contract<T: scale::Decode + Send + std::fmt::Debug>(
.result
.expect("If `result.result` was `err`, we should have returned `Err` from the whole function.")
.did_revert(),
debug_message: result.debug_message,
storage_deposit: result.storage_deposit,
})
}

Expand Down
3 changes: 3 additions & 0 deletions ink-wrapper-types/src/drink_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{ContractEvent, ExecCall, InstantiateCall, QueryArgs, UploadCall};
pub use client::*;

use drink::{frame_system, runtime::HashFor, DispatchError, Weight};
use pallet_contracts_primitives::StorageDeposit;

#[derive(thiserror::Error, Debug)]
pub enum Error {
Expand Down Expand Up @@ -48,6 +49,8 @@ pub struct ContractResult<R> {
pub result: R,
pub events: Vec<ContractEvent>,
pub reverted: bool,
pub debug_message: Vec<u8>,
pub storage_deposit: StorageDeposit<u128>,
}

pub type ContractInstantiateResult<AccountId> = ContractResult<AccountId>;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.72.0"
channel = "1.74.0"
components = ["rustfmt", "rust-src", "clippy"]
targets = ["wasm32-unknown-unknown"]
Loading