diff --git a/server/websocket.go b/server/websocket.go index bf7a0934..e60af0aa 100644 --- a/server/websocket.go +++ b/server/websocket.go @@ -257,6 +257,16 @@ var requestHandlers = map[string]func(*WebsocketServer, *websocketChannel, *webs } return }, + "getTransactionSpecific": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { + r := struct { + Txid string `json:"txid"` + }{} + err = json.Unmarshal(req.Params, &r) + if err == nil { + rv, err = s.getTransactionSpecific(r.Txid) + } + return + }, "estimateFee": func(s *WebsocketServer, c *websocketChannel, req *websocketReq) (rv interface{}, err error) { return s.estimateFee(c, req.Params) }, @@ -396,6 +406,10 @@ func (s *WebsocketServer) getTransaction(txid string) (interface{}, error) { return s.api.GetTransaction(txid, false, false) } +func (s *WebsocketServer) getTransactionSpecific(txid string) (interface{}, error) { + return s.chain.GetTransactionSpecific(&bchain.Tx{Txid: txid}) +} + func (s *WebsocketServer) getInfo() (interface{}, error) { vi := common.GetVersionInfo() height, hash, err := s.db.GetBestBlock() diff --git a/static/test-websocket.html b/static/test-websocket.html index 50f046a8..18be7c6a 100644 --- a/static/test-websocket.html +++ b/static/test-websocket.html @@ -163,6 +163,17 @@ }); } + function getTransactionSpecific() { + const txid = document.getElementById('getTransactionSpecificTxid').value.trim(); + const method = 'getTransactionSpecific'; + const params = { + txid, + }; + send(method, params, function (result) { + document.getElementById('getTransactionSpecificResult').innerText = JSON.stringify(result).replace(/,/g, ", "); + }); + } + function estimateFee() { try { var blocks = document.getElementById('estimateFeeBlocks').value.split(","); @@ -355,6 +366,21 @@
+
+
+ +
+
+
+ +
+
+
+
+
+
+
+