Bugfix - Add Recipient name on Send Fund's second step modal (#2255)

* Set recipient name if it is selected from addressBook

* Remove unnecesary console.log + some improvements
This commit is contained in:
Mati Dastugue 2021-05-07 05:53:13 -03:00 committed by GitHub
parent 2afbc827c9
commit 404e54e42d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -42,6 +42,7 @@ const { nativeCoin } = getNetworkInfo()
export type ReviewTxProp = {
recipientAddress: string
recipientName?: string
amount: string
txRecipient: string
token: string
@ -218,6 +219,7 @@ const ReviewSendFundsTx = ({ onClose, onPrev, tx }: ReviewTxProps): React.ReactE
<Col xs={12}>
<EthHashInfo
hash={tx.recipientAddress}
name={tx.recipientName}
showCopyBtn
showAvatar
explorerUrl={getExplorerInfo(tx.recipientAddress)}

View File

@ -69,6 +69,7 @@ const useStyles = makeStyles(styles)
export type SendFundsTx = {
amount?: string
recipientAddress?: string
name?: string
token?: string
txType?: string
tokenSpendingLimit?: SpendingLimit
@ -133,11 +134,12 @@ const SendFunds = ({
let tokenSpendingLimit
const handleSubmit = (values) => {
const submitValues = values
const submitValues = { ...values }
// If the input wasn't modified, there was no mutation of the recipientAddress
if (!values.recipientAddress) {
submitValues.recipientAddress = selectedEntry?.address
}
submitValues.recipientName = selectedEntry?.name
onReview({ ...submitValues, tokenSpendingLimit })
}