오늘 RC를 까고 바로 RC 확인하는 개발 글을 올립니다... RC(리소스 크레디트) 채우기 위한 시간을 확인하려고 디스코드까지 접속하는게 불편하다고 생각했습니다. 그래서 바로 제 사이트에 추가했습니다. 사이트에서 편리하게 확인해보세요. ㅎㅎㅎ ( 궁금하다 보니 어느 순간 바로 코딩을 하고 있더군요. )
https://nhj7.github.io/steem.apps/
참고하셔서 본인 사이트나 서드파티에 추가하실 분들은 https://github.com/nhj7/nhj7.github.io 소스 참고하시면 됩니다. 그리고 핵심이 되는 코드 올립니다. 본인 사이트에 맞게 수정하셔서 쓰시면 됩니다. 제 사이트는 deferred
를 사용하고 있어 저런 패턴입니다.
function getResourceCredits(arr_acct_nm) {
var deferred = $.Deferred();
let param={"jsonrpc":"2.0","id":1,"method":"rc_api.find_rc_accounts","params":{"accounts":arr_acct_nm}};
$.ajax({
url: "https://api.steemitstage.com/",
type: "POST",
data: JSON.stringify(param),
success: function(res){
deferred.resolve(res);
console.log(res);
},
error:function(e){
console.log(e);
deferred.reject(err);
}
});
return deferred.promise();
}
function getTimeBeforeFull(votingPower) {
var fullInString;
var remainingPowerToGet = 100.0 - votingPower / 100;
// 1% every 72minutes
var minutesNeeded = remainingPowerToGet * 72;
if (minutesNeeded === 0) {
fullInString = "Already full!";
} else {
var fullInDays = parseInt(minutesNeeded / 1440);
var fullInHours = parseInt((minutesNeeded - fullInDays * 1440) / 60);
var fullInMinutes = parseInt((minutesNeeded - fullInDays * 1440 - fullInHours * 60));
fullInString = (fullInDays === 0 ? '' : fullInDays + (fullInDays > 1 ? ' days ' : 'day ')) +
(fullInHours === 0 ? '' : fullInHours + (fullInHours > 1 ? ' hours ' : 'hour ')) +
(fullInMinutes === 0 ? '' : fullInMinutes + (fullInMinutes > 1 ? ' minutes ' : 'minute'));
}
return fullInString;
}
'rc_api.find_rc_accounts' jsonrpc로 RC 데이터를 얻고 시간계산하는 함수 추가하고 아래 계산 부를 넣으면 끝이 납니다.
......
// start rc calc.
console.log(rcInfo);
const STEEM_RC_MANA_REGENERATION_SECONDS =432000;
const estimated_max = parseFloat(rcInfo.result.rc_accounts["0"].max_rc);
const current_mana = parseFloat(rcInfo.result.rc_accounts["0"].rc_manabar.current_mana);
const last_update_time = parseFloat(rcInfo.result.rc_accounts["0"].rc_manabar.last_update_time);
const diff_in_seconds = Math.round(Date.now()/1000-last_update_time);
let estimated_mana = (current_mana + diff_in_seconds * estimated_max / STEEM_RC_MANA_REGENERATION_SECONDS);
if (estimated_mana > estimated_max)
estimated_mana = estimated_max;
const estimated_pct = estimated_mana / estimated_max * 100;
const calcRC = {"current_mana": current_mana, "last_update_time": last_update_time,
"estimated_mana": estimated_mana, "estimated_max": estimated_max, "estimated_pct": estimated_pct.toFixed(2),"fullin":getTimeBeforeFull(estimated_pct*100)};
console.log(calcRC);
data.resource_credits = calcRC.estimated_pct;
data.rc_fullin = calcRC.fullin
// end resource_credits
......
참고
https://github.com/steemplus (스팀플러스 github )
I believe your mana meter is not accurate. Had another account at 54% Mana and powered up 6k SP; then your Mana meter showed 100%. However, a full vote only still gave 54%.
Steemd still showed 54% even after powerup.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Can you give me the account name? I will check it out. I think the calculation method changed after the voting mana occurred.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
It seems to be working now! Thanks!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I saw symptoms similar to what you said. The voting mana can be seen normally if you have more than one vote on the account with the symptoms. I will apply it when I find a new voting mana calculation. Can you vote for your other account and check the voting mana?
Thanks for reporting. :) ( I used Google Translator. T.T )
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
boddhisattva님이 nhj12311님을 멘션하셨습니당. 아래 링크를 누르시면 연결되용~ ^^
boddhisattva님의 TOP 200 effective Steemit curators in KR category for the last week (2018.09.24-2018.09.30)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
boddhisattva님이 steem.apps님을 멘션하셨습니당. 아래 링크를 누르시면 연결되용~ ^^
boddhisattva님의 TOP 200 effective Steemit curators in KR category for the last week (2018.09.24-2018.09.30)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
@시리즈
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
소스 공개 감사합니다. 잘 사용할께요~^^
혹시 댓글을 몇 개 쓸 수 있는지도 계산가능한가요?
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
tabris님이 수치를 적어놓으신걸 활용하면 될거 같은데 계산하는 방식이 있긴 할거에요. 가변적일듯.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
가변적이군요. 그럼 줄어드는 수치를 보고 대략적으로 계산해야겠네요.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
댓글을 달아보아요~!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
wdev님이 nhj12311님을 멘션하셨습니당. 아래 링크를 누르시면 연결되용~ ^^
wdev님의 (진행중) 005.빈칸맞추기.상금3스달.kr-blank
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
wonsama님이 nhj12311님을 멘션하셨습니당. 아래 링크를 누르시면 연결되용~ ^^
wonsama님의 (진행중) 005.빈칸맞추기.상금3스달.kr-blank
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit