Skip to content

Commit 5f3222a

Browse files
authored
Release 1.9.0 (#346)
* Update SDK * Update trexor connect library * Feature: WalletLink (#344) * Initial implementation * Remove commented out code * Update interface * Modify interface * Update interfaces * Remove from default wallets Closes #345 * Change to version 1.9.0
1 parent d547aa6 commit 5f3222a

File tree

9 files changed

+256
-108
lines changed

9 files changed

+256
-108
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
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",
@@ -53,7 +53,7 @@
5353
"@walletconnect/web3-provider": "^1.0.0-beta.47",
5454
"authereum": "^0.0.4-beta.141",
5555
"bignumber.js": "^9.0.0",
56-
"bnc-sdk": "2.1.1",
56+
"bnc-sdk": "^2.1.3",
5757
"bowser": "^2.5.2",
5858
"ethereumjs-tx": "^2.1.2",
5959
"ethereumjs-util": "^6.2.0",
@@ -62,7 +62,8 @@
6262
"hdkey": "^1.1.1",
6363
"regenerator-runtime": "^0.13.3",
6464
"squarelink": "^1.1.4",
65-
"trezor-connect": "7.0.1",
65+
"trezor-connect": "^8.1.2",
66+
"walletlink": "^2.0.2",
6667
"web3-provider-engine": "^15.0.4"
6768
},
6869
"scripts": {

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export default {
6464
'squarelink',
6565
'authereum',
6666
'@toruslabs/torus-embed',
67+
'walletlink',
6768
'@unilogin/provider',
6869
'regenerator-runtime/runtime',
6970
'trezor-connect',

src/interfaces.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export interface TorusOptions extends CommonWalletOptions {
198198
showTorusButton?: boolean
199199
buttonPosition?: 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left'
200200
enableLogging?: boolean
201-
enabledVerifiers: TorusVerifierStatus
201+
enabledVerifiers?: TorusVerifierStatus
202202
}
203203

204204
interface TorusVerifierStatus {
@@ -213,6 +213,12 @@ export interface AuthereumOptions extends CommonWalletOptions {
213213
disableNotifications?: boolean
214214
}
215215

216+
export interface WalletLinkOptions extends CommonWalletOptions {
217+
appName: string
218+
appLogoUrl?: string
219+
rpcUrl: string
220+
}
221+
216222
export interface ImTokenOptions extends CommonWalletOptions {
217223
rpcUrl?: string
218224
}
@@ -239,6 +245,7 @@ export type AllWalletInitOptions = CommonWalletOptions &
239245
TrezorOptions &
240246
AuthereumOptions &
241247
LedgerOptions &
248+
WalletLinkOptions &
242249
ImTokenOptions &
243250
TrustWalletOptions & { networkId: number }
244251

src/modules/select/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { WalletModule, WalletInitOptions } from '../../interfaces'
22
import { isWalletInit } from '../../validation'
33

4+
// wallets that qualify for default wallets need to have no
5+
// init parameters that are required
46
const defaultWalletNames = [
57
'metamask',
68
'dapper',
@@ -82,6 +84,8 @@ function getModule(name: string): Promise<any> | undefined {
8284
return import('./wallets/trezor')
8385
case 'ledger':
8486
return import('./wallets/ledger')
87+
case 'walletLink':
88+
return import('./wallets/wallet-link')
8589
case 'imToken':
8690
return import('./wallets/imtoken')
8791
case 'unilogin':
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const coinbaseIcon = `
2+
<svg width="40" height="40" viewBox="0 0 383 383" fill="none" xmlns="http://www.w3.org/2000/svg">
3+
<g clip-path="url(#clip0)">
4+
<g filter="url(#filter0_dd)">
5+
<path d="M0.998047 0.572266L382.78 0.572266V382.354H0.998047L0.998047 0.572266Z" fill="url(#paint0_linear)"/>
6+
<path fill-rule="evenodd" clip-rule="evenodd" d="M59.1074 191.572C59.1074 264.966 118.605 324.463 191.998 324.463C265.392 324.463 324.889 264.966 324.889 191.572C324.889 118.179 265.392 58.6816 191.998 58.6816C118.605 58.6816 59.1074 118.179 59.1074 191.572ZM158.037 148.752C153.144 148.752 149.178 152.718 149.178 157.611V225.533C149.178 230.426 153.144 234.393 158.037 234.393H225.959C230.852 234.393 234.818 230.426 234.818 225.533V157.611C234.818 152.718 230.852 148.752 225.959 148.752H158.037Z" fill="white"/>
7+
</g>
8+
</g>
9+
<defs>
10+
<filter id="filter0_dd" x="-23.002" y="-7.42773" width="429.782" height="429.782" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
11+
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
12+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
13+
<feOffset dy="16"/>
14+
<feGaussianBlur stdDeviation="12"/>
15+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0"/>
16+
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>
17+
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>
18+
<feOffset/>
19+
<feGaussianBlur stdDeviation="4"/>
20+
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0"/>
21+
<feBlend mode="normal" in2="effect1_dropShadow" result="effect2_dropShadow"/>
22+
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow" result="shape"/>
23+
</filter>
24+
<linearGradient id="paint0_linear" x1="191.889" y1="0.572266" x2="191.889" y2="382.354" gradientUnits="userSpaceOnUse">
25+
<stop stop-color="#2E66F8"/>
26+
<stop offset="1" stop-color="#124ADB"/>
27+
</linearGradient>
28+
<clipPath id="clip0">
29+
<rect width="381.782" height="381.782" fill="white" transform="translate(0.998047 0.572266)"/>
30+
</clipPath>
31+
</defs>
32+
</svg>
33+
`
34+
35+
export default coinbaseIcon

src/modules/select/wallets/coinbase.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { mobileWalletInstallMessage } from '../content'
22
import { WalletModule, Helpers, CommonWalletOptions } from '../../../interfaces'
33

4+
import coinbaseIcon from '../wallet-icons/icon-coinbase'
5+
46
function coinbase(options: CommonWalletOptions): WalletModule {
57
const { preferred, label, iconSrc, svg } = options
68

79
return {
810
name: label || 'Coinbase',
9-
iconSrc:
10-
iconSrc ||
11-
'https://cdn-images-1.medium.com/max/1200/1*7ywNS48PnonfsvvMu1tTsA.png',
11+
iconSrc: iconSrc || coinbaseIcon,
1212
svg,
1313
wallet: async (helpers: Helpers) => {
1414
const { getProviderName, createLegacyProviderInterface } = helpers
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { WalletLinkOptions, WalletModule, Helpers } from '../../../interfaces'
2+
3+
import coinbaseIcon from '../wallet-icons/icon-coinbase'
4+
5+
function walletLink(
6+
options: WalletLinkOptions & { networkId: number }
7+
): WalletModule {
8+
const {
9+
rpcUrl,
10+
appName,
11+
appLogoUrl,
12+
networkId,
13+
preferred,
14+
label,
15+
iconSrc,
16+
svg
17+
} = options
18+
19+
return {
20+
name: label || 'WalletLink',
21+
svg: svg || coinbaseIcon,
22+
iconSrc,
23+
wallet: async (helpers: Helpers) => {
24+
const { getBalance, getAddress, getNetwork } = helpers
25+
26+
const { default: WalletLink } = await import('walletlink')
27+
28+
const instance = new WalletLink({
29+
appName,
30+
appLogoUrl
31+
})
32+
33+
const provider = instance.makeWeb3Provider(rpcUrl, networkId)
34+
35+
return {
36+
provider,
37+
interface: {
38+
name: 'WalletConnect',
39+
connect: () =>
40+
new Promise((resolve, reject) => {
41+
provider
42+
.enable()
43+
.then((res: any) => resolve(res))
44+
.catch(() =>
45+
reject({
46+
message:
47+
'This dapp needs access to your account information.'
48+
})
49+
)
50+
}),
51+
disconnect: () => {
52+
provider.disconnect()
53+
},
54+
address: {
55+
get: () => getAddress(provider)
56+
},
57+
network: {
58+
get: () => getNetwork(provider)
59+
},
60+
balance: {
61+
get: () => getBalance(provider)
62+
}
63+
}
64+
}
65+
},
66+
type: 'sdk',
67+
desktop: true,
68+
preferred
69+
}
70+
}
71+
72+
export default walletLink

src/validation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ export function validateWalletInit(
583583
'enableLogging',
584584
'loginMethod',
585585
'showTorusButton',
586+
'appName',
587+
'appLogoUrl',
586588
'enabledVerifiers',
587589
'disableNotifications'
588590
],

0 commit comments

Comments
 (0)