Skip to content

Commit

Permalink
chore: removed clogs
Browse files Browse the repository at this point in the history
  • Loading branch information
andremury committed Dec 19, 2023
1 parent 69ea0c8 commit 9627a78
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 0 additions & 4 deletions assets/javascripts/lib/karma-api-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,12 @@ class KarmaApiClient {
* @returns {import('karma-score').ParsedProposal[]}
*/
#parseVotingSummary = (summary) => {
console.info('voting summary', summary)
const { proposals, votes } = summary;
const parsedVotes = [];

votes.sort().forEach((vote) => {
const [id, version] = vote.proposalId.split('-');
console.log('id', id, 'version', version)
const proposal = proposals.find(p => p.id === +id && p.version === version);
console.log('proposal', proposal)
if (!proposal) {
return;
}
Expand All @@ -143,7 +140,6 @@ class KarmaApiClient {
* @returns {Promise<import("karma-score").KarmaApiVotesSummaryRes>
*/
async fetchVoteSummary() {
console.info('fetching voting summary')
if (!['moonbeam', 'moonriver', 'moonbase'].includes(this.daoName.toLowerCase())) {
return { proposals: [], votes: [] };
}
Expand Down
1 change: 0 additions & 1 deletion assets/javascripts/lib/voting-history/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const VotingHistory = {
const amount = this.shouldShowVotingHistory(ctx);

if (['moonbeam', 'moonriver', 'moonbase'].includes(daoName.toLowerCase())) {
console.info('voting history for' + daoName)
const votes = await moonriverFetcher(daoName, profile.address);
return votes.slice(0, amount);
}
Expand Down
12 changes: 3 additions & 9 deletions assets/javascripts/lib/voting-history/moonbeam/moonbeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@ function concatOnChainProposals(proposals, votes) {
}

async function proposalsWithMetadata(daoName) {
console.log('proposals with metadata')
const url = `https://dapp.karmahq.xyz/api/proposals?dao=${daoName?.toLowerCase()}&source=on-chain`;
const url = `https://delegate.moonbeam.network/api/proposals?dao=${daoName?.toLowerCase()}&source=on-chain`;
const data = await fetch(url, {
method: "GET",
}).then(async (res) => await res.json());
console.info('cu de saco', data)
return data;
}

Expand Down Expand Up @@ -104,7 +102,6 @@ async function fetchOnChainVotes(daoName, address) {
daoName = [daoName].flat()[0]
const cli = new KarmaApiClient([daoName].flat()[0], address);
const { votes, proposals: cachedProposals } = await cli.fetchVoteSummary();
console.info('deu n vote', votes, cachedProposals)

const voteList = votes.map(vote => ({
proposal: vote.proposalId.split('-')[0],
Expand All @@ -117,7 +114,7 @@ async function fetchOnChainVotes(daoName, address) {
return concatOnChainProposals(proposals, voteList);
}
} catch (error) {
console.info(error)
console.error(error)
return [];
}
return [];
Expand All @@ -127,14 +124,11 @@ export async function moonriverFetcher(
daoName,
address
) {
console.info('fetching moonriver')
try {
const votes = await fetchOnChainVotes(daoName, address);
console.info('deu vote', votes)
return votes;
} catch (error) {
console.info('deu error')
console.info(error)
console.error(error)
return [];
}
}

0 comments on commit 9627a78

Please sign in to comment.