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

Sync Gateway / Gateway staging -> master for Hummingbot version 1.23.0 #258

Merged
merged 89 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
bb9e7df
Updating .gitignore.
Danilo-Araujo-Silva Feb 17, 2023
df59dad
Add XRPL & XRPLDEX connector (v1)
mlguys Feb 17, 2023
8ed27ad
add unified clob swagger schema
mlguys Feb 27, 2023
f01cf29
Fix swagger missing field error for get orderbook
mlguys Mar 1, 2023
14d0e87
update yarn lock
mlguys Mar 24, 2023
b0a0bc1
wip
mlguys Jun 1, 2023
22b585c
WIP
mlguys Jun 4, 2023
a820ae3
WIP
mlguys Jun 6, 2023
f2a2bbc
Add order tracker logic wip
mlguys Jun 6, 2023
b1411d7
Finish connecter and add routes test
mlguys Jun 8, 2023
ad5704a
Remove old implementation and disable comments
mlguys Jun 8, 2023
8ba3776
Remove artifacts
mlguys Jun 8, 2023
3f49fba
Move order tracker to chain directory
mlguys Jun 8, 2023
b2b589e
add space
mlguys Jun 8, 2023
056e212
WIP
mlguys Jun 9, 2023
0af5945
Add basic e2e test scripts + fix bugs
mlguys Jun 26, 2023
6609840
Finish order posting and cancelling scenario test
mlguys Jun 27, 2023
1111b27
Finish fixing order tracking
mlguys Jun 30, 2023
4547c7e
merge development + fix test cases
mlguys Jul 14, 2023
d7844c8
Add tracking fills
mlguys Jul 26, 2023
edc2d9c
add orderhash to filldata
mlguys Jul 27, 2023
1737d24
fix balances chain endpoint for xrpl
mlguys Aug 1, 2023
32d96ea
update getTokens endpoint
mlguys Aug 1, 2023
7c81471
add get midprice for a market
mlguys Aug 2, 2023
a6f1a2b
fix getTokens
mlguys Aug 2, 2023
be86ef0
Fix bugs
mlguys Aug 8, 2023
8443ba3
fix getting order status & trading fees
mlguys Aug 10, 2023
d941a4e
Prepare PR WIP
mlguys Aug 11, 2023
7d48910
polish test cases
mlguys Aug 11, 2023
7e79813
fix getting order from db
mlguys Aug 15, 2023
67e6cb6
rebase latest changes
mlguys Aug 22, 2023
b08cf97
Remove network.routes.ts
mlguys Aug 22, 2023
e4d7778
Fix test errors on CI/CD
mlguys Aug 29, 2023
7b98601
fix client not disconect on close
mlguys Aug 29, 2023
2a8a778
fix tests
mlguys Aug 29, 2023
a05c732
Merge branch 'development' into feat/xrpl-connector-v2
mlguys Aug 29, 2023
0c74069
Merge branch 'development' into feat/xrpl-connector-v2
mlguys Aug 30, 2023
ceec75f
remove swagger doc changes
mlguys Sep 7, 2023
ba86d93
Merge branch 'development' into feat/xrpl-connector-v2
mlguys Sep 7, 2023
6280dff
Merge branch 'development' into feat/xrpl-connector-v2
mlguys Nov 10, 2023
a1a1ef5
fix UNKNOW state due to double offer cancel
mlguys Nov 10, 2023
8a2c1e2
Merge branch 'development' into feat/xrpl-connector-v2
mlguys Nov 10, 2023
b84f8d7
update test
mlguys Nov 11, 2023
6f6bd8f
update yarn
mlguys Nov 13, 2023
d35d850
Merge branch 'development' into feat/xrpl-connector-v2
mlguys Nov 14, 2023
dbf6839
Add pancake v3
vic-en Nov 26, 2023
90f51cd
fix/Update-gateway-dev-to-1.23.0
nikspz Nov 28, 2023
0c7ca7f
Update package.json
nikspz Nov 28, 2023
7f9363b
Merge pull request #242 from hummingbot/fix/Update-gateway-dev-to-1.23.0
nikspz Nov 28, 2023
8a58577
Update PancakeSwap contract addresses
vic-en Nov 30, 2023
6ded875
Update typescript version to 5.3.2
vic-en Nov 30, 2023
23607e0
Update UniswapLP Nft function parameter
vic-en Nov 30, 2023
2a16f04
update Jest type declaration
vic-en Nov 30, 2023
81576ca
Merge pull request #128 from yourtrading-ai/feat/xrpl-connector-v2
rapcmia Dec 1, 2023
247953e
(fix) remove local lookups for xdc ethers lib
fengtality Dec 1, 2023
3f21ec1
(update) Bump axios from 0.21.4 to 1.6.0
fengtality Dec 1, 2023
e9ac1e9
(fix) updates yarn.lock and bumps axios
fengtality Dec 1, 2023
4afa163
Merge pull request #246 from hummingbot/fix/fix-yarn
fengtality Dec 1, 2023
e9da133
Add 'pancakeswapLP' as a valid spender
vic-en Dec 2, 2023
15dea28
Update ttl value in pancakeswap.yml
vic-en Dec 2, 2023
d9e13ac
add unit tests
vic-en Dec 3, 2023
cadf835
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Dec 3, 2023
cf2b05b
update yarn lock
vic-en Dec 3, 2023
a1f8adf
revert changes to yarn lock
vic-en Dec 5, 2023
1bcf36c
update yarn lock
vic-en Dec 5, 2023
086faae
Update get account balances + fix SOLO hex symbol
mlguys Dec 10, 2023
2975b53
Update XRPL order book limit + improve connection
mlguys Dec 11, 2023
3994b51
update mainnet token list and market info
mlguys Dec 12, 2023
6bbec30
Merge pull request #247 from vic-en/feat/pancake_swap_v3
fengtality Dec 13, 2023
9aea964
Merge branch 'development' into feat/xrpl-fix-dec-11
rapcmia Dec 13, 2023
343eead
Merge pull request #249 from hummingbot/feat/xrpl-fix-dec-11
rapcmia Dec 14, 2023
85ea53e
fix jest
vic-en Dec 14, 2023
6bc7126
Merge pull request #250 from vic-en/fix/jest
fengtality Dec 16, 2023
9577734
Merge branch 'staging' into development
rapcmia Dec 18, 2023
55d2f84
Merge pull request #253 from hummingbot/development
nikspz Dec 18, 2023
03f95c9
fix-gateway-version
nikspz Dec 19, 2023
42b6908
Update app.ts
nikspz Dec 19, 2023
66bf142
Merge pull request #254 from hummingbot/fix-gateway-version
nikspz Dec 22, 2023
2ac30af
Update XRPL markets and tokens for testnet
mlguys Dec 26, 2023
9b96c14
change nodeURL for testnet
mlguys Dec 26, 2023
842933f
Fix XRPL getReserveInfo error handling
mlguys Dec 26, 2023
f277033
Update XRPL nodeURL and timeout values
mlguys Dec 26, 2023
a35a79e
Merge pull request #259 from hummingbot/fix/xrpl-token-list-not-updated
fengtality Dec 26, 2023
9b59c8b
(fix) move xrpl tests to test-bronze
fengtality Dec 26, 2023
3f04807
(fix) move routes test
fengtality Dec 26, 2023
6740efa
Merge pull request #260 from hummingbot/fix-move-xrpl-tests
fengtality Dec 26, 2023
7efa672
Merge branch 'staging' into development
nikspz Dec 26, 2023
f771fb7
Merge pull request #261 from hummingbot/development
nikspz Dec 26, 2023
6923d45
Merge branch 'main' into staging
nikspz Dec 26, 2023
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/dist
/db
/.idea
/*.iml
package-lock.json
/certs
/coverage
Expand All @@ -13,4 +14,7 @@ package-lock.json

# VSCode
.vscode/
.history
.history

# Yarn
yarn-error.log
2 changes: 1 addition & 1 deletion docs/swagger/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2103,4 +2103,4 @@ definitions:
example: 0.5
txHash:
type: 'string'
example: '0x...'
example: '0x...'
12 changes: 11 additions & 1 deletion docs/swagger/wallet-routes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ paths:
operationId: 'get'
produces:
- 'application/json'
parameters:
- in: 'body'
name: 'body'
required: true
schema:
$ref: '#/definitions/GetWalletRequest'
responses:
'200':
description: 'Wallet list'
Expand All @@ -27,7 +33,11 @@ paths:
required: true
schema:
$ref: '#/definitions/AddWalletRequest'
responses: '200'
responses:
'200':
description: 'Added wallet address'
schema:
$ref: '#/definitions/AddWalletResponse'

/wallet/remove:
delete:
Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hummingbot-gateway",
"version": "1.22.0",
"version": "1.23.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 @@ -37,6 +37,10 @@
"@harmony-js/utils": "^0.1.56",
"@improbable-eng/grpc-web": "^0.13.0",
"@pancakeswap/sdk": "^2.4.5",
"@pancakeswap/swap-sdk-core": "^1.0.0",
"@pancakeswap/v3-core": "^1.0.2",
"@pancakeswap/v3-periphery": "^1.0.2",
"@pancakeswap/v3-sdk": "^3.7.0",
"@pangolindex/sdk": "^1.1.0",
"@perp/sdk-curie": "^1.16.0",
"@sushiswap/sdk": "^5.0.0-canary.116",
Expand All @@ -60,7 +64,7 @@
"ajv": "^8.6.3",
"algosdk": "^2.2.0",
"app-root-path": "^3.0.0",
"axios": "^0.21.1",
"axios": "^1.6.0",
"big.js": "6.1.1",
"bn.js": "^5.2.1",
"body-parser": "^1.19.0",
Expand Down Expand Up @@ -94,6 +98,7 @@
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.5",
"xsswap-sdk": "^1.0.1",
"xrpl": "^2.7.0",
"yarn": "^1.22.17"
},
"devDependencies": {
Expand All @@ -107,7 +112,7 @@
"@types/bs58": "^4.0.1",
"@types/express": "^4.17.12",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^27.4.1",
"@types/jest": "^29.5.11",
"@types/js-yaml": "^4.0.2",
"@types/level": "^6.0.0",
"@types/lodash": "^4.14.178",
Expand All @@ -134,7 +139,7 @@
"eslint-plugin-standard": "^4.0.1",
"google-protobuf": "^3.2.0",
"hardhat": "^2.13.0",
"jest": "^27.3.1",
"jest": "^29.7.0",
"jest-extended": "^0.11.5",
"jsbi": "^3.2.0",
"mock-ethers-provider": "^1.0.2",
Expand All @@ -145,9 +150,9 @@
"react-dom": "^18",
"rimraf": "^3.0.2",
"supertest": "^6.1.6",
"ts-jest": "^27.0.5",
"ts-jest": "^29.1.1",
"ts-node": "^10.0.0",
"typescript": "^4.3.2",
"typescript": "^5.3.2",
"viem": "^0.3.x"
},
"resolutions": {
Expand Down
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ export const startSwagger = async () => {

export const startGateway = async () => {
const port = ConfigManagerV2.getInstance().get('server.port');
const gateway_version="1.22.0"; // gateway version
const gateway_version="1.23.0"; // gateway version
if (!ConfigManagerV2.getInstance().get('server.id')) {
ConfigManagerV2.getInstance().set(
'server.id',
Math.random().toString(16).substr(2, 14)
);
}
logger.info(`Gateway Version: ${gateway_version}`) // display gateway version
logger.info(`Gateway Version: ${gateway_version}`); // display gateway version
logger.info(`⚡️ Starting Gateway API on port ${port}...`);
if (ConfigManagerV2.getInstance().get('server.unsafeDevModeWithHTTP')) {
logger.info('Running in UNSAFE HTTP! This could expose private keys.');
Expand Down
4 changes: 4 additions & 0 deletions src/chains/binance-smart-chain/binance-smart-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ export class BinanceSmartChain extends EthereumBase implements Ethereumish {
let spender: string;
if (reqSpender === 'pancakeswap') {
spender = PancakeSwapConfig.config.routerAddress(this._chain);
} else if (reqSpender === 'pancakeswapLP') {
spender = PancakeSwapConfig.config.pancakeswapV3NftManagerAddress(
this._chain
);
} else if (reqSpender === 'sushiswap') {
spender = SushiswapConfig.config.sushiswapRouterAddress(
'binance-smart-chain',
Expand Down
1 change: 1 addition & 0 deletions src/chains/ethereum/ethereum.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export const validateSpender: Validator = mkValidator(
val === 'mad_meerkat' ||
val === 'vvs' ||
val === 'pancakeswap' ||
val === 'pancakeswapLP' ||
val === 'xsswap' ||
val === 'curve' ||
isAddress(val))
Expand Down
24 changes: 24 additions & 0 deletions src/chains/xrpl/xrpl-middlewares.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { HttpException } from '../../services/error-handler';
import { XRPL } from './xrpl';
import { NextFunction, Request, Response } from 'express';

export const verifyXRPLIsAvailable = async (
req: Request,
_res: Response,
next: NextFunction
) => {
if (!req || !req.body || !req.body.network) {
throw new HttpException(404, 'No XRPL network informed.');
}

const xrpl = await XRPL.getInstance(req.body.network);
if (!xrpl.ready) {
await xrpl.init();
}

if (!xrpl.isConnected()) {
await xrpl.client.connect();
}

return next();
};
62 changes: 62 additions & 0 deletions src/chains/xrpl/xrpl.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { ConfigManagerV2 } from '../../services/config-manager-v2';

export interface NetworkConfig {
name: string;
nodeUrl: string; // example: wss://xrplcluster.com/
tokenListType: string; // default: FILE
tokenListSource: string; // default: src/chains/xrpl/xrpl_tokens.json
marketListType: string; // default: FILE
marketListSource: string; // default: src/chains/xrpl/xrpl_markets.json
nativeCurrencySymbol: string; // XRP
maxLRUCacheInstances: number;
}

export interface Config {
// "mainnet" | "testnet" | "devnet"
network: NetworkConfig;
requestTimeout: number; // default: 20
connectionTimeout: number; // default: 5
feeCushion: number; // default: 1.2
maxFeeXRP: string; // default: 2
orderDbPath: string;
}

// @todo: find out which configs are required
export function getXRPLConfig(chainName: string, networkName: string): Config {
const configManager = ConfigManagerV2.getInstance();
return {
network: {
name: networkName,
nodeUrl: configManager.get(
chainName + '.networks.' + networkName + '.nodeURL'
),
tokenListType: ConfigManagerV2.getInstance().get(
chainName + '.networks.' + networkName + '.tokenListType'
),
tokenListSource: ConfigManagerV2.getInstance().get(
chainName + '.networks.' + networkName + '.tokenListSource'
),
marketListType: ConfigManagerV2.getInstance().get(
chainName + '.networks.' + networkName + '.marketListType'
),
marketListSource: ConfigManagerV2.getInstance().get(
chainName + '.networks.' + networkName + '.marketListSource'
),
nativeCurrencySymbol: ConfigManagerV2.getInstance().get(
chainName + '.networks.' + networkName + '.nativeCurrencySymbol'
),
maxLRUCacheInstances: ConfigManagerV2.getInstance().get(
chainName + '.maxLRUCacheInstances'
),
},
requestTimeout: ConfigManagerV2.getInstance().get(
chainName + '.requestTimeout'
),
connectionTimeout: ConfigManagerV2.getInstance().get(
chainName + '.connectionTimeout'
),
feeCushion: ConfigManagerV2.getInstance().get(chainName + '.feeCushion'),
maxFeeXRP: ConfigManagerV2.getInstance().get(chainName + '.maxFeeXRP'),
orderDbPath: ConfigManagerV2.getInstance().get(chainName + '.orderDbPath'),
};
}
26 changes: 26 additions & 0 deletions src/chains/xrpl/xrpl.constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ConfigManagerV2 } from '../../services/config-manager-v2';

const configManager = ConfigManagerV2.getInstance();

export const constants = {
retry: {
all: {
maxNumberOfRetries:
configManager.get('xrpl.retry.all.maxNumberOfRetries') || 0, // 0 means no retries
delayBetweenRetries:
configManager.get('xrpl.retry.all.delayBetweenRetries') || 0, // 0 means no delay (milliseconds)
},
},
timeout: {
all: configManager.get('xrpl.timeout.all') || 0, // 0 means no timeout (milliseconds)
},
parallel: {
all: {
batchSize: configManager.get('xrpl.parallel.all.batchSize') || 0, // 0 means no batching (group all)
delayBetweenBatches:
configManager.get('xrpl.parallel.all.delayBetweenBatches') || 0, // 0 means no delay (milliseconds)
},
},
};

export default constants;
Loading
Loading