Table of Contents

Interface IMessageFactory

Namespace
NLightning.Domain.Protocol.Interfaces
Assembly
NLightning.Domain.dll
public interface IMessageFactory

Methods

CreateAcceptChannel1Message(LightningMoney, ChannelTypeTlv?, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, ushort, LightningMoney, uint, CompactPubKey, CompactPubKey, ChannelId, ushort, UpfrontShutdownScriptTlv?)

AcceptChannel1Message CreateAcceptChannel1Message(LightningMoney channelReserveAmount, ChannelTypeTlv? channelTypeTlv, CompactPubKey delayedPaymentBasepoint, CompactPubKey firstPerCommitmentPoint, CompactPubKey fundingPubKey, CompactPubKey htlcBasepoint, ushort maxAcceptedHtlcs, LightningMoney maxHtlcValueInFlight, uint minimumDepth, CompactPubKey paymentBasepoint, CompactPubKey revocationBasepoint, ChannelId temporaryChannelId, ushort toSelfDelay, UpfrontShutdownScriptTlv? upfrontShutdownScriptTlv)

Parameters

channelReserveAmount LightningMoney
channelTypeTlv ChannelTypeTlv
delayedPaymentBasepoint CompactPubKey
firstPerCommitmentPoint CompactPubKey
fundingPubKey CompactPubKey
htlcBasepoint CompactPubKey
maxAcceptedHtlcs ushort
maxHtlcValueInFlight LightningMoney
minimumDepth uint
paymentBasepoint CompactPubKey
revocationBasepoint CompactPubKey
temporaryChannelId ChannelId
toSelfDelay ushort
upfrontShutdownScriptTlv UpfrontShutdownScriptTlv

Returns

AcceptChannel1Message

CreateAcceptChannel2Message(ChannelId, LightningMoney, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, LightningMoney, BitcoinScript?, byte[]?, bool)

AcceptChannel2Message CreateAcceptChannel2Message(ChannelId temporaryChannelId, LightningMoney fundingSatoshis, CompactPubKey fundingPubKey, CompactPubKey revocationBasepoint, CompactPubKey paymentBasepoint, CompactPubKey delayedPaymentBasepoint, CompactPubKey htlcBasepoint, CompactPubKey firstPerCommitmentPoint, LightningMoney maxHtlcValueInFlight, BitcoinScript? shutdownScriptPubkey = null, byte[]? channelType = null, bool requireConfirmedInputs = false)

Parameters

temporaryChannelId ChannelId
fundingSatoshis LightningMoney
fundingPubKey CompactPubKey
revocationBasepoint CompactPubKey
paymentBasepoint CompactPubKey
delayedPaymentBasepoint CompactPubKey
htlcBasepoint CompactPubKey
firstPerCommitmentPoint CompactPubKey
maxHtlcValueInFlight LightningMoney
shutdownScriptPubkey BitcoinScript?
channelType byte[]
requireConfirmedInputs bool

Returns

AcceptChannel2Message

CreateChannelReadyMessage(ChannelId, CompactPubKey, ShortChannelId?)

ChannelReadyMessage CreateChannelReadyMessage(ChannelId channelId, CompactPubKey secondPerCommitmentPoint, ShortChannelId? shortChannelId = null)

Parameters

channelId ChannelId
secondPerCommitmentPoint CompactPubKey
shortChannelId ShortChannelId?

Returns

ChannelReadyMessage

CreateChannelReestablishMessage(ChannelId, ulong, ulong, ReadOnlyMemory<byte>, CompactPubKey)

ChannelReestablishMessage CreateChannelReestablishMessage(ChannelId channelId, ulong nextCommitmentNumber, ulong nextRevocationNumber, ReadOnlyMemory<byte> yourLastPerCommitmentSecret, CompactPubKey myCurrentPerCommitmentPoint)

Parameters

channelId ChannelId
nextCommitmentNumber ulong
nextRevocationNumber ulong
yourLastPerCommitmentSecret ReadOnlyMemory<byte>
myCurrentPerCommitmentPoint CompactPubKey

