Compare commits

..

10 Commits

Author SHA1 Message Date
b3dab3200f Use postshrinkwrap instead of postinstall
`postinstall` is executed before package-lock.json is written to disk.

https://github.com/npm/npm/issues/18798
2019-06-18 10:30:35 +02:00
165ca8d3fc Add postinstall lockfile fix
https://github.com/67P/kredits-contracts/pull/140
2019-06-17 18:58:31 +02:00
42ef48b34d Make sure fix lockfile uses the correct file path 2019-06-17 09:38:47 +02:00
aacec26d0e Default to open.aragonpm.eth
it is now also available on the devchain
2019-06-15 00:49:26 +02:00
9ac3837f67 I don't know why this is needed but it fixes an npm issue
if install fails node scripts/fix-package-lock.js might help
2019-06-15 00:32:07 +02:00
b32b5e240d package-lock 2019-06-15 00:28:04 +02:00
ee70125139 package-lock 2019-06-15 00:26:38 +02:00
fa6423ed2e Fix fix... don't really know what I am doing 2019-06-15 00:21:54 +02:00
97071c1b60 still broken 2019-06-14 23:56:22 +02:00
9b8004af69 Remove npm cache and use LTS node on travis
Can we have a green build with that?
2019-06-13 18:39:26 +02:00
16 changed files with 3624 additions and 6452 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -6,17 +6,13 @@
"@aragon/os": "^4.2.0", "@aragon/os": "^4.2.0",
"@aragon/cli": "^5.9.6" "@aragon/cli": "^5.9.6"
}, },
"devDependencies": { "devDependencies": {},
"@aragon/test-helpers": "^1.1.0",
"eth-gas-reporter": "^0.2.0",
"ganache-cli": "^6.4.3",
"solidity-coverage": "^0.5.11"
},
"scripts": { "scripts": {
"start": "npm run start:aragon:ipfs", "start": "npm run start:aragon:ipfs",
"start:aragon:ipfs": "aragon run", "start:aragon:ipfs": "aragon run",
"start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist", "start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist",
"start:app": "", "start:app": "",
"test": "aragon contracts test",
"compile": "aragon contracts compile", "compile": "aragon contracts compile",
"sync-assets": "", "sync-assets": "",
"build:app": "", "build:app": "",
@@ -25,11 +21,7 @@
"publish:patch": "aragon apm publish patch", "publish:patch": "aragon apm publish patch",
"publish:minor": "aragon apm publish minor", "publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major", "publish:major": "aragon apm publish major",
"versions": "aragon apm versions", "versions": "aragon apm versions"
"test": "TRUFFLE_TEST=true PORT=7545 npm run ganache-cli:test",
"test:gas": "GAS_REPORTER=true npm test",
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test",
"ganache-cli:test": "./node_modules/@aragon/test-helpers/ganache-cli.sh"
}, },
"keywords": [] "keywords": []
} }

File diff suppressed because it is too large Load Diff

View File

@@ -6,17 +6,13 @@
"@aragon/os": "^4.2.0", "@aragon/os": "^4.2.0",
"@aragon/cli": "^5.9.6" "@aragon/cli": "^5.9.6"
}, },
"devDependencies": { "devDependencies": {},
"@aragon/test-helpers": "^1.1.0",
"eth-gas-reporter": "^0.2.0",
"ganache-cli": "^6.4.3",
"solidity-coverage": "^0.5.11"
},
"scripts": { "scripts": {
"start": "npm run start:aragon:ipfs", "start": "npm run start:aragon:ipfs",
"start:aragon:ipfs": "aragon run", "start:aragon:ipfs": "aragon run",
"start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist", "start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist",
"start:app": "", "start:app": "",
"test": "aragon contracts test",
"compile": "aragon contracts compile", "compile": "aragon contracts compile",
"sync-assets": "", "sync-assets": "",
"build:app": "", "build:app": "",
@@ -25,11 +21,7 @@
"publish:patch": "aragon apm publish patch", "publish:patch": "aragon apm publish patch",
"publish:minor": "aragon apm publish minor", "publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major", "publish:major": "aragon apm publish major",
"versions": "aragon apm versions", "versions": "aragon apm versions"
"test": "TRUFFLE_TEST=true PORT=7545 npm run ganache-cli:test",
"test:gas": "GAS_REPORTER=true npm test",
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test",
"ganache-cli:test": "./node_modules/@aragon/test-helpers/ganache-cli.sh"
}, },
"keywords": [] "keywords": []
} }

