Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bridge-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bridge-cli"
version = "0.3.37"
version = "0.3.38"
edition = "2021"
repository = "https://github.com/Near-One/bridge-sdk-rs"
rust-version = "1.88.0"
Expand Down
8 changes: 4 additions & 4 deletions bridge-cli/src/omni_connector_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alloy::primitives::{Address as EvmH160, TxHash};
use alloy::signers::local::PrivateKeySigner;
use evm_bridge_client::EvmBridgeClientBuilder;
use light_client::LightClientBuilder;
use near_bridge_client::{NearBridgeClientBuilder, TransactionOptions, UTXOChainAccounts};
use near_bridge_client::{btc::format_max_gas_fee, NearBridgeClientBuilder, TransactionOptions, UTXOChainAccounts};
use near_primitives::{hash::CryptoHash, types::AccountId};
use omni_connector::{
BindTokenArgs, BtcDepositArgs, DeployTokenArgs, FinTransferArgs, InitTransferArgs,
Expand Down Expand Up @@ -236,7 +236,7 @@ pub enum OmniConnectorSubCommand {
fee: Option<u128>,
#[clap(short, long, help = "Native fee to charge for the transfer")]
native_fee: Option<u128>,
#[clap(short, long, help = "Additional message")]
#[clap(short, long, help = "Additional message (JSON format, e.g. '{\"MaxGasFee\": \"400\"}' for BTC transfers)")]
message: Option<String>,
#[command(flatten)]
config_cli: CliConfig,
Expand Down Expand Up @@ -355,7 +355,7 @@ pub enum OmniConnectorSubCommand {
fee: Option<u128>,
#[clap(short, long, help = "Native fee to charge for the transfer")]
native_fee: Option<u64>,
#[clap(short, long, help = "Additional message")]
#[clap(short, long, help = "Additional message (JSON format, e.g. '{\"MaxGasFee\": \"400\"}' for BTC transfers)")]
message: Option<String>,
#[command(flatten)]
config_cli: CliConfig,
Expand Down Expand Up @@ -770,7 +770,7 @@ pub async fn match_subcommand(cmd: OmniConnectorSubCommand, network: Network) {
&& matches!(recipient.get_chain(), ChainKind::Btc | ChainKind::Zcash)
{
if let Some(gas_fee) = gas_fee {
message = format!("{{\"MaxGasFee\": \"{gas_fee}\"}}");
message = format_max_gas_fee(u64::try_from(gas_fee).unwrap());
}
}

Expand Down
2 changes: 1 addition & 1 deletion bridge-sdk/bridge-clients/near-bridge-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "near-bridge-client"
version = "0.2.14"
version = "0.2.15"
edition = "2021"

[dependencies]
Expand Down
7 changes: 7 additions & 0 deletions bridge-sdk/bridge-clients/near-bridge-client/src/btc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ impl TxBytes {
}
}

/// Format a MaxGasFee message for UTXO chain transfers.
/// This produces JSON like: `{"MaxGasFee":"400"}`
pub fn format_max_gas_fee(gas_fee: u64) -> String {
serde_json::to_string(&UTXOChainMsg::MaxGasFee(U64::from(gas_fee)))
.expect("Failed to serialize UTXOChainMsg")
}

impl NearBridgeClient {
/// Signs a NEAR transfer to BTC by calling `sign_btc_transaction` on the BTC connector contract.
#[tracing::instrument(skip_all, name = "NEAR SIGN BTC TRANSACTION")]
Expand Down
Loading