organize imports

This commit is contained in:
Florian Dold 2021-02-08 15:38:34 +01:00
parent 4452984a24
commit 5ff5a686e4
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
6 changed files with 223 additions and 270 deletions

View File

@ -24,33 +24,31 @@
/** /**
* Imports. * Imports.
*/ */
import { InternalWalletState } from "./state"; import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
import { import {
Stores,
CoinStatus,
CoinSourceType,
CoinRecord, CoinRecord,
WithdrawCoinSource, CoinSourceType,
CoinStatus,
RecoupGroupRecord,
RefreshCoinSource, RefreshCoinSource,
ReserveRecordStatus, ReserveRecordStatus,
RecoupGroupRecord, Stores,
WithdrawCoinSource,
} from "../types/dbTypes"; } from "../types/dbTypes";
import { codecForRecoupConfirmation } from "../types/talerTypes";
import { NotificationType } from "../types/notifications"; import { NotificationType } from "../types/notifications";
import { getReserveRequestTimeout, processReserve } from "./reserves"; import { codecForRecoupConfirmation } from "../types/talerTypes";
import { Amounts } from "../util/amounts";
import { createRefreshGroup, processRefreshGroup } from "./refresh";
import { RefreshReason, TalerErrorDetails } from "../types/walletTypes"; import { RefreshReason, TalerErrorDetails } from "../types/walletTypes";
import { Store, StoreParams, TransactionHandle } from "../util/query"; import { Amounts } from "../util/amounts";
import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
import { getTimestampNow } from "../util/time";
import { guardOperationException } from "./errors";
import { readSuccessResponseJsonOrThrow } from "../util/http"; import { readSuccessResponseJsonOrThrow } from "../util/http";
import { URL } from "../util/url";
import { Logger } from "../util/logging"; import { Logger } from "../util/logging";
import { TransactionHandle } from "../util/query";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
import { getTimestampNow } from "../util/time";
import { URL } from "../util/url";
import { guardOperationException } from "./errors";
import { createRefreshGroup, processRefreshGroup } from "./refresh";
import { getReserveRequestTimeout, processReserve } from "./reserves";
import { InternalWalletState } from "./state";
const logger = new Logger("operations/recoup.ts"); const logger = new Logger("operations/recoup.ts");

View File

@ -14,54 +14,51 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
import { Amounts, AmountJson } from "../util/amounts"; import { encodeCrock, getRandomBytes } from "../crypto/talerCrypto";
import { RefreshNewDenomInfo } from "../types/cryptoTypes";
import { import {
DenominationRecord,
Stores,
CoinStatus,
RefreshPlanchet,
CoinRecord, CoinRecord,
RefreshSessionRecord,
RefreshGroupRecord,
CoinSourceType, CoinSourceType,
CoinStatus,
DenominationRecord,
RefreshGroupRecord,
RefreshPlanchet,
Stores,
} from "../types/dbTypes"; } from "../types/dbTypes";
import { amountToPretty } from "../util/helpers";
import { TransactionHandle } from "../util/query";
import { InternalWalletState, EXCHANGE_COINS_LOCK } from "./state";
import { Logger } from "../util/logging";
import { selectWithdrawalDenominations, isWithdrawableDenom } from "./withdraw";
import { updateExchangeFromUrl } from "./exchanges";
import {
TalerErrorDetails,
CoinPublicKey,
RefreshReason,
RefreshGroupId,
} from "../types/walletTypes";
import { guardOperationException } from "./errors";
import { NotificationType } from "../types/notifications"; import { NotificationType } from "../types/notifications";
import { getRandomBytes, encodeCrock } from "../crypto/talerCrypto";
import {
getTimestampNow,
Duration,
Timestamp,
isTimestampExpired,
durationFromSpec,
timestampMin,
timestampAddDuration,
timestampDifference,
durationMax,
durationMul,
} from "../util/time";
import { readSuccessResponseJsonOrThrow } from "../util/http";
import { import {
codecForExchangeMeltResponse, codecForExchangeMeltResponse,
codecForExchangeRevealResponse, codecForExchangeRevealResponse,
} from "../types/talerTypes"; } from "../types/talerTypes";
import { URL } from "../util/url"; import {
CoinPublicKey,
RefreshGroupId,
RefreshReason,
TalerErrorDetails,
} from "../types/walletTypes";
import { AmountJson, Amounts } from "../util/amounts";
import { amountToPretty } from "../util/helpers";
import { readSuccessResponseJsonOrThrow } from "../util/http";
import { checkDbInvariant } from "../util/invariants"; import { checkDbInvariant } from "../util/invariants";
import { Logger } from "../util/logging";
import { TransactionHandle } from "../util/query";
import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries"; import { initRetryInfo, updateRetryInfoTimeout } from "../util/retries";
import { WALLET_EXCHANGE_PROTOCOL_VERSION } from "./versions"; import {
import { RefreshNewDenomInfo } from "../types/cryptoTypes"; Duration,
durationFromSpec,
durationMul,
getTimestampNow,
isTimestampExpired,
Timestamp,
timestampAddDuration,
timestampDifference,
timestampMin,
} from "../util/time";
import { URL } from "../util/url";
import { guardOperationException } from "./errors";
import { updateExchangeFromUrl } from "./exchanges";
import { EXCHANGE_COINS_LOCK, InternalWalletState } from "./state";
import { isWithdrawableDenom, selectWithdrawalDenominations } from "./withdraw";
const logger = new Logger("refresh.ts"); const logger = new Logger("refresh.ts");

