Skip to content

Commit

Permalink
fix: Change receiver_id type to String to be compatible with nearcore (
Browse files Browse the repository at this point in the history
…#160)

* fix: Change receiver_id type to String to be compatible with nearcore

* escape the `receiver_id` to avoid null-bytes
  • Loading branch information
khorolets authored Sep 1, 2021
1 parent e20730d commit b3037f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.2 (hotfix)

* Change `receiver_id` field type to `String` to be compatible with `nearcore` `AccessKeyPermissionView` struct (it caused problems during AccessKey serialization)

## 0.9.1

* Upgrade `nearcore` to 1.21.0 (rc1)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "indexer-explorer"
version = "0.9.1"
version = "0.9.2"
authors = ["Near Inc <[email protected]>"]
edition = "2018"

Expand Down
8 changes: 2 additions & 6 deletions src/models/serializers.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::str::FromStr;

use serde::{Deserialize, Serialize};
use serde_json::json;

use near_indexer::near_primitives;
use near_indexer::near_primitives::serialize::option_u128_dec_format;
use near_indexer::near_primitives::views::ActionView;

Expand Down Expand Up @@ -38,7 +35,7 @@ pub(crate) enum AccessKeyPermissionView {
FunctionCall {
#[serde(with = "option_u128_dec_format")]
allowance: Option<near_indexer::near_primitives::types::Balance>,
receiver_id: near_indexer::near_primitives::types::AccountId,
receiver_id: String,
method_names: Vec<String>,
},
FullAccess,
Expand All @@ -58,8 +55,7 @@ impl From<near_indexer::near_primitives::views::AccessKeyPermissionView>
method_names,
} => Self::FunctionCall {
allowance,
receiver_id: near_primitives::types::AccountId::from_str(&receiver_id)
.expect("receiver_id is not valid AccountId"),
receiver_id: receiver_id.escape_default().to_string(),
method_names: method_names
.into_iter()
.map(|method_name| method_name.escape_default().to_string())
Expand Down

0 comments on commit b3037f5

Please sign in to comment.