-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Solana accountChanged event #15561
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
Open
jiexi
wants to merge
69
commits into
main
Choose a base branch
from
jl/sip-26-multichain-router-solana-accountChanged
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,023
−142
Open
Changes from all commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
f6174b7
feat: add MultichainRouter to Engine
ffmcgee725 faa8338
lint
ffmcgee725 de0e57b
minor lint
ffmcgee725 e389d3c
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 0237aae
feat: uncomment selector code for Solana dapp connectivity
ffmcgee725 82ca5dc
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 91e8edd
Merge branch 'main' into feat/sip-26-multichain-router
jiexi a29f430
refactor: address typescript issues
ffmcgee725 851ae07
chore: update controllers package
ffmcgee725 f6a4b65
merge main fix conflicts
ffmcgee725 cea7b77
lint
ffmcgee725 491d2ed
lint
ffmcgee725 7cc2e84
lint
ffmcgee725 bba1968
lint
ffmcgee725 dac3d96
suggestion
adonesky1 002bc98
suggestion (#15546)
ffmcgee725 8f3382a
test: fix Permissions test module
ffmcgee725 007eddd
fix: get non evm network data from proper controller state
ffmcgee725 20bf6b3
cleanup suggestion
adonesky1 3d615b6
cleanup suggestion (#15554)
ffmcgee725 98bdc29
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 300389d
test: temporary mock state fix for AccountConnect unit test
ffmcgee725 7166c0b
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 238e588
WIP
jiexi b5bb6c8
Merge branch 'main' into feat/sip-26-multichain-router
jiexi c5c90d0
Merge branch 'feat/sip-26-multichain-router' into jl/sip-26-multichai…
jiexi fa44aba
cleanup sorting
jiexi c819bda
Fix background bridge
jiexi 2787ca0
Fix downstream usage
jiexi d9686d5
lint
jiexi 9d20be8
fix spec
jiexi aa66683
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 a583cce
fix: incorrect initial default network avatars shown in AccountConnec…
ffmcgee725 95541ca
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 9811cae
fix: proper UX for wallet:eip155 only request scope
ffmcgee725 1e280eb
merge main fix conflicts
ffmcgee725 d27d59d
Merge branch 'main' into feat/sip-26-multichain-router
ffmcgee725 ec40294
add sortMultichainAccountsByLastSelected spec
jiexi 5ac587b
merge main fix conflicts
ffmcgee725 8950817
add accountChanged on connect
jiexi d2c85b4
Add bridge.notifySolanaAccountChangedForCurrentAccount spec
jiexi e458d11
add handleSolanaAccountChangedFromSelectedAccountChanges spec
jiexi a4bb258
lint
jiexi b6ad5d9
add handleSolanaAccountChangedFromScopeChanges spec
jiexi d23b3b5
Merge branch 'feat/sip-26-multichain-router' into jl/sip-26-multichai…
jiexi 210d7db
Fix BrowserTab view editing permission from top right icon when only …
jiexi a5d0f44
Merge remote-tracking branch 'origin' into jl/sip-26-multichain-route…
adonesky1 85aac85
cleanup BackgroundBridge
jiexi 0deda83
revert package.json
jiexi 4b63ba3
fix account selection for non-evm
jiexi f19152d
fix snapshot and lint
jiexi 0504863
tsc
jiexi c75e83e
Fix selected account in context of CAIP permission
jiexi a279d5e
fix sortMultichainAccountsByLastSelected spec
jiexi 2d416bc
Merge branch 'main' into feat/sip-26-multichain-router
jiexi 89a0ee7
Merge branch 'feat/sip-26-multichain-router' into jl/sip-26-multichai…
jiexi c3ebba2
lint
jiexi 2adfd56
Revert bad lints
jiexi 6535c61
lint
jiexi 5276610
lint
jiexi 861510c
Fix specs
jiexi 2df9ec1
Fix all accounts shown as selected
jiexi 4af4fdc
fix solana accountChanged announcement on page load
jiexi ec48774
lint
jiexi 0afc798
Merge branch 'main' into feat/sip-26-multichain-router
jiexi 9f5a9f0
Merge branch 'feat/sip-26-multichain-router' into jl/sip-26-multichai…
jiexi 75ac09a
fix spec
jiexi 35eb004
Remove commented code in backgroundbridge
jiexi 8dd30f4
Update notifySolanaAccountChangedForCurrentAccount on pipeline setup
jiexi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -32,7 +32,7 @@ import { Account, Assets } from '../../hooks/useAccounts'; | |||
import Engine from '../../../core/Engine'; | ||||
import { | ||||
removeAccountsFromPermissions, | ||||
sortAccountsByLastSelected, | ||||
sortMultichainAccountsByLastSelected, | ||||
} from '../../../core/Permissions'; | ||||
import Routes from '../../../constants/navigation/Routes'; | ||||
|
||||
|
@@ -44,8 +44,7 @@ import { WalletViewSelectorsIDs } from '../../../../e2e/selectors/wallet/WalletV | |||
import { RootState } from '../../../reducers'; | ||||
import { ACCOUNT_SELECTOR_LIST_TESTID } from './CaipAccountSelectorList.constants'; | ||||
import { toHex } from '@metamask/controller-utils'; | ||||
import { CaipAccountId, Hex } from '@metamask/utils'; | ||||
import { parseAccountId } from '@walletconnect/utils'; | ||||
import { CaipAccountId, parseCaipAccountId } from '@metamask/utils'; | ||||
|
||||
const CaipAccountSelectorList = ({ | ||||
onSelectAccount, | ||||
|
@@ -155,21 +154,15 @@ const CaipAccountSelectorList = ({ | |||
const nextCaipAccountIds = selectedAddresses.filter( | ||||
(selectedAddress) => selectedAddress !== caipAccountId, | ||||
); | ||||
const nextAddresses = nextCaipAccountIds.map( | ||||
(nextCaipAccountId) => { | ||||
const { address: nextAddress } = | ||||
parseAccountId(nextCaipAccountId); | ||||
return nextAddress as Hex; | ||||
}, | ||||
); | ||||
const [nextCaipAccountId] = | ||||
sortMultichainAccountsByLastSelected(nextCaipAccountIds); | ||||
|
||||
const nextAddressesSorted = | ||||
sortAccountsByLastSelected(nextAddresses); | ||||
const nextAddress = nextCaipAccountId ? parseCaipAccountId(nextCaipAccountId).address : ''; | ||||
const selectedAccountAddress = accounts.find( | ||||
(acc) => acc.isSelected, | ||||
)?.address; | ||||
nextActiveAddress = | ||||
nextAddressesSorted[0] || selectedAccountAddress || ''; | ||||
nextAddress || selectedAccountAddress || ''; | ||||
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. Same question as above 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. nothing happens if nextActiveAddress is falsy
|
||||
} | ||||
|
||||
// Switching accounts on the PreferencesController must happen before account is removed from the KeyringController, otherwise UI will break. | ||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What happens when the logic falls back to empty string and
onRemoveImportedAccount
is invoked? Nothing?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.
nothing, lol. removeAccount isn't even used in the handler apparently
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.
opting to just leave this as is since it's the similar in
EvmAccountSelectorList