@toon-protocol/rig 2.10.3 → 2.12.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/{chunk-RZLDFCKS.js → chunk-ACTH6ISJ.js} +82 -3
- package/dist/chunk-ACTH6ISJ.js.map +1 -0
- package/dist/cli/rig.js +287 -55
- package/dist/cli/rig.js.map +1 -1
- package/dist/{network-bootstrap-IHQ4PWUW.js → network-bootstrap-3X2GXNJB.js} +6 -2
- package/dist/{standalone-mode-YMIY4GL3.js → standalone-mode-U3OOSVOB.js} +53 -5
- package/dist/standalone-mode-U3OOSVOB.js.map +1 -0
- package/package.json +3 -3
- package/dist/chunk-RZLDFCKS.js.map +0 -1
- package/dist/standalone-mode-YMIY4GL3.js.map +0 -1
- /package/dist/{network-bootstrap-IHQ4PWUW.js.map → network-bootstrap-3X2GXNJB.js.map} +0 -0
package/dist/cli/rig.js
CHANGED
|
@@ -1074,7 +1074,7 @@ function loadPaidSession(deps, relayUrl) {
|
|
|
1074
1074
|
});
|
|
1075
1075
|
}
|
|
1076
1076
|
var defaultLoadStandalone = async (options) => {
|
|
1077
|
-
const mod = await import("../standalone-mode-
|
|
1077
|
+
const mod = await import("../standalone-mode-U3OOSVOB.js");
|
|
1078
1078
|
return mod.createStandaloneContext(options);
|
|
1079
1079
|
};
|
|
1080
1080
|
function identityReport(ctx) {
|
|
@@ -1712,8 +1712,236 @@ async function runBalance(args, deps) {
|
|
|
1712
1712
|
}
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
|
-
// src/cli/
|
|
1715
|
+
// src/cli/chain.ts
|
|
1716
|
+
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1717
|
+
import { homedir as homedir2 } from "os";
|
|
1718
|
+
import { dirname, join as join2 } from "path";
|
|
1716
1719
|
import { parseArgs as parseArgs4 } from "util";
|
|
1720
|
+
var FAMILY_USDC = {
|
|
1721
|
+
evm: "EVM USDC (Base Sepolia on devnet)",
|
|
1722
|
+
solana: "Solana USDC",
|
|
1723
|
+
mina: "Mina USDC"
|
|
1724
|
+
};
|
|
1725
|
+
var FAMILY_ALIASES = {
|
|
1726
|
+
evm: "evm",
|
|
1727
|
+
eth: "evm",
|
|
1728
|
+
sol: "solana",
|
|
1729
|
+
solana: "solana",
|
|
1730
|
+
mina: "mina"
|
|
1731
|
+
};
|
|
1732
|
+
var CHAIN_ARG_LIST = "evm | sol | solana | mina (or a full id like evm:base:84532)";
|
|
1733
|
+
var CHAIN_USAGE = `Usage: rig chain [set <chain> | unset]
|
|
1734
|
+
|
|
1735
|
+
Choose which chain \u2014 and therefore which USDC token \u2014 settles paid \`rig\`
|
|
1736
|
+
writes. The choice is saved to the client config's \`chain\` field and applies to
|
|
1737
|
+
every subsequent paid command (there is no per-command chain flag). Free: only
|
|
1738
|
+
the local config file is touched.
|
|
1739
|
+
|
|
1740
|
+
rig chain show the current settlement-chain preference
|
|
1741
|
+
rig chain set <chain> pin the settlement chain / USDC:
|
|
1742
|
+
evm \u2192 EVM USDC (Base Sepolia on devnet)
|
|
1743
|
+
sol \u2192 Solana USDC
|
|
1744
|
+
mina \u2192 Mina USDC
|
|
1745
|
+
(a full id like evm:base:84532 or solana:devnet also
|
|
1746
|
+
works; \`solana\` is accepted for \`sol\`, \`eth\` for \`evm\`)
|
|
1747
|
+
rig chain unset clear the pin \u2014 revert to automatic selection
|
|
1748
|
+
|
|
1749
|
+
When nothing is pinned, rig auto-selects: your most-recently-used open channel's
|
|
1750
|
+
chain, else the first announced chain your wallet holds USDC on, else the first
|
|
1751
|
+
announced EVM chain.
|
|
1752
|
+
|
|
1753
|
+
Options:
|
|
1754
|
+
--json machine-readable envelope
|
|
1755
|
+
-h, --help show this help`;
|
|
1756
|
+
function configPathFor(env) {
|
|
1757
|
+
const dir = env["TOON_CLIENT_HOME"] ?? join2(homedir2(), ".toon-client");
|
|
1758
|
+
return join2(dir, "config.json");
|
|
1759
|
+
}
|
|
1760
|
+
function readChainConfig(configPath) {
|
|
1761
|
+
try {
|
|
1762
|
+
return JSON.parse(readFileSync2(configPath, "utf8"));
|
|
1763
|
+
} catch (err) {
|
|
1764
|
+
if (err.code === "ENOENT") return {};
|
|
1765
|
+
throw new Error(
|
|
1766
|
+
`failed to read client config at ${configPath}: ${err instanceof Error ? err.message : String(err)}`
|
|
1767
|
+
);
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
function writeChainConfig(configPath, file) {
|
|
1771
|
+
mkdirSync2(dirname(configPath), { recursive: true });
|
|
1772
|
+
writeFileSync2(configPath, `${JSON.stringify(file, null, 2)}
|
|
1773
|
+
`, "utf8");
|
|
1774
|
+
}
|
|
1775
|
+
function normalizeChain(raw) {
|
|
1776
|
+
if (raw.includes(":")) {
|
|
1777
|
+
const family = raw.split(":")[0]?.toLowerCase() ?? "";
|
|
1778
|
+
if (!(family in FAMILY_USDC)) {
|
|
1779
|
+
throw new Error(
|
|
1780
|
+
`unknown chain family in ${JSON.stringify(raw)} \u2014 must start with evm:, solana:, or mina:`
|
|
1781
|
+
);
|
|
1782
|
+
}
|
|
1783
|
+
return raw;
|
|
1784
|
+
}
|
|
1785
|
+
const canonical = FAMILY_ALIASES[raw.toLowerCase()];
|
|
1786
|
+
if (!canonical) {
|
|
1787
|
+
throw new Error(`chain must be one of ${CHAIN_ARG_LIST}, got ${JSON.stringify(raw)}`);
|
|
1788
|
+
}
|
|
1789
|
+
return canonical;
|
|
1790
|
+
}
|
|
1791
|
+
function usdcFor(chain) {
|
|
1792
|
+
const family = (chain.includes(":") ? chain.split(":")[0] ?? chain : chain).toLowerCase();
|
|
1793
|
+
return FAMILY_USDC[family] ?? `${family} USDC`;
|
|
1794
|
+
}
|
|
1795
|
+
async function runChain(args, deps) {
|
|
1796
|
+
const { io: io2, env } = deps;
|
|
1797
|
+
let positionals;
|
|
1798
|
+
let json = false;
|
|
1799
|
+
try {
|
|
1800
|
+
const parsed = parseArgs4({
|
|
1801
|
+
args,
|
|
1802
|
+
allowPositionals: true,
|
|
1803
|
+
options: {
|
|
1804
|
+
json: { type: "boolean", default: false },
|
|
1805
|
+
help: { type: "boolean", short: "h", default: false }
|
|
1806
|
+
}
|
|
1807
|
+
});
|
|
1808
|
+
if (parsed.values.help) {
|
|
1809
|
+
io2.out(CHAIN_USAGE);
|
|
1810
|
+
return 0;
|
|
1811
|
+
}
|
|
1812
|
+
positionals = parsed.positionals;
|
|
1813
|
+
json = parsed.values.json ?? false;
|
|
1814
|
+
} catch (err) {
|
|
1815
|
+
io2.err(err instanceof Error ? err.message : String(err));
|
|
1816
|
+
io2.err(CHAIN_USAGE);
|
|
1817
|
+
return 2;
|
|
1818
|
+
}
|
|
1819
|
+
const [sub, ...subRest] = positionals;
|
|
1820
|
+
if (sub !== void 0 && sub !== "set" && sub !== "unset") {
|
|
1821
|
+
io2.err(`unknown subcommand ${JSON.stringify(sub)} \u2014 expected \`set\`, \`unset\`, or no argument`);
|
|
1822
|
+
io2.err(CHAIN_USAGE);
|
|
1823
|
+
return 2;
|
|
1824
|
+
}
|
|
1825
|
+
if (sub === "set" && subRest.length !== 1) {
|
|
1826
|
+
io2.err(
|
|
1827
|
+
subRest.length === 0 ? `rig chain set needs a chain: ${CHAIN_ARG_LIST}` : `rig chain set takes exactly one chain, got ${subRest.length}: ${subRest.join(" ")}`
|
|
1828
|
+
);
|
|
1829
|
+
io2.err(CHAIN_USAGE);
|
|
1830
|
+
return 2;
|
|
1831
|
+
}
|
|
1832
|
+
if (sub === "unset" && subRest.length !== 0) {
|
|
1833
|
+
io2.err(`rig chain unset takes no arguments, got: ${subRest.join(" ")}`);
|
|
1834
|
+
io2.err(CHAIN_USAGE);
|
|
1835
|
+
return 2;
|
|
1836
|
+
}
|
|
1837
|
+
let setValue;
|
|
1838
|
+
if (sub === "set") {
|
|
1839
|
+
try {
|
|
1840
|
+
setValue = normalizeChain(subRest[0]);
|
|
1841
|
+
} catch (err) {
|
|
1842
|
+
io2.err(err instanceof Error ? err.message : String(err));
|
|
1843
|
+
io2.err(CHAIN_USAGE);
|
|
1844
|
+
return 2;
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
try {
|
|
1848
|
+
const configPath = configPathFor(env);
|
|
1849
|
+
const file = readChainConfig(configPath);
|
|
1850
|
+
const envChain = env["TOON_CLIENT_CHAIN"];
|
|
1851
|
+
const supported0 = file.supportedChains?.[0];
|
|
1852
|
+
const precedenceWarnings = (targetField) => {
|
|
1853
|
+
const w = [];
|
|
1854
|
+
if (envChain !== void 0) {
|
|
1855
|
+
w.push(
|
|
1856
|
+
`TOON_CLIENT_CHAIN=${envChain} is set in the environment and overrides the config ${targetField === "chain" ? "value you just wrote" : "file"} \u2014 unset it for the config to take effect.`
|
|
1857
|
+
);
|
|
1858
|
+
}
|
|
1859
|
+
if (supported0 !== void 0) {
|
|
1860
|
+
w.push(
|
|
1861
|
+
`config \`supportedChains\` is set (first entry ${JSON.stringify(supported0)}) and takes precedence over \`chain\` \u2014 clear or reorder it for this pin to take effect.`
|
|
1862
|
+
);
|
|
1863
|
+
}
|
|
1864
|
+
return w;
|
|
1865
|
+
};
|
|
1866
|
+
if (sub === "set") {
|
|
1867
|
+
const value = setValue;
|
|
1868
|
+
file.chain = value;
|
|
1869
|
+
writeChainConfig(configPath, file);
|
|
1870
|
+
const warnings = precedenceWarnings("chain");
|
|
1871
|
+
if (json) {
|
|
1872
|
+
io2.emitJson({
|
|
1873
|
+
command: "chain",
|
|
1874
|
+
chain: envChain ?? value,
|
|
1875
|
+
source: envChain !== void 0 ? "env" : "config",
|
|
1876
|
+
usdc: usdcFor(envChain ?? value),
|
|
1877
|
+
wrote: value,
|
|
1878
|
+
configPath,
|
|
1879
|
+
...warnings.length ? { warnings } : {}
|
|
1880
|
+
});
|
|
1881
|
+
return 0;
|
|
1882
|
+
}
|
|
1883
|
+
io2.out(`Settlement chain set to ${value} \u2192 spends ${usdcFor(value)}.`);
|
|
1884
|
+
io2.out(`Saved to ${configPath}. Applies to the next paid command (e.g. \`rig push\`).`);
|
|
1885
|
+
for (const w of warnings) io2.err(`warning: ${w}`);
|
|
1886
|
+
return 0;
|
|
1887
|
+
}
|
|
1888
|
+
if (sub === "unset") {
|
|
1889
|
+
const had = file.chain;
|
|
1890
|
+
delete file.chain;
|
|
1891
|
+
writeChainConfig(configPath, file);
|
|
1892
|
+
const stillPinned = envChain ?? supported0;
|
|
1893
|
+
if (json) {
|
|
1894
|
+
io2.emitJson({
|
|
1895
|
+
command: "chain",
|
|
1896
|
+
chain: stillPinned ?? null,
|
|
1897
|
+
source: envChain !== void 0 ? "env" : supported0 !== void 0 ? "supportedChains" : "auto",
|
|
1898
|
+
usdc: stillPinned ? usdcFor(stillPinned) : null,
|
|
1899
|
+
wrote: null,
|
|
1900
|
+
configPath,
|
|
1901
|
+
...precedenceWarnings(null).length ? { warnings: precedenceWarnings(null) } : {}
|
|
1902
|
+
});
|
|
1903
|
+
return 0;
|
|
1904
|
+
}
|
|
1905
|
+
io2.out(
|
|
1906
|
+
had !== void 0 ? `Cleared the settlement-chain pin (was ${had}).` : "No settlement-chain pin was set."
|
|
1907
|
+
);
|
|
1908
|
+
if (stillPinned !== void 0) {
|
|
1909
|
+
io2.out(`Still pinned to ${stillPinned} by ${envChain !== void 0 ? "TOON_CLIENT_CHAIN" : "config supportedChains"} \u2192 ${usdcFor(stillPinned)}.`);
|
|
1910
|
+
} else {
|
|
1911
|
+
io2.out("Reverted to automatic selection (most-recent channel \u2192 first funded announced chain \u2192 first EVM).");
|
|
1912
|
+
}
|
|
1913
|
+
return 0;
|
|
1914
|
+
}
|
|
1915
|
+
const effective = envChain ?? file.chain ?? supported0;
|
|
1916
|
+
const source = envChain !== void 0 ? "env" : file.chain !== void 0 ? "config" : supported0 !== void 0 ? "supportedChains" : "auto";
|
|
1917
|
+
if (json) {
|
|
1918
|
+
io2.emitJson({
|
|
1919
|
+
command: "chain",
|
|
1920
|
+
chain: effective ?? null,
|
|
1921
|
+
source,
|
|
1922
|
+
usdc: effective ? usdcFor(effective) : null,
|
|
1923
|
+
configPath
|
|
1924
|
+
});
|
|
1925
|
+
return 0;
|
|
1926
|
+
}
|
|
1927
|
+
if (effective !== void 0) {
|
|
1928
|
+
const via = source === "env" ? "TOON_CLIENT_CHAIN env" : source === "config" ? `config \`chain\` (${configPath})` : `config \`supportedChains[0]\``;
|
|
1929
|
+
io2.out(`Settlement chain: ${effective} \u2192 spends ${usdcFor(effective)} (from ${via}).`);
|
|
1930
|
+
io2.out("Change it with `rig chain set <evm|sol|mina>`, or `rig chain unset` for auto.");
|
|
1931
|
+
} else {
|
|
1932
|
+
io2.out("Settlement chain: (auto) \u2014 no pin set.");
|
|
1933
|
+
io2.out("rig picks your most-recent open channel, else the first announced chain your");
|
|
1934
|
+
io2.out("wallet holds USDC on, else the first announced EVM chain.");
|
|
1935
|
+
io2.out("Pin one with `rig chain set <evm|sol|mina>`.");
|
|
1936
|
+
}
|
|
1937
|
+
return 0;
|
|
1938
|
+
} catch (err) {
|
|
1939
|
+
return emitCliError(io2, json, "chain", err);
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
// src/cli/channel.ts
|
|
1944
|
+
import { parseArgs as parseArgs5 } from "util";
|
|
1717
1945
|
var CHANNEL_USAGE = `Usage: rig channel <subcommand>
|
|
1718
1946
|
|
|
1719
1947
|
Manage the payment channels paid rig commands hold with relay/store peers.
|
|
@@ -1780,7 +2008,7 @@ function runChannelList(args, deps) {
|
|
|
1780
2008
|
const { io: io2, env } = deps;
|
|
1781
2009
|
let json = false;
|
|
1782
2010
|
try {
|
|
1783
|
-
const { values } =
|
|
2011
|
+
const { values } = parseArgs5({
|
|
1784
2012
|
args,
|
|
1785
2013
|
options: {
|
|
1786
2014
|
json: { type: "boolean", default: false },
|
|
@@ -1899,7 +2127,7 @@ async function runChannelOpen(args, deps) {
|
|
|
1899
2127
|
let yes = false;
|
|
1900
2128
|
let json = false;
|
|
1901
2129
|
try {
|
|
1902
|
-
const { values } =
|
|
2130
|
+
const { values } = parseArgs5({
|
|
1903
2131
|
args,
|
|
1904
2132
|
options: {
|
|
1905
2133
|
peer: { type: "string" },
|
|
@@ -2036,7 +2264,7 @@ async function runChannelWithdrawStep(args, deps, step) {
|
|
|
2036
2264
|
let yes = false;
|
|
2037
2265
|
let json = false;
|
|
2038
2266
|
try {
|
|
2039
|
-
const { values, positionals } =
|
|
2267
|
+
const { values, positionals } = parseArgs5({
|
|
2040
2268
|
args,
|
|
2041
2269
|
options: {
|
|
2042
2270
|
yes: { type: "boolean", default: false },
|
|
@@ -2177,8 +2405,8 @@ async function stopQuietly(ctx) {
|
|
|
2177
2405
|
|
|
2178
2406
|
// src/cli/clone.ts
|
|
2179
2407
|
import { mkdtemp, mkdir, readdir, rename, rm, rmdir } from "fs/promises";
|
|
2180
|
-
import { basename, dirname, join as
|
|
2181
|
-
import { parseArgs as
|
|
2408
|
+
import { basename, dirname as dirname2, join as join3, resolve } from "path";
|
|
2409
|
+
import { parseArgs as parseArgs6 } from "util";
|
|
2182
2410
|
var CLONE_USAGE = `Usage: rig clone <relay-url> <owner>/<repo-id> [dir] [options]
|
|
2183
2411
|
|
|
2184
2412
|
Clone a TOON repository \u2014 FREE (relay reads + Arweave gateway downloads; no
|
|
@@ -2219,7 +2447,7 @@ var MissingRemoteObjectsError = class extends Error {
|
|
|
2219
2447
|
};
|
|
2220
2448
|
var WS_URL_RE = /^wss?:\/\//i;
|
|
2221
2449
|
function parseCloneArgs(args) {
|
|
2222
|
-
const { values, positionals } =
|
|
2450
|
+
const { values, positionals } = parseArgs6({
|
|
2223
2451
|
args,
|
|
2224
2452
|
options: {
|
|
2225
2453
|
json: { type: "boolean", default: false },
|
|
@@ -2346,9 +2574,9 @@ async function runClone(args, deps) {
|
|
|
2346
2574
|
`warning: unreachable object ${sha} (tx ${txId}) could not be downloaded \u2014 not needed by any ref, continuing`
|
|
2347
2575
|
);
|
|
2348
2576
|
}
|
|
2349
|
-
const parent =
|
|
2577
|
+
const parent = dirname2(dest);
|
|
2350
2578
|
await mkdir(parent, { recursive: true });
|
|
2351
|
-
tempDir = await mkdtemp(
|
|
2579
|
+
tempDir = await mkdtemp(join3(parent, `.${basename(dest)}.rig-clone-`));
|
|
2352
2580
|
await runGit(tempDir, [
|
|
2353
2581
|
"init",
|
|
2354
2582
|
"--quiet",
|
|
@@ -2418,7 +2646,7 @@ async function runClone(args, deps) {
|
|
|
2418
2646
|
|
|
2419
2647
|
// src/cli/events.ts
|
|
2420
2648
|
import { readFile } from "fs/promises";
|
|
2421
|
-
import { parseArgs as
|
|
2649
|
+
import { parseArgs as parseArgs8 } from "util";
|
|
2422
2650
|
import {
|
|
2423
2651
|
REPOSITORY_ANNOUNCEMENT_KIND as REPOSITORY_ANNOUNCEMENT_KIND2,
|
|
2424
2652
|
STATUS_APPLIED_KIND as STATUS_APPLIED_KIND2,
|
|
@@ -2428,7 +2656,7 @@ import {
|
|
|
2428
2656
|
} from "@toon-protocol/core/nip34";
|
|
2429
2657
|
|
|
2430
2658
|
// src/cli/tracker.ts
|
|
2431
|
-
import { parseArgs as
|
|
2659
|
+
import { parseArgs as parseArgs7 } from "util";
|
|
2432
2660
|
import {
|
|
2433
2661
|
ISSUE_KIND,
|
|
2434
2662
|
PATCH_KIND,
|
|
@@ -2761,7 +2989,7 @@ async function runList(args, deps, spec) {
|
|
|
2761
2989
|
const { io: io2 } = deps;
|
|
2762
2990
|
let flags;
|
|
2763
2991
|
try {
|
|
2764
|
-
const { values, positionals } =
|
|
2992
|
+
const { values, positionals } = parseArgs7({
|
|
2765
2993
|
args,
|
|
2766
2994
|
options: TRACKER_OPTIONS,
|
|
2767
2995
|
allowPositionals: true
|
|
@@ -2825,7 +3053,7 @@ async function runShow(args, deps, spec) {
|
|
|
2825
3053
|
let flags;
|
|
2826
3054
|
let eventId;
|
|
2827
3055
|
try {
|
|
2828
|
-
const { values, positionals } =
|
|
3056
|
+
const { values, positionals } = parseArgs7({
|
|
2829
3057
|
args,
|
|
2830
3058
|
options: TRACKER_OPTIONS,
|
|
2831
3059
|
allowPositionals: true
|
|
@@ -3212,7 +3440,7 @@ async function runIssue(args, deps) {
|
|
|
3212
3440
|
let bodyFile;
|
|
3213
3441
|
let labels;
|
|
3214
3442
|
try {
|
|
3215
|
-
const { values } =
|
|
3443
|
+
const { values } = parseArgs8({
|
|
3216
3444
|
args: rest,
|
|
3217
3445
|
options: {
|
|
3218
3446
|
...COMMON_OPTIONS,
|
|
@@ -3288,7 +3516,7 @@ async function runComment(args, deps) {
|
|
|
3288
3516
|
let parentAuthor;
|
|
3289
3517
|
let marker;
|
|
3290
3518
|
try {
|
|
3291
|
-
const { values, positionals } =
|
|
3519
|
+
const { values, positionals } = parseArgs8({
|
|
3292
3520
|
args,
|
|
3293
3521
|
options: {
|
|
3294
3522
|
...COMMON_OPTIONS,
|
|
@@ -3388,7 +3616,7 @@ async function runPrCreate(rest, deps) {
|
|
|
3388
3616
|
let bodyFlag;
|
|
3389
3617
|
let bodyFile;
|
|
3390
3618
|
try {
|
|
3391
|
-
const { values } =
|
|
3619
|
+
const { values } = parseArgs8({
|
|
3392
3620
|
args: rest,
|
|
3393
3621
|
options: {
|
|
3394
3622
|
...COMMON_OPTIONS,
|
|
@@ -3516,7 +3744,7 @@ async function runPrStatus(args, deps) {
|
|
|
3516
3744
|
let targetEventId;
|
|
3517
3745
|
let status;
|
|
3518
3746
|
try {
|
|
3519
|
-
const { values, positionals } =
|
|
3747
|
+
const { values, positionals } = parseArgs8({
|
|
3520
3748
|
args,
|
|
3521
3749
|
options: COMMON_OPTIONS,
|
|
3522
3750
|
allowPositionals: true
|
|
@@ -3595,7 +3823,7 @@ async function warnIfNotMaintainer(deps, args) {
|
|
|
3595
3823
|
}
|
|
3596
3824
|
|
|
3597
3825
|
// src/cli/fetch.ts
|
|
3598
|
-
import { parseArgs as
|
|
3826
|
+
import { parseArgs as parseArgs9 } from "util";
|
|
3599
3827
|
var FETCH_USAGE = `Usage: rig fetch [remote] [options]
|
|
3600
3828
|
|
|
3601
3829
|
Fetch from a TOON remote \u2014 FREE (relay reads + Arweave gateway downloads; no
|
|
@@ -3649,7 +3877,7 @@ async function runFetch(args, deps) {
|
|
|
3649
3877
|
let ownerFlag;
|
|
3650
3878
|
let concurrency;
|
|
3651
3879
|
try {
|
|
3652
|
-
const { values, positionals } =
|
|
3880
|
+
const { values, positionals } = parseArgs9({
|
|
3653
3881
|
args,
|
|
3654
3882
|
options: {
|
|
3655
3883
|
json: { type: "boolean", default: false },
|
|
@@ -3814,10 +4042,10 @@ async function runFetch(args, deps) {
|
|
|
3814
4042
|
}
|
|
3815
4043
|
|
|
3816
4044
|
// src/cli/fund.ts
|
|
3817
|
-
import { readFileSync as
|
|
3818
|
-
import { homedir as
|
|
3819
|
-
import { join as
|
|
3820
|
-
import { parseArgs as
|
|
4045
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
4046
|
+
import { homedir as homedir3 } from "os";
|
|
4047
|
+
import { join as join4 } from "path";
|
|
4048
|
+
import { parseArgs as parseArgs10 } from "util";
|
|
3821
4049
|
var DEVNET_FAUCET_URL = "https://faucet.devnet.toonprotocol.dev";
|
|
3822
4050
|
var CHAINS = ["evm", "solana", "mina"];
|
|
3823
4051
|
var CHAIN_ALIASES = {
|
|
@@ -3828,13 +4056,13 @@ var CHAIN_ALIASES = {
|
|
|
3828
4056
|
mina: "mina",
|
|
3829
4057
|
all: "all"
|
|
3830
4058
|
};
|
|
3831
|
-
var
|
|
4059
|
+
var CHAIN_ARG_LIST2 = "evm | sol | solana | mina | all";
|
|
3832
4060
|
function resolveChainArg(raw) {
|
|
3833
4061
|
if (raw === void 0) return void 0;
|
|
3834
4062
|
const canonical = CHAIN_ALIASES[raw.toLowerCase()];
|
|
3835
4063
|
if (!canonical) {
|
|
3836
4064
|
throw new Error(
|
|
3837
|
-
`chain must be one of ${
|
|
4065
|
+
`chain must be one of ${CHAIN_ARG_LIST2}, got ${JSON.stringify(raw)}`
|
|
3838
4066
|
);
|
|
3839
4067
|
}
|
|
3840
4068
|
return canonical;
|
|
@@ -3921,11 +4149,11 @@ function noFaucetGuidance(network, devnetOrigin) {
|
|
|
3921
4149
|
return `${head}. If you meant the shared devnet, set TOON_CLIENT_NETWORK=devnet and re-run \`rig fund\` \u2014 no faucet URL is needed there. If this is a self-hosted network with its own faucet, set TOON_CLIENT_FAUCET_URL (or the faucetUrl config field). ${external}`;
|
|
3922
4150
|
}
|
|
3923
4151
|
function readFundConfig(env) {
|
|
3924
|
-
const dir = env["TOON_CLIENT_HOME"] ??
|
|
3925
|
-
const configPath =
|
|
4152
|
+
const dir = env["TOON_CLIENT_HOME"] ?? join4(homedir3(), ".toon-client");
|
|
4153
|
+
const configPath = join4(dir, "config.json");
|
|
3926
4154
|
try {
|
|
3927
4155
|
return {
|
|
3928
|
-
file: JSON.parse(
|
|
4156
|
+
file: JSON.parse(readFileSync3(configPath, "utf8")),
|
|
3929
4157
|
configPath
|
|
3930
4158
|
};
|
|
3931
4159
|
} catch (err) {
|
|
@@ -3943,7 +4171,7 @@ async function runFund(args, deps) {
|
|
|
3943
4171
|
let addressFlag;
|
|
3944
4172
|
let json = false;
|
|
3945
4173
|
try {
|
|
3946
|
-
const { values, positionals } =
|
|
4174
|
+
const { values, positionals } = parseArgs10({
|
|
3947
4175
|
args,
|
|
3948
4176
|
allowPositionals: true,
|
|
3949
4177
|
options: {
|
|
@@ -3973,7 +4201,7 @@ async function runFund(args, deps) {
|
|
|
3973
4201
|
json = values.json ?? false;
|
|
3974
4202
|
if (addressFlag !== void 0 && (resolvedChain === void 0 || resolvedChain === "all")) {
|
|
3975
4203
|
throw new Error(
|
|
3976
|
-
`--address requires an explicit single chain (${
|
|
4204
|
+
`--address requires an explicit single chain (${CHAIN_ARG_LIST2}) \u2014 a single address cannot fund every chain`
|
|
3977
4205
|
);
|
|
3978
4206
|
}
|
|
3979
4207
|
} catch (err) {
|
|
@@ -4165,10 +4393,10 @@ var runGitPassthrough = (argv2, options = {}) => {
|
|
|
4165
4393
|
};
|
|
4166
4394
|
|
|
4167
4395
|
// src/cli/identity-cmd.ts
|
|
4168
|
-
import { existsSync, mkdirSync as
|
|
4169
|
-
import { dirname as
|
|
4396
|
+
import { existsSync, mkdirSync as mkdirSync3 } from "fs";
|
|
4397
|
+
import { dirname as dirname3 } from "path";
|
|
4170
4398
|
import { createInterface } from "readline/promises";
|
|
4171
|
-
import { parseArgs as
|
|
4399
|
+
import { parseArgs as parseArgs11 } from "util";
|
|
4172
4400
|
async function loadKeyOps() {
|
|
4173
4401
|
return await import("@toon-protocol/client");
|
|
4174
4402
|
}
|
|
@@ -4217,7 +4445,7 @@ async function prepareKeystoreTarget(input) {
|
|
|
4217
4445
|
const envPassword = input.env["TOON_CLIENT_KEYSTORE_PASSWORD"]?.trim() || void 0;
|
|
4218
4446
|
const autoPassword = envPassword === void 0;
|
|
4219
4447
|
const password = envPassword ?? DEFAULT_KEYSTORE_PASSWORD;
|
|
4220
|
-
|
|
4448
|
+
mkdirSync3(dirname3(keystorePath), { recursive: true });
|
|
4221
4449
|
return { keystorePath, password, autoPassword, existing, keyOps };
|
|
4222
4450
|
}
|
|
4223
4451
|
function readAccountIndex(env) {
|
|
@@ -4339,7 +4567,7 @@ async function runIdentity(args, deps) {
|
|
|
4339
4567
|
}
|
|
4340
4568
|
}
|
|
4341
4569
|
function parseMintArgs(args, verb) {
|
|
4342
|
-
const { values, positionals } =
|
|
4570
|
+
const { values, positionals } = parseArgs11({
|
|
4343
4571
|
args,
|
|
4344
4572
|
options: {
|
|
4345
4573
|
force: { type: "boolean", default: false },
|
|
@@ -4444,7 +4672,7 @@ async function runIdentityShow(args, deps) {
|
|
|
4444
4672
|
let json = false;
|
|
4445
4673
|
let help = false;
|
|
4446
4674
|
try {
|
|
4447
|
-
const parsed =
|
|
4675
|
+
const parsed = parseArgs11({
|
|
4448
4676
|
args,
|
|
4449
4677
|
options: {
|
|
4450
4678
|
json: { type: "boolean", default: false },
|
|
@@ -4553,7 +4781,7 @@ async function defaultReadSecretLine(prompt, isInteractive) {
|
|
|
4553
4781
|
|
|
4554
4782
|
// src/cli/init.ts
|
|
4555
4783
|
import { basename as basename2 } from "path";
|
|
4556
|
-
import { parseArgs as
|
|
4784
|
+
import { parseArgs as parseArgs12 } from "util";
|
|
4557
4785
|
|
|
4558
4786
|
// src/cli/git-author.ts
|
|
4559
4787
|
var PROFILE_KIND = 0;
|
|
@@ -4671,7 +4899,7 @@ Options:
|
|
|
4671
4899
|
--json machine-readable report
|
|
4672
4900
|
-h, --help show this help`;
|
|
4673
4901
|
function parseInitArgs(args) {
|
|
4674
|
-
const { values, positionals } =
|
|
4902
|
+
const { values, positionals } = parseArgs12({
|
|
4675
4903
|
args,
|
|
4676
4904
|
options: {
|
|
4677
4905
|
"repo-id": { type: "string" },
|
|
@@ -4715,7 +4943,7 @@ async function resolveProfileRelay(flagRelay, originRelay, toonRelays) {
|
|
|
4715
4943
|
].filter((u) => u !== void 0 && isWebSocketRelay2(u));
|
|
4716
4944
|
if (candidates[0] !== void 0) return candidates[0];
|
|
4717
4945
|
try {
|
|
4718
|
-
const { loadGenesisSeed } = await import("../network-bootstrap-
|
|
4946
|
+
const { loadGenesisSeed } = await import("../network-bootstrap-3X2GXNJB.js");
|
|
4719
4947
|
const seed = loadGenesisSeed();
|
|
4720
4948
|
if (seed?.relayUrl && isWebSocketRelay2(seed.relayUrl)) return seed.relayUrl;
|
|
4721
4949
|
} catch {
|
|
@@ -4904,7 +5132,7 @@ async function runInit(args, deps) {
|
|
|
4904
5132
|
}
|
|
4905
5133
|
|
|
4906
5134
|
// src/cli/maintainers.ts
|
|
4907
|
-
import { parseArgs as
|
|
5135
|
+
import { parseArgs as parseArgs13 } from "util";
|
|
4908
5136
|
var HEX64_RE3 = /^[0-9a-f]{64}$/;
|
|
4909
5137
|
var WS_URL_RE4 = /^wss?:\/\//i;
|
|
4910
5138
|
var MAINTAINERS_USAGE = `Usage: rig maintainers <list|add|remove> [<pubkey>] [options]
|
|
@@ -5009,7 +5237,7 @@ async function runList2(args, deps) {
|
|
|
5009
5237
|
const { io: io2 } = deps;
|
|
5010
5238
|
let flags;
|
|
5011
5239
|
try {
|
|
5012
|
-
const { values, positionals } =
|
|
5240
|
+
const { values, positionals } = parseArgs13({
|
|
5013
5241
|
args,
|
|
5014
5242
|
options: MAINT_OPTIONS,
|
|
5015
5243
|
allowPositionals: true
|
|
@@ -5076,7 +5304,7 @@ async function runMutate(op, args, deps) {
|
|
|
5076
5304
|
let flags;
|
|
5077
5305
|
let pubkey;
|
|
5078
5306
|
try {
|
|
5079
|
-
const { values, positionals } =
|
|
5307
|
+
const { values, positionals } = parseArgs13({
|
|
5080
5308
|
args,
|
|
5081
5309
|
options: MAINT_OPTIONS,
|
|
5082
5310
|
allowPositionals: true
|
|
@@ -5225,7 +5453,7 @@ async function runMutate(op, args, deps) {
|
|
|
5225
5453
|
|
|
5226
5454
|
// src/cli/name.ts
|
|
5227
5455
|
import { randomUUID } from "crypto";
|
|
5228
|
-
import { parseArgs as
|
|
5456
|
+
import { parseArgs as parseArgs14 } from "util";
|
|
5229
5457
|
var ARIO_DECIMALS = 6;
|
|
5230
5458
|
function renderMario(mario) {
|
|
5231
5459
|
return `${mario.toString()} mARIO (~${formatUnits(mario.toString(), ARIO_DECIMALS)} ARIO)`;
|
|
@@ -5732,7 +5960,7 @@ async function resolveNameContext(deps, network, processId, mode) {
|
|
|
5732
5960
|
return { identity, solanaAddress, network, processId, sdk, nostrSecretKey };
|
|
5733
5961
|
}
|
|
5734
5962
|
function parseNameFlags(args, env) {
|
|
5735
|
-
const { values, positionals } =
|
|
5963
|
+
const { values, positionals } = parseArgs14({
|
|
5736
5964
|
args,
|
|
5737
5965
|
allowPositionals: true,
|
|
5738
5966
|
options: {
|
|
@@ -6222,7 +6450,7 @@ async function runName(args, deps) {
|
|
|
6222
6450
|
}
|
|
6223
6451
|
|
|
6224
6452
|
// src/cli/site.ts
|
|
6225
|
-
import { parseArgs as
|
|
6453
|
+
import { parseArgs as parseArgs15 } from "util";
|
|
6226
6454
|
|
|
6227
6455
|
// src/arweave-manifest.ts
|
|
6228
6456
|
var DEFAULT_INDEX = "index.html";
|
|
@@ -6241,22 +6469,22 @@ function buildArweaveManifest(entries, indexPath = DEFAULT_INDEX, fallbackTxId)
|
|
|
6241
6469
|
}
|
|
6242
6470
|
|
|
6243
6471
|
// src/cli/site-record.ts
|
|
6244
|
-
import { mkdirSync as
|
|
6245
|
-
import { homedir as
|
|
6246
|
-
import { join as
|
|
6472
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
6473
|
+
import { homedir as homedir4 } from "os";
|
|
6474
|
+
import { join as join5 } from "path";
|
|
6247
6475
|
var SITE_MANIFEST_FILENAME = "site-manifests.json";
|
|
6248
6476
|
function storeDir2(env) {
|
|
6249
|
-
return env["TOON_CLIENT_HOME"] ??
|
|
6477
|
+
return env["TOON_CLIENT_HOME"] ?? join5(homedir4(), ".toon-client");
|
|
6250
6478
|
}
|
|
6251
6479
|
function storePath2(env) {
|
|
6252
|
-
return
|
|
6480
|
+
return join5(storeDir2(env), SITE_MANIFEST_FILENAME);
|
|
6253
6481
|
}
|
|
6254
6482
|
function keyOf(repoId, ref) {
|
|
6255
6483
|
return `${repoId}\0${ref}`;
|
|
6256
6484
|
}
|
|
6257
6485
|
function readFile2(env) {
|
|
6258
6486
|
try {
|
|
6259
|
-
const parsed = JSON.parse(
|
|
6487
|
+
const parsed = JSON.parse(readFileSync4(storePath2(env), "utf8"));
|
|
6260
6488
|
if (parsed && typeof parsed === "object") return parsed;
|
|
6261
6489
|
return {};
|
|
6262
6490
|
} catch {
|
|
@@ -6268,10 +6496,10 @@ function readSiteRecord(env, repoId, ref) {
|
|
|
6268
6496
|
}
|
|
6269
6497
|
function writeSiteRecord(env, record) {
|
|
6270
6498
|
const dir = storeDir2(env);
|
|
6271
|
-
|
|
6499
|
+
mkdirSync4(dir, { recursive: true });
|
|
6272
6500
|
const file = readFile2(env);
|
|
6273
6501
|
file[keyOf(record.repoId, record.ref)] = record;
|
|
6274
|
-
|
|
6502
|
+
writeFileSync3(storePath2(env), `${JSON.stringify(file, null, 2)}
|
|
6275
6503
|
`, "utf8");
|
|
6276
6504
|
}
|
|
6277
6505
|
|
|
@@ -6313,7 +6541,7 @@ Options (publish):
|
|
|
6313
6541
|
estimate (nothing uploaded)
|
|
6314
6542
|
-h, --help show this help`;
|
|
6315
6543
|
function parseSiteArgs(args) {
|
|
6316
|
-
const { values, positionals } =
|
|
6544
|
+
const { values, positionals } = parseArgs15({
|
|
6317
6545
|
args,
|
|
6318
6546
|
options: {
|
|
6319
6547
|
index: { type: "string" },
|
|
@@ -6721,6 +6949,8 @@ Commands rig owns:
|
|
|
6721
6949
|
address(es) to fund externally
|
|
6722
6950
|
balance wallet balances + payment-channel holdings
|
|
6723
6951
|
(free \u2014 chain reads and local state only)
|
|
6952
|
+
chain [set <c>|unset] choose which chain/USDC settles paid writes
|
|
6953
|
+
(evm|sol|mina); free \u2014 reads/writes local config
|
|
6724
6954
|
name buy <name> ArNS naming (#367): buy points a human name at an
|
|
6725
6955
|
name set <name> <txId> Arweave txId, owned + paid by this identity's
|
|
6726
6956
|
name status <name> Solana key. buy spends mARIO on Solana via the
|
|
@@ -6796,6 +7026,8 @@ async function dispatch(argv2, deps) {
|
|
|
6796
7026
|
return runFund(rest, deps);
|
|
6797
7027
|
case "balance":
|
|
6798
7028
|
return runBalance(rest, deps);
|
|
7029
|
+
case "chain":
|
|
7030
|
+
return runChain(rest, deps);
|
|
6799
7031
|
case "name":
|
|
6800
7032
|
return runName(rest, deps);
|
|
6801
7033
|
case "help":
|