gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (b4f97f45 -> 4b16d7bd)


From: gnunet
Subject: [taler-wallet-core] branch master updated (b4f97f45 -> 4b16d7bd)
Date: Mon, 14 Jun 2021 19:38:20 +0200

This is an automated email from the git hooks/post-receive script.

dold pushed a change to branch master
in repository wallet-core.

    from b4f97f45 make CSPRNG work on ES6
     new ef636c02 implement force-retrying transactions
     new 4b16d7bd fix module bundling config

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-util/src/walletTypes.ts             |  9 +++
 .../src/crypto/primitives/nacl-fast.ts             | 12 ++--
 .../src/operations/transactions.ts                 | 45 +++++++++++++
 packages/taler-wallet-core/src/wallet.ts           |  8 ++-
 .../taler-wallet-webextension/rollup.config.js     | 78 ++++++++--------------
 .../taler-wallet-webextension/src/i18n/index.ts    |  2 +-
 .../src/pageEntryPoint.ts                          |  4 +-
 pnpm-lock.yaml                                     | 17 +----
 8 files changed, 100 insertions(+), 75 deletions(-)

diff --git a/packages/taler-util/src/walletTypes.ts 
b/packages/taler-util/src/walletTypes.ts
index 10dbf75e..6a0c5713 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -949,7 +949,16 @@ export interface DeleteTransactionRequest {
   transactionId: string;
 }
 
+export interface RetryTransactionRequest {
+  transactionId: string;
+}
+
 export const codecForDeleteTransactionRequest = (): 
Codec<DeleteTransactionRequest> =>
   buildCodecForObject<DeleteTransactionRequest>()
     .property("transactionId", codecForString())
     .build("DeleteTransactionRequest");
+
+export const codecForRetryTransactionRequest = (): 
Codec<RetryTransactionRequest> =>
+  buildCodecForObject<RetryTransactionRequest>()
+    .property("transactionId", codecForString())
+    .build("RetryTransactionRequest");
diff --git a/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts 
b/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
index 711c83ec..eab4a2e5 100644
--- a/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
+++ b/packages/taler-wallet-core/src/crypto/primitives/nacl-fast.ts
@@ -5,11 +5,15 @@
 // Implementation derived from TweetNaCl version 20140427.
 // See for details: http://tweetnacl.cr.yp.to/
 
-import { createRequire } from "module";
+import * as mod from "module";
 
