Thirdweb Manager

The ThirdwebManager is a MonoBehaviour that provides a convenient and customizable way to instantiate and manage the ThirdwebSDK. Add the prefab to your scene and the SDK will persist throughout your game's lifecycle. It can be found at Thirdweb/Core/Prefabs/ThirdwebManager.

Configuration

Configure ThirdwebManager through the Unity Inspector window.

Below is a list of all the settings you can adjust.

General Settings

This section involves the basic blockchain configurations. Adjust the following settings:

  • Active Chain: The identifier for the default blockchain to use.
  • Supported Chains: A list of all blockchains your game supports. For each chain, provide an identifier, a chain ID, and optionally, an RPC override.
  • Client ID: Thirdweb API Key. Used for default thirdweb services such as Storage and Account Abstraction.
  • Bundle ID Override: Optional override for the bundle ID used by thirdweb services. Defaults to Application Identifier and can be fetched using Utils.GetBundleId().
  • Initialize On Awake: Whether the SDK should initialize on awake or not. If not, you can call ThirdwebManager.Instance.Initialize("chain-identifier") to initialize it manually.
  • Show Debug Logs: Whether to show thirdweb sdk debug logs.
  • Thirdweb Config: SciptableObject for additional Thirdweb configuration. Generated automatically. Mainly used to set custom schemes for google login.

App Metadata

This section lets you define how your app appears in wallet providers like Metamask, WalletConnect, etc. Modify the following fields:

  • App Name: The name of your application.
  • App Description: A brief description of your app.
  • App Icons: Your app's icons.
  • App URL: The URL for your app.

Storage Options

Here, you can specify the URL for your IPFS gateway, which stores your assets in a decentralized way. Edit the following:

  • Storage IPFS Gateway Url: The URL for your IPFS gateway.

Gasless Relayer Options

In this section, configure settings for your thirdweb Engine Relayer, a service that handles gasless transactions for your users.

  • Relayer Url: The URL for your engine relayer, can be found on the thirdweb dashboard.
  • Forwarder Address: Override the default thirdweb forwarder contract address. (Optional)
  • Forwarder Domain Override and Forwarder Version Override: Overrides for the forwarder domain and version. (Optional)

Wallet Connect Options

Here, provide your project ID for WalletConnect:

  • WalletConnect Project ID: Your project ID for WalletConnect.
  • WalletConnect Enable Explorer: WalletConnect WebGL QR Modal: enable recommended explorer wallet buttons.
  • WalletConnect Explorer RecommendedWallet Ids: WalletConnect WebGL QR Modal: wallets to display in the WC modal (https://walletconnect.com/explorer).
  • WalletConnect Wallet Images: WalletConnect WebGL QR Modal: mapping of wallet id to wallet image, useful for custom wallets or overrides.
  • WalletConnect Desktop Wallets: WalletConnect WebGL QR Modal: custom desktop wallets to display.
  • WalletConnect Mobile Wallets: WalletConnect WebGL QR Modal: custom mobile wallets to display.
  • WalletConnect Theme Mode: WalletConnect Theme Mode (light or dark, leave empty for system defaults).

Smart Account Options

These settings are required to set up a smart account.

  • Factory Contract Address: The address of your account factory contract.
  • Thirdweb API Key: Your API key for Thirdweb.
  • Gasless: Whether or not you want to use gasless transactions. Note that deployment and approval step when using ERC20Paymasters will be gasless as well if this is on.
  • ERC20 Paymaster Address: If you want to use an ERC20 Paymaster, you must provide the paymaster contract address here.
  • ERC20 Token Address: If using an ERC20 Paymaster, you must provide the associated ERC20 Token Address here.
  • Bundler Url, Paymaster Url, EntryPoint Address: Optional overrides for setting up your smart account.

Native Prefabs (Danger Zone)

This section allows you to provide GameObject prefabs for native wallet providers, which will be instantiated at runtime.

  • WalletConnect Prefab: The prefab for WalletConnect's customizable UI/behavior.
  • Metamask Prefab: The prefab for Metamask's customizable UI/behavior.
  • InAppWallet Prefab: The prefab for InAppWallet's customizable UI/behavior.

Accessing the SDK

Once ThirdwebManager is set up and the game starts, it will instantiate the Thirdweb SDK based on your settings. You can access the instantiated SDK from other scripts using:

var sdk = ThirdwebManager.Instance.SDK;