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", "embark/embark-test-contract-1",
"test_app/embark-service", "test_app/embark-service",
"test_app/zeppelin-solidity", "test_app/zeppelin-solidity",
"test_app/embarkjs-web3-connector", "test_app/embarkjs-connector-web3",
"contracts_app/embarkjs-web3-connector" "contracts_app/embarkjs-connector-web3"
] ]
} }
} }

View File

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

View File

@ -9,6 +9,6 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"dependencies": { "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" "ipfs-api": "17.2.4"
}, },
"plugins": { "plugins": {
"embarkjs-web3-connector": {} "embarkjs-connector-web3": {}
}, },
"options": { "options": {
"solc": { "solc": {

View File

@ -14,6 +14,6 @@
"react-dom": "16.7.0" "react-dom": "16.7.0"
}, },
"dependencies": { "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" "solc": "0.5.0"
}, },
"plugins": { "plugins": {
"embarkjs-web3-connector": {} "embarkjs-connector-web3": {}
}, },
"options": { "options": {
"solc": { "solc": {

View File

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

View File

@ -1,6 +1,6 @@
const path = require('path'); const path = require('path');
class EmbarkJSWeb3Connector { class EmbarkJSConnectorWeb3 {
constructor(embark, _options) { constructor(embark, _options) {
this.embark = embark; this.embark = embark;
this.events = embark.events; this.events = embark.events;
@ -40,10 +40,10 @@ class EmbarkJSWeb3Connector {
let code = `\nconst Web3 = global.__Web3 || require('${symlinkLocation}');`; let code = `\nconst Web3 = global.__Web3 || require('${symlinkLocation}');`;
code += `\nglobal.Web3 = Web3;`; 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 += connectorCode;
code += "\nEmbarkJS.Blockchain.registerProvider('web3', embarkJSWeb3Connector);"; code += "\nEmbarkJS.Blockchain.registerProvider('web3', embarkJSConnectorWeb3);";
code += "\nEmbarkJS.Blockchain.setProvider('web3', {});"; code += "\nEmbarkJS.Blockchain.setProvider('web3', {});";
const configPath = this.fs.dappPath(this.config.embarkConfig.generationDir, this.constants.dappArtifacts.dir, this.constants.dappArtifacts.blockchain).replace(/\\/g, '/'); 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", "version": "4.0.0-beta.0",
"description": "Web3.js Connector for EmbarkJS", "description": "Web3.js Connector for EmbarkJS",
"main": "index.js", "main": "index.js",
@ -8,7 +8,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "embark/packages/embarkjs-web3-connector" "url": "embark/packages/embarkjs-connector-web3"
}, },
"keywords": [ "keywords": [
"embark", "embark",

View File

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

View File

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

View File

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

View File

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