View File

@ -31,11 +31,11 @@ import {
ExchangeWithdrawDetails, ExchangeWithdrawDetails,
TalerErrorDetails, TalerErrorDetails,
ExchangeListItem, ExchangeListItem,
WithdrawUriInfoResponse,
} from "../types/walletTypes"; } from "../types/walletTypes";
import { import {
codecForWithdrawOperationStatusResponse, codecForWithdrawOperationStatusResponse,
codecForWithdrawResponse, codecForWithdrawResponse,
WithdrawUriInfoResponse,
WithdrawResponse, WithdrawResponse,
codecForTalerConfigResponse, codecForTalerConfigResponse,
} from "../types/talerTypes"; } from "../types/talerTypes";

View File

@ -47,7 +47,6 @@ import {
Duration, Duration,
codecForDuration, codecForDuration,
} from "../util/time"; } from "../util/time";
import { ExchangeListItem, codecForExchangeListItem } from "./walletTypes";
import { codecForAmountString } from "../util/amounts"; import { codecForAmountString } from "../util/amounts";
/** /**
@ -983,21 +982,6 @@ export interface MerchantOrderStatusUnpaid {
already_paid_order_id?: string; already_paid_order_id?: string;
} }
export interface WithdrawUriInfoResponse {
amount: AmountString;
defaultExchangeBaseUrl?: string;
possibleExchanges: ExchangeListItem[];
}
export const codecForWithdrawUriInfoResponse = (): Codec<
WithdrawUriInfoResponse
> =>
buildCodecForObject<WithdrawUriInfoResponse>()
.property("amount", codecForAmountString())
.property("defaultExchangeBaseUrl", codecOptional(codecForString()))
.property("possibleExchanges", codecForList(codecForExchangeListItem()))
.build("WithdrawUriInfoResponse");
/** /**
* Response body for the following endpoint: * Response body for the following endpoint:
* *

View File

@ -225,9 +225,7 @@ export interface ConfirmPayResultPending {
export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending; export type ConfirmPayResult = ConfirmPayResultDone | ConfirmPayResultPending;
export const codecForConfirmPayResultPending = (): Codec< export const codecForConfirmPayResultPending = (): Codec<ConfirmPayResultPending> =>
ConfirmPayResultPending
> =>
buildCodecForObject<ConfirmPayResultPending>() buildCodecForObject<ConfirmPayResultPending>()
.property("lastError", codecForAny()) .property("lastError", codecForAny())
.property("type", codecForConstString(ConfirmPayResultType.Pending)) .property("type", codecForConstString(ConfirmPayResultType.Pending))
@ -413,9 +411,7 @@ export enum PreparePayResultType {
AlreadyConfirmed = "already-confirmed", AlreadyConfirmed = "already-confirmed",
} }
export const codecForPreparePayResultPaymentPossible = (): Codec< export const codecForPreparePayResultPaymentPossible = (): Codec<PreparePayResultPaymentPossible> =>
PreparePayResultPaymentPossible
> =>
buildCodecForObject<PreparePayResultPaymentPossible>() buildCodecForObject<PreparePayResultPaymentPossible>()
.property("amountEffective", codecForAmountString()) .property("amountEffective", codecForAmountString())
.property("amountRaw", codecForAmountString()) .property("amountRaw", codecForAmountString())
@ -427,9 +423,7 @@ export const codecForPreparePayResultPaymentPossible = (): Codec<
) )
.build("PreparePayResultPaymentPossible"); .build("PreparePayResultPaymentPossible");
export const codecForPreparePayResultInsufficientBalance = (): Codec< export const codecForPreparePayResultInsufficientBalance = (): Codec<PreparePayResultInsufficientBalance> =>
PreparePayResultInsufficientBalance
> =>
buildCodecForObject<PreparePayResultInsufficientBalance>() buildCodecForObject<PreparePayResultInsufficientBalance>()
.property("amountRaw", codecForAmountString()) .property("amountRaw", codecForAmountString())
.property("contractTerms", codecForAny()) .property("contractTerms", codecForAny())
@ -440,9 +434,7 @@ export const codecForPreparePayResultInsufficientBalance = (): Codec<
) )
.build("PreparePayResultInsufficientBalance"); .build("PreparePayResultInsufficientBalance");
export const codecForPreparePayResultAlreadyConfirmed = (): Codec< export const codecForPreparePayResultAlreadyConfirmed = (): Codec<PreparePayResultAlreadyConfirmed> =>
PreparePayResultAlreadyConfirmed
> =>
buildCodecForObject<PreparePayResultAlreadyConfirmed>() buildCodecForObject<PreparePayResultAlreadyConfirmed>()
.property( .property(
"status", "status",
@ -734,9 +726,7 @@ export interface ForceExchangeUpdateRequest {
exchangeBaseUrl: string; exchangeBaseUrl: string;
} }
export const codecForForceExchangeUpdateRequest = (): Codec< export const codecForForceExchangeUpdateRequest = (): Codec<AddExchangeRequest> =>
AddExchangeRequest
> =>
buildCodecForObject<AddExchangeRequest>() buildCodecForObject<AddExchangeRequest>()
.property("exchangeBaseUrl", codecForString()) .property("exchangeBaseUrl", codecForString())
.build("AddExchangeRequest"); .build("AddExchangeRequest");
@ -755,9 +745,7 @@ export interface AcceptManualWithdrawalRequest {
amount: string; amount: string;
} }
export const codecForAcceptManualWithdrawalRequet = (): Codec< export const codecForAcceptManualWithdrawalRequet = (): Codec<AcceptManualWithdrawalRequest> =>
AcceptManualWithdrawalRequest
> =>
buildCodecForObject<AcceptManualWithdrawalRequest>() buildCodecForObject<AcceptManualWithdrawalRequest>()
.property("exchangeBaseUrl", codecForString()) .property("exchangeBaseUrl", codecForString())
.property("amount", codecForString()) .property("amount", codecForString())
@ -773,17 +761,13 @@ export interface AcceptBankIntegratedWithdrawalRequest {
exchangeBaseUrl: string; exchangeBaseUrl: string;
} }
export const codecForAcceptBankIntegratedWithdrawalRequest = (): Codec< export const codecForAcceptBankIntegratedWithdrawalRequest = (): Codec<AcceptBankIntegratedWithdrawalRequest> =>
AcceptBankIntegratedWithdrawalRequest
> =>
buildCodecForObject<AcceptBankIntegratedWithdrawalRequest>() buildCodecForObject<AcceptBankIntegratedWithdrawalRequest>()
.property("exchangeBaseUrl", codecForString()) .property("exchangeBaseUrl", codecForString())
.property("talerWithdrawUri", codecForString()) .property("talerWithdrawUri", codecForString())
.build("AcceptBankIntegratedWithdrawalRequest"); .build("AcceptBankIntegratedWithdrawalRequest");
export const codecForGetWithdrawalDetailsForAmountRequest = (): Codec< export const codecForGetWithdrawalDetailsForAmountRequest = (): Codec<GetWithdrawalDetailsForAmountRequest> =>
GetWithdrawalDetailsForAmountRequest
> =>
buildCodecForObject<GetWithdrawalDetailsForAmountRequest>() buildCodecForObject<GetWithdrawalDetailsForAmountRequest>()
.property("exchangeBaseUrl", codecForString()) .property("exchangeBaseUrl", codecForString())
.property("amount", codecForString()) .property("amount", codecForString())
@ -794,9 +778,7 @@ export interface AcceptExchangeTosRequest {
etag: string; etag: string;
} }
export const codecForAcceptExchangeTosRequest = (): Codec< export const codecForAcceptExchangeTosRequest = (): Codec<AcceptExchangeTosRequest> =>
AcceptExchangeTosRequest
> =>
buildCodecForObject<AcceptExchangeTosRequest>() buildCodecForObject<AcceptExchangeTosRequest>()
.property("exchangeBaseUrl", codecForString()) .property("exchangeBaseUrl", codecForString())
.property("etag", codecForString()) .property("etag", codecForString())
@ -815,9 +797,7 @@ export interface GetWithdrawalDetailsForUriRequest {
talerWithdrawUri: string; talerWithdrawUri: string;
} }
export const codecForGetWithdrawalDetailsForUri = (): Codec< export const codecForGetWithdrawalDetailsForUri = (): Codec<GetWithdrawalDetailsForUriRequest> =>
GetWithdrawalDetailsForUriRequest
> =>
buildCodecForObject<GetWithdrawalDetailsForUriRequest>() buildCodecForObject<GetWithdrawalDetailsForUriRequest>()
.property("talerWithdrawUri", codecForString()) .property("talerWithdrawUri", codecForString())
.build("GetWithdrawalDetailsForUriRequest"); .build("GetWithdrawalDetailsForUriRequest");
@ -920,9 +900,7 @@ export interface RecoveryLoadRequest {
strategy?: RecoveryMergeStrategy; strategy?: RecoveryMergeStrategy;
} }
export const codecForWithdrawTestBalance = (): Codec< export const codecForWithdrawTestBalance = (): Codec<WithdrawTestBalanceRequest> =>
WithdrawTestBalanceRequest
> =>
buildCodecForObject<WithdrawTestBalanceRequest>() buildCodecForObject<WithdrawTestBalanceRequest>()
.property("amount", codecForString()) .property("amount", codecForString())
.property("bankBaseUrl", codecForString()) .property("bankBaseUrl", codecForString())
@ -961,9 +939,7 @@ export interface SetCoinSuspendedRequest {
suspended: boolean; suspended: boolean;
} }
export const codecForSetCoinSuspendedRequest = (): Codec< export const codecForSetCoinSuspendedRequest = (): Codec<SetCoinSuspendedRequest> =>
SetCoinSuspendedRequest
> =>
buildCodecForObject<SetCoinSuspendedRequest>() buildCodecForObject<SetCoinSuspendedRequest>()
.property("coinPub", codecForString()) .property("coinPub", codecForString())
.property("suspended", codecForBoolean()) .property("suspended", codecForBoolean())
@ -1000,9 +976,7 @@ export interface AbortPayWithRefundRequest {
proposalId: string; proposalId: string;
} }
export const codecForAbortPayWithRefundRequest = (): Codec< export const codecForAbortPayWithRefundRequest = (): Codec<AbortPayWithRefundRequest> =>
AbortPayWithRefundRequest
> =>
buildCodecForObject<AbortPayWithRefundRequest>() buildCodecForObject<AbortPayWithRefundRequest>()
.property("proposalId", codecForString()) .property("proposalId", codecForString())
.build("AbortPayWithRefundRequest"); .build("AbortPayWithRefundRequest");
@ -1012,9 +986,7 @@ export interface CreateDepositGroupRequest {
amount: string; amount: string;
} }
export const codecForCreateDepositGroupRequest = (): Codec< export const codecForCreateDepositGroupRequest = (): Codec<CreateDepositGroupRequest> =>
CreateDepositGroupRequest
> =>
buildCodecForObject<CreateDepositGroupRequest>() buildCodecForObject<CreateDepositGroupRequest>()
.property("amount", codecForAmountString()) .property("amount", codecForAmountString())
.property("depositPaytoUri", codecForString()) .property("depositPaytoUri", codecForString())
@ -1035,9 +1007,20 @@ export interface TrackDepositGroupResponse {
}[]; }[];
} }
export const codecForTrackDepositGroupRequest = (): Codec< export const codecForTrackDepositGroupRequest = (): Codec<TrackDepositGroupRequest> =>
TrackDepositGroupRequest
> =>
buildCodecForObject<TrackDepositGroupRequest>() buildCodecForObject<TrackDepositGroupRequest>()
.property("depositGroupId", codecForAmountString()) .property("depositGroupId", codecForAmountString())
.build("TrackDepositGroupRequest"); .build("TrackDepositGroupRequest");
export interface WithdrawUriInfoResponse {
amount: AmountString;
defaultExchangeBaseUrl?: string;
possibleExchanges: ExchangeListItem[];
}
export const codecForWithdrawUriInfoResponse = (): Codec<WithdrawUriInfoResponse> =>
buildCodecForObject<WithdrawUriInfoResponse>()
.property("amount", codecForAmountString())
.property("defaultExchangeBaseUrl", codecOptional(codecForString()))
.property("possibleExchanges", codecForList(codecForExchangeListItem()))
.build("WithdrawUriInfoResponse");

View File

@ -22,169 +22,160 @@
/** /**
* Imports. * Imports.
*/ */
import { CryptoWorkerFactory } from "./crypto/workers/cryptoApi";
import { HttpRequestLibrary } from "./util/http";
import { Database, Store } from "./util/query";
import { Amounts, AmountJson } from "./util/amounts";
import {
getExchangeWithdrawalInfo,
getWithdrawalDetailsForUri,
} from "./operations/withdraw";
import {
preparePayForUri,
refuseProposal,
confirmPay,
processDownloadProposal,
processPurchasePay,
} from "./operations/pay";
import {
CoinRecord,
CurrencyRecord,
DenominationRecord,
ExchangeRecord,
PurchaseRecord,
ReserveRecord,
Stores,
ReserveRecordStatus,
CoinSourceType,
RefundState,
MetaStores,
DepositGroupRecord,
} from "./types/dbTypes";
import { CoinDumpJson, WithdrawUriInfoResponse } from "./types/talerTypes";
import {
BenchmarkResult,
ConfirmPayResult,
ReturnCoinsRequest,
SenderWireInfos,
PreparePayResult,
AcceptWithdrawalResponse,
PurchaseDetails,
RefreshReason,
ExchangeListItem,
ExchangesListRespose,
ManualWithdrawalDetails,
GetExchangeTosResult,
AcceptManualWithdrawalResult,
BalancesResponse,
TestPayArgs,
IntegrationTestArgs,
codecForAddExchangeRequest,
codecForGetWithdrawalDetailsForUri,
codecForAcceptManualWithdrawalRequet,
codecForGetWithdrawalDetailsForAmountRequest,
codecForAcceptExchangeTosRequest,
codecForApplyRefundRequest,
codecForAcceptBankIntegratedWithdrawalRequest,
codecForGetExchangeTosRequest,
codecForConfirmPayRequest,
CoreApiResponse,
codecForPreparePayRequest,
codecForIntegrationTestArgs,
WithdrawTestBalanceRequest,
codecForWithdrawTestBalance,
codecForTestPayArgs,
codecForSetCoinSuspendedRequest,
codecForForceExchangeUpdateRequest,
codecForForceRefreshRequest,
PrepareTipResult,
codecForPrepareTipRequest,
codecForAcceptTipRequest,
codecForAbortPayWithRefundRequest,
ApplyRefundResponse,
RecoveryLoadRequest,
codecForCreateDepositGroupRequest,
CreateDepositGroupRequest,
CreateDepositGroupResponse,
codecForTrackDepositGroupRequest,
TrackDepositGroupRequest,
TrackDepositGroupResponse,
} from "./types/walletTypes";
import { Logger } from "./util/logging";
import { assertUnreachable } from "./util/assertUnreachable";
import {
updateExchangeFromUrl,
getExchangeTrust,
getExchangePaytoUri,
acceptExchangeTermsOfService,
} from "./operations/exchanges";
import {
processReserve,
createTalerWithdrawReserve,
forceQueryReserve,
getFundingPaytoUris,
} from "./operations/reserves";
import { InternalWalletState } from "./operations/state";
import { createReserve } from "./operations/reserves";
import {
processRefreshGroup,
createRefreshGroup,
autoRefresh,
} from "./operations/refresh";
import { processWithdrawGroup } from "./operations/withdraw";
import { getPendingOperations } from "./operations/pending";
import { getBalances } from "./operations/balance";
import { acceptTip, prepareTip, processTip } from "./operations/tip";
import { TimerGroup } from "./util/timer";
import { AsyncCondition } from "./util/promiseUtils";
import { AsyncOpMemoSingle } from "./util/asyncMemo";
import {
PendingOperationInfo,
PendingOperationsResponse,
PendingOperationType,
} from "./types/pendingTypes";
import { WalletNotification, NotificationType } from "./types/notifications";
import {
processPurchaseQueryRefund,
applyRefund,
abortFailedPayWithRefund,
} from "./operations/refund";
import { durationMin, Duration } from "./util/time";
import { processRecoupGroup } from "./operations/recoup";
import {
OperationFailedAndReportedError,
OperationFailedError,
makeErrorDetails,
} from "./operations/errors";
import {
TransactionsRequest,
TransactionsResponse,
codecForTransactionsRequest,
} from "./types/transactionsTypes";
import { getTransactions } from "./operations/transactions";
import {
withdrawTestBalance,
runIntegrationTest,
testPay,
} from "./operations/testing";
import { TalerErrorCode } from "."; import { TalerErrorCode } from ".";
import { CryptoWorkerFactory } from "./crypto/workers/cryptoApi";
import { import {
addBackupProvider, addBackupProvider,
codecForAddBackupProviderRequest,
runBackupCycle,
exportBackup,
importBackupPlain,
exportBackupEncrypted,
importBackupEncrypted,
BackupRecovery,
getBackupRecovery,
AddBackupProviderRequest, AddBackupProviderRequest,
getBackupInfo,
BackupInfo, BackupInfo,
BackupRecovery,
codecForAddBackupProviderRequest,
exportBackup,
exportBackupEncrypted,
getBackupInfo,
getBackupRecovery,
importBackupEncrypted,
importBackupPlain,
loadBackupRecovery, loadBackupRecovery,
runBackupCycle,
} from "./operations/backup"; } from "./operations/backup";
import { getBalances } from "./operations/balance";
import { import {
createDepositGroup, createDepositGroup,
processDepositGroup, processDepositGroup,
trackDepositGroup, trackDepositGroup,
} from "./operations/deposits"; } from "./operations/deposits";
import {
makeErrorDetails,
OperationFailedAndReportedError,
OperationFailedError,
} from "./operations/errors";
import {
acceptExchangeTermsOfService,
getExchangePaytoUri,
getExchangeTrust,
updateExchangeFromUrl,
} from "./operations/exchanges";
import {
confirmPay,
preparePayForUri,
processDownloadProposal,
processPurchasePay,
refuseProposal,
} from "./operations/pay";
import { getPendingOperations } from "./operations/pending";
import { processRecoupGroup } from "./operations/recoup";
import {
autoRefresh,
createRefreshGroup,
processRefreshGroup,
} from "./operations/refresh";
import {
abortFailedPayWithRefund,
applyRefund,
processPurchaseQueryRefund,
} from "./operations/refund";
import {
createReserve,
createTalerWithdrawReserve,
forceQueryReserve,
getFundingPaytoUris,
processReserve,
} from "./operations/reserves";
import { InternalWalletState } from "./operations/state";
import {
runIntegrationTest,
testPay,
withdrawTestBalance,
} from "./operations/testing";
import { acceptTip, prepareTip, processTip } from "./operations/tip";
import { getTransactions } from "./operations/transactions";
import {
getExchangeWithdrawalInfo,
getWithdrawalDetailsForUri,
processWithdrawGroup,
} from "./operations/withdraw";
import {
CoinRecord,
CoinSourceType,
CurrencyRecord,
DenominationRecord,
ExchangeRecord,
PurchaseRecord,
RefundState,
ReserveRecord,
ReserveRecordStatus,
Stores,
} from "./types/dbTypes";
import { NotificationType, WalletNotification } from "./types/notifications";
import {
PendingOperationInfo,
PendingOperationsResponse,
PendingOperationType,
} from "./types/pendingTypes";
import { CoinDumpJson } from "./types/talerTypes";
import {
codecForTransactionsRequest,
TransactionsRequest,
TransactionsResponse,
} from "./types/transactionsTypes";
import {
AcceptManualWithdrawalResult,
AcceptWithdrawalResponse,
ApplyRefundResponse,
BalancesResponse,
BenchmarkResult,
codecForAbortPayWithRefundRequest,
codecForAcceptBankIntegratedWithdrawalRequest,
codecForAcceptExchangeTosRequest,
codecForAcceptManualWithdrawalRequet,
codecForAcceptTipRequest,
codecForAddExchangeRequest,
codecForApplyRefundRequest,
codecForConfirmPayRequest,
codecForCreateDepositGroupRequest,
codecForForceExchangeUpdateRequest,
codecForForceRefreshRequest,
codecForGetExchangeTosRequest,
codecForGetWithdrawalDetailsForAmountRequest,
codecForGetWithdrawalDetailsForUri,
codecForIntegrationTestArgs,
codecForPreparePayRequest,
codecForPrepareTipRequest,
codecForSetCoinSuspendedRequest,
codecForTestPayArgs,
codecForTrackDepositGroupRequest,
codecForWithdrawTestBalance,
ConfirmPayResult,
CoreApiResponse,
CreateDepositGroupRequest,
CreateDepositGroupResponse,
ExchangeListItem,
ExchangesListRespose,
GetExchangeTosResult,
IntegrationTestArgs,
ManualWithdrawalDetails,
PreparePayResult,
PrepareTipResult,
PurchaseDetails,
RecoveryLoadRequest,
RefreshReason,
ReturnCoinsRequest,
TestPayArgs,
TrackDepositGroupRequest,
TrackDepositGroupResponse,
WithdrawTestBalanceRequest,
WithdrawUriInfoResponse,
} from "./types/walletTypes";
import { AmountJson, Amounts } from "./util/amounts";
import { assertUnreachable } from "./util/assertUnreachable";
import { AsyncOpMemoSingle } from "./util/asyncMemo";
import { HttpRequestLibrary } from "./util/http";
import { Logger } from "./util/logging";
import { AsyncCondition } from "./util/promiseUtils";
import { Database } from "./util/query";
import { Duration, durationMin } from "./util/time";
import { TimerGroup } from "./util/timer";
const builtinCurrencies: CurrencyRecord[] = [ const builtinCurrencies: CurrencyRecord[] = [
{ {
@ -651,9 +642,9 @@ export class Wallet {
return await this.db.get(Stores.exchanges, exchangeBaseUrl); return await this.db.get(Stores.exchanges, exchangeBaseUrl);
} }
async getPendingOperations({ onlyDue = false } = {}): Promise< async getPendingOperations({
PendingOperationsResponse onlyDue = false,
> { } = {}): Promise<PendingOperationsResponse> {
return this.ws.memoGetPending.memo(() => return this.ws.memoGetPending.memo(() =>
getPendingOperations(this.ws, { onlyDue }), getPendingOperations(this.ws, { onlyDue }),
); );