Exemple #1
0
 protected override void NotifyToChildrenAsChanged()
 {
     //https://api.ethermine.org//miner/:miner/currentStats
     //{"status":"OK","data":[{"worker":"3090-2","time":1621352400,"lastSeen":1621352367,"reportedHashrate":433797908,"currentHashrate":411547659.92833334,"validShares":343,"invalidShares":0,"staleShares":3,"averageHashrate":415222961.9435879},{"worker":"3090-5li","time":1621352400,"lastSeen":1621352367,"reportedHashrate":707161209,"currentHashrate":661196443.3458333,"validShares":549,"invalidShares":0,"staleShares":8,"averageHashrate":692508591.4666438},{"worker":"melih-kktc","time":1621352400,"lastSeen":1621352366,"reportedHashrate":1260949519,"currentHashrate":1247647384.7508333,"validShares":1036,"invalidShares":0,"staleShares":15,"averageHashrate":1220588015.0897803},{"worker":"melih-rigrig-1","time":1621352400,"lastSeen":1621352361,"reportedHashrate":406673131,"currentHashrate":460880884.27416664,"validShares":385,"invalidShares":0,"staleShares":2,"averageHashrate":397732136.68556714},{"worker":"melih-rigrig-1-redminer","time":1621352400,"lastSeen":1621352365,"reportedHashrate":258040846,"currentHashrate":265635850.07416666,"validShares":222,"invalidShares":0,"staleShares":1,"averageHashrate":245787065.04707173}]}
     if (!HasError() && HasText())
     {
         if (m_address != null && m_address.Length > 0)
         {
             DefaultWalletAddress wallet = new DefaultWalletAddress(m_address);
             result             = JsonUtility.FromJson <Json_Result>(GetText());
             isConverted        = true;
             m_minerInformation = new EtherMinerOrgMinerInfo(wallet);
             m_minerInformation.SetPaid(result.data.unpaid, result.data.unconfirmed);
             m_minerInformation.SetEstimationWin(result.data.coinsPerMin, result.data.usdPerMin, result.data.btcPerMin);
             m_minerInformation.SetActiveWorker(result.data.activeWorkers);
             EtherMineOrgWorkerFrame frame = new EtherMineOrgWorkerFrame();
             frame.SetWorkerRef(new EhterMineWorkerRef(new DefaultWorkerFromWalletID(wallet, "")));
             frame.SetTime(result.data.time);
             frame.SetTimeLastSeen(result.data.time);
             frame.SetShares(result.data.validShares, result.data.invalidShares, result.data.staleShares);
             frame.SetHashRate(result.data.currentHashrate, result.data.reportedHashrate, result.data.averageHashrate);
             m_minerInformation.SetCurrentStateAsFrame(frame);
         }
     }
     else
     {
         isConverted = false;
     }
 }
Exemple #2
0
    protected override void NotifyToChildrenAsChanged()
    {
        //https://api.ethermine.org/miner/ee328a992046570f45970e06155b87e813361a4a/workers
        //{"status":"OK","data":[{"worker":"3090-2","time":1621352400,"lastSeen":1621352367,"reportedHashrate":433797908,"currentHashrate":411547659.92833334,"validShares":343,"invalidShares":0,"staleShares":3,"averageHashrate":415222961.9435879},{"worker":"3090-5li","time":1621352400,"lastSeen":1621352367,"reportedHashrate":707161209,"currentHashrate":661196443.3458333,"validShares":549,"invalidShares":0,"staleShares":8,"averageHashrate":692508591.4666438},{"worker":"melih-kktc","time":1621352400,"lastSeen":1621352366,"reportedHashrate":1260949519,"currentHashrate":1247647384.7508333,"validShares":1036,"invalidShares":0,"staleShares":15,"averageHashrate":1220588015.0897803},{"worker":"melih-rigrig-1","time":1621352400,"lastSeen":1621352361,"reportedHashrate":406673131,"currentHashrate":460880884.27416664,"validShares":385,"invalidShares":0,"staleShares":2,"averageHashrate":397732136.68556714},{"worker":"melih-rigrig-1-redminer","time":1621352400,"lastSeen":1621352365,"reportedHashrate":258040846,"currentHashrate":265635850.07416666,"validShares":222,"invalidShares":0,"staleShares":1,"averageHashrate":245787065.04707173}]}
        if (!HasError() && HasText())
        {
            isConverted = true;
            result      = JsonUtility.FromJson <Json_Result>(GetText());
            if (result.status.ToLower() == "ok")
            {
                WalletAddress address = new DefaultWalletAddress(m_addressTarget);
                m_resultWorkers = new WorkerLinkedData <EtherMineOrgWorkerFrame> [result.data.Length];
                for (int i = 0; i < result.data.Length; i++)
                {
                    Json_Data d = result.data[i];
                    DefaultWorkerFromWalletID worker = new DefaultWorkerFromWalletID(address, result.data[i].worker);
                    string workerFullId = worker.GetWorkerId();


                    EtherMineOrgWorkerFrame frame = new EtherMineOrgWorkerFrame();
                    frame.SetWorkerRef(new EhterMineWorkerRef(worker));
                    frame.SetTime((ulong)d.time);
                    frame.SetTimeLastSeen((ulong)d.time);
                    frame.SetHashRate((double)d.currentHashrate, (double)d.reportedHashrate, (double)d.averageHashrate);
                    frame.SetShares(d.validShares, d.invalidShares, d.staleShares);
                    m_resultWorkers[i] = new WorkerLinkedData <EtherMineOrgWorkerFrame>(worker, frame);
                }
            }
        }
        else
        {
            isConverted = false;
        }
    }