Skip to content

Releases: thirdweb-dev/unity-sdk

v4.12.1

17 Apr 23:37
869df33
Compare
Choose a tag to compare

What's Changed

  • [Cross-Platform] Added Wallet.AuthenticateAndLoginServerSide that helps you use thirdweb Auth more easily, cross-platform.
    • Previously, Wallet.Authenticate mostly acted as a signed payload generator rather than a full authentication flow, and stored a local SIWE style session. You had to do the extra work of serializing, encoding and logging in to your backend as an extra step.
    • You may use this helper method instead if you have thirdweb Auth setup on your backend, passing in your domain and chain id, to replicate a full login flow without having to deal with payloads, encoding or signing/verifying.
    • Defaults to calling /auth/payload and /auth/login, overrideable.
    • Works with Smart Wallets.
    • Uses UnityWebRequest, meaning it's WebGL compatible, however make sure CORS is setup correctly to test in WebGL as usual.

v4.12.0

16 Apr 23:43
1d277cf
Compare
Choose a tag to compare

What's Changed

Providing new ways for devs to sponsor transactions, powered by Engine!

  • [Cross-Platform] Added support for the thirdweb Engine Relayer
    • This relayer is a service provided by thirdweb for an alternative way to sponsor transactions on behalf of users through Engine.
    • When using Transaction.Send or Transaction.SendAndWaitForTransactionResult you may specify whether to use this gasless feature or not, other higher level APIs will default to the gasless flow if you have the relayer set up.
    • Replaces OpenZeppelin Defender Options.
    • We still recommend using Account Abstraction for gasless sponsorship features through Smart Wallets, however in some cases a relayer is needed!
  • [Native] Improved Contract.Write flow.
    • Better gas limit/price/fees estimations when not provided, similar to other APIs.
    • Now uses the gasless relayer by default if it is set up in your ThirdwebManager, similar to other higher level APIs.

b3239638a30c2ff165d7c05477da1372

Visit our documentation portal to learn more at https://portal.thirdweb.com/unity

v4.11.0

12 Apr 01:02
bf98f94
Compare
Choose a tag to compare

What's Changed

  • [Cross-Platform] Using Custom Contracts no longer requires passing an ABI on any platform.
    • Using Contract.Prepare, Contract.Read or Contract.Write will populate the ABI at runtime if it was not provided.
    • This is a great way to get started quickly, but it is not recommended for production environments for speed reasons.
    • We've also added Contract.FetchAbi to fetch the ABI manually.
  • [WebGL] Fixed regression introduced in 4.10 where using Smart Wallets with Embedded Wallets as a signer in WebGL would have caused invalid auth provider: undefined to be thrown. We now handle that case correctly.
  • [Cross-Platform] Renamed EmbeddedWallet to InAppWallet, as well as most other related scripts, prefabs and files.
    • There are no functionality changes between the old EmbeddedWallet and the new InAppWallet.
    • You may need to slightly adapt any previous prefabs you had and make sure the renamed classes are referenced properly.
    • This is in an effort to move to a powerful In-App Wallet that potentially will encompass other wallet type functionalities within itself.

This is a minor update, meaning some structural or api breaking changes occured. When upgrading, it is best to remove previous SDK files for a smooth importing process, backing up any prefab copies or scripts extending or overriding thirdweb prefabs and scripts.

v4.10.1

09 Apr 00:14
ec4ce3e
Compare
Choose a tag to compare

What's Changed

  • [WebGL] Upgraded bridge, includes optimizations and improved smart wallet transaction simulation (less silent reverts).
  • [Native] Added low level Contract.ReadRaw for parsing complex tuples into a Nethereum code generated style output type, useful when basic dynamic invocation/deserialization is not good enough for your use case.
  • [Native] Wallet.GetAllActiveSigners() now also returns admins, you may iterate through the output and check isAdmin to differentiate admins from basic session keys.

v4.10.0

05 Apr 01:57
4ba7b15
Compare
Choose a tag to compare

What's Changed

Sign-in with your Phone Number! (Native Platforms)

Similar to the Email OTP flow, the Phone OTP auth method will send you an OTP as an SMS, resulting in an Embedded Wallet.

// Reference to your Thirdweb SDK
var sdk = ThirdwebManager.Instance.SDK;
 
// Configure the connection
var connection = new WalletConnection(
    provider: WalletProvider.EmbeddedWallet,
    chainId: 1,
    phoneNumber: "+123456789",
    authOptions: new AuthOptions(
        authProvider: AuthProvider.PhoneOTP,
    )
);
 
// Connect the wallet
string address = await sdk.Wallet.Connect(connection);

You may test it out in Scene_Prefabs, the input field has been updated to check for both emails and phone numbers and adapt.
When creating your own UI, we suggest adapting the input field type according to the auth method used, specially for mobile.

This feature is only available on native platforms, WebGL coming soon!

Transaction Flow

This update brings the unification of all transaction flows and centralizes them around the Transaction class. This means that edge cases, issues with gas on some chains with some APIs, and raw transaction APIs now all should feel smoother and more consistent.

