1 // This file defines interfaces for model received from Wallet API
2 import type { WasmBitcoinUnit, WasmScriptType } from '@proton/andromeda';
4 export enum WalletPassphrase {
9 export enum WalletSetupMode {
14 export enum WalletStatus {
19 export enum WalletType {
24 export interface Wallet {
27 // UserID owning the wallet
29 // Name for the wallet
31 // Encrypted version of the mnemonic with the wallet key
33 // 0 = no passphrase, 1 = require passphrase
34 Passphrase: WalletPassphrase;
35 // Encrypted version of the public key with the wallet key, only used if wallet got imported with public key. In this case, it is a watch-only wallet and transaction broadcast route becomes unavailable.
37 // 0 = created by Proton, 1 = imported wallet
38 Imported: WalletSetupMode;
39 // Define wallet priority (1 is the primary wallet)
41 // 1 = Active, 2 = Disabled
43 // Type of wallet (1 = On-chain, 2 = Lightning)
47 // Time of last update
51 export interface WalletKey {
54 // WalletID owning the wallet key
56 // AES-GCM 256 bits symmetrical key encrypted with the account key
58 // UserKeyID used to encrypt the WalletKey
62 // Time of last update
66 export interface WalletSettings {
67 // WalletID owning the settings
69 // Hide accounts, only used for on-chain wallet
71 // Default description, only used for lightning wallet
72 InvoiceDefaultDescription: string;
73 // Default lightning invoice expiration time in seconds
74 InvoiceExpirationTime: number;
76 MaxChannelOpeningFee: number;
79 // Time of last update
83 export interface UserWalletSettings {
86 // Request 2FA for any amount above this threshold in sats
87 TwoFactorAmountThreshold: number;
88 // Hide empty used addresses
89 HideEmptyUsedAddresses: number;
90 // CurrencyID of the wallet
91 FiatCurrencyID: number;
92 // BitcoinUnitID of the wallet
93 BitcoinUnitID: number;
96 // Time of last update
100 export interface WalletAccount {
102 WalletAccountID: number;
103 // WalletID owning the account
105 // Account index, used to get derivation path
107 // Encrypted version of the label of the account with the wallet key
110 ScriptType: WasmScriptType;
113 // Time of last update
117 export interface Transaction {
119 TransactionLabelID: number;
122 // Encrypted version of the transaction label with the wallet key
124 // Encrypted version of the identification number for a bitcoin transaction with the wallet key
128 // Time of last update
132 export interface BitcoinUnit {
134 BitcoinUnitID: number;
135 // Name of the Bitcoin unit (e.g. satoshi, bitcoin)
137 // Symbol of the currency (e.g. sats and btc)
138 Symbol: WasmBitcoinUnit;
141 export interface FiatCurrency {
143 FiatCurrencyID: number;
144 // Name of the fiat currency (e.g. euro)
146 // Symbol of the currency (e.g. EUR)
150 export type ApiWallet = Wallet & { accounts: WalletAccount[]; settings: WalletSettings; key: WalletKey };