// This file is autogenerated by `msggen`
// Do not edit it manually, your changes will be overwritten
use serde::{Serialize, Deserialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum Hook {
#[serde(rename = "peer_connected")]
PeerConnected(events::PeerConnectedEvent),
#[serde(rename = "recover_hook")]
RecoverHook(events::RecoverHookEvent),
#[serde(rename = "commitment_revocation")]
CommitmentRevocation(events::CommitmentRevocationEvent),
#[serde(rename = "db_write")]
DbWrite(events::DbWriteEvent),
#[serde(rename = "invoice_payment_hook")]
InvoicePaymentHook(events::InvoicePaymentHookEvent),
#[serde(rename = "openchannel")]
Openchannel(events::OpenchannelEvent),
#[serde(rename = "openchannel2")]
Openchannel2(events::Openchannel2Event),
#[serde(rename = "openchannel2_changed")]
Openchannel2Changed(events::Openchannel2ChangedEvent),
#[serde(rename = "openchannel2_sign")]
Openchannel2Sign(events::Openchannel2SignEvent),
#[serde(rename = "rbf_channel")]
RbfChannel(events::RbfChannelEvent),
#[serde(rename = "htlc_accepted")]
HtlcAccepted(events::HtlcAcceptedEvent),
#[serde(rename = "rpc_command")]
RpcCommand(events::RpcCommandEvent),
#[serde(rename = "custommsg_hook")]
CustommsgHook(events::CustommsgHookEvent),
#[serde(rename = "onion_message_recv")]
OnionMessageRecv(events::OnionMessageRecvEvent),
#[serde(rename = "onion_message_recv_secret")]
OnionMessageRecvSecret(events::OnionMessageRecvSecretEvent),
}
pub mod events{
use crate::primitives::*;
use serde::{Serialize, Deserialize};
/// ['Connection direction: `in` for incoming, `out` for outgoing.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum PeerConnectedPeerDirection {
#[serde(rename = "in")]
IN = 0,
#[serde(rename = "out")]
OUT = 1,
}
impl TryFrom<i32> for PeerConnectedPeerDirection {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<PeerConnectedPeerDirection, anyhow::Error> {
match c {
0 => Ok(PeerConnectedPeerDirection::IN),
1 => Ok(PeerConnectedPeerDirection::OUT),
o => Err(anyhow::anyhow!("Unknown variant {} for enum PeerConnectedPeerDirection", o)),
}
}
}
impl ToString for PeerConnectedPeerDirection {
fn to_string(&self) -> String {
match self {
PeerConnectedPeerDirection::IN => "IN",
PeerConnectedPeerDirection::OUT => "OUT",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerConnectedPeer {
#[serde(skip_serializing_if = "Option::is_none")]
pub remote_addr: Option<String>,
// Path `peer_connected.peer.direction`
pub direction: PeerConnectedPeerDirection,
pub addr: String,
pub features: String,
pub id: PublicKey,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerConnectedEvent {
pub peer: PeerConnectedPeer,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RecoverHookEvent {
pub codex32: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CommitmentRevocationEvent {
pub channel_id: Sha256,
pub commitment_txid: String,
pub commitnum: u64,
pub penalty_tx: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DbWriteEvent {
pub data_version: u32,
pub writes: Vec<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InvoicePaymentHookPayment {
pub label: String,
pub msat: Amount,
pub preimage: Secret,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InvoicePaymentHookEvent {
pub payment: InvoicePaymentHookPayment,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OpenchannelOpenchannelChannelType {
pub bits: Vec<u32>,
pub names: Vec<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OpenchannelOpenchannel {
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_type: Option<OpenchannelOpenchannelChannelType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub shutdown_scriptpubkey: Option<String>,
pub channel_flags: u8,
pub channel_reserve_msat: Amount,
pub dust_limit_msat: Amount,
pub feerate_per_kw: u32,
pub funding_msat: Amount,
pub htlc_minimum_msat: Amount,
pub id: PublicKey,
pub max_accepted_htlcs: u32,
pub max_htlc_value_in_flight_msat: Amount,
pub push_msat: Amount,
pub to_self_delay: u32,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OpenchannelEvent {
pub openchannel: OpenchannelOpenchannel,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2Openchannel2ChannelType {
pub bits: Vec<u32>,
pub names: Vec<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2Openchannel2 {
#[serde(skip_serializing_if = "Option::is_none")]
pub channel_type: Option<Openchannel2Openchannel2ChannelType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub lease_blockheight_start: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub node_blockheight: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_lease_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
pub shutdown_scriptpubkey: Option<String>,
pub channel_flags: u8,
pub channel_id: Sha256,
pub channel_max_msat: Amount,
pub commitment_feerate_per_kw: u32,
pub dust_limit_msat: Amount,
pub feerate_our_max: u32,
pub feerate_our_min: u32,
pub funding_feerate_per_kw: u32,
pub htlc_minimum_msat: Amount,
pub id: PublicKey,
pub locktime: u32,
pub max_accepted_htlcs: u16,
pub max_htlc_value_in_flight_msat: Amount,
pub require_confirmed_inputs: bool,
pub their_funding_msat: Amount,
pub to_self_delay: u16,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2Event {
pub openchannel2: Openchannel2Openchannel2,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2ChangedOpenchannel2Changed {
pub channel_id: Sha256,
pub psbt: String,
pub require_confirmed_inputs: bool,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2ChangedEvent {
pub openchannel2_changed: Openchannel2ChangedOpenchannel2Changed,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2SignOpenchannel2Sign {
pub channel_id: Sha256,
pub psbt: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2SignEvent {
pub openchannel2_sign: Openchannel2SignOpenchannel2Sign,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RbfChannelRbfChannel {
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_lease_msat: Option<Amount>,
pub channel_id: Sha256,
pub channel_max_msat: Amount,
pub feerate_our_max: u32,
pub feerate_our_min: u32,
pub funding_feerate_per_kw: u32,
pub id: PublicKey,
pub locktime: u32,
pub our_last_funding_msat: Amount,
pub require_confirmed_inputs: bool,
pub their_funding_msat: Amount,
pub their_last_funding_msat: Amount,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RbfChannelEvent {
pub rbf_channel: RbfChannelRbfChannel,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HtlcAcceptedHtlc {
#[serde(skip_serializing_if = "Option::is_none")]
pub extra_tlvs: Option<String>,
pub amount_msat: Amount,
pub cltv_expiry: u32,
pub cltv_expiry_relative: u32,
pub id: u64,
pub payment_hash: Sha256,
pub short_channel_id: ShortChannelId,
}
/// ['Indicates that the payload is TLV formatted.', 'Only present if the payload was successfully parsed.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum HtlcAcceptedOnionType {
#[serde(rename = "tlv")]
TLV = 0,
}
impl TryFrom<i32> for HtlcAcceptedOnionType {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<HtlcAcceptedOnionType, anyhow::Error> {
match c {
0 => Ok(HtlcAcceptedOnionType::TLV),
o => Err(anyhow::anyhow!("Unknown variant {} for enum HtlcAcceptedOnionType", o)),
}
}
}
impl ToString for HtlcAcceptedOnionType {
fn to_string(&self) -> String {
match self {
HtlcAcceptedOnionType::TLV => "TLV",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HtlcAcceptedOnion {
#[serde(skip_serializing_if = "Option::is_none")]
pub forward_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
pub item_type: Option<HtlcAcceptedOnionType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub next_node_id: Option<PublicKey>,
#[serde(skip_serializing_if = "Option::is_none")]
pub outgoing_cltv_value: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_metadata: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_secret: Option<Secret>,
#[serde(skip_serializing_if = "Option::is_none")]
pub short_channel_id: Option<ShortChannelId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub total_msat: Option<Amount>,
pub next_onion: String,
pub payload: String,
pub shared_secret: Secret,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HtlcAcceptedEvent {
#[serde(skip_serializing_if = "Option::is_none")]
pub forward_to: Option<Sha256>,
#[serde(skip_serializing_if = "Option::is_none")]
pub peer_id: Option<PublicKey>,
pub htlc: HtlcAcceptedHtlc,
pub onion: HtlcAcceptedOnion,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandRpcCommand {
pub id: JsonScalar,
pub method: String,
pub params: JsonObjectOrArray,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandEvent {
pub rpc_command: RpcCommandRpcCommand,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CustommsgHookEvent {
pub payload: String,
pub peer_id: PublicKey,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvOnionMessageReplyBlindedpathHops {
pub blinded_node_id: PublicKey,
pub encrypted_recipient_data: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvOnionMessageReplyBlindedpath {
#[serde(skip_serializing_if = "Option::is_none")]
pub first_node_id: Option<PublicKey>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_path_key: Option<PublicKey>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_scid: Option<ShortChannelId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_scid_dir: Option<u32>,
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
pub hops: Option<Vec<OnionMessageRecvOnionMessageReplyBlindedpathHops>>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvOnionMessageUnknownFields {
pub number: u64,
pub value: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvOnionMessage {
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_error: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_request: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_blindedpath: Option<OnionMessageRecvOnionMessageReplyBlindedpath>,
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
pub unknown_fields: Option<Vec<OnionMessageRecvOnionMessageUnknownFields>>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvEvent {
pub onion_message: OnionMessageRecvOnionMessage,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvSecretOnionMessageReplyBlindedpathHops {
pub blinded_node_id: PublicKey,
pub encrypted_recipient_data: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvSecretOnionMessageReplyBlindedpath {
#[serde(skip_serializing_if = "Option::is_none")]
pub first_node_id: Option<PublicKey>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_path_key: Option<PublicKey>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_scid: Option<ShortChannelId>,
#[serde(skip_serializing_if = "Option::is_none")]
pub first_scid_dir: Option<u32>,
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
pub hops: Option<Vec<OnionMessageRecvSecretOnionMessageReplyBlindedpathHops>>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvSecretOnionMessageUnknownFields {
pub number: u64,
pub value: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvSecretOnionMessage {
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_error: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_request: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reply_blindedpath: Option<OnionMessageRecvSecretOnionMessageReplyBlindedpath>,
#[serde(skip_serializing_if = "crate::is_none_or_empty")]
pub unknown_fields: Option<Vec<OnionMessageRecvSecretOnionMessageUnknownFields>>,
pub pathsecret: Secret,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvSecretEvent {
pub onion_message: OnionMessageRecvSecretOnionMessage,
}
}
pub mod actions{
use crate::primitives::*;
use serde::{Serialize, Deserialize};
/// ['Whether to allow the connection to proceed or disconnect the peer.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum PeerConnectedResult {
#[serde(rename = "continue")]
CONTINUE = 0,
#[serde(rename = "disconnect")]
DISCONNECT = 1,
}
impl TryFrom<i32> for PeerConnectedResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<PeerConnectedResult, anyhow::Error> {
match c {
0 => Ok(PeerConnectedResult::CONTINUE),
1 => Ok(PeerConnectedResult::DISCONNECT),
o => Err(anyhow::anyhow!("Unknown variant {} for enum PeerConnectedResult", o)),
}
}
}
impl ToString for PeerConnectedResult {
fn to_string(&self) -> String {
match self {
PeerConnectedResult::CONTINUE => "CONTINUE",
PeerConnectedResult::DISCONNECT => "DISCONNECT",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PeerConnectedAction {
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
// Path `peer_connected.result`
pub result: PeerConnectedResult,
}
/// ['Returning "continue" resumes normal execution.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum RecoverHookResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for RecoverHookResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<RecoverHookResult, anyhow::Error> {
match c {
0 => Ok(RecoverHookResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum RecoverHookResult", o)),
}
}
}
impl ToString for RecoverHookResult {
fn to_string(&self) -> String {
match self {
RecoverHookResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RecoverHookAction {
// Path `recover_hook.result`
pub result: RecoverHookResult,
}
/// ['Plugins should always return "continue", otherwise subsequent hook subscribers would not get called.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum CommitmentRevocationResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for CommitmentRevocationResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<CommitmentRevocationResult, anyhow::Error> {
match c {
0 => Ok(CommitmentRevocationResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum CommitmentRevocationResult", o)),
}
}
}
impl ToString for CommitmentRevocationResult {
fn to_string(&self) -> String {
match self {
CommitmentRevocationResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CommitmentRevocationAction {
// Path `commitment_revocation.result`
pub result: CommitmentRevocationResult,
}
/// ['Must be "continue" for the database commit to proceed.', 'Any other value will abort the commit and cause `lightningd` to error.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum DbWriteResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for DbWriteResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<DbWriteResult, anyhow::Error> {
match c {
0 => Ok(DbWriteResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum DbWriteResult", o)),
}
}
}
impl ToString for DbWriteResult {
fn to_string(&self) -> String {
match self {
DbWriteResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DbWriteAction {
// Path `db_write.result`
pub result: DbWriteResult,
}
/// ['Controls whether the payment is accepted or rejected.', '"continue" accepts the payment.', '"reject" fails the payment.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum InvoicePaymentHookResult {
#[serde(rename = "continue")]
CONTINUE = 0,
#[serde(rename = "reject")]
REJECT = 1,
}
impl TryFrom<i32> for InvoicePaymentHookResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<InvoicePaymentHookResult, anyhow::Error> {
match c {
0 => Ok(InvoicePaymentHookResult::CONTINUE),
1 => Ok(InvoicePaymentHookResult::REJECT),
o => Err(anyhow::anyhow!("Unknown variant {} for enum InvoicePaymentHookResult", o)),
}
}
}
impl ToString for InvoicePaymentHookResult {
fn to_string(&self) -> String {
match self {
InvoicePaymentHookResult::CONTINUE => "CONTINUE",
InvoicePaymentHookResult::REJECT => "REJECT",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct InvoicePaymentHookAction {
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_message: Option<String>,
// Path `invoice_payment_hook.result`
pub result: InvoicePaymentHookResult,
}
/// ['Whether to accept or reject the channel opening request.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum OpenchannelResult {
#[serde(rename = "continue")]
CONTINUE = 0,
#[serde(rename = "reject")]
REJECT = 1,
}
impl TryFrom<i32> for OpenchannelResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<OpenchannelResult, anyhow::Error> {
match c {
0 => Ok(OpenchannelResult::CONTINUE),
1 => Ok(OpenchannelResult::REJECT),
o => Err(anyhow::anyhow!("Unknown variant {} for enum OpenchannelResult", o)),
}
}
}
impl ToString for OpenchannelResult {
fn to_string(&self) -> String {
match self {
OpenchannelResult::CONTINUE => "CONTINUE",
OpenchannelResult::REJECT => "REJECT",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OpenchannelAction {
#[serde(skip_serializing_if = "Option::is_none")]
pub close_to: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub mindepth: Option<u32>,
#[serde(skip_serializing_if = "Option::is_none")]
pub reserve: Option<Amount>,
// Path `openchannel.result`
pub result: OpenchannelResult,
}
/// ['Indicates whether to accept or reject the channel proposal.', 'Returning "continue" allows the channel negotiation to proceed.', 'Returning "reject" aborts the channel opening.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum Openchannel2Result {
#[serde(rename = "continue")]
CONTINUE = 0,
#[serde(rename = "reject")]
REJECT = 1,
}
impl TryFrom<i32> for Openchannel2Result {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<Openchannel2Result, anyhow::Error> {
match c {
0 => Ok(Openchannel2Result::CONTINUE),
1 => Ok(Openchannel2Result::REJECT),
o => Err(anyhow::anyhow!("Unknown variant {} for enum Openchannel2Result", o)),
}
}
}
impl ToString for Openchannel2Result {
fn to_string(&self) -> String {
match self {
Openchannel2Result::CONTINUE => "CONTINUE",
Openchannel2Result::REJECT => "REJECT",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2Action {
#[serde(skip_serializing_if = "Option::is_none")]
pub close_to: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub our_funding_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
pub psbt: Option<String>,
// Path `openchannel2.result`
pub result: Openchannel2Result,
}
/// ['Must be set to `continue` to proceed with the channel opening negotiation.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum Openchannel2ChangedResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for Openchannel2ChangedResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<Openchannel2ChangedResult, anyhow::Error> {
match c {
0 => Ok(Openchannel2ChangedResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum Openchannel2ChangedResult", o)),
}
}
}
impl ToString for Openchannel2ChangedResult {
fn to_string(&self) -> String {
match self {
Openchannel2ChangedResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2ChangedAction {
// Path `openchannel2_changed.result`
pub result: Openchannel2ChangedResult,
pub psbt: String,
}
/// ['Must be set to `continue` to proceed with channel opening.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum Openchannel2SignResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for Openchannel2SignResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<Openchannel2SignResult, anyhow::Error> {
match c {
0 => Ok(Openchannel2SignResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum Openchannel2SignResult", o)),
}
}
}
impl ToString for Openchannel2SignResult {
fn to_string(&self) -> String {
match self {
Openchannel2SignResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct Openchannel2SignAction {
// Path `openchannel2_sign.result`
pub result: Openchannel2SignResult,
pub psbt: String,
}
/// ['Whether to accept or reject the RBF proposal.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum RbfChannelResult {
#[serde(rename = "continue")]
CONTINUE = 0,
#[serde(rename = "reject")]
REJECT = 1,
}
impl TryFrom<i32> for RbfChannelResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<RbfChannelResult, anyhow::Error> {
match c {
0 => Ok(RbfChannelResult::CONTINUE),
1 => Ok(RbfChannelResult::REJECT),
o => Err(anyhow::anyhow!("Unknown variant {} for enum RbfChannelResult", o)),
}
}
}
impl ToString for RbfChannelResult {
fn to_string(&self) -> String {
match self {
RbfChannelResult::CONTINUE => "CONTINUE",
RbfChannelResult::REJECT => "REJECT",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RbfChannelAction {
#[serde(skip_serializing_if = "Option::is_none")]
pub error_message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub our_funding_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
pub psbt: Option<String>,
// Path `rbf_channel.result`
pub result: RbfChannelResult,
}
/// ['Determines how the HTLC should be handled.', '', '`continue` means that the plugin does not want to do anything special and lightningd should continue processing it normally,', "i.e., resolve the payment if we're the recipient, or attempt to forward it otherwise. Notice that the usual checks such as sufficient fees and CLTV deltas are still enforced.", '', 'It can also replace the onion.payload by specifying a payload in the response. Note that this is always a TLV-style payload,', 'so unlike onion.payload there is no length prefix (and it must be at least 4 hex digits long). This will be re-parsed;', "it's useful for removing onion fields which a plugin doesn't want lightningd to consider.", '', 'It can also specify forward_to in the response, replacing the destination.', 'This usually only makes sense if it wants to choose an alternate channel to the same next peer, but is useful if the payload is also replaced.', '', 'Also, it can specify extra_tlvs in the response. This will replace the TLV-stream update_add_htlc_tlvs in the update_add_htlc message for forwarded htlcs.', '', 'If the node is the final destination, the plugin can also replace the amount of the invoice that belongs to the payment_hash by specifying invoice_msat.', '', '', '`fail` will tell lightningd to fail the HTLC with a given hex-encoded `failure_message` (please refer to BOLT #4 for details: `incorrect_or_unknown_payment_details` is the most common).', '', 'Instead of `failure_message` the response can contain a hex-encoded `failure_onion` that will be used instead (please refer to the BOLT #4 for details).', "This can be used, for example, if you're writing a bridge between two Lightning Networks. Note that lightningd will apply the obfuscation step to the value", 'returned here with its own shared secret (and key type `ammag`) before returning it to the previous hop.', '', '', '`resolve` instructs lightningd to claim the HTLC by providing the preimage matching the `payment_hash` presented in the call.', 'Notice that the plugin must ensure that the `payment_key` really matches the `payment_hash` since lightningd will not check and the wrong value could result in the channel being closed.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum HtlcAcceptedResult {
#[serde(rename = "continue")]
CONTINUE = 0,
#[serde(rename = "fail")]
FAIL = 1,
#[serde(rename = "resolve")]
RESOLVE = 2,
}
impl TryFrom<i32> for HtlcAcceptedResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<HtlcAcceptedResult, anyhow::Error> {
match c {
0 => Ok(HtlcAcceptedResult::CONTINUE),
1 => Ok(HtlcAcceptedResult::FAIL),
2 => Ok(HtlcAcceptedResult::RESOLVE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum HtlcAcceptedResult", o)),
}
}
}
impl ToString for HtlcAcceptedResult {
fn to_string(&self) -> String {
match self {
HtlcAcceptedResult::CONTINUE => "CONTINUE",
HtlcAcceptedResult::FAIL => "FAIL",
HtlcAcceptedResult::RESOLVE => "RESOLVE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct HtlcAcceptedAction {
#[serde(skip_serializing_if = "Option::is_none")]
pub extra_tlvs: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_message: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub failure_onion: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub forward_to: Option<Sha256>,
#[serde(skip_serializing_if = "Option::is_none")]
pub invoice_msat: Option<Amount>,
#[serde(skip_serializing_if = "Option::is_none")]
pub payload: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_key: Option<Secret>,
// Path `htlc_accepted.result`
pub result: HtlcAcceptedResult,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandReturnError {
pub code: i64,
pub message: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandReturnResult {
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandReturn {
#[serde(skip_serializing_if = "Option::is_none")]
pub error: Option<RpcCommandReturnError>,
#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<RpcCommandReturnResult>,
}
/// ['The JSON-RPC version.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum RpcCommandReplaceJsonrpc {
#[serde(rename = "2.0")]
NUM_2_0 = 0,
}
impl TryFrom<i32> for RpcCommandReplaceJsonrpc {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<RpcCommandReplaceJsonrpc, anyhow::Error> {
match c {
0 => Ok(RpcCommandReplaceJsonrpc::NUM_2_0),
o => Err(anyhow::anyhow!("Unknown variant {} for enum RpcCommandReplaceJsonrpc", o)),
}
}
}
impl ToString for RpcCommandReplaceJsonrpc {
fn to_string(&self) -> String {
match self {
RpcCommandReplaceJsonrpc::NUM_2_0 => "NUM_2_0",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandReplace {
// Path `rpc_command.replace.jsonrpc`
pub jsonrpc: RpcCommandReplaceJsonrpc,
pub id: JsonScalar,
pub method: String,
pub params: JsonObjectOrArray,
}
/// ['Indicates that lightningd should continue processing the RPC command normally.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum RpcCommandResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for RpcCommandResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<RpcCommandResult, anyhow::Error> {
match c {
0 => Ok(RpcCommandResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum RpcCommandResult", o)),
}
}
}
impl ToString for RpcCommandResult {
fn to_string(&self) -> String {
match self {
RpcCommandResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct RpcCommandAction {
#[serde(rename = "return")]
#[serde(skip_serializing_if = "Option::is_none")]
pub return_: Option<RpcCommandReturn>,
#[serde(skip_serializing_if = "Option::is_none")]
pub replace: Option<RpcCommandReplace>,
#[serde(skip_serializing_if = "Option::is_none")]
pub result: Option<RpcCommandResult>,
}
/// ['Must always be `continue`. Any other value will cause the hook to fail.']
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
#[allow(non_camel_case_types)]
pub enum CustommsgHookResult {
#[serde(rename = "continue")]
CONTINUE = 0,
}
impl TryFrom<i32> for CustommsgHookResult {
type Error = anyhow::Error;
fn try_from(c: i32) -> Result<CustommsgHookResult, anyhow::Error> {
match c {
0 => Ok(CustommsgHookResult::CONTINUE),
o => Err(anyhow::anyhow!("Unknown variant {} for enum CustommsgHookResult", o)),
}
}
}
impl ToString for CustommsgHookResult {
fn to_string(&self) -> String {
match self {
CustommsgHookResult::CONTINUE => "CONTINUE",
}.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct CustommsgHookAction {
// Path `custommsg_hook.result`
pub result: CustommsgHookResult,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvAction {
pub result: String,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct OnionMessageRecvSecretAction {
pub result: String,
}
}