-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87e5298
commit 147d791
Showing
5 changed files
with
43 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
var privateKeyWallet = await PrivateKeyWallet.Create(client: client, privateKeyHex: privateKey); | ||
|
||
// var inAppWallet = await InAppWallet.Create(client: client, email: "[email protected]"); // or email: null, phoneNumber: "+1234567890" | ||
var inAppWallet = await InAppWallet.Create(client: client, authprovider: AuthProvider.Google); // or email: null, phoneNumber: "+1234567890" | ||
// var inAppWallet = await InAppWallet.Create(client: client, authprovider: AuthProvider.Google); // or email: null, phoneNumber: "+1234567890" | ||
|
||
// Reset InAppWallet (optional step for testing login flow) | ||
// if (await inAppWallet.IsConnected()) | ||
|
@@ -34,35 +34,35 @@ | |
// } | ||
|
||
// Relog if InAppWallet not logged in | ||
if (!await inAppWallet.IsConnected()) | ||
{ | ||
var address = await inAppWallet.LoginWithOauth( | ||
isMobile: false, | ||
(url) => | ||
{ | ||
var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; | ||
_ = Process.Start(psi); | ||
}, | ||
"thirdweb://", | ||
new InAppWalletBrowser() | ||
); | ||
Console.WriteLine($"InAppWallet address: {address}"); | ||
// await inAppWallet.SendOTP(); | ||
// Console.WriteLine("Please submit the OTP."); | ||
// var otp = Console.ReadLine(); | ||
// (var inAppWalletAddress, var canRetry) = await inAppWallet.SubmitOTP(otp); | ||
// if (inAppWalletAddress == null && canRetry) | ||
// { | ||
// Console.WriteLine("Please submit the OTP again."); | ||
// otp = Console.ReadLine(); | ||
// (inAppWalletAddress, _) = await inAppWallet.SubmitOTP(otp); | ||
// } | ||
// if (inAppWalletAddress == null) | ||
// { | ||
// Console.WriteLine("OTP login failed. Please try again."); | ||
// return; | ||
// } | ||
} | ||
// if (!await inAppWallet.IsConnected()) | ||
// { | ||
// var address = await inAppWallet.LoginWithOauth( | ||
// isMobile: false, | ||
// (url) => | ||
// { | ||
// var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true }; | ||
// _ = Process.Start(psi); | ||
// }, | ||
// "thirdweb://", | ||
// new InAppWalletBrowser() | ||
// ); | ||
// Console.WriteLine($"InAppWallet address: {address}"); | ||
// await inAppWallet.SendOTP(); | ||
// Console.WriteLine("Please submit the OTP."); | ||
// var otp = Console.ReadLine(); | ||
// (var inAppWalletAddress, var canRetry) = await inAppWallet.SubmitOTP(otp); | ||
// if (inAppWalletAddress == null && canRetry) | ||
// { | ||
// Console.WriteLine("Please submit the OTP again."); | ||
// otp = Console.ReadLine(); | ||
// (inAppWalletAddress, _) = await inAppWallet.SubmitOTP(otp); | ||
// } | ||
// if (inAppWalletAddress == null) | ||
// { | ||
// Console.WriteLine("OTP login failed. Please try again."); | ||
// return; | ||
// } | ||
// } | ||
|
||
// Prepare a transaction directly, or with Contract.Prepare | ||
// var tx = await ThirdwebTransaction.Create( | ||
|
@@ -92,13 +92,15 @@ | |
// Console.WriteLine($"Transaction hash: {txHash}"); | ||
|
||
var zkSmartWallet = await SmartWallet.Create(client: client, personalWallet: privateKeyWallet, chainId: 300, gasless: true); | ||
Console.WriteLine($"Smart wallet address: {await zkSmartWallet.GetAddress()}"); | ||
var zkSyncSignatureBasedAaTxHash = await zkSmartWallet.SendTransaction( | ||
new ThirdwebTransactionInput() | ||
{ | ||
From = await zkSmartWallet.GetAddress(), | ||
To = await zkSmartWallet.GetAddress(), | ||
Value = new HexBigInteger(BigInteger.Zero), | ||
Data = "0x", | ||
Gas = new HexBigInteger(25000000) | ||
} | ||
); | ||
Console.WriteLine($"Transaction hash: {zkSyncSignatureBasedAaTxHash}"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters