Skip to content

Commit 3cc558e

Browse files
authored
Merge pull request #487 from blocknative/feature/move-ws-init
Feature/move ws init
2 parents cc63c95 + 9a1ef9d commit 3cc558e

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
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.18.0-0.1.0",
3+
"version": "1.18.0-0.2.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",

src/services.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import BlocknativeApi from 'bnc-sdk'
2+
import { get } from 'svelte/store'
3+
import { app } from './stores'
24

35
let blocknative: any
46

@@ -17,5 +19,9 @@ export function initializeBlocknative(
1719
}
1820

1921
export function getBlocknative(): any {
22+
if (!blocknative) {
23+
const {dappId, networkId, apiUrl} = get(app)
24+
initializeBlocknative(dappId, networkId, apiUrl)
25+
}
2026
return blocknative
2127
}

src/stores.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getBlocknative, initializeBlocknative } from './services'
1+
import { getBlocknative } from './services'
22
import { writable, derived, get } from 'svelte/store'
33
import { wait, makeCancelable, createInterval } from './utilities'
44
import { validateWalletInterface, validateType } from './validation'
@@ -309,14 +309,6 @@ function createBalanceStore(initialState: string | null): BalanceStore {
309309
currentBalance: get(balance)
310310
})
311311

312-
if (!getBlocknative()) {
313-
initializeBlocknative(
314-
get(app).dappId,
315-
get(app).networkId,
316-
get(app).apiUrl
317-
)
318-
}
319-
320312
if (emitterAddress !== $address) {
321313
const blocknative = getBlocknative()
322314

0 commit comments

Comments
 (0)