Skip to content

Commit

Permalink
Merge pull request #6027 from hummingbot/staging
Browse files Browse the repository at this point in the history
sync / staging -> master for Hummingbot version 1.12.0
  • Loading branch information
fengtality committed Jan 25, 2023
2 parents 23a9a90 + bfa5074 commit 7a85847
Show file tree
Hide file tree
Showing 319 changed files with 7,577 additions and 31,264 deletions.
5 changes: 0 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,12 @@ omit =
hummingbot/connector/connector/uniswap_v3*
hummingbot/connector/derivative/perpetual_finance*
hummingbot/connector/derivative/position.py
hummingbot/connector/exchange/beaxy*
hummingbot/connector/exchange/bitfinex*
hummingbot/connector/exchange/coinbase_pro*
hummingbot/connector/exchange/digifinex*
hummingbot/connector/exchange/hitbtc*
hummingbot/connector/exchange/k2*
hummingbot/connector/exchange/liquid*
hummingbot/connector/exchange/loopring*
hummingbot/connector/exchange/paper_trade*
hummingbot/connector/exchange/probit*
hummingbot/connector/exchange/wazirx*
hummingbot/connector/gateway*
hummingbot/core/utils/gateway_config_utils.py
hummingbot/core/utils/kill_switch.py
Expand Down
11 changes: 0 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ RUN curl https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-x86_64
# Dropping default ~/.bashrc because it will return if not running as interactive shell, thus not invoking PATH settings
RUN :> ~/.bashrc

# Install nvm and CeloCLI; note: nvm adds own section to ~/.bashrc
SHELL [ "/bin/bash", "-lc" ]
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash && \
export NVM_DIR="/home/hummingbot/.nvm" && \
source "/home/hummingbot/.nvm/nvm.sh" && \
nvm install 10 && \
npm install --only=production -g @celo/celocli@1.0.3 && \
nvm cache clear && \
npm cache clean --force && \
rm -rf /home/hummingbot/.cache

# Copy environment only to optimize build caching, so changes in sources will not cause conda env invalidation
COPY --chown=hummingbot:hummingbot setup/environment-linux.yml setup/

Expand Down
11 changes: 0 additions & 11 deletions Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ RUN curl https://repo.anaconda.com/miniconda/Miniconda3-py38_4.10.3-Linux-aarch6
# Dropping default ~/.bashrc because it will return if not running as interactive shell, thus not invoking PATH settings
RUN :> ~/.bashrc

# Install nvm and CeloCLI; note: nvm adds own section to ~/.bashrc
SHELL [ "/bin/bash", "-lc" ]
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash && \
export NVM_DIR="/home/hummingbot/.nvm" && \
source "/home/hummingbot/.nvm/nvm.sh" && \
nvm install 10 && \
npm install --only=production -g @celo/celocli@1.0.3 && \
nvm cache clear && \
npm cache clean --force && \
rm -rf /home/hummingbot/.cache

# Copy environment only to optimize build caching, so changes in sources will not cause conda env invalidation
COPY --chown=hummingbot:hummingbot setup/environment-linux-aarch64.yml setup/

Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
.PHONY: run_coverage
.PHONY: report_coverage
.PHONY: development-diff-cover
.PHONY: docker
.PHONY: install
.PHONY: uninstall
.PHONY: clean
.PHONY: build

test:
coverage run -m nose --exclude-dir="test/connector" --exclude-dir="test/debug" --exclude-dir="test/mock" --exclude-dir="test/hummingbot/connector/gateway"
Expand All @@ -18,3 +23,18 @@ report_coverage:
development-diff-cover:
coverage xml
diff-cover --compare-branch=origin/development coverage.xml

docker:
git clean -xdf && make clean && docker build -t hummingbot/hummingbot${TAG} -f Dockerfile .

clean:
./clean

install:
./install

uninstall:
./uninstall

