Skip to content

Commit d5079e2

Browse files
committed
Cleanup
1 parent 42d4c9b commit d5079e2

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ The Thirdweb .NET SDK is a comprehensive and easy to use library that allows dev
1515
- **Query blockchain data:** Use Thirdweb RPC to fetch blockchain data efficiently.
1616
- **Interact with smart contracts:** Simplified read and write operations for smart contracts, with various out-of-the-box extensions provided.
1717
- **In-App Wallets:** Integrate user-friendly wallets within your applications, supporting email, phone, and OAuth login.
18-
- **Account Abstraction:** Simplify complex account management tasks with smart wallets, (ERC4337 or native zkSync AA).
18+
- **Ecosystem Wallets:** Basically In-App Wallets functionality wise, with the added benefit of being able to securely share your wallets with third party partners.
19+
- **Account Abstraction:** Simplify complex account management tasks with smart wallets.
1920
- **Gasless Transactions:** Enable transactions without requiring users to pay gas fees.
2021
- **Storage Solutions:** Download and upload files using IPFS.
2122
- **Transaction Builder:** Create, manipulate and send low level transactions.

Thirdweb.Console/Program.cs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,34 @@
7474

7575
#region Ecosystem Wallet
7676

77-
var ecosystemWallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.the-bonfire", email: "firekeeper+bonfire3@thirdweb.com");
78-
79-
if (!await ecosystemWallet.IsConnected())
80-
{
81-
_ = await ecosystemWallet.SendOTP();
82-
Console.WriteLine("Enter OTP:");
83-
var otp = Console.ReadLine();
84-
_ = await ecosystemWallet.LoginWithOtp(otp);
85-
}
86-
var ecosystemWalletAddress = await ecosystemWallet.GetAddress();
87-
Console.WriteLine($"Ecosystem Wallet address: {ecosystemWalletAddress}");
88-
89-
var ecosystemPersonalSignature = await ecosystemWallet.PersonalSign("Hello, Thirdweb!");
90-
Console.WriteLine($"Ecosystem Wallet personal sign: {ecosystemPersonalSignature}");
91-
var isValidPersonal = (await ecosystemWallet.RecoverAddressFromPersonalSign("Hello, Thirdweb!", ecosystemPersonalSignature)) == ecosystemWalletAddress;
92-
Console.WriteLine($"Ecosystem Wallet personal sign valid: {isValidPersonal}");
93-
94-
var ecosystemTypedSignature = await ecosystemWallet.SignTypedDataV4(
95-
/*lang=json,strict*/
96-
"{\"types\": {\"EIP712Domain\": [{\"name\": \"name\",\"type\": \"string\"},{\"name\": \"version\",\"type\": \"string\"},{\"name\": \"chainId\",\"type\": \"uint256\"},{\"name\": \"verifyingContract\",\"type\": \"address\"}],\"Person\": [{\"name\": \"name\",\"type\": \"string\"},{\"name\": \"wallet\",\"type\": \"address\"}],\"Mail\": [{\"name\": \"from\",\"type\": \"Person\"},{\"name\": \"to\",\"type\": \"Person\"},{\"name\": \"contents\",\"type\": \"string\"}]},\"primaryType\": \"Mail\",\"domain\": {\"name\": \"Ether Mail\",\"version\": \"1\",\"chainId\": 1,\"verifyingContract\": \"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\"},\"message\": {\"from\": {\"name\": \"Cow\",\"wallet\": \"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826\"},\"to\": {\"name\": \"Bob\",\"wallet\": \"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\"},\"contents\": \"Hello, Bob!\"}}"
97-
);
98-
Console.WriteLine($"Ecosystem Wallet typed sign: {ecosystemTypedSignature}");
77+
// var ecosystemWallet = await EcosystemWallet.Create(client: client, ecosystemId: "ecosystem.the-bonfire", authProvider: AuthProvider.Google);
78+
79+
// if (!await ecosystemWallet.IsConnected())
80+
// {
81+
// _ = await ecosystemWallet.LoginWithOauth(
82+
// isMobile: false,
83+
// (url) =>
84+
// {
85+
// var psi = new ProcessStartInfo { FileName = url, UseShellExecute = true };
86+
// _ = Process.Start(psi);
87+
// },
88+
// "thirdweb://",
89+
// new InAppWalletBrowser()
90+
// );
91+
// }
92+
// var ecosystemWalletAddress = await ecosystemWallet.GetAddress();
93+
// Console.WriteLine($"Ecosystem Wallet address: {ecosystemWalletAddress}");
94+
95+
// var ecosystemPersonalSignature = await ecosystemWallet.PersonalSign("Hello, Thirdweb!");
96+
// Console.WriteLine($"Ecosystem Wallet personal sign: {ecosystemPersonalSignature}");
97+
// var isValidPersonal = (await ecosystemWallet.RecoverAddressFromPersonalSign("Hello, Thirdweb!", ecosystemPersonalSignature)) == ecosystemWalletAddress;
98+
// Console.WriteLine($"Ecosystem Wallet personal sign valid: {isValidPersonal}");
99+
100+
// var ecosystemTypedSignature = await ecosystemWallet.SignTypedDataV4(
101+
// /*lang=json,strict*/
102+
// "{\"types\": {\"EIP712Domain\": [{\"name\": \"name\",\"type\": \"string\"},{\"name\": \"version\",\"type\": \"string\"},{\"name\": \"chainId\",\"type\": \"uint256\"},{\"name\": \"verifyingContract\",\"type\": \"address\"}],\"Person\": [{\"name\": \"name\",\"type\": \"string\"},{\"name\": \"wallet\",\"type\": \"address\"}],\"Mail\": [{\"name\": \"from\",\"type\": \"Person\"},{\"name\": \"to\",\"type\": \"Person\"},{\"name\": \"contents\",\"type\": \"string\"}]},\"primaryType\": \"Mail\",\"domain\": {\"name\": \"Ether Mail\",\"version\": \"1\",\"chainId\": 1,\"verifyingContract\": \"0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC\"},\"message\": {\"from\": {\"name\": \"Cow\",\"wallet\": \"0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826\"},\"to\": {\"name\": \"Bob\",\"wallet\": \"0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB\"},\"contents\": \"Hello, Bob!\"}}"
103+
// );
104+
// Console.WriteLine($"Ecosystem Wallet typed sign: {ecosystemTypedSignature}");
99105

100106
// var ecosystemSmartWallet = await SmartWallet.Create(ecosystemWallet, 421614);
101107

Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,15 @@ private static async Task<string> ResumeEnclaveSession(IThirdwebHttpClient httpC
138138
httpClient.AddHeader("Authorization", $"Bearer embedded-wallet-token:{sessionData.AuthToken}");
139139

140140
var userStatus = await GetUserStatus(httpClient).ConfigureAwait(false);
141-
return userStatus.Wallets[0].Address;
141+
if (userStatus.Wallets[0].Type == "enclave")
142+
{
143+
return userStatus.Wallets[0].Address.ToChecksumAddress();
144+
}
145+
else
146+
{
147+
// TODO: Implement migration flow from existing sharded InAppWallet to sharded EcosystemWallet to enclave Ecosystem Wallet
148+
throw new InvalidOperationException("Migration flow from existing sharded InAppWallet to enclave Ecosystem Wallet not implemented yet.");
149+
}
142150
}
143151

144152
private static void CreateEnclaveSession(EmbeddedWallet embeddedWallet, string authToken, string email, string phone, string authProvider)

0 commit comments

Comments
 (0)