rename to embarkjs-connector-web3

This commit is contained in:
Jonathan Rainville 2019-02-25 08:55:47 -05:00 committed by Iuri Matias
parent 4eee4dfc65
commit a62d03dc7e
14 changed files with 31 additions and 31 deletions

View File

@ -60,8 +60,8 @@
"embark/embark-test-contract-1",
"test_app/embark-service",
"test_app/zeppelin-solidity",
"test_app/embarkjs-web3-connector",
"contracts_app/embarkjs-web3-connector"
"test_app/embarkjs-connector-web3",
"contracts_app/embarkjs-connector-web3"
]
}
}

View File

@ -14,7 +14,7 @@
"ipfs-api": "17.2.4"
},
"plugins": {
"embarkjs-web3-connector": {}
"embarkjs-connector-web3": {}
},
"options": {
"solc": {

View File

@ -9,6 +9,6 @@
"author": "",
"license": "MIT",
"dependencies": {
"embarkjs-web3-connector": "4.0.0-beta.0"
"embarkjs-connector-web3": "4.0.0-beta.0"
}
}

View File

@ -13,7 +13,7 @@
"ipfs-api": "17.2.4"
},
"plugins": {
"embarkjs-web3-connector": {}
"embarkjs-connector-web3": {}
},
"options": {
"solc": {

View File

@ -14,6 +14,6 @@
"react-dom": "16.7.0"
},
"dependencies": {
"embarkjs-web3-connector": "4.0.0-beta.0"
"embarkjs-connector-web3": "4.0.0-beta.0"
}
}

View File

@ -13,7 +13,7 @@
"solc": "0.5.0"
},
"plugins": {
"embarkjs-web3-connector": {}
"embarkjs-connector-web3": {}
},
"options": {
"solc": {

View File

@ -9,6 +9,6 @@
"author": "",
"license": "MIT",
"dependencies": {
"embarkjs-web3-connector": "4.0.0-beta.0"
"embarkjs-connector-web3": "4.0.0-beta.0"
}
}

View File

@ -1,7 +1,7 @@
/*global Web3*/
const embarkJSWeb3Connector = {};
const embarkJSConnectorWeb3 = {};
embarkJSWeb3Connector.init = function(config) {
embarkJSConnectorWeb3.init = function(config) {
global.web3 = config.web3 || global.web3;
// Check if the global web3 object uses the old web3 (0.x)
if (global.web3 && typeof global.web3.version !== 'string') {
@ -13,46 +13,46 @@ embarkJSWeb3Connector.init = function(config) {
global.web3 = this.web3;
};
embarkJSWeb3Connector.getInstance = function () {
embarkJSConnectorWeb3.getInstance = function () {
return this.web3;
};
embarkJSWeb3Connector.getAccounts = function () {
embarkJSConnectorWeb3.getAccounts = function () {
return this.web3.eth.getAccounts(...arguments);
};
embarkJSWeb3Connector.getNewProvider = function (providerName, ...args) {
embarkJSConnectorWeb3.getNewProvider = function (providerName, ...args) {
return new Web3.providers[providerName](...args);
};
embarkJSWeb3Connector.setProvider = function (provider) {
embarkJSConnectorWeb3.setProvider = function (provider) {
return this.web3.setProvider(provider);
};
embarkJSWeb3Connector.getCurrentProvider = function () {
embarkJSConnectorWeb3.getCurrentProvider = function () {
return this.web3.currentProvider;
};
embarkJSWeb3Connector.getDefaultAccount = function () {
embarkJSConnectorWeb3.getDefaultAccount = function () {
return this.web3.eth.defaultAccount;
};
embarkJSWeb3Connector.setDefaultAccount = function (account) {
embarkJSConnectorWeb3.setDefaultAccount = function (account) {
this.web3.eth.defaultAccount = account;
};
embarkJSWeb3Connector.newContract = function (options) {
embarkJSConnectorWeb3.newContract = function (options) {
return new this.web3.eth.Contract(options.abi, options.address);
};
embarkJSWeb3Connector.send = function () {
embarkJSConnectorWeb3.send = function () {
return this.web3.eth.sendTransaction(...arguments);
};
embarkJSWeb3Connector.toWei = function () {
embarkJSConnectorWeb3.toWei = function () {
return this.web3.toWei(...arguments);
};
embarkJSWeb3Connector.getNetworkId = function () {
embarkJSConnectorWeb3.getNetworkId = function () {
return this.web3.eth.net.getId();
};

View File

@ -1,6 +1,6 @@
const path = require('path');
class EmbarkJSWeb3Connector {
class EmbarkJSConnectorWeb3 {
constructor(embark, _options) {
this.embark = embark;
this.events = embark.events;
@ -40,10 +40,10 @@ class EmbarkJSWeb3Connector {
let code = `\nconst Web3 = global.__Web3 || require('${symlinkLocation}');`;
code += `\nglobal.Web3 = Web3;`;
const connectorCode = this.fs.readFileSync(path.join(__dirname, 'embarkJSWeb3Connector.js'), 'utf8');
const connectorCode = this.fs.readFileSync(path.join(__dirname, 'embarkJSConnectorWeb3.js'), 'utf8');
code += connectorCode;
code += "\nEmbarkJS.Blockchain.registerProvider('web3', embarkJSWeb3Connector);";
code += "\nEmbarkJS.Blockchain.registerProvider('web3', embarkJSConnectorWeb3);";
code += "\nEmbarkJS.Blockchain.setProvider('web3', {});";
const configPath = this.fs.dappPath(this.config.embarkConfig.generationDir, this.constants.dappArtifacts.dir, this.constants.dappArtifacts.blockchain).replace(/\\/g, '/');
@ -111,4 +111,4 @@ class EmbarkJSWeb3Connector {
}
}
module.exports = EmbarkJSWeb3Connector;
module.exports = EmbarkJSConnectorWeb3;

View File

@ -1,5 +1,5 @@
{
"name": "embarkjs-web3-connector",
"name": "embarkjs-connector-web3",
"version": "4.0.0-beta.0",
"description": "Web3.js Connector for EmbarkJS",
"main": "index.js",
@ -8,7 +8,7 @@
},
"repository": {
"type": "git",
"url": "embark/packages/embarkjs-web3-connector"
"url": "embark/packages/embarkjs-connector-web3"
},
"keywords": [
"embark",

View File

@ -16,6 +16,6 @@
"solc": "0.4.24"
},
"plugins": {
"embarkjs-web3-connector": {}
"embarkjs-connector-web3": {}
}
}

View File

@ -4,7 +4,7 @@
"rimraf": "2.6.3"
},
"dependencies": {
"embarkjs-web3-connector": "4.0.0-beta.0"
"embarkjs-connector-web3": "4.0.0-beta.0"
},
"name": "contracts_app",
"private": true,

View File

@ -21,7 +21,7 @@
},
"plugins": {
"embark-service": {},
"embarkjs-web3-connector": {}
"embarkjs-connector-web3": {}
},
"options": {
"solc": {

View File

@ -14,7 +14,7 @@
"zeppelin-solidity": "1.12.0"
},
"dependencies": {
"embarkjs-web3-connector": "4.0.0-beta.0"
"embarkjs-connector-web3": "4.0.0-beta.0"
},
"name": "test_app",
"private": true,