Skip to content

Commit ec31bae

Browse files
authored
Merge pull request #1023 from blocknative/release/alpha-5_26_2022
[Coinbase, Common, Core, Injected-Wallets, Keepkey, Keystone, Ledger, React, Trezor, Vue] Release - Master
2 parents 300e410 + 987589c commit ec31bae

Some content is hidden

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

52 files changed

+1424
-314
lines changed

.circleci/config.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ aliases:
2525
branches:
2626
only: v2-web3-onboard-develop
2727

28-
- &test_package_version_for_alpha_tag
28+
- &test_package_version_for_alpha_tag_break_false
2929
run:
30-
name: Tagged as Alpha version
30+
name: Tagged as Alpha version if True Continue Flow
3131
command: |
3232
PACKAGE_VERSION=$(cat package.json \
3333
| grep version \
@@ -42,6 +42,23 @@ aliases:
4242
circleci step halt
4343
fi;
4444
45+
- &test_package_version_for_alpha_tag_break_true
46+
run:
47+
name: Tagged as Alpha version if True Stop Flow
48+
command: |
49+
PACKAGE_VERSION=$(cat package.json \
50+
| grep version \
51+
| head -1 \
52+
| awk -F: '{ print $2 }' \
53+
| sed 's/[",]//g');
54+
if [[ $PACKAGE_VERSION =~ "-alpha" ]];
55+
then
56+
echo true
57+
circleci step halt
58+
else
59+
echo false
60+
fi;
61+
4562
- &restore-build-flag
4663
restore_cache:
4764
keys:
@@ -107,6 +124,7 @@ commands:
107124
path: ~/web3-onboard-monorepo
108125
- *restore-build-flag
109126
- *test-build-flag
127+
- *test_package_version_for_alpha_tag_break_true
110128
# Services and packages in a Workspace don't get their own
111129
# yarn.lock so we need to generate them manually.
112130
- *generate-lock-file
@@ -130,7 +148,7 @@ commands:
130148
path: ~/web3-onboard-monorepo
131149
- *restore-build-flag
132150
- *test-build-flag
133-
- *test_package_version_for_alpha_tag
151+
- *test_package_version_for_alpha_tag_break_false
134152
# Services and packages in a Workspace don't get their own
135153
# yarn.lock so we need to generate them manually.
136154
- *generate-lock-file

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ For full documentation, check out the README.md for each package:
8181
**Frameworks**
8282

8383
- [React](packages/react/README.md)
84+
- [Vue](packages/vue/README.md)
8485

8586
## Test out the demo app
8687

packages/coinbase/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/coinbase",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "Coinbase Wallet module for web3-onboard",
55
"module": "dist/index.js",
66
"browser": "dist/index.js",
@@ -20,7 +20,7 @@
2020
"typescript": "^4.5.5"
2121
},
2222
"dependencies": {
23-
"@web3-onboard/common": "^2.0.7",
24-
"@coinbase/wallet-sdk": "^3.0.5"
23+
"@coinbase/wallet-sdk": "^3.0.5",
24+
"@web3-onboard/common": "2.1.0"
2525
}
2626
}

packages/coinbase/src/index.ts

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,52 @@ function coinbaseWallet({
55
}: {
66
darkMode?: boolean
77
} = {}): 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
8+
return () => {
9+
return {
10+
label: 'Coinbase Wallet',
11+
getIcon: async () => (await import('./icon.js')).default,
12+
getInterface: async ({ chains, appMetadata }) => {
13+
const [chain] = chains
14+
const { name, icon } = appMetadata || {}
15+
16+
const { CoinbaseWalletSDK } = await import('@coinbase/wallet-sdk')
17+
18+
const base64 = window.btoa(icon || '')
19+
const appLogoUrl = `data:image/svg+xml;base64,${base64}`
20+
21+
const instance = new CoinbaseWalletSDK({
22+
appName: name || '',
23+
appLogoUrl,
24+
darkMode
25+
})
26+
27+
const coinbaseWalletProvider = instance.makeWeb3Provider(
28+
chain.rpcUrl,
29+
parseInt(chain.id)
30+
)
31+
32+
// patch the chainChanged event
33+
const on = coinbaseWalletProvider.on.bind(coinbaseWalletProvider)
34+
coinbaseWalletProvider.on = (event, listener) => {
35+
on(event, val => {
36+
if (event === 'chainChanged') {
37+
listener(`0x${(val as number).toString(16)}`)
38+
return
4639
}
4740

48-
return {
49-
provider: coinbaseWalletProvider,
50-
instance
51-
}
52-
}
41+
listener(val)
42+
})
43+
44+
return coinbaseWalletProvider
45+
}
46+
47+
return {
48+
provider: coinbaseWalletProvider,
49+
instance
5350
}
54-
: null
51+
}
52+
}
53+
}
5554
}
5655

