-
Notifications
You must be signed in to change notification settings - Fork 8
Create Account Flow
Dominic Sherman edited this page Mar 30, 2021
·
1 revision
A wallet contain accounts You can have multiple wallets? (No clue how this looks on the UI) Accounts and wallets both have addresses
- From welcome screen:
- Navigate to
SWIPE_LAYOUTwith screen nameWALLET_SCREENand paramemptyWallet: true -
useEffectonWalletScreen.jscallsinitializeWalletif not already initialized withnull, null, null, true- seedPhrase - null
- color - null
- name - null
- shouldRunMigrations - true
-
initializeWalletdoes the following actions:- resets account state (
useResetAccountState) - since
seedPhraseis null,isImportingis false - calls
walletsLoadStatefrom redux- loads wallets from redux
- grabs your selected wallet out of keychain
- if your selected wallet isn’t among all the wallets then it defaults it to your first wallet
- if there is not a selected wallet, it sets your selected wallet based off of the address stored in keychain
- sets your selected address as well if necessary
- calls
runMigrations - loads the network
- calls
walletInit, which returnsisNewandwalletAddress- calls
createWallet, among other things, which is a 400 line function
- calls
- calls
walletsLoadState(again??) - calls
settingsUpdateAccountAddress- sets address in redux
- calls
walletConnectUpdateSessions
- initializes account data (
useInitializeAccountData)- init explorer
- init uniswap pairs
- uniswap get all exchanges
- unique tokens refresh state
- resets account state (
- Navigate to
- From create account :
- Navigates to modal screen with type
wallet_profileand actionType ofCreate- Passes
onCloseModalfunction which is used when the wallet profile state modal is finished. The modal passes args toonCloseModal(name, color, etc…)
- Passes
-
onCloseModal- Gets name and color off of args, with fallbacks
- gets primary wallet
- checks selected wallet
- otherwise tries to find it in all wallets
- otherwise falls back to imported wallet with seedphrase
- ensures it’s not damaged (
wallet.damaged) - creates a wallet by calling
createWalletif necessary
- calls
createAccountForWallet, which receivesid,color, andnameand returns an array ofnewWallets - calls
initializeWallet, described above - ensures everything is backed up correctly
- Navigates to modal screen with type