Skip to content

Latest commit

 

History

History
56 lines (28 loc) · 2.66 KB

File metadata and controls

56 lines (28 loc) · 2.66 KB

✍️ Providers & Signers

Providers

Providers are your connections to different blockchains. Scaffold-eth uses ethers.js providers.

The frontend has three different providers that provide different levels of access to different chains:

mainnetProvider: (read only) Alchemy or Infura connection to main Ethereum network (and contracts already deployed like DAI or Uniswap).

localProvider: local HardHat accounts, used to read from your contracts (.env file points you at testnet or mainnet). We use ethers.providers.StaticJsonRpcProvider when instantiating providers from RPCs where we are confident that the chainId won't change to save on network calls :)

injectedProvider: your personal MetaMask, WalletConnect via Argent, connected using web3modal.

image

These providers can be found in App.jsx at packages/react-app/src

Signers

From the ethers.js docs.

A Signer in ethers is an abstraction of an Ethereum Account, which can be used to sign messages and transactions and send signed transactions to the Ethereum Network to execute state changing operations.

Scaffold-eth now uses signers for user operations, either using injectedProvider.getSigner(), or using a Burner Signer created and stored in localStorage (all handled by the useUserSigner hook!)

{% hint style="info" %}

When should I use a provider and when should I use a signer?

If you are only reading data, use a provider. If you need to make transactions, or sign things, use a Signer. {% endhint %}

Supported Web3 Signers / Providers

Ethers

Metamask

WalletConnect

Coinbase Wallet

Scaffold-eth supports connecting with Coinbase Wallet and signing transactions with it.

See it in action here:

{% embed url="https://youtu.be/PliixgJ4EKk" %}