Skip to content

Commit 77e8d8a

Browse files
1.21.0-0.0.2: [fix] - Adds unknown network name (#520)
* Adds unknown network name * Update isMobile parameter in interfaces * Increment version * Fix type error * Modify networkName logic * Fix type error and remove fallback name param * Increment version Co-authored-by: Aaron <abarnard@protonmail.com>
1 parent abefc41 commit 77e8d8a

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
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.21.0-0.0.1",
3+
"version": "1.21.0-0.0.2",
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/modules/check/network.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {
55
WalletCheckCustomOptions
66
} from '../../interfaces'
77
import { networkIcon } from './icons'
8+
import { app } from './../../stores'
9+
import { get } from 'svelte/store'
810

911
function network(
1012
options: WalletCheckCustomOptions = {}
@@ -30,7 +32,7 @@ function network(
3032
setTimeout(() => {
3133
if (network === null) {
3234
// if prom isn't resolving after 500ms, then stop waiting
33-
resolve()
35+
resolve(undefined)
3436
}
3537
}, 500)
3638
})

src/stores.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ function createWalletStateSliceStore(options: {
260260
if (onChange) {
261261
stateSyncStatus[parameter] = new Promise(resolve => {
262262
onChange(newVal => {
263-
resolve()
263+
resolve(undefined)
264264
if (newVal || currentState !== initialState) {
265265
set(newVal)
266266
}

src/utilities.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import bowser from 'bowser'
22
import BigNumber from 'bignumber.js'
3+
import { get } from 'svelte/store'
34

4-
import { WalletInterface } from './interfaces'
55
import { app } from './stores'
6-
import { get } from 'svelte/store'
6+
import { WalletInterface } from './interfaces'
77

88
export function getNetwork(provider: any): Promise<number | any> {
99
return new Promise((resolve, reject) => {
@@ -198,7 +198,7 @@ export function getProviderName(provider: any): string | undefined {
198198
if (provider.isTokenPocket) {
199199
return 'TokenPocket'
200200
}
201-
201+
202202
if (provider.isOwnbit) {
203203
return 'Ownbit'
204204
}
@@ -304,7 +304,8 @@ export function networkName(id: number): string {
304304
case 100:
305305
return 'xdai'
306306
default:
307-
return get(app).networkName || 'local'
307+
const { networkId, networkName } = get(app)
308+
return (networkId === id && networkName) || 'unknown'
308309
}
309310
}
310311

0 commit comments

Comments
 (0)