spb/os-vault Public
Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.
Swift 96%
Shell 3.4%
Makefile 0.6%
1//2// WalletError.swift3// OS Vault4//5// Author: Simon-Pierre Boucher6// Mail: contact@spboucher.ai7//89import Foundation1011/// Typed errors for every service call. Messages never contain key material.12public enum WalletError: LocalizedError, Equatable {13 case noVault14 case vaultCorrupted15 case wrongPassword16 case invalidMnemonic17 case invalidAddress18 case insufficientETHForGas(needWei: String, haveWei: String)19 case insufficientTokenBalance20 case rpc(String)21 case signingFailed22 case internalError(String)2324 public var errorDescription: String? {25 switch self {26 case .noVault:27 return "No wallet exists on this Mac yet."28 case .vaultCorrupted:29 return "The vault file is damaged and cannot be read."30 case .wrongPassword:31 return "Incorrect password."32 case .invalidMnemonic:33 return "This recovery phrase is not valid. Check the words and their order."34 case .invalidAddress:35 return "This is not a valid Ethereum address."36 case .insufficientETHForGas(let need, let have):37 return "Not enough of the chain's native coin to pay gas (need ~\(need), have \(have)). Gas is always paid in the native coin, never in stablecoins."38 case .insufficientTokenBalance:39 return "Amount exceeds your token balance."40 case .rpc(let message):41 return "Network error: \(message)"42 case .signingFailed:43 return "The transaction could not be signed."44 case .internalError(let message):45 return message46 }47 }48}49