@toon-protocol/sdk 1.0.1 → 2.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.
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ import { NostrEvent, UnsignedEvent } from 'nostr-tools/pure';
4
4
  import { ToonRoutingMeta } from '@toon-protocol/core/toon';
5
5
  import { TransportConfig } from '@toon-protocol/connector';
6
6
  export { TransportConfig } from '@toon-protocol/connector';
7
- import { A as AccumulatedClaim } from './swap-D4Ozr_BM.js';
8
- export { D as DecryptFulfillClaimParams, E as EncryptFulfillClaimParams, a as EncryptFulfillClaimResult, P as PacketProgress, R as RateMonitorCallback, S as StreamSwapController, b as StreamSwapParams, c as StreamSwapResult, U as UnwrapSwapPacketFromToonParams, d as UnwrapSwapPacketParams, e as UnwrapSwapPacketResult, W as WrapSwapPacketParams, f as WrapSwapPacketResult, g as WrapSwapPacketToToonParams, h as WrapSwapPacketToToonResult, _ as __streamSwapTesting, i as decryptFulfillClaim, j as encryptFulfillClaim, s as streamSwap, k as streamSwapControlled, u as unwrapSwapPacket, l as unwrapSwapPacketFromToon, w as wrapSwapPacket, m as wrapSwapPacketToToon } from './swap-D4Ozr_BM.js';
7
+ import { A as AccumulatedClaim } from './swap-DF4ghKio.js';
8
+ export { D as DecryptFulfillClaimParams, E as EncryptFulfillClaimParams, a as EncryptFulfillClaimResult, P as PacketProgress, R as RateMonitorCallback, S as StreamSwapController, b as StreamSwapParams, c as StreamSwapResult, U as UnwrapSwapPacketFromToonParams, d as UnwrapSwapPacketParams, e as UnwrapSwapPacketResult, W as WrapSwapPacketParams, f as WrapSwapPacketResult, g as WrapSwapPacketToToonParams, h as WrapSwapPacketToToonResult, _ as __streamSwapTesting, i as decryptFulfillClaim, j as encryptFulfillClaim, s as streamSwap, k as streamSwapControlled, u as unwrapSwapPacket, l as unwrapSwapPacketFromToon, w as wrapSwapPacket, m as wrapSwapPacketToToon } from './swap-DF4ghKio.js';
9
9
 
10
10
  /**
11
11
  * Unified identity module for @toon-protocol/sdk.
@@ -173,7 +173,7 @@ declare class GiftWrapError extends ToonError {
173
173
  constructor(message: string, cause?: Error);
174
174
  }
175
175
  /**
176
- * Error thrown when Mill swap handler orchestration fails.
176
+ * Error thrown when swap handler orchestration fails.
177
177
  * Used for rate-conversion errors (invalid format, zero, overflow guards),
178
178
  * unsupported pair lookups, and issuer-boundary failures that are NOT
179
179
  * gift-wrap-specific. Gift-wrap failures continue to surface as `GiftWrapError`.
@@ -187,7 +187,7 @@ declare class SwapHandlerError extends ToonError {
187
187
  * All failures are categorized by a narrow `code` so callers can branch on
188
188
  * cause. `INVALID_*` codes are construction-time validation failures (thrown
189
189
  * synchronously before any packet fires). `FULFILL_DECODE_FAILED` surfaces
190
- * when the Mill returns `accepted: true` but the FULFILL data cannot be
190
+ * when the Swap returns `accepted: true` but the FULFILL data cannot be
191
191
  * decoded — this is a non-fatal per-packet error and is captured in
192
192
  * `StreamSwapResult.errors[]`.
193
193
  */
