Skip to content

Commit 81f52fb

Browse files
authored
Merge pull request #154 from blocknative/develop
Release 1.1.9
2 parents 4e67ae5 + 3588349 commit 81f52fb

20 files changed

+170
-165
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"description": "Onboard users to web3 by allowing them to select a wallet, get that wallet ready to transact and have access to synced wallet state.",
55
"keywords": [
66
"ethereum",

src/components/Modal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
background: #ffffff;
3939
border-radius: 10px;
4040
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.1);
41-
font-family: 'Helvetica Neue';
41+
font-family: inherit;
4242
font-size: inherit;
4343
padding: 1.33em;
4444
position: relative;

src/interfaces.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export interface WalletModule {
8282
preferred?: boolean
8383
desktop?: boolean
8484
mobile?: boolean
85+
osExclusions?: Array<string>
8586
}
8687

8788
export interface Helpers {
@@ -121,11 +122,17 @@ export interface SdkWalletOptions {
121122
apiKey: string
122123
networkId: number
123124
preferred?: boolean
125+
label?: string
126+
iconSrc?: string
127+
svg?: string
124128
}
125129

126130
export interface WalletConnectOptions {
127131
infuraKey: string
128132
preferred?: boolean
133+
label?: string
134+
iconSrc?: string
135+
svg?: string
129136
}
130137

131138
export interface WalletInit {
@@ -134,6 +141,9 @@ export interface WalletInit {
134141
apiKey?: string
135142
infuraKey?: string
136143
networkId?: number
144+
label?: string
145+
iconSrc?: string
146+
svg?: string
137147
}
138148

139149
export interface WalletCheckInit {
@@ -200,6 +210,7 @@ export interface AppState {
200210
networkId: number
201211
version: string
202212
mobileDevice: boolean
213+
os: string
203214
darkMode: boolean
204215
autoSelectWallet: string
205216
walletSelectInProgress: boolean

src/modules/select/wallets/authereum.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
import authereumIcon from '../wallet-icons/authereum.png'
22
import { networkName } from '../../../utilities'
33
import { WalletModule } from '../../../interfaces'
4-
import { validateType } from '../../../validation'
54

65
function authereum(options: {
76
networkId: number
87
preferred?: boolean
8+
label?: string
9+
iconSrc?: string
10+
svg?: string
911
}): WalletModule {
10-
validateType({ name: 'Authereum Options', value: options, type: 'object' })
11-
12-
const { networkId, preferred } = options
13-
14-
validateType({ name: 'networkId', value: networkId, type: 'number' })
15-
validateType({
16-
name: 'preferred',
17-
value: preferred,
18-
type: 'boolean',
19-
optional: true
20-
})
12+
const { networkId, preferred, label, iconSrc, svg } = options
2113

2214
return {
23-
name: 'Authereum',
24-
iconSrc: authereumIcon,
15+
name: label || 'Authereum',
16+
svg,
17+
iconSrc: iconSrc || authereumIcon,
2518
wallet: async () => {
2619
const { default: Authereum } = await import('authereum')
2720
const instance = new Authereum({

src/modules/select/wallets/coinbase.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import { mobileWalletInstallMessage } from '../content'
22
import { WalletModule, Helpers } from '../../../interfaces'
3-
import { validateType } from '../../../validation'
43

5-
function coinbase(options: { preferred?: boolean } = {}): WalletModule {
6-
const { preferred } = options
7-
validateType({
8-
name: 'preferred',
9-
value: preferred,
10-
type: 'boolean',
11-
optional: true
12-
})
4+
function coinbase(
5+
options: {
6+
preferred?: boolean
7+
label?: string
8+
iconSrc?: string
9+
svg?: string
10+
} = {}
11+
): WalletModule {
12+
const { preferred, label, iconSrc, svg } = options
1313

1414
return {
15-
name: 'Coinbase',
15+
name: label || 'Coinbase',
1616
iconSrc:
17+
iconSrc ||
1718
'https://cdn-images-1.medium.com/max/1200/1*7ywNS48PnonfsvvMu1tTsA.png',
19+
svg,
1820
wallet: async (helpers: Helpers) => {
1921
const { getProviderName, createLegacyProviderInterface } = helpers
2022
const provider =

src/modules/select/wallets/dapper.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { extensionInstallMessage } from '../content'
22
import { WalletModule, Helpers } from '../../../interfaces'
3-
import { validateType } from '../../../validation'
43

54
import dapperIcon from '../wallet-icons/icon-dapper.png'
65
import dapperIcon2x from '../wallet-icons/icon-dapper@2x.png'
76

8-
function dapper(options: { preferred?: boolean } = {}): WalletModule {
9-
const { preferred } = options
10-
11-
validateType({
12-
name: 'preferred',
13-
value: preferred,
14-
type: 'boolean',
15-
optional: true
16-
})
7+
function dapper(
8+
options: {
9+
preferred?: boolean
10+
label?: string
11+
iconSrc?: string
12+
svg?: string
13+
} = {}
14+
): WalletModule {
15+
const { preferred, label, iconSrc, svg } = options
1716

1817
return {
19-
name: 'Dapper',
20-
iconSrc: dapperIcon,
21-
iconSrcSet: dapperIcon2x,
18+
name: label || 'Dapper',
19+
iconSrc: iconSrc || dapperIcon,
20+
iconSrcSet: iconSrc || dapperIcon2x,
21+
svg,
2222
wallet: async (helpers: Helpers) => {
2323
const { createModernProviderInterface, getProviderName } = helpers
2424
const provider = (window as any).ethereum

src/modules/select/wallets/fortmatic.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { networkName } from '../../../utilities'
2-
import { validateType } from '../../../validation'
32
import { SdkWalletOptions, WalletModule, Helpers } from '../../../interfaces'
43

54
const fortmaticIcon = `
@@ -17,22 +16,12 @@ const fortmaticIcon = `
1716
`
1817

1918
function fortmatic(options: SdkWalletOptions): WalletModule {
20-
validateType({ name: 'Fortmatic options', value: options, type: 'object' })
21-
22-
const { apiKey, networkId, preferred } = options
23-
24-
validateType({ name: 'apiKey', value: apiKey, type: 'string' })
25-
validateType({ name: 'networkId', value: networkId, type: 'number' })
26-
validateType({
27-
name: 'preferred',
28-
value: preferred,
29-
type: 'boolean',
30-
optional: true
31-
})
19+
const { apiKey, networkId, preferred, label, iconSrc, svg } = options
3220

3321
return {
34-
name: 'Fortmatic',
35-
svg: fortmaticIcon,
22+
name: label || 'Fortmatic',
23+
svg: svg || fortmaticIcon,
24+
iconSrc,
3625
wallet: async (helpers: Helpers) => {
3726
const { default: Fortmatic } = await import('fortmatic')
3827

src/modules/select/wallets/metamask.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { extensionInstallMessage } from '../content'
22
import { WalletModule, Helpers } from '../../../interfaces'
3-
import { validateType } from '../../../validation'
43

54
import metamaskIcon from '../wallet-icons/icon-metamask.png'
65
import metamaskIcon2x from '../wallet-icons/icon-metamask@2x.png'
76

8-
function metamask(options: { preferred?: boolean } = {}): WalletModule {
9-
const { preferred } = options
10-
11-
validateType({
12-
name: 'preferred',
13-
value: preferred,
14-
type: 'boolean',
15-
optional: true
16-
})
7+
function metamask(
8+
options: {
9+
preferred?: boolean
10+
label?: string
11+
iconSrc?: string
12+
svg?: string
13+
} = {}
14+
): WalletModule {
15+
const { preferred, label, iconSrc, svg } = options
1716

1817
return {
19-
name: 'MetaMask',
20-
iconSrc: metamaskIcon,
21-
iconSrcSet: metamaskIcon2x,
18+
name: label || 'MetaMask',
19+
iconSrc: iconSrc || metamaskIcon,
20+
iconSrcSet: iconSrc || metamaskIcon2x,
21+
svg,
2222
wallet: async (helpers: Helpers) => {
2323
const {
2424
getProviderName,

src/modules/select/wallets/opera-touch.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { extensionInstallMessage } from '../content'
22
import { WalletModule, Helpers } from '../../../interfaces'
3-
import { validateType } from '../../../validation'
43

54
import operaTouchIcon from '../wallet-icons/icon-opera-touch.png'
65
import operaTouchIcon2x from '../wallet-icons/icon-opera-touch@2x.png'
76

8-
function operaTouch(options: { preferred?: boolean } = {}): WalletModule {
9-
const { preferred } = options
10-
11-
validateType({
12-
name: 'preferred',
13-
value: preferred,
14-
type: 'boolean',
15-
optional: true
16-
})
7+
function operaTouch(
8+
options: {
9+
preferred?: boolean
10+
label?: string
11+
iconSrc?: string
12+
svg?: string
13+
} = {}
14+
): WalletModule {
15+
const { preferred, label, iconSrc, svg } = options
1716

1817
return {
19-
name: 'Opera Touch',
20-
iconSrc: operaTouchIcon,
21-
iconSrcSet: operaTouchIcon2x,
18+
name: label || 'Opera Touch',
19+
iconSrc: iconSrc || operaTouchIcon,
20+
iconSrcSet: iconSrc || operaTouchIcon2x,
21+
svg,
2222
wallet: async (helpers: Helpers) => {
2323
const { getProviderName, createModernProviderInterface } = helpers
2424

@@ -37,7 +37,8 @@ function operaTouch(options: { preferred?: boolean } = {}): WalletModule {
3737
link: 'https://www.opera.com/mobile/touch',
3838
installMessage: extensionInstallMessage,
3939
mobile: true,
40-
preferred
40+
preferred,
41+
osExclusions: ['Android']
4142
}
4243
}
4344

src/modules/select/wallets/opera.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import { extensionInstallMessage } from '../content'
22
import { WalletModule, Helpers } from '../../../interfaces'
3-
import { validateType } from '../../../validation'
43

54
import operaIcon from '../wallet-icons/icon-opera.png'
65
import operaIcon2x from '../wallet-icons/icon-opera@2x.png'
76

8-
function opera(options: { preferred?: boolean } = {}): WalletModule {
9-
const { preferred } = options
10-
11-
validateType({
12-
name: 'preferred',
13-
value: preferred,
14-
type: 'boolean',
15-
optional: true
16-
})
7+
function opera(
8+
options: {
9+
preferred?: boolean
10+
label?: string
11+
iconSrc?: string
12+
svg?: string
13+
} = {}
14+
): WalletModule {
15+
const { preferred, label, iconSrc, svg } = options
1716

1817
return {
19-
name: 'Opera',
20-
iconSrc: operaIcon,
21-
iconSrcSet: operaIcon2x,
18+
name: label || 'Opera',
19+
iconSrc: iconSrc || operaIcon,
20+
iconSrcSet: iconSrc || operaIcon2x,
21+
svg,
2222
wallet: async (helpers: Helpers) => {
2323
const { getProviderName, createModernProviderInterface } = helpers
2424

@@ -37,7 +37,9 @@ function opera(options: { preferred?: boolean } = {}): WalletModule {
3737
link: 'https://www.opera.com/',
3838
installMessage: extensionInstallMessage,
3939
desktop: true,
40-
preferred
40+
mobile: true,
41+
preferred,
42+
osExclusions: ['iOS']
4143
}
4244
}
4345

src/modules/select/wallets/portis.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
import { networkName } from '../../../utilities'
2-
import { validateType } from '../../../validation'
32
import { SdkWalletOptions, WalletModule, Helpers } from '../../../interfaces'
43

54
const portisIcon = `
65
<svg height="40" viewBox="0 0 26 40" width="26" xmlns="http://www.w3.org/2000/svg"><g fill="none"><path d="m.38447675 22.9277905.93812327-.4094678 11.54391448-5.0174216 12.4724258 5.4268894-4.6829268 9.6753574-11.46701915 1.6205695-8.60843446-9.3004926z" fill="#133444"/><path d="m22.7456446 16.9549441c-2.0594671-2.4810138-4.9778453-4.095319-8.1739757-4.5214466l-.2037727-.0269133c-.9972573-.1211147-2.0055061-.1211147-3.0027634 0l-.2056951.024991c-3.19683486.4253443-6.11569177 2.0406007-8.17397573 4.5233689l-.51904361.861228-.86315031 1.4340982-.63054187 1.0496216c0 .024991-.02499099.0595939-.03460291.0845849v.0173014l1.38988346.8285474 8.84296527 5.2288838 1.7070768 1.0073291v-12.4954944l-1.7070768.7689535v-1.8647122l1.7070768-.7689535 1.7051544.7689535 8.6776402 3.9504986z" fill="#c42370"/><path d="m25.7234381 26.0324402c-.0248538 4.0988643-1.872927 7.97397-5.0424337 10.5731107-1.2054271.9911619-2.5812108 1.7546176-4.0600744 2.2530337-1.2073828.3962299-2.4702232.5974018-3.7409588.5959469-7.11281993 0-12.8799712-6.3227281-12.8799712-13.4220913.00397806-1.0496754.13304725-2.0951358.38447675-3.1142617l12.47242585 7.3800313 12.4743482-7.3800313c.2623236 1.017244.3941046 2.0637403.3921873 3.1142617z" fill="#1c4d6b"/><path d="m11.3651328 12.4161961 1.5013817.6747567-1.7070768.7747206v-1.5436741z" fill="#000"/><path d="m11.1594377 15.7438424 1.7070768-.7766431v12.4993392l-1.7070768-1.0073291z" fill="#000"/><path d="m12.8665145 14.9671993v12.4993392l11.9533822-7.0647603z" fill="#1d4259"/><path d="m12.8665145.56470023v14.40249907l11.9533822 5.4345789z" fill="#4b6b9a"/><path d="m12.8665145 14.9671993v12.4954944l-1.7070768-1.007329-10.22900396-6.0535865h-.01730146.02499099c0-.024991.02691338-.0595939.03460291-.0845849l1.49369218-2.4837198 8.69301934-3.9408867v1.8589451z" fill="#343535"/><path d="m12.8665145 14.9671993v12.4993392l-1.7070768-1.0073291-10.23861588-6.0478193-.00768954-.0096119.01730146-.0173014 10.22900396-4.6406344z" fill="#3e5578"/><path d="m12.8665145.56470023v14.40249907l-11.95338222 5.4345789z" fill="#6db2d8"/><g fill="#335f8a"><path d="m8.02787456 38.4298931c.18070408.0768953.35948577.1537907.53826746.2210741-.17878169-.0672834-.35756338-.1441788-.53826746-.2210741z"/><path d="m8.56614202 38.6509672c.17878169.0692058.36717529.1384116.55364652.1922384-.18647123-.0538268-.37486483-.1153431-.55364652-.1922384z"/><path d="m9.59077256 39.000841c.14417878.0442149.28066803.0768954.42484684.1114983-.13648928-.0346029-.28066806-.0768953-.42484684-.1114983z"/></g><path d="m.38447675 22.9277905 12.47242585 7.3800312c-.1695149 1.1206915-.4701886 2.2175699-.8958309 3.2680524-1.0034843 2.4222035-3.01045293 4.9751291-6.91865911 3.0277544-3.17007392-2.5978633-5.0183503-6.4726906-5.04241259-10.5711883.00728258-1.0462943.13630945-2.0881863.38447675-3.1046497z" fill="#6db2d8"/><path d="m20.6733149 36.6036285-.0346029.0269134c-.0672834.0499819-.1287997.1018863-.1922384.1537907l-.0173014.015379c-.0672835.0595939-.1441788.1114983-.2133846.1634027-.0758242.0613437-.1554406.1178457-.2383756.1691697-.0828404.0521651-.1624447.1093005-.2383756.1710922-.0768953.0595939-.1461012.0941968-.2133846.1461012l-.0442148.0249909c-.074973.0519044-.1518683.0941968-.2210742.1441788 0 0-.0173014 0-.0249909.0173015-.0768954.0519043-.1537907.0941968-.2306861.1461011-.0768953.0519044-.1710921.0941968-.255677.1441788s-.1710922.0941968-.2556771.1364893h-.0096119l-.255677.1268773c-.0845849.0422924-.1710922.0865073-.265289.1287997-.0941968.0422925-.1787817.0845849-.2633666.1191878-.1787816.0768954-.3594857.1537907-.5382674.2210741-.1787817.0672835-.3671753.1364893-.5536465.1922384-.0729076.0274308-.147369.0505395-.2229965.0692058l-.2460652.0768954c-.1461011.0422924-.2825904.0768953-.4267692.1114982-.0519043.0153791-.1114982.024991-.1634026.0422925l-.0922744.0173014-.2306861.049982c-.0768953.0173015-.1364892.0269134-.2133846.0422924-.0632285.0158437-.1274537.0274043-.1922383.034603-.0692058.0096119-.1461012.0269133-.2133846.0346029-.0346029 0-.0692058 0-.1018864.0173014l-.1634026.0173015h-.0845849c-.0590384.0105165-.1188222.016302-.1787817.0173014-.0738847.010539-.1483704.0163181-.2229965.0173015-.0595939 0-.1095758 0-.1710921 0s-.1018864.0096119-.1518683.0096119c-.0595939 0-.1191878 0-.1710922 0s-.1614802 0-.2383756 0h-.5113541c-.0800209.0050111-.160277.0050111-.2402979 0-.0595939 0-.1191878 0-.1787817 0-.0519044 0-.1018864-.0096119-.1537907-.0096119-.0519044 0-.1114983 0-.1710922 0-.0733428-.0095846-.1471332-.0153595-.2210741-.0173015-.0595939 0-.1191878 0-.1787817-.0173014h-.0865073c-.0532121-.0105119-.1072489-.0163015-.1614802-.0173015-.0345121-.0018508-.0686979-.0076559-.1018863-.0173014-.0718302-.0066855-.1431228-.0182465-.2133846-.0346029-.0692059 0-.1287997-.024991-.1922384-.034603-.0718469-.0101919-.1430817-.0243105-.2133846-.0422924-.0692058-.0173014-.1537907-.0326805-.2306861-.049982l-.0941968-.0173014c-.0593497-.0042617-.1184021-.0119642-.17685927-.0230686-.14610116-.0346029-.29027995-.0768954-.42676919-.1114983l-.25567704-.0768953c-.07689535-.024991-.1537907-.0422925-.22299652-.0692059-.19223837-.0595938-.3671753-.1268773-.55364652-.1922383-.18647122-.0653611-.3671753-.1441788-.53826745-.2210742-.08458489-.0422924-.17878169-.0768953-.26528896-.1191878l-.26336657-.1287997-.25567704-.1268773c-.08458489-.0422924-.16916977-.0941968-.25567704-.1364892-.08650727-.0422925-.17109216-.0941968-.25567704-.1441788-.08458489-.049982-.1537907-.0941968-.23068605-.1461012l-.02499099-.0173014c-.07756662-.0428621-.1520765-.0910366-.22299652-.1441788l-.04229244-.024991c-.06728343-.0422925-.14417878-.0941968-.2133846-.1461012-.06920581-.0519043-.16148023-.1095759-.23837558-.1710921-.07689535-.0615163-.16148024-.1095759-.23837559-.1691698l-.2133846-.1634026-.01730145-.0153791c-.06920582-.0519044-.12879971-.1038087-.19223838-.1537907l-.0346029-.0269134c3.89859425 1.9454524 5.92094194-.6132404 6.92058154-3.0200648.4259299-1.0505261.7272373-2.1473626.8977532-3.2680524.1691803 1.1238755.4698526 2.2239751.8958308 3.2776643 1.0111739 2.3779887 3.0258321 4.9386038 6.9244263 2.9912291z" fill="#529bba"/><path d="m15.7077977 39.1123393c.1441788-.0346029.2902799-.0768953.4267692-.1114983-.1364893.034603-.2825904.0768954-.4267692.1114983z" fill="#335f8a"/><path d="m16.611318 38.8489727c.1922384-.0595939.3671753-.1287997.5555689-.1922383-.180704.0711281-.3671753.1326444-.5555689.1922383z" fill="#335f8a"/><path d="m17.1668869 38.6509672c.1787817-.0672834.3575634-.1441788.5363451-.2210741-.1787817.0768953-.3575634.1537907-.5363451.2210741z" fill="#335f8a"/><path d="m25.723417 26.0324402c-.0248327 4.0988643-1.8729059 7.97397-5.0424126 10.5731107-3.8985942 1.9454523-5.9209419-.6151628-6.9205815-3.0200649-.4250714-1.0506755-.7257265-2.1474858-.8958308-3.2680524l12.4724258-7.3800312c.2564764 1.0116964.3862701 2.0513377.3863991 3.0950378z" fill="#4b6b9a"/></g></svg>
76
`
87

98
function portis(options: SdkWalletOptions): WalletModule {
10-
validateType({ name: 'Portis options', value: options, type: 'object' })
11-
12-
const { apiKey, networkId, preferred } = options
13-
14-
validateType({ name: 'apiKey', value: apiKey, type: 'string' })
15-
validateType({ name: 'networkId', value: networkId, type: 'number' })
16-
validateType({
17-
name: 'preferred',
18-
value: preferred,
19-
type: 'boolean',
20-
optional: true
21-
})
9+
const { apiKey, networkId, preferred, label, iconSrc, svg } = options
2210

2311
return {
24-
name: 'Portis',
25-
svg: portisIcon,
12+
name: label || 'Portis',
13+
iconSrc,
14+
svg: svg || portisIcon,
2615
wallet: async (helpers: Helpers) => {
2716
const { default: Portis } = await import('@portis/web3')
2817
const instance = new Portis(apiKey, networkName(networkId))

0 commit comments

Comments
 (0)