summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli/src/harness/denomStructures.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-12-23 12:59:29 +0100
committerFlorian Dold <florian@dold.me>2022-12-23 13:19:41 +0100
commit083c4cf5d96314c44dd716cf3cc931e95b651bbd (patch)
tree7f15a46224d5dfe495e26dc6ec66996c889498ff /packages/taler-wallet-cli/src/harness/denomStructures.ts
parentd98711cb51d13bb2da3682014c7c6e75d7fbb4f0 (diff)
downloadwallet-core-083c4cf5d96314c44dd716cf3cc931e95b651bbd.tar.gz
wallet-core-083c4cf5d96314c44dd716cf3cc931e95b651bbd.tar.bz2
wallet-core-083c4cf5d96314c44dd716cf3cc931e95b651bbd.zip
spill extra functionality from wallet-cli into taler-harness
We want to keep taler-wallet-cli smaller and have fewer dependencies.
Diffstat (limited to 'packages/taler-wallet-cli/src/harness/denomStructures.ts')
-rw-r--r--packages/taler-wallet-cli/src/harness/denomStructures.ts157
1 files changed, 0 insertions, 157 deletions
diff --git a/packages/taler-wallet-cli/src/harness/denomStructures.ts b/packages/taler-wallet-cli/src/harness/denomStructures.ts
deleted file mode 100644
index b12857c7e..000000000
--- a/packages/taler-wallet-cli/src/harness/denomStructures.ts
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2020 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-export interface CoinCoinfigCommon {
- name: string;
- value: string;
- durationWithdraw: string;
- durationSpend: string;
- durationLegal: string;
- feeWithdraw: string;
- feeDeposit: string;
- feeRefresh: string;
- feeRefund: string;
- ageRestricted?: boolean;
-}
-
-export interface CoinConfigRsa extends CoinCoinfigCommon {
- cipher: "RSA";
- rsaKeySize: number;
-}
-
-/**
- * Clause Schnorr coin config.
- */
-export interface CoinConfigCs extends CoinCoinfigCommon {
- cipher: "CS";
-}
-
-export type CoinConfig = CoinConfigRsa | CoinConfigCs;
-
-const coinRsaCommon = {
- cipher: "RSA" as const,
- durationLegal: "3 years",
- durationSpend: "2 years",
- durationWithdraw: "7 days",
- rsaKeySize: 1024,
-};
-
-export const coin_ct1 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_ct1`,
- value: `${curr}:0.01`,
- feeDeposit: `${curr}:0.00`,
- feeRefresh: `${curr}:0.01`,
- feeRefund: `${curr}:0.00`,
- feeWithdraw: `${curr}:0.01`,
-});
-
-export const coin_ct10 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_ct10`,
- value: `${curr}:0.10`,
- feeDeposit: `${curr}:0.01`,
- feeRefresh: `${curr}:0.01`,
- feeRefund: `${curr}:0.00`,
- feeWithdraw: `${curr}:0.01`,
-});
-
-export const coin_u1 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_u1`,
- value: `${curr}:1`,
- feeDeposit: `${curr}:0.02`,
- feeRefresh: `${curr}:0.02`,
- feeRefund: `${curr}:0.02`,
- feeWithdraw: `${curr}:0.02`,
-});
-
-export const coin_u2 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_u2`,
- value: `${curr}:2`,
- feeDeposit: `${curr}:0.02`,
- feeRefresh: `${curr}:0.02`,
- feeRefund: `${curr}:0.02`,
- feeWithdraw: `${curr}:0.02`,
-});
-
-export const coin_u4 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_u4`,
- value: `${curr}:4`,
- feeDeposit: `${curr}:0.02`,
- feeRefresh: `${curr}:0.02`,
- feeRefund: `${curr}:0.02`,
- feeWithdraw: `${curr}:0.02`,
-});
-
-export const coin_u8 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_u8`,
- value: `${curr}:8`,
- feeDeposit: `${curr}:0.16`,
- feeRefresh: `${curr}:0.16`,
- feeRefund: `${curr}:0.16`,
- feeWithdraw: `${curr}:0.16`,
-});
-
-const coin_u10 = (curr: string): CoinConfig => ({
- ...coinRsaCommon,
- name: `${curr}_u10`,
- value: `${curr}:10`,
- feeDeposit: `${curr}:0.2`,
- feeRefresh: `${curr}:0.2`,
- feeRefund: `${curr}:0.2`,
- feeWithdraw: `${curr}:0.2`,
-});
-
-export const defaultCoinConfig = [
- coin_ct1,
- coin_ct10,
- coin_u1,
- coin_u2,
- coin_u4,
- coin_u8,
- coin_u10,
-];
-
-export function makeNoFeeCoinConfig(curr: string): CoinConfig[] {
- const cc: CoinConfig[] = [];
-
- for (let i = 0; i < 16; i++) {
- const ct = 2 ** i;
-
- const unit = Math.floor(ct / 100);
- const cent = ct % 100;
-
- cc.push({
- cipher: "RSA",
- durationLegal: "3 years",
- durationSpend: "2 years",
- durationWithdraw: "7 days",
- rsaKeySize: 1024,
- name: `${curr}-u${i}`,
- feeDeposit: `${curr}:0`,
- feeRefresh: `${curr}:0`,
- feeRefund: `${curr}:0`,
- feeWithdraw: `${curr}:0`,
- value: `${curr}:${unit}.${cent}`,
- });
- }
-
- return cc;
-}