Is there another way to check the stake (in best case with JavaScript I think)? Which node do you use? What is wrong suddenly? It worked until 2, 3 days ago. Then api.hive-engine.com was down completely, now the node seems to be back, but my stake reading doesn't start to work again. Your support would be very welcome.
(Yes, I asked at the HiveDevs Discord and two buddies, too. As soon as I have a solution from anywhere I post the solution as comment under this article.)
async function findUserCCDStake() {
try {
const response = await fetch('https://api.hive-engine.com/rpc/contracts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'find',
params: {
contract: 'tokens',
table: 'balances',
query: {
symbol: 'CCD',
account: 'powerpaul', // powerpaul has 300,000 CCD in stake
},
},
id: 1,
}),
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const userData = await response.json();
if (userData.result && userData.result.length > 0) {
userCCDStake = parseFloat(userData.result[0].stake || 0);
console.log(userCCDStake);
return userCCDStake;
} else {
return 0; // If no CCD stake found
}
} catch (error) {
console.error('Error on api.hive-engine.com/rpc/contracts:', error.message);
return 0;
}
}
Once again thank you for your support!
Hi Paul bro,
I am looked the code in my vscode and it showed some errors. I have corrected it with best of my knowledge to remove errors, I have no idea of backend development so you do it as you feel fit.
I have created a variable toastManager as it was not declared and was giving error.
commented toastManager line in if block as createToast is not working and err is not defined.
In Catch block, I have added error instead of err as it was not declared anywhere in the code.
You need to use the function findUserCCDStake(username), make sure it is fetching data from node servers and whether you have created another script file to import this code to be implemented.
I hope you'll try and give me your feedback.
Hey. Thank you.
the toastStuff & err is defined further at the top of the file, don't worry about the toastStuff. This snippet is just a part of the whole file - but everything needed for fetching the stake. Yes, would be better to delete it from the example to don't confuse... We need the focus on fetching the data - you was able to do so?
Exactly, you was able to do so? This is the problem. All other stuff is okay in my file.
Let me clean the code to leave only the minimum without any toastStuff or so.
Thank you for your look!
SOLVED. Or at least seems to work / works for me again. Node seems to deliver the data as needed again. So when the node is working the CCCEO users should be able to use the voter as normal. In the long term I have to find a more solid solution.
THANK YOU once again!
It's good to know that your CCD fetch mechanism is now intact and working to deliver the desired results. 😀 Happy times again and ever.
Hi my big brother with the best of vibes. Ouch to be honest it's frustrating when a reliable method suddenly stops working. Have you tried reaching out to the Hive community directly? Sometimes a fresh pair of eyes can spot the issue😁. Good luck with finding a solution my good brother. As always more pow POW POW powwwwwwwweerrrrr to Great Paul
Hey. Yes, kind of. Asked in Discords, a few friends, mentioned this under the voter comments - let's see where help comes up first...
Actually I am on finishing the @BroBang stuff for the passed season which ended a few hours ago. As soon as this is done, I am back in the code for this task here...
When it comes, it comes all together... lol
Hive a great day my friend! I will have, too - unrelated to every "aaaaargh".
Stay groovy &
Hope everything goes really well for you my good friend.... Have a great week Paul🥰🥰🥰🥰🥰
Glad you find a solution for that issue!
Curated by @arc7icwolf.byte for the #LearnToCode community.
Me too. Always a little tricky when the own service depends on other services. I have to solve this step by step, if this would improve the strength of my doings and/or our network and not exceed my manpower. But in every case I am glad that we are such a powerful community... At the end we all try to give our best to empower our blockchain and it is pretty amazing what the people do for it - also if something runs not as planned, most people are very engaged to do their part wherever they see their role/possibilities; and that id pretty awesome! We are really kind of unique community here... That's foo awesome!
Wolf, buddy, thank you for your curation! Awesome to be with you! Hive on!
Hive teamwork at its best! I love to read that there are so many people ready to help solve an issue :) this is the true potential of Hive.
Just trying to give back something, mate! :)
Let's keep grinding!
!PIZZA
Interesting to see how things happen in the backround, curated by byte tribe
$PIZZA slices delivered:
@arc7icwolf(7/10) tipped @powerpaul
Congratulations @powerpaul! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)
Your next target is to reach 25000 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out our last posts: