diff options
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index a2d9e2ad9..506cde1f4 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -37,6 +37,8 @@ import { RefreshSessionRecord, ReserveCreationInfo, ReserveRecord, + CurrencyRecord, + AuditorRecord, WalletBalance, WalletBalanceEntry, WireInfo, DenominationRecord, DenominationStatus, denominationRecordFromKeys, @@ -202,17 +204,6 @@ export interface NonceRecord { pub: string; } -export interface AuditorRecord { - baseUrl: string; - auditorPub: string; - expirationStamp: number; -} - -export interface CurrencyRecord { - name: string; - fractionalDigits: number; - auditors: AuditorRecord[]; -} export interface ConfigRecord { key: string; @@ -1714,6 +1705,21 @@ export class Wallet { .toArray(); } + async getCurrencies(): Promise<CurrencyRecord[]> { + return this.q() + .iter<CurrencyRecord>(Stores.currencies) + .flatMap((e) => [e]) + .toArray(); + } + + async updateCurrency(currencyRecord: CurrencyRecord): Promise<void> { + console.log("updating currency to", currencyRecord); + await this.q() + .put(Stores.currencies, currencyRecord) + .finish(); + this.notifier.notify(); + } + async getReserves(exchangeBaseUrl: string): Promise<ReserveRecord[]> { return this.q() .iter<ReserveRecord>(Stores.reserves) |