forked from rooch-network/rooch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into third_pary_repo
- Loading branch information
Showing
29 changed files
with
393 additions
and
246 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "bitcoin-client" | ||
authors.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
publish.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
version.workspace = true | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
async-trait = { workspace = true } | ||
bitcoin = { workspace = true } | ||
bitcoincore-rpc = { workspace = true } | ||
coerce = { workspace = true } | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
tokio = { features = ["full"], workspace = true } | ||
tracing = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use anyhow::Result; | ||
use bitcoin::Transaction; | ||
use bitcoincore_rpc::bitcoin::Txid; | ||
use bitcoincore_rpc::json; | ||
use coerce::actor::message::Message; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetBlockMessage { | ||
pub hash: bitcoin::BlockHash, | ||
} | ||
|
||
impl Message for GetBlockMessage { | ||
type Result = Result<bitcoin::Block>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetBestBlockHashMessage {} | ||
|
||
impl Message for GetBestBlockHashMessage { | ||
type Result = Result<bitcoin::BlockHash>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetBlockHashMessage { | ||
pub height: u64, | ||
} | ||
|
||
impl Message for GetBlockHashMessage { | ||
type Result = Result<bitcoin::BlockHash>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetBlockHeaderInfoMessage { | ||
pub hash: bitcoin::BlockHash, | ||
} | ||
|
||
impl Message for GetBlockHeaderInfoMessage { | ||
type Result = Result<json::GetBlockHeaderResult>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetChainTipsMessage {} | ||
|
||
impl Message for GetChainTipsMessage { | ||
type Result = Result<json::GetChainTipsResult>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct BroadcastTransactionMessage { | ||
pub hex: String, | ||
pub maxfeerate: Option<f64>, | ||
pub maxburnamount: Option<f64>, | ||
} | ||
|
||
impl Message for BroadcastTransactionMessage { | ||
type Result = Result<Txid>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetTxOutMessage { | ||
pub txid: Txid, | ||
pub vout: u32, | ||
pub include_mempool: Option<bool>, | ||
} | ||
|
||
impl GetTxOutMessage { | ||
pub fn new(txid: Txid, vout: u32) -> Self { | ||
Self { | ||
txid, | ||
vout, | ||
include_mempool: Some(false), | ||
} | ||
} | ||
} | ||
|
||
impl Message for GetTxOutMessage { | ||
type Result = Result<Option<json::GetTxOutResult>>; | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct GetRawTransactionMessage { | ||
pub txid: Txid, | ||
} | ||
|
||
impl Message for GetRawTransactionMessage { | ||
type Result = Result<Transaction>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod client; | ||
pub mod messages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) RoochNetwork | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod actor; | ||
pub mod proxy; |
7 changes: 3 additions & 4 deletions
7
...relayer/src/actor/bitcoin_client_proxy.rs → crates/bitcoin-client/src/proxy/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.