From 515ba6c8a2fd2f428f2d448827443bce2521142d Mon Sep 17 00:00:00 2001
From: FroVolod
Date: Sat, 30 Nov 2024 13:45:41 +0200
Subject: [PATCH 1/6] feat: Trace configuration for loading wait indicators and
--teach-me flag moved to library (#417)
Created a setup_tracing() function in the library. It provides tracing
configuration for loading wait indicators and the --teach-me flag.
Co-authored-by: FroVolod
---
src/lib.rs | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/main.rs | 52 +--------------------------------------------------
2 files changed, 55 insertions(+), 51 deletions(-)
diff --git a/src/lib.rs b/src/lib.rs
index ad273c6b4..95fd79eca 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,3 +18,57 @@ pub struct GlobalContext {
pub offline: bool,
pub teach_me: bool,
}
+
+pub fn setup_tracing(teach_me_flag_is_set: bool) -> CliResult {
+ use indicatif::ProgressStyle;
+ use tracing_indicatif::IndicatifLayer;
+ use tracing_subscriber::layer::SubscriberExt;
+ use tracing_subscriber::util::SubscriberInitExt;
+ use tracing_subscriber::EnvFilter;
+
+ if teach_me_flag_is_set {
+ let env_filter = EnvFilter::from_default_env()
+ .add_directive(tracing::Level::WARN.into())
+ .add_directive("near_teach_me=info".parse()?)
+ .add_directive("near_cli_rs=info".parse()?);
+ tracing_subscriber::registry()
+ .with(
+ tracing_subscriber::fmt::layer()
+ .without_time()
+ .with_target(false),
+ )
+ .with(env_filter)
+ .init();
+ } else {
+ let indicatif_layer = IndicatifLayer::new()
+ .with_progress_style(
+ ProgressStyle::with_template(
+ "{spinner:.blue}{span_child_prefix} {span_name} {msg} {span_fields}",
+ )
+ .unwrap()
+ .tick_strings(&[
+ "▹▹▹▹▹",
+ "▸▹▹▹▹",
+ "▹▸▹▹▹",
+ "▹▹▸▹▹",
+ "▹▹▹▸▹",
+ "▹▹▹▹▸",
+ "▪▪▪▪▪",
+ ]),
+ )
+ .with_span_child_prefix_symbol("↳ ");
+ let env_filter = EnvFilter::from_default_env()
+ .add_directive(tracing::Level::WARN.into())
+ .add_directive("near_cli_rs=info".parse()?);
+ tracing_subscriber::registry()
+ .with(
+ tracing_subscriber::fmt::layer()
+ .without_time()
+ .with_writer(indicatif_layer.get_stderr_writer()),
+ )
+ .with(indicatif_layer)
+ .with(env_filter)
+ .init();
+ };
+ Ok(())
+}
diff --git a/src/main.rs b/src/main.rs
index 969b34b27..06de48f62 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,12 +9,6 @@ use color_eyre::eyre::WrapErr;
use color_eyre::owo_colors::OwoColorize;
use interactive_clap::ToCliArgs;
-use indicatif::ProgressStyle;
-use tracing_indicatif::IndicatifLayer;
-use tracing_subscriber::layer::SubscriberExt;
-use tracing_subscriber::util::SubscriberInitExt;
-use tracing_subscriber::EnvFilter;
-
pub use near_cli_rs::commands;
pub use near_cli_rs::common::{self, CliResult};
pub use near_cli_rs::config;
@@ -25,7 +19,6 @@ pub use near_cli_rs::network_view_at_block;
pub use near_cli_rs::transaction_signature_options;
pub use near_cli_rs::types;
pub use near_cli_rs::utils_command;
-
pub use near_cli_rs::GlobalContext;
type ConfigContext = (crate::config::Config,);
@@ -120,50 +113,7 @@ fn main() -> crate::common::CliResult {
}
},
};
- if cli.teach_me {
- let env_filter = EnvFilter::from_default_env()
- .add_directive(tracing::Level::WARN.into())
- .add_directive("near_teach_me=info".parse()?)
- .add_directive("near_cli_rs=info".parse()?);
- tracing_subscriber::registry()
- .with(
- tracing_subscriber::fmt::layer()
- .without_time()
- .with_target(false),
- )
- .with(env_filter)
- .init();
- } else {
- let indicatif_layer = IndicatifLayer::new()
- .with_progress_style(
- ProgressStyle::with_template(
- "{spinner:.blue}{span_child_prefix} {span_name} {msg} {span_fields}",
- )
- .unwrap()
- .tick_strings(&[
- "▹▹▹▹▹",
- "▸▹▹▹▹",
- "▹▸▹▹▹",
- "▹▹▸▹▹",
- "▹▹▹▸▹",
- "▹▹▹▹▸",
- "▪▪▪▪▪",
- ]),
- )
- .with_span_child_prefix_symbol("↳ ");
- let env_filter = EnvFilter::from_default_env()
- .add_directive(tracing::Level::WARN.into())
- .add_directive("near_cli_rs=info".parse()?);
- tracing_subscriber::registry()
- .with(
- tracing_subscriber::fmt::layer()
- .without_time()
- .with_writer(indicatif_layer.get_stderr_writer()),
- )
- .with(indicatif_layer)
- .with(env_filter)
- .init();
- };
+ near_cli_rs::setup_tracing(cli.teach_me)?;
let cli_cmd = match ::from_cli(Some(cli), (config,)) {
interactive_clap::ResultFromCli::Ok(cli_cmd)
From e10f27d3960af4ba571ec007bc5a54fc3951fee3 Mon Sep 17 00:00:00 2001
From: Ivan Frolov <59515280+frolvanya@users.noreply.github.com>
Date: Tue, 3 Dec 2024 12:58:20 -0500
Subject: [PATCH 2/6] feat: Get the final CLI command into the shell history
with a small helper setup (#415)
This PR introduces shell-specific functions for Bash, Zsh, and Fish
shells to improve NEAR CLI's integration with shell history. The
provided functions ensure that commands executed via the near CLI are
automatically added to the shell's history, making them accessible
through arrow keys and standard history mechanisms
---
.github/workflows/release.yml | 48 +++++++-------
Cargo.toml | 16 ++---
README.md | 2 +-
docs/SHELL_HISTORY_INTEGRATION.md | 106 ++++++++++++++++++++++++++++++
src/common.rs | 21 ++++++
src/main.rs | 24 ++++---
6 files changed, 173 insertions(+), 44 deletions(-)
create mode 100644 docs/SHELL_HISTORY_INTEGRATION.md
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index f8093c74d..df34114ca 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,4 +1,4 @@
-# This file was autogenerated by cargo-dist: https://opensource.axo.dev/cargo-dist/
+# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/
#
# Copyright 2022-2024, axodotdev
# SPDX-License-Identifier: MIT or Apache-2.0
@@ -6,7 +6,7 @@
# CI that:
#
# * checks for a Git Tag that looks like a release
-# * builds artifacts with cargo-dist (archives, installers, hashes)
+# * builds artifacts with dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a GitHub Release
#
@@ -24,10 +24,10 @@ permissions:
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
#
# If PACKAGE_NAME is specified, then the announcement will be for that
-# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
+# package (erroring out if it doesn't have the given version or isn't dist-able).
#
# If PACKAGE_NAME isn't specified, then the announcement will be for all
-# (cargo-dist-able) packages in the workspace with that version (this mode is
+# (dist-able) packages in the workspace with that version (this mode is
# intended for workspaces with only one dist-able package, or with all dist-able
# packages versioned/released in lockstep).
#
@@ -45,7 +45,7 @@ on:
- '**[0-9]+.[0-9]+.[0-9]+*'
jobs:
- # Run 'cargo dist plan' (or host) to determine what tasks we need to do
+ # Run 'dist plan' (or host) to determine what tasks we need to do
plan:
runs-on: "ubuntu-20.04"
outputs:
@@ -59,16 +59,16 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- - name: Install cargo-dist
+ - name: Install dist
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
- run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.1/cargo-dist-installer.sh | sh"
- - name: Cache cargo-dist
+ run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.25.1/cargo-dist-installer.sh | sh"
+ - name: Cache dist
uses: actions/upload-artifact@v4
with:
name: cargo-dist-cache
- path: ~/.cargo/bin/cargo-dist
+ path: ~/.cargo/bin/dist
# sure would be cool if github gave us proper conditionals...
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
# functionality based on whether this is a pull_request, and whether it's from a fork.
@@ -76,8 +76,8 @@ jobs:
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
- cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
- echo "cargo dist ran successfully"
+ dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
+ echo "dist ran successfully"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
@@ -95,12 +95,12 @@ jobs:
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
strategy:
fail-fast: false
- # Target platforms/runners are computed by cargo-dist in create-release.
+ # Target platforms/runners are computed by dist in create-release.
# Each member of the matrix has the following arguments:
#
# - runner: the github runner
- # - dist-args: cli flags to pass to cargo dist
- # - install-dist: expression to run to install cargo-dist on the runner
+ # - dist-args: cli flags to pass to dist
+ # - install-dist: expression to run to install dist on the runner
#
# Typically there will be:
# - 1 "global" task that builds universal installers
@@ -121,7 +121,7 @@ jobs:
with:
key: ${{ join(matrix.targets, '-') }}
cache-provider: ${{ matrix.cache_provider }}
- - name: Install cargo-dist
+ - name: Install dist
run: ${{ matrix.install_dist }}
# Get the dist-manifest
- name: Fetch local artifacts
@@ -136,8 +136,8 @@ jobs:
- name: Build artifacts
run: |
# Actually do builds and make zips and whatnot
- cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
- echo "cargo dist ran successfully"
+ dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
+ echo "dist ran successfully"
- id: cargo-dist
name: Post-build
# We force bash here just because github makes it really hard to get values up
@@ -172,12 +172,12 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- - name: Install cached cargo-dist
+ - name: Install cached dist
uses: actions/download-artifact@v4
with:
name: cargo-dist-cache
path: ~/.cargo/bin/
- - run: chmod +x ~/.cargo/bin/cargo-dist
+ - run: chmod +x ~/.cargo/bin/dist
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts
uses: actions/download-artifact@v4
@@ -188,8 +188,8 @@ jobs:
- id: cargo-dist
shell: bash
run: |
- cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
- echo "cargo dist ran successfully"
+ dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
+ echo "dist ran successfully"
# Parse out what we just built and upload it to scratch storage
echo "paths<> "$GITHUB_OUTPUT"
@@ -221,12 +221,12 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- - name: Install cached cargo-dist
+ - name: Install cached dist
uses: actions/download-artifact@v4
with:
name: cargo-dist-cache
path: ~/.cargo/bin/
- - run: chmod +x ~/.cargo/bin/cargo-dist
+ - run: chmod +x ~/.cargo/bin/dist
# Fetch artifacts from scratch-storage
- name: Fetch artifacts
uses: actions/download-artifact@v4
@@ -237,7 +237,7 @@ jobs:
- id: host
shell: bash
run: |
- cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
+ dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
echo "artifacts uploaded and released successfully"
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
diff --git a/Cargo.toml b/Cargo.toml
index db163dac0..71b0fd283 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -118,24 +118,18 @@ self-update = ["self_update", "semver"]
inherits = "release"
lto = "thin"
-# Config for 'cargo dist'
+# Config for 'dist'
[workspace.metadata.dist]
-# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
-cargo-dist-version = "0.21.1"
+# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
+cargo-dist-version = "0.25.1"
# CI backends to support
ci = "github"
# The installers to generate for each app
installers = ["shell", "powershell", "npm", "msi"]
-# Enable additional publishing steps
+# Publish jobs to run in CI
publish-jobs = ["npm"]
# Target platforms to build apps for (Rust target-triple syntax)
-targets = [
- "aarch64-apple-darwin",
- "aarch64-unknown-linux-gnu",
- "x86_64-apple-darwin",
- "x86_64-unknown-linux-gnu",
- "x86_64-pc-windows-msvc",
-]
+targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
# The archive format to use for windows builds (defaults .zip)
windows-archive = ".tar.gz"
# The archive format to use for non-windows builds (defaults .tar.xz)
diff --git a/README.md b/README.md
index 5c477588e..32f5ab7e8 100644
--- a/README.md
+++ b/README.md
@@ -137,7 +137,7 @@ $ near
[↑↓ to move, enter to select, type to filter]
```
-The CLI interactively guides you through some pretty complex topics, helping you make informed decisions along the way.
+The CLI interactively guides you through some pretty complex topics, helping you make informed decisions along the way. Also, you can enable [shell history integration](docs/SHELL_HISTORY_INTEGRATION.md)
## [Read more in English](docs/README.en.md)
- [Usage](docs/README.en.md#usage)
diff --git a/docs/SHELL_HISTORY_INTEGRATION.md b/docs/SHELL_HISTORY_INTEGRATION.md
new file mode 100644
index 000000000..546696bce
--- /dev/null
+++ b/docs/SHELL_HISTORY_INTEGRATION.md
@@ -0,0 +1,106 @@
+# Shell Configuration for Command History
+
+To enhance your experience with the NEAR CLI, you can configure your shell to integrate better with the near command. By adding the following functions to your shell configuration file, you ensure that commands executed via near are properly stored in your shell history and easily accessible via the arrow keys.
+
+## Bash
+
+Add the following function to your `~/.bashrc` file:
+
+```bash
+function near() {
+ command near "$@"
+
+ tmp_dir="${TMPDIR:-/tmp}"
+ tmp_file="$tmp_dir/near-cli-rs-final-command.log"
+
+ if [[ -f "$tmp_file" ]]; then
+ final_command=$(<"$tmp_file")
+
+ if [[ -n "$final_command" ]]; then
+ history -s -- "$final_command"
+ fi
+
+ rm "$tmp_file"
+ fi
+}
+```
+
+## Zsh
+
+Add the following function to your `~/.zshrc` file:
+
+```zsh
+function near() {
+ command near "$@"
+
+ tmp_dir="${TMPDIR:-/tmp}"
+ tmp_file="$tmp_dir/near-cli-rs-final-command.log"
+
+ if [[ -f "$tmp_file" ]]; then
+ final_command=$(<"$tmp_file")
+
+ if [[ -n "$final_command" ]]; then
+ print -s -- "$final_command"
+ fi
+
+ rm "$tmp_file"
+ fi
+}
+```
+
+## Fish
+
+Add the following function to your `~/.config/fish/config.fish` file:
+
+```fish
+function near
+ command near $argv
+
+ set tmp_dir (set -q TMPDIR; and echo $TMPDIR; or echo /tmp)
+ set tmp_file "$tmp_dir/near-cli-rs-final-command.log"
+
+ if test -f "$tmp_file"
+ set -l final_command (cat "$tmp_file")
+
+ if test -n "$final_command"
+ set -l history_file (dirname (status --current-filename))/../fish_history
+
+ if set -q XDG_DATA_HOME
+ set history_file "$XDG_DATA_HOME/fish/fish_history"
+ else if test -d "$HOME/.local/share/fish"
+ set history_file "$HOME/.local/share/fish/fish_history"
+ else
+ set history_file "$HOME/.fish_history"
+ end
+
+ echo "- cmd: $final_command" >> $history_file
+ echo " when: "(date +%s) >> $history_file
+
+ history --merge
+ end
+
+ rm "$tmp_file"
+ end
+end
+```
+
+> [!NOTE]
+> For Fish shell, the function appends the command to the Fish history file and merges it to make it immediately accessible via the arrow keys.
+
+## Explanation
+
+These functions wrap the original near command and perform additional steps to read a command from a temporary log file, which is created by the NEAR CLI, and add it to your shell history. This allows you to easily access previous NEAR CLI commands using your shell's history mechanisms.
+
+Steps performed by the functions:
+
+- Run the original near command with all provided arguments.
+- Check if the temporary log file exists.
+- Read the command from the log file.
+- If the command is not empty:
+ - For Bash and Zsh: Add the command to the shell history.
+ - For Fish: Append the command to the Fish history file and merge the history.
+- Remove the temporary log file to prevent duplicate entries.
+
+> [!IMPORTANT]
+> Ensure that your NEAR CLI is configured to write the final command to the temporary log file at the specified location.
+> Replace near with `cargo run --` in the functions if you are running the NEAR CLI via cargo locally.
diff --git a/src/common.rs b/src/common.rs
index f2f88b1f1..077c8fb0e 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1,5 +1,6 @@
use std::collections::VecDeque;
use std::convert::{TryFrom, TryInto};
+use std::fs::OpenOptions;
use std::io::Write;
use std::str::FromStr;
@@ -18,6 +19,8 @@ pub type CliResult = color_eyre::eyre::Result<()>;
use inquire::{Select, Text};
use strum::IntoEnumIterator;
+const FINAL_COMMAND_FILE_NAME: &str = "near-cli-rs-final-command.log";
+
pub fn get_near_exec_path() -> String {
std::env::args()
.next()
@@ -2645,3 +2648,21 @@ fn input_account_id_from_used_account_list(
update_used_account_list(credentials_home_dir, account_id.as_ref(), account_is_signer);
Ok(Some(account_id))
}
+
+pub fn save_cli_command(cli_cmd_str: &str) {
+ let tmp_file_path = std::env::temp_dir().join(FINAL_COMMAND_FILE_NAME);
+
+ let Ok(mut tmp_file) = OpenOptions::new()
+ .write(true)
+ .create(true)
+ .truncate(true)
+ .open(tmp_file_path)
+ else {
+ eprintln!("Failed to open a temporary file to store a cli command");
+ return;
+ };
+
+ if let Err(err) = writeln!(tmp_file, "{}", cli_cmd_str) {
+ eprintln!("Failed to store a cli command in a temporary file: {}", err);
+ }
+}
diff --git a/src/main.rs b/src/main.rs
index 06de48f62..4274a0cb4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,6 +3,7 @@
clippy::large_enum_variant,
clippy::too_many_arguments
)]
+
use clap::Parser;
#[cfg(feature = "self-update")]
use color_eyre::eyre::WrapErr;
@@ -118,13 +119,17 @@ fn main() -> crate::common::CliResult {
let cli_cmd = match ::from_cli(Some(cli), (config,)) {
interactive_clap::ResultFromCli::Ok(cli_cmd)
| interactive_clap::ResultFromCli::Cancel(Some(cli_cmd)) => {
+ let cli_cmd_str = shell_words::join(
+ std::iter::once(&near_cli_exec_path).chain(&cli_cmd.to_cli_args()),
+ );
+
eprintln!(
"\n\nHere is your console command if you need to script it or re-run:\n {}\n",
- shell_words::join(
- std::iter::once(&near_cli_exec_path).chain(&cli_cmd.to_cli_args())
- )
- .yellow()
+ cli_cmd_str.yellow()
);
+
+ crate::common::save_cli_command(&cli_cmd_str);
+
Ok(Some(cli_cmd))
}
interactive_clap::ResultFromCli::Cancel(None) => {
@@ -136,13 +141,16 @@ fn main() -> crate::common::CliResult {
}
interactive_clap::ResultFromCli::Err(optional_cli_cmd, err) => {
if let Some(cli_cmd) = optional_cli_cmd {
+ let cli_cmd_str = shell_words::join(
+ std::iter::once(&near_cli_exec_path).chain(&cli_cmd.to_cli_args()),
+ );
+
eprintln!(
"\nHere is your console command if you need to script it or re-run:\n {}\n",
- shell_words::join(
- std::iter::once(&near_cli_exec_path).chain(&cli_cmd.to_cli_args())
- )
- .yellow()
+ cli_cmd_str.yellow()
);
+
+ crate::common::save_cli_command(&cli_cmd_str);
}
Err(err)
}
From 4e8d0f2fae102e34ab57cd303835bb05fff4559f Mon Sep 17 00:00:00 2001
From: FroVolod
Date: Fri, 6 Dec 2024 20:15:23 +0200
Subject: [PATCH 3/6] feat: Added the ability to save payload for
broadcast_tx_commit (#413)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: FroVolod
Co-authored-by: dj8yf0μl <26653921+dj8yfo@users.noreply.github.com>
Co-authored-by: dj8yf0μl
---
src/common.rs | 135 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 123 insertions(+), 12 deletions(-)
diff --git a/src/common.rs b/src/common.rs
index 077c8fb0e..351ca3113 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -2156,18 +2156,43 @@ impl JsonRpcClientExt for near_jsonrpc_client::JsonRpcClient {
M::Error: serde::Serialize + std::fmt::Debug + std::fmt::Display,
{
if let Ok(request_payload) = near_jsonrpc_client::methods::to_json(&method) {
- tracing::info!(
- target: "near_teach_me",
- parent: &tracing::Span::none(),
- "HTTP POST {}",
- self.server_addr()
- );
- tracing::info!(
- target: "near_teach_me",
- parent: &tracing::Span::none(),
- "JSON Request Body:\n{}",
- indent_payload(&format!("{:#}", request_payload))
- );
+ if tracing::enabled!(target: "near_teach_me", tracing::Level::INFO) {
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "HTTP POST {}",
+ self.server_addr()
+ );
+
+ let (request_payload, message_about_saving_payload) =
+ check_request_payload_for_broadcast_tx_commit(request_payload);
+
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "JSON Request Body:\n{}",
+ indent_payload(&format!("{:#}", request_payload))
+ );
+ match message_about_saving_payload {
+ Ok(Some(message)) => {
+ tracing::event!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ tracing::Level::INFO,
+ "{}", message
+ );
+ }
+ Err(message) => {
+ tracing::event!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ tracing::Level::WARN,
+ "{}", message
+ );
+ }
+ _ => {}
+ }
+ }
}
tokio::runtime::Runtime::new()
@@ -2376,6 +2401,92 @@ impl JsonRpcClientExt for near_jsonrpc_client::JsonRpcClient {
}
}
+fn check_request_payload_for_broadcast_tx_commit(
+ mut request_payload: serde_json::Value,
+) -> (serde_json::Value, Result, String>) {
+ let mut message_about_saving_payload = Ok(None);
+ let method = request_payload.get("method").cloned();
+ let params_value = request_payload.get("params").cloned();
+ if let Some(method) = method {
+ if method.to_string().contains("broadcast_tx_commit") {
+ if let Some(params_value) = params_value {
+ message_about_saving_payload =
+ replace_params_with_file(&mut request_payload, params_value);
+ }
+ }
+ }
+ (request_payload, message_about_saving_payload)
+}
+
+fn replace_params_with_file(
+ request_payload: &mut serde_json::Value,
+ params_value: serde_json::Value,
+) -> Result , String> {
+ let file_path = std::path::PathBuf::from("broadcast_tx_commit__params_field.json");
+
+ let total_params_length = {
+ match serde_json::to_vec_pretty(¶ms_value) {
+ Ok(serialized) => serialized.len(),
+ // this branch is supposed to be unreachable
+ Err(err) => {
+ return Err(format!(
+ "Failed to save payload to `{}`. Serialization error:\n{}",
+ &file_path.display(),
+ indent_payload(&format!("{:#?}", err))
+ ));
+ }
+ }
+ };
+
+ if total_params_length > 1000 {
+ let file_content = {
+ let mut map = serde_json::Map::new();
+ map.insert(
+ "original `params` field of JSON Request Body".into(),
+ params_value,
+ );
+
+ serde_json::Value::Object(map)
+ };
+
+ let result = match std::fs::File::create(&file_path) {
+ Ok(mut file) => match serde_json::to_vec_pretty(&file_content) {
+ Ok(buf) => match file.write(&buf) {
+ Ok(_) => {
+ Ok(Some(format!("The file `{}` was created successfully. It has a signed transaction (serialized as base64).", &file_path.display())))
+ }
+ Err(err) => Err(format!(
+ "Failed to save payload to `{}`. Failed to write file:\n{}",
+ &file_path.display(),
+ indent_payload(&format!("{:#?}", err))
+ )),
+ },
+ Err(err) => Err(format!(
+ "Failed to save payload to `{}`. Serialization error:\n{}",
+ &file_path.display(),
+ indent_payload(&format!("{:#?}", err))
+ )),
+ },
+ Err(err) => Err(format!(
+ "Failed to save payload to `{}`. Failed to create file:\n{}",
+ &file_path.display(),
+ indent_payload(&format!("{:#?}", err))
+ )),
+ };
+
+ if result.is_ok() {
+ request_payload["params"] = serde_json::json!(format!(
+ "`params` field serialization contains {} characters. Current field will be stored in `{}`",
+ total_params_length,
+ &file_path.display()
+ ));
+ }
+ result
+ } else {
+ Ok(None)
+ }
+}
+
pub(crate) fn teach_me_call_response(response: &impl serde::Serialize) {
if let Ok(response_payload) = serde_json::to_value(response) {
tracing::info!(
From 63a9762841afc3732c7ef82f2cb8feb142353809 Mon Sep 17 00:00:00 2001
From: Vlad Frolov
Date: Thu, 12 Dec 2024 17:56:38 +0100
Subject: [PATCH 4/6] chore: release v0.16.1 (#421)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## 🤖 New release
* `near-cli-rs`: 0.16.0 -> 0.16.1 (✓ API compatible changes)
Changelog
##
[0.16.1](https://github.com/near/near-cli-rs/compare/v0.16.0...v0.16.1)
- 2024-12-06
### Added
- Added the ability to save payload for broadcast_tx_commit
([#413](https://github.com/near/near-cli-rs/pull/413))
- Get the final CLI command into the shell history with a small helper
setup ([#415](https://github.com/near/near-cli-rs/pull/415))
- Trace configuration for loading wait indicators and --teach-me flag
moved to library ([#417](https://github.com/near/near-cli-rs/pull/417))
- add to devtools workflow
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
---
CHANGELOG.md | 9 +++++++++
Cargo.lock | 2 +-
Cargo.toml | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1871893a1..2538045ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+## [0.16.1](https://github.com/near/near-cli-rs/compare/v0.16.0...v0.16.1) - 2024-12-06
+
+### Added
+
+- Added the ability to save payload for broadcast_tx_commit ([#413](https://github.com/near/near-cli-rs/pull/413))
+- Get the final CLI command into the shell history with a small helper setup ([#415](https://github.com/near/near-cli-rs/pull/415))
+- Trace configuration for loading wait indicators and --teach-me flag moved to library ([#417](https://github.com/near/near-cli-rs/pull/417))
+- add to devtools workflow
+
## [0.16.0](https://github.com/near/near-cli-rs/compare/v0.15.1...v0.16.0) - 2024-11-18
### Other
diff --git a/Cargo.lock b/Cargo.lock
index 10136e5eb..521495dc6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2057,7 +2057,7 @@ dependencies = [
[[package]]
name = "near-cli-rs"
-version = "0.16.0"
+version = "0.16.1"
dependencies = [
"bip39",
"bs58 0.5.1",
diff --git a/Cargo.toml b/Cargo.toml
index 71b0fd283..541e36a1f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "near-cli-rs"
-version = "0.16.0"
+version = "0.16.1"
authors = ["FroVolod ", "Near Inc "]
license = "MIT OR Apache-2.0"
edition = "2021"
From c19e525e544b162bf9fca1ce390687b1c6bbd3c4 Mon Sep 17 00:00:00 2001
From: Artur Yurii Korchynskyi <42449190+akorchyn@users.noreply.github.com>
Date: Fri, 13 Dec 2024 15:17:53 +0200
Subject: [PATCH 5/6] chore!: updates near-* dependencies to 0.28 release
(#423)
Also:
* Bumped up the `thiserror` crate to version 2.
* Changed callback to work with `TransactionV0` instead of the
`Transaction`. As `Transaction` doesn't support the `actions_mut`
function.
* rust-tolchain 1.80 pin to `stable`
@race-of-sloths
---------
Co-authored-by: FroVolod
---
Cargo.lock | 455 +++++++++---------
Cargo.toml | 20 +-
rust-toolchain | 2 +-
.../account/update_social_profile/sign_as.rs | 6 +-
src/commands/mod.rs | 12 +-
.../print_transaction/unsigned/mod.rs | 6 +-
.../send_meta_transaction/sign_as/mod.rs | 2 +-
.../transaction/sign_transaction/mod.rs | 6 +-
src/common.rs | 3 +-
src/js_command_match/account/delete.rs | 24 +-
.../sign_with_access_key_file/mod.rs | 20 +-
.../sign_with_keychain/mod.rs | 20 +-
.../sign_with_ledger/mod.rs | 20 +-
.../sign_with_legacy_keychain/mod.rs | 20 +-
.../sign_with_private_key/mod.rs | 20 +-
.../sign_with_seed_phrase/mod.rs | 7 +-
src/types/transaction.rs | 27 +-
17 files changed, 368 insertions(+), 302 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 521495dc6..fade8f320 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -121,9 +121,9 @@ dependencies = [
[[package]]
name = "anyhow"
-version = "1.0.93"
+version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
+checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7"
[[package]]
name = "arbitrary"
@@ -154,7 +154,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -284,9 +284,9 @@ dependencies = [
[[package]]
name = "borsh"
-version = "1.5.2"
+version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f5327f6c99920069d1fe374aa743be1af0031dea9f250852cdf1ae6a0861ee24"
+checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03"
dependencies = [
"borsh-derive",
"cfg_aliases",
@@ -294,15 +294,15 @@ dependencies = [
[[package]]
name = "borsh-derive"
-version = "1.5.2"
+version = "1.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10aedd8f1a81a8aafbfde924b0e3061cd6fedd6f6bbcfc6a76e6fd426d7bfe26"
+checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244"
dependencies = [
"once_cell",
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -322,9 +322,9 @@ dependencies = [
[[package]]
name = "bstr"
-version = "1.10.0"
+version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c"
+checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8"
dependencies = [
"memchr",
"serde",
@@ -366,9 +366,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
-version = "1.8.0"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da"
+checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b"
[[package]]
name = "bytesize"
@@ -381,12 +381,12 @@ dependencies = [
[[package]]
name = "cargo-util"
-version = "0.2.15"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6dd67a24439ca5260a08128b6cbf4b0f4453497a2f60508163ab9d5b534b122"
+checksum = "0b15bbe49616ee353fadadf6de5a24136f3fe8fdbd5eb0894be9f8a42c905674"
dependencies = [
"anyhow",
- "core-foundation 0.9.4",
+ "core-foundation 0.10.0",
"filetime",
"hex",
"ignore",
@@ -404,9 +404,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.2.0"
+version = "1.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1aeb932158bd710538c73702db6945cb68a8fb08c519e6e12706b94263b36db8"
+checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf"
dependencies = [
"jobserver",
"libc",
@@ -427,9 +427,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "chrono"
-version = "0.4.38"
+version = "0.4.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
+checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
dependencies = [
"android-tzdata",
"iana-time-zone",
@@ -440,9 +440,9 @@ dependencies = [
[[package]]
name = "clap"
-version = "4.5.20"
+version = "4.5.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8"
+checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84"
dependencies = [
"clap_builder",
"clap_derive",
@@ -450,9 +450,9 @@ dependencies = [
[[package]]
name = "clap_builder"
-version = "4.5.20"
+version = "4.5.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54"
+checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838"
dependencies = [
"anstream",
"anstyle",
@@ -469,14 +469,14 @@ dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
name = "clap_lex"
-version = "0.7.2"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97"
+checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
[[package]]
name = "color-eyre"
@@ -564,9 +564,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "cpufeatures"
-version = "0.2.15"
+version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ca741a962e1b0bff6d724a1a0958b686406e853bb14061f218562e1896f95e6"
+checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3"
dependencies = [
"libc",
]
@@ -701,7 +701,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -725,7 +725,7 @@ dependencies = [
"proc-macro2",
"quote",
"strsim",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -736,7 +736,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
"darling_core",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -792,7 +792,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -805,7 +805,7 @@ dependencies = [
"proc-macro2",
"quote",
"rustc_version",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -878,7 +878,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -969,7 +969,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -980,12 +980,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
-version = "0.3.9"
+version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
+checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
- "windows-sys 0.52.0",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -1000,9 +1000,9 @@ dependencies = [
[[package]]
name = "fastrand"
-version = "2.2.0"
+version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4"
+checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "fiat-crypto"
@@ -1033,9 +1033,9 @@ dependencies = [
[[package]]
name = "flate2"
-version = "1.0.34"
+version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
+checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c"
dependencies = [
"crc32fast",
"miniz_oxide 0.8.0",
@@ -1133,7 +1133,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -1226,9 +1226,9 @@ dependencies = [
[[package]]
name = "h2"
-version = "0.4.6"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
+checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e"
dependencies = [
"atomic-waker",
"bytes",
@@ -1236,7 +1236,7 @@ dependencies = [
"futures-core",
"futures-sink",
"http",
- "indexmap 2.6.0",
+ "indexmap 2.7.0",
"slab",
"tokio",
"tokio-util",
@@ -1264,9 +1264,9 @@ dependencies = [
[[package]]
name = "hashbrown"
-version = "0.15.1"
+version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3"
+checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
[[package]]
name = "heck"
@@ -1280,12 +1280,6 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
-[[package]]
-name = "hermit-abi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
-
[[package]]
name = "hermit-abi"
version = "0.4.0"
@@ -1332,9 +1326,9 @@ dependencies = [
[[package]]
name = "http"
-version = "1.1.0"
+version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
+checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea"
dependencies = [
"bytes",
"fnv",
@@ -1372,9 +1366,9 @@ checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946"
[[package]]
name = "hyper"
-version = "1.5.0"
+version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a"
+checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f"
dependencies = [
"bytes",
"futures-channel",
@@ -1580,7 +1574,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -1645,12 +1639,12 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "2.6.0"
+version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
+checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f"
dependencies = [
"equivalent",
- "hashbrown 0.15.1",
+ "hashbrown 0.15.2",
"serde",
]
@@ -1729,7 +1723,7 @@ version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b"
dependencies = [
- "hermit-abi 0.4.0",
+ "hermit-abi",
"libc",
"windows-sys 0.52.0",
]
@@ -1761,9 +1755,9 @@ dependencies = [
[[package]]
name = "itoa"
-version = "1.0.11"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
+checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
[[package]]
name = "jobserver"
@@ -1776,10 +1770,11 @@ dependencies = [
[[package]]
name = "js-sys"
-version = "0.3.72"
+version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
+checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
dependencies = [
+ "once_cell",
"wasm-bindgen",
]
@@ -1853,14 +1848,14 @@ dependencies = [
"ledger-transport",
"libc",
"log",
- "thiserror",
+ "thiserror 1.0.69",
]
[[package]]
name = "libc"
-version = "0.2.162"
+version = "0.2.168"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398"
+checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d"
[[package]]
name = "libdbus-sys"
@@ -1900,9 +1895,9 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "litemap"
-version = "0.7.3"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
+checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104"
[[package]]
name = "lock_api"
@@ -1973,11 +1968,10 @@ dependencies = [
[[package]]
name = "mio"
-version = "1.0.2"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
+checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
dependencies = [
- "hermit-abi 0.3.9",
"libc",
"wasi",
"windows-sys 0.52.0",
@@ -2033,9 +2027,9 @@ dependencies = [
[[package]]
name = "near-chain-configs"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa23b4799779931ac810dc95a834cf6832448462161431f65f2f0bd16f1a3b54"
+checksum = "4c1f312b5e1cdb6d6eb8a753de5798fe70fc2aa048b37d9a08a8d63f5623707d"
dependencies = [
"anyhow",
"bytesize",
@@ -2103,7 +2097,7 @@ dependencies = [
"strum",
"strum_macros",
"textwrap",
- "thiserror",
+ "thiserror 2.0.6",
"tokio",
"toml",
"tracing",
@@ -2116,21 +2110,21 @@ dependencies = [
[[package]]
name = "near-config-utils"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e7b41110a20f1d82bb06f06e4800068c5ade6d8ff844787f8753bc2ce7b16f7"
+checksum = "bedc768765dd8229a1d960c94f517317f40771a003e78916124784c7d6ea9d74"
dependencies = [
"anyhow",
"json_comments",
- "thiserror",
+ "thiserror 2.0.6",
"tracing",
]
[[package]]
name = "near-crypto"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43b17944c8d0f274c684227d79fcd46d583b1e36064b597c53a9ebec187a86f3"
+checksum = "4374804fdd45ac84c9e7cc3183312c98560c5518d81e6d8e2d92b77587e5a9f3"
dependencies = [
"blake2",
"borsh",
@@ -2149,14 +2143,14 @@ dependencies = [
"serde",
"serde_json",
"subtle",
- "thiserror",
+ "thiserror 2.0.6",
]
[[package]]
name = "near-fmt"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1eff0731995774d1498f017c968a3ebbfdadad84f556afea4b83679f6706ac9"
+checksum = "f14f36eee2dcb0ecd8febb9f198e0e1fa768c834db9e1982ad2acfcd04b45acf"
dependencies = [
"near-primitives-core",
]
@@ -2174,9 +2168,9 @@ dependencies = [
[[package]]
name = "near-jsonrpc-client"
-version = "0.14.0"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "942dfa1269d14ea33454a0e9bc39b0d14ab5c6057b21e23e80753239879c5e54"
+checksum = "e66a0c4c47f2fbbfa11ea8317fce2288d70d4aa8231e77fd213721ffcc1c334f"
dependencies = [
"borsh",
"lazy_static",
@@ -2188,14 +2182,14 @@ dependencies = [
"reqwest",
"serde",
"serde_json",
- "thiserror",
+ "thiserror 2.0.6",
]
[[package]]
name = "near-jsonrpc-primitives"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c89197294a74af70fd5d06b4876dc2a400ffbdff6131e640e75fcb4fd194649"
+checksum = "90f445f809d1f227f0f61f38c14271635c0bc9a28a8f74a803a4fb25292d5ea7"
dependencies = [
"arbitrary",
"near-chain-configs",
@@ -2204,7 +2198,7 @@ dependencies = [
"near-schema-checker-lib",
"serde",
"serde_json",
- "thiserror",
+ "thiserror 2.0.6",
"time",
]
@@ -2226,9 +2220,9 @@ dependencies = [
[[package]]
name = "near-parameters"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0d4b4d014ac9f46baf0eeac7214567a08db97d5fd26157ea13edfbb8ffc5fd8c"
+checksum = "1279baa276725971d5e2b80c524d1aa42d5ad8bccf8901466fd579374cf58a14"
dependencies = [
"borsh",
"enum-map",
@@ -2240,14 +2234,14 @@ dependencies = [
"serde_repr",
"serde_yaml",
"strum",
- "thiserror",
+ "thiserror 2.0.6",
]
[[package]]
name = "near-primitives"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b45b4742a1817ff7d80dcf51c6facb8134478f8c4a6d717825cca2e4b834b17f"
+checksum = "6ab6ecc354e61c40b044c8b553c187383a587a1679d2e594f0b98ca58dbfb6e3"
dependencies = [
"arbitrary",
"base64 0.21.7",
@@ -2280,16 +2274,16 @@ dependencies = [
"sha3",
"smart-default 0.6.0",
"strum",
- "thiserror",
+ "thiserror 2.0.6",
"tracing",
"zstd",
]
[[package]]
name = "near-primitives-core"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0de2c9da5de096b5cd4786a270900ff32a49d267e442a2e7f271fb23eb925c87"
+checksum = "d597af103bb7881d1fb9031fb126cfe6c1acb9c9a6c8296dca45b5b3beb0893d"
dependencies = [
"arbitrary",
"base64 0.21.7",
@@ -2303,20 +2297,20 @@ dependencies = [
"serde",
"serde_repr",
"sha2 0.10.8",
- "thiserror",
+ "thiserror 2.0.6",
]
[[package]]
name = "near-schema-checker-core"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03541d1dadd0b5dd0a2e1ae1fbe5735fdab79332ed556af36cdcbe50d4b8cf04"
+checksum = "a48405425eca34de98e680416310df33fdb75768a78481cc75b43172b2748613"
[[package]]
name = "near-schema-checker-lib"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa9050b0822d2c0dbd90d8c523fd74634f77c5be4ed3337e7010c0d986121982"
+checksum = "dfb720bf5cc256af687a9eb7a6e05baf3668dc75cfd43098e83ba1b3d3900f08"
dependencies = [
"near-schema-checker-core",
"near-schema-checker-macro",
@@ -2324,15 +2318,15 @@ dependencies = [
[[package]]
name = "near-schema-checker-macro"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1bca8c93ff0ad17138c147323a07f036d11c9e1602e3bc2ac9d29c3cf78b89d"
+checksum = "b41a159cbf732acc0279febdde046d9036330a32a951796bce42f9529bce799d"
[[package]]
name = "near-socialdb-client"
-version = "0.8.0"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd06eda493540f1b342dadd7bd001dc32cfdc5ed3160818e01af356f1862e4b0"
+checksum = "7d8e81d873d7663b24d2df9facc7b38d09aa1c88632cd31d88c3a602e787ec67"
dependencies = [
"color-eyre",
"near-crypto",
@@ -2347,15 +2341,15 @@ dependencies = [
[[package]]
name = "near-stdx"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "427b4e4af5e32f682064772da8b1a7558b3f090e6151c8804cff24ee6c5c4966"
+checksum = "7a91674768828a593f4bac4aeca9334c4b56fe19344a2ccf7bd795b2325f0b5e"
[[package]]
name = "near-time"
-version = "0.27.0"
+version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66ade805f0ca8211f0ca2e6ea130f8ddd03bf70c9c93ebeabdddf37314e3f30b"
+checksum = "c92bf9dffb11126e8db9a6a51bcb330c8584d0bab0d6d14c20cf2ff1f16d684d"
dependencies = [
"serde",
"time",
@@ -2529,9 +2523,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "open"
-version = "5.3.0"
+version = "5.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3"
+checksum = "3ecd52f0b8d15c40ce4820aa251ed5de032e5d91fab27f7db2f40d42a8bdf69c"
dependencies = [
"is-wsl",
"libc",
@@ -2561,7 +2555,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -2572,9 +2566,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
-version = "300.4.0+3.4.0"
+version = "300.4.1+3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a709e02f2b4aca747929cca5ed248880847c650233cf8b8cdc48f40aaf4898a6"
+checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c"
dependencies = [
"cc",
]
@@ -2647,9 +2641,9 @@ dependencies = [
[[package]]
name = "pathdiff"
-version = "0.2.2"
+version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361"
+checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]]
name = "percent-encoding"
@@ -2687,9 +2681,9 @@ checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2"
[[package]]
name = "portable-atomic"
-version = "1.9.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
+checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
[[package]]
name = "powerfmt"
@@ -2765,9 +2759,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
-version = "1.0.89"
+version = "1.0.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
+checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
dependencies = [
"unicode-ident",
]
@@ -2850,9 +2844,9 @@ dependencies = [
[[package]]
name = "redox_syscall"
-version = "0.5.7"
+version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
+checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags 2.6.0",
]
@@ -2865,7 +2859,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [
"getrandom",
"libredox",
- "thiserror",
+ "thiserror 1.0.69",
]
[[package]]
@@ -3042,22 +3036,22 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.38.40"
+version = "0.38.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99e4ea3e1cdc4b559b8e5650f9c8e5998e3e5c1343b4eaf034565f32318d63c0"
+checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85"
dependencies = [
"bitflags 2.6.0",
"errno",
"libc",
"linux-raw-sys",
- "windows-sys 0.52.0",
+ "windows-sys 0.59.0",
]
[[package]]
name = "rustls"
-version = "0.23.16"
+version = "0.23.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e"
+checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b"
dependencies = [
"once_cell",
"rustls-pki-types",
@@ -3115,9 +3109,9 @@ dependencies = [
[[package]]
name = "schannel"
-version = "0.1.26"
+version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1"
+checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
dependencies = [
"windows-sys 0.59.0",
]
@@ -3143,7 +3137,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde_derive_internals",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -3249,28 +3243,28 @@ dependencies = [
[[package]]
name = "semver"
-version = "1.0.23"
+version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
+checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba"
[[package]]
name = "serde"
-version = "1.0.215"
+version = "1.0.216"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
+checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.215"
+version = "1.0.216"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
+checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -3281,14 +3275,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
name = "serde_json"
-version = "1.0.132"
+version = "1.0.133"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
+checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
dependencies = [
"itoa",
"memchr",
@@ -3304,7 +3298,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -3338,7 +3332,7 @@ dependencies = [
"chrono",
"hex",
"indexmap 1.9.3",
- "indexmap 2.6.0",
+ "indexmap 2.7.0",
"serde",
"serde_derive",
"serde_json",
@@ -3355,7 +3349,7 @@ dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -3364,7 +3358,7 @@ version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
- "indexmap 2.6.0",
+ "indexmap 2.7.0",
"itoa",
"ryu",
"serde",
@@ -3532,7 +3526,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -3559,14 +3553,14 @@ dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
name = "socket2"
-version = "0.5.7"
+version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
+checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8"
dependencies = [
"libc",
"windows-sys 0.52.0",
@@ -3647,9 +3641,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.87"
+version = "2.0.90"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
+checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31"
dependencies = [
"proc-macro2",
"quote",
@@ -3658,9 +3652,9 @@ dependencies = [
[[package]]
name = "sync_wrapper"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
dependencies = [
"futures-core",
]
@@ -3673,7 +3667,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -3755,7 +3749,16 @@ version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [
- "thiserror-impl",
+ "thiserror-impl 1.0.69",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47"
+dependencies = [
+ "thiserror-impl 2.0.6",
]
[[package]]
@@ -3766,7 +3769,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
+]
+
+[[package]]
+name = "thiserror-impl"
+version = "2.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.90",
]
[[package]]
@@ -3781,9 +3795,9 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.36"
+version = "0.3.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
+checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21"
dependencies = [
"deranged",
"itoa",
@@ -3802,9 +3816,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
-version = "0.2.18"
+version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
+checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de"
dependencies = [
"num-conv",
"time-core",
@@ -3837,14 +3851,14 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.41.1"
+version = "1.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33"
+checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551"
dependencies = [
"backtrace",
"bytes",
"libc",
- "mio 1.0.2",
+ "mio 1.0.3",
"pin-project-lite",
"socket2",
"windows-sys 0.52.0",
@@ -3862,20 +3876,19 @@ dependencies = [
[[package]]
name = "tokio-rustls"
-version = "0.26.0"
+version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
+checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37"
dependencies = [
"rustls",
- "rustls-pki-types",
"tokio",
]
[[package]]
name = "tokio-util"
-version = "0.7.12"
+version = "0.7.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a"
+checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078"
dependencies = [
"bytes",
"futures-core",
@@ -3911,7 +3924,7 @@ version = "0.22.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
dependencies = [
- "indexmap 2.6.0",
+ "indexmap 2.7.0",
"serde",
"serde_spanned",
"toml_datetime",
@@ -3926,9 +3939,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
-version = "0.1.40"
+version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
+checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-attributes",
@@ -3937,20 +3950,20 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.27"
+version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
+checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
name = "tracing-core"
-version = "0.1.32"
+version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
+checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
dependencies = [
"once_cell",
"valuable",
@@ -3958,9 +3971,9 @@ dependencies = [
[[package]]
name = "tracing-error"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e"
+checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db"
dependencies = [
"tracing",
"tracing-subscriber",
@@ -3968,9 +3981,9 @@ dependencies = [
[[package]]
name = "tracing-indicatif"
-version = "0.3.6"
+version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "069580424efe11d97c3fef4197fa98c004fa26672cc71ad8770d224e23b1951d"
+checksum = "74ba258e9de86447f75edf6455fded8e5242704c6fccffe7bf8d7fb6daef1180"
dependencies = [
"indicatif",
"tracing",
@@ -3991,9 +4004,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
-version = "0.3.18"
+version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
+checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
dependencies = [
"matchers",
"nu-ansi-term",
@@ -4033,9 +4046,9 @@ dependencies = [
[[package]]
name = "unicode-ident"
-version = "1.0.13"
+version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
[[package]]
name = "unicode-linebreak"
@@ -4084,9 +4097,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
-version = "2.5.3"
+version = "2.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d157f1b96d14500ffdc1f10ba712e780825526c03d9a49b4d0324b0d9113ada"
+checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60"
dependencies = [
"form_urlencoded",
"idna",
@@ -4202,9 +4215,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
-version = "0.2.95"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
+checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
dependencies = [
"cfg-if",
"once_cell",
@@ -4213,36 +4226,36 @@ dependencies = [
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.95"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
+checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
dependencies = [
"bumpalo",
"log",
- "once_cell",
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.45"
+version = "0.4.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
+checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2"
dependencies = [
"cfg-if",
"js-sys",
+ "once_cell",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.95"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
+checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -4250,22 +4263,22 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.95"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
+checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.95"
+version = "0.2.99"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
+checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
[[package]]
name = "wasmparser"
@@ -4276,16 +4289,16 @@ dependencies = [
"ahash 0.8.11",
"bitflags 2.6.0",
"hashbrown 0.14.5",
- "indexmap 2.6.0",
+ "indexmap 2.7.0",
"semver",
"serde",
]
[[package]]
name = "web-sys"
-version = "0.3.72"
+version = "0.3.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
+checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
dependencies = [
"js-sys",
"wasm-bindgen",
@@ -4562,9 +4575,9 @@ dependencies = [
[[package]]
name = "yoke"
-version = "0.7.4"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
+checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40"
dependencies = [
"serde",
"stable_deref_trait",
@@ -4574,13 +4587,13 @@ dependencies = [
[[package]]
name = "yoke-derive"
-version = "0.7.4"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28cc31741b18cb6f1d5ff12f5b7523e3d6eb0852bbbad19d73905511d9849b95"
+checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
"synstructure",
]
@@ -4602,27 +4615,27 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
name = "zerofrom"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
+checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e"
dependencies = [
"zerofrom-derive",
]
[[package]]
name = "zerofrom-derive"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ea7b4a3637ea8669cedf0f1fd5c286a17f3de97b8dd5a70a6c167a1730e63a5"
+checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
"synstructure",
]
@@ -4651,7 +4664,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.87",
+ "syn 2.0.90",
]
[[package]]
@@ -4662,7 +4675,7 @@ checksum = "6413a546ada9dbcd0b9a3e0b0880581279e35047bce9797e523b3408e1df607c"
dependencies = [
"base64 0.22.1",
"ed25519-dalek",
- "thiserror",
+ "thiserror 1.0.69",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 541e36a1f..988f6b71d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -69,17 +69,17 @@ self_update = { version = "0.41.0", features = [
], optional = true }
color-eyre = "0.6"
-thiserror = "1"
+thiserror = "2"
bytesize = "1.1.0"
prettytable = "0.10.0"
textwrap = "0.16.1"
-near-crypto = "0.27"
-near-primitives = "0.27"
-near-jsonrpc-client = "0.14"
-near-jsonrpc-primitives = "0.27"
-near-socialdb-client = "0.8"
+near-crypto = "0.28"
+near-primitives = "0.28"
+near-jsonrpc-client = "0.15"
+near-jsonrpc-primitives = "0.28"
+near-socialdb-client = "0.9"
near-ledger = { version = "0.8.0", optional = true }
@@ -129,7 +129,13 @@ installers = ["shell", "powershell", "npm", "msi"]
# Publish jobs to run in CI
publish-jobs = ["npm"]
# Target platforms to build apps for (Rust target-triple syntax)
-targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
+targets = [
+ "aarch64-apple-darwin",
+ "aarch64-unknown-linux-gnu",
+ "x86_64-apple-darwin",
+ "x86_64-unknown-linux-gnu",
+ "x86_64-pc-windows-msvc",
+]
# The archive format to use for windows builds (defaults .zip)
windows-archive = ".tar.gz"
# The archive format to use for non-windows builds (defaults .tar.xz)
diff --git a/rust-toolchain b/rust-toolchain
index d456f7459..2bf5ad044 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1 @@
-1.80
+stable
diff --git a/src/commands/account/update_social_profile/sign_as.rs b/src/commands/account/update_social_profile/sign_as.rs
index f66436deb..2819da23e 100644
--- a/src/commands/account/update_social_profile/sign_as.rs
+++ b/src/commands/account/update_social_profile/sign_as.rs
@@ -58,11 +58,11 @@ impl From for crate::commands::ActionContext {
let account_id = item.account_id.clone();
move |prepopulated_unsigned_transaction, network_config| {
let json_rpc_client = network_config.json_rpc_client();
- let public_key = prepopulated_unsigned_transaction.public_key().clone();
- let receiver_id = prepopulated_unsigned_transaction.receiver_id().clone();
+ let public_key = prepopulated_unsigned_transaction.public_key.clone();
+ let receiver_id = prepopulated_unsigned_transaction.receiver_id.clone();
if let Some(near_primitives::transaction::Action::FunctionCall(action)) =
- prepopulated_unsigned_transaction.actions_mut().get_mut(0)
+ prepopulated_unsigned_transaction.actions.first_mut()
{
action.deposit = get_deposit(
&json_rpc_client,
diff --git a/src/commands/mod.rs b/src/commands/mod.rs
index 8306a7108..fa8ebc441 100644
--- a/src/commands/mod.rs
+++ b/src/commands/mod.rs
@@ -52,7 +52,7 @@ pub enum TopLevelCommand {
pub type OnBeforeSigningCallback = std::sync::Arc<
dyn Fn(
- &mut near_primitives::transaction::Transaction,
+ &mut near_primitives::transaction::TransactionV0,
&crate::config::NetworkConfig,
) -> crate::CliResult,
>;
@@ -68,6 +68,16 @@ pub struct PrepopulatedTransaction {
pub actions: Vec,
}
+impl From for PrepopulatedTransaction {
+ fn from(value: near_primitives::transaction::TransactionV0) -> Self {
+ Self {
+ signer_id: value.signer_id,
+ receiver_id: value.receiver_id,
+ actions: value.actions,
+ }
+ }
+}
+
impl From for PrepopulatedTransaction {
fn from(value: near_primitives::transaction::Transaction) -> Self {
Self {
diff --git a/src/commands/transaction/print_transaction/unsigned/mod.rs b/src/commands/transaction/print_transaction/unsigned/mod.rs
index b31673c94..db609ccb6 100644
--- a/src/commands/transaction/print_transaction/unsigned/mod.rs
+++ b/src/commands/transaction/print_transaction/unsigned/mod.rs
@@ -1,3 +1,5 @@
+use near_primitives::transaction::Transaction;
+
#[derive(Debug, Clone, interactive_clap::InteractiveClap)]
#[interactive_clap(input_context = crate::GlobalContext)]
#[interactive_clap(output_context = PrintContext)]
@@ -14,11 +16,11 @@ impl PrintContext {
_previous_context: crate::GlobalContext,
scope: &::InteractiveClapContextScope,
) -> color_eyre::eyre::Result {
- let unsigned_transaction: near_primitives::transaction::Transaction =
+ let unsigned_transaction: near_primitives::transaction::TransactionV0 =
scope.unsigned_transaction.clone().into();
eprintln!("\nUnsigned transaction (full):\n");
- crate::common::print_full_unsigned_transaction(unsigned_transaction);
+ crate::common::print_full_unsigned_transaction(Transaction::V0(unsigned_transaction));
eprintln!();
Ok(Self)
diff --git a/src/commands/transaction/send_meta_transaction/sign_as/mod.rs b/src/commands/transaction/send_meta_transaction/sign_as/mod.rs
index a777baf30..3a7a25544 100644
--- a/src/commands/transaction/send_meta_transaction/sign_as/mod.rs
+++ b/src/commands/transaction/send_meta_transaction/sign_as/mod.rs
@@ -40,7 +40,7 @@ impl RelayerAccountIdContext {
let on_before_signing_callback: crate::commands::OnBeforeSigningCallback =
std::sync::Arc::new({
move |prepopulated_unsigned_transaction, _network_config| {
- *prepopulated_unsigned_transaction.actions_mut() =
+ prepopulated_unsigned_transaction.actions =
vec![near_primitives::transaction::Action::Delegate(Box::new(
previous_context.signed_delegate_action.clone(),
))];
diff --git a/src/commands/transaction/sign_transaction/mod.rs b/src/commands/transaction/sign_transaction/mod.rs
index faaf70758..6f13b5778 100644
--- a/src/commands/transaction/sign_transaction/mod.rs
+++ b/src/commands/transaction/sign_transaction/mod.rs
@@ -19,7 +19,7 @@ impl SignTransactionContext {
) -> color_eyre::eyre::Result {
let get_prepopulated_transaction_after_getting_network_callback: crate::commands::GetPrepopulatedTransactionAfterGettingNetworkCallback =
std::sync::Arc::new({
- let unsigned_transaction: near_primitives::transaction::Transaction =
+ let unsigned_transaction: near_primitives::transaction::TransactionV0 =
scope.unsigned_transaction.clone().into();
move |_network_config| {
@@ -32,8 +32,8 @@ impl SignTransactionContext {
Ok(Self(crate::commands::ActionContext {
global_context: previous_context,
interacting_with_account_ids: vec![
- scope.unsigned_transaction.inner.signer_id().clone(),
- scope.unsigned_transaction.inner.receiver_id().clone(),
+ scope.unsigned_transaction.inner.signer_id.clone(),
+ scope.unsigned_transaction.inner.receiver_id.clone(),
],
get_prepopulated_transaction_after_getting_network_callback,
on_before_signing_callback: std::sync::Arc::new(
diff --git a/src/common.rs b/src/common.rs
index 351ca3113..8f817ed3e 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1192,11 +1192,12 @@ pub fn convert_invalid_tx_error_to_cli_result(
},
near_primitives::errors::InvalidTxError::StorageError(error) => match error {
near_primitives::errors::StorageError::StorageInternalError => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: Internal storage error")),
- near_primitives::errors::StorageError::MissingTrieValue(_, _) => todo!(),
+ near_primitives::errors::StorageError::MissingTrieValue(_, hash) => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: Requested trie value by its hash ({hash}) which is missing in the storage",)),
near_primitives::errors::StorageError::UnexpectedTrieValue => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: Unexpected trie value")),
near_primitives::errors::StorageError::StorageInconsistentState(message) => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: The storage is in the incosistent state: {}", message)),
near_primitives::errors::StorageError::FlatStorageBlockNotSupported(message) => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: The block is not supported by flat storage: {}", message)),
near_primitives::errors::StorageError::MemTrieLoadingError(message) => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: The trie is not loaded in memory: {}", message)),
+ near_primitives::errors::StorageError::FlatStorageReshardingAlreadyInProgress => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: Flat storage resharding is already in progress")),
},
near_primitives::errors::InvalidTxError::ShardCongested { shard_id, congestion_level } => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: The shard ({shard_id}) is too congested ({congestion_level:.2}/1.00) and can't accept new transaction")),
near_primitives::errors::InvalidTxError::ShardStuck { shard_id, missed_chunks } => color_eyre::eyre::Result::Err(color_eyre::eyre::eyre!("Error: The shard ({shard_id}) is {missed_chunks} blocks behind and can't accept new transaction until it will be in the sync")),
diff --git a/src/js_command_match/account/delete.rs b/src/js_command_match/account/delete.rs
index 5ca4e2dd0..f3951b405 100644
--- a/src/js_command_match/account/delete.rs
+++ b/src/js_command_match/account/delete.rs
@@ -57,44 +57,44 @@ mod tests {
fn delete_account() {
for (input, expected_output) in [
(
- format!("near delete bob.testnet alice.testnet --force"),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-keychain send")
+ "near delete bob.testnet alice.testnet --force".to_string(),
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-keychain send".to_string()
),
(
- format!("near delete-account bob.testnet alice.testnet --force"),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-keychain send")
+ "near delete-account bob.testnet alice.testnet --force".to_string(),
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-keychain send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --{} --force", SIGN_WITH_LEDGER_ALIASES[0]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --{} --force", SIGN_WITH_LEDGER_ALIASES[1]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --{} --force", SIGN_WITH_LEDGER_ALIASES[2]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --{} --force", SIGN_WITH_LEDGER_ALIASES[3]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --signWithLedger --{} \"44'/397'/0'/0'/2'\" --force", LEDGER_PATH_ALIASES[0]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/2'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/2'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --signWithLedger --{} \"44'/397'/0'/0'/2'\" --force", LEDGER_PATH_ALIASES[1]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/2'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config testnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/2'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --signWithLedger --{} mainnet --force", NETWORK_ID_ALIASES[0]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config mainnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config mainnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send".to_string()
),
(
format!("near delete-account bob.testnet alice.testnet --signWithLedger --{} mainnet --force", NETWORK_ID_ALIASES[1]),
- format!("account delete-account bob.testnet beneficiary alice.testnet network-config mainnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send")
+ "account delete-account bob.testnet beneficiary alice.testnet network-config mainnet sign-with-ledger --seed-phrase-hd-path '44'\\''/397'\\''/0'\\''/0'\\''/1'\\''' send".to_string()
)
] {
let input_cmd = shell_words::split(&input).expect("Input command must be a valid shell command");
diff --git a/src/transaction_signature_options/sign_with_access_key_file/mod.rs b/src/transaction_signature_options/sign_with_access_key_file/mod.rs
index e5a013026..0f445406a 100644
--- a/src/transaction_signature_options/sign_with_access_key_file/mod.rs
+++ b/src/transaction_signature_options/sign_with_access_key_file/mod.rs
@@ -1,5 +1,6 @@
use color_eyre::eyre::{ContextCompat, WrapErr};
use inquire::CustomType;
+use near_primitives::transaction::Transaction;
use near_primitives::transaction::TransactionV0;
use crate::common::JsonRpcClientExt;
@@ -90,18 +91,19 @@ impl SignAccessKeyFileContext {
)
};
- let mut unsigned_transaction =
- near_primitives::transaction::Transaction::V0(TransactionV0 {
- public_key: account_json.public_key.clone(),
- block_hash,
- nonce,
- signer_id: previous_context.prepopulated_transaction.signer_id,
- receiver_id: previous_context.prepopulated_transaction.receiver_id,
- actions: previous_context.prepopulated_transaction.actions,
- });
+ let mut unsigned_transaction = TransactionV0 {
+ public_key: account_json.public_key.clone(),
+ block_hash,
+ nonce,
+ signer_id: previous_context.prepopulated_transaction.signer_id,
+ receiver_id: previous_context.prepopulated_transaction.receiver_id,
+ actions: previous_context.prepopulated_transaction.actions,
+ };
(previous_context.on_before_signing_callback)(&mut unsigned_transaction, &network_config)?;
+ let unsigned_transaction = Transaction::V0(unsigned_transaction);
+
let signature = account_json
.private_key
.sign(unsigned_transaction.get_hash_and_size().0.as_ref());
diff --git a/src/transaction_signature_options/sign_with_keychain/mod.rs b/src/transaction_signature_options/sign_with_keychain/mod.rs
index f9b1af826..85dd43001 100644
--- a/src/transaction_signature_options/sign_with_keychain/mod.rs
+++ b/src/transaction_signature_options/sign_with_keychain/mod.rs
@@ -1,5 +1,6 @@
use color_eyre::eyre::{ContextCompat, WrapErr};
use inquire::CustomType;
+use near_primitives::transaction::Transaction;
use near_primitives::transaction::TransactionV0;
use tracing_indicatif::span_ext::IndicatifSpanExt;
@@ -181,18 +182,19 @@ impl SignKeychainContext {
)
};
- let mut unsigned_transaction =
- near_primitives::transaction::Transaction::V0(TransactionV0 {
- public_key: account_json.public_key.clone(),
- block_hash,
- nonce,
- signer_id: previous_context.prepopulated_transaction.signer_id,
- receiver_id: previous_context.prepopulated_transaction.receiver_id,
- actions: previous_context.prepopulated_transaction.actions,
- });
+ let mut unsigned_transaction = TransactionV0 {
+ public_key: account_json.public_key.clone(),
+ block_hash,
+ nonce,
+ signer_id: previous_context.prepopulated_transaction.signer_id,
+ receiver_id: previous_context.prepopulated_transaction.receiver_id,
+ actions: previous_context.prepopulated_transaction.actions,
+ };
(previous_context.on_before_signing_callback)(&mut unsigned_transaction, &network_config)?;
+ let unsigned_transaction = Transaction::V0(unsigned_transaction);
+
let signature = account_json
.private_key
.sign(unsigned_transaction.get_hash_and_size().0.as_ref());
diff --git a/src/transaction_signature_options/sign_with_ledger/mod.rs b/src/transaction_signature_options/sign_with_ledger/mod.rs
index 7be7943b3..a67ba7f28 100644
--- a/src/transaction_signature_options/sign_with_ledger/mod.rs
+++ b/src/transaction_signature_options/sign_with_ledger/mod.rs
@@ -3,6 +3,7 @@ use inquire::CustomType;
use near_ledger::NEARLedgerError;
use near_primitives::action::delegate::SignedDelegateAction;
use near_primitives::borsh;
+use near_primitives::transaction::Transaction;
use near_primitives::transaction::TransactionV0;
use crate::common::JsonRpcClientExt;
@@ -101,18 +102,19 @@ impl SignLedgerContext {
)
};
- let mut unsigned_transaction =
- near_primitives::transaction::Transaction::V0(TransactionV0 {
- public_key: scope.signer_public_key.clone().into(),
- block_hash,
- nonce,
- signer_id: previous_context.prepopulated_transaction.signer_id,
- receiver_id: previous_context.prepopulated_transaction.receiver_id,
- actions: previous_context.prepopulated_transaction.actions,
- });
+ let mut unsigned_transaction = TransactionV0 {
+ public_key: scope.signer_public_key.clone().into(),
+ block_hash,
+ nonce,
+ signer_id: previous_context.prepopulated_transaction.signer_id,
+ receiver_id: previous_context.prepopulated_transaction.receiver_id,
+ actions: previous_context.prepopulated_transaction.actions,
+ };
(previous_context.on_before_signing_callback)(&mut unsigned_transaction, &network_config)?;
+ let unsigned_transaction = Transaction::V0(unsigned_transaction);
+
if network_config.meta_transaction_relayer_url.is_some() {
let max_block_height = block_height
+ scope
diff --git a/src/transaction_signature_options/sign_with_legacy_keychain/mod.rs b/src/transaction_signature_options/sign_with_legacy_keychain/mod.rs
index 2e9dd7ff7..dcbc2a425 100644
--- a/src/transaction_signature_options/sign_with_legacy_keychain/mod.rs
+++ b/src/transaction_signature_options/sign_with_legacy_keychain/mod.rs
@@ -4,6 +4,7 @@ use std::str::FromStr;
use color_eyre::eyre::{ContextCompat, WrapErr};
use inquire::{CustomType, Select};
+use near_primitives::transaction::Transaction;
use near_primitives::transaction::TransactionV0;
use crate::common::JsonRpcClientExt;
@@ -176,18 +177,19 @@ impl SignLegacyKeychainContext {
)
};
- let mut unsigned_transaction =
- near_primitives::transaction::Transaction::V0(TransactionV0 {
- public_key: signer_access_key.public_key.clone(),
- block_hash,
- nonce,
- signer_id: previous_context.prepopulated_transaction.signer_id,
- receiver_id: previous_context.prepopulated_transaction.receiver_id,
- actions: previous_context.prepopulated_transaction.actions,
- });
+ let mut unsigned_transaction = TransactionV0 {
+ public_key: signer_access_key.public_key.clone(),
+ block_hash,
+ nonce,
+ signer_id: previous_context.prepopulated_transaction.signer_id,
+ receiver_id: previous_context.prepopulated_transaction.receiver_id,
+ actions: previous_context.prepopulated_transaction.actions,
+ };
(previous_context.on_before_signing_callback)(&mut unsigned_transaction, &network_config)?;
+ let unsigned_transaction = Transaction::V0(unsigned_transaction);
+
if network_config.meta_transaction_relayer_url.is_some() {
let max_block_height = block_height
+ scope
diff --git a/src/transaction_signature_options/sign_with_private_key/mod.rs b/src/transaction_signature_options/sign_with_private_key/mod.rs
index db079c11c..8b6d6c776 100644
--- a/src/transaction_signature_options/sign_with_private_key/mod.rs
+++ b/src/transaction_signature_options/sign_with_private_key/mod.rs
@@ -1,5 +1,6 @@
use color_eyre::eyre::{ContextCompat, WrapErr};
use inquire::CustomType;
+use near_primitives::transaction::Transaction;
use near_primitives::transaction::TransactionV0;
use crate::common::JsonRpcClientExt;
@@ -90,18 +91,19 @@ impl SignPrivateKeyContext {
)
};
- let mut unsigned_transaction =
- near_primitives::transaction::Transaction::V0(TransactionV0 {
- public_key: public_key.clone(),
- block_hash,
- nonce,
- signer_id: previous_context.prepopulated_transaction.signer_id,
- receiver_id: previous_context.prepopulated_transaction.receiver_id,
- actions: previous_context.prepopulated_transaction.actions,
- });
+ let mut unsigned_transaction = TransactionV0 {
+ public_key: public_key.clone(),
+ block_hash,
+ nonce,
+ signer_id: previous_context.prepopulated_transaction.signer_id,
+ receiver_id: previous_context.prepopulated_transaction.receiver_id,
+ actions: previous_context.prepopulated_transaction.actions,
+ };
(previous_context.on_before_signing_callback)(&mut unsigned_transaction, &network_config)?;
+ let unsigned_transaction = Transaction::V0(unsigned_transaction);
+
let signature = signer_secret_key.sign(unsigned_transaction.get_hash_and_size().0.as_ref());
if network_config.meta_transaction_relayer_url.is_some() {
diff --git a/src/transaction_signature_options/sign_with_seed_phrase/mod.rs b/src/transaction_signature_options/sign_with_seed_phrase/mod.rs
index c14d36cb8..7f6e59453 100644
--- a/src/transaction_signature_options/sign_with_seed_phrase/mod.rs
+++ b/src/transaction_signature_options/sign_with_seed_phrase/mod.rs
@@ -97,16 +97,19 @@ impl SignSeedPhraseContext {
)
};
- let mut unsigned_transaction = Transaction::V0(TransactionV0 {
+ let mut unsigned_transaction = TransactionV0 {
public_key: signer_public_key.clone(),
block_hash,
nonce,
signer_id: previous_context.prepopulated_transaction.signer_id,
receiver_id: previous_context.prepopulated_transaction.receiver_id,
actions: previous_context.prepopulated_transaction.actions,
- });
+ };
+
(previous_context.on_before_signing_callback)(&mut unsigned_transaction, &network_config)?;
+ let unsigned_transaction = Transaction::V0(unsigned_transaction);
+
let signature = signer_secret_key.sign(unsigned_transaction.get_hash_and_size().0.as_ref());
if network_config.meta_transaction_relayer_url.is_some() {
diff --git a/src/types/transaction.rs b/src/types/transaction.rs
index c5ad6dac3..e21b42ea3 100644
--- a/src/types/transaction.rs
+++ b/src/types/transaction.rs
@@ -2,10 +2,10 @@ use near_primitives::{borsh, borsh::BorshDeserialize};
#[derive(Debug, Clone)]
pub struct TransactionAsBase64 {
- pub inner: near_primitives::transaction::Transaction,
+ pub inner: near_primitives::transaction::TransactionV0,
}
-impl From for near_primitives::transaction::Transaction {
+impl From for near_primitives::transaction::TransactionV0 {
fn from(transaction: TransactionAsBase64) -> Self {
transaction.inner
}
@@ -13,10 +13,31 @@ impl From for near_primitives::transaction::Transaction {
impl From for TransactionAsBase64 {
fn from(value: near_primitives::transaction::Transaction) -> Self {
+ Self {
+ inner: near_primitives::transaction::TransactionV0 {
+ public_key: value.public_key().clone(),
+ nonce: value.nonce(),
+ signer_id: value.signer_id().clone(),
+ receiver_id: value.receiver_id().clone(),
+ block_hash: *value.block_hash(),
+ actions: value.take_actions(),
+ },
+ }
+ }
+}
+
+impl From for TransactionAsBase64 {
+ fn from(value: near_primitives::transaction::TransactionV0) -> Self {
Self { inner: value }
}
}
+impl From for near_primitives::transaction::Transaction {
+ fn from(transaction: TransactionAsBase64) -> Self {
+ Self::V0(transaction.inner)
+ }
+}
+
impl interactive_clap::ToCli for TransactionAsBase64 {
type CliVariant = TransactionAsBase64;
}
@@ -25,7 +46,7 @@ impl std::str::FromStr for TransactionAsBase64 {
type Err = String;
fn from_str(s: &str) -> Result {
Ok(Self {
- inner: near_primitives::transaction::Transaction::try_from_slice(
+ inner: near_primitives::transaction::TransactionV0::try_from_slice(
&near_primitives::serialize::from_base64(s)
.map_err(|err| format!("base64 transaction sequence is invalid: {}", err))?,
)
From 6f7cdf763b860e18ad8b3d2975528d51458e960f Mon Sep 17 00:00:00 2001
From: FroVolod
Date: Fri, 13 Dec 2024 15:53:39 +0200
Subject: [PATCH 6/6] feat: Added the ability to use TEACH ME mode to create an
account with a faucet service sponsor (#407)
Co-authored-by: FroVolod
---
.../sponsor_by_faucet_service/mod.rs | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/commands/account/create_account/sponsor_by_faucet_service/mod.rs b/src/commands/account/create_account/sponsor_by_faucet_service/mod.rs
index 33079e9fd..8b237325a 100644
--- a/src/commands/account/create_account/sponsor_by_faucet_service/mod.rs
+++ b/src/commands/account/create_account/sponsor_by_faucet_service/mod.rs
@@ -81,11 +81,30 @@ pub fn before_creating_account(
)))
};
tracing::Span::current().pb_set_message(faucet_service_url.as_str());
+ tracing::info!(target: "near_teach_me", "{}", faucet_service_url.as_str());
let mut data = std::collections::HashMap::new();
data.insert("newAccountId", new_account_id.to_string());
data.insert("newAccountPublicKey", public_key.to_string());
let client = reqwest::blocking::Client::new();
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "I am making HTTP call to create an account"
+ );
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "HTTP POST {}",
+ faucet_service_url.as_str()
+ );
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "JSON Body:\n{}",
+ crate::common::indent_payload(&format!("{:#?}", data))
+ );
+
let result = client.post(faucet_service_url.clone()).json(&data).send();
print_account_creation_status(
@@ -107,6 +126,12 @@ fn print_account_creation_status(
eprintln!();
match result {
Ok(response) => {
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "JSON RPC Response:\n{}",
+ crate::common::indent_payload(&format!("{:#?}", response))
+ );
if response.status() >= reqwest::StatusCode::BAD_REQUEST {
eprintln!("WARNING! The new account <{new_account_id}> could not be created successfully.\n{storage_message}\n");
return Err(color_eyre::Report::msg(format!(
@@ -163,6 +188,12 @@ fn print_account_creation_status(
Ok(())
}
Err(err) => {
+ tracing::info!(
+ target: "near_teach_me",
+ parent: &tracing::Span::none(),
+ "JSON RPC Response:\n{}",
+ crate::common::indent_payload(&err.to_string())
+ );
eprintln!("WARNING! The new account <{new_account_id}> could not be created successfully.\n{storage_message}\n");
Err(color_eyre::Report::msg(err.to_string()))
}