From 1634e5fb16dba74e8bb7cd2e27db5b68e43cfef8 Mon Sep 17 00:00:00 2001 From: poma Date: Tue, 20 Oct 2020 09:39:28 +0300 Subject: [PATCH] update gas price oracle --- package.json | 4 ++-- test/TxManager.test.js | 17 +++++++++++++++++ yarn.lock | 8 ++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 3aae96c..bdd0986 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tx-manager", - "version": "0.2.2", + "version": "0.2.3", "description": "", "main": "index.js", "scripts": { @@ -23,7 +23,7 @@ "dependencies": { "async-mutex": "^0.2.4", "ethers": "^5.0.17", - "gas-price-oracle": "^0.1.5", + "gas-price-oracle": "^0.2.0", "web3-core-promievent": "^1.3.0" }, "devDependencies": { diff --git a/test/TxManager.test.js b/test/TxManager.test.js index 5838da5..aeb8816 100644 --- a/test/TxManager.test.js +++ b/test/TxManager.test.js @@ -32,6 +32,11 @@ describe('TxManager', () => { to: '0x0039F22efB07A647557C7C5d17854CFD6D489eF3', } + const tx4 = { + value: 1, + to: '0xA43Ce8Cc89Eff3AA5593c742fC56A30Ef2427CB0', + } + describe('#transaction', () => { it('should work', async () => { const tx = manager.createTx(tx1) @@ -45,6 +50,18 @@ describe('TxManager', () => { console.log('receipt', receipt) }) + it('should fetch gas price', async () => { + const tx = manager.createTx(tx4) + + const receipt = await tx + .send() + .on('transactionHash', hash => console.log('hash', hash)) + .on('mined', receipt => console.log('Mined in block', receipt.blockNumber)) + .on('confirmations', confirmations => console.log('confirmations', confirmations)) + + console.log('receipt', receipt) + }) + it('should bump gas price', async () => { const tx = manager.createTx(tx2) diff --git a/yarn.lock b/yarn.lock index e2c4a1b..75502f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1141,10 +1141,10 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -gas-price-oracle@^0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.1.5.tgz#09dd0d9806465c2f5e63b682e6742f96f6eb525c" - integrity sha512-fkaTXnxJcSVco/tMPEcN5gieoUNs8O6JYMXflGLN2+3YeGZAucUI0fgCliazM3nRVAk//bBEm9819/Zb83xhrw== +gas-price-oracle@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.2.0.tgz#981926c96089497115113162b03151aacfe44a5a" + integrity sha512-2+mMyunV/pMJrmKl/IeEtX860NaE/bQ7H4D8PO2dc0OQd8ZAj/e4WJ+C9F/uOeG3dwm8SEFjofOvcYRHeGxo/Q== dependencies: axios "^0.19.2" bignumber.js "^9.0.0"