Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ba7c98b564 | |||
| 3f03368e25 | |||
| a3d21ebb30 | |||
| b11dbb9fde | |||
|
|
bfb51d48bc | ||
| f2f884a317 |
21
index.js
21
index.js
@@ -2,9 +2,18 @@
|
|||||||
|
|
||||||
const Kredits = require('kredits-contracts');
|
const Kredits = require('kredits-contracts');
|
||||||
const IpfsPinner = require('./lib/ipfs-pinner');
|
const IpfsPinner = require('./lib/ipfs-pinner');
|
||||||
|
const debug = require('debug')('ipfs-pinner');
|
||||||
|
|
||||||
const argv = require('yargs')
|
const argv = require('yargs')
|
||||||
.default({ network: 'rinkeby', apm: 'open.aragonpm.eth', host: 'localhost', port: '5001', protocol: 'http', monitor: true })
|
.default({
|
||||||
|
network: 'rinkeby',
|
||||||
|
apm: 'open.aragonpm.eth',
|
||||||
|
host: 'localhost',
|
||||||
|
port: '5001',
|
||||||
|
protocol: 'http',
|
||||||
|
monitor: true,
|
||||||
|
bootstrapNode: '/ip4/46.4.18.160/tcp/4001/ipfs/QmZ4Lpzhz8bafbTYvEMMCmrbrMM4JfyHDR23WbCSAd9bo7'
|
||||||
|
})
|
||||||
.boolean('monitor')
|
.boolean('monitor')
|
||||||
.describe({
|
.describe({
|
||||||
network: 'Ethereum network to connect to',
|
network: 'Ethereum network to connect to',
|
||||||
@@ -13,7 +22,8 @@ const argv = require('yargs')
|
|||||||
host: 'IPFS API host',
|
host: 'IPFS API host',
|
||||||
port: 'IPFS API port',
|
port: 'IPFS API port',
|
||||||
protocol: 'IPFS API protocol',
|
protocol: 'IPFS API protocol',
|
||||||
monitor: 'Monitor contract events for new IPFS documents'
|
monitor: 'Monitor contract events for new IPFS documents',
|
||||||
|
bootstrapNode: 'IPFS node address to connect to before fetching documents'
|
||||||
})
|
})
|
||||||
.example('$0 --network rinkeby --host localhost', 'Pins all existing IPFS documents to the IPFS API running on localhost and monitors for new events.')
|
.example('$0 --network rinkeby --host localhost', 'Pins all existing IPFS documents to the IPFS API running on localhost and monitors for new events.')
|
||||||
.argv;
|
.argv;
|
||||||
@@ -35,7 +45,12 @@ console.log(`Using IPFS:`, ipfsConfig);
|
|||||||
|
|
||||||
// check the connection to the IPFS client
|
// check the connection to the IPFS client
|
||||||
// TODO redesign IPFS wrapper API and do not use an internal attribute
|
// TODO redesign IPFS wrapper API and do not use an internal attribute
|
||||||
await kredits.ipfs._ipfsAPI.id();
|
const ipfsApi = kredits.ipfs._ipfsAPI;
|
||||||
|
|
||||||
|
await ipfsApi.id();
|
||||||
|
|
||||||
|
debug(`Connecting to known IPFS node ${argv.bootstrapNode}`);
|
||||||
|
await ipfsApi.swarm.connect(argv.bootstrapNode);
|
||||||
|
|
||||||
const ipfsPinner = new IpfsPinner(kredits);
|
const ipfsPinner = new IpfsPinner(kredits);
|
||||||
|
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@67p/kredits-ipfs-pinner",
|
"name": "@67p/kredits-ipfs-pinner",
|
||||||
"version": "1.0.3",
|
"version": "1.2.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kosmos/kredits-ipfs-pinner",
|
"name": "@kosmos/kredits-ipfs-pinner",
|
||||||
"version": "1.0.3",
|
"version": "1.2.0",
|
||||||
"description": "Pins IPFS data of a Kredits organization on an IPFS node",
|
"description": "Pins IPFS data of a Kredits organization on an IPFS node",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user