@toon-protocol/core 2.1.0 → 3.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Peer discovery, bootstrap, settlement negotiation, and TOON event encoding for the TOON Protocol network.
4
4
 
5
- > This is an internal package. Most users should start with [`@toon-protocol/client`](../client) or [`@toon-protocol/sdk`](../sdk).
5
+ > This is an internal package. Most users should start with [`@toon-protocol/client`](https://github.com/toon-protocol/toon-client) or [`@toon-protocol/sdk`](../sdk).
6
6
 
7
7
  ## Install
8
8
 
package/dist/index.d.ts CHANGED
@@ -2517,16 +2517,57 @@ declare function bigintToBytes32BE(x: bigint): Uint8Array;
2517
2517
  */
2518
2518
  declare function concatBytes(...parts: Uint8Array[]): Uint8Array;
2519
2519
  /**
2520
- * Compute the EVM balance-proof message hash:
2521
- * keccak256(channelId || cumulativeAmount(32BE) || nonce(32BE) || recipient)
2520
+ * Compute the EIP-712 domain separator for the RollingSwapChannel v2 domain:
2521
+ * keccak256(abi.encode(
2522
+ * EIP712DOMAIN_TYPEHASH,
2523
+ * keccak256("RollingSwapChannel"),
2524
+ * keccak256("2"),
2525
+ * chainId, // uint256, big-endian
2526
+ * verifyingContract // address, right-aligned in 32 bytes
2527
+ * ))
2522
2528
  *
2523
- * `channelIdBytes` MUST be 32 bytes. `recipientBytes` MUST be 20 bytes.
2524
- * This hash is what `EvmPaymentChannelSigner.signBalanceProof` signs and
2525
- * what `recoverEvmSignerAddress` recovers against.
2529
+ * `verifyingContractBytes` MUST be the 20-byte deployed RollingSwapChannel
2530
+ * address. Equivalent to OpenZeppelin `EIP712._domainSeparatorV4()`.
2531
+ *
2532
+ * @stable — every signer and verifier depends on the exact layout.
2533
+ */
2534
+ declare function eip712DomainSeparatorEvm(chainId: bigint, verifyingContractBytes: Uint8Array): Uint8Array;
2535
+ /**
2536
+ * Compute the v2 EVM balance-proof (claim) digest — the 32-byte EIP-712 typed
2537
+ * digest the swap node signs and the on-chain `RollingSwapChannel` verifies:
2538
+ *
2539
+ * structHash = keccak256(abi.encode(
2540
+ * CLAIM_TYPEHASH, channelId, cumulativeAmount, nonce, recipient))
2541
+ * digest = keccak256(0x1901 || domainSeparator || structHash)
2542
+ *
2543
+ * with domain `EIP712Domain(name="RollingSwapChannel", version="2", chainId,
2544
+ * verifyingContract)`. `channelIdBytes` MUST be 32 bytes, `recipientBytes` MUST
2545
+ * be 20 bytes, `verifyingContractBytes` MUST be the 20-byte deployed contract
2546
+ * address. Equivalent to OZ `EIP712._hashTypedDataV4(claimStructHash)`.
2547
+ *
2548
+ * v2 REQUIRES `chainId` + `verifyingContract` — the two inputs v1 lacked. This
2549
+ * hash is what `EvmPaymentChannelSigner.signBalanceProof` signs and what
2550
+ * `recoverEvmSignerAddress` recovers against.
2551
+ *
2552
+ * @stable — signer and verifier depend on the exact byte layout.
2553
+ */
2554
+ declare function balanceProofHashEvm(channelIdBytes: Uint8Array, cumulativeAmount: bigint, nonce: bigint, recipientBytes: Uint8Array, chainId: bigint, verifyingContractBytes: Uint8Array): Uint8Array;
2555
+ /**
2556
+ * Compute the v2 EVM cooperative-close digest — the 32-byte EIP-712 typed
2557
+ * digest the recipient signs to acknowledge a cooperative close:
2558
+ *
2559
+ * structHash = keccak256(abi.encode(
2560
+ * COOP_CLOSE_TYPEHASH, channelId, cumulativeAmount, nonce))
2561
+ * digest = keccak256(0x1901 || domainSeparator || structHash)
2562
+ *
2563
+ * Shares the SAME domain as the claim digest (so it is bound to
2564
+ * `chainId + verifyingContract` too), but the distinct `CooperativeClose`
2565
+ * type hash guarantees a close-ack can never be recovered as a balance-proof
2566
+ * claim (or vice-versa). `channelIdBytes` MUST be 32 bytes.
2526
2567
  *
2527
2568
  * @stable — signer and verifier depend on the exact byte layout.
2528
2569
  */
2529
- declare function balanceProofHashEvm(channelIdBytes: Uint8Array, cumulativeAmount: bigint, nonce: bigint, recipientBytes: Uint8Array): Uint8Array;
2570
+ declare function coopCloseHashEvm(channelIdBytes: Uint8Array, cumulativeAmount: bigint, nonce: bigint, chainId: bigint, verifyingContractBytes: Uint8Array): Uint8Array;
2530
2571
  /**
2531
2572
  * Compute the Solana balance-proof message hash:
2532
2573
  * sha256(utf8(channelId) || cumulativeAmount(32BE) || nonce(32BE) || utf8(recipient))
@@ -4645,4 +4686,4 @@ declare function selectLatestAddressable<T extends Event>(events: T[]): T | unde
4645
4686
  */
4646
4687
  declare const VERSION = "0.1.0";
4647
4688
 
4648
- 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 };
4689
+ 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, coopCloseHashEvm, createAgentRuntimeClient, createDirectChannelClient, createDirectConnectorAdmin, createDirectIlpClient, createDirectRuntimeClient, createDiscoveryTracker, createHttpChannelClient, createHttpConnectorAdmin, createHttpIlpClient$1 as createHttpIlpClient, createHttpRuntimeClient, createHttpIlpClient as createHttpRuntimeClientV2, createLogger, createToonNode, deriveChildAddress, deriveFromKmsSeed, deriveMinaPublicKeyBase58, eip712DomainSeparatorEvm, 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
@@ -2987,15 +2987,88 @@ function concatBytes(...parts) {
2987
2987
  }
