export class WalletAlreadyInitializedError extends Error { constructor() { super("Wallet already initialized"); Object.setPrototypeOf(this, WalletAlreadyInitializedError.prototype); } } export class InvalidWalletStateError extends Error { constructor() { super("Invalid embedded wallet state"); Object.setPrototypeOf(this, InvalidWalletStateError.prototype); } } export class InvalidWalletError extends Error { constructor() { super("Invalid embedded wallet"); Object.setPrototypeOf(this, InvalidWalletError.prototype); } } export class WalletAlreadyRegisteredError extends Error { constructor() { super("Wallet already registered"); Object.setPrototypeOf(this, WalletAlreadyRegisteredError.prototype); } } export class APIError extends Error { code: number; constructor(message: string, code: number) { super(message); this.code = code; Object.setPrototypeOf(this, APIError.prototype); } } export class PasskeyAuthenticateNotFoundError extends Error { constructor() { super("Passkey authenticate not found. The environment might not support WebAuthn or the authenticator is not properly initialized."); Object.setPrototypeOf(this, PasskeyAuthenticateNotFoundError.prototype); } } export class WalletRegistrationError extends Error { constructor(reason: string) { super(`Failed to register wallet: ${reason}`); Object.setPrototypeOf(this, WalletRegistrationError.prototype); } } export class WalletStorageError extends Error { constructor(operation: string) { super(`Failed to ${operation} wallet in storage`); Object.setPrototypeOf(this, WalletStorageError.prototype); } } export class InvalidWalletStateAfterCreationError extends Error { constructor() { super("Wallet was created but is in an invalid state"); Object.setPrototypeOf(this, InvalidWalletStateAfterCreationError.prototype); } } export class StateParseError extends Error { constructor(details?: string) { super(`Failed to parse wallet state${details ? `: ${details}` : ''}`); Object.setPrototypeOf(this, StateParseError.prototype); } } export class WalletNotFoundError extends Error { constructor() { super("Wallet not found"); Object.setPrototypeOf(this, WalletNotFoundError.prototype); } } export class WalletStateNotFoundError extends Error { constructor() { super("Wallet state not found"); Object.setPrototypeOf(this, WalletStateNotFoundError.prototype); } }