File diff suppressed because it is too large Load Diff

View File

@@ -6,17 +6,13 @@
"@aragon/os": "^4.2.0", "@aragon/os": "^4.2.0",
"@aragon/cli": "^5.9.6" "@aragon/cli": "^5.9.6"
}, },
"devDependencies": { "devDependencies": {},
"@aragon/test-helpers": "^1.1.0",
"eth-gas-reporter": "^0.2.0",
"ganache-cli": "^6.4.3",
"solidity-coverage": "^0.5.11"
},
"scripts": { "scripts": {
"start": "npm run start:aragon:ipfs", "start": "npm run start:aragon:ipfs",
"start:aragon:ipfs": "aragon run", "start:aragon:ipfs": "aragon run",
"start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist", "start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist",
"start:app": "", "start:app": "",
"test": "aragon contracts test",
"compile": "aragon contracts compile", "compile": "aragon contracts compile",
"sync-assets": "", "sync-assets": "",
"build:app": "", "build:app": "",
@@ -25,11 +21,7 @@
"publish:patch": "aragon apm publish patch", "publish:patch": "aragon apm publish patch",
"publish:minor": "aragon apm publish minor", "publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major", "publish:major": "aragon apm publish major",
"versions": "aragon apm versions", "versions": "aragon apm versions"
"test": "TRUFFLE_TEST=true PORT=7545 npm run ganache-cli:test",
"test:gas": "GAS_REPORTER=true npm test",
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test",
"ganache-cli:test": "./node_modules/@aragon/test-helpers/ganache-cli.sh"
}, },
"keywords": [] "keywords": []
} }

File diff suppressed because it is too large Load Diff

View File

@@ -6,17 +6,13 @@
"@aragon/os": "^4.2.0", "@aragon/os": "^4.2.0",
"@aragon/cli": "^5.9.6" "@aragon/cli": "^5.9.6"
}, },
"devDependencies": { "devDependencies": {},
"@aragon/test-helpers": "^1.1.0",
"eth-gas-reporter": "^0.2.0",
"ganache-cli": "^6.4.3",
"solidity-coverage": "^0.5.11"
},
"scripts": { "scripts": {
"start": "npm run start:aragon:ipfs", "start": "npm run start:aragon:ipfs",
"start:aragon:ipfs": "aragon run", "start:aragon:ipfs": "aragon run",
"start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist", "start:aragon:http": "aragon run --http localhost:8001 --http-served-from ./dist",
"start:app": "", "start:app": "",
"test": "aragon contracts test",
"compile": "aragon contracts compile", "compile": "aragon contracts compile",
"sync-assets": "", "sync-assets": "",
"build:app": "", "build:app": "",
@@ -25,11 +21,7 @@
"publish:patch": "aragon apm publish patch", "publish:patch": "aragon apm publish patch",
"publish:minor": "aragon apm publish minor", "publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major", "publish:major": "aragon apm publish major",
"versions": "aragon apm versions", "versions": "aragon apm versions"
"test": "TRUFFLE_TEST=true PORT=7545 npm run ganache-cli:test",
"test:gas": "GAS_REPORTER=true npm test",
"coverage": "SOLIDITY_COVERAGE=true npm run ganache-cli:test",
"ganache-cli:test": "./node_modules/@aragon/test-helpers/ganache-cli.sh"
}, },
"keywords": [] "keywords": []
} }

View File