5756
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.9",
3+
"version": "2.1.0",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/common/src/elements/TableHeader.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
export let loadingAccounts: boolean
66
export let showEmptyAddresses: boolean
77
export let errorFromScan: string
8-
9-
const filterEmptyAccounts = () => {
10-
showEmptyAddresses = !showEmptyAddresses
11-
}
128
</script>
139

1410
<style>
@@ -176,7 +172,7 @@
176172
<input
177173
id="show-empty-addresses"
178174
type="checkbox"
179-
on:change={filterEmptyAccounts}
175+
bind:checked={showEmptyAddresses}
180176
class="checkbox-input"
181177
/>
182178
<label for="show-empty-addresses" class="ml2 cursor-pointer font-5"

packages/common/src/hdwallets.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type Common from '@ethereumjs/common'
2+
import type { BigNumber } from 'ethers'
23
import type { CustomNetwork } from './types'
4+
import type { TransactionRequest } from '@ethersproject/providers'
35

46
/**
57
* Creates the common instance used for signing
@@ -35,3 +37,43 @@ export const getCommon = async ({
3537
}
3638
return common
3739
}
40+
41+
type StringifiedTransactionRequest = Omit<
42+
TransactionRequest,
43+
| 'nonce'
44+
| 'gasLimit'
45+
| 'gasPrice'
46+
| 'value'
47+
| 'maxPriorityFeePerGas'
48+
| 'maxFeePerGas'
49+
> & {
50+
nonce: string
51+
gasLimit: string
52+
gasPrice?: string
53+
value: string
54+
maxPriorityFeePerGas?: string
55+
maxFeePerGas?: string
56+
}
57+
58+
/**
59+
* Takes in TransactionRequest and converts all BigNumber values to strings
60+
* @param transaction
61+
* @returns a transaction where all BigNumber properties are now strings
62+
*/
63+
export const bigNumberFieldsToStrings = (
64+
transaction: TransactionRequest
65+
): StringifiedTransactionRequest =>
66+
Object.keys(transaction).reduce(
67+
(transaction, txnProperty) => ({
68+
...transaction,
69+
...((transaction[txnProperty as keyof TransactionRequest] as BigNumber)
70+
.toHexString
71+
? {
72+
[txnProperty]: (
73+
transaction[txnProperty as keyof TransactionRequest] as BigNumber
74+
).toHexString()
75+
}
76+
: {})
77+
}),
78+
transaction
79+
) as StringifiedTransactionRequest

packages/common/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export { createEIP1193Provider } from './eip-1193'
6262
export { default as accountSelect } from './account-select'
6363
export { entryModal } from './entry-modal'
6464
export { SofiaProLight, SofiaProRegular, SofiaProSemiBold } from './fonts'
65-
export { getCommon } from './hdwallets'
65+
export { getCommon, bigNumberFieldsToStrings } from './hdwallets'
6666

