@okx_ai/okx-trade-cli 1.3.1-beta.8 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okx_ai/okx-trade-cli",
3
- "version": "1.3.1-beta.8",
3
+ "version": "1.3.1",
4
4
  "description": "OKX CLI - Command line tool for OKX exchange",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@ function getPlatformDir() {
52
52
  }
53
53
 
54
54
  function getBinaryName() {
55
- return platform() === 'win32' ? 'okx-doh-resolver.exe' : 'okx-doh-resolver';
55
+ return platform() === 'win32' ? 'okx-pilot.exe' : 'okx-pilot';
56
56
  }
57
57
 
58
58
  /**
@@ -216,80 +216,3 @@ async function downloadDohBinary() {
216
216
  downloadDohBinary().catch(() => {
217
217
  // Never block npm install
218
218
  });
219
-
220
- // ---------------------------------------------------------------------------
221
- // okx-auth binary download (best-effort, never blocks npm install)
222
- // ---------------------------------------------------------------------------
223
-
224
- const AUTH_CDN_PATH_PREFIX = '/upgradeapp/tools/oauth';
225
-
226
- function getAuthBinaryName() {
227
- return platform() === 'win32' ? 'okx-auth.exe' : 'okx-auth';
228
- }
229
-
230
- async function downloadOkxAuthBinary() {
231
- if (process.env.OKX_AUTH_BIN) return;
232
-
233
- const platformDir = getPlatformDir();
234
- if (!platformDir) return;
235
-
236
- const binaryName = getAuthBinaryName();
237
- const destPath = join(BIN_DIR, binaryName);
238
- const tmpPath = destPath + '.auth.tmp';
239
-
240
- mkdirSync(BIN_DIR, { recursive: true });
241
-
242
- const checksumPath = `${AUTH_CDN_PATH_PREFIX}/${platformDir}/checksum.json`;
243
- const binaryPath = `${AUTH_CDN_PATH_PREFIX}/${platformDir}/${binaryName}`;
244
-
245
- for (const { host, protocol } of CDN_SOURCES) {
246
- try {
247
- const checksumUrl = `${protocol}://${host}${checksumPath}`;
248
- const raw = await downloadText(checksumUrl, DOWNLOAD_TIMEOUT_MS);
249
- const checksum = JSON.parse(raw);
250
-
251
- if (!checksum.sha256 || !checksum.size || !checksum.target) {
252
- throw new Error('Invalid checksum.json: missing sha256, size, or target');
253
- }
254
-
255
- if (checksum.target !== platformDir) {
256
- throw new Error(`Target mismatch: expected ${platformDir}, got ${checksum.target}`);
257
- }
258
-
259
- if (existsSync(destPath) && verifyBinary(destPath, checksum, platformDir)) {
260
- process.stderr.write(' ✓ okx-auth up to date (checksum match)\n');
261
- return;
262
- }
263
-
264
- const binaryUrl = `${protocol}://${host}${binaryPath}`;
265
- await download(binaryUrl, tmpPath, DOWNLOAD_TIMEOUT_MS);
266
-
267
- const actual = hashFile(tmpPath);
268
- if (actual.size !== checksum.size) {
269
- throw new Error(`Size mismatch: expected ${checksum.size}, got ${actual.size}`);
270
- }
271
- if (actual.sha256 !== checksum.sha256) {
272
- throw new Error(`SHA-256 mismatch: expected ${checksum.sha256}, got ${actual.sha256}`);
273
- }
274
-
275
- try { unlinkSync(destPath); } catch { /* ignore */ }
276
- renameSync(tmpPath, destPath);
277
-
278
- if (platform() !== 'win32') {
279
- chmodSync(destPath, 0o755);
280
- }
281
-
282
- process.stderr.write(` ✓ okx-auth downloaded and verified (${host})\n`);
283
- return;
284
- } catch (err) {
285
- try { unlinkSync(tmpPath); } catch { /* ignore */ }
286
- process.stderr.write(` [okx-auth] ${host} failed: ${err instanceof Error ? err.message : err}\n`);
287
- }
288
- }
289
-
290
- process.stderr.write(' ⓘ okx-auth not available (download failed). Set OKX_AUTH_BIN to provide a custom path, or re-run npm install to retry.\n');
291
- }
292
-
293
- downloadOkxAuthBinary().catch(() => {
294
- // Never block npm install
295
- });