Skip to content

Commit 2598111

Browse files
committed
release 0.6.2
2 parents ff58d50 + 514f9f6 commit 2598111

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ yarn add bnc-assist
4343
#### Script Tag
4444

4545
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.
4747
There are minified and non-minified versions.
4848
Put this script at the top of your `<head>`
4949

5050
```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>
5252

5353
<!-- OR... -->
5454

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>
5656
```
5757

5858
### Initialize the Library

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-assist",
3-
"version": "0.6.1",
3+
"version": "0.6.2",
44
"description": "Blocknative Assist js library for Dapp developers",
55
"main": "lib/assist.min.js",
66
"scripts": {

src/js/helpers/web3.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ export function configureWeb3(web3) {
103103
let modernWeb3
104104
let web3Version
105105

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+
) {
107111
legacyWeb3 = true
108112
modernWeb3 = false
109113
web3Version = web3.version.api
@@ -127,15 +131,15 @@ export function configureWeb3(web3) {
127131
}
128132

129133
export function checkForWallet() {
130-
if (window.ethereum) {
134+
if (window.ethereum && window.web3.version) {
131135
updateState({
132136
currentProvider: getCurrentProvider(),
133137
validBrowser: true,
134138
web3Wallet: true,
135139
legacyWallet: false,
136140
modernWallet: true
137141
})
138-
} else if (window.web3) {
142+
} else if (window.web3 && window.web3.version) {
139143
updateState({
140144
currentProvider: getCurrentProvider(),
141145
validBrowser: true,
@@ -259,7 +263,11 @@ export function getAccounts() {
259263
}
260264

261265
export function checkUnlocked() {
262-
return window.ethereum._metamask.isUnlocked()
266+
return (
267+
window.ethereum &&
268+
window.ethereum._metamask &&
269+
window.ethereum._metamask.isUnlocked()
270+
)
263271
}
264272

265273
export function requestLoginEnable() {

src/js/logic/user.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,7 @@ function checkAccountAccess() {
219219
walletEnabled: true
220220
})
221221
} else {
222-
const loggedIn = state.modernWallet
223-
? await checkUnlocked().catch(resolve)
224-
: false
222+
const loggedIn = state.modernWallet ? await checkUnlocked() : false
225223

226224
updateState({
227225
accessToAccounts: false,

0 commit comments

Comments
 (0)