Skip to content
Open
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.45"
version = "0.4.0"
edition = "2021"
repository = "https://github.com/Near-One/bridge-sdk-rs"
rust-version = "1.88.0"
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.17"
version = "0.3.0"
edition = "2021"

[dependencies]
Expand Down
4 changes: 4 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 @@ -104,6 +104,8 @@ pub struct FinBtcTransferArgs {
pub tx_block_blockhash: String,
pub tx_index: u64,
pub merkle_proof: Vec<String>,
pub coinbase_tx_id: String,
pub coinbase_merkle_proof: Vec<String>,
}

#[derive(Clone, serde::Serialize, serde::Deserialize)]
Expand All @@ -112,6 +114,8 @@ pub struct BtcVerifyWithdrawArgs {
pub tx_block_blockhash: String,
pub tx_index: u64,
pub merkle_proof: Vec<String>,
pub coinbase_tx_id: String,
pub coinbase_merkle_proof: Vec<String>,
}

#[derive(Clone, serde::Serialize, serde::Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion bridge-sdk/bridge-clients/utxo-bridge-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "utxo-bridge-client"
version = "0.2.3"
version = "0.3.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 2 additions & 0 deletions bridge-sdk/bridge-clients/utxo-bridge-client/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub struct TxProof {
pub tx_block_blockhash: String,
pub tx_index: u64,
pub merkle_proof: Vec<String>,
pub coinbase_tx_id: String,
pub coinbase_merkle_proof: Vec<String>,
}

pub struct UtxoBridgeTransactionData {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,20 @@ impl<T: UTXOChain> UTXOBridgeClient<T> {
"btc tx not found in block".to_string(),
))?;

let merkle_proof = merkle_tools::merkle_proof_calculator(transactions, tx_index);
let merkle_proof = merkle_tools::merkle_proof_calculator(transactions.clone(), tx_index);
let merkle_proof_str = merkle_proof
.iter()
.map(std::string::ToString::to_string)
.collect();

let coinbase_tx_id = transactions[0].to_string();
let coinbase_merkle_proof =
merkle_tools::merkle_proof_calculator(transactions, 0);
let coinbase_merkle_proof_str = coinbase_merkle_proof
.iter()
.map(std::string::ToString::to_string)
.collect();

Ok(TxProof {
block_height,
tx_bytes: block.tx_data(tx_index),
Expand All @@ -237,6 +245,8 @@ impl<T: UTXOChain> UTXOBridgeClient<T> {
.try_into()
.expect("Error on convert usize into u64"),
merkle_proof: merkle_proof_str,
coinbase_tx_id,
coinbase_merkle_proof: coinbase_merkle_proof_str,
})
}

Expand Down
2 changes: 1 addition & 1 deletion bridge-sdk/connectors/omni-connector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "omni-connector"
version = "0.3.9"
version = "0.4.0"
edition = "2021"
rust-version = "1.88.0"

Expand Down
6 changes: 6 additions & 0 deletions bridge-sdk/connectors/omni-connector/src/omni_connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ impl OmniConnector {
tx_block_blockhash: proof_data.tx_block_blockhash,
tx_index: proof_data.tx_index,
merkle_proof: proof_data.merkle_proof,
coinbase_tx_id: proof_data.coinbase_tx_id,
coinbase_merkle_proof: proof_data.coinbase_merkle_proof,
};

near_bridge_client
Expand Down Expand Up @@ -622,6 +624,8 @@ impl OmniConnector {
tx_block_blockhash: proof_data.tx_block_blockhash,
tx_index: proof_data.tx_index,
merkle_proof: proof_data.merkle_proof,
coinbase_tx_id: proof_data.coinbase_tx_id,
coinbase_merkle_proof: proof_data.coinbase_merkle_proof,
};

near_bridge_client
Expand Down Expand Up @@ -669,6 +673,8 @@ impl OmniConnector {
tx_block_blockhash: proof_data.tx_block_blockhash,
tx_index: proof_data.tx_index,
merkle_proof: proof_data.merkle_proof,
coinbase_tx_id: proof_data.coinbase_tx_id,
coinbase_merkle_proof: proof_data.coinbase_merkle_proof,
};

near_bridge_client
Expand Down
Loading