aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-31 16:04:14 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-31 16:04:23 +0200
commit613a14c14f969bf21ff7569f93cde3a7a35ce96a (patch)
tree5767b5d1664e503aa46bfd37074c14f44402b806 /src/crypto
parent7e5ddf3a456b0b39f688dc79035841d4bf86aa00 (diff)
fix messaging, small issues and safer types
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/cryptoApi.ts6
-rw-r--r--src/crypto/cryptoWorker.ts18
2 files changed, 12 insertions, 12 deletions
diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts
index c3c1f508a..139f8ae88 100644
--- a/src/crypto/cryptoApi.ts
+++ b/src/crypto/cryptoApi.ts
@@ -27,7 +27,7 @@ import {
AmountJson,
CoinRecord,
DenominationRecord,
- OfferRecord,
+ ProposalRecord,
PayCoinInfo,
PaybackRequest,
PreCoinRecord,
@@ -277,9 +277,9 @@ export class CryptoApi {
return this.doRpc<PayCoinInfo>("isValidPaymentSignature", 1, sig, contractHash, merchantPub);
}
- signDeposit(offer: OfferRecord,
+ signDeposit(proposal: ProposalRecord,
cds: CoinWithDenom[]): Promise<PayCoinInfo> {
- return this.doRpc<PayCoinInfo>("signDeposit", 3, offer, cds);
+ return this.doRpc<PayCoinInfo>("signDeposit", 3, proposal, cds);
}
createEddsaKeypair(): Promise<{priv: string, pub: string}> {
diff --git a/src/crypto/cryptoWorker.ts b/src/crypto/cryptoWorker.ts
index 85a0425b3..507a080ac 100644
--- a/src/crypto/cryptoWorker.ts
+++ b/src/crypto/cryptoWorker.ts
@@ -29,7 +29,7 @@ import {
CoinRecord,
CoinStatus,
DenominationRecord,
- OfferRecord,
+ ProposalRecord,
PayCoinInfo,
PaybackRequest,
PreCoinRecord,
@@ -227,7 +227,7 @@ namespace RpcFunctions {
* Generate updated coins (to store in the database)
* and deposit permissions for each given coin.
*/
- export function signDeposit(offer: OfferRecord,
+ export function signDeposit(proposal: ProposalRecord,
cds: CoinWithDenom[]): PayCoinInfo {
const ret: PayCoinInfo = [];
@@ -235,8 +235,8 @@ namespace RpcFunctions {
const feeList: AmountJson[] = cds.map((x) => x.denom.feeDeposit);
let fees = Amounts.add(Amounts.getZero(feeList[0].currency), ...feeList).amount;
// okay if saturates
- fees = Amounts.sub(fees, offer.contract.max_fee).amount;
- const total = Amounts.add(fees, offer.contract.amount).amount;
+ fees = Amounts.sub(fees, proposal.contractTerms.max_fee).amount;
+ const total = Amounts.add(fees, proposal.contractTerms.amount).amount;
const amountSpent = native.Amount.getZero(cds[0].coin.currentAmount.currency);
const amountRemaining = new native.Amount(total);
@@ -273,11 +273,11 @@ namespace RpcFunctions {
amount_with_fee: coinSpend.toNbo(),
coin_pub: native.EddsaPublicKey.fromCrock(cd.coin.coinPub),
deposit_fee: new native.Amount(cd.denom.feeDeposit).toNbo(),
- h_contract: native.HashCode.fromCrock(offer.H_contract),
- h_wire: native.HashCode.fromCrock(offer.contract.H_wire),
- merchant: native.EddsaPublicKey.fromCrock(offer.contract.merchant_pub),
- refund_deadline: native.AbsoluteTimeNbo.fromTalerString(offer.contract.refund_deadline),
- timestamp: native.AbsoluteTimeNbo.fromTalerString(offer.contract.timestamp),
+ h_contract: native.HashCode.fromCrock(proposal.contractTermsHash),
+ h_wire: native.HashCode.fromCrock(proposal.contractTerms.H_wire),
+ merchant: native.EddsaPublicKey.fromCrock(proposal.contractTerms.merchant_pub),
+ refund_deadline: native.AbsoluteTimeNbo.fromTalerString(proposal.contractTerms.refund_deadline),
+ timestamp: native.AbsoluteTimeNbo.fromTalerString(proposal.contractTerms.timestamp),
});
const coinSig = native.eddsaSign(d.toPurpose(),