示例#1
0
        public decimal BalanceOf(byte[] addressHash)
        {
            InvokeResult response = new InvokeResult();

            try
            {
                response = api.InvokeScript(ScriptHash, "balanceOf", new object[] { addressHash });
                var balance = response.result.GetBigInteger();
                return(ConvertToDecimal(balance, this.Decimals));
            }
            catch
            {
                throw new NeoException("Api did not return a value." + response);
            }
        }
示例#2
0
        public decimal BalanceOf(byte[] addressHash)
        {
            InvokeResult response = new InvokeResult();

            try
            {
                response = api.InvokeScript(scriptHash, "balanceOf", new object[] { addressHash });
                var bytes   = (byte[])response.stack[0];
                var balance = new BigInteger(bytes);
                return(ConvertToDecimal(balance));
            }
            catch
            {
                throw new NeoException("Api did not return a value." + response);
            }
        }