6767
export type {
6868
RequestPatch,

packages/common/src/views/AccountSelect.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
let accountsListObject: AccountsList | undefined
2828
let accountSelected: Account | undefined
2929
let customDerivationPath = false
30-
let showEmptyAddresses = false
30+
let showEmptyAddresses = true
3131
let loadingAccounts = false
3232
let errorFromScan = ''
3333
@@ -86,7 +86,7 @@
8686
const resetModal = () => {
8787
accountSelected = undefined
8888
accountsListObject = undefined
89-
showEmptyAddresses = false
89+
showEmptyAddresses = true
9090
scanAccountOptions.derivationPath =
9191
(basePaths[0] && basePaths[0].value) || ''
9292
}

packages/core/README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Install the core module:
1010

1111
If you would like to support all wallets, then you can install all of the wallet modules:
1212

13-
`npm i @web3-onboard/injected-wallets @web3-onboard/ledger @web3-onboard/trezor @web3-onboard/keepkey @web3-onboard/walletconnect @web3-onboard/walletlink @web3-onboard/torus @web3-onboard/portis @web3-onboard/mew @web3-onboard/gnosis @web3-onboard/magic @web3-onboard/fortmatic`
13+
`npm i @web3-onboard/injected-wallets @web3-onboard/coinbase @web3-onboard/ledger @web3-onboard/trezor @web3-onboard/keepkey @web3-onboard/walletconnect @web3-onboard/torus @web3-onboard/portis @web3-onboard/mew @web3-onboard/gnosis @web3-onboard/magic @web3-onboard/fortmatic`
1414

1515
Note:
1616

@@ -92,20 +92,19 @@ To see a list of all of the text values that can be internationalized or replace
9292
Onboard is using the [ICU syntax](https://formatjs.io/docs/core-concepts/icu-syntax/) for formatting under the hood.
9393
9494
**`accountCenter`**
95-
An object that defines whether the account center UI is enabled and it's position on the screen. Currently the account center is disabled for mobile devices, so only desktop options are available.
95+
An object that defines whether the account center UI (default and minimal) is enabled and it's position on the screen. Currently the account center is enabled for both desktop and mobile devices.
9696
9797
```typescript
98-
type AccountCenterOptions = {
99-
desktop: {
100-
position?: AccountCenterPosition // default: 'topRight'
101-
enabled?: AccountCenter['enabled'] // default: true
102-
}
98+
export type AccountCenter = {
99+
enabled: boolean
100+
position?: AccountCenterPosition // default: 'topRight'
101+
expanded?: boolean // default: true
102+
minimal?: boolean // enabled by default for mobile
103103
}
104104

105-
type AccountCenter = {
106-
enabled: boolean
107-
position: AccountCenterPosition
108-
expanded: boolean
105+
export type AccountCenterOptions = {
106+
desktop: Omit<AccountCenter, 'expanded'>
107+
mobile: Omit<AccountCenter, 'expanded'>
109108
}
110109

111110
type AccountCenterPosition =
@@ -174,7 +173,19 @@ const onboard = Onboard({
174173
{ name: 'MetaMask', url: 'https://metamask.io' },
175174
{ name: 'Coinbase', url: 'https://wallet.coinbase.com/' }
176175
]
177-
}
176+
},
177+
accountCenter: {
178+
desktop: {
179+
position: 'topRight',
180+
enabled: true,
181+
minimal: true
182+
},
183+
mobile: {
184+
position: 'topRight',
185+
enabled: true,
186+
minimal: true
187+
}
188+
},
178189
i18n: {
179190
en: {
180191
connect: {
@@ -316,6 +327,7 @@ type AccountCenter = {
316327
enabled: boolean
317328
position: AccountCenterPosition
318329
expanded: boolean
330+
minimal: boolean
319331
}
320332

321333
type AccountCenterPosition =
@@ -496,6 +508,9 @@ The Onboard styles can customized via [CSS variables](https://developer.mozilla.
496508
--onboard-modal-backdrop
497509
--onboard-modal-box-shadow
498510

511+
/* CUSTOMIZE THE ACTION REQUIRED MODAL */
512+
--onboard-action-required-modal-background
513+
499514
/* FONTS */
500515
--onboard-font-family-normal: Sofia Pro;
501516
--onboard-font-family-semibold: Sofia Pro Semibold;
@@ -516,8 +531,10 @@ The Onboard styles can customized via [CSS variables](https://developer.mozilla.
516531
--onboard-spacing-4: 1rem;
517532
--onboard-spacing-5: 0.5rem;
518533

519-
/* SHADOWS */
534+
/* BORDER RADIUS */
520535
--onboard-border-radius-1: 24px;
536+
--onboard-border-radius-2: 20px;
537+
--onboard-border-radius-3: 16px;
521538

522539
/* SHADOWS */
523540
--onboard-shadow-0: none;

0 commit comments

Comments
 (0)