polycopy 0.0.4 → 0.0.5

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");
@@ -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
  /**
@@ -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.5",
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": {