From bcdf5babf9cea4aef94457767735dc9195d84798 Mon Sep 17 00:00:00 2001 From: Austin Abell Date: Mon, 30 Aug 2021 14:34:24 -0400 Subject: [PATCH] fix(mock): method names type within receipts to be Strings (#555) * fix: method names type within receipts to be Strings * changelog --- CHANGELOG.md | 2 ++ near-sdk/src/environment/mock/external.rs | 2 ++ near-sdk/src/environment/mock/receipt.rs | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4c71002f..6b3b53783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog ## [unreleased] +- mock: Update `method_names` field of `AddKeyWithFunctionCall` to a `Vec` from `Vec>`. [PR 555](https://github.com/near/near-sdk-rs/pull/555) + - Method names were changed to be strings in `4.0.0-pre.2` but this one was missed ## `4.0.0-pre.2` [08-19-2021] - Update `panic` and `panic_utf8` syscall signatures to indicate they do not return. [PR 489](https://github.com/near/near-sdk-rs/pull/489) diff --git a/near-sdk/src/environment/mock/external.rs b/near-sdk/src/environment/mock/external.rs index afb46c278..baf958a1c 100644 --- a/near-sdk/src/environment/mock/external.rs +++ b/near-sdk/src/environment/mock/external.rs @@ -165,6 +165,8 @@ impl External for SdkExternal { method_names: Vec>, ) -> Result<()> { let public_key = PublicKey::try_from(public_key).unwrap(); + let method_names = + method_names.into_iter().map(|s| String::from_utf8(s).unwrap()).collect(); self.receipts.get_mut(receipt_index as usize).unwrap().actions.push( VmAction::AddKeyWithFunctionCall { public_key, diff --git a/near-sdk/src/environment/mock/receipt.rs b/near-sdk/src/environment/mock/receipt.rs index f54470637..54db12b3a 100644 --- a/near-sdk/src/environment/mock/receipt.rs +++ b/near-sdk/src/environment/mock/receipt.rs @@ -36,7 +36,7 @@ pub enum VmAction { nonce: u64, allowance: Option, receiver_id: AccountId, - method_names: Vec>, + method_names: Vec, }, DeleteKey { public_key: PublicKey,