@@ -14,10 +14,6 @@ class Contribution extends Record {
}); });
} }
getData (id) {
return this.functions.getContribution(id);
}
getByContributorId (contributorId) { getByContributorId (contributorId) {
return this.functions.getContributorAddressById(contributorId) return this.functions.getContributorAddressById(contributorId)
.then(address => this.getByContributorAddress(address)); .then(address => this.getByContributorAddress(address));
@@ -66,7 +62,6 @@ class Contribution extends Record {
deprecate('The function `addContribution()` is deprecated and will be removed in the next major version. Use `add()` instead'); deprecate('The function `addContribution()` is deprecated and will be removed in the next major version. Use `add()` instead');
return this.add(...arguments); return this.add(...arguments);
} }
} }
module.exports = Contribution; module.exports = Contribution;

View File

@@ -15,10 +15,6 @@ class Contributor extends Record {
}); });
} }
getData (id) {
return this.functions.getContributorById(id);
}
filterByAccount (search) { filterByAccount (search) {
return this._byAccount(search, 'filter'); return this._byAccount(search, 'filter');
} }
@@ -88,7 +84,6 @@ class Contributor extends Record {
}); });
}); });
} }
} }
module.exports = Contributor; module.exports = Contributor;

View File

@@ -9,18 +9,6 @@ class Record extends Base {
return Promise.all(records); return Promise.all(records);
}); });
} }
pinIpfsHashes () {
return this.count.then(count => {
let promises = [...Array(count).keys()].map(i => {
let id = i + 1; // 0 => 1 - ids start with 1 and not with 0
return this.getData(id).then(data => {
return this.ipfs.pin(data);
});
});
return Promise.all(promises);
});
}
} }
module.exports = Record; module.exports = Record;

View File

@@ -1,32 +0,0 @@
class IpfsPinner {
constructor (kredits) {
this.kredits = kredits;
}
pinAll () {
return Promise.all([
this.kredits.Contributor.pinIpfsHashes(),
this.kredits.Contribution.pinIpfsHashes(),
]);
}
monitor (callback) {
this.kredits.Contribution.on('ContributionAdded', (id) => {
this.kredits.Contribution.getData(id)
.then(data => { return this.kredits.ipfs.pin(data); })
.then(callback);
});
this.kredits.Contributor.on('ContributorAdded', (id) => {
this.kredits.Contribution.getData(id)
.then(data => { return this.kredits.ipfs.pin(data); })
.then(callback);
});
this.kredits.Contributor.on('ContributorProfileUpdated', (id) => {
this.kredits.Contributor.getData(id)
.then(data => { return this.kredits.ipfs.pin(data); })
.then(callback);
});
}
}
module.exports = IpfsPinner;

View File

