Skip to content

Commit

Permalink
Merge pull request #193 from hummingbot/staging
Browse files Browse the repository at this point in the history
gateway sync / gateway staging -> main for Hummingbot version 1.19.0
  • Loading branch information
fengtality authored Aug 29, 2023
2 parents 6286857 + 780aafd commit d2f7a98
Show file tree
Hide file tree
Showing 135 changed files with 8,609 additions and 619 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/docker_build_latest
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Push Docker image

on:
pull_request:
types: [closed]
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v3.5.3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.9.1
with:
version: latest

- name: Login to DockerHub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4.1.1
with:
context: .
push: true
tags: hummingbot/gateway:latest
platforms: linux/amd64,linux/arm64
build-args: |
BRANCH=${{ github.ref }}
COMMIT=${{ github.sha }}
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
cache-from: type=registry,ref=hummingbot/gateway:latest
cache-to: type=inline

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
37 changes: 37 additions & 0 deletions .github/workflows/docker_build_tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and push Docker images on release

on:
release:
types: [published, edited]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.7.0

- name: Login to DockerHub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract tag name
id: get_tag
run: echo ::set-output name=VERSION::version-${GITHUB_REF#refs/tags/v}

- name: Build and push
uses: docker/build-push-action@v4.1.1
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: hummingbot/gateway:${{ steps.get_tag.outputs.VERSION }}
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'
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hummingbot-gateway",
"version": "1.18.0",
"version": "1.19.0",
"description": "Middleware that helps Hummingbot clients access standardized DEX API endpoints on different blockchain networks",
"main": "index.js",
"license": "Apache-2.0",
Expand Down Expand Up @@ -43,6 +43,9 @@
"@pangolindex/sdk": "^1.1.0",
"@perp/sdk-curie": "^1.16.0",
"@sushiswap/sdk": "^5.0.0-canary.116",
"@taquito/rpc": "^17.0.0",
"@taquito/signer": "^17.0.0",
"@taquito/taquito": "^17.0.0",
"@tinymanorg/tinyman-js-sdk": "^3.0.0",
"@traderjoe-xyz/sdk-v2": "^2.0.5",
"@types/fs-extra": "^9.0.13",
Expand Down
Loading

0 comments on commit d2f7a98

Please sign in to comment.