Accessing the Storage - ajuna-network/Polkadot.Unity.SDK GitHub Wiki

Accessing blockchain storage in Unity with the Polkadot SDK is akin to using the Polkadot.JS developer UI. For instance, to access the system.account with an AccountId32 and retrieve AccountInfo:

image

This functionality, using Substrate.Polkadot.NET.NetApiExt, allows for querying account information directly within Unity, streamlining the process of interacting with blockchain data.

        /// <summary>
        /// Get account info.
        /// </summary>
        /// <returns></returns>
        private async Task<AccountInfo> GetAccountInfoAsync()
        {
            var client = (PolkadotExt.SubstrateClientExt)_client;

            var address = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

            AccountId32 accountId32 = new AccountId32();
            accountId32.Create(Utils.GetPublicKeyFrom(address));

            AccountInfo accountInfo = await client.SystemStorage.Account(accountId32, CancellationToken.None);

            return accountInfo;
        }

⚠️ **GitHub.com Fallback** ⚠️