aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-13 02:36:33 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-13 02:36:33 +0200
commite4cafe672d07781c4cfcfa3b9d0e062ce367646c (patch)
tree7ad8b213a898236dee02a140207af301e8d400e4 /lib
parent250069d86097a966366d21e447f6c3fcc70659bd (diff)
downloadwallet-core-e4cafe672d07781c4cfcfa3b9d0e062ce367646c.tar.xz
manual refresh triggering
Diffstat (limited to 'lib')
-rw-r--r--lib/wallet/wallet.ts6
-rw-r--r--lib/wallet/wxApi.ts4
-rw-r--r--lib/wallet/wxMessaging.ts6
3 files changed, 15 insertions, 1 deletions
diff --git a/lib/wallet/wallet.ts b/lib/wallet/wallet.ts
index 49e4e0a8d..b248d5315 100644
--- a/lib/wallet/wallet.ts
+++ b/lib/wallet/wallet.ts
@@ -1136,8 +1136,12 @@ export class Wallet {
coin.currentAmount,
oldDenom.fee_refresh));
- // FIXME: implement rest
+ let reqUrl = URI("reserve/withdraw").absoluteTo(exchange!.baseUrl);
+ let resp = await this.http.postJson(reqUrl, {});
+
+ console.log("melt response:", resp.responseText);
+ // FIXME: implement rest
}
diff --git a/lib/wallet/wxApi.ts b/lib/wallet/wxApi.ts
index 12d11a387..9ed7aabd3 100644
--- a/lib/wallet/wxApi.ts
+++ b/lib/wallet/wxApi.ts
@@ -68,4 +68,8 @@ export async function getCoins(exchangeBaseUrl: string): Promise<Coin[]> {
export async function getPreCoins(exchangeBaseUrl: string): Promise<PreCoin[]> {
return await callBackend("get-precoins", { exchangeBaseUrl });
+}
+
+export async function refresh(coinPub: string): Promise<void> {
+ return await callBackend("refresh-coin", { coinPub });
} \ No newline at end of file
diff --git a/lib/wallet/wxMessaging.ts b/lib/wallet/wxMessaging.ts
index b1916b4bc..2c69afc99 100644
--- a/lib/wallet/wxMessaging.ts
+++ b/lib/wallet/wxMessaging.ts
@@ -204,6 +204,12 @@ function makeHandlers(db: IDBDatabase,
}
return wallet.getPreCoins(detail.exchangeBaseUrl);
},
+ ["refresh-coin"]: function (detail, sender) {
+ if (typeof detail.coinPub !== "string") {
+ return Promise.reject(Error("coinPub missing"));
+ }
+ return wallet.refresh(detail.coinPub);
+ },
["payment-failed"]: function (detail, sender) {
// For now we just update exchanges (maybe the exchange did something
// wrong and the keys were messed up).