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

gateway sync / gateway development -> staging 1.22.0 #235

Merged
merged 37 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2d60994
initial commit
vic-en Aug 15, 2023
0c01d15
curve update
vic-en Aug 21, 2023
6206384
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Aug 21, 2023
7c28b04
update
vic-en Aug 23, 2023
417d3b3
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Aug 23, 2023
fa30d4d
fix linter issue
vic-en Aug 23, 2023
2e167f3
Merge branch 'development' into feat/curve_connector
vic-en Aug 27, 2023
656cb54
Merge branch 'development' into feat/curve_connector
rapcmia Sep 1, 2023
fba9b48
Merge branch 'development' into feat/curve_connector
rapcmia Sep 6, 2023
a2ef031
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Sep 11, 2023
2992c48
update package
vic-en Oct 3, 2023
e04dc4d
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Oct 3, 2023
76057eb
Merge branch 'development' of https://github.com/hummingbot/gateway i…
vic-en Oct 3, 2023
bbf0ff4
Merge branch 'feat/curve_connector' of https://github.com/vic-en/gate…
vic-en Oct 3, 2023
64e09d2
update curve import
vic-en Oct 3, 2023
ad894a3
update curve
vic-en Oct 16, 2023
396ba80
cleanup
vic-en Oct 16, 2023
60e95a7
Merge branch 'development' into feat/curve_connector
vic-en Oct 16, 2023
41ef17b
rename arbitrum_one to arbitrum
vic-en Oct 16, 2023
382b551
Throw error when no best pool found
vic-en Oct 18, 2023
886b768
(fix) resolved yarn.lock
fengtality Oct 21, 2023
cfaeefc
(feat) move ctezAdmin config to tezos scope
OjusWiZard Sep 20, 2023
ded3689
(fix) update tezos mainnet rpc url
OjusWiZard Sep 22, 2023
95f074f
(fix) plenty bugs
OjusWiZard Oct 12, 2023
cadb657
fix/update-to-dev-1.22.0
nikspz Nov 1, 2023
743ee42
Update app.ts
nikspz Nov 1, 2023
aef0610
Merge pull request #226 from hummingbot/update-to-dev-1.22.0
rapcmia Nov 2, 2023
c4bc84a
Merge branch 'development' into fix/plenty
rapcmia Nov 6, 2023
9efb8a2
resolved conflits
fengtality Nov 7, 2023
1a653e8
Merge pull request #215 from hummingbot/vic-en-feat/curve_connector
fengtality Nov 7, 2023
58bbb6a
(fix) remove injective chain and exchange connectors
fengtality Nov 9, 2023
ed3b1cb
Merge pull request #230 from hummingbot/fix/remove-injective
nikspz Nov 10, 2023
a392635
Merge branch 'development' into fix/plenty
nikspz Nov 10, 2023
15d7dc8
Updating Tendermint class references, improving test coverage and upd…
darley-silva-funttastic Nov 13, 2023
be4f240
Merge pull request #223 from OjusWiZard/fix/plenty
nikspz Nov 13, 2023
5b8c2e7
Merge pull request #218 from Team-Kujira/fix/kujira/tendermint-changes
nikspz Nov 13, 2023
a847ae2
Merge branch 'staging' into development
rapcmia Nov 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
56 changes: 28 additions & 28 deletions docs/swagger/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1445,13 +1445,13 @@ definitions:
example: 'AAVE-USDT'
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'

ClobMarketResponse:
type: 'object'
Expand Down Expand Up @@ -1483,16 +1483,16 @@ definitions:
properties:
market:
type: 'string'
example: 'AAVE-USDT'
example: 'AVAX-USDC'
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'

