Pin reimbursements
Release Drafter / Update release notes draft (pull_request) Successful in 3s Details

This commit is contained in:
Râu Cao 2023-04-26 15:58:19 +02:00
parent 3c7bcf038e
commit 83b3045afd
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
1 changed files with 7 additions and 3 deletions

View File

@ -29,8 +29,7 @@ class IpfsPinner {
const contracts = [
this.kredits.Contributor,
this.kredits.Contribution,
// TODO uncomment once we have data here
// this.kredits.Reimbursement
this.kredits.Reimbursement
]
for (const contract of contracts) {
@ -72,6 +71,11 @@ class IpfsPinner {
.then(data => { return this.ipfsApi.pin(data); })
.then(callback);
});
this.kredits.Reimbursement.on('ReimbursementAdded', (id) => {
this.kredits.Reimbursement.getData(id)
.then(data => { return this.ipfsApi.pin(data); })
.then(callback);
});
}
async _pinAllFromContract (contract, itemCount, progressBar) {
@ -91,7 +95,7 @@ class IpfsPinner {
cid = await ipfsApi.pin(data);
debug(`Pinned ${contract.constructor.name} #${id} at ${cid}`);
} catch(e) {
debug(`Error while trying to load an pin ${contract.constructor.name} #${id}:`)
debug(`Error while trying to load and pin ${contract.constructor.name} #${id}:`)
debug(e);
debug(`\nTrying again...`);
loadAndPin(id);