@@ -9,9 +9,7 @@ private async Task<ThirdwebTransaction> CreateSampleTransaction()
9
9
{
10
10
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
11
11
var wallet = await PrivateKeyWallet . Generate ( client ) ;
12
- var chainId = new BigInteger ( 421614 ) ;
13
-
14
- var transaction = await ThirdwebTransaction . Create ( wallet , new ThirdwebTransactionInput ( ) { To = await wallet . GetAddress ( ) , } , chainId ) ;
12
+ var transaction = await ThirdwebTransaction . Create ( wallet , new ThirdwebTransactionInput ( 421614 ) { To = await wallet . GetAddress ( ) , } ) ;
15
13
return transaction ;
16
14
}
17
15
@@ -50,9 +48,8 @@ public async Task Create_ValidatesInputParameters()
50
48
{
51
49
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
52
50
var wallet = await PrivateKeyWallet . Generate ( client ) ;
53
- var txInput = new ThirdwebTransactionInput ( ) { To = Constants . ADDRESS_ZERO } ;
54
- var chainId = new BigInteger ( 421614 ) ;
55
- var transaction = await ThirdwebTransaction . Create ( wallet , txInput , chainId ) ;
51
+ var txInput = new ThirdwebTransactionInput ( 421614 ) { To = Constants . ADDRESS_ZERO } ;
52
+ var transaction = await ThirdwebTransaction . Create ( wallet , txInput ) ;
56
53
Assert . NotNull ( transaction ) ;
57
54
}
58
55
@@ -61,8 +58,8 @@ public async Task Create_ThrowsOnNoTo()
61
58
{
62
59
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
63
60
var wallet = await PrivateKeyWallet . Generate ( client ) ;
64
- var txInput = new ThirdwebTransactionInput ( ) { } ;
65
- var ex = await Assert . ThrowsAsync < ArgumentException > ( ( ) => ThirdwebTransaction . Create ( wallet , txInput , 421614 ) ) ;
61
+ var txInput = new ThirdwebTransactionInput ( 421614 ) { } ;
62
+ var ex = await Assert . ThrowsAsync < ArgumentException > ( ( ) => ThirdwebTransaction . Create ( wallet , txInput ) ) ;
66
63
Assert . Contains ( "Transaction recipient (to) must be provided" , ex . Message ) ;
67
64
}
68
65
@@ -71,8 +68,8 @@ public async Task Create_ThrowsOnNoWallet()
71
68
{
72
69
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
73
70
var wallet = await PrivateKeyWallet . Generate ( client ) ;
74
- var txInput = new ThirdwebTransactionInput ( ) { To = Constants . ADDRESS_ZERO } ;
75
- var ex = await Assert . ThrowsAsync < ArgumentException > ( ( ) => ThirdwebTransaction . Create ( null , txInput , 421614 ) ) ;
71
+ var txInput = new ThirdwebTransactionInput ( 421614 ) { To = Constants . ADDRESS_ZERO } ;
72
+ var ex = await Assert . ThrowsAsync < ArgumentException > ( ( ) => ThirdwebTransaction . Create ( null , txInput ) ) ;
76
73
Assert . Contains ( "Wallet must be provided" , ex . Message ) ;
77
74
}
78
75
@@ -81,8 +78,7 @@ public async Task Create_ThrowsOnChainIdZero()
81
78
{
82
79
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
83
80
var wallet = await PrivateKeyWallet . Generate ( client ) ;
84
- var txInput = new ThirdwebTransactionInput ( ) { To = Constants . ADDRESS_ZERO } ;
85
- var ex = await Assert . ThrowsAsync < ArgumentException > ( ( ) => ThirdwebTransaction . Create ( wallet , txInput , BigInteger . Zero ) ) ;
81
+ var ex = Assert . Throws < ArgumentException > ( ( ) => new ThirdwebTransactionInput ( 0 ) { To = Constants . ADDRESS_ZERO } ) ;
86
82
Assert . Contains ( "Invalid Chain ID" , ex . Message ) ;
87
83
}
88
84
@@ -166,7 +162,7 @@ public async Task Sign_SmartWallet_SignsTransaction()
166
162
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
167
163
var privateKeyAccount = await PrivateKeyWallet . Generate ( client ) ;
168
164
var smartAccount = await SmartWallet . Create ( personalWallet : privateKeyAccount , factoryAddress : "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052" , gasless : true , chainId : 421614 ) ;
169
- var transaction = await ThirdwebTransaction . Create ( smartAccount , new ThirdwebTransactionInput ( ) { To = Constants . ADDRESS_ZERO , } , 421614 ) ;
165
+ var transaction = await ThirdwebTransaction . Create ( smartAccount , new ThirdwebTransactionInput ( 421614 ) { To = Constants . ADDRESS_ZERO , } ) ;
170
166
var signed = await ThirdwebTransaction . Sign ( transaction ) ;
171
167
Assert . NotNull ( signed ) ;
172
168
}
@@ -218,43 +214,43 @@ public async Task SetZkSyncOptions_DefaultsToZeroNull()
218
214
Assert . Null ( transaction . Input . ZkSync ? . FactoryDeps ) ;
219
215
}
220
216
221
- // [Fact(Timeout = 120000)]
222
- // public async Task Send_ZkSync_TransfersGaslessly()
223
- // {
224
- // var transaction = await CreateSampleTransaction();
225
- // _ = transaction.SetChainId(300);
226
- // _ = transaction.SetTo("0xbA226d47Cbb2731CBAA67C916c57d68484AA269F");
227
- // _ = transaction.SetValue(BigInteger.Zero);
228
- // _ = transaction.SetZkSyncOptions(
229
- // new ZkSyncOptions(
230
- // paymaster: "0xbA226d47Cbb2731CBAA67C916c57d68484AA269F",
231
- // paymasterInput: "0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000",
232
- // gasPerPubdataByteLimit: 50000,
233
- // factoryDeps: new List<byte[]>()
234
- // )
235
- // );
236
- // var receipt = await ThirdwebTransaction.SendAndWaitForTransactionReceipt(transaction);
237
- // Assert.NotNull(receipt);
238
- // Assert.StartsWith("0x", receipt.TransactionHash);
239
- // }
217
+ [ Fact ( Timeout = 120000 ) ]
218
+ public async Task Send_ZkSync_TransfersGaslessly ( )
219
+ {
220
+ var transaction = await this . CreateSampleTransaction ( ) ;
221
+ _ = transaction . SetChainId ( 300 ) ;
222
+ _ = transaction . SetTo ( "0xbA226d47Cbb2731CBAA67C916c57d68484AA269F" ) ;
223
+ _ = transaction . SetValue ( BigInteger . Zero ) ;
224
+ _ = transaction . SetZkSyncOptions (
225
+ new ZkSyncOptions (
226
+ paymaster : "0xbA226d47Cbb2731CBAA67C916c57d68484AA269F" ,
227
+ paymasterInput : "0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000" ,
228
+ gasPerPubdataByteLimit : 50000 ,
229
+ factoryDeps : new List < byte [ ] > ( )
230
+ )
231
+ ) ;
232
+ var receipt = await ThirdwebTransaction . SendAndWaitForTransactionReceipt ( transaction ) ;
233
+ Assert . NotNull ( receipt ) ;
234
+ Assert . StartsWith ( "0x" , receipt . TransactionHash ) ;
235
+ }
240
236
241
- // [Fact(Timeout = 120000)]
242
- // public async Task Send_ZkSync_NoGasPerPubFactoryDepsTransfersGaslessly()
243
- // {
244
- // var transaction = await CreateSampleTransaction();
245
- // _ = transaction.SetChainId(300);
246
- // _ = transaction.SetTo("0xbA226d47Cbb2731CBAA67C916c57d68484AA269F");
247
- // _ = transaction.SetValue(BigInteger.Zero);
248
- // _ = transaction.SetZkSyncOptions(
249
- // new ZkSyncOptions(
250
- // paymaster: "0xbA226d47Cbb2731CBAA67C916c57d68484AA269F",
251
- // paymasterInput: "0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000"
252
- // )
253
- // );
254
- // var receipt = await ThirdwebTransaction.SendAndWaitForTransactionReceipt(transaction);
255
- // Assert.NotNull(receipt);
256
- // Assert.StartsWith("0x", receipt.TransactionHash);
257
- // }
237
+ [ Fact ( Timeout = 120000 ) ]
238
+ public async Task Send_ZkSync_NoGasPerPubFactoryDepsTransfersGaslessly ( )
239
+ {
240
+ var transaction = await this . CreateSampleTransaction ( ) ;
241
+ _ = transaction . SetChainId ( 300 ) ;
242
+ _ = transaction . SetTo ( "0xbA226d47Cbb2731CBAA67C916c57d68484AA269F" ) ;
243
+ _ = transaction . SetValue ( BigInteger . Zero ) ;
244
+ _ = transaction . SetZkSyncOptions (
245
+ new ZkSyncOptions (
246
+ paymaster : "0xbA226d47Cbb2731CBAA67C916c57d68484AA269F" ,
247
+ paymasterInput : "0x8c5a344500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000"
248
+ )
249
+ ) ;
250
+ var receipt = await ThirdwebTransaction . SendAndWaitForTransactionReceipt ( transaction ) ;
251
+ Assert . NotNull ( receipt ) ;
252
+ Assert . StartsWith ( "0x" , receipt . TransactionHash ) ;
253
+ }
258
254
259
255
[ Fact ( Timeout = 120000 ) ]
260
256
public async Task EstimateTotalCosts_CalculatesCostsCorrectly ( )
@@ -355,9 +351,7 @@ public async Task EstimateGasFees_ReturnsCorrectly()
355
351
{
356
352
var transaction = await ThirdwebTransaction . Create (
357
353
await PrivateKeyWallet . Generate ( ThirdwebClient . Create ( secretKey : this . SecretKey ) ) ,
358
- new ThirdwebTransactionInput ( ) { To = Constants . ADDRESS_ZERO , } ,
359
- 250 // fantom for 1559 non zero prio
360
- ) ;
354
+ new ThirdwebTransactionInput ( 250 ) { To = Constants . ADDRESS_ZERO , } ) ;
361
355
362
356
( var maxFee , var maxPrio ) = await ThirdwebTransaction . EstimateGasFees ( transaction ) ;
363
357
@@ -393,7 +387,7 @@ public async Task Simulate_ReturnsDataOrThrowsIntrinsic()
393
387
var client = ThirdwebClient . Create ( secretKey : this . SecretKey ) ;
394
388
var privateKeyAccount = await PrivateKeyWallet . Generate ( client ) ;
395
389
var smartAccount = await SmartWallet . Create ( personalWallet : privateKeyAccount , factoryAddress : "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052" , gasless : true , chainId : 421614 ) ;
396
- var transaction = await ThirdwebTransaction . Create ( smartAccount , new ThirdwebTransactionInput ( ) { To = Constants . ADDRESS_ZERO , Gas = new HexBigInteger ( 250000 ) , } , 421614 ) ;
390
+ var transaction = await ThirdwebTransaction . Create ( smartAccount , new ThirdwebTransactionInput ( 421614 ) { To = Constants . ADDRESS_ZERO , Gas = new HexBigInteger ( 250000 ) , } ) ;
397
391
398
392
try
399
393
{
0 commit comments