Skip to content

Commit d73ff44

Browse files
authored
Add containerEl docs and update quickstart to remove deprecated chains and add new hot chains (#1382)
* Add conatinerEl docs and update quickstart to remove deprecated chains and add new hot chains * Mark AC containerEl props as deprecated
1 parent c37d0e1 commit d73ff44

File tree

1 file changed

+39
-15
lines changed
  • docs/src/routes/docs/[...3]modules

1 file changed

+39
-15
lines changed

docs/src/routes/docs/[...3]modules/core.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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: {

0 commit comments

Comments
 (0)