# Web3 & MetaMask

This section contains a description for each action separately, click on the arrow in the section name to open all actions.

## Element Installation

1. Add the element on the page
2. Make sure it is not inside a group or popup
3. Add the element on every page where you need it's features\
   (or use reusable elements)
4. Do not add more than 1 element per page

## Element settings

You will notice that the plugin element have some additional settings, they are **optional**.\
\
**1.** Auto-trigger change network

You can setup Auto-trigger request to change the network to the desired one.

![](https://163529783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGXQwv3RyfW5Yi0SKag6n%2Fuploads%2Ff14B4oS6YuxVQugM8KpD%2FScreenshot%202022-11-28%20at%2016.09.05.png?alt=media\&token=0677c413-e159-4dc5-b7aa-96eba3556426)

To enable it, check the *Enable Change Network Request* checkbox.\
To set the desired network, set the ID of it in the *Expected Network ID* field.\
Find all chains IDs on this page: <https://chainlist.org/>\
\
Note! If the user doesn't have the desired chain added in his wallet, an event called ***Chain ID not added in the Wallet*** will trigger.\
If this happens, you can run the action ***Trigger Switch Chain***

### &#x20;**2.** Use Liquality

You can set the plugin to use Liquality extension only instead of MetaMask. \
Details on Use with other wallets page: <https://docs.novabloq.com/web3-metamask/use-with-other-wallets-and-plugins#liquality-wallet>

### 3.  Read Only Mode

If you want to use the plugin features that can read the blockchain (read contract, get balance of a token, etc.) without connecting a wallet, you can set a custom RPC URL that the plugin will connect to and will be able to read the blockchain. Note that if you want to send a transaction or write a contract, you still need to connect a wallet.\
\
Note! When connecting a wallet, this field is ignored.

## Common States

These states are common for various actions, meaning the same state will be used for different actions. This is why it is important to save the data like transaction hash in your database before the state will be reset or replaced with new data.

<table><thead><tr><th width="218">State name</th><th width="94.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>Metamask is Installed</td><td>Yes/No</td><td>If the MetaMask extension is installed or is the app opened inside the MetaMask browser on mobile then this state will be Yes. </td></tr><tr><td>Transaction status</td><td>Text</td><td>When performing any form of transaction like write contract or send token, this state will show the status: <code>Done, Awaiting confirmation from user, Pending, Rejected, Error</code></td></tr><tr><td>Transaction Hash ID</td><td>Text</td><td>Similar to <em>Transaction status,</em> it will be available when doing any transactions using one of the plugin actions.<br>Will be available right after the user confirms the action from his wallet.<br>Doesn't mean the transaction was successfully confirmed on blockchain yet!<br>Use <a href="web3-utils/get-transaction-confirmations"><em>Get Transaction confirmations</em></a> to check it.</td></tr></tbody></table>

## Common Events

These are common events for various actions.\
Also in this list, there are some events that are not particular related to any actions, those are just useful events.

<table><thead><tr><th width="274">Event Name</th><th>Description</th></tr></thead><tbody><tr><td>Transaction sent successfully</td><td>Triggers when any submitted transaction using plugin actions (write contract, send token, etc.) was successfully confirmed on the blockchain. It may take a while depending on how congested the chain is.<br>Won't trigger if the page was reloaded!</td></tr><tr><td>Transaction ID is ready</td><td>When the user confirms performing a transaction, this event will trigger right after that.<br>Useful for UX, you can show a popup by letting the user know that the tx is pending.<br>Also you can use it to save the <em>Transaction Hash</em> in your database for later use in case the user reloads the page, because the hash state will be available only after this event triggers.</td></tr><tr><td>User canceled action</td><td>Any action that requires user confirmation and the user rejects it, will trigger this event.</td></tr><tr><td>User selected another Wallet</td><td>Triggered when the user connected to your app with multiple wallets from his MetaMask at once and is switching between them.</td></tr></tbody></table>