ClobTickerResponse:
type: 'object'
Expand Down Expand Up @@ -1525,16 +1525,16 @@ definitions:
properties:
market:
type: 'string'
example: 'AAVE-USDT'
example: 'AVAX-USDC'
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
isDerivative:
type: 'boolean'
example: false
Expand Down Expand Up @@ -1571,19 +1571,19 @@ definitions:
properties:
market:
type: 'string'
example: 'AAVE-USDT'
example: 'AVAX-USDC'
orderId:
type: 'string'
example: 'Buy-21342453'
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
address:
type: 'string'
example: '0x...'
Expand Down Expand Up @@ -1624,16 +1624,16 @@ definitions:
properties:
market:
type: 'string'
example: 'AAVE-USDT'
example: 'AVAX-USDC'
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
address:
type: 'string'
example: '0x...'
Expand Down Expand Up @@ -1683,16 +1683,16 @@ definitions:
properties:
market:
type: 'string'
example: 'AAVE-USDT'
example: 'AVAX-USDT'
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
address:
type: 'string'
example: '0x...'
Expand Down Expand Up @@ -1734,7 +1734,7 @@ definitions:
example: '0xa508cb32923323679f29a032c70342c147c17d0145625922b0ef22e955c844c0'
chain:
type: 'string'
example: 'injective'
example: 'ethereum'
network:
type: 'string'
example: 'mainnet'
Expand Down Expand Up @@ -1786,7 +1786,7 @@ definitions:
example: '0xa508cb32923323679f29a032c70342c147c17d0145625922b0ef22e955c844c0'
chain:
type: 'string'
example: 'injective'
example: 'ethereum'
network:
type: 'string'
example: 'mainnet'
Expand Down Expand Up @@ -1877,7 +1877,7 @@ definitions:
properties:
chain:
type: 'string'
example: 'injective'
example: 'dexalot'
network:
type: 'string'
example: 'mainnet'
Expand Down Expand Up @@ -1912,13 +1912,13 @@ definitions:
example: 'Buy-21342453'
chain:
type: 'string'
example: 'injective'
example: 'ethereum'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
address:
type: 'string'
example: '0x...'
Expand All @@ -1940,13 +1940,13 @@ definitions:
example: 'Buy-21342453'
chain:
type: 'string'
example: 'injective'
example: 'ethereum'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
address:
type: 'string'
example: '0x...'
Expand Down Expand Up @@ -1985,13 +1985,13 @@ definitions:
example: 'INJ-USDT'
chain:
type: 'string'
example: 'injective'
example: 'ethereum'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'

