Make it work
This commit is contained in:
parent
746149e89a
commit
03438bb890
|
@ -2,7 +2,6 @@
|
|||
|
||||
This tool pins the IPFS hashes of a Kredits organisation on a IPFS node.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
$ kredits-ipfs-pinner --help
|
||||
|
|
|
@ -7,7 +7,8 @@ class IpfsPinner {
|
|||
pinAll () {
|
||||
return Promise.all([
|
||||
this._pinAllFromContract(this.kredits.Contributor),
|
||||
this._pinAllFromContract(this.kredits.Contribution)
|
||||
this._pinAllFromContract(this.kredits.Contribution),
|
||||
this._pinAllFromContract(this.kredits.Proposal)
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -30,10 +31,13 @@ class IpfsPinner {
|
|||
}
|
||||
|
||||
_pinAllFromContract (contract) {
|
||||
console.log(`Pinning data from ${contract.constructor.name}...`);
|
||||
return contract.count.then(count => {
|
||||
let promises = [...Array(count).keys()].map(i => {
|
||||
let id = i + 1; // 0 => 1 - ids start with 1 and not with 0
|
||||
console.log(`Loading ${contract.constructor.name} #${id}`);
|
||||
return contract.getData(id).then(data => {
|
||||
console.log(`Pinning ${contract.constructor.name} #${id}`);
|
||||
return this.ipfsApi.pin(data);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1073,13 +1073,14 @@
|
|||
}
|
||||
},
|
||||
"kredits-contracts": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.3.0.tgz",
|
||||
"integrity": "sha512-Wz4zuA6yo0Q4WbVEO61fvFin+6VTNjkBqHPhHCqq6dIoGdFSjUZ3BCKan1ei0axIAda7ZDP+eebe2vCr+eqcHg==",
|
||||
"version": "5.4.0",
|
||||
"resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.4.0.tgz",
|
||||
"integrity": "sha512-Oz5c+wbuDhZ0uYKRWPxSpsNiUXdrZlJ6Vp/+IMMSjD/TmlHGwP2Pnmloyq4Xjim0JbA/bJSjyBdy62dCrqCLrw==",
|
||||
"requires": {
|
||||
"ethers": "^4.0.27",
|
||||
"ipfs-http-client": "^30.1.1",
|
||||
"kosmos-schemas": "^2.0.0",
|
||||
"ethers": "^4.0.29",
|
||||
"ipfs-http-client": "^30.1.3",
|
||||
"kosmos-schemas": "^2.1.0",
|
||||
"node-fetch": "^2.6.0",
|
||||
"tv4": "^1.3.0"
|
||||
}
|
||||
},
|
||||
|
@ -1338,6 +1339,11 @@
|
|||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
||||
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
||||
},
|
||||
"node-forge": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.7.6.tgz",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"kredits-contracts": "^5.3.0",
|
||||
"kredits-contracts": "^5.4.0",
|
||||
"yargs": "^13.2.4"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue