コード例 #1
0
        public IActionResult OnGet(string address)
        {
            IndexerClient indexerClient = IndexerRpc();

            string prefix = AddressPrefix();
            Script lockScript;

            try
            {
                lockScript = Address.ParseAddress(address, prefix);
            }
            catch
            {
                return(NotFound());
            }

            SearchKey    searchKey    = new(lockScript, "lock");
            CellCapacity?cellCapacity = indexerClient.GetCellsCapacity(searchKey);
            UInt64       balance      = 0;

            if (cellCapacity != null)
            {
                balance = Hex.HexToUInt64(cellCapacity.Capacity);
            }

            int cellsCount = GetCellsCount(indexerClient, searchKey);

            AddressResult = new()
            {
                AddressHash    = address,
                LockScript     = lockScript,
                Balance        = balance.ToString(),
                LiveCellsCount = cellsCount.ToString(),
            };

            return(Page());
        }