diff --git a/CHANGELOG.md b/CHANGELOG.md index d78d494..690320a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.2.0] +Updated `Rust` and `Flutter` dependencies. + + ## [0.1.3] Updated `Rust` and `Flutter` dependencies. Invalid `BuilderException` bug resolved diff --git a/README.md b/README.md index e414a17..b5417b0 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ To use the `ldk_node` package in your project, add it as a dependency in your pr ```dart dependencies: - ldk_node: ^0.1.3 + ldk_node: ^0.2.0 ``` or add from pub.dev using `pub add` command @@ -68,7 +68,10 @@ final config = Config( trustedPeers0Conf: [], storageDirPath: path, network: Network.Testnet, - listeningAddress: NetAddress.iPv4(addr: "0.0.0.0", port: 3006), + listeningAddresses: [ + bridge.SocketAddress.hostname( + hostname: bridge.Hostname(internal: "0.0.0.0"), port: 9735) + ], onchainWalletSyncIntervalSecs: 60, walletSyncIntervalSecs: 20, feeRateCacheUpdateIntervalSecs: 600, diff --git a/android/src/main/jniLibs/arm64-v8a/librust_ldk_node.so b/android/src/main/jniLibs/arm64-v8a/librust_ldk_node.so index 60cc4eb..a4e08b3 100755 Binary files a/android/src/main/jniLibs/arm64-v8a/librust_ldk_node.so and b/android/src/main/jniLibs/arm64-v8a/librust_ldk_node.so differ diff --git a/android/src/main/jniLibs/armeabi-v7a/librust_ldk_node.so b/android/src/main/jniLibs/armeabi-v7a/librust_ldk_node.so index 7995b93..6933834 100755 Binary files a/android/src/main/jniLibs/armeabi-v7a/librust_ldk_node.so and b/android/src/main/jniLibs/armeabi-v7a/librust_ldk_node.so differ diff --git a/android/src/main/jniLibs/x86/librust_ldk_node.so b/android/src/main/jniLibs/x86/librust_ldk_node.so index a0f8222..e4649eb 100755 Binary files a/android/src/main/jniLibs/x86/librust_ldk_node.so and b/android/src/main/jniLibs/x86/librust_ldk_node.so differ diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 5e636e3..664f111 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,6 +1,6 @@ PODS: - Flutter (1.0.0) - - ldk_node (0.1.3): + - ldk_node (0.2.0): - Flutter - path_provider_foundation (0.0.1): - Flutter @@ -21,7 +21,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 - ldk_node: 0bcad021798a6c23650ee6024b5e7d175a341aa3 + ldk_node: 2c7a711e69412b0e4e03a750a12c7c56110aa93b path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 diff --git a/example/lib/main.dart b/example/lib/main.dart index 41cc73f..1155018 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -24,31 +22,34 @@ class _MyAppState extends State { ldk.PublicKey? bobNodeId; int aliceBalance = 0; String displayText = ""; - ldk.NetAddress? bobAddr; + ldk.SocketAddress? bobAddr; ldk.Bolt11Invoice? invoice; ldk.ChannelId? channelId; // Replace this with your local esplora url - String esploraUrl = Platform.isAndroid - ? - //10.0.2.2 to access the AVD - 'http://10.0.2.2:30000' - : 'http://127.0.0.1:30000'; + String esploraUrl = "https://mempool.space/testnet/api"; + // Platform.isAndroid + // ? + // //10.0.2.2 to access the AVD + // 'http://10.0.2.2:30000' + // : '0.0.0.0:30000'; + @override void initState() { initAliceNode(); super.initState(); } - Future initLdkConfig(String path, ldk.NetAddress address) async { + Future initLdkConfig( + String path, ldk.SocketAddress address) async { final directory = await getApplicationDocumentsDirectory(); final nodePath = "${directory.path}/ldk_cache/$path"; final config = ldk.Config( probingLiquidityLimitMultiplier: 3, trustedPeers0Conf: [], storageDirPath: nodePath, - network: ldk.Network.Regtest, - listeningAddress: address, + network: ldk.Network.Testnet, + listeningAddresses: [address], onchainWalletSyncIntervalSecs: 60, walletSyncIntervalSecs: 20, feeRateCacheUpdateIntervalSecs: 600, @@ -64,12 +65,14 @@ class _MyAppState extends State { initAliceNode() async { final aliceConfig = await initLdkConfig( - 'alice_regtest', ldk.NetAddress.iPv4(addr: "0.0.0.0", port: 3006)); + 'alice_testnet', + ldk.SocketAddress.hostname( + hostname: ldk.Hostname(internal: "0.0.0.0"), port: 9735)); ldk.Builder aliceBuilder = ldk.Builder.fromConfig(config: aliceConfig); aliceNode = await aliceBuilder .setEntropyBip39Mnemonic( mnemonic: ldk.Mnemonic( - 'cart super leaf clinic pistol plug replace close super tooth wealth usage')) + 'puppy interest whip tonight dad never sudden response push zone pig patch')) .setEsploraServer(esploraServerUrl: esploraUrl) .build(); await startNode(aliceNode); @@ -90,12 +93,14 @@ class _MyAppState extends State { initBobNode() async { final bobConfig = await initLdkConfig( - "bob_regtest", ldk.NetAddress.iPv4(addr: "0.0.0.0", port: 3008)); + "bob_testnet", + ldk.SocketAddress.hostname( + hostname: ldk.Hostname(internal: "0.0.0.0"), port: 3006)); ldk.Builder bobBuilder = ldk.Builder.fromConfig(config: bobConfig); bobNode = await bobBuilder .setEntropyBip39Mnemonic( mnemonic: ldk.Mnemonic( - 'puppy interest whip tonight dad never sudden response push zone pig patch')) + 'cart super leaf clinic pistol plug replace close super tooth wealth usage')) .setEsploraServer(esploraServerUrl: esploraUrl) .build(); await startNode(bobNode); @@ -189,18 +194,19 @@ class _MyAppState extends State { listeningAddress() async { final alice = await aliceNode.listeningAddress(); final bob = await bobNode.listeningAddress(); + setState(() { - bobAddr = bob; + bobAddr = bob!.first; }); if (kDebugMode) { - print("alice's listeningAddress : ${alice!.addr}:${alice.port}"); - print("bob's listeningAddress: ${bob!.addr}:${bob.port}"); + print("alice's listeningAddress : ${alice!.first.toString()}"); + print("bob's listeningAddress: ${bob!.first.toString()}"); } } connectOpenChannel() async { await aliceNode.connectOpenChannel( - channelAmountSats: 5000000, + channelAmountSats: 5000, announceChannel: true, netaddress: bobAddr!, pushToCounterpartyMsat: 50000, diff --git a/example/pubspec.lock b/example/pubspec.lock index 5e08028..ced36e2 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -161,6 +161,14 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -178,10 +186,10 @@ packages: dependency: transitive description: name: flutter_rust_bridge - sha256: "7c5e94d037ccb0de7b5f7de3ff2491548d292b5aad01b01f5a5703f8aac9389b" + sha256: "02720226035257ad0b571c1256f43df3e1556a499f6bcb004849a0faaa0e87f0" url: "https://pub.dev" source: hosted - version: "1.82.4" + version: "1.82.6" flutter_test: dependency: "direct dev" description: flutter @@ -191,10 +199,10 @@ packages: dependency: transitive description: name: freezed - sha256: "21bf2825311de65501d22e563e3d7605dff57fb5e6da982db785ae5372ff018a" + sha256: "6c5031daae12c7072b3a87eff98983076434b4889ef2a44384d0cae3f82372ba" url: "https://pub.dev" source: hosted - version: "2.4.5" + version: "2.4.6" freezed_annotation: dependency: transitive description: @@ -257,7 +265,7 @@ packages: path: ".." relative: true source: path - version: "0.1.3" + version: "0.2.0" lints: dependency: transitive description: @@ -326,10 +334,10 @@ packages: dependency: "direct main" description: name: path_provider - sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_android: dependency: transitive description: @@ -374,10 +382,10 @@ packages: dependency: transitive description: name: petitparser - sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6 + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "6.0.2" platform: dependency: transitive description: @@ -467,10 +475,10 @@ packages: dependency: transitive description: name: source_gen - sha256: fc0da689e5302edb6177fdd964efcb7f58912f43c28c2047a808f5bfff643d16 + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.5.0" source_span: dependency: transitive description: @@ -547,10 +555,10 @@ packages: dependency: transitive description: name: uuid - sha256: df5a4d8f22ee4ccd77f8839ac7cb274ebc11ef9adcce8b92be14b797fe889921 + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 url: "https://pub.dev" source: hosted - version: "4.2.1" + version: "4.3.3" vector_math: dependency: transitive description: @@ -587,10 +595,10 @@ packages: dependency: transitive description: name: win32 - sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f" + sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.1.1" xdg_directories: dependency: transitive description: @@ -609,4 +617,4 @@ packages: version: "3.1.2" sdks: dart: ">=3.2.0 <4.0.0" - flutter: ">=3.7.0" + flutter: ">=3.10.0" diff --git a/ios/Classes/bindings.h b/ios/Classes/bindings.h index caa9c33..7851f2f 100644 --- a/ios/Classes/bindings.h +++ b/ios/Classes/bindings.h @@ -14,25 +14,53 @@ typedef struct wire_uint_8_list { int32_t len; } wire_uint_8_list; -typedef struct wire_NetAddress_IPv4 { +typedef struct wire_SocketAddress_TcpIpV4 { struct wire_uint_8_list *addr; uint16_t port; -} wire_NetAddress_IPv4; +} wire_SocketAddress_TcpIpV4; -typedef struct wire_NetAddress_IPv6 { +typedef struct wire_SocketAddress_TcpIpV6 { struct wire_uint_8_list *addr; uint16_t port; -} wire_NetAddress_IPv6; +} wire_SocketAddress_TcpIpV6; -typedef union NetAddressKind { - struct wire_NetAddress_IPv4 *IPv4; - struct wire_NetAddress_IPv6 *IPv6; -} NetAddressKind; +typedef struct wire_SocketAddress_OnionV2 { + struct wire_uint_8_list *field0; +} wire_SocketAddress_OnionV2; + +typedef struct wire_SocketAddress_OnionV3 { + struct wire_uint_8_list *ed25519_pubkey; + uint16_t checksum; + uint8_t version; + uint16_t port; +} wire_SocketAddress_OnionV3; + +typedef struct wire_Hostname { + struct wire_uint_8_list *internal; +} wire_Hostname; -typedef struct wire_NetAddress { +typedef struct wire_SocketAddress_Hostname { + struct wire_Hostname *hostname; + uint16_t port; +} wire_SocketAddress_Hostname; + +typedef union SocketAddressKind { + struct wire_SocketAddress_TcpIpV4 *TcpIpV4; + struct wire_SocketAddress_TcpIpV6 *TcpIpV6; + struct wire_SocketAddress_OnionV2 *OnionV2; + struct wire_SocketAddress_OnionV3 *OnionV3; + struct wire_SocketAddress_Hostname *Hostname; +} SocketAddressKind; + +typedef struct wire_SocketAddress { int32_t tag; - union NetAddressKind *kind; -} wire_NetAddress; + union SocketAddressKind *kind; +} wire_SocketAddress; + +typedef struct wire_list_socket_address { + struct wire_SocketAddress *ptr; + int32_t len; +} wire_list_socket_address; typedef struct wire_PublicKey { struct wire_uint_8_list *internal; @@ -47,7 +75,7 @@ typedef struct wire_Config { struct wire_uint_8_list *storage_dir_path; struct wire_uint_8_list *log_dir_path; int32_t network; - struct wire_NetAddress *listening_address; + struct wire_list_socket_address *listening_addresses; uint32_t default_cltv_expiry_delta; uint64_t onchain_wallet_sync_interval_secs; uint64_t wallet_sync_interval_secs; @@ -181,11 +209,11 @@ intptr_t init_frb_dart_api_dl(void *obj); void wire_generate_entropy_mnemonic(int64_t port_); -void wire_build_node(int64_t port_, - struct wire_Config *config, - struct wire_ChainDataSourceConfig *chain_data_source_config, - struct wire_EntropySourceConfig *entropy_source_config, - struct wire_GossipSourceConfig *gossip_source_config); +void wire_build_sqlite_node(int64_t port_, + struct wire_Config *config, + struct wire_ChainDataSourceConfig *chain_data_source_config, + struct wire_EntropySourceConfig *entropy_source_config, + struct wire_GossipSourceConfig *gossip_source_config); void wire_start__method__NodePointer(int64_t port_, struct wire_NodePointer *that); @@ -199,7 +227,7 @@ void wire_wait_until_next_event__method__NodePointer(int64_t port_, struct wire_ void wire_node_id__method__NodePointer(int64_t port_, struct wire_NodePointer *that); -void wire_listening_address__method__NodePointer(int64_t port_, struct wire_NodePointer *that); +void wire_listening_addresses__method__NodePointer(int64_t port_, struct wire_NodePointer *that); void wire_new_onchain_address__method__NodePointer(int64_t port_, struct wire_NodePointer *that); @@ -223,7 +251,7 @@ void wire_list_channels__method__NodePointer(int64_t port_, struct wire_NodePoin void wire_connect__method__NodePointer(int64_t port_, struct wire_NodePointer *that, struct wire_PublicKey *node_id, - struct wire_NetAddress *address, + struct wire_SocketAddress *address, bool persist); void wire_disconnect__method__NodePointer(int64_t port_, @@ -232,7 +260,7 @@ void wire_disconnect__method__NodePointer(int64_t port_, void wire_connect_open_channel__method__NodePointer(int64_t port_, struct wire_NodePointer *that, - struct wire_NetAddress *address, + struct wire_SocketAddress *address, struct wire_PublicKey *node_id, uint64_t channel_amount_sats, uint64_t *push_to_counterparty_msat, @@ -266,14 +294,14 @@ void wire_send_spontaneous_payment__method__NodePointer(int64_t port_, uint64_t amount_msat, struct wire_PublicKey *node_id); -void wire_send_payment_probe__method__NodePointer(int64_t port_, - struct wire_NodePointer *that, - struct wire_Bolt11Invoice *invoice); +void wire_send_payment_probes__method__NodePointer(int64_t port_, + struct wire_NodePointer *that, + struct wire_Bolt11Invoice *invoice); -void wire_send_spontaneous_payment_probe__method__NodePointer(int64_t port_, - struct wire_NodePointer *that, - uint64_t amount_msat, - struct wire_PublicKey *node_id); +void wire_send_spontaneous_payment_probes__method__NodePointer(int64_t port_, + struct wire_NodePointer *that, + uint64_t amount_msat, + struct wire_PublicKey *node_id); void wire_receive_payment__method__NodePointer(int64_t port_, struct wire_NodePointer *that, @@ -330,9 +358,9 @@ struct wire_EntropySourceConfig *new_box_autoadd_entropy_source_config_0(void); struct wire_GossipSourceConfig *new_box_autoadd_gossip_source_config_0(void); -struct wire_Mnemonic *new_box_autoadd_mnemonic_0(void); +struct wire_Hostname *new_box_autoadd_hostname_0(void); -struct wire_NetAddress *new_box_autoadd_net_address_0(void); +struct wire_Mnemonic *new_box_autoadd_mnemonic_0(void); struct wire_NodePointer *new_box_autoadd_node_pointer_0(void); @@ -340,10 +368,14 @@ struct wire_PaymentHash *new_box_autoadd_payment_hash_0(void); struct wire_PublicKey *new_box_autoadd_public_key_0(void); +struct wire_SocketAddress *new_box_autoadd_socket_address_0(void); + uint64_t *new_box_autoadd_u64_0(uint64_t value); struct wire_list_public_key *new_list_public_key_0(int32_t len); +struct wire_list_socket_address *new_list_socket_address_0(int32_t len); + struct wire_uint_8_list *new_uint_8_list_0(int32_t len); void drop_opaque_MutexNodeSqliteStore(const void *ptr); @@ -364,23 +396,29 @@ union MaxDustHTLCExposureKind *inflate_MaxDustHTLCExposure_FixedLimitMsat(void); union MaxDustHTLCExposureKind *inflate_MaxDustHTLCExposure_FeeRateMultiplier(void); -union NetAddressKind *inflate_NetAddress_IPv4(void); +union SocketAddressKind *inflate_SocketAddress_TcpIpV4(void); + +union SocketAddressKind *inflate_SocketAddress_TcpIpV6(void); + +union SocketAddressKind *inflate_SocketAddress_OnionV2(void); + +union SocketAddressKind *inflate_SocketAddress_OnionV3(void); -union NetAddressKind *inflate_NetAddress_IPv6(void); +union SocketAddressKind *inflate_SocketAddress_Hostname(void); void free_WireSyncReturn(WireSyncReturn ptr); static int64_t dummy_method_to_enforce_bundling(void) { int64_t dummy_var = 0; dummy_var ^= ((int64_t) (void*) wire_generate_entropy_mnemonic); - dummy_var ^= ((int64_t) (void*) wire_build_node); + dummy_var ^= ((int64_t) (void*) wire_build_sqlite_node); dummy_var ^= ((int64_t) (void*) wire_start__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_stop__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_event_handled__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_next_event__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_wait_until_next_event__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_node_id__method__NodePointer); - dummy_var ^= ((int64_t) (void*) wire_listening_address__method__NodePointer); + dummy_var ^= ((int64_t) (void*) wire_listening_addresses__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_new_onchain_address__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_spendable_onchain_balance_sats__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_total_onchain_balance_sats__method__NodePointer); @@ -396,8 +434,8 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) wire_send_payment__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_send_payment_using_amount__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_send_spontaneous_payment__method__NodePointer); - dummy_var ^= ((int64_t) (void*) wire_send_payment_probe__method__NodePointer); - dummy_var ^= ((int64_t) (void*) wire_send_spontaneous_payment_probe__method__NodePointer); + dummy_var ^= ((int64_t) (void*) wire_send_payment_probes__method__NodePointer); + dummy_var ^= ((int64_t) (void*) wire_send_spontaneous_payment_probes__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_receive_payment__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_receive_variable_amount_payment__method__NodePointer); dummy_var ^= ((int64_t) (void*) wire_payment__method__NodePointer); @@ -416,13 +454,15 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) new_box_autoadd_config_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_entropy_source_config_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_gossip_source_config_0); + dummy_var ^= ((int64_t) (void*) new_box_autoadd_hostname_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_mnemonic_0); - dummy_var ^= ((int64_t) (void*) new_box_autoadd_net_address_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_node_pointer_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_payment_hash_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_public_key_0); + dummy_var ^= ((int64_t) (void*) new_box_autoadd_socket_address_0); dummy_var ^= ((int64_t) (void*) new_box_autoadd_u64_0); dummy_var ^= ((int64_t) (void*) new_list_public_key_0); + dummy_var ^= ((int64_t) (void*) new_list_socket_address_0); dummy_var ^= ((int64_t) (void*) new_uint_8_list_0); dummy_var ^= ((int64_t) (void*) drop_opaque_MutexNodeSqliteStore); dummy_var ^= ((int64_t) (void*) share_opaque_MutexNodeSqliteStore); @@ -433,8 +473,11 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) inflate_GossipSourceConfig_RapidGossipSync); dummy_var ^= ((int64_t) (void*) inflate_MaxDustHTLCExposure_FixedLimitMsat); dummy_var ^= ((int64_t) (void*) inflate_MaxDustHTLCExposure_FeeRateMultiplier); - dummy_var ^= ((int64_t) (void*) inflate_NetAddress_IPv4); - dummy_var ^= ((int64_t) (void*) inflate_NetAddress_IPv6); + dummy_var ^= ((int64_t) (void*) inflate_SocketAddress_TcpIpV4); + dummy_var ^= ((int64_t) (void*) inflate_SocketAddress_TcpIpV6); + dummy_var ^= ((int64_t) (void*) inflate_SocketAddress_OnionV2); + dummy_var ^= ((int64_t) (void*) inflate_SocketAddress_OnionV3); + dummy_var ^= ((int64_t) (void*) inflate_SocketAddress_Hostname); dummy_var ^= ((int64_t) (void*) free_WireSyncReturn); dummy_var ^= ((int64_t) (void*) store_dart_post_cobject); dummy_var ^= ((int64_t) (void*) get_dart_object); diff --git a/ios/ldk_node.podspec b/ios/ldk_node.podspec index 21d66e0..e782ace 100644 --- a/ios/ldk_node.podspec +++ b/ios/ldk_node.podspec @@ -1,14 +1,7 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. -# Run `pod lib lint ldk_node.podspec` to validate before publishing. -# Pod::Spec.new do |s| s.name = 'ldk_node' - s.version = '0.1.3' + s.version = '0.2.0' s.summary = 'A ready-to-go Lightning node library built using LDK and BDK.' - s.description = <<-DESC -A new Flutter project. - DESC s.homepage = 'http://example.com' s.license = { :file => '../LICENSE' } s.author = { 'Your Company' => 'email@example.com' } @@ -16,7 +9,6 @@ A new Flutter project. s.source_files = 'Classes/**/*' s.dependency 'Flutter' s.platform = :ios, '9' - # Flutter.framework does not contain a i386 slice. s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' } s.swift_version = '5.0' s.public_header_files = 'Classes**/*.h' diff --git a/ios/librust_ldk_node.a b/ios/librust_ldk_node.a index 86a301a..bce1f69 100644 Binary files a/ios/librust_ldk_node.a and b/ios/librust_ldk_node.a differ diff --git a/lib/ldk_node.dart b/lib/ldk_node.dart index ba54a14..c40c17d 100644 --- a/lib/ldk_node.dart +++ b/lib/ldk_node.dart @@ -19,11 +19,14 @@ export './src/generated/bridge_definitions.dart' GossipSourceConfig_P2PNetwork, GossipSourceConfig_RapidGossipSync, MutexNodeSqliteStore, - NetAddress_IPv4, - NetAddress_IPv6, U8Array32, U8Array64, Mnemonic, + SocketAddress_Hostname, + SocketAddress_OnionV2, + SocketAddress_OnionV3, + SocketAddress_TcpIpV4, + SocketAddress_TcpIpV6, EntropySourceConfig_SeedFile; export 'src/root.dart'; export 'src/utils/exceptions.dart' diff --git a/lib/src/generated/bindings.dart b/lib/src/generated/bindings.dart index 3588602..ce04a40 100644 --- a/lib/src/generated/bindings.dart +++ b/lib/src/generated/bindings.dart @@ -1,5 +1,5 @@ // AUTO GENERATED FILE, DO NOT EDIT. -// Generated by `flutter_rust_bridge`@ 1.82.4. +// Generated by `flutter_rust_bridge`@ 1.82.6. // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const import "bridge_definitions.dart"; @@ -43,7 +43,7 @@ class RustLdkNodeImpl implements RustLdkNode { argNames: [], ); - Future buildNode( + Future buildSqliteNode( {required Config config, ChainDataSourceConfig? chainDataSourceConfig, EntropySourceConfig? entropySourceConfig, @@ -58,10 +58,10 @@ class RustLdkNodeImpl implements RustLdkNode { .api2wire_opt_box_autoadd_gossip_source_config(gossipSourceConfig); return _platform.executeNormal(FlutterRustBridgeTask( callFfi: (port_) => - _platform.inner.wire_build_node(port_, arg0, arg1, arg2, arg3), + _platform.inner.wire_build_sqlite_node(port_, arg0, arg1, arg2, arg3), parseSuccessData: (d) => _wire2api_node_pointer(d), parseErrorData: _wire2api_builder_exception, - constMeta: kBuildNodeConstMeta, + constMeta: kBuildSqliteNodeConstMeta, argValues: [ config, chainDataSourceConfig, @@ -72,9 +72,9 @@ class RustLdkNodeImpl implements RustLdkNode { )); } - FlutterRustBridgeTaskConstMeta get kBuildNodeConstMeta => + FlutterRustBridgeTaskConstMeta get kBuildSqliteNodeConstMeta => const FlutterRustBridgeTaskConstMeta( - debugName: "build_node", + debugName: "build_sqlite_node", argNames: [ "config", "chainDataSourceConfig", @@ -204,24 +204,24 @@ class RustLdkNodeImpl implements RustLdkNode { argNames: ["that"], ); - Future listeningAddressMethodNodePointer( + Future?> listeningAddressesMethodNodePointer( {required NodePointer that, dynamic hint}) { var arg0 = _platform.api2wire_box_autoadd_node_pointer(that); return _platform.executeNormal(FlutterRustBridgeTask( callFfi: (port_) => _platform.inner - .wire_listening_address__method__NodePointer(port_, arg0), - parseSuccessData: _wire2api_opt_box_autoadd_net_address, + .wire_listening_addresses__method__NodePointer(port_, arg0), + parseSuccessData: _wire2api_opt_list_socket_address, parseErrorData: null, - constMeta: kListeningAddressMethodNodePointerConstMeta, + constMeta: kListeningAddressesMethodNodePointerConstMeta, argValues: [that], hint: hint, )); } FlutterRustBridgeTaskConstMeta - get kListeningAddressMethodNodePointerConstMeta => + get kListeningAddressesMethodNodePointerConstMeta => const FlutterRustBridgeTaskConstMeta( - debugName: "listening_address__method__NodePointer", + debugName: "listening_addresses__method__NodePointer", argNames: ["that"], ); @@ -362,12 +362,12 @@ class RustLdkNodeImpl implements RustLdkNode { Future connectMethodNodePointer( {required NodePointer that, required PublicKey nodeId, - required NetAddress address, + required SocketAddress address, required bool persist, dynamic hint}) { var arg0 = _platform.api2wire_box_autoadd_node_pointer(that); var arg1 = _platform.api2wire_box_autoadd_public_key(nodeId); - var arg2 = _platform.api2wire_box_autoadd_net_address(address); + var arg2 = _platform.api2wire_box_autoadd_socket_address(address); var arg3 = persist; return _platform.executeNormal(FlutterRustBridgeTask( callFfi: (port_) => _platform.inner @@ -411,7 +411,7 @@ class RustLdkNodeImpl implements RustLdkNode { Future connectOpenChannelMethodNodePointer( {required NodePointer that, - required NetAddress address, + required SocketAddress address, required PublicKey nodeId, required int channelAmountSats, int? pushToCounterpartyMsat, @@ -419,7 +419,7 @@ class RustLdkNodeImpl implements RustLdkNode { ChannelConfig? channelConfig, dynamic hint}) { var arg0 = _platform.api2wire_box_autoadd_node_pointer(that); - var arg1 = _platform.api2wire_box_autoadd_net_address(address); + var arg1 = _platform.api2wire_box_autoadd_socket_address(address); var arg2 = _platform.api2wire_box_autoadd_public_key(nodeId); var arg3 = _platform.api2wire_u64(channelAmountSats); var arg4 = _platform.api2wire_opt_box_autoadd_u64(pushToCounterpartyMsat); @@ -616,7 +616,7 @@ class RustLdkNodeImpl implements RustLdkNode { argNames: ["that", "amountMsat", "nodeId"], ); - Future sendPaymentProbeMethodNodePointer( + Future sendPaymentProbesMethodNodePointer( {required NodePointer that, required Bolt11Invoice invoice, dynamic hint}) { @@ -624,23 +624,23 @@ class RustLdkNodeImpl implements RustLdkNode { var arg1 = _platform.api2wire_box_autoadd_bolt_11_invoice(invoice); return _platform.executeNormal(FlutterRustBridgeTask( callFfi: (port_) => _platform.inner - .wire_send_payment_probe__method__NodePointer(port_, arg0, arg1), + .wire_send_payment_probes__method__NodePointer(port_, arg0, arg1), parseSuccessData: _wire2api_unit, parseErrorData: _wire2api_node_exception, - constMeta: kSendPaymentProbeMethodNodePointerConstMeta, + constMeta: kSendPaymentProbesMethodNodePointerConstMeta, argValues: [that, invoice], hint: hint, )); } FlutterRustBridgeTaskConstMeta - get kSendPaymentProbeMethodNodePointerConstMeta => + get kSendPaymentProbesMethodNodePointerConstMeta => const FlutterRustBridgeTaskConstMeta( - debugName: "send_payment_probe__method__NodePointer", + debugName: "send_payment_probes__method__NodePointer", argNames: ["that", "invoice"], ); - Future sendSpontaneousPaymentProbeMethodNodePointer( + Future sendSpontaneousPaymentProbesMethodNodePointer( {required NodePointer that, required int amountMsat, required PublicKey nodeId, @@ -650,20 +650,20 @@ class RustLdkNodeImpl implements RustLdkNode { var arg2 = _platform.api2wire_box_autoadd_public_key(nodeId); return _platform.executeNormal(FlutterRustBridgeTask( callFfi: (port_) => _platform.inner - .wire_send_spontaneous_payment_probe__method__NodePointer( + .wire_send_spontaneous_payment_probes__method__NodePointer( port_, arg0, arg1, arg2), parseSuccessData: _wire2api_unit, parseErrorData: _wire2api_node_exception, - constMeta: kSendSpontaneousPaymentProbeMethodNodePointerConstMeta, + constMeta: kSendSpontaneousPaymentProbesMethodNodePointerConstMeta, argValues: [that, amountMsat, nodeId], hint: hint, )); } FlutterRustBridgeTaskConstMeta - get kSendSpontaneousPaymentProbeMethodNodePointerConstMeta => + get kSendSpontaneousPaymentProbesMethodNodePointerConstMeta => const FlutterRustBridgeTaskConstMeta( - debugName: "send_spontaneous_payment_probe__method__NodePointer", + debugName: "send_spontaneous_payment_probes__method__NodePointer", argNames: ["that", "amountMsat", "nodeId"], ); @@ -934,8 +934,8 @@ class RustLdkNodeImpl implements RustLdkNode { return _wire2api_event(raw); } - NetAddress _wire2api_box_autoadd_net_address(dynamic raw) { - return _wire2api_net_address(raw); + Hostname _wire2api_box_autoadd_hostname(dynamic raw) { + return _wire2api_hostname(raw); } OutPoint _wire2api_box_autoadd_out_point(dynamic raw) { @@ -1030,11 +1030,13 @@ class RustLdkNodeImpl implements RustLdkNode { return Event_ChannelReady( channelId: _wire2api_box_autoadd_channel_id(raw[1]), userChannelId: _wire2api_box_autoadd_user_channel_id(raw[2]), + counterpartyNodeId: _wire2api_opt_box_autoadd_public_key(raw[3]), ); case 4: return Event_ChannelClosed( channelId: _wire2api_box_autoadd_channel_id(raw[1]), userChannelId: _wire2api_box_autoadd_user_channel_id(raw[2]), + counterpartyNodeId: _wire2api_opt_box_autoadd_public_key(raw[3]), ); case 5: return Event_ChannelPending( @@ -1049,6 +1051,15 @@ class RustLdkNodeImpl implements RustLdkNode { } } + Hostname _wire2api_hostname(dynamic raw) { + final arr = raw as List; + if (arr.length != 1) + throw Exception('unexpected arr length: expect 1 but see ${arr.length}'); + return Hostname( + internal: _wire2api_String(arr[0]), + ); + } + int _wire2api_i32(dynamic raw) { return raw as int; } @@ -1065,6 +1076,10 @@ class RustLdkNodeImpl implements RustLdkNode { return (raw as List).map(_wire2api_peer_details).toList(); } + List _wire2api_list_socket_address(dynamic raw) { + return (raw as List).map(_wire2api_socket_address).toList(); + } + Mnemonic _wire2api_mnemonic(dynamic raw) { final arr = raw as List; if (arr.length != 1) @@ -1074,23 +1089,6 @@ class RustLdkNodeImpl implements RustLdkNode { ); } - NetAddress _wire2api_net_address(dynamic raw) { - switch (raw[0]) { - case 0: - return NetAddress_IPv4( - addr: _wire2api_String(raw[1]), - port: _wire2api_u16(raw[2]), - ); - case 1: - return NetAddress_IPv6( - addr: _wire2api_String(raw[1]), - port: _wire2api_u16(raw[2]), - ); - default: - throw Exception("unreachable"); - } - } - NodeException _wire2api_node_exception(dynamic raw) { return NodeException.values[raw as int]; } @@ -1113,10 +1111,6 @@ class RustLdkNodeImpl implements RustLdkNode { return raw == null ? null : _wire2api_box_autoadd_event(raw); } - NetAddress? _wire2api_opt_box_autoadd_net_address(dynamic raw) { - return raw == null ? null : _wire2api_box_autoadd_net_address(raw); - } - PaymentDetails? _wire2api_opt_box_autoadd_payment_details(dynamic raw) { return raw == null ? null : _wire2api_box_autoadd_payment_details(raw); } @@ -1129,6 +1123,10 @@ class RustLdkNodeImpl implements RustLdkNode { return raw == null ? null : _wire2api_box_autoadd_payment_secret(raw); } + PublicKey? _wire2api_opt_box_autoadd_public_key(dynamic raw) { + return raw == null ? null : _wire2api_box_autoadd_public_key(raw); + } + int? _wire2api_opt_box_autoadd_u32(dynamic raw) { return raw == null ? null : _wire2api_box_autoadd_u32(raw); } @@ -1137,6 +1135,10 @@ class RustLdkNodeImpl implements RustLdkNode { return raw == null ? null : _wire2api_box_autoadd_u64(raw); } + List? _wire2api_opt_list_socket_address(dynamic raw) { + return raw == null ? null : _wire2api_list_socket_address(raw); + } + OutPoint _wire2api_out_point(dynamic raw) { final arr = raw as List; if (arr.length != 2) @@ -1202,7 +1204,7 @@ class RustLdkNodeImpl implements RustLdkNode { throw Exception('unexpected arr length: expect 3 but see ${arr.length}'); return PeerDetails( nodeId: _wire2api_public_key(arr[0]), - address: _wire2api_net_address(arr[1]), + address: _wire2api_socket_address(arr[1]), isConnected: _wire2api_bool(arr[2]), ); } @@ -1216,6 +1218,39 @@ class RustLdkNodeImpl implements RustLdkNode { ); } + SocketAddress _wire2api_socket_address(dynamic raw) { + switch (raw[0]) { + case 0: + return SocketAddress_TcpIpV4( + addr: _wire2api_u8_array_4(raw[1]), + port: _wire2api_u16(raw[2]), + ); + case 1: + return SocketAddress_TcpIpV6( + addr: _wire2api_u8_array_16(raw[1]), + port: _wire2api_u16(raw[2]), + ); + case 2: + return SocketAddress_OnionV2( + _wire2api_u8_array_12(raw[1]), + ); + case 3: + return SocketAddress_OnionV3( + ed25519Pubkey: _wire2api_u8_array_32(raw[1]), + checksum: _wire2api_u16(raw[2]), + version: _wire2api_u8(raw[3]), + port: _wire2api_u16(raw[4]), + ); + case 4: + return SocketAddress_Hostname( + hostname: _wire2api_box_autoadd_hostname(raw[1]), + port: _wire2api_u16(raw[2]), + ); + default: + throw Exception("unreachable"); + } + } + Txid _wire2api_txid(dynamic raw) { final arr = raw as List; if (arr.length != 1) @@ -1241,10 +1276,22 @@ class RustLdkNodeImpl implements RustLdkNode { return raw as int; } + U8Array12 _wire2api_u8_array_12(dynamic raw) { + return U8Array12(_wire2api_uint_8_list(raw)); + } + + U8Array16 _wire2api_u8_array_16(dynamic raw) { + return U8Array16(_wire2api_uint_8_list(raw)); + } + U8Array32 _wire2api_u8_array_32(dynamic raw) { return U8Array32(_wire2api_uint_8_list(raw)); } + U8Array4 _wire2api_u8_array_4(dynamic raw) { + return U8Array4(_wire2api_uint_8_list(raw)); + } + Uint8List _wire2api_uint_8_list(dynamic raw) { return raw as Uint8List; } @@ -1387,17 +1434,16 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { } @protected - ffi.Pointer api2wire_box_autoadd_mnemonic(Mnemonic raw) { - final ptr = inner.new_box_autoadd_mnemonic_0(); - _api_fill_to_wire_mnemonic(raw, ptr.ref); + ffi.Pointer api2wire_box_autoadd_hostname(Hostname raw) { + final ptr = inner.new_box_autoadd_hostname_0(); + _api_fill_to_wire_hostname(raw, ptr.ref); return ptr; } @protected - ffi.Pointer api2wire_box_autoadd_net_address( - NetAddress raw) { - final ptr = inner.new_box_autoadd_net_address_0(); - _api_fill_to_wire_net_address(raw, ptr.ref); + ffi.Pointer api2wire_box_autoadd_mnemonic(Mnemonic raw) { + final ptr = inner.new_box_autoadd_mnemonic_0(); + _api_fill_to_wire_mnemonic(raw, ptr.ref); return ptr; } @@ -1424,6 +1470,14 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { return ptr; } + @protected + ffi.Pointer api2wire_box_autoadd_socket_address( + SocketAddress raw) { + final ptr = inner.new_box_autoadd_socket_address_0(); + _api_fill_to_wire_socket_address(raw, ptr.ref); + return ptr; + } + @protected ffi.Pointer api2wire_box_autoadd_u64(int raw) { return inner.new_box_autoadd_u64_0(api2wire_u64(raw)); @@ -1439,6 +1493,16 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { return ans; } + @protected + ffi.Pointer api2wire_list_socket_address( + List raw) { + final ans = inner.new_list_socket_address_0(raw.length); + for (var i = 0; i < raw.length; ++i) { + _api_fill_to_wire_socket_address(raw[i], ans.ref.ptr[i]); + } + return ans; + } + @protected ffi.Pointer api2wire_opt_String(String? raw) { return raw == null ? ffi.nullptr : api2wire_String(raw); @@ -1476,14 +1540,14 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { } @protected - ffi.Pointer api2wire_opt_box_autoadd_net_address( - NetAddress? raw) { - return raw == null ? ffi.nullptr : api2wire_box_autoadd_net_address(raw); + ffi.Pointer api2wire_opt_box_autoadd_u64(int? raw) { + return raw == null ? ffi.nullptr : api2wire_box_autoadd_u64(raw); } @protected - ffi.Pointer api2wire_opt_box_autoadd_u64(int? raw) { - return raw == null ? ffi.nullptr : api2wire_box_autoadd_u64(raw); + ffi.Pointer api2wire_opt_list_socket_address( + List? raw) { + return raw == null ? ffi.nullptr : api2wire_list_socket_address(raw); } @protected @@ -1491,6 +1555,20 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { return raw; } + @protected + ffi.Pointer api2wire_u8_array_12(U8Array12 raw) { + final ans = inner.new_uint_8_list_0(12); + ans.ref.ptr.asTypedList(12).setAll(0, raw); + return ans; + } + + @protected + ffi.Pointer api2wire_u8_array_16(U8Array16 raw) { + final ans = inner.new_uint_8_list_0(16); + ans.ref.ptr.asTypedList(16).setAll(0, raw); + return ans; + } + @protected ffi.Pointer api2wire_u8_array_32(U8Array32 raw) { final ans = inner.new_uint_8_list_0(32); @@ -1498,6 +1576,13 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { return ans; } + @protected + ffi.Pointer api2wire_u8_array_4(U8Array4 raw) { + final ans = inner.new_uint_8_list_0(4); + ans.ref.ptr.asTypedList(4).setAll(0, raw); + return ans; + } + @protected ffi.Pointer api2wire_u8_array_64(U8Array64 raw) { final ans = inner.new_uint_8_list_0(64); @@ -1575,16 +1660,16 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { _api_fill_to_wire_gossip_source_config(apiObj, wireObj.ref); } + void _api_fill_to_wire_box_autoadd_hostname( + Hostname apiObj, ffi.Pointer wireObj) { + _api_fill_to_wire_hostname(apiObj, wireObj.ref); + } + void _api_fill_to_wire_box_autoadd_mnemonic( Mnemonic apiObj, ffi.Pointer wireObj) { _api_fill_to_wire_mnemonic(apiObj, wireObj.ref); } - void _api_fill_to_wire_box_autoadd_net_address( - NetAddress apiObj, ffi.Pointer wireObj) { - _api_fill_to_wire_net_address(apiObj, wireObj.ref); - } - void _api_fill_to_wire_box_autoadd_node_pointer( NodePointer apiObj, ffi.Pointer wireObj) { _api_fill_to_wire_node_pointer(apiObj, wireObj.ref); @@ -1600,6 +1685,11 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { _api_fill_to_wire_public_key(apiObj, wireObj.ref); } + void _api_fill_to_wire_box_autoadd_socket_address( + SocketAddress apiObj, ffi.Pointer wireObj) { + _api_fill_to_wire_socket_address(apiObj, wireObj.ref); + } + void _api_fill_to_wire_chain_data_source_config( ChainDataSourceConfig apiObj, wire_ChainDataSourceConfig wireObj) { if (apiObj is ChainDataSourceConfig_Esplora) { @@ -1634,8 +1724,8 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { wireObj.storage_dir_path = api2wire_String(apiObj.storageDirPath); wireObj.log_dir_path = api2wire_opt_String(apiObj.logDirPath); wireObj.network = api2wire_network(apiObj.network); - wireObj.listening_address = - api2wire_opt_box_autoadd_net_address(apiObj.listeningAddress); + wireObj.listening_addresses = + api2wire_opt_list_socket_address(apiObj.listeningAddresses); wireObj.default_cltv_expiry_delta = api2wire_u32(apiObj.defaultCltvExpiryDelta); wireObj.onchain_wallet_sync_interval_secs = @@ -1693,6 +1783,10 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { } } + void _api_fill_to_wire_hostname(Hostname apiObj, wire_Hostname wireObj) { + wireObj.internal = api2wire_String(apiObj.internal); + } + void _api_fill_to_wire_max_dust_htlc_exposure( MaxDustHTLCExposure apiObj, wire_MaxDustHTLCExposure wireObj) { if (apiObj is MaxDustHTLCExposure_FixedLimitMsat) { @@ -1715,28 +1809,6 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { wireObj.internal = api2wire_String(apiObj.internal); } - void _api_fill_to_wire_net_address( - NetAddress apiObj, wire_NetAddress wireObj) { - if (apiObj is NetAddress_IPv4) { - var pre_addr = api2wire_String(apiObj.addr); - var pre_port = api2wire_u16(apiObj.port); - wireObj.tag = 0; - wireObj.kind = inner.inflate_NetAddress_IPv4(); - wireObj.kind.ref.IPv4.ref.addr = pre_addr; - wireObj.kind.ref.IPv4.ref.port = pre_port; - return; - } - if (apiObj is NetAddress_IPv6) { - var pre_addr = api2wire_String(apiObj.addr); - var pre_port = api2wire_u16(apiObj.port); - wireObj.tag = 1; - wireObj.kind = inner.inflate_NetAddress_IPv6(); - wireObj.kind.ref.IPv6.ref.addr = pre_addr; - wireObj.kind.ref.IPv6.ref.port = pre_port; - return; - } - } - void _api_fill_to_wire_node_pointer( NodePointer apiObj, wire_NodePointer wireObj) { wireObj.field0 = api2wire_MutexNodeSqliteStore(apiObj.field0); @@ -1750,6 +1822,57 @@ class RustLdkNodePlatform extends FlutterRustBridgeBase { void _api_fill_to_wire_public_key(PublicKey apiObj, wire_PublicKey wireObj) { wireObj.internal = api2wire_String(apiObj.internal); } + + void _api_fill_to_wire_socket_address( + SocketAddress apiObj, wire_SocketAddress wireObj) { + if (apiObj is SocketAddress_TcpIpV4) { + var pre_addr = api2wire_u8_array_4(apiObj.addr); + var pre_port = api2wire_u16(apiObj.port); + wireObj.tag = 0; + wireObj.kind = inner.inflate_SocketAddress_TcpIpV4(); + wireObj.kind.ref.TcpIpV4.ref.addr = pre_addr; + wireObj.kind.ref.TcpIpV4.ref.port = pre_port; + return; + } + if (apiObj is SocketAddress_TcpIpV6) { + var pre_addr = api2wire_u8_array_16(apiObj.addr); + var pre_port = api2wire_u16(apiObj.port); + wireObj.tag = 1; + wireObj.kind = inner.inflate_SocketAddress_TcpIpV6(); + wireObj.kind.ref.TcpIpV6.ref.addr = pre_addr; + wireObj.kind.ref.TcpIpV6.ref.port = pre_port; + return; + } + if (apiObj is SocketAddress_OnionV2) { + var pre_field0 = api2wire_u8_array_12(apiObj.field0); + wireObj.tag = 2; + wireObj.kind = inner.inflate_SocketAddress_OnionV2(); + wireObj.kind.ref.OnionV2.ref.field0 = pre_field0; + return; + } + if (apiObj is SocketAddress_OnionV3) { + var pre_ed25519_pubkey = api2wire_u8_array_32(apiObj.ed25519Pubkey); + var pre_checksum = api2wire_u16(apiObj.checksum); + var pre_version = api2wire_u8(apiObj.version); + var pre_port = api2wire_u16(apiObj.port); + wireObj.tag = 3; + wireObj.kind = inner.inflate_SocketAddress_OnionV3(); + wireObj.kind.ref.OnionV3.ref.ed25519_pubkey = pre_ed25519_pubkey; + wireObj.kind.ref.OnionV3.ref.checksum = pre_checksum; + wireObj.kind.ref.OnionV3.ref.version = pre_version; + wireObj.kind.ref.OnionV3.ref.port = pre_port; + return; + } + if (apiObj is SocketAddress_Hostname) { + var pre_hostname = api2wire_box_autoadd_hostname(apiObj.hostname); + var pre_port = api2wire_u16(apiObj.port); + wireObj.tag = 4; + wireObj.kind = inner.inflate_SocketAddress_Hostname(); + wireObj.kind.ref.Hostname.ref.hostname = pre_hostname; + wireObj.kind.ref.Hostname.ref.port = pre_port; + return; + } + } } // ignore_for_file: camel_case_types, non_constant_identifier_names, avoid_positional_boolean_parameters, annotate_overrides, constant_identifier_names @@ -1862,14 +1985,14 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { late final _wire_generate_entropy_mnemonic = _wire_generate_entropy_mnemonicPtr.asFunction(); - void wire_build_node( + void wire_build_sqlite_node( int port_, ffi.Pointer config, ffi.Pointer chain_data_source_config, ffi.Pointer entropy_source_config, ffi.Pointer gossip_source_config, ) { - return _wire_build_node( + return _wire_build_sqlite_node( port_, config, chain_data_source_config, @@ -1878,15 +2001,15 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { ); } - late final _wire_build_nodePtr = _lookup< + late final _wire_build_sqlite_nodePtr = _lookup< ffi.NativeFunction< ffi.Void Function( ffi.Int64, ffi.Pointer, ffi.Pointer, ffi.Pointer, - ffi.Pointer)>>('wire_build_node'); - late final _wire_build_node = _wire_build_nodePtr.asFunction< + ffi.Pointer)>>('wire_build_sqlite_node'); + late final _wire_build_sqlite_node = _wire_build_sqlite_nodePtr.asFunction< void Function( int, ffi.Pointer, @@ -2002,22 +2125,22 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { _wire_node_id__method__NodePointerPtr .asFunction)>(); - void wire_listening_address__method__NodePointer( + void wire_listening_addresses__method__NodePointer( int port_, ffi.Pointer that, ) { - return _wire_listening_address__method__NodePointer( + return _wire_listening_addresses__method__NodePointer( port_, that, ); } - late final _wire_listening_address__method__NodePointerPtr = _lookup< + late final _wire_listening_addresses__method__NodePointerPtr = _lookup< ffi.NativeFunction< ffi.Void Function(ffi.Int64, ffi.Pointer)>>( - 'wire_listening_address__method__NodePointer'); - late final _wire_listening_address__method__NodePointer = - _wire_listening_address__method__NodePointerPtr + 'wire_listening_addresses__method__NodePointer'); + late final _wire_listening_addresses__method__NodePointer = + _wire_listening_addresses__method__NodePointerPtr .asFunction)>(); void wire_new_onchain_address__method__NodePointer( @@ -2145,7 +2268,7 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { int port_, ffi.Pointer that, ffi.Pointer node_id, - ffi.Pointer address, + ffi.Pointer address, bool persist, ) { return _wire_connect__method__NodePointer( @@ -2163,7 +2286,7 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { ffi.Int64, ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.Bool)>>('wire_connect__method__NodePointer'); late final _wire_connect__method__NodePointer = _wire_connect__method__NodePointerPtr.asFunction< @@ -2171,7 +2294,7 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { int, ffi.Pointer, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, bool)>(); void wire_disconnect__method__NodePointer( @@ -2199,7 +2322,7 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { void wire_connect_open_channel__method__NodePointer( int port_, ffi.Pointer that, - ffi.Pointer address, + ffi.Pointer address, ffi.Pointer node_id, int channel_amount_sats, ffi.Pointer push_to_counterparty_msat, @@ -2223,7 +2346,7 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { ffi.Void Function( ffi.Int64, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.Pointer, ffi.Uint64, ffi.Pointer, @@ -2235,7 +2358,7 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { void Function( int, ffi.Pointer, - ffi.Pointer, + ffi.Pointer, ffi.Pointer, int, ffi.Pointer, @@ -2388,35 +2511,35 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { void Function(int, ffi.Pointer, int, ffi.Pointer)>(); - void wire_send_payment_probe__method__NodePointer( + void wire_send_payment_probes__method__NodePointer( int port_, ffi.Pointer that, ffi.Pointer invoice, ) { - return _wire_send_payment_probe__method__NodePointer( + return _wire_send_payment_probes__method__NodePointer( port_, that, invoice, ); } - late final _wire_send_payment_probe__method__NodePointerPtr = _lookup< + late final _wire_send_payment_probes__method__NodePointerPtr = _lookup< ffi.NativeFunction< ffi.Void Function(ffi.Int64, ffi.Pointer, ffi.Pointer)>>( - 'wire_send_payment_probe__method__NodePointer'); - late final _wire_send_payment_probe__method__NodePointer = - _wire_send_payment_probe__method__NodePointerPtr.asFunction< + 'wire_send_payment_probes__method__NodePointer'); + late final _wire_send_payment_probes__method__NodePointer = + _wire_send_payment_probes__method__NodePointerPtr.asFunction< void Function(int, ffi.Pointer, ffi.Pointer)>(); - void wire_send_spontaneous_payment_probe__method__NodePointer( + void wire_send_spontaneous_payment_probes__method__NodePointer( int port_, ffi.Pointer that, int amount_msat, ffi.Pointer node_id, ) { - return _wire_send_spontaneous_payment_probe__method__NodePointer( + return _wire_send_spontaneous_payment_probes__method__NodePointer( port_, that, amount_msat, @@ -2424,15 +2547,14 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { ); } - late final _wire_send_spontaneous_payment_probe__method__NodePointerPtr = + late final _wire_send_spontaneous_payment_probes__method__NodePointerPtr = _lookup< - ffi - .NativeFunction< + ffi.NativeFunction< ffi.Void Function(ffi.Int64, ffi.Pointer, ffi.Uint64, ffi.Pointer)>>( - 'wire_send_spontaneous_payment_probe__method__NodePointer'); - late final _wire_send_spontaneous_payment_probe__method__NodePointer = - _wire_send_spontaneous_payment_probe__method__NodePointerPtr.asFunction< + 'wire_send_spontaneous_payment_probes__method__NodePointer'); + late final _wire_send_spontaneous_payment_probes__method__NodePointer = + _wire_send_spontaneous_payment_probes__method__NodePointerPtr.asFunction< void Function(int, ffi.Pointer, int, ffi.Pointer)>(); @@ -2746,6 +2868,16 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { _new_box_autoadd_gossip_source_config_0Ptr .asFunction Function()>(); + ffi.Pointer new_box_autoadd_hostname_0() { + return _new_box_autoadd_hostname_0(); + } + + late final _new_box_autoadd_hostname_0Ptr = + _lookup Function()>>( + 'new_box_autoadd_hostname_0'); + late final _new_box_autoadd_hostname_0 = _new_box_autoadd_hostname_0Ptr + .asFunction Function()>(); + ffi.Pointer new_box_autoadd_mnemonic_0() { return _new_box_autoadd_mnemonic_0(); } @@ -2756,16 +2888,6 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { late final _new_box_autoadd_mnemonic_0 = _new_box_autoadd_mnemonic_0Ptr .asFunction Function()>(); - ffi.Pointer new_box_autoadd_net_address_0() { - return _new_box_autoadd_net_address_0(); - } - - late final _new_box_autoadd_net_address_0Ptr = - _lookup Function()>>( - 'new_box_autoadd_net_address_0'); - late final _new_box_autoadd_net_address_0 = _new_box_autoadd_net_address_0Ptr - .asFunction Function()>(); - ffi.Pointer new_box_autoadd_node_pointer_0() { return _new_box_autoadd_node_pointer_0(); } @@ -2798,6 +2920,17 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { late final _new_box_autoadd_public_key_0 = _new_box_autoadd_public_key_0Ptr .asFunction Function()>(); + ffi.Pointer new_box_autoadd_socket_address_0() { + return _new_box_autoadd_socket_address_0(); + } + + late final _new_box_autoadd_socket_address_0Ptr = + _lookup Function()>>( + 'new_box_autoadd_socket_address_0'); + late final _new_box_autoadd_socket_address_0 = + _new_box_autoadd_socket_address_0Ptr + .asFunction Function()>(); + ffi.Pointer new_box_autoadd_u64_0( int value, ) { @@ -2827,6 +2960,21 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { late final _new_list_public_key_0 = _new_list_public_key_0Ptr .asFunction Function(int)>(); + ffi.Pointer new_list_socket_address_0( + int len, + ) { + return _new_list_socket_address_0( + len, + ); + } + + late final _new_list_socket_address_0Ptr = _lookup< + ffi.NativeFunction< + ffi.Pointer Function( + ffi.Int32)>>('new_list_socket_address_0'); + late final _new_list_socket_address_0 = _new_list_socket_address_0Ptr + .asFunction Function(int)>(); + ffi.Pointer new_uint_8_list_0( int len, ) { @@ -2956,25 +3104,56 @@ class RustLdkNodeWire implements FlutterRustBridgeWireBase { _inflate_MaxDustHTLCExposure_FeeRateMultiplierPtr .asFunction Function()>(); - ffi.Pointer inflate_NetAddress_IPv4() { - return _inflate_NetAddress_IPv4(); + ffi.Pointer inflate_SocketAddress_TcpIpV4() { + return _inflate_SocketAddress_TcpIpV4(); + } + + late final _inflate_SocketAddress_TcpIpV4Ptr = + _lookup Function()>>( + 'inflate_SocketAddress_TcpIpV4'); + late final _inflate_SocketAddress_TcpIpV4 = _inflate_SocketAddress_TcpIpV4Ptr + .asFunction Function()>(); + + ffi.Pointer inflate_SocketAddress_TcpIpV6() { + return _inflate_SocketAddress_TcpIpV6(); } - late final _inflate_NetAddress_IPv4Ptr = - _lookup Function()>>( - 'inflate_NetAddress_IPv4'); - late final _inflate_NetAddress_IPv4 = _inflate_NetAddress_IPv4Ptr - .asFunction Function()>(); + late final _inflate_SocketAddress_TcpIpV6Ptr = + _lookup Function()>>( + 'inflate_SocketAddress_TcpIpV6'); + late final _inflate_SocketAddress_TcpIpV6 = _inflate_SocketAddress_TcpIpV6Ptr + .asFunction Function()>(); - ffi.Pointer inflate_NetAddress_IPv6() { - return _inflate_NetAddress_IPv6(); + ffi.Pointer inflate_SocketAddress_OnionV2() { + return _inflate_SocketAddress_OnionV2(); } - late final _inflate_NetAddress_IPv6Ptr = - _lookup Function()>>( - 'inflate_NetAddress_IPv6'); - late final _inflate_NetAddress_IPv6 = _inflate_NetAddress_IPv6Ptr - .asFunction Function()>(); + late final _inflate_SocketAddress_OnionV2Ptr = + _lookup Function()>>( + 'inflate_SocketAddress_OnionV2'); + late final _inflate_SocketAddress_OnionV2 = _inflate_SocketAddress_OnionV2Ptr + .asFunction Function()>(); + + ffi.Pointer inflate_SocketAddress_OnionV3() { + return _inflate_SocketAddress_OnionV3(); + } + + late final _inflate_SocketAddress_OnionV3Ptr = + _lookup Function()>>( + 'inflate_SocketAddress_OnionV3'); + late final _inflate_SocketAddress_OnionV3 = _inflate_SocketAddress_OnionV3Ptr + .asFunction Function()>(); + + ffi.Pointer inflate_SocketAddress_Hostname() { + return _inflate_SocketAddress_Hostname(); + } + + late final _inflate_SocketAddress_HostnamePtr = + _lookup Function()>>( + 'inflate_SocketAddress_Hostname'); + late final _inflate_SocketAddress_Hostname = + _inflate_SocketAddress_HostnamePtr + .asFunction Function()>(); void free_WireSyncReturn( WireSyncReturn ptr, @@ -3000,31 +3179,72 @@ final class wire_uint_8_list extends ffi.Struct { external int len; } -final class wire_NetAddress_IPv4 extends ffi.Struct { +final class wire_SocketAddress_TcpIpV4 extends ffi.Struct { external ffi.Pointer addr; @ffi.Uint16() external int port; } -final class wire_NetAddress_IPv6 extends ffi.Struct { +final class wire_SocketAddress_TcpIpV6 extends ffi.Struct { external ffi.Pointer addr; @ffi.Uint16() external int port; } -final class NetAddressKind extends ffi.Union { - external ffi.Pointer IPv4; +final class wire_SocketAddress_OnionV2 extends ffi.Struct { + external ffi.Pointer field0; +} + +final class wire_SocketAddress_OnionV3 extends ffi.Struct { + external ffi.Pointer ed25519_pubkey; + + @ffi.Uint16() + external int checksum; + + @ffi.Uint8() + external int version; + + @ffi.Uint16() + external int port; +} + +final class wire_Hostname extends ffi.Struct { + external ffi.Pointer internal; +} + +final class wire_SocketAddress_Hostname extends ffi.Struct { + external ffi.Pointer hostname; + + @ffi.Uint16() + external int port; +} + +final class SocketAddressKind extends ffi.Union { + external ffi.Pointer TcpIpV4; + + external ffi.Pointer TcpIpV6; + + external ffi.Pointer OnionV2; + + external ffi.Pointer OnionV3; - external ffi.Pointer IPv6; + external ffi.Pointer Hostname; } -final class wire_NetAddress extends ffi.Struct { +final class wire_SocketAddress extends ffi.Struct { @ffi.Int32() external int tag; - external ffi.Pointer kind; + external ffi.Pointer kind; +} + +final class wire_list_socket_address extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; } final class wire_PublicKey extends ffi.Struct { @@ -3046,7 +3266,7 @@ final class wire_Config extends ffi.Struct { @ffi.Int32() external int network; - external ffi.Pointer listening_address; + external ffi.Pointer listening_addresses; @ffi.Uint32() external int default_cltv_expiry_delta; diff --git a/lib/src/generated/bridge_definitions.dart b/lib/src/generated/bridge_definitions.dart index 15b9a16..82aead7 100644 --- a/lib/src/generated/bridge_definitions.dart +++ b/lib/src/generated/bridge_definitions.dart @@ -1,5 +1,5 @@ // AUTO GENERATED FILE, DO NOT EDIT. -// Generated by `flutter_rust_bridge`@ 1.82.4. +// Generated by `flutter_rust_bridge`@ 1.82.6. // ignore_for_file: non_constant_identifier_names, unused_element, duplicate_ignore, directives_ordering, curly_braces_in_flow_control_structures, unnecessary_lambdas, slash_for_doc_comments, prefer_const_literals_to_create_immutables, implicit_dynamic_list_literal, duplicate_import, unused_import, unnecessary_import, prefer_single_quotes, prefer_const_constructors, use_super_parameters, always_use_package_imports, annotate_overrides, invalid_use_of_protected_member, constant_identifier_names, invalid_use_of_internal_member, prefer_is_empty, unnecessary_const import 'dart:convert'; @@ -17,14 +17,14 @@ abstract class RustLdkNode { FlutterRustBridgeTaskConstMeta get kGenerateEntropyMnemonicConstMeta; - Future buildNode( + Future buildSqliteNode( {required Config config, ChainDataSourceConfig? chainDataSourceConfig, EntropySourceConfig? entropySourceConfig, GossipSourceConfig? gossipSourceConfig, dynamic hint}); - FlutterRustBridgeTaskConstMeta get kBuildNodeConstMeta; + FlutterRustBridgeTaskConstMeta get kBuildSqliteNodeConstMeta; /// Starts the necessary background tasks, such as handling events coming from user input, /// LDK/BDK, and the peer-to-peer network. @@ -78,11 +78,11 @@ abstract class RustLdkNode { FlutterRustBridgeTaskConstMeta get kNodeIdMethodNodePointerConstMeta; /// Returns our own listening address. - Future listeningAddressMethodNodePointer( + Future?> listeningAddressesMethodNodePointer( {required NodePointer that, dynamic hint}); FlutterRustBridgeTaskConstMeta - get kListeningAddressMethodNodePointerConstMeta; + get kListeningAddressesMethodNodePointerConstMeta; /// Retrieve a new on-chain/funding address. Future
newOnchainAddressMethodNodePointer( @@ -135,7 +135,7 @@ abstract class RustLdkNode { Future connectMethodNodePointer( {required NodePointer that, required PublicKey nodeId, - required NetAddress address, + required SocketAddress address, required bool persist, dynamic hint}); @@ -163,7 +163,7 @@ abstract class RustLdkNode { /// Returns a temporary channel id. Future connectOpenChannelMethodNodePointer( {required NodePointer that, - required NetAddress address, + required SocketAddress address, required PublicKey nodeId, required int channelAmountSats, int? pushToCounterpartyMsat, @@ -234,51 +234,30 @@ abstract class RustLdkNode { FlutterRustBridgeTaskConstMeta get kSendSpontaneousPaymentMethodNodePointerConstMeta; - /// - /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting - /// the actual payment. Note this is only useful if there likely is sufficient time for the - /// probe to settle before sending out the actual payment, e.g., when waiting for user - /// confirmation in a wallet UI. - /// - /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the - /// actual payment. Users should therefore be cautious and might avoid sending probes if - /// liquidity is scarce and/or they don't expect the probe to return before they send the - /// payment. To mitigate this issue, channels with available liquidity less than the required - /// amount times [`Config::probing_liquidity_limit_multiplier`] won't be used to send - /// pre-flight probes. - /// - Future sendPaymentProbeMethodNodePointer( + ///Sends payment probes over all paths of a route that would be used to pay the given invoice. + /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting the actual payment. + /// Note this is only useful if there likely is sufficient time for the probe to settle before sending out the actual payment, + /// e.g., when waiting for user confirmation in a wallet UI. + /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the actual payment. + /// Users should therefore be cautious and might avoid sending probes if liquidity is scarce and/or they don't expect the probe to return before they send the payment. + /// To mitigate this issue, channels with available liquidity less than the required amount times Config::probing_liquidity_limit_multiplier won't be used to send pre-flight probes. + Future sendPaymentProbesMethodNodePointer( {required NodePointer that, required Bolt11Invoice invoice, dynamic hint}); FlutterRustBridgeTaskConstMeta - get kSendPaymentProbeMethodNodePointerConstMeta; + get kSendPaymentProbesMethodNodePointerConstMeta; - /// Sends payment probes over all paths of a route that would be used to pay the given - /// amount to the given "nodeId". - /// - /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting - /// the actual payment. Note this is only useful if there likely is sufficient time for the - /// probe to settle before sending out the actual payment, e.g., when waiting for user - /// confirmation in a wallet UI. - /// - /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the - /// actual payment. Users should therefore be cautious and might avoid sending probes if - /// liquidity is scarce and/or they don't expect the probe to return before they send the - /// payment. To mitigate this issue, channels with available liquidity less than the required - /// amount times [Config::probing_liquidity_limit_multiplier] won't be used to send - /// pre-flight probes. - /// - /// - Future sendSpontaneousPaymentProbeMethodNodePointer( + ///Sends payment probes over all paths of a route that would be used to pay the given amount to the given node_id. + Future sendSpontaneousPaymentProbesMethodNodePointer( {required NodePointer that, required int amountMsat, required PublicKey nodeId, dynamic hint}); FlutterRustBridgeTaskConstMeta - get kSendSpontaneousPaymentProbeMethodNodePointerConstMeta; + get kSendSpontaneousPaymentProbesMethodNodePointerConstMeta; /// Returns a payable invoice that can be used to request and receive a payment of the amount /// given. @@ -407,13 +386,37 @@ class Bolt11Invoice { } enum BuilderException { + /// The given seed bytes are invalid, e.g., have invalid length. InvalidSeedBytes, + + /// The given seed file is invalid, e.g., has invalid length, or could not be read. InvalidSeedFile, + + /// The current system time is invalid, clocks might have gone backwards. InvalidSystemTime, + + /// The a read channel monitor is invalid. + InvalidChannelMonitor, + + /// The given listening addresses are invalid, e.g. too many were passed. + InvalidListeningAddresses, + + /// We failed to read data from the [`KVStore`]. ReadFailed, + + /// We failed to write data to the [`KVStore`]. WriteFailed, + + /// We failed to access the given `storage_dir_path`. StoragePathAccessFailed, + + /// We failed to setup our [`KVStore`]. + KVStoreSetupFailed, + + /// We failed to setup the onchain wallet. WalletSetupFailed, + + /// We failed to setup the logger. LoggerSetupFailed, } @@ -630,7 +633,7 @@ class Config { /// The IP address and TCP port the node will listen on. /// - NetAddress? listeningAddress; + List? listeningAddresses; /// The default CLTV expiry delta to be used for payments. /// @@ -665,7 +668,7 @@ class Config { required this.storageDirPath, this.logDirPath, required this.network, - this.listeningAddress, + this.listeningAddresses, required this.defaultCltvExpiryDelta, required this.onchainWalletSyncIntervalSecs, required this.walletSyncIntervalSecs, @@ -720,6 +723,7 @@ sealed class Event with _$Event { /// The user_channel_id of the channel. required UserChannelId userChannelId, + PublicKey? counterpartyNodeId, }) = Event_ChannelReady; /// A channel has been closed. @@ -729,6 +733,7 @@ sealed class Event with _$Event { /// The user_channel_id of the channel. required UserChannelId userChannelId, + PublicKey? counterpartyNodeId, }) = Event_ChannelClosed; /// A channel has been created and is pending confirmation on-chain. @@ -758,6 +763,14 @@ sealed class GossipSourceConfig with _$GossipSourceConfig { ) = GossipSourceConfig_RapidGossipSync; } +class Hostname { + final String internal; + + const Hostname({ + required this.internal, + }); +} + /// An enum representing the available verbosity levels of the logger. /// enum LogLevel { @@ -810,18 +823,6 @@ class Mnemonic { }); } -@freezed -sealed class NetAddress with _$NetAddress { - const factory NetAddress.iPv4({ - required String addr, - required int port, - }) = NetAddress_IPv4; - const factory NetAddress.iPv6({ - required String addr, - required int port, - }) = NetAddress_IPv6; -} - /// Bitcoin network enum /// enum Network { @@ -895,7 +896,7 @@ enum NodeException { InvalidAddress, /// The given network address is invalid. - InvalidNetAddress, + InvalidSocketAddress, /// The given public key is invalid. InvalidPublicKey, @@ -929,6 +930,7 @@ enum NodeException { /// There are insufficient funds to complete the given operation. InsufficientFunds, + FeerateEstimationUpdateFailed, } class NodePointer { @@ -988,8 +990,8 @@ class NodePointer { ); /// Returns our own listening address. - Future listeningAddress({dynamic hint}) => - bridge.listeningAddressMethodNodePointer( + Future?> listeningAddresses({dynamic hint}) => + bridge.listeningAddressesMethodNodePointer( that: this, ); @@ -1040,7 +1042,7 @@ class NodePointer { /// If `permanently` is set to `true`, we'll remember the peer and reconnect to it on restart. Future connect( {required PublicKey nodeId, - required NetAddress address, + required SocketAddress address, required bool persist, dynamic hint}) => bridge.connectMethodNodePointer( @@ -1071,7 +1073,7 @@ class NodePointer { /// /// Returns a temporary channel id. Future connectOpenChannel( - {required NetAddress address, + {required SocketAddress address, required PublicKey nodeId, required int channelAmountSats, int? pushToCounterpartyMsat, @@ -1152,45 +1154,24 @@ class NodePointer { nodeId: nodeId, ); - /// - /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting - /// the actual payment. Note this is only useful if there likely is sufficient time for the - /// probe to settle before sending out the actual payment, e.g., when waiting for user - /// confirmation in a wallet UI. - /// - /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the - /// actual payment. Users should therefore be cautious and might avoid sending probes if - /// liquidity is scarce and/or they don't expect the probe to return before they send the - /// payment. To mitigate this issue, channels with available liquidity less than the required - /// amount times [`Config::probing_liquidity_limit_multiplier`] won't be used to send - /// pre-flight probes. - /// - Future sendPaymentProbe( + ///Sends payment probes over all paths of a route that would be used to pay the given invoice. + /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting the actual payment. + /// Note this is only useful if there likely is sufficient time for the probe to settle before sending out the actual payment, + /// e.g., when waiting for user confirmation in a wallet UI. + /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the actual payment. + /// Users should therefore be cautious and might avoid sending probes if liquidity is scarce and/or they don't expect the probe to return before they send the payment. + /// To mitigate this issue, channels with available liquidity less than the required amount times Config::probing_liquidity_limit_multiplier won't be used to send pre-flight probes. + Future sendPaymentProbes( {required Bolt11Invoice invoice, dynamic hint}) => - bridge.sendPaymentProbeMethodNodePointer( + bridge.sendPaymentProbesMethodNodePointer( that: this, invoice: invoice, ); - /// Sends payment probes over all paths of a route that would be used to pay the given - /// amount to the given "nodeId". - /// - /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting - /// the actual payment. Note this is only useful if there likely is sufficient time for the - /// probe to settle before sending out the actual payment, e.g., when waiting for user - /// confirmation in a wallet UI. - /// - /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the - /// actual payment. Users should therefore be cautious and might avoid sending probes if - /// liquidity is scarce and/or they don't expect the probe to return before they send the - /// payment. To mitigate this issue, channels with available liquidity less than the required - /// amount times [Config::probing_liquidity_limit_multiplier] won't be used to send - /// pre-flight probes. - /// - /// - Future sendSpontaneousPaymentProbe( + ///Sends payment probes over all paths of a route that would be used to pay the given amount to the given node_id. + Future sendSpontaneousPaymentProbes( {required int amountMsat, required PublicKey nodeId, dynamic hint}) => - bridge.sendSpontaneousPaymentProbeMethodNodePointer( + bridge.sendSpontaneousPaymentProbesMethodNodePointer( that: this, amountMsat: amountMsat, nodeId: nodeId, @@ -1394,7 +1375,7 @@ class PeerDetails { /// The IP address and TCP port of the peer. /// - final NetAddress address; + final SocketAddress address; /// Indicates whether or not the user is currently has an active connection with the peer. /// @@ -1417,6 +1398,31 @@ class PublicKey { }); } +@freezed +sealed class SocketAddress with _$SocketAddress { + const factory SocketAddress.tcpIpV4({ + required U8Array4 addr, + required int port, + }) = SocketAddress_TcpIpV4; + const factory SocketAddress.tcpIpV6({ + required U8Array16 addr, + required int port, + }) = SocketAddress_TcpIpV6; + const factory SocketAddress.onionV2( + U8Array12 field0, + ) = SocketAddress_OnionV2; + const factory SocketAddress.onionV3({ + required U8Array32 ed25519Pubkey, + required int checksum, + required int version, + required int port, + }) = SocketAddress_OnionV3; + const factory SocketAddress.hostname({ + required Hostname hostname, + required int port, + }) = SocketAddress_Hostname; +} + ///A bitcoin transaction hash/transaction ID. /// class Txid { @@ -1427,6 +1433,24 @@ class Txid { }); } +class U8Array12 extends NonGrowableListView { + static const arraySize = 12; + U8Array12(Uint8List inner) + : assert(inner.length == arraySize), + super(inner); + U8Array12.unchecked(Uint8List inner) : super(inner); + U8Array12.init() : super(Uint8List(arraySize)); +} + +class U8Array16 extends NonGrowableListView { + static const arraySize = 16; + U8Array16(Uint8List inner) + : assert(inner.length == arraySize), + super(inner); + U8Array16.unchecked(Uint8List inner) : super(inner); + U8Array16.init() : super(Uint8List(arraySize)); +} + class U8Array32 extends NonGrowableListView { static const arraySize = 32; U8Array32(Uint8List inner) @@ -1436,6 +1460,15 @@ class U8Array32 extends NonGrowableListView { U8Array32.init() : super(Uint8List(arraySize)); } +class U8Array4 extends NonGrowableListView { + static const arraySize = 4; + U8Array4(Uint8List inner) + : assert(inner.length == arraySize), + super(inner); + U8Array4.unchecked(Uint8List inner) : super(inner); + U8Array4.init() : super(Uint8List(arraySize)); +} + class U8Array64 extends NonGrowableListView { static const arraySize = 64; U8Array64(Uint8List inner) diff --git a/lib/src/generated/bridge_definitions.freezed.dart b/lib/src/generated/bridge_definitions.freezed.dart index 2f35daa..525fa51 100644 --- a/lib/src/generated/bridge_definitions.freezed.dart +++ b/lib/src/generated/bridge_definitions.freezed.dart @@ -140,7 +140,7 @@ class _$ChainDataSourceConfig_EsploraImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$ChainDataSourceConfig_EsploraImpl && @@ -345,7 +345,7 @@ class _$EntropySourceConfig_SeedFileImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$EntropySourceConfig_SeedFileImpl && @@ -494,7 +494,7 @@ class _$EntropySourceConfig_SeedBytesImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$EntropySourceConfig_SeedBytesImpl && @@ -652,7 +652,7 @@ class _$EntropySourceConfig_Bip39MnemonicImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$EntropySourceConfig_Bip39MnemonicImpl && @@ -766,9 +766,11 @@ mixin _$Event { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -784,9 +786,11 @@ mixin _$Event { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -802,9 +806,11 @@ mixin _$Event { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -914,7 +920,7 @@ class _$Event_PaymentSuccessfulImpl implements Event_PaymentSuccessful { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Event_PaymentSuccessfulImpl && @@ -939,9 +945,11 @@ class _$Event_PaymentSuccessfulImpl implements Event_PaymentSuccessful { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -960,9 +968,11 @@ class _$Event_PaymentSuccessfulImpl implements Event_PaymentSuccessful { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -981,9 +991,11 @@ class _$Event_PaymentSuccessfulImpl implements Event_PaymentSuccessful { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -1101,7 +1113,7 @@ class _$Event_PaymentFailedImpl implements Event_PaymentFailed { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Event_PaymentFailedImpl && @@ -1126,9 +1138,11 @@ class _$Event_PaymentFailedImpl implements Event_PaymentFailed { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -1147,9 +1161,11 @@ class _$Event_PaymentFailedImpl implements Event_PaymentFailed { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -1168,9 +1184,11 @@ class _$Event_PaymentFailedImpl implements Event_PaymentFailed { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -1299,7 +1317,7 @@ class _$Event_PaymentReceivedImpl implements Event_PaymentReceived { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Event_PaymentReceivedImpl && @@ -1326,9 +1344,11 @@ class _$Event_PaymentReceivedImpl implements Event_PaymentReceived { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -1347,9 +1367,11 @@ class _$Event_PaymentReceivedImpl implements Event_PaymentReceived { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -1368,9 +1390,11 @@ class _$Event_PaymentReceivedImpl implements Event_PaymentReceived { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -1452,7 +1476,10 @@ abstract class _$$Event_ChannelReadyImplCopyWith<$Res> { $Res Function(_$Event_ChannelReadyImpl) then) = __$$Event_ChannelReadyImplCopyWithImpl<$Res>; @useResult - $Res call({ChannelId channelId, UserChannelId userChannelId}); + $Res call( + {ChannelId channelId, + UserChannelId userChannelId, + PublicKey? counterpartyNodeId}); } /// @nodoc @@ -1468,6 +1495,7 @@ class __$$Event_ChannelReadyImplCopyWithImpl<$Res> $Res call({ Object? channelId = null, Object? userChannelId = null, + Object? counterpartyNodeId = freezed, }) { return _then(_$Event_ChannelReadyImpl( channelId: null == channelId @@ -1478,6 +1506,10 @@ class __$$Event_ChannelReadyImplCopyWithImpl<$Res> ? _value.userChannelId : userChannelId // ignore: cast_nullable_to_non_nullable as UserChannelId, + counterpartyNodeId: freezed == counterpartyNodeId + ? _value.counterpartyNodeId + : counterpartyNodeId // ignore: cast_nullable_to_non_nullable + as PublicKey?, )); } } @@ -1486,7 +1518,9 @@ class __$$Event_ChannelReadyImplCopyWithImpl<$Res> class _$Event_ChannelReadyImpl implements Event_ChannelReady { const _$Event_ChannelReadyImpl( - {required this.channelId, required this.userChannelId}); + {required this.channelId, + required this.userChannelId, + this.counterpartyNodeId}); /// The channel_id of the channel. @override @@ -1495,25 +1529,30 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { /// The user_channel_id of the channel. @override final UserChannelId userChannelId; + @override + final PublicKey? counterpartyNodeId; @override String toString() { - return 'Event.channelReady(channelId: $channelId, userChannelId: $userChannelId)'; + return 'Event.channelReady(channelId: $channelId, userChannelId: $userChannelId, counterpartyNodeId: $counterpartyNodeId)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Event_ChannelReadyImpl && (identical(other.channelId, channelId) || other.channelId == channelId) && (identical(other.userChannelId, userChannelId) || - other.userChannelId == userChannelId)); + other.userChannelId == userChannelId) && + (identical(other.counterpartyNodeId, counterpartyNodeId) || + other.counterpartyNodeId == counterpartyNodeId)); } @override - int get hashCode => Object.hash(runtimeType, channelId, userChannelId); + int get hashCode => + Object.hash(runtimeType, channelId, userChannelId, counterpartyNodeId); @JsonKey(ignore: true) @override @@ -1529,9 +1568,11 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -1541,7 +1582,7 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { OutPoint fundingTxo) channelPending, }) { - return channelReady(channelId, userChannelId); + return channelReady(channelId, userChannelId, counterpartyNodeId); } @override @@ -1550,9 +1591,11 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -1562,7 +1605,7 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { OutPoint fundingTxo)? channelPending, }) { - return channelReady?.call(channelId, userChannelId); + return channelReady?.call(channelId, userChannelId, counterpartyNodeId); } @override @@ -1571,9 +1614,11 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -1585,7 +1630,7 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { required TResult orElse(), }) { if (channelReady != null) { - return channelReady(channelId, userChannelId); + return channelReady(channelId, userChannelId, counterpartyNodeId); } return orElse(); } @@ -1637,13 +1682,15 @@ class _$Event_ChannelReadyImpl implements Event_ChannelReady { abstract class Event_ChannelReady implements Event { const factory Event_ChannelReady( {required final ChannelId channelId, - required final UserChannelId userChannelId}) = _$Event_ChannelReadyImpl; + required final UserChannelId userChannelId, + final PublicKey? counterpartyNodeId}) = _$Event_ChannelReadyImpl; /// The channel_id of the channel. ChannelId get channelId; /// The user_channel_id of the channel. UserChannelId get userChannelId; + PublicKey? get counterpartyNodeId; @JsonKey(ignore: true) _$$Event_ChannelReadyImplCopyWith<_$Event_ChannelReadyImpl> get copyWith => throw _privateConstructorUsedError; @@ -1655,7 +1702,10 @@ abstract class _$$Event_ChannelClosedImplCopyWith<$Res> { $Res Function(_$Event_ChannelClosedImpl) then) = __$$Event_ChannelClosedImplCopyWithImpl<$Res>; @useResult - $Res call({ChannelId channelId, UserChannelId userChannelId}); + $Res call( + {ChannelId channelId, + UserChannelId userChannelId, + PublicKey? counterpartyNodeId}); } /// @nodoc @@ -1671,6 +1721,7 @@ class __$$Event_ChannelClosedImplCopyWithImpl<$Res> $Res call({ Object? channelId = null, Object? userChannelId = null, + Object? counterpartyNodeId = freezed, }) { return _then(_$Event_ChannelClosedImpl( channelId: null == channelId @@ -1681,6 +1732,10 @@ class __$$Event_ChannelClosedImplCopyWithImpl<$Res> ? _value.userChannelId : userChannelId // ignore: cast_nullable_to_non_nullable as UserChannelId, + counterpartyNodeId: freezed == counterpartyNodeId + ? _value.counterpartyNodeId + : counterpartyNodeId // ignore: cast_nullable_to_non_nullable + as PublicKey?, )); } } @@ -1689,7 +1744,9 @@ class __$$Event_ChannelClosedImplCopyWithImpl<$Res> class _$Event_ChannelClosedImpl implements Event_ChannelClosed { const _$Event_ChannelClosedImpl( - {required this.channelId, required this.userChannelId}); + {required this.channelId, + required this.userChannelId, + this.counterpartyNodeId}); /// The channel_id of the channel. @override @@ -1698,25 +1755,30 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { /// The user_channel_id of the channel. @override final UserChannelId userChannelId; + @override + final PublicKey? counterpartyNodeId; @override String toString() { - return 'Event.channelClosed(channelId: $channelId, userChannelId: $userChannelId)'; + return 'Event.channelClosed(channelId: $channelId, userChannelId: $userChannelId, counterpartyNodeId: $counterpartyNodeId)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Event_ChannelClosedImpl && (identical(other.channelId, channelId) || other.channelId == channelId) && (identical(other.userChannelId, userChannelId) || - other.userChannelId == userChannelId)); + other.userChannelId == userChannelId) && + (identical(other.counterpartyNodeId, counterpartyNodeId) || + other.counterpartyNodeId == counterpartyNodeId)); } @override - int get hashCode => Object.hash(runtimeType, channelId, userChannelId); + int get hashCode => + Object.hash(runtimeType, channelId, userChannelId, counterpartyNodeId); @JsonKey(ignore: true) @override @@ -1732,9 +1794,11 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -1744,7 +1808,7 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { OutPoint fundingTxo) channelPending, }) { - return channelClosed(channelId, userChannelId); + return channelClosed(channelId, userChannelId, counterpartyNodeId); } @override @@ -1753,9 +1817,11 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -1765,7 +1831,7 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { OutPoint fundingTxo)? channelPending, }) { - return channelClosed?.call(channelId, userChannelId); + return channelClosed?.call(channelId, userChannelId, counterpartyNodeId); } @override @@ -1774,9 +1840,11 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -1788,7 +1856,7 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { required TResult orElse(), }) { if (channelClosed != null) { - return channelClosed(channelId, userChannelId); + return channelClosed(channelId, userChannelId, counterpartyNodeId); } return orElse(); } @@ -1840,13 +1908,15 @@ class _$Event_ChannelClosedImpl implements Event_ChannelClosed { abstract class Event_ChannelClosed implements Event { const factory Event_ChannelClosed( {required final ChannelId channelId, - required final UserChannelId userChannelId}) = _$Event_ChannelClosedImpl; + required final UserChannelId userChannelId, + final PublicKey? counterpartyNodeId}) = _$Event_ChannelClosedImpl; /// The channel_id of the channel. ChannelId get channelId; /// The user_channel_id of the channel. UserChannelId get userChannelId; + PublicKey? get counterpartyNodeId; @JsonKey(ignore: true) _$$Event_ChannelClosedImplCopyWith<_$Event_ChannelClosedImpl> get copyWith => throw _privateConstructorUsedError; @@ -1944,7 +2014,7 @@ class _$Event_ChannelPendingImpl implements Event_ChannelPending { } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$Event_ChannelPendingImpl && @@ -1980,9 +2050,11 @@ class _$Event_ChannelPendingImpl implements Event_ChannelPending { required TResult Function(PaymentHash paymentHash) paymentFailed, required TResult Function(PaymentHash paymentHash, int amountMsat) paymentReceived, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelReady, - required TResult Function(ChannelId channelId, UserChannelId userChannelId) + required TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId) channelClosed, required TResult Function( ChannelId channelId, @@ -2002,9 +2074,11 @@ class _$Event_ChannelPendingImpl implements Event_ChannelPending { TResult? Function(PaymentHash paymentHash)? paymentSuccessful, TResult? Function(PaymentHash paymentHash)? paymentFailed, TResult? Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult? Function(ChannelId channelId, UserChannelId userChannelId)? + TResult? Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult? Function( ChannelId channelId, @@ -2024,9 +2098,11 @@ class _$Event_ChannelPendingImpl implements Event_ChannelPending { TResult Function(PaymentHash paymentHash)? paymentSuccessful, TResult Function(PaymentHash paymentHash)? paymentFailed, TResult Function(PaymentHash paymentHash, int amountMsat)? paymentReceived, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelReady, - TResult Function(ChannelId channelId, UserChannelId userChannelId)? + TResult Function(ChannelId channelId, UserChannelId userChannelId, + PublicKey? counterpartyNodeId)? channelClosed, TResult Function( ChannelId channelId, @@ -2208,7 +2284,7 @@ class _$GossipSourceConfig_P2PNetworkImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$GossipSourceConfig_P2PNetworkImpl); @@ -2336,7 +2412,7 @@ class _$GossipSourceConfig_RapidGossipSyncImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$GossipSourceConfig_RapidGossipSyncImpl && @@ -2566,7 +2642,7 @@ class _$MaxDustHTLCExposure_FixedLimitMsatImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MaxDustHTLCExposure_FixedLimitMsatImpl && @@ -2716,7 +2792,7 @@ class _$MaxDustHTLCExposure_FeeRateMultiplierImpl } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && other is _$MaxDustHTLCExposure_FeeRateMultiplierImpl && @@ -2816,71 +2892,106 @@ abstract class MaxDustHTLCExposure_FeeRateMultiplier } /// @nodoc -mixin _$NetAddress { - String get addr => throw _privateConstructorUsedError; - int get port => throw _privateConstructorUsedError; +mixin _$SocketAddress { @optionalTypeArgs TResult when({ - required TResult Function(String addr, int port) iPv4, - required TResult Function(String addr, int port) iPv6, + required TResult Function(U8Array4 addr, int port) tcpIpV4, + required TResult Function(U8Array16 addr, int port) tcpIpV6, + required TResult Function(U8Array12 field0) onionV2, + required TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port) + onionV3, + required TResult Function(Hostname hostname, int port) hostname, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String addr, int port)? iPv4, - TResult? Function(String addr, int port)? iPv6, + TResult? Function(U8Array4 addr, int port)? tcpIpV4, + TResult? Function(U8Array16 addr, int port)? tcpIpV6, + TResult? Function(U8Array12 field0)? onionV2, + TResult? Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult? Function(Hostname hostname, int port)? hostname, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeWhen({ - TResult Function(String addr, int port)? iPv4, - TResult Function(String addr, int port)? iPv6, + TResult Function(U8Array4 addr, int port)? tcpIpV4, + TResult Function(U8Array16 addr, int port)? tcpIpV6, + TResult Function(U8Array12 field0)? onionV2, + TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult Function(Hostname hostname, int port)? hostname, required TResult orElse(), }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult map({ - required TResult Function(NetAddress_IPv4 value) iPv4, - required TResult Function(NetAddress_IPv6 value) iPv6, + required TResult Function(SocketAddress_TcpIpV4 value) tcpIpV4, + required TResult Function(SocketAddress_TcpIpV6 value) tcpIpV6, + required TResult Function(SocketAddress_OnionV2 value) onionV2, + required TResult Function(SocketAddress_OnionV3 value) onionV3, + required TResult Function(SocketAddress_Hostname value) hostname, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult? mapOrNull({ - TResult? Function(NetAddress_IPv4 value)? iPv4, - TResult? Function(NetAddress_IPv6 value)? iPv6, + TResult? Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult? Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult? Function(SocketAddress_OnionV2 value)? onionV2, + TResult? Function(SocketAddress_OnionV3 value)? onionV3, + TResult? Function(SocketAddress_Hostname value)? hostname, }) => throw _privateConstructorUsedError; @optionalTypeArgs TResult maybeMap({ - TResult Function(NetAddress_IPv4 value)? iPv4, - TResult Function(NetAddress_IPv6 value)? iPv6, + TResult Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult Function(SocketAddress_OnionV2 value)? onionV2, + TResult Function(SocketAddress_OnionV3 value)? onionV3, + TResult Function(SocketAddress_Hostname value)? hostname, required TResult orElse(), }) => throw _privateConstructorUsedError; - - @JsonKey(ignore: true) - $NetAddressCopyWith get copyWith => - throw _privateConstructorUsedError; } /// @nodoc -abstract class $NetAddressCopyWith<$Res> { - factory $NetAddressCopyWith( - NetAddress value, $Res Function(NetAddress) then) = - _$NetAddressCopyWithImpl<$Res, NetAddress>; - @useResult - $Res call({String addr, int port}); +abstract class $SocketAddressCopyWith<$Res> { + factory $SocketAddressCopyWith( + SocketAddress value, $Res Function(SocketAddress) then) = + _$SocketAddressCopyWithImpl<$Res, SocketAddress>; } /// @nodoc -class _$NetAddressCopyWithImpl<$Res, $Val extends NetAddress> - implements $NetAddressCopyWith<$Res> { - _$NetAddressCopyWithImpl(this._value, this._then); +class _$SocketAddressCopyWithImpl<$Res, $Val extends SocketAddress> + implements $SocketAddressCopyWith<$Res> { + _$SocketAddressCopyWithImpl(this._value, this._then); // ignore: unused_field final $Val _value; // ignore: unused_field final $Res Function($Val) _then; +} + +/// @nodoc +abstract class _$$SocketAddress_TcpIpV4ImplCopyWith<$Res> { + factory _$$SocketAddress_TcpIpV4ImplCopyWith( + _$SocketAddress_TcpIpV4Impl value, + $Res Function(_$SocketAddress_TcpIpV4Impl) then) = + __$$SocketAddress_TcpIpV4ImplCopyWithImpl<$Res>; + @useResult + $Res call({U8Array4 addr, int port}); +} + +/// @nodoc +class __$$SocketAddress_TcpIpV4ImplCopyWithImpl<$Res> + extends _$SocketAddressCopyWithImpl<$Res, _$SocketAddress_TcpIpV4Impl> + implements _$$SocketAddress_TcpIpV4ImplCopyWith<$Res> { + __$$SocketAddress_TcpIpV4ImplCopyWithImpl(_$SocketAddress_TcpIpV4Impl _value, + $Res Function(_$SocketAddress_TcpIpV4Impl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -2888,36 +2999,169 @@ class _$NetAddressCopyWithImpl<$Res, $Val extends NetAddress> Object? addr = null, Object? port = null, }) { - return _then(_value.copyWith( + return _then(_$SocketAddress_TcpIpV4Impl( addr: null == addr ? _value.addr : addr // ignore: cast_nullable_to_non_nullable - as String, + as U8Array4, port: null == port ? _value.port : port // ignore: cast_nullable_to_non_nullable as int, - ) as $Val); + )); } } /// @nodoc -abstract class _$$NetAddress_IPv4ImplCopyWith<$Res> - implements $NetAddressCopyWith<$Res> { - factory _$$NetAddress_IPv4ImplCopyWith(_$NetAddress_IPv4Impl value, - $Res Function(_$NetAddress_IPv4Impl) then) = - __$$NetAddress_IPv4ImplCopyWithImpl<$Res>; + +class _$SocketAddress_TcpIpV4Impl implements SocketAddress_TcpIpV4 { + const _$SocketAddress_TcpIpV4Impl({required this.addr, required this.port}); + + @override + final U8Array4 addr; + @override + final int port; + + @override + String toString() { + return 'SocketAddress.tcpIpV4(addr: $addr, port: $port)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SocketAddress_TcpIpV4Impl && + const DeepCollectionEquality().equals(other.addr, addr) && + (identical(other.port, port) || other.port == port)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(addr), port); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SocketAddress_TcpIpV4ImplCopyWith<_$SocketAddress_TcpIpV4Impl> + get copyWith => __$$SocketAddress_TcpIpV4ImplCopyWithImpl< + _$SocketAddress_TcpIpV4Impl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(U8Array4 addr, int port) tcpIpV4, + required TResult Function(U8Array16 addr, int port) tcpIpV6, + required TResult Function(U8Array12 field0) onionV2, + required TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port) + onionV3, + required TResult Function(Hostname hostname, int port) hostname, + }) { + return tcpIpV4(addr, port); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(U8Array4 addr, int port)? tcpIpV4, + TResult? Function(U8Array16 addr, int port)? tcpIpV6, + TResult? Function(U8Array12 field0)? onionV2, + TResult? Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult? Function(Hostname hostname, int port)? hostname, + }) { + return tcpIpV4?.call(addr, port); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(U8Array4 addr, int port)? tcpIpV4, + TResult Function(U8Array16 addr, int port)? tcpIpV6, + TResult Function(U8Array12 field0)? onionV2, + TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult Function(Hostname hostname, int port)? hostname, + required TResult orElse(), + }) { + if (tcpIpV4 != null) { + return tcpIpV4(addr, port); + } + return orElse(); + } + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SocketAddress_TcpIpV4 value) tcpIpV4, + required TResult Function(SocketAddress_TcpIpV6 value) tcpIpV6, + required TResult Function(SocketAddress_OnionV2 value) onionV2, + required TResult Function(SocketAddress_OnionV3 value) onionV3, + required TResult Function(SocketAddress_Hostname value) hostname, + }) { + return tcpIpV4(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult? Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult? Function(SocketAddress_OnionV2 value)? onionV2, + TResult? Function(SocketAddress_OnionV3 value)? onionV3, + TResult? Function(SocketAddress_Hostname value)? hostname, + }) { + return tcpIpV4?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult Function(SocketAddress_OnionV2 value)? onionV2, + TResult Function(SocketAddress_OnionV3 value)? onionV3, + TResult Function(SocketAddress_Hostname value)? hostname, + required TResult orElse(), + }) { + if (tcpIpV4 != null) { + return tcpIpV4(this); + } + return orElse(); + } +} + +abstract class SocketAddress_TcpIpV4 implements SocketAddress { + const factory SocketAddress_TcpIpV4( + {required final U8Array4 addr, + required final int port}) = _$SocketAddress_TcpIpV4Impl; + + U8Array4 get addr; + int get port; + @JsonKey(ignore: true) + _$$SocketAddress_TcpIpV4ImplCopyWith<_$SocketAddress_TcpIpV4Impl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SocketAddress_TcpIpV6ImplCopyWith<$Res> { + factory _$$SocketAddress_TcpIpV6ImplCopyWith( + _$SocketAddress_TcpIpV6Impl value, + $Res Function(_$SocketAddress_TcpIpV6Impl) then) = + __$$SocketAddress_TcpIpV6ImplCopyWithImpl<$Res>; @useResult - $Res call({String addr, int port}); + $Res call({U8Array16 addr, int port}); } /// @nodoc -class __$$NetAddress_IPv4ImplCopyWithImpl<$Res> - extends _$NetAddressCopyWithImpl<$Res, _$NetAddress_IPv4Impl> - implements _$$NetAddress_IPv4ImplCopyWith<$Res> { - __$$NetAddress_IPv4ImplCopyWithImpl( - _$NetAddress_IPv4Impl _value, $Res Function(_$NetAddress_IPv4Impl) _then) +class __$$SocketAddress_TcpIpV6ImplCopyWithImpl<$Res> + extends _$SocketAddressCopyWithImpl<$Res, _$SocketAddress_TcpIpV6Impl> + implements _$$SocketAddress_TcpIpV6ImplCopyWith<$Res> { + __$$SocketAddress_TcpIpV6ImplCopyWithImpl(_$SocketAddress_TcpIpV6Impl _value, + $Res Function(_$SocketAddress_TcpIpV6Impl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @@ -2926,11 +3170,11 @@ class __$$NetAddress_IPv4ImplCopyWithImpl<$Res> Object? addr = null, Object? port = null, }) { - return _then(_$NetAddress_IPv4Impl( + return _then(_$SocketAddress_TcpIpV6Impl( addr: null == addr ? _value.addr : addr // ignore: cast_nullable_to_non_nullable - as String, + as U8Array16, port: null == port ? _value.port : port // ignore: cast_nullable_to_non_nullable @@ -2941,65 +3185,81 @@ class __$$NetAddress_IPv4ImplCopyWithImpl<$Res> /// @nodoc -class _$NetAddress_IPv4Impl implements NetAddress_IPv4 { - const _$NetAddress_IPv4Impl({required this.addr, required this.port}); +class _$SocketAddress_TcpIpV6Impl implements SocketAddress_TcpIpV6 { + const _$SocketAddress_TcpIpV6Impl({required this.addr, required this.port}); @override - final String addr; + final U8Array16 addr; @override final int port; @override String toString() { - return 'NetAddress.iPv4(addr: $addr, port: $port)'; + return 'SocketAddress.tcpIpV6(addr: $addr, port: $port)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$NetAddress_IPv4Impl && - (identical(other.addr, addr) || other.addr == addr) && + other is _$SocketAddress_TcpIpV6Impl && + const DeepCollectionEquality().equals(other.addr, addr) && (identical(other.port, port) || other.port == port)); } @override - int get hashCode => Object.hash(runtimeType, addr, port); + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(addr), port); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NetAddress_IPv4ImplCopyWith<_$NetAddress_IPv4Impl> get copyWith => - __$$NetAddress_IPv4ImplCopyWithImpl<_$NetAddress_IPv4Impl>( - this, _$identity); + _$$SocketAddress_TcpIpV6ImplCopyWith<_$SocketAddress_TcpIpV6Impl> + get copyWith => __$$SocketAddress_TcpIpV6ImplCopyWithImpl< + _$SocketAddress_TcpIpV6Impl>(this, _$identity); @override @optionalTypeArgs TResult when({ - required TResult Function(String addr, int port) iPv4, - required TResult Function(String addr, int port) iPv6, + required TResult Function(U8Array4 addr, int port) tcpIpV4, + required TResult Function(U8Array16 addr, int port) tcpIpV6, + required TResult Function(U8Array12 field0) onionV2, + required TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port) + onionV3, + required TResult Function(Hostname hostname, int port) hostname, }) { - return iPv4(addr, port); + return tcpIpV6(addr, port); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String addr, int port)? iPv4, - TResult? Function(String addr, int port)? iPv6, + TResult? Function(U8Array4 addr, int port)? tcpIpV4, + TResult? Function(U8Array16 addr, int port)? tcpIpV6, + TResult? Function(U8Array12 field0)? onionV2, + TResult? Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult? Function(Hostname hostname, int port)? hostname, }) { - return iPv4?.call(addr, port); + return tcpIpV6?.call(addr, port); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String addr, int port)? iPv4, - TResult Function(String addr, int port)? iPv6, + TResult Function(U8Array4 addr, int port)? tcpIpV4, + TResult Function(U8Array16 addr, int port)? tcpIpV6, + TResult Function(U8Array12 field0)? onionV2, + TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult Function(Hostname hostname, int port)? hostname, required TResult orElse(), }) { - if (iPv4 != null) { - return iPv4(addr, port); + if (tcpIpV6 != null) { + return tcpIpV6(addr, port); } return orElse(); } @@ -3007,80 +3267,256 @@ class _$NetAddress_IPv4Impl implements NetAddress_IPv4 { @override @optionalTypeArgs TResult map({ - required TResult Function(NetAddress_IPv4 value) iPv4, - required TResult Function(NetAddress_IPv6 value) iPv6, + required TResult Function(SocketAddress_TcpIpV4 value) tcpIpV4, + required TResult Function(SocketAddress_TcpIpV6 value) tcpIpV6, + required TResult Function(SocketAddress_OnionV2 value) onionV2, + required TResult Function(SocketAddress_OnionV3 value) onionV3, + required TResult Function(SocketAddress_Hostname value) hostname, }) { - return iPv4(this); + return tcpIpV6(this); } @override @optionalTypeArgs TResult? mapOrNull({ - TResult? Function(NetAddress_IPv4 value)? iPv4, - TResult? Function(NetAddress_IPv6 value)? iPv6, + TResult? Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult? Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult? Function(SocketAddress_OnionV2 value)? onionV2, + TResult? Function(SocketAddress_OnionV3 value)? onionV3, + TResult? Function(SocketAddress_Hostname value)? hostname, }) { - return iPv4?.call(this); + return tcpIpV6?.call(this); } @override @optionalTypeArgs TResult maybeMap({ - TResult Function(NetAddress_IPv4 value)? iPv4, - TResult Function(NetAddress_IPv6 value)? iPv6, + TResult Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult Function(SocketAddress_OnionV2 value)? onionV2, + TResult Function(SocketAddress_OnionV3 value)? onionV3, + TResult Function(SocketAddress_Hostname value)? hostname, required TResult orElse(), }) { - if (iPv4 != null) { - return iPv4(this); + if (tcpIpV6 != null) { + return tcpIpV6(this); } return orElse(); } } -abstract class NetAddress_IPv4 implements NetAddress { - const factory NetAddress_IPv4( - {required final String addr, - required final int port}) = _$NetAddress_IPv4Impl; +abstract class SocketAddress_TcpIpV6 implements SocketAddress { + const factory SocketAddress_TcpIpV6( + {required final U8Array16 addr, + required final int port}) = _$SocketAddress_TcpIpV6Impl; + + U8Array16 get addr; + int get port; + @JsonKey(ignore: true) + _$$SocketAddress_TcpIpV6ImplCopyWith<_$SocketAddress_TcpIpV6Impl> + get copyWith => throw _privateConstructorUsedError; +} +/// @nodoc +abstract class _$$SocketAddress_OnionV2ImplCopyWith<$Res> { + factory _$$SocketAddress_OnionV2ImplCopyWith( + _$SocketAddress_OnionV2Impl value, + $Res Function(_$SocketAddress_OnionV2Impl) then) = + __$$SocketAddress_OnionV2ImplCopyWithImpl<$Res>; + @useResult + $Res call({U8Array12 field0}); +} + +/// @nodoc +class __$$SocketAddress_OnionV2ImplCopyWithImpl<$Res> + extends _$SocketAddressCopyWithImpl<$Res, _$SocketAddress_OnionV2Impl> + implements _$$SocketAddress_OnionV2ImplCopyWith<$Res> { + __$$SocketAddress_OnionV2ImplCopyWithImpl(_$SocketAddress_OnionV2Impl _value, + $Res Function(_$SocketAddress_OnionV2Impl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') @override - String get addr; + $Res call({ + Object? field0 = null, + }) { + return _then(_$SocketAddress_OnionV2Impl( + null == field0 + ? _value.field0 + : field0 // ignore: cast_nullable_to_non_nullable + as U8Array12, + )); + } +} + +/// @nodoc + +class _$SocketAddress_OnionV2Impl implements SocketAddress_OnionV2 { + const _$SocketAddress_OnionV2Impl(this.field0); + @override - int get port; + final U8Array12 field0; + + @override + String toString() { + return 'SocketAddress.onionV2(field0: $field0)'; + } + + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SocketAddress_OnionV2Impl && + const DeepCollectionEquality().equals(other.field0, field0)); + } + + @override + int get hashCode => + Object.hash(runtimeType, const DeepCollectionEquality().hash(field0)); + + @JsonKey(ignore: true) + @override + @pragma('vm:prefer-inline') + _$$SocketAddress_OnionV2ImplCopyWith<_$SocketAddress_OnionV2Impl> + get copyWith => __$$SocketAddress_OnionV2ImplCopyWithImpl< + _$SocketAddress_OnionV2Impl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(U8Array4 addr, int port) tcpIpV4, + required TResult Function(U8Array16 addr, int port) tcpIpV6, + required TResult Function(U8Array12 field0) onionV2, + required TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port) + onionV3, + required TResult Function(Hostname hostname, int port) hostname, + }) { + return onionV2(field0); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(U8Array4 addr, int port)? tcpIpV4, + TResult? Function(U8Array16 addr, int port)? tcpIpV6, + TResult? Function(U8Array12 field0)? onionV2, + TResult? Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult? Function(Hostname hostname, int port)? hostname, + }) { + return onionV2?.call(field0); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(U8Array4 addr, int port)? tcpIpV4, + TResult Function(U8Array16 addr, int port)? tcpIpV6, + TResult Function(U8Array12 field0)? onionV2, + TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult Function(Hostname hostname, int port)? hostname, + required TResult orElse(), + }) { + if (onionV2 != null) { + return onionV2(field0); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SocketAddress_TcpIpV4 value) tcpIpV4, + required TResult Function(SocketAddress_TcpIpV6 value) tcpIpV6, + required TResult Function(SocketAddress_OnionV2 value) onionV2, + required TResult Function(SocketAddress_OnionV3 value) onionV3, + required TResult Function(SocketAddress_Hostname value) hostname, + }) { + return onionV2(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult? Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult? Function(SocketAddress_OnionV2 value)? onionV2, + TResult? Function(SocketAddress_OnionV3 value)? onionV3, + TResult? Function(SocketAddress_Hostname value)? hostname, + }) { + return onionV2?.call(this); + } + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult Function(SocketAddress_OnionV2 value)? onionV2, + TResult Function(SocketAddress_OnionV3 value)? onionV3, + TResult Function(SocketAddress_Hostname value)? hostname, + required TResult orElse(), + }) { + if (onionV2 != null) { + return onionV2(this); + } + return orElse(); + } +} + +abstract class SocketAddress_OnionV2 implements SocketAddress { + const factory SocketAddress_OnionV2(final U8Array12 field0) = + _$SocketAddress_OnionV2Impl; + + U8Array12 get field0; @JsonKey(ignore: true) - _$$NetAddress_IPv4ImplCopyWith<_$NetAddress_IPv4Impl> get copyWith => - throw _privateConstructorUsedError; + _$$SocketAddress_OnionV2ImplCopyWith<_$SocketAddress_OnionV2Impl> + get copyWith => throw _privateConstructorUsedError; } /// @nodoc -abstract class _$$NetAddress_IPv6ImplCopyWith<$Res> - implements $NetAddressCopyWith<$Res> { - factory _$$NetAddress_IPv6ImplCopyWith(_$NetAddress_IPv6Impl value, - $Res Function(_$NetAddress_IPv6Impl) then) = - __$$NetAddress_IPv6ImplCopyWithImpl<$Res>; - @override +abstract class _$$SocketAddress_OnionV3ImplCopyWith<$Res> { + factory _$$SocketAddress_OnionV3ImplCopyWith( + _$SocketAddress_OnionV3Impl value, + $Res Function(_$SocketAddress_OnionV3Impl) then) = + __$$SocketAddress_OnionV3ImplCopyWithImpl<$Res>; @useResult - $Res call({String addr, int port}); + $Res call({U8Array32 ed25519Pubkey, int checksum, int version, int port}); } /// @nodoc -class __$$NetAddress_IPv6ImplCopyWithImpl<$Res> - extends _$NetAddressCopyWithImpl<$Res, _$NetAddress_IPv6Impl> - implements _$$NetAddress_IPv6ImplCopyWith<$Res> { - __$$NetAddress_IPv6ImplCopyWithImpl( - _$NetAddress_IPv6Impl _value, $Res Function(_$NetAddress_IPv6Impl) _then) +class __$$SocketAddress_OnionV3ImplCopyWithImpl<$Res> + extends _$SocketAddressCopyWithImpl<$Res, _$SocketAddress_OnionV3Impl> + implements _$$SocketAddress_OnionV3ImplCopyWith<$Res> { + __$$SocketAddress_OnionV3ImplCopyWithImpl(_$SocketAddress_OnionV3Impl _value, + $Res Function(_$SocketAddress_OnionV3Impl) _then) : super(_value, _then); @pragma('vm:prefer-inline') @override $Res call({ - Object? addr = null, + Object? ed25519Pubkey = null, + Object? checksum = null, + Object? version = null, Object? port = null, }) { - return _then(_$NetAddress_IPv6Impl( - addr: null == addr - ? _value.addr - : addr // ignore: cast_nullable_to_non_nullable - as String, + return _then(_$SocketAddress_OnionV3Impl( + ed25519Pubkey: null == ed25519Pubkey + ? _value.ed25519Pubkey + : ed25519Pubkey // ignore: cast_nullable_to_non_nullable + as U8Array32, + checksum: null == checksum + ? _value.checksum + : checksum // ignore: cast_nullable_to_non_nullable + as int, + version: null == version + ? _value.version + : version // ignore: cast_nullable_to_non_nullable + as int, port: null == port ? _value.port : port // ignore: cast_nullable_to_non_nullable @@ -3091,65 +3527,97 @@ class __$$NetAddress_IPv6ImplCopyWithImpl<$Res> /// @nodoc -class _$NetAddress_IPv6Impl implements NetAddress_IPv6 { - const _$NetAddress_IPv6Impl({required this.addr, required this.port}); +class _$SocketAddress_OnionV3Impl implements SocketAddress_OnionV3 { + const _$SocketAddress_OnionV3Impl( + {required this.ed25519Pubkey, + required this.checksum, + required this.version, + required this.port}); @override - final String addr; + final U8Array32 ed25519Pubkey; + @override + final int checksum; + @override + final int version; @override final int port; @override String toString() { - return 'NetAddress.iPv6(addr: $addr, port: $port)'; + return 'SocketAddress.onionV3(ed25519Pubkey: $ed25519Pubkey, checksum: $checksum, version: $version, port: $port)'; } @override - bool operator ==(dynamic other) { + bool operator ==(Object other) { return identical(this, other) || (other.runtimeType == runtimeType && - other is _$NetAddress_IPv6Impl && - (identical(other.addr, addr) || other.addr == addr) && + other is _$SocketAddress_OnionV3Impl && + const DeepCollectionEquality() + .equals(other.ed25519Pubkey, ed25519Pubkey) && + (identical(other.checksum, checksum) || + other.checksum == checksum) && + (identical(other.version, version) || other.version == version) && (identical(other.port, port) || other.port == port)); } @override - int get hashCode => Object.hash(runtimeType, addr, port); + int get hashCode => Object.hash( + runtimeType, + const DeepCollectionEquality().hash(ed25519Pubkey), + checksum, + version, + port); @JsonKey(ignore: true) @override @pragma('vm:prefer-inline') - _$$NetAddress_IPv6ImplCopyWith<_$NetAddress_IPv6Impl> get copyWith => - __$$NetAddress_IPv6ImplCopyWithImpl<_$NetAddress_IPv6Impl>( - this, _$identity); + _$$SocketAddress_OnionV3ImplCopyWith<_$SocketAddress_OnionV3Impl> + get copyWith => __$$SocketAddress_OnionV3ImplCopyWithImpl< + _$SocketAddress_OnionV3Impl>(this, _$identity); @override @optionalTypeArgs TResult when({ - required TResult Function(String addr, int port) iPv4, - required TResult Function(String addr, int port) iPv6, + required TResult Function(U8Array4 addr, int port) tcpIpV4, + required TResult Function(U8Array16 addr, int port) tcpIpV6, + required TResult Function(U8Array12 field0) onionV2, + required TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port) + onionV3, + required TResult Function(Hostname hostname, int port) hostname, }) { - return iPv6(addr, port); + return onionV3(ed25519Pubkey, checksum, version, port); } @override @optionalTypeArgs TResult? whenOrNull({ - TResult? Function(String addr, int port)? iPv4, - TResult? Function(String addr, int port)? iPv6, + TResult? Function(U8Array4 addr, int port)? tcpIpV4, + TResult? Function(U8Array16 addr, int port)? tcpIpV6, + TResult? Function(U8Array12 field0)? onionV2, + TResult? Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult? Function(Hostname hostname, int port)? hostname, }) { - return iPv6?.call(addr, port); + return onionV3?.call(ed25519Pubkey, checksum, version, port); } @override @optionalTypeArgs TResult maybeWhen({ - TResult Function(String addr, int port)? iPv4, - TResult Function(String addr, int port)? iPv6, + TResult Function(U8Array4 addr, int port)? tcpIpV4, + TResult Function(U8Array16 addr, int port)? tcpIpV6, + TResult Function(U8Array12 field0)? onionV2, + TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult Function(Hostname hostname, int port)? hostname, required TResult orElse(), }) { - if (iPv6 != null) { - return iPv6(addr, port); + if (onionV3 != null) { + return onionV3(ed25519Pubkey, checksum, version, port); } return orElse(); } @@ -3157,46 +3625,229 @@ class _$NetAddress_IPv6Impl implements NetAddress_IPv6 { @override @optionalTypeArgs TResult map({ - required TResult Function(NetAddress_IPv4 value) iPv4, - required TResult Function(NetAddress_IPv6 value) iPv6, + required TResult Function(SocketAddress_TcpIpV4 value) tcpIpV4, + required TResult Function(SocketAddress_TcpIpV6 value) tcpIpV6, + required TResult Function(SocketAddress_OnionV2 value) onionV2, + required TResult Function(SocketAddress_OnionV3 value) onionV3, + required TResult Function(SocketAddress_Hostname value) hostname, }) { - return iPv6(this); + return onionV3(this); } @override @optionalTypeArgs TResult? mapOrNull({ - TResult? Function(NetAddress_IPv4 value)? iPv4, - TResult? Function(NetAddress_IPv6 value)? iPv6, + TResult? Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult? Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult? Function(SocketAddress_OnionV2 value)? onionV2, + TResult? Function(SocketAddress_OnionV3 value)? onionV3, + TResult? Function(SocketAddress_Hostname value)? hostname, }) { - return iPv6?.call(this); + return onionV3?.call(this); } @override @optionalTypeArgs TResult maybeMap({ - TResult Function(NetAddress_IPv4 value)? iPv4, - TResult Function(NetAddress_IPv6 value)? iPv6, + TResult Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult Function(SocketAddress_OnionV2 value)? onionV2, + TResult Function(SocketAddress_OnionV3 value)? onionV3, + TResult Function(SocketAddress_Hostname value)? hostname, required TResult orElse(), }) { - if (iPv6 != null) { - return iPv6(this); + if (onionV3 != null) { + return onionV3(this); } return orElse(); } } -abstract class NetAddress_IPv6 implements NetAddress { - const factory NetAddress_IPv6( - {required final String addr, - required final int port}) = _$NetAddress_IPv6Impl; +abstract class SocketAddress_OnionV3 implements SocketAddress { + const factory SocketAddress_OnionV3( + {required final U8Array32 ed25519Pubkey, + required final int checksum, + required final int version, + required final int port}) = _$SocketAddress_OnionV3Impl; + + U8Array32 get ed25519Pubkey; + int get checksum; + int get version; + int get port; + @JsonKey(ignore: true) + _$$SocketAddress_OnionV3ImplCopyWith<_$SocketAddress_OnionV3Impl> + get copyWith => throw _privateConstructorUsedError; +} + +/// @nodoc +abstract class _$$SocketAddress_HostnameImplCopyWith<$Res> { + factory _$$SocketAddress_HostnameImplCopyWith( + _$SocketAddress_HostnameImpl value, + $Res Function(_$SocketAddress_HostnameImpl) then) = + __$$SocketAddress_HostnameImplCopyWithImpl<$Res>; + @useResult + $Res call({Hostname hostname, int port}); +} + +/// @nodoc +class __$$SocketAddress_HostnameImplCopyWithImpl<$Res> + extends _$SocketAddressCopyWithImpl<$Res, _$SocketAddress_HostnameImpl> + implements _$$SocketAddress_HostnameImplCopyWith<$Res> { + __$$SocketAddress_HostnameImplCopyWithImpl( + _$SocketAddress_HostnameImpl _value, + $Res Function(_$SocketAddress_HostnameImpl) _then) + : super(_value, _then); + + @pragma('vm:prefer-inline') + @override + $Res call({ + Object? hostname = null, + Object? port = null, + }) { + return _then(_$SocketAddress_HostnameImpl( + hostname: null == hostname + ? _value.hostname + : hostname // ignore: cast_nullable_to_non_nullable + as Hostname, + port: null == port + ? _value.port + : port // ignore: cast_nullable_to_non_nullable + as int, + )); + } +} + +/// @nodoc + +class _$SocketAddress_HostnameImpl implements SocketAddress_Hostname { + const _$SocketAddress_HostnameImpl( + {required this.hostname, required this.port}); @override - String get addr; + final Hostname hostname; @override - int get port; + final int port; + + @override + String toString() { + return 'SocketAddress.hostname(hostname: $hostname, port: $port)'; + } + @override + bool operator ==(Object other) { + return identical(this, other) || + (other.runtimeType == runtimeType && + other is _$SocketAddress_HostnameImpl && + (identical(other.hostname, hostname) || + other.hostname == hostname) && + (identical(other.port, port) || other.port == port)); + } + + @override + int get hashCode => Object.hash(runtimeType, hostname, port); + @JsonKey(ignore: true) - _$$NetAddress_IPv6ImplCopyWith<_$NetAddress_IPv6Impl> get copyWith => - throw _privateConstructorUsedError; + @override + @pragma('vm:prefer-inline') + _$$SocketAddress_HostnameImplCopyWith<_$SocketAddress_HostnameImpl> + get copyWith => __$$SocketAddress_HostnameImplCopyWithImpl< + _$SocketAddress_HostnameImpl>(this, _$identity); + + @override + @optionalTypeArgs + TResult when({ + required TResult Function(U8Array4 addr, int port) tcpIpV4, + required TResult Function(U8Array16 addr, int port) tcpIpV6, + required TResult Function(U8Array12 field0) onionV2, + required TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port) + onionV3, + required TResult Function(Hostname hostname, int port) hostname, + }) { + return hostname(this.hostname, port); + } + + @override + @optionalTypeArgs + TResult? whenOrNull({ + TResult? Function(U8Array4 addr, int port)? tcpIpV4, + TResult? Function(U8Array16 addr, int port)? tcpIpV6, + TResult? Function(U8Array12 field0)? onionV2, + TResult? Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult? Function(Hostname hostname, int port)? hostname, + }) { + return hostname?.call(this.hostname, port); + } + + @override + @optionalTypeArgs + TResult maybeWhen({ + TResult Function(U8Array4 addr, int port)? tcpIpV4, + TResult Function(U8Array16 addr, int port)? tcpIpV6, + TResult Function(U8Array12 field0)? onionV2, + TResult Function( + U8Array32 ed25519Pubkey, int checksum, int version, int port)? + onionV3, + TResult Function(Hostname hostname, int port)? hostname, + required TResult orElse(), + }) { + if (hostname != null) { + return hostname(this.hostname, port); + } + return orElse(); + } + + @override + @optionalTypeArgs + TResult map({ + required TResult Function(SocketAddress_TcpIpV4 value) tcpIpV4, + required TResult Function(SocketAddress_TcpIpV6 value) tcpIpV6, + required TResult Function(SocketAddress_OnionV2 value) onionV2, + required TResult Function(SocketAddress_OnionV3 value) onionV3, + required TResult Function(SocketAddress_Hostname value) hostname, + }) { + return hostname(this); + } + + @override + @optionalTypeArgs + TResult? mapOrNull({ + TResult? Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult? Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult? Function(SocketAddress_OnionV2 value)? onionV2, + TResult? Function(SocketAddress_OnionV3 value)? onionV3, + TResult? Function(SocketAddress_Hostname value)? hostname, + }) { + return hostname?.call(this); + } + + @override + @optionalTypeArgs + TResult maybeMap({ + TResult Function(SocketAddress_TcpIpV4 value)? tcpIpV4, + TResult Function(SocketAddress_TcpIpV6 value)? tcpIpV6, + TResult Function(SocketAddress_OnionV2 value)? onionV2, + TResult Function(SocketAddress_OnionV3 value)? onionV3, + TResult Function(SocketAddress_Hostname value)? hostname, + required TResult orElse(), + }) { + if (hostname != null) { + return hostname(this); + } + return orElse(); + } +} + +abstract class SocketAddress_Hostname implements SocketAddress { + const factory SocketAddress_Hostname( + {required final Hostname hostname, + required final int port}) = _$SocketAddress_HostnameImpl; + + Hostname get hostname; + int get port; + @JsonKey(ignore: true) + _$$SocketAddress_HostnameImplCopyWith<_$SocketAddress_HostnameImpl> + get copyWith => throw _privateConstructorUsedError; } diff --git a/lib/src/root.dart b/lib/src/root.dart index 3b98548..5d984c9 100644 --- a/lib/src/root.dart +++ b/lib/src/root.dart @@ -102,9 +102,10 @@ class Node { } /// Returns our listening address - Future listeningAddress() async { + Future?> listeningAddress() async { try { - return await loaderApi.listeningAddressMethodNodePointer(that: _pointer); + return await loaderApi.listeningAddressesMethodNodePointer( + that: _pointer); } on bridge.NodeException catch (e) { throw handleNodeException(e); } @@ -174,7 +175,7 @@ class Node { /// /// If `permanently` is set to `true`, we'll remember the peer and reconnect to it on restart. Future connect( - {required bridge.NetAddress netaddress, + {required bridge.SocketAddress netaddress, required bridge.PublicKey nodeId, required bool persist}) async { try { @@ -215,7 +216,7 @@ class Node { /// /// Returns a temporary channel id. Future connectOpenChannel( - {required bridge.NetAddress netaddress, + {required bridge.SocketAddress netaddress, required bridge.PublicKey nodeId, required int channelAmountSats, required bool announceChannel, @@ -338,7 +339,7 @@ class Node { Future sendSpontaneousPaymentProbe( {required bridge.PublicKey nodeId, required int amountMsat}) async { try { - return await loaderApi.sendSpontaneousPaymentProbeMethodNodePointer( + return await loaderApi.sendSpontaneousPaymentProbesMethodNodePointer( that: _pointer, amountMsat: amountMsat, nodeId: nodeId); } on bridge.NodeException catch (e) { throw handleNodeException(e); @@ -361,7 +362,7 @@ class Node { /// Future sendPaymentProbe({required bridge.Bolt11Invoice invoice}) async { try { - return await loaderApi.sendPaymentProbeMethodNodePointer( + return await loaderApi.sendPaymentProbesMethodNodePointer( that: _pointer, invoice: invoice); } on bridge.NodeException catch (e) { throw handleNodeException(e); @@ -512,7 +513,10 @@ class Builder { return Builder._(bridge.Config( storageDirPath: '', network: bridge.Network.Bitcoin, - listeningAddress: bridge.NetAddress.iPv4(addr: "0.0.0.0", port: 9735), + listeningAddresses: [ + bridge.SocketAddress.hostname( + hostname: bridge.Hostname(internal: "0.0.0.0"), port: 9735) + ], onchainWalletSyncIntervalSecs: 60, walletSyncIntervalSecs: 20, feeRateCacheUpdateIntervalSecs: 600, @@ -593,8 +597,8 @@ class Builder { /// Sets the IP address and TCP port on which [Node] will listen for incoming network connections. /// /// - Builder setListeningAddress(bridge.NetAddress listeningAddress) { - _config!.listeningAddress = listeningAddress; + Builder setListeningAddress(List listeningAddresses) { + _config!.listeningAddresses = listeningAddresses; return this; } @@ -609,7 +613,7 @@ class Builder { final nodePath = "${directory.path}/ldk_cache/"; _config!.storageDirPath = nodePath; } - final res = await loaderApi.buildNode( + final res = await loaderApi.buildSqliteNode( config: _config!, entropySourceConfig: _entropySource, chainDataSourceConfig: _chainDataSourceConfig, diff --git a/lib/src/utils/exceptions.dart b/lib/src/utils/exceptions.dart index 715d97f..30ed649 100644 --- a/lib/src/utils/exceptions.dart +++ b/lib/src/utils/exceptions.dart @@ -39,6 +39,15 @@ BuilderException handleBuilderException(bridge.BuilderException e) { return BuilderException(message: "Failed to setup onchain wallet."); case bridge.BuilderException.LoggerSetupFailed: return BuilderException(message: "Failed to setup the logger."); + + case bridge.BuilderException.InvalidChannelMonitor: + return BuilderException( + message: "Failed to watch a deserialized ChannelMonitor."); + case bridge.BuilderException.InvalidListeningAddresses: + return BuilderException( + message: "Given listening addresses are invalid."); + case bridge.BuilderException.KVStoreSetupFailed: + return BuilderException(message: "Failed to setup KVStore."); } } @@ -77,7 +86,7 @@ NodeException handleNodeException(bridge.NodeException e) { return NodeException(message: "Failed to update gossip data."); case bridge.NodeException.InvalidAddress: return NodeException(message: "The given address is invalid."); - case bridge.NodeException.InvalidNetAddress: + case bridge.NodeException.InvalidSocketAddress: return NodeException(message: "The given network address is invalid."); case bridge.NodeException.InvalidPublicKey: return NodeException(message: "The given public key is invalid."); @@ -102,9 +111,12 @@ NodeException handleNodeException(bridge.NodeException e) { case bridge.NodeException.DuplicatePayment: return NodeException( message: "A payment with the given hash has already been initiated."); + case bridge.NodeException.InsufficientFunds: return NodeException( message: "There are insufficient funds to complete the given operation."); + case bridge.NodeException.FeerateEstimationUpdateFailed: + return NodeException(message: "Failed to update fee rate estimation. "); } } diff --git a/pubspec.yaml b/pubspec.yaml index 8e50303..78994c0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ldk_node description: A ready-to-go Lightning node library built using LDK and BDK. -version: 0.1.3 +version: 0.2.0 homepage: https://github.com/LtbLightning/ldk-node-flutter environment: @@ -12,18 +12,18 @@ dependencies: ffi: ^2.0.1 flutter: sdk: flutter - flutter_rust_bridge: ">1.82.3 <= 1.82.4" + flutter_rust_bridge: ">1.82.4 <= 1.82.6" freezed: ^2.3.5 freezed_annotation: ^2.2.0 meta: ^1.10.0 - uuid: ^4.2.1 - path_provider: ^2.0.15 + uuid: ^4.3.3 + path_provider: ^2.1.2 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^3.0.1 ffigen: ^9.0.1 - build_runner: ^2.4.4 + build_runner: ^2.4.8 lints: ^3.0.0 flutter: diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 7258695..e2191d0 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -30,9 +30,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "once_cell", @@ -51,9 +51,9 @@ dependencies = [ [[package]] name = "allo-isolate" -version = "0.1.20" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56b7997817c178b853573e8bdfb6c3afe02810b43f17d766d6703560074b0c3" +checksum = "f2f5a5fd28223e6f3cafb7d9cd685f51eafdd71d33ca1229f8316925d5957240" dependencies = [ "anyhow", "atomic", @@ -84,9 +84,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" dependencies = [ "anstyle", "anstyle-parse", @@ -104,50 +104,50 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" dependencies = [ "backtrace", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -196,9 +196,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bdk" @@ -321,9 +321,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12024c4645c97566567129c204f65d5815a8c9aecf30fcbe682b2fe034996d36" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -349,7 +349,7 @@ checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" dependencies = [ "clap 3.2.25", "heck", - "indexmap", + "indexmap 1.9.3", "log", "proc-macro2", "quote", @@ -386,7 +386,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -398,7 +398,7 @@ dependencies = [ "atty", "bitflags 1.3.2", "clap_lex 0.2.4", - "indexmap", + "indexmap 1.9.3", "strsim", "termcolor", "textwrap", @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.8" +version = "4.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" +checksum = "58e54881c004cec7895b0068a0a954cd5d62da01aef83fa35b1e594497bf5445" dependencies = [ "clap_builder", "clap_derive", @@ -416,9 +416,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.8" +version = "4.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" +checksum = "59cb82d7f531603d2fd1f507441cdd35184fa81beff7bd489570de7f773460bb" dependencies = [ "anstream", "anstyle", @@ -435,7 +435,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -488,9 +488,9 @@ checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -498,9 +498,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "dart-sys" @@ -519,14 +519,14 @@ checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -563,7 +563,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -575,17 +575,23 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -629,11 +635,17 @@ dependencies = [ "log", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flutter_rust_bridge" -version = "1.82.4" +version = "1.82.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae25c4523d6064e90202fb1bfd847f3e3c30026803a20ddfe55fbbe9fbc199d" +checksum = "23a5a7a1cd030cd63f53eafe2496eb4e40f520800e6e9b78cae6f3f3ba7f3c2b" dependencies = [ "allo-isolate", "anyhow", @@ -657,16 +669,16 @@ dependencies = [ [[package]] name = "flutter_rust_bridge_codegen" -version = "1.82.4" +version = "1.82.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80aed99793d3e54e14f2c7432799feddb9dbfcb0611f0779abc9a0fa410c697d" +checksum = "e5cefe80a6230c66eff7172db1d3979071ad0091b657ad6b683e692dee7875c8" dependencies = [ "anyhow", "atty", "cargo_metadata", "cbindgen", "chrono", - "clap 4.4.8", + "clap 4.4.16", "convert_case", "delegate-attr", "enum-iterator", @@ -681,7 +693,7 @@ dependencies = [ "serde", "serde_yaml", "strum_macros", - "syn 2.0.39", + "syn 2.0.48", "tempfile", "thiserror", "toml", @@ -690,9 +702,9 @@ dependencies = [ [[package]] name = "flutter_rust_bridge_macros" -version = "1.82.4" +version = "1.82.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2fe4c18349a2b17b980a1214e19a4cb7888a86f70ce5a9a0fccb5611f77bdb" +checksum = "a7fe743d921bedf4578b9472346d03a9643a01cd565ca7df7961baebad534ba5" [[package]] name = "fnv" @@ -700,20 +712,35 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -726,9 +753,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -736,15 +763,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -753,38 +780,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -800,9 +827,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -811,15 +838,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.21" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" dependencies = [ "bytes", "fnv", @@ -827,7 +854,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", @@ -842,11 +869,11 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.6", + "ahash 0.8.7", "allocator-api2", ] @@ -856,7 +883,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -880,11 +907,20 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f95b9abcae896730d42b78e09c155ed4ddf82c07b4de772c64aee5b2d8b7c150" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -893,9 +929,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -916,9 +952,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -931,7 +967,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", @@ -952,11 +988,24 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -977,9 +1026,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -995,6 +1044,16 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -1003,13 +1062,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi 0.3.3", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1023,15 +1082,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -1044,8 +1103,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "ldk-node" -version = "0.1.0" -source = "git+https://github.com/lightningdevkit/ldk-node?rev=db1b7dcc3415ac00455913b48d4b7b8ec6c2e617#db1b7dcc3415ac00455913b48d4b7b8ec6c2e617" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f72a985d2f39ec04bf5a156071e65810d04be47213e0a1582f347e9064a12b01" dependencies = [ "bdk", "bip39", @@ -1065,14 +1125,15 @@ dependencies = [ "reqwest", "rusqlite", "tokio", + "vss-client", "winapi", ] [[package]] name = "libc" -version = "0.2.150" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libsqlite3-sys" @@ -1087,18 +1148,18 @@ dependencies = [ [[package]] name = "lightning" -version = "0.0.116" +version = "0.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90a0f2155316f1570446a0447c993480673f840748c8ed25bbc59dfc442ac770" +checksum = "d52cec5fa9382154fe9671e8df93095b800c7d77abc66e2a5ef839d672521c5e" dependencies = [ "bitcoin", ] [[package]] name = "lightning-background-processor" -version = "0.0.116" +version = "0.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "398b68a96cceb3c1227504bd5faeb74f26c3233447bc10cc1cb2c67e01b51556" +checksum = "783150db7ad7b822e8029eae749123a377ed728b513a1610c3d9d3b31252da3e" dependencies = [ "bitcoin", "lightning", @@ -1107,9 +1168,9 @@ dependencies = [ [[package]] name = "lightning-invoice" -version = "0.24.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788c0158526ec27a502043c2911ea6ea58fdc656bdf8749484942c07b790d23" +checksum = "3eb24878b0f4ef75f020976c886d9ad1503867802329cc963e0ab4623ea3b25c" dependencies = [ "bech32", "bitcoin", @@ -1121,9 +1182,9 @@ dependencies = [ [[package]] name = "lightning-net-tokio" -version = "0.0.116" +version = "0.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366c0ae225736cbc03555bd5fb4b44b2e8fe2ca3c868ec53a4b325c38b2ab2bd" +checksum = "86ee02c5a817b46a5fd6de4b2e196b58ae0e6eca5f3b8a6f0b0cd67bd9485ecc" dependencies = [ "bitcoin", "lightning", @@ -1132,21 +1193,20 @@ dependencies = [ [[package]] name = "lightning-persister" -version = "0.0.116" +version = "0.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93caaafeb42115b70119619c2420e362cce776670427fc4ced3e6df77b41c0b6" +checksum = "85ec1734f931d819ab51b7000d792f69c7d0602eb75ddc59cb6ea22c8b0c3461" dependencies = [ "bitcoin", - "libc", "lightning", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "lightning-rapid-gossip-sync" -version = "0.0.116" +version = "0.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a07af5814234924e623bca499e003fca1864024d5bd984e752230f73a131584" +checksum = "ac66654c7593a16277cd9f1b7a078729318cad5cee2fe8948a2df4f756decb73" dependencies = [ "bitcoin", "lightning", @@ -1154,9 +1214,9 @@ dependencies = [ [[package]] name = "lightning-transaction-sync" -version = "0.0.116" +version = "0.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb33ef6e6d043a21c69ee04e0fcb71794d245e64d8f4ff5e47e2236d6d7db27b" +checksum = "bc0dc01c29b1c23ebc44844dd804c26d43820fa1258bc3c348f39f19bac210a4" dependencies = [ "bdk-macros", "bitcoin", @@ -1174,9 +1234,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" @@ -1196,9 +1256,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1227,13 +1287,61 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] @@ -1266,18 +1374,106 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "openssl" +version = "0.10.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "openssl" +version = "0.10.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "os_str_bytes" @@ -1305,7 +1501,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -1316,9 +1512,19 @@ checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.1.0", +] [[package]] name = "pin-project-lite" @@ -1334,9 +1540,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "powerfmt" @@ -1350,20 +1556,84 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +dependencies = [ + "bytes", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 1.0.109", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost", +] + [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1438,11 +1708,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -1452,10 +1722,12 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", + "hyper-tls", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", @@ -1466,6 +1738,7 @@ dependencies = [ "serde_urlencoded", "system-configuration", "tokio", + "tokio-native-tls", "tokio-rustls", "tokio-socks", "tower-service", @@ -1479,16 +1752,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", "libc", "spin", "untrusted", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1507,7 +1780,7 @@ dependencies = [ [[package]] name = "rust_ldk_node" -version = "0.1.3" +version = "0.2.0" dependencies = [ "anyhow", "flutter_rust_bridge", @@ -1527,22 +1800,22 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring", @@ -1556,7 +1829,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -1577,9 +1850,27 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "schannel" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "schannel" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys", +] [[package]] name = "scopeguard" @@ -1618,40 +1909,63 @@ dependencies = [ "cc", ] +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.192" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -1676,7 +1990,7 @@ version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ - "indexmap", + "indexmap 1.9.3", "ryu", "serde", "yaml-rust", @@ -1704,19 +2018,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] +checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" [[package]] name = "socket2" @@ -1725,7 +2029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1766,9 +2070,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1798,15 +2102,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1826,22 +2130,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1855,9 +2159,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -1877,9 +2181,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -1901,9 +2205,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -1911,9 +2215,9 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1924,7 +2228,27 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", ] [[package]] @@ -2005,15 +2329,15 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -2038,9 +2362,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -2065,6 +2389,19 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "vss-client" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50df9ec0db505c61439c94a69ec5ebc3dafb050c68470cae7904c57b9f9c919b" +dependencies = [ + "prost", + "prost-build", + "rand", + "reqwest", + "tokio", +] + [[package]] name = "want" version = "0.3.1" @@ -2082,9 +2419,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2092,24 +2429,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", @@ -2119,9 +2456,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2129,28 +2466,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -2158,9 +2495,21 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" + +[[package]] +name = "which" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] [[package]] name = "winapi" @@ -2195,11 +2544,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets", + "windows-targets 0.52.0", ] [[package]] @@ -2208,7 +2557,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -2217,13 +2575,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -2232,42 +2605,84 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winreg" version = "0.50.0" @@ -2275,7 +2690,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2289,20 +2704,20 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.25" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.25" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] diff --git a/rust/Cargo.toml b/rust/Cargo.toml index d7f590c..9528ddf 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rust_ldk_node" -version = "0.1.3" +version = "0.2.0" license = "MIT OR Apache-2.0" edition = "2018" @@ -9,18 +9,20 @@ crate-type = ["staticlib", "cdylib"] [build-dependencies] -flutter_rust_bridge_codegen = { version = "=1.82.4" } +flutter_rust_bridge_codegen = { version = "=1.82.6" } [dependencies] -flutter_rust_bridge = { version = "=1.82.4" } +flutter_rust_bridge = { version = "=1.82.6" } log = "0.4.19" simplelog = "0.12.1" lazy_static = "1.4.0" once_cell = "1.18.0" -ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "db1b7dcc3415ac00455913b48d4b7b8ec6c2e617" } +# Merge pull request #170 from jbesraa/persist-inbound-channels +#ldk-node = { git = "https://github.com/lightningdevkit/ldk-node.git", rev = "fc09bfbfbe43bdedebacfc75305acaed2ad85446" } anyhow= { version = "1.0.71"} +ldk-node = "0.2.0" [profile.release] opt-level = 'z' # Optimize for size diff --git a/rust/makefile b/rust/makefile index 46f25c5..db6aa18 100755 --- a/rust/makefile +++ b/rust/makefile @@ -1,6 +1,16 @@ DEFAULT_GOAL := help PROJECTNAME=$(shell basename "$(PWD)") SOURCES=$(sort $(wildcard ./src/*.rs ./src/**/*.rs)) + +# Add paths for OpenSSL and Android NDK here +OPENSSL_DIR=$(shell brew --prefix openssl) +ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/25.2.9519653 +PKG_CONFIG_PATH=$(ANDROID_NDK_HOME)/pkgconfig +PKG_CONFIG_SYSROOT_DIR=$(ANDROID_NDK_HOME)/sysroot + +# Export these variables so they are available to subprocesses +export OPENSSL_DIR PKG_CONFIG_PATH PKG_CONFIG_SYSROOT_DIR + # ############################################################################## # # GENERAL # ############################################################################## @@ -17,7 +27,6 @@ help: makefile init: rustup target add aarch64-apple-ios x86_64-apple-ios rustup target add aarch64-apple-darwin x86_64-apple-darwin - #rustup target add armv7-apple-ios armv7s-apple-ios i386-apple-ios ## deprecated rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android cargo install flutter_rust_bridge_codegen cargo install cargo-ndk diff --git a/rust/src/bridge_generated.io.rs b/rust/src/bridge_generated.io.rs index 265bfc1..6d75d8b 100644 --- a/rust/src/bridge_generated.io.rs +++ b/rust/src/bridge_generated.io.rs @@ -7,14 +7,14 @@ pub extern "C" fn wire_generate_entropy_mnemonic(port_: i64) { } #[no_mangle] -pub extern "C" fn wire_build_node( +pub extern "C" fn wire_build_sqlite_node( port_: i64, config: *mut wire_Config, chain_data_source_config: *mut wire_ChainDataSourceConfig, entropy_source_config: *mut wire_EntropySourceConfig, gossip_source_config: *mut wire_GossipSourceConfig, ) { - wire_build_node_impl( + wire_build_sqlite_node_impl( port_, config, chain_data_source_config, @@ -57,11 +57,11 @@ pub extern "C" fn wire_node_id__method__NodePointer(port_: i64, that: *mut wire_ } #[no_mangle] -pub extern "C" fn wire_listening_address__method__NodePointer( +pub extern "C" fn wire_listening_addresses__method__NodePointer( port_: i64, that: *mut wire_NodePointer, ) { - wire_listening_address__method__NodePointer_impl(port_, that) + wire_listening_addresses__method__NodePointer_impl(port_, that) } #[no_mangle] @@ -117,7 +117,7 @@ pub extern "C" fn wire_connect__method__NodePointer( port_: i64, that: *mut wire_NodePointer, node_id: *mut wire_PublicKey, - address: *mut wire_NetAddress, + address: *mut wire_SocketAddress, persist: bool, ) { wire_connect__method__NodePointer_impl(port_, that, node_id, address, persist) @@ -136,7 +136,7 @@ pub extern "C" fn wire_disconnect__method__NodePointer( pub extern "C" fn wire_connect_open_channel__method__NodePointer( port_: i64, that: *mut wire_NodePointer, - address: *mut wire_NetAddress, + address: *mut wire_SocketAddress, node_id: *mut wire_PublicKey, channel_amount_sats: u64, push_to_counterparty_msat: *mut u64, @@ -217,22 +217,27 @@ pub extern "C" fn wire_send_spontaneous_payment__method__NodePointer( } #[no_mangle] -pub extern "C" fn wire_send_payment_probe__method__NodePointer( +pub extern "C" fn wire_send_payment_probes__method__NodePointer( port_: i64, that: *mut wire_NodePointer, invoice: *mut wire_Bolt11Invoice, ) { - wire_send_payment_probe__method__NodePointer_impl(port_, that, invoice) + wire_send_payment_probes__method__NodePointer_impl(port_, that, invoice) } #[no_mangle] -pub extern "C" fn wire_send_spontaneous_payment_probe__method__NodePointer( +pub extern "C" fn wire_send_spontaneous_payment_probes__method__NodePointer( port_: i64, that: *mut wire_NodePointer, amount_msat: u64, node_id: *mut wire_PublicKey, ) { - wire_send_spontaneous_payment_probe__method__NodePointer_impl(port_, that, amount_msat, node_id) + wire_send_spontaneous_payment_probes__method__NodePointer_impl( + port_, + that, + amount_msat, + node_id, + ) } #[no_mangle] @@ -372,13 +377,13 @@ pub extern "C" fn new_box_autoadd_gossip_source_config_0() -> *mut wire_GossipSo } #[no_mangle] -pub extern "C" fn new_box_autoadd_mnemonic_0() -> *mut wire_Mnemonic { - support::new_leak_box_ptr(wire_Mnemonic::new_with_null_ptr()) +pub extern "C" fn new_box_autoadd_hostname_0() -> *mut wire_Hostname { + support::new_leak_box_ptr(wire_Hostname::new_with_null_ptr()) } #[no_mangle] -pub extern "C" fn new_box_autoadd_net_address_0() -> *mut wire_NetAddress { - support::new_leak_box_ptr(wire_NetAddress::new_with_null_ptr()) +pub extern "C" fn new_box_autoadd_mnemonic_0() -> *mut wire_Mnemonic { + support::new_leak_box_ptr(wire_Mnemonic::new_with_null_ptr()) } #[no_mangle] @@ -396,6 +401,11 @@ pub extern "C" fn new_box_autoadd_public_key_0() -> *mut wire_PublicKey { support::new_leak_box_ptr(wire_PublicKey::new_with_null_ptr()) } +#[no_mangle] +pub extern "C" fn new_box_autoadd_socket_address_0() -> *mut wire_SocketAddress { + support::new_leak_box_ptr(wire_SocketAddress::new_with_null_ptr()) +} + #[no_mangle] pub extern "C" fn new_box_autoadd_u64_0(value: u64) -> *mut u64 { support::new_leak_box_ptr(value) @@ -410,6 +420,15 @@ pub extern "C" fn new_list_public_key_0(len: i32) -> *mut wire_list_public_key { support::new_leak_box_ptr(wrap) } +#[no_mangle] +pub extern "C" fn new_list_socket_address_0(len: i32) -> *mut wire_list_socket_address { + let wrap = wire_list_socket_address { + ptr: support::new_leak_vec_ptr(::new_with_null_ptr(), len), + len, + }; + support::new_leak_box_ptr(wrap) +} + #[no_mangle] pub extern "C" fn new_uint_8_list_0(len: i32) -> *mut wire_uint_8_list { let ans = wire_uint_8_list { @@ -512,16 +531,16 @@ impl Wire2Api for *mut wire_GossipSourceConfig { Wire2Api::::wire2api(*wrap).into() } } -impl Wire2Api for *mut wire_Mnemonic { - fn wire2api(self) -> Mnemonic { +impl Wire2Api for *mut wire_Hostname { + fn wire2api(self) -> Hostname { let wrap = unsafe { support::box_from_leak_ptr(self) }; - Wire2Api::::wire2api(*wrap).into() + Wire2Api::::wire2api(*wrap).into() } } -impl Wire2Api for *mut wire_NetAddress { - fn wire2api(self) -> NetAddress { +impl Wire2Api for *mut wire_Mnemonic { + fn wire2api(self) -> Mnemonic { let wrap = unsafe { support::box_from_leak_ptr(self) }; - Wire2Api::::wire2api(*wrap).into() + Wire2Api::::wire2api(*wrap).into() } } impl Wire2Api for *mut wire_NodePointer { @@ -542,6 +561,12 @@ impl Wire2Api for *mut wire_PublicKey { Wire2Api::::wire2api(*wrap).into() } } +impl Wire2Api for *mut wire_SocketAddress { + fn wire2api(self) -> SocketAddress { + let wrap = unsafe { support::box_from_leak_ptr(self) }; + Wire2Api::::wire2api(*wrap).into() + } +} impl Wire2Api for *mut u64 { fn wire2api(self) -> u64 { unsafe { *support::box_from_leak_ptr(self) } @@ -588,7 +613,7 @@ impl Wire2Api for wire_Config { storage_dir_path: self.storage_dir_path.wire2api(), log_dir_path: self.log_dir_path.wire2api(), network: self.network.wire2api(), - listening_address: self.listening_address.wire2api(), + listening_addresses: self.listening_addresses.wire2api(), default_cltv_expiry_delta: self.default_cltv_expiry_delta.wire2api(), onchain_wallet_sync_interval_secs: self.onchain_wallet_sync_interval_secs.wire2api(), wallet_sync_interval_secs: self.wallet_sync_interval_secs.wire2api(), @@ -639,6 +664,13 @@ impl Wire2Api for wire_GossipSourceConfig { } } } +impl Wire2Api for wire_Hostname { + fn wire2api(self) -> Hostname { + Hostname { + internal: self.internal.wire2api(), + } + } +} impl Wire2Api> for *mut wire_list_public_key { fn wire2api(self) -> Vec { @@ -649,6 +681,15 @@ impl Wire2Api> for *mut wire_list_public_key { vec.into_iter().map(Wire2Api::wire2api).collect() } } +impl Wire2Api> for *mut wire_list_socket_address { + fn wire2api(self) -> Vec { + let vec = unsafe { + let wrap = support::box_from_leak_ptr(self); + support::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(Wire2Api::wire2api).collect() + } +} impl Wire2Api for wire_MaxDustHTLCExposure { fn wire2api(self) -> MaxDustHTLCExposure { @@ -674,29 +715,6 @@ impl Wire2Api for wire_Mnemonic { } } } -impl Wire2Api for wire_NetAddress { - fn wire2api(self) -> NetAddress { - match self.tag { - 0 => unsafe { - let ans = support::box_from_leak_ptr(self.kind); - let ans = support::box_from_leak_ptr(ans.IPv4); - NetAddress::IPv4 { - addr: ans.addr.wire2api(), - port: ans.port.wire2api(), - } - }, - 1 => unsafe { - let ans = support::box_from_leak_ptr(self.kind); - let ans = support::box_from_leak_ptr(ans.IPv6); - NetAddress::IPv6 { - addr: ans.addr.wire2api(), - port: ans.port.wire2api(), - } - }, - _ => unreachable!(), - } - } -} impl Wire2Api for wire_NodePointer { fn wire2api(self) -> NodePointer { @@ -718,13 +736,77 @@ impl Wire2Api for wire_PublicKey { } } } +impl Wire2Api for wire_SocketAddress { + fn wire2api(self) -> SocketAddress { + match self.tag { + 0 => unsafe { + let ans = support::box_from_leak_ptr(self.kind); + let ans = support::box_from_leak_ptr(ans.TcpIpV4); + SocketAddress::TcpIpV4 { + addr: ans.addr.wire2api(), + port: ans.port.wire2api(), + } + }, + 1 => unsafe { + let ans = support::box_from_leak_ptr(self.kind); + let ans = support::box_from_leak_ptr(ans.TcpIpV6); + SocketAddress::TcpIpV6 { + addr: ans.addr.wire2api(), + port: ans.port.wire2api(), + } + }, + 2 => unsafe { + let ans = support::box_from_leak_ptr(self.kind); + let ans = support::box_from_leak_ptr(ans.OnionV2); + SocketAddress::OnionV2(ans.field0.wire2api()) + }, + 3 => unsafe { + let ans = support::box_from_leak_ptr(self.kind); + let ans = support::box_from_leak_ptr(ans.OnionV3); + SocketAddress::OnionV3 { + ed25519_pubkey: ans.ed25519_pubkey.wire2api(), + checksum: ans.checksum.wire2api(), + version: ans.version.wire2api(), + port: ans.port.wire2api(), + } + }, + 4 => unsafe { + let ans = support::box_from_leak_ptr(self.kind); + let ans = support::box_from_leak_ptr(ans.Hostname); + SocketAddress::Hostname { + hostname: ans.hostname.wire2api(), + port: ans.port.wire2api(), + } + }, + _ => unreachable!(), + } + } +} +impl Wire2Api<[u8; 12]> for *mut wire_uint_8_list { + fn wire2api(self) -> [u8; 12] { + let vec: Vec = self.wire2api(); + support::from_vec_to_array(vec) + } +} +impl Wire2Api<[u8; 16]> for *mut wire_uint_8_list { + fn wire2api(self) -> [u8; 16] { + let vec: Vec = self.wire2api(); + support::from_vec_to_array(vec) + } +} impl Wire2Api<[u8; 32]> for *mut wire_uint_8_list { fn wire2api(self) -> [u8; 32] { let vec: Vec = self.wire2api(); support::from_vec_to_array(vec) } } +impl Wire2Api<[u8; 4]> for *mut wire_uint_8_list { + fn wire2api(self) -> [u8; 4] { + let vec: Vec = self.wire2api(); + support::from_vec_to_array(vec) + } +} impl Wire2Api<[u8; 64]> for *mut wire_uint_8_list { fn wire2api(self) -> [u8; 64] { let vec: Vec = self.wire2api(); @@ -782,7 +864,7 @@ pub struct wire_Config { storage_dir_path: *mut wire_uint_8_list, log_dir_path: *mut wire_uint_8_list, network: i32, - listening_address: *mut wire_NetAddress, + listening_addresses: *mut wire_list_socket_address, default_cltv_expiry_delta: u32, onchain_wallet_sync_interval_secs: u64, wallet_sync_interval_secs: u64, @@ -792,6 +874,12 @@ pub struct wire_Config { log_level: i32, } +#[repr(C)] +#[derive(Clone)] +pub struct wire_Hostname { + internal: *mut wire_uint_8_list, +} + #[repr(C)] #[derive(Clone)] pub struct wire_list_public_key { @@ -799,6 +887,13 @@ pub struct wire_list_public_key { len: i32, } +#[repr(C)] +#[derive(Clone)] +pub struct wire_list_socket_address { + ptr: *mut wire_SocketAddress, + len: i32, +} + #[repr(C)] #[derive(Clone)] pub struct wire_Mnemonic { @@ -930,31 +1025,56 @@ pub struct wire_MaxDustHTLCExposure_FeeRateMultiplier { #[repr(C)] #[derive(Clone)] -pub struct wire_NetAddress { +pub struct wire_SocketAddress { tag: i32, - kind: *mut NetAddressKind, + kind: *mut SocketAddressKind, } #[repr(C)] -pub union NetAddressKind { - IPv4: *mut wire_NetAddress_IPv4, - IPv6: *mut wire_NetAddress_IPv6, +pub union SocketAddressKind { + TcpIpV4: *mut wire_SocketAddress_TcpIpV4, + TcpIpV6: *mut wire_SocketAddress_TcpIpV6, + OnionV2: *mut wire_SocketAddress_OnionV2, + OnionV3: *mut wire_SocketAddress_OnionV3, + Hostname: *mut wire_SocketAddress_Hostname, } #[repr(C)] #[derive(Clone)] -pub struct wire_NetAddress_IPv4 { +pub struct wire_SocketAddress_TcpIpV4 { addr: *mut wire_uint_8_list, port: u16, } #[repr(C)] #[derive(Clone)] -pub struct wire_NetAddress_IPv6 { +pub struct wire_SocketAddress_TcpIpV6 { addr: *mut wire_uint_8_list, port: u16, } +#[repr(C)] +#[derive(Clone)] +pub struct wire_SocketAddress_OnionV2 { + field0: *mut wire_uint_8_list, +} + +#[repr(C)] +#[derive(Clone)] +pub struct wire_SocketAddress_OnionV3 { + ed25519_pubkey: *mut wire_uint_8_list, + checksum: u16, + version: u8, + port: u16, +} + +#[repr(C)] +#[derive(Clone)] +pub struct wire_SocketAddress_Hostname { + hostname: *mut wire_Hostname, + port: u16, +} + // Section: impl NewWithNullPtr pub trait NewWithNullPtr { @@ -1066,7 +1186,7 @@ impl NewWithNullPtr for wire_Config { storage_dir_path: core::ptr::null_mut(), log_dir_path: core::ptr::null_mut(), network: Default::default(), - listening_address: core::ptr::null_mut(), + listening_addresses: core::ptr::null_mut(), default_cltv_expiry_delta: Default::default(), onchain_wallet_sync_interval_secs: Default::default(), wallet_sync_interval_secs: Default::default(), @@ -1151,6 +1271,20 @@ pub extern "C" fn inflate_GossipSourceConfig_RapidGossipSync() -> *mut GossipSou }) } +impl NewWithNullPtr for wire_Hostname { + fn new_with_null_ptr() -> Self { + Self { + internal: core::ptr::null_mut(), + } + } +} + +impl Default for wire_Hostname { + fn default() -> Self { + Self::new_with_null_ptr() + } +} + impl Default for wire_MaxDustHTLCExposure { fn default() -> Self { Self::new_with_null_ptr() @@ -1198,41 +1332,6 @@ impl Default for wire_Mnemonic { } } -impl Default for wire_NetAddress { - fn default() -> Self { - Self::new_with_null_ptr() - } -} - -impl NewWithNullPtr for wire_NetAddress { - fn new_with_null_ptr() -> Self { - Self { - tag: -1, - kind: core::ptr::null_mut(), - } - } -} - -#[no_mangle] -pub extern "C" fn inflate_NetAddress_IPv4() -> *mut NetAddressKind { - support::new_leak_box_ptr(NetAddressKind { - IPv4: support::new_leak_box_ptr(wire_NetAddress_IPv4 { - addr: core::ptr::null_mut(), - port: Default::default(), - }), - }) -} - -#[no_mangle] -pub extern "C" fn inflate_NetAddress_IPv6() -> *mut NetAddressKind { - support::new_leak_box_ptr(NetAddressKind { - IPv6: support::new_leak_box_ptr(wire_NetAddress_IPv6 { - addr: core::ptr::null_mut(), - port: Default::default(), - }), - }) -} - impl NewWithNullPtr for wire_NodePointer { fn new_with_null_ptr() -> Self { Self { @@ -1275,6 +1374,72 @@ impl Default for wire_PublicKey { } } +impl Default for wire_SocketAddress { + fn default() -> Self { + Self::new_with_null_ptr() + } +} + +impl NewWithNullPtr for wire_SocketAddress { + fn new_with_null_ptr() -> Self { + Self { + tag: -1, + kind: core::ptr::null_mut(), + } + } +} + +#[no_mangle] +pub extern "C" fn inflate_SocketAddress_TcpIpV4() -> *mut SocketAddressKind { + support::new_leak_box_ptr(SocketAddressKind { + TcpIpV4: support::new_leak_box_ptr(wire_SocketAddress_TcpIpV4 { + addr: core::ptr::null_mut(), + port: Default::default(), + }), + }) +} + +#[no_mangle] +pub extern "C" fn inflate_SocketAddress_TcpIpV6() -> *mut SocketAddressKind { + support::new_leak_box_ptr(SocketAddressKind { + TcpIpV6: support::new_leak_box_ptr(wire_SocketAddress_TcpIpV6 { + addr: core::ptr::null_mut(), + port: Default::default(), + }), + }) +} + +#[no_mangle] +pub extern "C" fn inflate_SocketAddress_OnionV2() -> *mut SocketAddressKind { + support::new_leak_box_ptr(SocketAddressKind { + OnionV2: support::new_leak_box_ptr(wire_SocketAddress_OnionV2 { + field0: core::ptr::null_mut(), + }), + }) +} + +#[no_mangle] +pub extern "C" fn inflate_SocketAddress_OnionV3() -> *mut SocketAddressKind { + support::new_leak_box_ptr(SocketAddressKind { + OnionV3: support::new_leak_box_ptr(wire_SocketAddress_OnionV3 { + ed25519_pubkey: core::ptr::null_mut(), + checksum: Default::default(), + version: Default::default(), + port: Default::default(), + }), + }) +} + +#[no_mangle] +pub extern "C" fn inflate_SocketAddress_Hostname() -> *mut SocketAddressKind { + support::new_leak_box_ptr(SocketAddressKind { + Hostname: support::new_leak_box_ptr(wire_SocketAddress_Hostname { + hostname: core::ptr::null_mut(), + port: Default::default(), + }), + }) +} + // Section: sync execution mode utility #[no_mangle] diff --git a/rust/src/bridge_generated.rs b/rust/src/bridge_generated.rs index 6357e3d..c445996 100644 --- a/rust/src/bridge_generated.rs +++ b/rust/src/bridge_generated.rs @@ -9,7 +9,7 @@ clippy::too_many_arguments )] // AUTO GENERATED FILE, DO NOT EDIT. -// Generated by `flutter_rust_bridge`@ 1.82.4. +// Generated by `flutter_rust_bridge`@ 1.82.6. use crate::ldk::*; use core::panic::UnwindSafe; @@ -32,10 +32,10 @@ use crate::types::Config; use crate::types::EntropySourceConfig; use crate::types::Event; use crate::types::GossipSourceConfig; +use crate::types::Hostname; use crate::types::LogLevel; use crate::types::MaxDustHTLCExposure; use crate::types::Mnemonic; -use crate::types::NetAddress; use crate::types::Network; use crate::types::OutPoint; use crate::types::PaymentDetails; @@ -46,6 +46,7 @@ use crate::types::PaymentSecret; use crate::types::PaymentStatus; use crate::types::PeerDetails; use crate::types::PublicKey; +use crate::types::SocketAddress; use crate::types::Txid; use crate::types::UserChannelId; @@ -61,7 +62,7 @@ fn wire_generate_entropy_mnemonic_impl(port_: MessagePort) { move || move |task_callback| Result::<_, ()>::Ok(generate_entropy_mnemonic()), ) } -fn wire_build_node_impl( +fn wire_build_sqlite_node_impl( port_: MessagePort, config: impl Wire2Api + UnwindSafe, chain_data_source_config: impl Wire2Api> + UnwindSafe, @@ -70,7 +71,7 @@ fn wire_build_node_impl( ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, NodePointer, _>( WrapInfo { - debug_name: "build_node", + debug_name: "build_sqlite_node", port: Some(port_), mode: FfiCallMode::Normal, }, @@ -80,7 +81,7 @@ fn wire_build_node_impl( let api_entropy_source_config = entropy_source_config.wire2api(); let api_gossip_source_config = gossip_source_config.wire2api(); move |task_callback| { - build_node( + build_sqlite_node( api_config, api_chain_data_source_config, api_entropy_source_config, @@ -186,19 +187,19 @@ fn wire_node_id__method__NodePointer_impl( }, ) } -fn wire_listening_address__method__NodePointer_impl( +fn wire_listening_addresses__method__NodePointer_impl( port_: MessagePort, that: impl Wire2Api + UnwindSafe, ) { - FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, Option, _>( + FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, Option>, _>( WrapInfo { - debug_name: "listening_address__method__NodePointer", + debug_name: "listening_addresses__method__NodePointer", port: Some(port_), mode: FfiCallMode::Normal, }, move || { let api_that = that.wire2api(); - move |task_callback| Result::<_, ()>::Ok(NodePointer::listening_address(&api_that)) + move |task_callback| Result::<_, ()>::Ok(NodePointer::listening_addresses(&api_that)) }, ) } @@ -310,7 +311,7 @@ fn wire_connect__method__NodePointer_impl( port_: MessagePort, that: impl Wire2Api + UnwindSafe, node_id: impl Wire2Api + UnwindSafe, - address: impl Wire2Api + UnwindSafe, + address: impl Wire2Api + UnwindSafe, persist: impl Wire2Api + UnwindSafe, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, (), _>( @@ -351,7 +352,7 @@ fn wire_disconnect__method__NodePointer_impl( fn wire_connect_open_channel__method__NodePointer_impl( port_: MessagePort, that: impl Wire2Api + UnwindSafe, - address: impl Wire2Api + UnwindSafe, + address: impl Wire2Api + UnwindSafe, node_id: impl Wire2Api + UnwindSafe, channel_amount_sats: impl Wire2Api + UnwindSafe, push_to_counterparty_msat: impl Wire2Api> + UnwindSafe, @@ -515,25 +516,25 @@ fn wire_send_spontaneous_payment__method__NodePointer_impl( }, ) } -fn wire_send_payment_probe__method__NodePointer_impl( +fn wire_send_payment_probes__method__NodePointer_impl( port_: MessagePort, that: impl Wire2Api + UnwindSafe, invoice: impl Wire2Api + UnwindSafe, ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, (), _>( WrapInfo { - debug_name: "send_payment_probe__method__NodePointer", + debug_name: "send_payment_probes__method__NodePointer", port: Some(port_), mode: FfiCallMode::Normal, }, move || { let api_that = that.wire2api(); let api_invoice = invoice.wire2api(); - move |task_callback| NodePointer::send_payment_probe(&api_that, api_invoice) + move |task_callback| NodePointer::send_payment_probes(&api_that, api_invoice) }, ) } -fn wire_send_spontaneous_payment_probe__method__NodePointer_impl( +fn wire_send_spontaneous_payment_probes__method__NodePointer_impl( port_: MessagePort, that: impl Wire2Api + UnwindSafe, amount_msat: impl Wire2Api + UnwindSafe, @@ -541,7 +542,7 @@ fn wire_send_spontaneous_payment_probe__method__NodePointer_impl( ) { FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, (), _>( WrapInfo { - debug_name: "send_spontaneous_payment_probe__method__NodePointer", + debug_name: "send_spontaneous_payment_probes__method__NodePointer", port: Some(port_), mode: FfiCallMode::Normal, }, @@ -550,7 +551,11 @@ fn wire_send_spontaneous_payment_probe__method__NodePointer_impl( let api_amount_msat = amount_msat.wire2api(); let api_node_id = node_id.wire2api(); move |task_callback| { - NodePointer::send_spontaneous_payment_probe(&api_that, api_amount_msat, api_node_id) + NodePointer::send_spontaneous_payment_probes( + &api_that, + api_amount_msat, + api_node_id, + ) } }, ) @@ -869,11 +874,14 @@ impl support::IntoDart for BuilderException { Self::InvalidSeedBytes => 0, Self::InvalidSeedFile => 1, Self::InvalidSystemTime => 2, - Self::ReadFailed => 3, - Self::WriteFailed => 4, - Self::StoragePathAccessFailed => 5, - Self::WalletSetupFailed => 6, - Self::LoggerSetupFailed => 7, + Self::InvalidChannelMonitor => 3, + Self::InvalidListeningAddresses => 4, + Self::ReadFailed => 5, + Self::WriteFailed => 6, + Self::StoragePathAccessFailed => 7, + Self::KVStoreSetupFailed => 8, + Self::WalletSetupFailed => 9, + Self::LoggerSetupFailed => 10, } .into_dart() } @@ -949,18 +957,22 @@ impl support::IntoDart for Event { Self::ChannelReady { channel_id, user_channel_id, + counterparty_node_id, } => vec![ 3.into_dart(), channel_id.into_into_dart().into_dart(), user_channel_id.into_into_dart().into_dart(), + counterparty_node_id.into_dart(), ], Self::ChannelClosed { channel_id, user_channel_id, + counterparty_node_id, } => vec![ 4.into_dart(), channel_id.into_into_dart().into_dart(), user_channel_id.into_into_dart().into_dart(), + counterparty_node_id.into_dart(), ], Self::ChannelPending { channel_id, @@ -987,37 +999,25 @@ impl rust2dart::IntoIntoDart for Event { } } -impl support::IntoDart for Mnemonic { +impl support::IntoDart for Hostname { fn into_dart(self) -> support::DartAbi { vec![self.internal.into_into_dart().into_dart()].into_dart() } } -impl support::IntoDartExceptPrimitive for Mnemonic {} -impl rust2dart::IntoIntoDart for Mnemonic { +impl support::IntoDartExceptPrimitive for Hostname {} +impl rust2dart::IntoIntoDart for Hostname { fn into_into_dart(self) -> Self { self } } -impl support::IntoDart for NetAddress { +impl support::IntoDart for Mnemonic { fn into_dart(self) -> support::DartAbi { - match self { - Self::IPv4 { addr, port } => vec![ - 0.into_dart(), - addr.into_into_dart().into_dart(), - port.into_into_dart().into_dart(), - ], - Self::IPv6 { addr, port } => vec![ - 1.into_dart(), - addr.into_into_dart().into_dart(), - port.into_into_dart().into_dart(), - ], - } - .into_dart() + vec![self.internal.into_into_dart().into_dart()].into_dart() } } -impl support::IntoDartExceptPrimitive for NetAddress {} -impl rust2dart::IntoIntoDart for NetAddress { +impl support::IntoDartExceptPrimitive for Mnemonic {} +impl rust2dart::IntoIntoDart for Mnemonic { fn into_into_dart(self) -> Self { self } @@ -1043,7 +1043,7 @@ impl support::IntoDart for NodeException { Self::TxSyncFailed => 14, Self::GossipUpdateFailed => 15, Self::InvalidAddress => 16, - Self::InvalidNetAddress => 17, + Self::InvalidSocketAddress => 17, Self::InvalidPublicKey => 18, Self::InvalidSecretKey => 19, Self::InvalidPaymentHash => 20, @@ -1055,6 +1055,7 @@ impl support::IntoDart for NodeException { Self::InvalidNetwork => 26, Self::DuplicatePayment => 27, Self::InsufficientFunds => 28, + Self::FeerateEstimationUpdateFailed => 29, } .into_dart() } @@ -1212,6 +1213,48 @@ impl rust2dart::IntoIntoDart for PublicKey { } } +impl support::IntoDart for SocketAddress { + fn into_dart(self) -> support::DartAbi { + match self { + Self::TcpIpV4 { addr, port } => vec![ + 0.into_dart(), + addr.into_into_dart().into_dart(), + port.into_into_dart().into_dart(), + ], + Self::TcpIpV6 { addr, port } => vec![ + 1.into_dart(), + addr.into_into_dart().into_dart(), + port.into_into_dart().into_dart(), + ], + Self::OnionV2(field0) => vec![2.into_dart(), field0.into_into_dart().into_dart()], + Self::OnionV3 { + ed25519_pubkey, + checksum, + version, + port, + } => vec![ + 3.into_dart(), + ed25519_pubkey.into_into_dart().into_dart(), + checksum.into_into_dart().into_dart(), + version.into_into_dart().into_dart(), + port.into_into_dart().into_dart(), + ], + Self::Hostname { hostname, port } => vec![ + 4.into_dart(), + hostname.into_into_dart().into_dart(), + port.into_into_dart().into_dart(), + ], + } + .into_dart() + } +} +impl support::IntoDartExceptPrimitive for SocketAddress {} +impl rust2dart::IntoIntoDart for SocketAddress { + fn into_into_dart(self) -> Self { + self + } +} + impl support::IntoDart for Txid { fn into_dart(self) -> support::DartAbi { vec![self.internal.into_into_dart().into_dart()].into_dart() @@ -1246,4 +1289,4 @@ support::lazy_static! { #[path = "bridge_generated.io.rs"] mod io; #[cfg(not(target_family = "wasm"))] -pub use io::*; +pub use self::io::*; diff --git a/rust/src/errors.rs b/rust/src/errors.rs index 8001133..2f9f4bb 100644 --- a/rust/src/errors.rs +++ b/rust/src/errors.rs @@ -37,7 +37,7 @@ pub enum NodeException { /// The given address is invalid. InvalidAddress, /// The given network address is invalid. - InvalidNetAddress, + InvalidSocketAddress, /// The given public key is invalid. InvalidPublicKey, /// The given secret key is invalid. @@ -60,16 +60,32 @@ pub enum NodeException { DuplicatePayment, /// There are insufficient funds to complete the given operation. InsufficientFunds, + + FeerateEstimationUpdateFailed, } #[allow(dead_code)] pub enum BuilderException { + /// The given seed bytes are invalid, e.g., have invalid length. InvalidSeedBytes, + /// The given seed file is invalid, e.g., has invalid length, or could not be read. InvalidSeedFile, + /// The current system time is invalid, clocks might have gone backwards. InvalidSystemTime, + /// The a read channel monitor is invalid. + InvalidChannelMonitor, + /// The given listening addresses are invalid, e.g. too many were passed. + InvalidListeningAddresses, + /// We failed to read data from the [`KVStore`]. ReadFailed, + /// We failed to write data to the [`KVStore`]. WriteFailed, + /// We failed to access the given `storage_dir_path`. StoragePathAccessFailed, + /// We failed to setup our [`KVStore`]. + KVStoreSetupFailed, + /// We failed to setup the onchain wallet. WalletSetupFailed, + /// We failed to setup the logger. LoggerSetupFailed, } impl From for NodeException { @@ -92,7 +108,7 @@ impl From for NodeException { NodeError::TxSyncFailed => NodeException::TxSyncFailed, NodeError::GossipUpdateFailed => NodeException::GossipUpdateFailed, NodeError::InvalidAddress => NodeException::InvalidAddress, - NodeError::InvalidNetAddress => NodeException::InvalidNetAddress, + NodeError::InvalidSocketAddress => NodeException::InvalidSocketAddress, NodeError::InvalidPublicKey => NodeException::InvalidPublicKey, NodeError::InvalidSecretKey => NodeException::InvalidSecretKey, NodeError::InvalidPaymentHash => NodeException::InvalidPaymentHash, @@ -104,6 +120,9 @@ impl From for NodeException { NodeError::InvalidNetwork => NodeException::InvalidNetwork, NodeError::DuplicatePayment => NodeException::DuplicatePayment, NodeError::InsufficientFunds => NodeException::InsufficientFunds, + NodeError::FeerateEstimationUpdateFailed => { + NodeException::FeerateEstimationUpdateFailed + } } } } @@ -118,6 +137,9 @@ impl From for BuilderException { BuildError::StoragePathAccessFailed => BuilderException::StoragePathAccessFailed, BuildError::WalletSetupFailed => BuilderException::WalletSetupFailed, BuildError::LoggerSetupFailed => BuilderException::LoggerSetupFailed, + BuildError::InvalidChannelMonitor => BuilderException::InvalidChannelMonitor, + BuildError::KVStoreSetupFailed => BuilderException::KVStoreSetupFailed, + BuildError::InvalidListeningAddresses => BuilderException::InvalidListeningAddresses, } } } diff --git a/rust/src/ldk.rs b/rust/src/ldk.rs index e1d85bd..590df50 100644 --- a/rust/src/ldk.rs +++ b/rust/src/ldk.rs @@ -1,8 +1,7 @@ use crate::errors::{BuilderException, NodeException}; use crate::types::*; -pub use anyhow::anyhow; use flutter_rust_bridge::*; -pub use ldk_node::io::SqliteStore; +pub use ldk_node::io::sqlite_store::SqliteStore; use ldk_node::lightning::util::ser::Writeable; pub use ldk_node::Node; use ldk_node::{BuildError, Builder}; @@ -12,25 +11,26 @@ pub fn generate_entropy_mnemonic() -> Mnemonic { let mnemonic: Mnemonic = ldk_node::generate_entropy_mnemonic().into(); mnemonic } -pub fn build_node( + +pub fn build_sqlite_node( config: Config, chain_data_source_config: Option, entropy_source_config: Option, gossip_source_config: Option, ) -> anyhow::Result { - let builder = build_builder( + let builder = create_builder( config, chain_data_source_config, entropy_source_config, gossip_source_config, ); - match builder?.build() { Ok(e) => Ok(NodePointer(RustOpaque::new(Mutex::from(e)))), Err(e) => Err(e.into()), } } -fn build_builder( + +fn create_builder( config: Config, chain_data_source_config: Option, entropy_source_config: Option, @@ -62,7 +62,14 @@ fn build_builder( Ok(builder) } +// pub enum PointerNode{ +// sqlite_store(Node), +// vss_store(Node) +// } +// pub struct PointerNodeWrapper(pub RustOpaque>); + pub struct NodePointer(pub RustOpaque>>); + impl NodePointer { /// Starts the necessary background tasks, such as handling events coming from user input, /// LDK/BDK, and the peer-to-peer network. @@ -72,7 +79,7 @@ impl NodePointer { pub fn start(&self) -> anyhow::Result<(), NodeException> { match self.0.lock().unwrap().start() { Ok(_) => Ok(()), - Err(_) => Err(NodeException::AlreadyRunning), + Err(e) => Err(e.into()), } } @@ -120,9 +127,16 @@ impl NodePointer { } /// Returns our own listening address. - pub fn listening_address(&self) -> Option { + pub fn listening_addresses(&self) -> Option> { let node_lock = self.0.lock().unwrap(); - node_lock.listening_address().map(|x| x.to_owned().into()) + let y: Option> = + node_lock.listening_addresses().map(|vec_socket_addr| { + vec_socket_addr + .into_iter() + .map(|socket_addr| socket_addr.into()) + .collect() + }); + y } /// Retrieve a new on-chain/funding address. @@ -194,7 +208,7 @@ impl NodePointer { pub fn connect( &self, node_id: PublicKey, - address: NetAddress, + address: SocketAddress, persist: bool, ) -> anyhow::Result<(), NodeException> { let node_lock = self.0.lock().unwrap(); @@ -227,7 +241,7 @@ impl NodePointer { /// Returns a temporary channel id. pub fn connect_open_channel( &self, - address: NetAddress, + address: SocketAddress, node_id: PublicKey, channel_amount_sats: u64, push_to_counterparty_msat: Option, @@ -330,51 +344,29 @@ impl NodePointer { } } - // Sends payment probes over all paths of a route that would be used to pay the given invoice. - /// - /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting - /// the actual payment. Note this is only useful if there likely is sufficient time for the - /// probe to settle before sending out the actual payment, e.g., when waiting for user - /// confirmation in a wallet UI. - /// - /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the - /// actual payment. Users should therefore be cautious and might avoid sending probes if - /// liquidity is scarce and/or they don't expect the probe to return before they send the - /// payment. To mitigate this issue, channels with available liquidity less than the required - /// amount times [`Config::probing_liquidity_limit_multiplier`] won't be used to send - /// pre-flight probes. - /// - pub fn send_payment_probe(&self, invoice: Bolt11Invoice) -> anyhow::Result<(), NodeException> { + ///Sends payment probes over all paths of a route that would be used to pay the given invoice. + /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting the actual payment. + /// Note this is only useful if there likely is sufficient time for the probe to settle before sending out the actual payment, + /// e.g., when waiting for user confirmation in a wallet UI. + /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the actual payment. + /// Users should therefore be cautious and might avoid sending probes if liquidity is scarce and/or they don't expect the probe to return before they send the payment. + /// To mitigate this issue, channels with available liquidity less than the required amount times Config::probing_liquidity_limit_multiplier won't be used to send pre-flight probes. + pub fn send_payment_probes(&self, invoice: Bolt11Invoice) -> anyhow::Result<(), NodeException> { let node_lock = self.0.lock().unwrap(); - match node_lock.send_payment_probe(&invoice.into()) { + match node_lock.send_payment_probes(&invoice.into()) { Ok(_) => Ok(()), Err(e) => Err(e.into()), } } - /// Sends payment probes over all paths of a route that would be used to pay the given - /// amount to the given "nodeId". - /// - /// This may be used to send "pre-flight" probes, i.e., to train our scorer before conducting - /// the actual payment. Note this is only useful if there likely is sufficient time for the - /// probe to settle before sending out the actual payment, e.g., when waiting for user - /// confirmation in a wallet UI. - /// - /// Otherwise, there is a chance the probe could take up some liquidity needed to complete the - /// actual payment. Users should therefore be cautious and might avoid sending probes if - /// liquidity is scarce and/or they don't expect the probe to return before they send the - /// payment. To mitigate this issue, channels with available liquidity less than the required - /// amount times [Config::probing_liquidity_limit_multiplier] won't be used to send - /// pre-flight probes. - /// - /// - pub fn send_spontaneous_payment_probe( + ///Sends payment probes over all paths of a route that would be used to pay the given amount to the given node_id. + pub fn send_spontaneous_payment_probes( &self, amount_msat: u64, node_id: PublicKey, ) -> anyhow::Result<(), NodeException> { let node_lock = self.0.lock().unwrap(); - match node_lock.send_spontaneous_payment_probe(amount_msat, node_id.into()) { + match node_lock.send_spontaneous_payment_probes(amount_msat, node_id.into()) { Ok(_) => Ok(()), Err(e) => Err(e.into()), } diff --git a/rust/src/types.rs b/rust/src/types.rs index 32a8a32..d0a827f 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -1,8 +1,6 @@ -pub use anyhow::anyhow; use flutter_rust_bridge::*; use ldk_node::bitcoin::hashes::hex::ToHex; -pub use ldk_node::Node; -use std::net::SocketAddr; +use std::convert::TryFrom; use std::str::FromStr; use std::string::ToString; @@ -95,14 +93,14 @@ pub struct ChannelId { pub internal: [u8; 32], } -impl From for ChannelId { - fn from(value: ldk_node::ChannelId) -> Self { +impl From for ChannelId { + fn from(value: ldk_node::lightning::ln::ChannelId) -> Self { ChannelId { internal: value.0 } } } -impl From for ldk_node::ChannelId { +impl From for ldk_node::lightning::ln::ChannelId { fn from(value: ChannelId) -> Self { - ldk_node::ChannelId(value.internal) + ldk_node::lightning::ln::ChannelId(value.internal) } } ///A local, potentially user-provided, identifier of a channel. @@ -149,6 +147,8 @@ pub enum Event { channel_id: ChannelId, /// The user_channel_id of the channel. user_channel_id: UserChannelId, + + counterparty_node_id: Option, }, /// A channel has been closed. ChannelClosed { @@ -156,6 +156,7 @@ pub enum Event { channel_id: ChannelId, /// The user_channel_id of the channel. user_channel_id: UserChannelId, + counterparty_node_id: Option, }, /// A channel has been created and is pending confirmation on-chain. ChannelPending { @@ -197,16 +198,20 @@ impl From for Event { ldk_node::Event::ChannelReady { channel_id, user_channel_id, + counterparty_node_id, } => Event::ChannelReady { channel_id: channel_id.into(), user_channel_id: user_channel_id.into(), + counterparty_node_id: counterparty_node_id.map(|x| x.into()), }, ldk_node::Event::ChannelClosed { channel_id, user_channel_id, + counterparty_node_id, } => Event::ChannelClosed { channel_id: channel_id.into(), user_channel_id: user_channel_id.into(), + counterparty_node_id: counterparty_node_id.map(|x| x.into()), }, ldk_node::Event::ChannelPending { channel_id, @@ -565,7 +570,7 @@ pub struct PeerDetails { pub node_id: PublicKey, /// The IP address and TCP port of the peer. /// - pub address: NetAddress, + pub address: SocketAddress, /// Indicates whether or not the user is currently has an active connection with the peer. /// pub is_connected: bool, @@ -580,36 +585,6 @@ impl From for PeerDetails { } } } -///An address which can be used to connect to a remote peer. -/// -#[derive(Debug, Clone, PartialEq, Eq)] -pub enum NetAddress { - IPv4 { addr: String, port: u16 }, - IPv6 { addr: String, port: u16 }, -} - -impl From for ldk_node::NetAddress { - fn from(value: NetAddress) -> Self { - match value { - NetAddress::IPv4 { addr, port } => { - ldk_node::NetAddress::from_str(&*format!("{addr}:{port}")) - .expect("Invalid IPv4 address") - } - NetAddress::IPv6 { addr, port } => { - ldk_node::NetAddress::from_str(&*format!("{addr}:{port}")) - .expect("Invalid IPv6 address") - } - } - } -} -impl From for NetAddress { - fn from(value: ldk_node::NetAddress) -> Self { - let addr: SocketAddr = value.to_string().parse().unwrap(); - let host = addr.ip().to_string(); - let port = addr.port(); - NetAddress::IPv4 { addr: host, port } - } -} /// An enum representing the available verbosity levels of the logger. /// @@ -647,6 +622,108 @@ impl From for ldk_node::LogLevel { } } } +///The addresses on which the node will listen for incoming connections. +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum SocketAddress { + TcpIpV4 { + addr: [u8; 4], + port: u16, + }, + TcpIpV6 { + addr: [u8; 16], + port: u16, + }, + OnionV2([u8; 12]), + OnionV3 { + ed25519_pubkey: [u8; 32], + checksum: u16, + version: u8, + port: u16, + }, + Hostname { + hostname: Hostname, + port: u16, + }, +} + +impl From for SocketAddress { + fn from(value: ldk_node::lightning::ln::msgs::SocketAddress) -> Self { + match value { + ldk_node::lightning::ln::msgs::SocketAddress::TcpIpV4 { addr, port } => { + SocketAddress::TcpIpV4 { addr, port } + } + ldk_node::lightning::ln::msgs::SocketAddress::TcpIpV6 { addr, port } => { + SocketAddress::TcpIpV6 { addr, port } + } + ldk_node::lightning::ln::msgs::SocketAddress::OnionV2(e) => SocketAddress::OnionV2(e), + ldk_node::lightning::ln::msgs::SocketAddress::OnionV3 { + ed25519_pubkey, + checksum, + version, + port, + } => SocketAddress::OnionV3 { + ed25519_pubkey, + checksum, + version, + port, + }, + ldk_node::lightning::ln::msgs::SocketAddress::Hostname { hostname, port } => { + SocketAddress::Hostname { + hostname: hostname.into(), + port, + } + } + } + } +} + +impl From for ldk_node::lightning::ln::msgs::SocketAddress { + fn from(value: SocketAddress) -> Self { + match value { + SocketAddress::TcpIpV4 { addr, port } => { + ldk_node::lightning::ln::msgs::SocketAddress::TcpIpV4 { addr, port } + } + SocketAddress::TcpIpV6 { addr, port } => { + ldk_node::lightning::ln::msgs::SocketAddress::TcpIpV6 { addr, port } + } + SocketAddress::OnionV2(e) => ldk_node::lightning::ln::msgs::SocketAddress::OnionV2(e), + SocketAddress::OnionV3 { + ed25519_pubkey, + checksum, + version, + port, + } => ldk_node::lightning::ln::msgs::SocketAddress::OnionV3 { + ed25519_pubkey, + checksum, + version, + port, + }, + SocketAddress::Hostname { hostname, port } => { + ldk_node::lightning::ln::msgs::SocketAddress::Hostname { + hostname: hostname.into(), + port, + } + } + } + } +} +#[derive(Eq, PartialEq, Clone, Debug)] +pub struct Hostname { + pub internal: String, +} +impl From for Hostname { + fn from(value: ldk_node::lightning::util::ser::Hostname) -> Self { + Hostname { + internal: value.to_string(), + } + } +} +impl From for ldk_node::lightning::util::ser::Hostname { + fn from(value: Hostname) -> Self { + ldk_node::lightning::util::ser::Hostname::try_from(value.internal) + .expect("Invalid Hostname") + } +} impl From for ldk_node::Config { fn from(value: Config) -> Self { @@ -654,7 +731,12 @@ impl From for ldk_node::Config { storage_dir_path: value.storage_dir_path, log_dir_path: value.log_dir_path, network: value.network.into(), - listening_address: value.listening_address.map(|x| x.into()), + listening_addresses: value.listening_addresses.map(|vec_socket_addr| { + vec_socket_addr + .into_iter() + .map(|socket_addr| socket_addr.into()) + .collect() + }), default_cltv_expiry_delta: value.default_cltv_expiry_delta, onchain_wallet_sync_interval_secs: value.onchain_wallet_sync_interval_secs, wallet_sync_interval_secs: value.wallet_sync_interval_secs, @@ -686,7 +768,7 @@ pub struct Config { /// The IP address and TCP port the node will listen on. /// #[frb(non_final)] - pub listening_address: Option, + pub listening_addresses: Option>, /// The default CLTV expiry delta to be used for payments. /// #[frb(non_final)] @@ -727,10 +809,7 @@ impl Default for Config { storage_dir_path: DEFAULT_STORAGE_DIR_PATH.to_string(), log_dir_path: None, network: DEFAULT_NETWORK, - listening_address: Some(NetAddress::IPv4 { - addr: String::from("0.0.0.0"), - port: 9735, - }), + listening_addresses: None, default_cltv_expiry_delta: DEFAULT_CLTV_EXPIRY_DELTA, onchain_wallet_sync_interval_secs: DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS, wallet_sync_interval_secs: DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS,