-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf0b609
commit 66b1d50
Showing
6 changed files
with
2,590 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONTRACT_ADDRESS=0xBD04e6756A5E3B57373195D519684d4911625ac0 | ||
WEB3_PROVIDER=https://rinkeby.infura.io/v3/PROJECT_ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
pldr-provider-* | ||
bootstrap_nodes | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "pldr-provider", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "src/stress.js", | ||
"bin": "src/stress.js", | ||
"scripts": { | ||
"test:identity": "node src/stress.js --debug --name=stressdev --port=8000 getidentity", | ||
"test:peers": "node src/stress.js --debug --name=stressdev --port=8000 ipfs swarm peers", | ||
"test:pins": "node src/stress.js --debug --name=stressdev --port=8000 ipfs pin ls", | ||
"compile": "pkg . --out-path bin", | ||
"start": "./bin/pldr-provider-linux --debug --name=stress --port=8000" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"axios": "^0.24.0", | ||
"body-parser": "^1.19.0", | ||
"dotenv": "^10.0.0", | ||
"ethers": "^5.6.2", | ||
"express": "^4.17.1", | ||
"minimist": "^1.2.6", | ||
"public-ip": "^4.0.4" | ||
}, | ||
"devDependencies": { | ||
"nodemon": "^2.0.14", | ||
"pkg": "^5.6.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const axios = require('axios'); | ||
|
||
const ipfs = (node, ...args) => { | ||
node.runIpfsNativeCommand(args.join(' ')) | ||
} | ||
|
||
const getidentity = (node) => { | ||
console.log(node.returnNodeIdentity()) | ||
} | ||
|
||
|
||
module.exports = { getidentity, ipfs} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const argv = require('minimist')(process.argv.slice(2)); | ||
const cwd = process.cwd() | ||
let homedir = require('os').homedir() | ||
const PldrNode = require('../../shared/pldr') | ||
const commands = require('./libs/fn') | ||
const debug = argv.debug !== undefined ? argv.debug : false | ||
const name = argv.name !== undefined ? argv.name : "pldr-stress" | ||
const port = argv.port !== undefined ? argv.port : 8000 | ||
const daemon = argv.daemon !== undefined ? true : false | ||
if (argv.docker !== undefined) { | ||
homedir = './' | ||
} | ||
// Print initial conditions if debug is active | ||
if (debug) { | ||
console.log('--') | ||
console.log('DEBUG MODE') | ||
console.log('--') | ||
console.log('Working dir is:', cwd) | ||
console.log('Homedir is:', homedir) | ||
console.log('Node name is:', name) | ||
} | ||
// Init node folder and configs | ||
const node = new PldrNode(name, port, daemon) | ||
if (daemon) { | ||
console.log('Loaded identity:', node.returnNodeIdentity()) | ||
} | ||
// Detect commands | ||
async function main() { | ||
if (argv._ !== undefined && argv._[0] !== undefined) { | ||
if (commands[argv._[0]] !== undefined) { | ||
if (debug) { | ||
console.log('Running command: ' + argv._.join(' ')) | ||
console.log('--') | ||
} | ||
commands[argv._[0]](node, ...argv._) | ||
} else { | ||
console.log('Command not recognized') | ||
} | ||
} else { | ||
console.log('No command found') | ||
} | ||
} | ||
if (!daemon) { | ||
main() | ||
} else { | ||
setTimeout(function () { | ||
commands.daemon(node) | ||
}, 5000) | ||
} |
Oops, something went wrong.