Unity 4.10 - Phone Login & More

Sign in with your phone number, unified transactions and added utilities.

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.

Release: https://github.com/thirdweb-dev/unity-sdk/releases/tag/v4.10.0