From c5d81ad840e46ec8b7aaeac5bc31a31f8962a424 Mon Sep 17 00:00:00 2001 From: Mahmud <104795334+mahmud-bn@users.noreply.github.com> Date: Tue, 19 Jul 2022 10:08:51 -0600 Subject: [PATCH 01/21] [common-v2.1.5-alpha.1, core-v2.4.0-alpha.7, react-v2.2.3-alpha.5, vue-v2.1.3-alpha.5, demo-v2.0.6]: Enhancement - chain number support (#1135) * chain-number * chain-number * chain-number * chain-number * package-bump * merge develop * merge develop * remove space * remove yarn.lock * remove common-yarn.lock * package bump * package bump * package versioning * package versioning * package versioning * package versioning --- packages/common/package.json | 2 +- packages/common/src/types.ts | 2 +- packages/common/src/validation.ts | 4 +- packages/core/package.json | 4 +- packages/core/src/chain.ts | 2 +- packages/core/src/connect.ts | 4 +- packages/core/src/index.ts | 4 +- packages/core/src/store/actions.ts | 2 +- packages/core/src/utils.ts | 2 + packages/core/src/validation.ts | 5 +- packages/dcent/package.json | 4 +- packages/demo/package.json | 4 +- packages/demo/src/App.svelte | 12 ++- packages/fortmatic/package.json | 4 +- packages/gnosis/package.json | 4 +- packages/injected/package.json | 4 +- packages/keepkey/package.json | 4 +- packages/keystone/package.json | 4 +- packages/ledger/package.json | 4 +- packages/magic/package.json | 4 +- packages/mew/package.json | 4 +- packages/portis/package.json | 4 +- packages/react/package.json | 6 +- packages/torus/package.json | 4 +- packages/trezor/package.json | 4 +- packages/vue/package.json | 6 +- packages/walletconnect/package.json | 4 +- packages/web3auth/package.json | 4 +- yarn.lock | 150 ++++++++++++++++++++++++++++ 29 files changed, 212 insertions(+), 53 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 0878ce05c..3ef00cb11 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/common", - "version": "2.1.6", + "version": "2.1.7-alpha.1", "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", diff --git a/packages/common/src/types.ts b/packages/common/src/types.ts index c54fc3ddf..86b6d75e3 100644 --- a/packages/common/src/types.ts +++ b/packages/common/src/types.ts @@ -236,7 +236,7 @@ export type GetInterfaceHelpers = { EventEmitter: typeof EventEmitter } -export type ChainId = string +export type ChainId = string | number export type RpcUrl = string diff --git a/packages/common/src/validation.ts b/packages/common/src/validation.ts index fcbdaf1f3..6294d7b51 100644 --- a/packages/common/src/validation.ts +++ b/packages/common/src/validation.ts @@ -9,7 +9,9 @@ const basePaths = Joi.array().items(basePath) const chain = Joi.object({ namespace: Joi.string(), - id: Joi.string().required(), + id: Joi.alternatives() + .try(Joi.string().pattern(/^0x[0-9a-fA-F]+$/), + Joi.number().positive()).required, rpcUrl: Joi.string().required(), label: Joi.string().required(), token: Joi.string().required(), diff --git a/packages/core/package.json b/packages/core/package.json index 983eee850..165c27d1e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.5.0", + "version": "2.6.0-alpha.1", "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.", "keywords": [ "Ethereum", @@ -81,7 +81,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "bignumber.js": "^9.0.0", "bnc-sdk": "^4.4.1", "bowser": "^2.11.0", diff --git a/packages/core/src/chain.ts b/packages/core/src/chain.ts index 85750dc81..55de64efa 100644 --- a/packages/core/src/chain.ts +++ b/packages/core/src/chain.ts @@ -8,7 +8,7 @@ import { validateSetChainOptions } from './validation' import type { WalletState } from './types' async function setChain(options: { - chainId: string + chainId: string | number chainNamespace?: string wallet?: WalletState['label'] }): Promise { diff --git a/packages/core/src/connect.ts b/packages/core/src/connect.ts index af870690b..2cda51c65 100644 --- a/packages/core/src/connect.ts +++ b/packages/core/src/connect.ts @@ -25,8 +25,8 @@ async function connect( if (!chains.length) throw new Error( 'At least one chain must be set before attempting to connect a wallet' - ) - + ) + const { autoSelect } = options || { autoSelect: { label: '', disableModals: false } } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 58cc463e0..ad39b25bd 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -26,6 +26,7 @@ import { } from './store/actions' import updateBalances from './update-balances' +import { chainIdToHex } from './utils' import { preflightNotifications } from './preflight-notifications' const API = { @@ -89,8 +90,7 @@ function init(options: InitOptions): OnboardAPI { } = options initI18N(i18n) - addChains(chains) - + addChains(chains.map(chainIdToHex)) const { device, svelteInstance } = configuration // update accountCenter diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index 91f5c8f07..4bc8c74f4 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -63,7 +63,7 @@ export function addChains(chains: Chain[]): void { payload: chains.map(({ namespace = 'evm', id, ...rest }) => ({ ...rest, namespace, - id: id.toLowerCase() + id: id })) } diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 4c59e3ea5..c1ad41d08 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -92,6 +92,8 @@ export async function copyWalletAddress(text: string): Promise { } } +export const chainIdToHex = (chain: Chain): Chain => typeof chain.id === 'number' ? { ...chain, id: `0x${chain.id.toString(16)}` } : chain + export const chainIdToLabel: Record = { '0x1': 'Ethereum', '0x3': 'Ropsten', diff --git a/packages/core/src/validation.ts b/packages/core/src/validation.ts index 71f5b1b92..10a3e37a6 100644 --- a/packages/core/src/validation.ts +++ b/packages/core/src/validation.ts @@ -22,7 +22,10 @@ import type { PreflightNotificationsOptions } from './types' -const chainId = Joi.string().pattern(/^0x[0-9a-fA-F]+$/) +// const chainId = Joi.string().pattern(/^0x[0-9a-fA-F]+$/) +const chainId = Joi.alternatives(). + try(Joi.string().pattern(/^0x[0-9a-fA-F]+$/), + Joi.number().positive()) const chainNamespace = Joi.string().valid('evm') const unknownObject = Joi.object().unknown() diff --git a/packages/dcent/package.json b/packages/dcent/package.json index 61728fc7e..ac312e793 100644 --- a/packages/dcent/package.json +++ b/packages/dcent/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/dcent", - "version": "2.0.6", + "version": "2.0.7-alpha.1", "description": "D'CENT 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", @@ -56,7 +56,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "@ethereumjs/common": "^2.6.1", "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", diff --git a/packages/demo/package.json b/packages/demo/package.json index f93258f6d..484129afa 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -1,6 +1,6 @@ { "name": "demo", - "version": "2.0.5", + "version": "2.0.6", "devDependencies": { "assert": "^2.0.0", "buffer": "^6.0.3", @@ -23,7 +23,7 @@ }, "dependencies": { "@web3-onboard/coinbase": "^2.0.8", - "@web3-onboard/core": "^2.4.1-alpha.1", + "@web3-onboard/core": "^2.6.0-alpha.1", "@web3-onboard/dcent": "^2.0.5", "@web3-onboard/fortmatic": "^2.0.6", "@web3-onboard/gnosis": "^2.0.5", diff --git a/packages/demo/src/App.svelte b/packages/demo/src/App.svelte index 5b73b811a..8ecd45536 100644 --- a/packages/demo/src/App.svelte +++ b/packages/demo/src/App.svelte @@ -62,7 +62,9 @@ const coinbaseWallet = coinbaseModule() - const walletConnect = walletConnectModule() + const walletConnect = walletConnectModule({ + connectFirstChainId: true + }) const portis = portisModule({ apiKey: 'b2b7586f-2b1e-4c30-a7fb-c2d1533b153b' }) @@ -122,19 +124,19 @@ rpcUrl: 'https://mainnet.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e' }, { - id: '0x3', + id: 3, token: 'tROP', label: 'Ropsten', rpcUrl: 'https://ropsten.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e' }, { - id: '0x4', + id: 4, token: 'rETH', label: 'Rinkeby', rpcUrl: 'https://rinkeby.infura.io/v3/17c1e1500e384acfb6a72c5d2e67742e' }, { - id: '0x89', + id: 137, token: 'MATIC', label: 'Polygon', rpcUrl: 'https://matic-mainnet.chainstacklabs.com' @@ -146,7 +148,7 @@ rpcUrl: 'https://matic-mumbai.chainstacklabs.com ' }, { - id: '0xa', + id: 10, token: 'OETH', label: 'Optimism', rpcUrl: 'https://mainnet.optimism.io' diff --git a/packages/fortmatic/package.json b/packages/fortmatic/package.json index 02d1cf87f..d6970fef9 100644 --- a/packages/fortmatic/package.json +++ b/packages/fortmatic/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/fortmatic", - "version": "2.0.8", + "version": "2.0.9-alpha.1", "description": "Fortmatic 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", @@ -59,7 +59,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "fortmatic": "^2.2.1" } } diff --git a/packages/gnosis/package.json b/packages/gnosis/package.json index 63985b21d..db9ca5306 100644 --- a/packages/gnosis/package.json +++ b/packages/gnosis/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gnosis", - "version": "2.0.7", + "version": "2.0.8-alpha.1", "description": "Gnosis Safe 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", @@ -59,6 +59,6 @@ "dependencies": { "@gnosis.pm/safe-apps-provider": "^0.9.2", "@gnosis.pm/safe-apps-sdk": "^6.1.1", - "@web3-onboard/common": "^2.1.6" + "@web3-onboard/common": "^2.1.7-alpha.1" } } diff --git a/packages/injected/package.json b/packages/injected/package.json index f3eea5496..daa31f24c 100644 --- a/packages/injected/package.json +++ b/packages/injected/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/injected-wallets", - "version": "2.0.14", + "version": "2.0.15-alpha.1", "description": "Injected wallet module for connecting browser extension and mobile wallets 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", @@ -62,7 +62,7 @@ "window": "^4.2.7" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "joi": "^17.4.2", "lodash.uniqby": "^4.7.0" } diff --git a/packages/keepkey/package.json b/packages/keepkey/package.json index af108c770..2ca82f13d 100644 --- a/packages/keepkey/package.json +++ b/packages/keepkey/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/keepkey", - "version": "2.1.6", + "version": "2.1.7-alpha.1", "description": "KeepKey hardware 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", @@ -63,7 +63,7 @@ "@ethersproject/providers": "^5.5.0", "@shapeshiftoss/hdwallet-core": "^1.15.2", "@shapeshiftoss/hdwallet-keepkey-webusb": "^1.15.2", - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "ethereumjs-util": "^7.1.3" } } diff --git a/packages/keystone/package.json b/packages/keystone/package.json index 13e728245..a03acce66 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/keystone", - "version": "2.1.7", + "version": "2.1.8-alpha.1", "description": "Keystone hardware 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", @@ -57,6 +57,6 @@ "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", "@keystonehq/eth-keyring": "^0.14.0-alpha.10.3", - "@web3-onboard/common": "^2.1.6" + "@web3-onboard/common": "^2.1.7-alpha.1" } } diff --git a/packages/ledger/package.json b/packages/ledger/package.json index 019f1c6d8..0a94bc162 100644 --- a/packages/ledger/package.json +++ b/packages/ledger/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/ledger", - "version": "2.1.6", + "version": "2.1.7-alpha.1", "description": "Ledger hardare 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", @@ -65,7 +65,7 @@ "@ledgerhq/hw-transport-u2f": "^5.36.0-deprecated", "@ledgerhq/hw-transport-webusb": "^6.19.0", "@metamask/eth-sig-util": "^4.0.0", - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "buffer": "^6.0.3", "ethereumjs-util": "^7.1.3" } diff --git a/packages/magic/package.json b/packages/magic/package.json index 7bf00f7e9..40cd46ea7 100644 --- a/packages/magic/package.json +++ b/packages/magic/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/magic", - "version": "2.0.9", + "version": "2.0.10-alpha.1", "description": "Magic 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", @@ -80,7 +80,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "joi": "^17.4.2", "magic-sdk": "^8.1.0", "rxjs": "^7.5.2" diff --git a/packages/mew/package.json b/packages/mew/package.json index c9aca7f3a..929201120 100644 --- a/packages/mew/package.json +++ b/packages/mew/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/mew", - "version": "2.0.6", + "version": "2.0.7-alpha.1", "description": "MEW (My Ether Wallet) 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", @@ -59,7 +59,7 @@ "@myetherwallet/mewconnect-web-client": "^2.2.0-beta.14" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "rxjs": "^7.5.2" } } diff --git a/packages/portis/package.json b/packages/portis/package.json index 8460b2c40..6ccdeb901 100644 --- a/packages/portis/package.json +++ b/packages/portis/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/portis", - "version": "2.0.6", + "version": "2.0.7-alpha.1", "description": "Portis 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", @@ -57,6 +57,6 @@ }, "dependencies": { "@portis/web3": "^4.0.6", - "@web3-onboard/common": "^2.1.6" + "@web3-onboard/common": "^2.1.7-alpha.1" } } diff --git a/packages/react/package.json b/packages/react/package.json index 6a3e1f839..4d013971c 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/react", - "version": "2.2.4", + "version": "2.2.5-alpha.1", "description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. 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, 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", @@ -62,8 +62,8 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", - "@web3-onboard/core": "^2.5.0", + "@web3-onboard/core": "^2.6.0-alpha.1", + "@web3-onboard/common": "^2.1.7-alpha.1", "use-sync-external-store": "1.0.0" }, "peerDependencies": { diff --git a/packages/torus/package.json b/packages/torus/package.json index b266e7ed8..8d904c56b 100644 --- a/packages/torus/package.json +++ b/packages/torus/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/torus", - "version": "2.0.7", + "version": "2.0.8-alpha.1", "description": "Torus 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", @@ -57,6 +57,6 @@ }, "dependencies": { "@toruslabs/torus-embed": "^1.18.3", - "@web3-onboard/common": "^2.1.6" + "@web3-onboard/common": "^2.1.7-alpha.1" } } diff --git a/packages/trezor/package.json b/packages/trezor/package.json index 8680bad9d..0e289a49b 100644 --- a/packages/trezor/package.json +++ b/packages/trezor/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/trezor", - "version": "2.1.6", + "version": "2.1.7-alpha.1", "description": "Trezor hardware 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", @@ -60,7 +60,7 @@ "dependencies": { "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "buffer": "^6.0.3", "eth-crypto": "^2.1.0", "ethereumjs-util": "^7.1.3", diff --git a/packages/vue/package.json b/packages/vue/package.json index 280194da7..49b2c78e6 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/vue", - "version": "2.1.4", + "version": "2.1.5-alpha.1", "description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. 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, 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", @@ -62,8 +62,8 @@ "dependencies": { "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", - "@web3-onboard/common": "^2.1.6", - "@web3-onboard/core": "^2.5.0", + "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/core": "^2.6.0-alpha.1", "vue-demi": "^0.12.4" }, "peerDependencies": { diff --git a/packages/walletconnect/package.json b/packages/walletconnect/package.json index 71aa64cdc..7bbc134e2 100644 --- a/packages/walletconnect/package.json +++ b/packages/walletconnect/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/walletconnect", - "version": "2.0.7", + "version": "2.0.8-alpha.1", "description": "WalletConnect SDK 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", @@ -61,7 +61,7 @@ "@ethersproject/providers": "^5.5.0", "@walletconnect/client": "^1.7.1", "@walletconnect/qrcode-modal": "^1.7.1", - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "rxjs": "^7.5.2" } } diff --git a/packages/web3auth/package.json b/packages/web3auth/package.json index 975813955..a318395f5 100644 --- a/packages/web3auth/package.json +++ b/packages/web3auth/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/web3auth", - "version": "2.0.5", + "version": "2.0.6-alpha.1", "description": "Web3Auth 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", @@ -56,7 +56,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.6", + "@web3-onboard/common": "^2.1.7-alpha.1", "@web3auth/web3auth": "^1.0.0" } } diff --git a/yarn.lock b/yarn.lock index b5be41b09..c70893e59 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2455,6 +2455,156 @@ dependencies: "@walletconnect/window-getters" "^1.0.0" +"@web3-onboard/coinbase@^2.0.8": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@web3-onboard/coinbase/-/coinbase-2.0.8.tgz#26dbab5728f2a9c07ef4816dfd23ecc741bcf7ef" + integrity sha512-pLvY0Gme1vkqjmYjV2bi0mCeLRCvUfRvBfPZocLF+5XuAgPQuZy1+xYTEc2/1IryAw+wueGhYMHmvBc9dlKKew== + dependencies: + "@coinbase/wallet-sdk" "^3.0.5" + "@web3-onboard/common" "^2.1.5" + +"@web3-onboard/common@^2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/common/-/common-2.1.5.tgz#0bcd562853559a551eaa810ba709fb61a8fd7f09" + integrity sha512-bY5GYwO1f0lV8i1h//dn4Q0Ol3/vnbFcFCKZ/71GSKtvu859xJi6rBGM4+qgU05Wnrel3qyuUF9e9cEgTAwwWA== + dependencies: + "@ethereumjs/common" "2.6.2" + ethers "5.5.4" + joi "^17.4.2" + rxjs "^7.5.2" + +"@web3-onboard/dcent@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/dcent/-/dcent-2.0.5.tgz#395af9a3bbe993f2386d650dc8a9caedb54479e2" + integrity sha512-hOkfkV5iWlcXoFb9twlxMemqYLgvo3z+R03OyHE67DWH5gAUBqR3xlF9lNUk/lpPR3gIuMeYwAy7Wnvi5fiUWg== + dependencies: + "@ethereumjs/common" "^2.6.1" + "@ethereumjs/tx" "^3.4.0" + "@ethersproject/providers" "^5.5.0" + "@web3-onboard/common" "^2.1.5" + eth-dcent-keyring "^0.2.2" + +"@web3-onboard/fortmatic@^2.0.6": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@web3-onboard/fortmatic/-/fortmatic-2.0.7.tgz#d5a5c89c4dc2a92bdbf848a97dbe00c2f085a098" + integrity sha512-hh/HzLVuHLq/QYV8fyPyRBY2crhCQVmeGvxOminRpo3SdfKp/dos6q3oP8aot/3BIsFB/7Ta+kynMBjg+ZcQ7w== + dependencies: + "@web3-onboard/common" "^2.1.5" + fortmatic "^2.2.1" + +"@web3-onboard/gnosis@^2.0.5": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@web3-onboard/gnosis/-/gnosis-2.0.6.tgz#565ec23ebfeef9069def9cf2a129e493fd45e5a9" + integrity sha512-hrl98mpyyNkPGXvPLHky+BCmLMXbZtMHFxKjBmaBynovJyJX/hYK/0/n8/w0miAtWP+5fIWSO7VK+oBVbY7b2Q== + dependencies: + "@gnosis.pm/safe-apps-provider" "^0.9.2" + "@gnosis.pm/safe-apps-sdk" "^6.1.1" + "@web3-onboard/common" "^2.1.5" + +"@web3-onboard/injected-wallets@^2.0.12": + version "2.0.13" + resolved "https://registry.yarnpkg.com/@web3-onboard/injected-wallets/-/injected-wallets-2.0.13.tgz#dc7d67e3b9efd4f7bd09f075d6ef6399322d5146" + integrity sha512-UtPA26+yn02+lLmiwI404DKMIzLM/fhClQTyR9cc4ZcM+YHwGW3kb/NKtxxhKWNtQbXCp8nPTPfHgKW2Y9mggA== + dependencies: + "@web3-onboard/common" "^2.1.5" + joi "^17.4.2" + lodash.uniqby "^4.7.0" + +"@web3-onboard/keepkey@^2.1.4": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/keepkey/-/keepkey-2.1.5.tgz#7903f1824dca0af981fd771e63495cda85d9ee0a" + integrity sha512-nLmPNtGNG70gVMGogQD19Nitwbg8B1zxp8c9/GosdtLHGQ5JwscR6bMsH2PQT7pftMyUesILpWijBsRWk8vztQ== + dependencies: + "@ethersproject/providers" "^5.5.0" + "@shapeshiftoss/hdwallet-core" "^1.15.2" + "@shapeshiftoss/hdwallet-keepkey-webusb" "^1.15.2" + "@web3-onboard/common" "^2.1.5" + ethereumjs-util "^7.1.3" + +"@web3-onboard/keystone@^2.1.5": + version "2.1.6" + resolved "https://registry.yarnpkg.com/@web3-onboard/keystone/-/keystone-2.1.6.tgz#4f8b635133994b5eb9719f35b069384fe4835729" + integrity sha512-Ivfdei6yxzRnaYh4ycsOKY3xYz1MTD2CxuboMZZ8iAjKIYMBUDGBYOXKy+1q7nU750D+dKMVnGVQonEcBQj++Q== + dependencies: + "@ethereumjs/tx" "^3.4.0" + "@ethersproject/providers" "^5.5.0" + "@keystonehq/eth-keyring" "^0.14.0-alpha.10.3" + "@web3-onboard/common" "^2.1.5" + +"@web3-onboard/ledger@^2.1.4": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/ledger/-/ledger-2.1.5.tgz#53dbf4f820e7e18eccfa18dc45e70ca0d07942e9" + integrity sha512-/pQNI8x8KnrQ7drAEhaVF7ZBXSaL/E9+il7VnX1vPreWd94gnHopnA1pxRJsE0ufnj0gl7p59XaYL6KIWbnMOw== + dependencies: + "@ethereumjs/tx" "^3.4.0" + "@ethersproject/providers" "^5.5.0" + "@ledgerhq/hw-app-eth" "^6.19.0" + "@ledgerhq/hw-transport-u2f" "^5.36.0-deprecated" + "@ledgerhq/hw-transport-webusb" "^6.19.0" + "@metamask/eth-sig-util" "^4.0.0" + "@web3-onboard/common" "^2.1.5" + buffer "^6.0.3" + ethereumjs-util "^7.1.3" + +"@web3-onboard/magic@^2.0.7": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@web3-onboard/magic/-/magic-2.0.8.tgz#5f1fa68d999eb7389b59c8106265ec92eb6db3a9" + integrity sha512-N4M054oMD6byH40zCNgFCCRtzsscXiJHve1JBdZOQ2QJ/bxVWfA0KUEMdtWAx296neWK4QhwQfIi41wApuM9EA== + dependencies: + "@web3-onboard/common" "^2.1.5" + joi "^17.4.2" + magic-sdk "^8.1.0" + rxjs "^7.5.2" + +"@web3-onboard/portis@^2.0.4": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/portis/-/portis-2.0.5.tgz#9ac791b078863d964047e15d8a5010876ad62dee" + integrity sha512-dbd9CJl0Bor5GNf0wfhamJF9Gvygqc+FXWwYOydfJPGpd/adZ2eEJ2mT3RVN3NLW9C0MaXmfPJ4lHN5GpUPFIg== + dependencies: + "@portis/web3" "^4.0.6" + "@web3-onboard/common" "^2.1.5" + +"@web3-onboard/torus@^2.0.5": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@web3-onboard/torus/-/torus-2.0.6.tgz#7734d7bcc629c13a14e4d0cd0be696a264fefa73" + integrity sha512-sjDNG+wInP/TVO+Lp+lCWb0sHo074VyTtbCwGHKtQhoY87MiKr4NYo49ZwIiNn0rh9+VAQxyWOa7be/fijCyqA== + dependencies: + "@toruslabs/torus-embed" "^1.18.3" + "@web3-onboard/common" "^2.1.5" + +"@web3-onboard/trezor@^2.1.4": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@web3-onboard/trezor/-/trezor-2.1.5.tgz#fb9658267d3cb1e7cc3894112fdd737c1005abb5" + integrity sha512-693G426u92+NcdecLtA1PAH1G31ZszXVIEV6Fc2w3FNbw73K0wSNOTSegSxQk+Bo+7jZRU5DjCyAR1dmJiyTyg== + dependencies: + "@ethereumjs/tx" "^3.4.0" + "@ethersproject/providers" "^5.5.0" + "@web3-onboard/common" "^2.1.5" + buffer "^6.0.3" + eth-crypto "^2.1.0" + ethereumjs-util "^7.1.3" + hdkey "^2.0.1" + trezor-connect "^8.2.6" + +"@web3-onboard/walletconnect@^2.0.5": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@web3-onboard/walletconnect/-/walletconnect-2.0.6.tgz#dcf6bd74ad4e7f81749a52231a8a2e5b9fbce250" + integrity sha512-eEKGU3gf+Arhp1DyshSmFjbI7VJ9Stcc2nJw30ciHCIKXDhd70eOBL6jqpco8NOKObCulQI6b6Mc/LA5618aaQ== + dependencies: + "@ethersproject/providers" "^5.5.0" + "@walletconnect/client" "^1.7.1" + "@walletconnect/qrcode-modal" "^1.7.1" + "@web3-onboard/common" "^2.1.5" + rxjs "^7.5.2" + +"@web3-onboard/web3auth@^2.0.3": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@web3-onboard/web3auth/-/web3auth-2.0.4.tgz#5da6e25d22f4e5d3f6d772650954dcce5ff30d5f" + integrity sha512-hANa7kx+r8jr9OpZEJU4nOySDV25C1kZJmYmCNMI7NNvSM0vZoeuJjVyg6Vm7/ppCjk0QIjb7WWjov67XS7vjQ== + dependencies: + "@web3-onboard/common" "^2.1.5" + "@web3auth/web3auth" "^1.0.0" + "@web3auth/base-plugin@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@web3auth/base-plugin/-/base-plugin-1.0.1.tgz#1e2a87acf745299fdff6f92e6c46ee9bc38aa670" From 183ce59e08936849b026f11688429ffa77e93e2d Mon Sep 17 00:00:00 2001 From: Aaron Barnard Date: Wed, 20 Jul 2022 10:21:52 +1000 Subject: [PATCH 02/21] [core: 2.6.0-alpha.2] - [fix] - Autoselect with disabled modals resolve (#1154) * Handles failed autoselect with disable modals * Increment version * Increment core version in React and Vue pkgs --- packages/core/package.json | 2 +- packages/core/src/views/connect/Index.svelte | 29 +++++++++++--------- packages/react/package.json | 2 +- packages/vue/package.json | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 165c27d1e..1eebb904a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.1", + "version": "2.6.0-alpha.2", "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.", "keywords": [ "Ethereum", diff --git a/packages/core/src/views/connect/Index.svelte b/packages/core/src/views/connect/Index.svelte index 958667450..373f261df 100644 --- a/packages/core/src/views/connect/Index.svelte +++ b/packages/core/src/views/connect/Index.svelte @@ -51,12 +51,6 @@ let windowWidth: number let scrollContainer: HTMLElement - let walletToAutoSelect = - autoSelect.label && - walletModules.find( - ({ label }) => label.toLowerCase() === autoSelect.label.toLowerCase() - ) - const modalStep$ = new BehaviorSubject( 'selectingWallet' ) @@ -209,13 +203,13 @@ // user rejected account access if (code === ProviderRpcErrorCode.ACCOUNT_ACCESS_REJECTED) { connectionRejected = true - if (walletToAutoSelect) { - walletToAutoSelect = null - if (autoSelect.disableModals) { - connectWallet$.next({ inProgress: false }) - } + if (autoSelect.disableModals) { + connectWallet$.next({ inProgress: false }) + } else if (autoSelect.label) { + autoSelect.label = '' } + return } @@ -263,8 +257,17 @@ modalStep$.pipe(takeUntil(onDestroy$)).subscribe(step => { switch (step) { case 'selectingWallet': { - if (walletToAutoSelect) { - autoSelectWallet(walletToAutoSelect) + if (autoSelect.label) { + const walletToAutoSelect = walletModules.find( + ({ label }) => + label.toLowerCase() === autoSelect.label.toLowerCase() + ) + + if (walletToAutoSelect) { + autoSelectWallet(walletToAutoSelect) + } else if (autoSelect.disableModals) { + connectWallet$.next({ inProgress: false }) + } } else { loadWalletsForSelection() } diff --git a/packages/react/package.json b/packages/react/package.json index 4d013971c..dc21b5729 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -62,7 +62,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.6.0-alpha.1", + "@web3-onboard/core": "^2.6.0-alpha.2", "@web3-onboard/common": "^2.1.7-alpha.1", "use-sync-external-store": "1.0.0" }, diff --git a/packages/vue/package.json b/packages/vue/package.json index 49b2c78e6..a76b0e611 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -63,7 +63,7 @@ "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", "@web3-onboard/common": "^2.1.7-alpha.1", - "@web3-onboard/core": "^2.6.0-alpha.1", + "@web3-onboard/core": "^2.6.0-alpha.2", "vue-demi": "^0.12.4" }, "peerDependencies": { From 180d03aa0d48b8e5aab633676d7d5d7014cbee3a Mon Sep 17 00:00:00 2001 From: Mahmud <104795334+mahmud-bn@users.noreply.github.com> Date: Mon, 25 Jul 2022 09:08:33 -0600 Subject: [PATCH 03/21] [common-v2.1.7-alpha.2, core-v2.6.0-alpha.3, react-v2.2.5-alpha.3, vue-v2.1.5-alpha.3]: Enhancement: Minify bundle size (#1155) * minify common * minify core * package bum * package bump * package bump --- packages/common/package.json | 3 ++- packages/common/rollup.config.js | 16 +++++++++++++++- packages/core/package.json | 5 +++-- packages/core/rollup.config.js | 16 +++++++++++++++- packages/react/package.json | 6 +++--- packages/vue/package.json | 6 +++--- 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index 3ef00cb11..d6a146080 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/common", - "version": "2.1.7-alpha.1", + "version": "2.1.7-alpha.2", "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", @@ -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", diff --git a/packages/common/rollup.config.js b/packages/common/rollup.config.js index aa41939bf..a249675be 100644 --- a/packages/common/rollup.config.js +++ b/packages/common/rollup.config.js @@ -4,6 +4,7 @@ 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 @@ -11,7 +12,8 @@ export default { input: 'src/index.ts', output: { format: 'esm', - dir: 'dist/' + dir: 'dist/', + sourcemap: true, }, plugins: [ json(), @@ -33,6 +35,18 @@ export default { typescript({ sourceMap: !production, inlineSources: !production + }), + production && terser({ + ecma: 2020, + 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'] diff --git a/packages/core/package.json b/packages/core/package.json index 1eebb904a..a54413874 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.2", + "version": "2.6.0-alpha.3", "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.", "keywords": [ "Ethereum", @@ -75,13 +75,14 @@ "prettier-plugin-svelte": "^2.4.0", "rollup": "^2.3.4", "rollup-plugin-svelte": "^7.0.0", + "rollup-plugin-terser": "^7.0.2", "svelte-check": "^2.2.6", "svelte-preprocess": "^4.9.4", "tslib": "^2.0.0", "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7-alpha.2", "bignumber.js": "^9.0.0", "bnc-sdk": "^4.4.1", "bowser": "^2.11.0", diff --git a/packages/core/rollup.config.js b/packages/core/rollup.config.js index 0995d1e78..d19cff1f8 100644 --- a/packages/core/rollup.config.js +++ b/packages/core/rollup.config.js @@ -5,6 +5,7 @@ import json from '@rollup/plugin-json' import sveltePreprocess from 'svelte-preprocess' import typescript from '@rollup/plugin-typescript' import copy from '@rollup-extras/plugin-copy' +import { terser } from 'rollup-plugin-terser' const production = !process.env.ROLLUP_WATCH @@ -12,7 +13,8 @@ export default { input: 'src/index.ts', output: { format: 'es', - dir: 'dist/' + dir: 'dist/', + sourcemap: true, }, plugins: [ json(), @@ -38,6 +40,18 @@ export default { copy({ src: 'src/i18n/en.json', dest: 'i18n' + }), + production && terser({ + ecma: 2020, + mangle: { toplevel: true }, + compress: { + module: true, + toplevel: true, + unsafe_arrows: true, + drop_console: production, + drop_debugger: production + }, + output: { quote_style: 1 } }) ], external: [ diff --git a/packages/react/package.json b/packages/react/package.json index dc21b5729..d63f89c68 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/react", - "version": "2.2.5-alpha.1", + "version": "2.2.5-alpha.3", "description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. 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, 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", @@ -62,8 +62,8 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.6.0-alpha.2", - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/core": "^2.6.0-alpha.3", + "@web3-onboard/common": "^2.1.7-alpha.2", "use-sync-external-store": "1.0.0" }, "peerDependencies": { diff --git a/packages/vue/package.json b/packages/vue/package.json index a76b0e611..1fedcaa75 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/vue", - "version": "2.1.5-alpha.1", + "version": "2.1.5-alpha.3", "description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. 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, 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", @@ -62,8 +62,8 @@ "dependencies": { "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", - "@web3-onboard/common": "^2.1.7-alpha.1", - "@web3-onboard/core": "^2.6.0-alpha.2", + "@web3-onboard/common": "^2.1.7-alpha.2", + "@web3-onboard/core": "^2.6.0-alpha.3", "vue-demi": "^0.12.4" }, "peerDependencies": { From e71f10fe45946d2a4e2fb5fb98db00991b64ab72 Mon Sep 17 00:00:00 2001 From: Manthankumar Satani Date: Mon, 25 Jul 2022 21:34:59 +0530 Subject: [PATCH 04/21] fix: typo in WalletConnect sdk readme example (#1162) --- packages/walletconnect/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/walletconnect/README.md b/packages/walletconnect/README.md index 6600310fa..8af878a1d 100644 --- a/packages/walletconnect/README.md +++ b/packages/walletconnect/README.md @@ -29,7 +29,7 @@ const walletConnect = walletConnectModule({ bridge: 'YOUR_CUSTOM_BRIDGE_SERVER', qrcodeModalOptions: { mobileLinks: ['rainbow', 'metamask', 'argent', 'trust', 'imtoken', 'pillar'] - } + }, connectFirstChainId: true }) From fb81fbb38c5629bde0fac681e86bfe382092bda4 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Mon, 25 Jul 2022 12:37:46 -0600 Subject: [PATCH 05/21] =?UTF-8?q?[core-v2.6.0-alpha.4,=20react-v2.2.5-alph?= =?UTF-8?q?a.4,=20vue-v2.1.5-alpha.4]=20:=20Fix=20-=20Add=20optionality=20?= =?UTF-8?q?to=20containerElement,=20format=20validation=20so=20accountCent?= =?UTF-8?q?=E2=80=A6=20(#1166)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add optionality to containerElement, format validation so accountCenter validations are close to eachother, bump versions * Clean up accountCenter init options * Bump react and vue packages --- packages/core/README.md | 1 + packages/core/package.json | 2 +- packages/core/src/types.ts | 2 +- packages/core/src/validation.ts | 37 +++++++++++++++------------------ packages/react/package.json | 4 ++-- packages/vue/package.json | 4 ++-- 6 files changed, 24 insertions(+), 26 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index fe658dee2..f3791afb9 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -105,6 +105,7 @@ export type AccountCenter = { position?: AccountCenterPosition // default: 'topRight' expanded?: boolean // default: true minimal?: boolean // enabled by default for mobile + containerElement?: string // defines the DOM container element for svelte to attach } export type AccountCenterOptions = { diff --git a/packages/core/package.json b/packages/core/package.json index a54413874..516488e89 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.3", + "version": "2.6.0-alpha.4", "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.", "keywords": [ "Ethereum", diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index d23557b8e..cce41b26f 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -141,7 +141,7 @@ export type AccountCenter = { position?: AccountCenterPosition expanded?: boolean minimal?: boolean - containerElement: string + containerElement?: string } export type AccountCenterOptions = { diff --git a/packages/core/src/validation.ts b/packages/core/src/validation.ts index 10a3e37a6..97b86de4d 100644 --- a/packages/core/src/validation.ts +++ b/packages/core/src/validation.ts @@ -153,6 +153,21 @@ const notifyOptions = Joi.object({ mobile: notify }) +const accountCenterInitOptions = Joi.object({ + enabled: Joi.boolean(), + position: commonPositions, + minimal: Joi.boolean(), + containerElement: Joi.string() +}) + +const accountCenter = Joi.object({ + enabled: Joi.boolean(), + position: commonPositions, + expanded: Joi.boolean(), + minimal: Joi.boolean(), + containerElement: Joi.string() +}) + const initOptions = Joi.object({ wallets: walletInit, chains: chains.required(), @@ -160,18 +175,8 @@ const initOptions = Joi.object({ i18n: Joi.object().unknown(), apiKey: Joi.string(), accountCenter: Joi.object({ - desktop: Joi.object({ - enabled: Joi.boolean(), - minimal: Joi.boolean(), - position: commonPositions, - containerElement: Joi.string() - }), - mobile: Joi.object({ - enabled: Joi.boolean(), - minimal: Joi.boolean(), - position: commonPositions, - containerElement: Joi.string() - }) + desktop: accountCenterInitOptions, + mobile: accountCenterInitOptions }), notify: [notifyOptions, notify] }) @@ -198,14 +203,6 @@ const setChainOptions = Joi.object({ wallet: Joi.string() }) -const accountCenter = Joi.object({ - enabled: Joi.boolean(), - position: commonPositions, - expanded: Joi.boolean(), - minimal: Joi.boolean(), - containerElement: Joi.string() -}) - const customNotificationUpdate = Joi.object({ key: Joi.string().required(), type: Joi.string().allow('pending', 'error', 'success', 'hint'), diff --git a/packages/react/package.json b/packages/react/package.json index d63f89c68..222ccd1e5 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/react", - "version": "2.2.5-alpha.3", + "version": "2.2.5-alpha.4", "description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. 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, 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", @@ -62,7 +62,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.6.0-alpha.3", + "@web3-onboard/core": "^2.6.0-alpha.4", "@web3-onboard/common": "^2.1.7-alpha.2", "use-sync-external-store": "1.0.0" }, diff --git a/packages/vue/package.json b/packages/vue/package.json index 1fedcaa75..cf4185e8c 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/vue", - "version": "2.1.5-alpha.3", + "version": "2.1.5-alpha.4", "description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. 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, 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", @@ -63,7 +63,7 @@ "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", "@web3-onboard/common": "^2.1.7-alpha.2", - "@web3-onboard/core": "^2.6.0-alpha.3", + "@web3-onboard/core": "^2.6.0-alpha.4", "vue-demi": "^0.12.4" }, "peerDependencies": { From c1bcc7d8fa428af307cf7364cd34e35a55503605 Mon Sep 17 00:00:00 2001 From: Joey <5688912+bachstatter@users.noreply.github.com> Date: Tue, 26 Jul 2022 16:52:30 +0100 Subject: [PATCH 06/21] Fix trezor nonce (#1165) * Prefix nonce if needed * Update version * Fix type problems in trezor package --- packages/trezor/package.json | 2 +- packages/trezor/src/index.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/trezor/package.json b/packages/trezor/package.json index 0e289a49b..f032d7f5b 100644 --- a/packages/trezor/package.json +++ b/packages/trezor/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/trezor", - "version": "2.1.7-alpha.1", + "version": "2.1.7-alpha.2", "description": "Trezor hardware 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", diff --git a/packages/trezor/src/index.ts b/packages/trezor/src/index.ts index ab17d16dc..64100833a 100644 --- a/packages/trezor/src/index.ts +++ b/packages/trezor/src/index.ts @@ -284,7 +284,7 @@ function trezor(options: TrezorOptions): WalletInit { maxFeePerGas: transactionData.maxFeePerGas!, maxPriorityFeePerGas: transactionData.maxPriorityFeePerGas!, nonce: transactionData.nonce!, - chainId: parseInt(currentChain.id), + chainId: Number(currentChain.id), data: transactionData.hasOwnProperty('data') ? transactionData.data : '' @@ -296,7 +296,7 @@ function trezor(options: TrezorOptions): WalletInit { gasPrice: transactionData.gasPrice!, gasLimit: gasLimit!, nonce: transactionData.nonce!, - chainId: parseInt(currentChain.id), + chainId: Number(currentChain.id), data: transactionData.hasOwnProperty('data') ? transactionData.data : '' @@ -353,6 +353,15 @@ function trezor(options: TrezorOptions): WalletInit { ) { populatedTransaction.nonce = populatedTransaction.nonce.toString(16) } + if ( + populatedTransaction.hasOwnProperty('nonce') && + typeof populatedTransaction.nonce === 'string' + ) { + // Adds "0x" to a given `String` if it does not already start with "0x". + populatedTransaction.nonce = ethUtil.addHexPrefix( + populatedTransaction.nonce + ) + } const updateBigNumberFields = bigNumberFieldsToStrings(populatedTransaction) @@ -363,7 +372,7 @@ function trezor(options: TrezorOptions): WalletInit { ) const chainId = currentChain.hasOwnProperty('id') - ? Number.parseInt(currentChain.id) + ? Number(currentChain.id) : 1 const common = await getCommon({ customNetwork, chainId }) @@ -386,7 +395,7 @@ function trezor(options: TrezorOptions): WalletInit { // EIP155 support. check/recalc signature v value. const rv = parseInt(v, 16) - let cv = parseInt(currentChain.id) * 2 + 35 + let cv = Number(currentChain.id) * 2 + 35 if (rv !== cv && (rv & cv) !== rv) { cv += 1 // add signature v bit. } @@ -477,7 +486,7 @@ function trezor(options: TrezorOptions): WalletInit { ? [accounts[0].address] : [], eth_chainId: async () => - currentChain.hasOwnProperty('id') ? currentChain.id : '', + currentChain.hasOwnProperty('id') ? String(currentChain.id) : '', eth_signTransaction: async ({ params: [transactionObject] }) => signTransaction(transactionObject), eth_sendTransaction: async ({ baseRequest, params }) => { From db4672df232e2eb44c18c86aa218817e080ebef3 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 27 Jul 2022 02:04:34 +1000 Subject: [PATCH 07/21] [core:2.6.0-alpha.3] [common:2.1.7-alpha.2] - [feature] : Gas Module (#1168) * Initial implementation of Gas module * Working prototype * Add docs * Modify API * Add override poll example and comment * Remove gas module from demo * Update usage in core * Update gas API * Revert changes to fix types * Revert changes to types that are in another pr * Fix docs * Revert in favor of PR * Fix Configuration types * Fix validation * Remove gas from demo * Increment versions * Correct version for demo * Use joi version in other pkgs, update yarn.lock --- .circleci/config.yml | 18 +++++ packages/common/src/index.ts | 118 +---------------------------- packages/core/package.json | 3 +- packages/core/src/configuration.ts | 3 +- packages/core/src/index.ts | 35 ++++++--- packages/core/src/types.ts | 9 ++- packages/core/src/utils.ts | 7 +- packages/core/src/validation.ts | 23 +++--- packages/demo/package.json | 2 +- packages/demo/src/App.svelte | 1 - packages/gas/README.md | 55 ++++++++++++++ packages/gas/package.json | 34 +++++++++ packages/gas/src/get.ts | 41 ++++++++++ packages/gas/src/index.ts | 9 +++ packages/gas/src/stream.ts | 43 +++++++++++ packages/gas/src/types.ts | 51 +++++++++++++ packages/gas/src/utils.ts | 28 +++++++ packages/gas/src/validation.ts | 20 +++++ packages/gas/tsconfig.json | 15 ++++ yarn.lock | 117 +++++++++++++++++++++++++--- 20 files changed, 475 insertions(+), 157 deletions(-) create mode 100644 packages/gas/README.md create mode 100644 packages/gas/package.json create mode 100644 packages/gas/src/get.ts create mode 100644 packages/gas/src/index.ts create mode 100644 packages/gas/src/stream.ts create mode 100644 packages/gas/src/types.ts create mode 100644 packages/gas/src/utils.ts create mode 100644 packages/gas/src/validation.ts create mode 100644 packages/gas/tsconfig.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 41e06eecc..755afac11 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: @@ -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 @@ -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 diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 4a024f5c2..c7dbd0ba3 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -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' @@ -69,61 +10,4 @@ export { getHardwareWalletProvider } from './hdwallets' -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' diff --git a/packages/core/package.json b/packages/core/package.json index 516488e89..32706a314 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.4", + "version": "2.6.0-alpha.5", "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.", "keywords": [ "Ethereum", @@ -68,6 +68,7 @@ "@types/lodash.partition": "^4.6.6", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", + "@web3-onboard/gas": "^2.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.1", diff --git a/packages/core/src/configuration.ts b/packages/core/src/configuration.ts index 1bb47bdbe..f274c4ed8 100644 --- a/packages/core/src/configuration.ts +++ b/packages/core/src/configuration.ts @@ -6,7 +6,8 @@ export let configuration: Configuration = { appMetadata: null, apiKey: null, device: getDevice(), - initialWalletInit: [] + initialWalletInit: [], + gas: null } export function updateConfiguration(update: Partial): void { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index ad39b25bd..f29f2157e 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -4,16 +4,20 @@ import disconnectWallet from './disconnect' import setChain from './chain' import { state } from './store' import { reset$ } from './streams' -import { - validateInitOptions, - validateNotify, - validateNotifyOptions -} from './validation' import initI18N from './i18n' import App from './views/Index.svelte' import type { InitOptions, Notify } from './types' import { APP_INITIAL_STATE } from './constants' import { configuration, updateConfiguration } from './configuration' +import updateBalances from './update-balances' +import { chainIdToHex } from './utils' +import { preflightNotifications } from './preflight-notifications' + +import { + validateInitOptions, + validateNotify, + validateNotifyOptions +} from './validation' import { addChains, @@ -25,10 +29,6 @@ import { setWalletModules } from './store/actions' -import updateBalances from './update-balances' -import { chainIdToHex } from './utils' -import { preflightNotifications } from './preflight-notifications' - const API = { connectWallet, disconnectWallet, @@ -86,11 +86,13 @@ function init(options: InitOptions): OnboardAPI { i18n, accountCenter, apiKey, - notify + notify, + gas } = options initI18N(i18n) addChains(chains.map(chainIdToHex)) + const { device, svelteInstance } = configuration // update accountCenter @@ -129,6 +131,7 @@ function init(options: InitOptions): OnboardAPI { ) { notify.desktop.position = accountCenter.desktop.position } + if ( (!notify.mobile || (notify.mobile && !notify.mobile.position)) && accountCenter && @@ -137,6 +140,7 @@ function init(options: InitOptions): OnboardAPI { ) { notify.mobile.position = accountCenter.mobile.position } + let notifyUpdate: Partial if (device.type === 'mobile' && notify.mobile) { @@ -150,9 +154,11 @@ function init(options: InitOptions): OnboardAPI { ...notify.desktop } } + if (!apiKey || !notifyUpdate.enabled) { notifyUpdate.enabled = false } + updateNotify(notifyUpdate) } else { const error = validateNotify(notify as Notify) @@ -160,6 +166,7 @@ function init(options: InitOptions): OnboardAPI { if (error) { throw error } + const notifyUpdate: Partial = { ...APP_INITIAL_STATE.notify, ...notify @@ -168,6 +175,7 @@ function init(options: InitOptions): OnboardAPI { if (!apiKey || !notifyUpdate.enabled) { notifyUpdate.enabled = false } + updateNotify(notifyUpdate) } } else { @@ -176,6 +184,7 @@ function init(options: InitOptions): OnboardAPI { if (!apiKey) { notifyUpdate.enabled = false } + updateNotify(notifyUpdate) } @@ -191,7 +200,8 @@ function init(options: InitOptions): OnboardAPI { appMetadata, svelteInstance: app, apiKey, - initialWalletInit: wallets + initialWalletInit: wallets, + gas }) return API @@ -214,6 +224,7 @@ function mountApp() { styleEl.innerHTML = ` ${SofiaProRegular} ` + document.body.appendChild(styleEl) // add to DOM @@ -317,7 +328,9 @@ function mountApp() { const containerElementQuery = state.get().accountCenter.containerElement || 'body' + const containerElement = document.querySelector(containerElementQuery) + if (!containerElement) { throw new Error( `Element with query ${state.get().accountCenter} does not exist.` diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index cce41b26f..0c2a05c0b 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -10,6 +10,8 @@ import type { TokenSymbol } from '@web3-onboard/common' +import type gas from '@web3-onboard/gas' + import type en from './i18n/en.json' import type { EthereumTransactionData, Network } from 'bnc-sdk' @@ -43,6 +45,8 @@ export interface InitOptions { * Transaction notification options */ notify?: Partial | Partial + /**Gas module */ + gas?: typeof gas } export interface ConnectOptions { @@ -116,10 +120,11 @@ export interface AppState { export type Configuration = { svelteInstance: SvelteComponent | null - appMetadata: AppMetadata | null device: Device | DeviceNotBrowser - apiKey: string initialWalletInit: WalletInit[] + appMetadata?: AppMetadata | null + apiKey?: string + gas?: typeof gas } export type Locale = string diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index c1ad41d08..2108177c8 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -92,7 +92,10 @@ export async function copyWalletAddress(text: string): Promise { } } -export const chainIdToHex = (chain: Chain): Chain => typeof chain.id === 'number' ? { ...chain, id: `0x${chain.id.toString(16)}` } : chain +export const chainIdToHex = (chain: Chain): Chain => + typeof chain.id === 'number' + ? { ...chain, id: `0x${chain.id.toString(16)}` } + : chain export const chainIdToLabel: Record = { '0x1': 'Ethereum', @@ -245,5 +248,5 @@ export const defaultNotifyEventStyles: Record = { } } -export const wait = (time: number) => +export const wait = (time: number): Promise => new Promise(resolve => setTimeout(resolve, time)) diff --git a/packages/core/src/validation.ts b/packages/core/src/validation.ts index 97b86de4d..ffa38fedf 100644 --- a/packages/core/src/validation.ts +++ b/packages/core/src/validation.ts @@ -23,9 +23,10 @@ import type { } from './types' // const chainId = Joi.string().pattern(/^0x[0-9a-fA-F]+$/) -const chainId = Joi.alternatives(). - try(Joi.string().pattern(/^0x[0-9a-fA-F]+$/), - Joi.number().positive()) +const chainId = Joi.alternatives().try( + Joi.string().pattern(/^0x[0-9a-fA-F]+$/), + Joi.number().positive() +) const chainNamespace = Joi.string().valid('evm') const unknownObject = Joi.object().unknown() @@ -178,7 +179,11 @@ const initOptions = Joi.object({ desktop: accountCenterInitOptions, mobile: accountCenterInitOptions }), - notify: [notifyOptions, notify] + notify: [notifyOptions, notify], + gas: Joi.object({ + get: Joi.function().required(), + stream: Joi.function().required() + }) }) const connectOptions = Joi.object({ @@ -218,15 +223,9 @@ const preflightNotifications = Joi.object({ sendTransaction: Joi.function(), estimateGas: Joi.function(), gasPrice: Joi.function(), - balance: Joi.alternatives( - Joi.string(), - Joi.number() - ), + balance: Joi.alternatives(Joi.string(), Joi.number()), txDetails: Joi.object({ - value: Joi.alternatives( - Joi.string(), - Joi.number() - ), + value: Joi.alternatives(Joi.string(), Joi.number()), to: Joi.string(), from: Joi.string() }), diff --git a/packages/demo/package.json b/packages/demo/package.json index 484129afa..6b61e9c83 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -23,7 +23,7 @@ }, "dependencies": { "@web3-onboard/coinbase": "^2.0.8", - "@web3-onboard/core": "^2.6.0-alpha.1", + "@web3-onboard/core": "^2.6.0-alpha.5", "@web3-onboard/dcent": "^2.0.5", "@web3-onboard/fortmatic": "^2.0.6", "@web3-onboard/gnosis": "^2.0.5", diff --git a/packages/demo/src/App.svelte b/packages/demo/src/App.svelte index 8ecd45536..643be364a 100644 --- a/packages/demo/src/App.svelte +++ b/packages/demo/src/App.svelte @@ -13,7 +13,6 @@ import coinbaseModule from '@web3-onboard/coinbase' import magicModule from '@web3-onboard/magic' import web3authModule from '@web3-onboard/web3auth' - import dcentModule from '@web3-onboard/dcent' import { recoverAddress, diff --git a/packages/gas/README.md b/packages/gas/README.md new file mode 100644 index 000000000..ceca031cf --- /dev/null +++ b/packages/gas/README.md @@ -0,0 +1,55 @@ +# @web3-onboard/gas + +## A module for requesting streams or single requests of gas price estimates from the [Blocknative Gas Platform API](https://docs.blocknative.com/gas-platform). + +### Install + +**NPM** +`npm i @web3-onboard/gas` + +**Yarn** +`yarn add @web3-onboard/gas` + +### Standalone Usage + +```typescript +import gas from '@web3-onboard/gas' + +// subscribe to a single chain for estimates using the default poll rate of 5 secs +// API key is optional and if provided allows for faster poll rates +const ethMainnetGasBlockPrices = gas.stream({ + chains: ['0x1'], + apiKey: '', + endpoint: 'blockPrices' +}) + +const { unsubscribe: ethGasUnsub } = ethMainnetGasBlockPrices.subscribe( + estimates => console.log(estimates) +) + +// .... sometime later, unsubscribe to stop polling +setTimeout(ethGasUnsub, 10000) + +// OR you can subscribe to multiple chains at once: +const gasBlockPrices = gas.stream({ + chains: ['0x1', '0x89'], + apiKey: '', + endpoint: 'blockPrices', + // can override default poll rate as well + poll: 1000 +}) + +const { unsubscribe } = gasBlockPrices.subscribe(estimates => + console.log(estimates) +) + +// .... sometime later, unsubscribe to stop polling +setTimeout(unsubscribe, 10000) + +// Can also just do a one time get rather than a stream +const gasBlockPrices = await gas.get({ + chains: ['0x1', '0x89'], + apiKey: '', + endpoint: 'blockPrices' +}) +``` diff --git a/packages/gas/package.json b/packages/gas/package.json new file mode 100644 index 000000000..3c22b3635 --- /dev/null +++ b/packages/gas/package.json @@ -0,0 +1,34 @@ +{ + "name": "@web3-onboard/gas", + "version": "2.0.0", + "description": "Gas", + "keywords": [ + "gas" + ], + "repository": { + "type": "git", + "url": "https://github.com/blocknative/web3-onboard.git", + "directory": "packages/gas" + }, + "homepage": "https://www.blocknative.com/onboard", + "bugs": "https://github.com/blocknative/web3-onboard/issues", + "module": "dist/index.js", + "typings": "dist/index.d.ts", + "files": [ + "dist" + ], + "type": "module", + "scripts": { + "build": "tsc", + "dev": "tsc -w", + "type-check": "tsc --noEmit" + }, + "license": "MIT", + "devDependencies": { + "typescript": "^4.5.5" + }, + "dependencies": { + "rxjs": "^7.5.2", + "joi": "^17.4.2" + } +} diff --git a/packages/gas/src/get.ts b/packages/gas/src/get.ts new file mode 100644 index 000000000..e5df93f10 --- /dev/null +++ b/packages/gas/src/get.ts @@ -0,0 +1,41 @@ +import { firstValueFrom, zip } from 'rxjs' +import { map } from 'rxjs/operators' +import { ajax } from 'rxjs/ajax' +import { getRequestUrl } from './utils' +import { RequestOptions, ChainId, GasPlatformResponse } from './types' +import { validateRequest } from './validation' + +function get( + options: RequestOptions +): Promise> { + const invalid = validateRequest(options) + + if (invalid) { + throw invalid + } + + const { chains, endpoint, apiKey } = options + + const requestUrls = chains.map(chainId => + getRequestUrl({ chainId, apiKey, endpoint }) + ) + + return firstValueFrom( + // get data + zip( + requestUrls.map(({ url, headers }) => + ajax.getJSON(url, headers) + ) + ).pipe( + // reduce to mapping of chainId -> gas data + map(data => + chains.reduce((acc, chainId, index) => { + acc[chainId] = data[index] + return acc + }, {}) + ) + ) + ) +} + +export default get diff --git a/packages/gas/src/index.ts b/packages/gas/src/index.ts new file mode 100644 index 000000000..549e1271b --- /dev/null +++ b/packages/gas/src/index.ts @@ -0,0 +1,9 @@ +import get from './get' +import stream from './stream' + +export * from './types' + +export default { + get, + stream +} diff --git a/packages/gas/src/stream.ts b/packages/gas/src/stream.ts new file mode 100644 index 000000000..0edfe6bdf --- /dev/null +++ b/packages/gas/src/stream.ts @@ -0,0 +1,43 @@ +import { Observable, timer, zip } from 'rxjs' +import { switchMap, map } from 'rxjs/operators' +import { ajax } from 'rxjs/ajax' +import { getRequestUrl } from './utils' +import { StreamOptions, ChainId, GasPlatformResponse } from './types' +import { validateRequest } from './validation' + +function stream( + options: StreamOptions +): Observable> { + const invalid = validateRequest(options) + + if (invalid) { + throw invalid + } + + const { chains, endpoint, apiKey, poll = 5000 } = options + + const requestUrls = chains.map(chainId => + getRequestUrl({ chainId, apiKey, endpoint }) + ) + + // start polling + return timer(0, poll).pipe( + switchMap(() => + // combine results of all chains request in to one stream emission + zip( + requestUrls.map(({ url, headers }) => + ajax.getJSON(url, headers) + ) + ) + ), + // reduce to mapping of chainId -> gas data + map(data => + chains.reduce((acc, chainId, index) => { + acc[chainId] = data[index] + return acc + }, {}) + ) + ) +} + +export default stream diff --git a/packages/gas/src/types.ts b/packages/gas/src/types.ts new file mode 100644 index 000000000..c12996c40 --- /dev/null +++ b/packages/gas/src/types.ts @@ -0,0 +1,51 @@ +export type RequestEndpoint = 'blockPrices' + +export type RequestOptions = { + chains: ChainId[] + endpoint: RequestEndpoint + apiKey?: string +} + +export type StreamOptions = RequestOptions & { poll?: number } + +export type ChainId = string + +export type GasPrice = { + confidence: number + price: number | null + maxFeePerGas: number | null + maxPriorityFeePerGas: number | null +} + +export type BlockPrices = { + blockNumber: number + estimatedTransactionCount: number + baseFeePerGas: number + estimatedPrices: GasPrice[] +} + +export type EstimatedBaseFee = { + confidence: number + baseFee: number +} + +export type EstimatedBaseFees = [ + { ['pending+1']: [EstimatedBaseFee] }, + { ['pending+2']: [EstimatedBaseFee] }, + { ['pending+3']: [EstimatedBaseFee] }, + { ['pending+4']: [EstimatedBaseFee] }, + { ['pending+5']: [EstimatedBaseFee] } +] + +export type BlockPricesResponse = { + system: string + network: string + unit: string + maxPrice: number + currentBlockNumber: number + msSinceLastBlock: number + blockPrices: BlockPrices[] + estimatedBaseFees?: EstimatedBaseFees +} + +export type GasPlatformResponse = BlockPricesResponse diff --git a/packages/gas/src/utils.ts b/packages/gas/src/utils.ts new file mode 100644 index 000000000..5a4ec7450 --- /dev/null +++ b/packages/gas/src/utils.ts @@ -0,0 +1,28 @@ +import { ChainId, RequestEndpoint } from './types' + +export function getRequestUrl({ + chainId, + endpoint, + apiKey +}: { + chainId: ChainId + endpoint: RequestEndpoint + apiKey?: string +}): { url: string; headers: { authorization?: string } } { + switch (endpoint) { + case 'blockPrices': + return { + url: `https://api.blocknative.com/gasprices/blockprices?chainid=${parseInt( + chainId, + 16 + )}`, + headers: apiKey + ? { + authorization: apiKey + } + : {} + } + default: + throw new Error(`Unrecognized request endpoint: ${endpoint}`) + } +} diff --git a/packages/gas/src/validation.ts b/packages/gas/src/validation.ts new file mode 100644 index 000000000..1eb720b75 --- /dev/null +++ b/packages/gas/src/validation.ts @@ -0,0 +1,20 @@ +import Joi from 'joi' +import { RequestOptions, StreamOptions } from 'types' + +const requestOptions = Joi.object({ + endpoint: Joi.string().valid('blockPrices').required(), + chains: Joi.array().items(Joi.string().valid('0x1', '0x89')).required(), + apiKey: Joi.string(), + poll: Joi.number().min(1000).max(5000) +}) + +type ValidateReturn = Joi.ValidationResult | null + +const validate = (validator: Joi.Schema, data: unknown): ValidateReturn => { + const result = validator.validate(data) + return result.error ? result : null +} + +export const validateRequest = ( + request: RequestOptions | StreamOptions +): ValidateReturn => validate(requestOptions, request) diff --git a/packages/gas/tsconfig.json b/packages/gas/tsconfig.json new file mode 100644 index 000000000..592d71e8f --- /dev/null +++ b/packages/gas/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"], + "compilerOptions": { + "outDir": "dist", + "rootDir": "src", + "declarationDir": "dist", + "paths": { + "*": ["./src/*", "./node_modules/*"] + }, + "typeRoots": ["node_modules/@types"], + "strict": false, + "allowSyntheticDefaultImports": true + } +} diff --git a/yarn.lock b/yarn.lock index c70893e59..953b7bbb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14,6 +14,13 @@ dependencies: "@babel/highlight" "^7.10.4" +"@babel/code-frame@^7.10.4": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" + integrity sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q== + dependencies: + "@babel/highlight" "^7.18.6" + "@babel/code-frame@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" @@ -113,6 +120,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== +"@babel/helper-validator-identifier@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076" + integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g== + "@babel/helper-validator-option@^7.16.7": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" @@ -127,6 +139,15 @@ chalk "^2.0.0" js-tokens "^4.0.0" +"@babel/highlight@^7.18.6": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" + integrity sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g== + dependencies: + "@babel/helper-validator-identifier" "^7.18.6" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/parser@^7.16.4": version "7.17.8" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.8.tgz#2817fb9d885dd8132ea0f8eb615a6388cca1c240" @@ -818,6 +839,46 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" +"@jridgewell/gen-mapping@^0.3.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz#c1aedc61e853f2bb9f5dfe6d4442d3b565b253b9" + integrity sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A== + dependencies: + "@jridgewell/set-array" "^1.0.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/set-array@^1.0.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" + integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== + +"@jridgewell/source-map@^0.3.2": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb" + integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw== + dependencies: + "@jridgewell/gen-mapping" "^0.3.0" + "@jridgewell/trace-mapping" "^0.3.9" + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/trace-mapping@^0.3.9": + version "0.3.14" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" + integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@keepkey/device-protocol@^7.2.4": version "7.7.0" resolved "https://registry.yarnpkg.com/@keepkey/device-protocol/-/device-protocol-7.7.0.tgz#2bdf2da48c1a12cb731b7e4769662372f87e563a" @@ -2455,14 +2516,6 @@ dependencies: "@walletconnect/window-getters" "^1.0.0" -"@web3-onboard/coinbase@^2.0.8": - version "2.0.8" - resolved "https://registry.yarnpkg.com/@web3-onboard/coinbase/-/coinbase-2.0.8.tgz#26dbab5728f2a9c07ef4816dfd23ecc741bcf7ef" - integrity sha512-pLvY0Gme1vkqjmYjV2bi0mCeLRCvUfRvBfPZocLF+5XuAgPQuZy1+xYTEc2/1IryAw+wueGhYMHmvBc9dlKKew== - dependencies: - "@coinbase/wallet-sdk" "^3.0.5" - "@web3-onboard/common" "^2.1.5" - "@web3-onboard/common@^2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@web3-onboard/common/-/common-2.1.5.tgz#0bcd562853559a551eaa810ba709fb61a8fd7f09" @@ -2473,6 +2526,16 @@ joi "^17.4.2" rxjs "^7.5.2" +"@web3-onboard/common@^2.1.6": + version "2.1.6" + resolved "https://registry.yarnpkg.com/@web3-onboard/common/-/common-2.1.6.tgz#29d1a4a98b24a08af9f532707225ad5054e25bb6" + integrity sha512-mVmkjM/hI4WeK9uN3TNt/+v7VtNdwoTbAzTRAOcUSIZRK3q1ptWQoL0tydRimXCTfvv+EUJxlJHb+1+QqmRVPw== + dependencies: + "@ethereumjs/common" "2.6.2" + ethers "5.5.4" + joi "^17.4.2" + rxjs "^7.5.2" + "@web3-onboard/dcent@^2.0.5": version "2.0.5" resolved "https://registry.yarnpkg.com/@web3-onboard/dcent/-/dcent-2.0.5.tgz#395af9a3bbe993f2386d650dc8a9caedb54479e2" @@ -6779,6 +6842,15 @@ jest-changed-files@^24.9.0: execa "^1.0.0" throat "^4.0.0" +jest-worker@^26.2.1: + version "26.6.2" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.6.2.tgz#7f72cbc4d643c365e27b9fd775f9d0eaa9c7a8ed" + integrity sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + jest-worker@^27.4.5: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.5.1.tgz#8d146f0900e8973b106b6f73cc1e9a8cb86f8db0" @@ -8797,6 +8869,16 @@ rollup-plugin-svelte@^7.0.0: require-relative "^0.8.7" rollup-pluginutils "^2.8.2" +rollup-plugin-terser@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" + integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== + dependencies: + "@babel/code-frame" "^7.10.4" + jest-worker "^26.2.1" + serialize-javascript "^4.0.0" + terser "^5.0.0" + rollup-pluginutils@^2.8.2: version "2.8.2" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" @@ -9058,6 +9140,13 @@ send@0.17.2: range-parser "~1.2.1" statuses "~1.5.0" +serialize-javascript@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" + integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== + dependencies: + randombytes "^2.1.0" + serialize-javascript@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" @@ -9591,7 +9680,7 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.1.0: +supports-color@^7.0.0, supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -9734,6 +9823,16 @@ terser-webpack-plugin@^5.1.3: source-map "^0.6.1" terser "^5.7.2" +terser@^5.0.0: + version "5.14.2" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.14.2.tgz#9ac9f22b06994d736174f4091aa368db896f1c10" + integrity sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA== + dependencies: + "@jridgewell/source-map" "^0.3.2" + acorn "^8.5.0" + commander "^2.20.0" + source-map-support "~0.5.20" + terser@^5.7.2: version "5.11.0" resolved "https://registry.yarnpkg.com/terser/-/terser-5.11.0.tgz#2da5506c02e12cd8799947f30ce9c5b760be000f" From bf08241bb075dae6eae910e49061aaacdffae2b3 Mon Sep 17 00:00:00 2001 From: Mahmud <104795334+mahmud-bn@users.noreply.github.com> Date: Tue, 26 Jul 2022 11:30:50 -0600 Subject: [PATCH 08/21] common-v2.1.7-alpha.2, core-v2.6.0-alpha.3, react-v2.2.5-alpha.2, vue-v2.1.5-alpha.2]: Fix: Chain id type fix (#1158) * chainid fix * chainid fix * chainid fix * chainid fix * decimaltoHex * decimaltoHex * decimaltoHex * decimaltoHex * pr-fix * merge develop --- packages/common/package.json | 2 +- packages/common/src/types.ts | 6 +++++- packages/core/package.json | 4 ++-- packages/core/src/chain.ts | 10 ++++++---- packages/core/src/index.ts | 3 +-- packages/core/src/store/actions.ts | 2 +- packages/core/src/types.ts | 5 +++-- packages/core/src/utils.ts | 16 +++++++++++----- packages/core/src/validation.ts | 3 ++- packages/react/package.json | 6 +++--- packages/vue/package.json | 6 +++--- 11 files changed, 38 insertions(+), 25 deletions(-) diff --git a/packages/common/package.json b/packages/common/package.json index d6a146080..b82ce3384 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/common", - "version": "2.1.7-alpha.2", + "version": "2.1.7-alpha.3", "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", diff --git a/packages/common/src/types.ts b/packages/common/src/types.ts index 86b6d75e3..6d10ff435 100644 --- a/packages/common/src/types.ts +++ b/packages/common/src/types.ts @@ -236,7 +236,9 @@ export type GetInterfaceHelpers = { EventEmitter: typeof EventEmitter } -export type ChainId = string | number +export type ChainId = string + +export type DecimalChainId = number export type RpcUrl = string @@ -434,6 +436,8 @@ export interface Chain { blockExplorerUrl?: string } +export type ChainWithDecimalId = Omit & { id: DecimalChainId } + export type TokenSymbol = string // eg ETH export interface CustomNetwork { diff --git a/packages/core/package.json b/packages/core/package.json index 32706a314..55751fd0e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.5", + "version": "2.6.0-alpha.6", "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.", "keywords": [ "Ethereum", @@ -83,7 +83,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.2", + "@web3-onboard/common": "^2.1.7-alpha.3", "bignumber.js": "^9.0.0", "bnc-sdk": "^4.4.1", "bowser": "^2.11.0", diff --git a/packages/core/src/chain.ts b/packages/core/src/chain.ts index 55de64efa..6efd9175b 100644 --- a/packages/core/src/chain.ts +++ b/packages/core/src/chain.ts @@ -6,6 +6,7 @@ import { state } from './store' import { switchChainModal$ } from './streams' import { validateSetChainOptions } from './validation' import type { WalletState } from './types' +import { toHexString } from './utils' async function setChain(options: { chainId: string | number @@ -20,10 +21,11 @@ async function setChain(options: { const { wallets, chains } = state.get() const { chainId, chainNamespace = 'evm', wallet: walletToSet } = options + const chainIdHex = toHexString(chainId) // validate that chainId has been added to chains const chain = chains.find( - ({ namespace, id }) => namespace === chainNamespace && id === chainId + ({ namespace, id }) => namespace === chainNamespace && id === chainIdHex ) if (!chain) { @@ -50,13 +52,13 @@ async function setChain(options: { // check if wallet is already connected to chainId if ( walletConnectedChain.namespace === chainNamespace && - walletConnectedChain.id === chainId + walletConnectedChain.id === chainIdHex ) { return true } try { - await switchChain(wallet.provider, chainId) + await switchChain(wallet.provider, chainIdHex) return true } catch (error) { const { code } = error as { code: number } @@ -69,7 +71,7 @@ async function setChain(options: { // chain has not been added to wallet try { await addNewChain(wallet.provider, chain) - await switchChain(wallet.provider, chainId) + await switchChain(wallet.provider, chainIdHex) return true } catch (error) { // display notification to user to switch chain diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index f29f2157e..46cd0d349 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -91,8 +91,7 @@ function init(options: InitOptions): OnboardAPI { } = options initI18N(i18n) - addChains(chains.map(chainIdToHex)) - + addChains(chainIdToHex(chains)) const { device, svelteInstance } = configuration // update accountCenter diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index 4bc8c74f4..91f5c8f07 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -63,7 +63,7 @@ export function addChains(chains: Chain[]): void { payload: chains.map(({ namespace = 'evm', id, ...rest }) => ({ ...rest, namespace, - id: id + id: id.toLowerCase() })) } diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 0c2a05c0b..fd61471b7 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -7,7 +7,8 @@ import type { EIP1193Provider, WalletModule, Chain, - TokenSymbol + TokenSymbol, + ChainWithDecimalId } from '@web3-onboard/common' import type gas from '@web3-onboard/gas' @@ -23,7 +24,7 @@ export interface InitOptions { /** * The chains that your app works with */ - chains: Chain[] + chains: Chain[] | ChainWithDecimalId[] /** * Additional metadata about your app to be displayed in the Onboard UI */ diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 2108177c8..23204f0a9 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -8,7 +8,8 @@ import type { ChainId, Chain, WalletInit, - WalletModule + WalletModule, + ChainWithDecimalId } from '@web3-onboard/common' import ethereumIcon from './icons/ethereum' @@ -92,10 +93,15 @@ export async function copyWalletAddress(text: string): Promise { } } -export const chainIdToHex = (chain: Chain): Chain => - typeof chain.id === 'number' - ? { ...chain, id: `0x${chain.id.toString(16)}` } - : chain +export const toHexString = (val: number | string): string => typeof val === 'number' ? `0x${val.toString(16)}` : val + +export function chainIdToHex(chains : Chain[] | ChainWithDecimalId[] ): +Chain[] { + return chains.map(({ id, ...rest }) => { + const hexId = toHexString(id) + return { id: hexId, ...rest } + }) +} export const chainIdToLabel: Record = { '0x1': 'Ethereum', diff --git a/packages/core/src/validation.ts b/packages/core/src/validation.ts index ffa38fedf..8b0097acf 100644 --- a/packages/core/src/validation.ts +++ b/packages/core/src/validation.ts @@ -2,6 +2,7 @@ import Joi, { ObjectSchema, Schema } from 'joi' import type { Chain, ChainId, + DecimalChainId, WalletInit, WalletModule } from '@web3-onboard/common' @@ -304,7 +305,7 @@ export function validateString(str: string, label?: string): ValidateReturn { } export function validateSetChainOptions(data: { - chainId: ChainId + chainId: ChainId | DecimalChainId chainNamespace?: string wallet?: WalletState['label'] }): ValidateReturn { diff --git a/packages/react/package.json b/packages/react/package.json index 222ccd1e5..86eebd244 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/react", - "version": "2.2.5-alpha.4", + "version": "2.2.5-alpha.5", "description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. 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, 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", @@ -62,8 +62,8 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.6.0-alpha.4", - "@web3-onboard/common": "^2.1.7-alpha.2", + "@web3-onboard/core": "^2.6.0-alpha.6", + "@web3-onboard/common": "^2.1.7-alpha.3", "use-sync-external-store": "1.0.0" }, "peerDependencies": { diff --git a/packages/vue/package.json b/packages/vue/package.json index cf4185e8c..2869eb1ab 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/vue", - "version": "2.1.5-alpha.4", + "version": "2.1.5-alpha.5", "description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. 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, 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", @@ -62,8 +62,8 @@ "dependencies": { "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", - "@web3-onboard/common": "^2.1.7-alpha.2", - "@web3-onboard/core": "^2.6.0-alpha.4", + "@web3-onboard/common": "^2.1.7-alpha.3", + "@web3-onboard/core": "^2.6.0-alpha.6", "vue-demi": "^0.12.4" }, "peerDependencies": { From a538d6bc7fcc1569e3958a67e81ab6e3671be9f2 Mon Sep 17 00:00:00 2001 From: katspaugh <381895+katspaugh@users.noreply.github.com> Date: Tue, 26 Jul 2022 19:35:15 +0200 Subject: [PATCH 09/21] Fix: add "main" to Keystone's package.json (#1164) * Fix: add "main" to Keystone's package.json * Bump keystone package version --- packages/keystone/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/keystone/package.json b/packages/keystone/package.json index a03acce66..c22b88436 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/keystone", - "version": "2.1.8-alpha.1", + "version": "2.1.8-alpha.2", "description": "Keystone hardware 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", @@ -39,6 +39,7 @@ "homepage": "https://www.blocknative.com/onboard", "bugs": "https://github.com/blocknative/web3-onboard/issues", "module": "dist/index.js", + "main": "dist/index.js", "typings": "dist/index.d.ts", "files": [ "dist" From 6813beb800e013e67a77d997111bee58f080aa0c Mon Sep 17 00:00:00 2001 From: Mahmud <104795334+mahmud-bn@users.noreply.github.com> Date: Tue, 26 Jul 2022 12:25:23 -0600 Subject: [PATCH 10/21] gas-v2.0.0-alpha.1, core-v2.6.0-alpha.6]: Fix: Trigger Gas Module Publish (#1170) * alpha-gas * alpha-gas --- packages/core/package.json | 2 +- packages/gas/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 55751fd0e..fcf530769 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -68,7 +68,7 @@ "@types/lodash.partition": "^4.6.6", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", - "@web3-onboard/gas": "^2.0.0", + "@web3-onboard/gas": "^2.0.0-alpha.1", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.1", diff --git a/packages/gas/package.json b/packages/gas/package.json index 3c22b3635..71fe34606 100644 --- a/packages/gas/package.json +++ b/packages/gas/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gas", - "version": "2.0.0", + "version": "2.0.0-alpha.1", "description": "Gas", "keywords": [ "gas" From 1b3fc9e9755169df1071e4e72c4b305cf34defb0 Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Wed, 27 Jul 2022 11:39:29 -0600 Subject: [PATCH 11/21] Updated Binance Wallet provider patch and version bump (#1174) --- packages/demo/package.json | 2 +- packages/demo/src/App.svelte | 1 + packages/injected/package.json | 2 +- packages/injected/src/wallets.ts | 38 ++++++++++++++------------------ yarn.lock | 9 -------- 5 files changed, 20 insertions(+), 32 deletions(-) diff --git a/packages/demo/package.json b/packages/demo/package.json index 6b61e9c83..96027624b 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -27,7 +27,7 @@ "@web3-onboard/dcent": "^2.0.5", "@web3-onboard/fortmatic": "^2.0.6", "@web3-onboard/gnosis": "^2.0.5", - "@web3-onboard/injected-wallets": "^2.0.12", + "@web3-onboard/injected-wallets": "^2.0.15-alpha.2", "@web3-onboard/keepkey": "^2.1.4", "@web3-onboard/keystone": "^2.1.5", "@web3-onboard/ledger": "^2.1.4", diff --git a/packages/demo/src/App.svelte b/packages/demo/src/App.svelte index 643be364a..8ecd45536 100644 --- a/packages/demo/src/App.svelte +++ b/packages/demo/src/App.svelte @@ -13,6 +13,7 @@ import coinbaseModule from '@web3-onboard/coinbase' import magicModule from '@web3-onboard/magic' import web3authModule from '@web3-onboard/web3auth' + import dcentModule from '@web3-onboard/dcent' import { recoverAddress, diff --git a/packages/injected/package.json b/packages/injected/package.json index daa31f24c..870db7102 100644 --- a/packages/injected/package.json +++ b/packages/injected/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/injected-wallets", - "version": "2.0.15-alpha.1", + "version": "2.0.15-alpha.2", "description": "Injected wallet module for connecting browser extension and mobile wallets 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", diff --git a/packages/injected/src/wallets.ts b/packages/injected/src/wallets.ts index 7be24561a..7b18ea852 100644 --- a/packages/injected/src/wallets.ts +++ b/packages/injected/src/wallets.ts @@ -1,11 +1,16 @@ import type { EIP1193Provider, ChainListener, - SimpleEventEmitter + SimpleEventEmitter, + ChainId } from '@web3-onboard/common' import { createEIP1193Provider } from '@web3-onboard/common' -import type { InjectedWalletModule, CustomWindow } from './types.js' +import type { + InjectedWalletModule, + CustomWindow, + BinanceProvider +} from './types.js' import { InjectedNameSpace, @@ -65,11 +70,11 @@ const binance: InjectedWalletModule = { !!provider && !!provider[ProviderIdentityFlag.Binance], getIcon: async () => (await import('./icons/binance.js')).default, getInterface: async () => { - // We add this to the BinanceChain provider as there is currently - // no way to determine if the wallet is unlocked - if (window.BinanceChain) { - window.BinanceChain.isUnlocked = false + // Replace the provider as the BNB provider is readonly + let tempBNBProvider: BinanceProvider = { + ...window.BinanceChain } + window.BinanceChain = tempBNBProvider const addListener: SimpleEventEmitter['on'] = window.BinanceChain.on.bind( window.BinanceChain @@ -78,9 +83,9 @@ const binance: InjectedWalletModule = { window.BinanceChain.on = (event, func) => { // intercept chainChanged event and format string if (event === 'chainChanged') { - addListener(event, (chainId: string) => { + addListener(event, (chainId: ChainId) => { const cb = func as ChainListener - cb(`0x${parseInt(chainId).toString(16)}`) + cb(`0x${parseInt(chainId as string).toString(16)}`) }) } else { addListener(event, func) @@ -88,21 +93,12 @@ const binance: InjectedWalletModule = { } const provider = createEIP1193Provider(window.BinanceChain, { - // If the wallet is unlocked then we don't need to patch this request - ...(!window.BinanceChain.isUnlocked && { - eth_accounts: () => Promise.resolve([]) - }), - eth_requestAccounts: ({ baseRequest }) => - baseRequest({ method: 'eth_requestAccounts' }).then(accts => { - window.BinanceChain.isUnlocked = true - return accts - }), - eth_selectAccounts: UNSUPPORTED_METHOD, eth_chainId: ({ baseRequest }) => - baseRequest({ method: 'eth_chainId' }).then( - id => `0x${parseInt(id).toString(16)}` - ), + baseRequest({ method: 'eth_chainId' }).then(id => { + return `0x${parseInt(id as string).toString(16)}` + }), // Unsupported method -- will throw error + eth_selectAccounts: UNSUPPORTED_METHOD, wallet_switchEthereumChain: UNSUPPORTED_METHOD }) diff --git a/yarn.lock b/yarn.lock index 953b7bbb0..798020d45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2564,15 +2564,6 @@ "@gnosis.pm/safe-apps-sdk" "^6.1.1" "@web3-onboard/common" "^2.1.5" -"@web3-onboard/injected-wallets@^2.0.12": - version "2.0.13" - resolved "https://registry.yarnpkg.com/@web3-onboard/injected-wallets/-/injected-wallets-2.0.13.tgz#dc7d67e3b9efd4f7bd09f075d6ef6399322d5146" - integrity sha512-UtPA26+yn02+lLmiwI404DKMIzLM/fhClQTyR9cc4ZcM+YHwGW3kb/NKtxxhKWNtQbXCp8nPTPfHgKW2Y9mggA== - dependencies: - "@web3-onboard/common" "^2.1.5" - joi "^17.4.2" - lodash.uniqby "^4.7.0" - "@web3-onboard/keepkey@^2.1.4": version "2.1.5" resolved "https://registry.yarnpkg.com/@web3-onboard/keepkey/-/keepkey-2.1.5.tgz#7903f1824dca0af981fd771e63495cda85d9ee0a" From 5f8c0852fd16fd35f6cddd56b31c1c64e623daad Mon Sep 17 00:00:00 2001 From: Adam Carpenter Date: Wed, 27 Jul 2022 13:13:19 -0600 Subject: [PATCH 12/21] Updated versions for release --- package.json | 2 +- packages/coinbase/package.json | 4 +- packages/common/package.json | 2 +- packages/core/package.json | 6 +- packages/dcent/package.json | 4 +- packages/demo/package.json | 30 +++--- packages/fortmatic/package.json | 4 +- packages/gas/package.json | 2 +- packages/gnosis/package.json | 4 +- packages/injected/package.json | 4 +- packages/keepkey/package.json | 4 +- packages/keystone/package.json | 4 +- packages/ledger/package.json | 4 +- packages/magic/package.json | 4 +- packages/mew/package.json | 4 +- packages/portis/package.json | 4 +- packages/react/package.json | 6 +- packages/torus/package.json | 4 +- packages/trezor/package.json | 4 +- packages/vue/package.json | 6 +- packages/walletconnect/package.json | 4 +- packages/web3auth/package.json | 4 +- yarn.lock | 152 ---------------------------- 23 files changed, 57 insertions(+), 209 deletions(-) diff --git a/package.json b/package.json index 7690d46d7..9cb7ca1a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web3-onboard-monorepo", - "version": "2.5.0", + "version": "2.6.0", "private": true, "workspaces": [ "./packages/*" diff --git a/packages/coinbase/package.json b/packages/coinbase/package.json index 9f84cb034..12425e1f5 100644 --- a/packages/coinbase/package.json +++ b/packages/coinbase/package.json @@ -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", @@ -59,6 +59,6 @@ }, "dependencies": { "@coinbase/wallet-sdk": "^3.0.5", - "@web3-onboard/common": "^2.1.6" + "@web3-onboard/common": "^2.1.7" } } diff --git a/packages/common/package.json b/packages/common/package.json index b82ce3384..7c082aa44 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/common", - "version": "2.1.7-alpha.3", + "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", diff --git a/packages/core/package.json b/packages/core/package.json index fcf530769..921961c23 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.6", + "version": "2.6.0", "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.", "keywords": [ "Ethereum", @@ -68,7 +68,7 @@ "@types/lodash.partition": "^4.6.6", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", - "@web3-onboard/gas": "^2.0.0-alpha.1", + "@web3-onboard/gas": "^2.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.1", @@ -83,7 +83,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.3", + "@web3-onboard/common": "^2.1.7", "bignumber.js": "^9.0.0", "bnc-sdk": "^4.4.1", "bowser": "^2.11.0", diff --git a/packages/dcent/package.json b/packages/dcent/package.json index ac312e793..abcdcbbad 100644 --- a/packages/dcent/package.json +++ b/packages/dcent/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/dcent", - "version": "2.0.7-alpha.1", + "version": "2.0.7", "description": "D'CENT 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", @@ -56,7 +56,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "@ethereumjs/common": "^2.6.1", "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", diff --git a/packages/demo/package.json b/packages/demo/package.json index 6b61e9c83..20894bbe4 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -22,21 +22,21 @@ "webpack-dev-server": "4.7.4" }, "dependencies": { - "@web3-onboard/coinbase": "^2.0.8", - "@web3-onboard/core": "^2.6.0-alpha.5", - "@web3-onboard/dcent": "^2.0.5", - "@web3-onboard/fortmatic": "^2.0.6", - "@web3-onboard/gnosis": "^2.0.5", - "@web3-onboard/injected-wallets": "^2.0.12", - "@web3-onboard/keepkey": "^2.1.4", - "@web3-onboard/keystone": "^2.1.5", - "@web3-onboard/ledger": "^2.1.4", - "@web3-onboard/magic": "^2.0.7", - "@web3-onboard/portis": "^2.0.4", - "@web3-onboard/torus": "^2.0.5", - "@web3-onboard/trezor": "^2.1.4", - "@web3-onboard/walletconnect": "^2.0.5", - "@web3-onboard/web3auth": "^2.0.3", + "@web3-onboard/coinbase": "^2.0.10", + "@web3-onboard/core": "^2.6.0", + "@web3-onboard/dcent": "^2.0.7", + "@web3-onboard/fortmatic": "^2.0.9", + "@web3-onboard/gnosis": "^2.0.8", + "@web3-onboard/injected-wallets": "^2.0.15", + "@web3-onboard/keepkey": "^2.1.7", + "@web3-onboard/keystone": "^2.1.8", + "@web3-onboard/ledger": "^2.1.7", + "@web3-onboard/magic": "^2.0.10", + "@web3-onboard/portis": "^2.0.7", + "@web3-onboard/torus": "^2.0.8", + "@web3-onboard/trezor": "^2.1.7", + "@web3-onboard/walletconnect": "^2.0.8", + "@web3-onboard/web3auth": "^2.0.6", "vconsole": "^3.9.5" }, "license": "MIT", diff --git a/packages/fortmatic/package.json b/packages/fortmatic/package.json index d6970fef9..e2be3a36b 100644 --- a/packages/fortmatic/package.json +++ b/packages/fortmatic/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/fortmatic", - "version": "2.0.9-alpha.1", + "version": "2.0.9", "description": "Fortmatic 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", @@ -59,7 +59,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "fortmatic": "^2.2.1" } } diff --git a/packages/gas/package.json b/packages/gas/package.json index 71fe34606..3c22b3635 100644 --- a/packages/gas/package.json +++ b/packages/gas/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gas", - "version": "2.0.0-alpha.1", + "version": "2.0.0", "description": "Gas", "keywords": [ "gas" diff --git a/packages/gnosis/package.json b/packages/gnosis/package.json index db9ca5306..63daf760d 100644 --- a/packages/gnosis/package.json +++ b/packages/gnosis/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gnosis", - "version": "2.0.8-alpha.1", + "version": "2.0.8", "description": "Gnosis Safe 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", @@ -59,6 +59,6 @@ "dependencies": { "@gnosis.pm/safe-apps-provider": "^0.9.2", "@gnosis.pm/safe-apps-sdk": "^6.1.1", - "@web3-onboard/common": "^2.1.7-alpha.1" + "@web3-onboard/common": "^2.1.7" } } diff --git a/packages/injected/package.json b/packages/injected/package.json index daa31f24c..ad37d9540 100644 --- a/packages/injected/package.json +++ b/packages/injected/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/injected-wallets", - "version": "2.0.15-alpha.1", + "version": "2.0.15", "description": "Injected wallet module for connecting browser extension and mobile wallets 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", @@ -62,7 +62,7 @@ "window": "^4.2.7" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "joi": "^17.4.2", "lodash.uniqby": "^4.7.0" } diff --git a/packages/keepkey/package.json b/packages/keepkey/package.json index 2ca82f13d..73c17fd5e 100644 --- a/packages/keepkey/package.json +++ b/packages/keepkey/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/keepkey", - "version": "2.1.7-alpha.1", + "version": "2.1.7", "description": "KeepKey hardware 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", @@ -63,7 +63,7 @@ "@ethersproject/providers": "^5.5.0", "@shapeshiftoss/hdwallet-core": "^1.15.2", "@shapeshiftoss/hdwallet-keepkey-webusb": "^1.15.2", - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "ethereumjs-util": "^7.1.3" } } diff --git a/packages/keystone/package.json b/packages/keystone/package.json index c22b88436..df1ed2d86 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/keystone", - "version": "2.1.8-alpha.2", + "version": "2.1.8", "description": "Keystone hardware 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", @@ -58,6 +58,6 @@ "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", "@keystonehq/eth-keyring": "^0.14.0-alpha.10.3", - "@web3-onboard/common": "^2.1.7-alpha.1" + "@web3-onboard/common": "^2.1.7" } } diff --git a/packages/ledger/package.json b/packages/ledger/package.json index 0a94bc162..6d272da07 100644 --- a/packages/ledger/package.json +++ b/packages/ledger/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/ledger", - "version": "2.1.7-alpha.1", + "version": "2.1.7", "description": "Ledger hardare 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", @@ -65,7 +65,7 @@ "@ledgerhq/hw-transport-u2f": "^5.36.0-deprecated", "@ledgerhq/hw-transport-webusb": "^6.19.0", "@metamask/eth-sig-util": "^4.0.0", - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "buffer": "^6.0.3", "ethereumjs-util": "^7.1.3" } diff --git a/packages/magic/package.json b/packages/magic/package.json index 40cd46ea7..023d40a67 100644 --- a/packages/magic/package.json +++ b/packages/magic/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/magic", - "version": "2.0.10-alpha.1", + "version": "2.0.10", "description": "Magic 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", @@ -80,7 +80,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "joi": "^17.4.2", "magic-sdk": "^8.1.0", "rxjs": "^7.5.2" diff --git a/packages/mew/package.json b/packages/mew/package.json index 929201120..ab316c05f 100644 --- a/packages/mew/package.json +++ b/packages/mew/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/mew", - "version": "2.0.7-alpha.1", + "version": "2.0.7", "description": "MEW (My Ether Wallet) 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", @@ -59,7 +59,7 @@ "@myetherwallet/mewconnect-web-client": "^2.2.0-beta.14" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "rxjs": "^7.5.2" } } diff --git a/packages/portis/package.json b/packages/portis/package.json index 6ccdeb901..1d3ed4b2b 100644 --- a/packages/portis/package.json +++ b/packages/portis/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/portis", - "version": "2.0.7-alpha.1", + "version": "2.0.7", "description": "Portis 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", @@ -57,6 +57,6 @@ }, "dependencies": { "@portis/web3": "^4.0.6", - "@web3-onboard/common": "^2.1.7-alpha.1" + "@web3-onboard/common": "^2.1.7" } } diff --git a/packages/react/package.json b/packages/react/package.json index 86eebd244..2443841c3 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/react", - "version": "2.2.5-alpha.5", + "version": "2.2.5", "description": "A collection of React hooks for integrating Web3-Onboard in to React and Next.js projects. 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, 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", @@ -62,8 +62,8 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.6.0-alpha.6", - "@web3-onboard/common": "^2.1.7-alpha.3", + "@web3-onboard/core": "^2.6.0", + "@web3-onboard/common": "^2.1.7", "use-sync-external-store": "1.0.0" }, "peerDependencies": { diff --git a/packages/torus/package.json b/packages/torus/package.json index 8d904c56b..db7c5501f 100644 --- a/packages/torus/package.json +++ b/packages/torus/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/torus", - "version": "2.0.8-alpha.1", + "version": "2.0.8", "description": "Torus 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", @@ -57,6 +57,6 @@ }, "dependencies": { "@toruslabs/torus-embed": "^1.18.3", - "@web3-onboard/common": "^2.1.7-alpha.1" + "@web3-onboard/common": "^2.1.7" } } diff --git a/packages/trezor/package.json b/packages/trezor/package.json index f032d7f5b..f34636f4b 100644 --- a/packages/trezor/package.json +++ b/packages/trezor/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/trezor", - "version": "2.1.7-alpha.2", + "version": "2.1.7", "description": "Trezor hardware 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", @@ -60,7 +60,7 @@ "dependencies": { "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "buffer": "^6.0.3", "eth-crypto": "^2.1.0", "ethereumjs-util": "^7.1.3", diff --git a/packages/vue/package.json b/packages/vue/package.json index 2869eb1ab..1c8cbed57 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/vue", - "version": "2.1.5-alpha.5", + "version": "2.1.5", "description": "A collection of Vue Composables for integrating Web3-Onboard in to a Vue or Nuxt project. 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, 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", @@ -62,8 +62,8 @@ "dependencies": { "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", - "@web3-onboard/common": "^2.1.7-alpha.3", - "@web3-onboard/core": "^2.6.0-alpha.6", + "@web3-onboard/common": "^2.1.7", + "@web3-onboard/core": "^2.6.0", "vue-demi": "^0.12.4" }, "peerDependencies": { diff --git a/packages/walletconnect/package.json b/packages/walletconnect/package.json index 7bbc134e2..1e38d2b98 100644 --- a/packages/walletconnect/package.json +++ b/packages/walletconnect/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/walletconnect", - "version": "2.0.8-alpha.1", + "version": "2.0.8", "description": "WalletConnect SDK 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", @@ -61,7 +61,7 @@ "@ethersproject/providers": "^5.5.0", "@walletconnect/client": "^1.7.1", "@walletconnect/qrcode-modal": "^1.7.1", - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "rxjs": "^7.5.2" } } diff --git a/packages/web3auth/package.json b/packages/web3auth/package.json index a318395f5..eb060a300 100644 --- a/packages/web3auth/package.json +++ b/packages/web3auth/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/web3auth", - "version": "2.0.6-alpha.1", + "version": "2.0.6", "description": "Web3Auth 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", @@ -56,7 +56,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.7-alpha.1", + "@web3-onboard/common": "^2.1.7", "@web3auth/web3auth": "^1.0.0" } } diff --git a/yarn.lock b/yarn.lock index 953b7bbb0..109165e31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2516,158 +2516,6 @@ dependencies: "@walletconnect/window-getters" "^1.0.0" -"@web3-onboard/common@^2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@web3-onboard/common/-/common-2.1.5.tgz#0bcd562853559a551eaa810ba709fb61a8fd7f09" - integrity sha512-bY5GYwO1f0lV8i1h//dn4Q0Ol3/vnbFcFCKZ/71GSKtvu859xJi6rBGM4+qgU05Wnrel3qyuUF9e9cEgTAwwWA== - dependencies: - "@ethereumjs/common" "2.6.2" - ethers "5.5.4" - joi "^17.4.2" - rxjs "^7.5.2" - -"@web3-onboard/common@^2.1.6": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@web3-onboard/common/-/common-2.1.6.tgz#29d1a4a98b24a08af9f532707225ad5054e25bb6" - integrity sha512-mVmkjM/hI4WeK9uN3TNt/+v7VtNdwoTbAzTRAOcUSIZRK3q1ptWQoL0tydRimXCTfvv+EUJxlJHb+1+QqmRVPw== - dependencies: - "@ethereumjs/common" "2.6.2" - ethers "5.5.4" - joi "^17.4.2" - rxjs "^7.5.2" - -"@web3-onboard/dcent@^2.0.5": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@web3-onboard/dcent/-/dcent-2.0.5.tgz#395af9a3bbe993f2386d650dc8a9caedb54479e2" - integrity sha512-hOkfkV5iWlcXoFb9twlxMemqYLgvo3z+R03OyHE67DWH5gAUBqR3xlF9lNUk/lpPR3gIuMeYwAy7Wnvi5fiUWg== - dependencies: - "@ethereumjs/common" "^2.6.1" - "@ethereumjs/tx" "^3.4.0" - "@ethersproject/providers" "^5.5.0" - "@web3-onboard/common" "^2.1.5" - eth-dcent-keyring "^0.2.2" - -"@web3-onboard/fortmatic@^2.0.6": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@web3-onboard/fortmatic/-/fortmatic-2.0.7.tgz#d5a5c89c4dc2a92bdbf848a97dbe00c2f085a098" - integrity sha512-hh/HzLVuHLq/QYV8fyPyRBY2crhCQVmeGvxOminRpo3SdfKp/dos6q3oP8aot/3BIsFB/7Ta+kynMBjg+ZcQ7w== - dependencies: - "@web3-onboard/common" "^2.1.5" - fortmatic "^2.2.1" - -"@web3-onboard/gnosis@^2.0.5": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@web3-onboard/gnosis/-/gnosis-2.0.6.tgz#565ec23ebfeef9069def9cf2a129e493fd45e5a9" - integrity sha512-hrl98mpyyNkPGXvPLHky+BCmLMXbZtMHFxKjBmaBynovJyJX/hYK/0/n8/w0miAtWP+5fIWSO7VK+oBVbY7b2Q== - dependencies: - "@gnosis.pm/safe-apps-provider" "^0.9.2" - "@gnosis.pm/safe-apps-sdk" "^6.1.1" - "@web3-onboard/common" "^2.1.5" - -"@web3-onboard/injected-wallets@^2.0.12": - version "2.0.13" - resolved "https://registry.yarnpkg.com/@web3-onboard/injected-wallets/-/injected-wallets-2.0.13.tgz#dc7d67e3b9efd4f7bd09f075d6ef6399322d5146" - integrity sha512-UtPA26+yn02+lLmiwI404DKMIzLM/fhClQTyR9cc4ZcM+YHwGW3kb/NKtxxhKWNtQbXCp8nPTPfHgKW2Y9mggA== - dependencies: - "@web3-onboard/common" "^2.1.5" - joi "^17.4.2" - lodash.uniqby "^4.7.0" - -"@web3-onboard/keepkey@^2.1.4": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@web3-onboard/keepkey/-/keepkey-2.1.5.tgz#7903f1824dca0af981fd771e63495cda85d9ee0a" - integrity sha512-nLmPNtGNG70gVMGogQD19Nitwbg8B1zxp8c9/GosdtLHGQ5JwscR6bMsH2PQT7pftMyUesILpWijBsRWk8vztQ== - dependencies: - "@ethersproject/providers" "^5.5.0" - "@shapeshiftoss/hdwallet-core" "^1.15.2" - "@shapeshiftoss/hdwallet-keepkey-webusb" "^1.15.2" - "@web3-onboard/common" "^2.1.5" - ethereumjs-util "^7.1.3" - -"@web3-onboard/keystone@^2.1.5": - version "2.1.6" - resolved "https://registry.yarnpkg.com/@web3-onboard/keystone/-/keystone-2.1.6.tgz#4f8b635133994b5eb9719f35b069384fe4835729" - integrity sha512-Ivfdei6yxzRnaYh4ycsOKY3xYz1MTD2CxuboMZZ8iAjKIYMBUDGBYOXKy+1q7nU750D+dKMVnGVQonEcBQj++Q== - dependencies: - "@ethereumjs/tx" "^3.4.0" - "@ethersproject/providers" "^5.5.0" - "@keystonehq/eth-keyring" "^0.14.0-alpha.10.3" - "@web3-onboard/common" "^2.1.5" - -"@web3-onboard/ledger@^2.1.4": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@web3-onboard/ledger/-/ledger-2.1.5.tgz#53dbf4f820e7e18eccfa18dc45e70ca0d07942e9" - integrity sha512-/pQNI8x8KnrQ7drAEhaVF7ZBXSaL/E9+il7VnX1vPreWd94gnHopnA1pxRJsE0ufnj0gl7p59XaYL6KIWbnMOw== - dependencies: - "@ethereumjs/tx" "^3.4.0" - "@ethersproject/providers" "^5.5.0" - "@ledgerhq/hw-app-eth" "^6.19.0" - "@ledgerhq/hw-transport-u2f" "^5.36.0-deprecated" - "@ledgerhq/hw-transport-webusb" "^6.19.0" - "@metamask/eth-sig-util" "^4.0.0" - "@web3-onboard/common" "^2.1.5" - buffer "^6.0.3" - ethereumjs-util "^7.1.3" - -"@web3-onboard/magic@^2.0.7": - version "2.0.8" - resolved "https://registry.yarnpkg.com/@web3-onboard/magic/-/magic-2.0.8.tgz#5f1fa68d999eb7389b59c8106265ec92eb6db3a9" - integrity sha512-N4M054oMD6byH40zCNgFCCRtzsscXiJHve1JBdZOQ2QJ/bxVWfA0KUEMdtWAx296neWK4QhwQfIi41wApuM9EA== - dependencies: - "@web3-onboard/common" "^2.1.5" - joi "^17.4.2" - magic-sdk "^8.1.0" - rxjs "^7.5.2" - -"@web3-onboard/portis@^2.0.4": - version "2.0.5" - resolved "https://registry.yarnpkg.com/@web3-onboard/portis/-/portis-2.0.5.tgz#9ac791b078863d964047e15d8a5010876ad62dee" - integrity sha512-dbd9CJl0Bor5GNf0wfhamJF9Gvygqc+FXWwYOydfJPGpd/adZ2eEJ2mT3RVN3NLW9C0MaXmfPJ4lHN5GpUPFIg== - dependencies: - "@portis/web3" "^4.0.6" - "@web3-onboard/common" "^2.1.5" - -"@web3-onboard/torus@^2.0.5": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@web3-onboard/torus/-/torus-2.0.6.tgz#7734d7bcc629c13a14e4d0cd0be696a264fefa73" - integrity sha512-sjDNG+wInP/TVO+Lp+lCWb0sHo074VyTtbCwGHKtQhoY87MiKr4NYo49ZwIiNn0rh9+VAQxyWOa7be/fijCyqA== - dependencies: - "@toruslabs/torus-embed" "^1.18.3" - "@web3-onboard/common" "^2.1.5" - -"@web3-onboard/trezor@^2.1.4": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@web3-onboard/trezor/-/trezor-2.1.5.tgz#fb9658267d3cb1e7cc3894112fdd737c1005abb5" - integrity sha512-693G426u92+NcdecLtA1PAH1G31ZszXVIEV6Fc2w3FNbw73K0wSNOTSegSxQk+Bo+7jZRU5DjCyAR1dmJiyTyg== - dependencies: - "@ethereumjs/tx" "^3.4.0" - "@ethersproject/providers" "^5.5.0" - "@web3-onboard/common" "^2.1.5" - buffer "^6.0.3" - eth-crypto "^2.1.0" - ethereumjs-util "^7.1.3" - hdkey "^2.0.1" - trezor-connect "^8.2.6" - -"@web3-onboard/walletconnect@^2.0.5": - version "2.0.6" - resolved "https://registry.yarnpkg.com/@web3-onboard/walletconnect/-/walletconnect-2.0.6.tgz#dcf6bd74ad4e7f81749a52231a8a2e5b9fbce250" - integrity sha512-eEKGU3gf+Arhp1DyshSmFjbI7VJ9Stcc2nJw30ciHCIKXDhd70eOBL6jqpco8NOKObCulQI6b6Mc/LA5618aaQ== - dependencies: - "@ethersproject/providers" "^5.5.0" - "@walletconnect/client" "^1.7.1" - "@walletconnect/qrcode-modal" "^1.7.1" - "@web3-onboard/common" "^2.1.5" - rxjs "^7.5.2" - -"@web3-onboard/web3auth@^2.0.3": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@web3-onboard/web3auth/-/web3auth-2.0.4.tgz#5da6e25d22f4e5d3f6d772650954dcce5ff30d5f" - integrity sha512-hANa7kx+r8jr9OpZEJU4nOySDV25C1kZJmYmCNMI7NNvSM0vZoeuJjVyg6Vm7/ppCjk0QIjb7WWjov67XS7vjQ== - dependencies: - "@web3-onboard/common" "^2.1.5" - "@web3auth/web3auth" "^1.0.0" - "@web3auth/base-plugin@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@web3auth/base-plugin/-/base-plugin-1.0.1.tgz#1e2a87acf745299fdff6f92e6c46ee9bc38aa670" From 9b285dcfceea1d0edac4e08af7f5fdbf51f0060b Mon Sep 17 00:00:00 2001 From: Aaron Date: Thu, 28 Jul 2022 05:14:09 +1000 Subject: [PATCH 13/21] [gas:2.0.0-alpha.2] [core:2.6.0-alpha.7] - [enhancement] - Modify Gas API Response (#1171) * Modifies results to be an array rather than a map * Increments versions --- packages/core/package.json | 4 ++-- packages/gas/package.json | 2 +- packages/gas/src/get.ts | 13 +------------ packages/gas/src/stream.ts | 15 +++------------ 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index fcf530769..3ebc2b89c 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.6.0-alpha.6", + "version": "2.6.0-alpha.7", "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.", "keywords": [ "Ethereum", @@ -68,7 +68,7 @@ "@types/lodash.partition": "^4.6.6", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", - "@web3-onboard/gas": "^2.0.0-alpha.1", + "@web3-onboard/gas": "^2.0.0-alpha.2", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.1", diff --git a/packages/gas/package.json b/packages/gas/package.json index 71fe34606..333d62701 100644 --- a/packages/gas/package.json +++ b/packages/gas/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/gas", - "version": "2.0.0-alpha.1", + "version": "2.0.0-alpha.2", "description": "Gas", "keywords": [ "gas" diff --git a/packages/gas/src/get.ts b/packages/gas/src/get.ts index e5df93f10..7bffd98a4 100644 --- a/packages/gas/src/get.ts +++ b/packages/gas/src/get.ts @@ -1,13 +1,10 @@ import { firstValueFrom, zip } from 'rxjs' -import { map } from 'rxjs/operators' import { ajax } from 'rxjs/ajax' import { getRequestUrl } from './utils' import { RequestOptions, ChainId, GasPlatformResponse } from './types' import { validateRequest } from './validation' -function get( - options: RequestOptions -): Promise> { +function get(options: RequestOptions): Promise { const invalid = validateRequest(options) if (invalid) { @@ -26,14 +23,6 @@ function get( requestUrls.map(({ url, headers }) => ajax.getJSON(url, headers) ) - ).pipe( - // reduce to mapping of chainId -> gas data - map(data => - chains.reduce((acc, chainId, index) => { - acc[chainId] = data[index] - return acc - }, {}) - ) ) ) } diff --git a/packages/gas/src/stream.ts b/packages/gas/src/stream.ts index 0edfe6bdf..ed4839e00 100644 --- a/packages/gas/src/stream.ts +++ b/packages/gas/src/stream.ts @@ -1,13 +1,11 @@ import { Observable, timer, zip } from 'rxjs' -import { switchMap, map } from 'rxjs/operators' +import { switchMap } from 'rxjs/operators' import { ajax } from 'rxjs/ajax' import { getRequestUrl } from './utils' -import { StreamOptions, ChainId, GasPlatformResponse } from './types' +import { StreamOptions, GasPlatformResponse } from './types' import { validateRequest } from './validation' -function stream( - options: StreamOptions -): Observable> { +function stream(options: StreamOptions): Observable { const invalid = validateRequest(options) if (invalid) { @@ -29,13 +27,6 @@ function stream( ajax.getJSON(url, headers) ) ) - ), - // reduce to mapping of chainId -> gas data - map(data => - chains.reduce((acc, chainId, index) => { - acc[chainId] = data[index] - return acc - }, {}) ) ) } From af5a09f52f4c4ff2be48d3f76ad9745da366d07f Mon Sep 17 00:00:00 2001 From: Mahmud <104795334+mahmud-bn@users.noreply.github.com> Date: Wed, 27 Jul 2022 19:56:13 -0600 Subject: [PATCH 14/21] [common-v2.1.7-alpha.1, core-v2.6.0-alpha.1, react-v2.2.5-alpha.1, vue-2.1.5-alpha.1, demo-v2.0.6]: Enhancement - Convert Wei to Eth (#1137) * weitoeth * weitoeth * weitoeth * weitoeth * common-utils * BigNumber replacement * BigNumber replacement * replace balanceWei * pr-fix * pr-fix * edits * edits * merge develop --- packages/common/package.json | 3 ++- packages/common/rollup.config.js | 2 +- .../common/src/elements/AddressTable.svelte | 4 ++-- packages/common/src/hdwallets.ts | 2 +- packages/common/src/index.ts | 1 + packages/common/src/types.ts | 4 ++-- packages/common/src/utils.ts | 5 +++++ .../common/src/views/AccountSelect.svelte | 5 ++--- packages/core/README.md | 22 +++++++++---------- packages/core/package.json | 2 +- packages/core/src/provider.ts | 16 +++++++++----- packages/core/src/update-balances.ts | 1 - packages/core/src/views/connect/Index.svelte | 3 +-- packages/react/package.json | 6 ++--- packages/vue/package.json | 6 ++--- 15 files changed, 45 insertions(+), 37 deletions(-) create mode 100644 packages/common/src/utils.ts diff --git a/packages/common/package.json b/packages/common/package.json index b82ce3384..670713a8d 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/common", - "version": "2.1.7-alpha.3", + "version": "2.1.7-alpha.4", "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", @@ -82,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" diff --git a/packages/common/rollup.config.js b/packages/common/rollup.config.js index a249675be..dc7b10941 100644 --- a/packages/common/rollup.config.js +++ b/packages/common/rollup.config.js @@ -49,5 +49,5 @@ export default { output: { quote_style: 1 } }) ], - external: ['joi', 'rxjs', 'ethers', '@ethereumjs/common'] + external: ['joi', 'rxjs', 'ethers', '@ethereumjs/common', 'bignumber.js'] } diff --git a/packages/common/src/elements/AddressTable.svelte b/packages/common/src/elements/AddressTable.svelte index 704098e1a..8aa8c3e0c 100644 --- a/packages/common/src/elements/AddressTable.svelte +++ b/packages/common/src/elements/AddressTable.svelte @@ -1,6 +1,6 @@