8000 Releases · thirdweb-dev/dotnet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Releases: thirdweb-dev/dotnet

v2.22.0

09 May 20:43
b6541d6
Compare
Choose a tag to compare

ThirdwebBridge - Onramp Integration & Improved APIs

This release brings you new Onramp APIs, as well as new QOL parameters for the general ThirdwebBridge APIs, in line with the latest changes made to the service.

Do note that some responses now have obsolete propeties. Generally the main change is that instead of returning a list of transactions, Prepare endpoints will return a set of Steps. You can still use our extensions to Execute any prepared quote you receive directly, we'll handle the steps for you as usual.

Basic example of using the new Onramp APIs in .NET

The onramp flow will return a link for you to display/open as you please. You may poll the status of that onramp by its ID.
In some cases, you may receive an additional set of onchain transactions required to get to your destination token post on-ramp, in such cases, you may use our extension IsSwapRequiredPostOnramp to check, and if a swap is indeed required, you may use our Execute extensions to execute the transactions, or manually execute them by going through each Step.

// Onramp - Get a quote for buying crypto with Fiat
var preparedOnramp = await bridge.Onramp_Prepare(
    onramp: OnrampProvider.Coinbase,
    chainId: 8453,
    tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
    amount: "10000000",
    receiver: await myWallet.GetAddress()
);
Console.WriteLine($"Onramp link: {preparedOnramp.Link}");
Console.WriteLine($"Full onramp quote and steps data: {JsonConvert.SerializeObject(preparedOnramp, Formatting.Indented)}");

while (true)
{
    var onrampStatus = await bridge.Onramp_Status(id: preparedOnramp.Id);
    Console.WriteLine($"Full Onramp Status: {JsonConvert.SerializeObject(onrampStatus, Formatting.Indented)}");
    if (onrampStatus.StatusType is StatusType.COMPLETED or StatusType.FAILED)
    {
        break;
    }
    await ThirdwebTask.Delay(5000);
}

if (preparedOnramp.IsSwapRequiredPostOnramp())
{
    // Execute additional steps that are required post-onramp to get to your token, manually or via the Execute extension
    var receipts = await bridge.Execute(myWallet, preparedOnramp);
    Console.WriteLine($"Onramp receipts: {JsonConvert.SerializeObject(receipts, Formatting.Indented)}");
}
else
{
    Console.WriteLine("No additional steps required post-onramp, you can use the tokens directly!");
}

v2.21.0

07 May 23:51
ea4d093
Compare
Choose a tag to compare

[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

  • InAppWallet and EcosystemWallet's SignAuthorization low level methods have been integrated.
  • Fixed an issue where using SmartWallet on Hedera or Hedera Testnet where HBAR (native token) is involved could cause silent revets.

v2.20.1

02 May 13:09
0dd7293
Compare
Choose a tag to compare

What's Changed

  • Ronin and its testnet Saigon have been added to the forced type 1 transaction list, making use of gas price all the time. This is due to instability in type 2 transaction behavior on that chain in some cases.

v2.20.0

29 Apr 13:58
a668d2c
Compare
Choose a tag to compare

What's Changed

  • Nebula model t0-003 Integration
    • New NebulaContext constructor, 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 ThirdwebNebula instance.
    • Execution methods returns receipts more consistently.
    • Session is now properly passed to every call, improving contextual responses.
  • Fixed an bug where using the extension DropERC20_Claim would fail if the claim condition was set to be in native tokens.

v2.19.1

21 Apr 14:33
b8788c1
Compare
Choose a tag to compare

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's ToNFT and ToNFTList extensions would throw "Unknown NFT type" due to new response model.

v2.19.0

21 Mar 23:50
59f7ed8
Compare
Choose a tag to compare

[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)}");

Full Bridge .NET Reference

v2.18.6

19 Mar 21:26
fc2d1a6
Compare
Choose a tag to compare

What's Changed

  • EngineWallet connections will now show up in your dashboard analytics, alongside other wallets.
  • Fixes issues fetching ERC721A NFTs (without the ERC721AQueryable extension) where burned token ids would throw an error due to a OwnerQueryForNonexistentToken revert.
  • GetEcosystemDetails now throws early if called on an InAppWallet rather than fetching and failing, slightly improving SmartWallet creation speed when using InAppWallet.

v2.18.5

13 Mar 14:51
613177f
Compare
Choose a tag to compare

What's Changed

// 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

12 Mar 17:57
06241aa
Compare
Choose a tag to compare

What's Changed

  • Fixed an issue where using InAppWallet or EcosystemWallet with AuthProvider.Siwe with a permissioned client id could lead to an Unauthorized error being thrown. AuthProvider.SiweExternal unaffected.

v2.18.3

12 Mar 14:36
d8a5637
Compare
Choose a tag to compare

What's Changed

  • Removed EngineWallet.Create's backend wallet validity check, this fixes issues instantiating when you had more than 10 backend wallets.
  • EngineWallet.Create is now synchronous.
0