diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 9f1c6a4f25..724f7e16fb 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -79,19 +79,6 @@ jobs: cp -rf src/templates/* conf sed -i 's|/home/gateway/conf/lists/|conf/lists/|g' ./conf/*.yml sed -i 's/https:\/\/rpc.ankr.com\/eth_goerli/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml - sed -i 's/https:\/\/arbitrum-rinkeby.infura.io\/v3/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml - sed -i 's/https:\/\/rpc.ankr.com\/optimism/http:\/\/127.0.0.1:8545\//g' ./conf/ethereum.yml - sed -i 's/https:\/\/rpc.ankr.com\/avalanche/http:\/\/127.0.0.1:8545\//g' ./conf/avalanche.yml - sed -i 's/https:\/\/rpc.ankr.com\/avalanche_fuji/http:\/\/127.0.0.1:8545\//g' ./conf/avalanche.yml - sed -i 's/https:\/\/rpc.ankr.com\/polygon_mumbai/http:\/\/127.0.0.1:8545\//g' ./conf/polygon.yml - sed -i 's/https:\/\/rpc.ankr.com\/harmony/http:\/\/127.0.0.1:8545\//g' ./conf/harmony.yml - sed -i 's/https:\/\/api.s0.b.hmny.io/http:\/\/127.0.0.1:8545\//g' ./conf/harmony.yml - sed -i 's/https:\/\/rpc.ankr.com\/bsc/http:\/\/127.0.0.1:8545\//g' ./conf/binance-smart-chain.yml - sed -i 's/https:\/\/rpc.ankr.com\/bsc_testnet_chapel/http:\/\/127.0.0.1:8545\//g' ./conf/binance-smart-chain.yml - sed -i 's/https:\/\/cosmos-testnet-rpc.allthatnode.com:26657/http:\/\/127.0.0.1:8545\//g' ./conf/cosmos.yml - sed -i 's/https:\/\/cosmos-mainnet-rpc.allthatnode.com:26657/http:\/\/127.0.0.1:8545\//g' ./conf/cosmos.yml - sed -i 's/https:\/\/evm-t3.cronos.org/http:\/\/127.0.0.1:8545\//g' ./conf/cosmos.yml - sed -i 's/https:\/\/evm.cronos.org/http:\/\/127.0.0.1:8545\//g' ./conf/cosmos.yml - name: Run unit test coverage if: github.event_name == 'pull_request' @@ -99,9 +86,7 @@ jobs: run: | git fetch --all -q git checkout -b $GITHUB_SHA - DIFF_FILES=`git diff --name-only origin/$GITHUB_BASE_REF ./src/` - ./node_modules/.bin/jest --listTests --findRelatedTests ${DIFF_FILES//$'\n'/ } - NODE_OPTIONS=--max-old-space-size=10240 node ./node_modules/.bin/jest --runInBand --coverage --findRelatedTests ${DIFF_FILES//$'\n'/ } + NODE_OPTIONS=--max-old-space-size=10240 node ./node_modules/.bin/jest --runInBand --coverage ./test/ # git diff origin/$GITHUB_BASE_REF | yarn diff-test-coverage -c ./coverage/lcov.info -t lcov -b 50 -l 60 docker_build_and_push: diff --git a/docs/swagger/chain-routes.yml b/docs/swagger/chain-routes.yml index cd706fc471..c4766128f1 100644 --- a/docs/swagger/chain-routes.yml +++ b/docs/swagger/chain-routes.yml @@ -1,31 +1,54 @@ paths: - /chain/nonce: - post: + /chain/config: + get: tags: - 'chain' - summary: 'Get the current nonce for the provided private key' - operationId: 'nonce' - consumes: + summary: 'Returns configuration options for a chain' + produces: - 'application/json' + responses: '200' + + /chain/status: + get: + tags: + - 'chain' + summary: 'Returns status of the chain' + produces: + - 'application/json' + responses: '200' + + /chain/tokens: + get: + tags: + - 'chain' + summary: 'Returns a list of tokens available on a chain' produces: - 'application/json' parameters: - - in: 'body' - name: 'body' + - in: 'query' + name: 'chain' required: true - schema: - $ref: '#/definitions/NonceRequest' + type: 'string' + example: 'ethereum' + - in: 'query' + name: 'network' + required: true + type: 'string' + example: 'goerli' + - in: 'query' + name: 'tokenSymbols' + required: false responses: '200': schema: - $ref: '#/definitions/NonceResponse' - - /chain/nextNonce: + $ref: '#/definitions/TokensResponse' + + /chain/allowances: post: tags: - 'chain' - summary: 'Get the next nonce for the provided private key' - operationId: 'nonce' + summary: 'Get ERC20 allowances for an address on a chain' + operationId: 'allowances' consumes: - 'application/json' produces: @@ -35,18 +58,19 @@ paths: name: 'body' required: true schema: - $ref: '#/definitions/NonceRequest' + $ref: '#/definitions/AllowancesRequest' responses: '200': schema: - $ref: '#/definitions/NonceResponse' - - /chain/allowances: + $ref: '#/definitions/AllowancesResponse' + + + /chain/balances: post: tags: - 'chain' - summary: 'Get the ERC20 allowances for a spender on a given private key' - operationId: 'allowances' + summary: 'Get balances for an address on a chain' + operationId: 'balances' consumes: - 'application/json' produces: @@ -56,11 +80,12 @@ paths: name: 'body' required: true schema: - $ref: '#/definitions/AllowancesRequest' + $ref: '#/definitions/BalancesRequest' responses: '200': schema: - $ref: '#/definitions/AllowancesResponse' + $ref: '#/definitions/BalancesResponse' + /chain/approve: post: tags: @@ -118,3 +143,66 @@ paths: - 'application/json' responses: '200' + + /chain/poll: + post: + tags: + - 'chain' + summary: 'Poll the status of a transaction on a chain' + operationId: 'poll' + consumes: + - 'application/json' + produces: + - 'application/json' + parameters: + - in: 'body' + name: 'body' + required: true + schema: + $ref: '#/definitions/PollRequest' + responses: + '200': + schema: + $ref: '#/definitions/PollResponse' + + /chain/nonce: + post: + tags: + - 'chain' + summary: 'Get the current nonce for the provided private key' + operationId: 'nonce' + consumes: + - 'application/json' + produces: + - 'application/json' + parameters: + - in: 'body' + name: 'body' + required: true + schema: + $ref: '#/definitions/NonceRequest' + responses: + '200': + schema: + $ref: '#/definitions/NonceResponse' + + /chain/nextNonce: + post: + tags: + - 'chain' + summary: 'Get the next nonce for the provided private key' + operationId: 'nonce' + consumes: + - 'application/json' + produces: + - 'application/json' + parameters: + - in: 'body' + name: 'body' + required: true + schema: + $ref: '#/definitions/NonceRequest' + responses: + '200': + schema: + $ref: '#/definitions/NonceResponse' diff --git a/docs/swagger/swagger.yml b/docs/swagger/swagger.yml index bef77055aa..77e722c16a 100644 --- a/docs/swagger/swagger.yml +++ b/docs/swagger/swagger.yml @@ -1,11 +1,9 @@ swagger: '2.0' info: - description: 'Gateway allows clients to interoperate with blockchains and DeFi protocols via a REST API. This allows for a language agnostic way to use official SDKs for blockchains.' - version: '1.0.0' - title: 'gateway' - contact: - email: 'dev@hummingbot.io' + description: 'API middleware that lets Hummingbot clients interact with standardized DEX API endpoints on various blockchain networks' + version: '1.18.0' + title: 'Hummingbot Gateway' license: name: 'Apache 2.0' url: 'http://www.apache.org/licenses/LICENSE-2.0.html' @@ -14,25 +12,23 @@ host: 'localhost:15888' tags: - name: 'system' - description: 'Get information about the currently running Gateway program' - - name: 'network' - description: 'Get information about specific networks' + description: 'System endpoints' - name: 'wallet' - description: 'Manage private keys available for use in Gateway' + description: 'Wallet endpoints' + - name: 'chain' + description: 'Blockchain network endpoints' - name: 'amm' - description: 'Interact with AMM decentralized exchanges' + description: 'AMM DEX swap endpoints' + - name: 'amm/liquidity' + description: 'AMM DEX liquidity provision endpoints' - name: 'clob' - description: 'Interact with CLOB spot decentralized exchanges' + description: 'CLOB spot DEX endpoints' - name: 'clob/perp' - description: 'Interact with CLOB perpetual decentralized exchanges' - - name: 'amm/liquidity' - description: 'Interact with AMM LP contracts' - - name: 'chain' - description: 'Interact with primary chain properties' + description: 'CLOB perpetual DEX endpoints' schemes: - 'http' externalDocs: - description: 'Find out more about gateway' - url: 'https://github.com/hummingbot/hummingbot' + description: 'Gateway Docs' + url: 'https://hummingbot.org/gateway' diff --git a/test/chains/algorand/algorand.routes.test.ts b/test-bronze/chains/algorand/algorand.routes.test.ts similarity index 94% rename from test/chains/algorand/algorand.routes.test.ts rename to test-bronze/chains/algorand/algorand.routes.test.ts index 0b8aef5152..23c2670c41 100644 --- a/test/chains/algorand/algorand.routes.test.ts +++ b/test-bronze/chains/algorand/algorand.routes.test.ts @@ -6,7 +6,7 @@ import { setUpTempDir, tearDownTempDir, unpatch, -} from '../../services/patch'; +} from '../../../test/services/patch'; import { getAlgorandConfig } from '../../../src/chains/algorand/algorand.config'; import { NETWORK_ERROR_CODE, @@ -100,7 +100,7 @@ const patchGetAssetData = () => { { id: NATIVE_TOKEN_ID.toString(), is_liquidity_token: false, - name: 'Algorand', + name: CHAIN_NAME, unit_name: NATIVE_TOKEN, decimals: ALGO_DECIMALS, total_amount: null, @@ -136,10 +136,10 @@ const patchGetAssetData = () => { }); }; -describe('GET /network/config', () => { +describe('GET /chain/config', () => { it('should return 200 and the result dictionary should include the algorand config', async () => { await request(gatewayApp) - .get(`/network/config`) + .get(`/chain/config`) .set('Accept', 'application/json') .expect('Content-Type', /json/) .expect(200) @@ -149,10 +149,10 @@ describe('GET /network/config', () => { }); }); -describe('GET /network/status', () => { +describe('GET /chain/status', () => { it('should return 200 with network info when chain provided', async () => { await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: CHAIN_NAME, network: NETWORK }) .set('Accept', 'application/json') .expect('Content-Type', /json/) @@ -166,7 +166,7 @@ describe('GET /network/status', () => { it('should return 200 with a status list, if an instance is already instantiated', async () => { await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .set('Accept', 'application/json') .expect('Content-Type', /json/) .expect(200) @@ -183,7 +183,7 @@ describe('GET /network/status', () => { patchCurrentBlockNumber(false, mainnetAlgorandChain, mainnetBlockNumber); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .set('Accept', 'application/json') .expect('Content-Type', /json/) .expect(200) @@ -202,7 +202,7 @@ describe('GET /network/status', () => { }); }); -describe('POST /algorand/poll', () => { +describe('POST /chain/poll', () => { const expectedTransactionHash = '0x2faeb1aa55f96c1db55f643a8cf19b0f76bf091d0b7d1b068d2e829414576362'; // noqa: mock const expectedTransactionFee = 1000; @@ -216,8 +216,9 @@ describe('POST /algorand/poll', () => { }); await request(gatewayApp) - .post('/algorand/poll') + .post('/chain/poll') .send({ + chain: CHAIN_NAME, network: NETWORK, txHash: expectedTransactionHash, }) @@ -234,8 +235,9 @@ describe('POST /algorand/poll', () => { }); await request(gatewayApp) - .post('/algorand/poll') + .post('/chain/poll') .send({ + chain: CHAIN_NAME, network: NETWORK, txHash: expectedTransactionHash, }) @@ -260,8 +262,9 @@ describe('POST /algorand/poll', () => { }); await request(gatewayApp) - .post('/algorand/poll') + .post('/chain/poll') .send({ + chain: CHAIN_NAME, network: NETWORK, txHash: expectedTransactionHash, }) @@ -290,8 +293,9 @@ describe('POST /algorand/poll', () => { }); await request(gatewayApp) - .post('/algorand/poll') + .post('/chain/poll') .send({ + chain: CHAIN_NAME, network: NETWORK, txHash: expectedTransactionHash, }) @@ -329,8 +333,9 @@ describe('POST /algorand/poll', () => { }); await request(gatewayApp) - .post('/algorand/poll') + .post('/chain/poll') .send({ + chain: CHAIN_NAME, network: NETWORK, txHash: expectedTransactionHash, }) @@ -396,7 +401,7 @@ describe('test managing Algorand wallets', () => { }); }); -describe('POST /algorand/balances', () => { +describe('POST /chain/balances', () => { const expectedBalance = '9'; it('should return 200 with correct balance for native token', async () => { @@ -418,7 +423,7 @@ describe('POST /algorand/balances', () => { }); await request(gatewayApp) - .post(`/algorand/balances`) + .post(`/chain/balances`) .send({ chain: CHAIN_NAME, network: NETWORK, @@ -458,7 +463,7 @@ describe('POST /algorand/balances', () => { }); await request(gatewayApp) - .post(`/algorand/balances`) + .post(`/chain/balances`) .send({ chain: CHAIN_NAME, network: NETWORK, @@ -490,7 +495,7 @@ describe('POST /algorand/balances', () => { }); await request(gatewayApp) - .post(`/algorand/balances`) + .post(`/chain/balances`) .send({ chain: CHAIN_NAME, network: NETWORK, @@ -510,7 +515,7 @@ describe('POST /algorand/balances', () => { it('should return 404 when parameters are invalid/incomplete', async () => { await request(gatewayApp) - .post(`/algorand/balances`) + .post(`/chain/balances`) .send({ chain: CHAIN_NAME, network: NETWORK, @@ -519,10 +524,10 @@ describe('POST /algorand/balances', () => { }); }); -describe('GET /algorand/assets', () => { +describe('GET /chain/tokens', () => { it('should return 200 with all assets if assetSymbols not provided', async () => { await request(gatewayApp) - .get(`/algorand/assets`) + .get(`/chain/tokens`) .query({ network: NETWORK, }) @@ -548,7 +553,7 @@ describe('GET /algorand/assets', () => { it('should return 200 with the requested asset', async () => { await request(gatewayApp) - .get(`/algorand/assets`) + .get(`/chain/tokens`) .query({ network: NETWORK, assetSymbols: [USDC_TOKEN], @@ -569,8 +574,8 @@ describe('GET /algorand/assets', () => { }); }); -describe('POST /algorand/opt-in', () => { - it('should return 200 with the opt-in response', async () => { +describe('POST /chain/approve', () => { + it('should return 200 with the approve response', async () => { const expectedTransactionId = 'RVZ24ML6UE3OFXFN5ID3L65EHSRAYYX3FCCTKQP3P3P5K73Y65CQ'; @@ -606,7 +611,7 @@ describe('POST /algorand/opt-in', () => { }); await request(gatewayApp) - .post('/algorand/opt-in') + .post('/chain/approve') .send({ network: NETWORK, address: ACCOUNT_ADDRESS, diff --git a/test/chains/avalanche/avalanche.routes.test.ts b/test-bronze/chains/avalanche/avalanche.routes.test.ts similarity index 88% rename from test/chains/avalanche/avalanche.routes.test.ts rename to test-bronze/chains/avalanche/avalanche.routes.test.ts index b0ed932e58..4c2e233cc2 100644 --- a/test/chains/avalanche/avalanche.routes.test.ts +++ b/test-bronze/chains/avalanche/avalanche.routes.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, @@ -7,9 +7,9 @@ import { NETWORK_ERROR_MESSAGE, UNKNOWN_ERROR_MESSAGE, } from '../../../src/services/error-handler'; -import * as transactionSuccesful from '../ethereum/fixtures/transaction-succesful.json'; -import * as transactionSuccesfulReceipt from '../ethereum/fixtures/transaction-succesful-receipt.json'; -import * as transactionOutOfGas from '../ethereum/fixtures/transaction-out-of-gas.json'; +import * as transactionSuccesful from '../../../test/chains/ethereum/fixtures/transaction-succesful.json'; +import * as transactionSuccesfulReceipt from '../../../test/chains/ethereum/fixtures/transaction-succesful-receipt.json'; +import * as transactionOutOfGas from '../../../test/chains/ethereum/fixtures/transaction-out-of-gas.json'; import { Avalanche } from '../../../src/chains/avalanche/avalanche'; let avalanche: Avalanche; @@ -87,13 +87,13 @@ const patchGetERC20Balance = () => { patch(avalanche, 'getERC20Balance', () => ({ value: 1, decimals: 3 })); }; -describe('POST /evm/nonce', () => { +describe('POST /chain/nonce', () => { it('should return 200', async () => { patchGetWallet(); patchGetNonce(); await request(gatewayApp) - .post(`/evm/nonce`) + .post(`/chain/nonce`) .send({ chain: 'avalanche', network: 'fuji', @@ -107,7 +107,7 @@ describe('POST /evm/nonce', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/nonce`) + .post(`/chain/nonce`) .send({ chain: 'avalanche', network: 'fuji', @@ -117,7 +117,7 @@ describe('POST /evm/nonce', () => { }); }); -describe('POST /evm/approve', () => { +describe('POST /chain/approve', () => { it('should return 200', async () => { patchGetWallet(); avalanche.getContract = jest.fn().mockReturnValue({ @@ -128,7 +128,7 @@ describe('POST /evm/approve', () => { patchApproveERC20(); await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'avalanche', network: 'fuji', @@ -146,7 +146,7 @@ describe('POST /evm/approve', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'avalanche', network: 'fuji', @@ -159,7 +159,7 @@ describe('POST /evm/approve', () => { }); }); -describe('POST /evm/allowances', () => { +describe('POST /chain/allowances', () => { it('should return 200 asking for allowances', async () => { patchGetWallet(); patchGetTokenBySymbol(); @@ -171,7 +171,7 @@ describe('POST /evm/allowances', () => { patchGetERC20Allowance(); await request(gatewayApp) - .post(`/evm/allowances`) + .post(`/chain/allowances`) .send({ chain: 'avalanche', network: 'fuji', @@ -188,7 +188,7 @@ describe('POST /evm/allowances', () => { }); }); -describe('POST /network/balances', () => { +describe('POST /chain/balances', () => { it('should return 200 asking for supported tokens', async () => { patchGetWallet(); patchGetTokenBySymbol(); @@ -199,7 +199,7 @@ describe('POST /network/balances', () => { }); await request(gatewayApp) - .post(`/network/balances`) + .post(`/chain/balances`) .send({ chain: 'avalanche', network: 'fuji', @@ -214,7 +214,7 @@ describe('POST /network/balances', () => { }); }); -describe('POST /evm/cancel', () => { +describe('POST /chain/cancel', () => { it('should return 200', async () => { // override getWallet (network call) avalanche.getWallet = jest.fn().mockReturnValue({ @@ -226,7 +226,7 @@ describe('POST /evm/cancel', () => { }); await request(gatewayApp) - .post(`/evm/cancel`) + .post(`/chain/cancel`) .send({ chain: 'avalanche', network: 'fuji', @@ -245,7 +245,7 @@ describe('POST /evm/cancel', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/cancel`) + .post(`/chain/cancel`) .send({ chain: 'avalanche', network: 'fuji', @@ -256,7 +256,7 @@ describe('POST /evm/cancel', () => { }); }); -describe('POST /network/poll', () => { +describe('POST /chain/poll', () => { it('should get a NETWORK_ERROR_CODE when the network is unavailable', async () => { patch(avalanche, 'getCurrentBlockNumber', () => { const error: any = new Error('something went wrong'); @@ -264,7 +264,7 @@ describe('POST /network/poll', () => { throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'avalanche', network: 'fuji', txHash: @@ -281,7 +281,7 @@ describe('POST /network/poll', () => { throw new Error(); }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'avalanche', network: 'fuji', txHash: @@ -296,7 +296,7 @@ describe('POST /network/poll', () => { patch(avalanche, 'getCurrentBlockNumber', () => 1); patch(avalanche, 'getTransaction', () => transactionOutOfGas); patch(avalanche, 'getTransactionReceipt', () => null); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'avalanche', network: 'fuji', txHash: @@ -311,7 +311,7 @@ describe('POST /network/poll', () => { patch(avalanche, 'getCurrentBlockNumber', () => 1); patch(avalanche, 'getTransaction', () => null); patch(avalanche, 'getTransactionReceipt', () => null); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'avalanche', network: 'fuji', txHash: @@ -330,7 +330,7 @@ describe('POST /network/poll', () => { 'getTransactionReceipt', () => transactionSuccesfulReceipt ); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'avalanche', network: 'fuji', txHash: @@ -347,7 +347,7 @@ describe('POST /network/poll', () => { error.code = -32006; throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'avalanche', network: 'fuji', txHash: diff --git a/test/chains/avalanche/avalanche.test.ts b/test-bronze/chains/avalanche/avalanche.test.ts similarity index 91% rename from test/chains/avalanche/avalanche.test.ts rename to test-bronze/chains/avalanche/avalanche.test.ts index c6c1259a13..7b778d643e 100644 --- a/test/chains/avalanche/avalanche.test.ts +++ b/test-bronze/chains/avalanche/avalanche.test.ts @@ -1,7 +1,7 @@ jest.useFakeTimers(); -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { Avalanche } from '../../../src/chains/avalanche/avalanche'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let avalanche: Avalanche; // Fake data for for testing diff --git a/test/chains/avalanche/avalanche.validators.test.ts b/test-bronze/chains/avalanche/avalanche.validators.test.ts similarity index 100% rename from test/chains/avalanche/avalanche.validators.test.ts rename to test-bronze/chains/avalanche/avalanche.validators.test.ts diff --git a/test/chains/binance-smart-chain/binance-smart-chain.routes.test.ts b/test-bronze/chains/binance-smart-chain/binance-smart-chain.routes.test.ts similarity index 88% rename from test/chains/binance-smart-chain/binance-smart-chain.routes.test.ts rename to test-bronze/chains/binance-smart-chain/binance-smart-chain.routes.test.ts index 4009e909eb..805b706934 100644 --- a/test/chains/binance-smart-chain/binance-smart-chain.routes.test.ts +++ b/test-bronze/chains/binance-smart-chain/binance-smart-chain.routes.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, @@ -7,11 +7,11 @@ import { UNKNOWN_ERROR_ERROR_CODE, UNKNOWN_ERROR_MESSAGE, } from '../../../src/services/error-handler'; -import * as transactionSuccesful from '../ethereum/fixtures/transaction-succesful.json'; -import * as transactionSuccesfulReceipt from '../ethereum//fixtures/transaction-succesful-receipt.json'; -import * as transactionOutOfGas from '../ethereum//fixtures/transaction-out-of-gas.json'; +import * as transactionSuccesful from '../../../test/chains/ethereum/fixtures/transaction-succesful.json'; +import * as transactionSuccesfulReceipt from '../../../test/chains/ethereum//fixtures/transaction-succesful-receipt.json'; +import * as transactionOutOfGas from '../../../test/chains/ethereum//fixtures/transaction-out-of-gas.json'; import { BinanceSmartChain } from '../../../src/chains/binance-smart-chain/binance-smart-chain'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let bsc: BinanceSmartChain; @@ -99,7 +99,7 @@ const patchGetERC20Balance = () => { patch(bsc, 'getERC20Balance', () => ({ value: 1, decimals: 3 })); }; -describe('POST /evm/approve', () => { +describe('POST /chain/approve', () => { it('should return 200', async () => { patchGetWallet(); bsc.getContract = jest.fn().mockReturnValue({ @@ -110,7 +110,7 @@ describe('POST /evm/approve', () => { patchApproveERC20(); await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -128,7 +128,7 @@ describe('POST /evm/approve', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -141,13 +141,13 @@ describe('POST /evm/approve', () => { }); }); -describe('POST /evm/nonce', () => { +describe('POST /chain/nonce', () => { it('should return 200', async () => { patchGetWallet(); patchGetNonce(); await request(gatewayApp) - .post(`/evm/nonce`) + .post(`/chain/nonce`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -160,7 +160,7 @@ describe('POST /evm/nonce', () => { }); }); -describe('POST /evm/allowances', () => { +describe('POST /chain/allowances', () => { it('should return 200 asking for allowances', async () => { patchGetWallet(); patchGetTokenBySymbol(); @@ -172,7 +172,7 @@ describe('POST /evm/allowances', () => { patchGetERC20Allowance(); await request(gatewayApp) - .post(`/evm/allowances`) + .post(`/chain/allowances`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -189,7 +189,7 @@ describe('POST /evm/allowances', () => { }); }); -describe('POST /network/balances', () => { +describe('POST /chain/balances', () => { it('should return 200 asking for supported tokens', async () => { patchGetWallet(); patchGetTokenBySymbol(); @@ -200,7 +200,7 @@ describe('POST /network/balances', () => { }); await request(gatewayApp) - .post(`/network/balances`) + .post(`/chain/balances`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -215,7 +215,7 @@ describe('POST /network/balances', () => { }); }); -describe('POST /evm/cancel', () => { +describe('POST /chain/cancel', () => { it('should return 200', async () => { // override getWallet (network call) bsc.getWallet = jest.fn().mockReturnValue({ @@ -227,7 +227,7 @@ describe('POST /evm/cancel', () => { }); await request(gatewayApp) - .post(`/evm/cancel`) + .post(`/chain/cancel`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -246,7 +246,7 @@ describe('POST /evm/cancel', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/cancel`) + .post(`/chain/cancel`) .send({ chain: 'binance-smart-chain', network: 'testnet', @@ -257,7 +257,7 @@ describe('POST /evm/cancel', () => { }); }); -describe('POST /network/poll', () => { +describe('POST /chain/poll', () => { it('should get a NETWORK_ERROR_CODE when the network is unavailable', async () => { patch(bsc, 'getCurrentBlockNumber', () => { const error: any = new Error('something went wrong'); @@ -265,7 +265,7 @@ describe('POST /network/poll', () => { throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'binance-smart-chain', network: 'testnet', txHash: @@ -282,7 +282,7 @@ describe('POST /network/poll', () => { throw new Error(); }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'binance-smart-chain', network: 'testnet', txHash: @@ -297,7 +297,7 @@ describe('POST /network/poll', () => { patch(bsc, 'getCurrentBlockNumber', () => 1); patch(bsc, 'getTransaction', () => transactionOutOfGas); patch(bsc, 'getTransactionReceipt', () => null); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'binance-smart-chain', network: 'testnet', txHash: @@ -312,7 +312,7 @@ describe('POST /network/poll', () => { patch(bsc, 'getCurrentBlockNumber', () => 1); patch(bsc, 'getTransaction', () => null); patch(bsc, 'getTransactionReceipt', () => null); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'binance-smart-chain', network: 'testnet', txHash: @@ -327,7 +327,7 @@ describe('POST /network/poll', () => { patch(bsc, 'getCurrentBlockNumber', () => 1); patch(bsc, 'getTransaction', () => transactionSuccesful); patch(bsc, 'getTransactionReceipt', () => transactionSuccesfulReceipt); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'binance-smart-chain', network: 'testnet', txHash: @@ -344,7 +344,7 @@ describe('POST /network/poll', () => { error.code = -32006; throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'binance-smart-chain', network: 'testnet', txHash: diff --git a/test/chains/cosmos/cosmos.validators.test.ts b/test-bronze/chains/cosmos/cosmos.validators.test.ts similarity index 100% rename from test/chains/cosmos/cosmos.validators.test.ts rename to test-bronze/chains/cosmos/cosmos.validators.test.ts diff --git a/test/chains/cosmos/fixtures/getTransaction.json b/test-bronze/chains/cosmos/fixtures/getTransaction.json similarity index 100% rename from test/chains/cosmos/fixtures/getTransaction.json rename to test-bronze/chains/cosmos/fixtures/getTransaction.json diff --git a/test/chains/cronos/cronos.routes.test.ts b/test-bronze/chains/cronos/cronos.routes.test.ts similarity index 95% rename from test/chains/cronos/cronos.routes.test.ts rename to test-bronze/chains/cronos/cronos.routes.test.ts index a8fb48e4d8..9d415a5b21 100644 --- a/test/chains/cronos/cronos.routes.test.ts +++ b/test-bronze/chains/cronos/cronos.routes.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, @@ -7,11 +7,11 @@ import { UNKNOWN_ERROR_ERROR_CODE, UNKNOWN_ERROR_MESSAGE, } from '../../../src/services/error-handler'; -import * as transactionSuccesful from '../ethereum/fixtures/transaction-succesful.json'; -import * as transactionSuccesfulReceipt from '../ethereum/fixtures/transaction-succesful-receipt.json'; -import * as transactionOutOfGas from '../ethereum/fixtures/transaction-out-of-gas.json'; +import * as transactionSuccesful from '../../../test/chains/ethereum/fixtures/transaction-succesful.json'; +import * as transactionSuccesfulReceipt from '../../../test/chains/ethereum/fixtures/transaction-succesful-receipt.json'; +import * as transactionOutOfGas from '../../../test/chains/ethereum/fixtures/transaction-out-of-gas.json'; import { Cronos } from '../../../src/chains/cronos/cronos'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let cronos: Cronos; const address: string = '0x242532ebDfcc760f2Ddfe8378eB51f5F847CE5bD'; // noqa: mock diff --git a/test/chains/harmony/harmony.controllers.test.ts b/test-bronze/chains/harmony/harmony.controllers.test.ts similarity index 98% rename from test/chains/harmony/harmony.controllers.test.ts rename to test-bronze/chains/harmony/harmony.controllers.test.ts index f15f93a670..4ee0a44e69 100644 --- a/test/chains/harmony/harmony.controllers.test.ts +++ b/test-bronze/chains/harmony/harmony.controllers.test.ts @@ -1,6 +1,6 @@ import { BigNumber } from 'ethers'; import { Harmony } from '../../../src/chains/harmony/harmony'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { TokenInfo } from '../../../src/chains/ethereum/ethereum-base'; import { HttpException, @@ -9,7 +9,7 @@ import { TOKEN_NOT_SUPPORTED_ERROR_MESSAGE, TOKEN_NOT_SUPPORTED_ERROR_CODE, } from '../../../src/services/error-handler'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; import { EVMController, willTxSucceed, diff --git a/test/chains/harmony/harmony.routes.test.ts b/test-bronze/chains/harmony/harmony.routes.test.ts similarity index 96% rename from test/chains/harmony/harmony.routes.test.ts rename to test-bronze/chains/harmony/harmony.routes.test.ts index c5c936aced..e87d589e1c 100644 --- a/test/chains/harmony/harmony.routes.test.ts +++ b/test-bronze/chains/harmony/harmony.routes.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, @@ -7,11 +7,11 @@ import { NETWORK_ERROR_MESSAGE, UNKNOWN_ERROR_MESSAGE, } from '../../../src/services/error-handler'; -import * as transactionSuccesful from '../ethereum/fixtures/transaction-succesful.json'; -import * as transactionSuccesfulReceipt from '../ethereum/fixtures/transaction-succesful-receipt.json'; -import * as transactionOutOfGas from '../ethereum/fixtures/transaction-out-of-gas.json'; +import * as transactionSuccesful from '../../../test/chains/ethereum/fixtures/transaction-succesful.json'; +import * as transactionSuccesfulReceipt from '../../../test/chains/ethereum/fixtures/transaction-succesful-receipt.json'; +import * as transactionOutOfGas from '../../../test/chains/ethereum/fixtures/transaction-out-of-gas.json'; import { Harmony } from '../../../src/chains/harmony/harmony'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let harmony: Harmony; beforeAll(async () => { diff --git a/test/chains/harmony/harmony.test.ts b/test-bronze/chains/harmony/harmony.test.ts similarity index 93% rename from test/chains/harmony/harmony.test.ts rename to test-bronze/chains/harmony/harmony.test.ts index 13aea00305..15b937f9fb 100644 --- a/test/chains/harmony/harmony.test.ts +++ b/test-bronze/chains/harmony/harmony.test.ts @@ -1,5 +1,5 @@ import { Harmony } from '../../../src/chains/harmony/harmony'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; import { DefiraConfig } from '../../../src/connectors/defira/defira.config'; let harmony: Harmony; diff --git a/test/chains/harmony/harmony.validators.test.ts b/test-bronze/chains/harmony/harmony.validators.test.ts similarity index 100% rename from test/chains/harmony/harmony.validators.test.ts rename to test-bronze/chains/harmony/harmony.validators.test.ts diff --git a/test/chains/injective/injective.message.test.ts b/test-bronze/chains/injective/injective.message.test.ts similarity index 97% rename from test/chains/injective/injective.message.test.ts rename to test-bronze/chains/injective/injective.message.test.ts index 36c916cc3d..32849ce1b3 100644 --- a/test/chains/injective/injective.message.test.ts +++ b/test-bronze/chains/injective/injective.message.test.ts @@ -1,6 +1,6 @@ import { MsgBroadcasterLocal } from '../../../src/chains/injective/injective.message'; import { Network } from '@injectivelabs/networks'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { MsgBid, PrivateKey, @@ -8,7 +8,7 @@ import { TxRaw, } from '@injectivelabs/sdk-ts'; import { Injective } from '../../../src/chains/injective/injective'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; import { AccountDetails } from '@injectivelabs/sdk-ts/dist/cjs/types/auth'; const TX_HASH = diff --git a/test/chains/injective/injective.routes.test.ts b/test-bronze/chains/injective/injective.routes.test.ts similarity index 98% rename from test/chains/injective/injective.routes.test.ts rename to test-bronze/chains/injective/injective.routes.test.ts index c6e3d3e2d1..1c7258c7ac 100644 --- a/test/chains/injective/injective.routes.test.ts +++ b/test-bronze/chains/injective/injective.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Injective } from '../../../src/chains/injective/injective'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; const TX_HASH = 'CC6BF44223B4BD05396F83D55A0ABC0F16CE80836C0E34B08F4558CF72944299'; // noqa: mock diff --git a/test/chains/injective/injective.validator.test.ts b/test-bronze/chains/injective/injective.validator.test.ts similarity index 100% rename from test/chains/injective/injective.validator.test.ts rename to test-bronze/chains/injective/injective.validator.test.ts diff --git a/test/chains/near/fixtures/getTokenList.json b/test-bronze/chains/near/fixtures/getTokenList.json similarity index 100% rename from test/chains/near/fixtures/getTokenList.json rename to test-bronze/chains/near/fixtures/getTokenList.json diff --git a/test/chains/near/fixtures/getTransaction.json b/test-bronze/chains/near/fixtures/getTransaction.json similarity index 100% rename from test/chains/near/fixtures/getTransaction.json rename to test-bronze/chains/near/fixtures/getTransaction.json diff --git a/test/chains/near/near.controllers.test.ts b/test-bronze/chains/near/near.controllers.test.ts similarity index 98% rename from test/chains/near/near.controllers.test.ts rename to test-bronze/chains/near/near.controllers.test.ts index d2ccf558b9..8677c1814e 100644 --- a/test/chains/near/near.controllers.test.ts +++ b/test-bronze/chains/near/near.controllers.test.ts @@ -7,7 +7,7 @@ import { LOAD_WALLET_ERROR_CODE, LOAD_WALLET_ERROR_MESSAGE, } from '../../../src/services/error-handler'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import * as getTokenListData from './fixtures/getTokenList.json'; import * as getTransactionData from './fixtures/getTransaction.json'; import { publicKey } from './near.validators.test'; diff --git a/test/chains/near/near.routes.test.ts b/test-bronze/chains/near/near.routes.test.ts similarity index 98% rename from test/chains/near/near.routes.test.ts rename to test-bronze/chains/near/near.routes.test.ts index 55128de12f..c351e18dcd 100644 --- a/test/chains/near/near.routes.test.ts +++ b/test-bronze/chains/near/near.routes.test.ts @@ -1,6 +1,6 @@ import request from 'supertest'; import { Near } from '../../../src/chains/near/near'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, diff --git a/test/chains/near/near.validators.test.ts b/test-bronze/chains/near/near.validators.test.ts similarity index 100% rename from test/chains/near/near.validators.test.ts rename to test-bronze/chains/near/near.validators.test.ts diff --git a/test/chains/polygon/polygon.test.ts b/test-bronze/chains/polygon/polygon.test.ts similarity index 87% rename from test/chains/polygon/polygon.test.ts rename to test-bronze/chains/polygon/polygon.test.ts index 309e7e6d3b..6ce7de1912 100644 --- a/test/chains/polygon/polygon.test.ts +++ b/test-bronze/chains/polygon/polygon.test.ts @@ -1,6 +1,6 @@ import { Polygon } from '../../../src/chains/polygon/polygon'; -import { unpatch } from '../../services/patch'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { unpatch } from '../../../test/services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let polygon: Polygon; beforeAll(async () => { diff --git a/test/chains/polygon/polygon.validators.test.ts b/test-bronze/chains/polygon/polygon.validators.test.ts similarity index 100% rename from test/chains/polygon/polygon.validators.test.ts rename to test-bronze/chains/polygon/polygon.validators.test.ts diff --git a/test/chains/tezos/tezos.controllers.test.ts b/test-bronze/chains/tezos/tezos.controllers.test.ts similarity index 100% rename from test/chains/tezos/tezos.controllers.test.ts rename to test-bronze/chains/tezos/tezos.controllers.test.ts diff --git a/test/chains/tezos/tezos.routes.test.ts b/test-bronze/chains/tezos/tezos.routes.test.ts similarity index 100% rename from test/chains/tezos/tezos.routes.test.ts rename to test-bronze/chains/tezos/tezos.routes.test.ts diff --git a/test/chains/tezos/tezos.test.ts b/test-bronze/chains/tezos/tezos.test.ts similarity index 100% rename from test/chains/tezos/tezos.test.ts rename to test-bronze/chains/tezos/tezos.test.ts diff --git a/test/chains/tezos/tezos.validators.test.ts b/test-bronze/chains/tezos/tezos.validators.test.ts similarity index 100% rename from test/chains/tezos/tezos.validators.test.ts rename to test-bronze/chains/tezos/tezos.validators.test.ts diff --git a/test/chains/tezos/tzkt.api.client.test.ts b/test-bronze/chains/tezos/tzkt.api.client.test.ts similarity index 100% rename from test/chains/tezos/tzkt.api.client.test.ts rename to test-bronze/chains/tezos/tzkt.api.client.test.ts diff --git a/test/chains/xdc/xdc.routes.test.ts b/test-bronze/chains/xdc/xdc.routes.test.ts similarity index 97% rename from test/chains/xdc/xdc.routes.test.ts rename to test-bronze/chains/xdc/xdc.routes.test.ts index 03e780477d..025d6e311b 100644 --- a/test/chains/xdc/xdc.routes.test.ts +++ b/test-bronze/chains/xdc/xdc.routes.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, @@ -7,9 +7,9 @@ import { NETWORK_ERROR_MESSAGE, UNKNOWN_ERROR_MESSAGE, } from '../../../src/services/error-handler'; -import * as transactionSuccesful from '../ethereum/fixtures/transaction-succesful.json'; -import * as transactionSuccesfulReceipt from '../ethereum/fixtures/transaction-succesful-receipt.json'; -import * as transactionOutOfGas from '../ethereum/fixtures/transaction-out-of-gas.json'; +import * as transactionSuccesful from '../../../test/chains/ethereum/fixtures/transaction-succesful.json'; +import * as transactionSuccesfulReceipt from '../../../test/chains/ethereum/fixtures/transaction-succesful-receipt.json'; +import * as transactionOutOfGas from '../../../test/chains/ethereum/fixtures/transaction-out-of-gas.json'; import { Xdc } from '../../../src/chains/xdc/xdc'; let xdc: Xdc; diff --git a/test/chains/xdc/xdc.test.ts b/test-bronze/chains/xdc/xdc.test.ts similarity index 89% rename from test/chains/xdc/xdc.test.ts rename to test-bronze/chains/xdc/xdc.test.ts index c9c05e9865..5f37d4d146 100644 --- a/test/chains/xdc/xdc.test.ts +++ b/test-bronze/chains/xdc/xdc.test.ts @@ -1,7 +1,7 @@ jest.useFakeTimers(); -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { Xdc } from '../../../src/chains/xdc/xdc'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let xdc: Xdc; // Fake data for for testing diff --git a/test/chains/xdc/xdc.validators.test.ts b/test-bronze/chains/xdc/xdc.validators.test.ts similarity index 100% rename from test/chains/xdc/xdc.validators.test.ts rename to test-bronze/chains/xdc/xdc.validators.test.ts diff --git a/test/clob/clob.routes.test.ts b/test-bronze/clob/clob.routes.test.ts similarity index 99% rename from test/clob/clob.routes.test.ts rename to test-bronze/clob/clob.routes.test.ts index da43eb3f17..ef7999c92e 100644 --- a/test/clob/clob.routes.test.ts +++ b/test-bronze/clob/clob.routes.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../services/patch'; +import { patch, unpatch } from '../../test/services/patch'; import { gatewayApp } from '../../src/app'; import { Injective } from '../../src/chains/injective/injective'; import { InjectiveCLOB } from '../../src/connectors/injective/injective'; @@ -241,10 +241,10 @@ const patchMarkets = () => { }; const patchOrderBook = () => { - patch(injCLOB.spotApi, 'fetchOrderbook', () => { + patch(injCLOB.spotApi, 'fetchOrderbookV2', () => { return ORDER_BOOK; }); - patch(injClobPerp.derivativeApi, 'fetchOrderbook', () => { + patch(injClobPerp.derivativeApi, 'fetchOrderbookV2', () => { return ORDER_BOOK; }); }; diff --git a/test/clob/clob.validators.test.ts b/test-bronze/clob/clob.validators.test.ts similarity index 100% rename from test/clob/clob.validators.test.ts rename to test-bronze/clob/clob.validators.test.ts diff --git a/test/connectors/defira/defira.routes.test.ts b/test-bronze/connectors/defira/defira.routes.test.ts similarity index 99% rename from test/connectors/defira/defira.routes.test.ts rename to test-bronze/connectors/defira/defira.routes.test.ts index 2d0621b757..139562baf9 100644 --- a/test/connectors/defira/defira.routes.test.ts +++ b/test-bronze/connectors/defira/defira.routes.test.ts @@ -4,7 +4,7 @@ import request from 'supertest'; import { Harmony } from '../../../src/chains/harmony/harmony'; import { Defira } from '../../../src/connectors/defira/defira'; import { AmmRoutes } from '../../../src/amm/amm.routes'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; let app: Express; let harmony: Harmony; diff --git a/test/connectors/defira/defira.test.ts b/test-bronze/connectors/defira/defira.test.ts similarity index 97% rename from test/connectors/defira/defira.test.ts rename to test-bronze/connectors/defira/defira.test.ts index ad59fd02e7..5a07674d47 100644 --- a/test/connectors/defira/defira.test.ts +++ b/test-bronze/connectors/defira/defira.test.ts @@ -2,13 +2,13 @@ jest.useFakeTimers(); const { MockProvider } = require('mock-ethers-provider'); import { FACTORY_ADDRESS } from '@zuzu-cat/defira-sdk'; import { Defira } from '../../../src/connectors/defira/defira'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { Token, CurrencyAmount, TradeType, Percent } from '@uniswap/sdk-core'; import { Trade, Pair, Route } from '@zuzu-cat/defira-sdk'; import { BigNumber } from 'ethers'; import { Harmony } from '../../../src/chains/harmony/harmony'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; import { DefiraConfig } from '../../../src/connectors/defira/defira.config'; import { abi as routerAbi } from '../../../src/connectors/defira/defira_v2_router_abi.json'; diff --git a/test/connectors/injective_perpetual/injective.perp.test.ts b/test-bronze/connectors/injective_perpetual/injective.perp.test.ts similarity index 100% rename from test/connectors/injective_perpetual/injective.perp.test.ts rename to test-bronze/connectors/injective_perpetual/injective.perp.test.ts diff --git a/test/connectors/mad_meerkat/mad-meerkat.routes.test.ts b/test-bronze/connectors/mad_meerkat/mad-meerkat.routes.test.ts similarity index 99% rename from test/connectors/mad_meerkat/mad-meerkat.routes.test.ts rename to test-bronze/connectors/mad_meerkat/mad-meerkat.routes.test.ts index bf9c3e77d2..67d950df43 100644 --- a/test/connectors/mad_meerkat/mad-meerkat.routes.test.ts +++ b/test-bronze/connectors/mad_meerkat/mad-meerkat.routes.test.ts @@ -1,9 +1,9 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { Cronos } from '../../../src/chains/cronos/cronos'; import { MadMeerkat } from '../../../src/connectors/mad_meerkat/mad_meerkat'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let cronos: Cronos; let madMeerkat: MadMeerkat; diff --git a/test/connectors/mad_meerkat/mad-meerkat.test.ts b/test-bronze/connectors/mad_meerkat/mad-meerkat.test.ts similarity index 96% rename from test/connectors/mad_meerkat/mad-meerkat.test.ts rename to test-bronze/connectors/mad_meerkat/mad-meerkat.test.ts index 6cf1397a8b..94d7291d3f 100644 --- a/test/connectors/mad_meerkat/mad-meerkat.test.ts +++ b/test-bronze/connectors/mad_meerkat/mad-meerkat.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { MadMeerkat } from '../../../src/connectors/mad_meerkat/mad_meerkat'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { ChainId, @@ -15,7 +15,7 @@ import { } from '@crocswap/sdk'; import { BigNumber } from 'ethers'; import { Cronos } from '../../../src/chains/cronos/cronos'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let cronos: Cronos; let madMeerkat: MadMeerkat; diff --git a/test/connectors/openocean/arbitrum.openocean.routes.test.ts b/test-bronze/connectors/openocean/arbitrum.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/arbitrum.openocean.routes.test.ts rename to test-bronze/connectors/openocean/arbitrum.openocean.routes.test.ts index 7dae6a2f6e..bacc0bdd9a 100644 --- a/test/connectors/openocean/arbitrum.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/arbitrum.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/avalanche.openocean.routes.test.ts b/test-bronze/connectors/openocean/avalanche.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/avalanche.openocean.routes.test.ts rename to test-bronze/connectors/openocean/avalanche.openocean.routes.test.ts index 8f9c35e7e0..e465338d0a 100644 --- a/test/connectors/openocean/avalanche.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/avalanche.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Avalanche } from '../../../src/chains/avalanche/avalanche'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/bsc.openocean.routes.test.ts b/test-bronze/connectors/openocean/bsc.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/bsc.openocean.routes.test.ts rename to test-bronze/connectors/openocean/bsc.openocean.routes.test.ts index 79c1157713..3dcef45f13 100644 --- a/test/connectors/openocean/bsc.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/bsc.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { BinanceSmartChain } from '../../../src/chains/binance-smart-chain/binance-smart-chain'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/cronos.openocean.routes.test.ts b/test-bronze/connectors/openocean/cronos.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/cronos.openocean.routes.test.ts rename to test-bronze/connectors/openocean/cronos.openocean.routes.test.ts index c6b9a640ba..41b5cceaf8 100644 --- a/test/connectors/openocean/cronos.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/cronos.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Cronos } from '../../../src/chains/cronos/cronos'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/ethereum.openocean.routes.test.ts b/test-bronze/connectors/openocean/ethereum.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/ethereum.openocean.routes.test.ts rename to test-bronze/connectors/openocean/ethereum.openocean.routes.test.ts index 22dd3ec763..1b8d79a82b 100644 --- a/test/connectors/openocean/ethereum.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/ethereum.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/harmony.openocean.routes.test.ts b/test-bronze/connectors/openocean/harmony.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/harmony.openocean.routes.test.ts rename to test-bronze/connectors/openocean/harmony.openocean.routes.test.ts index a888f024fd..2f31357530 100644 --- a/test/connectors/openocean/harmony.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/harmony.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Harmony } from '../../../src/chains/harmony/harmony'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/optimism.openocean.routes.test.ts b/test-bronze/connectors/openocean/optimism.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/optimism.openocean.routes.test.ts rename to test-bronze/connectors/openocean/optimism.openocean.routes.test.ts index 11158aec8e..9dbade8b6c 100644 --- a/test/connectors/openocean/optimism.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/optimism.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/openocean/polygon.openocean.routes.test.ts b/test-bronze/connectors/openocean/polygon.openocean.routes.test.ts similarity index 99% rename from test/connectors/openocean/polygon.openocean.routes.test.ts rename to test-bronze/connectors/openocean/polygon.openocean.routes.test.ts index b13461de2d..0eb8380940 100644 --- a/test/connectors/openocean/polygon.openocean.routes.test.ts +++ b/test-bronze/connectors/openocean/polygon.openocean.routes.test.ts @@ -1,8 +1,8 @@ import request from 'supertest'; import { Polygon } from '../../../src/chains/polygon/polygon'; import { Openocean } from '../../../src/connectors/openocean/openocean'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { AmmRoutes } from '../../../src/amm/amm.routes'; import express from 'express'; diff --git a/test/connectors/pangolin/pangolin.routes.test.ts b/test-bronze/connectors/pangolin/pangolin.routes.test.ts similarity index 99% rename from test/connectors/pangolin/pangolin.routes.test.ts rename to test-bronze/connectors/pangolin/pangolin.routes.test.ts index c76efede02..d483b3b843 100644 --- a/test/connectors/pangolin/pangolin.routes.test.ts +++ b/test-bronze/connectors/pangolin/pangolin.routes.test.ts @@ -1,9 +1,9 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { Avalanche } from '../../../src/chains/avalanche/avalanche'; import { Pangolin } from '../../../src/connectors/pangolin/pangolin'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let avalanche: Avalanche; let pangolin: Pangolin; diff --git a/test/connectors/pangolin/pangolin.test.ts b/test-bronze/connectors/pangolin/pangolin.test.ts similarity index 96% rename from test/connectors/pangolin/pangolin.test.ts rename to test-bronze/connectors/pangolin/pangolin.test.ts index eb6b8d700a..f43e0a161b 100644 --- a/test/connectors/pangolin/pangolin.test.ts +++ b/test-bronze/connectors/pangolin/pangolin.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Pangolin } from '../../../src/connectors/pangolin/pangolin'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { Fetcher, @@ -14,7 +14,7 @@ import { } from '@pangolindex/sdk'; import { BigNumber } from 'ethers'; import { Avalanche } from '../../../src/chains/avalanche/avalanche'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let avalanche: Avalanche; let pangolin: Pangolin; diff --git a/test/connectors/perp/perp.routes.test.ts b/test-bronze/connectors/perp/perp.routes.test.ts similarity index 98% rename from test/connectors/perp/perp.routes.test.ts rename to test-bronze/connectors/perp/perp.routes.test.ts index accde18616..4f12356592 100644 --- a/test/connectors/perp/perp.routes.test.ts +++ b/test-bronze/connectors/perp/perp.routes.test.ts @@ -7,9 +7,9 @@ import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { Perp } from '../../../src/connectors/perp/perp'; import { PerpAmmRoutes } from '../../../src/amm/amm.routes'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let app: Express; let ethereum: Ethereum; diff --git a/test/connectors/perp/perp.test.ts b/test-bronze/connectors/perp/perp.test.ts similarity index 97% rename from test/connectors/perp/perp.test.ts rename to test-bronze/connectors/perp/perp.test.ts index eb65bcedf4..c1c008ca5e 100644 --- a/test/connectors/perp/perp.test.ts +++ b/test-bronze/connectors/perp/perp.test.ts @@ -1,10 +1,10 @@ jest.useFakeTimers(); import { Perp } from '../../../src/connectors/perp/perp'; import { MarketStatus } from '@perp/sdk-curie'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { Big } from 'big.js'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let ethereum: Ethereum; let perp: Perp; diff --git a/test/connectors/plenty/analyticsAPI.ts b/test-bronze/connectors/plenty/analyticsAPI.ts similarity index 100% rename from test/connectors/plenty/analyticsAPI.ts rename to test-bronze/connectors/plenty/analyticsAPI.ts diff --git a/test/connectors/plenty/plenty.routes.test.ts b/test-bronze/connectors/plenty/plenty.routes.test.ts similarity index 99% rename from test/connectors/plenty/plenty.routes.test.ts rename to test-bronze/connectors/plenty/plenty.routes.test.ts index e0522900d2..2fcfae8269 100644 --- a/test/connectors/plenty/plenty.routes.test.ts +++ b/test-bronze/connectors/plenty/plenty.routes.test.ts @@ -3,7 +3,7 @@ import express from 'express'; import { Express } from 'express-serve-static-core'; import request from 'supertest'; import { AmmRoutes } from '../../../src/amm/amm.routes'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { Tezos } from '../../../src/chains/tezos/tezos'; import { Plenty } from '../../../src/connectors/plenty/plenty'; import * as plentyUtils from '../../../src/connectors/plenty/utils/router'; diff --git a/test/connectors/plenty/plenty.test.ts b/test-bronze/connectors/plenty/plenty.test.ts similarity index 98% rename from test/connectors/plenty/plenty.test.ts rename to test-bronze/connectors/plenty/plenty.test.ts index 793bdaf444..779062d6ef 100644 --- a/test/connectors/plenty/plenty.test.ts +++ b/test-bronze/connectors/plenty/plenty.test.ts @@ -3,7 +3,7 @@ import BigNumber from 'bignumber.js'; import { Tezosish } from '../../../src/services/common-interfaces'; import { tokensAPI } from './tokensAPI'; import { analyticsAPI } from './analyticsAPI'; -import { patch } from '../../services/patch'; +import { patch } from '../../../test/services/patch'; import { Tezos } from '../../../src/chains/tezos/tezos'; diff --git a/test/connectors/plenty/tokensAPI.ts b/test-bronze/connectors/plenty/tokensAPI.ts similarity index 100% rename from test/connectors/plenty/tokensAPI.ts rename to test-bronze/connectors/plenty/tokensAPI.ts diff --git a/test/connectors/quickswap/quickswap.route.test.ts b/test-bronze/connectors/quickswap/quickswap.route.test.ts similarity index 99% rename from test/connectors/quickswap/quickswap.route.test.ts rename to test-bronze/connectors/quickswap/quickswap.route.test.ts index b3326b2796..cd45c4f928 100644 --- a/test/connectors/quickswap/quickswap.route.test.ts +++ b/test-bronze/connectors/quickswap/quickswap.route.test.ts @@ -1,9 +1,9 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { Polygon } from '../../../src/chains/polygon/polygon'; import { Quickswap } from '../../../src/connectors/quickswap/quickswap'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let polygon: Polygon; let quickswap: Quickswap; diff --git a/test/connectors/quickswap/quickswap.test.ts b/test-bronze/connectors/quickswap/quickswap.test.ts similarity index 96% rename from test/connectors/quickswap/quickswap.test.ts rename to test-bronze/connectors/quickswap/quickswap.test.ts index 8a409a4a65..a95918333d 100644 --- a/test/connectors/quickswap/quickswap.test.ts +++ b/test-bronze/connectors/quickswap/quickswap.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Quickswap } from '../../../src/connectors/quickswap/quickswap'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { Fetcher, @@ -14,7 +14,7 @@ import { } from 'quickswap-sdk'; import { BigNumber } from 'ethers'; import { Polygon } from '../../../src/chains/polygon/polygon'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let polygon: Polygon; let quickswap: Quickswap; diff --git a/test/connectors/ref/ref.route.test.ts b/test-bronze/connectors/ref/ref.route.test.ts similarity index 99% rename from test/connectors/ref/ref.route.test.ts rename to test-bronze/connectors/ref/ref.route.test.ts index 1675caea8b..2a734f5850 100644 --- a/test/connectors/ref/ref.route.test.ts +++ b/test-bronze/connectors/ref/ref.route.test.ts @@ -1,5 +1,5 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { Near } from '../../../src/chains/near/near'; import { Ref } from '../../../src/connectors/ref/ref'; diff --git a/test/connectors/ref/ref.test.ts b/test-bronze/connectors/ref/ref.test.ts similarity index 99% rename from test/connectors/ref/ref.test.ts rename to test-bronze/connectors/ref/ref.test.ts index 5d4df836bf..4ef33fa6c1 100644 --- a/test/connectors/ref/ref.test.ts +++ b/test-bronze/connectors/ref/ref.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Ref } from '../../../src/connectors/ref/ref'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { Near } from '../../../src/chains/near/near'; import * as RefSDK from 'coinalpha-ref-sdk'; diff --git a/test/connectors/sushiswap/ethereum.sushiswap.routes.test.ts b/test-bronze/connectors/sushiswap/ethereum.sushiswap.routes.test.ts similarity index 99% rename from test/connectors/sushiswap/ethereum.sushiswap.routes.test.ts rename to test-bronze/connectors/sushiswap/ethereum.sushiswap.routes.test.ts index 636ecb5c8d..061ff03bf2 100644 --- a/test/connectors/sushiswap/ethereum.sushiswap.routes.test.ts +++ b/test-bronze/connectors/sushiswap/ethereum.sushiswap.routes.test.ts @@ -4,7 +4,7 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { Sushiswap } from '../../../src/connectors/sushiswap/sushiswap'; import { AmmRoutes } from '../../../src/amm/amm.routes'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; let app: Express; diff --git a/test/connectors/sushiswap/ethereum.sushiswap.test.ts b/test-bronze/connectors/sushiswap/ethereum.sushiswap.test.ts similarity index 96% rename from test/connectors/sushiswap/ethereum.sushiswap.test.ts rename to test-bronze/connectors/sushiswap/ethereum.sushiswap.test.ts index deee57a7cf..50613ad809 100644 --- a/test/connectors/sushiswap/ethereum.sushiswap.test.ts +++ b/test-bronze/connectors/sushiswap/ethereum.sushiswap.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Sushiswap } from '../../../src/connectors/sushiswap/sushiswap'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError as SushiswapishPriceError } from '../../../src/services/error-handler'; import { Token, @@ -12,7 +12,7 @@ import { } from '@sushiswap/sdk'; import { BigNumber } from 'ethers'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let ethereum: Ethereum; let sushiswap: Sushiswap; diff --git a/test/connectors/tinyman/tinyman.test.ts b/test-bronze/connectors/tinyman/tinyman.test.ts similarity index 99% rename from test/connectors/tinyman/tinyman.test.ts rename to test-bronze/connectors/tinyman/tinyman.test.ts index 0c85d06c5b..23bfe63f17 100644 --- a/test/connectors/tinyman/tinyman.test.ts +++ b/test-bronze/connectors/tinyman/tinyman.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Tinyman } from '../../../src/connectors/tinyman/tinyman'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { Algorand } from '../../../src/chains/algorand/algorand'; import { poolUtils, SwapQuoteType, } from '@tinymanorg/tinyman-js-sdk'; import { getAlgorandConfig } from '../../../src/chains/algorand/algorand.config'; diff --git a/test/connectors/traderjoe/traderjoe.test.ts b/test-bronze/connectors/traderjoe/traderjoe.test.ts similarity index 98% rename from test/connectors/traderjoe/traderjoe.test.ts rename to test-bronze/connectors/traderjoe/traderjoe.test.ts index ec7b7b378b..7089818932 100644 --- a/test/connectors/traderjoe/traderjoe.test.ts +++ b/test-bronze/connectors/traderjoe/traderjoe.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Traderjoe } from '../../../src/connectors/traderjoe/traderjoe'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { Pair, @@ -13,7 +13,7 @@ import { } from '@traderjoe-xyz/sdk'; import { BigNumber } from 'ethers'; import { Avalanche } from '../../../src/chains/avalanche/avalanche'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; import { JSBI, TradeV2 } from '@traderjoe-xyz/sdk-v2'; let avalanche: Avalanche; let traderjoe: Traderjoe; diff --git a/test/connectors/vvs/vvs.routes.test.ts b/test-bronze/connectors/vvs/vvs.routes.test.ts similarity index 99% rename from test/connectors/vvs/vvs.routes.test.ts rename to test-bronze/connectors/vvs/vvs.routes.test.ts index 09e0168b3c..1e3ae78708 100644 --- a/test/connectors/vvs/vvs.routes.test.ts +++ b/test-bronze/connectors/vvs/vvs.routes.test.ts @@ -1,9 +1,9 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { Cronos } from '../../../src/chains/cronos/cronos'; import { VVSConnector } from '../../../src/connectors/vvs/vvs'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let cronos: Cronos; let vvs: VVSConnector; diff --git a/test/connectors/vvs/vvs.test.ts b/test-bronze/connectors/vvs/vvs.test.ts similarity index 96% rename from test/connectors/vvs/vvs.test.ts rename to test-bronze/connectors/vvs/vvs.test.ts index d82a25ca28..5a69a3901c 100644 --- a/test/connectors/vvs/vvs.test.ts +++ b/test-bronze/connectors/vvs/vvs.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { VVSConnector } from '../../../src/connectors/vvs/vvs'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { ChainId, @@ -15,7 +15,7 @@ import { } from 'vvs-sdk'; import { BigNumber } from 'ethers'; import { Cronos } from '../../../src/chains/cronos/cronos'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let cronos: Cronos; let vvs: VVSConnector; diff --git a/test/connectors/xsswap/xsswap.routes.test.ts b/test-bronze/connectors/xsswap/xsswap.routes.test.ts similarity index 99% rename from test/connectors/xsswap/xsswap.routes.test.ts rename to test-bronze/connectors/xsswap/xsswap.routes.test.ts index d9ececdd1b..6a4a3c915e 100644 --- a/test/connectors/xsswap/xsswap.routes.test.ts +++ b/test-bronze/connectors/xsswap/xsswap.routes.test.ts @@ -1,9 +1,9 @@ import request from 'supertest'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { Xdc } from '../../../src/chains/xdc/xdc'; import { Xsswap } from '../../../src/connectors/xsswap/xsswap'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let xdc: Xdc; let xsswap: Xsswap; diff --git a/test/connectors/xsswap/xsswap.test.ts b/test-bronze/connectors/xsswap/xsswap.test.ts similarity index 96% rename from test/connectors/xsswap/xsswap.test.ts rename to test-bronze/connectors/xsswap/xsswap.test.ts index fae8aea91d..bf8f22408f 100644 --- a/test/connectors/xsswap/xsswap.test.ts +++ b/test-bronze/connectors/xsswap/xsswap.test.ts @@ -1,6 +1,6 @@ jest.useFakeTimers(); import { Xsswap } from '../../../src/connectors/xsswap/xsswap'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { ChainId, @@ -15,7 +15,7 @@ import { } from 'xsswap-sdk'; import { BigNumber } from 'ethers'; import { Xdc } from '../../../src/chains/xdc/xdc'; -import { patchEVMNonceManager } from '../../evm.nonce.mock'; +import { patchEVMNonceManager } from '../../../test/evm.nonce.mock'; let xdc: Xdc; let xsswap: Xsswap; diff --git a/test/chains/ethereum/ethereum.controllers.test.ts b/test/chains/ethereum/ethereum.controllers.test.ts index 6a1fc7d960..74567906f7 100644 --- a/test/chains/ethereum/ethereum.controllers.test.ts +++ b/test/chains/ethereum/ethereum.controllers.test.ts @@ -1,6 +1,6 @@ import { BigNumber } from 'ethers'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { TokenInfo } from '../../../src/chains/ethereum/ethereum-base'; import { HttpException, @@ -36,21 +36,23 @@ afterAll(async () => { await eth.close(); }); -const zeroAddress = - '0000000000000000000000000000000000000000000000000000000000000000'; // noqa: mock +// const zeroAddress = +// '0000000000000000000000000000000000000000000000000000000000000000'; // noqa: mock + +const mockAddress = '0xFaA12FD102FE8623C9299c72B03E45107F2772B5'; // noqa: mock describe('nonce', () => { it('return a nonce for a wallet', async () => { patch(eth, 'getWallet', () => { return { - address: '0xFaA12FD102FE8623C9299c72B03E45107F2772B5', + address: mockAddress, }; }); patch(eth.nonceManager, 'getNonce', () => 2); const n = await EVMController.nonce(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, }); expect(n).toEqual({ nonce: 2 }); }); @@ -58,14 +60,14 @@ describe('nonce', () => { it('return next nonce for a wallet', async () => { patch(eth, 'getWallet', () => { return { - address: '0xFaA12FD102FE8623C9299c72B03E45107F2772B5', + address: mockAddress, }; }); patch(eth.nonceManager, 'getNextNonce', () => 3); const n = await EVMController.nextNonce(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, }); expect(n).toEqual({ nonce: 3 }); }); @@ -95,7 +97,7 @@ describe('allowances', () => { it('return allowances for an owner, spender and tokens', async () => { patch(eth, 'getWallet', () => { return { - address: '0xFaA12FD102FE8623C9299c72B03E45107F2772B5', + address: mockAddress, }; }); @@ -117,7 +119,7 @@ describe('allowances', () => { const result = await EVMController.allowances(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, spender: uniswap, tokenSymbols: ['WETH'], }); @@ -133,14 +135,14 @@ describe('approve', () => { return uniswap; }); eth.getContract = jest.fn().mockReturnValue({ - address: '0xFaA12FD102FE8623C9299c72B03E45107F2772B5', + address: mockAddress, }); patch(eth, 'ready', () => true); patch(eth, 'getWallet', () => { return { - address: '0xFaA12FD102FE8623C9299c72B03E45107F2772B5', + address: mockAddress, }; }); @@ -158,7 +160,7 @@ describe('approve', () => { const result = await EVMController.approve(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, spender: uniswap, token: 'WETH', }); @@ -179,7 +181,7 @@ describe('approve', () => { EVMController.approve(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, spender: uniswap, token: 'WETH', }) @@ -199,7 +201,7 @@ describe('approve', () => { patch(eth, 'getWallet', () => { return { - address: '0xFaA12FD102FE8623C9299c72B03E45107F2772B5', + address: mockAddress, }; }); @@ -211,7 +213,7 @@ describe('approve', () => { EVMController.approve(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, spender: uniswap, token: 'WETH', }) @@ -236,7 +238,7 @@ describe('balances', () => { EVMController.balances(eth, { chain: 'ethereum', network: 'goerli', - address: zeroAddress, + address: mockAddress, tokenSymbols: ['WETH', 'DAI'], }) ).rejects.toThrow( @@ -261,7 +263,7 @@ describe('cancel', () => { chain: 'ethereum', network: 'goerli', nonce: 123, - address: zeroAddress, + address: mockAddress, }) ).rejects.toThrow( new HttpException( diff --git a/test/chains/ethereum/ethereum.routes.test.ts b/test/chains/ethereum/ethereum.routes.test.ts index 4061cd970a..7a94225f55 100644 --- a/test/chains/ethereum/ethereum.routes.test.ts +++ b/test/chains/ethereum/ethereum.routes.test.ts @@ -1,6 +1,6 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gatewayApp } from '../../../src/app'; import { NETWORK_ERROR_CODE, @@ -118,7 +118,7 @@ const patchApproveERC20 = (tx_type?: string) => { }); }; -describe('POST /evm/allowances', () => { +describe('POST /chain/allowances', () => { it('should return 200 asking for allowances', async () => { patchGetWallet(); patchGetTokenBySymbol(); @@ -130,7 +130,7 @@ describe('POST /evm/allowances', () => { patchGetERC20Allowance(); await request(gatewayApp) - .post(`/evm/allowances`) + .post(`/chain/allowances`) .send({ chain: 'ethereum', network: 'goerli', @@ -148,7 +148,7 @@ describe('POST /evm/allowances', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/allowances`) + .post(`/chain/allowances`) .send({ chain: 'ethereum', network: 'goerli', @@ -160,7 +160,7 @@ describe('POST /evm/allowances', () => { }); }); -describe('POST /network/balances', () => { +describe('POST /chain/balances', () => { it('should return 200 asking for supported tokens', async () => { patchGetWallet(); patchGetTokenBySymbol(); @@ -171,7 +171,7 @@ describe('POST /network/balances', () => { }); await request(gatewayApp) - .post(`/network/balances`) + .post(`/chain/balances`) .send({ chain: 'ethereum', network: 'goerli', @@ -195,7 +195,7 @@ describe('POST /network/balances', () => { }); await request(gatewayApp) - .post(`/network/balances`) + .post(`/chain/balances`) .send({ chain: 'ethereum', network: 'goerli', @@ -219,7 +219,7 @@ describe('POST /network/balances', () => { }); await request(gatewayApp) - .post(`/network/balances`) + .post(`/chain/balances`) .send({ chain: 'ethereum', network: 'goerli', @@ -233,7 +233,7 @@ describe('POST /network/balances', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/network/balances`) + .post(`/chain/balances`) .send({ chain: 'ethereum', network: 'goerli', @@ -243,13 +243,13 @@ describe('POST /network/balances', () => { }); }); -describe('POST /evm/nonce', () => { +describe('POST /chain/nonce', () => { it('should return 200', async () => { patchGetWallet(); patchGetNonce(); await request(gatewayApp) - .post(`/evm/nonce`) + .post(`/chain/nonce`) .send({ chain: 'ethereum', network: 'goerli', @@ -263,7 +263,7 @@ describe('POST /evm/nonce', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/nonce`) + .post(`/chain/nonce`) .send({ chain: 'ethereum', network: 'goerli', @@ -273,13 +273,13 @@ describe('POST /evm/nonce', () => { }); }); -describe('POST /evm/nextNonce', () => { +describe('POST /chain/nextNonce', () => { it('should return 200', async () => { patchGetWallet(); patchGetNextNonce(); await request(gatewayApp) - .post(`/evm/nextNonce`) + .post(`/chain/nextNonce`) .send({ chain: 'ethereum', network: 'goerli', @@ -293,7 +293,7 @@ describe('POST /evm/nextNonce', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/nextNonce`) + .post(`/chain/nextNonce`) .send({ chain: 'ethereum', network: 'goerli', @@ -303,7 +303,7 @@ describe('POST /evm/nextNonce', () => { }); }); -describe('POST /evm/approve', () => { +describe('POST /chain/approve', () => { it('approve without nonce parameter should return 200', async () => { patchGetWallet(); eth.getContract = jest.fn().mockReturnValue({ @@ -314,7 +314,7 @@ describe('POST /evm/approve', () => { patchApproveERC20(); await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'ethereum', network: 'goerli', @@ -334,7 +334,7 @@ describe('POST /evm/approve', () => { patchApproveERC20(); await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'ethereum', network: 'goerli', @@ -358,7 +358,7 @@ describe('POST /evm/approve', () => { patchApproveERC20(); await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'ethereum', network: 'goerli', @@ -384,7 +384,7 @@ describe('POST /evm/approve', () => { patchApproveERC20(); await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'ethereum', network: 'goerli', @@ -398,7 +398,7 @@ describe('POST /evm/approve', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send({ chain: 'ethereum', network: 'goerli', @@ -411,7 +411,7 @@ describe('POST /evm/approve', () => { }); }); -describe('POST /evm/cancel', () => { +describe('POST /chain/cancel', () => { it('should return 200', async () => { // override getWallet (network call) eth.getWallet = jest.fn().mockReturnValue({ @@ -423,7 +423,7 @@ describe('POST /evm/cancel', () => { }); await request(gatewayApp) - .post(`/evm/cancel`) + .post(`/chain/cancel`) .send({ chain: 'ethereum', network: 'goerli', @@ -442,7 +442,7 @@ describe('POST /evm/cancel', () => { it('should return 404 when parameters are invalid', async () => { await request(gatewayApp) - .post(`/evm/cancel`) + .post(`/chain/cancel`) .send({ chain: 'ethereum', network: 'goerli', @@ -453,7 +453,7 @@ describe('POST /evm/cancel', () => { }); }); -describe('POST /network/poll', () => { +describe('POST /chain/poll', () => { it('should get a NETWORK_ERROR_CODE when the network is unavailable', async () => { patch(eth, 'getCurrentBlockNumber', () => { const error: any = new Error('something went wrong'); @@ -461,7 +461,7 @@ describe('POST /network/poll', () => { throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: @@ -478,7 +478,7 @@ describe('POST /network/poll', () => { throw new Error(); }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ txHash: '0x2faeb1aa55f96c1db55f643a8cf19b0f76bf091d0b7d1b068d2e829414576362', // noqa: mock }); @@ -491,7 +491,7 @@ describe('POST /network/poll', () => { patch(eth, 'getCurrentBlockNumber', () => 1); patch(eth, 'getTransaction', () => transactionOutOfGas); patch(eth, 'getTransactionReceipt', () => null); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: @@ -506,7 +506,7 @@ describe('POST /network/poll', () => { patch(eth, 'getCurrentBlockNumber', () => 1); patch(eth, 'getTransaction', () => null); patch(eth, 'getTransactionReceipt', () => null); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: @@ -521,7 +521,7 @@ describe('POST /network/poll', () => { patch(eth, 'getCurrentBlockNumber', () => 1); patch(eth, 'getTransaction', () => transactionSuccesful); patch(eth, 'getTransactionReceipt', () => transactionSuccesfulReceipt); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: @@ -546,7 +546,7 @@ describe('POST /network/poll', () => { }; throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: @@ -563,7 +563,7 @@ describe('POST /network/poll', () => { error.code = -32006; throw error; }); - const res = await request(gatewayApp).post('/network/poll').send({ + const res = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: @@ -594,7 +594,7 @@ describe('overwrite existing transaction', () => { patchApproveERC20('overwritten_tx'); const tx_1 = await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send(requestParam) .set('Accept', 'application/json') .expect('Content-Type', /json/) @@ -603,7 +603,7 @@ describe('overwrite existing transaction', () => { patchApproveERC20(); // patch to return different tx_hash requestParam.maxPriorityFeePerGas = '8000000000'; // we only increase maxPriorityFeePerGas const tx_2 = await request(gatewayApp) - .post(`/evm/approve`) + .post(`/chain/approve`) .send(requestParam) .set('Accept', 'application/json') .expect('Content-Type', /json/) @@ -613,7 +613,7 @@ describe('overwrite existing transaction', () => { patch(eth, 'getCurrentBlockNumber', () => 1); patch(eth, 'getTransaction', () => null); patch(eth, 'getTransactionReceipt', () => null); - const res_1 = await request(gatewayApp).post('/network/poll').send({ + const res_1 = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: tx_1.body.approval.hash, @@ -625,7 +625,7 @@ describe('overwrite existing transaction', () => { patch(eth, 'getCurrentBlockNumber', () => 1); patch(eth, 'getTransaction', () => transactionSuccesful); patch(eth, 'getTransactionReceipt', () => transactionSuccesfulReceipt); - const res_2 = await request(gatewayApp).post('/network/poll').send({ + const res_2 = await request(gatewayApp).post('/chain/poll').send({ chain: 'ethereum', network: 'goerli', txHash: tx_2.body.approval.hash, diff --git a/test/chains/ethereum/evm.nonce.test.ts b/test/chains/ethereum/evm.nonce.test.ts index edf369ffb5..f44291e221 100644 --- a/test/chains/ethereum/evm.nonce.test.ts +++ b/test/chains/ethereum/evm.nonce.test.ts @@ -13,7 +13,7 @@ import { SERVICE_UNITIALIZED_ERROR_MESSAGE, } from '../../../src/services/error-handler'; import { EVMNonceManager } from '../../../src/chains/ethereum/evm.nonce'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import 'jest-extended'; import { ReferenceCountingCloseable } from '../../../src/services/refcounting-closeable'; diff --git a/test/connectors/dexalot/dexalot.test.ts b/test/connectors/dexalot/dexalot.test.ts index e013ae02fd..13fba6f81e 100644 --- a/test/connectors/dexalot/dexalot.test.ts +++ b/test/connectors/dexalot/dexalot.test.ts @@ -5,7 +5,7 @@ import { Avalanche } from '../../../src/chains/avalanche/avalanche'; import { EVMTxBroadcaster } from '../../../src/chains/ethereum/evm.broadcaster'; import { DexalotCLOB } from '../../../src/connectors/dexalot/dexalot'; import { fromUtf8 } from '../../../src/connectors/dexalot/dexalot.utils'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; let avalanche: Avalanche; let dexalot: DexalotCLOB; diff --git a/test/connectors/pancakeswap/pancakeswap.routes.test.ts b/test/connectors/pancakeswap/pancakeswap.routes.test.ts index 5630b4f205..632bb73ee8 100644 --- a/test/connectors/pancakeswap/pancakeswap.routes.test.ts +++ b/test/connectors/pancakeswap/pancakeswap.routes.test.ts @@ -2,7 +2,7 @@ import request from 'supertest'; import { gatewayApp } from '../../../src/app'; import { BinanceSmartChain } from '../../../src/chains/binance-smart-chain/binance-smart-chain'; import { PancakeSwap } from '../../../src/connectors/pancakeswap/pancakeswap'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { patchEVMNonceManager } from '../../evm.nonce.mock'; let bsc: BinanceSmartChain; diff --git a/test/connectors/pancakeswap/pancakeswap.test.ts b/test/connectors/pancakeswap/pancakeswap.test.ts index 310b02a758..61816d954e 100644 --- a/test/connectors/pancakeswap/pancakeswap.test.ts +++ b/test/connectors/pancakeswap/pancakeswap.test.ts @@ -14,7 +14,7 @@ import { BinanceSmartChain } from '../../../src/chains/binance-smart-chain/binan import { PancakeSwap } from '../../../src/connectors/pancakeswap/pancakeswap'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { patchEVMNonceManager } from '../../evm.nonce.mock'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; let bsc: BinanceSmartChain; let pancakeswap: PancakeSwap; diff --git a/test/connectors/uniswap/uniswap.lp.routes.test.ts b/test/connectors/uniswap/uniswap.lp.routes.test.ts index 67f1572b36..5abb7d237b 100644 --- a/test/connectors/uniswap/uniswap.lp.routes.test.ts +++ b/test/connectors/uniswap/uniswap.lp.routes.test.ts @@ -4,7 +4,7 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { UniswapLP } from '../../../src/connectors/uniswap/uniswap.lp'; import { AmmLiquidityRoutes } from '../../../src/amm/amm.routes'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { patchEVMNonceManager } from '../../evm.nonce.mock'; let app: Express; diff --git a/test/connectors/uniswap/uniswap.lp.test.ts b/test/connectors/uniswap/uniswap.lp.test.ts index e282530cb1..3fed8b8aa8 100644 --- a/test/connectors/uniswap/uniswap.lp.test.ts +++ b/test/connectors/uniswap/uniswap.lp.test.ts @@ -4,7 +4,7 @@ import * as uniV3 from '@uniswap/v3-sdk'; import { BigNumber, Transaction, Wallet } from 'ethers'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { UniswapLP } from '../../../src/connectors/uniswap/uniswap.lp'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { patchEVMNonceManager } from '../../evm.nonce.mock'; let ethereum: Ethereum; let uniswapLP: UniswapLP; diff --git a/test/connectors/uniswap/uniswap.routes.test.ts b/test/connectors/uniswap/uniswap.routes.test.ts index 0bf191f7a9..642aeaf514 100644 --- a/test/connectors/uniswap/uniswap.routes.test.ts +++ b/test/connectors/uniswap/uniswap.routes.test.ts @@ -4,7 +4,7 @@ import request from 'supertest'; import { Ethereum } from '../../../src/chains/ethereum/ethereum'; import { Uniswap } from '../../../src/connectors/uniswap/uniswap'; import { AmmRoutes } from '../../../src/amm/amm.routes'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { gasCostInEthString } from '../../../src/services/base'; import { patchEVMNonceManager } from '../../evm.nonce.mock'; let app: Express; diff --git a/test/connectors/uniswap/uniswap.test.ts b/test/connectors/uniswap/uniswap.test.ts index ff81685ad6..502de8737c 100644 --- a/test/connectors/uniswap/uniswap.test.ts +++ b/test/connectors/uniswap/uniswap.test.ts @@ -1,7 +1,7 @@ jest.useFakeTimers(); const { MockProvider } = require('mock-ethers-provider'); import { Uniswap } from '../../../src/connectors/uniswap/uniswap'; -import { patch, unpatch } from '../../services/patch'; +import { patch, unpatch } from '../../../test/services/patch'; import { UniswapishPriceError } from '../../../src/services/error-handler'; import { CurrencyAmount, Percent, TradeType, Token } from '@uniswap/sdk-core'; import { Pair, Route } from '@uniswap/v2-sdk'; diff --git a/test/network/network.routes.test.ts b/test/network/network.routes.test.ts index 943fddfca2..600f7aea84 100644 --- a/test/network/network.routes.test.ts +++ b/test/network/network.routes.test.ts @@ -59,7 +59,7 @@ afterAll(async () => { await cronos.close(); }); -describe('GET /network/status', () => { +describe('GET /chain/status', () => { it('should return 200 when asking for harmony network status', async () => { patch(harmony, 'chain', () => { return 'testnet'; @@ -71,7 +71,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'harmony', network: 'testnet', @@ -95,7 +95,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'ethereum', network: 'goerli', @@ -119,7 +119,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'ethereum', network: 'goerli', @@ -143,7 +143,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'avalanche', network: 'fuji', @@ -167,7 +167,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'polygon', network: 'mumbai', @@ -191,7 +191,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'cronos', network: 'testnet', @@ -217,7 +217,7 @@ describe('GET /network/status', () => { }); await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .expect('Content-Type', /json/) .expect(200) .expect((res) => expect(Array.isArray(res.body)).toEqual(true)); @@ -225,7 +225,7 @@ describe('GET /network/status', () => { it('should return 500 when asking for invalid network', async () => { await request(gatewayApp) - .get(`/network/status`) + .get(`/chain/status`) .query({ chain: 'hello', }) @@ -236,16 +236,16 @@ describe('GET /network/status', () => { describe('GET /network/config', () => { it('should return 200 when asking for config', async () => { request(gatewayApp) - .get(`/network/config`) + .get(`/chain/config`) .expect('Content-Type', /json/) .expect(200); }); }); -describe('GET /network/tokens', () => { +describe('GET /chain/tokens', () => { it('should return 200 when retrieving ethereum-goerli tokens, tokenSymbols parameter not provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'ethereum', network: 'goerli', @@ -256,7 +256,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving ethereum-goerli tokens, s parameter provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'ethereum', network: 'goerli', @@ -268,7 +268,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving ethereum-goerli tokens, tokenSymbols parameter not provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'ethereum', network: 'goerli', @@ -279,7 +279,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving ethereum-goerli tokens, tokenSymbols parameter provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'ethereum', network: 'goerli', @@ -291,7 +291,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving polygon-mumbai tokens, tokenSymbols parameter not provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'polygon', network: 'mumbai', @@ -302,7 +302,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving polygon-mumbai tokens, tokenSymbols parameter provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'polygon', network: 'mumbai', @@ -314,7 +314,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving cronos-testnet tokens, tokenSymbols parameter not provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'cronos', network: 'testnet', @@ -325,7 +325,7 @@ describe('GET /network/tokens', () => { it('should return 200 when retrieving cronos-testnet tokens, tokenSymbols parameter provided', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'cronos', network: 'testnet', @@ -335,13 +335,13 @@ describe('GET /network/tokens', () => { .expect(200); }); - it('should return 500 when retrieving tokens for invalid chain', async () => { + it('should return 503 when retrieving tokens for invalid chain', async () => { await request(gatewayApp) - .get(`/network/tokens`) + .get(`/chain/tokens`) .query({ chain: 'unknown', network: 'goerli', }) - .expect(500); + .expect(503); }); });