diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..05ba80e --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +@tornado:registry=https://git.tornado.ws/api/packages/tornado-packages/npm/ \ No newline at end of file diff --git a/package.json b/package.json index 7988a46..a2c20ff 100644 --- a/package.json +++ b/package.json @@ -29,16 +29,16 @@ "@nestjs/core": "^8.0.0", "@nestjs/microservices": "^8.0.2", "@nestjs/platform-express": "^8.0.0", + "@tornado/gas-price-oracle": "^0.5.3", + "@tornado/tx-manager": "^0.4.9", "ajv": "^8.6.1", "bull": "^3.22.11", "class-validator": "^0.13.1", "ethers": "^5.4.6", - "gas-price-oracle": "^0.4.7", "redis": "^3.1.2", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.2", "rxjs": "^7.2.0", - "tx-manager": "^0.4.8", "uuid": "^8.3.2" }, "devDependencies": { diff --git a/src/config/txManager.config.ts b/src/config/txManager.config.ts index f37a8ae..2324f8d 100644 --- a/src/config/txManager.config.ts +++ b/src/config/txManager.config.ts @@ -6,8 +6,8 @@ export default registerAs('txManager', () => ({ rpcUrl: process.env.RPC_URL || RPC_LIST[process.env.CHAIN_ID], config: { THROW_ON_REVERT: false, - CONFIRMATIONS: process.env.CONFIRMATIONS, - MAX_GAS_PRICE: process.env.MAX_GAS_PRICE, + CONFIRMATIONS: Number(process.env.CONFIRMATIONS), + MAX_GAS_PRICE: Number(process.env.MAX_GAS_PRICE), }, gasPriceOracleConfig: { chainId: Number(process.env.CHAIN_ID), diff --git a/src/modules/queue/transaction.processor.ts b/src/modules/queue/transaction.processor.ts index efa3ad8..d448dd0 100644 --- a/src/modules/queue/transaction.processor.ts +++ b/src/modules/queue/transaction.processor.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'ethers'; -import { TxManager } from 'tx-manager'; +import { TxManager } from '@tornado/tx-manager'; import { Job, Queue, DoneCallback } from 'bull'; import { Injectable } from '@nestjs/common'; diff --git a/src/services/gas-price.service.ts b/src/services/gas-price.service.ts index 1400bfa..b29145b 100644 --- a/src/services/gas-price.service.ts +++ b/src/services/gas-price.service.ts @@ -2,7 +2,8 @@ import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { BigNumber } from 'ethers'; -import { GasPriceOracle } from 'gas-price-oracle'; +import { GasPriceOracle } from '@tornado/gas-price-oracle'; +import type { GasPrice } from '@tornado/gas-price-oracle/lib/services'; import { toWei } from '@/utilities'; import { SERVICE_ERRORS } from '@/constants'; @@ -34,7 +35,7 @@ export class GasPriceService { defaultRpc: this.rpcUrl, }); - const result = await instance.gasPrices(); + const result = (await instance.gasPrices({ isLegacy: true })) as GasPrice; return { instant: bump(gweiToWei(result.instant), percentBump.INSTANT), diff --git a/yarn.lock b/yarn.lock index deea7da..fa25c03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1158,6 +1158,25 @@ resolved "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== +"@tornado/gas-price-oracle@^0.5.3": + version "0.5.3" + resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Fgas-price-oracle/-/0.5.3/gas-price-oracle-0.5.3.tgz#fb5423dddee2f52edbc16174c5ddce90bea5413d" + integrity sha512-LpVfPiPIz3FOmJdiqJf/yoeO5n9/Pd5jgtdY+6hB9lNW0AiWhylhpScojICViS+3OL9QC8CoTlgr+kbfGeO9pQ== + dependencies: + axios "^0.21.2" + bignumber.js "^9.0.0" + node-cache "^5.1.2" + +"@tornado/tx-manager@^0.4.9": + version "0.4.9" + resolved "https://git.tornado.ws/api/packages/tornado-packages/npm/%40tornado%2Ftx-manager/-/0.4.9/tx-manager-0.4.9.tgz#075add158e3c01da1b34bbcd68ba764491746ceb" + integrity sha512-0j6bquM/gB6JZvm2nv2y1Xo35IvsZcjQ0BMlvoH8OZYa1dzXQCiNBKSlNOIBOFMsOklUXHNE1JmQpko+rTgXOA== + dependencies: + "@tornado/gas-price-oracle" "^0.5.3" + async-mutex "^0.2.4" + ethers "^5.4.6" + web3-core-promievent "^1.3.0" + "@tsconfig/node10@^1.0.7": version "1.0.8" resolved "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz#c1e4e80d6f964fbecb3359c43bd48b40f7cadad9" @@ -2205,6 +2224,11 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +clone@2.x: + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== + clone@^1.0.2: version "1.0.4" resolved "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -3185,14 +3209,6 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -gas-price-oracle@^0.4.7: - version "0.4.7" - resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.4.7.tgz#47406048083074bcab677efb9de08663e742153d" - integrity sha512-Ti8nhpATm83YebWU/Pz5xclZoTkzOblIhT504ZViZJUcd8jOxgj9pWtCasg8RYw+d0f19m0dJUPvdj04RC4o3A== - dependencies: - axios "^0.21.2" - bignumber.js "^9.0.0" - gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" @@ -4571,6 +4587,13 @@ neo-async@^2.6.2: resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== +node-cache@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" + integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== + dependencies: + clone "2.x" + node-emoji@1.10.0: version "1.10.0" resolved "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz#8886abd25d9c7bb61802a658523d1f8d2a89b2da" @@ -5793,16 +5816,6 @@ tsutils@^3.21.0: dependencies: tslib "^1.8.1" -tx-manager@^0.4.8: - version "0.4.8" - resolved "https://registry.yarnpkg.com/tx-manager/-/tx-manager-0.4.8.tgz#d354af422d6019629c4b80b0872e332e1ab8c338" - integrity sha512-gs7V8jWxAjMLl+HtkDI6U04fqqB/Coprz0xRCVYeuBh/5ZiVuC+txd2yP08HyQsSRgAiNMXAlSskrfxaJKsxZg== - dependencies: - async-mutex "^0.2.4" - ethers "^5.4.6" - gas-price-oracle "^0.4.7" - web3-core-promievent "^1.3.0" - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"