Browse Source

rpc_get_transfer_by_txid updated to mainnet.

master
Captain 1 year ago
parent
commit
d08d8463d7
1 changed files with 10 additions and 2 deletions
  1. +10
    -2
      walletapi/rpc_get_transfer_by_txid.go

+ 10
- 2
walletapi/rpc_get_transfer_by_txid.go View File

@@ -63,6 +63,9 @@ func (h Get_Transfer_By_TXID_Handler) ServeJSONRPC(c context.Context, params *fa
Unlock_time: entry.Unlock_Time,

}
if entry.Height == 0 {
return nil, &jsonrpc.Error{Code: -8, Message: fmt.Sprintf("Transaction not found. TXID %s", p.TXID)}
}

for i := range entry.Details.Daddress {
result.Transfer.Destinations = append(result.Transfer.Destinations,
@@ -76,7 +79,12 @@ func (h Get_Transfer_By_TXID_Handler) ServeJSONRPC(c context.Context, params *fa
result.Transfer.Payment_ID = entry.Details.PaymentID
}

result.Transfer.Type = "in"
if entry.Status == 0 { // if we have an amount
result.Transfer.Type = "in"
// send the result
return result, nil

}
// setup in/out
if entry.Status == 1 { // if we have an amount
result.Transfer.Type = "out"
@@ -85,5 +93,5 @@ func (h Get_Transfer_By_TXID_Handler) ServeJSONRPC(c context.Context, params *fa

}

return nil, &jsonrpc.Error{Code: -8, Message: fmt.Sprintf("Transaction not found. TXID %s", p.TXID)}
return nil, &jsonrpc.Error{Code: -9, Message: fmt.Sprintf("Transaction not found. TXID %s", p.TXID)}
}

Loading…
Cancel
Save