polycopy 0.0.4 → 0.0.6

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/dist/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const init = require("./init-BYV6n20C.js");
2
+ const init = require("./init-Bm-Q_fD_.js");
3
3
  async function main() {
4
4
  try {
5
5
  await init.runConfigWizard();
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const init = require("./init-BYV6n20C.js");
2
+ const init = require("./init-Bm-Q_fD_.js");
3
3
  const grammy = require("grammy");
4
4
  const wallet = require("@ethersproject/wallet");
5
5
  const clobClient = require("@polymarket/clob-client");
@@ -769,7 +769,7 @@ class Trader {
769
769
  builderCreds: config.polymarket.builderCreds
770
770
  });
771
771
  } else {
772
- init.logger.warning("未配置 builderCredsRedeem 功能已禁用");
772
+ init.logger.warning("未配置 builderCreds,自动 Redeem 功能已禁用");
773
773
  }
774
774
  this.initialized = true;
775
775
  init.logger.success("交易模块初始化完成");
@@ -849,6 +849,11 @@ class Trader {
849
849
  return;
850
850
  }
851
851
  this.assetFilter.markTraded(assetId, endTime);
852
+ if (sellPrice === 1) {
853
+ init.logger.success(`买单已提交: ${buyResult.orderId}`);
854
+ init.logger.line("", "sellPrice = 1,成交后将自动 redeem");
855
+ return;
856
+ }
852
857
  this.watchAndHandle(buyResult.orderId, assetId, sellPrice, endTime, metadata.eventId);
853
858
  }
854
859
  /**
@@ -1021,10 +1026,6 @@ async function main() {
1021
1026
  } else {
1022
1027
  try {
1023
1028
  await trader.init(config);
1024
- if (config.trading?.sellPrice === 1 && !config.polymarket?.builderCreds) {
1025
- init.logger.warning("sellPrice = 1 但未配置 builderCreds,持仓将无法自动结算");
1026
- init.logger.line("", "请配置 Builder API 凭证,或手动 claim");
1027
- }
1028
1029
  } catch (error) {
1029
1030
  const errorMsg = error instanceof Error ? error.message : String(error);
1030
1031
  init.logger.error(`交易模块初始化失败: ${errorMsg}`);
@@ -631,7 +631,7 @@ async function runConfigWizard(existingConfig) {
631
631
  const currentAdminChatId = currentTelegram?.adminChatId;
632
632
  const adminHint = currentAdminChatId ? "回车保持,skip 清除" : "回车跳过";
633
633
  const adminChatIdInput = await question(
634
- ` - 管理员 Chat ID [${currentAdminChatId || "未配置"}] (${adminHint}): `
634
+ ` - 管理员 Chat ID [${currentAdminChatId || "未配置"}] (用于接收重要通知, ${adminHint}): `
635
635
  );
636
636
  let adminChatId = currentAdminChatId;
637
637
  if (adminChatIdInput.trim().toLowerCase() === "skip") {
@@ -833,10 +833,10 @@ async function configureTrading(existingConfig) {
833
833
  const defaultSellPrice = existingSellPrice ?? 1;
834
834
  let sellPrice = defaultSellPrice;
835
835
  while (true) {
836
- const sellDisplay = (existingSellPrice ?? defaultSellPrice) === 1 ? "1 (redeem)" : String(existingSellPrice ?? defaultSellPrice);
836
+ const sellDisplay = String(existingSellPrice ?? defaultSellPrice);
837
837
  const minSell = buyPrice ?? 0.98;
838
838
  const sellPriceInput = await question(
839
- ` - 卖价 [${sellDisplay}] (>${minSell} 且 <=1, 1=redeem, skip=跳过): `
839
+ ` - 卖价 [${sellDisplay}] (>${minSell} 且 <=1, 1=不卖出等待自动 redeem, skip=跳过): `
840
840
  );
841
841
  if (!sellPriceInput.trim()) {
842
842
  sellPrice = existingSellPrice ?? defaultSellPrice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polycopy",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "polycopy test",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -13,6 +13,8 @@
13
13
  "config": "node dist/config.js",
14
14
  "dev": "tsc --noEmit && vite build && node dist/index.js",
15
15
  "cli": "node dist/cli.js",
16
+ "preuninstall": "node dist/cli.js stop 2>/dev/null || true",
17
+ "prepublishOnly": "npm run build",
16
18
  "test": "echo \"Error: no test specified\" && exit 1"
17
19
  },
18
20
  "dependencies": {