Add some no-exporting of more offers code 2023-04-0.0.115-bindings
authorMatt Corallo <git@bluematt.me>
Tue, 25 Apr 2023 17:40:40 +0000 (17:40 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 26 Apr 2023 17:38:04 +0000 (17:38 +0000)
These really could be handled in the bindings, but for lack of
immediate users there's not a strong reason to, so instead we just
disable them for now.

lightning/src/offers/invoice.rs
lightning/src/offers/invoice_request.rs
lightning/src/offers/offer.rs
lightning/src/offers/parse.rs

index 7dd2a99d150bfad018eab79dc3448402d0817fb7..7d24c2e46a994c54789d30b5dfdb495825e85f66 100644 (file)
@@ -311,6 +311,8 @@ impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S> {
        ///
        /// Successive calls to this method will add another address. Caller is responsible for not
        /// adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
+       ///
+       /// This is not exported to bindings users as TweakedPublicKey isn't yet mapped.
        pub fn fallback_v1_p2tr_tweaked(mut self, output_key: &TweakedPublicKey) -> Self {
                let address = FallbackAddress {
                        version: WitnessVersion::V1.to_num(),
@@ -476,6 +478,8 @@ impl Invoice {
        ///
        /// Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this
        /// privacy is lost if a public node id is used for [`Invoice::signing_pubkey`].
+       ///
+       /// This is not exported to bindings users as a slice of tuples isn't exportable.
        pub fn payment_paths(&self) -> &[(BlindedPath, BlindedPayInfo)] {
                &self.contents.fields().payment_paths[..]
        }
@@ -516,6 +520,8 @@ impl Invoice {
 
        /// Fallback addresses for paying the invoice on-chain, in order of most-preferred to
        /// least-preferred.
+       ///
+       /// This is not exported to bindings users as Address is not yet mapped
        pub fn fallbacks(&self) -> Vec<Address> {
                let network = match self.network() {
                        None => return Vec::new(),
@@ -580,6 +586,8 @@ impl Invoice {
        }
 
        /// Signature of the invoice verified using [`Invoice::signing_pubkey`].
+       ///
+       /// This is not exported to bindings users as SIgnature is not yet mapped.
        pub fn signature(&self) -> Signature {
                self.signature
        }
index 8d4755537078f5a8698d8ef7d87fb71ca168206d..7243b7b92b32b2904c3e3f7278d5a3ce5fe44b67 100644 (file)
@@ -464,6 +464,8 @@ impl InvoiceRequest {
 
        /// Signature of the invoice request using [`payer_id`].
        ///
+       /// This is not exported to bindings users as Signature is not yet mapped.
+       ///
        /// [`payer_id`]: Self::payer_id
        pub fn signature(&self) -> Signature {
                self.signature
@@ -572,6 +574,8 @@ impl InvoiceRequest {
        /// keys need to sign an [`Invoice`] for the request if they could be extracted from the
        /// metadata.
        ///
+       /// This is not exported to bindings users as KeyPair is not yet mapped.
+       ///
        /// [`Invoice`]: crate::offers::invoice::Invoice
        pub fn verify<T: secp256k1::Signing>(
                &self, key: &ExpandedKey, secp_ctx: &Secp256k1<T>
index ac16b6ef2536520929e88b6de6a14fafebf9f75d..a49ed5ff69cde279e5a8f799523e2deb47fe0875 100644 (file)
@@ -705,6 +705,9 @@ pub enum Amount {
        /// An amount of currency specified using ISO 4712.
        Currency {
                /// The currency that the amount is denominated in.
+               ///
+               /// This is not exported to bindings users as bindings have troubles with type aliases to
+               /// byte arrays.
                iso4217_code: CurrencyCode,
                /// The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents).
                amount: u64,
@@ -712,7 +715,7 @@ pub enum Amount {
 }
 
 /// An ISO 4712 three-letter currency code (e.g., USD).
-pub type CurrencyCode = [u8; 3];
+pub(crate) type CurrencyCode = [u8; 3];
 
 /// Quantity of items supported by an [`Offer`].
 #[derive(Clone, Copy, Debug, PartialEq)]
@@ -722,7 +725,8 @@ pub enum Quantity {
        ///
        /// May be used with `NonZeroU64::new(1)` but prefer to use [`Quantity::One`] if only one item
        /// is supported.
-       Bounded(NonZeroU64),
+       Bounded(/// This is not exported to bindings users as builder patterns don't map outside of move semantics.
+               NonZeroU64),
        /// One or more items. Use when more than one item can be requested without any limit.
        Unbounded,
        /// Only one item. Use when only a single item can be requested.
index 42ed2e002d1f29b60169c86954f39cece3101647..022a7b4c8abe61d751983d937047166dd936e0f7 100644 (file)
@@ -127,7 +127,8 @@ pub enum ParseError {
        /// being parsed.
        InvalidBech32Hrp,
        /// The string could not be bech32 decoded.
-       Bech32(bech32::Error),
+       Bech32(/// This is not exported to bindings users as the details don't matter much
+               bech32::Error),
        /// The bech32 decoded string could not be decoded as the expected message type.
        Decode(DecodeError),
        /// The parsed message has invalid semantics.