syntax = "proto3";

package hydra_app;

import "primitives.proto";

// Preimage-settlement service.
//
// A revealed preimage `S` can settle value on two independent facets of a
// network's node: held **channel** hashlock payments (claim + arm force-close /
// on-chain settlement) and **on-chain HTLC** legs (claim every `Locked` HTLC
// paying this node whose hash is `sha256(S)`). This service exposes the single
// uniform act "settle every leg this preimage unlocks", fanning out to whichever
// facets the network has — kept separate from the node-management service so the
// settlement capability has its own surface.
//
// JSON-RPC namespace: `preimage`
service PreimageService {
  // Register a revealed preimage and settle every leg it unlocks on the given
  // network: persist it durably, claim held channel payments + arm force-close,
  // and (on HTLC-capable networks) claim matching on-chain HTLCs. Idempotent.
  rpc SettlePreimage(SettlePreimageRequest) returns (SettlePreimageResponse) {}
}

message SettlePreimageRequest {
  // The target network.
  Network network = 1;
  // The hex-encoded preimage to settle.
  string payment_preimage = 2;
}

message SettlePreimageResponse {}