Returns

ChannelReestablishMessage

CreateClosingSignedMessage(ChannelId, ulong, CompactSignature, ulong, ulong)

ClosingSignedMessage CreateClosingSignedMessage(ChannelId channelId, ulong feeSatoshis, CompactSignature signature, ulong minFeeSatoshis, ulong maxFeeSatoshis)

Parameters

channelId ChannelId
feeSatoshis ulong
signature CompactSignature
minFeeSatoshis ulong
maxFeeSatoshis ulong

Returns

ClosingSignedMessage

CreateCommitmentSignedMessage(ChannelId, CompactSignature, IEnumerable<CompactSignature>)

CommitmentSignedMessage CreateCommitmentSignedMessage(ChannelId channelId, CompactSignature signature, IEnumerable<CompactSignature> htlcSignatures)

Parameters

channelId ChannelId
signature CompactSignature
htlcSignatures IEnumerable<CompactSignature>

Returns

CommitmentSignedMessage

CreateErrorMessage(byte[], ChannelId?)

ErrorMessage CreateErrorMessage(byte[] data, ChannelId? channelId)

Parameters

data byte[]
channelId ChannelId?

Returns

ErrorMessage

CreateErrorMessage(string, ChannelId?)

ErrorMessage CreateErrorMessage(string message, ChannelId? channelId)

Parameters

message string
channelId ChannelId?

Returns

ErrorMessage

CreateInitMessage()

InitMessage CreateInitMessage()

Returns

InitMessage

CreateOpenChannel1Message(ChannelId, LightningMoney, CompactPubKey, LightningMoney, LightningMoney, LightningMoney, ushort, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, ChannelFlags, UpfrontShutdownScriptTlv?, ChannelTypeTlv?)

OpenChannel1Message CreateOpenChannel1Message(ChannelId temporaryChannelId, LightningMoney fundingAmount, CompactPubKey fundingPubKey, LightningMoney pushAmount, LightningMoney channelReserveAmount, LightningMoney feeRatePerKw, ushort maxAcceptedHtlcs, CompactPubKey revocationBasepoint, CompactPubKey paymentBasepoint, CompactPubKey delayedPaymentBasepoint, CompactPubKey htlcBasepoint, CompactPubKey firstPerCommitmentPoint, ChannelFlags channelFlags, UpfrontShutdownScriptTlv? upfrontShutdownScriptTlv, ChannelTypeTlv? channelTypeTlv)

Parameters

temporaryChannelId ChannelId
fundingAmount LightningMoney
fundingPubKey CompactPubKey
pushAmount LightningMoney
channelReserveAmount LightningMoney
feeRatePerKw LightningMoney
maxAcceptedHtlcs ushort
revocationBasepoint CompactPubKey
paymentBasepoint CompactPubKey
delayedPaymentBasepoint CompactPubKey
htlcBasepoint CompactPubKey
firstPerCommitmentPoint CompactPubKey
channelFlags ChannelFlags
upfrontShutdownScriptTlv UpfrontShutdownScriptTlv
channelTypeTlv ChannelTypeTlv

Returns

OpenChannel1Message

CreateOpenChannel2Message(ChannelId, uint, uint, ulong, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, CompactPubKey, ChannelFlags, BitcoinScript?, byte[]?, bool)

OpenChannel2Message CreateOpenChannel2Message(ChannelId temporaryChannelId, uint fundingFeeRatePerKw, uint commitmentFeeRatePerKw, ulong fundingSatoshis, CompactPubKey fundingPubKey, CompactPubKey revocationBasepoint, CompactPubKey paymentBasepoint, CompactPubKey delayedPaymentBasepoint, CompactPubKey htlcBasepoint, CompactPubKey firstPerCommitmentPoint, CompactPubKey secondPerCommitmentPoint, ChannelFlags channelFlags, BitcoinScript? shutdownScriptPubkey = null, byte[]? channelType = null, bool requireConfirmedInputs = false)

Parameters

