Viewing Keys allow users to see balances of SecretTokens
The encrypted nature of the secret smart contracts that power SecretTokens and SecretSwap means that the balances on your wallet are not visible by default, even to you. In order to see these balances, you need to create the corresponding viewing keys.
In the SecretSwap app, you can select a SecretToken from the drop-down and the app will check your wallet for a viewing key. If one is found, the app will show your balance, otherwise it will show a button showing "View Balance".
Clicking this button triggers the creation of a viewing key for that SecretToken for your wallet. Keplr will prompt you to approve this creation and submit the transaction.
This transaction needs a small amount of SCRT for network fees.
Once this transaction is completed, the SecretSwap app will show your balance for that SecretToken, even if zero. Each SecretToken you wish to hold in your wallet will need a viewing key created. These keys can be copied and then imported into Keplr if you switch your wallet to a different browser.
Adding Viewing Keys directly from Keplr
Viewing Keys can also be added directly from your Keplr wallet. In order to do this, you'll first need the contract address of the token you're going to be adding. A list of contract addresses can be found here or on secretanalytics.xyz. Once you have the contract address for the token you'd like to add, open your Keplr wallet and click the button consisting of three lines in the top left corner. This will open the menu and reveal the following options:
Select the 'Add Token' option from this menu
Clicking the 'Add Token' option from the menu will open the following dialogue box:
Click 'Submit' when populated
Paste the contract address in the 'Contract Address' field and Keplr wallet will auto-populate the remainder of the details. In this example, we're adding the viewing key for sWBTC. Click the 'Submit' button and you'll once again be asked to authorize gas usage.
Click 'Approve' to finalize
Once you approve the gas usage, the Viewing Key will be added to your wallet and the balance of your added asset should now be showing on SecretSwap or showing as '0' if you have none of this asset. It's that simple!