Skip to content

Commit d265022

Browse files
authored
Merge pull request #613 from hummingbot/staging
sync / Gateway staging -> main for Hummingbot version 2.13.0
2 parents 843ac10 + 758de21 commit d265022

53 files changed

Lines changed: 2054 additions & 462 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gateway",
3-
"version": "2.12.0",
3+
"version": "2.13.0",
44
"description": "Hummingbot Gateway is an API server that helps you interact with DEXs and blockchains.",
55
"main": "index.js",
66
"license": "Apache-2.0",
@@ -82,7 +82,7 @@
8282
"@uniswap/router-sdk": "^2.0.4",
8383
"@uniswap/sdk": "3.0.3",
8484
"@uniswap/sdk-core": "^5.9.0",
85-
"@uniswap/smart-order-router": "^4.22.38",
85+
"@uniswap/smart-order-router": "^4.31.10",
8686
"@uniswap/universal-router-sdk": "^4.19.6",
8787
"@uniswap/v2-sdk": "^4.15.2",
8888
"@uniswap/v3-core": "^1.0.1",

pnpm-lock.yaml

Lines changed: 47 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,16 @@ const configureGatewayServer = () => {
308308

309309
// Handle Fastify's native errors (includes rate limit errors with statusCode 429)
310310
if (error.statusCode && error.statusCode >= 400) {
311-
return reply.status(error.statusCode).send({
311+
const response: Record<string, unknown> = {
312312
statusCode: error.statusCode,
313313
error: error.name,
314314
message: error.message,
315-
});
315+
};
316+
// Include error code if present (for specific error types like TRANSACTION_TIMEOUT)
317+
if ('code' in error && error.code) {
318+
response.code = error.code;
319+
}
320+
return reply.status(error.statusCode).send(response);
316321
}
317322

318323
// Log and handle unexpected errors

src/chains/ethereum/ethereum.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface EthereumNetworkConfig {
1717

1818
export interface EthereumChainConfig {
1919
defaultNetwork: string;
20+
defaultNetworks?: string[];
2021
defaultWallet: string;
2122
rpcProvider: string;
2223
etherscanAPIKey?: string;
@@ -44,6 +45,7 @@ export function getEthereumNetworkConfig(network: string): EthereumNetworkConfig
4445
export function getEthereumChainConfig(): EthereumChainConfig {
4546
return {
4647
defaultNetwork: ConfigManagerV2.getInstance().get('ethereum.defaultNetwork'),
48+
defaultNetworks: ConfigManagerV2.getInstance().get('ethereum.defaultNetworks'),
4749
defaultWallet: ConfigManagerV2.getInstance().get('ethereum.defaultWallet'),
4850
rpcProvider: ConfigManagerV2.getInstance().get('ethereum.rpcProvider') || 'url',
4951
etherscanAPIKey: ConfigManagerV2.getInstance().get('apiKeys.etherscan'),

src/chains/ethereum/ethereum.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ export class Ethereum {
10801080

10811081
/**
10821082
* Get balances for all tokens in the token list
1083+
* Processes tokens sequentially to prevent RPC timeouts
10831084
*/
10841085
private async getAllTokenBalances(
10851086
address: string,
@@ -1090,26 +1091,24 @@ export class Ethereum {
10901091
const tokenList = await this.getTokenList();
10911092
logger.info(`Checking balances for all ${tokenList.length} tokens in the token list`);
10921093

1093-
await Promise.all(
1094-
tokenList.map(async (token) => {
1095-
try {
1096-
const contract = this.getContract(token.address, this.provider);
1097-
const balance = isHardware
1098-
? await this.getERC20BalanceByAddress(contract, address, token.decimals, 2000, token.symbol)
1099-
: await this.getERC20Balance(contract, wallet!, token.decimals, 2000, token.symbol);
1100-
1101-
const balanceNum = parseFloat(tokenValueToString(balance));
1102-
1103-
// Only add tokens with non-zero balances
1104-
if (balanceNum > 0) {
1105-
balances[token.symbol] = balanceNum;
1106-
logger.debug(`Found non-zero balance for ${token.symbol}: ${balanceNum}`);
1107-
}
1108-
} catch (err) {
1109-
logger.warn(`Error getting balance for ${token.symbol}: ${err.message}`);
1094+
for (const token of tokenList) {
1095+
try {
1096+
const contract = this.getContract(token.address, this.provider);
1097+
const balance = isHardware
1098+
? await this.getERC20BalanceByAddress(contract, address, token.decimals, 5000, token.symbol)
1099+
: await this.getERC20Balance(contract, wallet!, token.decimals, 5000, token.symbol);
1100+
1101+
const balanceNum = parseFloat(tokenValueToString(balance));
1102+
1103+
// Only add tokens with non-zero balances
1104+
if (balanceNum > 0) {
1105+
balances[token.symbol] = balanceNum;
1106+
logger.debug(`Found non-zero balance for ${token.symbol}: ${balanceNum}`);
11101107
}
1111-
}),
1112-
);
1108+
} catch (err) {
1109+
logger.warn(`Error getting balance for ${token.symbol}: ${err.message}`);
1110+
}
1111+
}
11131112
}
11141113

11151114
/**

0 commit comments

Comments
 (0)