MCPcopy Create free account
hub / github.com/DEROFDN/Engram / getTxData

Function getTxData

functions.go:3299–3334  ·  view source on GitHub ↗

Get transaction data for any TXID from the daemon

(txid string)

Source from the content-addressed store, hash-verified

3297
3298// Get transaction data for any TXID from the daemon
3299func getTxData(txid string) (result rpc.GetTransaction_Result, err error) {
3300 if engram.Disk == nil || session.Offline {
3301 return
3302 }
3303
3304 var params rpc.GetTransaction_Params
3305
3306 params.Tx_Hashes = append(params.Tx_Hashes, txid)
3307
3308 rpc_client.WS, _, err = websocket.DefaultDialer.Dial("ws://"+session.Daemon+"/ws", nil)
3309 if err != nil {
3310 return
3311 }
3312
3313 input_output := rwc.New(rpc_client.WS)
3314 rpc_client.RPC = jrpc2.NewClient(channel.RawJSON(input_output, input_output), nil)
3315
3316 if err = rpc_client.RPC.CallResult(context.Background(), "DERO.GetTransaction", params, &result); err != nil {
3317 logger.Errorf("[Engram] getTxData TXID: %s (Failed: %s)\n", txid, err)
3318 return
3319 }
3320
3321 rpc_client.WS.Close()
3322 rpc_client.RPC.Close()
3323
3324 if result.Status != "OK" {
3325 logger.Errorf("[Engram] getTxData TXID: %s (Failed: %s)\n", txid, result.Status)
3326 return
3327 }
3328
3329 if len(result.Txs_as_hex[0]) < 50 {
3330 return
3331 }
3332
3333 return
3334}
3335
3336// Methods Engram will use as XSWD noStore
3337func engramNoStoreMethods() []string {

Callers 3

layoutAssetExplorerFunction · 0.85
layoutAssetManagerFunction · 0.85
layoutTELAFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected