Adjust wrapper and scripts for contract changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user