@toon-protocol/rig 3.6.0 → 4.1.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.
Files changed (37) hide show
  1. package/README.md +112 -153
  2. package/dist/{chunk-HJDPM37T.js → chunk-7VCVR4GK.js} +12 -8
  3. package/dist/{chunk-HJDPM37T.js.map → chunk-7VCVR4GK.js.map} +1 -1
  4. package/dist/chunk-CDSFVZDV.js +290 -0
  5. package/dist/chunk-CDSFVZDV.js.map +1 -0
  6. package/dist/{chunk-B5ISARMU.js → chunk-GVXBUL3C.js} +15 -2
  7. package/dist/chunk-GVXBUL3C.js.map +1 -0
  8. package/dist/chunk-LTFMPOHU.js +194 -0
  9. package/dist/chunk-LTFMPOHU.js.map +1 -0
  10. package/dist/{chunk-2KJJ7LSO.js → chunk-NCEMQUPA.js} +40 -2
  11. package/dist/chunk-NCEMQUPA.js.map +1 -0
  12. package/dist/{chunk-LCYCKWAT.js → chunk-YZRR2UO6.js} +86 -5
  13. package/dist/chunk-YZRR2UO6.js.map +1 -0
  14. package/dist/cli/rig.js +631 -568
  15. package/dist/cli/rig.js.map +1 -1
  16. package/dist/index.d.ts +10 -115
  17. package/dist/index.js +16 -122
  18. package/dist/index.js.map +1 -1
  19. package/dist/{publisher-BFcnZeJI.d.ts → publisher-DMJ06cuL.d.ts} +98 -2
  20. package/dist/standalone/index.d.ts +241 -438
  21. package/dist/standalone/index.js +19 -11
  22. package/dist/standalone-mode-KTYRTUS6.js +390 -0
  23. package/dist/standalone-mode-KTYRTUS6.js.map +1 -0
  24. package/package.json +7 -5
  25. package/dist/chunk-2KJJ7LSO.js.map +0 -1
  26. package/dist/chunk-B5ISARMU.js.map +0 -1
  27. package/dist/chunk-IZ6KLYQ6.js +0 -724
  28. package/dist/chunk-IZ6KLYQ6.js.map +0 -1
  29. package/dist/chunk-LCYCKWAT.js.map +0 -1
  30. package/dist/chunk-PWNZWQOH.js +0 -404
  31. package/dist/chunk-PWNZWQOH.js.map +0 -1
  32. package/dist/chunk-UZZ2RN7A.js +0 -469
  33. package/dist/chunk-UZZ2RN7A.js.map +0 -1
  34. package/dist/network-bootstrap-27FYE3N7.js +0 -40
  35. package/dist/network-bootstrap-27FYE3N7.js.map +0 -1
  36. package/dist/standalone-mode-5MNNJC2D.js +0 -928
  37. package/dist/standalone-mode-5MNNJC2D.js.map +0 -1
@@ -126,6 +126,42 @@ declare function parseMaintainers(tags: string[][]): string[];
126
126
  * `maintainers` tag). All values are lowercased hex.
127
127
  */
128
128
  declare function authorizedStatusAuthors(ownerPubkey: string, repoAnnouncementTags: string[][]): Set<string>;