-// We need this require function to synchronously
-// import the "crypto" module in the CSPRNG initialization.
-const require = createRequire(import.meta.url);
+let require: any;
+
+if (typeof require !== "function" && mod.default && mod.default.createRequire) 
{
+  // We need this require function to synchronously
+  // import the "crypto" module in the CSPRNG initialization.
+  require = mod.default.createRequire(import.meta.url);
+}
 
 const gf = function (init: number[] = []): Float64Array {
   const r = new Float64Array(16);
diff --git a/packages/taler-wallet-core/src/operations/transactions.ts 
b/packages/taler-wallet-core/src/operations/transactions.ts
index 3d9f1be4..1b2c8477 100644
--- a/packages/taler-wallet-core/src/operations/transactions.ts
+++ b/packages/taler-wallet-core/src/operations/transactions.ts
@@ -38,6 +38,11 @@ import {
 } from "@gnu-taler/taler-util";
 import { getFundingPaytoUris } from "./reserves.js";
 import { getExchangeDetails } from "./exchanges.js";
+import { processWithdrawGroup } from "./withdraw.js";
+import { processPurchasePay } from "./pay.js";
+import { processDepositGroup } from "./deposits.js";
+import { processTip } from "./tip.js";
+import { processRefreshGroup } from "./refresh.js";
 
 /**
  * Create an event ID from the type and the primary key for the event.
@@ -398,6 +403,46 @@ export enum TombstoneTag {
   DeleteRefund = "delete-refund",
 }
 
+/**
+ * Immediately retry the underlying operation
+ * of a transaction.
+ */
+export async function retryTransaction(
+  ws: InternalWalletState,
+  transactionId: string,
+): Promise<void> {
+  const [type, ...rest] = transactionId.split(":");
+
+  switch (type) {
+    case TransactionType.Deposit:
+      const depositGroupId = rest[0];
+      processDepositGroup(ws, depositGroupId, true);
+      break;
+    case TransactionType.Withdrawal: {
+      const withdrawalGroupId = rest[0];
+      await processWithdrawGroup(ws, withdrawalGroupId, true);
+      break;
+    }
+    case TransactionType.Payment: {
+      const proposalId = rest[0]
+      await processPurchasePay(ws, proposalId, true);
+      break;
+    }
+    case TransactionType.Tip: {
+      const walletTipId = rest[0];
+      await processTip(ws, walletTipId, true);
+      break;
+    }
+    case TransactionType.Refresh: {
+      const refreshGroupId = rest[0];
+      await processRefreshGroup(ws, refreshGroupId, true);
+      break;
+    }
+    default:
+      break;
+  }
+}
+
 /**
  * Permanently delete a transaction based on the transaction ID.
  */
diff --git a/packages/taler-wallet-core/src/wallet.ts 
b/packages/taler-wallet-core/src/wallet.ts
index 900a2e77..33e431f3 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -26,6 +26,7 @@ import {
   BackupRecovery,
   codecForAny,
   codecForDeleteTransactionRequest,
+  codecForRetryTransactionRequest,
   DeleteTransactionRequest,
   durationFromSpec,
   durationMax,
@@ -103,7 +104,7 @@ import {
   withdrawTestBalance,
 } from "./operations/testing";
 import { acceptTip, prepareTip, processTip } from "./operations/tip";
-import { deleteTransaction, getTransactions } from "./operations/transactions";
+import { deleteTransaction, getTransactions, retryTransaction } from 
"./operations/transactions";
 import {
   getExchangeWithdrawalInfo,
   getWithdrawalDetailsForUri,
@@ -1194,6 +1195,11 @@ export class Wallet {
         await deleteTransaction(this.ws, req.transactionId);
         return {};
       }
+      case "retryTransaction": {
+        const req = codecForRetryTransactionRequest().decode(payload);
+        await retryTransaction(this.ws, req.transactionId);
+        return {};
+      }
     }
     throw OperationFailedError.fromCode(
       TalerErrorCode.WALLET_CORE_API_OPERATION_UNKNOWN,
diff --git a/packages/taler-wallet-webextension/rollup.config.js 
b/packages/taler-wallet-webextension/rollup.config.js
index 6f2d8450..30ca82a0 100644
--- a/packages/taler-wallet-webextension/rollup.config.js
+++ b/packages/taler-wallet-webextension/rollup.config.js
@@ -6,33 +6,41 @@ import builtins from "builtin-modules";
 import replace from "@rollup/plugin-replace";
 import ignore from "rollup-plugin-ignore"
 
-
-const webExtensionPageEntryPoint = {
-  input: "lib/pageEntryPoint.js",
-  output: {
-    file: "dist/pageEntryPoint.js",
-    format: "iife",
-    exports: "none",
-    name: "webExtensionPageEntry",
-  },
-  plugins: [
-    json(),
-
-    ignore(builtins),
-
+const makePlugins = () => [
+    ignore(["module", "os"]),
     nodeResolve({
       browser: true,
+      preferBuiltins: true,
     }),
 
     //terser(),
+    
 
     replace({
       "process.env.NODE_ENV": JSON.stringify("production"),
       "__filename": "'__webextension__'",
     }),
 
-    commonjs(),
-  ],
+    commonjs({
+      include: [/node_modules/, /dist/],
+      extensions: [".js"],
+      ignoreGlobal: true,
+      sourceMap: true,
+    }),
+
+    json(),
+];
+
+
+const webExtensionPageEntryPoint = {
+  input: "lib/pageEntryPoint.js",
+  output: {
+    file: "dist/pageEntryPoint.js",
+    format: "iife",
+    exports: "none",
+    name: "webExtensionPageEntry",
+  },
+  plugins: makePlugins(),
 };
 
 const webExtensionBackgroundPageScript = {
@@ -43,24 +51,7 @@ const webExtensionBackgroundPageScript = {
     exports: "none",
     name: "webExtensionBackgroundScript",
   },
-  plugins: [
-    json(),
-
-    ignore(builtins),
-
-    nodeResolve({
-      browser: true,
-    }),
-
-    //terser(),
-
-    replace({
-      "process.env.NODE_ENV": JSON.stringify("production"),
-      "__filename": "'__webextension__'",
-    }),
-
-    commonjs()
-  ],
+  plugins: makePlugins(),
 };
 
 const webExtensionCryptoWorker = {
@@ -71,24 +62,7 @@ const webExtensionCryptoWorker = {
     exports: "none",
     name: "webExtensionCryptoWorker",
   },
-  plugins: [
-    json(),
-
-    ignore(builtins),
-
-    nodeResolve({
-      browser: true,
-    }),
-
-    //terser(),
-
-    replace({
-      "process.env.NODE_ENV": JSON.stringify("production"),
-      "__filename": "'__webextension__'",
-    }),
-
-    commonjs(),
-  ],
+  plugins: makePlugins(),
 };
 
 export default [
diff --git a/packages/taler-wallet-webextension/src/i18n/index.ts 
b/packages/taler-wallet-webextension/src/i18n/index.ts
index abfc8b92..8db366a3 100644
--- a/packages/taler-wallet-webextension/src/i18n/index.ts
+++ b/packages/taler-wallet-webextension/src/i18n/index.ts
@@ -21,4 +21,4 @@
 /**
  * Imports.
  */
-export { strings } from "./strings";
+export { strings } from "./strings.js";
diff --git a/packages/taler-wallet-webextension/src/pageEntryPoint.ts 
b/packages/taler-wallet-webextension/src/pageEntryPoint.ts
index 960b1995..505b32d7 100644
--- a/packages/taler-wallet-webextension/src/pageEntryPoint.ts
+++ b/packages/taler-wallet-webextension/src/pageEntryPoint.ts
@@ -22,8 +22,8 @@
 
 import { render } from "preact";
 import { setupI18n } from "@gnu-taler/taler-util";
-import { strings } from "./i18n"
-import { Application } from './Application';
+import { strings } from "./i18n/strings";
+import { Application } from "./Application";
 
 function main(): void {
   try {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c02ed18d..14219b2f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -46,7 +46,6 @@ importers:
       '@types/node': ^14.14.22
       ava: ^3.15.0
       esbuild: ^0.9.2
-      esm: ^3.2.25
       jed: ^1.1.1
       prettier: ^2.2.1
       rimraf: ^3.0.2
@@ -59,7 +58,6 @@ importers:
       '@types/node': 14.14.34
       ava: 3.15.0
       esbuild: 0.9.2
-      esm: 3.2.25
       prettier: 2.2.1
       rimraf: 3.0.2
       typescript: 4.2.3
@@ -159,7 +157,6 @@ importers:
       eslint-plugin-jsx-a11y: ^6.4.1
       eslint-plugin-react: ^7.22.0
       eslint-plugin-react-hooks: ^4.2.0
-      esm: ^3.2.25
       fflate: ^0.6.0
       jed: ^1.1.1
       nyc: ^15.1.0
@@ -195,7 +192,6 @@ importers:
       eslint-plugin-jsx-a11y: 6.4.1_eslint@7.18.0
       eslint-plugin-react: 7.22.0_eslint@7.18.0
       eslint-plugin-react-hooks: 4.2.0_eslint@7.18.0
-      esm: 3.2.25
       jed: 1.1.1
       nyc: 15.1.0
       po2json: 0.4.5
@@ -6165,7 +6161,7 @@ packages:
   /axios/0.21.1:
     resolution: {integrity: 
sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==}
     dependencies:
-      follow-redirects: 1.14.0
+      follow-redirects: 1.14.0_debug@4.3.1
     transitivePeerDependencies:
       - debug
 
@@ -9660,15 +9656,6 @@ packages:
       readable-stream: 2.3.7
     dev: true
 
-  /follow-redirects/1.14.0:
-    resolution: {integrity: 
sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==}
-    engines: {node: '>=4.0'}
-    peerDependencies:
-      debug: '*'
-    peerDependenciesMeta:
-      debug:
-        optional: true
-
   /follow-redirects/1.14.0_debug@4.3.1:
     resolution: {integrity: 
sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg==}
     engines: {node: '>=4.0'}
@@ -9679,7 +9666,6 @@ packages:
         optional: true
     dependencies:
       debug: 4.3.1_supports-color@6.1.0
-    dev: true
 
   /for-each/0.3.3:
     resolution: {integrity: 
sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
@@ -13250,6 +13236,7 @@ packages:
 
   /nodent-compiler/3.2.13:
     resolution: {integrity: 
sha512-nzzWPXZwSdsWie34om+4dLrT/5l1nT/+ig1v06xuSgMtieJVAnMQFuZihUwREM+M7dFso9YoHfDmweexEXXrrw==}
+    engines: {'0': n, '1': o, '2': d, '3': e, '4': ' ', '5': '>', '6': '=', 
'7': ' ', '8': '0', '9': ., '10': '1', '11': '0', '12': ., '13': '0'}
     dependencies:
       acorn: 5.7.4
       acorn-es7-plugin: 1.1.7

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]