import { defaultProvider } from "starknet" ; import App from "./App.svelte" ; import type { StarknetWindowObject } from "./extension.model" ; const IS_BROWSER = typeof window !== "undefined" ; export function getStarknet ( { showModal = false , } = { } ) { if ( ! globalThis [ "starknet" ] ) { const fail = async ( ) => { throw Error ( "no starknet found in window" ) ; } ; globalThis [ "starknet" ] = { request : fail , isConnected : false , provider : defaultProvider , enable : ( ) => { if ( IS_BROWSER && showModal ) { new App ( { target : document . body } ) ; } return fail ( ) ; } , on : fail , off : fail , } ; } return globalThis [ "starknet" ] ; }