Hello Steemians,
I am excited to share with you my recent development for automating to generate the curation report using SDS API that are developed by @Steemchiller. It is created to automated system that fetches voting posts with voting weight from the Steem blockchain then compile it to make a formatted curation report. Manually compiling curation reports take a lot of time and also cause for errors facing in data preparation. By automating this process, curators can save valuable time and ensure accuracy in their reports.
Language and API.
- SDS API: For data fetching
- JavaScript Language: For server-side scripting and report automation.
- SteemJS LIB: Library for report broadcasting.
For this development I have use a function in which we hit the SDS API to get the curation info of curators by using date parameters. I will cover this topic within two posts in this post. i will share the function to give the date parameter in UNIX format and get the data from Api but in second part we will make a formatted body for post and write the broadcasting function
function getSystemDateRangeUnix() {
const currentDateMillis = Date.now();
const pakistanOffsetMillis = 5 * 60 * 60 * 1000;
const dtt = currentDateMillis + pakistanOffsetMillis;
const fromDateMillis = dtt - (2 * 24 * 60 * 60 * 1000);
const toDateMillis = dtt - (1 * 24 * 60 * 60 * 1000);
return {
fromDate: Math.floor(fromDateMillis / 1000),
toDate: Math.floor(toDateMillis / 1000)
};
}
function convertUnixToDate(unixTimestamp) {
const date = new Date(unixTimestamp * 1000);
return date.toISOString().slice(0, 10); // Return date in YYYY-MM-DD format
}
const dateRangeUnix = getSystemDateRangeUnix();
const fdate = dateRangeUnix.fromDate;
const tdate = dateRangeUnix.toDate;
const api1 = `https://sds.steemworld.org/account_history_api/getHistoryByOpTypesTime/beautycreativity/vote,comment/${fdate}-${tdate}`;
let data;
fetch(api1)
.then(response => response.json())
.then(apiData => {
data = apiData.result.rows;
console.log('data', data);
const filteredData = data.filter(innerArray => innerArray[6][1].voter === 'beautycreativity');
const convertedArray = filteredData.map((innerArray, index) => {
const dauthor = innerArray[6][1].author;
const dpermlink = innerArray[6][1].permlink;
const dvoter = innerArray[6][1].voter;
const dweight = innerArray[6][1].weight / 100;
return [index + 1, dauthor, dpermlink, dvoter, dweight];
});
console.log('Converted Array:', convertedArray);
const readableFromDate = convertUnixToDate(fdate);
const readableToDate = convertUnixToDate(tdate);
console.log('Readable From Date:', readableFromDate);
console.log('Readable To Date:', readableToDate);
})
.catch(error => {
console.error('Error fetching data from api1:', error);
});
Please cast witness vote to bangla.Witness or set proxy to rme.
_
Vote bangla.witness as witness
Set Proxy rme as proxy
Special Thanks.
Cc: @rme
Cc: @hungry-griffin
Cc: @steemcurator01
Cc: @steemchiller
Cc: @pennsif
Thanks for giving your precious time to my post.
Follow | Upvote | Share | Comments
Follow me on Instagram.
Instagram
🆃🅷🅰️🅽🅺 🆈🅾️🆄
Upvoted! Thank you for supporting witness @jswit.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit