Skip to content
Permalink
Browse files

[~+] framework utility

  - Use ethvtx framework utility for embark
  • Loading branch information...
mortimr committed Mar 19, 2019
1 parent 7746616 commit f8889be79374221a5b7f26186d1a943fc4d29641
Showing with 14 additions and 14 deletions.
  1. +1 −1 app/ethvtx_config/createVtxStore.js
  2. +8 −9 app/ethvtx_config/setupWeb3.js
  3. +2 −2 config/blockchain.js
  4. +3 −2 package.json
@@ -9,7 +9,7 @@ export const createVtxStore = () => {
// You can configure some parameters here to inject them with the initial state
const initial_state = configureVtx(getInitialState(), {
poll_timer: 100,
confirmation_treshold: 5
confirmation_treshold: 3
});

// Recover the vortex reducers. This method takes your custom reducers and combines them with vortex's
@@ -3,6 +3,7 @@ import { loadContractSpec, loadContractInstance } from 'ethvtx/lib/dispatchers';
import Web3 from 'web3';
import EmbarkJs from 'Embark/EmbarkJS';
import { start, setWeb3 } from 'ethvtx/lib/dispatchers';
import { embark } from 'ethvtx/lib/utils';
import SimpleStorage from 'Embark/contracts/SimpleStorage';

export const setupWeb3 = async (store) => {
@@ -11,24 +12,20 @@ export const setupWeb3 = async (store) => {

EmbarkJs.onReady(async () => {

console.log('ready');
// Recover the Web3 instance created by Embark
const embark_web3 = EmbarkJs.Blockchain.Providers.web3.web3;

// Extract the provider to build a very specific version of web3 (in our case web3@1.0.0-beta.32 is the best working version)
//const provider = embark_web3.currentProvider;
//const web3 = new Web3(provider);

const provider = embark_web3.currentProvider;
const web3 = new Web3(provider);
// Set the web3 instance in the store
setWeb3(store.dispatch, embark_web3);
setWeb3(store.dispatch, web3);

// Initialize the Store's contract manager
VtxContract.init(store);

// Loading a spec, to prevent data replication and ease things when you have multiple instances of the same type of contracts
loadContractSpec(store.dispatch, 'SimpleStorage', SimpleStorage._jsonInterface, {
permanent: true
});
// Loading a spec si made easy with the embark.loadSpec helper
loadContractSpec(store.dispatch, ...embark.loadSpec(SimpleStorage, 'SimpleStorage', true, true));

// Loading an instance BEFORE starting the store will check on the chain if the correct bytecode is found, and if not, the WrongNet status is applied
loadContractInstance(store.dispatch, 'SimpleStorage', SimpleStorage.address, {
@@ -39,6 +36,8 @@ export const setupWeb3 = async (store) => {
// Starts the store, will update the vtxconfig.status depending on the environment. Will also call the enable callback if available
start(store.dispatch, EmbarkJs.enableEthereum ? EmbarkJs.enableEthereum : undefined);

window.DEBUG_STORE = store;

ok();
});

@@ -56,9 +56,9 @@ module.exports = {
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
proxy: true, // Proxy is used to present meaningful information about transactions
proxy: false, // Proxy is used to present meaningful information about transactions
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
simulatorBlocktime: 5 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
simulatorBlocktime: 2 // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
},

// merges with the settings in default
@@ -8,8 +8,9 @@
"license": "MIT",
"dependencies": {
"embark": "^4.0.0-beta.2",
"embarkjs": "file:../../../../tmp/embarkjs-4.0.0.tgz",
"embarkjs-connector-web3": "^4.0.0-beta.1",
"ethvtx": "git://github.com/mortimr/ethvtx.git#develop",
"ethvtx": "git://github.com/horyus/ethvtx.git#feature/27.framework-helpers",
"grommet": "^2.5.5",
"react": "^16.3.2",
"react-bootstrap": "0.32.1",
@@ -19,6 +20,6 @@
"redux-saga": "^1.0.2",
"shards-react": "^1.0.3",
"styled-components": "^4.1.3",
"web3": "^1.0.0-beta.32"
"web3": "1.0.0-beta.36"
}
}

0 comments on commit f8889be

Please sign in to comment.
You can’t perform that action at this time.