Skip to content

Commit da79a81

Browse files
Merge pull request #1065 from blocknative/release/06-14
Release: 06-14 (main)
2 parents 1a3358c + 0c6a26e commit da79a81

38 files changed

+1275
-101
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,12 @@ jobs:
267267
working_directory: ~/web3-onboard-monorepo/packages/coinbase
268268
steps:
269269
- node-build-steps
270+
build-web3auth:
271+
docker:
272+
- image: cimg/node:16.13.1
273+
working_directory: ~/web3-onboard-monorepo/packages/web3auth
274+
steps:
275+
- node-build-steps
270276
build-dcent:
271277
docker:
272278
- image: cimg/node:16.13.1
@@ -383,6 +389,12 @@ jobs:
383389
working_directory: ~/web3-onboard-monorepo/packages/coinbase
384390
steps:
385391
- node-staging-build-steps
392+
build-staging-web3auth:
393+
docker:
394+
- image: cimg/node:16.13.1
395+
working_directory: ~/web3-onboard-monorepo/packages/web3auth
396+
steps:
397+
- node-build-steps
386398
build-staging-dcent:
387399
docker:
388400
- image: cimg/node:16.13.1
@@ -501,6 +513,12 @@ workflows:
501513
<<: *deploy_production_filters
502514
- build-staging-coinbase:
503515
<<: *deploy_staging_filters
516+
web3auth:
517+
jobs:
518+
- build-web3auth:
519+
<<: *deploy_production_filters
520+
- build-staging-web3auth:
521+
<<: *deploy_staging_filters
504522
dcent:
505523
jobs:
506524
- build-dcent:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ node_modules
33
dist/
44
package-lock.json
55
.rpt2_cache
6-
.vscode
6+
.vscode

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.0.3",
3+
"version": "2.0.4",
44
"description": "Coinbase Wallet module for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",
@@ -21,6 +21,6 @@
2121
},
2222
"dependencies": {
2323
"@coinbase/wallet-sdk": "^3.0.5",
24-
"@web3-onboard/common": "2.1.0"
24+
"@web3-onboard/common": "2.1.1"
2525
}
2626
}

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.1.0",
3+
"version": "2.1.1",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/common/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ethers, BigNumber } from 'ethers'
2+
import type { ConnectionInfo } from 'ethers/lib/utils'
23
import type EventEmitter from 'eventemitter3'
34
import type { TypedData as EIP712TypedData } from 'eip-712'
45
export type { TypedData as EIP712TypedData } from 'eip-712'
@@ -428,6 +429,7 @@ export interface Chain {
428429
token: TokenSymbol // eg ETH, BNB, MATIC
429430
color?: string
430431
icon?: string // svg string
432+
providerConnectionInfo?: ConnectionInfo
431433
}
432434

