Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1200936
Adds react context provider and nextjs example
taylorjdawson Jul 31, 2022
b98b4aa
version bump
taylorjdawson Jul 31, 2022
8571ab0
Merge pull request #1175 from blocknative/release/2.6.0
Adamj1232 Aug 1, 2022
e27f53c
[core-v2.7.0-alpha.1, react-v2.2.6-alpha.1, vue-v2.1.6-alpha.1] : Fea…
Adamj1232 Aug 3, 2022
d30a4ad
Fix readme example (#1189)
ihorbond Aug 3, 2022
9087fac
Adding Missed Readme Info for Connect prop (#1192)
Adamj1232 Aug 3, 2022
6e0d1a9
Enhancement: Examples/with-ledger (#1187)
mahmud-bn Aug 3, 2022
8c7dc85
Adds VueJs Example
taylorjdawson Aug 6, 2022
c835f13
remove nextjs example
taylorjdawson Aug 6, 2022
7077ddd
revert react package changes
taylorjdawson Aug 6, 2022
5dc68c3
revert react package changes
taylorjdawson Aug 6, 2022
7d0e99b
Merge branch 'v2-web3-onboard-develop' into feature/with-vuejs
taylorjdawson Aug 6, 2022
39e7fc0
revert yarn.lock changes
taylorjdawson Aug 6, 2022
df692c5
[core:2.7.0-alpha.2] [ledger:2.1.8-alpha.1] - [feature] - Replacement…
lnbc1QWFyb24 Aug 8, 2022
75747f4
Merge pull request #1198 from blocknative/feature/with-vuejs
taylorjdawson Aug 10, 2022
3c4d38d
[common-v2.1.8-alpha.1, core-v2.7.0-alpha.3, react-v2.2.6-alpha.2, vu…
Adamj1232 Aug 10, 2022
51338cc
Bump svelte from 3.46.4 to 3.49.0
dependabot[bot] Aug 10, 2022
51542c9
Dynamic import Account Center
lnbc1QWFyb24 Aug 11, 2022
5d972de
Dynamically import notify
lnbc1QWFyb24 Aug 11, 2022
7f33ba4
Increment version
lnbc1QWFyb24 Aug 11, 2022
ac07e06
Revert direct commits
lnbc1QWFyb24 Aug 11, 2022
3755d6f
readme-update (#1208)
mahmud-bn Aug 11, 2022
840d8d1
Merge pull request #1150 from blocknative/dependabot/npm_and_yarn/sve…
Adamj1232 Aug 11, 2022
344d5b4
[core:2.7.0-alpha.4] - Dynamically import Notify and Account Center (…
lnbc1QWFyb24 Aug 12, 2022
7be1132
Increment versions
lnbc1QWFyb24 Aug 12, 2022
3dc1fb5
Update lock file
lnbc1QWFyb24 Aug 12, 2022
d376ced
Remove docs typo
lnbc1QWFyb24 Aug 12, 2022
99b4748
Fix: Re-initialize Cleanup Logic (#1213)
lnbc1QWFyb24 Aug 12, 2022
a599d05
Merge branch 'v2-web3-onboard-develop' into release/2.7.0
lnbc1QWFyb24 Aug 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Web3-Onboard

**easy way to connect users to dapps**

## Features
Expand Down Expand Up @@ -68,6 +69,10 @@ if (wallets[0]) {
}
```

**Onboard v1 migration guide**

If you're coming from v1, we've created a [migration guide for you](https://docs.blocknative.com/onboard/migration-guide).

## Documentation

For full documentation, check out the README.md for each package:
Expand Down
3 changes: 3 additions & 0 deletions examples/with-ledger/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
32 changes: 32 additions & 0 deletions examples/with-ledger/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel
35 changes: 35 additions & 0 deletions examples/with-ledger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
This is a sample [Web3Onboard](https://github.com/blocknative/web3-onboard) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) showing how to integrate the Ledger wallet into your web3 dApp.

## Getting Started

Clone this repo

```
https://github.com/blocknative/web3-onboard.git
```

Navigate to the project directory:

```
cd examples
```

Install the dependencies:

```
yarn
```

Run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

## Learn More

To learn more about how you can use web3Onboard to integrate Ledger and other popular web3 wallets into your dApps, take a look at our documentation: [Web3Onboard Documentation](https://docs.blocknative.com/onboard) for more details.
7 changes: 7 additions & 0 deletions examples/with-ledger/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
}

module.exports = nextConfig
22 changes: 22 additions & 0 deletions examples/with-ledger/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "with-ledger",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@web3-onboard/ledger": "^2.1.6",
"@web3-onboard/react": "^2.2.4",
"next": "12.2.3",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "8.20.0",
"eslint-config-next": "12.2.3"
}
}
7 changes: 7 additions & 0 deletions examples/with-ledger/pages/_app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import '../styles/globals.css'

function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}

export default MyApp
5 changes: 5 additions & 0 deletions examples/with-ledger/pages/api/hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction

export default function handler(req, res) {
res.status(200).json({ name: 'John Doe' })
}
113 changes: 113 additions & 0 deletions examples/with-ledger/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import Head from 'next/head'
import { init, useConnectWallet } from '@web3-onboard/react'
import ledgerModule from '@web3-onboard/ledger'
import styles from '../styles/Home.module.css'

const buttonStyles = {
borderRadius: '6px',
background: '#111827',
border: 'none',
fontSize: '18px',
fontWeight: '600',
cursor: 'pointer',
color: 'white',
padding: '14px 12px',
marginTop: '40px',
fontFamily: 'inherit'
}


const INFURA__KEY = 'cf540cb0b3b643d399e59aef4f5ac179'
const ledger = ledgerModule()

// initialize Onboard
init({
wallets: [ledger],
chains: [
{
id: '0x1',
token: 'ETH',
label: 'Ethereum',
rpcUrl: `https://mainnet.infura.io/v3/${INFURA__KEY}`
},
{
id: '0x3',
token: 'tROP',
label: 'Ropsten',
rpcUrl: `https://ropsten.infura.io/v3/${INFURA__KEY}`
},
{
id: '0x4',
token: 'rETH',
label: 'Rinkeby',
rpcUrl: `https://rinkeby.infura.io/v3/${INFURA__KEY}`
},
{
id: '0x38',
token: 'BNB',
label: 'Binance',
rpcUrl: 'https://bsc-dataseed.binance.org/'
},
{
id: '0x89',
token: 'MATIC',
label: 'Polygon',
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
},
{
id: '0xfa',
token: 'FTM',
label: 'Fantom',
rpcUrl: 'https://rpc.ftm.tools/'
}
],
appMetadata: {
name: "Web3-Onboard Demo",
icon: '<svg>My App Icon</svg>',
description: "A demo of Web3-Onboard with Ledger."
},
accountCenter: {
desktop: {
position: 'topRight',
enabled: true,
minimal: false
}
}
})



export default function Home() {
const [{ wallet, connecting }, connect, disconnect] = useConnectWallet()

return (
<div className={styles.container}>
<Head>
<title>Web3-Onboard + Ledger Demo</title>
<meta
name="description"
content="Web3-Onboard Example with Ledger Hardware Wallet"
/>
<link rel="icon" href="/favicon.ico" />
</Head>

<main className={styles.main}>
<h1 className={styles.title}>
Welcome to a demo of
<a href="https://github.com/blocknative/web3-onboard">
{' '}
Web3-Onboard + Ledger
</a>
!
</h1>
<button
style={buttonStyles}
disabled={connecting}
onClick={() => (wallet ? disconnect(wallet) : connect())}
>
{connecting ? 'connecting' : wallet ? 'disconnect' : 'connect'}
</button>
</main>
</div>
)
}
129 changes: 129 additions & 0 deletions examples/with-ledger/styles/Home.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
.container {
padding: 0 2rem;
}

.main {
min-height: 100vh;
padding: 4rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.footer {
display: flex;
flex: 1;
padding: 2rem 0;
border-top: 1px solid #eaeaea;
justify-content: center;
align-items: center;
}

.footer a {
display: flex;
justify-content: center;
align-items: center;
flex-grow: 1;
}

.title a {
color: #0070f3;
text-decoration: none;
}

.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}

.title {
margin: 0;
line-height: 1.15;
font-size: 4rem;
}

.title,
.description {
text-align: center;
}

.description {
margin: 4rem 0;
line-height: 1.5;
font-size: 1.5rem;
}

.code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}

.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
max-width: 800px;
}

.card {
margin: 1rem;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition: color 0.15s ease, border-color 0.15s ease;
max-width: 300px;
}

.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}

.card h2 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}

.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}

.logo {
height: 1em;
margin-left: 0.5rem;
}

@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
}

@media (prefers-color-scheme: dark) {
.card,
.footer {
border-color: #222;
}
.code {
background: #111;
}
.logo img {
filter: invert(1);
}
}
Loading