Add getTransactionSpecific to websocket interface
parent
1c35c632cb
commit
bd89ab8256
|
@ -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()
|
||||
|
|
|
@ -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 @@
|
|||
<div class="col" id="getTransactionResult">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<input class="btn btn-secondary" type="button" value="getTransactionSpecific" onclick="getTransactionSpecific()">
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div class="row" style="margin: 0;">
|
||||
<input type="text" placeholder="txid" class="form-control" id="getTransactionSpecificTxid" value="0xb266c89f9bfefa4aa2fca4e65b7d6c918d5407f464be781c2803f3546d34a574">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col form-inline"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col" id="getTransactionSpecificResult">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<input class="btn btn-secondary" type="button" value="estimateFee" onclick="estimateFee()">
|
||||
|
|
Loading…
Reference in New Issue