-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add token selection to the send screen #6445
Changes from 16 commits
6b83031
9261d85
d750c5e
f8459b7
5714cc3
c9b18d1
4137e53
9798892
02339b1
74f0733
8d64e17
6fe32f3
8e018e6
c51afaf
7595013
a8efcd8
d8f1432
2ac0302
d6b9026
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,9 +154,26 @@ function reduceMetamask (state, action) { | |
return newState | ||
|
||
case actions.SET_SELECTED_TOKEN: | ||
return extend(metamaskState, { | ||
newState = extend(metamaskState, { | ||
selectedTokenAddress: action.value, | ||
}) | ||
const newSend = extend(metamaskState.send) | ||
|
||
if (metamaskState.send.editingTransactionId && !action.value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about the case when a user has ETH + two or more tokens in the dropdown. Do we need to modify There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part is handled in |
||
delete newSend.token | ||
const unapprovedTx = newState.unapprovedTxs[newSend.editingTransactionId] || {} | ||
const txParams = unapprovedTx.txParams || {} | ||
newState.unapprovedTxs = extend(newState.unapprovedTxs, { | ||
[newSend.editingTransactionId]: extend(unapprovedTx, { | ||
txParams: extend(txParams, { data: '' }), | ||
}), | ||
}) | ||
newSend.tokenBalance = null | ||
newSend.balance = '0' | ||
} | ||
|
||
newState.send = newSend | ||
return newState | ||
|
||
case actions.SET_ACCOUNT_LABEL: | ||
const account = action.value.account | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to handle the specific case of when we are editing a transaction and ETH is selected, correct?
I see in
send-asset-row.component
that we pass an empty string when ETH is selected. Perhaps instead of just!action.value
, we could explicitly checkaction.value === ''
. That way the reader of the code here knows that the value passed to the action was intentionally an empty string, and not just defaulting to undefined.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed it to
this.setSelectedToken()
to invoke with no params, keeping it consistent with how it is call everywhere else in the app.