diff options
| author | Florian Dold <florian.dold@gmail.com> | 2018-01-17 05:33:06 +0100 | 
|---|---|---|
| committer | Florian Dold <florian.dold@gmail.com> | 2018-01-17 05:33:06 +0100 | 
| commit | d4c2f6f6f992c36609c4a029afcb378a7f839ddf (patch) | |
| tree | 2c50f9f1fa65ccea77894460b9d2080184914ab2 /src/crypto | |
| parent | c62ba4986fbfcb8637a3befadf3d3eddbd5348ca (diff) | |
use full amount with wire fees when creating deposit permission
Diffstat (limited to 'src/crypto')
| -rw-r--r-- | src/crypto/cryptoApi.ts | 5 | ||||
| -rw-r--r-- | src/crypto/cryptoWorker.ts | 5 | 
2 files changed, 6 insertions, 4 deletions
diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts index 1f45ba8eb..c1f3f4245 100644 --- a/src/crypto/cryptoApi.ts +++ b/src/crypto/cryptoApi.ts @@ -293,8 +293,9 @@ export class CryptoApi {    }    signDeposit(contractTerms: ContractTerms, -              cds: CoinWithDenom[]): Promise<PayCoinInfo> { -    return this.doRpc<PayCoinInfo>("signDeposit", 3, contractTerms, cds); +              cds: CoinWithDenom[], +              totalAmount: AmountJson): Promise<PayCoinInfo> { +    return this.doRpc<PayCoinInfo>("signDeposit", 3, contractTerms, cds, totalAmount);    }    createEddsaKeypair(): Promise<{priv: string, pub: string}> { diff --git a/src/crypto/cryptoWorker.ts b/src/crypto/cryptoWorker.ts index b7c8e933f..6b82f6bc2 100644 --- a/src/crypto/cryptoWorker.ts +++ b/src/crypto/cryptoWorker.ts @@ -269,7 +269,8 @@ namespace RpcFunctions {     * and deposit permissions for each given coin.     */    export function signDeposit(contractTerms: ContractTerms, -                              cds: CoinWithDenom[]): PayCoinInfo { +                              cds: CoinWithDenom[], +                              totalAmount: AmountJson): PayCoinInfo {      const ret: PayCoinInfo = {        originalCoins: [],        sigs: [], @@ -282,7 +283,7 @@ namespace RpcFunctions {      let fees = Amounts.add(Amounts.getZero(feeList[0].currency), ...feeList).amount;      // okay if saturates      fees = Amounts.sub(fees, contractTerms.max_fee).amount; -    const total = Amounts.add(fees, contractTerms.amount).amount; +    const total = Amounts.add(fees, totalAmount).amount;      const amountSpent = native.Amount.getZero(cds[0].coin.currentAmount.currency);      const amountRemaining = new native.Amount(total);  | 
