From d16c340598c21f73d625ef1998fdda33ed510673 Mon Sep 17 00:00:00 2001 From: deuszx Date: Wed, 22 Nov 2023 16:08:37 +0100 Subject: [PATCH] Expose actor and gas_limit from Session --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- drink/src/session.rs | 10 ++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 559366d..d12efca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1038,7 +1038,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "drink" -version = "0.8.0" +version = "0.8.1" dependencies = [ "contract-metadata", "contract-transcode", @@ -1063,7 +1063,7 @@ dependencies = [ [[package]] name = "drink-cli" -version = "0.8.0" +version = "0.8.1" dependencies = [ "anyhow", "clap", @@ -1079,7 +1079,7 @@ dependencies = [ [[package]] name = "drink-test-macro" -version = "0.8.0" +version = "0.8.1" dependencies = [ "cargo_metadata 0.18.1", "contract-build", diff --git a/Cargo.toml b/Cargo.toml index 5b520ae..95981ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ homepage = "https://github.com/Cardinal-Cryptography/drink" license = "Apache-2.0" readme = "README.md" repository = "https://github.com/Cardinal-Cryptography/drink" -version = "0.8.1" +version = "0.8.2" [workspace.dependencies] anyhow = { version = "1.0.71" } diff --git a/drink/src/session.rs b/drink/src/session.rs index 150a658..a10c67f 100644 --- a/drink/src/session.rs +++ b/drink/src/session.rs @@ -166,6 +166,11 @@ impl Session { Self { actor, ..self } } + /// Returns currently set actor. + pub fn get_actor(&self) -> AccountIdFor { + self.actor.clone() + } + /// Sets a new actor and returns the old one. pub fn set_actor(&mut self, actor: AccountIdFor) -> AccountIdFor { mem::replace(&mut self.actor, actor) @@ -181,6 +186,11 @@ impl Session { mem::replace(&mut self.gas_limit, gas_limit) } + /// Returns currently set gas limit. + pub fn get_gas_limit(&self) -> Weight { + self.gas_limit + } + /// Sets a new determinism policy and returns updated `self`. pub fn with_determinism(self, determinism: Determinism) -> Self { Self {