Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/gateway tests #188

Merged
merged 10 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,14 @@ 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'
shell: bash
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:
Expand Down
132 changes: 110 additions & 22 deletions docs/swagger/chain-routes.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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'
32 changes: 14 additions & 18 deletions docs/swagger/swagger.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Loading