-
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
8f12521
commit 9e26633
Showing
2 changed files
with
7 additions
and
3 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 |
---|---|---|
|
@@ -34,9 +34,8 @@ var contract = await ThirdwebContract.Create(client: client, address: "0x81ebd23 | |
var readResult = await ThirdwebContract.Read<string>(contract, "name"); | ||
Console.WriteLine($"Contract read result: {readResult}"); | ||
|
||
// Create a smart account to unlock gasless features, with an embedded account as signer to unlock web2 auth | ||
// Create embedded account as signer to unlock web2 auth | ||
var embeddedAccount = await EmbeddedAccount.Create(client: client, email: "[email protected]"); // or email: null, phoneNumber: "+1234567890" | ||
var smartAccount = await SmartAccount.Create(client: client, personalAccount: embeddedAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); | ||
// Relog if embedded account not logged in | ||
if (!await embeddedAccount.IsConnected()) | ||
|
@@ -58,6 +57,9 @@ if (!await embeddedAccount.IsConnected()) | |
} | ||
} | ||
|
||
// Create a smart account to unlock gasless features, with embedded account as a signer | ||
var smartAccount = await SmartAccount.Create(client: client, personalAccount: embeddedAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); | ||
|
||
// Log addresses | ||
Console.WriteLine($"Embedded Account: {await embeddedAccount.GetAddress()}"); | ||
Console.WriteLine($"Smart Account: {await smartAccount.GetAddress()}"); | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,6 @@ private static async Task Main(string[] args) | |
// Create accounts (this is an advanced use case, typically one account is plenty) | ||
var privateKeyAccount = await PrivateKeyAccount.Create(client: client, privateKeyHex: privateKey); | ||
var embeddedAccount = await EmbeddedAccount.Create(client: client, email: "[email protected]"); // or email: null, phoneNumber: "+1234567890" | ||
var smartAccount = await SmartAccount.Create(client: client, personalAccount: embeddedAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); | ||
|
||
// // Reset embedded account (optional step for testing login flow) | ||
// if (await embeddedAccount.IsConnected()) | ||
|
@@ -51,6 +50,9 @@ private static async Task Main(string[] args) | |
} | ||
} | ||
|
||
// Create smart account with embedded signer | ||
var smartAccount = await SmartAccount.Create(client: client, personalAccount: embeddedAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); | ||
|
||
// Connect the smart account with embedded signer and grant a session key to pk account (advanced use case) | ||
_ = await smartAccount.CreateSessionKey( | ||
signerAddress: await privateKeyAccount.GetAddress(), | ||
|