File tree Expand file tree Collapse file tree 2 files changed +23
-13
lines changed
Assets/Thirdweb/Core/Scripts Expand file tree Collapse file tree 2 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -331,21 +331,11 @@ private async Task<RpcResponseMessage> CreateUserOpAndSend(RpcRequestMessage req
331331 }
332332 ThirdwebDebug . Log ( "Tx Hash: " + txHash ) ;
333333
334- // Check if successful
334+ // Check if successful deployment
335335
336336 if ( ! _deployed )
337337 {
338- var receipt = await Transaction . WaitForTransactionResultRaw ( txHash ) ;
339- var decodedEvents = receipt . DecodeAllEvents < EntryPointContract . UserOperationEventEventDTO > ( ) ;
340- if ( decodedEvents [ 0 ] . Event . Success == false )
341- {
342- throw new Exception ( $ "Transaction { txHash } execution reverted") ;
343- }
344- else
345- {
346- ThirdwebDebug . Log ( "Transaction successful" ) ;
347- _deployed = true ;
348- }
338+ await UpdateDeploymentStatus ( ) ;
349339 }
350340
351341 _deploying = false ;
Original file line number Diff line number Diff line change 88using MinimalForwarder = Thirdweb . Contracts . Forwarder . ContractDefinition ;
99using UnityEngine . Networking ;
1010using Thirdweb . Redcode . Awaiting ;
11+ using Nethereum . Contracts ;
12+ using Nethereum . ABI . FunctionEncoding ;
13+ using System ;
1114
1215#pragma warning disable CS0618
1316
@@ -407,8 +410,25 @@ public static async Task<TransactionReceipt> WaitForTransactionResultRaw(string
407410 {
408411 var reason = await web3 . Eth . GetContractTransactionErrorReason . SendRequestAsync ( txHash ) ;
409412 if ( ! string . IsNullOrEmpty ( reason ) )
410- throw new UnityException ( $ "Transaction failed : { reason } ") ;
413+ throw new UnityException ( $ "Transaction { txHash } execution reverted : { reason } ") ;
411414 }
415+
416+ var userOpEvent = receipt . DecodeAllEvents < Thirdweb . Contracts . EntryPoint . ContractDefinition . UserOperationEventEventDTO > ( ) ;
417+ if ( userOpEvent != null && userOpEvent . Count > 0 && userOpEvent [ 0 ] . Event . Success == false )
418+ {
419+ var revertReasonEvent = receipt . DecodeAllEvents < Thirdweb . Contracts . EntryPoint . ContractDefinition . UserOperationRevertReasonEventDTO > ( ) ;
420+ if ( revertReasonEvent != null && revertReasonEvent . Count > 0 )
421+ {
422+ byte [ ] revertReason = revertReasonEvent [ 0 ] . Event . RevertReason ;
423+ string revertReasonString = new FunctionCallDecoder ( ) . DecodeFunctionErrorMessage ( revertReason . ByteArrayToHexString ( ) ) ;
424+ throw new Exception ( $ "Transaction { txHash } execution silently reverted: { revertReasonString } ") ;
425+ }
426+ else
427+ {
428+ throw new Exception ( $ "Transaction { txHash } execution silently reverted with no reason string") ;
429+ }
430+ }
431+
412432 return receipt ;
413433 }
414434 }
You can’t perform that action at this time.
0 commit comments