@tempoxyz/patron 0.0.31 → 0.0.33

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/bin.js CHANGED
@@ -12,14 +12,14 @@ if (!process.env.PATRON_HOME) {
12
12
  if (home) process.env.PATRON_HOME = home;
13
13
  }
14
14
  if (process.argv[2] === "hook") {
15
- const { runHookProcess } = await import("./chunks/hook-process-W3ZK5FT3.js");
15
+ const { runHookProcess } = await import("./chunks/hook-process-QKKTEUP6.js");
16
16
  await runHookProcess().catch(() => void 0);
17
17
  process.exit(0);
18
18
  } else if (process.argv[2] === "pay") {
19
- const { runPayProcess } = await import("./chunks/hook-process-W3ZK5FT3.js");
19
+ const { runPayProcess } = await import("./chunks/hook-process-QKKTEUP6.js");
20
20
  await runPayProcess().catch(() => void 0);
21
21
  process.exit(0);
22
22
  } else {
23
- const { run } = await import("./chunks/-K6MPD575.js");
23
+ const { run } = await import("./chunks/-IY3OYWAY.js");
24
24
  process.exitCode = await run(process.argv.slice(2));
25
25
  }
@@ -31,33 +31,32 @@ import {
31
31
  withPatronStatus,
32
32
  withoutPatronHandlers,
33
33
  writeJsonObject
34
- } from "./chunk-AN64RW3X.js";
34
+ } from "./chunk-U536WCJ4.js";
35
35
  import {
36
36
  awaitRedemptions,
37
37
  gatewayTurn,
38
38
  startRefill
39
- } from "./chunk-IIB6TI3U.js";
39
+ } from "./chunk-H2MOKUUK.js";
40
40
  import {
41
41
  inferHome,
42
42
  resolveSettings,
43
43
  settingsFor
44
44
  } from "./chunk-NDBTADXZ.js";
45
- import {
46
- LeaderboardResponse,
47
- PatronInfo,
48
- profileMessage
49
- } from "./chunk-GBZCXMDZ.js";
45
+ import "./chunk-SSV6C6E5.js";
50
46
  import {
51
47
  AGENT_IDS,
52
48
  DEFAULT_MONTHLY_BUDGET_USD,
49
+ LeaderboardResponse,
53
50
  MAX_TOKENS_PER_PAGE,
54
51
  MIN_TOKENS_PER_PAGE,
55
52
  PACK_SIZE,
53
+ PatronInfo,
56
54
  TOKEN_PRICE_UNITS,
57
55
  clampTokensPerPage,
58
56
  ensureHome,
59
57
  formatUsd,
60
58
  normalizePayee,
59
+ profileMessage,
61
60
  readConfig,
62
61
  readJson,
63
62
  readUsage,
@@ -68,7 +67,7 @@ import {
68
67
  withLock,
69
68
  writeConfig,
70
69
  writePrivateFile
71
- } from "./chunk-JTPFWITF.js";
70
+ } from "./chunk-4FPS3A57.js";
72
71
  import "./chunk-GTMLTZRN.js";
73
72
 
74
73
  // src/index.ts
@@ -780,10 +779,10 @@ async function linkRefillFailedAt(home) {
780
779
  }
781
780
  var defaultOpenWallet = async (settings, config, issuer, maxUnits) => {
782
781
  if (config.wallet === "link") {
783
- const { openLinkWallet } = await import("./wallet-WR6EBMN6.js");
782
+ const { openLinkWallet } = await import("./wallet-VQM33W7E.js");
784
783
  return openLinkWallet(config, maxUnits);
785
784
  }
786
- const { openWallet } = await import("./wallet-WR6EBMN6.js");
785
+ const { openWallet } = await import("./wallet-VQM33W7E.js");
787
786
  return openWallet(settings, config.wallet, issuer, maxUnits);
788
787
  };
789
788
  var REFILL_LOCK_STALE_MS = 5 * 60 * 1e3;
@@ -1303,7 +1302,7 @@ async function tempoSignIn(deps, budgetUnits, issuer) {
1303
1302
  deps,
1304
1303
  deps.settings.privateKey ? "Using PATRON_PRIVATE_KEY" : "Signing in with Tempo Wallet"
1305
1304
  );
1306
- const { signIn } = await import("./wallet-WR6EBMN6.js");
1305
+ const { signIn } = await import("./wallet-VQM33W7E.js");
1307
1306
  const account = await signIn(deps.settings, {
1308
1307
  budgetUnits,
1309
1308
  issuer,
@@ -1422,7 +1421,7 @@ async function changeBudget(deps, input) {
1422
1421
  } else budget = await askBudget(deps, config.monthlyBudgetUsd);
1423
1422
  if (config.wallet === "tempo" && budget >= config.monthlyBudgetUsd) {
1424
1423
  step(deps, "Approve the new spending limit in Tempo Wallet");
1425
- const { authorizeBudget } = await import("./wallet-WR6EBMN6.js");
1424
+ const { authorizeBudget } = await import("./wallet-VQM33W7E.js");
1426
1425
  const issuer = await currentIssuer(deps, settings);
1427
1426
  await authorizeBudget(settings, {
1428
1427
  budgetUnits: BigInt(budgetTokens(budget)) * TOKEN_PRICE_UNITS,
@@ -1430,7 +1429,7 @@ async function changeBudget(deps, input) {
1430
1429
  output: deps.stdout
1431
1430
  });
1432
1431
  }
1433
- await writeConfig(settings.home, { ...config, monthlyBudgetUsd: budget });
1432
+ await updateConfigField(settings.home, { monthlyBudgetUsd: budget });
1434
1433
  done(deps, `Monthly budget set to $${twoDecimals(String(budget))}.`);
1435
1434
  }
1436
1435
  async function changePerPage(deps, input) {
@@ -1618,15 +1617,20 @@ async function setName(deps, name) {
1618
1617
  "Leaderboard names belong to Tempo addresses; Link purchases are not ranked."
1619
1618
  );
1620
1619
  const issuer = await currentIssuer(deps, settings);
1621
- const open = deps.openWallet ?? (async (s, c, i, max) => (await import("./wallet-WR6EBMN6.js")).openWallet(s, c.wallet, i, max));
1620
+ const open = deps.openWallet ?? (async (s, c, i, max) => (await import("./wallet-VQM33W7E.js")).openWallet(s, c.wallet, i, max));
1622
1621
  const wallet = await open(settings, config, issuer, 0n);
1623
1622
  await inGatewayTurn(
1624
1623
  deps,
1625
1624
  () => setProfile(settings.gatewayUrl, wallet, name, deps.fetch)
1626
1625
  );
1627
- await writeConfig(settings.home, { ...config, name });
1626
+ await updateConfigField(settings.home, { name });
1628
1627
  done(deps, `Leaderboard name set to ${name}.`);
1629
1628
  }
1629
+ async function updateConfigField(home, fields) {
1630
+ const current = await readConfig(home);
1631
+ if (!current) throw new Error("Patron is not set up. Run npx @tempoxyz/patron.");
1632
+ await writeConfig(home, { ...current, ...fields });
1633
+ }
1630
1634
  async function uninstall(deps) {
1631
1635
  const config = await readConfig(deps.settings.home);
1632
1636
  const removed = await removeAgents(deps.agents);