UNPKG

sui-svelte-wallet-kit

Version:

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

101 lines (100 loc) 2.85 kB
/** * Multisig Store using Svelte 5 Runes * Class-based reactive state management */ import { Transaction } from '@mysten/sui/transactions'; import type { PublicKey } from '@mysten/sui/cryptography'; import { type MultisigConfig, type MultisigState, type ResolvedSigner, type MultisigSigner, type MultisigProposal, type ResolverContext } from './MultisigTypes.js'; /** * Context providers for Multisig */ export interface MultisigProviders { signTransaction: (tx: Transaction, options?: { sender?: string; }) => Promise<{ signature: string; bytes: Uint8Array; }>; getCurrentWalletPublicKey: () => Promise<{ publicKey: PublicKey; type: string; } | null>; getResolverContext: () => ResolverContext; } /** * Multisig Store Class * Uses Svelte 5 Runes for reactive state */ export declare class MultisigStore { #private; resolvedCount: number; totalWeight: number; allResolved: boolean; address: string | null; addressReady: boolean; isReady: boolean; get config(): MultisigConfig | null; get threshold(): number; get mode(): "preconfigured" | "dynamic" | null; get signers(): ResolvedSigner[]; get error(): string | null; get network(): "mainnet" | "testnet" | "devnet"; get providers(): MultisigProviders | null; get state(): MultisigState; /** * Initialize with config */ initialize(config: MultisigConfig, network?: 'mainnet' | 'testnet' | 'devnet'): void; /** * Set providers (called by SuiModule) */ setProviders(providers: MultisigProviders): void; /** * Resolve signers with current context */ resolveSigners(context?: ResolverContext): void; /** * Set threshold (dynamic mode only) */ setThreshold(threshold: number): void; /** * Add signer from current wallet (dynamic mode only) */ addSignerFromCurrentWallet(options?: { weight?: number; name?: string; }): Promise<void>; /** * Add signer (dynamic mode only) */ addSigner(signer: MultisigSigner): void; /** * Remove signer by ID (dynamic mode only) */ removeSigner(signerId: string): void; /** * Update signer weight by ID (dynamic mode only) */ updateSignerWeight(signerId: string, weight: number): void; /** * Create a proposal for signature collection */ createProposal(tx: Transaction): Promise<MultisigProposal>; /** * Save config to localStorage */ saveConfig(): void; /** * Load config from localStorage */ loadFromStorage(storageKey: string): boolean; /** * Clear config from localStorage */ clearConfig(): void; /** * Reset store */ reset(): void; } export declare const multisigStore: MultisigStore;