Skip to content
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 Accounts Controller #20344

Closed
wants to merge 263 commits into from
Closed
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
263 commits
Select commit Hold shift + click to select a range
e169619
fix: account-details-menu test
montelaidev Jul 27, 2023
0cd626a
feat: update import-nfts-modal to use internal account and fix consol…
montelaidev Jul 27, 2023
71877f2
fix: hardware selector test
montelaidev Jul 27, 2023
dfd0f13
feat: add snap keyring to switch case
montelaidev Jul 27, 2023
2a19e39
fix: tests for ui/pages ui/hooks ui/components
montelaidev Jul 28, 2023
3a015b1
fix: lint
montelaidev Jul 29, 2023
355c5dd
fix: code fence
montelaidev Jul 29, 2023
ba4618c
fix: removable keyrings
montelaidev Jul 29, 2023
061bb76
fix: fix unit tests
montelaidev Aug 1, 2023
3eb0a18
fix: send test
montelaidev Aug 3, 2023
fbeda3c
fix: use getAccountExpect
montelaidev Aug 3, 2023
f3a17c5
fix: eth-overview test
montelaidev Aug 3, 2023
fe9a421
fix: add fence to snap code in accountscontroller
montelaidev Aug 3, 2023
84d9670
chore: update yarn.lock
montelaidev Aug 3, 2023
b524093
fix: add and remove account logic on keyring state change
montelaidev Aug 3, 2023
d1daf9a
fix: metamask-controller.actions tests
montelaidev Aug 5, 2023
3228730
fix: remove the use of identities
montelaidev Aug 6, 2023
dd18f59
feat: add new tests internal accounts in metamask-controller
montelaidev Aug 6, 2023
b7b6d9b
fix: send-asset-row story
montelaidev Aug 8, 2023
a919a0b
fix: add account
montelaidev Aug 8, 2023
a4fc477
fix: snapshot
montelaidev Aug 8, 2023
f3625a1
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 8, 2023
e10b25a
fix: update actions
montelaidev Aug 8, 2023
38c12eb
fix: update permission to use accounts
montelaidev Aug 8, 2023
2d353bc
fix: actions tests
montelaidev Aug 8, 2023
4741972
Merge remote-tracking branch 'origin' into feat/accounts-controller
montelaidev Aug 21, 2023
e8cc01a
fix: merge usage of identities
montelaidev Aug 21, 2023
9d087d6
fix: import flow e2e
montelaidev Aug 21, 2023
9d60f90
fix: lavamoat policy
montelaidev Aug 21, 2023
501463e
fix: update snapshot and default state in fixtures
montelaidev Aug 22, 2023
afc7928
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 23, 2023
50ac5fa
fix:remove log
montelaidev Aug 24, 2023
ab9d811
fix: update IncomingTransactionHelper to use internal account
montelaidev Aug 24, 2023
1aa9eb1
fix: send tx using internal account
montelaidev Aug 24, 2023
601dd55
lint: remove unused
montelaidev Aug 24, 2023
01319ec
fix: relocate AccountTracker to after AccountsController, and set to …
montelaidev Aug 25, 2023
d0dc993
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 25, 2023
7e81679
feat: add migrations
montelaidev Aug 25, 2023
f1d4f99
feat: add migration to migrations/index.js
montelaidev Aug 25, 2023
f9a2d05
fix: account-detail unit test
montelaidev Aug 25, 2023
3f5fbec
fix: remove identities in accounts controller
montelaidev Aug 25, 2023
945997f
fix: app header initial internalAccount address may not be defined du…
montelaidev Aug 25, 2023
999c350
fix: update migrationcd
montelaidev Aug 26, 2023
051ca2f
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 26, 2023
d446f59
feat: update alert, detect token and account tracker to use intenral …
montelaidev Aug 27, 2023
1be53fb
fix: update custody-confirm-link-modal to use internal account
montelaidev Aug 27, 2023
27f9b71
fix: update advanced gas fee default story to use intenral account
montelaidev Aug 27, 2023
0c1347f
fix: account-tracker test
montelaidev Aug 28, 2023
8f88fa2
fix: remove default account in default state in accounts controller
montelaidev Aug 28, 2023
5c0200b
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 28, 2023
012ce5d
fix: double negative in updateAccounts filter
montelaidev Aug 28, 2023
08cb11d
update accounts controller to not have snapcontroller and keyringcont…
montelaidev Aug 28, 2023
95d686a
fix: change identities to internal accounts in permissions controller
montelaidev Aug 28, 2023
8ccfd69
fix: update error snapshot
montelaidev Aug 29, 2023
5d7b290
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 29, 2023
56c69aa
fix: update backup to save accountsControllerState
montelaidev Aug 29, 2023
418db3a
fix: add accountsController to backup
montelaidev Aug 30, 2023
dbf742b
fix: uncomment tests
montelaidev Aug 31, 2023
7ed783d
fix: use listener for selectedAccountChange inplace of onPreferencesS…
montelaidev Aug 31, 2023
1992b30
fix: onPreferencesStateChange payload for TokensController and fix test
montelaidev Aug 31, 2023
217c59d
fix: update policy and change from default export of AccountsController
montelaidev Aug 31, 2023
8498a3f
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 31, 2023
536027a
chore: update yarn.lock
montelaidev Aug 31, 2023
1c915a8
fix: update build.yml
montelaidev Aug 31, 2023
4df1db4
chore: update policy.json
montelaidev Aug 31, 2023
3c607bf
fix: account-tracker and select-action-modal test
montelaidev Aug 31, 2023
4e812f4
fix: update snapshots
montelaidev Aug 31, 2023
5f0d889
fix: re-add gas-estimates
montelaidev Aug 31, 2023
b08f382
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Aug 31, 2023
8cb1730
fix: race condition to add nft 6
montelaidev Aug 31, 2023
685b55a
fix: remove exclusive test
montelaidev Aug 31, 2023
7779f08
feat: update sentry to add AccountsController in SENTRY_BACKGROUND_STATE
montelaidev Aug 31, 2023
e593e44
fix: migrate name to metadata in internalAccount
montelaidev Sep 1, 2023
833ec68
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 1, 2023
4e9d38e
feat: add keyring-api dependency
montelaidev Sep 1, 2023
ee67d51
fix: set correct selectedAddress in computeEstimatedGasLimit and init…
montelaidev Sep 2, 2023
b6d019e
fix: restore missing e2e test
montelaidev Sep 2, 2023
6481457
fix: return empty if snapKeyring is not initialised
montelaidev Sep 2, 2023
bc04e16
fix: missing accountsController arg in account-tracker test
montelaidev Sep 2, 2023
3ef16e7
fix: confirm-remove-account and confirm-encryption-public-key stories…
montelaidev Sep 2, 2023
3f744d3
chore: policy.json update
montelaidev Sep 2, 2023
b219dfe
fix: order of snap keyring
montelaidev Sep 2, 2023
8b157c5
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 2, 2023
cc07638
fix: update DetectTokensController to use getCurrentSelectedAccount t…
montelaidev Sep 4, 2023
5b0116b
fix: update AlertController to use getCurrentSelectedAccount than imp…
montelaidev Sep 4, 2023
2d5e390
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 5, 2023
6fee8e5
fix: update snapshot
montelaidev Sep 5, 2023
b0dd2bf
fix: mmi to use accounts controller
montelaidev Sep 5, 2023
d0b693d
feat: use eth-snap-keyring 0.2.0
montelaidev Sep 6, 2023
d03879d
fix: update to use preview version of accounts-controller from the co…
montelaidev Sep 6, 2023
52c094e
fix: test imports of AccountsController and yarn dedupe
montelaidev Sep 6, 2023
71e76bc
fix: InternalAccount import from eth-snap-keyring to keyring-api
montelaidev Sep 6, 2023
2225d81
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 7, 2023
c3511c9
fix: bump keyring-api dep and fix 097 migration's account schema
montelaidev Sep 7, 2023
f864aca
feat: update accounts-controller to subscribe to events instead of us…
montelaidev Sep 7, 2023
328fdc4
fix: 097 test
montelaidev Sep 7, 2023
886fe91
fix: mmi controller test
montelaidev Sep 7, 2023
26d50a5
fix: update tests to use EthAccountType and EthMethod
montelaidev Sep 7, 2023
a8a6c07
fix: update keyring controller and metametrics to use accounts contro…
montelaidev Sep 8, 2023
837c8a1
fix: preference test and error snapshots
montelaidev Sep 8, 2023
d5b4324
chore: fix lint
montelaidev Sep 8, 2023
1178b3a
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 8, 2023
b9a6249
fix: remove only
montelaidev Sep 8, 2023
11d1e3f
fix: remove eth-sig-util dep
montelaidev Sep 8, 2023
5e205f9
Update LavaMoat policies
metamaskbot Sep 8, 2023
1286565
chore: update to new bridge and API (#20828)
danroc Sep 13, 2023
cc3e426
Add extra confirmation when removing keyring snap (#20714)
montelaidev Sep 13, 2023
c158e5a
chore: update `keyring-api`
danroc Sep 13, 2023
99a1501
Fix unit test
FrederikBolding Sep 12, 2023
814454a
chore: update `yarn.lock`
danroc Sep 13, 2023
c2e4bd3
chore: update `keyring-api`
danroc Sep 13, 2023
6ef9eb4
chore: ignore `snap_getLocale` in unit tests
danroc Sep 13, 2023
e932791
chore: update `yarn.lock`
danroc Sep 13, 2023
766f53e
chore: update `eth-snap-keyring`
danroc Sep 13, 2023
6cbd8d8
test: fix permissions unit tests
danroc Sep 13, 2023
f69d4f2
Update LavaMoat policies
metamaskbot Sep 13, 2023
88586ad
chore: update policy
montelaidev Sep 11, 2023
57970eb
fix: remove identities references
montelaidev Sep 11, 2023
74f1e43
fix: updates the paramater names for getPermissionSpecifications
montelaidev Sep 15, 2023
d12b518
fix: removes identities in from setupSentry
montelaidev Sep 15, 2023
9177e90
fix: updates jsdoc to change identities to InternalAccounts
montelaidev Sep 15, 2023
1abc4de
Publish MMI builds alongside stable releases (#20788)
Gudahtt Sep 8, 2023
d3f6493
UX: Multichain: Remove hover background on Account Picker (#20794)
darkwing Sep 8, 2023
e467a3f
Throw error if mock server port is busy (#20692)
FrederikBolding Sep 8, 2023
5641898
[MMI] Shows Stake & Portfolio buttons and hides the Buy and Bridge bu…
zone-live Sep 11, 2023
cb375db
Fix broken `approveTokenDescriptionWithoutSymbol` translation key (#2…
GuillaumeRx Sep 11, 2023
c4f63bc
Ux Multichain : Updated Select Action Modal (#20755)
NidhiKJha Sep 11, 2023
706710b
Multichain: Cleanup: Use constants, jest fns (#20678)
darkwing Sep 11, 2023
a8069bd
Remove `nonceDetails` from `TransactionMeta` (#20729)
OGPoyraz Sep 11, 2023
d710fba
UX: Fix errant global menu event (#20781)
darkwing Sep 11, 2023
301fb32
Updating NetworkListMenu component to show as many networks in the ne…
georgewrmarshall Sep 11, 2023
e6c9c0f
Migrate MetaMaskController from mocha to jest (#20696)
jiexi Sep 11, 2023
907b3db
Adding env vars for blockaid to build file (#20769)
jpuri Sep 12, 2023
d27c9f0
Revert ppom.js exactly yo audited version (#20826)
jpuri Sep 12, 2023
32ff78f
Fix: Change style object key format kebab -> camelCase and fix title …
digiwand Sep 12, 2023
0ad9a24
Migrate Import Token Link to TypeScript (#20474)
NidhiKJha Sep 12, 2023
0da5dd3
[MMI] Show the NFT tab content for mmi (#20830)
zone-live Sep 12, 2023
05b2f4c
fix: fix nft order (#20796)
sahar-fehri Sep 12, 2023
b54113d
Integrate `SelectedNetworkController` (#20821)
adonesky1 Sep 12, 2023
e890482
fix: error during persisted transaction approval (#20626)
vinistevam Sep 13, 2023
d15882a
Only show enabled insight snaps on the confirmation screen (#20850)
FrederikBolding Sep 13, 2023
c20e121
Use first non-symbol character as snap fallback icon (#20851)
FrederikBolding Sep 13, 2023
1012387
Require Flask Snaps E2E to pass for CI pass (#20740)
FrederikBolding Sep 13, 2023
dc9fcfd
Fix spacing on connected sites in the snap details page (#20854)
FrederikBolding Sep 13, 2023
bb167dd
Make permissions modal scrollable (#20409)
dominikrudzki Sep 13, 2023
00d2b12
[FLASK] Bump snaps packages (#20567)
FrederikBolding Sep 13, 2023
4596dda
build: add "test:unit:jest:watch" script to package.json to run jest …
digiwand Sep 13, 2023
8fdfd85
Fix: Unable to edit token allowance / custom spending cap (#20804)
digiwand Sep 13, 2023
8ed30ec
Fix-BannerAlert to TS (#20655)
dhruvv173 Sep 13, 2023
8fce60f
Enable zkSync Era in Swaps (#20809)
dan437 Sep 13, 2023
3ef1f60
fix: add new account after an account management snap is re-installed…
gantunesr Sep 13, 2023
4fcf681
Adding storybook files for the StepProgressBar (#20842)
georgewrmarshall Sep 13, 2023
9797821
Update chromedriver version (#20818)
pedronfigueiredo Sep 14, 2023
3e9aef0
[MMI] Added institutional selectors unit tests (#20833)
albertolive Sep 14, 2023
fad1bbd
Added Institution-background unit test (#20855)
albertolive Sep 14, 2023
0396d6d
[MMI] Changed the wrong privacy policy URL to the good one (#20884)
albertolive Sep 14, 2023
77b1b34
UX: Set initial background color to system theme (#20858)
darkwing Sep 14, 2023
2932cf7
fix: move keyring-controller patch to preview package
mikesposito Sep 18, 2023
7a1af97
fix: update dependencies
montelaidev Sep 18, 2023
92e9044
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 18, 2023
388e4a8
fix: message subscription in DetectTokensController
montelaidev Sep 18, 2023
31d7912
feat: update keyring-controller dep to use patch
montelaidev Sep 18, 2023
bf2ed0a
fix: add selectedAccountChange event to DetectTokenController messenger
montelaidev Sep 18, 2023
36023a4
fix: mmi-controller test
montelaidev Sep 18, 2023
776cc66
fix: mmi selector test
montelaidev Sep 18, 2023
d7ed2e4
chore: update snapshot
montelaidev Sep 18, 2023
ee10e3b
fix: permission test
montelaidev Sep 18, 2023
d5c6f9e
fix: metamask-controller test after merge
montelaidev Sep 18, 2023
5f796f0
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 18, 2023
5d9c1dd
chore: update lockfile
montelaidev Sep 18, 2023
50c3954
fix: metamask-controller test
montelaidev Sep 19, 2023
0360111
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 19, 2023
8fffbcf
fix: change Serverity to BannerAlertSeverity in keyring-snap-removal-…
montelaidev Sep 19, 2023
00c2466
fix: removed unused Severity
montelaidev Sep 19, 2023
7915145
fix: remove unused dep and fix import of keyring to use preview
montelaidev Sep 19, 2023
81bc4b0
fix: add default selectedAddress
montelaidev Sep 19, 2023
0dccbb3
fix: use optional chaining for AccountsController state in selectedAd…
montelaidev Sep 19, 2023
e38a34f
feat: add migrations
montelaidev Sep 19, 2023
e9cfe9a
fix: have PreferenceController to subscribe to AccountsController to …
montelaidev Sep 19, 2023
8532628
fix: isImportNftsModalOpen state
montelaidev Sep 19, 2023
b03a16b
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 19, 2023
b61f8a2
chore: update dep and yarn.lock
montelaidev Sep 19, 2023
4511974
fix: migrations from 098 to 099 after merge
montelaidev Sep 19, 2023
944626a
fix: preference, mmi controller tests
montelaidev Sep 19, 2023
79293ab
fix: detect-tokens test
montelaidev Sep 19, 2023
2ba17ed
chore: bump eth-snap-keyring dep
montelaidev Sep 19, 2023
1a73bd2
fix: snap-manageAccount test
montelaidev Sep 19, 2023
90744d6
fix: state-log e2e test
montelaidev Sep 19, 2023
8806e83
fix: update errors snapshots
montelaidev Sep 19, 2023
1667f6d
chore: update policies
montelaidev Sep 19, 2023
3e09171
chore: update yarn.lock and policy.json
montelaidev Sep 19, 2023
ffb84f9
fix: lint error
montelaidev Sep 19, 2023
61ef454
fix: policy and yarn lock
montelaidev Sep 19, 2023
a68a1cd
fix: update snapshot
montelaidev Sep 19, 2023
8e6848e
chore: update preview version and policy
montelaidev Sep 19, 2023
0335128
fix: stories and remove signTypedData from mock data
montelaidev Sep 19, 2023
8094bd9
fix: snap-manageAccount e2e
montelaidev Sep 20, 2023
055bcad
fix: display snap name in account picker
montelaidev Sep 20, 2023
f2d2e28
chore: lint fix use const
montelaidev Sep 20, 2023
b9a0372
fix: snap-manageAccount query snap name instead of just snap
montelaidev Sep 20, 2023
81ef6fe
Update LavaMoat policies
metamaskbot Sep 20, 2023
a9600cd
feat: add additional test for account link
montelaidev Sep 20, 2023
affcb5a
fix: update backup test
montelaidev Sep 20, 2023
a6f13a4
feat: add keyring snap removal modal
montelaidev Sep 20, 2023
ffab1ee
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 20, 2023
6ed379e
Update LavaMoat policies
metamaskbot Sep 20, 2023
297a89b
fix:tests and change selectors that uses metamask.keyring to internal…
montelaidev Sep 21, 2023
cb5d7d5
chore: update accounts-controller dep
montelaidev Sep 21, 2023
c6fcc7e
fix: snap-update e2e test when the scroll may not render on firefox
montelaidev Sep 21, 2023
5f9267d
feat: add tests for KeyringSnapRemovalResult
montelaidev Sep 21, 2023
c2f2375
fix: rename toBeCalledWith to toHaveBeenCalledWith
montelaidev Sep 21, 2023
5f8ade9
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 21, 2023
73e91a6
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 22, 2023
7cada76
feat: bump accounts controller to release version
montelaidev Sep 22, 2023
eb1d474
fix: reapply patch on `@metamask/keyring-controller`
mikesposito Sep 22, 2023
5f81b78
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 22, 2023
b1c5e2b
fix: missing import from merge
montelaidev Sep 22, 2023
c14a0a2
chore: update policy and yarn lock
montelaidev Sep 22, 2023
136cb1f
Update LavaMoat policies
metamaskbot Sep 22, 2023
a34b14b
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 25, 2023
4547aea
Update LavaMoat policies
metamaskbot Sep 25, 2023
fbb2dfe
fix: mmi e2e tests
montelaidev Sep 25, 2023
12667b0
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 25, 2023
2fba0aa
Update LavaMoat policies
metamaskbot Sep 25, 2023
1819c35
fix: remove unneeded patch
montelaidev Sep 26, 2023
646137e
fix: missing period in message
montelaidev Sep 26, 2023
088f19b
fix: toLowerCase in mmicontroller, and remove log
montelaidev Sep 26, 2023
fa32f67
fix: remove unused mocks
montelaidev Sep 26, 2023
4c4f468
fix: move setAccountLabel under accounts controller block
montelaidev Sep 26, 2023
a029809
chore: remove unused log
montelaidev Sep 26, 2023
d8b13f6
fix: update comments for keyring controller and tokens controller
montelaidev Sep 26, 2023
8e9da24
fix: update accounts controller to false in sentry
montelaidev Sep 26, 2023
033fea9
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 26, 2023
e71fe10
fix: add addititonal migration test for 099
montelaidev Sep 26, 2023
6c3dcca
fix: add comment on why default in migration is HD Key Tree
montelaidev Sep 26, 2023
3a6db1e
chore: bump keyring-api and eth-snap-keyring dep
montelaidev Sep 26, 2023
a122d59
Update LavaMoat policies
metamaskbot Sep 26, 2023
35ff503
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 26, 2023
acbb8df
fix: add addressExists callback to snapkeyring
montelaidev Sep 26, 2023
3be04ad
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 26, 2023
37739e8
Update LavaMoat policies
metamaskbot Sep 26, 2023
88e5656
fix: addNewAccount implementation to match newer version
montelaidev Sep 28, 2023
9a99e78
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 28, 2023
b7a4338
fix: remove unused getAccountType
montelaidev Sep 28, 2023
cd22f62
fix: unit tests
montelaidev Sep 28, 2023
7315df9
Update LavaMoat policies
metamaskbot Sep 28, 2023
35be64e
Merge remote-tracking branch 'origin/develop' into feat/accounts-cont…
montelaidev Sep 28, 2023
3006deb
chore: update policy
montelaidev Sep 28, 2023
7121faf
fix: test-snap-account e2e test to search for SSK name instead of jus…
montelaidev Sep 28, 2023
7aed4f5
Update LavaMoat policies
metamaskbot Sep 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { KeyringType } from '../shared/constants/keyring';
import { NetworkType } from '@metamask/controller-utils';
import { NetworkStatus } from '@metamask/network-controller';
import { CHAIN_IDS } from '../shared/constants/network';
import { EthAccountType, EthMethod } from '@metamask/keyring-api';

const state = {
invalidCustomNetwork: {
Expand Down Expand Up @@ -300,6 +301,63 @@ const state = {
isUnlocked: true,
isAccountMenuOpen: false,
rpcUrl: 'https://rawtestrpc.metamask.io/',
internalAccounts: {
accounts: {
'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3': {
address: '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4',
id: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3',
metadata: {
name: 'This is a Really Long Account Name',
keyring: {
type: 'HD Key Tree',
},
},
options: {},
methods: [...Object.values(EthMethod)],
type: EthAccountType.Eoa,
},
'07c2cfec-36c9-46c4-8115-3836d3ac9047': {
address: '0xb19ac54efa18cc3a14a5b821bfec73d284bf0c5e',
id: '07c2cfec-36c9-46c4-8115-3836d3ac9047',
metadata: {
name: 'Account 2',
keyring: {
type: 'HD Key Tree',
},
},
options: {},
methods: [...Object.values(EthMethod)],
type: EthAccountType.Eoa,
},
'15e69915-2a1a-4019-93b3-916e11fd432f': {
address: '0x9d0ba4ddac06032527b140912ec808ab9451b788',
id: '15e69915-2a1a-4019-93b3-916e11fd432f',
metadata: {
name: 'Account 3',
keyring: {
type: 'HD Key Tree',
},
},
options: {},
methods: [...Object.values(EthMethod)],
type: EthAccountType.Eoa,
},
'784225f4-d30b-4e77-a900-c8bbce735b88': {
address: '0xeb9e64b93097bc15f01f13eae97015c57ab64823',
id: '784225f4-d30b-4e77-a900-c8bbce735b88',
metadata: {
name: 'Account 4',
keyring: {
type: 'HD Key Tree',
},
},
options: {},
methods: [...Object.values(EthMethod)],
type: EthAccountType.Eoa,
},
},
selectedAccount: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3',
},
identities: {
'0x64a845a5b02460acf8a3d84503b0d68d028b4bb4': {
name: 'This is a Really Long Account Name',
Expand Down Expand Up @@ -455,6 +513,57 @@ const state = {
],
},
],
'0x64a845a5b02460acf8a3d84503b0d68d028b4bb4': [
{
address: '0x514910771AF9Ca656af840dff83E8264EcF986CA',
decimals: 18,
symbol: 'LINK',
image:
'https://crypto.com/price/coin-data/icon/LINK/color_icon.png',
aggregators: [
'coinGecko',
'oneInch',
'paraswap',
'zapper',
'zerion',
],
},
{
address: '0xc00e94Cb662C3520282E6f5717214004A7f26888',
decimals: 18,
symbol: 'COMP',
image:
'https://crypto.com/price/coin-data/icon/COMP/color_icon.png',
aggregators: [
'bancor',
'cmc',
'cryptocom',
'coinGecko',
'oneInch',
'paraswap',
'pmm',
'zapper',
'zerion',
'zeroEx',
],
},
{
address: '0xfffffffFf15AbF397dA76f1dcc1A1604F45126DB',
decimals: 18,
symbol: 'FSW',
image:
'https://assets.coingecko.com/coins/images/12256/thumb/falconswap.png?1598534184',
aggregators: [
'aave',
'cmc',
'coinGecko',
'oneInch',
'paraswap',
'zapper',
'zerion',
],
},
],
},
},
detectedTokens: [
Expand Down
Empty file.
27 changes: 27 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 21 additions & 12 deletions app/scripts/controllers/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export default class AlertController {
* @param {AlertControllerOptions} [opts] - Controller configuration parameters
*/
constructor(opts = {}) {
const { initState = {}, preferencesStore } = opts;
const {
initState = {},
getCurrentSelectedAccount,
controllerMessenger,
} = opts;
const state = {
...defaultState,
alertEnabledness: {
Expand All @@ -49,18 +53,23 @@ export default class AlertController {

this.store = new ObservableStore(state);

this.selectedAddress = preferencesStore.getState().selectedAddress;
this.selectedAddress = getCurrentSelectedAccount().address;

preferencesStore.subscribe(({ selectedAddress }) => {
const currentState = this.store.getState();
if (
currentState.unconnectedAccountAlertShownOrigins &&
this.selectedAddress !== selectedAddress
) {
this.selectedAddress = selectedAddress;
this.store.updateState({ unconnectedAccountAlertShownOrigins: {} });
}
});
this.controllerMessenger = controllerMessenger;

this.controllerMessenger.subscribe(
'AccountsController:selectedAccountChange',
(account) => {
const currentState = this.store.getState();
if (
currentState.unconnectedAccountAlertShownOrigins &&
this.selectedAddress !== account.address
) {
this.selectedAddress = account.address;
this.store.updateState({ unconnectedAccountAlertShownOrigins: {} });
}
},
);
}

setAlertEnabledness(alertId, enabledness) {
Expand Down
31 changes: 20 additions & 11 deletions app/scripts/controllers/detect-tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class DetectTokensController {
* @param config.assetsContractController
* @param config.trackMetaMetricsEvent
* @param config.messenger
* @param config.getCurrentSelectedAccount
*/
constructor({
messenger,
Expand All @@ -43,6 +44,7 @@ export default class DetectTokensController {
tokensController,
assetsContractController = null,
trackMetaMetricsEvent,
getCurrentSelectedAccount,
} = {}) {
this.messenger = messenger;
this.assetsContractController = assetsContractController;
Expand All @@ -53,7 +55,7 @@ export default class DetectTokensController {
this.tokenList = tokenList;
this.useTokenDetection =
this.preferences?.store.getState().useTokenDetection;
this.selectedAddress = this.preferences?.store.getState().selectedAddress;
this.selectedAddress = getCurrentSelectedAccount().address;
this.tokenAddresses = this.tokensController?.state.tokens.map((token) => {
return token.address;
});
Expand All @@ -62,16 +64,22 @@ export default class DetectTokensController {
this.chainId = this.getChainIdFromNetworkStore();
this._trackMetaMetricsEvent = trackMetaMetricsEvent;

preferences?.store.subscribe(({ selectedAddress, useTokenDetection }) => {
if (
this.selectedAddress !== selectedAddress ||
this.useTokenDetection !== useTokenDetection
) {
this.selectedAddress = selectedAddress;
this.useTokenDetection = useTokenDetection;
this.restartTokenDetection({ selectedAddress });
}
});
messenger.subscribe(
'AccountsController:selectedAccountChange',
(account) => {
const useTokenDetection =
this.preferences?.store.getState().useTokenDetection;
if (
this.selectedAddress !== account.address ||
this.useTokenDetection !== useTokenDetection
) {
this.selectedAddress = account.address;
this.useTokenDetection = useTokenDetection;
this.restartTokenDetection({ selectedAddress: this.selectedAddress });
}
},
);

tokensController?.subscribe(
({ tokens = [], ignoredTokens = [], detectedTokens = [] }) => {
this.tokenAddresses = tokens.map((token) => {
Expand All @@ -81,6 +89,7 @@ export default class DetectTokensController {
this.detectedTokens = detectedTokens;
},
);

messenger.subscribe('NetworkController:stateChange', () => {
if (this.chainId !== this.getChainIdFromNetworkStore()) {
const chainId = this.getChainIdFromNetworkStore();
Expand Down
Loading
Loading