hedera-sdk-js
hedera-sdk-js copied to clipboard
Transfer Transaction: isApproved flag is missing on current transfers getters
Problem
When you create an approved transfer it is internally saved as a Transfer. When you try to use the getter for all transfers (e.g. transaction.hbarTransfers), the value is a TransferMap, which does not contain information on whether the transfer is approved.
Here is an example getter of transfers:
get hbarTransfers() {
const map = new HbarTransferMap();
for (const transfer of this._hbarTransfers) {
map._set(transfer.accountId, transfer.amount);
}
return map;
}
_hbarTransfers is of type Transfer[] and Transfer contains a boolean property isApproved. This boolean property is missing when the getter is used
Solution
A possible solution is to rework the hbarTransfers, tokenTransfers, and nftTransfers or create new getters that return a shallow representation of 'Transfer[]'
Alternatives
No response