Skip to content

Commit 8de19ec

Browse files
authored
Fix: Secondary Token Symbol fetch and docs (#1690)
* Fixing * Update SecondaryToken type * Add max of 5 tokens to secondaryTokens, add error handling in html, add docs update * Bump all package versions * Revert node version changes for web3auth
1 parent 01d8044 commit 8de19ec

File tree

49 files changed

+248
-178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+248
-178
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ jobs:
287287
- node-build-steps
288288
build-web3auth:
289289
docker:
290-
- image: cimg/node:16.18.1
290+
- image: cimg/node:16.13.1
291291
working_directory: ~/web3-onboard-monorepo/packages/web3auth
292292
steps:
293293
- node-build-steps
@@ -511,7 +511,7 @@ jobs:
511511
- node-staging-build-steps
512512
build-staging-web3auth:
513513
docker:
514-
- image: cimg/node:16.18.1
514+
- image: cimg/node:16.13.1
515515
working_directory: ~/web3-onboard-monorepo/packages/web3auth
516516
steps:
517517
- node-staging-build-steps

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,20 @@ type Chain = {
140140
icon?: string // the icon to represent the chain
141141
publicRpcUrl?: string // an optional public RPC used when adding a new chain config to the wallet
142142
blockExplorerUrl?: string // also used when adding a new config to the wallet
143-
secondaryTokens?: SecondaryTokens[] // An optional array of tokens to be available to the dapp in the app state object per wallet within the wallet account and displayed in Account Center (if enabled)
143+
secondaryTokens?: SecondaryTokens[] // An optional array of tokens (max of 5) to be available to the dapp in the app state object per wallet within the wallet account and displayed in Account Center (if enabled)
144+
}
145+
146+
interface SecondaryTokens {
147+
/**
148+
* Required - The onchain address of the token associated
149+
* with the chain it is entered under
150+
*/
151+
address: string
152+
/**
153+
* An optional svg or url string for the icon of the token.
154+
* If an svg is used ensure the height/width is set to 100%
155+
*/
156+
icon?: string
144157
}
145158
```
146159

packages/cede-store/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/cede-store",
3-
"version": "2.0.1-alpha.1",
3+
"version": "2.0.1-alpha.2",
44
"description": "cede.store SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -70,6 +70,6 @@
7070
},
7171
"dependencies": {
7272
"@cedelabs/providers": "^0.0.7",
73-
"@web3-onboard/common": "^2.3.2-alpha.1"
73+
"@web3-onboard/common": "^2.3.2-alpha.2"
7474
}
7575
}

packages/coinbase/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/coinbase",
3-
"version": "2.2.3-alpha.1",
3+
"version": "2.2.3-alpha.2",
44
"description": "Coinbase SDK wallet module for connecting to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -59,6 +59,6 @@
5959
},
6060
"dependencies": {
6161
"@coinbase/wallet-sdk": "^3.6.0",
62-
"@web3-onboard/common": "^2.3.2-alpha.1"
62+
"@web3-onboard/common": "^2.3.2-alpha.2"
6363
}
6464
}

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/common",
3-
"version": "2.3.2-alpha.1",
3+
"version": "2.3.2-alpha.2",
44
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",

packages/common/src/types.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export interface Chain {
405405
/* Recommended to include. The native token symbol, eg ETH, BNB, MATIC */
406406
token?: TokenSymbol
407407
/**
408-
* An optional array of tokens to be available to the dapp in the
408+
* An optional array of tokens (max of 5) to be available to the dapp in the
409409
* app state object per wallet within the wallet account and displayed
410410
* in Account Center (if enabled)
411411
*/
@@ -431,10 +431,6 @@ export interface SecondaryTokens {
431431
* with the chain it is entered under
432432
*/
433433
address: string
434-
/**
435-
* Required - The symbol of the token i.e. USDC, ETH, 1INCH
436-
*/
437-
name: TokenSymbol
438434
/**
439435
* An optional svg or url string for the icon of the token.
440436
* If an svg is used ensure the height/width is set to 100%

packages/common/src/validation.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const providerConnectionInfoValidation = Joi.object({
3232
})
3333

3434
const secondaryTokenValidation = Joi.object({
35-
name: Joi.string().required(),
3635
address: Joi.string().required(),
3736
icon: Joi.string().optional()
3837
})
@@ -43,7 +42,10 @@ export const chainValidation = Joi.object({
4342
rpcUrl: Joi.string(),
4443
label: Joi.string(),
4544
token: Joi.string(),
46-
secondaryTokens: Joi.array().items(secondaryTokenValidation).optional(),
45+
secondaryTokens: Joi.array()
46+
.max(5)
47+
.items(secondaryTokenValidation)
48+
.optional(),
4749
icon: Joi.string(),
4850
color: Joi.string(),
4951
publicRpcUrl: Joi.string(),

packages/core/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,19 @@ type Chain = {
132132
icon?: string // the icon to represent the chain
133133
publicRpcUrl?: string // an optional public RPC used when adding a new chain config to the wallet
134134
blockExplorerUrl?: string // also used when adding a new config to the wallet
135-
secondaryTokens?: SecondaryTokens[] // An optional array of tokens to be available to the dapp in the app state object per wallet within the wallet account and displayed in Account Center (if enabled)
135+
secondaryTokens?: SecondaryTokens[] // An optional array of tokens (max of 5) to be available to the dapp in the app state object per wallet within the wallet account and displayed in Account Center (if enabled)
136+
}
137+
interface SecondaryTokens {
138+
/**
139+
* Required - The onchain address of the token associated
140+
* with the chain it is entered under
141+
*/
142+
address: string
143+
/**
144+
* An optional svg or url string for the icon of the token.
145+
* If an svg is used ensure the height/width is set to 100%
146+
*/
147+
icon?: string
136148
}
137149
```
138150

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.18.0-alpha.1",
3+
"version": "2.18.0-alpha.2",
44
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
55
"keywords": [
66
"Ethereum",
@@ -85,7 +85,7 @@
8585
"typescript": "^4.5.5"
8686
},
8787
"dependencies": {
88-
"@web3-onboard/common": "^2.3.2-alpha.1",
88+
"@web3-onboard/common": "^2.3.2-alpha.2",
8989
"bignumber.js": "^9.0.0",
9090
"bnc-sdk": "^4.6.7",
9191
"bowser": "^2.11.0",

packages/core/src/chain.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ async function setChain(options: {
3636

3737
// validate that chainId has been added to chains
3838
const chain = chains.find(
39-
({ namespace, id }) => namespace === chainNamespace && id === chainIdHex
39+
({ namespace, id }) =>
40+
namespace === chainNamespace &&
41+
id.toLowerCase() === chainIdHex.toLowerCase()
4042
)
4143

4244
if (!chain) {

0 commit comments

Comments
 (0)