🇺🇲
Broearn Wallet Documentation
  • 🧬OVERVIEW
    • 💡What is Broearn Wallet?
    • 🛡️Security
    • 📋Available Networks
      • Parallel Universe Chain
      • Bitcoin
      • Ethereum
      • BNB Chain
      • Tron
      • Solana
      • OKX Chain
      • Optimism
      • Fantom
      • Ethereum Classic
      • Polygon
      • Avalanche
  • 🛸PUT
    • Extension & in Broearn app
      • Events
        • Disconnect
        • Accounts Changed
    • Detecting the Provider
  • Establishing a Connection
  • PROVIDER METHODS
    • Connect
    • Disconnect
    • SignMessage
    • SignTransaction
    • SignAllTransactions
    • SignAndSendTransaction
  • 🔹ETHEREUM & EVM
    • Getting Started with Ethereum and EVM
    • Detecting the Provider
    • Establishing a Connection
    • Sending a Transaction
    • Signing a Message
    • Provider API Reference
      • Properties
        • eth_chainId
        • eth_networkVersion
        • eth_selectedAddress
        • _events
        • _eventsCount
      • Events
        • Connect
        • Accounts Changed
        • Disconnect
        • Chain Changed
      • Methods
        • isConnected
        • request
  • Demo Applications
  • 📜ERRORS
  • ADVANCED
    • Auth
      • Web Javascript demo
      • Web Java
      • Web Golang
      • Web PHP
  • COMMUNITY AND SUPPORT
    • 🐦Twitter
    • ✈️Telegram
    • 🎮Discord
Powered by GitBook
On this page
  1. ETHEREUM & EVM
  2. Provider API Reference
  3. Methods

request

Sends a JSON RPC request to the wallet

PreviousisConnectedNextDemo Applications

Last updated 1 year ago

Params: method: string; params?: unknown[] | object;

Returns: Promise<unknown>

Example:

const accounts = await window.bw.eth.request({ 
    method: "eth_requestAccounts", params: [] 
})
console.log(accounts)
// ["0xb233696514F192Da7F0f0Fb1332f18c68cfB6c23"]

The code above demonstrates how you can use the request method to ask the user to connect to your dapp. The request method is the go to way for you to interface with the wallet in your dapp. It accepts most that would need to interact with the wallet. However it will not work for methods that don't make sense for a wallet. E.g. you can't use the provider object Broearn Wallet injects to call something like eth_getTransactionByHash. If you send a method that the provider object does not support, it will throw an error. You can see a list of errors, and the shape that they will take on page.

🔹
JSON RPC requests
this