@@ -47,7 +47,7 @@ void main() {
4747 await core.init ();
4848
4949 final aliceConfig = await initLdkConfig ('alice' ,
50- ldk.SocketAddress . hostname (addr: "0.0.0.0" , port: 3003 ));
50+ ldk.AddressHostname (addr: "0.0.0.0" , port: 3003 ). asSocket ( ));
5151 debugPrint ("Creating Alice builder..." );
5252 final aliceBuilder = await ldk.Builder .fromConfig (config: aliceConfig)
5353 .setEntropyBip39Mnemonic (
@@ -65,7 +65,7 @@ void main() {
6565 await aliceNode.start ();
6666 debugPrint ("Alice node started successfully!" );
6767 final bobConfig = await initLdkConfig (
68- 'bob' , ldk.SocketAddress . hostname (addr: "0.0.0.0" , port: 3004 ));
68+ 'bob' , ldk.AddressHostname (addr: "0.0.0.0" , port: 3004 ). asSocket ( ));
6969
7070 debugPrint ("Creating Bob builder..." );
7171 final bobBuilder = ldk.Builder .fromConfig (config: bobConfig)
@@ -132,7 +132,7 @@ void main() {
132132
133133 debugPrint ("Opening channel from aliceNode to bobNode" );
134134 final bobNodeId = await bobNode.nodeId ();
135- debugPrint ("Bob's node ID: ${bobNodeId .hex }" );
135+ debugPrint ("Bob's node ID: ${bobNodeId .toString () }" );
136136
137137 // Check if nodes can see each other
138138 final bobListeningAddresses = await bobNode.listeningAddresses ();
@@ -148,8 +148,8 @@ void main() {
148148 channelAmountSats: BigInt .from (fundingAmountSat),
149149 pushToCounterpartyMsat: BigInt .from (pushMsat),
150150 );
151- debugPrint ("Channel created; id: ${userChannelId .data }" );
152-
151+ debugPrint ("Channel created; id: ${await userChannelId .asVec () }" );
152+
153153 // Wait a moment for the funding transaction to be broadcast
154154 await Future .delayed (const Duration (seconds: 2 ));
155155 debugPrint ("Waiting for funding transaction to be broadcast..." );
@@ -179,14 +179,14 @@ void main() {
179179 final channels = await aliceNode.listChannels ();
180180 debugPrint ("Alice has ${channels .length } channels" );
181181
182- final bobChannels = channels.where ((e) => e.counterpartyNodeId.hex == bobNodeId.hex ).toList ();
182+ final bobChannels = channels.where ((e) => e.counterpartyNodeId.toString () == bobNodeId.toString () ).toList ();
183183
184184 if (bobChannels.isNotEmpty) {
185185 final channel = bobChannels.first;
186186 debugPrint ("Channel state: usable=${channel .isUsable }, ready=${channel .isChannelReady }, confirmations=${channel .confirmations }" );
187187 debugPrint ("Channel funding: ${channel .channelValueSats }sats, outbound capacity: ${channel .outboundCapacityMsat }msat" );
188- debugPrint ("Channel ID: ${channel .channelId .data }, User Channel ID: ${channel .userChannelId .data }" );
189-
188+ debugPrint ("Channel ID: ${await channel .channelId .asBytes () }, User Channel ID: ${await channel .userChannelId .asVec () }" );
189+
190190 // If channel has 0 confirmations, generate more blocks
191191 if (channel.confirmations == 0 && channelAttempts % 10 == 0 ) {
192192 debugPrint ("Channel still has 0 confirmations, generating more blocks..." );
@@ -215,7 +215,7 @@ void main() {
215215 debugPrint ("Channel not ready after timeout! Checking final state..." );
216216 final finalChannels = await aliceNode.listChannels ();
217217 for (final channel in finalChannels) {
218- debugPrint ("Final channel state: counterparty=${channel .counterpartyNodeId .hex }, usable=${channel .isUsable }, ready=${channel .isChannelReady }" );
218+ debugPrint ("Final channel state: counterparty=${channel .counterpartyNodeId .toString () }, usable=${channel .isUsable }, ready=${channel .isChannelReady }" );
219219 }
220220 }
221221
@@ -224,18 +224,18 @@ void main() {
224224 debugPrint ("Alice has ${alicePeers .length } peers and ${aliceChannels .length } channels" );
225225
226226 for (final peer in alicePeers) {
227- debugPrint ("Alice peer: ${peer .nodeId .hex }, connected: ${peer .isConnected }" );
227+ debugPrint ("Alice peer: ${peer .nodeId .toString () }, connected: ${peer .isConnected }" );
228228 }
229229
230230 expect (
231- (alicePeers.where ((e) => e.nodeId.hex == bobNodeId.hex )).toList ().isNotEmpty,
231+ (alicePeers.where ((e) => e.nodeId.toString () == bobNodeId.toString () )).toList ().isNotEmpty,
232232 equals (true ));
233233
234234 // Generate more blocks to ensure channel is well-confirmed
235235 await regTestClient.generate (5 , await aliceNodeAddress.asString ());
236236 expect (
237237 (aliceChannels
238- .where ((e) => e.counterpartyNodeId.hex == bobNodeId.hex ))
238+ .where ((e) => e.counterpartyNodeId.toString () == bobNodeId.toString () ))
239239 .where ((f) => f.isUsable && f.isChannelReady)
240240 .toList () !=
241241 [],
@@ -259,7 +259,7 @@ void main() {
259259 final offer1 = await bobNodeBol12Handler.receive (
260260 amountMsat: payment1ExpectedAmountMsat, description: "payment_1" );
261261 final payment1Id = await aliceNodeBol12Handler.send (offer: offer1);
262- debugPrint ("payment_1 successful: ${payment1Id .data .toString ()}" );
262+ debugPrint ("payment_1 successful: ${payment1Id .toVec () .toString ()}" );
263263
264264 // Wait a moment for the payment to be fully recorded
265265 await Future .delayed (const Duration (milliseconds: 500 ));
@@ -276,7 +276,7 @@ void main() {
276276 debugPrint ("Offer2 created, now sending payment of ${payment2ExpectedAmountMsat }msat" );
277277 final payment2Id = await aliceNodeBol12Handler.sendUsingAmount (
278278 offer: offer2, amountMsat: BigInt .from (payment2ExpectedAmountMsat));
279- debugPrint ("payment_2 successful: ${payment2Id .data .toString ()}" );
279+ debugPrint ("payment_2 successful: ${payment2Id .toVec () .toString ()}" );
280280
281281 // Wait a moment for the payment to be recorded
282282 await Future .delayed (const Duration (milliseconds: 500 ));
@@ -286,20 +286,20 @@ void main() {
286286 debugPrint ("Alice now has ${allAlicePayments .length } total payments:" );
287287 for (int i = 0 ; i < allAlicePayments.length; i++ ) {
288288 final payment = allAlicePayments[i];
289- debugPrint (" Payment $i : ID=${payment .id .data }, amount=${payment .amountMsat }msat, status=${payment .status }" );
289+ debugPrint (" Payment $i : ID=${payment .id .toVec () }, amount=${payment .amountMsat }msat, status=${payment .status }" );
290290 }
291291
292292 // Check if payment2Id exists in the list
293- final matchingPayments = allAlicePayments.where ((e) => listEquals (e.id.data , payment2Id.data )).toList ();
294- debugPrint ("Looking for payment with ID: ${payment2Id .data }" );
293+ final matchingPayments = allAlicePayments.where ((e) => listEquals (e.id.toVec () , payment2Id.toVec () )).toList ();
294+ debugPrint ("Looking for payment with ID: ${payment2Id .toVec () }" );
295295 debugPrint ("Found ${matchingPayments .length } matching payments" );
296296
297297 if (matchingPayments.isEmpty) {
298298 debugPrint ("ERROR: payment_2 not found in Alice's payment list!" );
299- debugPrint ("Expected payment ID: ${payment2Id .data }" );
299+ debugPrint ("Expected payment ID: ${payment2Id .toVec () }" );
300300 debugPrint ("All payment IDs in Alice's list:" );
301301 for (int i = 0 ; i < allAlicePayments.length; i++ ) {
302- debugPrint (" Payment $i ID: ${allAlicePayments [i ].id .data }" );
302+ debugPrint (" Payment $i ID: ${allAlicePayments [i ].id .toVec () }" );
303303 }
304304 }
305305
@@ -314,10 +314,10 @@ void main() {
314314 final bobNodePayment3Id = (await bobNode.listPayments ())
315315 .firstWhere ((p) => p.amountMsat == BigInt .from (overPaidAmount))
316316 .id;
317- debugPrint ("Bob's payment 3 ID: ${bobNodePayment3Id .data }" );
317+ debugPrint ("Bob's payment 3 ID: ${bobNodePayment3Id .toVec () }" );
318318 expect (
319319 ((await bobNode.listPayments ()).where (
320- (e) => listEquals (e.id.data , bobNodePayment3Id.data )))
320+ (e) => listEquals (e.id.toVec () , bobNodePayment3Id.toVec () )))
321321 .length ==
322322 1 ,
323323 true );
0 commit comments