Skip to content

Commit 6f39e6f

Browse files
committed
Merge in develop and test publishing
2 parents f770671 + 92c235d commit 6f39e6f

File tree

16 files changed

+125
-80
lines changed

16 files changed

+125
-80
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ aliases:
3434
| head -1 \
3535
| awk -F: '{ print $2 }' \
3636
| sed 's/[",]//g');
37-
if [[ $PACKAGE_VERSION =~ "alpha" ]];
37+
if [[ $PACKAGE_VERSION =~ "-alpha" ]];
3838
then
3939
echo true
4040
else

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ If you would like to test out the current functionality of V2 in a small browser
8888

8989
- Clone the repo: `git clone git@github.com:blocknative/onboard.git`
9090
- Change in to the onboard directory: `cd onboard`
91-
- Checkout the V2 feature branch: `git checkout v2-web-onboard`
91+
- Checkout the V2 feature branch: `git checkout v2-web3-onboard`
9292
- Install the dependencies: `yarn` (if running a M1 mac - `yarn install-m1-mac`)
9393
- Run all packages in dev mode: `yarn dev`
9494
- [View demo app in the browser](http://localhost:8080)

packages/coinbase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/coinbase",
3-
"version": "2.0.0",
3+
"version": "2.0.2",
44
"description": "Coinbase Wallet module for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",

packages/coinbase/src/index.ts

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,57 @@
11
import { WalletInit } from '@web3-onboard/common'
22

3-
function coinbaseWallet(options?: { darkMode?: boolean }): WalletInit {
4-
const { darkMode = false } = options || {}
5-
6-
return () => {
7-
return {
8-
label: 'Coinbase',
9-
getIcon: async () => (await import('./icon.js')).default,
10-
getInterface: async ({ chains, appMetadata }) => {
11-
const [chain] = chains
12-
const { name, icon } = appMetadata || {}
13-
14-
const { CoinbaseWalletSDK } = await import('@coinbase/wallet-sdk')
15-
16-
const base64 = window.btoa(icon || '')
17-
const appLogoUrl = `data:image/svg+xml;base64,${base64}`
18-
19-
const instance = new CoinbaseWalletSDK({
20-
appName: name || '',
21-
appLogoUrl,
22-
darkMode
23-
})
24-
25-
const coinbaseWalletProvider = instance.makeWeb3Provider(
26-
chain.rpcUrl,
27-
parseInt(chain.id)
28-
)
29-
30-
// patch the chainChanged event
31-
const on = coinbaseWalletProvider.on.bind(coinbaseWalletProvider)
32-
coinbaseWalletProvider.on = (event, listener) => {
33-
on(event, val => {
34-
if (event === 'chainChanged') {
35-
listener(`0x${(val as number).toString(16)}`)
36-
return
3+
function coinbaseWallet({
4+
darkMode = false
5+
}: {
6+
darkMode?: boolean
7+
} = {}): WalletInit {
8+
return ({ device }) =>
9+
device.type === 'mobile'
10+
? {
11+
label: 'Coinbase',
12+
getIcon: async () => (await import('./icon.js')).default,
13+
getInterface: async ({ chains, appMetadata }) => {
14+
const [chain] = chains
15+
const { name, icon } = appMetadata || {}
16+
17+
const { CoinbaseWalletSDK } = await import('@coinbase/wallet-sdk')
18+
19+
const base64 = window.btoa(icon || '')
20+
const appLogoUrl = `data:image/svg+xml;base64,${base64}`
21+
22+
const instance = new CoinbaseWalletSDK({
23+
appName: name || '',
24+
appLogoUrl,
25+
darkMode
26+
})
27+
28+
const coinbaseWalletProvider = instance.makeWeb3Provider(
29+
chain.rpcUrl,
30+
parseInt(chain.id)
31+
)
32+
33+
// patch the chainChanged event
34+
const on = coinbaseWalletProvider.on.bind(coinbaseWalletProvider)
35+
coinbaseWalletProvider.on = (event, listener) => {
36+
on(event, val => {
37+
if (event === 'chainChanged') {
38+
listener(`0x${(val as number).toString(16)}`)
39+
return
40+
}
41+
42+
listener(val)
43+
})
44+
45+
return coinbaseWalletProvider
3746
}
3847

39-
listener(val)
40-
})
41-
42-
return coinbaseWalletProvider
43-
}
44-
45-
return {
46-
provider: coinbaseWalletProvider,
47-
instance
48+
return {
49+
provider: coinbaseWalletProvider,
50+
instance
51+
}
52+
}
4853
}
49-
}
50-
}
51-
}
54+
: null
5255
}
5356

5457
export default coinbaseWallet

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/common",
3-
"version": "2.0.7-alpha.0.0.1",
3+
"version": "2.0.9-alpha",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.2.6",
3+
"version": "2.2.8",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/core/src/validation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ const balance = Joi.any().allow(
4747
null
4848
)
4949

50-
const account = {
50+
const account = Joi.object({
5151
address: Joi.string().required(),
5252
ens,
5353
balance
54-
}
54+
})
5555

5656
const chains = Joi.array().items(chain)
5757
const accounts = Joi.array().items(account)

packages/core/src/views/account-center/Index.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { onDestroy } from 'svelte'
3+
import { state } from '../../store'
34
import { updateAccountCenter } from '../../store/actions'
45
import type { AccountCenter } from '../../types'
56
import Maximized from './Maximized.svelte'
@@ -17,7 +18,10 @@
1718
onDestroy(minimize)
1819
1920
function minimize() {
20-
updateAccountCenter({ expanded: false })
21+
const { accountCenter } = state.get()
22+
if (accountCenter.expanded) {
23+
updateAccountCenter({ expanded: false })
24+
}
2125
}
2226
</script>
2327

packages/core/src/views/shared/Modal.svelte

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,32 @@
1515

1616
<script lang="ts">
1717
import { fade } from 'svelte/transition'
18+
import { onDestroy, onMount } from 'svelte'
1819
20+
const body = document.body
21+
onMount(() => {
22+
window.addEventListener(
23+
'scroll',
24+
() => {
25+
document.documentElement.style.setProperty(
26+
'--scroll-y',
27+
`${window.scrollY}px`
28+
)
29+
},
30+
{ passive: true }
31+
)
32+
const scrollY =
33+
document.documentElement.style.getPropertyValue('--scroll-y')
34+
body.style.position = 'fixed'
35+
body.style.top = `-${scrollY}`
36+
})
37+
38+
onDestroy(() => {
39+
const scrollY = body.style.top
40+
body.style.position = ''
41+
body.style.top = ''
42+
window.scrollTo(0, parseInt(scrollY || '0') * -1)
43+
})
1944
export let close: () => void
2045
</script>
2146

@@ -48,7 +73,7 @@
4873
.modal-overflow {
4974
overflow: hidden;
5075
}
51-
76+
5277
.modal-styling {
5378
border-radius: var(--onboard-modal-border-radius, var(--border-radius-1));
5479
box-shadow: var(--onboard-modal-box-shadow, var(--box-shadow-0));

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"webpack-dev-server": "4.7.4"
2323
},
2424
"dependencies": {
25-
"@web3-onboard/core": "^2.2.3",
25+
"@web3-onboard/core": "^2.2.7",
2626
"@web3-onboard/fortmatic": "^2.0.2",
2727
"@web3-onboard/gnosis": "^2.0.1",
2828
"@web3-onboard/injected-wallets": "^2.0.5",

0 commit comments

Comments
 (0)