syntax = "proto3";
package cln;

message Amount {
	uint64 msat = 1;
}

message AmountOrAll {
	oneof value {
		Amount amount = 1;
		bool all = 2;
	}
}

message AmountOrAny {
	oneof value {
		Amount amount = 1;
		bool any = 2;
	}
}

enum ChannelSide {
	LOCAL = 0;
	REMOTE = 1;
}

enum ChannelState {
	Openingd = 0;
	ChanneldAwaitingLockin = 1;
	ChanneldNormal = 2;
	ChanneldShuttingDown = 3;
	ClosingdSigexchange = 4;
	ClosingdComplete = 5;
	AwaitingUnilateral = 6;
	FundingSpendSeen = 7;
	Onchain = 8;
	DualopendOpenInit = 9;
	DualopendAwaitingLockin = 10;
	ChanneldAwaitingSplice = 11;
	DualopendOpenCommitted = 12;
	DualopendOpenCommittReady = 13;
	Closed = 14;
}

enum HtlcState {
	SentAddHtlc = 0;
	SentAddCommit = 1;
	RcvdAddRevocation = 2;
	RcvdAddAckCommit = 3;
	SentAddAckRevocation = 4;
	RcvdAddAckRevocation = 5;
	RcvdRemoveHtlc = 6;
	RcvdRemoveCommit = 7;
	SentRemoveRevocation = 8;
	SentRemoveAckCommit = 9;
	RcvdRemoveAckRevocation = 10;
	RcvdAddHtlc = 11;
	RcvdAddCommit = 12;
	SentAddRevocation = 13;
	SentAddAckCommit = 14;
	SentRemoveHtlc = 15;
	SentRemoveCommit = 16;
	RcvdRemoveRevocation = 17;
	RcvdRemoveAckCommit = 18;
	SentRemoveAckRevocation = 19;
}

message Outpoint {
	bytes txid = 1;
	uint32 outnum = 2;
}

message Feerate {
	oneof style {
		bool slow = 1;
		bool normal = 2;
		bool urgent = 3;
		uint32 perkb = 4;
		uint32 perkw = 5;
	}
}

message OutputDesc {
	string address = 1;
	Amount amount = 2;
}

message RouteHop {
	bytes id = 1;
	string scid = 2;
	Amount feebase = 3;
	uint32 feeprop = 4;
	uint32 expirydelta = 5;
}
message Routehint {
	repeated RouteHop hops = 1;
}
message RoutehintList {
	repeated Routehint hints = 2;
}

message DecodeRouteHop {
	bytes pubkey = 1;
	string short_channel_id = 2;
	Amount fee_base_msat = 3;
	uint32 fee_proportional_millionths = 4;
	uint32 cltv_expiry_delta = 5;
}
message DecodeRoutehint {
	repeated DecodeRouteHop hops = 1;
}
message DecodeRoutehintList {
	repeated DecodeRoutehint hints = 2;
}

message TlvEntry {
	uint64 type = 1;
	bytes value = 2;
}

message TlvStream {
	repeated TlvEntry entries = 1;
}

enum ChannelTypeName {
  static_remotekey_even = 0;
  anchor_outputs_even = 1;
  anchors_zero_fee_htlc_tx_even = 2;
  scid_alias_even = 3;
  zeroconf_even = 4;
  anchors_even = 5;
}

enum AutocleanSubsystem {
	SUCCEEDEDFORWARDS = 0;
	FAILEDFORWARDS = 1;
	SUCCEEDEDPAYS = 2;
	FAILEDPAYS = 3;
	PAIDINVOICES = 4;
	EXPIREDINVOICES = 5;
}

enum PluginSubcommand {
	START = 0;
	STOP = 1;
	RESCAN = 2;
	STARTDIR = 3;
	LIST = 4;
}

message JsonObjectOrArray {
	oneof structure {
		JsonObject object = 1;
		JsonArray array  = 2;
	}
}

message JsonObject {
	map<string, JsonValue> fields = 1;
}

message JsonArray {
	repeated JsonValue values = 1;
}

message JsonValue {
  	oneof kind {
		bool   bool_value   = 1;
		int64  int_value    = 2;
		uint64 uint_value   = 3;
		double double_value = 4;
		string string_value = 5;
		JsonArray  array    = 6;
		JsonObject object   = 7;
  }
}

message JsonScalar {
	oneof scalar {
		bool   bool_value   = 1;
		int64  int_value    = 2;
		uint64 uint_value   = 3;
		double double_value = 4;
		string string_value = 5;
	}
}

message ProofField {
	oneof ident {
		string name   = 1;
		uint64 number = 2;
	}
}
