Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 = 'm', long, help = "Additional message (JSON format, e.g. '{\"MaxGasFee\": \"400\"}' for BTC transfers)")]
Comment thread
tom9000 marked this conversation as resolved.
Outdated
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 = 'm', long, help = "Additional message (JSON format, e.g. '{\"MaxGasFee\": \"400\"}' for BTC transfers)")]
Comment thread
tom9000 marked this conversation as resolved.
Outdated
message: Option<String>,
#[command(flatten)]
config_cli: CliConfig,
Expand Down Expand Up @@ -769,7 +769,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(gas_fee as u64);
Comment thread
tom9000 marked this conversation as resolved.
Outdated
}
}

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 @@ -184,6 +184,13 @@ enum UTXOChainMsg {
MaxGasFee(U64),
}

/// 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