fromStorage static method

Wallet fromStorage({
  1. required String id,
  2. required String name,
  3. required WalletType type,
  4. required Set<String> supportedUnits,
  5. required Map<String, dynamic> metadata,
})

Creates a wallet instance from storage data Delegates to subclass static fromStorage methods based on wallet type

Implementation

static Wallet fromStorage({
  required String id,
  required String name,
  required WalletType type,
  required Set<String> supportedUnits,
  required Map<String, dynamic> metadata,
}) {
  switch (type) {
    case WalletType.CASHU:
      return CashuWallet.fromStorage(
        id: id,
        name: name,
        supportedUnits: supportedUnits,
        metadata: metadata,
      );
    case WalletType.NWC:
      return NwcWallet.fromStorage(
        id: id,
        name: name,
        supportedUnits: supportedUnits,
        metadata: metadata,
      );
    case WalletType.LNURL:
      return LnurlWallet.fromStorage(
        id: id,
        name: name,
        supportedUnits: supportedUnits,
        metadata: metadata,
      );
  }
}