@toon-protocol/rig 4.0.0 → 4.2.0

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/cli/rig.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  GitError,
4
4
  GitRepoReader,
5
+ MAX_OBJECT_SIZE,
5
6
  NonFastForwardError,
6
7
  OversizeObjectsError,
7
8
  collectRepoObjects,
@@ -18,7 +19,7 @@ import {
18
19
  setHeadSymref,
19
20
  updateRef,
20
21
  writeGitObjects
21
- } from "../chunk-ZZBA5VVL.js";
22
+ } from "../chunk-TJPIE5X4.js";
22
23
  import {
23
24
  DEFAULT_KEYSTORE_PASSWORD,
24
25
  MissingIdentityError,
@@ -39,9 +40,10 @@ import {
39
40
  buildRepoAnnouncement,
40
41
  buildStatus,
41
42
  fetchRemoteState,
43
+ isValidEvmPayoutAddress,
42
44
  parseMaintainers,
43
45
  queryRelay
44
- } from "../chunk-2KJJ7LSO.js";
46
+ } from "../chunk-NCEMQUPA.js";
45
47
  import {
46
48
  ChannelMapStore,
47
49
  RIG_STANDALONE_ENV,
@@ -53,9 +55,8 @@ import {
53
55
  standaloneForced
54
56
  } from "../chunk-YZRR2UO6.js";
55
57
  import {
56
- MAX_OBJECT_SIZE,
57
58
  uploadChargeFor
58
- } from "../chunk-GVXBUL3C.js";
59
+ } from "../chunk-CXREFXB6.js";
59
60
 
60
61
  // src/cli/rig.ts
61
62
  import { createInterface as createInterface2 } from "readline/promises";
@@ -1110,7 +1111,7 @@ function loadPaidSession(deps, relayUrl) {
1110
1111
  });
1111
1112
  }
1112
1113
  var defaultLoadStandalone = async (options) => {
1113
- const mod = await import("../standalone-mode-LEAC4A2L.js");
1114
+ const mod = await import("../standalone-mode-YOFWOAL5.js");
1114
1115
  return mod.createStandaloneContext(options);
1115
1116
  };
1116
1117
  function identityReport(ctx) {
@@ -1830,17 +1831,18 @@ import { dirname, join as join2 } from "path";
1830
1831
  import { parseArgs as parseArgs4 } from "util";
1831
1832
  var FAMILY_USDC = {
1832
1833
  evm: "EVM USDC (Base Sepolia on devnet)",
1833
- solana: "Solana USDC",
1834
- mina: "Mina USDC"
1834
+ solana: "Solana USDC"
1835
+ };
1836
+ var REMOVED_FAMILIES = {
1837
+ mina: "Mina settlement was removed in rig 4.0.0 along with the Mina client and `rig channel deploy-zkapp`"
1835
1838
  };
1836
1839
  var FAMILY_ALIASES = {
1837
1840
  evm: "evm",
1838
1841
  eth: "evm",
1839
1842
  sol: "solana",
1840
- solana: "solana",
1841
- mina: "mina"
1843
+ solana: "solana"
1842
1844
  };
1843
- var CHAIN_ARG_LIST = "evm | sol | solana | mina (or a full id like evm:base:84532)";
1845
+ var CHAIN_ARG_LIST = "evm | sol | solana (or a full id like evm:base:84532)";
1844
1846
  var CHAIN_USAGE = `Usage: rig chain [set <chain> | unset]
1845
1847
 
1846
1848
  Choose which chain \u2014 and therefore which USDC token \u2014 settles paid \`rig\`
@@ -1852,7 +1854,6 @@ the local config file is touched.
1852
1854
  rig chain set <chain> pin the settlement chain / USDC:
1853
1855
  evm \u2192 EVM USDC (Base Sepolia on devnet)
1854
1856
  sol \u2192 Solana USDC
1855
- mina \u2192 Mina USDC
1856
1857
  (a full id like evm:base:84532 or solana:devnet also
1857
1858
  works; \`solana\` is accepted for \`sol\`, \`eth\` for \`evm\`)
1858
1859
  rig chain unset clear the pin \u2014 revert to automatic selection
@@ -1886,16 +1887,27 @@ function writeChainConfig(configPath, file) {
1886
1887
  function normalizeChain(raw) {
1887
1888
  if (raw.includes(":")) {
1888
1889
  const family = raw.split(":")[0]?.toLowerCase() ?? "";
1890
+ const removed2 = REMOVED_FAMILIES[family];
1891
+ if (removed2) {
1892
+ throw new Error(`${removed2}; settle on evm or solana instead`);
1893
+ }
1889
1894
  if (!(family in FAMILY_USDC)) {
1890
1895
  throw new Error(
1891
- `unknown chain family in ${JSON.stringify(raw)} \u2014 must start with evm:, solana:, or mina:`
1896
+ `unknown chain family in ${JSON.stringify(raw)} \u2014 must start with evm: or solana:`
1892
1897
  );
1893
1898
  }
1894
1899
  return raw;
1895
1900
  }
1896
- const canonical = FAMILY_ALIASES[raw.toLowerCase()];
1901
+ const lowered = raw.toLowerCase();
1902
+ const removed = REMOVED_FAMILIES[lowered];
1903
+ if (removed) {
1904
+ throw new Error(`${removed}; settle on evm or solana instead`);
1905
+ }
1906
+ const canonical = FAMILY_ALIASES[lowered];
1897
1907
  if (!canonical) {
1898
- throw new Error(`chain must be one of ${CHAIN_ARG_LIST}, got ${JSON.stringify(raw)}`);
1908
+ throw new Error(
1909
+ `chain must be one of ${CHAIN_ARG_LIST}, got ${JSON.stringify(raw)}`
1910
+ );
1899
1911
  }
1900
1912
  return canonical;
1901
1913
  }
@@ -1929,7 +1941,9 @@ async function runChain(args, deps) {
1929
1941
  }
1930
1942
  const [sub, ...subRest] = positionals;
1931
1943
  if (sub !== void 0 && sub !== "set" && sub !== "unset") {
1932
- io2.err(`unknown subcommand ${JSON.stringify(sub)} \u2014 expected \`set\`, \`unset\`, or no argument`);
1944
+ io2.err(
1945
+ `unknown subcommand ${JSON.stringify(sub)} \u2014 expected \`set\`, \`unset\`, or no argument`
1946
+ );
1933
1947
  io2.err(CHAIN_USAGE);
