WebGLGetBlockNumber.cs 324 B

12345678910111213
  1. using UnityEngine;
  2. using Web3Unity.Scripts.Library.Ethers.Providers;
  3. #if UNITY_WEBGL
  4. public class WebGLGetBlockNumber : MonoBehaviour
  5. {
  6. public async void GetBlockNumber()
  7. {
  8. var provider = new JsonRpcProvider("YOUR_NODE");
  9. Debug.Log("Block Number: " + await provider.GetBlockNumber());
  10. }
  11. }
  12. #endif