File tree 4 files changed +17
-11
lines changed
4 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,16 @@ yarn add bnc-assist
43
43
#### Script Tag
44
44
45
45
The library uses [ semantic versioning] ( https://semver.org/spec/v2.0.0.html ) .
46
- The current version is 0.6.1 .
46
+ The current version is 0.6.2 .
47
47
There are minified and non-minified versions.
48
48
Put this script at the top of your ` <head> `
49
49
50
50
``` html
51
- <script src =" https://assist.blocknative.com/0-6-1 /assist.js" ></script >
51
+ <script src =" https://assist.blocknative.com/0-6-2 /assist.js" ></script >
52
52
53
53
<!-- OR... -->
54
54
55
- <script src =" https://assist.blocknative.com/0-6-1 /assist.min.js" ></script >
55
+ <script src =" https://assist.blocknative.com/0-6-2 /assist.min.js" ></script >
56
56
```
57
57
58
58
### Initialize the Library
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " bnc-assist" ,
3
- "version" : " 0.6.1 " ,
3
+ "version" : " 0.6.2 " ,
4
4
"description" : " Blocknative Assist js library for Dapp developers" ,
5
5
"main" : " lib/assist.min.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -103,7 +103,11 @@ export function configureWeb3(web3) {
103
103
let modernWeb3
104
104
let web3Version
105
105
106
- if ( web3 . version . api && typeof web3 . version . api === 'string' ) {
106
+ if (
107
+ web3 . version &&
108
+ web3 . version . api &&
109
+ typeof web3 . version . api === 'string'
110
+ ) {
107
111
legacyWeb3 = true
108
112
modernWeb3 = false
109
113
web3Version = web3 . version . api
@@ -127,15 +131,15 @@ export function configureWeb3(web3) {
127
131
}
128
132
129
133
export function checkForWallet ( ) {
130
- if ( window . ethereum ) {
134
+ if ( window . ethereum && window . web3 . version ) {
131
135
updateState ( {
132
136
currentProvider : getCurrentProvider ( ) ,
133
137
validBrowser : true ,
134
138
web3Wallet : true ,
135
139
legacyWallet : false ,
136
140
modernWallet : true
137
141
} )
138
- } else if ( window . web3 ) {
142
+ } else if ( window . web3 && window . web3 . version ) {
139
143
updateState ( {
140
144
currentProvider : getCurrentProvider ( ) ,
141
145
validBrowser : true ,
@@ -259,7 +263,11 @@ export function getAccounts() {
259
263
}
260
264
261
265
export function checkUnlocked ( ) {
262
- return window . ethereum . _metamask . isUnlocked ( )
266
+ return (
267
+ window . ethereum &&
268
+ window . ethereum . _metamask &&
269
+ window . ethereum . _metamask . isUnlocked ( )
270
+ )
263
271
}
264
272
265
273
export function requestLoginEnable ( ) {
Original file line number Diff line number Diff line change @@ -219,9 +219,7 @@ function checkAccountAccess() {
219
219
walletEnabled : true
220
220
} )
221
221
} else {
222
- const loggedIn = state . modernWallet
223
- ? await checkUnlocked ( ) . catch ( resolve )
224
- : false
222
+ const loggedIn = state . modernWallet ? await checkUnlocked ( ) : false
225
223
226
224
updateState ( {
227
225
accessToAccounts : false ,
You can’t perform that action at this time.
0 commit comments