diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-07-28 23:17:12 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-07-28 23:17:12 +0530 |
commit | 732e764b376dff6b0262b869b29dbdee0c455a0e (patch) | |
tree | d1bcb7ed2257941251aec03346de321ec895deb4 /src/types | |
parent | 43655adff0f8f1db082e1f0c18f1271a29ab8905 (diff) | |
download | wallet-core-732e764b376dff6b0262b869b29dbdee0c455a0e.tar.xz |
new balances API, remove defunct 'return funds to own account' implementation
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/pending.ts | 4 | ||||
-rw-r--r-- | src/types/walletTypes.ts | 52 |
2 files changed, 17 insertions, 39 deletions
diff --git a/src/types/pending.ts b/src/types/pending.ts index e6c879992..85f7585c5 100644 --- a/src/types/pending.ts +++ b/src/types/pending.ts @@ -21,7 +21,7 @@ /** * Imports. */ -import { OperationErrorDetails, WalletBalance } from "./walletTypes"; +import { OperationErrorDetails, BalancesResponse } from "./walletTypes"; import { WithdrawalSource, RetryInfo, ReserveRecordStatus } from "./dbTypes"; import { Timestamp, Duration } from "../util/time"; @@ -243,7 +243,7 @@ export interface PendingOperationsResponse { /** * Current wallet balance, including pending balances. */ - walletBalance: WalletBalance; + walletBalance: BalancesResponse; /** * When is the next pending operation due to be re-tried? diff --git a/src/types/walletTypes.ts b/src/types/walletTypes.ts index d68f41564..f37815333 100644 --- a/src/types/walletTypes.ts +++ b/src/types/walletTypes.ts @@ -146,48 +146,26 @@ export interface ExchangeWithdrawDetails { walletVersion: string; } -/** - * Mapping from currency/exchange to detailed balance - * information. - */ -export interface WalletBalance { - /** - * Mapping from currency name to detailed balance info. - */ - byExchange: { [exchangeBaseUrl: string]: WalletBalanceEntry }; - /** - * Mapping from currency name to detailed balance info. - */ - byCurrency: { [currency: string]: WalletBalanceEntry }; -} +export interface Balance { + available: AmountString; + pendingIncoming: AmountString; + pendingOutgoing: AmountString; -/** - * Detailed wallet balance for a particular currency. - */ -export interface WalletBalanceEntry { - /** - * Directly available amount. - */ - available: AmountJson; - /** - * Amount that we're waiting for (refresh, withdrawal). - */ - pendingIncoming: AmountJson; - /** - * Amount that's marked for a pending payment. - */ - pendingPayment: AmountJson; - /** - * Amount that was paid back and we could withdraw again. - */ - paybackAmount: AmountJson; + // Does the balance for this currency have a pending + // transaction? + hasPendingTransactions: boolean; - pendingIncomingWithdraw: AmountJson; - pendingIncomingRefresh: AmountJson; - pendingIncomingDirty: AmountJson; + // Is there a pending transaction that would affect the balance + // and requires user input? + requiresUserInput: boolean; } +export interface BalancesResponse { + balances: Balance[]; +} + + /** * For terseness. */ |