Change references from embark-omg to embark-plasma

This commit is contained in:
emizzle 2019-06-19 13:10:54 +10:00
parent 01add08c15
commit 7c534fcd39
No known key found for this signature in database
GPG Key ID: 1FD4BAB3C37EE9BA
2 changed files with 6 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "embark-plasma", "name": "embark-plasma",
"version": "1.0.2", "version": "1.0.3",
"description": "OmiseGO Plasma plugin for Embark", "description": "OmiseGO Plasma plugin for Embark",
"main": "dist/index.js", "main": "dist/index.js",
"files": [ "files": [

View File

@ -1,4 +1,4 @@
import EmbarkJSPlasma from "embarkjs-omg"; import EmbarkJSPlasma from "embarkjs-plasma";
import { dappPath } from "embark-utils"; import { dappPath } from "embark-utils";
import { formatDate } from "./utils"; import { formatDate } from "./utils";
@ -52,23 +52,22 @@ class EmbarkPlasma extends EmbarkJSPlasma {
async addCodeToEmbarkJs() { async addCodeToEmbarkJs() {
const nodePath = dappPath("node_modules"); const nodePath = dappPath("node_modules");
const embarkjsOmgPath = require.resolve("embarkjs-omg", { const embarkjsOmgPath = require.resolve("embarkjs-plasma", {
paths: [nodePath] paths: [nodePath]
}); });
let embarkJsOmgSymlinkPath; let embarkJsOmgSymlinkPath;
await this.codeGeneratorReady(); await this.codeGeneratorReady();
try { try {
embarkJsOmgSymlinkPath = await this.generateSymlink("embarkjs-omg", embarkjsOmgPath); embarkJsOmgSymlinkPath = await this.generateSymlink("embarkjs-plasma", embarkjsOmgPath);
} catch (err) { } catch (err) {
this.logger.error(__("Error creating a symlink to embarkjs-omg")); this.logger.error(__("Error creating a symlink to embarkjs-plasma"));
return this.logger.error(err.message || err); return this.logger.error(err.message || err);
} }
this.events.emit("runcode:register", "embarkjsOmg", require("embarkjs-omg"), () => { this.events.emit("runcode:register", "embarkjsOmg", require("embarkjs-plasma"), () => {
let code = ""; let code = "";
code += `\nlet __embarkPlasma = global.embarkjsOmg || require('${embarkJsOmgSymlinkPath}').default;`; code += `\nlet __embarkPlasma = global.embarkjsOmg || require('${embarkJsOmgSymlinkPath}').default;`;
//code += `\nWeb3 = global.embarkjsOmg || require('${embarkJsOmgSymlinkPath}').default;`;
code += `\nconst opts = { code += `\nconst opts = {
logger: { logger: {
info: console.log, info: console.log,
@ -80,7 +79,6 @@ class EmbarkPlasma extends EmbarkJSPlasma {
};`; };`;
code += "\nEmbarkJS.onReady(() => {"; code += "\nEmbarkJS.onReady(() => {";
code += "\n EmbarkJS.Plasma = new __embarkPlasma(opts);"; code += "\n EmbarkJS.Plasma = new __embarkPlasma(opts);";
// code += `\n EmbarkJS.Plasma.init(${JSON.stringify(this.accounts)}, "${web3SymlinkPath}");`;
code += `\n const embarkJsWeb3Provider = EmbarkJS.Blockchain.Providers["web3"]`; code += `\n const embarkJsWeb3Provider = EmbarkJS.Blockchain.Providers["web3"]`;
code += `\n if (!embarkJsWeb3Provider) { throw new Error("web3 cannot be found. Please ensure you have the 'embarkjs-connector-web3' plugin installed in your DApp."); }`; code += `\n if (!embarkJsWeb3Provider) { throw new Error("web3 cannot be found. Please ensure you have the 'embarkjs-connector-web3' plugin installed in your DApp."); }`;
code += `\n if (global.embarkjsOmg) EmbarkJS.Plasma.init(embarkJsWeb3Provider.web3, true).catch((err) => console.error(err));`; // global.embarkjsOmg ? "${web3SymlinkPath}" : null);`; // pass the symlink path ONLY when we are in the node (VM) context code += `\n if (global.embarkjsOmg) EmbarkJS.Plasma.init(embarkJsWeb3Provider.web3, true).catch((err) => console.error(err));`; // global.embarkjsOmg ? "${web3SymlinkPath}" : null);`; // pass the symlink path ONLY when we are in the node (VM) context