UNPKG

sui-svelte-wallet-kit

Version:

Svelte 5 wallet kit for Sui: connect wallets, manage accounts, SuiNS, balance, sign transactions/messages

160 lines (159 loc) 5.43 kB
import { ConnectionStatus } from '@suiet/wallet-sdk'; import { type Wallet } from '@wallet-standard/core'; import type { SuiWalletAdapter, WalletConfig, ZkLoginGoogleConfig, PasskeyConfig, SuiModuleMultisigConfig, WalletWithStatus, SwitchWalletOptions, SuiAccount } from './types'; import { type MultisigConfig } from '../MultisigService/index.js'; export declare let getConnectModal: () => any; export declare const refreshSuiBalance: (targetAddress: string, options?: { force?: boolean; ttlMs?: number; }) => Promise<string | null>; export declare const setSuiBalanceCacheTTL: (ms: number) => void; export declare const setAccountLabel: (name: string) => void; export declare const useCurrentAccount: () => SuiAccount | undefined; export declare const useAccounts: () => SuiAccount[]; export declare const accountLoading: { readonly value: boolean; }; export declare const suiNames: { readonly value: string[]; clear(): void; }; export declare const suiNamesLoading: { readonly value: boolean; }; export declare const suiBalance: { readonly value: string | null; }; export declare const suiBalanceLoading: { readonly value: boolean; }; export declare const suiBalanceByAddress: { readonly value: Record<string, string>; }; export declare const suiNamesByAddress: { readonly value: Record<string, string[]>; }; export declare const useSuiClient: () => import("@mysten/sui/client").SuiClient; export declare const activeAccountIndex: { readonly value: number; }; export declare const switchAccount: (selector: number | string | SuiAccount) => boolean; export declare const useCurrentWallet: () => { name: string; iconUrl: string; connectionStatus: ConnectionStatus; }; export declare const lastWalletSelection: { readonly value: { wallet: Wallet; installed: boolean; } | undefined; clear(): void; }; export declare const connect: (wallet: WalletWithStatus) => Promise<void>; export declare const disconnect: () => void; export declare const connectWithModal: (onSelection?: (payload: { wallet: Wallet; installed: boolean; connected: boolean; }) => void) => Promise<{ connected: boolean; alreadyConnected: boolean; wallet?: undefined; installed?: undefined; cancelled?: undefined; } | { wallet: undefined; installed: boolean; connected: boolean; cancelled: boolean; alreadyConnected?: undefined; } | { wallet: Wallet; installed: boolean; connected: boolean; alreadyConnected?: undefined; cancelled?: undefined; }>; export declare const switchWallet: (options?: SwitchWalletOptions) => Promise<{ connected: boolean; cancelled: boolean; wallet?: undefined; installed?: undefined; skipped?: undefined; error?: undefined; } | { wallet: Wallet; installed: boolean; connected: boolean; skipped: boolean; cancelled?: undefined; error?: undefined; } | { wallet: Wallet; installed: boolean; connected: boolean; cancelled?: undefined; skipped?: undefined; error?: undefined; } | { connected: boolean; error: string; cancelled?: undefined; wallet?: undefined; installed?: undefined; skipped?: undefined; }>; export declare const signAndExecuteTransaction: (transaction: any) => Promise<any>; export declare const signTransaction: (transaction: any, options?: { sender?: string; }) => Promise<{ signature: string; bytes: Uint8Array; }>; export declare const signMessage: (message: string | Uint8Array) => Promise<{ signature: string; messageBytes: string; }>; export declare const canSignMessage: () => boolean; export declare const isPasskeyWallet: () => boolean; export declare const usePasskeyAccount: () => { readonly isPasskey: boolean; readonly address: string | null; readonly publicKey: Uint8Array<ArrayBufferLike> | null; readonly credentialId: any; getCredential(): Promise<import("..").PasskeyCredential | null>; }; export declare const isMultisigWallet: () => boolean; export declare const useMultisigAccount: () => { readonly isMultisig: boolean; readonly address: string | null; readonly threshold: any; readonly totalWeight: any; getConfig(): MultisigConfig | null; getAvailableSigners(): Promise<import("..").SignerStatus[]>; }; export declare const isZkLoginWallet: () => boolean; export declare const getZkLoginInfo: () => Promise<{ session: any; metadata: any; } | null>; export declare const walletAdapters: SuiWalletAdapter[]; export declare const availableWallets: WalletWithStatus[]; export declare const setModuleWalletDiscovery: (adapters: SuiWalletAdapter[], wallets: WalletWithStatus[]) => void; export declare const subscribeWalletDiscovery: (callback: (adapters: SuiWalletAdapter[], wallets: WalletWithStatus[]) => void) => (() => void); export declare const initWalletDiscovery: () => void; type $$ComponentProps = { onConnect?: () => void; autoConnect?: boolean; autoSuiNS?: boolean; autoSuiBalance?: boolean; walletConfig?: WalletConfig; zkLoginGoogle?: ZkLoginGoogleConfig | null; passkey?: PasskeyConfig | null; multisig?: SuiModuleMultisigConfig | null; children?: import('svelte').Snippet; }; declare const SuiModule: import("svelte").Component<$$ComponentProps, {}, "">; type SuiModule = ReturnType<typeof SuiModule>; export default SuiModule;