diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-12-06 00:24:34 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-12-06 00:24:34 +0100 |
commit | 65bccbd139c53a2baccec442a680373125488102 (patch) | |
tree | 216860ec3523af33091b8fb52193787034c667f8 /src/wallet-impl/exchanges.ts | |
parent | 7b54439fd62bd2a5e15b3068a8fbaffeb0a57468 (diff) | |
download | wallet-core-65bccbd139c53a2baccec442a680373125488102.tar.xz |
separate operations for pay, refund status query and refund submission
Diffstat (limited to 'src/wallet-impl/exchanges.ts')
-rw-r--r-- | src/wallet-impl/exchanges.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/wallet-impl/exchanges.ts b/src/wallet-impl/exchanges.ts index b6a2f1c8a..3814971a3 100644 --- a/src/wallet-impl/exchanges.ts +++ b/src/wallet-impl/exchanges.ts @@ -44,7 +44,10 @@ import { } from "../util/query"; import * as Amounts from "../util/amounts"; import { parsePaytoUri } from "../util/payto"; -import { OperationFailedAndReportedError } from "./errors"; +import { + OperationFailedAndReportedError, + guardOperationException, +} from "./errors"; async function denominationRecordFromKeys( ws: InternalWalletState, @@ -307,12 +310,24 @@ async function updateExchangeWithWireInfo( }); } +export async function updateExchangeFromUrl( + ws: InternalWalletState, + baseUrl: string, + force: boolean = false, +): Promise<ExchangeRecord> { + const onOpErr = (e: OperationError) => setExchangeError(ws, baseUrl, e); + return await guardOperationException( + () => updateExchangeFromUrlImpl(ws, baseUrl, force), + onOpErr, + ); +} + /** * Update or add exchange DB entry by fetching the /keys and /wire information. * Optionally link the reserve entry to the new or existing * exchange entry in then DB. */ -export async function updateExchangeFromUrl( +async function updateExchangeFromUrlImpl( ws: InternalWalletState, baseUrl: string, force: boolean = false, |