Skip to content

Commit 810f740

Browse files
committed
[C#] Check in initial auto-generated C# bindings
1 parent fa130da commit 810f740

File tree

403 files changed

+60288
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+60288
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* An error when accessing the chain via [`Access`].
3+
*/
4+
public enum AccessError {
5+
/**
6+
* The requested chain is unknown.
7+
*/
8+
LDKAccessError_UnknownChain,
9+
/**
10+
* The requested transaction doesn't exist or hasn't confirmed.
11+
*/
12+
LDKAccessError_UnknownTx,
13+
}} } }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* An enum which can either contain a or not
3+
*/
4+
public enum COption_NoneZ {
5+
/**
6+
* When we're in this state, this COption_NoneZ contains a
7+
*/
8+
LDKCOption_NoneZ_Some,
9+
/**
10+
* When we're in this state, this COption_NoneZ contains nothing
11+
*/
12+
LDKCOption_NoneZ_None,
13+
}} } }
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* An enum representing the status of a channel monitor update persistence.
3+
*/
4+
public enum ChannelMonitorUpdateStatus {
5+
/**
6+
* The update has been durably persisted and all copies of the relevant [`ChannelMonitor`]
7+
* have been updated.
8+
*
9+
* This includes performing any `fsync()` calls required to ensure the update is guaranteed to
10+
* be available on restart even if the application crashes.
11+
*/
12+
LDKChannelMonitorUpdateStatus_Completed,
13+
/**
14+
* Used to indicate a temporary failure (eg connection to a watchtower or remote backup of
15+
* our state failed, but is expected to succeed at some point in the future).
16+
*
17+
* Such a failure will \"freeze\" a channel, preventing us from revoking old states or
18+
* submitting new commitment transactions to the counterparty. Once the update(s) which failed
19+
* have been successfully applied, a [`MonitorEvent::Completed`] can be used to restore the
20+
* channel to an operational state.
21+
*
22+
* Note that a given [`ChannelManager`] will *never* re-generate a [`ChannelMonitorUpdate`].
23+
* If you return this error you must ensure that it is written to disk safely before writing
24+
* the latest [`ChannelManager`] state, or you should return [`PermanentFailure`] instead.
25+
*
26+
* Even when a channel has been \"frozen\", updates to the [`ChannelMonitor`] can continue to
27+
* occur (e.g. if an inbound HTLC which we forwarded was claimed upstream, resulting in us
28+
* attempting to claim it on this channel) and those updates must still be persisted.
29+
*
30+
* No updates to the channel will be made which could invalidate other [`ChannelMonitor`]s
31+
* until a [`MonitorEvent::Completed`] is provided, even if you return no error on a later
32+
* monitor update for the same channel.
33+
*
34+
* For deployments where a copy of ChannelMonitors and other local state are backed up in a
35+
* remote location (with local copies persisted immediately), it is anticipated that all
36+
* updates will return [`InProgress`] until the remote copies could be updated.
37+
*
38+
* [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
39+
* [`InProgress`]: ChannelMonitorUpdateStatus::InProgress
40+
* [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
41+
*/
42+
LDKChannelMonitorUpdateStatus_InProgress,
43+
/**
44+
* Used to indicate no further channel monitor updates will be allowed (likely a disk failure
45+
* or a remote copy of this [`ChannelMonitor`] is no longer reachable and thus not updatable).
46+
*
47+
* When this is returned, [`ChannelManager`] will force-close the channel but *not* broadcast
48+
* our current commitment transaction. This avoids a dangerous case where a local disk failure
49+
* (e.g. the Linux-default remounting of the disk as read-only) causes [`PermanentFailure`]s
50+
* for all monitor updates. If we were to broadcast our latest commitment transaction and then
51+
* restart, we could end up reading a previous [`ChannelMonitor`] and [`ChannelManager`],
52+
* revoking our now-broadcasted state before seeing it confirm and losing all our funds.
53+
*
54+
* Note that this is somewhat of a tradeoff - if the disk is really gone and we may have lost
55+
* the data permanently, we really should broadcast immediately. If the data can be recovered
56+
* with manual intervention, we'd rather close the channel, rejecting future updates to it,
57+
* and broadcast the latest state only if we have HTLCs to claim which are timing out (which
58+
* we do as long as blocks are connected).
59+
*
60+
* In order to broadcast the latest local commitment transaction, you'll need to call
61+
* [`ChannelMonitor::get_latest_holder_commitment_txn`] and broadcast the resulting
62+
* transactions once you've safely ensured no further channel updates can be generated by your
63+
* [`ChannelManager`].
64+
*
65+
* Note that at least one final [`ChannelMonitorUpdate`] may still be provided, which must
66+
* still be processed by a running [`ChannelMonitor`]. This final update will mark the
67+
* [`ChannelMonitor`] as finalized, ensuring no further updates (e.g. revocation of the latest
68+
* commitment transaction) are allowed.
69+
*
70+
* Note that even if you return a [`PermanentFailure`] due to unavailability of secondary
71+
* [`ChannelMonitor`] copies, you should still make an attempt to store the update where
72+
* possible to ensure you can claim HTLC outputs on the latest commitment transaction
73+
* broadcasted later.
74+
*
75+
* In case of distributed watchtowers deployment, the new version must be written to disk, as
76+
* state may have been stored but rejected due to a block forcing a commitment broadcast. This
77+
* storage is used to claim outputs of rejected state confirmed onchain by another watchtower,
78+
* lagging behind on block processing.
79+
*
80+
* [`PermanentFailure`]: ChannelMonitorUpdateStatus::PermanentFailure
81+
* [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
82+
*/
83+
LDKChannelMonitorUpdateStatus_PermanentFailure,
84+
}} } }
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* An enum that represents the speed at which we want a transaction to confirm used for feerate
3+
* estimation.
4+
*/
5+
public enum ConfirmationTarget {
6+
/**
7+
* We are happy with this transaction confirming slowly when feerate drops some.
8+
*/
9+
LDKConfirmationTarget_Background,
10+
/**
11+
* We'd like this transaction to confirm without major delay, but 12-18 blocks is fine.
12+
*/
13+
LDKConfirmationTarget_Normal,
14+
/**
15+
* We'd like this transaction to confirm in the next few blocks.
16+
*/
17+
LDKConfirmationTarget_HighPriority,
18+
}} } }
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* Errors that may occur when constructing a new `RawInvoice` or `Invoice`
3+
*/
4+
public enum CreationError {
5+
/**
6+
* The supplied description string was longer than 639 __bytes__ (see [`Description::new(...)`](./struct.Description.html#method.new))
7+
*/
8+
LDKCreationError_DescriptionTooLong,
9+
/**
10+
* The specified route has too many hops and can't be encoded
11+
*/
12+
LDKCreationError_RouteTooLong,
13+
/**
14+
* The Unix timestamp of the supplied date is less than zero or greater than 35-bits
15+
*/
16+
LDKCreationError_TimestampOutOfBounds,
17+
/**
18+
* The supplied millisatoshi amount was greater than the total bitcoin supply.
19+
*/
20+
LDKCreationError_InvalidAmount,
21+
/**
22+
* Route hints were required for this invoice and were missing. Applies to
23+
* [phantom invoices].
24+
*
25+
* [phantom invoices]: crate::utils::create_phantom_invoice
26+
*/
27+
LDKCreationError_MissingRouteHints,
28+
}} } }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* Enum representing the crypto currencies (or networks) supported by this library
3+
*/
4+
public enum Currency {
5+
/**
6+
* Bitcoin mainnet
7+
*/
8+
LDKCurrency_Bitcoin,
9+
/**
10+
* Bitcoin testnet
11+
*/
12+
LDKCurrency_BitcoinTestnet,
13+
/**
14+
* Bitcoin regtest
15+
*/
16+
LDKCurrency_Regtest,
17+
/**
18+
* Bitcoin simnet
19+
*/
20+
LDKCurrency_Simnet,
21+
/**
22+
* Bitcoin signet
23+
*/
24+
LDKCurrency_Signet,
25+
}} } }
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* Describes the type of HTLC claim as determined by analyzing the witness.
3+
*/
4+
public enum HTLCClaim {
5+
/**
6+
* Claims an offered output on a commitment transaction through the timeout path.
7+
*/
8+
LDKHTLCClaim_OfferedTimeout,
9+
/**
10+
* Claims an offered output on a commitment transaction through the success path.
11+
*/
12+
LDKHTLCClaim_OfferedPreimage,
13+
/**
14+
* Claims an accepted output on a commitment transaction through the timeout path.
15+
*/
16+
LDKHTLCClaim_AcceptedTimeout,
17+
/**
18+
* Claims an accepted output on a commitment transaction through the success path.
19+
*/
20+
LDKHTLCClaim_AcceptedPreimage,
21+
/**
22+
* Claims an offered/accepted output on a commitment transaction through the revocation path.
23+
*/
24+
LDKHTLCClaim_Revocation,
25+
}} } }
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* Represents an IO Error. Note that some information is lost in the conversion from Rust.
3+
*/
4+
public enum IOError {
5+
LDKIOError_NotFound,
6+
LDKIOError_PermissionDenied,
7+
LDKIOError_ConnectionRefused,
8+
LDKIOError_ConnectionReset,
9+
LDKIOError_ConnectionAborted,
10+
LDKIOError_NotConnected,
11+
LDKIOError_AddrInUse,
12+
LDKIOError_AddrNotAvailable,
13+
LDKIOError_BrokenPipe,
14+
LDKIOError_AlreadyExists,
15+
LDKIOError_WouldBlock,
16+
LDKIOError_InvalidInput,
17+
LDKIOError_InvalidData,
18+
LDKIOError_TimedOut,
19+
LDKIOError_WriteZero,
20+
LDKIOError_Interrupted,
21+
LDKIOError_Other,
22+
LDKIOError_UnexpectedEof,
23+
}} } }

