Adjust wrapper and scripts for contract changes
This commit is contained in:
parent
6088f30cd8
commit
5b49f82544
@ -7,8 +7,7 @@ const Base = require('./base');
|
||||
class Contribution extends Base {
|
||||
all() {
|
||||
return this.functions.contributionsCount()
|
||||
.then((count) => {
|
||||
count = count.toNumber();
|
||||
.then(count => {
|
||||
let contributions = [];
|
||||
|
||||
for (let id = 1; id <= count; id++) {
|
||||
@ -20,31 +19,29 @@ class Contribution extends Base {
|
||||
}
|
||||
|
||||
getById(id) {
|
||||
id = ethers.utils.bigNumberify(id);
|
||||
|
||||
return this.functions.getContribution(id)
|
||||
.then((data) => {
|
||||
.then(data => {
|
||||
return this.ipfs.catAndMerge(data, ContributionSerializer.deserialize);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
getByContributorId(contributorId) {
|
||||
return this.functions.balanceOf(address)
|
||||
then((balance) => {
|
||||
count = balance.toNumber();
|
||||
|
||||
let contributions = [];
|
||||
|
||||
for (let index = 0; index <= count; index++) {
|
||||
this.functions.tokenOfOwnerByIndex(address, index)
|
||||
.then((id) => {
|
||||
contributions.push(this.getById(id));
|
||||
});
|
||||
}
|
||||
|
||||
return RSVP.all(contributions);
|
||||
});
|
||||
// return this.functions.balanceOf(address)
|
||||
// then(balance => {
|
||||
// count = balance.toNumber();
|
||||
//
|
||||
// let contributions = [];
|
||||
//
|
||||
// for (let index = 0; index <= count; index++) {
|
||||
// this.functions.tokenOfOwnerByIndex(address, index)
|
||||
// .then((id) => {
|
||||
// contributions.push(this.getById(id));
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// return RSVP.all(contributions);
|
||||
// });
|
||||
}
|
||||
|
||||
getByContributorAddress(address) {
|
||||
|
@ -7,8 +7,7 @@ const Base = require('./base');
|
||||
class Contributor extends Base {
|
||||
all() {
|
||||
return this.functions.contributorsCount()
|
||||
.then((count) => {
|
||||
count = count.toNumber();
|
||||
.then(count => {
|
||||
let contributors = [];
|
||||
|
||||
for (let id = 1; id <= count; id++) {
|
||||
@ -20,8 +19,6 @@ class Contributor extends Base {
|
||||
}
|
||||
|
||||
getById(id) {
|
||||
id = ethers.utils.bigNumberify(id);
|
||||
|
||||
return this.functions.getContributorById(id)
|
||||
.then((data) => {
|
||||
// TODO: remove when naming updated on the contract
|
||||
|
@ -27,7 +27,7 @@ module.exports = async function(callback) {
|
||||
console.log(`Creating a contribution for contributor account ${contributorAccount} ID: ${contributorId}`);
|
||||
|
||||
let contributionAttributes = {
|
||||
contributorAccount,
|
||||
contributorId,
|
||||
amount: await promptly.prompt('Amount: '),
|
||||
description: await promptly.prompt('Description: '),
|
||||
kind: await promptly.prompt('Kind: ', { default: 'dev' }),
|
||||
|
@ -14,7 +14,6 @@ module.exports = async function(callback) {
|
||||
|
||||
console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`);
|
||||
|
||||
|
||||
const table = new Table({
|
||||
head: ['ID', 'Contributor account', 'Amount', 'Claimed?', 'Vetoed?', 'Description']
|
||||
})
|
||||
@ -24,7 +23,7 @@ module.exports = async function(callback) {
|
||||
contributions.forEach((c) => {
|
||||
table.push([
|
||||
c.id.toString(),
|
||||
c.contributor,
|
||||
c.contributorId,
|
||||
c.amount.toString(),
|
||||
c.claimed,
|
||||
c.vetoed,
|
||||
|
Loading…
x
Reference in New Issue
Block a user