@@ -1,14 +1,13 @@
const ipfsClient = require('ipfs-http-client'); const ipfsClient = require('ipfs-http-client');
const multihashes = require('multihashes'); const multihashes = require('multihashes');
const fetch = require('node-fetch');
class IPFS { class IPFS {
constructor (config) { constructor (config) {
if (!config) { if (!config) {
config = { host: 'localhost', port: '5001', protocol: 'http' }; config = { host: 'localhost', port: '5001', protocol: 'http' };
} }
this._config = config;
this._ipfsAPI = ipfsClient(config); this._ipfsAPI = ipfsClient(config);
this._config = config;
} }
catAndMerge (data, deserialize) { catAndMerge (data, deserialize) {
@@ -39,19 +38,7 @@ class IPFS {
if (hashData.hasOwnProperty('hashSize')) { if (hashData.hasOwnProperty('hashSize')) {
ipfsHash = this.encodeHash(hashData); ipfsHash = this.encodeHash(hashData);
} }
if (this._config['gatewayUrl']) { return this._ipfsAPI.cat(ipfsHash);
return fetch(`${this._config['gatewayUrl']}/${ipfsHash}`).then(r => r.text());
} else {
return this._ipfsAPI.cat(ipfsHash);
}
}
pin (hashData) {
let ipfsHash = hashData; // default - if it is a string
if (hashData.hasOwnProperty('hashSize')) {
ipfsHash = this.encodeHash(hashData);
}
return this._ipfsAPI.pin.add(multihashes.toB58String(ipfsHash));
} }
decodeHash (ipfsHash) { decodeHash (ipfsHash) {

1018
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "kredits-contracts", "name": "kredits-contracts",
"version": "5.4.0", "version": "5.3.0",
"description": "Ethereum contracts and npm wrapper for Kredits", "description": "Ethereum contracts and npm wrapper for Kredits",
"main": "./lib/kredits.js", "main": "./lib/kredits.js",
"directories": { "directories": {
@@ -12,7 +12,7 @@
"build-json": "npm run compile-contracts && node ./scripts/build-json.js", "build-json": "npm run compile-contracts && node ./scripts/build-json.js",
"repl": "truffle exec scripts/repl.js", "repl": "truffle exec scripts/repl.js",
"seeds": "truffle exec scripts/seeds.js", "seeds": "truffle exec scripts/seeds.js",
"compile-contracts": "truffle compile --all", "compile-contracts": "aragon contracts compile --all",
"bootstrap": "npm run reset:hard && npm run seeds", "bootstrap": "npm run reset:hard && npm run seeds",
"reset": "npm run deploy:kit && npm run deploy:dao", "reset": "npm run deploy:kit && npm run deploy:dao",
"reset:hard": "npm run deploy:apps && npm run reset", "reset:hard": "npm run deploy:apps && npm run reset",
@@ -24,10 +24,7 @@
"lint:contracts": "solhint \"contracts/**/*.sol\" \"apps/*/contracts/**/*.sol\"", "lint:contracts": "solhint \"contracts/**/*.sol\" \"apps/*/contracts/**/*.sol\"",
"lint:contract-tests": "eslint apps/*/test", "lint:contract-tests": "eslint apps/*/test",
"lint:wrapper": "eslint lib/", "lint:wrapper": "eslint lib/",
"test:token": "cd apps/token && npm run test", "test": "echo \"Error: no test specified\" && exit 1",
"test:contributor": "cd apps/contributor && npm run test",
"test:contribution": "cd apps/contribution && npm run test",
"test:proposal": "cd apps/proposal && npm run test",
"setup-git-hooks": "sh scripts/git-hooks/install" "setup-git-hooks": "sh scripts/git-hooks/install"
}, },
"repository": { "repository": {
@@ -58,9 +55,8 @@
}, },
"dependencies": { "dependencies": {
"ethers": "^4.0.29", "ethers": "^4.0.29",
"ipfs-http-client": "^30.1.3", "ipfs-http-client": "^32.0.1",
"kosmos-schemas": "^2.1.0", "kosmos-schemas": "^2.1.0",
"node-fetch": "^2.6.0",
"tv4": "^1.3.0" "tv4": "^1.3.0"
}, },
"keywords": [ "keywords": [

View File

@@ -1,31 +0,0 @@
const Kredits = require('../lib/kredits');
const IpfsPinner = require('../lib/utils/ipfs-pinner');
const network = process.env.ETH_NETWORK || 'rinkeby';
const rpcUrl = process.env.ETH_RPC_URL;
const apm = process.env.APM_DOMAIN || 'open.aragonpm.eth';
const ipfsConfig = {
host: process.env.IPFS_HOST || 'localhost',
port: process.env.IPFS_PORT || '5001',
protocol: process.env.IPFS_PROTOCOL || 'http',
};
console.log(`Using IPFS:`, ipfsConfig);
(async () => {
try {
const kredits = await Kredits.for({ network, rpcUrl }, { apm, ipfsConfig }).init();
const ipfsPinner = new IpfsPinner(kredits);
ipfsPinner.pinAll().then(pins => {
console.log('Pinned', JSON.stringify(pins, null, 2));
});
ipfsPinner.monitor((pin) => {
console.log('Pinned', JSON.stringify(pin));
});
console.log(`Subscribed to DAO: ${kredits.Kernel.contract.address}`);
} catch(e) {
console.log(e);
process.exit(1);
}
})();