Skip to content
LogoLogo

JSON-RPC Account

A function to create a JSON-RPC Account.

A JSON-RPC Account is an Account whose signing keys are stored on the external Wallet. It defers signing of transactions & messages to the target Wallet over JSON-RPC. An example of such Wallet could be a Browser Extension Wallet, or Mobile Wallet over WalletConnect.

Usage

A JSON-RPC Account can just be initialized as an Address string. In the usage below, we are extracting the address from a Browser Extension Wallet (e.g. MetaMask) with the window.ethereum Provider via eth_requestAccounts:

import 'viem/window'
import { ,  } from 'viem'
import {  } from 'viem/chains'
 
const [] = await ..({ 
  : 'eth_requestAccounts' 
})
 
const  = ({
  : , 
  : ,
  : (.!)
})