129
+ /**
130
+ * NIP-34 tag naming the repo's declared payout pointer: a single
131
+ * `["payout", "<chain>", "<address>"]` tag on the kind:30617 announcement.
132
+ * No pointer → no split, the serving node keeps 100% of repo-scoped write
133
+ * fees (toon-meta#391 decision 2). The tag carries the chain label so the
134
+ * shape survives future chains, but v1 accepts exactly one: `evm` — the
135
+ * payout accrual ledger is EVM-only today
136
+ * (`crates/connector-client-edge/src/btp.rs:270-272`).
137
+ */
138
+ declare const PAYOUT_TAG = "payout";
139
+ /** Chains the payout pointer can target. v1: `evm` only (toon-meta#391). */
140
+ type PayoutChain = 'evm';
141
+ /** A repo's declared payout pointer (parsed from / built into the `payout` tag). */
142
+ interface PayoutPointer {
143
+ chain: PayoutChain;
144
+ /** EIP-55 checksummed address (never a raw lowercase/mixed-case echo). */
145
+ address: string;
146
+ }
147
+ /**
148
+ * True when `address` is a structurally valid, correctly-checksummed EVM
149
+ * address: `0x` + 40 hex chars, and — when mixed-case — a valid EIP-55
150
+ * checksum (an all-lowercase address is accepted as "unchecksummed").
151
+ */
152
+ declare function isValidEvmPayoutAddress(address: string): boolean;
153
+ /**
154
+ * Collect the repo's declared payout pointer from a kind:30617 event's tags.
155
+ * Only `["payout", "evm", <address>]` with a shape- and checksum-valid
156
+ * address is accepted; the address is normalized to its EIP-55 checksummed
157
+ * form. Tolerant of relay noise: an unsupported chain or malformed address
158
+ * is skipped (not thrown). The relay is permissionless and 30617 is
159
+ * replaceable, so a legacy/hand-crafted event could carry more than one
160
+ * `payout` tag — the first valid one wins and the rest are ignored (a
161
+ * `console.warn` notes the drop so a stray extra tag isn't silently
162
+ * mysterious).
163
+ */
164
+ declare function parsePayout(tags: string[][]): PayoutPointer | null;
129
165
  /**
130
166
  * Build a kind:30617 repository announcement event.
131
167
  *
@@ -137,8 +173,11 @@ declare function authorizedStatusAuthors(ownerPubkey: string, repoAnnouncementTa
137
173
  * values are dropped. The owner (the signer) is an implicit maintainer and
138
174
  * need not be listed — if passed it is emitted, which is harmless since the
139
175
  * owner is authorized regardless. See {@link MAINTAINERS_TAG}.
176
+ * @param payout - Optional declared payout pointer (rig#92). Emitted as a
177
+ * single `["payout", "evm", <address>]` tag when given; omit (or pass
178
+ * `null`) to leave the repo with no payout pointer. See {@link PAYOUT_TAG}.
140
179
  */
141
- declare function buildRepoAnnouncement(repoId: string, name: string, description: string, maintainers?: string[]): UnsignedEvent;
180
+ declare function buildRepoAnnouncement(repoId: string, name: string, description: string, maintainers?: string[], payout?: PayoutPointer | null): UnsignedEvent;
142
181
  /**
143
182
  * Build a kind:30618 repository refs/state event.
144
183
  *
@@ -281,6 +320,47 @@ interface PublishReceipt {
281
320
  /** Fee paid for this publish, in the smallest asset unit. */
282
321
  feePaid: bigint;
283
322
  }
323
+ /**
324
+ * One NIP-90 job for a store node's DVM, carried on the PAID path (#101).
325
+ *
326
+ * The store sits behind the connector's payment termination, so there is no
327
+ * public HTTP endpoint to POST these to — a reachable one would be an
328
+ * anonymous free gateway to a paid handler, which is the failure ADR 0020
329
+ * exists to close. The job therefore travels exactly as a kind:5094 store
330
+ * write does: inside a paid ILP packet, with `/store` as the envelope target
331
+ * BENEATH the route's handler path rather than as a URL path.
332
+ */
333
+ interface StoreJobRequest {
334
+ /** NIP-90 job kind — 5095 brokered ArNS buy, 5096 gas station. */
335
+ kind: number;
336
+ /** Job arguments, sent as `["param", key, value]` tags. */
337
+ params: [string, string][];
338
+ }
339
+ /**
340
+ * A store DVM's answer, opened from the sealed FULFILL.
341
+ *
342
+ * ⚠️ A refusal is a RESULT, not an error. Under ADR 0020 an HTTP status is
343
+ * envelope content and never a packet outcome, so `accept: false` arrives on a
344
+ * FULFILL and the payer was charged for it either way. Implementations must
345
+ * return it rather than throw: the zero-ARIO rehearsal (submit a buy with no
346
+ * `processId` and watch the handler refuse by name before it quotes or touches
347
+ * the registry) is the cheapest proof the whole paid path works, and it only
348
+ * works if the refusal comes back as data.
349
+ */
350
+ interface StoreJobResponse {
351
+ /** HTTP status the app answered with, inside the envelope. */
352
+ status: number;
353
+ /** The DVM's own accept flag. `false` is a refusal, not a transport fault. */
354
+ accept: boolean;
355
+ /** Machine-readable refusal reason, when the DVM sent one. */
356
+ code?: string;
357
+ /** Human-readable detail, when the DVM sent one. */
358
+ message?: string;
359
+ /** The job's output, shape depending on `kind`. */
360
+ result?: Record<string, unknown>;
361
+ /** Fee paid to carry this job, in the smallest asset unit. */
362
+ feePaid: bigint;
363
+ }
284
364
  /**
285
365
  * Fee rates used by `planPush` for the pre-push estimate.
286
366
  *
@@ -300,6 +380,12 @@ interface FeeRates {
300
380
  * price, so an estimate built from it is exactly what a push pays.
301
381
  */