1934
1948
  return 2;
1935
1949
  }
@@ -1992,7 +2006,9 @@ async function runChain(args, deps) {
1992
2006
  return 0;
1993
2007
  }
1994
2008
  io2.out(`Settlement chain set to ${value} \u2192 spends ${usdcFor(value)}.`);
1995
- io2.out(`Saved to ${configPath}. Applies to the next paid command (e.g. \`rig push\`).`);
2009
+ io2.out(
2010
+ `Saved to ${configPath}. Applies to the next paid command (e.g. \`rig push\`).`
2011
+ );
1996
2012
  for (const w of warnings) io2.err(`warning: ${w}`);
1997
2013
  return 0;
1998
2014
  }
@@ -2017,9 +2033,13 @@ async function runChain(args, deps) {
2017
2033
  had !== void 0 ? `Cleared the settlement-chain pin (was ${had}).` : "No settlement-chain pin was set."
2018
2034
  );
2019
2035
  if (stillPinned !== void 0) {
2020
- io2.out(`Still pinned to ${stillPinned} by ${envChain !== void 0 ? "TOON_CLIENT_CHAIN" : "config supportedChains"} \u2192 ${usdcFor(stillPinned)}.`);
2036
+ io2.out(
2037
+ `Still pinned to ${stillPinned} by ${envChain !== void 0 ? "TOON_CLIENT_CHAIN" : "config supportedChains"} \u2192 ${usdcFor(stillPinned)}.`
2038
+ );
2021
2039
  } else {
2022
- io2.out("Reverted to automatic selection (most-recent channel \u2192 first funded announced chain \u2192 first EVM).");
2040
+ io2.out(
2041
+ "Reverted to automatic selection (most-recent channel \u2192 first funded announced chain \u2192 first EVM)."
2042
+ );
2023
2043
  }
2024
2044
  return 0;
2025
2045
  }
@@ -2037,13 +2057,19 @@ async function runChain(args, deps) {
2037
2057
  }
