@@ -162,7 +162,7 @@ public static async Task<BigInteger> EstimateGasPrice(ThirdwebTransaction transa
162
162
var maxFee = fees [ "max_fee_per_gas" ] . ToObject < HexBigInteger > ( ) . Value ;
163
163
var maxPriorityFee = fees [ "max_priority_fee_per_gas" ] . ToObject < HexBigInteger > ( ) . Value ;
164
164
maxPriorityFee = maxPriorityFee == 0 ? maxFee : maxPriorityFee ;
165
- return withBump ? ( maxFee * 10 / 9 , maxPriorityFee * 10 / 9 ) : ( maxFee , maxPriorityFee ) ;
165
+ return withBump ? ( maxFee * 10 / 5 , maxPriorityFee * 10 / 5 ) : ( maxFee , maxPriorityFee ) ;
166
166
}
167
167
168
168
var gasPrice = await EstimateGasPrice ( transaction , withBump ) ;
@@ -267,22 +267,7 @@ public static async Task<string> Send(ThirdwebTransaction transaction)
267
267
string hash ;
268
268
if ( IsZkSyncTransaction ( transaction ) && transaction . Input . ZkSync . HasValue && transaction . Input . ZkSync . Value . Paymaster != 0 && transaction . Input . ZkSync . Value . PaymasterInput != null )
269
269
{
270
- var zkTx = new AccountAbstraction . ZkSyncAATransaction
271
- {
272
- TxType = 0x71 ,
273
- From = new HexBigInteger ( transaction . Input . From ) . Value ,
274
- To = new HexBigInteger ( transaction . Input . To ) . Value ,
275
- GasLimit = transaction . Input . Gas . Value ,
276
- GasPerPubdataByteLimit = transaction . Input . ZkSync ? . GasPerPubdataByteLimit ?? await GetGasPerPubData ( transaction ) ,
277
- MaxFeePerGas = transaction . Input . MaxFeePerGas ? . Value ?? transaction . Input . GasPrice . Value ,
278
- MaxPriorityFeePerGas = transaction . Input . MaxPriorityFeePerGas ? . Value ?? transaction . Input . GasPrice . Value ,
279
- Paymaster = transaction . Input . ZkSync . Value . Paymaster ,
280
- Nonce = transaction . Input . Nonce ?? new HexBigInteger ( await rpc . SendRequestAsync < string > ( "eth_getTransactionCount" , transaction . Input . From , "latest" ) ) ,
281
- Value = transaction . Input . Value . Value ,
282
- Data = transaction . Input . Data . HexToByteArray ( ) ,
283
- FactoryDeps = transaction . Input . ZkSync . Value . FactoryDeps ,
284
- PaymasterInput = transaction . Input . ZkSync . Value . PaymasterInput
285
- } ;
270
+ var zkTx = await ConvertToZkSyncTransaction ( transaction ) ;
286
271
var zkTxSigned = await EIP712 . GenerateSignature_ZkSyncTransaction ( "zkSync" , "2" , transaction . Input . ChainId . Value , zkTx , transaction . _wallet ) ;
287
272
hash = await rpc . SendRequestAsync < string > ( "eth_sendRawTransaction" , zkTxSigned ) ;
288
273
}
@@ -355,6 +340,27 @@ public static async Task<TransactionReceipt> WaitForTransactionReceipt(ThirdwebC
355
340
return receipt ;
356
341
}
357
342
343
+ public static async Task < AccountAbstraction . ZkSyncAATransaction > ConvertToZkSyncTransaction ( ThirdwebTransaction transaction )
344
+ {
345
+ var rpc = ThirdwebRPC . GetRpcInstance ( transaction . _client , transaction . Input . ChainId . Value ) ;
346
+ return new AccountAbstraction . ZkSyncAATransaction
347
+ {
348
+ TxType = 0x71 ,
349
+ From = new HexBigInteger ( transaction . Input . From ) . Value ,
350
+ To = new HexBigInteger ( transaction . Input . To ) . Value ,
351
+ GasLimit = transaction . Input . Gas . Value ,
352
+ GasPerPubdataByteLimit = transaction . Input . ZkSync ? . GasPerPubdataByteLimit ?? await GetGasPerPubData ( transaction ) ,
353
+ MaxFeePerGas = transaction . Input . MaxFeePerGas ? . Value ?? transaction . Input . GasPrice . Value ,
354
+ MaxPriorityFeePerGas = transaction . Input . MaxPriorityFeePerGas ? . Value ?? transaction . Input . GasPrice . Value ,
355
+ Paymaster = transaction . Input . ZkSync . Value . Paymaster ,
356
+ Nonce = transaction . Input . Nonce ?? new HexBigInteger ( await rpc . SendRequestAsync < string > ( "eth_getTransactionCount" , transaction . Input . From , "latest" ) ) ,
357
+ Value = transaction . Input . Value . Value ,
358
+ Data = transaction . Input . Data . HexToByteArray ( ) ,
359
+ FactoryDeps = transaction . Input . ZkSync . Value . FactoryDeps ,
360
+ PaymasterInput = transaction . Input . ZkSync . Value . PaymasterInput
361
+ } ;
362
+ }
363
+
358
364
private static bool IsZkSyncTransaction ( ThirdwebTransaction transaction )
359
365
{
360
366
return transaction . Input . ChainId . Value . Equals ( 324 ) || transaction . Input . ChainId . Value . Equals ( 300 ) ;
0 commit comments