1
- # @bn -onboard/core
1
+ # @web3 -onboard/core
2
2
3
3
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.
4
4
5
5
## Installation
6
6
7
7
Install the core module:
8
8
9
- ` npm i @bn -onboard/core `
9
+ ` npm i @web3 -onboard/core `
10
10
11
11
If you would like to support all wallets, then you can install all of the wallet modules:
12
12
13
- ` npm i @bn -onboard/injected-wallets @bn -onboard/ledger @bn -onboard/trezor @bn -onboard/keepkey @bn -onboard/walletconnect @bn -onboard/walletlink @bn -onboard/torus @bn -onboard/portis @bn -onboard/mew @bn -onboard/gnosis @bn -onboard/fortmatic `
13
+ ` npm i @web3 -onboard/injected-wallets @web3 -onboard/ledger @web3 -onboard/trezor @web3 -onboard/keepkey @web3 -onboard/walletconnect @web3 -onboard/walletlink @web3 -onboard/torus @web3 -onboard/portis @web3 -onboard/mew @web3 -onboard/gnosis @web3 -onboard/fortmatic `
14
14
15
15
Note:
16
16
@@ -41,6 +41,7 @@ An array of Chains that your app supports:
41
41
``` typescript
42
42
type Chain = {
43
43
id: ChainId // hex encoded string, eg '0x1' for Ethereum Mainnet
44
+ namespace? : ' evm' // string indicating chain namespace. Defaults to 'evm' but will allow other chain namespaces in the future
44
45
rpcUrl: string // used for network requests
45
46
label? : string // used for display, eg Ethereum Mainnet
46
47
token? : TokenSymbol // the native token symbol, eg ETH, BNB, MATIC
@@ -56,6 +57,8 @@ type AppMetadata = {
56
57
name: string
57
58
// SVG icon string, with height or width (whichever is larger) set to 100% or a valid image URL
58
59
icon: string
60
+ // Optional wide format logo (ie icon and text) to be displayed in the sidebar of connect modal. Defaults to icon if not provided
61
+ logo? : string
59
62
// description of app
60
63
description? : string
61
64
// url to a getting started guide for app
@@ -88,8 +91,8 @@ Onboard is using the [ICU syntax](https://formatjs.io/docs/core-concepts/icu-syn
88
91
Putting it all together, here is an example initialization with the injected wallet modules:
89
92
90
93
` ` ` javascript
91
- import Onboard from ' @bn -onboard/core'
92
- import injectedModule from ' @bn -onboard/injected-wallets'
94
+ import Onboard from ' @web3 -onboard/core'
95
+ import injectedModule from ' @web3 -onboard/injected-wallets'
93
96
94
97
const ETH_MAINNET_RPC = ` https://mainnet.infura.io/v3/${INFURA_KEY } `
95
98
const ETH_RINKEBY_RPC = ` https://rinkeby.infura.io/v3/${INFURA_KEY } `
@@ -223,7 +226,7 @@ type WalletState = {
223
226
icon: string
224
227
provider: EIP1193Provider
225
228
accounts: Account []
226
- chain : ChainId
229
+ chains : ConnectedChain []
227
230
instance? : unknown
228
231
}
229
232
@@ -238,6 +241,11 @@ type Account = {
238
241
balance: Record <TokenSymbol , string >
239
242
}
240
243
244
+ type ConnectedChain = {
245
+ namespace: ' evm'
246
+ id: ChainId
247
+ }
248
+
241
249
type ChainId = string
242
250
type TokenSymbol = string
243
251
` ` `
@@ -282,6 +290,7 @@ When initializing Onboard you define a list of chains/networks that your app sup
282
290
type SetChain = (options : SetChainOptions ) => Promise <boolean >
283
291
type SetChainOptions = {
284
292
chainId: string // hex encoded string
293
+ chainNamespace? : ' evm' // defaults to 'evm' (currently the only valid value, but will add more in future updates)
285
294
wallet? : string // the wallet.label of the wallet to set chain
286
295
}
287
296
@@ -370,11 +379,6 @@ The Onboard styles can customized via [CSS variables](https://developer.mozilla.
370
379
--onboard-font-size-6 : 0.875rem ;
371
380
--onboard-font-size-7 : 0.75rem ;
372
381
373
- --onboard-font-line-height-1 : 24px ;
374
- --onboard-font-line-height-2 : 20px ;
375
- --onboard-font-line-height-3 : 16px ;
376
- --onboard-font-line-height-4 : 12px ;
377
-
378
382
/* SPACING */
379
383
--onboard-spacing-1 : 3rem ;
380
384
--onboard-spacing-2 : 2rem ;
0 commit comments