@@ -38,7 +38,7 @@ public static async Task<ThirdwebWallet> Create(ThirdwebClient client, BigIntege
3838
3939 var rpc = ThirdwebRPC . GetRpcInstance ( client , chainId ) ;
4040 var code = await rpc . SendRequestAsync < string > ( "eth_getCode" , userWalletAddress , "latest" ) ;
41- var needsDelegation = code . ToLower ( ) != $ "0xef0100 { Constants . MINIMAL_ACCOUNT_7702 [ 2 .. ] } " . ToLower ( ) ;
41+ var needsDelegation = ! Utils . IsDelegatedAccount ( code ) ;
4242
4343 // Sign authorization if needed
4444 EIP7702Authorization ? authorization = needsDelegation ? await userWallet . SignAuthorization ( chainId , Constants . MINIMAL_ACCOUNT_7702 , willSelfExecute : false ) : null ;
@@ -56,13 +56,12 @@ public static async Task<ThirdwebWallet> Create(ThirdwebClient client, BigIntege
5656 executorWallet ,
5757 new ThirdwebTransactionInput ( chainId : chainId , to : userWalletAddress , data : sessionKeyCallData , authorization : authorization )
5858 ) ;
59- var delegationReceipt = await ThirdwebTransaction . SendAndWaitForTransactionReceipt ( delegationTx ) ;
60- Console . WriteLine ( $ "Delegation receipt: { delegationReceipt } ") ;
59+ _ = await ThirdwebTransaction . SendAndWaitForTransactionReceipt ( delegationTx ) ;
6160
6261 var newCode = await rpc . SendRequestAsync < string > ( "eth_getCode" , userWalletAddress , "latest" ) ;
63- if ( newCode . ToLower ( ) != $ "0xef0100 { Constants . MINIMAL_ACCOUNT_7702 [ 2 .. ] } " . ToLower ( ) )
62+ if ( ! Utils . IsDelegatedAccount ( newCode ) )
6463 {
65- throw new Exception ( "Delegation failed" ) ;
64+ throw new Exception ( "Delegation failed, code was not set. " ) ;
6665 }
6766
6867 var userContract = await ThirdwebContract . Create ( client , userWalletAddress , chainId , delegationContract . Abi ) ;
0 commit comments