Skip to content

Commit 6234a25

Browse files
authored
Merge pull request #1383 from blocknative/docs-develop
Docs release
2 parents 930175e + 3208cb9 commit 6234a25

File tree

30 files changed

+299
-70
lines changed

30 files changed

+299
-70
lines changed

docs/src/lib/components/Footer.svelte

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
let text = {
1313
license: 'Released under the MIT License.',
14-
copyright: 'Copyright © 2022'
14+
copyright: '© 2022 Blocknative. All Rights Reserved.'
1515
}
1616
</script>
1717

@@ -43,34 +43,67 @@
4343
</a>
4444
</Flexbox>
4545
<a href="//www.blocknative.com/" target="_blank">
46-
<img src={PoweredByBn} alt="Powered by Blocknative">
46+
<img src={PoweredByBn} alt="Powered by Blocknative" />
4747
<span class="sr-only">Powered by Blocknative</span>
4848
</a>
4949
</Flexbox>
5050
<div class="copyright-box">
51-
<div class="text">{text.license}</div>
52-
<div class="text">{text.copyright}</div>
51+
<div class="flex flex-row flex-wrap justify-center">
52+
<div class="text">{text.license}</div>
53+
<div class="text">{text.copyright}</div>
54+
</div>
55+
<div class="flex">
56+
<a
57+
target="_blank"
58+
href="https://www.blocknative.com/privacy-policy"
59+
class="text-sm hover:text-white">Privacy Policy</a
60+
>
61+
<div class="w-px bg-gray-divider mx-2 h-4" />
62+
<a
63+
target="_blank"
64+
href="https://www.blocknative.com/terms-conditions"
65+
class="text-sm hover:text-white">Terms of Service</a
66+
>
67+
</div>
5368
</div>
5469
</footer>
5570

5671
<style>
5772
footer {
5873
background: #1a1d26;
5974
min-height: 400px;
60-
6175
display: flex;
6276
flex-flow: column;
6377
}
6478
79+
a.icon-link {
80+
color: rgba(255, 255, 255, 0.8);
81+
transition: transform 200ms ease-in-out;
82+
}
83+
a.icon-link:hover {
84+
color: rgba(255, 255, 255, 1);
85+
transform: scale(1.2);
86+
}
87+
a.icon-link:focus {
88+
transform: none;
89+
}
90+
6591
.copyright-box {
6692
/* grey/600 */
6793
background: #242835;
68-
6994
display: flex;
7095
flex-flow: column;
7196
justify-content: center;
7297
align-items: center;
7398
padding: 1.5rem 2rem;
99+
gap: 1rem;
100+
}
101+
@media screen and (min-width: 1024px) {
102+
.copyright-box {
103+
flex-flow: row;
104+
justify-content: space-between;
105+
gap: 0.5rem;
106+
}
74107
}
75108
76109
.text {
@@ -80,23 +113,10 @@
80113
font-weight: 400;
81114
font-size: 14px;
82115
line-height: 16px;
83-
84116
/* grey/300 */
85117
color: #999ca5;
86118
}
87119
88-
a.icon-link {
89-
color: rgba(255, 255, 255, 0.8);
90-
transition: transform 200ms ease-in-out;
91-
}
92-
a.icon-link:hover {
93-
color: rgba(255, 255, 255, 1);
94-
transform: scale(1.2);
95-
}
96-
a.icon-link:focus {
97-
transform: none;
98-
}
99-
100120
/* screen reader class */
101121
/* can be moved elsewhere */
102122
.sr-only {
@@ -110,4 +130,5 @@
110130
white-space: nowrap;
111131
border-width: 0;
112132
}
133+
113134
</style>

