-
Notifications
You must be signed in to change notification settings - Fork 134
[REFACTOR][RPC] Centralize RPC traits and method names #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
moisesPompilio
wants to merge
7
commits into
getfloresta:master
Choose a base branch
from
moisesPompilio:centralize-trait-and-type-rpc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c6b5215
refactor(rpc): centralize RPC method names with RpcMethods enum
moisesPompilio bd3fa59
refactor(rpc): add modular trait-based RPC interfaces
moisesPompilio 6417375
refactor(rpc): enable async support in NetworkRpc with maybe_async
moisesPompilio 6a576ee
refactor(rpc): implement WalletRpc with maybe_async for compatibility
moisesPompilio d86609b
refactor(rpc): add maybe_async to ControlRpc and implement in florest…
moisesPompilio 67b29ae
refactor(rpc): add maybe_async to BlockchainRpc and implement in flor…
moisesPompilio 167b5c2
refactor(rpc): add maybe_async to RawTransactionRpc and centralize types
moisesPompilio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ use bitcoin::Txid; | |
| use clap::Parser; | ||
| use clap::Subcommand; | ||
| use floresta_rpc::jsonrpc_client::Client; | ||
| use floresta_rpc::rpc::FlorestaRPC; | ||
| use floresta_rpc::rpc_interfaces::BlockchainRpc; | ||
| use floresta_rpc::rpc_interfaces::ControlRpc; | ||
| use floresta_rpc::rpc_interfaces::NetworkRpc; | ||
| use floresta_rpc::rpc_interfaces::RawTransactionRpc; | ||
| use floresta_rpc::rpc_interfaces::WalletRpc; | ||
| use floresta_rpc::rpc_types::AddNodeCommand; | ||
| use floresta_rpc::rpc_types::RescanConfidence; | ||
|
|
||
|
|
@@ -63,24 +67,24 @@ fn do_request(cmd: &Cli, client: Client) -> anyhow::Result<String> { | |
| Methods::GetBestBlockHash => serde_json::to_string_pretty(&client.get_best_block_hash()?)?, | ||
| Methods::GetBlockCount => serde_json::to_string_pretty(&client.get_block_count()?)?, | ||
| Methods::GetTxOut { txid, vout } => { | ||
| serde_json::to_string_pretty(&client.get_tx_out(txid, vout)?)? | ||
| serde_json::to_string_pretty(&client.get_tx_out(txid, vout, false)?)? | ||
| } | ||
| Methods::GetTxOutProof { txids, blockhash } => { | ||
| serde_json::to_string_pretty(&client.get_txout_proof(txids, blockhash))? | ||
| serde_json::to_string_pretty(&client.get_txout_proof(&txids, blockhash)?)? | ||
| } | ||
| Methods::GetTransaction { txid, .. } => { | ||
| serde_json::to_string_pretty(&client.get_transaction(txid, Some(true))?)? | ||
| Methods::GetTransaction { txid, verbose } => { | ||
| serde_json::to_string_pretty(&client.get_raw_transaction(txid, verbose)?)? | ||
| } | ||
| Methods::RescanBlockchain { | ||
| start_block, | ||
| stop_block, | ||
| use_timestamp, | ||
| confidence, | ||
| } => serde_json::to_string_pretty(&client.rescanblockchain( | ||
| } => serde_json::to_string_pretty(&client.rescan_blockchain( | ||
| Some(start_block), | ||
| Some(stop_block), | ||
| use_timestamp, | ||
| confidence, | ||
| Some(confidence), | ||
| )?)?, | ||
| Methods::SendRawTransaction { tx } => { | ||
| serde_json::to_string_pretty(&client.send_raw_transaction(tx)?)? | ||
|
|
@@ -215,7 +219,7 @@ pub enum Methods { | |
|
|
||
| /// Returns the transaction, assuming it is cached by our watch only wallet | ||
| #[command(name = "gettransaction")] | ||
| GetTransaction { txid: Txid, verbose: Option<bool> }, | ||
| GetTransaction { txid: Txid, verbose: Option<u32> }, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| #[doc = include_str!("../../../doc/rpc/rescanblockchain.md")] | ||
| #[command( | ||
|
|
@@ -362,7 +366,7 @@ pub enum Methods { | |
| )] | ||
| DisconnectNode { | ||
| node_address: String, | ||
| node_id: Option<usize>, | ||
| node_id: Option<u32>, | ||
| }, | ||
|
|
||
| #[command(name = "findtxout")] | ||
|
|
||
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this false for?