• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 17275382059

27 Aug 2025 06:28PM UTC coverage: 60.14% (-0.1%) from 60.274%
17275382059

push

github

web-flow
chore: new release v5.0.0-pre.8 (#7446)

Description
---
new release

71505 of 118897 relevant lines covered (60.14%)

536444.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/base_layer/core/src/base_node/rpc/mod.rs
1
// Copyright 2025 The Tari Project
2
// SPDX-License-Identifier: BSD-3-Clause
3

4
mod service;
5

6
pub mod sync_utxos_by_block_task;
7

8
pub use service::BaseNodeWalletRpcService;
9

10
pub mod query_service;
11

12
use std::{error::Error, fmt::Debug};
13

14
use tari_comms::protocol::rpc::{Request, Response, RpcStatus, Streaming};
15
use tari_comms_rpc_macros::tari_rpc;
16
use tari_transaction_components::rpc::models;
17
use url::Url;
18

19
use crate::{
20
    base_node::StateMachineHandle,
21
    chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend},
22
    mempool::service::MempoolHandle,
23
    proto::{
24
        self,
25
        base_node::{
26
            FetchMatchingUtxos,
27
            FetchUtxosResponse,
28
            GetMempoolFeePerGramStatsRequest,
29
            GetMempoolFeePerGramStatsResponse,
30
            GetWalletQueryHttpServiceAddressResponse,
31
            QueryDeletedRequest,
32
            QueryDeletedResponse,
33
            Signatures,
34
            SyncUtxosByBlockRequest,
35
            SyncUtxosByBlockResponse,
36
            TipInfoResponse,
37
            TxQueryBatchResponses,
38
            TxQueryResponse,
39
            TxSubmissionResponse,
40
            UtxoQueryRequest,
41
            UtxoQueryResponses,
42
        },
43
        types::{Signature, Transaction},
44
    },
45
};
46

47
/// Trait that a base node wallet query service must implement.
48
/// Please note that this service is to fetch data, so read-only queries.
49
#[async_trait::async_trait]
50
pub trait BaseNodeWalletQueryService: Send + Sync + 'static {
51
    type Error: Error + 'static;
52

53
    async fn get_tip_info(&self) -> Result<models::TipInfoResponse, Self::Error>;
54

55
    async fn get_header_by_height(&self, height: u64) -> Result<models::BlockHeader, Self::Error>;
56

57
    async fn get_height_at_time(&self, epoch_time: u64) -> Result<u64, Self::Error>;
58

59
    async fn get_utxos_mined_info(
60
        &self,
61
        request: models::GetUtxosMinedInfoRequest,
62
    ) -> Result<models::GetUtxosMinedInfoResponse, Self::Error>;
63

64
    async fn get_utxos_by_block(
65
        &self,
66
        request: models::GetUtxosByBlockRequest,
67
    ) -> Result<models::GetUtxosByBlockResponse, Self::Error>;
68

69
    async fn transaction_query(&self, signature: models::Signature) -> Result<models::TxQueryResponse, Self::Error>;
70

71
    async fn sync_utxos_by_block(
72
        &self,
73
        request: models::SyncUtxosByBlockRequest,
74
    ) -> Result<models::SyncUtxosByBlockResponse, Self::Error>;
75

76
    async fn get_utxos_deleted_info(
77
        &self,
78
        request: models::GetUtxosDeletedInfoRequest,
79
    ) -> Result<models::GetUtxosDeletedInfoResponse, Self::Error>;
80
}
81

82
#[tari_rpc(protocol_name = b"t/bnwallet/1", server_struct = BaseNodeWalletRpcServer, client_struct = BaseNodeWalletRpcClient
×
83
)]
×
84
pub trait BaseNodeWalletService: Send + Sync + 'static {
85
    #[rpc(method = 1)]
86
    async fn submit_transaction(
87
        &self,
88
        request: Request<Transaction>,
89
    ) -> Result<Response<TxSubmissionResponse>, RpcStatus>;
90

91
    #[rpc(method = 2)]
92
    async fn transaction_query(&self, request: Request<Signature>) -> Result<Response<TxQueryResponse>, RpcStatus>;
93

94
    #[rpc(method = 3)]
95
    async fn transaction_batch_query(
96
        &self,
97
        request: Request<Signatures>,
98
    ) -> Result<Response<TxQueryBatchResponses>, RpcStatus>;
99

100
    #[rpc(method = 4)]
101
    async fn fetch_matching_utxos(
102
        &self,
103
        request: Request<FetchMatchingUtxos>,
104
    ) -> Result<Response<FetchUtxosResponse>, RpcStatus>;
105

106
    #[rpc(method = 5)]
107
    async fn get_tip_info(&self, request: Request<()>) -> Result<Response<TipInfoResponse>, RpcStatus>;
108

109
    #[rpc(method = 6)]
110
    async fn get_header(&self, request: Request<u64>) -> Result<Response<proto::core::BlockHeader>, RpcStatus>;
111

112
    #[rpc(method = 7)]
113
    async fn utxo_query(&self, request: Request<UtxoQueryRequest>) -> Result<Response<UtxoQueryResponses>, RpcStatus>;
114

115
    #[rpc(method = 8)]
116
    async fn query_deleted(
117
        &self,
118
        request: Request<QueryDeletedRequest>,
119
    ) -> Result<Response<QueryDeletedResponse>, RpcStatus>;
120

121
    #[rpc(method = 9)]
122
    async fn get_header_by_height(
123
        &self,
124
        request: Request<u64>,
125
    ) -> Result<Response<proto::core::BlockHeader>, RpcStatus>;
126

127
    #[rpc(method = 10)]
128
    async fn get_height_at_time(&self, request: Request<u64>) -> Result<Response<u64>, RpcStatus>;
129

130
    #[rpc(method = 11)]
131
    async fn sync_utxos_by_block(
132
        &self,
133
        request: Request<SyncUtxosByBlockRequest>,
134
    ) -> Result<Streaming<SyncUtxosByBlockResponse>, RpcStatus>;
135

136
    #[rpc(method = 12)]
137
    async fn get_mempool_fee_per_gram_stats(
138
        &self,
139
        request: Request<GetMempoolFeePerGramStatsRequest>,
140
    ) -> Result<Response<GetMempoolFeePerGramStatsResponse>, RpcStatus>;
141

142
    #[rpc(method = 13)]
143
    async fn get_wallet_query_http_service_address(
144
        &self,
145
        request: Request<()>,
146
    ) -> Result<Response<GetWalletQueryHttpServiceAddressResponse>, RpcStatus>;
147
}
148

149
pub fn create_base_node_wallet_rpc_service<B: BlockchainBackend + 'static>(
×
150
    db: AsyncBlockchainDb<B>,
×
151
    mempool: MempoolHandle,
×
152
    state_machine: StateMachineHandle,
×
153
    wallet_query_service_address: Option<Url>,
×
154
) -> BaseNodeWalletRpcServer<BaseNodeWalletRpcService<B>> {
×
155
    BaseNodeWalletRpcServer::new(BaseNodeWalletRpcService::new(
×
156
        db,
×
157
        mempool,
×
158
        state_machine,
×
159
        wallet_query_service_address,
×
160
    ))
×
161
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc