12
12
13
13
pub use crate :: config:: {
14
14
default_config, AnchorChannelsConfig , BackgroundSyncConfig , ElectrumSyncConfig ,
15
- EsploraSyncConfig , MaxDustHTLCExposure ,
15
+ EsploraSyncConfig , HumanReadableNamesConfig , MaxDustHTLCExposure ,
16
16
} ;
17
17
pub use crate :: graph:: { ChannelInfo , ChannelUpdateInfo , NodeAnnouncementInfo , NodeInfo } ;
18
18
pub use crate :: liquidity:: { LSPS1OrderStatus , LSPS2ServiceConfig , OnchainPaymentInfo , PaymentInfo } ;
@@ -36,6 +36,8 @@ pub use lightning_invoice::{Description, SignedRawBolt11Invoice};
36
36
pub use lightning_liquidity:: lsps1:: msgs:: ChannelInfo as ChannelOrderInfo ;
37
37
pub use lightning_liquidity:: lsps1:: msgs:: { OrderId , OrderParameters , PaymentState } ;
38
38
39
+ pub use lightning:: onion_message:: dns_resolution:: HumanReadableName as LdkHumanReadableName ;
40
+
39
41
pub use bitcoin:: { Address , BlockHash , FeeRate , Network , OutPoint , Txid } ;
40
42
41
43
pub use bip39:: Mnemonic ;
@@ -1117,6 +1119,59 @@ impl UniffiCustomTypeConverter for DateTime {
1117
1119
}
1118
1120
}
1119
1121
1122
+ pub struct HumanReadableName {
1123
+ pub ( crate ) inner : LdkHumanReadableName ,
1124
+ }
1125
+
1126
+ impl HumanReadableName {
1127
+ /// Returns the underlying HumanReadableName [`LdkHumanReadableName`]
1128
+ pub fn into_inner ( & self ) -> LdkHumanReadableName {
1129
+ self . inner . clone ( )
1130
+ }
1131
+
1132
+ pub fn from_encoded ( encoded : & str ) -> Result < Self , Error > {
1133
+ let hrn = match LdkHumanReadableName :: from_encoded ( encoded) {
1134
+ Ok ( hrn) => Ok ( hrn) ,
1135
+ Err ( _) => Err ( Error :: HrnParsingFailed ) ,
1136
+ } ?;
1137
+
1138
+ Ok ( Self { inner : hrn } )
1139
+ }
1140
+
1141
+ pub fn user ( & self ) -> String {
1142
+ self . inner . user ( ) . to_string ( )
1143
+ }
1144
+
1145
+ pub fn domain ( & self ) -> String {
1146
+ self . inner . domain ( ) . to_string ( )
1147
+ }
1148
+ }
1149
+
1150
+ impl From < LdkHumanReadableName > for HumanReadableName {
1151
+ fn from ( ldk_hrn : LdkHumanReadableName ) -> Self {
1152
+ HumanReadableName { inner : ldk_hrn }
1153
+ }
1154
+ }
1155
+
1156
+ impl From < HumanReadableName > for LdkHumanReadableName {
1157
+ fn from ( wrapper : HumanReadableName ) -> Self {
1158
+ wrapper. into_inner ( )
1159
+ }
1160
+ }
1161
+
1162
+ impl Deref for HumanReadableName {
1163
+ type Target = LdkHumanReadableName ;
1164
+ fn deref ( & self ) -> & Self :: Target {
1165
+ & self . inner
1166
+ }
1167
+ }
1168
+
1169
+ impl AsRef < LdkHumanReadableName > for HumanReadableName {
1170
+ fn as_ref ( & self ) -> & LdkHumanReadableName {
1171
+ self . deref ( )
1172
+ }
1173
+ }
1174
+
1120
1175
#[ cfg( test) ]
1121
1176
mod tests {
1122
1177
use std:: {
0 commit comments