2038
2058
  if (effective !== void 0) {
2039
2059
  const via = source === "env" ? "TOON_CLIENT_CHAIN env" : source === "config" ? `config \`chain\` (${configPath})` : `config \`supportedChains[0]\``;
2040
- io2.out(`Settlement chain: ${effective} \u2192 spends ${usdcFor(effective)} (from ${via}).`);
2041
- io2.out("Change it with `rig chain set <evm|sol|mina>`, or `rig chain unset` for auto.");
2060
+ io2.out(
2061
+ `Settlement chain: ${effective} \u2192 spends ${usdcFor(effective)} (from ${via}).`
2062
+ );
2063
+ io2.out(
2064
+ "Change it with `rig chain set <evm|sol>`, or `rig chain unset` for auto."
2065
+ );
2042
2066
  } else {
2043
2067
  io2.out("Settlement chain: (auto) \u2014 no pin set.");
2044
- io2.out("rig picks your most-recent open channel, else the first announced chain your");
2068
+ io2.out(
2069
+ "rig picks your most-recent open channel, else the first announced chain your"
2070
+ );
2045
2071
  io2.out("wallet holds USDC on, else the first announced EVM chain.");
2046
- io2.out("Pin one with `rig chain set <evm|sol|mina>`.");
2072
+ io2.out("Pin one with `rig chain set <evm|sol>`.");
2047
2073
  }
2048
2074
  return 0;
