.NET/Unity - Unified Identity: Account Linking & More

Unlocking advanced use cases with this feature packed dual release.

.NET/Unity - Unified Identity: Account Linking & More

What's Changed

Added SIWE (Sign In With Ethereum) as an additional login provider for In-App Wallets.

// The external wallet you want to login with
var anyExternalWallet = await PrivateKeyWallet.Generate(client: Client); 

// USING .NET API

// Create the InAppWallet
var wallet = await InAppWallet.Create(
  client: client, 
  authProvider: AuthProvider.Siwe, 
  siweSigner: anyExternalWallet
);

_ = await siweWallet.LoginWithSiwe(chainId: 1);

// USING UNITY API

// Setup auth with SIWE
var siweOptions = new InAppWalletOptions(
  authprovider: AuthProvider.Siwe, 
  siweSigner: anyExternalWallet
);

// Setup connect options with chain ID
var connectOptions = new WalletOptions(
  provider: WalletProvider.InAppWallet, 
  chainId: 421614, 
  inAppWalletOptions: siweOptions
);

// Login with SIWE!
var siweInAppWallet = await ThirdwebManager.Instance.ConnectWallet(connectOptions);
var address = await siweInAppWallet.GetAddress();
// Your main InAppWallet account, already authenticated and connected
InAppWallet mainInAppWallet = ...

// An InAppWallet with a new auth provider to be linked to the main account, not connected
InAppWallet walletToLink = await InAppWallet.Create(
  client: Client, 
  authProvider: AuthProvider.Telegram
);

// Link Account - .NET API
var linkedAccounts = await mainInAppWallet.LinkAccount(
  walletToLink: walletToLink
);

// Link Account - Unity API
var linkedAccounts = await ThirdwebManager.Instance.LinkAccount(
  mainInAppWallet, 
  walletToLink
);

// You can also fetch linked accounts at any time
List<LinkedAccount> linkedAccounts = await mainInAppWallet.GetLinkedAccounts();

The LinkAccount API requires the parameters you typically use to login with a normal InAppWallet. It will authenticate the new wallet and link it directly to the main wallet. This makes it simple to have multiple identities tied a single evm-compatible account.

Miscellaneous

  • Performance and speed improvements for OTP based login methods.
  • Added caching for Utils.FetchThirdwebChainDataAsync.
  • Added Utils.IsEip155Enforced to check whether a chain enforces EIP 155.
  • Added smarter transaction gas fee defaults based on whether chain supports 1559.
  • ThirdwebContract.Read and ThirdwebContract.Write can now take in full or partial method signatures:
    • var name = await contract.Read<string>(method: "name", ...) still works.
    • var name = await contract.Read<string>(method: "function name() view returns (string)", ...) now also works.
    • var name= await contract.Read<string>(method: "name() view returns (string)", ...) now also works.
    • var result = await contract.Write(..., method: "claim(address, uint256, address, uint256, (bytes32[], uint256, uint256, address), bytes)", ...) now also works.
    • We still recommend using our awesome extensions for common standards such as contract.DropERC20_Claim to make life easier!
  • Added support for ERC20 Paymasters.

Releases

.NET: https://www.nuget.org/packages/Thirdweb/1.4.0

Unity: https://github.com/thirdweb-dev/unity-sdk/releases/tag/v5.0.0-beta.3

Documentation

.NET: https://portal.thirdweb.com/dotnet

Unity: https://portal.thirdweb.com/unity/v5