loophe / web3-onboard

Client library to onboard users to web3 apps

Home Page:https://blocknative.com/onboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web3-Onboard

Features

  • Minimal Dependencies: All wallet dependencies are included in separate packages, so you only include the ones you want to use in your app.
  • Multiple Wallets and Accounts Connection: Allow your users to connect multiple wallets and multiple accounts within each wallet at the same time to your app.
  • Multiple Chain Support: Allow users to switch between chains/networks with ease.
  • Wallet Provider Standardization: All wallet modules expose a provider that is patched to be compliant with the EIP-1193, EIP-1102, EIP-3085 and EIP-3326 specifications.
  • Dynamic Imports: Supporting multiple wallets in your app requires a lot of dependencies. Onboard dynamically imports a wallet and it's dependencies only when the user selects it, so that minimal bandwidth is used.

Quickstart

Install the core Onboard library and the injected wallets module to support browser extension and mobile wallets:

npm i @web3-onboard/core @web3-onboard/injected-wallets

Then initialize in your app:

import Onboard from '@web3-onboard/core'
import injectedModule from '@web3-onboard/injected-wallets'

const MAINNET_RPC_URL = 'https://mainnet.infura.io/v3/<INFURA_KEY>'

const injected = injectedModule()

const onboard = Onboard({
  wallets: [injected],
  chains: [
    {
      id: '0x1',
      token: 'ETH',
      label: 'Ethereum Mainnet',
      rpcUrl: MAINNET_RPC_URL
    }
  ],
  appMetadata: {
    name: 'My App',
    icon: '<SVG_ICON_STRING>',
    description: 'My app using Onboard'
  }
})

const wallets = await onboard.connectWallet()

console.log(wallets)

Documentation

For full documentation, check out the README.md for each package:

Core Repo

Injected Wallets

SDK Wallets

Hardware Wallets

Frameworks

Test out the demo app

If you would like to test out the current functionality of V2 in a small browser demo, then:

  • Clone the repo: git clone git@github.com:blocknative/onboard.git
  • Change in to the onboard directory: cd onboard
  • Checkout the V2 feature branch: git checkout v2-web-onboard
  • Install the dependencies: yarn (if running a M1 mac - yarn install-m1-mac)
  • Run all packages in dev mode: yarn dev
  • View demo app in the browser

About

Client library to onboard users to web3 apps

https://blocknative.com/onboard

License:MIT License


Languages

Language:TypeScript 81.5%Language:Svelte 17.0%Language:JavaScript 1.3%Language:CSS 0.1%Language:HTML 0.1%