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
331
331
}
332
332
ThirdwebDebug . Log ( "Tx Hash: " + txHash ) ;
333
333
334
- // Check if successful
334
+ // Check if successful deployment
335
335
336
336
if ( ! _deployed )
337
337
{
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 ( ) ;
349
339
}
350
340
351
341
_deploying = false ;
Original file line number Diff line number Diff line change 8
8
using MinimalForwarder = Thirdweb . Contracts . Forwarder . ContractDefinition ;
9
9
using UnityEngine . Networking ;
10
10
using Thirdweb . Redcode . Awaiting ;
11
+ using Nethereum . Contracts ;
12
+ using Nethereum . ABI . FunctionEncoding ;
13
+ using System ;
11
14
12
15
#pragma warning disable CS0618
13
16
@@ -407,8 +410,25 @@ public static async Task<TransactionReceipt> WaitForTransactionResultRaw(string
407
410
{
408
411
var reason = await web3 . Eth . GetContractTransactionErrorReason . SendRequestAsync ( txHash ) ;
409
412
if ( ! string . IsNullOrEmpty ( reason ) )
410
- throw new UnityException ( $ "Transaction failed : { reason } ") ;
413
+ throw new UnityException ( $ "Transaction { txHash } execution reverted : { reason } ") ;
411
414
}
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
+
412
432
return receipt ;
413
433
}
414
434
}
You can’t perform that action at this time.
0 commit comments