File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Assets/Thirdweb/Core/Scripts Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -58,16 +58,16 @@ public static async Task<TransactionReceipt> ThirdwebWriteRawResult<TWFunction>(
58
58
}
59
59
else
60
60
{
61
- var gasEstimator = new Web3 ( ThirdwebManager . Instance . SDK . session . RPC ) . Eth . GetContractTransactionHandler < TWFunction > ( ) ;
62
- functionMessage . Gas = 100000 ;
63
61
try
64
62
{
63
+ var gasEstimator = new Web3 ( ThirdwebManager . Instance . SDK . session . RPC ) . Eth . GetContractTransactionHandler < TWFunction > ( ) ;
65
64
var gas = await gasEstimator . EstimateGasAsync ( contractAddress , functionMessage ) ;
66
65
functionMessage . Gas = gas . Value < 100000 ? 100000 : gas . Value ;
67
66
}
68
67
catch ( System . InvalidOperationException e )
69
68
{
70
69
Debug . LogWarning ( $ "Failed to estimate gas for transaction, proceeding with 100k gas: { e } ") ;
70
+ functionMessage . Gas = 100000 ;
71
71
}
72
72
}
73
73
@@ -130,11 +130,15 @@ public static async Task<TransactionReceipt> ThirdwebWriteRawResult<TWFunction>(
130
130
}
131
131
else
132
132
{
133
- Debug . Log ( "Relayer Response: " + req . downloadHandler . text ) ;
134
133
var response = JsonConvert . DeserializeObject < RelayerResponse > ( req . downloadHandler . text ) ;
134
+ if ( response . status != "success" )
135
+ {
136
+ throw new UnityException (
137
+ $ "Forward Request Failed!\n Error: { req . downloadHandler . text } \n Relayer URL: { relayerUrl } \n Relayer Forwarder Address: { forwarderAddress } \n Request: { request } \n Signature: { signature } \n Post Data: { postData } "
138
+ ) ;
139
+ }
135
140
var result = JsonConvert . DeserializeObject < RelayerResult > ( response . result ) ;
136
141
txHash = result . txHash ;
137
- Debug . Log ( txHash ) ;
138
142
}
139
143
}
140
144
}
@@ -146,6 +150,9 @@ public static async Task<TransactionReceipt> ThirdwebWriteRawResult<TWFunction>(
146
150
[ System . Serializable ]
147
151
public struct RelayerResponse
148
152
{
153
+ [ JsonProperty ( "status" ) ]
154
+ public string status ;
155
+
149
156
[ JsonProperty ( "result" ) ]
150
157
public string result ;
151
158
}
You can’t perform that action at this time.
0 commit comments