temporaryChannelId ChannelId
fundingFeeRatePerKw uint
commitmentFeeRatePerKw uint
fundingSatoshis ulong
fundingPubKey CompactPubKey
revocationBasepoint CompactPubKey
paymentBasepoint CompactPubKey
delayedPaymentBasepoint CompactPubKey
htlcBasepoint CompactPubKey
firstPerCommitmentPoint CompactPubKey
secondPerCommitmentPoint CompactPubKey
channelFlags ChannelFlags
shutdownScriptPubkey BitcoinScript?
channelType byte[]
requireConfirmedInputs bool

Returns

OpenChannel2Message

CreatePingMessage()

PingMessage CreatePingMessage()

Returns

PingMessage

CreatePongMessage(IMessage)

PongMessage CreatePongMessage(IMessage pingMessage)

Parameters

pingMessage IMessage

Returns

PongMessage

CreateRevokeAndAckMessage(ChannelId, ReadOnlyMemory<byte>, CompactPubKey)

RevokeAndAckMessage CreateRevokeAndAckMessage(ChannelId channelId, ReadOnlyMemory<byte> perCommitmentSecret, CompactPubKey nextPerCommitmentPoint)

Parameters

channelId ChannelId
perCommitmentSecret ReadOnlyMemory<byte>
nextPerCommitmentPoint CompactPubKey

Returns

RevokeAndAckMessage

CreateShutdownMessage(ChannelId, BitcoinScript)

ShutdownMessage CreateShutdownMessage(ChannelId channelId, BitcoinScript scriptPubkey)

Parameters

channelId ChannelId
scriptPubkey BitcoinScript

Returns

ShutdownMessage

CreateStfuMessage(ChannelId, bool)

StfuMessage CreateStfuMessage(ChannelId channelId, bool initiator)

Parameters

channelId ChannelId
initiator bool

Returns

StfuMessage

CreateTxAbortMessage(ChannelId, byte[])

TxAbortMessage CreateTxAbortMessage(ChannelId channelId, byte[] data)

Parameters

channelId ChannelId
data byte[]

Returns

TxAbortMessage

CreateTxAckRbfMessage(ChannelId, long, bool)

TxAckRbfMessage CreateTxAckRbfMessage(ChannelId channelId, long fundingOutputContrubution, bool requireConfirmedInputs)

Parameters

channelId ChannelId
fundingOutputContrubution long
requireConfirmedInputs bool

Returns

TxAckRbfMessage

CreateTxAddInputMessage(ChannelId, ulong, byte[], uint, uint)

TxAddInputMessage CreateTxAddInputMessage(ChannelId channelId, ulong serialId, byte[] prevTx, uint prevTxVout, uint sequence)

Parameters

channelId ChannelId
serialId ulong
prevTx byte[]
prevTxVout uint
sequence uint

Returns

TxAddInputMessage

CreateTxAddOutputMessage(ChannelId, ulong, LightningMoney, BitcoinScript)

TxAddOutputMessage CreateTxAddOutputMessage(ChannelId channelId, ulong serialId, LightningMoney amount, BitcoinScript script)

Parameters

channelId ChannelId
serialId ulong
amount LightningMoney
script BitcoinScript

Returns

TxAddOutputMessage

CreateTxCompleteMessage(ChannelId)

TxCompleteMessage CreateTxCompleteMessage(ChannelId channelId)

Parameters

channelId ChannelId

Returns

TxCompleteMessage

CreateTxInitRbfMessage(ChannelId, uint, uint, long, bool)

TxInitRbfMessage CreateTxInitRbfMessage(ChannelId channelId, uint locktime, uint feerate, long fundingOutputContrubution, bool requireConfirmedInputs)

Parameters

channelId ChannelId
locktime uint
feerate uint
fundingOutputContrubution long
requireConfirmedInputs bool

Returns

TxInitRbfMessage

CreateTxRemoveInputMessage(ChannelId, ulong)

TxRemoveInputMessage CreateTxRemoveInputMessage(ChannelId channelId, ulong serialId)

Parameters

channelId ChannelId
serialId ulong

Returns

TxRemoveInputMessage

