diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml index 639ffb678..a3548ebec 100644 --- a/.github/ISSUE_TEMPLATE/BUG.yml +++ b/.github/ISSUE_TEMPLATE/BUG.yml @@ -41,26 +41,26 @@ body: attributes: label: What package is effected by this issue? options: - - @web3-onboard/core - - @web3-onboard/common - - @web3-onboard/coinbase - - @web3-onboard/decent - - @web3-onboard/formatic - - @web3-onboard/gnosis - - @web3-onboard/injected - - @web3-onboard/keepkey - - @web3-onboard/keystone - - @web3-onboard/ledger - - @web3-onboard/magic - - @web3-onboard/mew - - @web3-onboard/portis - - @web3-onboard/react - - @web3-onboard/torus - - @web3-onboard/trezor - - @web3-onboard/vue - - @web3-onboard/walletconnect - - @web3-onboard/walletlink - - @web3-onboard/web3auth + - "@web3-onboard/core" + - "@web3-onboard/common" + - "@web3-onboard/coinbase" + - "@web3-onboard/decent" + - "@web3-onboard/formatic" + - "@web3-onboard/gnosis" + - "@web3-onboard/injected" + - "@web3-onboard/keepkey" + - "@web3-onboard/keystone" + - "@web3-onboard/ledger" + - "@web3-onboard/magic" + - "@web3-onboard/mew" + - "@web3-onboard/portis" + - "@web3-onboard/react" + - "@web3-onboard/torus" + - "@web3-onboard/trezor" + - "@web3-onboard/vue" + - "@web3-onboard/walletconnect" + - "@web3-onboard/walletlink" + - "@web3-onboard/web3auth" - bnc-onboard (v1) validations: required: true diff --git a/README.md b/README.md index 0b467ca0c..b79787cdd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Web3-Onboard +**easy way to connect users to dapps** ## Features diff --git a/package.json b/package.json index 1ad8867b0..57c1bbdbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web3-onboard-monorepo", - "version": "2.2.0", + "version": "2.3.0", "private": true, "workspaces": [ "./packages/*" diff --git a/packages/coinbase/package.json b/packages/coinbase/package.json index 68c3138d1..3028dac62 100644 --- a/packages/coinbase/package.json +++ b/packages/coinbase/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/coinbase", - "version": "2.0.6", + "version": "2.0.7", "description": "Coinbase Wallet module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -21,6 +22,6 @@ }, "dependencies": { "@coinbase/wallet-sdk": "^3.0.5", - "@web3-onboard/common": "^2.1.3" + "@web3-onboard/common": "^2.1.4" } } diff --git a/packages/common/package.json b/packages/common/package.json index 525a1d8f0..ac0346e99 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,7 @@ { "name": "@web3-onboard/common", - "version": "2.1.3", + "version": "2.1.4", + "repository": "blocknative/web3-onboard", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", diff --git a/packages/core/package.json b/packages/core/package.json index 5651b107a..18bc413c2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,7 @@ { "name": "@web3-onboard/core", - "version": "2.3.1", + "version": "2.3.2", + "repository": "blocknative/web3-onboard", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", @@ -41,7 +42,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "bignumber.js": "^9.0.0", "bnc-sdk": "^4.4.1", "bowser": "^2.11.0", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index cbd7a22ff..e29442eff 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -4,7 +4,11 @@ import disconnectWallet from './disconnect' import setChain from './chain' import { state } from './store' import { reset$ } from './streams' -import { validateInitOptions, validateNotify, validateNotifyOptions } from './validation' +import { + validateInitOptions, + validateNotify, + validateNotifyOptions +} from './validation' import initI18N from './i18n' import App from './views/Index.svelte' import type { InitOptions, OnboardAPI, Notify } from './types' @@ -103,14 +107,14 @@ function init(options: InitOptions): OnboardAPI { } // update notify - if (typeof notify !== undefined) { + if (typeof notify !== 'undefined') { if ('desktop' in notify || 'mobile' in notify) { const error = validateNotifyOptions(notify) - + if (error) { throw error } - + if ( (!notify.desktop || (notify.desktop && !notify.desktop.position)) && accountCenter && @@ -128,6 +132,7 @@ function init(options: InitOptions): OnboardAPI { notify.mobile.position = accountCenter.mobile.position } let notifyUpdate: Partial + if (device.type === 'mobile' && notify.mobile) { notifyUpdate = { ...APP_INITIAL_STATE.notify, @@ -139,15 +144,34 @@ function init(options: InitOptions): OnboardAPI { ...notify.desktop } } + if (!apiKey || !notifyUpdate.enabled) { + notifyUpdate.enabled = false + } updateNotify(notifyUpdate) } else { const error = validateNotify(notify as Notify) - + if (error) { throw error } - updateNotify(notify as Notify) + const notifyUpdate: Partial = { + ...APP_INITIAL_STATE.notify, + ...notify + } + + if (!apiKey || !notifyUpdate.enabled) { + notifyUpdate.enabled = false + } + console.log(notifyUpdate) + updateNotify(notifyUpdate) + } + } else { + const notifyUpdate: Partial = APP_INITIAL_STATE.notify + + if (!apiKey) { + notifyUpdate.enabled = false } + updateNotify(notifyUpdate) } if (svelteInstance) { diff --git a/packages/core/src/views/Index.svelte b/packages/core/src/views/Index.svelte index adcb618dc..709873e48 100644 --- a/packages/core/src/views/Index.svelte +++ b/packages/core/src/views/Index.svelte @@ -8,6 +8,8 @@ import AccountCenter from './account-center/Index.svelte' import Notify from './notify/Index.svelte' import { configuration } from '../configuration' + import type { Observable } from 'rxjs' + import type { Notification } from '../types' const { device } = configuration const accountCenter$ = state @@ -17,12 +19,61 @@ const notify$ = state .select('notify') .pipe(startWith(state.get().notify), shareReplay(1)) + + const notifications$: Observable = state + .select('notifications') + .pipe(startWith(state.get().notifications)) + const positioningDefaults = { topLeft: 'top: 0; left: 0;', topRight: 'top: 0; right: 0;', bottomRight: 'bottom: 0; right: 0;', bottomLeft: 'bottom: 0; left: 0;' } + + $: sharedContainer = + $accountCenter$.enabled && + $notify$.enabled && + $notify$.position === $accountCenter$.position + + $: samePositionOrMobile = + device.type === 'mobile' || $accountCenter$.position === $notify$.position + + $: sharedMobileContainerCheck = + device.type === 'mobile' && + (($notify$.position.includes('bottom') && + $accountCenter$.position.includes('bottom')) || + ($notify$.position.includes('top') && + $accountCenter$.position.includes('top'))) + + $: separateMobileContainerCheck = + device.type === 'mobile' && + (($notify$.position.includes('top') && + $accountCenter$.position.includes('bottom')) || + ($notify$.position.includes('bottom') && + $accountCenter$.position.includes('top'))) + + $: displayNotifySeparate = + $notify$.enabled && + (!$accountCenter$.enabled || + ($notify$.position !== $accountCenter$.position && + device.type !== 'mobile') || + separateMobileContainerCheck) && + $wallets$.length + + $: displayAccountCenterSeparate = + $accountCenter$.enabled && + (!$notify$.enabled || + ($notify$.position !== $accountCenter$.position && + device.type !== 'mobile') || + separateMobileContainerCheck) && + $wallets$.length + + $: displayAccountCenterNotifySameContainer = + $notify$.enabled && + $accountCenter$.enabled && + $wallets$.length && + (sharedContainer || sharedMobileContainerCheck) -{#if $notifications$.length} +{#if notifications.length}
    - {#each $notifications$ as notification (notification.key)} + {#each notifications as notification (notification.key)}
  • + + + + + + + + + + + + + + + + + + + + + + +` diff --git a/packages/injected/src/types.ts b/packages/injected/src/types.ts index ede008038..b4a5b904a 100644 --- a/packages/injected/src/types.ts +++ b/packages/injected/src/types.ts @@ -40,7 +40,8 @@ export enum ProviderIdentityFlag { OneInch = 'isOneInchIOSWallet', Tokenary = 'isTokenary', Tally = 'isTally', - BraveWallet = 'isBraveWallet' + BraveWallet = 'isBraveWallet', + Rabby = 'isRabby' } export enum ProviderLabel { @@ -72,7 +73,8 @@ export enum ProviderLabel { XDEFI = 'XDEFI Wallet', OneInch = '1inch Wallet', Tokenary = 'Tokenary Wallet', - Tally = 'Tally Wallet' + Tally = 'Tally Wallet', + Rabby = 'Rabby' } export interface MeetOneProvider extends ExternalProvider { diff --git a/packages/injected/src/wallets.ts b/packages/injected/src/wallets.ts index da4f25a89..b1cb30053 100644 --- a/packages/injected/src/wallets.ts +++ b/packages/injected/src/wallets.ts @@ -473,6 +473,18 @@ const tally: InjectedWalletModule = { platforms: ['desktop'] } +const rabby: InjectedWalletModule = { + label: ProviderLabel.Rabby, + injectedNamespace: InjectedNameSpace.Ethereum, + checkProviderIdentity: ({ provider }) => + !!provider && !!provider[ProviderIdentityFlag.Rabby], + getIcon: async () => (await import('./icons/rabby.js')).default, + getInterface: async () => ({ + provider: createEIP1193Provider(window.ethereum) + }), + platforms: ['desktop'] +} + const wallets = [ exodus, metamask, @@ -500,7 +512,8 @@ const wallets = [ xdefi, oneInch, tokenary, - tally + tally, + rabby ] export default wallets diff --git a/packages/keepkey/package.json b/packages/keepkey/package.json index 41c931e1d..12acda501 100644 --- a/packages/keepkey/package.json +++ b/packages/keepkey/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/keepkey", - "version": "2.1.3", + "version": "2.1.4", "description": "KeepKey module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -27,7 +28,7 @@ "@ethersproject/providers": "^5.5.0", "@shapeshiftoss/hdwallet-core": "^1.15.2", "@shapeshiftoss/hdwallet-keepkey-webusb": "^1.15.2", - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "ethereumjs-util": "^7.1.3" } } diff --git a/packages/keystone/package.json b/packages/keystone/package.json index 400e535f0..ea6144e24 100644 --- a/packages/keystone/package.json +++ b/packages/keystone/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/keystone", - "version": "2.1.4", + "version": "2.1.5", "description": "Keystone module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "typings": "dist/index.d.ts", "files": [ @@ -21,6 +22,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.3" + "@web3-onboard/common": "^2.1.4" } } diff --git a/packages/ledger/package.json b/packages/ledger/package.json index 43a0e391f..05235e616 100644 --- a/packages/ledger/package.json +++ b/packages/ledger/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/ledger", - "version": "2.1.3", + "version": "2.1.4", "description": "Ledger module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -27,7 +28,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.3", + "@web3-onboard/common": "^2.1.4", "buffer": "^6.0.3", "ethereumjs-util": "^7.1.3" } diff --git a/packages/magic/package.json b/packages/magic/package.json index 04013b4bf..ce2010766 100644 --- a/packages/magic/package.json +++ b/packages/magic/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/magic", - "version": "2.0.6", + "version": "2.0.7", "description": "Magic module for Onboard.js", + "repository": "blocknative/web3-onboard", "scripts": { "build": "rollup -c", "dev": "rollup -c -w", @@ -42,7 +43,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "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 1a361327e..aeed67174 100644 --- a/packages/mew/package.json +++ b/packages/mew/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/mew", - "version": "2.0.3", + "version": "2.0.4", "description": "MEW module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -23,7 +24,7 @@ "@myetherwallet/mewconnect-web-client": "^2.2.0-beta.14" }, "dependencies": { - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "rxjs": "^7.5.2" } } diff --git a/packages/mew/src/index.ts b/packages/mew/src/index.ts index 15313dd6c..abc930e9b 100644 --- a/packages/mew/src/index.ts +++ b/packages/mew/src/index.ts @@ -46,7 +46,9 @@ function mew(): WalletInit { firstValueFrom(closed$) ]) }, - eth_selectAccounts: null + eth_selectAccounts: null, + wallet_addEthereumChain: null, + wallet_switchEthereumChain: null }) const events = new EventEmitter() diff --git a/packages/portis/package.json b/packages/portis/package.json index 743a9a026..5cff6e448 100644 --- a/packages/portis/package.json +++ b/packages/portis/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/portis", - "version": "2.0.3", + "version": "2.0.4", "description": "Portis module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -21,6 +22,6 @@ }, "dependencies": { "@portis/web3": "^4.0.6", - "@web3-onboard/common": "^2.1.3" + "@web3-onboard/common": "^2.1.4" } } diff --git a/packages/react/package.json b/packages/react/package.json index af3b37a8e..57cd12bd7 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/react", - "version": "2.2.1", + "version": "2.2.2", "description": "Collection of React Hooks for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -23,8 +24,8 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/core": "^2.3.1", - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/core": "^2.3.2", + "@web3-onboard/common": "^2.1.4", "use-sync-external-store": "1.0.0" }, "peerDependencies": { diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index ea2a80e86..8de00de28 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -51,7 +51,8 @@ const useAppState: { return stateKey ? snapshot[stateKey] : snapshot }, [stateKey]) - return useSyncExternalStore(subscribe, getSnapshot) + const getServerSnapshot = () => get() || getSnapshot; + return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); } export const useConnectWallet = (): [ diff --git a/packages/torus/package.json b/packages/torus/package.json index e560a9b83..52deded3c 100644 --- a/packages/torus/package.json +++ b/packages/torus/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/torus", - "version": "2.0.4", + "version": "2.0.5", "description": "Torus module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -21,6 +22,6 @@ }, "dependencies": { "@toruslabs/torus-embed": "^1.18.3", - "@web3-onboard/common": "^2.1.3" + "@web3-onboard/common": "^2.1.4" } } diff --git a/packages/trezor/package.json b/packages/trezor/package.json index 26a7dc084..f02f2c602 100644 --- a/packages/trezor/package.json +++ b/packages/trezor/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/trezor", - "version": "2.1.3", + "version": "2.1.4", "description": "Trezor module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -22,7 +23,7 @@ "dependencies": { "@ethereumjs/tx": "^3.4.0", "@ethersproject/providers": "^5.5.0", - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "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 401103274..d77b24f17 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/vue", - "version": "2.1.1", + "version": "2.1.2", "description": "Vue Composable for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -23,8 +24,8 @@ "dependencies": { "@vueuse/core": "^8.4.2", "@vueuse/rxjs": "^8.2.0", - "@web3-onboard/common": "^2.1.3", - "@web3-onboard/core": "^2.3.1", + "@web3-onboard/common": "^2.1.4", + "@web3-onboard/core": "^2.3.2", "vue-demi": "^0.12.4" }, "peerDependencies": { diff --git a/packages/walletconnect/package.json b/packages/walletconnect/package.json index e9fc63938..0230c975b 100644 --- a/packages/walletconnect/package.json +++ b/packages/walletconnect/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/walletconnect", - "version": "2.0.4", + "version": "2.0.5", "description": "WalletConnect module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -23,7 +24,7 @@ "@ethersproject/providers": "^5.5.0", "@walletconnect/client": "^1.7.1", "@walletconnect/qrcode-modal": "^1.7.1", - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "rxjs": "^7.5.2" } } diff --git a/packages/walletlink/package.json b/packages/walletlink/package.json index 78bb252e1..7659e362c 100644 --- a/packages/walletlink/package.json +++ b/packages/walletlink/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/walletlink", - "version": "2.0.3", + "version": "2.0.4", "description": "WalletLink module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -20,7 +21,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "walletlink": "^2.5.0" } } diff --git a/packages/web3auth/package.json b/packages/web3auth/package.json index 005e11422..a68b79b2f 100644 --- a/packages/web3auth/package.json +++ b/packages/web3auth/package.json @@ -1,7 +1,8 @@ { "name": "@web3-onboard/web3auth", - "version": "2.0.2", + "version": "2.0.3", "description": "Web3Auth module for web3-onboard", + "repository": "blocknative/web3-onboard", "module": "dist/index.js", "browser": "dist/index.js", "main": "dist/index.js", @@ -20,7 +21,7 @@ "typescript": "^4.5.5" }, "dependencies": { - "@web3-onboard/common": "^2.1.3", + "@web3-onboard/common": "^2.1.4", "@web3auth/web3auth": "^1.0.0" } }