Allow overriding confirmedAtBlock and vetoed in JS API

This commit is contained in:
Râu Cao 2023-08-24 16:43:18 +02:00
parent 1f91a13f06
commit 5e33381f2a
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
2 changed files with 9 additions and 1 deletions

View File

@ -41,6 +41,8 @@ class Contribution extends Record {
async add (contributionAttr, callOptions = {}) {
const contribution = new ContributionSerializer(contributionAttr);
const confirmedAtBlock = contributionAttr.confirmedAtBlock || 0;
const vetoed = contributionAttr.vetoed || false;
try { await contribution.validate(); }
catch (error) { return Promise.reject(error); }
@ -56,9 +58,11 @@ class Contribution extends Record {
ipfsHashAttr.hashDigest,
ipfsHashAttr.hashFunction,
ipfsHashAttr.hashSize,
confirmedAtBlock,
vetoed,
];
return this.contract.add(...contribution, 0, false, callOptions);
return this.contract.add(...contribution, callOptions);
});
}

View File

@ -23,6 +23,8 @@ class Reimbursement extends Record {
const amount = parseInt(attrs.amount);
const token = attrs.token;
const recipientId = attrs.recipientId;
const confirmedAtBlock = attrs.confirmedAtBlock || 0;
const vetoed = attrs.vetoed || false;
const expenses = attrs.expenses.map((e) => new ExpenseSerializer(e));
let errorMessage;
@ -56,6 +58,8 @@ class Reimbursement extends Record {
ipfsHashAttr.hashDigest,
ipfsHashAttr.hashFunction,
ipfsHashAttr.hashSize,
confirmedAtBlock,
vetoed,
];
return this.contract.add(...reimbursement, callOptions);