예제 #1
0
        private JObject GetBalance(string address)
        {
            var addressUint160 = address.HexToBytes().ToUInt160();
            var balance        =
                _stateManager.LastApprovedSnapshot.Balances.GetBalance(addressUint160);

            var staked  = _systemContractReader.GetStake(addressUint160).ToMoney();
            var staking = _systemContractReader.GetStakerTotalStake(addressUint160).ToMoney();
            var penalty = _systemContractReader.GetPenalty(addressUint160).ToMoney();
            var nonce   = _stateManager.LastApprovedSnapshot.Transactions.GetTotalTransactionCount(
                addressUint160);

            return(new JObject
            {
                ["balance"] = balance.ToString(),
                ["staked"] = staked.ToString(),
                ["staking"] = staking.ToString(),
                ["penalty"] = penalty.ToString(),
                ["nonce"] = nonce,
            });
        }