|
360 | 360 |
|
361 | 361 | #region EIP-7702 |
362 | 362 |
|
363 | | -var chain = 11155111; // 7702-compatible chain |
364 | | - |
365 | | -// Connect to EOA |
366 | | -var smartEoa = await InAppWallet.Create(client, authProvider: AuthProvider.Guest, executionMode: ExecutionMode.EIP7702Sponsored); |
367 | | -if (!await smartEoa.IsConnected()) |
368 | | -{ |
369 | | - _ = await smartEoa.LoginWithGuest(defaultSessionIdOverride: new Guid().ToString()); |
370 | | -} |
371 | | -var smartEoaAddress = await smartEoa.GetAddress(); |
372 | | -Console.WriteLine($"User Wallet address: {await smartEoa.GetAddress()}"); |
373 | | - |
374 | | -// Upgrade EOA - This wallet explicitly uses EIP-7702 delegation to the thirdweb MinimalAccount (will delegate upon first tx) |
375 | | - |
376 | | -// Transact, will upgrade EOA |
377 | | -var receipt = await smartEoa.Transfer(chainId: chain, toAddress: await Utils.GetAddressFromENS(client, "vitalik.eth"), weiAmount: 0); |
378 | | -Console.WriteLine($"Transfer Receipt: {receipt.TransactionHash}"); |
379 | | - |
380 | | -// Double check that it was upgraded |
381 | | -var isDelegated = await Utils.IsDelegatedAccount(client, chain, smartEoaAddress); |
382 | | -Console.WriteLine($"Is delegated: {isDelegated}"); |
383 | | - |
384 | | -// Create a session key |
385 | | -var sessionKeyReceipt = await smartEoa.CreateSessionKey( |
386 | | - chain, |
387 | | - new SessionSpec() |
388 | | - { |
389 | | - Signer = await Utils.GetAddressFromENS(client, "vitalik.eth"), |
390 | | - IsWildcard = true, |
391 | | - ExpiresAt = Utils.GetUnixTimeStampNow() + 86400, // 1 day |
392 | | - CallPolicies = new List<CallSpec>(), |
393 | | - TransferPolicies = new List<TransferSpec>(), |
394 | | - Uid = "my-session-key-uid".HashMessage().HexToBytes() |
395 | | - } |
396 | | -); |
397 | | -Console.WriteLine($"Session key receipt: {sessionKeyReceipt.TransactionHash}"); |
| 363 | +// var chain = 11155111; // 7702-compatible chain |
| 364 | + |
| 365 | +// // Connect to EOA |
| 366 | +// var smartEoa = await InAppWallet.Create(client, authProvider: AuthProvider.Guest, executionMode: ExecutionMode.EIP7702Sponsored); |
| 367 | +// if (!await smartEoa.IsConnected()) |
| 368 | +// { |
| 369 | +// _ = await smartEoa.LoginWithGuest(defaultSessionIdOverride: new Guid().ToString()); |
| 370 | +// } |
| 371 | +// var smartEoaAddress = await smartEoa.GetAddress(); |
| 372 | +// Console.WriteLine($"User Wallet address: {await smartEoa.GetAddress()}"); |
| 373 | + |
| 374 | +// // Upgrade EOA - This wallet explicitly uses EIP-7702 delegation to the thirdweb MinimalAccount (will delegate upon first tx) |
| 375 | + |
| 376 | +// // Transact, will upgrade EOA |
| 377 | +// var receipt = await smartEoa.Transfer(chainId: chain, toAddress: await Utils.GetAddressFromENS(client, "vitalik.eth"), weiAmount: 0); |
| 378 | +// Console.WriteLine($"Transfer Receipt: {receipt.TransactionHash}"); |
| 379 | + |
| 380 | +// // Double check that it was upgraded |
| 381 | +// var isDelegated = await Utils.IsDelegatedAccount(client, chain, smartEoaAddress); |
| 382 | +// Console.WriteLine($"Is delegated: {isDelegated}"); |
| 383 | + |
| 384 | +// // Create a session key |
| 385 | +// var sessionKeyReceipt = await smartEoa.CreateSessionKey(chainId: chain, signerAddress: await Utils.GetAddressFromENS(client, "vitalik.eth"), durationInSeconds: 86400, grantFullPermissions: true); |
| 386 | +// Console.WriteLine($"Session key receipt: {sessionKeyReceipt.TransactionHash}"); |
398 | 387 |
|
399 | 388 | #endregion |
400 | 389 |
|
|
0 commit comments