-
Notifications
You must be signed in to change notification settings - Fork 5.3k
feat: account details pages w/o 7702 #33964
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
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
e620f03
feat: create account details component that switches into the correct…
hmalik88 92e1dd4
test: add mock account data
hmalik88 2379206
feat: add account details pages for various account types
hmalik88 94abd24
feat: conditionally render account details based on state 1 flag
hmalik88 f399be7
test: update tests
hmalik88 8a34473
chore: rename account details page to multichain account details
hmalik88 f7191e5
chore: remove extra account types from utils
hmalik88 4a250be
chore: update exports
hmalik88 164d8ce
refactor: remove unnecessary code from evm account details
hmalik88 f1b74a3
feat: move selectors into props, add useEffect for navigation, update…
hmalik88 79d4a34
Merge branch 'main' into hm/mul-283
hmalik88 fde920f
feat: add private key account details page
hmalik88 6862014
test: fix account details tests
hmalik88 cad293f
fix: update mock accounts and fix utils
hmalik88 5e1edbb
chore: remove unused props
hmalik88 9501960
feat: add multichain account details route
hmalik88 525fb8d
feat: add logic to conditionally push to multichain account details r…
hmalik88 0cd26c0
feat: add logic to prevent app header from appearing for account details
hmalik88 1d1dbd6
feat: add accountDetailsAddress selector back to multichain account d…
hmalik88 f5b0637
feat: add logic to prevent navigation to new account details page if …
hmalik88 6ebf8b4
feat: add logic to remove app header for address qr code page
hmalik88 43d4710
feat: add navigation protection for address qr code page
hmalik88 15be842
feat: add address qr code route
hmalik88 14f3f49
fix: update condition to be navigate protect when flag is NOT enabled
hmalik88 2ea64d5
Merge branch 'main' into hm/mul-283
hmalik88 f0b252c
feat: update smart contract account toggle components to use address …
hmalik88 0951f7e
fix: update prop type
hmalik88 922e4c2
feat: add address prop to smart contract account toggle section compo…
hmalik88 646da78
chore: update types
hmalik88 c926716
fix: update storybook file with correct props
hmalik88 02548a5
fix: resolve lint errors
hmalik88 7c6b8fb
Merge branch 'main' into hm/mul-283
hmalik88 5206ed6
chore: move 7702 toggles out of this PR
hmalik88 824167f
fix: apply lint fix
hmalik88 ddd7a33
fix: fix type error in utils tests
hmalik88 3d58992
fix: pass correct props to base account details in its tests
hmalik88 cb82654
chore: revert gitignore
hmalik88 3feaf71
test: add test for instiutional evm accounts
hmalik88 64fe3ed
Merge branch 'main' into hm/283without7702
hmalik88 6ba18a4
chore: revert 7702 changes
hmalik88 40a558e
feat: add push to account details route from wallet details
hmalik88 d286c99
chore: remove unnecessary path protection
hmalik88 d374bcd
chore: add param description in jsdoc
hmalik88 2006eb6
chore: remove unnecessary mocking of I18nContext
hmalik88 c9b272a
fix: lint fix
hmalik88 f839d61
fix: prevent wrapping of long values in account details row
hmalik88 59c5cdb
style: adjust container size
hmalik88 02fa170
style: add max width to account details
hmalik88 addb079
fix: apply code review
hmalik88 a4ff93f
Merge branch 'main' into hm/283without7702
hmalik88 9153933
fix: fix routing
hmalik88 066fb00
feat: add btc account details page
hmalik88 d853bf1
fix: apply fixes for text styling and navigation
hmalik88 38fc83a
test: add btc account tests
hmalik88 c5f638f
fix: add routing to account details tests
hmalik88 10f4217
fix: add routing to address qr code stories
hmalik88 ce6d4c8
fix: apply lint fix
hmalik88 5268bc1
fix: apply lint fix
hmalik88 f5d6676
fix: add routing to address qr code tests
hmalik88 da13839
Merge branch 'main' into hm/283without7702
hmalik88 cfabe05
fix: fix base account details test
hmalik88 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
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
130 changes: 130 additions & 0 deletions
130
ui/pages/multichain-accounts/account-details/account-type-utils.test.ts
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import { InternalAccount } from '@metamask/keyring-internal-api'; | ||
import { | ||
MOCK_ACCOUNT_BIP122_P2WPKH, | ||
MOCK_ACCOUNT_EOA, | ||
MOCK_ACCOUNT_ERC4337, | ||
MOCK_ACCOUNT_HARDWARE, | ||
MOCK_ACCOUNT_INSTITUTIONAL, | ||
MOCK_ACCOUNT_PRIVATE_KEY, | ||
MOCK_ACCOUNT_SOLANA_MAINNET, | ||
} from '../../../../test/data/mock-accounts'; | ||
import { | ||
getAccountTypeCategory, | ||
isEVMAccount, | ||
isSolanaAccount, | ||
isHardwareAccount, | ||
isPrivateKeyAccount, | ||
isInstitutionalEVMAccount, | ||
isBitcoinAccount, | ||
} from './account-type-utils'; | ||
|
||
describe('Account Type Utils', () => { | ||
describe('getAccountTypeCategory', () => { | ||
it('should return "evm" for EOA accounts', () => { | ||
expect(getAccountTypeCategory(MOCK_ACCOUNT_EOA)).toBe('evm'); | ||
}); | ||
|
||
it('should return "evm" for ERC-4337 accounts', () => { | ||
expect(getAccountTypeCategory(MOCK_ACCOUNT_ERC4337)).toBe('evm'); | ||
}); | ||
|
||
it('should return "solana" for Solana accounts', () => { | ||
expect(getAccountTypeCategory(MOCK_ACCOUNT_SOLANA_MAINNET)).toBe( | ||
'solana', | ||
); | ||
}); | ||
|
||
it('should return "unknown" for null/undefined accounts', () => { | ||
expect(getAccountTypeCategory(null as unknown as InternalAccount)).toBe( | ||
'unknown', | ||
); | ||
expect( | ||
getAccountTypeCategory(undefined as unknown as InternalAccount), | ||
).toBe('unknown'); | ||
}); | ||
}); | ||
|
||
describe('isEVMAccount', () => { | ||
it('should return true for EOA accounts', () => { | ||
expect(isEVMAccount(MOCK_ACCOUNT_EOA)).toBe(true); | ||
}); | ||
|
||
it('should return true for ERC-4337 accounts', () => { | ||
expect(isEVMAccount(MOCK_ACCOUNT_ERC4337)).toBe(true); | ||
}); | ||
|
||
it('should return false for Solana accounts', () => { | ||
expect(isEVMAccount(MOCK_ACCOUNT_SOLANA_MAINNET)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('isSolanaAccount', () => { | ||
it('should return true for Solana accounts', () => { | ||
expect(isSolanaAccount(MOCK_ACCOUNT_SOLANA_MAINNET)).toBe(true); | ||
}); | ||
|
||
it('should return false for EOA accounts', () => { | ||
expect(isSolanaAccount(MOCK_ACCOUNT_EOA)).toBe(false); | ||
}); | ||
|
||
it('should return false for ERC-4337 accounts', () => { | ||
expect(isSolanaAccount(MOCK_ACCOUNT_ERC4337)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('isHardwareAccount', () => { | ||
it('should return true for hardware accounts', () => { | ||
expect(isHardwareAccount(MOCK_ACCOUNT_HARDWARE)).toBe(true); | ||
}); | ||
|
||
it('should return false for EOA accounts', () => { | ||
expect(isHardwareAccount(MOCK_ACCOUNT_EOA)).toBe(false); | ||
}); | ||
|
||
it('should return false for Solana accounts', () => { | ||
expect(isHardwareAccount(MOCK_ACCOUNT_SOLANA_MAINNET)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('isPrivateKeyAccount', () => { | ||
it('should return true for private key accounts', () => { | ||
expect(isPrivateKeyAccount(MOCK_ACCOUNT_PRIVATE_KEY)).toBe(true); | ||
}); | ||
|
||
it('should return false for EOA accounts', () => { | ||
expect(isPrivateKeyAccount(MOCK_ACCOUNT_EOA)).toBe(false); | ||
}); | ||
|
||
it('should return false for Solana accounts', () => { | ||
expect(isPrivateKeyAccount(MOCK_ACCOUNT_SOLANA_MAINNET)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('isInstitutionalEVMAccount', () => { | ||
it('should return true for institutional EVM accounts', () => { | ||
expect(isInstitutionalEVMAccount(MOCK_ACCOUNT_INSTITUTIONAL)).toBe(true); | ||
}); | ||
|
||
it('should return false for regular EOA accounts', () => { | ||
expect(isInstitutionalEVMAccount(MOCK_ACCOUNT_EOA)).toBe(false); | ||
}); | ||
|
||
it('should return false for regular ERC-4337 accounts', () => { | ||
expect(isInstitutionalEVMAccount(MOCK_ACCOUNT_ERC4337)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('isBitcoinAccount', () => { | ||
it('should return true for Bitcoin accounts', () => { | ||
expect(isBitcoinAccount(MOCK_ACCOUNT_BIP122_P2WPKH)).toBe(true); | ||
}); | ||
|
||
it('should return false for EOA accounts', () => { | ||
expect(isBitcoinAccount(MOCK_ACCOUNT_EOA)).toBe(false); | ||
}); | ||
|
||
it('should return false for Solana accounts', () => { | ||
expect(isBitcoinAccount(MOCK_ACCOUNT_SOLANA_MAINNET)).toBe(false); | ||
}); | ||
}); | ||
}); |
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.
Uh oh!
There was an error while loading. Please reload this page.