Skip to content

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 name WALLET_SCREEN and param emptyWallet: true
    • useEffect on WalletScreen.js calls initializeWallet if not already initialized with null, 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 returns isNew and walletAddress
        • calls createWallet, among other things, which is a 400 line function
      • 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
  • From create account :
    • Navigates to modal screen with type wallet_profile and actionType of Create
      • Passes onCloseModal function which is used when the wallet profile state modal is finished. The modal passes args to onCloseModal (name, color, etc…)
    • 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 receives id, color, and name and returns an array of newWallets
      • calls initializeWallet, described above
      • ensures everything is backed up correctly
Clone this wiki locally