What to expect:

  • We will always estimate gas on your behalf if a gas limit is not passed.
  • When on a chain that supports EIP-1559, we will always use optimized max and priority fee fetching mechanics and submit the tx as 1559, if a gas price is not explicitly passed (thus overriding our default checks for 1559 support).
  • When on a chain that does not support EIP-1559, we will always use optimized gasPrice fetching mechanics and submit the tx as a legacy tx, if a max/priority fee is not explicitly passed (the transaction may still not be legacy with some external wallet providers that may override this).
  • Account Abstraction has its own gas pricing flow and will always price User Operations accordingly.
  • If relayer options are provided, the transactions will always default to the relayer unless a low level API is used where that can be overridden, such as Transaction.Send. Note that we recommend using Account Abstraction instead of relayers in general.

Miscellaneous

  • [Cross-Platform] Added a utility to copy text to a buffer for cross-platform usage, Utils.CopyToClipboard (used in Prefab_ConnectWallet)
  • [Native] Added a utility to fetch legacy gas price Utils.GetLegacyGasPriceAsync.
  • [WebGL] Fixed an Account Abstraction edge case where simulation would not account for delegate call overheads in the gas limit.

v4.9.1

02 Apr 17:35
3458d5b
Compare
Choose a tag to compare

What's Changed

  • [Cross-Platform] Improved cross-chain gas price accuracy when using thirdweb default bundler with Account Abstraction.
  • [Native] Transaction.WaitForTransactionResult now supports AA transactions and properly decodes silent reverts, throwing accordingly.
  • [Native] Updated chains.
  • [WebGL] Updated bridge.

This patch is greatly recommended for Account Abstraction users.

v4.9.0

28 Mar 04:05
ff672fe
Compare
Choose a tag to compare

What's Changed

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.

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

v4.8.0

23 Mar 00:05
e12c16d
Compare
Choose a tag to compare

What's Changed

Unity SDK 4.8.0 is here!

It brings you various reliability, performance and API improvements, let's go through them.

Gas Fees
In most situations, you do not typically want to set a gas price or max fee/priority fee. The SDK used to use a simple way to suggest those before broadcasting your transaction. It now uses a custom flow when no gasPrice is provided to set your 1559 gas fees in a way that will both be more reliable as well as speed up transactions without increasing the cost too much. A follow-up to this update for L2s will be arriving in upcoming releases, whereby we may increase your gas fee internally and actually end up costing you less in total paid $ in L1 fees.
This should also fix issues on chains like Fantom and others.

The Great Refactor
Everyone hates when a dev changes the API randomly, but it's time the SDK grows up and detaches itself from JS SDK naming conventions.
Major properties and variables are now PascalCase and the scoping of some has changed.
For instance, ThirdwebManager.Instance.SDK.wallet is now ThirdwebManager.Instance.SDK.Wallet
All ThirdwebSDK and Contract subclasses are now following this convention.
Portal documentation will be updated shortly to reflect this change. Do note that functionality wise, it is still the same.
The Deployer class has been removed, please deploy from the thirdweb Dashboard or your own custom contract deployment process.

Return Types
We now return BigInteger instead of strings from tasks where it makes sense, so you don't have to do any parsing. Hooray!
Strings may still be returned in internal types for cross-platform purposes.

Signature Minting
Signature minting Generate function can now take in a private key override optional second parameter, and assuming it has a MINTER role, it can generate valid signatures that can be used to mint from the connected wallet - USE THIS ONLY FOR TESTING PURPOSES!
This flow previously partially existed but has now also been adapted to work in WebGL, it is still an unrecommended API.
The correct flow is to validate a request and generate a signature server side, however this is a useful feature for quick tests.

Miscellaneous
The ThirdwebManager now preserves the state of hidden/shown optional fields in subcategories when unfocused.
Fixed an issue with Storage in WebGL failing to download text in some cases, it now uses the sync version of System.IO.
Updated the chains package.
Updated the WebGL bridge.
Added unit tests.

This is an API-breaking update, please update carefully!

v4.7.11

18 Mar 22:08
856efc6
Compare
Choose a tag to compare

What's Changed

  • [WebGL] Additional WalletConnect Modal options are now exposed in the ThirdwebManager.
    • enableExplorer - determines whether to show specific wallets under the QR code.
    • explorerRecommendedWalletIds - specify wallets to recommend in the bar below the QR, if enabled. See WC Explorer to find ids.
    • walletImages - wallet id to image url mapping for custom wallets that were added as desktop or mobile wallets.
    • desktopWallets - custom wallets that are desktop-based and may support deep linking.
    • mobileWallets - custom wallets that are mobile-based and may support deep linking.
    • themeMode - set to "dark" or "light" to force a theme mode, otherwise uses system default.

2b163a3de43028676f37b0abf44aea87

v4.7.10

18 Mar 14:56
d3c0f8c
Compare
Choose a tag to compare

What's Changed

  • [General] Updated chains package.
  • [Native] Providing a chain id that is not officially supported through the chains package should no longer be a blocking action i.e. you should still be able to connect so long as an rpc is available as well as interact with other thirdweb libraries without null references.
  • [Native] Avoid posting wallet analytics when no client id provided