aboutsummaryrefslogtreecommitdiff
path: root/src/types
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-25 19:11:20 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-25 19:11:20 +0100
commitadebfab94e76ee5d34a4f22d15fc085daef9ae00 (patch)
tree2dd0f233661fc32d2e5c2ee83750b3616d421359 /src/types
parent54f7999c63292ca63f5f584c49bdef0b55627d71 (diff)
downloadwallet-core-adebfab94e76ee5d34a4f22d15fc085daef9ae00.tar.xz
fix and simplify coin selection
Diffstat (limited to 'src/types')
-rw-r--r--src/types/dbTypes.ts8
-rw-r--r--src/types/talerTypes.ts4
-rw-r--r--src/types/walletTypes.ts82
3 files changed, 33 insertions, 61 deletions
diff --git a/src/types/dbTypes.ts b/src/types/dbTypes.ts
index 71fe99b6b..b8eca2ddf 100644
--- a/src/types/dbTypes.ts
+++ b/src/types/dbTypes.ts
@@ -26,7 +26,7 @@
import { AmountJson } from "../util/amounts";
import {
Auditor,
- CoinPaySig,
+ CoinDepositPermission,
ContractTerms,
Denomination,
MerchantRefundPermission,
@@ -1085,6 +1085,10 @@ export interface AllowedExchangeInfo {
exchangePub: string;
}
+/**
+ * Data extracted from the contract terms that is relevant for payment
+ * processing in the wallet.
+ */
export interface WalletContractData {
fulfillmentUrl: string;
contractTermsHash: string;
@@ -1230,7 +1234,7 @@ export interface ConfigRecord {
* Coin that we're depositing ourselves.
*/
export interface DepositCoin {
- coinPaySig: CoinPaySig;
+ coinPaySig: CoinDepositPermission;
/**
* Undefined if coin not deposited, otherwise signature
diff --git a/src/types/talerTypes.ts b/src/types/talerTypes.ts
index f8e2b1c64..f8e449000 100644
--- a/src/types/talerTypes.ts
+++ b/src/types/talerTypes.ts
@@ -211,7 +211,7 @@ export class RecoupConfirmation {
/**
* Deposit permission for a single coin.
*/
-export interface CoinPaySig {
+export interface CoinDepositPermission {
/**
* Signature by the coin.
*/
@@ -401,7 +401,7 @@ export interface PayReq {
/**
* Coins with signature.
*/
- coins: CoinPaySig[];
+ coins: CoinDepositPermission[];
/**
* The merchant public key, used to uniquely
diff --git a/src/types/walletTypes.ts b/src/types/walletTypes.ts
index 223ca4329..9887474c3 100644
--- a/src/types/walletTypes.ts
+++ b/src/types/walletTypes.ts
@@ -33,9 +33,14 @@ import {
ExchangeRecord,
ExchangeWireInfo,
} from "./dbTypes";
-import { CoinPaySig, ContractTerms } from "./talerTypes";
+import { CoinDepositPermission, ContractTerms } from "./talerTypes";
import { Timestamp } from "../util/time";
-import { typecheckedCodec, makeCodecForObject, codecForString, makeCodecOptional } from "../util/codec";
+import {
+ typecheckedCodec,
+ makeCodecForObject,
+ codecForString,
+ makeCodecOptional,
+} from "../util/codec";
/**
* Response for the create reserve request to the wallet.
@@ -187,32 +192,6 @@ export interface WalletBalanceEntry {
pendingIncomingDirty: AmountJson;
}
-export interface CoinPayInfo {
- /**
- * Amount that will be subtracted from the coin when the payment is finalized.
- */
- subtractedAmount: AmountJson;
-
- /**
- * Public key of the coin that is being spent.
- */
- coinPub: string;
-
- /**
- * Signature together with the other information needed by the merchant,
- * directly in the format expected by the merchant.
- */
- sig: CoinPaySig;
-}
-
-/**
- * Coins used for a payment, with signatures authorizing the payment and the
- * coins with remaining value updated to accomodate for a payment.
- */
-export interface PaySigInfo {
- coinInfo: CoinPayInfo[];
-}
-
/**
* For terseness.
*/
@@ -302,7 +281,6 @@ export interface ConfirmReserveRequest {
reservePub: string;
}
-
export const codecForConfirmReserveRequest = () =>
typecheckedCodec<ConfirmReserveRequest>(
makeCodecForObject<ConfirmReserveRequest>()
@@ -337,34 +315,6 @@ export class ReturnCoinsRequest {
static checked: (obj: any) => ReturnCoinsRequest;
}
-/**
- * Result of selecting coins, contains the exchange, and selected
- * coins with their denomination.
- */
-export interface CoinSelectionResult {
- exchangeUrl: string;
- cds: CoinWithDenom[];
- totalFees: AmountJson;
- /**
- * Total amount, including wire fees payed by the customer.
- */
- totalAmount: AmountJson;
-}
-
-/**
- * Named tuple of coin and denomination.
- */
-export interface CoinWithDenom {
- /**
- * A coin. Must have the same denomination public key as the associated
- * denomination.
- */
- coin: CoinRecord;
- /**
- * An associated denomination.
- */
- denom: DenominationRecord;
-}
/**
* Status of processing a tip.
@@ -511,3 +461,21 @@ export interface CoinPublicKey {
export interface RefreshGroupId {
readonly refreshGroupId: string;
}
+
+/**
+ * Private data required to make a deposit permission.
+ */
+export interface DepositInfo {
+ exchangeBaseUrl: string;
+ contractTermsHash: string;
+ coinPub: string;
+ coinPriv: string;
+ spendAmount: AmountJson;
+ timestamp: Timestamp;
+ refundDeadline: Timestamp;
+ merchantPub: string;
+ feeDeposit: AmountJson;
+ wireInfoHash: string;
+ denomPub: string;
+ denomSig: string;
+}