Adjust API for new ethers v5 API
see issue for details: https://github.com/ethers-io/ethers.js/issues/920#issuecomment-650836642
This commit is contained in:
@@ -19,10 +19,10 @@ module.exports = async function(callback) {
|
||||
let contributorAccount;
|
||||
if (contributor.length < 5) {
|
||||
contributorId = contributor;
|
||||
contributorAccount = await kredits.Contributor.functions.getContributorAddressById(contributor);
|
||||
contributorAccount = await kredits.Contributor.contract.getContributorAddressById(contributor);
|
||||
} else {
|
||||
contributorAccount = contributor;
|
||||
contributorId = await kredits.Contributor.functions.getContributorIdByAddress(contributor);
|
||||
contributorId = await kredits.Contributor.contract.getContributorIdByAddress(contributor);
|
||||
}
|
||||
|
||||
console.log(`Creating a contribution for contributor account ${contributorAccount} ID: ${contributorId}`);
|
||||
|
||||
@@ -19,10 +19,10 @@ module.exports = async function(callback) {
|
||||
let contributorAccount;
|
||||
if (contributor.length < 5) {
|
||||
contributorId = contributor;
|
||||
contributorAccount = await kredits.Contributor.functions.getContributorAddressById(contributor);
|
||||
contributorAccount = await kredits.Contributor.contract.getContributorAddressById(contributor);
|
||||
} else {
|
||||
contributorAccount = contributor;
|
||||
contributorId = await kredits.Contributor.functions.getContributorIdByAddress(contributor);
|
||||
contributorId = await kredits.Contributor.contract.getContributorIdByAddress(contributor);
|
||||
}
|
||||
console.log(`Creating a proposal for contributor ID #${contributorId} account: ${contributorAccount}`);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = async function(callback) {
|
||||
|
||||
if (c.contributorId === recipient && confirmed && !c.vetoed && !c.claimed) {
|
||||
console.log(`Claiming contribution ID=${c.id}`);
|
||||
return kredits.Contribution.functions.claim(c.id, { gasLimit: 500000 }).then(tx => {
|
||||
return kredits.Contribution.contract.claim(c.id, { gasLimit: 500000 }).then(tx => {
|
||||
table.push([
|
||||
c.id.toString(),
|
||||
`${c.description}`,
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = async function(callback) {
|
||||
|
||||
method = await promptly.prompt('Function: ');
|
||||
}
|
||||
if (!contractWrapper[method] && !contractWrapper.functions[method]) {
|
||||
if (!contractWrapper[method] && !contractWrapper.contract[method]) {
|
||||
callback(new Error(`Method ${method} is not defined on ${contractName}`));
|
||||
return;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ module.exports = async function(callback) {
|
||||
if (contractWrapper[method]) {
|
||||
func = contractWrapper[method];
|
||||
} else {
|
||||
func = contractWrapper.functions[method];
|
||||
func = contractWrapper.contract[method];
|
||||
}
|
||||
func.apply(contractWrapper, args).then((result) => {
|
||||
console.log("\nResult:");
|
||||
|
||||
@@ -41,8 +41,8 @@ module.exports = async function(callback) {
|
||||
|
||||
console.log(table.toString());
|
||||
|
||||
let totalKreditsEarnedUnConfirmed = await kredits.Contribution.functions.totalKreditsEarned(false);
|
||||
let totalKreditsEarnedConfirmed = await kredits.Contribution.functions.totalKreditsEarned(true);
|
||||
let totalKreditsEarnedUnConfirmed = await kredits.Contribution.contract.totalKreditsEarned(false);
|
||||
let totalKreditsEarnedConfirmed = await kredits.Contribution.contract.totalKreditsEarned(true);
|
||||
console.log(`Total Kredits: ${totalKreditsEarnedConfirmed} (confirmed) | ${totalKreditsEarnedUnConfirmed} (including unconfirmed)`);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
|
||||
@@ -38,7 +38,7 @@ module.exports = async function(callback) {
|
||||
if (contractWrapper[method]) {
|
||||
func = contractWrapper[method];
|
||||
} else {
|
||||
func = contractWrapper.functions[method];
|
||||
func = contractWrapper.contract[method];
|
||||
}
|
||||
func.apply(contractWrapper, args).then((result) => {
|
||||
console.log(`[OK] kredits.${contractName}.${method}(${JSON.stringify(args)}) => ${result.hash}`);
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = async function(callback) {
|
||||
console.log(`Recording a veto for contribution #${contributionId}`);
|
||||
|
||||
try {
|
||||
kredits.Contribution.functions.veto(contributionId, { gasLimit: 300000 })
|
||||
kredits.Contribution.contract.veto(contributionId, { gasLimit: 300000 })
|
||||
.then(result => {
|
||||
console.log("\n\nResult:");
|
||||
console.log(result);
|
||||
|
||||
Reference in New Issue
Block a user