├── .gitignore
├── AUTHORS
├── fonts
└── fontawesome-webfont.woff
├── .babelrc
├── index.js
├── .editorconfig
├── spec
└── atom-solidity-spec.js
├── formatSolc.js
├── menus
└── atom-solidity.cson
├── .github
└── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── keymaps
└── atom-solidity.cson
├── .travis.yml
├── CHANGELOG.md
├── lib
├── actions
│ ├── EventActions.js
│ ├── ClientActions.js
│ ├── index.js
│ ├── ErrorActions.js
│ ├── FilesActions.js
│ ├── NodeActions.js
│ ├── AccountActions.js
│ ├── ContractActions.js
│ └── types.js
├── web3
│ ├── vyp-worker.js
│ ├── worker.js
│ ├── view.js
│ ├── web3.js
│ └── web3Worker.js
├── helpers
│ ├── uiHelpers.js
│ ├── configureStore.js
│ └── compiler-imports.js
├── reducers
│ ├── ErrorReducer.js
│ ├── FilesReducer.js
│ ├── index.js
│ ├── NodeReducer.js
│ ├── AccountReducer.js
│ ├── EventReducer.js
│ ├── ClientReducer.js
│ └── ContractReducer.js
├── components
│ ├── CompileBtn
│ │ └── index.js
│ ├── LoaderView
│ │ └── index.js
│ ├── Events
│ │ └── index.js
│ ├── GasInput
│ │ └── index.js
│ ├── InputsForm
│ │ └── index.js
│ ├── ErrorView
│ │ └── index.js
│ ├── VersionSelector
│ │ └── index.js
│ ├── EventItem
│ │ └── index.js
│ ├── RemixDebugger
│ │ └── index.js
│ ├── CreateButton
│ │ └── index.js
│ ├── ContractExecution
│ │ └── index.js
│ ├── StaticAnalysis
│ │ └── index.js
│ ├── CoinbaseView
│ │ └── index.js
│ ├── TxAnalyzer
│ │ └── index.js
│ ├── ContractCompiled
│ │ └── index.js
│ ├── TabView
│ │ └── index.js
│ ├── FunctionABI
│ │ └── index.js
│ ├── RemixTests
│ │ └── index.js
│ ├── Contracts
│ │ └── index.js
│ └── NodeControl
│ │ └── index.js
├── ethereum-interface.js
└── ethereum-interface-view.js
├── rollup.config.js
├── .eslintrc.js
├── package.json
├── README.md
└── styles
└── atom-solidity.less
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | npm-debug.log
3 | node_modules
4 | package-lock.json
5 | .idea/
6 | .vscode/
7 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | # This is list of Etheratom authors for copyright purposes.
2 |
3 | 0mkar <0mkar@protonmail.com>
4 |
--------------------------------------------------------------------------------
/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/0mkara/etheratom/HEAD/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "@babel/preset-react",
4 | [ "@babel/preset-env", { "targets": { "electron": "2.0.7" } } ]
5 | ],
6 | "plugins": ["@babel/plugin-proposal-object-rest-spread","emotion"]
7 | }
8 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | import 'idempotent-babel-polyfill';
3 | import { Etheratom } from './lib/ethereum-interface';
4 |
5 | module.exports = new Etheratom({
6 | config: atom.config,
7 | workspace: atom.workspace
8 | });
9 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 4
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/spec/atom-solidity-spec.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | /* global it, describe, expect */
3 |
4 | // Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
5 | //
6 | // To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
7 | // or `fdescribe`). Remove the `f` to unfocus the block.
8 |
9 | describe('Etheratom', async function() {
10 | describe('Test test', function() {
11 | it('Expect true to be true', function() {
12 | expect(true).toBe(true);
13 | })
14 | })
15 | });
16 |
--------------------------------------------------------------------------------
/formatSolc.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 |
3 | const SOLJSON_PATH = __dirname + '/node_modules/solc/soljson.js';
4 | const MODULE_OVERRIDE = 'var Module = {"ENVIRONMENT": "NODE"};';
5 | const ENVIRONMENT_OVERRIDE_FROM = 'var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;'
6 | const ENVIRONMENT_OVERRIDE_TO = 'var ENVIRONMENT_IS_NODE=true;'
7 |
8 | const solSrc = fs.readFileSync(SOLJSON_PATH, 'utf8').replace(ENVIRONMENT_OVERRIDE_FROM, ENVIRONMENT_OVERRIDE_TO);
9 |
10 | fs.writeFileSync(SOLJSON_PATH, MODULE_OVERRIDE + solSrc)
11 |
--------------------------------------------------------------------------------
/menus/atom-solidity.cson:
--------------------------------------------------------------------------------
1 | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
2 | 'context-menu':
3 | 'atom-text-editor': [
4 | {
5 | 'label': 'Activate Etheratom'
6 | 'command': 'eth-interface:activate'
7 | }
8 | ]
9 | 'menu': [
10 | {
11 | 'label': 'Packages'
12 | 'submenu': [
13 | 'label': 'Etheratom'
14 | 'submenu': [
15 | {
16 | 'label': 'Toggle view'
17 | 'command': 'eth-interface:toggle'
18 | }
19 | {
20 | 'label': 'Compile code'
21 | 'command': 'eth-interface:compile'
22 | }
23 | ]
24 | ]
25 | }
26 | ]
27 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/keymaps/atom-solidity.cson:
--------------------------------------------------------------------------------
1 | # Keybindings require three things to be fully defined: A selector that is
2 | # matched against the focused element, the keystroke and the command to
3 | # execute.
4 | #
5 | # Below is a basic keybinding which registers on all platforms by applying to
6 | # the root workspace element.
7 |
8 | # For more detailed documentation see
9 | # https://atom.io/docs/latest/behind-atom-keymaps-in-depth
10 | 'atom-workspace':
11 | 'ctrl-alt-e': 'eth-interface:activate'
12 | 'ctrl-alt-c': 'eth-interface:compile'
13 | 'ctrl-alt-v': 'eth-interface:toggle'
14 | 'atom-text-editor[data-grammar~="solidity"]:not([mini])': 'ctrl-alt-e': 'eth-interface:activate'
15 | 'atom-text-editor[data-grammar~="vyper"]:not([mini])': 'ctrl-alt-e': 'eth-interface:activate'
16 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ### Project specific config ###
2 | language: generic
3 |
4 | env:
5 | global:
6 | - APM_TEST_PACKAGES=""
7 | - ATOM_LINT_WITH_BUNDLED_NODE="true"
8 |
9 | matrix:
10 | - ATOM_CHANNEL=stable
11 |
12 | os:
13 | - linux
14 | - osx
15 |
16 | ### Generic setup follows ###
17 | script:
18 | - curl -s -O https://raw.githubusercontent.com/atom/ci/master/build-package.sh
19 | - chmod u+x build-package.sh
20 | - ./build-package.sh
21 |
22 | notifications:
23 | email:
24 | on_success: never
25 | on_failure: change
26 |
27 | branches:
28 | only:
29 | - master
30 | - /^greenkeeper/.*$/
31 |
32 | git:
33 | depth: 10
34 |
35 | sudo: false
36 |
37 | dist: trusty
38 |
39 | addons:
40 | apt:
41 | packages:
42 | - build-essential
43 | - fakeroot
44 | - git
45 | - libsecret-1-dev
46 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.1.0 - First Release
2 | * Every feature added
3 | * Every bug fixed
4 |
5 | ## 0.1.1 - Second Release
6 | * Merge pull requests
7 | * Fix async calls
8 | * Introduce solcjs [JavaScript bindings for the Solidity compiler](https://github.com/ethereum/solc-js)
9 | * Avail options to switch compiler environment
10 |
11 | ## 2.0.2 - Etheratom
12 | * Rename repository
13 | * Compile solidity files on save
14 | * Resize panel
15 | * Moved from CoffeeScript to ES6
16 | * Split web3 and ethereumjs-vm environments into separate modules
17 | * Dynamically load `ethereumjs-vm` to reduce package activation time
18 | * More errors added
19 |
20 | ## 4.0.5
21 | * Move web3js libraries into worker to load extension faster and provide non-blocking UI/UX
22 | * Easy connection management from Node panel
23 | * Easy WebSocket / RPC connection switch in Node panel
24 | * Save ABI after compilation
25 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [ Linux, Windows, OSX ]
28 | - Etheratom version 4.5.3
29 | - apm version
30 | ```
31 | apm 2.1.7
32 | npm 6.2.0
33 | node 8.9.3 x64
34 | atom 1.37.0
35 | python 2.7.16
36 | git 2.21.0
37 | ```
38 |
39 | **Additional context**
40 | Add any other context about the problem here.
41 |
--------------------------------------------------------------------------------
/lib/actions/EventActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { ADD_EVENTS } from './types';
18 |
19 | export const addNewEvents = ({ payload }) => {
20 | return (dispatch) => {
21 | dispatch({ type: ADD_EVENTS, payload });
22 | };
23 | };
24 |
--------------------------------------------------------------------------------
/lib/actions/ClientActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 |
18 | import { SET_CONNECTION_STATUS } from './types';
19 |
20 | export const setConnectionStatus = (status) => {
21 | return (dispatch) => {
22 | dispatch({ type: SET_CONNECTION_STATUS, payload: status });
23 | };
24 | };
25 |
--------------------------------------------------------------------------------
/lib/actions/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | export * from './ContractActions';
18 | export * from './AccountActions';
19 | export * from './EventActions';
20 | export * from './NodeActions';
21 | export * from './ErrorActions';
22 | export * from './FilesActions';
23 | export * from './ClientActions';
24 |
--------------------------------------------------------------------------------
/lib/web3/vyp-worker.js:
--------------------------------------------------------------------------------
1 | const shell = require('shelljs');
2 | const fs = require('fs');
3 |
4 | function vyperCompiler(source) {
5 | const outputSelection = {
6 | // Enable the metadata and bytecode outputs of every single contract.
7 | '*': {
8 | '': ['ast'],
9 | '*': ['abi', 'evm.bytecode']
10 | }
11 | };
12 | var input_json = {
13 | 'language': 'Vyper',
14 | 'sources': source,
15 | 'settings': {
16 | 'evmVersion': 'byzantium'
17 | },
18 | 'outputSelection': outputSelection
19 | };
20 | fs.writeFileSync(__dirname + '/' + '.temp-vy.json', JSON.stringify(input_json, null, 4), 'UTF-8');
21 | var args = 'vyper-json ' + __dirname + '/' + '.temp-vy.json';
22 | var escaped = shell.exec(args);
23 | var m = { compiled: escaped };
24 | fs.unlink(__dirname + '/' + '.temp-vy.json', ()=>{});
25 | process.send(m);
26 | }
27 | process.on('message', (m) => {
28 | if (m.command == 'compile') {
29 | vyperCompiler(m.source);
30 | }
31 | });
32 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import resolve from 'rollup-plugin-node-resolve';
2 | import babel from 'rollup-plugin-babel';
3 | import commonjs from 'rollup-plugin-commonjs';
4 | import fs from 'fs';
5 | import path from 'path';
6 | import builtins from 'rollup-plugin-node-builtins';
7 | const pkg = JSON.parse(fs.readFileSync(path.resolve('./package.json'), 'utf-8'));
8 | const external = Object.keys(pkg.dependencies || {});
9 | external.push('atom');
10 | external.push('fs');
11 | external.push('child_process');
12 |
13 | export default {
14 | input: 'index.js',
15 | output: {
16 | file: 'build/main.js',
17 | format: 'cjs',
18 | sourceMap: false
19 | },
20 | plugins: [
21 | resolve({
22 | mainFields: ['module', 'main'],
23 | extensions: ['.js', '.jsx', '.json'],
24 | preferBuiltins: true
25 | }),
26 | babel({
27 | exclude: 'node_modules/**'
28 | }),
29 | commonjs({
30 | include: ['node_modules/**']
31 | }),
32 | builtins()
33 | ],
34 | external
35 | };
36 |
--------------------------------------------------------------------------------
/lib/actions/ErrorActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_ERRORS, RESET_ERRORS } from './types';
18 |
19 | export const setErrors = (payload) => {
20 | return (dispatch) => {
21 | dispatch({ type: SET_ERRORS, payload });
22 | };
23 | };
24 |
25 | export const resetErrors = () => {
26 | return (dispatch) => {
27 | dispatch({ type: RESET_ERRORS });
28 | };
29 | };
30 |
--------------------------------------------------------------------------------
/lib/helpers/uiHelpers.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { MessagePanelView, PlainMessageView } from 'atom-message-panel';
18 |
19 | export function showPanelError(err_message) {
20 | let messages;
21 | messages = new MessagePanelView({ title: 'Etheratom report' });
22 | messages.attach();
23 | messages.add(new PlainMessageView({ message: err_message, className: 'red-message' }));
24 | }
25 |
--------------------------------------------------------------------------------
/lib/actions/FilesActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { RESET_SOURCES, SET_SOURCES } from './types';
18 |
19 | export const setSources = (payload) => {
20 | return (dispatch) => {
21 | dispatch({ type: SET_SOURCES, payload });
22 | };
23 | };
24 |
25 | export const resetSources = () => {
26 | return (dispatch) => {
27 | dispatch({ type: RESET_SOURCES });
28 | };
29 | };
30 |
--------------------------------------------------------------------------------
/lib/reducers/ErrorReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_ERRORS, RESET_ERRORS } from '../actions/types';
18 | const INITIAL_STATE = {
19 | errormsg: [],
20 | };
21 | export default (state = INITIAL_STATE, action) => {
22 | switch (action.type) {
23 | case SET_ERRORS:
24 | return { ...state, errormsg: action.payload };
25 | case RESET_ERRORS:
26 | return { ...INITIAL_STATE };
27 | default:
28 | return state;
29 | }
30 | };
31 |
--------------------------------------------------------------------------------
/lib/reducers/FilesReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import {
18 | SET_SOURCES,
19 | RESET_SOURCES
20 | } from '../actions/types';
21 |
22 | const INITIAL_STATE = {
23 | sources: {}
24 | };
25 |
26 | export default (state = INITIAL_STATE, action) => {
27 | switch (action.type) {
28 | case SET_SOURCES:
29 | return { ...state, sources: action.payload };
30 | case RESET_SOURCES:
31 | return { ...INITIAL_STATE };
32 | default:
33 | return state;
34 | }
35 | };
36 |
--------------------------------------------------------------------------------
/lib/helpers/configureStore.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import etheratomReducers from '../reducers';
18 | import logger from 'redux-logger';
19 | import ReduxThunk from 'redux-thunk';
20 | import { createStore, applyMiddleware } from 'redux';
21 |
22 | export default function configureStore(initialState) {
23 | const middleWares = [ReduxThunk];
24 | if(atom.inDevMode()) {
25 | middleWares.push(logger);
26 | }
27 | const store = createStore(
28 | etheratomReducers,
29 | initialState,
30 | applyMiddleware(...middleWares)
31 | );
32 | return store;
33 | }
34 |
--------------------------------------------------------------------------------
/lib/actions/NodeActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_SYNC_STATUS, SET_MINING, SET_HASH_RATE } from './types';
18 |
19 | export const setSyncStatus = (status) => {
20 | return (dispatch) => {
21 | dispatch({ type: SET_SYNC_STATUS, payload: status });
22 | };
23 | };
24 |
25 | export const setMining = (mining) => {
26 | return (dispatch) => {
27 | dispatch({ type: SET_MINING, payload: mining });
28 | };
29 | };
30 |
31 | export const setHashrate = (hashrate) => {
32 | return (dispatch) => {
33 | dispatch({ type: SET_HASH_RATE, payload: hashrate });
34 | };
35 | };
36 |
--------------------------------------------------------------------------------
/lib/reducers/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { combineReducers } from 'redux';
18 | import FilesReducer from './FilesReducer';
19 | import ContractReducer from './ContractReducer';
20 | import AccountReducer from './AccountReducer';
21 | import ErrorReducer from './ErrorReducer';
22 | import EventReducer from './EventReducer';
23 | import ClientReducer from './ClientReducer';
24 | import NodeReducer from './NodeReducer';
25 |
26 | export default combineReducers({
27 | files: FilesReducer,
28 | contract: ContractReducer,
29 | account: AccountReducer,
30 | errors: ErrorReducer,
31 | eventReducer: EventReducer,
32 | clientReducer: ClientReducer,
33 | node: NodeReducer
34 | });
35 |
--------------------------------------------------------------------------------
/lib/reducers/NodeReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_SYNC_STATUS, SET_SYNCING, SET_MINING, SET_HASH_RATE } from '../actions/types';
18 | const INITIAL_STATE = {
19 | syncing: false,
20 | status: {},
21 | mining: false,
22 | hashRate: 0
23 | };
24 | export default (state = INITIAL_STATE, action) => {
25 | switch (action.type) {
26 | case SET_SYNCING:
27 | return { ...state, syncing: action.payload };
28 | case SET_SYNC_STATUS:
29 | return { ...state, status: action.payload };
30 | case SET_MINING:
31 | return { ...state, mining: action.payload };
32 | case SET_HASH_RATE:
33 | return { ...state, hashRate: action.payload };
34 | default:
35 | return state;
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | parser: 'babel-eslint',
4 | parserOptions: {
5 | sourceType: 'module'
6 | },
7 | "env": {
8 | "es6": true,
9 | "node": true
10 | },
11 | "extends": ["standard", "eslint:recommended", "plugin:react/recommended", 'plugin:import/errors', 'plugin:import/warnings'],
12 | globals: {
13 | __static: true,
14 | atom: true
15 | },
16 | "parserOptions": {
17 | "ecmaVersion": 6,
18 | "ecmaFeatures": {
19 | "jsx": true
20 | },
21 | "sourceType": "module"
22 | },
23 | "settings": {
24 | "react": {
25 | "version": "16.4.2"
26 | }
27 | },
28 | "plugins": [
29 | "react",
30 | "babel",
31 | "import"
32 | ],
33 | "rules": {
34 | "strict": 0,
35 | "babel/semi": 1,
36 | // tab indentation
37 | 'indent': ["warn", 4],
38 | "linebreak-style": [
39 | "error",
40 | "unix"
41 | ],
42 | "quotes": [
43 | "error",
44 | "single"
45 | ],
46 | // allow paren-less arrow functions
47 | 'arrow-parens': 0,
48 | 'space-before-function-paren': ["error", "never"],
49 | 'no-console': ["error", { allow: ["warn", "error", "log"] }],
50 | 'import/named': 2,
51 | 'import/namespace': 2,
52 | 'import/default': 2,
53 | 'import/export': 2,
54 | 'import/no-unresolved': 'off'
55 | }
56 | };
57 |
--------------------------------------------------------------------------------
/lib/reducers/AccountReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_COINBASE, SET_PASSWORD, SET_ACCOUNTS, SET_BALANCE } from '../actions/types';
18 | const INITIAL_STATE = {
19 | coinbase: '',
20 | password: false,
21 | accounts: [],
22 | balance: 0.00,
23 | };
24 | export default (state = INITIAL_STATE, action) => {
25 | switch (action.type) {
26 | case SET_COINBASE:
27 | return { ...state, coinbase: action.payload };
28 | case SET_PASSWORD:
29 | return { ...state, password: action.payload.password };
30 | case SET_ACCOUNTS:
31 | return { ...state, accounts: action.payload };
32 | case SET_BALANCE:
33 | return { ...state, balance: action.payload };
34 | default:
35 | return state;
36 | }
37 | };
38 |
--------------------------------------------------------------------------------
/lib/actions/AccountActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_ACCOUNTS, SET_COINBASE, SET_PASSWORD, SET_BALANCE } from './types';
18 |
19 | export const setCoinbase = (coinbase) => {
20 | return (dispatch) => {
21 | dispatch({ type: SET_COINBASE, payload: coinbase });
22 | };
23 | };
24 |
25 | export const setPassword = ({ password }) => {
26 | return (dispatch) => {
27 | dispatch({ type: SET_PASSWORD, payload: { password } });
28 | };
29 | };
30 |
31 | export const setAccounts = ( accounts ) => {
32 | return (dispatch) => {
33 | dispatch({ type: SET_ACCOUNTS, payload: accounts });
34 | };
35 | };
36 |
37 | export const setBalance = ({ balance }) => {
38 | return (dispatch) => {
39 | dispatch({ type: SET_BALANCE, payload: { balance } });
40 | };
41 | };
--------------------------------------------------------------------------------
/lib/reducers/EventReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { ADD_PENDING_TRANSACTION, ADD_EVENTS, SET_EVENTS, TEXT_ANALYSIS } from '../actions/types';
18 | const INITIAL_STATE = {
19 | pendingTransactions: [],
20 | events: [],
21 | txAnalysis: {}
22 | };
23 | export default (state = INITIAL_STATE, action) => {
24 | switch (action.type) {
25 | case ADD_PENDING_TRANSACTION:
26 | return { ...state, pendingTransactions: [...state.pendingTransactions, action.payload] };
27 | case ADD_EVENTS:
28 | return { ...state, events: [...state.events, action.payload] };
29 | case SET_EVENTS:
30 | return { ...state, events: [] };
31 | case TEXT_ANALYSIS:
32 | return { ...state, txAnalysis: action.payload };
33 | default:
34 | return state;
35 | }
36 | };
37 |
--------------------------------------------------------------------------------
/lib/reducers/ClientReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_CONNECTION_STATUS, IS_WS_PROVIDER, IS_HTTP_PROVIDER, FIRST_TIME_CHECK_ENABLE } from '../actions/types';
18 | const INITIAL_STATE = {
19 | clients: [
20 | {
21 | provider: 'web3',
22 | desc: 'Backend ethereum node',
23 | hasConnection: false,
24 | firstTimeCheck: true,
25 | isWsProvider: false,
26 | isHttpProvider: false,
27 | }
28 | ]
29 | };
30 | export default (state = INITIAL_STATE, action) => {
31 | switch (action.type) {
32 | case SET_CONNECTION_STATUS:
33 | return { ...state, clients: action.payload };
34 | case FIRST_TIME_CHECK_ENABLE:
35 | // TODO: modify only one key:value
36 | return { ...state, clients: action.payload };
37 | case IS_WS_PROVIDER:
38 | return { ...state, clients: action.payload };
39 | case IS_HTTP_PROVIDER:
40 | return { ...state, clients: action.payload };
41 | default:
42 | return state;
43 | }
44 | };
45 |
--------------------------------------------------------------------------------
/lib/components/CompileBtn/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import PropTypes from 'prop-types';
19 | import { connect } from 'react-redux';
20 |
21 | class CompileBtn extends React.Component {
22 | constructor(props) {
23 | super(props);
24 | this._handleSubmit = this._handleSubmit.bind(this);
25 | }
26 | async _handleSubmit() {
27 | const workspaceElement = atom.views.getView(atom.workspace);
28 | await atom.commands.dispatch(workspaceElement, 'eth-interface:compile');
29 | }
30 | render() {
31 | const { compiling } = this.props;
32 | return (
33 |
43 | );
44 | }
45 | }
46 |
47 | CompileBtn.propTypes = {
48 | compiling: PropTypes.bool
49 | };
50 |
51 | const mapStateToProps = ({ contract }) => {
52 | const { compiling } = contract;
53 | return { compiling };
54 | };
55 |
56 | export default connect(mapStateToProps, {})(CompileBtn);
57 |
--------------------------------------------------------------------------------
/lib/web3/worker.js:
--------------------------------------------------------------------------------
1 | const RemixTests = require('remix-tests');
2 | const Solc = require('solc');
3 |
4 | function _testCallback(result) {
5 | try {
6 | process.send({ _testCallback: '_testCallback', result });
7 | } catch (e) {
8 | process.send({ error: e });
9 | }
10 | }
11 | function _resultsCallback(e, result) {
12 | if(e) {
13 | process.send({ error: e });
14 | }
15 | process.send({ _resultsCallback: '_resultsCallback', result });
16 | }
17 | function _finalCallback(e, result) {
18 | if(e) {
19 | process.send({ error: e });
20 | }
21 | process.send({ _finalCallback: '_finalCallback', result });
22 | process.exit(0);
23 | }
24 | function _importFileCb(e, result) {
25 | if(e) {
26 | process.send({ error: e });
27 | }
28 | }
29 |
30 | process.on('message', async(m) => {
31 | if (m.command === 'compile') {
32 | try {
33 | const input = m.payload;
34 | const installedSlocVersion = 'v' + Solc.version();
35 | const requiredSolcVersion = m.version;
36 |
37 | if(installedSlocVersion.includes(requiredSolcVersion)) {
38 | const output = await Solc.compileStandardWrapper(JSON.stringify(input));
39 | process.send({ compiled: output });
40 | } else {
41 | Solc.loadRemoteVersion(requiredSolcVersion, async(err, solcSnapshot) => {
42 | if (err) {
43 | process.send({ error: err });
44 | } else {
45 | const output = await solcSnapshot.compile(JSON.stringify(input));
46 | process.send({ compiled: output });
47 | }
48 | });
49 | }
50 | } catch (e) {
51 | throw e;
52 | }
53 | }
54 | if (m.command === 'runTests') {
55 | try {
56 | const sources = m.payload;
57 | RemixTests.runTestSources(sources, _testCallback, _resultsCallback, _finalCallback, _importFileCb);
58 | } catch (e) {
59 | throw e;
60 | }
61 | }
62 | });
63 | module.exports = {};
64 |
--------------------------------------------------------------------------------
/lib/components/LoaderView/index.js:
--------------------------------------------------------------------------------
1 | 'use babel';
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import PropTypes from 'prop-types';
20 | import ScaleLoader from 'react-spinners/ScaleLoader';
21 |
22 | const loaderContainerStyle = {
23 | textAlign: 'center',
24 | justifyContent: 'center'
25 | };
26 |
27 | class LoaderView extends React.Component {
28 | constructor(props) {
29 | super(props);
30 | this.store = this.props.store;
31 | }
32 | stateChange() {
33 | }
34 | componentDidUpdate() {
35 |
36 | }
37 | componentWillReceiveProps() {
38 |
39 | }
40 | render() {
41 | const { clients } = this.props;
42 | const { hasConnection } = clients[0];
43 |
44 | // alert(hasConnection);
45 |
46 | return (
47 |
48 |
54 |
55 | );
56 | }
57 | }
58 |
59 | LoaderView.propTypes = {
60 | clients: PropTypes.any.isRequired,
61 | store: PropTypes.any,
62 | };
63 |
64 | const mapStateToProps = ({ clientReducer }) => {
65 | const { clients } = clientReducer;
66 | return { clients };
67 | };
68 | export default connect(mapStateToProps)(LoaderView);
69 |
--------------------------------------------------------------------------------
/lib/actions/ContractActions.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { SET_COMPILED, SET_PARAMS, ADD_INTERFACE, SET_DEPLOYED, SET_INSTANCE, SET_GAS_ESTIMATE } from './types';
18 |
19 | export const contractCompiled = (dispatch, compiled) => {
20 | dispatch({ type: SET_COMPILED, payload: compiled });
21 | };
22 |
23 | export const setParamsInput = ({ contractName, abi }) => {
24 | return (dispatch) => {
25 | dispatch({ type: SET_PARAMS, payload: { contractName, abi } });
26 | };
27 | };
28 |
29 | export const addInterface = ({ contractName, ContractABI }) => {
30 | return (dispatch) => {
31 | dispatch({ type: ADD_INTERFACE, payload: { contractName, interface: ContractABI } });
32 | };
33 | };
34 |
35 | export const updateInterface = ({ contractName, ContractABI }) => {
36 | return (dispatch) => {
37 | dispatch({ type: ADD_INTERFACE, payload: { contractName, interface: ContractABI } });
38 | };
39 | };
40 |
41 | export const setInstance = ({ contractName, instance }) => {
42 | return (dispatch) => {
43 | dispatch({ type: SET_INSTANCE, payload: { contractName, instance } });
44 | };
45 | };
46 |
47 | export const setDeployed = ({ contractName, deployed }) => {
48 | return (dispatch) => {
49 | dispatch({ type: SET_DEPLOYED, payload: { contractName, deployed } });
50 | };
51 | };
52 |
53 | export const setGasEstimate = ({ gasEstimate }) => {
54 | return (dispatch) => {
55 | dispatch({ type: SET_GAS_ESTIMATE, payload: { gasEstimate } });
56 | };
57 | };
58 |
--------------------------------------------------------------------------------
/lib/components/Events/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import EventItem from '../EventItem';
20 | import PropTypes from 'prop-types';
21 |
22 | class Events extends React.Component {
23 | constructor(props) {
24 | super(props);
25 | this.helpers = props.helpers;
26 | }
27 | render() {
28 | const { events } = this.props;
29 | const events_ = events.slice();
30 | events_.reverse();
31 | return (
32 |
48 | );
49 | }
50 | }
51 |
52 | Events.propTypes = {
53 | helpers: PropTypes.any.isRequired,
54 | events: PropTypes.arrayOf(PropTypes.object)
55 | };
56 |
57 | const mapStateToProps = ({ eventReducer }) => {
58 | const { events } = eventReducer;
59 | return { events };
60 | };
61 |
62 | export default connect(mapStateToProps, {})(Events);
63 |
--------------------------------------------------------------------------------
/lib/components/GasInput/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import PropTypes from 'prop-types';
20 |
21 | class GasInput extends React.Component {
22 | constructor(props) {
23 | super(props);
24 | this.state = {
25 | gas: props.gas
26 | };
27 | }
28 | UNSAFE_componentWillReceiveProps(nextProps) {
29 | const { gas } = nextProps;
30 | this.setState({ gas });
31 | }
32 | render() {
33 | const { gasLimit } = this.props;
34 | const { contractName } = this.props;
35 | return (
36 |
47 | );
48 | }
49 | }
50 |
51 | GasInput.propTypes = {
52 | contractName: PropTypes.string,
53 | interfaces: PropTypes.arrayOf(PropTypes.object),
54 | onChange: PropTypes.func,
55 | gasLimit: PropTypes.number,
56 | gas: PropTypes.number
57 | };
58 |
59 | const mapStateToProps = ({ contract }) => {
60 | const { compiled, gasLimit } = contract;
61 | return { compiled, gasLimit };
62 | };
63 |
64 | export default connect(mapStateToProps, {})(GasInput);
65 |
--------------------------------------------------------------------------------
/lib/components/InputsForm/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import { setParamsInput } from '../../actions';
20 | import PropTypes from 'prop-types';
21 |
22 | class InputsForm extends React.Component {
23 | constructor(props) {
24 | super(props);
25 | this._handleChange = this._handleChange.bind(this);
26 | }
27 | _handleChange(input, event) {
28 | input.value = event.target.value;
29 | }
30 | render() {
31 | const { contractName, abi } = this.props;
32 | return (
33 |
50 | );
51 | }
52 | }
53 |
54 | InputsForm.propTypes = {
55 | onSubmit: PropTypes.func,
56 | contractName: PropTypes.string,
57 | abi: PropTypes.object
58 | };
59 |
60 | const mapStateToProps = ({ contract }) => {
61 | const { compiled } = contract;
62 | return { compiled };
63 | };
64 |
65 | export default connect(mapStateToProps, { setParamsInput })(InputsForm);
66 |
--------------------------------------------------------------------------------
/lib/components/ErrorView/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import PropTypes from 'prop-types';
20 |
21 | class ErrorView extends React.Component {
22 | constructor(props) {
23 | super(props);
24 | }
25 | render() {
26 | const { errormsg } = this.props;
27 | return (
28 |
51 | );
52 | }
53 | }
54 |
55 | ErrorView.propTypes = {
56 | errormsg: PropTypes.any
57 | };
58 |
59 | const mapStateToProps = ({ errors }) => {
60 | const { errormsg } = errors;
61 | return { errormsg };
62 | };
63 |
64 | export default connect(mapStateToProps, {})(ErrorView);
65 |
--------------------------------------------------------------------------------
/lib/actions/types.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | export const RESET_CONTRACTS = 'reset_contracts';
18 | export const SET_COMPILING = 'set_compiling';
19 | export const SET_COMPILED = 'set_compiled';
20 | export const RESET_COMPILED = 'reset_compiled';
21 | export const SET_PARAMS = 'set_params';
22 | export const ADD_INTERFACE = 'add_interface';
23 | export const UPDATE_INTERFACE = 'update_interface';
24 | export const UPDATE_OPTIONS = 'update_options';
25 | export const ADD_TX_HASH = 'add_tx_hash';
26 | export const SET_INSTANCE = 'set_instance';
27 | export const SET_DEPLOYED = 'set_deployed';
28 | export const SET_GAS_LIMIT = 'set_gas_limit';
29 | export const SET_BALANCE = 'set_balance';
30 | export const SET_GAS_ESTIMATE = 'set_gas_estimate';
31 |
32 | // Files action types
33 | export const RESET_SOURCES = 'reset_sources';
34 | export const SET_SOURCES = 'set_sources';
35 |
36 | export const SET_COINBASE = 'set_coinbase';
37 | export const SET_PASSWORD = 'set_password';
38 | export const SET_ACCOUNTS = 'set_accounts';
39 |
40 | export const SET_ERRORS = 'set_errors';
41 | export const RESET_ERRORS = 'reset_errors';
42 |
43 | // Ethereum client events
44 | export const ADD_PENDING_TRANSACTION = 'add_pending_transaction';
45 | export const ADD_EVENTS = 'add_logs';
46 | export const SET_EVENTS = 'set_events';
47 | export const TEXT_ANALYSIS = 'text_analysis';
48 |
49 | // Node variables
50 | export const SET_CONNECTED = 'set_connected';
51 | export const SET_SYNC_STATUS = 'set_sync_status';
52 | export const SET_SYNCING = 'set_syncing';
53 | export const SET_MINING = 'set_mining';
54 | export const SET_HASH_RATE = 'set_hash_rate';
55 |
56 | // Client variables
57 | export const SET_CONNECTION_STATUS = 'set_connection_status';
58 | export const FIRST_TIME_CHECK_ENABLE = 'first_time_check_enable';
59 | export const IS_WS_PROVIDER = 'is_ws_provider';
60 | export const IS_HTTP_PROVIDER = 'is_http_provider';
61 |
--------------------------------------------------------------------------------
/lib/ethereum-interface.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import { AtomSolidityView } from './ethereum-interface-view';
18 | import Web3Env from './web3/web3';
19 | import configureStore from './helpers/configureStore';
20 | import { CompositeDisposable } from 'atom';
21 |
22 | export class Etheratom {
23 | constructor(props) {
24 | this.subscriptions = new CompositeDisposable();
25 | this.atomSolidityView = new AtomSolidityView();
26 | this.modalPanel = null;
27 | this.loaded = false;
28 | this.store = configureStore();
29 | }
30 | activate() {
31 | require('atom-package-deps').install('etheratom', true)
32 | .then(function() {
33 | console.log('All dependencies installed, good to go');
34 | });
35 | this.subscriptions.add(atom.commands.add('atom-workspace', {
36 | 'eth-interface:toggle': ((_this) => {
37 | return function() {
38 | _this.toggleView();
39 | };
40 | })(this),
41 | 'eth-interface:activate': ((_this) => {
42 | return function() {
43 | _this.toggleView();
44 | };
45 | })(this)
46 | }));
47 | this.modalPanel = atom.workspace.addRightPanel({
48 | item: this.atomSolidityView.getElement(),
49 | visible: false
50 | });
51 | // Initiate env
52 | this.load();
53 | }
54 | deactivate() {
55 | this.modalPanel.destroy();
56 | this.subscriptions.dispose();
57 | this.atomSolidityView.destroy();
58 | }
59 | load() {
60 | this.loadWeb3();
61 | this.loaded = true;
62 | }
63 | loadWeb3() {
64 | if (this.Web3Interface) {
65 | return this.Web3Interface;
66 | }
67 | this.Web3Interface = new Web3Env(this.store);
68 | this.subscriptions.add(this.Web3Interface);
69 | return this.Web3Interface;
70 | }
71 | toggleView() {
72 | if (this.modalPanel.isVisible()) {
73 | return this.modalPanel.hide();
74 | } else {
75 | return this.modalPanel.show();
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/lib/components/VersionSelector/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import PropTypes from 'prop-types';
19 | import { connect } from 'react-redux';
20 | import axios from 'axios';
21 |
22 | class VersionSelector extends React.Component {
23 | constructor(props) {
24 | super(props);
25 | this.state = {
26 | availableVersions: [],
27 | selectedVersion: '',
28 | };
29 | this._handleVersionSelector = this._handleVersionSelector.bind(this);
30 | }
31 | async _handleVersionSelector(event) {
32 | const selectedVersion = event.target.value;
33 | await this.setState({ selectedVersion });
34 | atom.config.set('etheratom.versionSelector', selectedVersion);
35 | }
36 | async componentDidMount() {
37 | this.fetchVersionList();
38 | }
39 |
40 | async fetchVersionList() {
41 | const versions = await axios.get('https://ethereum.github.io/solc-bin/bin/list.json');
42 | this.setState({
43 | availableVersions: versions.data.releases,
44 | selectedVersion: atom.config.get('etheratom.versionSelector'),
45 | });
46 | }
47 | render() {
48 | const { availableVersions } = this.state;
49 | return (
50 |
51 |
52 |
61 |
62 |
63 | );
64 | }
65 | }
66 |
67 | VersionSelector.propTypes = {
68 | selectedVersion: PropTypes.string
69 | };
70 |
71 | const mapStateToProps = ({ contract }) => {
72 | const { selectedVersion } = contract;
73 | return { selectedVersion };
74 | };
75 |
76 | export default connect(mapStateToProps, {})(VersionSelector);
77 |
--------------------------------------------------------------------------------
/lib/components/EventItem/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import ReactJson from 'react-json-view';
19 | import { Collapse } from 'react-collapse';
20 | import PropTypes from 'prop-types';
21 |
22 | class EventItem extends React.Component {
23 | constructor(props) {
24 | super(props);
25 | this.state = {
26 | isOpened: false,
27 | toggleBtnStyle: 'btn icon icon-unfold inline-block-tight',
28 | toggleBtnTxt: 'Expand'
29 | };
30 | this._toggleCollapse = this._toggleCollapse.bind(this);
31 | }
32 | _toggleCollapse() {
33 | const { isOpened } = this.state;
34 | this.setState({ isOpened: !isOpened });
35 | if(!isOpened) {
36 | this.setState({
37 | toggleBtnStyle: 'btn btn-success icon icon-fold inline-block-tight',
38 | toggleBtnTxt: 'Collapse'
39 | });
40 | } else {
41 | this.setState({
42 | toggleBtnStyle: 'btn icon icon-unfold inline-block-tight',
43 | toggleBtnTxt: 'Expand'
44 | });
45 | }
46 | }
47 | render() {
48 | const { event } = this.props;
49 | const { isOpened, toggleBtnStyle, toggleBtnTxt } = this.state;
50 | return (
51 |
52 |
60 |
61 |
69 |
70 |
71 | );
72 | }
73 | }
74 |
75 | EventItem.propTypes = {
76 | event: PropTypes.object
77 | };
78 |
79 | export default EventItem;
80 |
--------------------------------------------------------------------------------
/lib/web3/view.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import ReactDOM from 'react-dom';
19 | import Web3Helpers from './methods';
20 | import TabView from '../components/TabView';
21 | import CoinbaseView from '../components/CoinbaseView';
22 | import VersionSelector from '../components/VersionSelector';
23 | import CompileBtn from '../components/CompileBtn';
24 | import { SET_ACCOUNTS, SET_COINBASE } from '../actions/types';
25 | import LoaderView from '../components/LoaderView';
26 |
27 | export default class View {
28 | constructor(store) {
29 | this.Accounts = [];
30 | this.coinbase = null;
31 | this.store = store;
32 | this.helpers = new Web3Helpers(this.store);
33 | }
34 | async createCoinbaseView() {
35 | try {
36 | await this.helpers.getAccounts();
37 | ReactDOM.render(, document.getElementById('accounts-list'));
38 | } catch (e) {
39 | console.log(e);
40 | this.helpers.showPanelError('No account exists! Please create one.');
41 | this.store.dispatch({ type: SET_ACCOUNTS, payload: [] });
42 | this.store.dispatch({ type: SET_COINBASE, payload: '0x00' });
43 | ReactDOM.render(, document.getElementById('accounts-list'));
44 |
45 | throw e;
46 | }
47 | }
48 | createButtonsView() {
49 | ReactDOM.render(
50 |
51 |
52 |
53 |
,
54 | document.getElementById('compile_btn'));
55 | }
56 | createTabView() {
57 | ReactDOM.render(, document.getElementById('tab_view'));
58 | }
59 | createVersionSelector() {
60 | ReactDOM.render(, document.getElementById('version_selector'));
61 | }
62 | createLoaderView() {
63 | ReactDOM.render(, document.getElementById('loader'));
64 | }
65 |
66 | createTextareaR(text) {
67 | var textNode;
68 | this.text = text;
69 | textNode = document.createElement('pre');
70 | textNode.textContent = this.text;
71 | textNode.classList.add('large-code');
72 | return textNode;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/components/RemixDebugger/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect, Provider } from 'react-redux';
19 | import PropTypes from 'prop-types';
20 | import { execution, init } from 'remix-lib';
21 | import { TransactionDebugger as Debugger } from 'remix-debug';
22 | class RemixDebugger extends React.Component {
23 | constructor(props) {
24 | super(props);
25 | }
26 | getDebugWeb3() {
27 | return new Promise((resolve, reject) => {
28 | execution.executionContext.detectNetwork((error, network) => {
29 | let web3;
30 | if (error || !network) {
31 | web3 = init.web3DebugNode(execution.executionContext.web3());
32 | } else {
33 | const webDebugNode = init.web3DebugNode(network.name);
34 | web3 = !webDebugNode ? execution.executionContext.web3() : webDebugNode;
35 | }
36 | init.extendWeb3(web3);
37 | resolve(web3);
38 | })
39 | })
40 | }
41 | async _runRemixDebugging(blockNumber, txNumber, tx) {
42 | let lastCompilationResult;
43 | if (this.props.compiled) lastCompilationResult = this.props.compiled;
44 | var api = null;
45 | let web3 = await this.getDebugWeb3();
46 | this.debugger = new Debugger({
47 | web3,
48 | api,
49 | compiler: { lastCompilationResult }
50 | });
51 |
52 | this.debugger.debug(blockNumber, txNumber, tx, () => {
53 | console.log('debugger detected');
54 | }).catch((error) => {
55 | console.error(error);
56 | })
57 | }
58 | render() {
59 | // const { blockNumber, txNumber, tx } = this.props;
60 | return (
61 |
62 |
63 |
Remix-Debugger
64 | {/*
65 |
68 | */}
69 |
72 |
73 |
74 | );
75 | }
76 | }
77 |
78 | RemixDebugger.propTypes = {
79 | compiled: PropTypes.object,
80 | store: PropTypes.any,
81 |
82 | };
83 | const mapStateToProps = ({ contract }) => {
84 | const { compiled } = contract;
85 | return { compiled };
86 | };
87 | export default connect(mapStateToProps, {})(RemixDebugger);
88 |
--------------------------------------------------------------------------------
/lib/reducers/ContractReducer.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import {
18 | SET_SOURCES,
19 | SET_COMPILING,
20 | SET_DEPLOYED,
21 | SET_COMPILED,
22 | RESET_COMPILED,
23 | RESET_CONTRACTS,
24 | SET_INSTANCE,
25 | SET_PARAMS,
26 | ADD_INTERFACE,
27 | UPDATE_INTERFACE,
28 | UPDATE_OPTIONS,
29 | ADD_TX_HASH,
30 | SET_GAS_LIMIT,
31 | SET_GAS_ESTIMATE
32 | } from '../actions/types';
33 | const INITIAL_STATE = {
34 | compiled: null,
35 | compiling: false,
36 | deployed: false,
37 | interfaces: null,
38 | contracts: null,
39 | instances: null,
40 | gasLimit: 0,
41 | gasEstimate: 90000
42 | };
43 | export default (state = INITIAL_STATE, action) => {
44 | switch (action.type) {
45 | case SET_SOURCES:
46 | return { ...state, sources: action.payload };
47 | case SET_COMPILING:
48 | return { ...state, compiling: action.payload };
49 | case SET_DEPLOYED:
50 | return { ...state, deployed: { ...state.deployed, [action.payload.contractName]: action.payload.deployed } };
51 | case SET_COMPILED:
52 | return { ...state, compiled: action.payload };
53 | case RESET_CONTRACTS:
54 | return { ...INITIAL_STATE };
55 | case RESET_COMPILED:
56 | return { ...state, compiled: null, deployed: false, interfaces: null, instances: null };
57 | case SET_INSTANCE:
58 | return { ...state, instances: { ...state.instances, [action.payload.contractName]: action.payload.instance } };
59 | case SET_PARAMS:
60 | return { ...state, interfaces: { ...state.interfaces, [action.payload.contractName]: { interface: action.payload.interface } } };
61 | case ADD_INTERFACE:
62 | return { ...state, interfaces: { ...state.interfaces, [action.payload.contractName]: { interface: action.payload.interface } } };
63 | case UPDATE_INTERFACE:
64 | return { ...state, interfaces: { ...state.interfaces, [action.payload.contractName]: { interface: action.payload.interface } } };
65 | case UPDATE_OPTIONS:
66 | // We want to access contracts like following:
67 | // contracts[myContract].options, contracts[myContract].methods, contracts[myContract].events
68 | return {
69 | ...state,
70 | contracts: {
71 | ...state.contracts,
72 | [action.payload.contractName]: {
73 | options: action.payload.options,
74 | transactionHash: (state.contracts && state.contracts[action.payload.contractName]) ? state.contracts[action.payload.contractName].transactionHash : null
75 | }
76 | }
77 | };
78 | case ADD_TX_HASH:
79 | return {
80 | ...state,
81 | contracts: {
82 | ...state.contracts,
83 | [action.payload.contractName]: {
84 | transactionHash: action.payload.transactionHash,
85 | options: state.contracts[action.payload.contractName].options
86 | }
87 | }
88 | };
89 | case SET_GAS_LIMIT:
90 | return { ...state, gasLimit: action.payload };
91 | case SET_GAS_ESTIMATE:
92 | return { ...state, gasEstimate: action.payload.gasEstimate };
93 | default:
94 | return state;
95 | }
96 | };
97 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "etheratom",
3 | "main": "build/main.js",
4 | "version": "4.6.0",
5 | "description": "Solidity compilation and Ethereum contract execution interface for hackable atom editor.",
6 | "keywords": [
7 | "ethereum",
8 | "solidity",
9 | "web3",
10 | "ethereumjs"
11 | ],
12 | "activationCommands": {
13 | "atom-workspace": [
14 | "eth-interface:activate",
15 | "eth-interface:toggle"
16 | ],
17 | "atom-text-editor[data-grammar~=\"solidity\"]:not([mini])": [
18 | "eth-interface:compile"
19 | ]
20 | },
21 | "activationHooks": [
22 | "core:loaded-shell-environment"
23 | ],
24 | "repository": {
25 | "type": "git",
26 | "url": "https://github.com/0mkara/etheratom"
27 | },
28 | "bugs": {
29 | "url": "https://github.com/0mkara/etheratom/issues"
30 | },
31 | "license": "GPLv3",
32 | "engines": {
33 | "atom": ">=1.0.0 <2.0.0"
34 | },
35 | "package-deps": [
36 | "language-solidity"
37 | ],
38 | "dependencies": {
39 | "atom-message-panel": "^1.2.7",
40 | "atom-package-deps": "^5.0.0",
41 | "axios": "^0.18.0",
42 | "blob": "0.0.5",
43 | "create-react-class": "^15.6.2",
44 | "eslint-import-resolver-node": "^0.3.2",
45 | "file-saver": "^2.0.0",
46 | "idempotent-babel-polyfill": "^7.0.0",
47 | "md5": "^2.2.1",
48 | "prop-types": "^15.6.1",
49 | "react": "16.8.3",
50 | "react-addons-update": "^15.4.2",
51 | "react-checkbox-tree": "1.4.0",
52 | "react-collapse": "^4.0.3",
53 | "react-dom": "^16.8.3",
54 | "react-json-view": "1.19.1",
55 | "react-motion": "^0.5.2",
56 | "react-redux": "^5.0.7",
57 | "react-spinners": "^0.5.13",
58 | "react-tabs": "3.0.0",
59 | "react-tiny-virtual-list": "2.2.0",
60 | "redux": "^4.0.0",
61 | "redux-logger": "^3.0.6",
62 | "redux-thunk": "^2.2.0",
63 | "remix-analyzer": "^0.3.1",
64 | "remix-debug": "^0.3.16",
65 | "remix-lib": "^0.4.14",
66 | "remix-solidity": "0.3.1",
67 | "remix-tests": "0.1.14",
68 | "shelljs": "^0.8.3",
69 | "solc": "^0.5.13",
70 | "valid-url": "^1.0.9",
71 | "web3": "^1.0.0-beta.35"
72 | },
73 | "configSchema": {
74 | "rpcAddress": {
75 | "title": "Ethereum rpc endpoint:",
76 | "description": "Point to local ethereum rpc endpoint. Used as HttpProvider.",
77 | "type": "string",
78 | "default": "",
79 | "order": 1
80 | },
81 | "websocketAddress": {
82 | "title": "Ethereum websocket endpoint:",
83 | "description": "Point to local ethereum websocket endpoint. Used as WebsocketProvider.",
84 | "type": "string",
85 | "default": "",
86 | "order": 2
87 | },
88 | "compileOnSave": {
89 | "title": "Compile Solidity on Save",
90 | "description": "Compile solidity code each time a file is saved",
91 | "type": "boolean",
92 | "default": true,
93 | "order": 3
94 | },
95 | "versionSelector": {
96 | "title": "Solidity compiler version:",
97 | "description": "Selected version of Solidity compiler",
98 | "type": "string",
99 | "default": "latest",
100 | "order": 4
101 | }
102 | },
103 | "scripts": {
104 | "postinstall": "npm install solc && node ./formatSolc.js",
105 | "build": "rollup -c"
106 | },
107 | "devDependencies": {
108 | "@babel/core": "7.3.3",
109 | "@babel/plugin-proposal-object-rest-spread": "7.3.2",
110 | "@babel/preset-env": "7.3.1",
111 | "@babel/preset-react": "7.0.0",
112 | "@types/web3": "^1.0.19",
113 | "babel-eslint": "^10.0.1",
114 | "babel-plugin-emotion": "^10.0.14",
115 | "eslint": "^5.0.0",
116 | "eslint-config-standard": "^12.0.0",
117 | "eslint-plugin-babel": "^5.1.0",
118 | "eslint-plugin-import": "^2.12.0",
119 | "eslint-plugin-node": "^8.0.0",
120 | "eslint-plugin-promise": "^4.0.0",
121 | "eslint-plugin-react": "^7.8.2",
122 | "eslint-plugin-standard": "^4.0.0",
123 | "rollup-plugin-babel": "4.3.0",
124 | "rollup-plugin-commonjs": "9.2.1",
125 | "rollup-plugin-node-builtins": "^2.1.2",
126 | "rollup-plugin-node-resolve": "^4.0.0"
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/lib/components/CreateButton/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import PropTypes from 'prop-types';
20 | import { setInstance, setDeployed, addNewEvents } from '../../actions';
21 |
22 | class CreateButton extends React.Component {
23 | constructor(props) {
24 | super(props);
25 | this.helpers = props.helpers;
26 | this.state = {
27 | constructorParams: undefined,
28 | coinbase: props.coinbase,
29 | password: props.password,
30 | atAddress: undefined
31 | };
32 | this._handleAtAddressChange = this._handleAtAddressChange.bind(this);
33 | this._handleSubmit = this._handleSubmit.bind(this);
34 | }
35 | async componentDidMount() {
36 | const { abi } = this.props;
37 | var inputs = [];
38 | for (let abiObj in abi) {
39 | if (abi[abiObj].type === 'constructor' && abi[abiObj].inputs.length > 0) {
40 | inputs = abi[abiObj].inputs;
41 | }
42 | }
43 | this.setState({ constructorParams: inputs });
44 | }
45 | async _handleAtAddressChange(event) {
46 | this.setState({ atAddress: event.target.value });
47 | }
48 | async _handleSubmit() {
49 | try {
50 | const { abi, bytecode, contractName, gas, coinbase, password } = this.props;
51 | const { atAddress } = this.state;
52 | const contractInterface = this.props.interfaces[contractName].interface;
53 | const constructor = contractInterface.find(interfaceItem => interfaceItem.type === 'constructor');
54 | const params = [];
55 | if (constructor) {
56 | for (let input of constructor.inputs) {
57 | if (input.value) {
58 | params.push(input);
59 | }
60 | }
61 | }
62 | await this.helpers.create({ coinbase, password, atAddress, abi, bytecode, contractName, params, gas });
63 | } catch (e) {
64 | console.error(e);
65 | this.helpers.showPanelError(e);
66 | }
67 | }
68 | render() {
69 | const { contractName } = this.props;
70 | return (
71 |
84 | );
85 | }
86 | }
87 |
88 | CreateButton.propTypes = {
89 | helpers: PropTypes.any.isRequired,
90 | coinbase: PropTypes.string,
91 | password: PropTypes.oneOfType([PropTypes.string, PropTypes.boolean]),
92 | interfaces: PropTypes.object,
93 | setInstance: PropTypes.func,
94 | setDeployed: PropTypes.func,
95 | addNewEvents: PropTypes.func,
96 | contractName: PropTypes.string,
97 | abi: PropTypes.object,
98 | bytecode: PropTypes.string,
99 | gas: PropTypes.number,
100 | };
101 |
102 | const mapStateToProps = ({ contract, account }) => {
103 | const { compiled, interfaces } = contract;
104 | const { coinbase, password } = account;
105 | return { compiled, interfaces, coinbase, password };
106 | };
107 |
108 | export default connect(mapStateToProps, { setDeployed, setInstance, addNewEvents })(CreateButton);
109 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Use [ethcode](https://marketplace.visualstudio.com/items?itemName=7finney.ethcode) in vscode for better development experience.
2 |
3 | # Etheratom
4 |
5 | [](https://greenkeeper.io/)
6 | [](https://travis-ci.org/0mkara/etheratom)
7 | [](https://gitter.im/Ethereum-Devtools-Developers-Studio/etheratom?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
8 | [](https://t.me/etheratom)
9 |
10 | Ethereum IDE plugin for hackable Atom editor. Compile smart contracts, deploy them to Ethereum networks. Efficient contract management interface. Integrated test suite for smart contracts.
11 |
12 | 
13 |
14 | # Sponsors
15 | 
16 |
17 |
18 | # Support
19 | You can join our Telegram group for quick help in solving any issues at https://t.me/etheratom [](https://t.me/etheratom)
20 |
21 | Join our new gitter room for help - https://gitter.im/Ethereum-Devtools-Developers-Studio/etheratom
22 |
23 | #### Quick help
24 | Follow our [quick troubleshooting issue](https://github.com/0mkara/etheratom/issues/282) to get help about some known bugs and issues.
25 |
26 | # Requirements
27 |
28 | #### Use [Ganache](http://truffleframework.com/ganache/) or Install [geth](https://github.com/ethereum/go-ethereum)
29 | [Go Ethereum client installation instruction](https://www.ethereum.org/cli)
30 | **Or**
31 | You can just download binary from [https://geth.ethereum.org/downloads/](https://geth.ethereum.org/downloads/) and run.
32 |
33 | #### Run go-ethereum client
34 | Start geth node on testnet using following command:
35 |
36 | geth --goerli --rpc --rpcapi="eth,web3,personal" --ws --wsorigins="*" --wsapi="eth,web3,personal" console
37 |
38 | *Note:* Only solidity compilation is supported. `--wsorigins="*"` or `--wsorigins="file://"` is necessary to allow Atom to connect to go-ethereum websocket endpoint.
39 |
40 | # Installation
41 |
42 | `apm install etheratom`
43 |
44 | Or you can install [Etheratom](https://atom.io/packages/etheratom) from Atom packages.
45 |
46 | #### Install from source
47 |
48 | Clone git repository
49 |
50 | git clone https://github.com/0mkara/etheratom.git
51 | cd etheratom
52 |
53 | Install as atom package
54 |
55 | apm install
56 | apm link .
57 |
58 | # Configuration
59 | **Geth** defaults : **rpc** `http://127.0.0.1:8545/` **websocket** `ws://127.0.0.1:8546/`
60 |
61 | **Ganache** defaults : **rpc** `http://127.0.0.1:7545/`
62 |
63 | #### Go to package settings and set rpc address & websocket address.
64 |
65 | 
66 |
67 | **Restart atom** to load your configuration changes.
68 |
69 | # Usage
70 |
71 | Activate Etheratom package `ctrl+alt+e`
72 |
73 | Compile solidity code with `ctrl+alt+c` or just by saving a solidity file with `ctrl+s`
74 |
75 | Show/hide etheratom panel `ctrl+alt+v`
76 |
77 | After compiling your solidity code click **Deploy to blockchain** button to deploy the contract on blockchain. Optionally you can deploy your contract at some previously created address.
78 |
79 | 
80 |
81 | ##### Follow [Etheratom Wiki](https://github.com/0mkara/etheratom/wiki) for more information.
82 |
83 | # Development guideline
84 |
85 | ##### Clone & code
86 | ```
87 | git clone https://github.com/0mkara/etheratom.git
88 | cd etheratom
89 | ```
90 | ##### Build
91 | `rollup -c`
92 |
93 | # Support development :heart:
94 |
95 | Etheratom aims to provide a clean interactive interface to develop solidity smart contracts, test them on testnet, do security analysis and deploy them on mainnet. **Etheratom needs your help!**
96 |
97 | **Etheratom is looking for financial help. Any organization or individual wants to help grow etheratom is requested to contact `0mkar@protonmail.com`**
98 |
99 | ## Ethereum :point_right: 0xd22fE4aEFed0A984B1165dc24095728EE7005a36
100 |
--------------------------------------------------------------------------------
/lib/components/ContractExecution/index.js:
--------------------------------------------------------------------------------
1 | 'use babel'
2 | // Copyright 2018 Etheratom Authors
3 | // This file is part of Etheratom.
4 |
5 | // Etheratom is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // Etheratom is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with Etheratom. If not, see .
17 | import React from 'react';
18 | import { connect } from 'react-redux';
19 | import ReactJson from 'react-json-view';
20 | import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
21 | import InputsForm from '../InputsForm';
22 | import FunctionABI from '../FunctionABI';
23 | import PropTypes from 'prop-types';
24 |
25 | class ContractExecution extends React.Component {
26 | constructor(props) {
27 | super(props);
28 | this.helpers = props.helpers;
29 | }
30 | render() {
31 | const { contractName, bytecode, index, contracts } = this.props;
32 | const contractOptions = contracts[contractName].options;
33 | const transactionHash = contracts[contractName].transactionHash;
34 | const ContractABI = contracts[contractName].options.jsonInterface;
35 | return (
36 |