Skip to content

Commit d9c4a98

Browse files
committed
fix zks_ rpc calls for abstract
1 parent 4751f7b commit d9c4a98

File tree

2 files changed

+36
-19
lines changed

2 files changed

+36
-19
lines changed

Thirdweb.Tests/Thirdweb.Transactions/Thirdweb.ZkSmartWallet.Tests.cs

+33-16
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,22 @@ public async Task IsDeployed_ReturnsTrue()
7373
Assert.True(await account.IsDeployed());
7474
}
7575

76-
// [Fact(Timeout = 120000)]
77-
// public async Task SendGaslessZkTx_Success()
78-
// {
79-
// var account = await GetSmartAccount();
80-
// var hash = await account.SendTransaction(
81-
// new ThirdwebTransactionInput()
82-
// {
83-
// From = await account.GetAddress(),
84-
// To = await account.GetAddress(),
85-
// Value = new Nethereum.Hex.HexTypes.HexBigInteger(0),
86-
// Data = "0x"
87-
// }
88-
// );
89-
// Assert.NotNull(hash);
90-
// Assert.True(hash.Length == 66);
91-
// }
76+
[Fact(Timeout = 120000)]
77+
public async Task SendGaslessZkTx_Success()
78+
{
79+
var account = await GetSmartAccount();
80+
var hash = await account.SendTransaction(
81+
new ThirdwebTransactionInput()
82+
{
83+
From = await account.GetAddress(),
84+
To = await account.GetAddress(),
85+
Value = new Nethereum.Hex.HexTypes.HexBigInteger(0),
86+
Data = "0x"
87+
}
88+
);
89+
Assert.NotNull(hash);
90+
Assert.True(hash.Length == 66);
91+
}
9292

9393
// [Fact(Timeout = 120000)]
9494
// public async Task SendGaslessZkTx_ZkCandy_Success()
@@ -106,4 +106,21 @@ public async Task IsDeployed_ReturnsTrue()
106106
// Assert.NotNull(hash);
107107
// Assert.True(hash.Length == 66);
108108
// }
109+
110+
[Fact(Timeout = 120000)]
111+
public async Task SendGaslessZkTx_Abstract_Success()
112+
{
113+
var account = await GetSmartAccount(zkChainId: 11124);
114+
var hash = await account.SendTransaction(
115+
new ThirdwebTransactionInput()
116+
{
117+
From = await account.GetAddress(),
118+
To = await account.GetAddress(),
119+
Value = new Nethereum.Hex.HexTypes.HexBigInteger(0),
120+
Data = "0x"
121+
}
122+
);
123+
Assert.NotNull(hash);
124+
Assert.True(hash.Length == 66);
125+
}
109126
}

Thirdweb/Thirdweb.Transactions/ThirdwebTransaction.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static async Task<BigInteger> EstimateGasPrice(ThirdwebTransaction transa
246246

247247
if (Utils.IsZkSync(transaction.Input.ChainId.Value))
248248
{
249-
var fees = await rpc.SendRequestAsync<JToken>("zks_estimateFee", transaction.Input, "latest").ConfigureAwait(false);
249+
var fees = await rpc.SendRequestAsync<JToken>("zks_estimateFee", transaction.Input).ConfigureAwait(false);
250250
var maxFee = fees["max_fee_per_gas"].ToObject<HexBigInteger>().Value;
251251
var maxPriorityFee = fees["max_priority_fee_per_gas"].ToObject<HexBigInteger>().Value;
252252
return withBump ? (maxFee * 10 / 5, maxPriorityFee * 10 / 5) : (maxFee, maxPriorityFee);
@@ -308,7 +308,7 @@ public static async Task<BigInteger> EstimateGasLimit(ThirdwebTransaction transa
308308

309309
if (Utils.IsZkSync(transaction.Input.ChainId.Value))
310310
{
311-
var hex = (await rpc.SendRequestAsync<JToken>("zks_estimateFee", transaction.Input, "latest").ConfigureAwait(false))["gas_limit"].ToString();
311+
var hex = (await rpc.SendRequestAsync<JToken>("zks_estimateFee", transaction.Input).ConfigureAwait(false))["gas_limit"].ToString();
312312
return new HexBigInteger(hex).Value * 10 / 5;
313313
}
314314

@@ -338,7 +338,7 @@ public static async Task<BigInteger> GetNonce(ThirdwebTransaction transaction)
338338
private static async Task<BigInteger> GetGasPerPubData(ThirdwebTransaction transaction)
339339
{
340340
var rpc = ThirdwebRPC.GetRpcInstance(transaction._wallet.Client, transaction.Input.ChainId.Value);
341-
var hex = (await rpc.SendRequestAsync<JToken>("zks_estimateFee", transaction.Input, "latest").ConfigureAwait(false))["gas_per_pubdata_limit"].ToString();
341+
var hex = (await rpc.SendRequestAsync<JToken>("zks_estimateFee", transaction.Input).ConfigureAwait(false))["gas_per_pubdata_limit"].ToString();
342342
var finalGasPerPubData = new HexBigInteger(hex).Value * 10 / 5;
343343
return finalGasPerPubData < 10000 ? 10000 : finalGasPerPubData;
344344
}

0 commit comments

Comments
 (0)