-
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_LAYOUT
with screen nameWALLET_SCREEN
and paramemptyWallet: true
-
useEffect
onWalletScreen.js
callsinitializeWallet
if not already initialized withnull, null, null, true
- seedPhrase - null
- color - null
- name - null
- shouldRunMigrations - true
-
initializeWallet
does the following actions:- resets account state (
useResetAccountState
) - since
seedPhrase
is null,isImporting
is false - calls
walletsLoadState
from 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 returnsisNew
andwalletAddress
- 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_profile
and actionType ofCreate
- Passes
onCloseModal
function 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
createWallet
if necessary
- calls
createAccountForWallet
, which receivesid
,color
, andname
and returns an array ofnewWallets
- calls
initializeWallet
, described above - ensures everything is backed up correctly
- Navigates to modal screen with type