Releases: thirdweb-dev/dotnet
v2.21.0
[Beta] Your In-App Wallets can now be upgraded directly to an EIP7702 Smart Account with a simple creation flag!
With the recent Ethereum upgrade Pectra, EIP-7702 allows you - on chains that support it - to upgrade your EOA and get SmartWallet-like functionality with:
- Much cheaper gas costs, batching functionality
- No account separation - your wallet address does not change, not even on zksync chains (once they implement EIP-7702)
- Much faster execution, with the option of paying for gas yourself or having thirdweb manage gas sponsorship, similar to SmartWallet.
And here's how simple it is!
ExecutionMode.EIP7702Sponsored**
Upgrade to an EIP7702 smart account, unlocking all functionality of 4337 without the downsides, and thirdweb handles the execution and gas sponsorship for you!
var smartEoa = await InAppWallet.Create(
client: thirdwebClient,
authProvider: AuthProvider.Google,
executionMode: ExecutionMode.EIP7702Sponsored
);ExecutionMode.EIP7702
Upgrade to an EIP7702 smart account, unlocking all functionality of 4337 without the downsides, but sponsoring gas yourself.
var smartEoa = await InAppWallet.Create(
client: thirdwebClient,
authProvider: AuthProvider.Google,
executionMode: ExecutionMode.EIP7702
);ExecutionMode.EOA
Normal" EOA Execution, no smart account functionality
var basicEoa = await InAppWallet.Create(
client: thirdwebClient,
authProvider: AuthProvider.Google,
// does not need to be explicitly passed, is the default but we're showing it here
executionMode: ExecutionMode.EOA
);When using EIP-7702 execution modes, upon your first transaction - if not already delegated to a smart account - an EIP-7702 authorization will be signed and bundled with your first transaction, similar to how 4337 works with initcode, but without the large gas costs, slower execution and chain specific requirements.
We hope you enjoy not having to pass your signers to yet another SmartWallet class, dealing with entrypoint versions, bundlers, paymasters, slow execution and higher gas fees.
This Smart EOA contract also comes with granular session keys that we'll showcase in a later release!
More chains will have support for EIP-7702 very soon with various chain stacks upgrading to Pectra, and we will support each and every one of them.
Additional updates
InAppWalletandEcosystemWallet'sSignAuthorizationlow level methods have been integrated.- Fixed an issue where using
SmartWalleton Hedera or Hedera Testnet where HBAR (native token) is involved could cause silent revets.
v2.20.1
v2.20.0
What's Changed
- Nebula model
t0-003Integration- New
NebulaContextconstructor, only a list of chain ids are now needed, and an optional wallet address can be passed. - Results are a lot more predictable now, model t0-003 is now the default model when creating a
ThirdwebNebulainstance. - Execution methods returns receipts more consistently.
- Session is now properly passed to every call, improving contextual responses.
- New
- Fixed an bug where using the extension
DropERC20_Claimwould fail if the claim condition was set to be in native tokens.
v2.19.1
What's Changed
- Fixed an encoding issue when using Account Abstraction v0.7 (Smart Wallet with Entrypoint v0.7) without a paymaster (gasless: false).
- Fixed an issue where
ThirdwebInsight'sToNFTandToNFTListextensions would throw "Unknown NFT type" due to new response model.
v2.19.0
[Beta] Universal Bridge .NET Integration - Successor to Thirdweb Pay
We've built Universal Bridge to allow your users to use any asset on any chain, and it's ready for you to try.
This integration simplifies onchain asset trading, and we've added extensions in .NET to integrate with any IThirdwebWallet nicely.
Core APIs
The design is akin to letting us know what your intent is.
- Buy: "I want to buy x USDC on y Chain using z Token"
- Sell: "I want to sell x USDC on y Chain for z Token"
- Transfer: "Just transfer all my money to vitalik"
We will return the transactions needed to achieve whatever you desire.
You may then handle execution yourself or use our extensions.
Instantiation
using Thirdweb.Bridge;
// Create a ThirdwebBridge instance
var bridge = await ThirdwebBridge.Create(client);Buy - Get a quote for buying a specific amount of tokens
var buyQuote = await bridge.Buy_Quote(
originChainId: 1,
originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
destinationChainId: 324,
destinationTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
buyAmountWei: BigInteger.Parse("0.1".ToWei())
);
Console.WriteLine($"Buy quote: {JsonConvert.SerializeObject(buyQuote, Formatting.Indented)}");Buy - Get an executable set of transactions (alongside a quote) for buying a specific amount of tokens
var preparedBuy = await bridge.Buy_Prepare(
originChainId: 1,
originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
destinationChainId: 324,
destinationTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
buyAmountWei: BigInteger.Parse("0.1".ToWei()),
sender: await Utils.GetAddressFromENS(client, "vitalik.eth"),
receiver: await myWallet.GetAddress()
);
Console.WriteLine($"Prepared Buy contains {preparedBuy.Transactions.Count} transaction(s)!");Sell - Get a quote for selling a specific amount of tokens
var sellQuote = await bridge.Sell_Quote(
originChainId: 324,
originTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
destinationChainId: 1,
destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
sellAmountWei: BigInteger.Parse("0.1".ToWei())
);
Console.WriteLine($"Sell quote: {JsonConvert.SerializeObject(sellQuote, Formatting.Indented)}");Sell - Get an executable set of transactions (alongside a quote) for selling a specific amount of tokens
var preparedSell = await bridge.Sell_Prepare(
originChainId: 324,
originTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
destinationChainId: 1,
destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
sellAmountWei: BigInteger.Parse("0.1".ToWei()),
sender: await Utils.GetAddressFromENS(client, "vitalik.eth"),
receiver: await myWallet.GetAddress()
);
Console.WriteLine($"Prepared Sell contains {preparedSell.Transactions.Count} transaction(s)!");Transfer - Get an executable transaction for transferring a specific amount of tokens
Why not just transfer with the SDK? Stay tuned for webhooks, think direct payments!
var preparedTransfer = await bridge.Transfer_Prepare(
chainId: 137,
tokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
transferAmountWei: BigInteger.Parse("0.1".ToWei()),
sender: await Utils.GetAddressFromENS(client, "vitalik.eth"),
receiver: await myWallet.GetAddress()
);
Console.WriteLine($"Prepared Transfer: {JsonConvert.SerializeObject(preparedTransfer, Formatting.Indented)}");Manual Execution
This is not production code, we're just showcasing some of the APIs that would help you execute and poll status here.
// You may use our extensions to execute yourself...
var myTx = await preparedTransfer.Transactions[0].ToThirdwebTransaction(myWallet);
var myHash = await ThirdwebTransaction.Send(myTx);
// ...and poll for the status...
var status = await bridge.Status(transactionHash: myHash, chainId: 1);
var isComplete = status.StatusType == StatusType.COMPLETED;
Console.WriteLine($"Status: {JsonConvert.SerializeObject(status, Formatting.Indented)}");
// Or use our Execute extensions directly to handle everything for you!Managed Execution
The SDK comes with some extensions that you'll see on a lot of ThirdwebBridge objects, and the main one is Execute.
// Execute a prepared Buy
var buyResult = await bridge.Execute(myWallet, preparedBuy);
var buyHashes = buyResult.Select(receipt => receipt.TransactionHash).ToList();
Console.WriteLine($"Buy hashes: {JsonConvert.SerializeObject(buyHashes, Formatting.Indented)}");
// Execute a prepared Sell
var sellResult = await bridge.Execute(myWallet, preparedSell);
var sellHashes = sellResult.Select(receipt => receipt.TransactionHash).ToList();
Console.WriteLine($"Sell hashes: {JsonConvert.SerializeObject(sellHashes, Formatting.Indented)}");
// Execute a prepared Transfer
var transferResult = await bridge.Execute(myWallet, preparedTransfer);
var transferHashes = transferResult.Select(receipt => receipt.TransactionHash).ToList();
Console.WriteLine($"Transfer hashes: {JsonConvert.SerializeObject(transferHashes, Formatting.Indented)}");v2.18.6
What's Changed
EngineWalletconnections will now show up in your dashboard analytics, alongside other wallets.- Fixes issues fetching
ERC721ANFTs (without theERC721AQueryableextension) where burned token ids would throw an error due to aOwnerQueryForNonexistentTokenrevert. GetEcosystemDetailsnow throws early if called on anInAppWalletrather than fetching and failing, slightly improvingSmartWalletcreation speed when usingInAppWallet.
v2.18.5
What's Changed
ThirdwebInsightcan now return additional Token Prices using GetTokenPrice or GetTokenPrices.
// Instantiate Insight
var insight = await ThirdwebInsight.Create(client);
// Fetch current token price
var ethPriceToday = await insight.GetTokenPrice(addressOrSymbol: "ETH", chainId: 1);
Console.WriteLine($"ETH price today: {ethPriceToday.PriceUsd}");
// Fetch token price at specified timestamp
var ethPriceYesterday = await insight.GetTokenPrice(
addressOrSymbol: "ETH",
chainId: 1,
timestamp: Utils.GetUnixTimeStampNow() - 86400
);
Console.WriteLine($"ETH price yesterday: {ethPriceYesterday.PriceUsd}");
// Fetch multiple token prices across multiple chains
var multiTokenPrices = await insight.GetTokenPrices(
addressOrSymbols: new string[] { "POL", "APE" },
chainIds: new BigInteger[] { 137, 33139 }
);
Console.WriteLine($"Multi token prices: {JsonConvert.SerializeObject(multiTokenPrices, Formatting.Indented)}");v2.18.4
What's Changed
- Fixed an issue where using
InAppWalletorEcosystemWalletwithAuthProvider.Siwewith a permissioned client id could lead to anUnauthorizederror being thrown.AuthProvider.SiweExternalunaffected.
v2.18.3
What's Changed
- Removed
EngineWallet.Create's backend wallet validity check, this fixes issues instantiating when you had more than 10 backend wallets. EngineWallet.Createis now synchronous.
v2.18.2
What's Changed
ThirdwebInsightcan now return additional rich NFT Metadata when using GetTokens_ERC721 or GetTokens_ERC1155.limit,pageandwithMetadataoptional arguments have been added.- The
Token_ERC721andToken_ERC1155return types can now be converted into a base SDKNFTtype - Extensions can be used with said
NFTtype.
// Fetch ERC721s with extra metadata returned
var erc721Tokens = await insight.GetTokens_ERC721(address, chains, withMetadata: true);
// Use ToNFT or ToNFTList extensions
var convertedNft = erc721Tokens[0].ToNFT();
var convertedNfts = erc721Tokens.ToNFTList();
// Use NFT Extensions (GetNFTImageBytes, or GetNFTSprite in Unity)
var imageBytes = await convertedNft.GetNFTImageBytes(client);
var pathToSave = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "nft.png");
await File.WriteAllBytesAsync(pathToSave, imageBytes);
Console.WriteLine($"NFT image saved to: {pathToSave}");