mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
The best_venue_buy() and best_venue_sell() methods used Decimal::from_double(1e18) as a sentinel value, which caused integer overflow (1e18 * 1e8 scale = 1e26 exceeds int64_t max ~9.2e18). This resulted in undefined behavior during price comparisons. Changed to use std::optional<Decimal> for safe sentinel-free comparisons.
40 lines
929 B
TypeScript
40 lines
929 B
TypeScript
/**
|
|
* Hummingbot Gateway Plugin for LX
|
|
*
|
|
* This plugin registers the LX connector with Hummingbot Gateway.
|
|
*/
|
|
|
|
import { FastifyInstance, FastifyPluginOptions } from 'fastify';
|
|
import { lxdexRoutes } from '@lxdex/hummingbot-gateway-connector';
|
|
|
|
export interface LXDexPluginOptions extends FastifyPluginOptions {
|
|
/** Custom prefix for routes (default: none) */
|
|
prefix?: string;
|
|
}
|
|
|
|
/**
|
|
* Register the LX plugin with Hummingbot Gateway
|
|
*/
|
|
export async function lxdexPlugin(
|
|
fastify: FastifyInstance,
|
|
options: LXDexPluginOptions
|
|
): Promise<void> {
|
|
// Register the LX routes
|
|
await fastify.register(lxdexRoutes, {
|
|
prefix: options.prefix,
|
|
});
|
|
|
|
fastify.log.info('LX plugin registered successfully');
|
|
}
|
|
|
|
export default lxdexPlugin;
|
|
|
|
// Re-export connector components for direct use
|
|
export {
|
|
LXDex,
|
|
LXDexConfig,
|
|
getLXDexConfig,
|
|
LX_DEX_NETWORKS,
|
|
lxdexRoutes,
|
|
} from '@lxdex/hummingbot-gateway-connector';
|