summaryrefslogtreecommitdiff
path: root/src/types/walletTypes.ts
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/walletTypes.ts
parent54f7999c63292ca63f5f584c49bdef0b55627d71 (diff)
downloadwallet-core-adebfab94e76ee5d34a4f22d15fc085daef9ae00.tar.gz
wallet-core-adebfab94e76ee5d34a4f22d15fc085daef9ae00.tar.bz2
wallet-core-adebfab94e76ee5d34a4f22d15fc085daef9ae00.zip
fix and simplify coin selection
Diffstat (limited to 'src/types/walletTypes.ts')
-rw-r--r--src/types/walletTypes.ts82
1 files changed, 25 insertions, 57 deletions
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;
+}