Skip to content

Commit

Permalink
fix decimal places of amounts of in event properties
Browse files Browse the repository at this point in the history
  • Loading branch information
yushih committed Feb 5, 2025
1 parent bb60607 commit 7bc6d6b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ export default class WalletSendPreviewStepContainer extends Component<Props> {

if (signRequest == null) throw new Error('Unexpected missing active signing request');

const amount = signRequest.totalInput();
const { numberOfDecimals } = this.props.getTokenInfo(amount.getDefaultEntry()).Metadata;
ampli.sendSummarySubmitted({
ada_amount: signRequest.totalInput().getDefault().toNumber(),
ada_amount: amount.getDefault().shiftedBy(-numberOfDecimals).toNumber(),
asset_count: signRequest.totalInput().nonDefaultEntries().length,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,11 @@ export default class CardanoStakingPage extends Component<AllProps, State> {
if (delegationTx != null && selectedPoolId != null && showSignDialog) {
// may happen for a split second before backend query starts
if (selectedPoolInfo == null) return null;

const { numberOfDecimals } = genLookupOrFail(this.props.stores.tokenInfoStore.tokenInfo)(
delegationTx.totalAmountToDelegate.getDefaultEntry()
).Metadata;

return (
<DelegationTxDialog
staleTx={delegationTransaction.isStale}
Expand All @@ -401,7 +406,8 @@ export default class CardanoStakingPage extends Component<AllProps, State> {
dialog: DelegationSuccessDialog,
});
ampli.stakingCenterDelegationSubmitted({
ada_amount: delegationTx.totalAmountToDelegate.getDefault().toNumber(),
ada_amount:
delegationTx.totalAmountToDelegate.getDefault().shiftedBy(-numberOfDecimals).toNumber(),
staking_pool: selectedPoolId,
});
}}
Expand Down

0 comments on commit 7bc6d6b

Please sign in to comment.