-
Notifications
You must be signed in to change notification settings - Fork 254
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
Dispatch activateWalletTokens
from TransactionListScene
#5275
Conversation
src/actions/WalletActions.tsx
Outdated
)).catch(err => showError(err)) | ||
navigation.pop() | ||
return | ||
function activateWalletTokens(navigation: NavigationBase, wallet: EdgeCurrencyWallet, tokenIds?: string[]): ThunkAction<Promise<void>> { |
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.
It seems like the tokenIds
argument should be mandatory, and should be EdgeTokenId[]
. The function is only called from two places, so this change should be safe. Within the function, we pass tokenIds
straight to the core, so it's up to the plugins to decide if they support mainnet activation or not.
Further down, when we do const tokensText
, we could change the following line to const { currencyCode, displayName } = tokenId != null ? wallet.currencyConfig.allTokens[tokenId] : wallet.currencyInfo
, and even our string formatting will work for mainnet coins.
src/actions/WalletActions.tsx
Outdated
return | ||
function activateWalletTokens(navigation: NavigationBase, wallet: EdgeCurrencyWallet, tokenIds?: string[]): ThunkAction<Promise<void>> { | ||
return async (_dispatch, getState) => { | ||
if (tokenIds == null) throw new Error('Activating mainnet wallets unsupported') |
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.
If tokenIds
are mandatory, this line goes away.
if (unactivatedTokenIds.some(unactivatedTokenId => unactivatedTokenId === tokenId)) { | ||
// NOTE: It's safe to cast tokenId to string because we know it's in | ||
// unactivatedTokenIds which is an array of strings. | ||
await dispatch(activateWalletTokens(navigation, wallet, [tokenId as string])) |
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.
If we fix the typing, the cast simply goes away.
0b8e6d1
to
76e0c50
Compare
76e0c50
to
7b2936e
Compare
This is to resolve an issue where the wallet state hasn't completed checking if a newly added token is activated or not. This means the user can enter the transaction list scene without activating the wallet. In that case, we'll at least navigate in retrospect. Watch for changes to the `unactivedTokenIds` property on the wallet. If the tokenId within the transaction list appears in the `unactivedTokenids` array, then we'll properly handle the activation user journey.
7b2936e
to
52eeda0
Compare
This is to resolve an issue where the wallet state hasn't completed
checking if a newly added token is activated or not. This means the
user can enter the transaction list scene without activating the wallet.
In that case, we'll at least navigate in retrospect.
Watch for changes to the
unactivedTokenIds
property on the wallet.If the tokenId within the transaction list appears in the
unactivedTokenids
array, then we'll properly handle the activationuser journey.
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: