Esempio n. 1
0
        public IRpcMethodResult GetAddressesByTag(string tag)
        {
            try
            {
                var accountComponent = new AccountComponent();
                var accounts         = accountComponent.GetAccountsByTag(tag);
                var result           = new List <AccountOM>();

                foreach (var account in accounts)
                {
                    var item = new AccountOM();
                    item.Address   = account.Id;
                    item.PublicKey = account.PublicKey;
                    item.Balance   = account.Balance;
                    item.IsDefault = account.IsDefault;
                    item.WatchOnly = account.WatchedOnly;
                    item.Tag       = account.Tag;

                    result.Add(item);
                }

                return(Ok(result.ToArray()));
            }
            catch (CommonException ce)
            {
                return(Error(ce.ErrorCode, ce.Message, ce));
            }
            catch (Exception ex)
            {
                return(Error(ErrorCode.UNKNOWN_ERROR, ex.Message, ex));
            }
        }