# External wallet
# auth screen
- use button and icon of "Other" wallet (rename it to "External")
- on click: open modal
## auth watcher wallet
Dialog:
- Title: External wallet
- Input: "ETH address"
## on transaction page
on each open of transaction page check if address unlocked.
If address unlocked - apply usual flow.
If address in locked state allow to press on unlock button.
## Methods
- create zkSync wallet from address:
```
async fromEthSigner(ethWallet, provider, signer);
```
- ethWallet instance:
```
{
provider: ethers.Provider // например ethers.getDefaultProvider(),
address: "0x.."
}
```
- provider:
```
const syncProvider = await zkSync.Provider.newWebsocketProvider(
LINKS_CONFIG.ws_api,
);
```
- signer:
https://zksync.io/dev/accounts.html#create-from-seed
```
signer?: Signer - non null (generated with random seed)
```
## help wanted:
- [x] need instruction for unlock modal
- [ ] need icon for watcher wallet
# Unlock dialog
Title: Unlocking account
:::info
To control your account from this browser, you need to call a method on zkSync contract to set a new public key. Note: to switch to a different browser later, you will need to set the key again.
If you don't want to control 0xexternal_address in zkSync from this browser, you can just directly [withdraw tokens](opens withdraw tokens page).
:::
## Login
- For a known address:
- Text "This address has already been used."
- input: "Enter password:"
- button: "Login"
- For a new address:
- Text "New address: please choose a strong password to protect your private key."
- input "Choose password:"
- input "Confirm password:"
- button "Login"
- If address already saved in local storage, decrypt private key with password provided by user.
- If address already saved in local storage, but decrypting private key fails show error message "Wrong password. If you forgot it, you need to reset your private key." and link "Reset key" to reset stored key in local storage. Resetting key must promopt confirmation with a Yes/No dialog.
## After login
Text on top remains the same, password buttons change to:
::: info
**Contract:** 0x.... *TODO: link to etherscan, contract page*
**Method:** `setPubKey()` *TODO: double-check with Vitalik*
**Arguments:** [12, "0x..."] *TODO: double-check with Vitalik*
Button: "Done"
:::
# Withdraw dialog
Title: Withdraw to L1
Dropdown: "Select a token" (tokens with non-zero balances listed).
## Once token is chosen
::: info
For now, for external wallets we only support withdrawals to L1. You can initiate a withdrawal in 2 steps. In the first step, you need to request withdrawal by calling the following method from 0xaddress:
**Contract:** 0x.... *TODO: link to etherscan, contract page*
**Method:** `withdraw()` *TODO: double-check with Vitalik*
**Arguments:** [12, 1] *TODO: double-check with Vitalik*
Once the request is processed, tokens will be accrued to your on-chain balance. You can check it by invoking the following function:
**Method:** `withdraw()` *TODO: double-check with Vitalik*
**Arguments:** [12] *TODO: double-check with Vitalik*
To complete the withdrawal, call this method from 0xaddress:
**Method:** `withdraw()` *TODO: double-check with Vitalik*
**Arguments:** [12] *TODO: double-check with Vitalik*
:::
# Full exit
**Instead of 0xabea.. below use zksyncProvider.contractAddress.mainContract for links and etherscan.io should be {rinkeby, ropsten,}.etherscan.io**
1. For given token show user account id (available in AccountState), balance in the zkSync (get using `getBalance` or from AccountState), balance on contract (to get this see function here https://gist.github.com/dvush/cf8b0e511be70a9f172a43cd2afb8d8f)
2. To make FullExit user should call method https://etherscan.io/address/0xabea9132b05a70803a4e85094fd0e1800777fbef#writeProxyContract `fullExit` Arguments required: token address (0x00..00 zero address for ETH), account id.
3. After full exit is processed and verified - balance will descrese in the zkSync and increase on the contract (see point 1)
4. To withdraw funds from contract to the user account https://etherscan.io/address/0xabea9132b05a70803a4e85094fd0e1800777fbef#writeProxyContract withdrawETH or withdrawERC20 should be called (ERC20 for any token except ETH). Arguments required: token address, amount (should be less or equal to amount of funds on the contract)