diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-04-02 20:33:01 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-04-02 20:33:01 +0530 |
commit | ef0acf06bfb7820a21c4719dba0d659f600be3c7 (patch) | |
tree | 216d34722240f682e5ee58632947fa75e9b4fcee /src/crypto | |
parent | 1728e5011e16f226c6e3675aa196872af39f6c4e (diff) |
model reserve history in the exchange, improve reserve handling logic
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/workers/cryptoApi.ts | 4 | ||||
-rw-r--r-- | src/crypto/workers/cryptoImplementation.ts | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/crypto/workers/cryptoApi.ts b/src/crypto/workers/cryptoApi.ts index ab97e1274..d3b12e26d 100644 --- a/src/crypto/workers/cryptoApi.ts +++ b/src/crypto/workers/cryptoApi.ts @@ -359,8 +359,8 @@ export class CryptoApi { return this.doRpc<string>("hashString", 1, str); } - hashDenomPub(denomPub: string): Promise<string> { - return this.doRpc<string>("hashDenomPub", 1, denomPub); + hashEncoded(encodedBytes: string): Promise<string> { + return this.doRpc<string>("hashEncoded", 1, encodedBytes); } isValidDenom(denom: DenominationRecord, masterPub: string): Promise<boolean> { diff --git a/src/crypto/workers/cryptoImplementation.ts b/src/crypto/workers/cryptoImplementation.ts index 156c72ba0..eef8f5955 100644 --- a/src/crypto/workers/cryptoImplementation.ts +++ b/src/crypto/workers/cryptoImplementation.ts @@ -49,8 +49,7 @@ import { PlanchetCreationRequest, DepositInfo, } from "../../types/walletTypes"; -import { AmountJson } from "../../util/amounts"; -import * as Amounts from "../../util/amounts"; +import { AmountJson, Amounts } from "../../util/amounts"; import * as timer from "../../util/timer"; import { encodeCrock, @@ -199,6 +198,7 @@ export class CryptoImplementation { denomPubHash: encodeCrock(denomPubHash), reservePub: encodeCrock(reservePub), withdrawSig: encodeCrock(sig), + coinEvHash: encodeCrock(evHash), }; return planchet; } @@ -367,7 +367,7 @@ export class CryptoImplementation { const s: CoinDepositPermission = { coin_pub: depositInfo.coinPub, coin_sig: encodeCrock(coinSig), - contribution: Amounts.toString(depositInfo.spendAmount), + contribution: Amounts.stringify(depositInfo.spendAmount), denom_pub: depositInfo.denomPub, exchange_url: depositInfo.exchangeBaseUrl, ub_sig: depositInfo.denomSig, @@ -491,10 +491,10 @@ export class CryptoImplementation { } /** - * Hash a denomination public key. + * Hash a crockford encoded value. */ - hashDenomPub(denomPub: string): string { - return encodeCrock(hash(decodeCrock(denomPub))); + hashEncoded(encodedBytes: string): string { + return encodeCrock(hash(decodeCrock(encodedBytes))); } signCoinLink( |