2049
2075
  } catch (err) {
@@ -5498,33 +5524,10 @@ async function runInit(args, deps) {
5498
5524
 
5499
5525
  // src/cli/maintainers.ts
5500
5526
  import { parseArgs as parseArgs14 } from "util";
5501
- var HEX64_RE3 = /^[0-9a-f]{64}$/;
5502
- var WS_URL_RE4 = /^wss?:\/\//i;
5503
- var MAINTAINERS_USAGE = `Usage: rig maintainers <list|add|remove> [<pubkey>] [options]
5504
-
5505
- Manage a repo's declared maintainers (#287). Status authority is consumer-side:
5506
- rig and rig-web honor an issue/PR status (kind:1630-1633) ONLY when its author
5507
- is the repo owner or a declared maintainer. The owner is always an implicit
5508
- maintainer; this command edits the explicit set on the kind:30617 announcement.
5509
-
5510
- Subcommands:
5511
- list show the owner + declared maintainers \u2014 FREE (relay read)
5512
- add <pubkey> add a maintainer (npub or 64-char hex) \u2014 PAID: republishes
5513
- the kind:30617 (permanent, non-refundable)
5514
- remove <pubkey> remove a maintainer \u2014 PAID: republishes the kind:30617
5515
5527
 
5516
- add/remove must run under the repo OWNER's identity (only the owner's
5517
- announcement is authoritative).
5518
-
5519
- Options:
5520
- --repo-id <id> repository id / NIP-34 d-tag (default: git config)
5521
- --owner <pubkey> repository owner (npub or hex; default: git config)
5522
- --remote <name> publish/read via this configured git remote (default: origin)
5523
- --relay <url> ad-hoc relay override (exactly one for add/remove)
5524
- --yes skip the fee confirmation (required when not a TTY)
5525
- --json machine-readable envelope
5526
- -h, --help show this help`;
5527
- var MAINT_OPTIONS = {
5528
+ // src/cli/repo-command.ts
5529
+ var WS_URL_RE4 = /^wss?:\/\//i;
5530
+ var REPO_COMMAND_OPTIONS = {
5528
5531
  json: { type: "boolean", default: false },
5529
5532
  yes: { type: "boolean", default: false },
5530
5533
  relay: { type: "string", multiple: true },
@@ -5533,7 +5536,7 @@ var MAINT_OPTIONS = {
5533
5536
  owner: { type: "string" },
5534
5537
  help: { type: "boolean", short: "h", default: false }
5535
5538
  };
5536
- function pickFlags(values) {
5539
+ function pickRepoCommandFlags(values) {
5537
5540
  const flags = {
5538
5541
  json: values["json"] === true,
5539
5542
  yes: values["yes"] === true,
@@ -5546,7 +5549,7 @@ function pickFlags(values) {
5546
5549
  flags.owner = ownerToHex(values["owner"]);
5547
5550
  return flags;
5548
5551
  }
5549
- async function resolveContext(flags, deps) {
5552
+ async function resolveRepoContext(flags, deps) {
5550
5553
  let repoRoot;
5551
5554
  let toonConfig = {
5552
5555
  relays: []
@@ -5575,6 +5578,33 @@ async function resolveContext(flags, deps) {
5575
5578
  ...repoRoot !== void 0 ? { repoRoot } : {}
5576
5579
  };
5577
5580
  }
5581
+
5582
+ // src/cli/maintainers.ts
5583
+ var HEX64_RE3 = /^[0-9a-f]{64}$/;
5584
+ var MAINTAINERS_USAGE = `Usage: rig maintainers <list|add|remove> [<pubkey>] [options]
5585
+
5586
+ Manage a repo's declared maintainers (#287). Status authority is consumer-side:
5587
+ rig and rig-web honor an issue/PR status (kind:1630-1633) ONLY when its author
5588
+ is the repo owner or a declared maintainer. The owner is always an implicit
5589
+ maintainer; this command edits the explicit set on the kind:30617 announcement.
5590
+
5591
+ Subcommands:
5592
+ list show the owner + declared maintainers \u2014 FREE (relay read)
5593
+ add <pubkey> add a maintainer (npub or 64-char hex) \u2014 PAID: republishes
5594
+ the kind:30617 (permanent, non-refundable)
5595
+ remove <pubkey> remove a maintainer \u2014 PAID: republishes the kind:30617
5596
+
5597
+ add/remove must run under the repo OWNER's identity (only the owner's
5598
+ announcement is authoritative).
5599
+
5600
+ Options:
5601
+ --repo-id <id> repository id / NIP-34 d-tag (default: git config)
5602
+ --owner <pubkey> repository owner (npub or hex; default: git config)
5603
+ --remote <name> publish/read via this configured git remote (default: origin)
5604
+ --relay <url> ad-hoc relay override (exactly one for add/remove)
5605
+ --yes skip the fee confirmation (required when not a TTY)
5606
+ --json machine-readable envelope
5607
+ -h, --help show this help`;
5578
5608
  async function runMaintainers(args, deps) {
5579
5609
  const { io: io2 } = deps;
5580
5610
  const [sub, ...rest] = args;
@@ -5604,13 +5634,13 @@ async function runList2(args, deps) {
5604
5634
  try {
5605
5635
  const { values, positionals } = parseArgs14({
5606
5636
  args,
5607
- options: MAINT_OPTIONS,
5637
+ options: REPO_COMMAND_OPTIONS,
5608
5638
  allowPositionals: true
5609
5639
  });
5610
5640
  if (positionals.length > 0) {
5611
5641
  throw new Error("rig maintainers list takes no positional arguments");
5612
5642
  }
5613
- flags = pickFlags(values);
5643
+ flags = pickRepoCommandFlags(values);
5614
5644
  } catch (err) {
5615
5645
  io2.err(err instanceof Error ? err.message : String(err));
5616
5646
  io2.err(MAINTAINERS_USAGE);
@@ -5621,7 +5651,7 @@ async function runList2(args, deps) {
5621
5651
  return 0;
5622
5652
  }
5623
5653
  try {
5624
- const ctx = await resolveContext(flags, deps);
5654
+ const ctx = await resolveRepoContext(flags, deps);
5625
5655
  const wsRelays = ctx.relays.filter((url) => WS_URL_RE4.test(url));
5626
5656
  if (wsRelays.length === 0) {
5627
5657
  throw new InvalidRelayUrlError(
@@ -5671,10 +5701,10 @@ async function runMutate(op, args, deps) {
5671
5701
  try {
5672
5702
  const { values, positionals } = parseArgs14({
5673
5703
  args,
5674
- options: MAINT_OPTIONS,
5704
+ options: REPO_COMMAND_OPTIONS,
5675
5705
  allowPositionals: true
5676
5706
  });
5677
- flags = pickFlags(values);
5707
+ flags = pickRepoCommandFlags(values);
5678
5708
  if (flags.help) {
5679
5709
  io2.out(MAINTAINERS_USAGE);
5680
5710
  return 0;
@@ -5693,7 +5723,7 @@ async function runMutate(op, args, deps) {
5693
5723
  }
5694
5724
  let standaloneCtx;
5695
5725
  try {
5696
- const ctx = await resolveContext(flags, deps);
5726
+ const ctx = await resolveRepoContext(flags, deps);
5697
5727
  if (ctx.relays.length > 1) {
5698
5728
  io2.err(singleRelayRefusal(ctx.resolved, "Nothing was published or paid."));
5699
5729
  return 1;
@@ -5748,7 +5778,13 @@ async function runMutate(op, args, deps) {
5748
5778
  const next = op === "add" ? [...current, pubkey] : current.filter((m) => m !== pubkey);
5749
5779
  const name = remote.name ?? ctx.repoId;
5750
5780
  const description = remote.description ?? "";
5751
- const event = buildRepoAnnouncement(ctx.repoId, name, description, next);
5781
+ const event = buildRepoAnnouncement(
5782
+ ctx.repoId,
5783
+ name,
5784
+ description,
5785
+ next,
5786
+ remote.payout
5787
+ );
5752
5788
  const fee = (await standaloneCtx.publisher.getFeeRates()).eventFee.toString();
5753
5789
  const action = `kind:30617 maintainers ${op} ${pubkey.slice(0, 8)}\u2026`;
5754
5790
  if (!flags.json) {
@@ -6885,8 +6921,285 @@ async function runName(args, deps) {
6885
6921
  }
6886
6922
  }
6887
6923
 
6888
- // src/cli/site.ts
6924
+ // src/cli/payout.ts
6889
6925
  import { parseArgs as parseArgs16 } from "util";
6926
+ import { getAddress } from "viem";
6927
+ var PAYOUT_USAGE = `Usage: rig payout <set|clear|show> [<address>] [options]
6928
+
6929
+ Manage a repo's declared payout pointer (rig#92, part of the payout epic
6930
+ toon-protocol/toon-meta#391). No pointer on the kind:30617 announcement means
6931
+ a serving node keeps 100% of repo-scoped write fees; a pointer opts the repo
6932
+ into that node's declared ownerFeeShare split.
6933
+
6934
+ Subcommands:
6935
+ show show the declared payout pointer \u2014 FREE (relay read)
6936
+ set <address> declare the payout pointer (EVM address, EIP-55
6937
+ checksummed or all-lowercase) \u2014 PAID: republishes the
6938
+ kind:30617 (permanent, non-refundable). v1 accepts evm
6939
+ addresses only.
6940
+ clear remove the payout pointer \u2014 PAID: republishes the
6941
+ kind:30617
6942
+
6943
+ set/clear must run under the repo OWNER's identity (only the owner's
6944
+ announcement is authoritative).
6945
+
6946
+ Options:
6947
+ --repo-id <id> repository id / NIP-34 d-tag (default: git config)
6948
+ --owner <pubkey> repository owner (npub or hex; default: git config)
6949
+ --remote <name> publish/read via this configured git remote (default: origin)
6950
+ --relay <url> ad-hoc relay override (exactly one for set/clear)
6951
+ --yes skip the fee confirmation (required when not a TTY)
6952
+ --json machine-readable envelope
6953
+ -h, --help show this help`;
6954
+ async function runPayout(args, deps) {
6955
+ const { io: io2 } = deps;
6956
+ const [sub, ...rest] = args;
6957
+ switch (sub) {
6958
+ case "show":
6959
+ return runShow2(rest, deps);
6960
+ case "set":
6961
+ return runMutate2("set", rest, deps);
6962
+ case "clear":
6963
+ return runMutate2("clear", rest, deps);
6964
+ case "--help":
6965
+ case "-h":
6966
+ case "help":
6967
+ io2.out(PAYOUT_USAGE);
6968
+ return 0;
6969
+ default:
6970
+ io2.err(
6971
+ sub === void 0 ? "missing subcommand: rig payout <set|clear|show>" : `unknown rig payout subcommand: ${sub}`
6972
+ );
6973
+ io2.err(PAYOUT_USAGE);
6974
+ return 2;
6975
+ }
6976
+ }
6977
+ async function runShow2(args, deps) {
6978
+ const { io: io2 } = deps;
6979
+ let flags;
6980
+ try {
6981
+ const { values, positionals } = parseArgs16({
6982
+ args,
6983
+ options: REPO_COMMAND_OPTIONS,
6984
+ allowPositionals: true
6985
+ });
6986
+ if (positionals.length > 0) {
6987
+ throw new Error("rig payout show takes no positional arguments");
6988
+ }
6989
+ flags = pickRepoCommandFlags(values);
6990
+ } catch (err) {
6991
+ io2.err(err instanceof Error ? err.message : String(err));
6992
+ io2.err(PAYOUT_USAGE);
6993
+ return 2;
6994
+ }
6995
+ if (flags.help) {
6996
+ io2.out(PAYOUT_USAGE);
6997
+ return 0;
6998
+ }
6999
+ try {
7000
+ const ctx = await resolveRepoContext(flags, deps);
7001
+ const wsRelays = ctx.relays.filter((url) => WS_URL_RE4.test(url));
7002
+ if (wsRelays.length === 0) {
7003
+ throw new InvalidRelayUrlError(
7004
+ ctx.relays[0] ?? "",
7005
+ "reads need a ws:// or wss:// relay"
7006
+ );
7007
+ }
7008
+ const remote = await fetchRemoteState({
7009
+ relayUrls: wsRelays,
7010
+ ownerPubkey: ctx.owner,
7011
+ repoId: ctx.repoId,
7012
+ ...deps.webSocketFactory ? { webSocketFactory: deps.webSocketFactory } : {}
7013
+ });
7014
+ const payout = remote.payout;
7015
+ if (flags.json) {
7016
+ io2.emitJson({
7017
+ command: "payout show",
7018
+ repoAddr: { ownerPubkey: ctx.owner, repoId: ctx.repoId },
7019
+ announced: remote.announced,
7020
+ payout
7021
+ });
7022
+ return 0;
7023
+ }
7024
+ io2.out(`Repo: 30617:${ctx.owner}:${ctx.repoId}`);
7025
+ if (!remote.announced) {
7026
+ io2.out("No kind:30617 announcement found \u2014 no payout pointer.");
7027
+ return 0;
7028
+ }
7029
+ io2.out(
7030
+ payout === null ? "Payout: none (the serving node keeps 100% of repo-scoped write fees)" : `Payout: ${payout.chain} ${payout.address}`
7031
+ );
7032
+ return 0;
7033
+ } catch (err) {
7034
+ return emitCliError(io2, flags.json, "payout show", err);
7035
+ }
7036
+ }
7037
+ async function runMutate2(op, args, deps) {
7038
+ const { io: io2 } = deps;
7039
+ const command = `payout ${op}`;
7040
+ let flags;
7041
+ let nextPayout = null;
7042
+ try {
7043
+ const { values, positionals } = parseArgs16({
7044
+ args,
7045
+ options: REPO_COMMAND_OPTIONS,
7046
+ allowPositionals: true
7047
+ });
7048
+ flags = pickRepoCommandFlags(values);
7049
+ if (flags.help) {
7050
+ io2.out(PAYOUT_USAGE);
7051
+ return 0;
7052
+ }
7053
+ if (op === "set") {
7054
+ if (positionals.length !== 1) {
7055
+ throw new Error("expected exactly one <address> to set");
7056
+ }
7057
+ const raw = positionals[0];
7058
+ if (!isValidEvmPayoutAddress(raw)) {
7059
+ throw new Error(
7060
+ `<address> must be a valid EVM address (0x + 40 hex chars, correctly EIP-55 checksummed if mixed-case) \u2014 got ${JSON.stringify(raw)}. See toon-meta#391 (payout epic): v1 accepts evm addresses only.`
7061
+ );
7062
+ }
7063
+ nextPayout = { chain: "evm", address: getAddress(raw) };
7064
+ } else if (positionals.length !== 0) {
7065
+ throw new Error("rig payout clear takes no positional arguments");
7066
+ }
7067
+ } catch (err) {
7068
+ io2.err(err instanceof Error ? err.message : String(err));
7069
+ io2.err(PAYOUT_USAGE);
7070
+ return 2;
7071
+ }
7072
+ let standaloneCtx;
7073
+ try {
7074
+ const ctx = await resolveRepoContext(flags, deps);
7075
+ if (ctx.relays.length > 1) {
7076
+ io2.err(singleRelayRefusal(ctx.resolved, "Nothing was published or paid."));
7077
+ return 1;
7078
+ }
7079
+ const relayUrl = ctx.relays[0];
7080
+ if (relayUrl === void 0 || !WS_URL_RE4.test(relayUrl)) {
7081
+ throw new InvalidRelayUrlError(
7082
+ relayUrl ?? "",
7083
+ "a paid publish needs a ws:// or wss:// relay"
7084
+ );
7085
+ }
7086
+ const load = deps.loadStandalone ?? defaultLoadStandalone;
7087
+ standaloneCtx = await load({
7088
+ env: deps.env,
7089
+ cwd: deps.cwd,
7090
+ warn: (line) => io2.err(line),
7091
+ relayUrl
7092
+ });
7093
+ const identity = identityReport(standaloneCtx);
7094
+ if (identity.pubkey.toLowerCase() !== ctx.owner.toLowerCase()) {
7095
+ io2.err(
7096
+ `rig: only the repo owner (${ctx.owner.slice(0, 8)}\u2026) can change the payout pointer \u2014 the active identity is ${identity.pubkey.slice(0, 8)}\u2026. A non-owner republish would write your own (ignored) announcement. Nothing was published or paid.`
7097
+ );
7098
+ return 1;
7099
+ }
7100
+ const remote = await fetchRemoteState({
7101
+ relayUrls: [relayUrl],
7102
+ ownerPubkey: ctx.owner,
7103
+ repoId: ctx.repoId,
7104
+ ...deps.webSocketFactory ? { webSocketFactory: deps.webSocketFactory } : {}
7105
+ });
7106
+ if (!remote.announced) {
7107
+ io2.err(
7108
+ `rig: 30617:${ctx.owner.slice(0, 8)}\u2026:${ctx.repoId} has no announcement yet \u2014 run \`rig push\` to publish the repo (with its real name/description) before managing the payout pointer. Nothing was published or paid.`
7109
+ );
7110
+ return 1;
7111
+ }
7112
+ const current = remote.payout;
7113
+ if (nextPayout !== null && current !== null && current.chain === nextPayout.chain && current.address === nextPayout.address) {
7114
+ io2.err(
7115
+ `rig: payout is already set to ${current.chain} ${current.address} \u2014 nothing to do (not published).`
7116
+ );
7117
+ return 0;
7118
+ }
7119
+ if (op === "clear" && current === null) {
7120
+ io2.err("rig: no payout pointer is set \u2014 nothing to do (not published).");
7121
+ return 0;
7122
+ }
7123
+ const name = remote.name ?? ctx.repoId;
7124
+ const description = remote.description ?? "";
7125
+ const event = buildRepoAnnouncement(
7126
+ ctx.repoId,
7127
+ name,
7128
+ description,
7129
+ remote.maintainers,
7130
+ nextPayout
7131
+ );
7132
+ const fee = (await standaloneCtx.publisher.getFeeRates()).eventFee.toString();
7133
+ const action = nextPayout ? `kind:30617 payout set ${nextPayout.chain} ${nextPayout.address}` : "kind:30617 payout clear";
7134
+ if (!flags.json) {
7135
+ io2.out(`Republish ${action}`);
7136
+ io2.out(`Repo: 30617:${ctx.owner}:${ctx.repoId}`);
7137
+ io2.out(
7138
+ `Payout after: ${nextPayout ? `${nextPayout.chain} ${nextPayout.address}` : "(none)"}`
7139
+ );
7140
+ io2.out(`Fee: ${feeLabel(fee)}. Writes are permanent and non-refundable.`);
7141
+ }
7142
+ if (!flags.yes) {
7143
+ if (flags.json) {
7144
+ io2.emitJson({
7145
+ command,
7146
+ repoAddr: { ownerPubkey: ctx.owner, repoId: ctx.repoId },
7147
+ identity,
7148
+ executed: false,
7149
+ feeEstimate: fee,
7150
+ payout: nextPayout,
7151
+ hint: "estimate only \u2014 re-run with --yes to publish (permanent, non-refundable)"
7152
+ });
7153
+ return 0;
7154
+ }
7155
+ if (!io2.isInteractive) {
7156
+ io2.err(
7157
+ "refusing to spend channel funds without confirmation in a non-interactive session \u2014 re-run with --yes (or use --json for an estimate)"
7158
+ );
7159
+ return 1;
7160
+ }
7161
+ const proceed = await io2.confirm(
7162
+ `Proceed with paid republish (${feeLabel(fee)})? [y/N] `
7163
+ );
7164
+ if (!proceed) {
7165
+ io2.err("aborted \u2014 nothing was published.");
7166
+ return 1;
7167
+ }
7168
+ }
7169
+ const receipt = await standaloneCtx.publisher.publishEvent(event, [
7170
+ relayUrl
7171
+ ]);
7172
+ const result = serializeEventReceipt(event.kind, receipt);
7173
+ if (flags.json) {
7174
+ io2.emitJson({
7175
+ command,
7176
+ repoAddr: { ownerPubkey: ctx.owner, repoId: ctx.repoId },
7177
+ identity,
7178
+ executed: true,
7179
+ feeEstimate: fee,
7180
+ payout: nextPayout,
7181
+ result
7182
+ });
7183
+ } else {
7184
+ io2.out(
7185
+ `Published ${action}: ${result.eventId} paid ${result.feePaid} base units`
7186
+ );
7187
+ }
7188
+ return 0;
7189
+ } catch (err) {
7190
+ return emitCliError(io2, flags.json, command, err);
7191
+ } finally {
7192
+ if (standaloneCtx) {
7193
+ try {
7194
+ await standaloneCtx.stop();
7195
+ } catch {
7196
+ }
7197
+ }
7198
+ }
7199
+ }
7200
+
7201
+ // src/cli/site.ts
7202
+ import { parseArgs as parseArgs17 } from "util";
6890
7203
 
6891
7204
  // src/arweave-manifest.ts
6892
7205
  var DEFAULT_INDEX = "index.html";
@@ -6977,7 +7290,7 @@ Options (publish):
6977
7290
  estimate (nothing uploaded)
6978
7291
  -h, --help show this help`;
6979
7292
  function parseSiteArgs(args) {
6980
- const { values, positionals } = parseArgs16({
7293
+ const { values, positionals } = parseArgs17({
6981
7294
  args,
6982
7295
  options: {
6983
7296
  index: { type: "string" },
@@ -7389,17 +7702,22 @@ Commands rig owns:
7389
7702
  maintainers add <pubkey> remove republish the kind:30617 to change who may
7390
7703
  maintainers remove <pubkey> author authoritative issue/PR status (owner is
7391
7704
  always an implicit maintainer)
7705
+ payout show show the repo's declared payout pointer (free);
7706
+ payout set <address> set/clear republish the kind:30617 \u2014 no pointer
7707
+ payout clear means the serving node keeps 100% of
7708
+ repo-scoped write fees (v1: evm addresses only)
7392
7709
  fund drip devnet faucet funds to this identity's
7393
7710
  wallet (free); on other networks prints the
7394
7711
  address(es) to fund externally
7395
7712
  balance wallet balances + payment-channel holdings
7396
7713
  (free \u2014 chain reads and local state only)
7397
7714
  chain [set <c>|unset] choose which chain/USDC settles paid writes
7398
- (evm|sol|mina); free \u2014 reads/writes local config
7399
- entry [apex|sandbox|url] choose the network entry node (payment ingress +
7400
- relay): apex settles evm|sol|mina, sandbox is the
7401
- Mina-only multihop demo path; free \u2014 writes local
7402
- config and clears the cached topology
7715
+ (evm|sol); free \u2014 reads/writes local config
7716
+ entry <url> | entry clear choose the connector that prices and settles paid
7717
+ writes \u2014 one URL is the whole configuration, since
7718
+ its GET /ilp describes it; --relay <wss-url>
7719
+ records the free-read relay beside it; free \u2014
7720
+ writes local config
7403
7721
  name buy <name> ArNS naming (#367): buy points a human name at an
7404
7722
  name set <name> <txId> Arweave txId, owned + paid by this identity's
7405
7723
  name status <name> Solana key. buy spends mARIO on Solana via the
@@ -7446,7 +7764,11 @@ racing the channel. If a daemon is ALSO actively writing on this identity,
7446
7764
  stop it (its pid is in ~/.toon-client/daemon.pid) to avoid a claim race.`;
7447
7765
  function rigVersion() {
7448
7766
  const require2 = createRequire(import.meta.url);
7449
- for (const rel of ["../package.json", "../../package.json", "../../../package.json"]) {
7767
+ for (const rel of [
7768
+ "../package.json",
7769
+ "../../package.json",
7770
+ "../../../package.json"
7771
+ ]) {
7450
7772
  try {
7451
7773
  const pkg = require2(rel);
7452
7774
  if (pkg.name === "@toon-protocol/rig" && pkg.version) return pkg.version;
@@ -7482,6 +7804,8 @@ async function dispatch(argv2, deps) {
7482
7804
  return runPr(rest, deps);
7483
7805
  case "maintainers":
7484
7806
  return runMaintainers(rest, deps);
7807
+ case "payout":
7808
+ return runPayout(rest, deps);
7485
7809
  case "channel":
7486
7810
  return runChannel(rest, deps);
7487
7811
  case "channels":
@@ -7573,6 +7897,7 @@ var RIG_OWNED_VERBS = /* @__PURE__ */ new Set([
7573
7897
  "comment",
7574
7898
  "pr",
7575
7899
  "maintainers",
7900
+ "payout",
7576
7901
  "channel",
7577
7902
  "channels",
7578
7903
  "fund",