I'm writing an app where I fetch and transparently display all TXs for a wallet.
When I send a POST request to the monero-wallet-rpc
with the get_transfers
method and the in: true
parameter, I get three outputs for the same TXID.
- Amount is 0
- Very small amount
- Actual TX amount with added
suggested_confirmations_threshold: 1
object property
I assume #2 is the TX fee, and #3 is the actual TX to the receiver. Not exactly sure what #1 is.
How can I make sense of this returned data?
Request (NodeJS):
fetch(config.xmr.wallet_RPC_URL + "/json_rpc", {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
jsonrpc: "2.0",
id: "0",
method: "get_transfers",
params: {
in: true
}
})
Response:
{
address: 'mywalletaddr',
amount: 0,
confirmations: 788609,
double_spend_seen: false,
fee: 20000000000,
height: 1511844,
locked: false,
note: '',
payment_id: '0000000000000000',
subaddr_index: { major: 0, minor: 0 },
subaddr_indices: [ { major: 0, minor: 0 } ],
timestamp: 1518905851,
txid: 'thetxid',
type: 'in',
unlock_time: 0
}
{
address: 'mywalletaddr',
amount: 0,
confirmations: 788609,
double_spend_seen: false,
fee: 20000000000,
height: 1511844,
locked: false,
note: '',
payment_id: '0000000000000000',
subaddr_index: { major: 0, minor: 0 },
subaddr_indices: [ { major: 0, minor: 0 } ],
timestamp: 1518905851,
txid: 'thetxid',
type: 'in',
unlock_time: 0
}
{
address: 'mywalletaddr',
amount: 874585636991,
amounts: [ 874585636991 ],
confirmations: 788609,
double_spend_seen: false,
fee: 20000000000,
height: 1511844,
locked: false,
note: '',
payment_id: '0000000000000000',
subaddr_index: { major: 0, minor: 0 },
subaddr_indices: [ { major: 0, minor: 0 } ],
suggested_confirmations_threshold: 1,
timestamp: 1518905851,
txid: 'thetxid',
type: 'in',
unlock_time: 0
}
rescan_bc
from the earliest height you ever received anything.rescan_blockchain
fixed it! Thank you.