Skip to main content

Basic Network Functionality

L1 Wallet/Token Interactions

tip

You may notice that UniTask is used in return values from various SDK methods. This is a utility library for use in situations where the .Net System.Threading.Tasks namespace is unavailable, specifically when building for the WebGL platform. It also allows the use of the async/await pattern in an allocation-free manner. Please see the UniTask Github page for more information about usage of this library.

Retrieving a wallet's balance

string walletAddress = "0x1234567890abcdef1234567890abcdef12345678";
decimal balance = await Web3Utils.GetBalance(walletAddress);
Debug.Log($"Balance of {walletAddress}: {balance}");

Transferring L1 Tokens

string toAddress = "0x1234567890abcdef1234567890abcdef12345678";
decimal amount = 1.0m;

string result = await Web3Utils.SendEthTransaction(toAddress, amount);
Debug.Log($"{amount} L1 sent to {address}. Transaction hash: {result}");