From 050cec1c91d05b329bbc4a817ff7431261b0e6d8 Mon Sep 17 00:00:00 2001 From: Antoine Herzog Date: Wed, 29 Apr 2020 07:42:32 +0200 Subject: [PATCH 1/2] improve default value for gaz --- packages/iov-ethereum/src/ethereumconnection.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/iov-ethereum/src/ethereumconnection.ts b/packages/iov-ethereum/src/ethereumconnection.ts index 1a6670473..2eb5736a7 100644 --- a/packages/iov-ethereum/src/ethereumconnection.ts +++ b/packages/iov-ethereum/src/ethereumconnection.ts @@ -917,10 +917,19 @@ export class EthereumConnection implements AtomicSwapConnection { public async getFeeQuote(transaction: UnsignedTransaction): Promise { switch (transaction.kind) { + case "bcp/send": + return { + gasPrice: { + // TODO: calculate dynamically from previous blocks or external API + quantity: "10000000000", // 10 gwei + fractionalDigits: constants.primaryTokenFractionalDigits, + tokenTicker: constants.primaryTokenTicker, + }, + gasLimit: "21000", + }; case "smartcontract/escrow_open": case "smartcontract/escrow_abort": case "smartcontract/escrow_claim": - case "bcp/send": case "bcp/swap_offer": case "bcp/swap_claim": case "bcp/swap_abort": @@ -928,11 +937,11 @@ export class EthereumConnection implements AtomicSwapConnection { return { gasPrice: { // TODO: calculate dynamically from previous blocks or external API - quantity: "20000000000", // 20 gwei + quantity: "10000000000", // 10 gwei fractionalDigits: constants.primaryTokenFractionalDigits, tokenTicker: constants.primaryTokenTicker, }, - gasLimit: "2100000", + gasLimit: "210000", }; default: throw new Error("Received transaction of unsupported kind."); From 57d5ea8f242c66e1502ffb498a80ad68bcfa386c Mon Sep 17 00:00:00 2001 From: Antoine Herzog Date: Wed, 29 Apr 2020 08:40:42 +0200 Subject: [PATCH 2/2] fix test --- packages/iov-ethereum/src/ethereumconnection.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/iov-ethereum/src/ethereumconnection.spec.ts b/packages/iov-ethereum/src/ethereumconnection.spec.ts index 587bcc44c..50d0d123e 100644 --- a/packages/iov-ethereum/src/ethereumconnection.spec.ts +++ b/packages/iov-ethereum/src/ethereumconnection.spec.ts @@ -2066,11 +2066,11 @@ describe("EthereumConnection", () => { expect(result.tokens).toBeUndefined(); expect(result.gasPrice).toEqual({ // 20 gwei - quantity: "20000000000", + quantity: "10000000000", fractionalDigits: 18, tokenTicker: "ETH" as TokenTicker, }); - expect(result.gasLimit).toEqual("2100000"); + expect(result.gasLimit).toEqual("21000"); connection.disconnect(); });