Fixing hex address display bug when editing transaction (#15873)

feature/default_network_editable
ryanml 2 years ago committed by GitHub
parent b5049a1736
commit c8935c6951
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      ui/ducks/send/send.js
  2. 6
      ui/ducks/send/send.test.js
  3. 2
      ui/pages/send/send-content/add-recipient/add-recipient.component.js

@ -1714,8 +1714,10 @@ export function editExistingTransaction(assetType, transactionId) {
...draftTransactionInitialState.recipient, ...draftTransactionInitialState.recipient,
address: transaction.txParams.to, address: transaction.txParams.to,
nickname: nickname:
getAddressBookEntryOrAccountName(state, transaction.txParams.to) getAddressBookEntryOrAccountName(
?.name ?? '', state,
transaction.txParams.to,
) ?? '',
}, },
amount: { amount: {
...draftTransactionInitialState.amount, ...draftTransactionInitialState.amount,
@ -1739,8 +1741,7 @@ export function editExistingTransaction(assetType, transactionId) {
const tokenAmountInDec = const tokenAmountInDec =
assetType === ASSET_TYPES.TOKEN ? getTokenValueParam(tokenData) : '1'; assetType === ASSET_TYPES.TOKEN ? getTokenValueParam(tokenData) : '1';
const address = getTokenAddressParam(tokenData); const address = getTokenAddressParam(tokenData);
const nickname = const nickname = getAddressBookEntryOrAccountName(state, address) ?? '';
getAddressBookEntryOrAccountName(state, address)?.name ?? '';
const tokenAmountInHex = addHexPrefix( const tokenAmountInHex = addHexPrefix(
conversionUtil(tokenAmountInDec, { conversionUtil(tokenAmountInDec, {

@ -2460,7 +2460,7 @@ describe('Send Slice', () => {
recipient: { recipient: {
address: '0xRecipientAddress', address: '0xRecipientAddress',
error: null, error: null,
nickname: '', nickname: '0xRecipientAddress',
warning: null, warning: null,
recipientWarningAcknowledged: false, recipientWarningAcknowledged: false,
type: '', type: '',
@ -2605,7 +2605,7 @@ describe('Send Slice', () => {
recipient: { recipient: {
address: BURN_ADDRESS, address: BURN_ADDRESS,
error: null, error: null,
nickname: '', nickname: BURN_ADDRESS,
warning: null, warning: null,
type: '', type: '',
recipientWarningAcknowledged: false, recipientWarningAcknowledged: false,
@ -2797,7 +2797,7 @@ describe('Send Slice', () => {
address: BURN_ADDRESS, address: BURN_ADDRESS,
error: null, error: null,
warning: null, warning: null,
nickname: '', nickname: BURN_ADDRESS,
type: '', type: '',
recipientWarningAcknowledged: false, recipientWarningAcknowledged: false,
}, },

@ -28,7 +28,7 @@ export default class AddRecipient extends Component {
isUsingMyAccountsForRecipientSearch: PropTypes.bool, isUsingMyAccountsForRecipientSearch: PropTypes.bool,
recipient: PropTypes.shape({ recipient: PropTypes.shape({
address: PropTypes.string, address: PropTypes.string,
nickname: PropTypes.nickname, nickname: PropTypes.string,
error: PropTypes.string, error: PropTypes.string,
warning: PropTypes.string, warning: PropTypes.string,
}), }),

Loading…
Cancel
Save