Releases: thirdweb-dev/unity
v4.10.0
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 inPrefab_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
What's Changed
- [Cross-Platform] Improved cross-chain gas price accuracy when using thirdweb default bundler with Account Abstraction.
- [Native]
Transaction.WaitForTransactionResultnow 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
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.SendRawTransactionno longer waits for the transaction to be mined and returns a tx hash. - [Cross-Platform]
Wallet.ExecuteRawTransactionis 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.Transferon 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
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
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.
v4.7.10
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
v4.7.9
What's Changed
- [General] Added
Utils.ResolveAddressFromENSandUtils.ResolveENSFromAddresscross-platform utilities. - [General] Added alternative
Initializefunction inThirdwebManager.csfor more granular control. - [Native] Fixed issue where bundle id would be appended to default rpc urls when no client id was provided, this should fix potential 401s.
v4.7.8
What's Changed
- [General] Added simpler
Wallet.IsDeployedAPI for cross-platform Smart Wallet deployment checks. - [Native] Improved error messaging when a Smart Wallet is not connected.
v4.7.7
What's Changed
- [WebGL] Improved Smart Wallet receipt polling mechanism. Added optimized support for newer factories.
v4.7.6
What's Changed
- [WebGL] Removed unnecessary WebGL-specific logs, improved stability and speed in some cases.
