@@ -19,6 +19,7 @@ mod get_address_for_account;
1919mod get_new_account;
2020mod get_notes_count;
2121mod get_operation;
22+ mod get_transaction;
2223mod get_wallet_info;
2324mod help;
2425mod list_accounts;
@@ -31,6 +32,7 @@ mod openrpc;
3132mod recover_accounts;
3233mod unlock_wallet;
3334mod z_send_many;
35+ mod view_transaction;
3436
3537#[ rpc( server) ]
3638pub ( crate ) trait Rpc {
@@ -209,6 +211,41 @@ pub(crate) trait Rpc {
209211 #[ method( name = "z_listunifiedreceivers" ) ]
210212 fn list_unified_receivers ( & self , unified_address : & str ) -> list_unified_receivers:: Response ;
211213
214+ /// Returns detailed information about in-wallet transaction `txid`.
215+ ///
216+ /// This does not include complete information about shielded components of the
217+ /// transaction; to obtain details about shielded components of the transaction use
218+ /// `z_viewtransaction`.
219+ ///
220+ /// # Parameters
221+ ///
222+ /// - `includeWatchonly` (bool, optional, default=false): Whether to include watchonly
223+ /// addresses in balance calculation and `details`.
224+ /// - `verbose`: Must be `false` or omitted.
225+ /// - `asOfHeight` (numeric, optional, default=-1): Execute the query as if it were
226+ /// run when the blockchain was at the height specified by this argument. The
227+ /// default is to use the entire blockchain that the node is aware of. -1 can be
228+ /// used as in other RPC calls to indicate the current height (including the
229+ /// mempool), but this does not support negative values in general. A "future"
230+ /// height will fall back to the current height. Any explicit value will cause the
231+ /// mempool to be ignored, meaning no unconfirmed tx will be considered.
232+ ///
233+ /// # Bitcoin compatibility
234+ ///
235+ /// Compatible up to three arguments, but can only use the default value for `verbose`.
236+ #[ method( name = "gettransaction" ) ]
237+ async fn get_transaction (
238+ & self ,
239+ txid : & str ,
240+ include_watchonly : Option < bool > ,
241+ verbose : Option < bool > ,
242+ as_of_height : Option < i64 > ,
243+ ) -> get_transaction:: Response ;
244+
245+ /// Returns detailed shielded information about in-wallet transaction `txid`.
246+ #[ method( name = "z_viewtransaction" ) ]
247+ async fn view_transaction ( & self , txid : & str ) -> view_transaction:: Response ;
248+
212249 /// Returns an array of unspent shielded notes with between minconf and maxconf
213250 /// (inclusive) confirmations.
214251 ///
@@ -436,6 +473,27 @@ impl RpcServer for RpcImpl {
436473 list_unified_receivers:: call ( unified_address)
437474 }
438475
476+ async fn get_transaction (
477+ & self ,
478+ txid : & str ,
479+ include_watchonly : Option < bool > ,
480+ verbose : Option < bool > ,
481+ as_of_height : Option < i64 > ,
482+ ) -> get_transaction:: Response {
483+ get_transaction:: call (
484+ self . wallet ( ) . await ?. as_ref ( ) ,
485+ self . chain ( ) . await ?,
486+ txid,
487+ include_watchonly. unwrap_or ( false ) ,
488+ verbose. unwrap_or ( false ) ,
489+ as_of_height. unwrap_or ( -1 ) ,
490+ )
491+ }
492+
493+ async fn view_transaction ( & self , txid : & str ) -> view_transaction:: Response {
494+ view_transaction:: call ( self . wallet ( ) . await ?. as_ref ( ) , txid)
495+ }
496+
439497 async fn list_unspent ( & self ) -> list_unspent:: Response {
440498 list_unspent:: call ( self . wallet ( ) . await ?. as_ref ( ) )
441499 }
0 commit comments