For non payment transactions like asset transfers, are pending rewards added to the receiver balance?
I mean, seems only the sender of a non-payment tx collects pending rewards but want to know if other accounts affected by the tx (like the receiver of assets) do also collect rewards.
Unclaimed pending rewards are claimed by an address when that address is contained within a transaction’s To, From, or Close parameters. That means it is impossible to transact without claiming any unclaimed pending rewards first. If there are unclaimed pending rewards to claim, they will be noted in the transaction and available when you query that transaction.
On payment TXs, you can see what you say is true and node’s api also shows that information (stored internally in the ApplyData field of the transaction information)
But on non-payment TXs I have a confusion when, for e.g., asset balances are modified, if rewards are collected.
I need to look more into this. Take a look at eval.go specifically move and get and put functions. If the get is called and then a put I believe it is updated. It is definitely in payment.go.
Yes, yesterday I saw put adds an account into an array and later those accounts seems to collect the pending rewards but, first, I’m not sure if I’m following the correct flow and, second, I cannot also figure out if that information is really stored.
Meantime I’m also trying to collect some rewards in order to do a live test on testnet or mainnet.
Max just pointed out to me that the gets second parameters are false meaning the account balance do not get updated with rewards so the put wont reflect those. If you do an asset transfer do you get rewards in the sender?
Can you test it with an asset transfer or find an existing one on mainnet and use something like:
let tx = (await algodclient.accountInformation(account));
var textedJson = JSON.stringify(tx, undefined, 4);
console.log(textedJson);
This should give you output like: (note this field amountwithoutpendingrewards)
“round”: 6130326,
“address”: “TZ27KYCVDKJA7NIHGPNMS545CFCT2Y44U2GU5E6TRM7ZWVLRJKDLURA34A”,
“amount”: 100000000,
“pendingrewards”: 0,
“amountwithoutpendingrewards”: 100000000,
“rewards”: 0,
“status”: “Offline”
Ok, @JasonW confirmed receiving assets DOES NOT involves collecting pending rewards.
Did a query to the node about my account before and after receiving the asset and the only affected data, as expected, was the asset amount but pendingrewards remains the same.