mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
Integrate StandX exchange support by updating configuration files, adding environment variables, and enhancing documentation. Include new API endpoints and authentication details for StandX in README and dedicated documentation files. Update CLI and adapter logic to accommodate StandX functionalities.
This commit is contained in:
@@ -5,6 +5,7 @@ import type { LighterCredentials } from "./lighter/adapter";
|
||||
import type { BackpackCredentials } from "./backpack/adapter";
|
||||
import type { ParadexCredentials } from "./paradex/adapter";
|
||||
import type { NadoCredentials } from "./nado/adapter";
|
||||
import type { StandxCredentials } from "./standx/adapter";
|
||||
import { t } from "../i18n";
|
||||
import type { Address } from "viem";
|
||||
|
||||
@@ -42,6 +43,11 @@ export function buildAdapterFromEnv(options: BuildAdapterOptions): ExchangeAdapt
|
||||
return createExchangeAdapter({ exchange: id, symbol, nado: credentials });
|
||||
}
|
||||
|
||||
if (id === "standx") {
|
||||
const credentials = resolveStandxCredentials(symbol);
|
||||
return createExchangeAdapter({ exchange: id, symbol, standx: credentials });
|
||||
}
|
||||
|
||||
return createExchangeAdapter({ exchange: id, symbol, grvt: { symbol } });
|
||||
}
|
||||
|
||||
@@ -153,6 +159,21 @@ function resolveNadoCredentials(symbol: string): NadoCredentials {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
function resolveStandxCredentials(symbol: string): StandxCredentials {
|
||||
const token = process.env.STANDX_TOKEN;
|
||||
if (!token) {
|
||||
throw new Error(t("env.missingStandx"));
|
||||
}
|
||||
return {
|
||||
token,
|
||||
symbol: process.env.STANDX_SYMBOL ?? symbol,
|
||||
baseUrl: process.env.STANDX_BASE_URL ?? undefined,
|
||||
wsUrl: process.env.STANDX_WS_URL ?? undefined,
|
||||
sessionId: process.env.STANDX_SESSION_ID ?? undefined,
|
||||
signingKey: process.env.STANDX_REQUEST_PRIVATE_KEY ?? undefined,
|
||||
};
|
||||
}
|
||||
|
||||
function isHex32(value: string): boolean {
|
||||
return /^0x[0-9a-fA-F]{64}$/.test(value.trim());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user