mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
feat: 添加 Lighter 签名桥接和公钥派生脚本,支持新的签名库和环境检测功能
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import "dotenv/config";
|
||||
import { LighterPrivateKey } from "../src/exchanges/lighter/crypto/schnorr";
|
||||
import { bytesToHex } from "../src/exchanges/lighter/bytes";
|
||||
|
||||
function main(): void {
|
||||
const raw = process.env.LIGHTER_API_PRIVATE_KEY;
|
||||
if (!raw) {
|
||||
throw new Error("LIGHTER_API_PRIVATE_KEY env var is required");
|
||||
}
|
||||
const normalized = raw.startsWith("0x") ? raw.slice(2) : raw;
|
||||
const key = LighterPrivateKey.fromHex(normalized);
|
||||
const publicKeyHex = bytesToHex(key.publicKey().toBytes());
|
||||
const apiKeyIndex = process.env.LIGHTER_API_KEY_INDEX ?? "(not set)";
|
||||
|
||||
console.log(JSON.stringify({
|
||||
apiKeyIndex,
|
||||
publicKeyHex,
|
||||
}, null, 2));
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user