302
382
  uploadFee: bigint;
383
+ /**
384
+ * The store route's per-kibibyte rate, when it meters by size (ADR 0065: a
385
+ * price is a schedule `{base, per_kib}`; a flat route has no slope). Absent
386
+ * or zero means every upload costs exactly `uploadFee`.
387
+ */
388
+ uploadPerKib?: bigint;
303
389
  /**
304
390
  * Flat cost per published event (smallest asset unit). Implementations
305
391
  * already fold any per-packet route-price floor into this flat value, so
@@ -328,6 +414,16 @@ interface Publisher {
328
414
  * implement it — `rig site` requires it and errors clearly when absent.
329
415
  */
330
416
  uploadBlob?(upload: BlobUpload): Promise<UploadReceipt>;
417
+ /**
418
+ * Submit one NIP-90 job to the store node's DVM over the paid path and
419
+ * return its answer; paid. Used by `rig name buy/set --via` (#101) for the
420
+ * brokered kind:5095 buy and the kind:5096 gas station.
421
+ *
422
+ * Optional for the same reason as {@link uploadBlob}: transports that only
423
+ * move git objects (and pre-#101 test fakes) need not implement it, and
424
+ * `rig name --via` errors clearly when it is absent.
425
+ */
426
+ submitStoreJob?(request: StoreJobRequest): Promise<StoreJobResponse>;
331
427
  /**
332
428
  * Sign (implementation-held key) and pay-to-publish one event to the
333
429
  * given relay(s).
@@ -335,4 +431,4 @@ interface Publisher {
335
431
  publishEvent(event: UnsignedEvent, relayUrls: string[]): Promise<PublishReceipt>;
336
432
  }
337
433
 
338
- export { type BlobUpload as B, COMMENT_KIND as C, type FeeRates as F, type GitObjectUpload as G, MAINTAINERS_TAG as M, type Publisher as P, REPOSITORY_STATE_KIND as R, type StatusKind as S, type UnsignedEvent as U, type UploadReceipt as a, type PublishReceipt as b, type GitObjectType as c, type GitObject as d, MAX_OBJECT_SIZE as e, authorizedStatusAuthors as f, buildComment as g, buildIssue as h, buildPatch as i, buildRepoAnnouncement as j, buildRepoRefs as k, buildStatus as l, createGitBlob as m, createGitCommit as n, createGitTag as o, createGitTree as p, hashGitObject as q, parseMaintainers as r };
434
+ export { type BlobUpload as B, COMMENT_KIND as C, type FeeRates as F, type GitObjectUpload as G, MAINTAINERS_TAG as M, type Publisher as P, REPOSITORY_STATE_KIND as R, type StoreJobRequest as S, type UploadReceipt as U, type StoreJobResponse as a, type UnsignedEvent as b, type PublishReceipt as c, type GitObjectType as d, type PayoutPointer as e, type GitObject as f, MAX_OBJECT_SIZE as g, PAYOUT_TAG as h, type PayoutChain as i, type StatusKind as j, authorizedStatusAuthors as k, buildComment as l, buildIssue as m, buildPatch as n, buildRepoAnnouncement as o, buildRepoRefs as p, buildStatus as q, createGitBlob as r, createGitCommit as s, createGitTag as t, createGitTree as u, hashGitObject as v, isValidEvmPayoutAddress as w, parseMaintainers as x, parsePayout as y };