2988
2988
  return out;
2989
2989
  }
2990
- function balanceProofHashEvm(channelIdBytes, cumulativeAmount, nonce, recipientBytes) {
2990
+ var EIP712_PREFIX = new Uint8Array([25, 1]);
2991
+ var EIP712DOMAIN_TYPEHASH = keccak_256(
2992
+ new TextEncoder().encode(
2993
+ "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
2994
+ )
2995
+ );
2996
+ var DOMAIN_NAME_HASH = keccak_256(new TextEncoder().encode("RollingSwapChannel"));
2997
+ var DOMAIN_VERSION_HASH = keccak_256(new TextEncoder().encode("2"));
2998
+ var CLAIM_TYPEHASH = keccak_256(
2999
+ new TextEncoder().encode(
3000
+ "ClaimBalanceProof(bytes32 channelId,uint256 cumulativeAmount,uint256 nonce,address recipient)"
3001
+ )
3002
+ );
3003
+ var COOP_CLOSE_TYPEHASH = keccak_256(
3004
+ new TextEncoder().encode(
3005
+ "CooperativeClose(bytes32 channelId,uint256 cumulativeAmount,uint256 nonce)"
3006
+ )
3007
+ );
3008
+ function leftPad32(bytes) {
3009
+ if (bytes.length > 32) {
3010
+ throw new Error(`cannot left-pad ${bytes.length} bytes into 32`);
3011
+ }
3012
+ const out = new Uint8Array(32);
3013
+ out.set(bytes, 32 - bytes.length);
3014
+ return out;
3015
+ }
3016
+ function eip712DomainSeparatorEvm(chainId, verifyingContractBytes) {
3017
+ if (verifyingContractBytes.length !== 20) {
3018
+ throw new Error(
3019
+ `verifyingContract must be 20 bytes (got ${verifyingContractBytes.length})`
3020
+ );
3021
+ }
2991
3022
  return keccak_256(
2992
3023
  concatBytes(
3024
+ EIP712DOMAIN_TYPEHASH,
3025
+ DOMAIN_NAME_HASH,
3026
+ DOMAIN_VERSION_HASH,
3027
+ bigintToBytes32BE(chainId),
3028
+ leftPad32(verifyingContractBytes)
3029
+ )
3030
+ );
3031
+ }
3032
+ function eip712Digest(domainSeparator, structHash) {
3033
+ return keccak_256(concatBytes(EIP712_PREFIX, domainSeparator, structHash));
3034
+ }
3035
+ function balanceProofHashEvm(channelIdBytes, cumulativeAmount, nonce, recipientBytes, chainId, verifyingContractBytes) {
3036
+ if (channelIdBytes.length !== 32) {
3037
+ throw new Error(`channelId must be 32 bytes (got ${channelIdBytes.length})`);
3038
+ }
3039
+ if (recipientBytes.length !== 20) {
3040
+ throw new Error(`recipient must be 20 bytes (got ${recipientBytes.length})`);
3041
+ }
3042
+ const structHash = keccak_256(
3043
+ concatBytes(
3044
+ CLAIM_TYPEHASH,
2993
3045
  channelIdBytes,
2994
3046
  bigintToBytes32BE(cumulativeAmount),
2995
3047
  bigintToBytes32BE(nonce),
2996
- recipientBytes
3048
+ leftPad32(recipientBytes)
2997
3049
  )
2998
3050
  );
3051
+ return eip712Digest(
3052
+ eip712DomainSeparatorEvm(chainId, verifyingContractBytes),
3053
+ structHash
3054
+ );
3055
+ }
3056
+ function coopCloseHashEvm(channelIdBytes, cumulativeAmount, nonce, chainId, verifyingContractBytes) {
3057
+ if (channelIdBytes.length !== 32) {
3058
+ throw new Error(`channelId must be 32 bytes (got ${channelIdBytes.length})`);
3059
+ }
3060
+ const structHash = keccak_256(
3061
+ concatBytes(
3062
+ COOP_CLOSE_TYPEHASH,
3063
+ channelIdBytes,
3064
+ bigintToBytes32BE(cumulativeAmount),
3065
+ bigintToBytes32BE(nonce)
3066
+ )
3067
+ );
3068
+ return eip712Digest(
3069
+ eip712DomainSeparatorEvm(chainId, verifyingContractBytes),
3070
+ structHash
3071
+ );
2999
3072
  }
3000
3073
  function balanceProofHashSolana(channelId, cumulativeAmount, nonce, recipient) {
3001
3074
  return sha256(
@@ -5514,6 +5587,7 @@ export {
5514
5587
  calculateRouteAmount,
5515
5588
  checkAddressCollision,
5516
5589
  concatBytes,
5590
+ coopCloseHashEvm,
5517
5591
  createAgentRuntimeClient,
5518
5592
  createDirectChannelClient,
5519
5593
  createDirectConnectorAdmin,
@@ -5531,6 +5605,7 @@ export {
5531
5605
  deriveChildAddress,
5532
5606
  deriveFromKmsSeed,
5533
5607
  deriveMinaPublicKeyBase58,
5608
+ eip712DomainSeparatorEvm,
5534
5609
  encodeEventToToon,
5535
5610
  encodeEventToToonString,
5536
5611
  extractPrefixFromHandshake,