File tree Expand file tree Collapse file tree 9 files changed +256
-108
lines changed Expand file tree Collapse file tree 9 files changed +256
-108
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " bnc-onboard" ,
3
- "version" : " 1.8 .0" ,
3
+ "version" : " 1.9 .0" ,
4
4
"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." ,
5
5
"keywords" : [
6
6
" ethereum" ,
53
53
"@walletconnect/web3-provider" : " ^1.0.0-beta.47" ,
54
54
"authereum" : " ^0.0.4-beta.141" ,
55
55
"bignumber.js" : " ^9.0.0" ,
56
- "bnc-sdk" : " 2.1.1 " ,
56
+ "bnc-sdk" : " ^ 2.1.3 " ,
57
57
"bowser" : " ^2.5.2" ,
58
58
"ethereumjs-tx" : " ^2.1.2" ,
59
59
"ethereumjs-util" : " ^6.2.0" ,
62
62
"hdkey" : " ^1.1.1" ,
63
63
"regenerator-runtime" : " ^0.13.3" ,
64
64
"squarelink" : " ^1.1.4" ,
65
- "trezor-connect" : " 7.0.1" ,
65
+ "trezor-connect" : " ^8.1.2" ,
66
+ "walletlink" : " ^2.0.2" ,
66
67
"web3-provider-engine" : " ^15.0.4"
67
68
},
68
69
"scripts" : {
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export default {
64
64
'squarelink' ,
65
65
'authereum' ,
66
66
'@toruslabs/torus-embed' ,
67
+ 'walletlink' ,
67
68
'@unilogin/provider' ,
68
69
'regenerator-runtime/runtime' ,
69
70
'trezor-connect' ,
Original file line number Diff line number Diff line change @@ -198,7 +198,7 @@ export interface TorusOptions extends CommonWalletOptions {
198
198
showTorusButton ?: boolean
199
199
buttonPosition ?: 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left'
200
200
enableLogging ?: boolean
201
- enabledVerifiers : TorusVerifierStatus
201
+ enabledVerifiers ? : TorusVerifierStatus
202
202
}
203
203
204
204
interface TorusVerifierStatus {
@@ -213,6 +213,12 @@ export interface AuthereumOptions extends CommonWalletOptions {
213
213
disableNotifications ?: boolean
214
214
}
215
215
216
+ export interface WalletLinkOptions extends CommonWalletOptions {
217
+ appName : string
218
+ appLogoUrl ?: string
219
+ rpcUrl : string
220
+ }
221
+
216
222
export interface ImTokenOptions extends CommonWalletOptions {
217
223
rpcUrl ?: string
218
224
}
@@ -239,6 +245,7 @@ export type AllWalletInitOptions = CommonWalletOptions &
239
245
TrezorOptions &
240
246
AuthereumOptions &
241
247
LedgerOptions &
248
+ WalletLinkOptions &
242
249
ImTokenOptions &
243
250
TrustWalletOptions & { networkId : number }
244
251
Original file line number Diff line number Diff line change 1
1
import { WalletModule , WalletInitOptions } from '../../interfaces'
2
2
import { isWalletInit } from '../../validation'
3
3
4
+ // wallets that qualify for default wallets need to have no
5
+ // init parameters that are required
4
6
const defaultWalletNames = [
5
7
'metamask' ,
6
8
'dapper' ,
@@ -82,6 +84,8 @@ function getModule(name: string): Promise<any> | undefined {
82
84
return import ( './wallets/trezor' )
83
85
case 'ledger' :
84
86
return import ( './wallets/ledger' )
87
+ case 'walletLink' :
88
+ return import ( './wallets/wallet-link' )
85
89
case 'imToken' :
86
90
return import ( './wallets/imtoken' )
87
91
case 'unilogin' :
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change 1
1
import { mobileWalletInstallMessage } from '../content'
2
2
import { WalletModule , Helpers , CommonWalletOptions } from '../../../interfaces'
3
3
4
+ import coinbaseIcon from '../wallet-icons/icon-coinbase'
5
+
4
6
function coinbase ( options : CommonWalletOptions ) : WalletModule {
5
7
const { preferred, label, iconSrc, svg } = options
6
8
7
9
return {
8
10
name : label || 'Coinbase' ,
9
- iconSrc :
10
- iconSrc ||
11
- 'https://cdn-images-1.medium.com/max/1200/1*7ywNS48PnonfsvvMu1tTsA.png' ,
11
+ iconSrc : iconSrc || coinbaseIcon ,
12
12
svg,
13
13
wallet : async ( helpers : Helpers ) => {
14
14
const { getProviderName, createLegacyProviderInterface } = helpers
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change @@ -583,6 +583,8 @@ export function validateWalletInit(
583
583
'enableLogging' ,
584
584
'loginMethod' ,
585
585
'showTorusButton' ,
586
+ 'appName' ,
587
+ 'appLogoUrl' ,
586
588
'enabledVerifiers' ,
587
589
'disableNotifications'
588
590
] ,
You can’t perform that action at this time.
0 commit comments