tests improvement
This commit is contained in:
parent
2577addc65
commit
8dad644e9a
|
@ -9,7 +9,7 @@ Proof of phone is a smart oracle developed for the Ethereum blockchain to serve
|
|||
1. Download zip archive
|
||||
2. Unpack it
|
||||
3. Go to the /web folder in terminal and install the dependencies `npm install`
|
||||
4. Set **environment** in web/config.json (see config.json with placeholders below): `dev` or `live`
|
||||
4. Set **environment** in web/config.json (see config.json with placeholders below): `test` or `live`
|
||||
5. Set smart contract key points in web/config.json (see config.json with placeholders below):
|
||||
* `wallet.test`, `wallet.live`
|
||||
* `rpc.test`, `rpc.live`
|
||||
|
@ -24,7 +24,7 @@ Proof of phone is a smart oracle developed for the Ethereum blockchain to serve
|
|||
config.json with placeholders
|
||||
```
|
||||
{
|
||||
"environment": "live/dev",
|
||||
"environment": "live/test",
|
||||
"globalToken": "cba2c691-47df-41e7-bc97-a0818103ed14",
|
||||
"salt": "salt_for_message_with_hash_creating",
|
||||
"mongodbConnectionString": "mongodb://user:password@path_to_database",
|
||||
|
|
|
@ -7,12 +7,7 @@ var web3;
|
|||
if (typeof web3 !== 'undefined') {
|
||||
web3 = new Web3(web3.currentProvider);
|
||||
} else {
|
||||
if (config.environment == "live")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.live));
|
||||
else if (config.environment == "dev")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
else
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc[config.environment]));
|
||||
}
|
||||
|
||||
var contractABI = config.smartContract.abi;
|
||||
|
|
|
@ -6,12 +6,7 @@ var contractABI = config.smartContract.abi;
|
|||
if (typeof web3 !== 'undefined') {
|
||||
web3 = new Web3(web3.currentProvider);
|
||||
} else {
|
||||
if (config.environment == "live")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.live));
|
||||
else if (config.environment == "dev")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
else
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc[config.environment]));
|
||||
}
|
||||
|
||||
var contractAddress;
|
||||
|
|
|
@ -3,20 +3,11 @@ var Web3 = require('web3');
|
|||
var web3;
|
||||
var config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
|
||||
var contractABI = config.smartContract.abi;
|
||||
var contractAddress;
|
||||
var contractAddress = config.smartContract.contractAddress[config.environment];
|
||||
if (typeof web3 !== 'undefined') {
|
||||
web3 = new Web3(web3.currentProvider);
|
||||
} else {
|
||||
if (config.environment == "live") {
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.live));
|
||||
contractAddress = config.smartContract.contractAddress.live;
|
||||
} else if (config.environment == "dev") {
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
contractAddress = config.smartContract.contractAddress.test;
|
||||
} else {
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
contractAddress = config.smartContract.contractAddress.test;
|
||||
}
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc[config.environment]));
|
||||
}
|
||||
|
||||
sendEtherHome();
|
||||
|
@ -34,7 +25,6 @@ function sendEtherHome() {
|
|||
|
||||
attachToContract(function(err, contract) {
|
||||
contract.sendEtherToOwner.sendTransaction({from: web3.eth.defaultAccount}, function(err, result) {
|
||||
console.log("TEST");
|
||||
if (err)
|
||||
console.log(err);
|
||||
else
|
||||
|
|
|
@ -5,12 +5,7 @@ var config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
|
|||
if (typeof web3 !== 'undefined') {
|
||||
web3 = new Web3(web3.currentProvider);
|
||||
} else {
|
||||
if (config.environment == "live")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.live));
|
||||
else if (config.environment == "dev")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
else
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc[config.environment]));
|
||||
}
|
||||
|
||||
var message = "";
|
||||
|
@ -29,14 +24,7 @@ function sendTransaction() {
|
|||
console.log("web3.eth.defaultAccount:");
|
||||
console.log(web3.eth.defaultAccount);
|
||||
|
||||
var contractAddress;
|
||||
if (config.environment == "live") {
|
||||
contractAddress = config.smartContract.contractAddress.live;
|
||||
} else if (config.environment == "dev") {
|
||||
contractAddress = config.smartContract.contractAddress.test;
|
||||
} else {
|
||||
contractAddress = config.smartContract.contractAddress.test;
|
||||
}
|
||||
var contractAddress = config.smartContract.contractAddress[config.environment];
|
||||
|
||||
var gasWillUsed = web3.eth.estimateGas({
|
||||
from: web3.eth.defaultAccount,
|
||||
|
|
|
@ -5,12 +5,7 @@ var config = JSON.parse(fs.readFileSync('./config.json', 'utf8'));
|
|||
if (typeof web3 !== 'undefined') {
|
||||
web3 = new Web3(web3.currentProvider);
|
||||
} else {
|
||||
if (config.environment == "live")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.live));
|
||||
else if (config.environment == "dev")
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
else
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc.test));
|
||||
web3 = new Web3(new Web3.providers.HttpProvider(config.smartContract.rpc[config.environment]));
|
||||
}
|
||||
|
||||
var clientAddress = "";
|
||||
|
|
Loading…
Reference in New Issue