From adebfab94e76ee5d34a4f22d15fc085daef9ae00 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 25 Dec 2019 19:11:20 +0100 Subject: fix and simplify coin selection --- src/types/walletTypes.ts | 82 +++++++++++++++--------------------------------- 1 file changed, 25 insertions(+), 57 deletions(-) (limited to 'src/types/walletTypes.ts') 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( makeCodecForObject() @@ -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; +} -- cgit v1.2.3