Skip to content

Commit d453081

Browse files
authored
Merge pull request #1176 from blocknative/release/2.6.0
(main) Release: 2.6.0
2 parents 5e0c2cb + 3a199e6 commit d453081

Some content is hidden

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

59 files changed

+702
-315
lines changed

.circleci/config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,12 @@ jobs:
285285
working_directory: ~/web3-onboard-monorepo/packages/vue
286286
steps:
287287
- node-build-steps
288+
build-gas:
289+
docker:
290+
- image: cimg/node:16.13.1
291+
working_directory: ~/web3-onboard-monorepo/packages/gas
292+
steps:
293+
- node-build-steps
288294

289295
# Build staging/Alpha releases
290296
build-staging-core:
@@ -407,6 +413,12 @@ jobs:
407413
working_directory: ~/web3-onboard-monorepo/packages/vue
408414
steps:
409415
- node-staging-build-steps
416+
build-staging-gas:
417+
docker:
418+
- image: cimg/node:16.13.1
419+
working_directory: ~/web3-onboard-monorepo/packages/gas
420+
steps:
421+
- node-staging-build-steps
410422

411423
workflows:
412424
version: 2
@@ -531,3 +543,9 @@ workflows:
531543
<<: *deploy_production_filters
532544
- build-staging-vue:
533545
<<: *deploy_staging_filters
546+
gas:
547+
jobs:
548+
- build-gas:
549+
<<: *deploy_production_filters
550+
- build-staging-gas:
551+
<<: *deploy_staging_filters

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-monorepo",
3-
"version": "2.5.0",
3+
"version": "2.6.0",
44
"private": true,
55
"workspaces": [
66
"./packages/*"

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.9",
3+
"version": "2.0.10",
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.0.5",
62-
"@web3-onboard/common": "^2.1.6"
62+
"@web3-onboard/common": "^2.1.7"
6363
}
6464
}