PerpClobFundingInfoResponse:
type: 'object'
Expand Down Expand Up @@ -2051,13 +2051,13 @@ definitions:
properties:
chain:
type: 'string'
example: 'injective'
example: 'ethereum'
network:
type: 'string'
example: 'mainnet'
connector:
type: 'string'
example: 'injective'
example: 'dexalot'
address:
type: 'string'
example: '0x...'
Expand Down
2 changes: 0 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ module.exports = {
'src/chains/avalanche/avalanche.ts',
'src/chains/avalanche/pangolin/pangolin.ts',
'src/chains/cosmos/cosmos.ts',
'src/chains/injective/injective.ts',
'src/chains/near/near.ts',
'src/chains/near/near.base.ts',
'src/connectors/uniswap/uniswap.config.ts',
'src/connectors/uniswap/uniswap.ts',
'src/connectors/uniswap/uniswap.lp.helper.ts',
'src/connectors/openocean/openocean.ts',
'src/connectors/pangolin/pangolin.ts',
'src/chains/injective/injective.mappers.ts',
'src/connectors/quickswap/quickswap.ts',
'src/connectors/sushiswap/sushiswap.ts',
'src/connectors/traderjoe/traderjoe.ts',
Expand Down
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hummingbot-gateway",
"version": "1.21.0",
"version": "dev-1.22.0",
"description": "Middleware that helps Hummingbot clients access standardized DEX API endpoints on different blockchain networks",
"main": "index.js",
"license": "Apache-2.0",
Expand All @@ -23,22 +23,19 @@
"test:scripts": "jest -i --verbose ./test-scripts/*.test.ts"
},
"dependencies": {
"@cosmjs/proto-signing": "^0.30.1",
"@cosmjs/stargate": "^0.30.1",
"@cosmjs/proto-signing": "^0.31.1",
"@cosmjs/stargate": "^0.31.1",
"@crocswap/sdk": "^2.4.5",
"@ethersproject/abstract-provider": "5.7.0",
"@ethersproject/address": "5.7.0",
"@ethersproject/contracts": "5.7.0",
"@ethersproject/networks": "5.7.0",
"@ethersproject/providers": "5.7.0",
"@ethersproject/solidity": "5.7.0",
"@injectivelabs/sdk-ts": "^1.10.58",
"@harmony-js/core": "^0.1.57",
"@harmony-js/utils": "^0.1.56",
"@improbable-eng/grpc-web": "^0.13.0",
"@injectivelabs/networks": "^1.10.8",
"@injectivelabs/sdk-ts": "^1.10.58",
"@injectivelabs/ts-types": "^1.0.29",
"@injectivelabs/wallet-ts": "^1.10.63",
"@pancakeswap/sdk": "^2.4.5",
"@pangolindex/sdk": "^1.1.0",
"@perp/sdk-curie": "^1.16.0",
Expand Down Expand Up @@ -79,7 +76,7 @@
"http-status-codes": "2.2.0",
"immutable": "^4.2.4",
"js-yaml": "^4.1.0",
"kujira.js": "^0.8.145",
"kujira.js": "0.9.6",
"level": "^8.0.0",
"lodash": "^4.17.21",
"lru-cache": "^7.14.1",
Expand Down
53 changes: 31 additions & 22 deletions src/amm/amm.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ import {
trade as plentyTrade,
estimateGas as plentyEstimateGas,
} from '../connectors/plenty/plenty.controllers';
import { getInitializedChain, getConnector } from '../services/connection-manager';
import {
getInitializedChain,
getConnector,
} from '../services/connection-manager';
import {
Chain as Ethereumish,
Nearish,
Expand All @@ -74,13 +77,15 @@ import { Tinyman } from '../connectors/tinyman/tinyman';
import { Plenty } from '../connectors/plenty/plenty';

export async function price(req: PriceRequest): Promise<PriceResponse> {
const chain = await getInitializedChain<Algorand | Ethereumish | Nearish | Tezosish>(
req.chain,
req.network
);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty = await getConnector<
Uniswapish | RefAMMish | Tinyman | Plenty
>(req.chain, req.network, req.connector);
const chain = await getInitializedChain<
Algorand | Ethereumish | Nearish | Tezosish
>(req.chain, req.network);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty =
await getConnector<Uniswapish | RefAMMish | Tinyman | Plenty>(
req.chain,
req.network,
req.connector
);

if (connector instanceof Plenty) {
return plentyPrice(<Tezosish>chain, connector, req);
Expand All @@ -95,13 +100,15 @@ export async function price(req: PriceRequest): Promise<PriceResponse> {
}

export async function trade(req: TradeRequest): Promise<TradeResponse> {
const chain = await getInitializedChain<Algorand | Ethereumish | Nearish | Tezosish>(
req.chain,
req.network
);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty = await getConnector<
Uniswapish | RefAMMish | Tinyman | Plenty
>(req.chain, req.network, req.connector);
const chain = await getInitializedChain<
Algorand | Ethereumish | Nearish | Tezosish
>(req.chain, req.network);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty =
await getConnector<Uniswapish | RefAMMish | Tinyman | Plenty>(
req.chain,
req.network,
req.connector
);

if (connector instanceof Plenty) {
return plentyTrade(<Tezosish>chain, connector, req);
Expand Down Expand Up @@ -180,13 +187,15 @@ export async function poolPrice(
export async function estimateGas(
req: NetworkSelectionRequest
): Promise<EstimateGasResponse> {
const chain = await getInitializedChain<Algorand | Ethereumish | Nearish | Tezosish>(
req.chain,
req.network
);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty = await getConnector<
Uniswapish | RefAMMish | Plenty
>(req.chain, req.network, req.connector);
const chain = await getInitializedChain<
Algorand | Ethereumish | Nearish | Tezosish
>(req.chain, req.network);
const connector: Uniswapish | RefAMMish | Tinyman | Plenty =
await getConnector<Uniswapish | RefAMMish | Plenty>(
req.chain,
req.network,
req.connector
);

if (connector instanceof Plenty) {
return plentyEstimateGas(<Tezosish>chain, connector);
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const startSwagger = async () => {

export const startGateway = async () => {
const port = ConfigManagerV2.getInstance().get('server.port');
const gateway_version="1.21.0"; // gateway version
const gateway_version="dev-1.22.0"; // gateway version
if (!ConfigManagerV2.getInstance().get('server.id')) {
ConfigManagerV2.getInstance().set(
'server.id',
Expand Down
9 changes: 8 additions & 1 deletion src/chains/algorand/algorand.validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ import {
invalidAddressError,
validateNetwork,
} from '../ethereum/ethereum.validators';
import { validateTxHash } from '../injective/injective.validators';
import { invalidChainError } from '../near/near.validators';

const invalidTxHashError: string = 'The txHash param must be a string.';

const validateTxHash: Validator = mkValidator(
'txHash',
invalidTxHashError,
(val) => typeof val === 'string'
);

const validateAlgorandChain: Validator = mkValidator(
'chain',
invalidChainError,
Expand Down
8 changes: 8 additions & 0 deletions src/chains/avalanche/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Ethereumish } from '../../services/common-interfaces';
import { SushiswapConfig } from '../../connectors/sushiswap/sushiswap.config';
import { ConfigManagerV2 } from '../../services/config-manager-v2';
import { EVMController } from '../ethereum/evm.controllers';
import { Curve } from '../../connectors/curve/curve';

export class Avalanche extends EthereumBase implements Ethereumish {
private static _instances: { [name: string]: Avalanche };
Expand Down Expand Up @@ -93,6 +94,13 @@ export class Avalanche extends EthereumBase implements Ethereumish {
'avalanche',
this._chain
);
} else if (reqSpender === 'curve') {
const curve = Curve.getInstance('ethereum', this._chain);
if (!curve.ready()) {
curve.init();
throw Error('Curve not ready');
}
spender = curve.router;
} else {
spender = reqSpender;
}
Expand Down