Open
Conversation
0925efe to
b0260a4
Compare
mitinarseny
reviewed
Feb 27, 2026
Comment on lines
+3166
to
+3169
| let key = hex::decode(&k) | ||
| .map_err(|e| color_eyre::eyre::eyre!("Failed to hex-decode key '{k}': {e}"))?; | ||
| let value = hex::decode(&v) | ||
| .map_err(|e| color_eyre::eyre::eyre!("Failed to hex-decode value '{v}': {e}"))?; |
There was a problem hiding this comment.
I'd suggest to be consistent and encode as base64, as key-value pairs in near_sdk::StateInit and DeterministicAccountStateInitV1 are encoded as base64 as well
Comment on lines
+104
to
+115
| pub enum Data { | ||
| #[strum_discriminants(strum( | ||
| message = "data-from-file - Read hex-encoded key-value JSON data from a file" | ||
| ))] | ||
| /// Read hex-encoded key-value JSON data from a file | ||
| DataFromFile(DataFromFile), | ||
| #[strum_discriminants(strum( | ||
| message = "data-from-json - Provide hex-encoded key-value JSON data inline" | ||
| ))] | ||
| /// Provide hex-encoded key-value JSON data inline | ||
| DataFromJson(DataFromJson), | ||
| } |
There was a problem hiding this comment.
Maybe add an option to provide the whole StateInit serialized as borsh and encoded as base64 as well?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added a new contract state-init subcommand that initializes a deterministic account with a global contract and state data. The command supports two ways to reference the global contract: by code hash or by account ID. There are also 2 ways to provide the initial state data: reading hex-encoded key-value JSON from a file or passing it inline as a JSON string.
A few other things in this change: