apow-cli 0.11.3 → 0.11.4

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/errors.js CHANGED
@@ -93,6 +93,14 @@ const patterns = [
93
93
  recovery: "Retrying with a fresh payment session...",
94
94
  }),
95
95
  },
96
+ {
97
+ test: (m) => m.includes("x402 payment failed — insufficient USDC balance on Base"),
98
+ classify: () => ({
99
+ category: "setup",
100
+ userMessage: "Insufficient USDC for QuickNode x402 RPC",
101
+ recovery: "Send USDC to your wallet on Base, or set RPC_URL in .env to use your own RPC",
102
+ }),
103
+ },
96
104
  {
97
105
  test: (m) => /\b402\b/.test(m) || m.includes("QuickNode x402") || (m.toLowerCase().includes("insufficient") && m.toLowerCase().includes("usdc")),
98
106
  classify: () => ({
package/dist/index.js CHANGED
@@ -470,10 +470,17 @@ async function main() {
470
470
  .option("--token <token>", "Source token: sol, usdc, eth")
471
471
  .option("--amount <eth>", "Target ETH amount (default: 0.005)")
472
472
  .option("--no-swap", "Skip auto-split after bridging")
473
- .hook("preAction", async () => {
474
- await (0, preflight_1.runPreflight)("readonly");
475
- })
476
473
  .action(async (opts) => {
474
+ if (!config_1.config.privateKey || !wallet_1.account) {
475
+ ui.warn("No wallet configured — launching setup first.");
476
+ await setupWizard();
477
+ (0, config_1.reloadConfig)();
478
+ (0, wallet_1.reinitClients)();
479
+ if (!wallet_1.account) {
480
+ ui.error("Wallet configuration did not complete.");
481
+ return;
482
+ }
483
+ }
477
484
  await (0, fund_1.runFundFlow)(opts);
478
485
  });
479
486
  program
package/dist/miner.js CHANGED
@@ -56,8 +56,8 @@ const wallet_1 = require("./wallet");
56
56
  const agentCoinAbi = AgentCoin_json_1.default;
57
57
  const miningAgentAbi = MiningAgent_json_1.default;
58
58
  const MAX_CONSECUTIVE_FAILURES = 10;
59
- const BASE_BACKOFF_MS = 2_000;
60
- const MAX_BACKOFF_MS = 60_000;
59
+ const RETRY_DELAY_MS = 2_000;
60
+ const RETRY_JITTER_MS = 500;
61
61
  const BASE_REWARD = 3n * 10n ** 18n;
62
62
  const REWARD_DECAY_NUM = 90n;
63
63
  const REWARD_DECAY_DEN = 100n;
@@ -96,10 +96,8 @@ function rejectOnAbort(signal) {
96
96
  }, { once: true });
97
97
  });
98
98
  }
99
- function backoffMs(failures) {
100
- const base = Math.min(BASE_BACKOFF_MS * 2 ** (failures - 1), MAX_BACKOFF_MS);
101
- const jitter = Math.random() * base * 0.3;
102
- return base + jitter;
99
+ function retryDelayMs() {
100
+ return RETRY_DELAY_MS + Math.random() * RETRY_JITTER_MS;
103
101
  }
104
102
  function estimateReward(totalMines, eraInterval, hashpower) {
105
103
  const era = totalMines / eraInterval;
@@ -682,7 +680,7 @@ async function startMining(tokenId) {
682
680
  ui.error(`${MAX_CONSECUTIVE_FAILURES} consecutive failures. Last: ${classified.userMessage}`);
683
681
  return;
684
682
  }
685
- const delay = backoffMs(consecutiveFailures);
683
+ const delay = retryDelayMs();
686
684
  ui.error(`${classified.userMessage} (${consecutiveFailures}/${MAX_CONSECUTIVE_FAILURES})`);
687
685
  if (classified.recovery)
688
686
  ui.hint(classified.recovery);
package/dist/x402.js CHANGED
@@ -38,6 +38,7 @@ exports.resetX402 = resetX402;
38
38
  const viem_1 = require("viem");
39
39
  const QUICKNODE_BASE = "https://x402.quicknode.com";
40
40
  const BASE_MAINNET = "eip155:8453";
41
+ const X402_RPC_TIMEOUT_MS = 10_000;
41
42
  let _client = null;
42
43
  async function getClient(privateKey) {
43
44
  if (_client && !_client.isTokenExpired())
@@ -60,6 +61,7 @@ function createX402Transport(privateKey) {
60
61
  method: "POST",
61
62
  headers: { "Content-Type": "application/json" },
62
63
  body: JSON.stringify({ jsonrpc: "2.0", method, params, id: 1 }),
64
+ signal: AbortSignal.timeout(X402_RPC_TIMEOUT_MS),
63
65
  });
64
66
  if (response.status === 402) {
65
67
  throw new Error("x402 payment failed — insufficient USDC balance on Base");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apow-cli",
3
- "version": "0.11.3",
3
+ "version": "0.11.4",
4
4
  "description": "Mine AGENT tokens on Base L2 with Agentic Proof of Work",
5
5
  "keywords": [
6
6
  "apow",