@toon-protocol/client 4.1.2 → 5.0.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.
@@ -32,7 +32,7 @@ import {
32
32
  resolveConfig,
33
33
  send,
34
34
  toEnvelopeRequest
35
- } from "./chunk-2FCRHYFJ.js";
35
+ } from "./chunk-PCPG4CIS.js";
36
36
  import "./chunk-WJKJ6Y4N.js";
37
37
  import "./chunk-32MD3CXE.js";
38
38
  export {
@@ -70,4 +70,4 @@ export {
70
70
  send,
71
71
  toEnvelopeRequest
72
72
  };
73
- //# sourceMappingURL=client-66Z6WVBV.js.map
73
+ //# sourceMappingURL=client-WCAXMQWM.js.map
package/dist/index.d.ts CHANGED
@@ -1218,7 +1218,7 @@ interface ChannelStoreEntry {
1218
1218
  * connector refused one. It means "our watermark and the connector's may
1219
1219
  * disagree", and the next claim on this channel reconciles against
1220
1220
  * `POST /ilp/claim-state` before it is signed. Persisted because a timeout in
1221
- * one `toon` invocation desyncs the next one.
1221
+ * one `toon-client` invocation desyncs the next one.
1222
1222
  */
1223
1223
  watermarkUncertain?: boolean;
1224
1224
  /** Unix SECONDS when close was initiated (withdraw flow). */
@@ -1591,7 +1591,7 @@ declare class BatchChannelManager {
1591
1591
  isClosing(channelId: string): boolean;
1592
1592
  /**
1593
1593
  * Every channel this client holds on `connector`, live or archived, with its
1594
- * exit state — what `toon channel settle` walks to take deposits back.
1594
+ * exit state — what `toon-client channel settle` walks to take deposits back.
1595
1595
  */
1596
1596
  channels(connector: string): {
1597
1597
  channel: BatchChannel;
@@ -3444,8 +3444,8 @@ interface ToonClientConfig {
3444
3444
  * connector it makes this client a hidden payer (TOON_Network#167): the
3445
3445
  * client edge, the BTP socket and each chain's RPC, on a pinned circuit per
3446
3446
  * chain, all ride it. Nothing falls back to a direct dial. `socks5://` is
3447
- * refused either way. This library never starts a daemon itself; the `toon`
3448
- * CLI will start one for you (ADR 0001).
3447
+ * refused either way. This library never starts a daemon itself; the
3448
+ * `toon-client` CLI will start one for you (ADR 0001).
3449
3449
  *
3450
3450
  * Node only: a browser cannot dial a hidden service by any route.
3451
3451
  */
package/dist/index.js CHANGED
@@ -223,7 +223,7 @@ import {
223
223
  trimTrailingSlashes,
224
224
  withRetry,
225
225
  withdrawSvmBatchChannel
226
- } from "./chunk-2FCRHYFJ.js";
226
+ } from "./chunk-PCPG4CIS.js";
227
227
  import {
228
228
  DEVNET,
229
229
  HS_HOSTNAME_MAX_LENGTH,
@@ -6,7 +6,7 @@ import {
6
6
  createChainRpcTransport,
7
7
  createHiddenServiceTransport,
8
8
  probeSocks5Proxy
9
- } from "./chunk-LJSOTVUT.js";
9
+ } from "./chunk-SIDK54Y5.js";
10
10
  import {
11
11
  validateSocks5hUrl
12
12
  } from "./chunk-32MD3CXE.js";
@@ -20,4 +20,4 @@ export {
20
20
  probeSocks5Proxy,
21
21
  validateSocks5hUrl
22
22
  };
23
- //# sourceMappingURL=socks-K6QOOWJ5.js.map
23
+ //# sourceMappingURL=socks-KNSFCLBG.js.map
@@ -6,7 +6,7 @@ import {
6
6
  createChainRpcTransport,
7
7
  createHiddenServiceTransport,
8
8
  probeSocks5Proxy
9
- } from "../chunk-LJSOTVUT.js";
9
+ } from "../chunk-SIDK54Y5.js";
10
10
  import {
11
11
  validateSocks5hUrl
12
12
  } from "../chunk-32MD3CXE.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toon-protocol/client",
3
- "version": "4.1.2",
3
+ "version": "5.0.0",
4
4
  "description": "TOON client: pay for HTTP requests per request over ILP, with EVM and Solana payment channels",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Green",
@@ -67,7 +67,7 @@
67
67
  "ws": "^8.19.0"
68
68
  },
69
69
  "bin": {
70
- "toon": "./dist/cli/main.js"
70
+ "toon-client": "./dist/cli/main.js"
71
71
  },
72
72
  "engines": {
73
73
  "node": ">=22"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/cli/anon-daemon.ts"],"sourcesContent":["/**\n * The managed `anon` daemon — the CLI's, and only the CLI's (ADR 0001).\n *\n * Reaching a hidden-service connector takes a running Anyone Protocol daemon and\n * a SOCKS port. `@toon-protocol/client` never provides one: a library that an\n * application embeds must not download and execute a binary at runtime. The\n * `toon` command may, because running it is already a decision to run our\n * executable — so this module lives under `src/cli/`, which is a separate build\n * entry that a library consumer never loads.\n *\n * The release is pinned and checksummed, and the gate fails **closed**: an asset\n * whose hash is unknown is not downloaded at all, rather than downloaded and\n * trusted. A platform we have no pinned hash for is a platform this command\n * cannot serve.\n */\nimport { createRequire } from 'node:module';\nimport type childProcessModule from 'node:child_process';\nimport type cryptoModule from 'node:crypto';\nimport type fsModule from 'node:fs';\nimport type httpsModule from 'node:https';\nimport type netModule from 'node:net';\nimport type osModule from 'node:os';\nimport type pathModule from 'node:path';\n\nconst nodeRequire = createRequire(import.meta.url);\n\n/**\n * The pinned `anon` release.\n *\n * `live` is the stable channel. There are newer `-beta` tags, and a payer should\n * not be shipped a beta daemon by default. The channel slug is embedded in every\n * asset name (`anon-live-linux-amd64.zip`), which is why it moves with the\n * version rather than being a separate knob.\n */\nexport const ANON_VERSION = 'v0.4.10.2';\n\nconst RELEASE_BASE = `https://github.com/anyone-protocol/ator-protocol/releases/download/${ANON_VERSION}`;\n\n/** One platform's release asset, and the hash it must have. */\nexport interface AnonAsset {\n assetName: string;\n /** sha256 of the zip, or `null` when unpinned — which refuses the download. */\n sha256: string | null;\n}\n\n/**\n * Platform → asset, keyed by `${os.platform()}-${os.arch()}`.\n *\n * Windows is here now: earlier versions of this map excluded it because no\n * Windows asset existed, and `v0.4.10.2` ships a signed one.\n */\nexport const ANON_ASSETS: Record<string, AnonAsset> = {\n 'linux-x64': {\n assetName: 'anon-live-linux-amd64.zip',\n sha256: '9c6498b8d27de54d78842a1b854979a605f9c140ccc34f2b4c267bf094eaeb17',\n },\n 'linux-arm64': {\n assetName: 'anon-live-linux-arm64.zip',\n sha256: 'daa3ed15f321d83f22b9c03fad2c0f908e60e3e156d143774bd38194244ebec9',\n },\n 'darwin-x64': {\n assetName: 'anon-live-macos-amd64.zip',\n sha256: '38b5b7ce1ed847e791e56697385365918fbcf81d08def0d389abd8e31e58b975',\n },\n 'darwin-arm64': {\n assetName: 'anon-live-macos-arm64.zip',\n sha256: '8f662cc5ecba27b5ec07dbed897894bd6f0e6c5ff33ca01f3a1d19544ac67866',\n },\n 'win32-x64': {\n assetName: 'anon-live-windows-signed-amd64.zip',\n sha256: 'e7352c4436e2043cfe505a35f1f412e01c72a5aa671cb85af2dcf97da83df4ab',\n },\n};\n\n/** The asset for a platform/arch pair, or an error naming what is supported. */\nexport function selectAnonAsset(platform: string, arch: string): AnonAsset {\n const asset = ANON_ASSETS[`${platform}-${arch}`];\n if (!asset) {\n throw new Error(\n `No pinned anon binary for ${platform}-${arch}. Supported: ` +\n `${Object.keys(ANON_ASSETS).join(', ')}. Run your own daemon and pass --socks instead.`\n );\n }\n return asset;\n}\n\n/** Where the binary and its data live between runs. */\nexport function defaultCacheDir(): string {\n const os = nodeRequire('node:os') as typeof osModule;\n const path = nodeRequire('node:path') as typeof pathModule;\n const xdg = process.env['XDG_CACHE_HOME'];\n return xdg\n ? path.join(xdg, 'toon', 'anon', ANON_VERSION)\n : path.join(os.homedir(), '.toon', 'anon', ANON_VERSION);\n}\n\n/**\n * A SOCKS-only torrc.\n *\n * `AgreeToTerms 1` is REQUIRED: without it `anon` exits immediately, and the\n * failure reads as \"the daemon died\" rather than \"you did not accept the terms\".\n */\nexport function renderTorrc(cacheDir: string, socksPort: number): string {\n const path = nodeRequire('node:path') as typeof pathModule;\n return [\n 'AgreeToTerms 1',\n `DataDirectory ${path.join(cacheDir, 'data')}`,\n `SOCKSPort 127.0.0.1:${socksPort}`,\n 'SOCKSPolicy accept *',\n `GeoIPFile ${path.join(cacheDir, 'geoip')}`,\n `GeoIPv6File ${path.join(cacheDir, 'geoip6')}`,\n 'Log notice stdout',\n 'RunAsDaemon 0',\n '',\n ].join('\\n');\n}\n\n/** A running daemon, and the way to stop it. */\nexport interface ManagedAnon {\n /** `socks5h://127.0.0.1:<port>` — what to configure a client with. */\n socksProxy: string;\n port: number;\n stop(): void;\n}\n\nexport interface StartManagedAnonOptions {\n cacheDir?: string;\n /** Where progress goes. The CLI passes something that prints. */\n log?: (message: string) => void;\n /** How long to wait for the SOCKS port to open. Default 90s. */\n bootstrapTimeoutMs?: number;\n}\n\n/**\n * Downloads (once), verifies, spawns and waits for `anon`.\n *\n * Announced, not silent: a first run downloads ~15MB and then waits for the\n * daemon to bootstrap, and an unexplained thirty-second pause reads as a hang.\n */\nexport async function startManagedAnon(options: StartManagedAnonOptions = {}): Promise<ManagedAnon> {\n const fs = nodeRequire('node:fs') as typeof fsModule;\n const path = nodeRequire('node:path') as typeof pathModule;\n const cp = nodeRequire('node:child_process') as typeof childProcessModule;\n\n const log = options.log ?? ((): void => undefined);\n const cacheDir = options.cacheDir ?? defaultCacheDir();\n const anonPath = await ensureAnonBinary(cacheDir, log);\n const port = await freePort();\n\n fs.mkdirSync(path.join(cacheDir, 'data'), { recursive: true, mode: 0o700 });\n const torrcPath = path.join(cacheDir, 'torrc');\n fs.writeFileSync(torrcPath, renderTorrc(cacheDir, port), { mode: 0o600 });\n\n log(`starting anon ${ANON_VERSION} on 127.0.0.1:${port} (${anonPath})`);\n const child = cp.spawn(anonPath, ['-f', torrcPath], { stdio: ['ignore', 'pipe', 'pipe'] });\n\n let exited = false;\n let lastLine = '';\n child.on('exit', () => {\n exited = true;\n });\n child.stdout?.on('data', (data: Buffer) => {\n lastLine = data.toString().trim().split('\\n').pop() ?? lastLine;\n });\n child.stderr?.on('data', (data: Buffer) => {\n lastLine = data.toString().trim().split('\\n').pop() ?? lastLine;\n });\n\n const stop = (): void => {\n if (!exited) child.kill('SIGTERM');\n };\n\n try {\n await waitForSocksPort(port, options.bootstrapTimeoutMs ?? 90_000, () => exited, () => lastLine);\n } catch (error) {\n stop();\n throw error;\n }\n\n log(`anon is listening; building circuits on demand`);\n return { socksProxy: `socks5h://127.0.0.1:${port}`, port, stop };\n}\n\n/** The binary's path, downloading and verifying it if this is the first run. */\nexport async function ensureAnonBinary(\n cacheDir: string,\n log: (message: string) => void = () => undefined\n): Promise<string> {\n const fs = nodeRequire('node:fs') as typeof fsModule;\n const path = nodeRequire('node:path') as typeof pathModule;\n const os = nodeRequire('node:os') as typeof osModule;\n\n const exe = os.platform() === 'win32' ? 'anon.exe' : 'anon';\n const anonPath = path.join(cacheDir, exe);\n if (fs.existsSync(anonPath)) return anonPath;\n\n const asset = selectAnonAsset(os.platform(), os.arch());\n if (asset.sha256 === null) {\n // Fail closed. An unpinned asset is one nobody has verified, and silently\n // skipping the check would make the gate decorative.\n throw new Error(\n `The anon asset ${asset.assetName} has no pinned checksum, so it will not be ` +\n 'downloaded. Run your own daemon and pass --socks.'\n );\n }\n\n fs.mkdirSync(cacheDir, { recursive: true });\n const zipPath = path.join(cacheDir, asset.assetName);\n const url = `${RELEASE_BASE}/${asset.assetName}`;\n log(`downloading ${asset.assetName} (${ANON_VERSION})…`);\n await downloadToFile(url, zipPath);\n\n const actual = await sha256File(zipPath);\n if (actual !== asset.sha256) {\n fs.rmSync(zipPath, { force: true });\n throw new Error(\n `Checksum mismatch for ${asset.assetName}: expected ${asset.sha256}, got ${actual}. ` +\n 'The download was discarded.'\n );\n }\n\n log('verified; extracting');\n await extractZip(zipPath, cacheDir);\n fs.rmSync(zipPath, { force: true });\n if (os.platform() !== 'win32') fs.chmodSync(anonPath, 0o755);\n return anonPath;\n}\n\n/** sha256 of a file, streamed — these zips are ~15MB. */\nasync function sha256File(filePath: string): Promise<string> {\n const fs = nodeRequire('node:fs') as typeof fsModule;\n const crypto = nodeRequire('node:crypto') as typeof cryptoModule;\n const hash = crypto.createHash('sha256');\n await new Promise<void>((resolve, reject) => {\n const stream = fs.createReadStream(filePath);\n stream.on('data', (chunk) => hash.update(chunk));\n stream.on('error', reject);\n stream.on('end', () => resolve());\n });\n return hash.digest('hex');\n}\n\n/** GitHub release assets redirect to a signed URL, so follow a few. */\nasync function downloadToFile(url: string, destPath: string): Promise<void> {\n const fs = nodeRequire('node:fs') as typeof fsModule;\n const https = nodeRequire('node:https') as typeof httpsModule;\n\n const once = (target: string, redirectsLeft: number): Promise<void> =>\n new Promise<void>((resolve, reject) => {\n const req = https.get(target, (res) => {\n const status = res.statusCode ?? 0;\n if (status >= 300 && status < 400 && res.headers.location) {\n res.resume();\n if (redirectsLeft <= 0) return reject(new Error(`Too many redirects downloading ${url}`));\n return resolve(once(res.headers.location, redirectsLeft - 1));\n }\n if (status !== 200) {\n res.resume();\n return reject(new Error(`Download failed (HTTP ${status}) for ${target}`));\n }\n const out = fs.createWriteStream(destPath);\n res.pipe(out);\n out.on('error', reject);\n out.on('finish', () => out.close(() => resolve()));\n });\n req.on('error', reject);\n req.setTimeout(120_000, () => req.destroy(new Error(`Download timeout for ${target}`)));\n });\n\n await once(url, 5);\n}\n\n/** No zip reader in Node, so borrow the platform's. */\nasync function extractZip(zipPath: string, destDir: string): Promise<void> {\n const cp = nodeRequire('node:child_process') as typeof childProcessModule;\n const os = nodeRequire('node:os') as typeof osModule;\n\n const [command, args] =\n os.platform() === 'win32'\n ? ([\n 'powershell',\n ['-NoProfile', '-Command', `Expand-Archive -Force -Path \"${zipPath}\" -DestinationPath \"${destDir}\"`],\n ] as const)\n : (['unzip', ['-o', zipPath, '-d', destDir]] as const);\n\n await new Promise<void>((resolve, reject) => {\n const child = cp.spawn(command, [...args], { stdio: ['ignore', 'ignore', 'pipe'] });\n let stderr = '';\n child.stderr?.on('data', (d: Buffer) => (stderr += d.toString()));\n child.on('error', (err: Error) =>\n reject(new Error(`Could not run ${command} to extract ${zipPath} (is it installed?): ${err.message}`))\n );\n child.on('exit', (code) =>\n code === 0 ? resolve() : reject(new Error(`${command} exited ${code} extracting ${zipPath}: ${stderr}`))\n );\n });\n}\n\n/** An unused loopback port, chosen by the OS. */\nasync function freePort(): Promise<number> {\n const net = nodeRequire('node:net') as typeof netModule;\n return new Promise<number>((resolve, reject) => {\n const server = net.createServer();\n server.on('error', reject);\n server.listen(0, '127.0.0.1', () => {\n const port = (server.address() as netModule.AddressInfo).port;\n server.close(() => resolve(port));\n });\n });\n}\n\n/**\n * Waits for the daemon to open its SOCKS port, and gives up early if it dies.\n *\n * A dead child is reported with its last log line, because \"anon exited\" alone\n * sends the reader looking in the wrong place — the actual reason is almost\n * always in that line.\n */\nasync function waitForSocksPort(\n port: number,\n timeoutMs: number,\n exited: () => boolean,\n lastLine: () => string\n): Promise<void> {\n const net = nodeRequire('node:net') as typeof netModule;\n const deadline = Date.now() + timeoutMs;\n\n const probe = (): Promise<boolean> =>\n new Promise((resolve) => {\n const socket = net.createConnection({ host: '127.0.0.1', port }, () => {\n socket.destroy();\n resolve(true);\n });\n socket.setTimeout(1000, () => {\n socket.destroy();\n resolve(false);\n });\n socket.on('error', () => {\n socket.destroy();\n resolve(false);\n });\n });\n\n while (Date.now() < deadline) {\n if (exited()) {\n throw new Error(`anon exited before opening its SOCKS port. Last log line: ${lastLine()}`);\n }\n if (await probe()) return;\n await new Promise((resolve) => setTimeout(resolve, 250));\n }\n throw new Error(\n `anon did not open a SOCKS port on 127.0.0.1:${port} within ${timeoutMs}ms. ` +\n `Last log line: ${lastLine()}`\n );\n}\n"],"mappings":";AAeA,SAAS,qBAAqB;AAS9B,IAAM,cAAc,cAAc,YAAY,GAAG;AAU1C,IAAM,eAAe;AAE5B,IAAM,eAAe,sEAAsE,YAAY;AAehG,IAAM,cAAyC;AAAA,EACpD,aAAa;AAAA,IACX,WAAW;AAAA,IACX,QAAQ;AAAA,EACV;AAAA,EACA,eAAe;AAAA,IACb,WAAW;AAAA,IACX,QAAQ;AAAA,EACV;AAAA,EACA,cAAc;AAAA,IACZ,WAAW;AAAA,IACX,QAAQ;AAAA,EACV;AAAA,EACA,gBAAgB;AAAA,IACd,WAAW;AAAA,IACX,QAAQ;AAAA,EACV;AAAA,EACA,aAAa;AA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