Monarch White-Label API Overview
  • ⚙️Monarch API Calls
    • Creating an Invoice
      • POST
      • RETURNS
    • Generating Payment Data
      • POST
      • RETURNS
    • Check Allowance
      • POST
      • RETURNS
    • Generate Approve Transaction
  • 💸WalletConnect
  • 🦊MetaMask
  • 📮POSTing a Payment
Powered by GitBook
On this page

WalletConnect

PreviousGenerate Approve TransactionNextMetaMask

Last updated 1 year ago

One of the easiest ways to connect and deploy with WalletConnect is with their UniversalProvider.

The provider object returned can be used with Web3.js natively.

import Web3 from "web3";
import UniversalProvider from "@walletconnect/universal-provider";


const provider = await UniversalProvider.init({
   logger: "error",
   projectId: "",
});
const session = await provider.connect({
  namespaces: {
  eip155: {
    methods: [
       "eth_sendTransaction",
   	"eth_signTransaction",
   	"eth_sign",
       "personal_sign",
   	"eth_signTypedData",
    ],
    chains: ["eip155:137"],
    events: ["chainChanged", "accountsChanged"],
   },
  },
});

const web3 = new Web3(provider);

const [from] = await provider
   			 .request({
   				 method: "eth_accounts",
   			 })

web3.eth.sendTransaction({
  to: "0x"
  from,
  gas: "300000",
  data: "0x"
})
💸
https://docs.walletconnect.com/2.0/web/providers/universal
Universal Provider | WalletConnect Docs
Logo