Web3 & MetaMask - Bubble plugin
Get PluginAll our plugins
  • Overview
  • Quick Start Example
  • Elements details
    • Web3 & MetaMask
      • Connect To MetaMask
      • Disconnect MetaMask
      • Send token With MetaMask
      • Get Balance of a Token
      • Get Balance of Multiple Tokens
      • Get Token Symbol
      • Sign
      • Check signature
      • Sign Typed Data
      • Check signature-Typed Data
      • Smart Contract - Read
        • Example - CAKE/BUSD rate on Pancaksewap
      • Smart Contract - Write
        • Example - Write a function
      • Trigger Switch Chain
      • Approve - Set Allowance
      • Revoke Allowance
      • Deploy Contract
      • Add Chain to MetaMask
      • Get NFT Metadata
      • Check NFT Balance
      • Smart Contract - Read
      • Smart Contract - Write
    • Web3 Utils
      • Get Transaction confirmations
      • Get Transaction Details
      • To Wei
      • From Wei
      • Add Token to MetaMask
      • Get ENS data
      • Get ENS Domain from Address
  • Use with other Wallets & Plugins
  • Sign up a user with signature
  • How to use on Mobile
Powered by GitBook
On this page
  • Element Installation
  • Element settings
  • 2. Use Liquality
  • 3. Read Only Mode
  • Common States
  • Common Events
  1. Elements details

Web3 & MetaMask

Main plugin element that you will work with.

PreviousQuick Start ExampleNextConnect To MetaMask

Last updated 2 years ago

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.

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: 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

2. Use Liquality

You can set the plugin to use Liquality extension only instead of MetaMask. Details on Use with other wallets page:

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.

State name
Type
Description

Metamask is Installed

Yes/No

If the MetaMask extension is installed or is the app opened inside the MetaMask browser on mobile then this state will be Yes.

Transaction status

Text

When performing any form of transaction like write contract or send token, this state will show the status: Done, Awaiting confirmation from user, Pending, Rejected, Error

Transaction Hash ID

Text

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.

Event Name
Description

Transaction sent successfully

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. Won't trigger if the page was reloaded!

Transaction ID is ready

When the user confirms performing a transaction, this event will trigger right after that. Useful for UX, you can show a popup by letting the user know that the tx is pending. Also you can use it to save the Transaction Hash 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.

User canceled action

Any action that requires user confirmation and the user rejects it, will trigger this event.

User selected another Wallet

Triggered when the user connected to your app with multiple wallets from his MetaMask at once and is switching between them.

Similar to Transaction status, it will be available when doing any transactions using one of the plugin actions. Will be available right after the user confirms the action from his wallet. Doesn't mean the transaction was successfully confirmed on blockchain yet! Use to check it.

Get Transaction confirmations
https://chainlist.org/
https://docs.novabloq.com/web3-metamask/use-with-other-wallets-and-plugins#liquality-wallet