docs/src/lib/components/gas/Gas.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import anime from 'animejs'
33
import GasCard from './GasCard.svelte'
44
import gasModule from '@web3-onboard/gas'
5-
import { onMount } from 'svelte'
5+
import { onDestroy, onMount } from 'svelte'
66
import { ethers } from 'ethers'
77
import type { GasPrice, RPCGasPrice, GasData } from './types'
88
@@ -19,14 +19,15 @@
1919
})
2020
}
2121
let ethMainnetGasBlockPrices
22+
let gasSub
2223
let rpcGasData: RPCGasPrice
2324
onMount(() => {
2425
ethMainnetGasBlockPrices = gasModule.stream({
2526
chains: ['0x1'],
2627
apiKey: 'da1b962d-314d-4903-bfe1-426821d14a35',
2728
endpoint: 'blockPrices'
2829
})
29-
ethMainnetGasBlockPrices.subscribe(() => {
30+
gasSub = ethMainnetGasBlockPrices.subscribe(() => {
3031
async function getEtherGasFromRPC() {
3132
const INFURA_ID = '8b60d52405694345a99bcb82e722e0af'
3233
const infuraRPC = `https://mainnet.infura.io/v3/${INFURA_ID}`
@@ -62,6 +63,10 @@
6263
estimatedTransactionCount: null,
6364
seconds: null
6465
}
66+
67+
onDestroy(() => {
68+
gasSub && gasSub.unsubscribe()
69+
})
6570
</script>
6671

6772
<div class="Gas px-6 p-4">

docs/src/routes/docs/[...1]overview/[...1]introduction.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ and it's dependencies only when the user selects it, so that minimal bandwidth i
3333

3434
### Supported Networks
3535

36-
web3-onboard supports all EVM networks. Supporting a new network is simply a matter of adding its details in the Chains section upon initialization. For more information see [initialization options](https://onboard.blocknative.com/docs/packages/core#options).
36+
web3-onboard supports all EVM networks. Supporting a new network is simply a matter of adding its details in the Chains section upon initialization. For more information see [initialization options](https://onboard.blocknative.com/docs/modules/core#options).
3737
- Arbitrum
3838
- Avalanche
3939
- BNB Chain
@@ -133,9 +133,9 @@ if (wallets[0]) {
133133
## Wallet Modules
134134
Add other wallet modules such as Wallet Connect or Ledger to increase the support and functionality of your web3-onboard implementation. All modules are listed below and can be accessed through the subpages of web3-onboard docs on the left.
135135

136-
We recommend you add the [Core Repo](https://onboard.blocknative.com/docs/packages/core#install) and consider adding the [Injected Wallets](https://onboard.blocknative.com/docs/packages/injected#install) module to get connected with wallets like Metamask, Tally, Coinbase Wallet & more right away.
136+
We recommend you add the [Core Repo](https://onboard.blocknative.com/docs/modules/core#install) and consider adding the [Injected Wallets](https://onboard.blocknative.com/docs/packages/injected#install) module to get connected with wallets like Metamask, Tally, Coinbase Wallet & more right away.
137137

138-
[**Core Repo**](https://onboard.blocknative.com/docs/packages/core#install)
138+
[**Core Repo**](https://onboard.blocknative.com/docs/modules/core#install)
139139

140140
[**Injected Wallets**](https://onboard.blocknative.com/docs/packages/injected#install)
141141

@@ -160,8 +160,8 @@ We recommend you add the [Core Repo](https://onboard.blocknative.com/docs/packag
160160

161161
**Frameworks**
162162

163-
- [React](https://onboard.blocknative.com/docs/packages/react#quickstart-with-injected-wallets-and-ethers-provider)
164-
- [Vue](https://onboard.blocknative.com/docs/packages/vue#install)
163+
- [React](https://onboard.blocknative.com/docs/modules/react#quickstart-with-injected-wallets-and-ethers-provider)
164+
- [Vue](https://onboard.blocknative.com/docs/modules/vue#install)
165165

166166
## Test out the demo app
167167

docs/src/routes/docs/[...1]overview/[...3]onboard.js-migration-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const onboard = Onboard({
4646
})
4747
```
4848

49-
You can find the full list of initialization options in our docs [here](/docs/packages/core#options).
49+
You can find the full list of initialization options in our docs [here](/docs/modules/core#options).
5050

5151
### API Upgrades
5252

@@ -55,7 +55,7 @@ Now, you only need to call the connectWallet API:
5555

5656
`await onboard.connectWallet()`
5757

58-
Learn more about state changes tracked with the Onboard API [here](/docs/packages/core#state) and the exposed actions you can use to modify the state [here](/docs/packages/core#actions-to-modify-state).
58+
Learn more about state changes tracked with the Onboard API [here](/docs/modules/core#state) and the exposed actions you can use to modify the state [here](/docs/modules/core#actions-to-modify-state).
5959

6060
### Framework Support
6161

@@ -89,7 +89,7 @@ We've also added more expansive custom CSS properties so you can style every par
8989
}
9090
```
9191

92-
The full list of CSS variables for web3-onboard are available [here](/docs/packages/core#custom-styling).
92+
The full list of CSS variables for web3-onboard are available [here](/docs/modules/core#custom-styling).
9393

9494
### Other Important Changes
9595

docs/src/routes/docs/[...2]getting-started/[...2]customization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ The Onboard styles can customized via [CSS custom properties](https://developer.
7979
--account-center-app-btn-font-family
8080
--account-center-border
8181
--account-center-box-shadow
82-
--account-center-boarder-radius
82+
--account-center-border-radius
8383
--account-center-chain-warning
8484
--account-center-minimized-balance-color
8585
--account-center-minimized-chain-select-background

docs/src/routes/docs/[...4]packages/core.md renamed to docs/src/routes/docs/[...3]modules/core.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @web3-onboard/core
1+
# Core
22

33
This is the core package that contains all of the UI and logic to be able to seamlessly connect user's wallets to your app and track the state of those wallets. Onboard no longer contains any wallet specific code, so wallets need to be passed in upon initialization.
44

@@ -63,6 +63,11 @@ type InitOptions {
6363
accountCenter?: AccountCenterOptions
6464
apiKey?: string
6565
notify?: Partial<NotifyOptions>
66+
gas?: typeof gas
67+
/**
68+
* Object mapping for W3O components with the key being the component and the value the DOM element to mount the component to. This element must be available at time of package script execution.
69+
*/
70+
containerElements?: Partial<ContainerElements>
6671
}
6772
```
6873

@@ -136,6 +141,11 @@ export type AccountCenter = {
136141
position?: AccountCenterPosition // default: 'topRight'
137142
expanded?: boolean // default: true
138143
minimal?: boolean // enabled by default for mobile
144+
145+
/**
146+
* @deprecated Use top level containerElements property
147+
* with the accountCenter prop set to the desired container El. See documentation below
148+
*/
139149
containerElement?: string // defines the DOM container element for svelte to attach
140150
}
141151

@@ -147,6 +157,20 @@ export type AccountCenterOptions = {
147157
type AccountCenterPosition = 'topRight' | 'bottomRight' | 'bottomLeft' | 'topLeft'
148158
```
149159
160+
**`containerElements`**
161+
An object mapping for W3O components with the key being the DOM element to mount the specified component to.
162+
This defines the DOM container element for svelte to attach the component.
163+
164+
**NOTE**: containerElement must be a DOM element with a styleSheet property attached and the element must be available on the DOM at the time of component mounting.
165+
For an example please see containerElement usage [here](https://github.com/blocknative/web3-onboard/blob/8531a73d69365f7d584320f1c4b97a5d90f1c34e/packages/demo/src/App.svelte#L227)
166+
167+
```typescript
168+
type ContainerElements = {
169+
// when using the accountCenter with a container el the accountCenter position properties are ignored
170+
accountCenter?: string
171+
}
172+
```
173+
150174
**`notify`**
151175
Notify provides by default transaction notifications for all connected wallets on the current blockchain. When switching chains the previous chain listeners remain active for 60 seconds to allow capture and report of an remaining transactions that may be in flight.
152176
By default transaction notifications are captured if a DAppID is provided in the Onboard config along with the Account Center being enabled.
@@ -252,19 +276,13 @@ const onboard = Onboard({
252276
id: '0x1',
253277
token: 'ETH',
254278
label: 'Ethereum Mainnet',
255-
rpcUrl: 'https://mainnet.infura.io/v3/{INFURA_ID}'
256-
},
257-
{
258-
id: '0x3',
259-
token: 'tROP',
260-
label: 'Ethereum Ropsten Testnet',
261-
rpcUrl: 'https://ropsten.infura.io/v3/{INFURA_ID}'
279+
rpcUrl: `https://mainnet.infura.io/v3/${INFURA_ID}`
262280
},
263281
{
264-
id: '0x4',
265-
token: 'rETH',
266-
label: 'Ethereum Rinkeby Testnet',
267-
rpcUrl: 'https://rinkeby.infura.io/v3/{INFURA_ID}'
282+
id: '0x5',
283+
token: 'ETH',
284+
label: 'Goerli',
285+
rpcUrl: `https://goerli.infura.io/v3/${INFURA_ID}`
268286
},
269287
{
270288
id: '0x38',
@@ -279,10 +297,16 @@ const onboard = Onboard({
279297
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
280298
},
281299
{
282-
id: '0xfa',
283-
token: 'FTM',
284-
label: 'Fantom Mainnet',
285-
rpcUrl: 'https://rpc.ftm.tools/'
300+
id: 10,
301+
token: 'OETH',
302+
label: 'Optimism',
303+
rpcUrl: 'https://mainnet.optimism.io'
304+
},
305+
{
306+
id: 42161,
307+
token: 'ARB-ETH',
308+
label: 'Arbitrum',
309+
rpcUrl: 'https://rpc.ankr.com/arbitrum'
286310
}
287311
],
288312
appMetadata: {

docs/src/routes/docs/[...4]packages/gas.md renamed to docs/src/routes/docs/[...3]modules/gas.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import {Gas} from '$lib/components'
33
</script>
4-
# @web3-onboard/gas
4+
# Gas
55

66
A module for requesting streams or single requests of gas price estimates from the [Blocknative Gas Platform API](https://docs.blocknative.com/gas-platform).
77

@@ -79,7 +79,7 @@ const gasBlockPrices = await gas.get({
7979
## Usage with Web3-Onboard wallet Connect and Ethers.js
8080

8181
This example assumes you have already setup web3-onboard to connect wallets to your dapp.
82-
For more information see [web3-onboard docs](/docs/packages/core#install).
82+
For more information see [web3-onboard docs](/docs/modules/core#install).
8383
```ts
8484
import gas from '@web3-onboard/gas'
8585
import { ethers } from 'ethers'

docs/src/routes/docs/[...4]packages/react.md renamed to docs/src/routes/docs/[...3]modules/react.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @web3-onboard/react
1+
# React
22

33
A collection of React hooks for implementing web3-onboard in to a React project
44

docs/src/routes/docs/[...4]packages/vue.md renamed to docs/src/routes/docs/[...3]modules/vue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# @web3-onboard/vue
1+
# Vue
22

33
A collection of composable functions for implementing web3-onboard in to a Vue project; compatible both with Vue 2 + composition-api and Vue 3
44

docs/src/routes/docs/[...4]packages/common.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)