Skip to content

Commit 44b8bd2

Browse files
committed
add blocknative init before address subscribe
1 parent 612412a commit 44b8bd2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/stores.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { getBlocknative } from './services'
1+
import { getBlocknative, initializeBlocknative } from './services'
22
import { writable, derived, get } from 'svelte/store'
33
import { wait, makeCancelable, createInterval } from './utilities'
4-
import { validateWalletInterface, validateType } from './validation'
4+
import { validateWalletInterface, validateType } from './validation'
55
import {
66
WritableStore,
77
ReadableStore,
@@ -16,6 +16,7 @@ import {
1616

1717
export const app: WritableStore = writable({
1818
dappId: '',
19+
apiUrl: '',
1920
networkId: 1,
2021
version: '',
2122
mobileDevice: false,
@@ -308,6 +309,14 @@ function createBalanceStore(initialState: string | null): BalanceStore {
308309
currentBalance: get(balance)
309310
})
310311

312+
if (!getBlocknative()) {
313+
initializeBlocknative(
314+
get(app).dappId,
315+
get(app).networkId,
316+
get(app).apiUrl
317+
)
318+
}
319+
311320
if (emitterAddress !== $address) {
312321
const blocknative = getBlocknative()
313322

0 commit comments

Comments
 (0)