packages/common/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/common",
3-
"version": "2.1.6",
3+
"version": "2.1.7",
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",
@@ -73,6 +73,7 @@
7373
"prettier-plugin-svelte": "^2.4.0",
7474
"rollup": "^2.3.4",
7575
"rollup-plugin-svelte": "^7.0.0",
76+
"rollup-plugin-terser": "^7.0.2",
7677
"svelte": "^3.42.5",
7778
"svelte-check": "^2.2.6",
7879
"svelte-preprocess": "^4.9.4",
@@ -81,6 +82,7 @@
8182
},
8283
"dependencies": {
8384
"@ethereumjs/common": "2.6.2",
85+
"bignumber.js": "^9.0.0",
8486
"ethers": "5.5.4",
8587
"joi": "^17.4.2",
8688
"rxjs": "^7.5.2"

packages/common/rollup.config.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import replace from '@rollup/plugin-replace'
44
import json from '@rollup/plugin-json'
55
import sveltePreprocess from 'svelte-preprocess'
66
import typescript from '@rollup/plugin-typescript'
7+
import { terser } from 'rollup-plugin-terser'
78

89
const production = !process.env.ROLLUP_WATCH
910

1011
export default {
1112
input: 'src/index.ts',
1213
output: {
1314
format: 'esm',
14-
dir: 'dist/'
15+
dir: 'dist/',
16+
sourcemap: true,
1517
},
1618
plugins: [
1719
json(),
@@ -33,7 +35,19 @@ export default {
3335
typescript({
3436
sourceMap: !production,
3537
inlineSources: !production
38+
}),
39+
production && terser({
40+
ecma: 2017,
41+
mangle: { toplevel: true },
42+
compress: {
43+
module: true,
44+
toplevel: true,
45+
unsafe_arrows: true,
46+
drop_console: production,
47+
drop_debugger: production
48+
},
49+
output: { quote_style: 1 }
3650
})
3751
],
38-
external: ['joi', 'rxjs', 'ethers', '@ethereumjs/common']
52+
external: ['joi', 'rxjs', 'ethers', '@ethereumjs/common', 'bignumber.js']
3953
}

packages/common/src/elements/AddressTable.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import type { Account, AccountsList } from '../types'
3-
import { utils } from 'ethers'
3+
import { weiToEth } from '../utils'
44
55
export let accountsListObject: AccountsList | undefined
66
export let accountSelected: Account | undefined = undefined
@@ -120,7 +120,7 @@
120120
>
121121
<td>{account.derivationPath}</td>
122122
<td class="asset-td"
123-
>{utils.formatEther(account.balance.value)}
123+
>{weiToEth(account.balance.value.toString())}
124124
{account.balance.asset}</td
125125
>
126126
</tr>

packages/common/src/hdwallets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type Common from '@ethereumjs/common'
2-
import type { BigNumber } from 'ethers'
32
import type { CustomNetwork, EIP1193Provider, RPCResponse } from './types'
43
import type { TransactionRequest } from '@ethersproject/providers'
4+
import type { BigNumber } from 'ethers'
55

66
/**
77
* Creates the common instance used for signing

packages/common/src/index.ts

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,3 @@
1-
import type {
2-
RequestPatch,
3-
AccountSelectAPI,
4-
SelectAccountOptions,
5-
BasePath,
6-
DerivationPath,
7-
Asset,
8-
ScanAccounts,
9-
ScanAccountsOptions,
10-
AccountAddress,
11-
Account,
12-
AccountsList,
13-
AppMetadata,
14-
RecommendedInjectedWallets,
15-
WalletInit,
16-
WalletHelpers,
17-
APIKey,
18-
Device,
19-
WalletModule,
20-
GetInterfaceHelpers,
21-
Platform,
22-
DeviceOS,
23-
DeviceBrowser,
24-
DeviceOSName,
25-
DeviceBrowserName,
26-
DeviceType,
27-
ChainId,
28-
RpcUrl,
29-
WalletInterface,
30-
ProviderMessage,
31-
ProviderInfo,
32-
ProviderAccounts,
33-
ProviderEvent,
34-
SimpleEventEmitter,
35-
ConnectListener,
36-
DisconnectListener,
37-
MessageListener,
38-
ChainListener,
39-
AccountsListener,
40-
Balance,
41-
EthAccountsRequest,
42-
EthBalanceRequest,
43-
EIP1102Request,
44-
SelectAccountsRequest,
45-
EIP3326Request,
46-
EIP3085Request,
47-
EthChainIdRequest,
48-
EthSignTransactionRequest,
49-
EthSignMessageRequest,
50-
EIP712Request,
51-
AddChainParams,
52-
EIP1193Provider,
53-
Chain,
54-
TokenSymbol,
55-
CustomNetwork,
56-
TransactionObject,
57-
RPCResponse
58-
} from './types'
59-
601
export { ProviderRpcErrorCode } from './types'
612
export { ProviderRpcError } from './errors'
623
export { createEIP1193Provider } from './eip-1193'
@@ -68,62 +9,6 @@ export {
689
bigNumberFieldsToStrings,
6910
getHardwareWalletProvider
7011
} from './hdwallets'
12+
export { weiToEth } from './utils'
7113

72-
export type {
73-
RequestPatch,
74-
AccountSelectAPI,
75-
SelectAccountOptions,
76-
BasePath,
77-
DerivationPath,
78-
Asset,
79-
ScanAccounts,
80-
ScanAccountsOptions,
81-
AccountAddress,
82-
Account,
83-
AccountsList,
84-
AppMetadata,
85-
RecommendedInjectedWallets,
86-
WalletInit,
87-
WalletHelpers,
88-
APIKey,
89-
Device,
90-
WalletModule,
91-
GetInterfaceHelpers,
92-
Platform,
93-
DeviceOS,
94-
DeviceBrowser,
95-
DeviceOSName,
96-
DeviceBrowserName,
97-
DeviceType,
98-
ChainId,
99-
RpcUrl,
100-
WalletInterface,
101-
ProviderMessage,
102-
ProviderInfo,
103-
ProviderAccounts,
104-
ProviderEvent,
105-
SimpleEventEmitter,
106-
ConnectListener,
107-
DisconnectListener,
108-
MessageListener,
109-
ChainListener,
110-
AccountsListener,
111-
Balance,
112-
EthAccountsRequest,
113-
EthBalanceRequest,
114-
EIP1102Request,
115-
SelectAccountsRequest,
116-
EIP3326Request,
117-
EIP3085Request,
118-
EthChainIdRequest,
119-
EthSignTransactionRequest,
120-
EthSignMessageRequest,
121-
EIP712Request,
122-
AddChainParams,
123-
EIP1193Provider,
124-
Chain,
125-
TokenSymbol,
126-
CustomNetwork,
127-
TransactionObject,
128-
RPCResponse
129-
}
14+
export * from './types'

packages/common/src/types.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import type { ethers, BigNumber } from 'ethers'
21
import type { ConnectionInfo } from 'ethers/lib/utils'
32
import type EventEmitter from 'eventemitter3'
43
import type { TypedData as EIP712TypedData } from 'eip-712'
4+
import type { ethers } from 'ethers'
55
export type { TypedData as EIP712TypedData } from 'eip-712'
66

77
/**
@@ -116,7 +116,7 @@ export type Account = {
116116
derivationPath: DerivationPath
117117
balance: {
118118
asset: Asset['label']
119-
value: BigNumber
119+
value: ethers.BigNumber
120120
}
121121
}
122122

@@ -238,6 +238,8 @@ export type GetInterfaceHelpers = {
238238

239239
export type ChainId = string
240240

241+
export type DecimalChainId = number
242+
241243
export type RpcUrl = string
242244

243245
export type WalletInterface = {
@@ -434,6 +436,8 @@ export interface Chain {
434436
blockExplorerUrl?: string
435437
}
436438

439+
export type ChainWithDecimalId = Omit<Chain, 'id'> & { id: DecimalChainId }
440+
437441
export type TokenSymbol = string // eg ETH
438442

439443
export interface CustomNetwork {

packages/common/src/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import BigNumber from 'bignumber.js'
2+
3+
export function weiToEth(wei: string): string {
4+
return new BigNumber(wei).div(1e18).toString(10)
5+
}

packages/common/src/validation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const basePaths = Joi.array().items(basePath)
99

1010
const chain = Joi.object({
1111
namespace: Joi.string(),
12-
id: Joi.string().required(),
12+
id: Joi.string()
13+
.pattern(/^0x[0-9a-fA-F]+$/)
14+
.required(),
1315
rpcUrl: Joi.string().required(),
1416
label: Joi.string().required(),
1517
token: Joi.string().required(),

packages/common/src/views/AccountSelect.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
import CloseButton from '../elements/CloseButton.svelte'
44
import AddressTable from '../elements/AddressTable.svelte'
55
import TableHeader from '../elements/TableHeader.svelte'
6-
import { utils } from 'ethers'
7-
86
import type { Subject } from 'rxjs'
97
import type {
108
ScanAccountsOptions,
119
SelectAccountOptions,
1210
Account,
1311
AccountsList
1412
} from '../types'
13+
import { weiToEth } from '../utils'
1514
1615
export let selectAccountOptions: SelectAccountOptions
1716
export let accounts$: Subject<Account[]>
@@ -61,7 +60,7 @@
6160
accountsListObject = {
6261
all: allAccounts,
6362
filtered: allAccounts.filter(account => {
64-
return parseFloat(utils.formatEther(account.balance.value)) > 0
63+
return parseFloat(weiToEth(account.balance.value.toString())) > 0
6564
})
6665
}
6766
loadingAccounts = false

0 commit comments

Comments
 (0)