@@ -214,7 +214,7 @@ declare class StreamSwapError extends Error {
214
214
  * @stable — Epic 13 Chain Bridge DVM depends on this error shape.
215
215
  */
216
216
  declare class SettlementTxError extends Error {
217
- readonly code: 'INVALID_INPUT' | 'MISSING_SETTLEMENT_METADATA' | 'UNSUPPORTED_CHAIN' | 'MISSING_RECIPIENT' | 'RECIPIENT_MISMATCH' | 'MILL_SIGNER_MISMATCH' | 'DUPLICATE_NONCE' | 'NON_MONOTONIC_CUMULATIVE' | 'INVALID_SIGNATURE_LENGTH' | 'INVALID_SIGNATURE_V' | 'ENCODING_FAILED';
217
+ readonly code: 'INVALID_INPUT' | 'MISSING_SETTLEMENT_METADATA' | 'UNSUPPORTED_CHAIN' | 'MISSING_RECIPIENT' | 'RECIPIENT_MISMATCH' | 'SWAP_SIGNER_MISMATCH' | 'DUPLICATE_NONCE' | 'NON_MONOTONIC_CUMULATIVE' | 'INVALID_SIGNATURE_LENGTH' | 'INVALID_SIGNATURE_V' | 'ENCODING_FAILED';
218
218
  readonly cause?: unknown;
219
219
  constructor(code: SettlementTxError['code'], message: string, options?: {
220
220
  cause?: unknown;
@@ -395,18 +395,18 @@ declare function createPaymentHandlerBridge(config: PaymentHandlerBridgeConfig):
395
395
  * Event storage handler stub for @toon-protocol/sdk.
396
396
  *
397
397
  * This is a stub that throws. The real implementation lives in
398
- * `@toon-protocol/town` -- see `createEventStorageHandler` from that package.
398
+ * `@toon-protocol/relay` -- see `createEventStorageHandler` from that package.
399
399
  *
400
- * The SDK is the framework; Town is the relay implementation. SDK consumers
401
- * building relay functionality should use `@toon-protocol/town` directly.
400
+ * The SDK is the framework; Relay is the relay implementation. SDK consumers
401
+ * building relay functionality should use `@toon-protocol/relay` directly.
402
402
  */
403
403
  /**
404
404
  * Creates an event storage handler.
405
405
  *
406
- * **Stub** -- throws "not yet implemented". See `@toon-protocol/town` for the
406
+ * **Stub** -- throws "not yet implemented". See `@toon-protocol/relay` for the
407
407
  * real relay implementation of this handler.
408
408
  *
409
- * @see {@link https://github.com/ALLiDoizCode/toon/tree/main/packages/town | @toon-protocol/town}
409
+ * @see {@link https://github.com/toon-protocol/relay | @toon-protocol/relay}
410
410
  */
411
411
  declare function createEventStorageHandler(_config: unknown): unknown;
412
412
 
@@ -1358,7 +1358,7 @@ declare function uploadBlob(node: PublishableNode, blob: Buffer, destination: st
1358
1358
  declare function uploadBlobChunked(node: PublishableNode, blob: Buffer, destination: string, options: UploadBlobChunkedOptions): Promise<string>;
1359
1359
 
1360
1360
  /**
1361
- * Mill Swap Handler (Story 12.3)
1361
+ * Swap Handler (Story 12.3)
1362
1362
  *
1363
1363
  * `createSwapHandler()` factory produces a kind:1059 `Handler` that:
1364
1364
  * 1. Unwraps an incoming NIP-59 gift-wrapped ILP swap packet (via Story 12.2).
@@ -1381,7 +1381,7 @@ declare function uploadBlobChunked(node: PublishableNode, blob: Buffer, destinat
1381
1381
 
1382
1382
  /** Parameters passed to a {@link ClaimIssuer.issueClaim} call. */
1383
1383
  interface IssueClaimParams {
1384
- /** Source-asset amount received by the Mill (ILP packet amount, source micro-units). */
1384
+ /** Source-asset amount received by the Swap (ILP packet amount, source micro-units). */
1385
1385
  sourceAmount: bigint;
1386
1386
  /** Target-asset amount owed to the sender (post-rate-conversion, target micro-units). */
1387
1387
  targetAmount: bigint;
@@ -1390,9 +1390,9 @@ interface IssueClaimParams {
1390
1390
  /**
1391
1391
  * The sender's real Nostr pubkey (extracted from the unwrapped seal).
1392
1392
  *
1393
- * Identity-layer key only: used by the Mill for inventory ledger keying and
1393
+ * Identity-layer key only: used by the Swap for inventory ledger keying and
1394
1394
  * the sender→channel sticky binding (`channelState.reserve()` /
1395
- * `channelState.release()`). The Mill MUST NOT pass this to chain-layer
1395
+ * `channelState.release()`). The Swap MUST NOT pass this to chain-layer
1396
1396
  * signers as the balance-proof `recipient` — use {@link chainRecipient}
1397
1397
  * for that (Story 12.9 D12-011).
1398
1398
  */
@@ -1401,11 +1401,11 @@ interface IssueClaimParams {
1401
1401
  * The sender's chain-specific payout address for `pair.to.chain`
1402
1402
  * (Story 12.9 AC-10). Extracted and format-validated from the rumor's
1403
1403
  * `chain-recipient` tag by the swap handler. REQUIRED. This is the
1404
- * address the Mill's `PaymentChannelSigner` MUST use as the balance-proof
1404
+ * address the Swap's `PaymentChannelSigner` MUST use as the balance-proof
1405
1405
  * `recipient` (e.g., 20-byte EVM address, 32-byte Solana Ed25519 pubkey).
1406
1406
  */
1407
1407
  chainRecipient: string;
1408
- /** The inner rumor (for optional Mill-side context; may be ignored by the issuer). */
1408
+ /** The inner rumor (for optional Swap-side context; may be ignored by the issuer). */
1409
1409
  rumor: UnsignedEvent;
1410
1410
  }
1411
1411
  /**
@@ -1418,7 +1418,7 @@ interface IssueClaimParams {
1418
1418
  interface IssueClaimResult {
1419
1419
  /** Signed claim bytes ready for NIP-44 encryption (chain-specific format). */
1420
1420
  claim: Uint8Array;
1421
- /** Optional Mill-side claim ID for logging/tracing. */
1421
+ /** Optional Swap-side claim ID for logging/tracing. */
1422
1422
  claimId?: string;
1423
1423
  /** Channel identifier on the target chain. */
1424
1424
  channelId?: string;
@@ -1428,8 +1428,8 @@ interface IssueClaimResult {
1428
1428
  cumulativeAmount?: bigint;
1429
1429
  /** Recipient address (the sender's target-asset address). */
1430
1430
  recipient?: string;
1431
- /** Mill's on-chain signer address. */
1432
- millSignerAddress?: string;
1431
+ /** Swap's on-chain signer address. */
1432
+ swapSignerAddress?: string;
1433
1433
  }
1434
1434
  /**
1435
1435
  * Pluggable signed-claim issuer. Story 12.3 defines only the contract — the
@@ -1438,7 +1438,7 @@ interface IssueClaimResult {
1438
1438
  * The issuer owns inventory accounting and signing-key material. The handler
1439
1439
  * relies on `issueClaim()` being atomic with inventory debit: if the call
1440
1440
  * resolves, the target-asset amount MUST be considered committed from the
1441
- * Mill's reserves. If the call throws, no inventory change SHOULD have occurred.
1441
+ * Swap's reserves. If the call throws, no inventory change SHOULD have occurred.
1442
1442
  */
1443
1443
  interface ClaimIssuer {
1444
1444
  /**
@@ -1482,9 +1482,9 @@ interface SeenPacketIdsLike {
1482
1482
  }
1483
1483
  /** Configuration for {@link createSwapHandler}. */
1484
1484
  interface CreateSwapHandlerConfig {
1485
- /** Mill's secp256k1 secret key for unwrapping gift-wrapped packets (32 bytes). */
1485
+ /** Swap's secp256k1 secret key for unwrapping gift-wrapped packets (32 bytes). */
1486
1486
  recipientSecretKey: Uint8Array;
1487
- /** Swap pairs this Mill currently supports. */
1487
+ /** Swap pairs this Swap currently supports. */
1488
1488
  swapPairs: SwapPair[];
1489
1489
  /** Claim issuer delegate (Story 12.4 plugs in the multi-chain implementation). */
1490
1490
  claimIssuer: ClaimIssuer;
@@ -1524,11 +1524,11 @@ declare const SWAP_HANDLER_REJECT_CODES: {
1524
1524
  readonly UNREACHABLE: "F02";
1525
1525
  /** Duplicate packet — `seenPacketIds` replay hit. */
1526
1526
  readonly DUPLICATE_PACKET: "F04";
1527
- /** Requested swap pair is not advertised by this Mill. */
1527
+ /** Requested swap pair is not advertised by this Swap. */
1528
1528
  readonly UNSUPPORTED_PAIR: "F06";
1529
1529
  /** Transient internal failure — signing, rate provider, or unexpected. */
1530
1530
  readonly INTERNAL: "T00";
1531
- /** Insufficient Mill inventory for the requested amount. */
1531
+ /** Insufficient Swap inventory for the requested amount. */
1532
1532
  readonly INSUFFICIENT_LIQUIDITY: "T04";
1533
1533
  };
1534
1534
  /**
@@ -1553,7 +1553,7 @@ declare const SWAP_HANDLER_REJECT_MESSAGES: {
1553
1553
  * Uses BigInt arithmetic throughout — never coerces to `Number` — to preserve
1554
1554
  * 18-decimal EVM precision (Epic 11 retro MAX_SAFE_INTEGER guard).
1555
1555
  *
1556
- * Rounds toward zero (integer division), which economically favors the Mill
1556
+ * Rounds toward zero (integer division), which economically favors the Swap
1557
1557
  * (standard market-maker convention).
1558
1558
  *
1559
1559
  * @throws {SwapHandlerError} If rate format is invalid, rate is zero, or
@@ -1570,7 +1570,7 @@ declare function applyRate(params: ApplyRateParams): bigint;
1570
1570
  */
1571
1571
  declare function findSwapPair(rumor: UnsignedEvent, pairs: SwapPair[]): SwapPair | null;
1572
1572
  /**
1573
- * Construct a kind:1059 Mill inbound-swap handler.
1573
+ * Construct a kind:1059 Swap inbound-swap handler.
1574
1574
  *
1575
1575
  * The returned `Handler` is a pure closure over `config`; two calls with the
1576
1576
  * same config yield two independent-but-equivalent handlers. Register via
@@ -1586,9 +1586,9 @@ declare function createSwapHandler(config: CreateSwapHandlerConfig): Handler;
1586
1586
  *
1587
1587
  * ## What is implemented (and unit-tested)
1588
1588
  *
1589
- * - {@link verifyMinaSignature}: verifies the Mill's off-chain balance-proof
1589
+ * - {@link verifyMinaSignature}: verifies the Swap's off-chain balance-proof
1590
1590
  * signature using `mina-signer` (`verifyFields`). This is the EXACT inverse
1591
- * of the Mill's {@link MinaPaymentChannelSigner} (`packages/mill/src/payment-channel-signer.ts`),
1591
+ * of the Swap's {@link MinaPaymentChannelSigner} (`packages/swap/src/payment-channel-signer.ts`),
1592
1592
  * which signs `balanceProofFieldsMina(channelId, cumulativeAmount, nonce, recipient)`
1593
1593
  * via `mina-signer`'s `signFields` and emits the base58 signature string as
1594
1594
  * the claim's `claimBytes` (UTF-8). The field-element derivation lives in
@@ -1614,10 +1614,10 @@ declare function createSwapHandler(config: CreateSwapHandlerConfig): Handler;
1614
1614
  * generate the proof + broadcast. See the on-chain settlement note below
1615
1615
  * (connector 3.8.1 wires the dual-party claim path — connector#84).
1616
1616
  *
1617
- * Note also: the Mill↔sender wire proof here (a Schnorr signature over four
1617
+ * Note also: the Swap↔sender wire proof here (a Schnorr signature over four
1618
1618
  * field elements) is a DIFFERENT object than the connector's on-chain
1619
1619
  * `MinaPaymentChannelSDK` Poseidon-commitment proof shape
1620
- * (`{ commitment, signature, nonce }`). The verifier matches the Mill's
1620
+ * (`{ commitment, signature, nonce }`). The verifier matches the Swap's
1621
1621
  * actual emitted format (`MinaPaymentChannelSigner`), which is what a sender
1622
1622
  * receives on-wire.
1623
1623
  *
@@ -1654,8 +1654,8 @@ declare function loadMinaSignerClient(): Promise<MinaSignerClientLike | undefine
1654
1654
  * `AccumulatedClaim`.
1655
1655
  *
1656
1656
  * Re-derives the signed field-element message via {@link balanceProofFieldsMina}
1657
- * (identical to the Mill signer), decodes the claim's `claimBytes` to the
1658
- * base58 signature string the Mill emitted, and verifies it against
1657
+ * (identical to the Swap signer), decodes the claim's `claimBytes` to the
1658
+ * base58 signature string the Swap emitted, and verifies it against
1659
1659
  * `expectedSignerAddress` using a `mina-signer` `Client`.
1660
1660
  *
1661
1661
  * `client` MUST be a pre-loaded `mina-signer` `Client` (see
@@ -1700,8 +1700,8 @@ interface SettlementBundle {
1700
1700
  nonce: string;
1701
1701
  /** Recipient address (the sender's target-asset address — the one that will receive funds). */
1702
1702
  recipient: string;
1703
- /** Mill's on-chain signer address (expected signer of the balance-proof signature). */
1704
- millSignerAddress: string;
1703
+ /** Swap's on-chain signer address (expected signer of the balance-proof signature). */
1704
+ swapSignerAddress: string;
1705
1705
  /**
1706
1706
  * Raw UNSIGNED transaction bytes ready for the caller to sign (or for a
1707
1707
  * Chain Bridge DVM to gas-sponsor + sign). EVM: RLP-encoded tx with
@@ -1733,13 +1733,13 @@ interface SettlementBundle {
1733
1733
  sourceAssetCode: string;
1734
1734
  }
1735
1735
  /**
1736
- * Per-chain Mill signer configuration.
1736
+ * Per-chain Swap signer configuration.
1737
1737
  *
1738
1738
  * @since 12.6
1739
1739
  */
1740
- interface MillSignerConfig {
1740
+ interface SwapSignerConfig {
1741
1741
  /**
1742
- * Expected on-chain signer address for the Mill. EVM: 0x + 40 lowercase
1742
+ * Expected on-chain signer address for the Swap. EVM: 0x + 40 lowercase
1743
1743
  * hex chars. Solana: base58-encoded 32-byte Ed25519 pubkey. Mina: base58 pubkey.
1744
1744
  */
1745
1745
  address: string;
@@ -1765,8 +1765,8 @@ interface MillSignerConfig {
1765
1765
  interface BuildSettlementTxParams {
1766
1766
  /** Claims to settle. Typically `streamSwapResult.claims`. MUST be non-empty. */
1767
1767
  claims: readonly AccumulatedClaim[];
1768
- /** Per-chain Mill signer configuration. Keyed by `claim.pair.to.chain`. */
1769
- signers: Record<string, MillSignerConfig>;
1768
+ /** Per-chain Swap signer configuration. Keyed by `claim.pair.to.chain`. */
1769
+ signers: Record<string, SwapSignerConfig>;
1770
1770
  /** Sender's target-asset address per chain. Keyed by `claim.pair.to.chain`. */
1771
1771
  recipients: Record<string, string>;
1772
1772
  /** When `true` (default), verify every claim's signature against `signers[chain].address`. */
@@ -1831,7 +1831,7 @@ declare function fillEvmSettlementTxGas(bundle: SettlementBundle, gas: {
1831
1831
  nonce: bigint;
1832
1832
  gasPrice: bigint;
1833
1833
  gasLimit: bigint;
1834
- }, signer: MillSignerConfig): Uint8Array;
1834
+ }, signer: SwapSignerConfig): Uint8Array;
1835
1835
 
1836
1836
  /**
1837
1837
  * `buildSettlementTx()` — public entrypoint for Story 12.6.
@@ -1854,7 +1854,7 @@ declare function fillEvmSettlementTxGas(bundle: SettlementBundle, gas: {
1854
1854
  * 2. Optionally verify each claim's signature. Rejected claims land in
1855
1855
  * `result.rejected[]` and are dropped from further processing.
1856
1856
  * 3. Group surviving claims by `(chain, channelId)`. Within each group,
1857
- * assert recipient + millSignerAddress consensus, unique nonces, and
1857
+ * assert recipient + swapSignerAddress consensus, unique nonces, and
1858
1858
  * non-decreasing cumulativeAmount with nonce.
1859
1859
  * 4. Pick the winning claim per group (highest nonce).
1860
1860
  * 5. Dispatch each winner to its chain-specific tx builder.
@@ -1871,7 +1871,7 @@ declare function fillEvmSettlementTxGas(bundle: SettlementBundle, gas: {
1871
1871
  * claims: result.claims,
1872
1872
  * signers: {
1873
1873
  * 'evm:base:8453': {
1874
- * address: '0xmill...',
1874
+ * address: '0xswap...',
1875
1875
  * contractAddress: '0xtokennetwork...',
1876
1876
  * chainId: 8453,
1877
1877
  * },
@@ -1884,7 +1884,7 @@ declare function fillEvmSettlementTxGas(bundle: SettlementBundle, gas: {
1884
1884
  declare function buildSettlementTx(params: BuildSettlementTxParams): BuildSettlementTxResult;
1885
1885
  /**
1886
1886
  * Standalone utility: verify a single `AccumulatedClaim`'s signature against
1887
- * a `MillSignerConfig` without running the full grouping/winner pipeline.
1887
+ * a `SwapSignerConfig` without running the full grouping/winner pipeline.
1888
1888
  *
1889
1889
  * Useful inside a `streamSwap()` `onPacket` callback for mid-stream claim
1890
1890
  * validation.
@@ -1897,7 +1897,7 @@ declare function buildSettlementTx(params: BuildSettlementTxParams): BuildSettle
1897
1897
  * @stable
1898
1898
  * @since 12.6
1899
1899
  */
1900
- declare function verifyAccumulatedClaim(claim: AccumulatedClaim, signer: MillSignerConfig, minaSignerClient?: MinaSignerClientLike): {
1900
+ declare function verifyAccumulatedClaim(claim: AccumulatedClaim, signer: SwapSignerConfig, minaSignerClient?: MinaSignerClientLike): {
1901
1901
  valid: true;
1902
1902
  } | {
1903
1903
  valid: false;
@@ -1921,30 +1921,30 @@ declare function verifyAccumulatedClaim(claim: AccumulatedClaim, signer: MillSig
1921
1921
  declare function verifyEd25519Signature(claim: AccumulatedClaim, expectedSignerAddress: string): boolean;
1922
1922
 
1923
1923
  /**
1924
- * DvmHealthResponse — canonical type for the DVM BLS health endpoint.
1925
- * Exported from @toon-protocol/sdk so Townhouse and the entrypoint share
1926
- * the same definition (mirrors MillHealthResponse from @toon-protocol/mill).
1924
+ * StoreHealthResponse — canonical type for the Store BLS health endpoint.
1925
+ * Exported from @toon-protocol/sdk so the node and the entrypoint share
1926
+ * the same definition (mirrors SwapHealthResponse from @toon-protocol/swap).
1927
1927
  */
1928
1928
  /** Per-kind job count for jobsRecent.byKind */
1929
- interface DvmJobsByKindEntry {
1929
+ interface StoreJobsByKindEntry {
1930
1930
  kind: number;
1931
1931
  count: number;
1932
1932
  }
1933
1933
  /** Per-status job counts for the sliding window */
1934
- interface DvmJobsByStatus {
1934
+ interface StoreJobsByStatus {
1935
1935
  processing: number;
1936
1936
  success: number;
1937
1937
  error: number;
1938
1938
  partial: number;
1939
1939
  }
1940
1940
  /** Windowed recent-jobs telemetry (default window: 5 min) */
1941
- interface DvmJobsRecent {
1941
+ interface StoreJobsRecent {
1942
1942
  total: number;
1943
- byKind: DvmJobsByKindEntry[];
1944
- byStatus: DvmJobsByStatus;
1943
+ byKind: StoreJobsByKindEntry[];
1944
+ byStatus: StoreJobsByStatus;
1945
1945
  }
1946
- /** Response shape for GET /health on the DVM BLS server (port 3400). */
1947
- interface DvmHealthResponse {
1946
+ /** Response shape for GET /health on the Store BLS server (port 3400). */
1947
+ interface StoreHealthResponse {
1948
1948
  status: 'starting' | 'ok' | 'stopping' | 'stopped' | 'error';
1949
1949
  version: string;
1950
1950
  nodePubkey: string;
@@ -1954,7 +1954,7 @@ interface DvmHealthResponse {
1954
1954
  /** Per-kind pricing in string-encoded bigint (e.g. { "5094": "10", "5250": "10000" }). */
1955
1955
  kindPricing: Record<string, string>;
1956
1956
  basePricePerByte: string;
1957
- jobsRecent: DvmJobsRecent;
1957
+ jobsRecent: StoreJobsRecent;
1958
1958
  }
1959
1959
 
1960
- export { AccumulatedClaim, type AddChunkResult, type ApplyRateParams, type ArweaveDvmConfig, type ArweaveUploadAdapter, type BuildSettlementTxParams, type BuildSettlementTxResult, type BuildSkillDescriptorConfig, ChunkManager, type ChunkManagerConfig, type ClaimIssuer, type CreateHandlerContextOptions, type CreateSwapHandlerConfig, type DvmHealthResponse, type DvmJobsByKindEntry, type DvmJobsByStatus, type DvmJobsRecent, type FromMnemonicOptions, GiftWrapError, type Handler, type HandlerContext, HandlerError, HandlerRegistry, type HandlerResponse, IdentityError, type IssueClaimParams, type IssueClaimResult, type MillSignerConfig, type MinaIdentity, type MinaSignerClientLike, type NodeConfig, NodeError, type NodeIdentity, type PaymentHandlerBridgeConfig, type PaymentRequest, type PaymentResponse, type PrefixClaimHandlerOptions, PricingError, type PricingValidationResult, type PricingValidatorConfig, type PublishEventResult, type PublishableNode, SWAP_HANDLER_REJECT_CODES, SWAP_HANDLER_REJECT_MESSAGES, type ServiceNode, type SettlementBundle, SettlementTxError, type SolanaIdentity, type StartResult, StreamSwapError, SwapHandlerError, type SwapHandlerLogger, SwarmCoordinator, type SwarmCoordinatorOptions, type SwarmState, type ToonIdentity, TurboUploadAdapter, type UploadBlobChunkedOptions, type UploadBlobOptions, VerificationError, type VerificationPipelineConfig, type VerificationResult, type WorkflowEventStore, WorkflowOrchestrator, type WorkflowOrchestratorOptions, type WorkflowState, applyRate, base58Decode, base58Encode, buildSettlementTx, buildSkillDescriptor, createArweaveDvmHandler, createEventStorageHandler, createHandlerContext, createNode, createPaymentHandlerBridge, createPrefixClaimHandler, createPricingValidator, createSwapHandler, createVerificationPipeline, fillEvmSettlementTxGas, findSwapPair, fromMnemonic, fromMnemonicFull, fromSecretKey, generateMnemonic, generateSolanaKeypair, loadMinaSignerClient, uploadBlob, uploadBlobChunked, verifyAccumulatedClaim, verifyEd25519Signature, verifyMinaSignature };
1960
+ export { AccumulatedClaim, type AddChunkResult, type ApplyRateParams, type ArweaveDvmConfig, type ArweaveUploadAdapter, type BuildSettlementTxParams, type BuildSettlementTxResult, type BuildSkillDescriptorConfig, ChunkManager, type ChunkManagerConfig, type ClaimIssuer, type CreateHandlerContextOptions, type CreateSwapHandlerConfig, type FromMnemonicOptions, GiftWrapError, type Handler, type HandlerContext, HandlerError, HandlerRegistry, type HandlerResponse, IdentityError, type IssueClaimParams, type IssueClaimResult, type MinaIdentity, type MinaSignerClientLike, type NodeConfig, NodeError, type NodeIdentity, type PaymentHandlerBridgeConfig, type PaymentRequest, type PaymentResponse, type PrefixClaimHandlerOptions, PricingError, type PricingValidationResult, type PricingValidatorConfig, type PublishEventResult, type PublishableNode, SWAP_HANDLER_REJECT_CODES, SWAP_HANDLER_REJECT_MESSAGES, type ServiceNode, type SettlementBundle, SettlementTxError, type SolanaIdentity, type StartResult, type StoreHealthResponse, type StoreJobsByKindEntry, type StoreJobsByStatus, type StoreJobsRecent, StreamSwapError, SwapHandlerError, type SwapHandlerLogger, type SwapSignerConfig, SwarmCoordinator, type SwarmCoordinatorOptions, type SwarmState, type ToonIdentity, TurboUploadAdapter, type UploadBlobChunkedOptions, type UploadBlobOptions, VerificationError, type VerificationPipelineConfig, type VerificationResult, type WorkflowEventStore, WorkflowOrchestrator, type WorkflowOrchestratorOptions, type WorkflowState, applyRate, base58Decode, base58Encode, buildSettlementTx, buildSkillDescriptor, createArweaveDvmHandler, createEventStorageHandler, createHandlerContext, createNode, createPaymentHandlerBridge, createPrefixClaimHandler, createPricingValidator, createSwapHandler, createVerificationPipeline, fillEvmSettlementTxGas, findSwapPair, fromMnemonic, fromMnemonicFull, fromSecretKey, generateMnemonic, generateSolanaKeypair, loadMinaSignerClient, uploadBlob, uploadBlobChunked, verifyAccumulatedClaim, verifyEd25519Signature, verifyMinaSignature };
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  unwrapSwapPacketFromToon,
30
30
  wrapSwapPacket,
31
31
  wrapSwapPacketToToon
32
- } from "./chunk-XTHUXP63.js";
32
+ } from "./chunk-Z6S56VPV.js";
33
33
  import "./chunk-UP2VWCW5.js";
34
34
 
35
35
  // src/handler-context.ts
@@ -260,7 +260,7 @@ function createPaymentHandlerBridge(config) {
260
260
  // src/event-storage-handler.ts
261
261
  function createEventStorageHandler(_config) {
262
262
  throw new Error(
263
- "createEventStorageHandler is not yet implemented in @toon-protocol/sdk. Use @toon-protocol/town for the relay implementation."
263
+ "createEventStorageHandler is not yet implemented in @toon-protocol/sdk. Use @toon-protocol/relay for the relay implementation."
264
264
  );
265
265
  }
266
266
 
@@ -2184,7 +2184,7 @@ function rlpEncodeUnsignedTx(params) {
2184
2184
  ]);
2185
2185
  }
2186
2186
  function buildEvmSettlementTx(winner, signer, recipient, selectedClaimIndex, claimsMerged) {
2187
- if (winner.channelId === void 0 || winner.cumulativeAmount === void 0 || winner.nonce === void 0 || winner.recipient === void 0 || winner.millSignerAddress === void 0) {
2187
+ if (winner.channelId === void 0 || winner.cumulativeAmount === void 0 || winner.nonce === void 0 || winner.recipient === void 0 || winner.swapSignerAddress === void 0) {
2188
2188
  throw new SettlementTxError(
2189
2189
  "MISSING_SETTLEMENT_METADATA",
2190
2190
  "EVM winner claim missing settlement-context fields"
@@ -2193,13 +2193,13 @@ function buildEvmSettlementTx(winner, signer, recipient, selectedClaimIndex, cla
2193
2193
  if (!signer.contractAddress) {
2194
2194
  throw new SettlementTxError(
2195
2195
  "INVALID_INPUT",
2196
- `EVM MillSignerConfig.contractAddress is required for chain ${winner.pair.to.chain}`
2196
+ `EVM SwapSignerConfig.contractAddress is required for chain ${winner.pair.to.chain}`
2197
2197
  );
2198
2198
  }
2199
2199
  if (typeof signer.chainId !== "number" || !Number.isInteger(signer.chainId) || signer.chainId <= 0) {
2200
2200
  throw new SettlementTxError(
2201
2201
  "INVALID_INPUT",
2202
- `EVM MillSignerConfig.chainId must be a positive integer, got ${signer.chainId}`
2202
+ `EVM SwapSignerConfig.chainId must be a positive integer, got ${signer.chainId}`
2203
2203
  );
2204
2204
  }
2205
2205
  const channelIdBytes = hexToBytes2(winner.channelId);
@@ -2228,7 +2228,7 @@ function buildEvmSettlementTx(winner, signer, recipient, selectedClaimIndex, cla
2228
2228
  cumulativeAmount: winner.cumulativeAmount,
2229
2229
  nonce: winner.nonce,
2230
2230
  recipient,
2231
- millSignerAddress: winner.millSignerAddress,
2231
+ swapSignerAddress: winner.swapSignerAddress,
2232
2232
  unsignedTxBytes,
2233
2233
  expectedEventSignature: EVM_SETTLEMENT_EVENT_TOPIC,
2234
2234
  claimsMerged,
@@ -2247,13 +2247,13 @@ function fillEvmSettlementTxGas(bundle, gas, signer) {
2247
2247
  if (!signer.contractAddress) {
2248
2248
  throw new SettlementTxError(
2249
2249
  "INVALID_INPUT",
2250
- "EVM MillSignerConfig.contractAddress is required for gas-fill"
2250
+ "EVM SwapSignerConfig.contractAddress is required for gas-fill"
2251
2251
  );
2252
2252
  }
2253
2253
  if (typeof signer.chainId !== "number" || signer.chainId <= 0) {
2254
2254
  throw new SettlementTxError(
2255
2255
  "INVALID_INPUT",
2256
- "EVM MillSignerConfig.chainId must be a positive integer"
2256
+ "EVM SwapSignerConfig.chainId must be a positive integer"
2257
2257
  );
2258
2258
  }
2259
2259
  const channelIdBytes = hexToBytes2(bundle.channelId);
@@ -2416,7 +2416,7 @@ function verifyMinaSignature(claim, expectedSignerAddress, client) {
2416
2416
  }
2417
2417
  }
2418
2418
  function buildMinaSettlementTx(winner, signer, recipient, selectedClaimIndex, claimsMerged) {
2419
- if (winner.channelId === void 0 || winner.cumulativeAmount === void 0 || winner.nonce === void 0 || winner.recipient === void 0 || winner.millSignerAddress === void 0) {
2419
+ if (winner.channelId === void 0 || winner.cumulativeAmount === void 0 || winner.nonce === void 0 || winner.recipient === void 0 || winner.swapSignerAddress === void 0) {
2420
2420
  throw new SettlementTxError(
2421
2421
  "MISSING_SETTLEMENT_METADATA",
2422
2422
  "Mina winner claim missing settlement-context fields"
@@ -2425,7 +2425,7 @@ function buildMinaSettlementTx(winner, signer, recipient, selectedClaimIndex, cl
2425
2425
  if (!signer.address) {
2426
2426
  throw new SettlementTxError(
2427
2427
  "INVALID_INPUT",
2428
- `Mina MillSignerConfig.address is required for chain ${winner.pair.to.chain}`
2428
+ `Mina SwapSignerConfig.address is required for chain ${winner.pair.to.chain}`
2429
2429
  );
2430
2430
  }
2431
2431
  if (winner.claimBytes.length === 0) {
@@ -2442,7 +2442,7 @@ function buildMinaSettlementTx(winner, signer, recipient, selectedClaimIndex, cl
2442
2442
  cumulativeAmount: winner.cumulativeAmount,
2443
2443
  nonce: winner.nonce,
2444
2444
  recipient,
2445
- millSignerAddress: winner.millSignerAddress,
2445
+ swapSignerAddress: winner.swapSignerAddress,
2446
2446
  unsignedTxBytes,
2447
2447
  claimsMerged,
2448
2448
  selectedClaimIndex,
@@ -2520,7 +2520,7 @@ function bigintToBytes8LE(x) {
2520
2520
  return out;
2521
2521
  }
2522
2522
  function buildSolanaSettlementTx(winner, signer, recipient, selectedClaimIndex, claimsMerged) {
2523
- if (winner.channelId === void 0 || winner.cumulativeAmount === void 0 || winner.nonce === void 0 || winner.recipient === void 0 || winner.millSignerAddress === void 0) {
2523
+ if (winner.channelId === void 0 || winner.cumulativeAmount === void 0 || winner.nonce === void 0 || winner.recipient === void 0 || winner.swapSignerAddress === void 0) {
2524
2524
  throw new SettlementTxError(
2525
2525
  "MISSING_SETTLEMENT_METADATA",
2526
2526
  "Solana winner claim missing settlement-context fields"
@@ -2529,17 +2529,17 @@ function buildSolanaSettlementTx(winner, signer, recipient, selectedClaimIndex,
2529
2529
  if (!signer.programId) {
2530
2530
  throw new SettlementTxError(
2531
2531
  "INVALID_INPUT",
2532
- `Solana MillSignerConfig.programId is required for chain ${winner.pair.to.chain}`
2532
+ `Solana SwapSignerConfig.programId is required for chain ${winner.pair.to.chain}`
2533
2533
  );
2534
2534
  }
2535
2535
  let programIdBytes;
2536
2536
  let recipientBytes;
2537
- let millBytes;
2537
+ let swapBytes;
2538
2538
  let channelIdBytes;
2539
2539
  try {
2540
2540
  programIdBytes = base58Decode(signer.programId);
2541
2541
  recipientBytes = base58Decode(recipient);
2542
- millBytes = base58Decode(winner.millSignerAddress);
2542
+ swapBytes = base58Decode(winner.swapSignerAddress);
2543
2543
  channelIdBytes = base58Decode(winner.channelId);
2544
2544
  } catch (err) {
2545
2545
  throw new SettlementTxError(
@@ -2560,10 +2560,10 @@ function buildSolanaSettlementTx(winner, signer, recipient, selectedClaimIndex,
2560
2560
  `Solana recipient must decode to 32 bytes, got ${recipientBytes.length}`
2561
2561
  );
2562
2562
  }
2563
- if (millBytes.length !== 32) {
2563
+ if (swapBytes.length !== 32) {
2564
2564
  throw new SettlementTxError(
2565
2565
  "INVALID_INPUT",
2566
- `Solana millSignerAddress must decode to 32 bytes, got ${millBytes.length}`
2566
+ `Solana swapSignerAddress must decode to 32 bytes, got ${swapBytes.length}`
2567
2567
  );
2568
2568
  }
2569
2569
  if (channelIdBytes.length !== 32) {
@@ -2578,7 +2578,7 @@ function buildSolanaSettlementTx(winner, signer, recipient, selectedClaimIndex,
2578
2578
  bigintToBytes8LE(BigInt(winner.nonce)),
2579
2579
  winner.claimBytes
2580
2580
  );
2581
- const accounts = [recipientBytes, millBytes, channelIdBytes, programIdBytes];
2581
+ const accounts = [recipientBytes, swapBytes, channelIdBytes, programIdBytes];
2582
2582
  const header = new Uint8Array([1, 0, 1]);
2583
2583
  const accountsCountByte = new Uint8Array([accounts.length]);
2584
2584
  const recentBlockhash = new Uint8Array(32);
@@ -2615,7 +2615,7 @@ function buildSolanaSettlementTx(winner, signer, recipient, selectedClaimIndex,
2615
2615
  cumulativeAmount: winner.cumulativeAmount,
2616
2616
  nonce: winner.nonce,
2617
2617
  recipient,
2618
- millSignerAddress: winner.millSignerAddress,
2618
+ swapSignerAddress: winner.swapSignerAddress,
2619
2619
  unsignedTxBytes,
2620
2620
  claimsMerged,
2621
2621
  selectedClaimIndex,
@@ -2650,10 +2650,10 @@ function buildSettlementTx(params) {
2650
2650
  for (let i = 0; i < params.claims.length; i++) {
2651
2651
  const c = params.claims[i];
2652
2652
  if (c === void 0) continue;
2653
- if (c.channelId === void 0 || c.nonce === void 0 || c.cumulativeAmount === void 0 || c.recipient === void 0 || c.millSignerAddress === void 0) {
2653
+ if (c.channelId === void 0 || c.nonce === void 0 || c.cumulativeAmount === void 0 || c.recipient === void 0 || c.swapSignerAddress === void 0) {
2654
2654
  throw new SettlementTxError(
2655
2655
  "MISSING_SETTLEMENT_METADATA",
2656
- `claims[${i}] missing one or more of { channelId, nonce, cumulativeAmount, recipient, millSignerAddress }`
2656
+ `claims[${i}] missing one or more of { channelId, nonce, cumulativeAmount, recipient, swapSignerAddress }`
2657
2657
  );
2658
2658
  }
2659
2659
  }
@@ -2843,11 +2843,11 @@ function buildSettlementTx(params) {
2843
2843
  const first = g.claims[0];
2844
2844
  if (!first) continue;
2845
2845
  const firstRecipient = first.claim.recipient;
2846
- const firstMillSigner = first.claim.millSignerAddress;
2847
- if (firstRecipient === void 0 || firstMillSigner === void 0) {
2846
+ const firstSwapSigner = first.claim.swapSignerAddress;
2847
+ if (firstRecipient === void 0 || firstSwapSigner === void 0) {
2848
2848
  throw new SettlementTxError(
2849
2849
  "MISSING_SETTLEMENT_METADATA",
2850
- "winner claim missing recipient/millSignerAddress (unreachable after validation)"
2850
+ "winner claim missing recipient/swapSignerAddress (unreachable after validation)"
2851
2851
  );
2852
2852
  }
2853
2853
  for (let i = 1; i < g.claims.length; i++) {
@@ -2860,10 +2860,10 @@ function buildSettlementTx(params) {
2860
2860
  `claims in channel ${g.channelId} disagree on recipient: ${firstRecipient} vs ${String(c.recipient)} (claim indices ${first.originalIndex}, ${entry.originalIndex})`
2861
2861
  );
2862
2862
  }
2863
- if (c.millSignerAddress !== firstMillSigner) {
2863
+ if (c.swapSignerAddress !== firstSwapSigner) {
2864
2864
  throw new SettlementTxError(
2865
- "MILL_SIGNER_MISMATCH",
2866
- `claims in channel ${g.channelId} disagree on millSignerAddress: ${firstMillSigner} vs ${String(c.millSignerAddress)}`
2865
+ "SWAP_SIGNER_MISMATCH",
2866
+ `claims in channel ${g.channelId} disagree on swapSignerAddress: ${firstSwapSigner} vs ${String(c.swapSignerAddress)}`
2867
2867
  );
2868
2868
  }
2869
2869
  }
@@ -2925,7 +2925,7 @@ function buildSettlementTx(params) {
2925
2925
  if (recipient.toLowerCase() !== firstRecipient.toLowerCase()) {
2926
2926
  throw new SettlementTxError(
2927
2927
  "RECIPIENT_MISMATCH",
2928
- `recipients[${g.chain}] (${recipient}) does not match Mill-reported recipient (${firstRecipient})`
2928
+ `recipients[${g.chain}] (${recipient}) does not match Swap-reported recipient (${firstRecipient})`
2929
2929
  );
2930
2930
  }
2931
2931
  bundle = buildEvmSettlementTx(
@@ -2939,7 +2939,7 @@ function buildSettlementTx(params) {
2939
2939
  if (recipient !== firstRecipient) {
2940
2940
  throw new SettlementTxError(
2941
2941
  "RECIPIENT_MISMATCH",
2942
- `recipients[${g.chain}] (${recipient}) does not match Mill-reported recipient (${firstRecipient})`
2942
+ `recipients[${g.chain}] (${recipient}) does not match Swap-reported recipient (${firstRecipient})`
2943
2943
  );
2944
2944
  }
2945
2945
  bundle = buildSolanaSettlementTx(
@@ -2953,7 +2953,7 @@ function buildSettlementTx(params) {
2953
2953
  if (recipient !== firstRecipient) {
2954
2954
  throw new SettlementTxError(
2955
2955
  "RECIPIENT_MISMATCH",
2956
- `recipients[${g.chain}] (${recipient}) does not match Mill-reported recipient (${firstRecipient})`
2956
+ `recipients[${g.chain}] (${recipient}) does not match Swap-reported recipient (${firstRecipient})`
2957
2957
  );
2958
2958
  }
2959
2959
  bundle = buildMinaSettlementTx(