Skip to content

Commit

Permalink
fix(mock): method names type within receipts to be Strings (#555)
Browse files Browse the repository at this point in the history
* fix: method names type within receipts to be Strings

* changelog
  • Loading branch information
austinabell committed Aug 30, 2021
1 parent 05e4539 commit bcdf5ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [unreleased]
- mock: Update `method_names` field of `AddKeyWithFunctionCall` to a `Vec<String>` from `Vec<Vec<u8>>`. [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)
Expand Down
2 changes: 2 additions & 0 deletions near-sdk/src/environment/mock/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ impl External for SdkExternal {
method_names: Vec<Vec<u8>>,
) -> 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,
Expand Down
2 changes: 1 addition & 1 deletion near-sdk/src/environment/mock/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub enum VmAction {
nonce: u64,
allowance: Option<Balance>,
receiver_id: AccountId,
method_names: Vec<Vec<u8>>,
method_names: Vec<String>,
},
DeleteKey {
public_key: PublicKey,
Expand Down

0 comments on commit bcdf5ba

Please sign in to comment.