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
  • Parameter 1
  • Parameter 2
  • Parameter 3
  • Transaction Value
  • Result
  1. Elements details
  2. Web3 & MetaMask
  3. Smart Contract - Write

Example - Write a function

In this example we will interact with a simple smart contract deployed by us for demo purpose.

PreviousSmart Contract - WriteNextTrigger Switch Chain

Last updated 2 years ago

We will use a smart contract from Goerli testnet. If you don't have any ETH on Goerli, get some from for fees. Contract used

0x399F1A6D5f2e67978E1D36B9F093A34526ed720F

This demo is available

To get started, open the contract on It has a function called samplePay, this is the one we need

All these parameters doesn't do anything, it is needed only for our demo.

Parameter 1

It requires a string that represents a name

Alex

Parameter 2

It is a number, all parameters fields in plugin are of string type but it will auto convert to number if it detects one.

30

Parameter 3

It requires a bool (true,false), again the plugin will detect if this is a true false parameter and will convert it to bool automatically.

true

Transaction Value

Min payment for this contract is 0.001 ETH, so just set this number without converting to wei

0.001

This is how it looks:

Result

Example:

Do not forget to set the contract

First thing you have to do to make sure the tx was sent successfully is to save the transaction hash as soon as it is available, to avoid situations when the user refresh or closes the page. Use the event "" and get the transaction hash from state ""

To check if a transaction was successfully confirmed use the action from the Utils element.

Additionally, you can use the event "" for the cases when user doesn't close or refresh the page.

Get Transaction confirmation
our faucet
here
Goerli etherscan
Join the Web3 NoCode Discord Server!Discord
Our team is active on Discord. Join for discussions and support
Logo
Transaction ID is ready
Transaction Hash ID
Transaction Sent Successfully
ABI