aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--src/i18n/de.po16
-rw-r--r--src/i18n/en-US.po16
-rw-r--r--src/i18n/fr.po16
-rw-r--r--src/i18n/it.po16
-rw-r--r--src/i18n/taler-wallet-webex.pot16
-rw-r--r--src/types.ts13
-rw-r--r--src/wallet.ts24
-rw-r--r--src/webex/pages/confirm-create-reserve.tsx34
-rw-r--r--src/webex/style/wallet.css19
-rw-r--r--src/webex/wxBackend.ts2
11 files changed, 131 insertions, 43 deletions
diff --git a/.gitignore b/.gitignore
index c8ef9b056..d7a865b9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@ dist/
# Even though node_modules are tracked in git,
# per default we don't want them to show up in git status
node_modules
+
+*.swp
diff --git a/src/i18n/de.po b/src/i18n/de.po
index 171e8b058..5bf73c8ab 100644
--- a/src/i18n/de.po
+++ b/src/i18n/de.po
@@ -151,44 +151,44 @@ msgid ""
"selected."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:424
+#: src/webex/pages/confirm-create-reserve.tsx:455
#, c-format
msgid "Accept fees and withdraw"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:429
+#: src/webex/pages/confirm-create-reserve.tsx:460
#, c-format
msgid "Change Exchange Provider"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:485
+#: src/webex/pages/confirm-create-reserve.tsx:517
#, c-format
msgid "You are about to withdraw %1$s from your bank account into your wallet."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:568
+#: src/webex/pages/confirm-create-reserve.tsx:600
#, c-format
msgid ""
"Oops, something went wrong. The wallet responded with error status (%1$s)."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:579
+#: src/webex/pages/confirm-create-reserve.tsx:611
#, c-format
msgid "Checking URL, please wait ..."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:593
+#: src/webex/pages/confirm-create-reserve.tsx:625
#, c-format
msgid "Can't parse amount: %1$s"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:600
+#: src/webex/pages/confirm-create-reserve.tsx:632
#, c-format
msgid "Can't parse wire_types: %1$s"
msgstr ""
#. TODO:generic error reporting function or component.
-#: src/webex/pages/confirm-create-reserve.tsx:620
+#: src/webex/pages/confirm-create-reserve.tsx:652
#, c-format
msgid "Fatal error: \"%1$s\"."
msgstr ""
diff --git a/src/i18n/en-US.po b/src/i18n/en-US.po
index 7870ff891..e548014e6 100644
--- a/src/i18n/en-US.po
+++ b/src/i18n/en-US.po
@@ -151,44 +151,44 @@ msgid ""
"selected."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:424
+#: src/webex/pages/confirm-create-reserve.tsx:455
#, c-format
msgid "Accept fees and withdraw"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:429
+#: src/webex/pages/confirm-create-reserve.tsx:460
#, c-format
msgid "Change Exchange Provider"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:485
+#: src/webex/pages/confirm-create-reserve.tsx:517
#, c-format
msgid "You are about to withdraw %1$s from your bank account into your wallet."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:568
+#: src/webex/pages/confirm-create-reserve.tsx:600
#, c-format
msgid ""
"Oops, something went wrong. The wallet responded with error status (%1$s)."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:579
+#: src/webex/pages/confirm-create-reserve.tsx:611
#, c-format
msgid "Checking URL, please wait ..."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:593
+#: src/webex/pages/confirm-create-reserve.tsx:625
#, c-format
msgid "Can't parse amount: %1$s"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:600
+#: src/webex/pages/confirm-create-reserve.tsx:632
#, c-format
msgid "Can't parse wire_types: %1$s"
msgstr ""
#. TODO:generic error reporting function or component.
-#: src/webex/pages/confirm-create-reserve.tsx:620
+#: src/webex/pages/confirm-create-reserve.tsx:652
#, c-format
msgid "Fatal error: \"%1$s\"."
msgstr ""
diff --git a/src/i18n/fr.po b/src/i18n/fr.po
index ccd36aecc..da860ad8f 100644
--- a/src/i18n/fr.po
+++ b/src/i18n/fr.po
@@ -151,44 +151,44 @@ msgid ""
"selected."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:424
+#: src/webex/pages/confirm-create-reserve.tsx:455
#, c-format
msgid "Accept fees and withdraw"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:429
+#: src/webex/pages/confirm-create-reserve.tsx:460
#, c-format
msgid "Change Exchange Provider"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:485
+#: src/webex/pages/confirm-create-reserve.tsx:517
#, c-format
msgid "You are about to withdraw %1$s from your bank account into your wallet."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:568
+#: src/webex/pages/confirm-create-reserve.tsx:600
#, c-format
msgid ""
"Oops, something went wrong. The wallet responded with error status (%1$s)."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:579
+#: src/webex/pages/confirm-create-reserve.tsx:611
#, c-format
msgid "Checking URL, please wait ..."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:593
+#: src/webex/pages/confirm-create-reserve.tsx:625
#, c-format
msgid "Can't parse amount: %1$s"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:600
+#: src/webex/pages/confirm-create-reserve.tsx:632
#, c-format
msgid "Can't parse wire_types: %1$s"
msgstr ""
#. TODO:generic error reporting function or component.
-#: src/webex/pages/confirm-create-reserve.tsx:620
+#: src/webex/pages/confirm-create-reserve.tsx:652
#, c-format
msgid "Fatal error: \"%1$s\"."
msgstr ""
diff --git a/src/i18n/it.po b/src/i18n/it.po
index ccd36aecc..da860ad8f 100644
--- a/src/i18n/it.po
+++ b/src/i18n/it.po
@@ -151,44 +151,44 @@ msgid ""
"selected."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:424
+#: src/webex/pages/confirm-create-reserve.tsx:455
#, c-format
msgid "Accept fees and withdraw"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:429
+#: src/webex/pages/confirm-create-reserve.tsx:460
#, c-format
msgid "Change Exchange Provider"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:485
+#: src/webex/pages/confirm-create-reserve.tsx:517
#, c-format
msgid "You are about to withdraw %1$s from your bank account into your wallet."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:568
+#: src/webex/pages/confirm-create-reserve.tsx:600
#, c-format
msgid ""
"Oops, something went wrong. The wallet responded with error status (%1$s)."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:579
+#: src/webex/pages/confirm-create-reserve.tsx:611
#, c-format
msgid "Checking URL, please wait ..."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:593
+#: src/webex/pages/confirm-create-reserve.tsx:625
#, c-format
msgid "Can't parse amount: %1$s"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:600
+#: src/webex/pages/confirm-create-reserve.tsx:632
#, c-format
msgid "Can't parse wire_types: %1$s"
msgstr ""
#. TODO:generic error reporting function or component.
-#: src/webex/pages/confirm-create-reserve.tsx:620
+#: src/webex/pages/confirm-create-reserve.tsx:652
#, c-format
msgid "Fatal error: \"%1$s\"."
msgstr ""
diff --git a/src/i18n/taler-wallet-webex.pot b/src/i18n/taler-wallet-webex.pot
index ccd36aecc..da860ad8f 100644
--- a/src/i18n/taler-wallet-webex.pot
+++ b/src/i18n/taler-wallet-webex.pot
@@ -151,44 +151,44 @@ msgid ""
"selected."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:424
+#: src/webex/pages/confirm-create-reserve.tsx:455
#, c-format
msgid "Accept fees and withdraw"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:429
+#: src/webex/pages/confirm-create-reserve.tsx:460
#, c-format
msgid "Change Exchange Provider"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:485
+#: src/webex/pages/confirm-create-reserve.tsx:517
#, c-format
msgid "You are about to withdraw %1$s from your bank account into your wallet."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:568
+#: src/webex/pages/confirm-create-reserve.tsx:600
#, c-format
msgid ""
"Oops, something went wrong. The wallet responded with error status (%1$s)."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:579
+#: src/webex/pages/confirm-create-reserve.tsx:611
#, c-format
msgid "Checking URL, please wait ..."
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:593
+#: src/webex/pages/confirm-create-reserve.tsx:625
#, c-format
msgid "Can't parse amount: %1$s"
msgstr ""
-#: src/webex/pages/confirm-create-reserve.tsx:600
+#: src/webex/pages/confirm-create-reserve.tsx:632
#, c-format
msgid "Can't parse wire_types: %1$s"
msgstr ""
#. TODO:generic error reporting function or component.
-#: src/webex/pages/confirm-create-reserve.tsx:620
+#: src/webex/pages/confirm-create-reserve.tsx:652
#, c-format
msgid "Fatal error: \"%1$s\"."
msgstr ""
diff --git a/src/types.ts b/src/types.ts
index 7120f64cc..9a7a79aca 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -27,6 +27,7 @@
* Imports.
*/
import { Checkable } from "./checkable";
+import * as LibtoolVersion from "./libtoolVersion";
/**
* Non-negative financial amount. Fractional values are expressed as multiples
@@ -492,6 +493,11 @@ export interface ExchangeRecord {
* Timestamp for last update.
*/
lastUpdateTime: number;
+
+ /**
+ * Last observed protocol version.
+ */
+ protocolVersion?: string;
}
/**
@@ -558,6 +564,13 @@ export interface ReserveCreationInfo {
* Public keys of trusted auditors for the currency we're withdrawing.
*/
trustedAuditorPubs: string[];
+ /**
+ * Result of checking the wallet's version
+ * against the exchange's version.
+ *
+ * Older exchanges don't return version information.
+ */
+ versionMatch: LibtoolVersion.VersionMatchResult|undefined;
}
diff --git a/src/wallet.ts b/src/wallet.ts
index b0029e755..2f5fa294e 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -34,6 +34,7 @@ import {
HttpRequestLibrary,
RequestException,
} from "./http";
+import * as LibtoolVersion from "./libtoolVersion";
import {
AbortTransaction,
Index,
@@ -152,6 +153,12 @@ export class KeysJson {
signkeys: any;
/**
+ * Protocol version.
+ */
+ @Checkable.Optional(Checkable.String)
+ version?: string;
+
+ /**
* Verify that a value matches the schema of this class and convert it into a
* member.
*/
@@ -1500,6 +1507,19 @@ export class Wallet {
trustedAuditorPubs.push(...currencyRecord.auditors.map((a) => a.auditorPub));
}
+ let versionMatch;
+ if (exchangeInfo.protocolVersion) {
+ versionMatch = LibtoolVersion.compare(WALLET_PROTOCOL_VERSION, exchangeInfo.protocolVersion);
+
+ if (versionMatch && !versionMatch.compatible && versionMatch.currentCmp == -1) {
+ console.log("wallet version might be outdated, checking for updates");
+ chrome.runtime.requestUpdateCheck((status, details) => {
+ console.log("update check status:", status);
+ });
+ }
+ }
+
+
const ret: ReserveCreationInfo = {
earliestDepositExpiration,
exchangeInfo,
@@ -1512,6 +1532,7 @@ export class Wallet {
wireFees,
wireInfo,
withdrawFee: acc,
+ versionMatch,
};
return ret;
}
@@ -1610,8 +1631,9 @@ export class Wallet {
}
const updatedExchangeInfo = await this.updateExchangeInfo(exchangeInfo,
- exchangeKeysJson);
+ exchangeKeysJson);
await this.suspendCoins(updatedExchangeInfo);
+ updatedExchangeInfo.protocolVersion = exchangeKeysJson.version;
await this.q()
.put(Stores.exchanges, updatedExchangeInfo)
diff --git a/src/webex/pages/confirm-create-reserve.tsx b/src/webex/pages/confirm-create-reserve.tsx
index ca8517a25..f8f53510c 100644
--- a/src/webex/pages/confirm-create-reserve.tsx
+++ b/src/webex/pages/confirm-create-reserve.tsx
@@ -414,10 +414,41 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> {
);
}
+ renderUpdateStatus() {
+ const rci = this.reserveCreationInfo();
+ if (!rci) {
+ return null;
+ }
+ if (!rci.versionMatch) {
+ return null;
+ }
+ if (rci.versionMatch.compatible) {
+ return null;
+ }
+ if (rci.versionMatch.currentCmp == -1) {
+ return (
+ <p className="errorbox">
+ Your wallet might be outdated. The exchange has a higher, incompatible
+ protocol version.
+ </p>
+ );
+ }
+ if (rci.versionMatch.currentCmp == 1) {
+ return (
+ <p className="errorbox">
+ The chosen exchange might be outdated. The exchange has a lower, incompatible
+ protocol version.
+ </p>
+ );
+ }
+ throw Error("not reached");
+ }
+
renderConfirm() {
return (
<div>
{this.renderFeeStatus()}
+ <p>
<button className="pure-button button-success"
disabled={this.reserveCreationInfo() === null}
onClick={() => this.confirmReserve()}>
@@ -428,7 +459,8 @@ class ExchangeSelection extends ImplicitStateComponent<ExchangeSelectionProps> {
onClick={() => this.selectingExchange(true)}>
{i18n.str`Change Exchange Provider`}
</button>
- <br/>
+ </p>
+ {this.renderUpdateStatus()}
<Collapsible initiallyCollapsed={true} title="Fee and Spending Details">
{renderReserveCreationDetails(this.reserveCreationInfo())}
</Collapsible>
diff --git a/src/webex/style/wallet.css b/src/webex/style/wallet.css
index 752fc6d75..7bfb99e6c 100644
--- a/src/webex/style/wallet.css
+++ b/src/webex/style/wallet.css
@@ -220,3 +220,22 @@ span.spacer {
a.actionLink {
color: black;
}
+
+
+.errorbox {
+ border: 1px solid;
+ display: inline-block;
+ margin: 1em;
+ padding: 1em;
+ font-weight: bold;
+ background: #FF8A8A;
+}
+
+.okaybox {
+ border: 1px solid;
+ display: inline-block;
+ margin: 1em;
+ padding: 1em;
+ font-weight: bold;
+ background: #00FA9A;
+}
diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts
index 6ea9a3cf4..b4e24e09c 100644
--- a/src/webex/wxBackend.ts
+++ b/src/webex/wxBackend.ts
@@ -58,7 +58,7 @@ const DB_NAME = "taler";
* In the future we might consider adding migration functions for
* each version increment.
*/
-const DB_VERSION = 17;
+const DB_VERSION = 18;
function handleMessage(db: IDBDatabase,
wallet: Wallet,