@@ -30,12 +30,12 @@ public class ThirdwebTransaction
30
30
{
31
31
public ThirdwebTransactionInput Input { get ; }
32
32
33
- private readonly IThirdwebWallet _wallet ;
33
+ internal readonly IThirdwebWallet Wallet ;
34
34
35
35
private ThirdwebTransaction ( IThirdwebWallet wallet , ThirdwebTransactionInput txInput )
36
36
{
37
37
this . Input = txInput ;
38
- this . _wallet = wallet ;
38
+ this . Wallet = wallet ;
39
39
}
40
40
41
41
/// <summary>
@@ -215,7 +215,7 @@ public static async Task<TotalCosts> EstimateTotalCosts(ThirdwebTransaction tran
215
215
/// <returns>The estimated gas price.</returns>
216
216
public static async Task < BigInteger > EstimateGasPrice ( ThirdwebTransaction transaction , bool withBump = true )
217
217
{
218
- return await Utils . FetchGasPrice ( transaction . _wallet . Client , transaction . Input . ChainId . Value , withBump ) . ConfigureAwait ( false ) ;
218
+ return await Utils . FetchGasPrice ( transaction . Wallet . Client , transaction . Input . ChainId . Value , withBump ) . ConfigureAwait ( false ) ;
219
219
}
220
220
221
221
/// <summary>
@@ -226,10 +226,10 @@ public static async Task<BigInteger> EstimateGasPrice(ThirdwebTransaction transa
226
226
/// <returns>The estimated maximum fee per gas and maximum priority fee per gas.</returns>
227
227
public static async Task < ( BigInteger maxFeePerGas , BigInteger maxPriorityFeePerGas ) > EstimateGasFees ( ThirdwebTransaction transaction , bool withBump = true )
228
228
{
229
- var rpc = ThirdwebRPC . GetRpcInstance ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) ;
229
+ var rpc = ThirdwebRPC . GetRpcInstance ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) ;
230
230
var chainId = transaction . Input . ChainId . Value ;
231
231
232
- if ( await Utils . IsZkSync ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) . ConfigureAwait ( false ) )
232
+ if ( await Utils . IsZkSync ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) . ConfigureAwait ( false ) )
233
233
{
234
234
var fees = await rpc . SendRequestAsync < JToken > ( "zks_estimateFee" , transaction . Input ) . ConfigureAwait ( false ) ;
235
235
var maxFee = fees [ "max_fee_per_gas" ] . ToObject < HexBigInteger > ( ) . Value ;
@@ -238,7 +238,7 @@ public static async Task<BigInteger> EstimateGasPrice(ThirdwebTransaction transa
238
238
}
239
239
else
240
240
{
241
- return await Utils . FetchGasFees ( transaction . _wallet . Client , chainId , withBump ) . ConfigureAwait ( false ) ;
241
+ return await Utils . FetchGasFees ( transaction . Wallet . Client , chainId , withBump ) . ConfigureAwait ( false ) ;
242
242
}
243
243
}
244
244
@@ -249,7 +249,7 @@ public static async Task<BigInteger> EstimateGasPrice(ThirdwebTransaction transa
249
249
/// <returns>The result of the simulation.</returns>
250
250
public static async Task < string > Simulate ( ThirdwebTransaction transaction )
251
251
{
252
- var rpc = ThirdwebRPC . GetRpcInstance ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) ;
252
+ var rpc = ThirdwebRPC . GetRpcInstance ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) ;
253
253
return await rpc . SendRequestAsync < string > ( "eth_call" , transaction . Input , "latest" ) ;
254
254
}
255
255
@@ -260,8 +260,8 @@ public static async Task<string> Simulate(ThirdwebTransaction transaction)
260
260
/// <returns>The estimated gas limit.</returns>
261
261
public static async Task < BigInteger > EstimateGasLimit ( ThirdwebTransaction transaction )
262
262
{
263
- var rpc = ThirdwebRPC . GetRpcInstance ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) ;
264
- var isZkSync = await Utils . IsZkSync ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) . ConfigureAwait ( false ) ;
263
+ var rpc = ThirdwebRPC . GetRpcInstance ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) ;
264
+ var isZkSync = await Utils . IsZkSync ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) . ConfigureAwait ( false ) ;
265
265
BigInteger divider = isZkSync
266
266
? 7
267
267
: transaction . Input . AuthorizationList == null
@@ -288,12 +288,12 @@ public static async Task<BigInteger> EstimateGasLimit(ThirdwebTransaction transa
288
288
/// <returns>The nonce.</returns>
289
289
public static async Task < BigInteger > GetNonce ( ThirdwebTransaction transaction )
290
290
{
291
- return await transaction . _wallet . GetTransactionCount ( chainId : transaction . Input . ChainId , blocktag : "pending" ) . ConfigureAwait ( false ) ;
291
+ return await transaction . Wallet . GetTransactionCount ( chainId : transaction . Input . ChainId , blocktag : "pending" ) . ConfigureAwait ( false ) ;
292
292
}
293
293
294
294
private static async Task < BigInteger > GetGasPerPubData ( ThirdwebTransaction transaction )
295
295
{
296
- var rpc = ThirdwebRPC . GetRpcInstance ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) ;
296
+ var rpc = ThirdwebRPC . GetRpcInstance ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) ;
297
297
var hex = ( await rpc . SendRequestAsync < JToken > ( "zks_estimateFee" , transaction . Input ) . ConfigureAwait ( false ) ) [ "gas_per_pubdata_limit" ] . ToString ( ) ;
298
298
var finalGasPerPubData = new HexBigInteger ( hex ) . Value * 10 / 5 ;
299
299
return finalGasPerPubData < 10000 ? 10000 : finalGasPerPubData ;
@@ -306,7 +306,7 @@ private static async Task<BigInteger> GetGasPerPubData(ThirdwebTransaction trans
306
306
/// <returns>The signed transaction.</returns>
307
307
public static async Task < string > Sign ( ThirdwebTransaction transaction )
308
308
{
309
- return await transaction . _wallet . SignTransaction ( transaction . Input ) . ConfigureAwait ( false ) ;
309
+ return await transaction . Wallet . SignTransaction ( transaction . Input ) . ConfigureAwait ( false ) ;
310
310
}
311
311
312
312
/// <summary>
@@ -362,31 +362,32 @@ public static async Task<string> Send(ThirdwebTransaction transaction)
362
362
{
363
363
transaction = await Prepare ( transaction ) . ConfigureAwait ( false ) ;
364
364
365
- var rpc = ThirdwebRPC . GetRpcInstance ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) ;
365
+ var rpc = ThirdwebRPC . GetRpcInstance ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) ;
366
366
string hash ;
367
367
368
- if ( await Utils . IsZkSync ( transaction . _wallet . Client , transaction . Input . ChainId . Value ) . ConfigureAwait ( false ) && transaction . Input . ZkSync . HasValue )
368
+ if ( await Utils . IsZkSync ( transaction . Wallet . Client , transaction . Input . ChainId . Value ) . ConfigureAwait ( false ) && transaction . Input . ZkSync . HasValue )
369
369
{
370
370
var zkTx = await ConvertToZkSyncTransaction ( transaction ) . ConfigureAwait ( false ) ;
371
- var zkTxSigned = await EIP712 . GenerateSignature_ZkSyncTransaction ( "zkSync" , "2" , transaction . Input . ChainId . Value , zkTx , transaction . _wallet ) . ConfigureAwait ( false ) ;
371
+ var zkTxSigned = await EIP712 . GenerateSignature_ZkSyncTransaction ( "zkSync" , "2" , transaction . Input . ChainId . Value , zkTx , transaction . Wallet ) . ConfigureAwait ( false ) ;
372
372
hash = await rpc . SendRequestAsync < string > ( "eth_sendRawTransaction" , zkTxSigned ) . ConfigureAwait ( false ) ;
373
373
}
374
374
else
375
375
{
376
- switch ( transaction . _wallet . AccountType )
376
+ switch ( transaction . Wallet . AccountType )
377
377
{
378
378
case ThirdwebAccountType . PrivateKeyAccount :
379
379
var signedTx = await Sign ( transaction ) ;
380
380
hash = await rpc . SendRequestAsync < string > ( "eth_sendRawTransaction" , signedTx ) . ConfigureAwait ( false ) ;
381
381
break ;
382
382
case ThirdwebAccountType . SmartAccount :
383
383
case ThirdwebAccountType . ExternalAccount :
384
- hash = await transaction . _wallet . SendTransaction ( transaction . Input ) . ConfigureAwait ( false ) ;
384
+ hash = await transaction . Wallet . SendTransaction ( transaction . Input ) . ConfigureAwait ( false ) ;
385
385
break ;
386
386
default :
387
387
throw new NotImplementedException ( "Account type not supported" ) ;
388
388
}
389
389
}
390
+ Utils . TrackTransaction ( transaction , hash ) ;
390
391
return hash ;
391
392
}
392
393
@@ -398,7 +399,7 @@ public static async Task<string> Send(ThirdwebTransaction transaction)
398
399
public static async Task < ThirdwebTransactionReceipt > SendAndWaitForTransactionReceipt ( ThirdwebTransaction transaction )
399
400
{
400
401
var txHash = await Send ( transaction ) . ConfigureAwait ( false ) ;
401
- return await WaitForTransactionReceipt ( transaction . _wallet . Client , transaction . Input . ChainId . Value , txHash ) . ConfigureAwait ( false ) ;
402
+ return await WaitForTransactionReceipt ( transaction . Wallet . Client , transaction . Input . ChainId . Value , txHash ) . ConfigureAwait ( false ) ;
402
403
}
403
404
404
405
/// <summary>
0 commit comments