build:
./compile
160 changes: 67 additions & 93 deletions README.md

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@
test_web3_provider_list = [os.getenv("WEB3_PROVIDER")]
# Latoken Tests
latoken_api_key = os.getenv("LATOKEN_API_KEY")
latoken_secret_key = os.getenv("LATOKEN_SECRET_KEY")
# Liquid Tests
liquid_api_key = os.getenv("LIQUID_API_KEY")
liquid_secret_key = os.getenv("LIQUID_SECRET_KEY")
# Kraken Tests
kraken_api_key = os.getenv("KRAKEN_API_KEY")
kraken_secret_key = os.getenv("KRAKEN_SECRET_KEY")
Expand All @@ -99,10 +91,6 @@
bitmart_secret_key = os.getenv("BITMART_SECRET_KEY")
bitmart_memo = os.getenv("BITMART_MEMO")
# BTC Markets Test
btc_markets_api_key = os.getenv("BTC_MARKETS_API_KEY")
btc_markets_secret_key = os.getenv("BTC_MARKETS_SECRET_KEY")
# CryptoCom Test
crypto_com_api_key = os.getenv("CRYPTO_COM_API_KEY")
crypto_com_secret_key = os.getenv("CRYPTO_COM_SECRET_KEY")
Expand All @@ -115,15 +103,6 @@
gate_io_api_key = os.getenv("GATE_IO_API_KEY")
gate_io_secret_key = os.getenv("GATE_IO_SECRET_KEY")
# CoinZoom Test
coinzoom_api_key = os.getenv("COINZOOM_API_KEY")
coinzoom_secret_key = os.getenv("COINZOOM_SECRET_KEY")
coinzoom_username = os.getenv("COINZOOM_USERNAME")
# Wazirx Test
wazirx_api_key = os.getenv("WAZIRX_API_KEY")
wazirx_secret_key = os.getenv("WAZIRX_SECRET_KEY")
# AltMarkets.io Test
altmarkets_api_key = os.getenv("ALTMARKETS_API_KEY")
altmarkets_secret_key = os.getenv("ALTMARKETS_SECRET_KEY")
Expand Down
57 changes: 57 additions & 0 deletions gateway/docs/swagger/cosmos-routes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
paths:
/cosmos:
get:
tags:
- 'cosmos'
summary: 'View the Cosmos network and RPC URL that gateway is configured to use'
description: 'The user can change this by editing src/chains/cosmos/cosmos.config.ts'
operationId: 'root'
produces:
- 'application/json'
responses:
'200':
description: 'Cosmos config'
schema:
$ref: '#/definitions/CosmosConfigResponse'

/cosmos/balances:
post:
tags:
- 'cosmos'
summary: 'Get the balances of a Cosmos wallet'
operationId: 'balances'
consumes:
- 'application/json'
produces:
- 'application/json'
parameters:
- in: 'body'
name: 'body'
required: true
schema:
$ref: '#/definitions/CosmosBalanceRequest'
responses:
'200':
schema:
$ref: '#/definitions/BalancesResponse'

/cosmos/poll:
post:
tags:
- 'cosmos'
summary: 'Poll the status of a Cosmos transaction'
operationId: 'poll'
consumes:
- 'application/json'
produces:
- 'application/json'
parameters:
- in: 'body'
name: 'body'
required: true
schema:
$ref: '#/definitions/CosmosPollRequest'
responses:
'200':
schema:
$ref: '#/definitions/CosmosPollResponse'
80 changes: 80 additions & 0 deletions gateway/docs/swagger/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,86 @@ definitions:
txData:
$ref: '#/definitions/SolanaTransaction'

CosmosConfigResponse:
type: 'object'
required:
- 'network'
- 'rpcUrl'
- 'connection'
- 'timestamp'
properties:
network:
type: 'string'
example: 'mainnet'
rpcUrl:
type: 'string'
example: 'https://rpc.cosmos.network/'
connection:
type: 'boolean'
example: true
timestamp:
type: 'integer'
example: 1641889489132

CosmosBalanceRequest:
type: 'object'
required:
- 'address'
- 'tokenSymbols'
properties:
address:
type: 'string'
example: 'cosmos1pc8m5m7n0z8xe7sx2tawkvc0v6qkjql83js0dr'
tokenSymbols:
type: 'array'
items: 'string'
example: ['ATOM', 'NETA']

CosmosPollRequest:
type: 'object'
required:
- 'txHash'
properties:
txHash:
type: 'string'
example: 'E0E02A6C27A75F4442B0746676BDAF5F66AFF1E71928C54624A35B48D5A4B3AF'

CosmosPollResponse:
type: 'object'
required:
- 'network'
- 'timestamp'
- 'txHash'
- 'currentBlock'
- 'txBlock'
- 'gasUsed'
- 'gasWanted'
- 'txData'
properties:
network:
type: 'string'
example: 'mainnet'
timestamp:
type: 'integer'
example: 1636368085740
currentBlock:
type: 'integer'
example: 112646487
txHash:
type: 'string'
example: 'oaMWkrYr1g9JBcDUPRqz21cJBxowM4CEbDy2FsCgNK569CjZSr4wa51d4k9DpTRJU8GUHfp3e9YX2pGXaBS5Tta'
txBlock:
type: 'number'
example: 11581899
gasUsed:
type: 'number'
example: 89054
gasWanted:
type: 'number'
example: 130000
txData:
$ref: '#/definitions/CosmosTransaction'

