From 9a197d619c02f7787311b191da3da693380304b6 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Tue, 1 Mar 2016 19:39:17 +0100
Subject: mint->exchange

---
 pages/confirm-create-reserve.tsx | 54 ++++++++++++++++++++--------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

(limited to 'pages/confirm-create-reserve.tsx')

diff --git a/pages/confirm-create-reserve.tsx b/pages/confirm-create-reserve.tsx
index 224a3e895..914f58cad 100644
--- a/pages/confirm-create-reserve.tsx
+++ b/pages/confirm-create-reserve.tsx
@@ -19,7 +19,7 @@
 import {amountToPretty, canonicalizeBaseUrl} from "../lib/wallet/helpers";
 import {AmountJson, CreateReserveResponse} from "../lib/wallet/types";
 import m from "mithril";
-import {IMintInfo} from "../lib/wallet/types";
+import {IExchangeInfo} from "../lib/wallet/types";
 import {ReserveCreationInfo, Amounts} from "../lib/wallet/types";
 import MithrilComponent = _mithril.MithrilComponent;
 import {Denomination} from "../lib/wallet/types";
@@ -60,7 +60,7 @@ class DelayTimer {
 class Controller {
   url = m.prop<string>();
   statusString = null;
-  isValidMint = false;
+  isValidExchange = false;
   reserveCreationInfo: ReserveCreationInfo = null;
   private timer: DelayTimer;
   private request: XMLHttpRequest;
@@ -68,12 +68,12 @@ class Controller {
   callbackUrl: string;
   detailCollapsed = m.prop<boolean>(true);
 
-  constructor(initialMintUrl: string, amount: AmountJson, callbackUrl: string) {
+  constructor(initialExchangeUrl: string, amount: AmountJson, callbackUrl: string) {
     console.log("creating main controller");
     this.amount = amount;
     this.callbackUrl = callbackUrl;
     this.timer = new DelayTimer(800, () => this.update());
-    this.url(initialMintUrl);
+    this.url(initialExchangeUrl);
     this.update();
   }
 
@@ -93,19 +93,19 @@ class Controller {
 
       m.redraw(true);
 
-      console.log("doing get mint info");
+      console.log("doing get exchange info");
 
       getReserveCreationInfo(this.url(), this.amount)
         .then((r: ReserveCreationInfo) => {
-          console.log("get mint info resolved");
-          this.isValidMint = true;
+          console.log("get exchange info resolved");
+          this.isValidExchange = true;
           this.reserveCreationInfo = r;
           console.dir(r);
-          this.statusString = "The mint base URL is valid!";
+          this.statusString = "The exchange base URL is valid!";
           m.endComputation();
         })
         .catch((e) => {
-          console.log("get mint info rejected");
+          console.log("get exchange info rejected");
           if (e.hasOwnProperty("httpStatus")) {
             this.statusString = `request failed with status ${this.request.status}`;
           } else {
@@ -122,7 +122,7 @@ class Controller {
   }
 
   reset() {
-    this.isValidMint = false;
+    this.isValidExchange = false;
     this.statusString = null;
     this.reserveCreationInfo = null;
     if (this.request) {
@@ -131,8 +131,8 @@ class Controller {
     }
   }
 
-  confirmReserve(mint: string, amount: AmountJson, callback_url: string) {
-    const d = {mint, amount};
+  confirmReserve(exchange: string, amount: AmountJson, callback_url: string) {
+    const d = {exchange, amount};
     const cb = (rawResp) => {
       if (!rawResp) {
         throw Error("empty response");
@@ -140,7 +140,7 @@ class Controller {
       if (!rawResp.error) {
         const resp = CreateReserveResponse.checked(rawResp);
         let q = {
-          mint: resp.mint,
+          exchange: resp.exchange,
           reserve_pub: resp.reservePub,
           amount_value: amount.value,
           amount_fraction: amount.fraction,
@@ -190,7 +190,7 @@ function view(ctrl: Controller) {
        onclick: () => ctrl.confirmReserve(ctrl.url(),
                                           ctrl.amount,
                                           ctrl.callbackUrl),
-       disabled: !ctrl.isValidMint
+       disabled: !ctrl.isValidExchange
      },
      "Confirm exchange selection");
 
@@ -256,30 +256,30 @@ function renderReserveCreationDetails(rci: ReserveCreationInfo) {
 }
 
 
-interface MintProbeResult {
+interface ExchangeProbeResult {
   keyInfo?: any;
 }
 
-function probeMint(mintBaseUrl: string): Promise<MintProbeResult> {
+function probeExchange(exchangeBaseUrl: string): Promise<ExchangeProbeResult> {
   throw Error("not implemented");
 }
 
 
-function getSuggestedMint(currency: string): Promise<string> {
+function getSuggestedExchange(currency: string): Promise<string> {
   // TODO: make this request go to the wallet backend
   // Right now, this is a stub.
-  const defaultMint = {
+  const defaultExchange = {
     "KUDOS": "http://exchange.demo.taler.net",
     "PUDOS": "http://exchange.test.taler.net",
   };
 
-  let mint = defaultMint[currency];
+  let exchange = defaultExchange[currency];
 
-  if (!mint) {
-    mint = ""
+  if (!exchange) {
+    exchange = ""
   }
 
-  return Promise.resolve(mint);
+  return Promise.resolve(exchange);
 }
 
 
@@ -290,11 +290,11 @@ export function main() {
   const callback_url = query.callback_url;
   const bank_url = query.bank_url;
 
-  getSuggestedMint(amount.currency)
-    .then((suggestedMintUrl) => {
-      const controller = () => new Controller(suggestedMintUrl, amount, callback_url);
-      var MintSelection = {controller, view};
-      m.mount(document.getElementById("mint-selection"), MintSelection);
+  getSuggestedExchange(amount.currency)
+    .then((suggestedExchangeUrl) => {
+      const controller = () => new Controller(suggestedExchangeUrl, amount, callback_url);
+      var ExchangeSelection = {controller, view};
+      m.mount(document.getElementById("exchange-selection"), ExchangeSelection);
     })
     .catch((e) => {
       // TODO: provide more context information, maybe factor it out into a
-- 
cgit v1.2.3


From 1cca800254bca4b34e911f252223ef0456dd95d7 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Tue, 1 Mar 2016 19:46:20 +0100
Subject: add author

---
 background/main.ts               |  4 +++-
 content_scripts/notify.ts        | 11 +++++++----
 gulpfile.js                      |  2 ++
 lib/module-trampoline.js         |  4 +++-
 lib/wallet/cryptoApi.ts          |  8 +++++++-
 lib/wallet/cryptoLib.ts          |  2 +-
 lib/wallet/helpers.ts            |  2 ++
 lib/wallet/http.ts               |  2 +-
 lib/wallet/types.ts              |  2 ++
 lib/wallet/wxApi.ts              |  3 ++-
 pages/confirm-contract.tsx       |  9 ++++++++-
 pages/confirm-create-reserve.tsx |  8 ++++++++
 pages/show-db.ts                 |  6 ++++++
 pogen/pogen.ts                   |  2 ++
 popup/popup.css                  |  7 +++++++
 popup/popup.tsx                  |  8 ++++++++
 16 files changed, 69 insertions(+), 11 deletions(-)

(limited to 'pages/confirm-create-reserve.tsx')

diff --git a/background/main.ts b/background/main.ts
index 746d81a60..724c4c978 100644
--- a/background/main.ts
+++ b/background/main.ts
@@ -16,6 +16,8 @@
 
 /**
  * Entry point for the background page.
+ * 
+ * @author Florian Dold
  */
 
 "use strict";
@@ -34,4 +36,4 @@ System.import("../lib/wallet/wxMessaging")
       .catch((e) => {
         console.log("wallet failed");
         console.error(e.stack);
-      });
\ No newline at end of file
+      });
diff --git a/content_scripts/notify.ts b/content_scripts/notify.ts
index 6fa965ba7..afc03c934 100644
--- a/content_scripts/notify.ts
+++ b/content_scripts/notify.ts
@@ -14,16 +14,19 @@
  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
  */
 
-/// <reference path="../lib/decl/chrome/chrome.d.ts" />
-
-"use strict";
-
 
 /**
  * Script that is injected into (all!) pages to allow them
  * to interact with the GNU Taler wallet via DOM Events.
+ *
+ * @author Florian Dold
  */
 
+
+/// <reference path="../lib/decl/chrome/chrome.d.ts" />
+
+"use strict";
+
 // Make sure we don't pollute the namespace too much.
 namespace TalerNotify {
   const PROTOCOL_VERSION = 1;
diff --git a/gulpfile.js b/gulpfile.js
index fc0134457..a683e7b17 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -25,6 +25,8 @@
  *   development
  * - package: create Chrome extension zip file in
  *   build/.
+ *
+ * @author Florian Dold
  */
 
 const gulp = require("gulp");
diff --git a/lib/module-trampoline.js b/lib/module-trampoline.js
index 22173aa42..1f0247f35 100644
--- a/lib/module-trampoline.js
+++ b/lib/module-trampoline.js
@@ -17,6 +17,8 @@
 
 /**
  * Boilerplate to initialize the module system and call main()
+ *
+ * @author Florian Dold
  */
 
 "use strict";
@@ -75,4 +77,4 @@ System.import(me)
   .catch((e) => {
     console.log("trampoline failed");
     console.error(e.stack);
-  });
\ No newline at end of file
+  });
diff --git a/lib/wallet/cryptoApi.ts b/lib/wallet/cryptoApi.ts
index 300b928db..3cbed89c3 100644
--- a/lib/wallet/cryptoApi.ts
+++ b/lib/wallet/cryptoApi.ts
@@ -15,6 +15,12 @@
  */
 
 
+/**
+ * API to access the Taler crypto worker thread.
+ * @author Florian Dold
+ */
+
+
 import {PreCoin} from "./types";
 import {Reserve} from "./types";
 import {Denomination} from "./types";
@@ -90,4 +96,4 @@ export class CryptoApi {
   rsaUnblind(sig: string, bk: string, pk: string): Promise<string> {
     return this.doRpc("rsaUnblind", sig, bk, pk);
   }
-}
\ No newline at end of file
+}
diff --git a/lib/wallet/cryptoLib.ts b/lib/wallet/cryptoLib.ts
index 5546dcebe..769cb3356 100644
--- a/lib/wallet/cryptoLib.ts
+++ b/lib/wallet/cryptoLib.ts
@@ -14,7 +14,6 @@
  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
  */
 
-import {Denomination} from "./types";
 /**
  * Web worker for crypto operations.
  * @author Florian Dold
@@ -28,6 +27,7 @@ import create = chrome.alarms.create;
 import {Offer} from "./wallet";
 import {CoinWithDenom} from "./wallet";
 import {CoinPaySig} from "./types";
+import {Denomination} from "./types";
 
 
 export function main(worker: Worker) {
diff --git a/lib/wallet/helpers.ts b/lib/wallet/helpers.ts
index a7d164102..477fce33f 100644
--- a/lib/wallet/helpers.ts
+++ b/lib/wallet/helpers.ts
@@ -18,6 +18,8 @@
 /**
  * Smaller helper functions that do not depend
  * on the emscripten machinery.
+ *
+ * @author Florian Dold
  */
 
 import {AmountJson} from "./types";
diff --git a/lib/wallet/http.ts b/lib/wallet/http.ts
index 3f7244e40..3bc80f40a 100644
--- a/lib/wallet/http.ts
+++ b/lib/wallet/http.ts
@@ -81,4 +81,4 @@ export class RequestException {
   constructor(detail) {
 
   }
-}
\ No newline at end of file
+}
diff --git a/lib/wallet/types.ts b/lib/wallet/types.ts
index a0e22dbca..748df6f4c 100644
--- a/lib/wallet/types.ts
+++ b/lib/wallet/types.ts
@@ -21,6 +21,8 @@
  * are defined in types.ts are intended to be used by components
  * that do not depend on the whole wallet implementation (which depends on
  * emscripten).
+ *
+ * @author Florian Dold
  */
 
 import {Checkable} from "./checkable";
diff --git a/lib/wallet/wxApi.ts b/lib/wallet/wxApi.ts
index 9871b6e7f..2b69ff82e 100644
--- a/lib/wallet/wxApi.ts
+++ b/lib/wallet/wxApi.ts
@@ -19,6 +19,7 @@ import {ReserveCreationInfo} from "./types";
 
 /**
  * Interface to the wallet through WebExtension messaging.
+ * @author Florian Dold
  */
 
 
@@ -37,4 +38,4 @@ export function getReserveCreationInfo(baseUrl: string,
       resolve(resp);
     });
   });
-}
\ No newline at end of file
+}
diff --git a/pages/confirm-contract.tsx b/pages/confirm-contract.tsx
index ff6ffba64..9ce1b0a5a 100644
--- a/pages/confirm-contract.tsx
+++ b/pages/confirm-contract.tsx
@@ -14,6 +14,13 @@
  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
  */
 
+/**
+ * Page shown to the user to confirm entering
+ * a contract.
+ *
+ * @author Florian Dold
+ */
+
 /// <reference path="../lib/decl/handlebars/handlebars.d.ts" />
 "use strict";
 
@@ -79,4 +86,4 @@ export function main() {
                                                         offer);
     });
   }
-}
\ No newline at end of file
+}
diff --git a/pages/confirm-create-reserve.tsx b/pages/confirm-create-reserve.tsx
index 914f58cad..5ed97db04 100644
--- a/pages/confirm-create-reserve.tsx
+++ b/pages/confirm-create-reserve.tsx
@@ -14,6 +14,14 @@
  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
  */
 
+
+/**
+ * Page shown to the user to confirm creation
+ * of a reserve, usually requested by the bank.
+ *
+ * @author Florian Dold
+ */
+
 /// <reference path="../lib/decl/mithril.d.ts" />
 
 import {amountToPretty, canonicalizeBaseUrl} from "../lib/wallet/helpers";
diff --git a/pages/show-db.ts b/pages/show-db.ts
index 1c414dde7..c99d2f2b3 100644
--- a/pages/show-db.ts
+++ b/pages/show-db.ts
@@ -15,6 +15,12 @@
  */
 
 
+/**
+ * Wallet database dump for debugging.
+ *
+ * @author Florian Dold
+ */
+
 function replacer(match, pIndent, pKey, pVal, pEnd) {
   var key = '<span class=json-key>';
   var val = '<span class=json-value>';
diff --git a/pogen/pogen.ts b/pogen/pogen.ts
index 77f7ea3dc..5ff182e7c 100644
--- a/pogen/pogen.ts
+++ b/pogen/pogen.ts
@@ -20,6 +20,8 @@
  *
  * Note that duplicate message IDs are NOT merged, to get the same output as
  * you would from xgettext, just run msguniq.
+ *
+ * @author Florian Dold
  */
 
 /// <reference path="../lib/decl/node.d.ts" />
diff --git a/popup/popup.css b/popup/popup.css
index 53c9f97ed..7218b7baf 100644
--- a/popup/popup.css
+++ b/popup/popup.css
@@ -1,3 +1,10 @@
+
+/**
+ * @author Gabor X. Toth
+ * @author Marcello Stanisci
+ * @author Florian Dold
+ */
+
 body {
     min-height: 20em;
     width: 30em;
diff --git a/popup/popup.tsx b/popup/popup.tsx
index 963556c32..2cd753e4f 100644
--- a/popup/popup.tsx
+++ b/popup/popup.tsx
@@ -15,6 +15,14 @@
  */
 
 
+/**
+ * Popup shown to the user when they click
+ * the Taler browser action button.
+ *
+ * @author Florian Dold
+ */
+
+
 /// <reference path="../lib/decl/mithril.d.ts" />
 /// <reference path="../lib/decl/lodash.d.ts" />
 
-- 
cgit v1.2.3

