import type { _SERVICE as verifierService } from './idls/ic_siwb_provider'; import { type ActorConfig, type ActorSubclass, type HttpAgentOptions, SignIdentity } from '@dfinity/agent'; import { DelegationChain, DelegationIdentity } from '@dfinity/identity'; import { Principal } from '@dfinity/principal'; import { LaserEyesClient, type ContentType } from "@omnisat/lasereyes-core"; import { type NetworkType, type ProviderType } from "@omnisat/lasereyes"; import { type ReactNode } from "react"; import type { IDL } from "@dfinity/candid"; import type { LoginStatus, PrepareLoginStatus } from "./state.type"; export * from "./service.interface"; export * from "./storage.type"; export declare class SiwbConnector { private delegationIdentity; private publicKey; private userAddress; constructor(delegationIdentity: DelegationIdentity, publicKey: string, userAddress: string); static connect(provider: LaserEyesClient, canisterId?: string): Promise; static disconnect(): Promise; static hasStorage(): Promise; getPrincipal(): Principal; getAddress(): string; static getPrincialFromBitcoinAddress(address: string): Promise; static getDelegationIdentity(): Promise; } export declare function handleDelegationVerification(actor: ActorSubclass, address: string, sessionId: SignIdentity, public_key: string, signature: string): Promise<{ delegationIdentity: DelegationIdentity; delegationChain: DelegationChain; }>; export type LaserEyesContextType = { isInitializing: boolean; connected: boolean; isConnecting: boolean; publicKey: string; address: string; paymentAddress: string; paymentPublicKey: string; balance: number | undefined; network: NetworkType; library: any; provider: any; accounts: string[]; hasUnisat: boolean; hasXverse: boolean; hasOrange: boolean; hasOpNet: boolean; hasOyl: boolean; hasMagicEden: boolean; hasOkx: boolean; hasLeather: boolean; hasPhantom: boolean; hasWizz: boolean; connect: (walletName: ProviderType) => Promise; disconnect: () => void; requestAccounts: () => Promise; getNetwork: () => Promise; switchNetwork: (network: NetworkType) => Promise; getPublicKey: () => Promise; getBalance: () => Promise; getInscriptions: () => Promise; sendBTC: (to: string, amount: number) => Promise; signMessage: (message: string, toSignAddress?: string) => Promise; signPsbt: (tx: string, finalize?: boolean, broadcast?: boolean) => Promise<{ signedPsbtHex: string | undefined; signedPsbtBase64: string | undefined; txId?: string; } | undefined>; pushPsbt: (tx: string) => Promise; inscribe: (contentBase64: string, mimeType: ContentType) => Promise; }; export type SiwbIdentityContextType = { /** Is set to `true` on mount until a stored identity is loaded from local storage or * none is found. */ isInitializing: boolean; /** Load a SIWb message from the provider canister, to be used for login. Calling prepareLogin * is optional, as it will be called automatically on login if not called manually. */ prepareLogin: () => void; /** Reflects the current status of the prepareLogin process. */ prepareLoginStatus: PrepareLoginStatus; /** `prepareLoginStatus === "loading"` */ isPreparingLogin: boolean; /** `prepareLoginStatus === "error"` */ isPrepareLoginError: boolean; /** `prepareLoginStatus === "success"` */ isPrepareLoginSuccess: boolean; /** `prepareLoginStatus === "idle"` */ isPrepareLoginIdle: boolean; /** Error that occurred during the prepareLogin process. */ prepareLoginError?: Error; /** Initiates the login process by requesting a SIWb message from the backend. */ login: () => Promise; /** Reflects the current status of the login process. */ loginStatus: LoginStatus; /** `loginStatus === "logging-in"` */ isLoggingIn: boolean; /** `loginStatus === "error"` */ isLoginError: boolean; /** `loginStatus === "success"` */ isLoginSuccess: boolean; /** `loginStatus === "idle"` */ isLoginIdle: boolean; /** Error that occurred during the login process. */ loginError?: Error; /** Status of the SIWb message signing process. This is a re-export of the Wagmi * signMessage / status type. */ signMessageStatus: "error" | "idle" | "pending" | "success"; /** Error that occurred during the SIWb message signing process. This is a re-export of the * Wagmi signMessage / error type. */ signMessageError: Error | null; /** The delegation chain is available after successfully loading the identity from local * storage or completing the login process. */ delegationChain?: DelegationChain; /** The identity is available after successfully loading the identity from local storage * or completing the login process. */ identity?: DelegationIdentity; /** The Bitcoin address associated with current identity. This address is not necessarily * the same as the address of the currently connected wallet - on wallet change, the addresses * will differ. */ identityAddress?: string; identityPublicKey?: string; /** Clears the identity from the state and local storage. Effectively "logs the user out". */ clear: () => void; /** Network Identitfier, not adding bitcoinjs-lib network directly, simple string */ network?: NetworkType; /** We don't have things like rainbow kit right now, so we have to manually set provider key */ /** We don't have things like rainbow kit right now, so we have to manually return provider key */ selectedProvider?: ProviderType; /** We don't have things like rainbow kit right now, so we have to manually return btc address */ connectedBtcAddress?: string; /** We don't have things like rainbow kit right now, so we have to manually return btc address */ getAddress: () => string | undefined; getPublicKey: () => string | undefined; setLaserEyes: (laserEyes: LaserEyesContextType, providerType?: ProviderType) => Promise; }; export declare const SiwbIdentityContext: import("react").Context; export declare function createClient(context: LaserEyesContextType): [LaserEyesClient, ProviderType]; /** * Hook to access the SiwbIdentityContext. */ export declare const useSiwbIdentity: () => SiwbIdentityContextType; export declare function SiwbIdentityProvider({ httpAgentOptions, actorOptions, idlFactory, canisterId, children, }: { /** Configuration options for the HTTP agent used to communicate with the Internet Computer network. */ httpAgentOptions?: HttpAgentOptions; /** Configuration options for the actor. These options are passed to the actor upon its creation. */ actorOptions?: ActorConfig; /** The Interface Description Language (IDL) factory for the canister. This factory is used to create an actor interface for the canister. */ idlFactory: IDL.InterfaceFactory; /** The unique identifier of the canister on the Internet Computer network. This ID is used to establish a connection to the canister. */ canisterId: string; /** The child components that the SiwbIdentityProvider will wrap. This allows any child component to access the authentication context provided by the SiwbIdentityProvider. */ children: ReactNode; }): import("react/jsx-runtime").JSX.Element;