Skip to content

Commit

Permalink
Merge pull request #1176 from blocknative/release/2.6.0
Browse files Browse the repository at this point in the history
(main) Release: 2.6.0
  • Loading branch information
Adamj1232 authored Aug 1, 2022
2 parents 5e0c2cb + 3a199e6 commit d453081
Show file tree
Hide file tree
Showing 59 changed files with 702 additions and 315 deletions.
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/vue
steps:
- node-build-steps
build-gas:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/gas
steps:
- node-build-steps

# Build staging/Alpha releases
build-staging-core:
Expand Down Expand Up @@ -407,6 +413,12 @@ jobs:
working_directory: ~/web3-onboard-monorepo/packages/vue
steps:
- node-staging-build-steps
build-staging-gas:
docker:
- image: cimg/node:16.13.1
working_directory: ~/web3-onboard-monorepo/packages/gas
steps:
- node-staging-build-steps

workflows:
version: 2
Expand Down Expand Up @@ -531,3 +543,9 @@ workflows:
<<: *deploy_production_filters
- build-staging-vue:
<<: *deploy_staging_filters
gas:
jobs:
- build-gas:
<<: *deploy_production_filters
- build-staging-gas:
<<: *deploy_staging_filters
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web3-onboard-monorepo",
"version": "2.5.0",
"version": "2.6.0",
"private": true,
"workspaces": [
"./packages/*"
Expand Down
4 changes: 2 additions & 2 deletions packages/coinbase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/coinbase",
"version": "2.0.9",
"version": "2.0.10",
"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.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -59,6 +59,6 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.0.5",
"@web3-onboard/common": "^2.1.6"
"@web3-onboard/common": "^2.1.7"
}
}
4 changes: 3 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/common",
"version": "2.1.6",
"version": "2.1.7",
"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.",
"keywords": [
"Ethereum",
Expand Down Expand Up @@ -73,6 +73,7 @@
"prettier-plugin-svelte": "^2.4.0",
"rollup": "^2.3.4",
"rollup-plugin-svelte": "^7.0.0",
"rollup-plugin-terser": "^7.0.2",
"svelte": "^3.42.5",
"svelte-check": "^2.2.6",
"svelte-preprocess": "^4.9.4",
Expand All @@ -81,6 +82,7 @@
},
"dependencies": {
"@ethereumjs/common": "2.6.2",
"bignumber.js": "^9.0.0",
"ethers": "5.5.4",
"joi": "^17.4.2",
"rxjs": "^7.5.2"
Expand Down
18 changes: 16 additions & 2 deletions packages/common/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import replace from '@rollup/plugin-replace'
import json from '@rollup/plugin-json'
import sveltePreprocess from 'svelte-preprocess'
import typescript from '@rollup/plugin-typescript'
import { terser } from 'rollup-plugin-terser'

const production = !process.env.ROLLUP_WATCH

export default {
input: 'src/index.ts',
output: {
format: 'esm',
dir: 'dist/'
dir: 'dist/',
sourcemap: true,
},
plugins: [
json(),
Expand All @@ -33,7 +35,19 @@ export default {
typescript({
sourceMap: !production,
inlineSources: !production
}),
production && terser({
ecma: 2017,
mangle: { toplevel: true },
compress: {
module: true,
toplevel: true,
unsafe_arrows: true,
drop_console: production,
drop_debugger: production
},
output: { quote_style: 1 }
})
],
external: ['joi', 'rxjs', 'ethers', '@ethereumjs/common']
external: ['joi', 'rxjs', 'ethers', '@ethereumjs/common', 'bignumber.js']
}
4 changes: 2 additions & 2 deletions packages/common/src/elements/AddressTable.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import type { Account, AccountsList } from '../types'
import { utils } from 'ethers'
import { weiToEth } from '../utils'
export let accountsListObject: AccountsList | undefined
export let accountSelected: Account | undefined = undefined
Expand Down Expand Up @@ -120,7 +120,7 @@
>
<td>{account.derivationPath}</td>
<td class="asset-td"
>{utils.formatEther(account.balance.value)}
>{weiToEth(account.balance.value.toString())}
{account.balance.asset}</td
>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/hdwallets.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type Common from '@ethereumjs/common'
import type { BigNumber } from 'ethers'
import type { CustomNetwork, EIP1193Provider, RPCResponse } from './types'
import type { TransactionRequest } from '@ethersproject/providers'
import type { BigNumber } from 'ethers'

/**
* Creates the common instance used for signing
Expand Down
119 changes: 2 additions & 117 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,3 @@
import type {
RequestPatch,
AccountSelectAPI,
SelectAccountOptions,
BasePath,
DerivationPath,
Asset,
ScanAccounts,
ScanAccountsOptions,
AccountAddress,
Account,
AccountsList,
AppMetadata,
RecommendedInjectedWallets,
WalletInit,
WalletHelpers,
APIKey,
Device,
WalletModule,
GetInterfaceHelpers,
Platform,
DeviceOS,
DeviceBrowser,
DeviceOSName,
DeviceBrowserName,
DeviceType,
ChainId,
RpcUrl,
WalletInterface,
ProviderMessage,
ProviderInfo,
ProviderAccounts,
ProviderEvent,
SimpleEventEmitter,
ConnectListener,
DisconnectListener,
MessageListener,
ChainListener,
AccountsListener,
Balance,
EthAccountsRequest,
EthBalanceRequest,
EIP1102Request,
SelectAccountsRequest,
EIP3326Request,
EIP3085Request,
EthChainIdRequest,
EthSignTransactionRequest,
EthSignMessageRequest,
EIP712Request,
AddChainParams,
EIP1193Provider,
Chain,
TokenSymbol,
CustomNetwork,
TransactionObject,
RPCResponse
} from './types'

export { ProviderRpcErrorCode } from './types'
export { ProviderRpcError } from './errors'
export { createEIP1193Provider } from './eip-1193'
Expand All @@ -68,62 +9,6 @@ export {
bigNumberFieldsToStrings,
getHardwareWalletProvider
} from './hdwallets'
export { weiToEth } from './utils'

export type {
RequestPatch,
AccountSelectAPI,
SelectAccountOptions,
BasePath,
DerivationPath,
Asset,
ScanAccounts,
ScanAccountsOptions,
AccountAddress,
Account,
AccountsList,
AppMetadata,
RecommendedInjectedWallets,
WalletInit,
WalletHelpers,
APIKey,
Device,
WalletModule,
GetInterfaceHelpers,
Platform,
DeviceOS,
DeviceBrowser,
DeviceOSName,
DeviceBrowserName,
DeviceType,
ChainId,
RpcUrl,
WalletInterface,
ProviderMessage,
ProviderInfo,
ProviderAccounts,
ProviderEvent,
SimpleEventEmitter,
ConnectListener,
DisconnectListener,
MessageListener,
ChainListener,
AccountsListener,
Balance,
EthAccountsRequest,
EthBalanceRequest,
EIP1102Request,
SelectAccountsRequest,
EIP3326Request,
EIP3085Request,
EthChainIdRequest,
EthSignTransactionRequest,
EthSignMessageRequest,
EIP712Request,
AddChainParams,
EIP1193Provider,
Chain,
TokenSymbol,
CustomNetwork,
TransactionObject,
RPCResponse
}
export * from './types'
8 changes: 6 additions & 2 deletions packages/common/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ethers, BigNumber } from 'ethers'
import type { ConnectionInfo } from 'ethers/lib/utils'
import type EventEmitter from 'eventemitter3'
import type { TypedData as EIP712TypedData } from 'eip-712'
import type { ethers } from 'ethers'
export type { TypedData as EIP712TypedData } from 'eip-712'

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ export type Account = {
derivationPath: DerivationPath
balance: {
asset: Asset['label']
value: BigNumber
value: ethers.BigNumber
}
}

Expand Down Expand Up @@ -238,6 +238,8 @@ export type GetInterfaceHelpers = {

export type ChainId = string

export type DecimalChainId = number

export type RpcUrl = string

export type WalletInterface = {
Expand Down Expand Up @@ -434,6 +436,8 @@ export interface Chain {
blockExplorerUrl?: string
}

export type ChainWithDecimalId = Omit<Chain, 'id'> & { id: DecimalChainId }

export type TokenSymbol = string // eg ETH

export interface CustomNetwork {
Expand Down
5 changes: 5 additions & 0 deletions packages/common/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import BigNumber from 'bignumber.js'

export function weiToEth(wei: string): string {
return new BigNumber(wei).div(1e18).toString(10)
}
4 changes: 3 additions & 1 deletion packages/common/src/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const basePaths = Joi.array().items(basePath)

const chain = Joi.object({
namespace: Joi.string(),
id: Joi.string().required(),
id: Joi.string()
.pattern(/^0x[0-9a-fA-F]+$/)
.required(),
rpcUrl: Joi.string().required(),
label: Joi.string().required(),
token: Joi.string().required(),
Expand Down
5 changes: 2 additions & 3 deletions packages/common/src/views/AccountSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import CloseButton from '../elements/CloseButton.svelte'
import AddressTable from '../elements/AddressTable.svelte'
import TableHeader from '../elements/TableHeader.svelte'
import { utils } from 'ethers'
import type { Subject } from 'rxjs'
import type {
ScanAccountsOptions,
SelectAccountOptions,
Account,
AccountsList
} from '../types'
import { weiToEth } from '../utils'
export let selectAccountOptions: SelectAccountOptions
export let accounts$: Subject<Account[]>
Expand Down Expand Up @@ -61,7 +60,7 @@
accountsListObject = {
all: allAccounts,
filtered: allAccounts.filter(account => {
return parseFloat(utils.formatEther(account.balance.value)) > 0
return parseFloat(weiToEth(account.balance.value.toString())) > 0
})
}
loadingAccounts = false
Expand Down
Loading

0 comments on commit d453081

Please sign in to comment.