Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task <object> GetAsset(UInt160 asset)
        {
            var assetInfo = AssetCache.GetAssetInfo(asset);

            if (assetInfo == null)
            {
                return(null);
            }
            var totalSupply = AssetCache.GetTotalSupply(asset);

            using var db = new TrackDB();
            var record = db.GetContract(asset);
            var trans  = db.QueryTransactions(new TransactionFilter()
            {
                Contracts = new List <UInt160>()
                {
                    asset
                }, PageSize = 0
            });

            return(new AssetInfoModel()
            {
                Asset = assetInfo.Asset,
                Decimals = assetInfo.Decimals,
                Name = assetInfo.Name,
                Symbol = assetInfo.Symbol,
                TotalSupply = totalSupply,
                CreateTime = record?.CreateTime,
                TransactionCount = trans.TotalCount,
            });
        }