[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] branch master updated: support exchange API version
From: |
gnunet |
Subject: |
[taler-wallet-core] branch master updated: support exchange API version 7:0:0 |
Date: |
Mon, 09 Mar 2020 12:07:53 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
The following commit(s) were added to refs/heads/master by this push:
new 26d961ad support exchange API version 7:0:0
26d961ad is described below
commit 26d961ad633027f50ee402b9a7e7fa383c2b33c3
Author: Florian Dold <address@hidden>
AuthorDate: Mon Mar 9 16:37:46 2020 +0530
support exchange API version 7:0:0
---
src/operations/exchanges.ts | 1 +
src/operations/refresh.ts | 19 +++++++++++++++----
src/operations/refund.ts | 2 +-
src/operations/reserves.ts | 5 ++---
src/operations/versions.ts | 2 +-
src/operations/withdraw.ts | 2 +-
6 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/operations/exchanges.ts b/src/operations/exchanges.ts
index 89f89ec1..cf6b0686 100644
--- a/src/operations/exchanges.ts
+++ b/src/operations/exchanges.ts
@@ -77,6 +77,7 @@ async function setExchangeError(
baseUrl: string,
err: OperationError,
): Promise<void> {
+ console.log(`last error for exchange ${baseUrl}:`, err);
const mut = (exchange: ExchangeRecord) => {
exchange.lastError = err;
return exchange;
diff --git a/src/operations/refresh.ts b/src/operations/refresh.ts
index b53baf39..6dd16d61 100644
--- a/src/operations/refresh.ts
+++ b/src/operations/refresh.ts
@@ -229,7 +229,10 @@ async function refreshMelt(
return;
}
- const reqUrl = new URL("refresh/melt", refreshSession.exchangeBaseUrl);
+ const reqUrl = new URL(
+ `coins/${coin.coinPub}/melt`,
+ refreshSession.exchangeBaseUrl,
+ );
const meltReq = {
coin_pub: coin.coinPub,
confirm_sig: refreshSession.confirmSig,
@@ -244,7 +247,10 @@ async function refreshMelt(
console.log(`got status ${resp.status} for refresh/melt`);
try {
const respJson = await resp.json();
- console.log(`body of refresh/melt error response:`,
JSON.stringify(respJson, undefined, 2));
+ console.log(
+ `body of refresh/melt error response:`,
+ JSON.stringify(respJson, undefined, 2),
+ );
} catch (e) {
console.log(`body of refresh/melt error response is not JSON`);
}
@@ -344,7 +350,10 @@ async function refreshReveal(
link_sigs: linkSigs,
};
- const reqUrl = new URL("refresh/reveal", refreshSession.exchangeBaseUrl);
+ const reqUrl = new URL(
+ `refreshes/${refreshSession.hash}/reveal`,
+ refreshSession.exchangeBaseUrl,
+ );
logger.trace("reveal request:", req);
let resp;
@@ -523,7 +532,9 @@ async function processRefreshSession(
refreshGroupId: string,
coinIndex: number,
) {
- logger.trace(`processing refresh session for coin ${coinIndex} of group
${refreshGroupId}`);
+ logger.trace(
+ `processing refresh session for coin ${coinIndex} of group
${refreshGroupId}`,
+ );
let refreshGroup = await ws.db.get(Stores.refreshGroups, refreshGroupId);
if (!refreshGroup) {
return;
diff --git a/src/operations/refund.ts b/src/operations/refund.ts
index 2fb3a239..9d1c5308 100644
--- a/src/operations/refund.ts
+++ b/src/operations/refund.ts
@@ -423,7 +423,7 @@ async function processPurchaseApplyRefundImpl(
console.log("sending refund permission", perm);
// FIXME: not correct once we support multiple exchanges per payment
const exchangeUrl = purchase.payReq.coins[0].exchange_url;
- const reqUrl = new URL("refund", exchangeUrl);
+ const reqUrl = new URL(`coins/${perm.coin_pub}/refund`, exchangeUrl);
const resp = await ws.http.postJson(reqUrl.href, req);
console.log("sent refund permission");
switch (resp.status) {
diff --git a/src/operations/reserves.ts b/src/operations/reserves.ts
index 463b57b6..1f9cc305 100644
--- a/src/operations/reserves.ts
+++ b/src/operations/reserves.ts
@@ -402,12 +402,11 @@ async function updateReserve(
return;
}
- const reqUrl = new URL("reserve/status", reserve.exchangeBaseUrl);
- reqUrl.searchParams.set("reserve_pub", reservePub);
+ const reqUrl = new URL(`reserves/${reservePub}`, reserve.exchangeBaseUrl);
let resp;
try {
resp = await ws.http.get(reqUrl.href);
- console.log("got reserve/status response", await resp.json());
+ console.log("got reserves/${RESERVE_PUB} response", await resp.json());
if (resp.status === 404) {
const m = "reserve not known to the exchange yet"
throw new OperationFailedError(m, {
diff --git a/src/operations/versions.ts b/src/operations/versions.ts
index 393bdd88..6ac78f01 100644
--- a/src/operations/versions.ts
+++ b/src/operations/versions.ts
@@ -20,7 +20,7 @@
*
* Uses libtool's current:revision:age versioning.
*/
-export const WALLET_EXCHANGE_PROTOCOL_VERSION = "6";
+export const WALLET_EXCHANGE_PROTOCOL_VERSION = "7:0:0";
/**
* Cache breaker that is appended to queries such as /keys and /wire
diff --git a/src/operations/withdraw.ts b/src/operations/withdraw.ts
index 3a1f3cf0..0c58f5f2 100644
--- a/src/operations/withdraw.ts
+++ b/src/operations/withdraw.ts
@@ -197,7 +197,7 @@ async function processPlanchet(
wd.reserve_pub = planchet.reservePub;
wd.reserve_sig = planchet.withdrawSig;
wd.coin_ev = planchet.coinEv;
- const reqUrl = new URL("reserve/withdraw", exchange.baseUrl).href;
+ const reqUrl = new URL(`reserves/${planchet.reservePub}/withdraw`,
exchange.baseUrl).href;
const resp = await ws.http.postJson(reqUrl, wd);
if (resp.status !== 200) {
throw Error(`unexpected status ${resp.status} for withdraw`);
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-wallet-core] branch master updated: support exchange API version 7:0:0,
gnunet <=