433435
export type TokenSymbol = string // eg ETH

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.2.11",
3+
"version": "2.2.12",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",
@@ -41,7 +41,7 @@
4141
"typescript": "^4.5.5"
4242
},
4343
"dependencies": {
44-
"@web3-onboard/common": "^2.1.0",
44+
"@web3-onboard/common": "^2.1.1",
4545
"bowser": "^2.11.0",
4646
"ethers": "5.5.3",
4747
"eventemitter3": "^4.0.7",

packages/core/src/provider.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ export const ethersProviders: {
2525
[key: string]: providers.StaticJsonRpcProvider
2626
} = {}
2727

28+
export function getProvider(chain: Chain): providers.StaticJsonRpcProvider {
29+
if (!chain) return null
30+
31+
if (!ethersProviders[chain.rpcUrl]) {
32+
ethersProviders[chain.rpcUrl] = new providers.StaticJsonRpcProvider(
33+
chain.providerConnectionInfo?.url
34+
? chain.providerConnectionInfo
35+
: chain.rpcUrl
36+
)
37+
}
38+
39+
return ethersProviders[chain.rpcUrl]
40+
}
41+
2842
export function requestAccounts(
2943
provider: EIP1193Provider
3044
): Promise<ProviderAccounts> {
@@ -231,13 +245,7 @@ export async function getEns(
231245
// chain we don't recognize and don't have a rpcUrl for requests
232246
if (!chain) return null
233247

234-
if (!ethersProviders[chain.rpcUrl]) {
235-
ethersProviders[chain.rpcUrl] = new providers.StaticJsonRpcProvider(
236-
chain.rpcUrl
237-
)
238-
}
239-
240-
const provider = ethersProviders[chain.rpcUrl]
248+
const provider = getProvider(chain);
241249

242250
try {
243251
const name = await provider.lookupAddress(address)
@@ -277,13 +285,7 @@ export async function getBalance(
277285
// chain we don't recognize and don't have a rpcUrl for requests
278286
if (!chain) return null
279287

280-
if (!ethersProviders[chain.rpcUrl]) {
281-
ethersProviders[chain.rpcUrl] = new providers.StaticJsonRpcProvider(
282-
chain.rpcUrl
283-
)
284-
}
285-
286-
const provider = ethersProviders[chain.rpcUrl]
288+
const provider = getProvider(chain);
287289

288290
try {
289291
const balanceWei = await provider.getBalance(address)

packages/core/src/store/actions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ export function addChains(chains: Chain[]): void {
4444
// chains are validated on init
4545
const action = {
4646
type: ADD_CHAINS,
47-
payload: chains.map(({ namespace = 'evm', ...rest }) => ({
47+
payload: chains.map(({ namespace = 'evm', id, ...rest }) => ({
4848
...rest,
49-
namespace
49+
namespace,
50+
id : id.toLowerCase()
5051
}))
5152
}
5253

packages/core/src/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export const chainIdToLabel: Record<string, string> = {
8181
'0x89': 'Polygon',
8282
'0xfa': 'Fantom',
8383
'0xa': 'Optimism',
84+
'0x45': 'Optimism Kovan',
8485
'0xa86a': 'Avalanche',
8586
'0xa4ec': 'Celo',
8687
'0x64': 'Gnosis',
@@ -125,6 +126,10 @@ export const chainStyles: Record<string, ChainStyle> = {
125126
icon: optimismIcon,
126127
color: '#FF0420'
127128
},
129+
'0x45': {
130+
icon: optimismIcon,
131+
color: '#FF0420'
132+
},
128133
'0xa86a': {
129134
icon: avalancheIcon,
130135
color: '#E84142'

packages/core/src/validation.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,29 @@ const chainId = Joi.string().pattern(/^0x[0-9a-fA-F]+$/)
1414
const chainNamespace = Joi.string().valid('evm')
1515
const unknownObject = Joi.object().unknown()
1616

17+
/** Related to ConnectionInfo from 'ethers/lib/utils' */
18+
const providerConnectionInfo = Joi.object({
19+
url: Joi.string().required(),
20+
headers: Joi.object(),
21+
user: Joi.string(),
22+
password: Joi.string(),
23+
allowInsecureAuthentication: Joi.boolean(),
24+
allowGzip: Joi.boolean(),
25+
throttleLimit: Joi.number(),
26+
throttleSlotInterval: Joi.number(),
27+
throttleCallback: Joi.function(),
28+
timeout: Joi.number()
29+
})
30+
1731
const chain = Joi.object({
1832
namespace: chainNamespace,
1933
id: chainId.required(),
2034
rpcUrl: Joi.string().required(),
2135
label: Joi.string().required(),
2236
token: Joi.string().required(),
2337
icon: Joi.string(),
24-
color: Joi.string()
38+
color: Joi.string(),
39+
providerConnectionInfo: providerConnectionInfo
2540
})
2641

2742
const connectedChain = Joi.object({
@@ -214,4 +229,4 @@ export function validateLocale(data: string): ValidateReturn {
214229
export function validateUpdateBalances(data:
215230
WalletState[]): ValidateReturn {
216231
return validate(wallets, data)
217-
}
232+
}

0 commit comments

Comments
 (0)