@toon-protocol/core 1.4.2 → 1.6.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 +113 -4
- package/dist/index.js +86 -4
- 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
|
|
|
@@ -432,6 +432,21 @@ interface IlpPeerInfo {
|
|
|
432
432
|
ilpAddresses?: string[];
|
|
433
433
|
/** BTP WebSocket endpoint URL for packet exchange (pay-per-event writes) */
|
|
434
434
|
btpEndpoint: string;
|
|
435
|
+
/**
|
|
436
|
+
* ILP-over-HTTP endpoint URL (RFC-0035) for stateless, one-shot writes:
|
|
437
|
+
* `POST` an ILP PREPARE here and receive a FULFILL/REJECT body. Suited to
|
|
438
|
+
* pure consumers, browsers, and NAT'd agents that don't need a duplex BTP
|
|
439
|
+
* session. Absent when the node only exposes BTP. The same host typically
|
|
440
|
+
* also accepts an HTTP `Upgrade` to BTP — see {@link supportsUpgrade}.
|
|
441
|
+
*/
|
|
442
|
+
httpEndpoint?: string;
|
|
443
|
+
/**
|
|
444
|
+
* Whether `httpEndpoint`'s host accepts an HTTP `Upgrade` to a BTP/WebSocket
|
|
445
|
+
* session (`Sec-WebSocket-Protocol: btp`). Lets a client start on
|
|
446
|
+
* ILP-over-HTTP and upgrade to duplex BTP when it becomes a peer or needs
|
|
447
|
+
* server-initiated packets, carrying its HTTP-proven identity across.
|
|
448
|
+
*/
|
|
449
|
+
supportsUpgrade?: boolean;
|
|
435
450
|
/**
|
|
436
451
|
* Public Nostr relay WebSocket URL for FREE reads (e.g. `wss://<addr>.anyone/`
|
|
437
452
|
* or `ws://host:7100`). Lets a client discover where to subscribe/read without
|
|
@@ -3704,7 +3719,7 @@ interface SolanaChainPreset {
|
|
|
3704
3719
|
chainType: 'solana';
|
|
3705
3720
|
/** Solana cluster RPC endpoint (HTTP). */
|
|
3706
3721
|
rpcUrl: string;
|
|
3707
|
-
/** Payment channel program ID (base58-encoded).
|
|
3722
|
+
/** Payment channel program ID (base58-encoded). */
|
|
3708
3723
|
programId: string;
|
|
3709
3724
|
/** Solana cluster name for chain ID namespacing (e.g., 'devnet'). */
|
|
3710
3725
|
cluster: string;
|
|
@@ -3721,7 +3736,7 @@ interface MinaChainPreset {
|
|
|
3721
3736
|
chainType: 'mina';
|
|
3722
3737
|
/** Mina GraphQL endpoint. */
|
|
3723
3738
|
graphqlUrl: string;
|
|
3724
|
-
/** zkApp address for the payment channel contract.
|
|
3739
|
+
/** zkApp address for the payment channel contract. */
|
|
3725
3740
|
zkAppAddress: string;
|
|
3726
3741
|
/** Mina network name (e.g., 'devnet'). */
|
|
3727
3742
|
network: string;
|
|
@@ -4502,6 +4517,100 @@ interface Logger {
|
|
|
4502
4517
|
*/
|
|
4503
4518
|
declare function createLogger(config: LoggerConfig): Logger;
|
|
4504
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
|
+
|
|
4505
4614
|
/**
|
|
4506
4615
|
* @toon-protocol/core
|
|
4507
4616
|
*
|
|
@@ -4509,4 +4618,4 @@ declare function createLogger(config: LoggerConfig): Logger;
|
|
|
4509
4618
|
*/
|
|
4510
4619
|
declare const VERSION = "0.1.0";
|
|
4511
4620
|
|
|
4512
|
-
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
|
@@ -414,6 +414,8 @@ function parseIlpPeerInfo(event) {
|
|
|
414
414
|
const {
|
|
415
415
|
ilpAddress,
|
|
416
416
|
btpEndpoint,
|
|
417
|
+
httpEndpoint,
|
|
418
|
+
supportsUpgrade,
|
|
417
419
|
blsHttpEndpoint,
|
|
418
420
|
settlementEngine,
|
|
419
421
|
assetCode,
|
|
@@ -428,6 +430,12 @@ function parseIlpPeerInfo(event) {
|
|
|
428
430
|
if (btpEndpoint !== void 0 && typeof btpEndpoint !== "string") {
|
|
429
431
|
throw new InvalidEventError("Invalid field: btpEndpoint must be a string");
|
|
430
432
|
}
|
|
433
|
+
if (httpEndpoint !== void 0 && typeof httpEndpoint !== "string") {
|
|
434
|
+
throw new InvalidEventError("Invalid field: httpEndpoint must be a string");
|
|
435
|
+
}
|
|
436
|
+
if (supportsUpgrade !== void 0 && typeof supportsUpgrade !== "boolean") {
|
|
437
|
+
throw new InvalidEventError("Invalid field: supportsUpgrade must be a boolean");
|
|
438
|
+
}
|
|
431
439
|
if (typeof assetCode !== "string" || assetCode.length === 0) {
|
|
432
440
|
throw new InvalidEventError("Missing or invalid required field: assetCode");
|
|
433
441
|
}
|
|
@@ -561,6 +569,8 @@ function parseIlpPeerInfo(event) {
|
|
|
561
569
|
return {
|
|
562
570
|
ilpAddress,
|
|
563
571
|
btpEndpoint: typeof btpEndpoint === "string" ? btpEndpoint : "",
|
|
572
|
+
...httpEndpoint !== void 0 && typeof httpEndpoint === "string" && { httpEndpoint },
|
|
573
|
+
...supportsUpgrade !== void 0 && typeof supportsUpgrade === "boolean" && { supportsUpgrade },
|
|
564
574
|
...blsHttpEndpoint !== void 0 && typeof blsHttpEndpoint === "string" && { blsHttpEndpoint },
|
|
565
575
|
assetCode,
|
|
566
576
|
assetScale,
|
|
@@ -4621,8 +4631,7 @@ var SOLANA_CHAIN_PRESETS = {
|
|
|
4621
4631
|
name: "solana-devnet",
|
|
4622
4632
|
chainType: "solana",
|
|
4623
4633
|
rpcUrl: "http://localhost:19899",
|
|
4624
|
-
programId: "",
|
|
4625
|
-
// TBD: set after program deployment
|
|
4634
|
+
programId: "EdJxYPDxGvaJuu57DSUptf4soLv8enpdyQJJhHDLiydG",
|
|
4626
4635
|
cluster: "devnet"
|
|
4627
4636
|
}
|
|
4628
4637
|
};
|
|
@@ -4631,8 +4640,7 @@ var MINA_CHAIN_PRESETS = {
|
|
|
4631
4640
|
name: "mina-devnet",
|
|
4632
4641
|
chainType: "mina",
|
|
4633
4642
|
graphqlUrl: "http://localhost:19085/graphql",
|
|
4634
|
-
zkAppAddress: "",
|
|
4635
|
-
// TBD: set after zkApp deployment
|
|
4643
|
+
zkAppAddress: "B62qrH1As4odHiNyKpTZMHaM6tRs6gi5DJ53efZKQBtbaR5CUctbDs6",
|
|
4636
4644
|
network: "devnet"
|
|
4637
4645
|
}
|
|
4638
4646
|
};
|
|
@@ -5300,6 +5308,74 @@ function createLogger(config) {
|
|
|
5300
5308
|
return logger;
|
|
5301
5309
|
}
|
|
5302
5310
|
|
|
5311
|
+
// src/ui/coordinate.ts
|
|
5312
|
+
var UI_RENDERER_KIND = 31036;
|
|
5313
|
+
var UI_TAG = "ui";
|
|
5314
|
+
var HEX64_RE = /^[0-9a-f]{64}$/;
|
|
5315
|
+
function parseUiCoordinate(coord) {
|
|
5316
|
+
if (typeof coord !== "string") {
|
|
5317
|
+
return null;
|
|
5318
|
+
}
|
|
5319
|
+
const parts = coord.split(":");
|
|
5320
|
+
if (parts.length !== 3) {
|
|
5321
|
+
return null;
|
|
5322
|
+
}
|
|
5323
|
+
const [kindStr, pubkey, targetKindStr] = parts;
|
|
5324
|
+
if (kindStr === void 0 || pubkey === void 0 || targetKindStr === void 0) {
|
|
5325
|
+
return null;
|
|
5326
|
+
}
|
|
5327
|
+
if (kindStr !== String(UI_RENDERER_KIND)) {
|
|
5328
|
+
return null;
|
|
5329
|
+
}
|
|
5330
|
+
if (!HEX64_RE.test(pubkey)) {
|
|
5331
|
+
return null;
|
|
5332
|
+
}
|
|
5333
|
+
if (!/^\d+$/.test(targetKindStr)) {
|
|
5334
|
+
return null;
|
|
5335
|
+
}
|
|
5336
|
+
const targetKind = Number(targetKindStr);
|
|
5337
|
+
if (!Number.isInteger(targetKind)) {
|
|
5338
|
+
return null;
|
|
5339
|
+
}
|
|
5340
|
+
return {
|
|
5341
|
+
kind: UI_RENDERER_KIND,
|
|
5342
|
+
pubkey,
|
|
5343
|
+
targetKind
|
|
5344
|
+
};
|
|
5345
|
+
}
|
|
5346
|
+
function buildUiCoordinate(ref) {
|
|
5347
|
+
const { pubkey, targetKind } = ref;
|
|
5348
|
+
if (typeof pubkey !== "string" || !HEX64_RE.test(pubkey)) {
|
|
5349
|
+
return null;
|
|
5350
|
+
}
|
|
5351
|
+
if (!Number.isInteger(targetKind) || targetKind < 0) {
|
|
5352
|
+
return null;
|
|
5353
|
+
}
|
|
5354
|
+
return `${UI_RENDERER_KIND}:${pubkey}:${targetKind}`;
|
|
5355
|
+
}
|
|
5356
|
+
function getUiCoordinate(event) {
|
|
5357
|
+
const value = event.tags.find((t) => t[0] === UI_TAG)?.[1];
|
|
5358
|
+
if (value === void 0) {
|
|
5359
|
+
return null;
|
|
5360
|
+
}
|
|
5361
|
+
return parseUiCoordinate(value);
|
|
5362
|
+
}
|
|
5363
|
+
function selectLatestAddressable(events) {
|
|
5364
|
+
let latest;
|
|
5365
|
+
for (const event of events) {
|
|
5366
|
+
if (latest === void 0) {
|
|
5367
|
+
latest = event;
|
|
5368
|
+
continue;
|
|
5369
|
+
}
|
|
5370
|
+
if (event.created_at > latest.created_at) {
|
|
5371
|
+
latest = event;
|
|
5372
|
+
} else if (event.created_at === latest.created_at && event.id < latest.id) {
|
|
5373
|
+
latest = event;
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
return latest;
|
|
5377
|
+
}
|
|
5378
|
+
|
|
5303
5379
|
// src/index.ts
|
|
5304
5380
|
var VERSION = "0.1.0";
|
|
5305
5381
|
export {
|
|
@@ -5352,6 +5428,8 @@ export {
|
|
|
5352
5428
|
ToonDecodeError,
|
|
5353
5429
|
ToonEncodeError,
|
|
5354
5430
|
ToonError,
|
|
5431
|
+
UI_RENDERER_KIND,
|
|
5432
|
+
UI_TAG,
|
|
5355
5433
|
USDC_DECIMALS,
|
|
5356
5434
|
USDC_NAME,
|
|
5357
5435
|
USDC_SYMBOL,
|
|
@@ -5385,6 +5463,7 @@ export {
|
|
|
5385
5463
|
buildSolanaProviderEntry,
|
|
5386
5464
|
buildSwarmRequestEvent,
|
|
5387
5465
|
buildSwarmSelectionEvent,
|
|
5466
|
+
buildUiCoordinate,
|
|
5388
5467
|
buildWorkflowDefinitionEvent,
|
|
5389
5468
|
buildWotDeclarationEvent,
|
|
5390
5469
|
calculateRouteAmount,
|
|
@@ -5411,6 +5490,7 @@ export {
|
|
|
5411
5490
|
encodeEventToToonString,
|
|
5412
5491
|
extractPrefixFromHandshake,
|
|
5413
5492
|
getEventExpiration,
|
|
5493
|
+
getUiCoordinate,
|
|
5414
5494
|
hasMinReputation,
|
|
5415
5495
|
hasRequireAttestation,
|
|
5416
5496
|
hexToBytes,
|
|
@@ -5434,6 +5514,7 @@ export {
|
|
|
5434
5514
|
parseServiceDiscovery,
|
|
5435
5515
|
parseSwarmRequest,
|
|
5436
5516
|
parseSwarmSelection,
|
|
5517
|
+
parseUiCoordinate,
|
|
5437
5518
|
parseWorkflowDefinition,
|
|
5438
5519
|
parseWotDeclaration,
|
|
5439
5520
|
publishSeedRelayEntry,
|
|
@@ -5445,6 +5526,7 @@ export {
|
|
|
5445
5526
|
resolveRouteFees,
|
|
5446
5527
|
resolveSolanaChainConfig,
|
|
5447
5528
|
resolveTokenForChain,
|
|
5529
|
+
selectLatestAddressable,
|
|
5448
5530
|
shallowParseToon,
|
|
5449
5531
|
validateChainId,
|
|
5450
5532
|
validateIlpAddress,
|