TokensResponse:
type: 'object'
required:
Expand Down
2 changes: 2 additions & 0 deletions gateway/docs/swagger/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ tags:
description: 'Interact with the Solana blockchain'
- name: 'serum'
description: 'Interact with Serum to operate on Solana blockchain'
- name: 'cosmos'
description: 'Interact with the Cosmos blockchain'
- name: 'near'
description: 'Interact with the Near blockchain'

Expand Down
4 changes: 4 additions & 0 deletions gateway/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ module.exports = {
'src/app.ts',
'src/https.ts',
'src/paths.ts',
'src/services/ethereum-base.ts',
'src/services/cosmos-base.ts',
'src/services/telemetry-transport.ts',
'src/chains/cronos/cronos.ts',
'src/chains/binance-smart-chain/binance-smart-chain.ts',
'src/chains/ethereum/ethereum.ts',
'src/chains/avalanche/avalanche.ts',
'src/chains/avalanche/pangolin/pangolin.ts',
'src/chains/solana/solana.ts',
'src/chains/cosmos/cosmos.ts',
'src/chains/near/near.ts',
'src/chains/near/near.base.ts',
'src/connectors/uniswap/uniswap.config.ts',
Expand Down
3 changes: 3 additions & 0 deletions gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
},
"dependencies": {
"@blockworks-foundation/mango-client": "^3.2.14",
"@cosmjs/proto-signing": "^0.28.10",
"@cosmjs/stargate": "^0.28.13",
"@crocswap/sdk": "^2.4.5",
"@ethersproject/experimental": "^5.3.0",
"@harmony-js/core": "^0.1.57",
Expand Down Expand Up @@ -59,6 +61,7 @@
"axios": "^0.21.1",
"bn.js": "^5.2.1",
"body-parser": "^1.19.0",
"chain-registry": "^0.0.26",
"bs58": "^5.0.0",
"chalk": "^4.1.0",
"coinalpha-ref-sdk": "1.1.0",
Expand Down
3 changes: 3 additions & 0 deletions gateway/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import express from 'express';
import { Request, Response, NextFunction } from 'express';
import { ConfigRoutes } from './services/config/config.routes';
import { SolanaRoutes } from './chains/solana/solana.routes';
import { CosmosRoutes } from './chains/cosmos/cosmos.routes';
import { WalletRoutes } from './services/wallet/wallet.routes';
import { logger } from './services/logger';
import { addHttps } from './https';
Expand Down Expand Up @@ -70,6 +71,7 @@ gatewayApp.use('/clob', ClobRoutes.router);
gatewayApp.use('/wallet', WalletRoutes.router);
gatewayApp.use('/solana', SolanaRoutes.router);
gatewayApp.use('/serum', SerumRoutes.router);
gatewayApp.use('/cosmos', CosmosRoutes.router);
gatewayApp.use('/near', NearRoutes.router);

// a simple route to test that the server is running
Expand Down Expand Up @@ -139,6 +141,7 @@ export const swaggerDocument = SwaggerManager.generateSwaggerJson(
'./docs/swagger/near-routes.yml',
'./docs/swagger/clob-routes.yml',
'./docs/swagger/serum-routes.yml',
'./docs/swagger/cosmos-routes.yml',
]
);

Expand Down
8 changes: 8 additions & 0 deletions gateway/src/chains/avalanche/avanlanche_tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,14 @@
"symbol": "WBTC.e",
"logoURI": "https://raw.githubusercontent.com/pangolindex/tokens/main/assets/43114/0x50b7545627a5162F82A992c33b87aDc75187B218/logo_24.png"
},
{
"chainId": 43114,
"address": "0x152b9d0FdC40C096757F570A51E494bd4b943E50",
"decimals": 8,
"name": "Bitcoin",
"symbol": "BTC.b",
"logoURI": "https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0x152b9d0FdC40C096757F570A51E494bd4b943E50/logo.png"
},
{
"chainId": 43114,
"address": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
Expand Down
15 changes: 15 additions & 0 deletions gateway/src/chains/cosmos/cosmos-middlewares.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Cosmos } from './cosmos';
import { NextFunction, Request, Response } from 'express';
import { CosmosConfig } from './cosmos.config';

export const verifyCosmosIsAvailable = async (
_req: Request,
_res: Response,
next: NextFunction
) => {
const cosmos = Cosmos.getInstance(CosmosConfig.config.network.name);
if (!cosmos.ready()) {
await cosmos.init();
}
return next();
};
Loading

0 comments on commit 7a85847

Please sign in to comment.