Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion Thirdweb.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
var client = ThirdwebClient.Create(secretKey: secretKey, fetchTimeoutOptions: new TimeoutOptions(storage: 120000, rpc: 120000, other: 120000));

// Create a private key wallet
var privateKeyWallet = await PrivateKeyWallet.Generate(client: client);
var privateKeyWallet = await PrivateKeyWallet.Generate(client);

// var walletAddress = await privateKeyWallet.GetAddress();
// Console.WriteLine($"PK Wallet address: {walletAddress}");
Expand Down Expand Up @@ -324,6 +324,31 @@

#endregion

#region ERC20 Smart Wallet - Celo Dollar

// var erc20SmartWallet = await SmartWallet.Create(
// personalWallet: privateKeyWallet,
// chainId: 42220, // celo mainnet
// gasless: true,
// factoryAddress: Constants.DEFAULT_FACTORY_ADDRESS_V07,
// entryPoint: Constants.ENTRYPOINT_ADDRESS_V07,
// tokenPaymaster: TokenPaymaster.CELO_CUSD
// );
// var erc20SmartWalletAddress = await erc20SmartWallet.GetAddress();
// Console.WriteLine($"ERC20 Smart Wallet address: {erc20SmartWalletAddress}");

// var selfTransfer = await ThirdwebTransaction.Create(wallet: erc20SmartWallet, txInput: new ThirdwebTransactionInput(chainId: 42220, to: erc20SmartWalletAddress, value: 0, data: "0x"));

// var estimateGas = await ThirdwebTransaction.EstimateGasCosts(selfTransfer);
// Console.WriteLine($"Self transfer gas estimate: {estimateGas.Ether}");
// Console.WriteLine("Make sure you have enough cUSD!");
// Console.ReadLine();

// var receipt = await ThirdwebTransaction.SendAndWaitForTransactionReceipt(selfTransfer);
// Console.WriteLine($"Self transfer receipt: {JsonConvert.SerializeObject(receipt, Formatting.Indented)}");

#endregion

#region Chain Data Fetching

// var chainData = await Utils.GetChainMetadata(client, 421614);
Expand Down Expand Up @@ -368,6 +393,21 @@

#endregion

#region InAppWallet - Email

// var inAppWalletEmail = await InAppWallet.Create(client: client, email: "[email protected]");
// if (!await inAppWalletEmail.IsConnected())
// {
// _ = await inAppWalletEmail.SendOTP();
// Console.WriteLine("Enter OTP:");
// var otp = Console.ReadLine();
// _ = await inAppWalletEmail.LoginWithOtp(otp);
// }
// var inAppWalletOAuthAddress = await inAppWalletEmail.GetAddress();
// Console.WriteLine($"InAppWallet address: {inAppWalletOAuthAddress}");

#endregion

#region Smart Wallet - Gasless Transaction

// var smartWallet = await SmartWallet.Create(privateKeyWallet, 78600);
Expand Down
11 changes: 11 additions & 0 deletions Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public enum TokenPaymaster
{
NONE,
BASE_USDC,
CELO_CUSD,
}

public class SmartWallet : IThirdwebWallet
Expand Down Expand Up @@ -70,6 +71,16 @@ private struct TokenPaymasterConfig
TokenAddress = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
BalanceStorageSlot = 9
}
},
{
TokenPaymaster.CELO_CUSD,
new TokenPaymasterConfig()
{
ChainId = 42220,
PaymasterAddress = "0x61382940b029f8Df0c9FfB12638f20EF6B526853",
TokenAddress = "0x765DE816845861e75A25fCA122bb6898B8B1282a",
BalanceStorageSlot = 9,
}
}
};

Expand Down
Loading