@toon-protocol/core 1.3.0 → 1.4.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 +35 -1
- package/dist/index.js +41 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -141,6 +141,28 @@ declare const BLOB_STORAGE_REQUEST_KIND = 5094;
|
|
|
141
141
|
* NOT as a kind:6094 event.
|
|
142
142
|
*/
|
|
143
143
|
declare const BLOB_STORAGE_RESULT_KIND = 6094;
|
|
144
|
+
/**
|
|
145
|
+
* Pet Interaction Request DVM kind (kind 5900).
|
|
146
|
+
* Used for pet interaction requests (feed, play, clean, etc.).
|
|
147
|
+
* Kind 5900 chosen to leave room for future DVM kinds in 5000-5899 range.
|
|
148
|
+
* Payment is carried in the ILP PREPARE packet (prepaid model).
|
|
149
|
+
*/
|
|
150
|
+
declare const PET_INTERACTION_REQUEST_KIND = 5900;
|
|
151
|
+
/**
|
|
152
|
+
* Pet Interaction Result DVM kind (kind 6900).
|
|
153
|
+
* Result kind = request kind + 1000 per NIP-90 convention.
|
|
154
|
+
* In the prepaid model, the new pet state is returned in the ILP FULFILL
|
|
155
|
+
* data field as base64-encoded JSON.
|
|
156
|
+
*/
|
|
157
|
+
declare const PET_INTERACTION_RESULT_KIND = 6900;
|
|
158
|
+
/**
|
|
159
|
+
* Pet Interaction Event kind (kind 14919).
|
|
160
|
+
* Optimistic interaction event published to relays after processing.
|
|
161
|
+
* Contains action details, stat changes, and brain hash.
|
|
162
|
+
* No proof or mina_tx tags -- those are added by the proof settlement
|
|
163
|
+
* pipeline after ZK proof generation.
|
|
164
|
+
*/
|
|
165
|
+
declare const PET_INTERACTION_EVENT_KIND = 14919;
|
|
144
166
|
declare const ILP_ROOT_PREFIX = "g.toon";
|
|
145
167
|
|
|
146
168
|
/**
|
|
@@ -2082,6 +2104,10 @@ interface BootstrapResult {
|
|
|
2082
2104
|
negotiatedChain?: string;
|
|
2083
2105
|
/** Peer's settlement address */
|
|
2084
2106
|
settlementAddress?: string;
|
|
2107
|
+
/** Token address for the negotiated chain */
|
|
2108
|
+
tokenAddress?: string;
|
|
2109
|
+
/** TokenNetwork/program/zkApp address for the negotiated chain */
|
|
2110
|
+
tokenNetwork?: string;
|
|
2085
2111
|
}
|
|
2086
2112
|
/**
|
|
2087
2113
|
* Callback interface for connector Admin API operations.
|
|
@@ -2546,6 +2572,14 @@ interface DiscoveryTracker {
|
|
|
2546
2572
|
setConnectorAdmin(admin: ConnectorAdminClient): void;
|
|
2547
2573
|
/** Set channel client for payment channel opening (optional). */
|
|
2548
2574
|
setChannelClient(client: ConnectorChannelClient): void;
|
|
2575
|
+
/** Get negotiation metadata for a peer (for lazy channel opening). */
|
|
2576
|
+
getPeerNegotiation(peerId: string): {
|
|
2577
|
+
chain: string;
|
|
2578
|
+
chainType: string;
|
|
2579
|
+
settlementAddress: string;
|
|
2580
|
+
tokenAddress?: string;
|
|
2581
|
+
tokenNetwork?: string;
|
|
2582
|
+
} | undefined;
|
|
2549
2583
|
/** Mark pubkeys as already-peered (e.g., from bootstrap phase). */
|
|
2550
2584
|
addExcludedPubkeys(pubkeys: string[]): void;
|
|
2551
2585
|
}
|
|
@@ -3990,4 +4024,4 @@ declare function createLogger(config: LoggerConfig): Logger;
|
|
|
3990
4024
|
*/
|
|
3991
4025
|
declare const VERSION = "0.1.0";
|
|
3992
4026
|
|
|
3993
|
-
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 BuildIlpPrepareParams, CHAIN_PRESETS, type CalculateRouteAmountParams, type ChainName, type ChainPreset, type ChainProviderConfigEntry, type ChainType, type ChannelState, type ConnectorAdminClient, type ConnectorAdminLike, type ConnectorChannelClient, type ConnectorChannelLike, type ConnectorNodeLike, type DeriveFromKmsSeedOptions, type DeterminismReport, type DirectRuntimeClientConfig, type DiscoveredPeer, type DiscoveryTracker, type DiscoveryTrackerConfig, type DvmJobStatus, type EVMProviderConfigEntry, type EmbeddableConnectorLike, type ForbiddenPattern, type GenesisPeer, GenesisPeerLoader, type HandlePacketAcceptResponse, type HandlePacketRejectResponse, type HandlePacketRequest, type HandlePacketResponse, ILP_PEER_INFO_KIND, ILP_ROOT_PREFIX, 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 NixBuildResult, NixBuilder, type NixBuilderConfig, NostrPeerDiscovery, type OpenChannelParams, type OpenChannelResult, 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, 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 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, buildAttestationEvent, buildBlobStorageRequest, buildEip712Domain, buildEvmProviderEntry, buildIlpPeerInfoEvent, buildIlpPrepare, buildJobFeedbackEvent, buildJobRequestEvent, buildJobResultEvent, buildJobReviewEvent, buildMinaProviderEntry, buildPrefixClaimEvent, buildPrefixGrantEvent, buildPrefixHandshakeData, buildSeedRelayListEvent, buildServiceDiscoveryEvent, buildSolanaProviderEntry, buildSwarmRequestEvent, buildSwarmSelectionEvent, buildWorkflowDefinitionEvent, buildWotDeclarationEvent, calculateRouteAmount, checkAddressCollision, createAgentRuntimeClient, createDirectChannelClient, createDirectConnectorAdmin, createDirectIlpClient, createDirectRuntimeClient, createDiscoveryTracker, createHttpChannelClient, createHttpConnectorAdmin, createHttpIlpClient$1 as createHttpIlpClient, createHttpRuntimeClient, createHttpIlpClient as createHttpRuntimeClientV2, createLogger, createToonNode, deriveChildAddress, deriveFromKmsSeed, extractPrefixFromHandshake, hasMinReputation, hasRequireAttestation, isGenesisNode, isValidIlpAddressStructure, negotiateSettlementChain, parseAttestation, parseBlobStorageRequest, parseIlpPeerInfo, parseJobFeedback, parseJobRequest, parseJobResult, parseJobReview, parsePrefixClaimEvent, parsePrefixGrantEvent, parseSeedRelayList, parseServiceDiscovery, parseSwarmRequest, parseSwarmSelection, parseWorkflowDefinition, parseWotDeclaration, publishSeedRelayEntry, readDockerfileNix, resolveChainConfig, resolveMinaChainConfig, resolveRouteFees, resolveSolanaChainConfig, resolveTokenForChain, validateChainId, validateIlpAddress, validatePrefix, validatePrefixConsistency, verifyPcrReproducibility };
|
|
4027
|
+
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 BuildIlpPrepareParams, CHAIN_PRESETS, type CalculateRouteAmountParams, type ChainName, type ChainPreset, type ChainProviderConfigEntry, type ChainType, type ChannelState, type ConnectorAdminClient, type ConnectorAdminLike, type ConnectorChannelClient, type ConnectorChannelLike, type ConnectorNodeLike, type DeriveFromKmsSeedOptions, type DeterminismReport, type DirectRuntimeClientConfig, type DiscoveredPeer, type DiscoveryTracker, type DiscoveryTrackerConfig, type DvmJobStatus, type EVMProviderConfigEntry, type EmbeddableConnectorLike, type ForbiddenPattern, type GenesisPeer, GenesisPeerLoader, type HandlePacketAcceptResponse, type HandlePacketRejectResponse, type HandlePacketRequest, type HandlePacketResponse, ILP_PEER_INFO_KIND, ILP_ROOT_PREFIX, 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 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, 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 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, buildAttestationEvent, buildBlobStorageRequest, buildEip712Domain, buildEvmProviderEntry, buildIlpPeerInfoEvent, buildIlpPrepare, buildJobFeedbackEvent, buildJobRequestEvent, buildJobResultEvent, buildJobReviewEvent, buildMinaProviderEntry, buildPrefixClaimEvent, buildPrefixGrantEvent, buildPrefixHandshakeData, buildSeedRelayListEvent, buildServiceDiscoveryEvent, buildSolanaProviderEntry, buildSwarmRequestEvent, buildSwarmSelectionEvent, buildWorkflowDefinitionEvent, buildWotDeclarationEvent, calculateRouteAmount, checkAddressCollision, createAgentRuntimeClient, createDirectChannelClient, createDirectConnectorAdmin, createDirectIlpClient, createDirectRuntimeClient, createDiscoveryTracker, createHttpChannelClient, createHttpConnectorAdmin, createHttpIlpClient$1 as createHttpIlpClient, createHttpRuntimeClient, createHttpIlpClient as createHttpRuntimeClientV2, createLogger, createToonNode, deriveChildAddress, deriveFromKmsSeed, extractPrefixFromHandshake, hasMinReputation, hasRequireAttestation, isGenesisNode, isValidIlpAddressStructure, negotiateSettlementChain, parseAttestation, parseBlobStorageRequest, parseIlpPeerInfo, parseJobFeedback, parseJobRequest, parseJobResult, parseJobReview, parsePrefixClaimEvent, parsePrefixGrantEvent, parseSeedRelayList, parseServiceDiscovery, parseSwarmRequest, parseSwarmSelection, parseWorkflowDefinition, parseWotDeclaration, publishSeedRelayEntry, readDockerfileNix, resolveChainConfig, resolveMinaChainConfig, resolveRouteFees, resolveSolanaChainConfig, resolveTokenForChain, validateChainId, validateIlpAddress, validatePrefix, validatePrefixConsistency, verifyPcrReproducibility };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,9 @@ var PREFIX_CLAIM_KIND = 10034;
|
|
|
29
29
|
var PREFIX_GRANT_KIND = 10037;
|
|
30
30
|
var BLOB_STORAGE_REQUEST_KIND = 5094;
|
|
31
31
|
var BLOB_STORAGE_RESULT_KIND = 6094;
|
|
32
|
+
var PET_INTERACTION_REQUEST_KIND = 5900;
|
|
33
|
+
var PET_INTERACTION_RESULT_KIND = 6900;
|
|
34
|
+
var PET_INTERACTION_EVENT_KIND = 14919;
|
|
32
35
|
var ILP_ROOT_PREFIX = "g.toon";
|
|
33
36
|
|
|
34
37
|
// src/address/ilp-address-validation.ts
|
|
@@ -3041,29 +3044,12 @@ var BootstrapService = class {
|
|
|
3041
3044
|
const tokenNetwork = peerInfo.tokenNetworks?.[negotiatedChain];
|
|
3042
3045
|
if (peerAddress) {
|
|
3043
3046
|
console.log(
|
|
3044
|
-
`[Bootstrap]
|
|
3047
|
+
`[Bootstrap] Negotiated ${negotiatedChain} with ${registeredPeerId} (lazy \u2014 channel deferred)`
|
|
3045
3048
|
);
|
|
3046
|
-
const channelResult = await this.channelClient.openChannel({
|
|
3047
|
-
peerId: registeredPeerId,
|
|
3048
|
-
chain: negotiatedChain,
|
|
3049
|
-
token: tokenAddress,
|
|
3050
|
-
tokenNetwork,
|
|
3051
|
-
peerAddress,
|
|
3052
|
-
initialDeposit: "100000",
|
|
3053
|
-
settlementTimeout: 86400
|
|
3054
|
-
});
|
|
3055
|
-
result.channelId = channelResult.channelId;
|
|
3056
3049
|
result.negotiatedChain = negotiatedChain;
|
|
3057
3050
|
result.settlementAddress = peerAddress;
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
);
|
|
3061
|
-
this.emit({
|
|
3062
|
-
type: "bootstrap:channel-opened",
|
|
3063
|
-
peerId: registeredPeerId,
|
|
3064
|
-
channelId: channelResult.channelId,
|
|
3065
|
-
negotiatedChain
|
|
3066
|
-
});
|
|
3051
|
+
result.tokenAddress = tokenAddress;
|
|
3052
|
+
result.tokenNetwork = tokenNetwork;
|
|
3067
3053
|
if (this.connectorAdmin) {
|
|
3068
3054
|
await this.connectorAdmin.addPeer({
|
|
3069
3055
|
id: registeredPeerId,
|
|
@@ -3074,10 +3060,7 @@ var BootstrapService = class {
|
|
|
3074
3060
|
preference: negotiatedChain,
|
|
3075
3061
|
...peerAddress && { evmAddress: peerAddress },
|
|
3076
3062
|
...tokenAddress && { tokenAddress },
|
|
3077
|
-
...tokenNetwork && { tokenNetworkAddress: tokenNetwork }
|
|
3078
|
-
...channelResult.channelId && {
|
|
3079
|
-
channelId: channelResult.channelId
|
|
3080
|
-
}
|
|
3063
|
+
...tokenNetwork && { tokenNetworkAddress: tokenNetwork }
|
|
3081
3064
|
}
|
|
3082
3065
|
});
|
|
3083
3066
|
}
|
|
@@ -3473,10 +3456,11 @@ function createDiscoveryTracker(config) {
|
|
|
3473
3456
|
const pubkey = getPublicKey4(config.secretKey);
|
|
3474
3457
|
const excludedPubkeys = /* @__PURE__ */ new Set([pubkey]);
|
|
3475
3458
|
let connectorAdmin;
|
|
3476
|
-
let
|
|
3459
|
+
let _channelClient;
|
|
3477
3460
|
let listeners = [];
|
|
3478
3461
|
const discoveredPeers = /* @__PURE__ */ new Map();
|
|
3479
3462
|
const peeredPubkeys = /* @__PURE__ */ new Set();
|
|
3463
|
+
const peerNegotiations = /* @__PURE__ */ new Map();
|
|
3480
3464
|
const peerTimestamps = /* @__PURE__ */ new Map();
|
|
3481
3465
|
function emit(event) {
|
|
3482
3466
|
for (const listener of listeners) {
|
|
@@ -3593,7 +3577,7 @@ function createDiscoveryTracker(config) {
|
|
|
3593
3577
|
});
|
|
3594
3578
|
return;
|
|
3595
3579
|
}
|
|
3596
|
-
if (
|
|
3580
|
+
if (config.settlementInfo?.supportedChains?.length && peerInfo.supportedChains?.length && peerInfo.settlementAddresses) {
|
|
3597
3581
|
try {
|
|
3598
3582
|
const negotiatedChain = negotiateSettlementChain(
|
|
3599
3583
|
config.settlementInfo.supportedChains,
|
|
@@ -3610,44 +3594,24 @@ function createDiscoveryTracker(config) {
|
|
|
3610
3594
|
);
|
|
3611
3595
|
const tokenNetwork = peerInfo.tokenNetworks?.[negotiatedChain];
|
|
3612
3596
|
if (peerAddress) {
|
|
3613
|
-
|
|
3614
|
-
peerId,
|
|
3597
|
+
peerNegotiations.set(peerId, {
|
|
3615
3598
|
chain: negotiatedChain,
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
settlementTimeout: 86400
|
|
3621
|
-
});
|
|
3622
|
-
await admin.addPeer({
|
|
3623
|
-
id: peerId,
|
|
3624
|
-
url: peerInfo.btpEndpoint,
|
|
3625
|
-
authToken: "",
|
|
3626
|
-
routes: [{ prefix: peerInfo.ilpAddress }],
|
|
3627
|
-
settlement: {
|
|
3628
|
-
preference: negotiatedChain,
|
|
3629
|
-
...peerAddress && { evmAddress: peerAddress },
|
|
3630
|
-
...tokenAddress && { tokenAddress },
|
|
3631
|
-
...tokenNetwork && {
|
|
3632
|
-
tokenNetworkAddress: tokenNetwork
|
|
3633
|
-
},
|
|
3634
|
-
...channelResult.channelId && {
|
|
3635
|
-
channelId: channelResult.channelId
|
|
3636
|
-
}
|
|
3637
|
-
}
|
|
3638
|
-
});
|
|
3639
|
-
emit({
|
|
3640
|
-
type: "bootstrap:channel-opened",
|
|
3641
|
-
peerId,
|
|
3642
|
-
channelId: channelResult.channelId,
|
|
3643
|
-
negotiatedChain
|
|
3599
|
+
chainType: negotiatedChain.split(":")[0] ?? negotiatedChain,
|
|
3600
|
+
settlementAddress: peerAddress,
|
|
3601
|
+
tokenAddress,
|
|
3602
|
+
tokenNetwork
|
|
3644
3603
|
});
|
|
3604
|
+
console.log(
|
|
3605
|
+
"[DiscoveryTracker] Negotiated %s with %s (lazy \u2014 channel deferred)",
|
|
3606
|
+
negotiatedChain,
|
|
3607
|
+
peerId
|
|
3608
|
+
);
|
|
3645
3609
|
}
|
|
3646
3610
|
}
|
|
3647
3611
|
} catch (error) {
|
|
3648
3612
|
const reason = error instanceof Error ? error.message : "Unknown error";
|
|
3649
3613
|
console.warn(
|
|
3650
|
-
"[DiscoveryTracker] Settlement failed for %s: %s",
|
|
3614
|
+
"[DiscoveryTracker] Settlement negotiation failed for %s: %s",
|
|
3651
3615
|
peerId,
|
|
3652
3616
|
reason
|
|
3653
3617
|
);
|
|
@@ -3686,7 +3650,10 @@ function createDiscoveryTracker(config) {
|
|
|
3686
3650
|
connectorAdmin = admin;
|
|
3687
3651
|
},
|
|
3688
3652
|
setChannelClient(client) {
|
|
3689
|
-
|
|
3653
|
+
_channelClient = client;
|
|
3654
|
+
},
|
|
3655
|
+
getPeerNegotiation(peerId) {
|
|
3656
|
+
return peerNegotiations.get(peerId);
|
|
3690
3657
|
},
|
|
3691
3658
|
addExcludedPubkeys(pubkeys) {
|
|
3692
3659
|
for (const pk of pubkeys) {
|
|
@@ -4182,7 +4149,19 @@ function createToonNode(config) {
|
|
|
4182
4149
|
}
|
|
4183
4150
|
try {
|
|
4184
4151
|
if (config.connector.setPacketHandler) {
|
|
4185
|
-
|
|
4152
|
+
const adaptedHandler = async (request) => {
|
|
4153
|
+
const result = await config.handlePacket(request);
|
|
4154
|
+
if (result.accept) {
|
|
4155
|
+
return result;
|
|
4156
|
+
}
|
|
4157
|
+
const adapted = result;
|
|
4158
|
+
adapted.rejectReason = {
|
|
4159
|
+
code: result.code,
|
|
4160
|
+
message: result.message
|
|
4161
|
+
};
|
|
4162
|
+
return adapted;
|
|
4163
|
+
};
|
|
4164
|
+
config.connector.setPacketHandler(adaptedHandler);
|
|
4186
4165
|
}
|
|
4187
4166
|
const results = await bootstrapService.bootstrap(
|
|
4188
4167
|
config.additionalPeersJson
|
|
@@ -4750,6 +4729,9 @@ export {
|
|
|
4750
4729
|
MOCK_USDC_CONFIG,
|
|
4751
4730
|
NixBuilder,
|
|
4752
4731
|
NostrPeerDiscovery,
|
|
4732
|
+
PET_INTERACTION_EVENT_KIND,
|
|
4733
|
+
PET_INTERACTION_REQUEST_KIND,
|
|
4734
|
+
PET_INTERACTION_RESULT_KIND,
|
|
4753
4735
|
PREFIX_CLAIM_KIND,
|
|
4754
4736
|
PREFIX_GRANT_KIND,
|
|
4755
4737
|
PcrReproducibilityError,
|