Skip to content

Commit

Permalink
add withdrawals to transaction amount
Browse files Browse the repository at this point in the history
  • Loading branch information
yushih committed Jun 9, 2021
1 parent 67003d4 commit c0f9db9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/yoroi-extension/app/domain/CardanoShelleyTransaction.js
Expand Up @@ -73,6 +73,17 @@ export default class CardanoShelleyTransaction extends WalletTransaction {
throw new Error(`${nameof(CardanoShelleyTransaction)}::${this.constructor.fromAnnotatedTx} missing extra data`);
}

const withdrawals = toAddr({
rows: tx.accountingInputs,
addressLookupMap,
tokens: tx.tokens,
defaultToken,
});
const amount = tx.amount.joinAddCopy(tx.fee);
for (const {value} of withdrawals) {
amount.joinAddMutable(value);
}

return new CardanoShelleyTransaction({
txid: tx.transaction.Hash,
block: tx.block,
Expand All @@ -89,20 +100,15 @@ export default class CardanoShelleyTransaction extends WalletTransaction {
),
ttl: Extra.Ttl != null ? new BigNumber(Extra.Ttl) : undefined,
metadata: Extra.Metadata,
amount: tx.amount.joinAddCopy(tx.fee),
amount,
date: tx.block != null
? tx.block.BlockTime
: new Date(tx.transaction.LastUpdateTime),
addresses: {
from: toAddr({ rows: tx.utxoInputs, addressLookupMap, tokens: tx.tokens, defaultToken, }),
to: toAddr({ rows: tx.utxoOutputs, addressLookupMap, tokens: tx.tokens, defaultToken, }),
},
withdrawals: toAddr({
rows: tx.accountingInputs,
addressLookupMap,
tokens: tx.tokens,
defaultToken,
}),
withdrawals,
certificates: tx.certificates,
state: tx.transaction.Status,
errorMsg: tx.transaction.ErrorMessage,
Expand Down

0 comments on commit c0f9db9

Please sign in to comment.