import BlocknativeApi from 'bnc-sdk' ; import { get } from 'svelte/store' ; import { app } from './stores' ; import { version } from '../package.json' ; let blocknative ; export function initializeBlocknative ( dappId , networkId , apiUrl ? ) { blocknative = new BlocknativeApi ( { dappId , networkId , name : 'Onboard' , appVersion : version , apiUrl } ) ; return blocknative ; } export function getBlocknative ( ) { if ( ! blocknative ) { const { dappId , networkId , apiUrl } = get ( app ) ; dappId && initializeBlocknative ( dappId , networkId , apiUrl ) ; } return blocknative ; } export function closeSocketConnection ( ) { blocknative ?. destroy ( ) ; }