1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Show correct base asset in Signature Request view (#12696)

This commit is contained in:
ryanml 2021-11-15 10:19:14 -07:00 committed by GitHub
parent a323a5fe59
commit a2033377e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -35,6 +35,7 @@ export default class SignatureRequestOriginal extends Component {
domainMetadata: PropTypes.object, domainMetadata: PropTypes.object,
hardwareWalletRequiresConnection: PropTypes.bool, hardwareWalletRequiresConnection: PropTypes.bool,
isLedgerWallet: PropTypes.bool, isLedgerWallet: PropTypes.bool,
nativeCurrency: PropTypes.string.isRequired,
}; };
state = { state = {
@ -74,12 +75,12 @@ export default class SignatureRequestOriginal extends Component {
}; };
renderBalance = () => { renderBalance = () => {
const { conversionRate } = this.props; const { conversionRate, nativeCurrency } = this.props;
const { const {
fromAccount: { balance }, fromAccount: { balance },
} = this.state; } = this.state;
const balanceInEther = conversionUtil(balance, { const balanceInBaseAsset = conversionUtil(balance, {
fromNumericBase: 'hex', fromNumericBase: 'hex',
toNumericBase: 'dec', toNumericBase: 'dec',
fromDenomination: 'WEI', fromDenomination: 'WEI',
@ -93,7 +94,7 @@ export default class SignatureRequestOriginal extends Component {
{`${this.context.t('balance')}:`} {`${this.context.t('balance')}:`}
</div> </div>
<div className="request-signature__balance-value"> <div className="request-signature__balance-value">
{`${balanceInEther} ETH`} {`${balanceInBaseAsset} ${nativeCurrency}`}
</div> </div>
</div> </div>
); );

View File

@ -13,7 +13,10 @@ import {
import { getAccountByAddress } from '../../../helpers/utils/util'; import { getAccountByAddress } from '../../../helpers/utils/util';
import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck'; import { clearConfirmTransaction } from '../../../ducks/confirm-transaction/confirm-transaction.duck';
import { getMostRecentOverviewPage } from '../../../ducks/history/history'; import { getMostRecentOverviewPage } from '../../../ducks/history/history';
import { isAddressLedger } from '../../../ducks/metamask/metamask'; import {
isAddressLedger,
getNativeCurrency,
} from '../../../ducks/metamask/metamask';
import SignatureRequestOriginal from './signature-request-original.component'; import SignatureRequestOriginal from './signature-request-original.component';
function mapStateToProps(state, ownProps) { function mapStateToProps(state, ownProps) {
@ -34,6 +37,7 @@ function mapStateToProps(state, ownProps) {
mostRecentOverviewPage: getMostRecentOverviewPage(state), mostRecentOverviewPage: getMostRecentOverviewPage(state),
hardwareWalletRequiresConnection, hardwareWalletRequiresConnection,
isLedgerWallet, isLedgerWallet,
nativeCurrency: getNativeCurrency(state),
// not passed to component // not passed to component
allAccounts: accountsWithSendEtherInfoSelector(state), allAccounts: accountsWithSendEtherInfoSelector(state),
domainMetadata: getDomainMetadata(state), domainMetadata: getDomainMetadata(state),