Unity 4.9.0 - Thirdweb Pay

Cross-chain, cross-platform, embedded swapping and bridging!

Thirdweb Pay has made its way to Unity!

New Cross-Platform Feature: Buy with Crypto

Simply add using Thirdweb.Pay; at the top of your file to get access to static methods:

  • ThirdwebPay.GetBuyWithCryptoQuote: Get a quote for swapping any token pair.
  • ThirdwebPay.BuyWithCrypto: Pass said quote into this function to execute the swap and get a transaction hash.
  • ThirdwebPay.GetBuyWithCryptoStatus: Get the status of your swap using the transaction hash.
  • ThirdwebPay.GetBuyWithCryptoHistory: Additional API to get the swap history of a wallet address.

Buy with Crypto Unity API Reference can be found here.

In addition, a new scene has been added: Scene_Prefabs with a prefab Prefab_BuyWithCrypto to illustrate the basic flow. It is set up for Polygon and will buy 2 WMATIC using the connected wallet's MATIC funds. You may edit the behavior as you please, this prefab serves as an example use case, code can be found in Prefab_BuyWithCrypto.cs

Other additions

  • [Cross-Platform] Wallet.SendRawTransaction no longer waits for the transaction to be mined and returns a tx hash.
  • [Cross-Platform] Wallet.ExecuteRawTransaction is a new function that was added this update and will wait for the transaction to be mined.
  • [Cross-Platform] Fixed issues with native token transfers using Wallet.Transfer on some chains or some wallets.
  • [Cross-Platform] Legacy type transactions are no longer used in mid/high level APIs. They are only used in low level APIs when a gas price is explicitly passed.
  • [Native] Fallback gas estimation when Polygon gas station requests fail are now more reliable.
  • [Cross-Platform] Improved support for Smart Wallets for all of the above.

This update comes after various reliability improvements and new features which culminated into Unity 4.8.0, and 4.9.0 is the cherry on top!

Documentation Portal: https://portal.thirdweb.com/unity