From 457a6aa016a0c493b08be125552db95008b6a47f Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Wed, 10 Apr 2024 16:21:12 +0300 Subject: [PATCH 1/2] Account -> Wallet + Embedded -> InApp --- README.md | 90 ++++---- Thirdweb.Console/Program.cs | 207 +++++++++--------- Thirdweb.Tests/Thirdweb.Contracts.Tests.cs | 8 +- .../Thirdweb.PrivateKeyAccount.Tests.cs | 6 +- Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs | 28 +-- Thirdweb.Tests/Thirdweb.Wallets.Tests.cs | 6 +- .../Thirdweb.Contracts/ThirdwebContract.cs | 12 +- Thirdweb/Thirdweb.Wallets/EIP712.cs | 4 +- Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs | 2 +- .../EmbeddedWallet.Authentication/AWS.cs | 0 .../Server.Types.cs | 0 .../EmbeddedWallet.Authentication/Server.cs | 0 .../EmbeddedWallet.Cryptography.cs | 0 .../EmbeddedWallet.Encryption/IvGenerator.cs | 0 .../EmbeddedWallet.Encryption/Secrets.cs | 0 .../VerificationException.cs | 0 .../EmbeddedWallet.Models/User.cs | 0 .../EmbeddedWallet.Models/UserStatus.cs | 0 .../LocalStorage.Types.cs | 0 .../EmbeddedWallet.Storage/LocalStorage.cs | 0 .../EmbeddedWallet.AuthEndpoint.cs | 0 .../EmbeddedWallet/EmbeddedWallet.EmailOTP.cs | 0 .../EmbeddedWallet/EmbeddedWallet.JWT.cs | 0 .../EmbeddedWallet/EmbeddedWallet.Misc.cs | 0 .../EmbeddedWallet/EmbeddedWallet.OAuth.cs | 0 .../EmbeddedWallet/EmbeddedWallet.PhoneOTP.cs | 0 .../EmbeddedWallet/EmbeddedWallet.cs | 0 .../InAppWallet.cs} | 21 +- .../PrivateKeyWallet.cs} | 8 +- .../SmartWallet.cs} | 23 +- .../Thirdweb.AccountAbstraction/AATypes.cs | 0 .../BundlerClient.cs | 0 codecov.yml | 2 +- 33 files changed, 201 insertions(+), 216 deletions(-) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Authentication/AWS.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Authentication/Server.Types.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Authentication/Server.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Encryption/IvGenerator.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Encryption/Secrets.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Exceptions/VerificationException.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Models/User.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Models/UserStatus.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Storage/LocalStorage.Types.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet.Storage/LocalStorage.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.AuthEndpoint.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.EmailOTP.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.JWT.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.Misc.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.OAuth.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.PhoneOTP.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount => InAppWallet}/EmbeddedWallet/EmbeddedWallet.cs (100%) rename Thirdweb/Thirdweb.Wallets/{EmbeddedAccount/EmbeddedAccount.cs => InAppWallet/InAppWallet.cs} (81%) rename Thirdweb/Thirdweb.Wallets/{PrivateKeyAccount/PrivateKeyAccount.cs => PrivateKeyWallet/PrivateKeyWallet.cs} (94%) rename Thirdweb/Thirdweb.Wallets/{SmartAccount/SmartAccount.cs => SmartWallet/SmartWallet.cs} (99%) rename Thirdweb/Thirdweb.Wallets/{SmartAccount => SmartWallet}/Thirdweb.AccountAbstraction/AATypes.cs (100%) rename Thirdweb/Thirdweb.Wallets/{SmartAccount => SmartWallet}/Thirdweb.AccountAbstraction/BundlerClient.cs (100%) diff --git a/README.md b/README.md index dc885c0..222562a 100644 --- a/README.md +++ b/README.md @@ -34,42 +34,42 @@ var contract = await ThirdwebContract.Create(client: client, address: "0x81ebd23 var readResult = await ThirdwebContract.Read(contract, "name"); Console.WriteLine($"Contract read result: {readResult}"); -// Create embedded account as signer to unlock web2 auth -var embeddedAccount = await EmbeddedAccount.Create(client: client, email: "email@email.com"); // or email: null, phoneNumber: "+1234567890" +// Create InAppWallet wallet as signer to unlock web2 auth +var inAppWallet = await InAppWallet.Create(client: client, email: "email@email.com"); // or email: null, phoneNumber: "+1234567890" -// Relog if embedded account not logged in -if (!await embeddedAccount.IsConnected()) +// Relog if InAppWallet wallet not logged in +if (!await inAppWallet.IsConnected()) { - await embeddedAccount.SendOTP(); + await inAppWallet.SendOTP(); Console.WriteLine("Please submit the OTP."); var otp = Console.ReadLine(); - (var embeddedAccountAddress, var canRetry) = await embeddedAccount.SubmitOTP(otp); - if (embeddedAccountAddress == null && canRetry) + (var inAppWalletAddress, var canRetry) = await inAppWallet.SubmitOTP(otp); + if (inAppWalletAddress == null && canRetry) { Console.WriteLine("Please submit the OTP again."); otp = Console.ReadLine(); - (embeddedAccountAddress, _) = await embeddedAccount.SubmitOTP(otp); + (inAppWalletAddress, _) = await inAppWallet.SubmitOTP(otp); } - if (embeddedAccountAddress == null) + if (inAppWalletAddress == null) { Console.WriteLine("OTP login failed. Please try again."); return; } } -// 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); +// Create a smart wallet to unlock gasless features, with InAppWallet as a signer +var smartWallet = await SmartWallet.Create(client: client, personalWallet: inAppWallet, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); // Log addresses -Console.WriteLine($"Embedded Account: {await embeddedAccount.GetAddress()}"); -Console.WriteLine($"Smart Account: {await smartAccount.GetAddress()}"); +Console.WriteLine($"InAppWallet: {await inAppWallet.GetAddress()}"); +Console.WriteLine($"Smart Wallet: {await smartWallet.GetAddress()}"); // Sign, triggering deploy as needed and 1271 verification if it's a smart wallet var message = "Hello, Thirdweb!"; -var signature = await smartAccount.PersonalSign(message); +var signature = await smartWallet.PersonalSign(message); Console.WriteLine($"Signed message: {signature}"); -var writeResult = await ThirdwebContract.Write(smartAccount, contract, "mintTo", 0, await smartAccount.GetAddress(), 100); +var writeResult = await ThirdwebContract.Write(smartWallet, contract, "mintTo", 0, await smartWallet.GetAddress(), 100); Console.WriteLine($"Contract write result: {writeResult}"); ``` @@ -80,7 +80,7 @@ using Thirdweb; // Do not use secret keys client side, use client id/bundle id instead var secretKey = Environment.GetEnvironmentVariable("THIRDWEB_SECRET_KEY"); -// Do not use private keys client side, use embedded/smart accounts instead +// Do not use private keys client side, use InAppWallet/SmartWallet instead var privateKey = Environment.GetEnvironmentVariable("PRIVATE_KEY"); // Fetch timeout options are optional, default is 60000ms @@ -90,40 +90,42 @@ var contract = await ThirdwebContract.Create(client: client, address: "0x81ebd23 var readResult = await ThirdwebContract.Read(contract, "name"); Console.WriteLine($"Contract read result: {readResult}"); -// 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@email.com"); // or email: null, phoneNumber: "+1234567890" -var smartAccount = await SmartAccount.Create(client: client, personalAccount: embeddedAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); +// Create wallets (this is an advanced use case, typically one wallet is plenty) +var privateKeyWallet = await PrivateKeyWallet.Create(client: client, privateKeyHex: privateKey); +var inAppWallet = await InAppWallet.Create(client: client, email: "email@email.com"); // or email: null, phoneNumber: "+1234567890" -// // Reset embedded account (optional step for testing login flow) -// if (await embeddedAccount.IsConnected()) +// // Reset InAppWallet (optional step for testing login flow) +// if (await inAppWallet.IsConnected()) // { -// await embeddedAccount.Disconnect(); +// await inAppWallet.Disconnect(); // } -// Relog if embedded account not logged in -if (!await embeddedAccount.IsConnected()) +// Relog if InAppWallet not logged in +if (!await inAppWallet.IsConnected()) { - await embeddedAccount.SendOTP(); + await inAppWallet.SendOTP(); Console.WriteLine("Please submit the OTP."); var otp = Console.ReadLine(); - (var embeddedAccountAddress, var canRetry) = await embeddedAccount.SubmitOTP(otp); - if (embeddedAccountAddress == null && canRetry) + (var inAppWalletAddress, var canRetry) = await inAppWallet.SubmitOTP(otp); + if (inAppWalletAddress == null && canRetry) { Console.WriteLine("Please submit the OTP again."); otp = Console.ReadLine(); - (embeddedAccountAddress, _) = await embeddedAccount.SubmitOTP(otp); + (inAppWalletAddress, _) = await inAppWallet.SubmitOTP(otp); } - if (embeddedAccountAddress == null) + if (inAppWalletAddress == null) { Console.WriteLine("OTP login failed. Please try again."); return; } } -// 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(), +// Create smart wallet with InAppWallet signer +var smartWallet = await SmartWallet.Create(client: client, personalWallet: inAppWallet, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); + +// Connect the smart wallet with InAppWallet signer and grant a session key to pk wallet (advanced use case) +_ = await smartWallet.CreateSessionKey( + signerAddress: await privateKeyWallet.GetAddress(), approvedTargets: new List() { Constants.ADDRESS_ZERO }, nativeTokenLimitPerTransactionInWei: "0", permissionStartTimestamp: "0", @@ -132,33 +134,33 @@ _ = await smartAccount.CreateSessionKey( reqValidityEndTimestamp: Utils.GetUnixTimeStampIn10Years().ToString() ); -// Reconnect to same smart account with pk account as signer (specifying account address override) -smartAccount = await SmartAccount.Create( +// Reconnect to same smart wallet with pk wallet as signer (specifying wallet address override) +smartWallet = await SmartWallet.Create( client: client, - personalAccount: privateKeyAccount, + personalWallet: privateKeyWallet, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614, - accountAddressOverride: await smartAccount.GetAddress() + accountAddressOverride: await smartWallet.GetAddress() ); // Log addresses -Console.WriteLine($"PrivateKey Account: {await privateKeyAccount.GetAddress()}"); -Console.WriteLine($"Embedded Account: {await embeddedAccount.GetAddress()}"); -Console.WriteLine($"Smart Account: {await smartAccount.GetAddress()}"); +Console.WriteLine($"PrivateKey Wallet: {await privateKeyWallet.GetAddress()}"); +Console.WriteLine($"InAppWallet: {await inAppWallet.GetAddress()}"); +Console.WriteLine($"Smart Wallet: {await smartWallet.GetAddress()}"); // Sign, triggering deploy as needed and 1271 verification if it's a smart wallet var message = "Hello, Thirdweb!"; -var signature = await smartAccount.PersonalSign(message); +var signature = await smartWallet.PersonalSign(message); Console.WriteLine($"Signed message: {signature}"); -var balanceBefore = await ThirdwebContract.Read(contract, "balanceOf", await smartAccount.GetAddress()); +var balanceBefore = await ThirdwebContract.Read(contract, "balanceOf", await smartWallet.GetAddress()); Console.WriteLine($"Balance before mint: {balanceBefore}"); -var writeResult = await ThirdwebContract.Write(smartAccount, contract, "mintTo", 0, await smartAccount.GetAddress(), 100); +var writeResult = await ThirdwebContract.Write(smartWallet, contract, "mintTo", 0, await smartWallet.GetAddress(), 100); Console.WriteLine($"Contract write result: {writeResult}"); -var balanceAfter = await ThirdwebContract.Read(contract, "balanceOf", await smartAccount.GetAddress()); +var balanceAfter = await ThirdwebContract.Read(contract, "balanceOf", await smartWallet.GetAddress()); Console.WriteLine($"Balance after mint: {balanceAfter}"); // Storage actions diff --git a/Thirdweb.Console/Program.cs b/Thirdweb.Console/Program.cs index e4bf172..318a83d 100644 --- a/Thirdweb.Console/Program.cs +++ b/Thirdweb.Console/Program.cs @@ -1,113 +1,108 @@ using System.Numerics; -using dotenv.net; using Thirdweb; +using dotenv.net; + +DotEnv.Load(); + +// Do not use secret keys client side, use client id/bundle id instead +var secretKey = Environment.GetEnvironmentVariable("THIRDWEB_SECRET_KEY"); + +// Do not use private keys client side, use InAppWallet/SmartWallet instead +var privateKey = Environment.GetEnvironmentVariable("PRIVATE_KEY"); + +// Fetch timeout options are optional, default is 60000ms +var client = ThirdwebClient.Create(secretKey: secretKey, fetchTimeoutOptions: new TimeoutOptions(storage: 30000, rpc: 60000)); -internal class Program +var contract = await ThirdwebContract.Create(client: client, address: "0x81ebd23aA79bCcF5AaFb9c9c5B0Db4223c39102e", chain: 421614); +var readResult = await ThirdwebContract.Read(contract, "name"); +Console.WriteLine($"Contract read result: {readResult}"); + +// Create wallets (this is an advanced use case, typically one wallet is plenty) +var privateKeyWallet = await PrivateKeyWallet.Create(client: client, privateKeyHex: privateKey); +var inAppWallet = await InAppWallet.Create(client: client, email: "firekeeper+7121271d@thirdweb.com"); // or email: null, phoneNumber: "+1234567890" + +// // Reset InAppWallet (optional step for testing login flow) +// if (await inAppWallet.IsConnected()) +// { +// await inAppWallet.Disconnect(); +// } + +// Relog if InAppWallet not logged in +if (!await inAppWallet.IsConnected()) { - private static async Task Main(string[] args) + 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) { - DotEnv.Load(); - - // Do not use secret keys client side, use client id/bundle id instead - var secretKey = Environment.GetEnvironmentVariable("THIRDWEB_SECRET_KEY"); - // Do not use private keys client side, use embedded/smart accounts instead - var privateKey = Environment.GetEnvironmentVariable("PRIVATE_KEY"); - - // Fetch timeout options are optional, default is 60000ms - var client = ThirdwebClient.Create(secretKey: secretKey, fetchTimeoutOptions: new TimeoutOptions(storage: 30000, rpc: 60000)); - - var contract = await ThirdwebContract.Create(client: client, address: "0x81ebd23aA79bCcF5AaFb9c9c5B0Db4223c39102e", chain: 421614); - var readResult = await ThirdwebContract.Read(contract, "name"); - Console.WriteLine($"Contract read result: {readResult}"); - - // 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: "firekeeper+7121271d@thirdweb.com"); // or email: null, phoneNumber: "+1234567890" - - // // Reset embedded account (optional step for testing login flow) - // if (await embeddedAccount.IsConnected()) - // { - // await embeddedAccount.Disconnect(); - // } - - // Relog if embedded account not logged in - if (!await embeddedAccount.IsConnected()) - { - await embeddedAccount.SendOTP(); - Console.WriteLine("Please submit the OTP."); - var otp = Console.ReadLine(); - (var embeddedAccountAddress, var canRetry) = await embeddedAccount.SubmitOTP(otp); - if (embeddedAccountAddress == null && canRetry) - { - Console.WriteLine("Please submit the OTP again."); - otp = Console.ReadLine(); - (embeddedAccountAddress, _) = await embeddedAccount.SubmitOTP(otp); - } - if (embeddedAccountAddress == null) - { - Console.WriteLine("OTP login failed. Please try again."); - return; - } - } - - // 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(), - approvedTargets: new List() { Constants.ADDRESS_ZERO }, - nativeTokenLimitPerTransactionInWei: "0", - permissionStartTimestamp: "0", - permissionEndTimestamp: (Utils.GetUnixTimeStampNow() + 86400).ToString(), - reqValidityStartTimestamp: "0", - reqValidityEndTimestamp: Utils.GetUnixTimeStampIn10Years().ToString() - ); - - // Reconnect to same smart account with pk account as signer (specifying account address override) - smartAccount = await SmartAccount.Create( - client: client, - personalAccount: privateKeyAccount, - factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", - gasless: true, - chainId: 421614, - accountAddressOverride: await smartAccount.GetAddress() - ); - - // Log addresses - Console.WriteLine($"PrivateKey Account: {await privateKeyAccount.GetAddress()}"); - Console.WriteLine($"Embedded Account: {await embeddedAccount.GetAddress()}"); - Console.WriteLine($"Smart Account: {await smartAccount.GetAddress()}"); - - // Sign, triggering deploy as needed and 1271 verification if it's a smart wallet - var message = "Hello, Thirdweb!"; - var signature = await smartAccount.PersonalSign(message); - Console.WriteLine($"Signed message: {signature}"); - - var balanceBefore = await ThirdwebContract.Read(contract, "balanceOf", await smartAccount.GetAddress()); - Console.WriteLine($"Balance before mint: {balanceBefore}"); - - var writeResult = await ThirdwebContract.Write(smartAccount, contract, "mintTo", 0, await smartAccount.GetAddress(), 100); - Console.WriteLine($"Contract write result: {writeResult}"); - - var balanceAfter = await ThirdwebContract.Read(contract, "balanceOf", await smartAccount.GetAddress()); - Console.WriteLine($"Balance after mint: {balanceAfter}"); - - // Storage actions - - // // Will download from IPFS or normal urls - // var downloadResult = await ThirdwebStorage.Download(client: client, uri: "AnyUrlIncludingIpfs"); - // Console.WriteLine($"Download result: {downloadResult}"); - - // // Will upload to IPFS - // var uploadResult = await ThirdwebStorage.Upload(client: client, path: "AnyPath"); - // Console.WriteLine($"Upload result preview: {uploadResult.PreviewUrl}"); - - - // Access RPC directly if needed, generally not recommended - - // var rpc = ThirdwebRPC.GetRpcInstance(client, 421614); - // var blockNumber = await rpc.SendRequestAsync("eth_blockNumber"); - // Console.WriteLine($"Block number: {blockNumber}"); + 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; } } + +// Create smart wallet with InAppWallet signer +var smartWallet = await SmartWallet.Create(client: client, personalWallet: inAppWallet, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); + +// Grant a session key to pk wallet (advanced use case) +_ = await smartWallet.CreateSessionKey( + signerAddress: await privateKeyWallet.GetAddress(), + approvedTargets: new List() { Constants.ADDRESS_ZERO }, + nativeTokenLimitPerTransactionInWei: "0", + permissionStartTimestamp: "0", + permissionEndTimestamp: (Utils.GetUnixTimeStampNow() + 86400).ToString(), + reqValidityStartTimestamp: "0", + reqValidityEndTimestamp: Utils.GetUnixTimeStampIn10Years().ToString() +); + +// Reconnect to same smart wallet with pk wallet as signer (specifying wallet address override) +smartWallet = await SmartWallet.Create( + client: client, + personalWallet: privateKeyWallet, + factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", + gasless: true, + chainId: 421614, + accountAddressOverride: await smartWallet.GetAddress() +); + +// Log addresses +Console.WriteLine($"PrivateKey Wallet: {await privateKeyWallet.GetAddress()}"); +Console.WriteLine($"InAppWallet: {await inAppWallet.GetAddress()}"); +Console.WriteLine($"Smart Wallet: {await smartWallet.GetAddress()}"); + +// Sign, triggering deploy as needed and 1271 verification if it's a smart wallet +var message = "Hello, Thirdweb!"; +var signature = await smartWallet.PersonalSign(message); +Console.WriteLine($"Signed message: {signature}"); + +var balanceBefore = await ThirdwebContract.Read(contract, "balanceOf", await smartWallet.GetAddress()); +Console.WriteLine($"Balance before mint: {balanceBefore}"); + +var writeResult = await ThirdwebContract.Write(smartWallet, contract, "mintTo", 0, await smartWallet.GetAddress(), 100); +Console.WriteLine($"Contract write result: {writeResult}"); + +var balanceAfter = await ThirdwebContract.Read(contract, "balanceOf", await smartWallet.GetAddress()); +Console.WriteLine($"Balance after mint: {balanceAfter}"); + +// Storage actions + +// // Will download from IPFS or normal urls +// var downloadResult = await ThirdwebStorage.Download(client: client, uri: "AnyUrlIncludingIpfs"); +// Console.WriteLine($"Download result: {downloadResult}"); + +// // Will upload to IPFS +// var uploadResult = await ThirdwebStorage.Upload(client: client, path: "AnyPath"); +// Console.WriteLine($"Upload result preview: {uploadResult.PreviewUrl}"); + + +// Access RPC directly if needed, generally not recommended + +// var rpc = ThirdwebRPC.GetRpcInstance(client, 421614); +// var blockNumber = await rpc.SendRequestAsync("eth_blockNumber"); +// Console.WriteLine($"Block number: {blockNumber}"); diff --git a/Thirdweb.Tests/Thirdweb.Contracts.Tests.cs b/Thirdweb.Tests/Thirdweb.Contracts.Tests.cs index d782521..0430c3c 100644 --- a/Thirdweb.Tests/Thirdweb.Contracts.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Contracts.Tests.cs @@ -109,7 +109,7 @@ public async Task WriteTest_SmartAccount() public async Task WriteTest_PrivateKeyAccount() { var contract = await GetContract(); - var privateKeyAccount = await PrivateKeyAccount.Create(contract.Client, _testPrivateKey); + var privateKeyAccount = await PrivateKeyWallet.Create(contract.Client, _testPrivateKey); var receiver = await privateKeyAccount.GetAddress(); var quantity = BigInteger.One; var currency = Constants.NATIVE_TOKEN_ADDRESS; @@ -122,11 +122,11 @@ public async Task WriteTest_PrivateKeyAccount() Assert.Contains("insufficient funds", exception.Message); } - private async Task GetAccount() + private async Task GetAccount() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); - var smartAccount = await SmartAccount.Create(client, personalAccount: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); + var smartAccount = await SmartWallet.Create(client, personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); return smartAccount; } diff --git a/Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs b/Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs index 4f4b7d1..f4540e2 100644 --- a/Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs @@ -9,10 +9,10 @@ public class PrivateKeyAccountTests : BaseTests public PrivateKeyAccountTests(ITestOutputHelper output) : base(output) { } - private async Task GetAccount() + private async Task GetAccount() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client: client, privateKeyHex: _testPrivateKey); + var privateKeyAccount = await PrivateKeyWallet.Create(client: client, privateKeyHex: _testPrivateKey); return privateKeyAccount; } @@ -27,7 +27,7 @@ public async Task Initialization_Success() public async void Initialization_NullPrivateKey() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var ex = await Assert.ThrowsAsync(async () => await PrivateKeyAccount.Create(client, null)); + var ex = await Assert.ThrowsAsync(async () => await PrivateKeyWallet.Create(client, null)); Assert.Equal("Private key cannot be null or empty. (Parameter 'privateKeyHex')", ex.Message); } diff --git a/Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs b/Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs index 14f01e2..de875c4 100644 --- a/Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs @@ -9,11 +9,11 @@ public class SmartAccountTests : BaseTests public SmartAccountTests(ITestOutputHelper output) : base(output) { } - private async Task GetSmartAccount() + private async Task GetSmartAccount() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); - var smartAccount = await SmartAccount.Create(client, personalAccount: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); + var smartAccount = await SmartWallet.Create(client, personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); return smartAccount; } @@ -28,10 +28,10 @@ public async Task Initialization_Success() public async Task Initialization_Fail() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); await privateKeyAccount.Disconnect(); var ex = await Assert.ThrowsAsync( - async () => await SmartAccount.Create(client, personalAccount: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614) + async () => await SmartWallet.Create(client, personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614) ); Assert.Equal("SmartAccount.Connect: Personal account must be connected.", ex.Message); } @@ -47,10 +47,10 @@ public async Task IsDeployed_True() public async Task IsDeployed_False() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); - var smartAccount = await SmartAccount.Create( + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); + var smartAccount = await SmartWallet.Create( client, - personalAccount: privateKeyAccount, + personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614, @@ -78,8 +78,8 @@ public async Task SendTransaction_Success() public async Task SendTransaction_ClientBundleId_Success() { var client = ThirdwebClient.Create(clientId: _clientIdBundleIdOnly, bundleId: _bundleIdBundleIdOnly); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); - var smartAccount = await SmartAccount.Create(client, personalAccount: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); + var smartAccount = await SmartWallet.Create(client, personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); var tx = await smartAccount.SendTransaction( new TransactionInput() { @@ -113,17 +113,17 @@ public async Task GetPersonalAccount() var account = await GetSmartAccount(); var personalAccount = await account.GetPersonalAccount(); Assert.NotNull(personalAccount); - _ = Assert.IsType(personalAccount); + _ = Assert.IsType(personalAccount); } [Fact] public async Task GetAddress_WithOverride() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); - var smartAccount = await SmartAccount.Create( + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); + var smartAccount = await SmartWallet.Create( client, - personalAccount: privateKeyAccount, + personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614, diff --git a/Thirdweb.Tests/Thirdweb.Wallets.Tests.cs b/Thirdweb.Tests/Thirdweb.Wallets.Tests.cs index 28a79ef..5aec1aa 100644 --- a/Thirdweb.Tests/Thirdweb.Wallets.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.Wallets.Tests.cs @@ -8,11 +8,11 @@ public class WalletTests : BaseTests public WalletTests(ITestOutputHelper output) : base(output) { } - private async Task GetAccount() + private async Task GetAccount() { var client = ThirdwebClient.Create(secretKey: _secretKey); - var privateKeyAccount = await PrivateKeyAccount.Create(client, _testPrivateKey); - var smartAccount = await SmartAccount.Create(client, personalAccount: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); + var privateKeyAccount = await PrivateKeyWallet.Create(client, _testPrivateKey); + var smartAccount = await SmartWallet.Create(client, personalWallet: privateKeyAccount, factoryAddress: "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052", gasless: true, chainId: 421614); return smartAccount; } diff --git a/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs b/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs index 48c92c2..3f3b3b7 100644 --- a/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs +++ b/Thirdweb/Thirdweb.Contracts/ThirdwebContract.cs @@ -63,7 +63,7 @@ public static async Task Read(ThirdwebContract contract, string method, pa return function.DecodeTypeOutput(resultData); } - public static async Task Write(IThirdwebAccount account, ThirdwebContract contract, string method, BigInteger weiValue, params object[] parameters) + public static async Task Write(IThirdwebWallet wallet, ThirdwebContract contract, string method, BigInteger weiValue, params object[] parameters) { var rpc = ThirdwebRPC.GetRpcInstance(contract.Client, contract.Chain); @@ -73,7 +73,7 @@ public static async Task Write(IThirdwebAccount account, ThirdwebContrac var transaction = new TransactionInput { - From = await account.GetAddress(), + From = await wallet.GetAddress(), To = contract.Address, Data = data, }; @@ -85,15 +85,15 @@ public static async Task Write(IThirdwebAccount account, ThirdwebContrac transaction.Value = new HexBigInteger(weiValue); string hash; - switch (account.AccountType) + switch (wallet.AccountType) { case ThirdwebAccountType.PrivateKeyAccount: - transaction.Nonce = new HexBigInteger(await rpc.SendRequestAsync("eth_getTransactionCount", await account.GetAddress(), "latest")); - var signedTx = await account.SignTransaction(transaction, contract.Chain); + transaction.Nonce = new HexBigInteger(await rpc.SendRequestAsync("eth_getTransactionCount", await wallet.GetAddress(), "latest")); + var signedTx = await wallet.SignTransaction(transaction, contract.Chain); hash = await rpc.SendRequestAsync("eth_sendRawTransaction", signedTx); break; case ThirdwebAccountType.SmartAccount: - var smartAccount = account as SmartAccount; + var smartAccount = wallet as SmartWallet; hash = await smartAccount.SendTransaction(transaction); break; default: diff --git a/Thirdweb/Thirdweb.Wallets/EIP712.cs b/Thirdweb/Thirdweb.Wallets/EIP712.cs index 5071322..f845b3b 100644 --- a/Thirdweb/Thirdweb.Wallets/EIP712.cs +++ b/Thirdweb/Thirdweb.Wallets/EIP712.cs @@ -11,7 +11,7 @@ public async static Task GenerateSignature_SmartAccount( BigInteger chainId, string verifyingContract, AccountAbstraction.SignerPermissionRequest signerPermissionRequest, - IThirdwebAccount signer + IThirdwebWallet signer ) { var typedData = GetTypedDefinition_SmartAccount(domainName, version, chainId, verifyingContract); @@ -24,7 +24,7 @@ public async static Task GenerateSignature_SmartAccount_AccountMessage( BigInteger chainId, string verifyingContract, byte[] message, - IThirdwebAccount signer + IThirdwebWallet signer ) { var typedData = GetTypedDefinition_SmartAccount_AccountMessage(domainName, version, chainId, verifyingContract); diff --git a/Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs b/Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs index 2ea5ef5..4d03811 100644 --- a/Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs +++ b/Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs @@ -4,7 +4,7 @@ namespace Thirdweb { - public interface IThirdwebAccount + public interface IThirdwebWallet { public ThirdwebAccountType AccountType { get; } public Task GetAddress(); diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Authentication/AWS.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Authentication/AWS.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/AWS.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Authentication/Server.Types.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.Types.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Authentication/Server.Types.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.Types.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Authentication/Server.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Authentication/Server.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/EmbeddedWallet.Cryptography.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Encryption/IvGenerator.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/IvGenerator.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Encryption/IvGenerator.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/IvGenerator.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Encryption/Secrets.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Encryption/Secrets.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Encryption/Secrets.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Exceptions/VerificationException.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Exceptions/VerificationException.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Exceptions/VerificationException.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Models/User.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Models/User.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Models/User.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Models/User.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Models/UserStatus.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Models/UserStatus.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Models/UserStatus.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Models/UserStatus.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Storage/LocalStorage.Types.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Storage/LocalStorage.Types.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Storage/LocalStorage.Types.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Storage/LocalStorage.Types.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Storage/LocalStorage.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Storage/LocalStorage.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet.Storage/LocalStorage.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Storage/LocalStorage.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.AuthEndpoint.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AuthEndpoint.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.AuthEndpoint.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.AuthEndpoint.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.EmailOTP.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.EmailOTP.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.EmailOTP.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.EmailOTP.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.JWT.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.JWT.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.JWT.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.JWT.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.Misc.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.Misc.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.Misc.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.Misc.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.OAuth.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.OAuth.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.OAuth.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.OAuth.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.PhoneOTP.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.PhoneOTP.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.PhoneOTP.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.PhoneOTP.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedWallet/EmbeddedWallet.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet/EmbeddedWallet.cs diff --git a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedAccount.cs b/Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.cs similarity index 81% rename from Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedAccount.cs rename to Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.cs index ceb7300..081d9c6 100644 --- a/Thirdweb/Thirdweb.Wallets/EmbeddedAccount/EmbeddedAccount.cs +++ b/Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.cs @@ -1,24 +1,15 @@ -using System.Numerics; -using System.Text; -using Nethereum.ABI.EIP712; -using Nethereum.Hex.HexConvertors.Extensions; -using Nethereum.Hex.HexTypes; -using Nethereum.Model; -using Nethereum.RPC.Eth.DTOs; -using Nethereum.RPC.Eth.Mappers; using Nethereum.Signer; -using Nethereum.Signer.EIP712; using Thirdweb.EWS; namespace Thirdweb { - public class EmbeddedAccount : PrivateKeyAccount + public class InAppWallet : PrivateKeyWallet { internal EmbeddedWallet _embeddedWallet; internal string _email; internal string _phoneNumber; - internal EmbeddedAccount(ThirdwebClient client, string email, string phoneNumber, EmbeddedWallet embeddedWallet, EthECKey ecKey) + internal InAppWallet(ThirdwebClient client, string email, string phoneNumber, EmbeddedWallet embeddedWallet, EthECKey ecKey) : base(client, ecKey) { _email = email; @@ -26,7 +17,7 @@ internal EmbeddedAccount(ThirdwebClient client, string email, string phoneNumber _embeddedWallet = embeddedWallet; } - public static async Task Create(ThirdwebClient client, string email = null, string phoneNumber = null) + public static async Task Create(ThirdwebClient client, string email = null, string phoneNumber = null) { if (string.IsNullOrEmpty(email) && string.IsNullOrEmpty(phoneNumber)) { @@ -42,10 +33,10 @@ public static async Task Create(ThirdwebClient client, string e } catch { - Console.WriteLine("User not found. Please call EmbeddedAccount.SendOTP() to initialize the login process."); + Console.WriteLine("User not found. Please call InAppWallet.SendOTP() to initialize the login process."); ecKey = null; } - return new EmbeddedAccount(client, email, phoneNumber, embeddedWallet, ecKey); + return new InAppWallet(client, email, phoneNumber, embeddedWallet, ecKey); } public override async Task Disconnect() @@ -78,7 +69,7 @@ public async Task SendOTP() throw new Exception("Email or Phone Number must be provided to login."); } - Console.WriteLine("OTP sent to user. Please call EmbeddedAccount.SubmitOTP to login."); + Console.WriteLine("OTP sent to user. Please call InAppWallet.SubmitOTP to login."); } catch (Exception e) { diff --git a/Thirdweb/Thirdweb.Wallets/PrivateKeyAccount/PrivateKeyAccount.cs b/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs similarity index 94% rename from Thirdweb/Thirdweb.Wallets/PrivateKeyAccount/PrivateKeyAccount.cs rename to Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs index bd5e921..75662eb 100644 --- a/Thirdweb/Thirdweb.Wallets/PrivateKeyAccount/PrivateKeyAccount.cs +++ b/Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs @@ -11,24 +11,24 @@ namespace Thirdweb { - public class PrivateKeyAccount : IThirdwebAccount + public class PrivateKeyWallet : IThirdwebWallet { public ThirdwebAccountType AccountType => ThirdwebAccountType.PrivateKeyAccount; protected ThirdwebClient _client; protected EthECKey _ecKey; - protected PrivateKeyAccount(ThirdwebClient client, EthECKey key) + protected PrivateKeyWallet(ThirdwebClient client, EthECKey key) { _client = client; _ecKey = key; } - public static Task Create(ThirdwebClient client, string privateKeyHex) + public static Task Create(ThirdwebClient client, string privateKeyHex) { return string.IsNullOrEmpty(privateKeyHex) ? throw new ArgumentNullException(nameof(privateKeyHex), "Private key cannot be null or empty.") - : Task.FromResult(new PrivateKeyAccount(client, new EthECKey(privateKeyHex))); + : Task.FromResult(new PrivateKeyWallet(client, new EthECKey(privateKeyHex))); } public virtual Task GetAddress() diff --git a/Thirdweb/Thirdweb.Wallets/SmartAccount/SmartAccount.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs similarity index 99% rename from Thirdweb/Thirdweb.Wallets/SmartAccount/SmartAccount.cs rename to Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs index 3b698b8..d08e406 100644 --- a/Thirdweb/Thirdweb.Wallets/SmartAccount/SmartAccount.cs +++ b/Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs @@ -4,20 +4,17 @@ using Nethereum.Contracts; using Nethereum.Hex.HexConvertors.Extensions; using Nethereum.Hex.HexTypes; -using Nethereum.JsonRpc.Client.RpcMessages; using Nethereum.RPC.Eth.DTOs; -using Nethereum.Signer; -using Newtonsoft.Json; using Thirdweb.AccountAbstraction; namespace Thirdweb { - public class SmartAccount : IThirdwebAccount + public class SmartWallet : IThirdwebWallet { public ThirdwebAccountType AccountType => ThirdwebAccountType.SmartAccount; protected ThirdwebClient _client; - protected IThirdwebAccount _personalAccount; + protected IThirdwebWallet _personalAccount; protected bool _gasless; protected ThirdwebContract _factoryContract; protected ThirdwebContract _accountContract; @@ -26,9 +23,9 @@ public class SmartAccount : IThirdwebAccount protected string _bundlerUrl; protected string _paymasterUrl; - protected SmartAccount( + protected SmartWallet( ThirdwebClient client, - IThirdwebAccount personalAccount, + IThirdwebWallet personalAccount, bool gasless, BigInteger chainId, string bundlerUrl, @@ -49,9 +46,9 @@ ThirdwebContract accountContract _accountContract = accountContract; } - public static async Task Create( + public static async Task Create( ThirdwebClient client, - IThirdwebAccount personalAccount, + IThirdwebWallet personalWallet, string factoryAddress, bool gasless, BigInteger chainId, @@ -61,7 +58,7 @@ public static async Task Create( string paymasterUrl = null ) { - if (!await personalAccount.IsConnected()) + if (!await personalWallet.IsConnected()) { throw new InvalidOperationException("SmartAccount.Connect: Personal account must be connected."); } @@ -82,7 +79,7 @@ public static async Task Create( chainId, "[{\"type\": \"constructor\",\"name\": \"\",\"inputs\": [{\"type\": \"address\",\"name\": \"_defaultAdmin\",\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"_entrypoint\",\"internalType\": \"contract IEntryPoint\"},{\"type\": \"tuple[]\",\"name\": \"_defaultExtensions\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension[]\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"error\",\"name\": \"InvalidCodeAtRange\",\"inputs\": [{\"type\": \"uint256\",\"name\": \"_size\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"_start\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"_end\",\"internalType\": \"uint256\"}],\"outputs\": []},{\"type\": \"error\",\"name\": \"WriteError\",\"inputs\": [],\"outputs\": []},{\"type\": \"event\",\"name\": \"AccountCreated\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"accountAdmin\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ContractURIUpdated\",\"inputs\": [{\"type\": \"string\",\"name\": \"prevURI\",\"indexed\": false,\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"newURI\",\"indexed\": false,\"internalType\": \"string\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ExtensionAdded\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"tuple\",\"name\": \"extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"indexed\": false,\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ExtensionRemoved\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"tuple\",\"name\": \"extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"indexed\": false,\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"ExtensionReplaced\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"tuple\",\"name\": \"extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"indexed\": false,\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"FunctionDisabled\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"indexed\": true,\"internalType\": \"bytes4\"},{\"type\": \"tuple\",\"name\": \"extMetadata\",\"components\": [{\"type\": \"string\",\"name\": \"name\",\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"metadataURI\",\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"internalType\": \"address\"}],\"indexed\": false,\"internalType\": \"struct IExtension.ExtensionMetadata\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"FunctionEnabled\",\"inputs\": [{\"type\": \"string\",\"name\": \"name\",\"indexed\": true,\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"indexed\": true,\"internalType\": \"bytes4\"},{\"type\": \"tuple\",\"name\": \"extFunction\",\"components\": [{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"internalType\": \"bytes4\"},{\"type\": \"string\",\"name\": \"functionSignature\",\"internalType\": \"string\"}],\"indexed\": false,\"internalType\": \"struct IExtension.ExtensionFunction\"},{\"type\": \"tuple\",\"name\": \"extMetadata\",\"components\": [{\"type\": \"string\",\"name\": \"name\",\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"metadataURI\",\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"internalType\": \"address\"}],\"indexed\": false,\"internalType\": \"struct IExtension.ExtensionMetadata\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"RoleAdminChanged\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"bytes32\",\"name\": \"previousAdminRole\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"bytes32\",\"name\": \"newAdminRole\",\"indexed\": true,\"internalType\": \"bytes32\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"RoleGranted\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"RoleRevoked\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"indexed\": true,\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"sender\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"SignerAdded\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"signer\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"event\",\"name\": \"SignerRemoved\",\"inputs\": [{\"type\": \"address\",\"name\": \"account\",\"indexed\": true,\"internalType\": \"address\"},{\"type\": \"address\",\"name\": \"signer\",\"indexed\": true,\"internalType\": \"address\"}],\"outputs\": [],\"anonymous\": false},{\"type\": \"fallback\",\"name\": \"\",\"inputs\": [],\"outputs\": [],\"stateMutability\": \"payable\"},{\"type\": \"function\",\"name\": \"DEFAULT_ADMIN_ROLE\",\"inputs\": [],\"outputs\": [{\"type\": \"bytes32\",\"name\": \"\",\"internalType\": \"bytes32\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"_disableFunctionInExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"_functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"accountImplementation\",\"inputs\": [],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"addExtension\",\"inputs\": [{\"type\": \"tuple\",\"name\": \"_extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"contractURI\",\"inputs\": [],\"outputs\": [{\"type\": \"string\",\"name\": \"\",\"internalType\": \"string\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"createAccount\",\"inputs\": [{\"type\": \"address\",\"name\": \"_admin\",\"internalType\": \"address\"},{\"type\": \"bytes\",\"name\": \"_data\",\"internalType\": \"bytes\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"defaultExtensions\",\"inputs\": [],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"disableFunctionInExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"},{\"type\": \"bytes4\",\"name\": \"_functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"enableFunctionInExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"},{\"type\": \"tuple\",\"name\": \"_function\",\"components\": [{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"internalType\": \"bytes4\"},{\"type\": \"string\",\"name\": \"functionSignature\",\"internalType\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"entrypoint\",\"inputs\": [],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAccounts\",\"inputs\": [{\"type\": \"uint256\",\"name\": \"_start\",\"internalType\": \"uint256\"},{\"type\": \"uint256\",\"name\": \"_end\",\"internalType\": \"uint256\"}],\"outputs\": [{\"type\": \"address[]\",\"name\": \"accounts\",\"internalType\": \"address[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAccountsOfSigner\",\"inputs\": [{\"type\": \"address\",\"name\": \"signer\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"address[]\",\"name\": \"accounts\",\"internalType\": \"address[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAddress\",\"inputs\": [{\"type\": \"address\",\"name\": \"_adminSigner\",\"internalType\": \"address\"},{\"type\": \"bytes\",\"name\": \"_data\",\"internalType\": \"bytes\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAllAccounts\",\"inputs\": [],\"outputs\": [{\"type\": \"address[]\",\"name\": \"\",\"internalType\": \"address[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getAllExtensions\",\"inputs\": [],\"outputs\": [{\"type\": \"tuple[]\",\"name\": \"allExtensions\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension[]\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"extensionName\",\"internalType\": \"string\"}],\"outputs\": [{\"type\": \"tuple\",\"name\": \"\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getImplementationForFunction\",\"inputs\": [{\"type\": \"bytes4\",\"name\": \"_functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getMetadataForFunction\",\"inputs\": [{\"type\": \"bytes4\",\"name\": \"functionSelector\",\"internalType\": \"bytes4\"}],\"outputs\": [{\"type\": \"tuple\",\"name\": \"\",\"components\": [{\"type\": \"string\",\"name\": \"name\",\"internalType\": \"string\"},{\"type\": \"string\",\"name\": \"metadataURI\",\"internalType\": \"string\"},{\"type\": \"address\",\"name\": \"implementation\",\"internalType\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getRoleAdmin\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"}],\"outputs\": [{\"type\": \"bytes32\",\"name\": \"\",\"internalType\": \"bytes32\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getRoleMember\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"uint256\",\"name\": \"index\",\"internalType\": \"uint256\"}],\"outputs\": [{\"type\": \"address\",\"name\": \"member\",\"internalType\": \"address\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"getRoleMemberCount\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"}],\"outputs\": [{\"type\": \"uint256\",\"name\": \"count\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"grantRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"hasRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"hasRoleWithSwitch\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"isRegistered\",\"inputs\": [{\"type\": \"address\",\"name\": \"_account\",\"internalType\": \"address\"}],\"outputs\": [{\"type\": \"bool\",\"name\": \"\",\"internalType\": \"bool\"}],\"stateMutability\": \"view\"},{\"type\": \"function\",\"name\": \"multicall\",\"inputs\": [{\"type\": \"bytes[]\",\"name\": \"data\",\"internalType\": \"bytes[]\"}],\"outputs\": [{\"type\": \"bytes[]\",\"name\": \"results\",\"internalType\": \"bytes[]\"}],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"onRegister\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"_salt\",\"internalType\": \"bytes32\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"onSignerAdded\",\"inputs\": [{\"type\": \"address\",\"name\": \"_signer\",\"internalType\": \"address\"},{\"type\": \"bytes32\",\"name\": \"_salt\",\"internalType\": \"bytes32\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"onSignerRemoved\",\"inputs\": [{\"type\": \"address\",\"name\": \"_signer\",\"internalType\": \"address\"},{\"type\": \"bytes32\",\"name\": \"_salt\",\"internalType\": \"bytes32\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"removeExtension\",\"inputs\": [{\"type\": \"string\",\"name\": \"_extensionName\",\"internalType\": \"string\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"renounceRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"replaceExtension\",\"inputs\": [{\"type\": \"tuple\",\"name\": \"_extension\",\"components\": [{\"type\": \"tuple\",\"name\": \"metadata\",\"components\": [{\"internalType\": \"string\",\"name\": \"name\",\"type\": \"string\"},{\"internalType\": \"string\",\"name\": \"metadataURI\",\"type\": \"string\"},{\"internalType\": \"address\",\"name\": \"implementation\",\"type\": \"address\"}],\"internalType\": \"struct IExtension.ExtensionMetadata\"},{\"type\": \"tuple[]\",\"name\": \"functions\",\"components\": [{\"internalType\": \"bytes4\",\"name\": \"functionSelector\",\"type\": \"bytes4\"},{\"internalType\": \"string\",\"name\": \"functionSignature\",\"type\": \"string\"}],\"internalType\": \"struct IExtension.ExtensionFunction[]\"}],\"internalType\": \"struct IExtension.Extension\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"revokeRole\",\"inputs\": [{\"type\": \"bytes32\",\"name\": \"role\",\"internalType\": \"bytes32\"},{\"type\": \"address\",\"name\": \"account\",\"internalType\": \"address\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"setContractURI\",\"inputs\": [{\"type\": \"string\",\"name\": \"_uri\",\"internalType\": \"string\"}],\"outputs\": [],\"stateMutability\": \"nonpayable\"},{\"type\": \"function\",\"name\": \"totalAccounts\",\"inputs\": [],\"outputs\": [{\"type\": \"uint256\",\"name\": \"\",\"internalType\": \"uint256\"}],\"stateMutability\": \"view\"}]" ); - var accountAddress = accountAddressOverride ?? await ThirdwebContract.Read(factoryContract, "getAddress", await personalAccount.GetAddress(), new byte[0]); + var accountAddress = accountAddressOverride ?? await ThirdwebContract.Read(factoryContract, "getAddress", await personalWallet.GetAddress(), new byte[0]); var accountContract = await ThirdwebContract.Create( client, accountAddress, @@ -90,7 +87,7 @@ public static async Task Create( "[{type: \"constructor\",inputs: [{name: \"_entrypoint\",type: \"address\",internalType: \"contract IEntryPoint\",},{ name: \"_factory\", type: \"address\", internalType: \"address\" },],stateMutability: \"nonpayable\",},{ type: \"receive\", stateMutability: \"payable\" },{type: \"function\",name: \"addDeposit\",inputs: [],outputs: [],stateMutability: \"payable\",},{type: \"function\",name: \"contractURI\",inputs: [],outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],stateMutability: \"view\",},{type: \"function\",name: \"entryPoint\",inputs: [],outputs: [{ name: \"\", type: \"address\", internalType: \"contract IEntryPoint\" },],stateMutability: \"view\",},{type: \"function\",name: \"execute\",inputs: [{ name: \"_target\", type: \"address\", internalType: \"address\" },{ name: \"_value\", type: \"uint256\", internalType: \"uint256\" },{ name: \"_calldata\", type: \"bytes\", internalType: \"bytes\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"executeBatch\",inputs: [{ name: \"_target\", type: \"address[]\", internalType: \"address[]\" },{ name: \"_value\", type: \"uint256[]\", internalType: \"uint256[]\" },{ name: \"_calldata\", type: \"bytes[]\", internalType: \"bytes[]\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"factory\",inputs: [],outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],stateMutability: \"view\",},{type: \"function\",name: \"getAllActiveSigners\",inputs: [],outputs: [{name: \"signers\",type: \"tuple[]\",internalType: \"struct IAccountPermissions.SignerPermissions[]\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{ name: \"startTimestamp\", type: \"uint128\", internalType: \"uint128\" },{ name: \"endTimestamp\", type: \"uint128\", internalType: \"uint128\" },],},],stateMutability: \"view\",},{type: \"function\",name: \"getAllAdmins\",inputs: [],outputs: [{ name: \"\", type: \"address[]\", internalType: \"address[]\" }],stateMutability: \"view\",},{type: \"function\",name: \"getAllSigners\",inputs: [],outputs: [{name: \"signers\",type: \"tuple[]\",internalType: \"struct IAccountPermissions.SignerPermissions[]\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{ name: \"startTimestamp\", type: \"uint128\", internalType: \"uint128\" },{ name: \"endTimestamp\", type: \"uint128\", internalType: \"uint128\" },],},],stateMutability: \"view\",},{type: \"function\",name: \"getMessageHash\",inputs: [{ name: \"_hash\", type: \"bytes32\", internalType: \"bytes32\" }],outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],stateMutability: \"view\",},{type: \"function\",name: \"getNonce\",inputs: [],outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],stateMutability: \"view\",},{type: \"function\",name: \"getPermissionsForSigner\",inputs: [{ name: \"signer\", type: \"address\", internalType: \"address\" }],outputs: [{name: \"\",type: \"tuple\",internalType: \"struct IAccountPermissions.SignerPermissions\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{ name: \"startTimestamp\", type: \"uint128\", internalType: \"uint128\" },{ name: \"endTimestamp\", type: \"uint128\", internalType: \"uint128\" },],},],stateMutability: \"view\",},{type: \"function\",name: \"initialize\",inputs: [{ name: \"_defaultAdmin\", type: \"address\", internalType: \"address\" },{ name: \"_data\", type: \"bytes\", internalType: \"bytes\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"isActiveSigner\",inputs: [{ name: \"signer\", type: \"address\", internalType: \"address\" }],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"isAdmin\",inputs: [{ name: \"_account\", type: \"address\", internalType: \"address\" }],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"isValidSignature\",inputs: [{ name: \"_hash\", type: \"bytes32\", internalType: \"bytes32\" },{ name: \"_signature\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"magicValue\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"view\",},{type: \"function\",name: \"isValidSigner\",inputs: [{ name: \"_signer\", type: \"address\", internalType: \"address\" },{name: \"_userOp\",type: \"tuple\",internalType: \"struct UserOperation\",components: [{ name: \"sender\", type: \"address\", internalType: \"address\" },{ name: \"nonce\", type: \"uint256\", internalType: \"uint256\" },{ name: \"initCode\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callGasLimit\", type: \"uint256\", internalType: \"uint256\" },{name: \"verificationGasLimit\",type: \"uint256\",internalType: \"uint256\",},{name: \"preVerificationGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"maxFeePerGas\", type: \"uint256\", internalType: \"uint256\" },{name: \"maxPriorityFeePerGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"paymasterAndData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"signature\", type: \"bytes\", internalType: \"bytes\" },],},],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"multicall\",inputs: [{ name: \"data\", type: \"bytes[]\", internalType: \"bytes[]\" }],outputs: [{ name: \"results\", type: \"bytes[]\", internalType: \"bytes[]\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"onERC1155BatchReceived\",inputs: [{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"uint256[]\", internalType: \"uint256[]\" },{ name: \"\", type: \"uint256[]\", internalType: \"uint256[]\" },{ name: \"\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"onERC1155Received\",inputs: [{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"uint256\", internalType: \"uint256\" },{ name: \"\", type: \"uint256\", internalType: \"uint256\" },{ name: \"\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"onERC721Received\",inputs: [{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"address\", internalType: \"address\" },{ name: \"\", type: \"uint256\", internalType: \"uint256\" },{ name: \"\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],stateMutability: \"nonpayable\",},{type: \"function\",name: \"setContractURI\",inputs: [{ name: \"_uri\", type: \"string\", internalType: \"string\" }],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"setEntrypointOverride\",inputs: [{name: \"_entrypointOverride\",type: \"address\",internalType: \"contract IEntryPoint\",},],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"setPermissionsForSigner\",inputs: [{name: \"_req\",type: \"tuple\",internalType: \"struct IAccountPermissions.SignerPermissionRequest\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{ name: \"isAdmin\", type: \"uint8\", internalType: \"uint8\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{name: \"permissionStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"permissionEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{ name: \"uid\", type: \"bytes32\", internalType: \"bytes32\" },],},{ name: \"_signature\", type: \"bytes\", internalType: \"bytes\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"function\",name: \"supportsInterface\",inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],stateMutability: \"view\",},{type: \"function\",name: \"validateUserOp\",inputs: [{name: \"userOp\",type: \"tuple\",internalType: \"struct UserOperation\",components: [{ name: \"sender\", type: \"address\", internalType: \"address\" },{ name: \"nonce\", type: \"uint256\", internalType: \"uint256\" },{ name: \"initCode\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"callGasLimit\", type: \"uint256\", internalType: \"uint256\" },{name: \"verificationGasLimit\",type: \"uint256\",internalType: \"uint256\",},{name: \"preVerificationGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"maxFeePerGas\", type: \"uint256\", internalType: \"uint256\" },{name: \"maxPriorityFeePerGas\",type: \"uint256\",internalType: \"uint256\",},{ name: \"paymasterAndData\", type: \"bytes\", internalType: \"bytes\" },{ name: \"signature\", type: \"bytes\", internalType: \"bytes\" },],},{ name: \"userOpHash\", type: \"bytes32\", internalType: \"bytes32\" },{ name: \"missingAccountFunds\", type: \"uint256\", internalType: \"uint256\" },],outputs: [{ name: \"validationData\", type: \"uint256\", internalType: \"uint256\" },],stateMutability: \"nonpayable\",},{type: \"function\",name: \"verifySignerPermissionRequest\",inputs: [{name: \"req\",type: \"tuple\",internalType: \"struct IAccountPermissions.SignerPermissionRequest\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{ name: \"isAdmin\", type: \"uint8\", internalType: \"uint8\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{name: \"permissionStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"permissionEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{ name: \"uid\", type: \"bytes32\", internalType: \"bytes32\" },],},{ name: \"signature\", type: \"bytes\", internalType: \"bytes\" },],outputs: [{ name: \"success\", type: \"bool\", internalType: \"bool\" },{ name: \"signer\", type: \"address\", internalType: \"address\" },],stateMutability: \"view\",},{type: \"function\",name: \"withdrawDepositTo\",inputs: [{name: \"withdrawAddress\",type: \"address\",internalType: \"address payable\",},{ name: \"amount\", type: \"uint256\", internalType: \"uint256\" },],outputs: [],stateMutability: \"nonpayable\",},{type: \"event\",name: \"AdminUpdated\",inputs: [{name: \"signer\",type: \"address\",indexed: true,internalType: \"address\",},{ name: \"isAdmin\", type: \"bool\", indexed: false, internalType: \"bool\" },],anonymous: false,},{type: \"event\",name: \"ContractURIUpdated\",inputs: [{name: \"prevURI\",type: \"string\",indexed: false,internalType: \"string\",},{name: \"newURI\",type: \"string\",indexed: false,internalType: \"string\",},],anonymous: false,},{type: \"event\",name: \"Initialized\",inputs: [{ name: \"version\", type: \"uint8\", indexed: false, internalType: \"uint8\" },],anonymous: false,},{type: \"event\",name: \"SignerPermissionsUpdated\",inputs: [{name: \"authorizingSigner\",type: \"address\",indexed: true,internalType: \"address\",},{name: \"targetSigner\",type: \"address\",indexed: true,internalType: \"address\",},{name: \"permissions\",type: \"tuple\",indexed: false,internalType: \"struct IAccountPermissions.SignerPermissionRequest\",components: [{ name: \"signer\", type: \"address\", internalType: \"address\" },{ name: \"isAdmin\", type: \"uint8\", internalType: \"uint8\" },{name: \"approvedTargets\",type: \"address[]\",internalType: \"address[]\",},{name: \"nativeTokenLimitPerTransaction\",type: \"uint256\",internalType: \"uint256\",},{name: \"permissionStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"permissionEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityStartTimestamp\",type: \"uint128\",internalType: \"uint128\",},{name: \"reqValidityEndTimestamp\",type: \"uint128\",internalType: \"uint128\",},{ name: \"uid\", type: \"bytes32\", internalType: \"bytes32\" },],},],anonymous: false,},]" ); - return new SmartAccount(client, personalAccount, gasless, chainId, bundlerUrl, paymasterUrl, entryPointContract, factoryContract, accountContract); + return new SmartWallet(client, personalWallet, gasless, chainId, bundlerUrl, paymasterUrl, entryPointContract, factoryContract, accountContract); } public async Task IsDeployed() @@ -252,7 +249,7 @@ public async Task ForceDeploy() _ = await Utils.GetTransactionReceipt(_client, _chainId, txHash); } - public Task GetPersonalAccount() + public Task GetPersonalAccount() { return Task.FromResult(_personalAccount); } diff --git a/Thirdweb/Thirdweb.Wallets/SmartAccount/Thirdweb.AccountAbstraction/AATypes.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/SmartAccount/Thirdweb.AccountAbstraction/AATypes.cs rename to Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/AATypes.cs diff --git a/Thirdweb/Thirdweb.Wallets/SmartAccount/Thirdweb.AccountAbstraction/BundlerClient.cs b/Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/SmartAccount/Thirdweb.AccountAbstraction/BundlerClient.cs rename to Thirdweb/Thirdweb.Wallets/SmartWallet/Thirdweb.AccountAbstraction/BundlerClient.cs diff --git a/codecov.yml b/codecov.yml index 397779e..68f4592 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,2 +1,2 @@ ignore: - - "Thirdweb/Thirdweb.Wallets/EmbeddedAccount" + - "Thirdweb/Thirdweb.Wallets/InAppWallet" From 0d4c1a5c6d00c5aa5607e8532c88b777687075b6 Mon Sep 17 00:00:00 2001 From: 0xFirekeeper <0xFirekeeper@gmail.com> Date: Wed, 10 Apr 2024 16:23:51 +0300 Subject: [PATCH 2/2] files --- ...KeyAccount.Tests.cs => Thirdweb.PrivateKeyWallet.Tests.cs} | 4 ++-- ...eb.SmartAccount.Tests.cs => Thirdweb.SmartWallet.Tests.cs} | 4 ++-- .../{IThirdwebAccount.cs => IThirdwebWallet.cs} | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename Thirdweb.Tests/{Thirdweb.PrivateKeyAccount.Tests.cs => Thirdweb.PrivateKeyWallet.Tests.cs} (99%) rename Thirdweb.Tests/{Thirdweb.SmartAccount.Tests.cs => Thirdweb.SmartWallet.Tests.cs} (98%) rename Thirdweb/Thirdweb.Wallets/{IThirdwebAccount.cs => IThirdwebWallet.cs} (100%) diff --git a/Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs b/Thirdweb.Tests/Thirdweb.PrivateKeyWallet.Tests.cs similarity index 99% rename from Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs rename to Thirdweb.Tests/Thirdweb.PrivateKeyWallet.Tests.cs index f4540e2..779930f 100644 --- a/Thirdweb.Tests/Thirdweb.PrivateKeyAccount.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.PrivateKeyWallet.Tests.cs @@ -4,9 +4,9 @@ namespace Thirdweb.Tests; -public class PrivateKeyAccountTests : BaseTests +public class PrivateKeyWalletTests : BaseTests { - public PrivateKeyAccountTests(ITestOutputHelper output) + public PrivateKeyWalletTests(ITestOutputHelper output) : base(output) { } private async Task GetAccount() diff --git a/Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs b/Thirdweb.Tests/Thirdweb.SmartWallet.Tests.cs similarity index 98% rename from Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs rename to Thirdweb.Tests/Thirdweb.SmartWallet.Tests.cs index de875c4..31923b2 100644 --- a/Thirdweb.Tests/Thirdweb.SmartAccount.Tests.cs +++ b/Thirdweb.Tests/Thirdweb.SmartWallet.Tests.cs @@ -4,9 +4,9 @@ namespace Thirdweb.Tests; -public class SmartAccountTests : BaseTests +public class SmartWalletTests : BaseTests { - public SmartAccountTests(ITestOutputHelper output) + public SmartWalletTests(ITestOutputHelper output) : base(output) { } private async Task GetSmartAccount() diff --git a/Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs b/Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs similarity index 100% rename from Thirdweb/Thirdweb.Wallets/IThirdwebAccount.cs rename to Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs