diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-06-04 18:46:32 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-06-04 18:46:32 +0200 |
commit | 8edbf426f7cf468c041cf0f87a44a68d1f6acd46 (patch) | |
tree | 9fd492e2930a934034786958773be722c2360b47 /src/wallet.ts | |
parent | c88bcce9987d4b5cc8123002485a928ff4191e94 (diff) |
nicer auditor display on withdraw
Diffstat (limited to 'src/wallet.ts')
-rw-r--r-- | src/wallet.ts | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/wallet.ts b/src/wallet.ts index ec7eade9c..1d72489c0 100644 --- a/src/wallet.ts +++ b/src/wallet.ts @@ -129,8 +129,8 @@ export class KeysJson { /** * The list of auditors (partially) auditing the exchange. */ - @Checkable.Any - auditors: any[]; + @Checkable.List(Checkable.Value(Auditor)) + auditors: Auditor[]; /** * Timestamp when this response was issued. @@ -321,6 +321,8 @@ export interface ConfigRecord { } +const WALLET_PROTOCOL_VERSION = "0:0:0"; + const builtinCurrencies: CurrencyRecord[] = [ { auditors: [ @@ -1452,7 +1454,7 @@ export class Wallet { } for (const trustedAuditor of currencyRecord.auditors) { for (const exchangeAuditor of exchangeInfo.auditors) { - if (trustedAuditor.baseUrl === exchangeAuditor.url) { + if (trustedAuditor.baseUrl === exchangeAuditor.auditor_url) { isAudited = true; break; } @@ -1495,13 +1497,28 @@ export class Wallet { } } + const possibleDenoms = await ( + this.q().iterIndex(Stores.denominations.exchangeBaseUrlIndex, baseUrl) + .filter((d) => d.isOffered) + .toArray() + ) || []; + + const currencyRecord = await this.q().get<CurrencyRecord>(Stores.currencies, amount.currency); + if (!currencyRecord) { + throw Error("currency not found"); + } + + const trustedAuditorPubs = currencyRecord.auditors.map((a) => a.auditorPub); + const ret: ReserveCreationInfo = { earliestDepositExpiration, exchangeInfo, isAudited, isTrusted, + numOfferedDenoms: possibleDenoms.length, overhead: Amounts.sub(amount, actualCoinCost).amount, selectedDenoms, + trustedAuditorPubs, wireFees, wireInfo, withdrawFee: acc, |