@@ -314,41 +314,103 @@ public async Task ExecuteTransaction_07_WhenAll_Success()
314314 Assert . True ( hashes [ 1 ] . TransactionHash . Length == 66 ) ;
315315 }
316316
317- // [Fact(Timeout = 120000)]
318- // public async Task MultiChainTransaction_Success()
319- // {
320- // var chainId1 = 11155111;
321- // var chainId2 = 421614;
322-
323- // var smartWallet = await SmartWallet.Create(
324- // personalWallet: await PrivateKeyWallet.Generate(this.Client),
325- // chainId: chainId1,
326- // gasless: true,
327- // factoryAddress: Constants.DEFAULT_FACTORY_ADDRESS_V06,
328- // entryPoint: Constants.ENTRYPOINT_ADDRESS_V06
329- // );
330-
331- // var address1 = await smartWallet.GetAddress();
332- // var receipt1 = await smartWallet.ExecuteTransaction(new ThirdwebTransactionInput(chainId1) { To = address1, });
333- // var nonce1 = await smartWallet.GetTransactionCount(chainId: chainId1, blocktag: "latest");
334-
335- // var address2 = await smartWallet.GetAddress();
336- // var receipt2 = await smartWallet.ExecuteTransaction(new ThirdwebTransactionInput(chainId2) { To = address2, });
337- // var nonce2 = await smartWallet.GetTransactionCount(chainId: chainId2, blocktag: "latest");
338-
339- // Assert.NotNull(address1);
340- // Assert.NotNull(address2);
341- // Assert.Equal(address1, address2);
342-
343- // Assert.NotNull(receipt1);
344- // Assert.NotNull(receipt2);
345-
346- // Assert.True(receipt1.TransactionHash.Length == 66);
347- // Assert.True(receipt2.TransactionHash.Length == 66);
348-
349- // Assert.Equal(receipt1.To, receipt2.To);
350-
351- // Assert.Equal(nonce1, 1);
352- // Assert.Equal(nonce2, 1);
353- // }
317+ [ Fact ( Timeout = 120000 ) ]
318+ public async Task MultiChainTransaction_Success ( )
319+ {
320+ var chainId1 = 11155111 ;
321+ var chainId2 = 421614 ;
322+
323+ var smartWallet = await SmartWallet . Create ( personalWallet : await PrivateKeyWallet . Generate ( this . Client ) , chainId : chainId1 , gasless : true ) ;
324+
325+ var address1 = await smartWallet . GetAddress ( ) ;
326+ var receipt1 = await smartWallet . ExecuteTransaction ( new ThirdwebTransactionInput ( chainId1 ) { To = address1 , } ) ;
327+ var nonce1 = await smartWallet . GetTransactionCount ( chainId : chainId1 , blocktag : "latest" ) ;
328+
329+ var address2 = await smartWallet . GetAddress ( ) ;
330+ var receipt2 = await smartWallet . ExecuteTransaction ( new ThirdwebTransactionInput ( chainId2 ) { To = address2 , } ) ;
331+ var nonce2 = await smartWallet . GetTransactionCount ( chainId : chainId2 , blocktag : "latest" ) ;
332+
333+ Assert . NotNull ( address1 ) ;
334+ Assert . NotNull ( address2 ) ;
335+ Assert . Equal ( address1 , address2 ) ;
336+
337+ Assert . NotNull ( receipt1 ) ;
338+ Assert . NotNull ( receipt2 ) ;
339+
340+ Assert . True ( receipt1 . TransactionHash . Length == 66 ) ;
341+ Assert . True ( receipt2 . TransactionHash . Length == 66 ) ;
342+
343+ Assert . Equal ( receipt1 . To , receipt2 . To ) ;
344+
345+ Assert . Equal ( nonce1 , 1 ) ;
346+ Assert . Equal ( nonce2 , 1 ) ;
347+ }
348+
349+ [ Fact ( Timeout = 120000 ) ]
350+ public async Task MultiChainTransaction_ZkToNonZk_Success ( )
351+ {
352+ var chainId1 = 300 ;
353+ var chainId2 = 421614 ;
354+
355+ var smartWallet = await SmartWallet . Create ( personalWallet : await PrivateKeyWallet . Generate ( this . Client ) , chainId : chainId1 , gasless : true ) ;
356+
357+ var randomAddy = await ( await PrivateKeyWallet . Generate ( this . Client ) ) . GetAddress ( ) ;
358+
359+ var receipt1 = await smartWallet . ExecuteTransaction ( new ThirdwebTransactionInput ( chainId1 ) { To = randomAddy , } ) ;
360+ var nonce1 = await smartWallet . GetTransactionCount ( chainId : chainId1 , blocktag : "latest" ) ;
361+ var address1 = await smartWallet . GetAddress ( ) ;
362+
363+ var receipt2 = await smartWallet . ExecuteTransaction ( new ThirdwebTransactionInput ( chainId2 ) { To = randomAddy , } ) ;
364+ var nonce2 = await smartWallet . GetTransactionCount ( chainId : chainId2 , blocktag : "latest" ) ;
365+ var address2 = await smartWallet . GetAddress ( ) ;
366+
367+ Assert . NotNull ( address1 ) ;
368+ Assert . NotNull ( address2 ) ;
369+ Assert . NotEqual ( address1 , address2 ) ;
370+
371+ Assert . NotNull ( receipt1 ) ;
372+ Assert . NotNull ( receipt2 ) ;
373+
374+ Assert . True ( receipt1 . TransactionHash . Length == 66 ) ;
375+ Assert . True ( receipt2 . TransactionHash . Length == 66 ) ;
376+
377+ Assert . NotEqual ( receipt1 . To , receipt2 . To ) ;
378+
379+ Assert . Equal ( nonce1 , 1 ) ;
380+ Assert . Equal ( nonce2 , 1 ) ;
381+ }
382+
383+ [ Fact ( Timeout = 120000 ) ]
384+ public async Task MultiChainTransaction_NonZkToZk_Success ( )
385+ {
386+ var chainId1 = 421614 ;
387+ var chainId2 = 300 ;
388+
389+ var smartWallet = await SmartWallet . Create ( personalWallet : await PrivateKeyWallet . Generate ( this . Client ) , chainId : chainId1 , gasless : true ) ;
390+
391+ var randomAddy = await ( await PrivateKeyWallet . Generate ( this . Client ) ) . GetAddress ( ) ;
392+
393+ var receipt1 = await smartWallet . ExecuteTransaction ( new ThirdwebTransactionInput ( chainId1 ) { To = randomAddy , } ) ;
394+ var nonce1 = await smartWallet . GetTransactionCount ( chainId : chainId1 , blocktag : "latest" ) ;
395+ var address1 = await smartWallet . GetAddress ( ) ;
396+
397+ var receipt2 = await smartWallet . ExecuteTransaction ( new ThirdwebTransactionInput ( chainId2 ) { To = randomAddy , } ) ;
398+ var nonce2 = await smartWallet . GetTransactionCount ( chainId : chainId2 , blocktag : "latest" ) ;
399+ var address2 = await smartWallet . GetAddress ( ) ;
400+
401+ Assert . NotNull ( address1 ) ;
402+ Assert . NotNull ( address2 ) ;
403+ Assert . NotEqual ( address1 , address2 ) ;
404+
405+ Assert . NotNull ( receipt1 ) ;
406+ Assert . NotNull ( receipt2 ) ;
407+
408+ Assert . True ( receipt1 . TransactionHash . Length == 66 ) ;
409+ Assert . True ( receipt2 . TransactionHash . Length == 66 ) ;
410+
411+ Assert . NotEqual ( receipt1 . To , receipt2 . To ) ;
412+
413+ Assert . Equal ( nonce1 , 1 ) ;
414+ Assert . Equal ( nonce2 , 1 ) ;
415+ }
354416}
0 commit comments