@toon-protocol/core 1.5.0 → 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 +119 -25
- package/dist/index.js +84 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { T as ToonError } from './index-DSgMeweu.js';
|
|
2
2
|
export { I as InvalidEventError, P as PeerDiscoveryError, a as ToonDecodeError, b as ToonEncodeError, c as ToonRoutingMeta, d as decodeEventFromToon, e as encodeEventToToon, f as encodeEventToToonString, s as shallowParseToon } from './index-DSgMeweu.js';
|
|
3
|
-
import { NostrEvent } from 'nostr-tools/pure';
|
|
3
|
+
import { NostrEvent, Event } from 'nostr-tools/pure';
|
|
4
4
|
import { SimplePool } from 'nostr-tools/pool';
|
|
5
5
|
import { TurboAuthenticatedClient } from '@ardrive/turbo-sdk';
|
|
6
6
|
|
|
@@ -479,7 +479,7 @@ interface IlpPeerInfo {
|
|
|
479
479
|
swapPairs?: SwapPair[];
|
|
480
480
|
}
|
|
481
481
|
/**
|
|
482
|
-
* Declarative advertisement of a token swap pair supported by a swap-capable peer (
|
|
482
|
+
* Declarative advertisement of a token swap pair supported by a swap-capable peer (Swap).
|
|
483
483
|
*
|
|
484
484
|
* Source and target assets use the same `{blockchain}:{network}[:{chainId}]` chain format
|
|
485
485
|
* as `IlpPeerInfo.supportedChains`. Rate is serialized as a decimal string (not a float) to
|
|
@@ -2473,15 +2473,15 @@ declare function resolveTokenForChain(chain: string, requesterPreferredTokens?:
|
|
|
2473
2473
|
* Shared balance-proof hash helpers — the single source of truth for the
|
|
2474
2474
|
* byte/field layout that ALL signers and verifiers across the monorepo depend
|
|
2475
2475
|
* on:
|
|
2476
|
-
* - the
|
|
2476
|
+
* - the Swap-side signer (`packages/swap/src/payment-channel-signer.ts`)
|
|
2477
2477
|
* - the sender-side settlement verifier (`packages/sdk/src/settlement/{evm,solana,mina}.ts`)
|
|
2478
2478
|
* - the client-side balance-proof signers (`packages/client/src/signing/{solana,mina}-signer.ts`)
|
|
2479
2479
|
*
|
|
2480
|
-
* Originally extracted from the
|
|
2480
|
+
* Originally extracted from the Swap signer (Story 12.4) into `@toon-protocol/sdk`
|
|
2481
2481
|
* (Story 12.6 AC-6). Relocated here to `@toon-protocol/core` so the client can
|
|
2482
2482
|
* consume the canonical hashes WITHOUT taking a dependency on `@toon-protocol/sdk`
|
|
2483
2483
|
* (the client only depends on core). `@toon-protocol/sdk` re-exports these names
|
|
2484
|
-
* unchanged, so
|
|
2484
|
+
* unchanged, so Swap and existing SDK consumers are unaffected.
|
|
2485
2485
|
*
|
|
2486
2486
|
* Any change to a hash layout here automatically applies to every signer AND
|
|
2487
2487
|
* verifier — they cannot drift.
|
|
@@ -2533,7 +2533,7 @@ declare function balanceProofHashSolana(channelId: string, cumulativeAmount: big
|
|
|
2533
2533
|
* `channelId` / `recipient` strings into the fixed field-element array a Mina
|
|
2534
2534
|
* Schnorr signature is computed over.
|
|
2535
2535
|
*
|
|
2536
|
-
* @stable —
|
|
2536
|
+
* @stable — Swap signer and SDK verifier depend on the exact derivation.
|
|
2537
2537
|
*/
|
|
2538
2538
|
declare function minaHashToField(s: string): bigint;
|
|
2539
2539
|
/**
|
|
@@ -2543,20 +2543,20 @@ declare function minaHashToField(s: string): bigint;
|
|
|
2543
2543
|
* nonce,
|
|
2544
2544
|
* minaHashToField(recipient) ]
|
|
2545
2545
|
*
|
|
2546
|
-
* This is the EXACT `fields` array that the
|
|
2546
|
+
* This is the EXACT `fields` array that the Swap's `MinaPaymentChannelSigner`
|
|
2547
2547
|
* passes to `mina-signer`'s `signFields(...)`, and that the sender-side
|
|
2548
2548
|
* `verifyMinaSignature` re-derives and passes to `verifyFields(...)`. Keeping
|
|
2549
|
-
* the derivation here (shared across `@toon-protocol/
|
|
2549
|
+
* the derivation here (shared across `@toon-protocol/swap`, `@toon-protocol/sdk`,
|
|
2550
2550
|
* and `@toon-protocol/client`) prevents signer/verifier drift — mirroring the
|
|
2551
2551
|
* EVM/Solana hash helpers above.
|
|
2552
2552
|
*
|
|
2553
|
-
* NOTE: this is the
|
|
2553
|
+
* NOTE: this is the Swap↔sender wire contract (a Schnorr signature over four
|
|
2554
2554
|
* field elements), NOT the connector's on-chain `MinaPaymentChannelSDK`
|
|
2555
2555
|
* Poseidon-commitment proof shape. The two are distinct; see
|
|
2556
2556
|
* `packages/sdk/src/settlement/mina.ts` for the relationship + the
|
|
2557
2557
|
* remaining on-chain-settlement gap.
|
|
2558
2558
|
*
|
|
2559
|
-
* @stable —
|
|
2559
|
+
* @stable — Swap signer and SDK verifier depend on the exact byte layout.
|
|
2560
2560
|
*/
|
|
2561
2561
|
declare function balanceProofFieldsMina(channelId: string, cumulativeAmount: bigint, nonce: bigint, recipient: string): bigint[];
|
|
2562
2562
|
|
|
@@ -2582,13 +2582,13 @@ declare function base58Decode(str: string): Uint8Array;
|
|
|
2582
2582
|
/**
|
|
2583
2583
|
* Mina private-key format conversion.
|
|
2584
2584
|
*
|
|
2585
|
-
* `deriveFullIdentity()` / `
|
|
2585
|
+
* `deriveFullIdentity()` / `deriveSwapKeys()` emit a Mina Pallas scalar as a
|
|
2586
2586
|
* big-endian hex string, but `mina-signer`'s `signFields`/`derivePublicKey`
|
|
2587
2587
|
* require the Mina base58check (`EK…`) private-key format. This helper bridges
|
|
2588
2588
|
* the two so a hex-derived Mina key produces signatures verifiable by the
|
|
2589
2589
|
* sender-side `verifyMinaSignature`.
|
|
2590
2590
|
*
|
|
2591
|
-
* Mirrors `hexToMinaBase58PrivateKey` in `packages/
|
|
2591
|
+
* Mirrors `hexToMinaBase58PrivateKey` in `packages/swap/src/payment-channel-signer.ts`
|
|
2592
2592
|
* (same fixed Mina base58check wire standard — version byte `0x5a`, non-zero
|
|
2593
2593
|
* tag `0x01`, little-endian scalar, double-sha256 checksum).
|
|
2594
2594
|
*
|
|
@@ -2608,11 +2608,11 @@ declare function hexToMinaBase58PrivateKey(privateKey: string): string;
|
|
|
2608
2608
|
* Derive the Mina base58 (`B62…`) public key for a private-key scalar, using
|
|
2609
2609
|
* the optional `mina-signer` peer dep.
|
|
2610
2610
|
*
|
|
2611
|
-
* `deriveFullIdentity()` / `
|
|
2611
|
+
* `deriveFullIdentity()` / `deriveSwapKeys()` emit only a keccak **hex
|
|
2612
2612
|
* placeholder** for the Mina public key — they deliberately avoid pulling
|
|
2613
2613
|
* Pallas curve math into derivation. That placeholder is unfundable and is
|
|
2614
2614
|
* rejected by Mina GraphQL balance queries, so wallet views that display it
|
|
2615
|
-
* (e.g.
|
|
2615
|
+
* (e.g. a swap node's `/wallet/balances` Mina leg) show an unusable hex
|
|
2616
2616
|
* string. This resolves the real, fundable `B62…` address when `mina-signer`
|
|
2617
2617
|
* is installed.
|
|
2618
2618
|
*
|
|
@@ -3677,7 +3677,7 @@ type ChainType = 'evm' | 'solana' | 'mina';
|
|
|
3677
3677
|
* `anvil` is the local-dev chain. `arbitrum-*` and `base-*` are the public
|
|
3678
3678
|
* Arbitrum and Base networks used by the network-mode resolver
|
|
3679
3679
|
* (see network-profile.ts). Base is the primary EVM chain for single-EVM
|
|
3680
|
-
* nodes; the apex connector and
|
|
3680
|
+
* nodes; the apex connector and Swap can hold providers for both families.
|
|
3681
3681
|
*/
|
|
3682
3682
|
type ChainName = 'anvil' | 'arbitrum-sepolia' | 'arbitrum-one' | 'base-sepolia' | 'base-mainnet';
|
|
3683
3683
|
/**
|
|
@@ -3719,7 +3719,7 @@ interface SolanaChainPreset {
|
|
|
3719
3719
|
chainType: 'solana';
|
|
3720
3720
|
/** Solana cluster RPC endpoint (HTTP). */
|
|
3721
3721
|
rpcUrl: string;
|
|
3722
|
-
/** Payment channel program ID (base58-encoded).
|
|
3722
|
+
/** Payment channel program ID (base58-encoded). */
|
|
3723
3723
|
programId: string;
|
|
3724
3724
|
/** Solana cluster name for chain ID namespacing (e.g., 'devnet'). */
|
|
3725
3725
|
cluster: string;
|
|
@@ -3736,7 +3736,7 @@ interface MinaChainPreset {
|
|
|
3736
3736
|
chainType: 'mina';
|
|
3737
3737
|
/** Mina GraphQL endpoint. */
|
|
3738
3738
|
graphqlUrl: string;
|
|
3739
|
-
/** zkApp address for the payment channel contract.
|
|
3739
|
+
/** zkApp address for the payment channel contract. */
|
|
3740
3740
|
zkAppAddress: string;
|
|
3741
3741
|
/** Mina network name (e.g., 'devnet'). */
|
|
3742
3742
|
network: string;
|
|
@@ -3910,7 +3910,7 @@ declare function buildSolanaProviderEntry(config: SolanaChainPreset, keyId: stri
|
|
|
3910
3910
|
declare function buildMinaProviderEntry(config: MinaChainPreset, keyId?: string): MinaProviderConfigEntry;
|
|
3911
3911
|
|
|
3912
3912
|
/**
|
|
3913
|
-
* Network-mode resolution for the
|
|
3913
|
+
* Network-mode resolution for the TOON connector `network` flag.
|
|
3914
3914
|
*
|
|
3915
3915
|
* A single operator-facing selector — `mainnet | testnet | devnet | custom` —
|
|
3916
3916
|
* resolves a coherent multi-chain configuration that is consumed by BOTH:
|
|
@@ -3918,18 +3918,18 @@ declare function buildMinaProviderEntry(config: MinaChainPreset, keyId?: string)
|
|
|
3918
3918
|
* to point at the project's dev chains — e.g. the Akash-hosted anvil + solana.)
|
|
3919
3919
|
*
|
|
3920
3920
|
* - the **apex** standalone connector (its `chainProviders` settlement array), and
|
|
3921
|
-
* - the **children** node containers (
|
|
3921
|
+
* - the **children** node containers (relay/swap), via a small set of env vars the
|
|
3922
3922
|
* HS compose template interpolates (`EVM_CHAIN`, `EVM_RPC_URL`, `EVM_CHAIN_ID`,
|
|
3923
3923
|
* `EVM_USDC_ADDRESS`, `SOLANA_RPC_URL`, `SOLANA_USDC_MINT`).
|
|
3924
3924
|
*
|
|
3925
3925
|
* Design notes:
|
|
3926
3926
|
* - **All tiers are public.** No tier resolves to a local chain (anvil/lightnet),
|
|
3927
3927
|
* so a node never points at an unreachable `localhost` RPC. This is what fixes
|
|
3928
|
-
* the "JsonRpcProvider failed to detect network" boot-loop that left
|
|
3928
|
+
* the "JsonRpcProvider failed to detect network" boot-loop that left relay nodes
|
|
3929
3929
|
* permanently disconnected (an empty RPC fell back to the `anvil` preset whose
|
|
3930
3930
|
* `localhost:8545` does not exist in the HS network).
|
|
3931
|
-
* - **EVM = Base (primary) + Arbitrum.** The single-EVM
|
|
3932
|
-
* apex connector and
|
|
3931
|
+
* - **EVM = Base (primary) + Arbitrum.** The single-EVM relay node uses Base; the
|
|
3932
|
+
* apex connector and Swap can hold providers for both families.
|
|
3933
3933
|
* - **Settlement status.** TOON's settlement contracts are deployed for the
|
|
3934
3934
|
* public **testnet/devnet** tiers (EVM Base Sepolia registry + TokenNetwork,
|
|
3935
3935
|
* Solana devnet program, Mina devnet zkApp — source of truth: e2e/testnets.json),
|
|
@@ -3981,7 +3981,7 @@ interface NetworkFamilyStatus {
|
|
|
3981
3981
|
* Only keys with real values are present (absent ⇒ compose `${VAR:-}` default).
|
|
3982
3982
|
*/
|
|
3983
3983
|
interface NetworkNodeEnv {
|
|
3984
|
-
/** Primary EVM chain preset name →
|
|
3984
|
+
/** Primary EVM chain preset name → relay `TOON_CHAIN` (`'none'` ⇒ relay-only). */
|
|
3985
3985
|
EVM_CHAIN?: string;
|
|
3986
3986
|
EVM_RPC_URL?: string;
|
|
3987
3987
|
EVM_CHAIN_ID?: string;
|
|
@@ -4007,7 +4007,7 @@ interface NetworkProfile {
|
|
|
4007
4007
|
/** Per-family settlement readiness. */
|
|
4008
4008
|
status: NetworkFamilyStatus;
|
|
4009
4009
|
}
|
|
4010
|
-
/** Sentinel for the
|
|
4010
|
+
/** Sentinel for the relay node meaning "no EVM settlement chain — run relay-only". */
|
|
4011
4011
|
declare const RELAY_ONLY_CHAIN = "none";
|
|
4012
4012
|
/**
|
|
4013
4013
|
* Resolve a {@link NetworkProfile} from a network mode.
|
|
@@ -4517,6 +4517,100 @@ interface Logger {
|
|
|
4517
4517
|
*/
|
|
4518
4518
|
declare function createLogger(config: LoggerConfig): Logger;
|
|
4519
4519
|
|
|
4520
|
+
/**
|
|
4521
|
+
* Pure helpers for NIP-on-TOON UI renderer resolution.
|
|
4522
|
+
*
|
|
4523
|
+
* An event may carry a `ui` tag whose value is an addressable coordinate
|
|
4524
|
+
* pointing at a `kind:31036` renderer event. The coordinate convention is:
|
|
4525
|
+
*
|
|
4526
|
+
* 31036:<renderer-author-pubkey>:<target-kind>
|
|
4527
|
+
*
|
|
4528
|
+
* where the trailing segment (the renderer event's `d` tag value) is the
|
|
4529
|
+
* kind of event the renderer knows how to render.
|
|
4530
|
+
*
|
|
4531
|
+
* These helpers are intentionally PURE: they parse coordinate strings and
|
|
4532
|
+
* select the latest addressable event from a set of candidates. The actual
|
|
4533
|
+
* resolution (relay query + cache) is client-local and lives outside core.
|
|
4534
|
+
*
|
|
4535
|
+
* Mirrors the style of `parseRepositoryReference` in `../nip34/types.ts`.
|
|
4536
|
+
*/
|
|
4537
|
+
|
|
4538
|
+
/** The renderer event kind for NIP-on-TOON UI rendering. */
|
|
4539
|
+
declare const UI_RENDERER_KIND = 31036;
|
|
4540
|
+
/** Tag name carrying the UI renderer coordinate on a rendered event. */
|
|
4541
|
+
declare const UI_TAG = "ui";
|
|
4542
|
+
/**
|
|
4543
|
+
* A parsed `ui` renderer coordinate.
|
|
4544
|
+
* Format: "31036:<pubkey>:<targetKind>"
|
|
4545
|
+
*/
|
|
4546
|
+
interface UiCoordinate {
|
|
4547
|
+
/** Always {@link UI_RENDERER_KIND} (31036). */
|
|
4548
|
+
kind: typeof UI_RENDERER_KIND;
|
|
4549
|
+
/** The renderer author's 64-hex pubkey. */
|
|
4550
|
+
pubkey: string;
|
|
4551
|
+
/** The kind of event this renderer targets (the renderer's `d` value). */
|
|
4552
|
+
targetKind: number;
|
|
4553
|
+
}
|
|
4554
|
+
/**
|
|
4555
|
+
* Parse a `ui` renderer coordinate string of the form
|
|
4556
|
+
* `31036:<pubkey>:<targetKind>`.
|
|
4557
|
+
*
|
|
4558
|
+
* Returns `null` on any malformed input: wrong segment count, a leading kind
|
|
4559
|
+
* other than 31036, a pubkey that is not 64-hex, or a non-integer target kind.
|
|
4560
|
+
*
|
|
4561
|
+
* Pure: no IO, no relay fetch.
|
|
4562
|
+
*
|
|
4563
|
+
* @param coord - The coordinate string (e.g. a `ui` tag value).
|
|
4564
|
+
* @returns The parsed {@link UiCoordinate}, or `null` if malformed.
|
|
4565
|
+
*/
|
|
4566
|
+
declare function parseUiCoordinate(coord: string): UiCoordinate | null;
|
|
4567
|
+
/**
|
|
4568
|
+
* Build a `ui` renderer coordinate string of the form
|
|
4569
|
+
* `31036:<pubkey>:<targetKind>`.
|
|
4570
|
+
*
|
|
4571
|
+
* The inverse of {@link parseUiCoordinate}. Returns `null` if the inputs are
|
|
4572
|
+
* invalid (pubkey not 64-hex, or target kind not a non-negative integer), so
|
|
4573
|
+
* that `build`→`parse` round-trips cleanly.
|
|
4574
|
+
*
|
|
4575
|
+
* Pure: no IO, no relay fetch.
|
|
4576
|
+
*
|
|
4577
|
+
* @param ref - The renderer author pubkey and target kind.
|
|
4578
|
+
* @returns The coordinate string, or `null` if the inputs are invalid.
|
|
4579
|
+
*/
|
|
4580
|
+
declare function buildUiCoordinate(ref: {
|
|
4581
|
+
pubkey: string;
|
|
4582
|
+
targetKind: number;
|
|
4583
|
+
}): string | null;
|
|
4584
|
+
/**
|
|
4585
|
+
* Read the `ui` tag value off an event and parse it into a coordinate.
|
|
4586
|
+
*
|
|
4587
|
+
* Convenience wrapper around {@link parseUiCoordinate} that pulls the first
|
|
4588
|
+
* `ui` tag's value from `event.tags`. Returns `null` if the event has no
|
|
4589
|
+
* `ui` tag or the tag value is malformed.
|
|
4590
|
+
*
|
|
4591
|
+
* Pure: no IO, no relay fetch.
|
|
4592
|
+
*
|
|
4593
|
+
* @param event - The event that may reference a renderer via a `ui` tag.
|
|
4594
|
+
* @returns The parsed {@link UiCoordinate}, or `null`.
|
|
4595
|
+
*/
|
|
4596
|
+
declare function getUiCoordinate(event: Event): UiCoordinate | null;
|
|
4597
|
+
/**
|
|
4598
|
+
* Select the latest addressable/replaceable event from a set of candidates
|
|
4599
|
+
* that share an addressable coordinate.
|
|
4600
|
+
*
|
|
4601
|
+
* Implements NIP-33 latest-wins: the event with the greatest `created_at`
|
|
4602
|
+
* wins. Ties on `created_at` are broken by the lexicographically lowest `id`
|
|
4603
|
+
* per the NIP-01 convention.
|
|
4604
|
+
*
|
|
4605
|
+
* Does not itself group by coordinate — callers pass the candidate set for a
|
|
4606
|
+
* single coordinate (e.g. the result of a relay query filtered by author +
|
|
4607
|
+
* kind + `#d`). Pure: no IO, no relay fetch.
|
|
4608
|
+
*
|
|
4609
|
+
* @param events - Candidate events sharing a coordinate.
|
|
4610
|
+
* @returns The latest event, or `undefined` for an empty input.
|
|
4611
|
+
*/
|
|
4612
|
+
declare function selectLatestAddressable<T extends Event>(events: T[]): T | undefined;
|
|
4613
|
+
|
|
4520
4614
|
/**
|
|
4521
4615
|
* @toon-protocol/core
|
|
4522
4616
|
*
|
|
@@ -4524,4 +4618,4 @@ declare function createLogger(config: LoggerConfig): Logger;
|
|
|
4524
4618
|
*/
|
|
4525
4619
|
declare const VERSION = "0.1.0";
|
|
4526
4620
|
|
|
4527
|
-
export { AddressRegistry, type AgentRuntimeClient, ArDrivePeerRegistry, AttestationBootstrap, type AttestationBootstrapConfig, type AttestationBootstrapEvent, type AttestationBootstrapEventListener, type AttestationBootstrapResult, type AttestationEventOptions, AttestationState, AttestationVerifier, type AttestationVerifierConfig, type AttestedResultVerificationOptions, type AttestedResultVerificationResult, AttestedResultVerifier, BLOB_STORAGE_REQUEST_KIND, BLOB_STORAGE_RESULT_KIND, type BlobStorageRequestParams, type BootstrapConfig, BootstrapError, type BootstrapEvent, type BootstrapEventListener, type BootstrapPhase, type BootstrapResult, BootstrapService, type BootstrapServiceConfig, type BtpHandshakeExtension, type BuildIlpPeerInfoOptions, type BuildIlpPrepareParams, CHAIN_PRESETS, type CalculateRouteAmountParams, type ChainName, type ChainPreset, type ChainProviderConfigEntry, type ChainType, type ChannelState, type ClientNetworkPresets, type ConnectorAdminClient, type ConnectorAdminLike, type ConnectorChannelClient, type ConnectorChannelLike, type ConnectorNodeLike, type CustomEndpoints, type DeriveFromKmsSeedOptions, type DeterminismReport, type DirectRuntimeClientConfig, type DiscoveredPeer, type DiscoveryTracker, type DiscoveryTrackerConfig, type DvmJobStatus, type EVMProviderConfigEntry, EXPIRATION_TAG, type EmbeddableConnectorLike, type ForbiddenPattern, type GenesisPeer, GenesisPeerLoader, type HandlePacketAcceptResponse, type HandlePacketRejectResponse, type HandlePacketRequest, type HandlePacketResponse, ILP_PEER_INFO_KIND, ILP_ROOT_PREFIX, ILP_TO_SEMANTIC, IMAGE_GENERATION_KIND, type IlpClient, type IlpPeerInfo, type IlpPreparePacket, type IlpSendResult, JOB_FEEDBACK_KIND, JOB_REQUEST_KIND_BASE, JOB_RESULT_KIND_BASE, JOB_REVIEW_KIND, type JobFeedbackParams, type JobRequestParams, type JobResultParams, type JobReviewParams, KmsIdentityError, type KmsKeypair, type KnownPeer, type LogEntry, type LogLevel, type Logger, type LoggerConfig, MINA_CHAIN_PRESETS, MOCK_USDC_ADDRESS, MOCK_USDC_CONFIG, type MinaChainName, type MinaChainPreset, type MinaProviderConfigEntry, type MockUsdcConfig, type MultiChainName, type NetworkFamilyStatus, type NetworkMode, type NetworkNodeEnv, type NetworkProfile, type NixBuildResult, NixBuilder, type NixBuilderConfig, NostrPeerDiscovery, type OpenChannelParams, type OpenChannelResult, PET_INTERACTION_EVENT_KIND, PET_INTERACTION_REQUEST_KIND, PET_INTERACTION_RESULT_KIND, PREFIX_CLAIM_KIND, PREFIX_GRANT_KIND, type PacketHandler, type ParsedAttestation, type ParsedBlobStorageRequest, type ParsedJobFeedback, type ParsedJobRequest, type ParsedJobResult, type ParsedJobReview, type ParsedSwarmRequest, type ParsedSwarmSelection, type ParsedWorkflowDefinition, type ParsedWotDeclaration, PcrReproducibilityError, type PcrReproducibilityResult, type PeerDescriptor, type PrefixClaimContent, type PrefixGrantContent, type PrefixValidationResult, type PublishSeedRelayConfig, RELAY_ONLY_CHAIN, type RegisterPeerParams, type ReputationScore, ReputationScoreCalculator, type ReputationSignals, type ResolveRouteFeesParams, type ResolveRouteFeesResult, SEED_RELAY_LIST_KIND, SERVICE_DISCOVERY_KIND, SOLANA_CHAIN_PRESETS, SeedRelayDiscovery, type SeedRelayDiscoveryConfig, type SeedRelayDiscoveryResult, type SeedRelayEntry, type SendPacketParams, type SendPacketResult, type ServiceDiscoveryContent, type SettlementConfig, type SkillDescriptor, type SocialDiscoveryEvent, type SocialDiscoveryEventListener, SocialPeerDiscovery, type SocialPeerDiscoveryConfig, type SolanaChainName, type SolanaChainPreset, type SolanaProviderConfigEntry, type Subscription, type SwapPair, type SwarmRequestParams, type SwarmSelectionParams, TEE_ATTESTATION_KIND, TEXT_GENERATION_KIND, TEXT_TO_SPEECH_KIND, TRANSLATION_KIND, type TeeAttestation, ToonError, type ToonNode, type ToonNodeConfig, type ToonNodeStartResult, USDC_DECIMALS, USDC_NAME, USDC_SYMBOL, VERSION, type VerificationResult, type VerifyOptions, type Violation, WEB_OF_TRUST_KIND, WORKFLOW_CHAIN_KIND, type WorkflowDefinitionParams, type WorkflowStep, type WotDeclarationParams, analyzeDockerfileForNonDeterminism, assignAddressFromHandshake, balanceProofFieldsMina, balanceProofHashEvm, balanceProofHashSolana, base58Decode, base58Encode, bigintToBytes32BE, buildAttestationEvent, buildBlobStorageRequest, buildEip712Domain, buildEvmProviderEntry, buildIlpPeerInfoEvent, buildIlpPrepare, buildJobFeedbackEvent, buildJobRequestEvent, buildJobResultEvent, buildJobReviewEvent, buildMinaProviderEntry, buildPrefixClaimEvent, buildPrefixGrantEvent, buildPrefixHandshakeData, buildSeedRelayListEvent, buildServiceDiscoveryEvent, buildSolanaProviderEntry, buildSwarmRequestEvent, buildSwarmSelectionEvent, buildWorkflowDefinitionEvent, buildWotDeclarationEvent, calculateRouteAmount, checkAddressCollision, concatBytes, createAgentRuntimeClient, createDirectChannelClient, createDirectConnectorAdmin, createDirectIlpClient, createDirectRuntimeClient, createDiscoveryTracker, createHttpChannelClient, createHttpConnectorAdmin, createHttpIlpClient$1 as createHttpIlpClient, createHttpRuntimeClient, createHttpIlpClient as createHttpRuntimeClientV2, createLogger, createToonNode, deriveChildAddress, deriveFromKmsSeed, deriveMinaPublicKeyBase58, extractPrefixFromHandshake, getEventExpiration, hasMinReputation, hasRequireAttestation, hexToBytes, hexToMinaBase58PrivateKey, ilpCodeToSemantic, isEventExpired, isGenesisNode, isValidIlpAddressStructure, minaHashToField, negotiateSettlementChain, parseAttestation, parseBlobStorageRequest, parseIlpPeerInfo, parseJobFeedback, parseJobRequest, parseJobResult, parseJobReview, parsePrefixClaimEvent, parsePrefixGrantEvent, parseSeedRelayList, parseServiceDiscovery, parseSwarmRequest, parseSwarmSelection, parseWorkflowDefinition, parseWotDeclaration, publishSeedRelayEntry, readDockerfileNix, resolveChainConfig, resolveClientNetwork, resolveMinaChainConfig, resolveNetworkProfile, resolveRouteFees, resolveSolanaChainConfig, resolveTokenForChain, validateChainId, validateIlpAddress, validatePrefix, validatePrefixConsistency, verifyPcrReproducibility };
|
|
4621
|
+
export { AddressRegistry, type AgentRuntimeClient, ArDrivePeerRegistry, AttestationBootstrap, type AttestationBootstrapConfig, type AttestationBootstrapEvent, type AttestationBootstrapEventListener, type AttestationBootstrapResult, type AttestationEventOptions, AttestationState, AttestationVerifier, type AttestationVerifierConfig, type AttestedResultVerificationOptions, type AttestedResultVerificationResult, AttestedResultVerifier, BLOB_STORAGE_REQUEST_KIND, BLOB_STORAGE_RESULT_KIND, type BlobStorageRequestParams, type BootstrapConfig, BootstrapError, type BootstrapEvent, type BootstrapEventListener, type BootstrapPhase, type BootstrapResult, BootstrapService, type BootstrapServiceConfig, type BtpHandshakeExtension, type BuildIlpPeerInfoOptions, type BuildIlpPrepareParams, CHAIN_PRESETS, type CalculateRouteAmountParams, type ChainName, type ChainPreset, type ChainProviderConfigEntry, type ChainType, type ChannelState, type ClientNetworkPresets, type ConnectorAdminClient, type ConnectorAdminLike, type ConnectorChannelClient, type ConnectorChannelLike, type ConnectorNodeLike, type CustomEndpoints, type DeriveFromKmsSeedOptions, type DeterminismReport, type DirectRuntimeClientConfig, type DiscoveredPeer, type DiscoveryTracker, type DiscoveryTrackerConfig, type DvmJobStatus, type EVMProviderConfigEntry, EXPIRATION_TAG, type EmbeddableConnectorLike, type ForbiddenPattern, type GenesisPeer, GenesisPeerLoader, type HandlePacketAcceptResponse, type HandlePacketRejectResponse, type HandlePacketRequest, type HandlePacketResponse, ILP_PEER_INFO_KIND, ILP_ROOT_PREFIX, ILP_TO_SEMANTIC, IMAGE_GENERATION_KIND, type IlpClient, type IlpPeerInfo, type IlpPreparePacket, type IlpSendResult, JOB_FEEDBACK_KIND, JOB_REQUEST_KIND_BASE, JOB_RESULT_KIND_BASE, JOB_REVIEW_KIND, type JobFeedbackParams, type JobRequestParams, type JobResultParams, type JobReviewParams, KmsIdentityError, type KmsKeypair, type KnownPeer, type LogEntry, type LogLevel, type Logger, type LoggerConfig, MINA_CHAIN_PRESETS, MOCK_USDC_ADDRESS, MOCK_USDC_CONFIG, type MinaChainName, type MinaChainPreset, type MinaProviderConfigEntry, type MockUsdcConfig, type MultiChainName, type NetworkFamilyStatus, type NetworkMode, type NetworkNodeEnv, type NetworkProfile, type NixBuildResult, NixBuilder, type NixBuilderConfig, NostrPeerDiscovery, type OpenChannelParams, type OpenChannelResult, PET_INTERACTION_EVENT_KIND, PET_INTERACTION_REQUEST_KIND, PET_INTERACTION_RESULT_KIND, PREFIX_CLAIM_KIND, PREFIX_GRANT_KIND, type PacketHandler, type ParsedAttestation, type ParsedBlobStorageRequest, type ParsedJobFeedback, type ParsedJobRequest, type ParsedJobResult, type ParsedJobReview, type ParsedSwarmRequest, type ParsedSwarmSelection, type ParsedWorkflowDefinition, type ParsedWotDeclaration, PcrReproducibilityError, type PcrReproducibilityResult, type PeerDescriptor, type PrefixClaimContent, type PrefixGrantContent, type PrefixValidationResult, type PublishSeedRelayConfig, RELAY_ONLY_CHAIN, type RegisterPeerParams, type ReputationScore, ReputationScoreCalculator, type ReputationSignals, type ResolveRouteFeesParams, type ResolveRouteFeesResult, SEED_RELAY_LIST_KIND, SERVICE_DISCOVERY_KIND, SOLANA_CHAIN_PRESETS, SeedRelayDiscovery, type SeedRelayDiscoveryConfig, type SeedRelayDiscoveryResult, type SeedRelayEntry, type SendPacketParams, type SendPacketResult, type ServiceDiscoveryContent, type SettlementConfig, type SkillDescriptor, type SocialDiscoveryEvent, type SocialDiscoveryEventListener, SocialPeerDiscovery, type SocialPeerDiscoveryConfig, type SolanaChainName, type SolanaChainPreset, type SolanaProviderConfigEntry, type Subscription, type SwapPair, type SwarmRequestParams, type SwarmSelectionParams, TEE_ATTESTATION_KIND, TEXT_GENERATION_KIND, TEXT_TO_SPEECH_KIND, TRANSLATION_KIND, type TeeAttestation, ToonError, type ToonNode, type ToonNodeConfig, type ToonNodeStartResult, UI_RENDERER_KIND, UI_TAG, USDC_DECIMALS, USDC_NAME, USDC_SYMBOL, type UiCoordinate, VERSION, type VerificationResult, type VerifyOptions, type Violation, WEB_OF_TRUST_KIND, WORKFLOW_CHAIN_KIND, type WorkflowDefinitionParams, type WorkflowStep, type WotDeclarationParams, analyzeDockerfileForNonDeterminism, assignAddressFromHandshake, balanceProofFieldsMina, balanceProofHashEvm, balanceProofHashSolana, base58Decode, base58Encode, bigintToBytes32BE, buildAttestationEvent, buildBlobStorageRequest, buildEip712Domain, buildEvmProviderEntry, buildIlpPeerInfoEvent, buildIlpPrepare, buildJobFeedbackEvent, buildJobRequestEvent, buildJobResultEvent, buildJobReviewEvent, buildMinaProviderEntry, buildPrefixClaimEvent, buildPrefixGrantEvent, buildPrefixHandshakeData, buildSeedRelayListEvent, buildServiceDiscoveryEvent, buildSolanaProviderEntry, buildSwarmRequestEvent, buildSwarmSelectionEvent, buildUiCoordinate, buildWorkflowDefinitionEvent, buildWotDeclarationEvent, calculateRouteAmount, checkAddressCollision, concatBytes, createAgentRuntimeClient, createDirectChannelClient, createDirectConnectorAdmin, createDirectIlpClient, createDirectRuntimeClient, createDiscoveryTracker, createHttpChannelClient, createHttpConnectorAdmin, createHttpIlpClient$1 as createHttpIlpClient, createHttpRuntimeClient, createHttpIlpClient as createHttpRuntimeClientV2, createLogger, createToonNode, deriveChildAddress, deriveFromKmsSeed, deriveMinaPublicKeyBase58, extractPrefixFromHandshake, getEventExpiration, getUiCoordinate, hasMinReputation, hasRequireAttestation, hexToBytes, hexToMinaBase58PrivateKey, ilpCodeToSemantic, isEventExpired, isGenesisNode, isValidIlpAddressStructure, minaHashToField, negotiateSettlementChain, parseAttestation, parseBlobStorageRequest, parseIlpPeerInfo, parseJobFeedback, parseJobRequest, parseJobResult, parseJobReview, parsePrefixClaimEvent, parsePrefixGrantEvent, parseSeedRelayList, parseServiceDiscovery, parseSwarmRequest, parseSwarmSelection, parseUiCoordinate, parseWorkflowDefinition, parseWotDeclaration, publishSeedRelayEntry, readDockerfileNix, resolveChainConfig, resolveClientNetwork, resolveMinaChainConfig, resolveNetworkProfile, resolveRouteFees, resolveSolanaChainConfig, resolveTokenForChain, selectLatestAddressable, validateChainId, validateIlpAddress, validatePrefix, validatePrefixConsistency, verifyPcrReproducibility };
|
package/dist/index.js
CHANGED
|
@@ -2232,7 +2232,14 @@ var NostrPeerDiscovery = class {
|
|
|
2232
2232
|
};
|
|
2233
2233
|
|
|
2234
2234
|
// src/discovery/genesis-peers.json
|
|
2235
|
-
var genesis_peers_default = [
|
|
2235
|
+
var genesis_peers_default = [
|
|
2236
|
+
{
|
|
2237
|
+
pubkey: "522e93098bf650f141a07f0ecfc1ace0f5d0397932afc01826e9ef46888b7bce",
|
|
2238
|
+
relayUrl: "wss://relay-ws.devnet.toonprotocol.dev",
|
|
2239
|
+
ilpAddress: "g.proxy.relay.store",
|
|
2240
|
+
btpEndpoint: "wss://proxy.store.devnet.toonprotocol.dev:443"
|
|
2241
|
+
}
|
|
2242
|
+
];
|
|
2236
2243
|
|
|
2237
2244
|
// src/discovery/GenesisPeerLoader.ts
|
|
2238
2245
|
var PUBKEY_REGEX3 = /^[0-9a-f]{64}$/;
|
|
@@ -4631,8 +4638,7 @@ var SOLANA_CHAIN_PRESETS = {
|
|
|
4631
4638
|
name: "solana-devnet",
|
|
4632
4639
|
chainType: "solana",
|
|
4633
4640
|
rpcUrl: "http://localhost:19899",
|
|
4634
|
-
programId: "",
|
|
4635
|
-
// TBD: set after program deployment
|
|
4641
|
+
programId: "EdJxYPDxGvaJuu57DSUptf4soLv8enpdyQJJhHDLiydG",
|
|
4636
4642
|
cluster: "devnet"
|
|
4637
4643
|
}
|
|
4638
4644
|
};
|
|
@@ -4641,8 +4647,7 @@ var MINA_CHAIN_PRESETS = {
|
|
|
4641
4647
|
name: "mina-devnet",
|
|
4642
4648
|
chainType: "mina",
|
|
4643
4649
|
graphqlUrl: "http://localhost:19085/graphql",
|
|
4644
|
-
zkAppAddress: "",
|
|
4645
|
-
// TBD: set after zkApp deployment
|
|
4650
|
+
zkAppAddress: "B62qrH1As4odHiNyKpTZMHaM6tRs6gi5DJ53efZKQBtbaR5CUctbDs6",
|
|
4646
4651
|
network: "devnet"
|
|
4647
4652
|
}
|
|
4648
4653
|
};
|
|
@@ -5310,6 +5315,74 @@ function createLogger(config) {
|
|
|
5310
5315
|
return logger;
|
|
5311
5316
|
}
|
|
5312
5317
|
|
|
5318
|
+
// src/ui/coordinate.ts
|
|
5319
|
+
var UI_RENDERER_KIND = 31036;
|
|
5320
|
+
var UI_TAG = "ui";
|
|
5321
|
+
var HEX64_RE = /^[0-9a-f]{64}$/;
|
|
5322
|
+
function parseUiCoordinate(coord) {
|
|
5323
|
+
if (typeof coord !== "string") {
|
|
5324
|
+
return null;
|
|
5325
|
+
}
|
|
5326
|
+
const parts = coord.split(":");
|
|
5327
|
+
if (parts.length !== 3) {
|
|
5328
|
+
return null;
|
|
5329
|
+
}
|
|
5330
|
+
const [kindStr, pubkey, targetKindStr] = parts;
|
|
5331
|
+
if (kindStr === void 0 || pubkey === void 0 || targetKindStr === void 0) {
|
|
5332
|
+
return null;
|
|
5333
|
+
}
|
|
5334
|
+
if (kindStr !== String(UI_RENDERER_KIND)) {
|
|
5335
|
+
return null;
|
|
5336
|
+
}
|
|
5337
|
+
if (!HEX64_RE.test(pubkey)) {
|
|
5338
|
+
return null;
|
|
5339
|
+
}
|
|
5340
|
+
if (!/^\d+$/.test(targetKindStr)) {
|
|
5341
|
+
return null;
|
|
5342
|
+
}
|
|
5343
|
+
const targetKind = Number(targetKindStr);
|
|
5344
|
+
if (!Number.isInteger(targetKind)) {
|
|
5345
|
+
return null;
|
|
5346
|
+
}
|
|
5347
|
+
return {
|
|
5348
|
+
kind: UI_RENDERER_KIND,
|
|
5349
|
+
pubkey,
|
|
5350
|
+
targetKind
|
|
5351
|
+
};
|
|
5352
|
+
}
|
|
5353
|
+
function buildUiCoordinate(ref) {
|
|
5354
|
+
const { pubkey, targetKind } = ref;
|
|
5355
|
+
if (typeof pubkey !== "string" || !HEX64_RE.test(pubkey)) {
|
|
5356
|
+
return null;
|
|
5357
|
+
}
|
|
5358
|
+
if (!Number.isInteger(targetKind) || targetKind < 0) {
|
|
5359
|
+
return null;
|
|
5360
|
+
}
|
|
5361
|
+
return `${UI_RENDERER_KIND}:${pubkey}:${targetKind}`;
|
|
5362
|
+
}
|
|
5363
|
+
function getUiCoordinate(event) {
|
|
5364
|
+
const value = event.tags.find((t) => t[0] === UI_TAG)?.[1];
|
|
5365
|
+
if (value === void 0) {
|
|
5366
|
+
return null;
|
|
5367
|
+
}
|
|
5368
|
+
return parseUiCoordinate(value);
|
|
5369
|
+
}
|
|
5370
|
+
function selectLatestAddressable(events) {
|
|
5371
|
+
let latest;
|
|
5372
|
+
for (const event of events) {
|
|
5373
|
+
if (latest === void 0) {
|
|
5374
|
+
latest = event;
|
|
5375
|
+
continue;
|
|
5376
|
+
}
|
|
5377
|
+
if (event.created_at > latest.created_at) {
|
|
5378
|
+
latest = event;
|
|
5379
|
+
} else if (event.created_at === latest.created_at && event.id < latest.id) {
|
|
5380
|
+
latest = event;
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
return latest;
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5313
5386
|
// src/index.ts
|
|
5314
5387
|
var VERSION = "0.1.0";
|
|
5315
5388
|
export {
|
|
@@ -5362,6 +5435,8 @@ export {
|
|
|
5362
5435
|
ToonDecodeError,
|
|
5363
5436
|
ToonEncodeError,
|
|
5364
5437
|
ToonError,
|
|
5438
|
+
UI_RENDERER_KIND,
|
|
5439
|
+
UI_TAG,
|
|
5365
5440
|
USDC_DECIMALS,
|
|
5366
5441
|
USDC_NAME,
|
|
5367
5442
|
USDC_SYMBOL,
|
|
@@ -5395,6 +5470,7 @@ export {
|
|
|
5395
5470
|
buildSolanaProviderEntry,
|
|
5396
5471
|
buildSwarmRequestEvent,
|
|
5397
5472
|
buildSwarmSelectionEvent,
|
|
5473
|
+
buildUiCoordinate,
|
|
5398
5474
|
buildWorkflowDefinitionEvent,
|
|
5399
5475
|
buildWotDeclarationEvent,
|
|
5400
5476
|
calculateRouteAmount,
|
|
@@ -5421,6 +5497,7 @@ export {
|
|
|
5421
5497
|
encodeEventToToonString,
|
|
5422
5498
|
extractPrefixFromHandshake,
|
|
5423
5499
|
getEventExpiration,
|
|
5500
|
+
getUiCoordinate,
|
|
5424
5501
|
hasMinReputation,
|
|
5425
5502
|
hasRequireAttestation,
|
|
5426
5503
|
hexToBytes,
|
|
@@ -5444,6 +5521,7 @@ export {
|
|
|
5444
5521
|
parseServiceDiscovery,
|
|
5445
5522
|
parseSwarmRequest,
|
|
5446
5523
|
parseSwarmSelection,
|
|
5524
|
+
parseUiCoordinate,
|
|
5447
5525
|
parseWorkflowDefinition,
|
|
5448
5526
|
parseWotDeclaration,
|
|
5449
5527
|
publishSeedRelayEntry,
|
|
@@ -5455,6 +5533,7 @@ export {
|
|
|
5455
5533
|
resolveRouteFees,
|
|
5456
5534
|
resolveSolanaChainConfig,
|
|
5457
5535
|
resolveTokenForChain,
|
|
5536
|
+
selectLatestAddressable,
|
|
5458
5537
|
shallowParseToon,
|
|
5459
5538
|
validateChainId,
|
|
5460
5539
|
validateIlpAddress,
|