Skip to content

Commit a68fcf2

Browse files
authored
check initialization on get call
1 parent 656e844 commit a68fcf2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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
}

0 commit comments

Comments
 (0)