Skip to content

Commit fa2cc09

Browse files
committed
Merge branch 'v2-web3-onboard-develop' of blocknative.github.com:blocknative/onboard into v2-web3-onboard-develop
2 parents 00e8ef5 + 9c5d4f2 commit fa2cc09

File tree

28 files changed

+141
-127
lines changed

28 files changed

+141
-127
lines changed

packages/core/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/core",
3-
"version": "2.3.0-alpha.3",
3+
"version": "2.3.0-alpha.4",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/core/src/icons/checkmark.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export default `
22
<svg width="14" height="11" viewBox="0 0 14 11" fill="none" xmlns="http://www.w3.org/2000/svg">
33
<path d="M4.48076 8.10881L1.33076 4.95881L0.280762 6.00881L4.48076 10.2088L13.4808 1.20881L12.4308 0.158813L4.48076 8.10881Z" fill="#A4F4C6"/>
44
</svg>
5-
`
5+
`

packages/core/src/icons/close-circle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export default `
22
<svg width="100%" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
33
<path d="M10 0C4.47 0 0 4.47 0 10C0 15.53 4.47 20 10 20C15.53 20 20 15.53 20 10C20 4.47 15.53 0 10 0ZM15 13.59L13.59 15L10 11.41L6.41 15L5 13.59L8.59 10L5 6.41L6.41 5L10 8.59L13.59 5L15 6.41L11.41 10L15 13.59Z" fill="currentColor"/>
44
</svg>
5-
`
5+
`

packages/core/src/icons/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export default `<svg width="16" height="13" viewBox="0 0 16 13" fill="none" xmlns="http://www.w3.org/2000/svg">
22
<path d="M0.666992 13.0002H15.3337L8.00033 0.333496L0.666992 13.0002ZM8.66699 11.0002H7.33366V9.66683H8.66699V11.0002ZM8.66699 8.3335H7.33366V5.66683H8.66699V8.3335Z" fill="#FFB3B3"/>
33
</svg>
4-
`
4+
`

packages/core/src/icons/hourglass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ export default `
22
<svg width="100%" height="100%" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg">
33
<path d="M0 0L0.0100002 6L4 10L0.0100002 14.01L0 20H12V14L8 10L12 6.01V0H0ZM10 14.5V18H2V14.5L6 10.5L10 14.5Z" fill="#929BED"/>
44
</svg>
5-
`
5+
`

packages/core/src/notify.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,3 @@ export function typeToDismissTimeout(type: string): number {
161161
return 0
162162
}
163163
}
164-

packages/core/src/provider.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function getProvider(chain: Chain): providers.StaticJsonRpcProvider {
3131

3232
if (!ethersProviders[chain.rpcUrl]) {
3333
ethersProviders[chain.rpcUrl] = new providers.StaticJsonRpcProvider(
34-
chain.providerConnectionInfo?.url
34+
chain.providerConnectionInfo && chain.providerConnectionInfo.url
3535
? chain.providerConnectionInfo
3636
: chain.rpcUrl
3737
)
@@ -300,7 +300,7 @@ export async function getEns(
300300
// chain we don't recognize and don't have a rpcUrl for requests
301301
if (!chain) return null
302302

303-
const provider = getProvider(chain);
303+
const provider = getProvider(chain)
304304

305305
try {
306306
const name = await provider.lookupAddress(address)
@@ -340,7 +340,7 @@ export async function getBalance(
340340
// chain we don't recognize and don't have a rpcUrl for requests
341341
if (!chain) return null
342342

343-
const provider = getProvider(chain);
343+
const provider = getProvider(chain)
344344

345345
try {
346346
const balanceWei = await provider.getBalance(address)
@@ -380,7 +380,9 @@ export function addNewChain(
380380
decimals: 18
381381
},
382382
rpcUrls: [chain.publicRpcUrl || chain.rpcUrl],
383-
blockExplorerUrls: chain.blockExplorerUrl ? [chain.blockExplorerUrl] : undefined
383+
blockExplorerUrls: chain.blockExplorerUrl
384+
? [chain.blockExplorerUrl]
385+
: undefined
384386
}
385387
]
386388
})

packages/core/src/updateBalances.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,31 @@ import { state } from './store'
22
import { getBalance } from './provider'
33
import { updateAllWallets } from './store/actions'
44

5-
async function updateBalances(addresses?: string[]): Promise<void> {
6-
const { wallets, chains } = state.get()
5+
async function updateBalances(addresses?: string[]): Promise<void> {
6+
const { wallets, chains } = state.get()
77

8-
const updatedWallets = await Promise.all(
9-
wallets.map(async wallet => {
10-
const chain = chains.find(({ id }) => id === wallet.chains[0].id)
8+
const updatedWallets = await Promise.all(
9+
wallets.map(async wallet => {
10+
const chain = chains.find(({ id }) => id === wallet.chains[0].id)
1111

12-
const updatedAccounts = await Promise.all(
13-
wallet.accounts.map(async account => {
14-
// if no provided addresses, we want to update all balances
15-
// otherwise check if address is in addresses array
16-
if (!addresses || addresses.includes(account.address)) {
12+
const updatedAccounts = await Promise.all(
13+
wallet.accounts.map(async account => {
14+
// if no provided addresses, we want to update all balances
15+
// otherwise check if address is in addresses array
16+
if (!addresses || addresses.includes(account.address)) {
17+
const updatedBalance = await getBalance(account.address, chain)
1718

18-
const updatedBalance = await getBalance(account.address, chain)
19+
return { ...account, balance: updatedBalance }
20+
}
1921

20-
return { ...account, balance: updatedBalance }
21-
}
22-
23-
return account
24-
})
25-
)
26-
return { ...wallet, accounts: updatedAccounts }
22+
return account
2723
})
2824
)
29-
30-
updateAllWallets(updatedWallets)
25+
return { ...wallet, accounts: updatedAccounts }
26+
})
27+
)
28+
29+
updateAllWallets(updatedWallets)
3130
}
3231

33-
export default updateBalances
32+
export default updateBalances

packages/core/src/validation.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import Joi, { ObjectSchema, Schema } from 'joi'
2-
import type { Chain, ChainId, WalletInit, WalletModule } from '@web3-onboard/common'
2+
import type {
3+
Chain,
4+
ChainId,
5+
WalletInit,
6+
WalletModule
7+
} from '@web3-onboard/common'
38

49
import type {
510
InitOptions,

packages/dcent/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { providers } from 'ethers'
1616
interface CustomWindow extends Window {
1717
ethereum: EIP1193Provider
1818
}
19-
19+
2020
declare const window: CustomWindow
2121

2222
const DEFAULT_BASE_PATH = "m/44'/60'/0'/0/0"

0 commit comments

Comments
 (0)