CreateTxRemoveOutputMessage(ChannelId, ulong)

TxRemoveOutputMessage CreateTxRemoveOutputMessage(ChannelId channelId, ulong serialId)

Parameters

channelId ChannelId
serialId ulong

Returns

TxRemoveOutputMessage

CreateTxSignaturesMessage(ChannelId, byte[], List<Witness>)

TxSignaturesMessage CreateTxSignaturesMessage(ChannelId channelId, byte[] txId, List<Witness> witnesses)

Parameters

channelId ChannelId
txId byte[]
witnesses List<Witness>

Returns

TxSignaturesMessage

CreateUpdateAddHtlcMessage(ChannelId, ulong, ulong, ReadOnlyMemory<byte>, uint, ReadOnlyMemory<byte>?)

UpdateAddHtlcMessage CreateUpdateAddHtlcMessage(ChannelId channelId, ulong id, ulong amountMsat, ReadOnlyMemory<byte> paymentHash, uint cltvExpiry, ReadOnlyMemory<byte>? onionRoutingPacket = null)

Parameters

channelId ChannelId
id ulong
amountMsat ulong
paymentHash ReadOnlyMemory<byte>
cltvExpiry uint
onionRoutingPacket ReadOnlyMemory<byte>?

Returns

UpdateAddHtlcMessage

CreateUpdateFailHtlcMessage(ChannelId, ulong, ReadOnlyMemory<byte>)

UpdateFailHtlcMessage CreateUpdateFailHtlcMessage(ChannelId channelId, ulong id, ReadOnlyMemory<byte> reason)

Parameters

channelId ChannelId
id ulong
reason ReadOnlyMemory<byte>

Returns

UpdateFailHtlcMessage

CreateUpdateFailMalformedHtlcMessage(ChannelId, ulong, ReadOnlyMemory<byte>, ushort)

UpdateFailMalformedHtlcMessage CreateUpdateFailMalformedHtlcMessage(ChannelId channelId, ulong id, ReadOnlyMemory<byte> sha256OfOnion, ushort failureCode)

Parameters

channelId ChannelId
id ulong
sha256OfOnion ReadOnlyMemory<byte>
failureCode ushort

Returns

UpdateFailMalformedHtlcMessage

CreateUpdateFeeMessage(ChannelId, uint)

UpdateFeeMessage CreateUpdateFeeMessage(ChannelId channelId, uint feeratePerKw)

Parameters

channelId ChannelId
feeratePerKw uint

Returns

UpdateFeeMessage

CreateUpdateFulfillHtlcMessage(ChannelId, ulong, ReadOnlyMemory<byte>)

UpdateFulfillHtlcMessage CreateUpdateFulfillHtlcMessage(ChannelId channelId, ulong id, ReadOnlyMemory<byte> preimage)

Parameters

channelId ChannelId
id ulong
preimage ReadOnlyMemory<byte>

Returns

UpdateFulfillHtlcMessage

CreateWarningMessage(byte[], ChannelId?)

WarningMessage CreateWarningMessage(byte[] data, ChannelId? channelId)

Parameters

data byte[]
channelId ChannelId?

Returns

WarningMessage

CreateWarningMessage(string, ChannelId?)

WarningMessage CreateWarningMessage(string message, ChannelId? channelId)

Parameters

message string
channelId ChannelId?

Returns

WarningMessage

CreatedFundingCreatedMessage(ChannelId, TxId, ushort, CompactSignature)

FundingCreatedMessage CreatedFundingCreatedMessage(ChannelId temporaryChannelId, TxId fundingTxId, ushort fundingOutputIndex, CompactSignature signature)

Parameters

temporaryChannelId ChannelId
fundingTxId TxId
fundingOutputIndex ushort
signature CompactSignature

Returns

FundingCreatedMessage

CreatedFundingSignedMessage(ChannelId, CompactSignature)

FundingSignedMessage CreatedFundingSignedMessage(ChannelId channelId, CompactSignature signature)

Parameters

channelId ChannelId
signature CompactSignature

Returns

FundingSignedMessage