c_sharp/src/org/ldk/enums/Level.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* An enum representing the available verbosity levels of the logger.
3+
*/
4+
public enum Level {
5+
/**
6+
* Designates extremely verbose information, including gossip-induced messages
7+
*/
8+
LDKLevel_Gossip,
9+
/**
10+
* Designates very low priority, often extremely verbose, information
11+
*/
12+
LDKLevel_Trace,
13+
/**
14+
* Designates lower priority information
15+
*/
16+
LDKLevel_Debug,
17+
/**
18+
* Designates useful information
19+
*/
20+
LDKLevel_Info,
21+
/**
22+
* Designates hazardous situations
23+
*/
24+
LDKLevel_Warn,
25+
/**
26+
* Designates very serious errors
27+
*/
28+
LDKLevel_Error,
29+
}} } }
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace org { namespace ldk { namespace enums {/**
2+
* An enum representing the possible Bitcoin or test networks which we can run on
3+
*/
4+
public enum Network {
5+
/**
6+
* The main Bitcoin blockchain.
7+
*/
8+
LDKNetwork_Bitcoin,
9+
/**
10+
* The testnet3 blockchain.
11+
*/
12+
LDKNetwork_Testnet,
13+
/**
14+
* A local test blockchain.
15+
*/
16+
LDKNetwork_Regtest,
17+
/**
18+
* A blockchain on which blocks are signed instead of mined.
19+
*/
20+
LDKNetwork_Signet,
21+
}} } }

0 commit comments

Comments
 (0)