├── .babelrc
├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── src
├── eos-client.jsx
├── index.html
├── index.jsx
├── names
│ ├── bid-table.jsx
│ ├── create-bid.jsx
│ └── names.jsx
├── scatter-client.jsx
├── staking
│ ├── stake-bandwidth.jsx
│ ├── staking.jsx
│ └── unstake-bandwidth.jsx
├── theme.css
├── tools
│ ├── account-create.jsx
│ ├── account-lookup.jsx
│ ├── buy-sell-ram.jsx
│ ├── manage-proxy.jsx
│ ├── tools.jsx
│ └── vote-genereos.jsx
├── unlock.jsx
└── votes
│ ├── vote-table.jsx
│ └── votes.jsx
└── webpack.config.js
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["env", "react", "stage-2"]
3 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | dist/bundle.js
3 | .idea/
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # This is the classic version of the EOSToolkit
2 | ### This version is no longer supported
3 | ### The new eostoolkit can be found at https://github.com/eostoolkit/eostoolkit
4 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "eos-toolbox",
3 | "version": "1.0.0",
4 | "description": "Manage your EOS!",
5 | "repository": {
6 | "type": "git",
7 | "url": "git://github.com/genereos/eostoolkit.git"
8 | },
9 | "main": "index.js",
10 | "scripts": {
11 | "start": "webpack-dev-server --config webpack.config.js --mode development",
12 | "test": "echo \"No test specified\" && exit 0",
13 | "compile": "webpack --config ./webpack.config.js --progress"
14 | },
15 | "keywords": [
16 | "react",
17 | "eos",
18 | "eos.js"
19 | ],
20 | "author": "Nathan Rempel",
21 | "license": "ISC",
22 | "devDependencies": {
23 | "babel-core": "^6.26.3",
24 | "babel-loader": "^7.1.4",
25 | "babel-preset-react": "^6.23.0",
26 | "babel-preset-stage-2": "^6.22.0",
27 | "clean-webpack-plugin": "^0.1.19",
28 | "css-loader": "^0.28.11",
29 | "html-webpack-plugin": "^3.2.0",
30 | "react-hot-loader": "^3.1.3",
31 | "react-router-dom": "^4.3.1",
32 | "react-table": "^6.8.6",
33 | "style-loader": "^0.21.0",
34 | "webpack": "^4.12.0",
35 | "webpack-cli": "^2.1.5",
36 | "webpack-dev-server": "^3.1.4"
37 | },
38 | "dependencies": {
39 | "babel-preset-env": "^1.7.0",
40 | "eosjs": "^14.1.1",
41 | "immutability-helper": "^2.7.0",
42 | "npm": "^6.1.0",
43 | "react": "^16.4.0",
44 | "react-addons-update": "^15.6.2",
45 | "react-bootstrap": "^0.32.1",
46 | "react-dom": "^16.4.0",
47 | "react-router-bootstrap": "^0.24.4"
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/eos-client.jsx:
--------------------------------------------------------------------------------
1 | import Eos from 'eosjs'
2 |
3 | const EOS_CONFIG = {
4 | clientConfig: {
5 | httpEndpoint: 'https://mainnet.genereos.io', // EOS http endpoint
6 | chainId: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
7 | }
8 | }
9 |
10 | export default function EosClient() {
11 | return Eos(EOS_CONFIG.clientConfig);
12 | }
13 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EOS Toolkit - By GenerEOS
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import update from 'react-addons-update';
4 | import { BrowserRouter as Router, Route, Redirect } from "react-router-dom";
5 | import { Navbar, Nav, NavItem, Panel, Alert, ButtonGroup, Button } from 'react-bootstrap';
6 | import { ScatterConnect } from './scatter-client.jsx';
7 | import { LinkContainer } from 'react-router-bootstrap';
8 | import Unlock from './unlock.jsx'
9 | import Tools from './tools/tools.jsx'
10 | import Names from './names/names.jsx'
11 | import Staking from './staking/staking.jsx'
12 | import './theme.css';
13 |
14 | const Home = () => (
15 |
16 | );
17 |
18 | class Toolkit extends React.Component {
19 | constructor(props) {
20 | super(props)
21 | }
22 |
23 |
24 |
25 | render() {
26 | return (
27 |
28 |
29 |
30 |
31 |
32 | EOS Toolkit by GenerEOS
33 |
34 |
35 |
36 |
37 |
38 | Tools
39 |
40 |
41 |
42 |
43 | Staking Management
44 |
45 |
46 |
47 |
48 | Name Auction
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Scatter Integration
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
Copywrite GenerEOS 2018 | Website | GitHub
68 |
69 |
70 |
71 | );
72 | }
73 | }
74 |
75 | ReactDOM.render( , document.getElementById('app'));
76 |
77 | module.hot.accept();
78 |
--------------------------------------------------------------------------------
/src/names/bid-table.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { render } from "react-dom";
3 | import update from 'react-addons-update';
4 | import EosClient from '../eos-client.jsx';
5 | import { Button } from 'react-bootstrap';
6 |
7 | // Import React Table
8 | import ReactTable from "react-table";
9 | import "react-table/react-table.css";
10 |
11 | export default class BidTable extends React.Component {
12 | constructor() {
13 | super();
14 | this.state = {
15 | data: [],
16 | loading:false
17 | };
18 |
19 |
20 | this.eosClient = EosClient();
21 | }
22 |
23 | componentDidMount() {
24 | this.getBids();
25 | }
26 |
27 | getBids() {
28 |
29 | this.setState({loading:true});
30 | var bids = {
31 | json: true,
32 | scope: "eosio",
33 | code: "eosio",
34 | table: "namebids",
35 | limit: 10000
36 | }
37 |
38 | this.eosClient.getTableRows(bids).then((table)=>{
39 | this.setState({data: table.rows,loading:false});
40 | });
41 | }
42 |
43 | formatDate(date) {
44 | let newDate = new Date(date/1000);
45 | return newDate.toUTCString();
46 | }
47 |
48 | render() {
49 | const { data, loading } = this.state;
50 | return (
51 |
52 | Refresh
53 | (
68 | {(row.value/10000)} EOS
69 | )
70 | },
71 | {
72 | Header: "Last Bid Time",
73 | accessor: "last_bid_time",
74 | Cell: row => (
75 | {this.formatDate(row.value)}
76 | )
77 | },
78 | ]}
79 | defaultPageSize={20}
80 | data={data}
81 | className="-striped -highlight"
82 | loading={loading} // Display the loading overlay when we need it
83 | filterable
84 | defaultSorted={[
85 | {
86 | id: "high_bid",
87 | desc: true
88 | }
89 | ]}
90 | />
91 |
92 |
93 | );
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/names/create-bid.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table, Popover, OverlayTrigger } from 'react-bootstrap';
4 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
5 |
6 | export default class CreateBid extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 |
10 | this.handleBidder = this.handleBidder.bind(this);
11 | this.handleName = this.handleName.bind(this);
12 | this.handleBid = this.handleBid.bind(this);
13 |
14 | this.state = {
15 | loading: false,
16 | error: false,
17 | success: '',
18 | reason: '',
19 | bidder: '',
20 | name: '',
21 | bid: 0.0001,
22 | eos: null
23 | };
24 |
25 | document.addEventListener('scatterLoaded', scatterExtension => {
26 | console.log('Scatter connected')
27 | let client = EosClient();
28 | this.setState({ eos: client});
29 |
30 | setInterval(() => {
31 | bindNameToState(this.setState.bind(this), ['bidder']);
32 | }, 1000);
33 | });
34 | }
35 |
36 | componentDidMount() {
37 | if(window.scatter !== undefined) {
38 | this.setState({ eos: EosClient()});
39 | bindNameToState(this.setState.bind(this), ['bidder']);
40 | }
41 | }
42 |
43 | handleBidder(e) {
44 | this.setState({ bidder: e.target.value });
45 | }
46 |
47 | handleName(e) {
48 | this.setState({ name: e.target.value });
49 | }
50 |
51 | handleBid(e) {
52 | this.setState({ bid: e.target.value });
53 | }
54 |
55 | createBid(e) {
56 | e.preventDefault();
57 | this.setState({loading:true, error:false, reason:''});
58 | this.state.eos.transaction(tr => {
59 | tr.bidname({
60 | bidder: this.state.bidder,
61 | newname: this.state.name,
62 | bid: this.state.bid + ' EOS',
63 | })
64 | }).then((data) => {
65 | console.log(data);
66 | this.setState({loading:false, error:false});
67 | }).catch((e) => {
68 | let error = JSON.stringify(e);
69 | this.setState({loading:false, error:true});
70 |
71 | if(error.includes('must increase bid by 10%')) {
72 | this.setState({reason:'Increase bid by 10%'});
73 | } else if(error.includes('Missing required accounts')) {
74 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
75 | }
76 | });
77 | }
78 |
79 |
80 |
81 | render() {
82 | const isError = this.state.error;
83 | const isLoading = this.state.loading;
84 | const isSuccess = this.state.success;
85 |
86 | const contract = (
87 |
88 | Action - {'{ bidname }'}
89 | Description
90 | The {'{ bidname }'} action places a bid on a premium account name, in the knowledge that the high bid will purchase the name.
91 |
92 | As an authorized party I {'{ signer }'} wish to bid on behalf of {'{ bidder }'} the amount of {'{ bid }'} toward purchase of the account name {'{ newname }'}.
93 |
94 | );
95 |
96 | const RenderStatus = () => {
97 | if(isError) {
98 | return (
99 |
100 | Transaction failed. {this.state.reason}
101 |
102 | );
103 | }
104 |
105 | if(isLoading) {
106 | return( );
107 | }
108 |
109 | if(isSuccess !== '') {
110 | return (
111 |
112 | Transaction sent. TxId: {isSuccess}
113 |
114 | );
115 | }
116 | return('');
117 | }
118 |
119 | return (
120 |
121 |
Important notice! Your bid is transferred immediately. Your bid will be returned if you are outbid.
122 |
156 |
157 |
158 |
159 |
160 | );
161 | }
162 | }
163 | module.hot.accept();
164 |
--------------------------------------------------------------------------------
/src/names/names.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Panel } from 'react-bootstrap';
3 | import BidTable from './bid-table.jsx'
4 | import CreateBid from './create-bid.jsx'
5 |
6 | export default class Names extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 | }
10 |
11 | render() {
12 | return (
13 |
14 |
15 |
16 | Bid on Premium Names
17 |
18 |
19 |
20 |
21 |
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/scatter-client.jsx:
--------------------------------------------------------------------------------
1 | import Eos from 'eosjs'
2 | import React from 'react'
3 | import update from 'react-addons-update';
4 | import { Button, Label } from 'react-bootstrap';
5 |
6 |
7 | const network = {
8 | blockchain:'eos',
9 | host:'mainnet.genereos.io', // ( or null if endorsed chainId )
10 | port:443, // ( or null if defaulting to 80 )
11 | chainId:"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", // Or null to fetch automatically ( takes longer )
12 | }
13 |
14 | const httpNetwork = {
15 | blockchain:'eos',
16 | host:'mainnet.genereos.io', // ( or null if endorsed chainId )
17 | port:80, // ( or null if defaulting to 80 )
18 | chainId:"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906", // Or null to fetch automatically ( takes longer )
19 | }
20 |
21 | const eosOptions = {
22 | broadcast: true,
23 | sign: true,
24 | chainId: "aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906",
25 | }
26 |
27 | export function EosClient() {
28 | return window.scatter.eos(network,Eos,eosOptions,'https');
29 | }
30 |
31 | export const bindNameToState = (stateSetter, paramArray) => {
32 | const name = window.scatter.identity && window.scatter.identity.accounts.find(x => x.blockchain === 'eos')
33 | ? window.scatter.identity.accounts.find(x => x.blockchain === 'eos').name
34 | : '';
35 |
36 | stateSetter(paramArray.reduce((acc, param) => {
37 | acc[param] = name;
38 | return acc;
39 | }, {}));
40 | }
41 |
42 | export class ScatterConnect extends React.Component {
43 | constructor(props, context) {
44 | super(props, context);
45 | this.state = {
46 | connecting: false,
47 | error: false,
48 | scatter: window.scatter,
49 | identity: null
50 | }
51 |
52 | document.addEventListener('scatterLoaded', scatterExtension => {
53 | console.log('Scatter connected')
54 | // Scatter will now be available from the window scope.
55 | // At this stage the connection to Scatter from the application is
56 | // already encrypted.
57 | this.setState({scatter: window.scatter, identity: window.scatter.identity});
58 |
59 | // It is good practice to take this off the window once you have
60 | // a reference to it.
61 | //window.scatter = null;
62 | })
63 | }
64 |
65 | connectIdentity() {
66 | this.state.scatter.getIdentity({accounts:[{chainId:network.chainId, blockchain:network.blockchain}]}).then(() => {
67 | console.log('Attach Identity');
68 | console.log(this.state.scatter.identity);
69 | this.setState({identity: window.scatter.identity});
70 | }).catch(error => {
71 | console.error(error);
72 | });
73 | }
74 |
75 | removeIdentity() {
76 | this.state.scatter.forgetIdentity().then(() => {
77 | console.log('Detach Identity');
78 | console.log(this.state.scatter.identity);
79 | this.setState({identity: window.scatter.identity});
80 | }).catch((e) => {
81 | if(e.code == 423) {
82 | console.log('No identity to detach');
83 | }
84 | });
85 | }
86 |
87 | renderScatter() {
88 | const id = this.state.identity ? (
89 | {this.state.identity.name}
90 | ) : (
);
91 |
92 | const button = this.state.identity ? (
93 | Remove Identity
94 | ) : (
95 | Attach Identity
96 | );
97 |
98 | return (
99 |
100 |
101 |
{id} {button}
102 |
103 |
104 | );
105 | }
106 |
107 | render() {
108 | if(this.state.scatter === undefined) {
109 | return (Scatter is required to send transactions. Install Scatter );
110 | } else {
111 | return ( this.renderScatter() );
112 | }
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/staking/stake-bandwidth.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import Eos from 'eosjs'
4 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table, Checkbox,Popover,OverlayTrigger } from 'react-bootstrap';
5 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
6 |
7 | export default class AccountCreate extends React.Component {
8 | constructor(props, context) {
9 | super(props, context);
10 |
11 | this.handleCreator = this.handleCreator.bind(this);
12 | this.handleName = this.handleName.bind(this);
13 | this.handleNet = this.handleNet.bind(this);
14 | this.handleCpu = this.handleCpu.bind(this);
15 | this.handleTransfer = this.handleTransfer.bind(this);
16 |
17 | this.state = {
18 | loading: false,
19 | error: false,
20 | reason: '',
21 | success: '',
22 | name: '',
23 | creator: '',
24 | net: 0,
25 | cpu: 0,
26 | transfer: true,
27 | eos: null,
28 | scatter:null
29 | };
30 |
31 |
32 | document.addEventListener('scatterLoaded', scatterExtension => {
33 | console.log('Scatter connected')
34 | let client = EosClient();
35 | this.setState({ eos: client});
36 |
37 | setInterval(() => {
38 | bindNameToState(this.setState.bind(this), ['creator']);
39 | }, 1000)
40 |
41 |
42 |
43 | });
44 | }
45 |
46 | componentDidMount() {
47 | if(window.scatter !== undefined) {
48 | this.setState({ eos: EosClient()});
49 | bindNameToState(this.setState.bind(this), ['creator']);
50 | }
51 | }
52 |
53 | handleName(e) {
54 | this.setState({ name: e.target.value });
55 | }
56 |
57 | handleCreator(e) {
58 | this.setState({ creator: e.target.value });
59 | }
60 |
61 | handleNet(e) {
62 | this.setState({ net: e.target.value });
63 | }
64 |
65 | handleCpu(e) {
66 | this.setState({ cpu: e.target.value });
67 | }
68 |
69 | handleTransfer(e) {
70 | this.setState({ transfer: e.target.checked });
71 | }
72 |
73 | stakeBandwidth(e) {
74 | e.preventDefault();
75 | this.setState({loading:true, error:false, reason:'', success:''});1
76 | this.state.eos.transaction(tr => {
77 | tr.delegatebw({
78 | from: this.state.creator,
79 | receiver: this.state.name,
80 | stake_net_quantity: this.state.net + ' EOS',
81 | stake_cpu_quantity: this.state.cpu + ' EOS',
82 | transfer: this.state.transfer ? 1 : 0
83 | })
84 | }).then((data) => {
85 | console.log(data.transaction_id);
86 | this.setState({loading:false, error:false, success: data.transaction_id});
87 | }).catch((e) => {
88 | let error = JSON.stringify(e);
89 | this.setState({loading:false, error:true});
90 |
91 | if(error.includes('Missing required accounts')) {
92 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
93 | }
94 | });
95 | }
96 |
97 | render() {
98 | const isError = this.state.error;
99 | const isLoading = this.state.loading;
100 | const isSuccess = this.state.success;
101 |
102 | const contract = (
103 |
104 | Action - {'{ delegatebw }'}
105 | Description
106 | The intent of the {'{ delegatebw }'} action is to stake tokens for bandwidth and/or CPU and optionally transfer ownership.
107 |
108 | As an authorized party I {'{ signer }'} wish to stake {'{ stake_cpu_quantity }'} for CPU and {'{ stake_net_quantity }'} for bandwidth from the liquid tokens of {'{ from }'} for the use of delegatee {'{ to }'}.
109 |
110 | {'{if transfer }'}
111 | It is {'{ transfer }'} that I wish these tokens to become immediately owned by the delegatee.
112 |
113 | {'{/if}'}
114 | As signer I stipulate that, if I am not the beneficial owner of these tokens, I have proof that I’ve been authorized to take this action by their beneficial owner(s).
115 | );
116 |
117 | const RenderStatus = () => {
118 | if(isError) {
119 | return (
120 |
121 | Transaction failed. {this.state.reason}
122 |
123 | );
124 | }
125 |
126 | if(isLoading) {
127 | return( );
128 | }
129 |
130 | if(isSuccess !== '') {
131 | return (
132 |
133 | Transaction sent. TxId: {isSuccess}
134 |
135 | );
136 | }
137 | return('');
138 | }
139 |
140 | return (
141 |
142 |
143 |
194 |
195 |
196 |
197 |
198 |
199 | );
200 | }
201 | }
202 | module.hot.accept();
203 |
--------------------------------------------------------------------------------
/src/staking/staking.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Panel } from 'react-bootstrap';
3 | import AccountLookup from '../tools/account-lookup.jsx'
4 | import UndeletegateBandwidth from './unstake-bandwidth.jsx'
5 | import DeletegateBandwidth from './stake-bandwidth.jsx'
6 | export default class Staking extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 | }
10 |
11 | render() {
12 | return (
13 |
14 |
15 |
16 | Lookup Accounts
17 |
18 |
19 |
20 |
21 |
22 | Undelegate Bandwidth (Unstake)
23 |
24 |
25 |
26 |
27 |
28 | Delegate Bandwidth (Stake)
29 |
30 |
31 |
32 |
33 |
34 | Withdraw (after Unstake period)
35 |
36 | Coming soon...
37 |
38 |
39 | );
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/staking/unstake-bandwidth.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import Eos from 'eosjs'
4 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table, Checkbox,Popover,OverlayTrigger } from 'react-bootstrap';
5 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
6 |
7 | export default class AccountCreate extends React.Component {
8 | constructor(props, context) {
9 | super(props, context);
10 |
11 | this.handleCreator = this.handleCreator.bind(this);
12 | this.handleName = this.handleName.bind(this);
13 | this.handleNet = this.handleNet.bind(this);
14 | this.handleCpu = this.handleCpu.bind(this);
15 |
16 | this.state = {
17 | loading: false,
18 | error: false,
19 | reason: '',
20 | success: '',
21 | name: '',
22 | creator: '',
23 | net: 0,
24 | cpu: 0,
25 | eos: null,
26 | scatter:null
27 | };
28 |
29 |
30 | document.addEventListener('scatterLoaded', scatterExtension => {
31 | console.log('Scatter connected')
32 | let client = EosClient();
33 | this.setState({ eos: client});
34 |
35 | setInterval(() => {
36 | bindNameToState(this.setState.bind(this), ['creator']);
37 | }, 1000)
38 |
39 |
40 |
41 | });
42 | }
43 |
44 | componentDidMount() {
45 | if(window.scatter !== undefined) {
46 | this.setState({ eos: EosClient()});
47 | bindNameToState(this.setState.bind(this), ['creator']);
48 | }
49 | }
50 |
51 | handleName(e) {
52 | this.setState({ name: e.target.value });
53 | }
54 |
55 | handleCreator(e) {
56 | this.setState({ creator: e.target.value });
57 | }
58 |
59 | handleNet(e) {
60 | this.setState({ net: e.target.value });
61 | }
62 |
63 | handleCpu(e) {
64 | this.setState({ cpu: e.target.value });
65 | }
66 |
67 | unstakeBandwidth(e) {
68 | e.preventDefault();
69 | this.setState({loading:true, error:false, reason:'', success:''});1
70 | this.state.eos.transaction(tr => {
71 | tr.undelegatebw({
72 | from: this.state.creator,
73 | receiver: this.state.name,
74 | unstake_net_quantity: this.state.net + ' EOS',
75 | unstake_cpu_quantity: this.state.cpu + ' EOS',
76 | })
77 | }).then((data) => {
78 | console.log(data.transaction_id);
79 | this.setState({loading:false, error:false, success: data.transaction_id});
80 | }).catch((e) => {
81 | let error = JSON.stringify(e);
82 | this.setState({loading:false, error:true});
83 |
84 | if(error.includes('Missing required accounts')) {
85 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
86 | }
87 | });
88 | }
89 |
90 | render() {
91 | const isError = this.state.error;
92 | const isLoading = this.state.loading;
93 | const isSuccess = this.state.success;
94 |
95 | const contract = (
96 |
97 | Action - {'{ undelegatebw }'}
98 | Description
99 | The intent of the {'{ undelegatebw }'} action is to unstake tokens from CPU and/or bandwidth.
100 |
101 | As an authorized party I {'{ signer }'} wish to unstake {'{ unstake_cpu_quantity }'} from CPU and {'{ unstake_net_quantity }'} from bandwidth from the tokens owned by {'{ from }'} previously delegated for the use of delegatee {'{ to }'}.
102 |
103 | If I as signer am not the beneficial owner of these tokens I stipulate I have proof that I’ve been authorized to take this action by their beneficial owner(s).
104 |
105 | );
106 |
107 | const RenderStatus = () => {
108 | if(isError) {
109 | return (
110 |
111 | Transaction failed. {this.state.reason}
112 |
113 | );
114 | }
115 |
116 | if(isLoading) {
117 | return( );
118 | }
119 |
120 | if(isSuccess !== '') {
121 | return (
122 |
123 | Transaction sent. TxId: {isSuccess}
124 |
125 | );
126 | }
127 | return('');
128 | }
129 |
130 | return (
131 |
132 |
Important notice! Unstaking takes three days. After this time has passed you can use "withdraw" below.
133 |
Your vote goes away! After unstaking your vote no longer has weight. Please keep this in mind - Please stake and vote!
134 |
178 |
179 |
180 |
181 |
182 |
183 | );
184 | }
185 | }
186 | module.hot.accept();
187 |
--------------------------------------------------------------------------------
/src/theme.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 70px;
3 | padding-bottom: 30px;
4 | }
5 |
6 | .theme-dropdown .dropdown-menu {
7 | position: static;
8 | display: block;
9 | margin-bottom: 20px;
10 | }
11 |
12 | .theme-showcase > p > .btn {
13 | margin: 5px 0;
14 | }
15 |
16 | .theme-showcase .navbar .container {
17 | width: auto;
18 | }
19 |
--------------------------------------------------------------------------------
/src/tools/account-create.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import Eos from 'eosjs'
4 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table, Checkbox,Popover,OverlayTrigger } from 'react-bootstrap';
5 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
6 |
7 | export default class AccountCreate extends React.Component {
8 | constructor(props, context) {
9 | super(props, context);
10 |
11 | this.handleOwner = this.handleOwner.bind(this);
12 | this.handleActive = this.handleActive.bind(this);
13 | this.handleCreator = this.handleCreator.bind(this);
14 | this.handleName = this.handleName.bind(this);
15 | this.handleNet = this.handleNet.bind(this);
16 | this.handleCpu = this.handleCpu.bind(this);
17 | this.handleRam = this.handleRam.bind(this);
18 | this.handleTransfer = this.handleTransfer.bind(this);
19 |
20 | this.state = {
21 | loading: false,
22 | error: false,
23 | reason: '',
24 | success: '',
25 | owner: '',
26 | active: '',
27 | name: '',
28 | creator: '',
29 | net: 0.1,
30 | cpu: 0.1,
31 | ram: 8192,
32 | transfer: true,
33 | eos: null,
34 | scatter:null
35 | };
36 |
37 |
38 | document.addEventListener('scatterLoaded', scatterExtension => {
39 | console.log('Scatter connected')
40 | let client = EosClient();
41 | this.setState({ eos: client});
42 |
43 | setInterval(() => {
44 | bindNameToState(this.setState.bind(this), ['creator']);
45 | }, 1000)
46 |
47 |
48 |
49 | });
50 | }
51 |
52 | componentDidMount() {
53 | if(window.scatter !== undefined) {
54 | this.setState({ eos: EosClient()});
55 | bindNameToState(this.setState.bind(this), ['creator']);
56 | }
57 | }
58 |
59 | getNameValidation() {
60 | const name = this.state.name;
61 | let regEx = new RegExp("^([a-z1-5]){12,}$");
62 | if (name.length == 12 && regEx.test(name)) return 'success'
63 | else return 'error';
64 | return null;
65 | }
66 |
67 | handleActive(e) {
68 | this.setState({ active: e.target.value });
69 | }
70 |
71 | handleOwner(e) {
72 | this.setState({ owner: e.target.value });
73 | }
74 |
75 | handleName(e) {
76 | this.setState({ name: e.target.value });
77 | }
78 |
79 | handleCreator(e) {
80 | this.setState({ creator: e.target.value });
81 | }
82 |
83 | handleNet(e) {
84 | this.setState({ net: e.target.value });
85 | }
86 |
87 | handleCpu(e) {
88 | this.setState({ cpu: e.target.value });
89 | }
90 |
91 | handleRam(e) {
92 | this.setState({ ram: e.target.value });
93 | }
94 |
95 | handleTransfer(e) {
96 | this.setState({ transfer: e.target.checked });
97 | }
98 |
99 | resetForm() {
100 | this.setState({
101 | // owner: '',
102 | active: '',
103 | name: '',
104 | creator: '',
105 | net: 0.1,
106 | cpu: 0.1,
107 | ram: 8192,
108 | transfer: true,
109 | });
110 | }
111 |
112 | createAccount(e) {
113 | e.preventDefault();
114 | this.setState({loading:true, error:false, reason:'', success:''});1
115 | this.state.eos.transaction(tr => {
116 | tr.newaccount({
117 | creator: this.state.creator,
118 | name: this.state.name,
119 | owner: this.state.owner,
120 | active: this.state.active
121 | })
122 | tr.buyrambytes({
123 | payer: this.state.creator,
124 | receiver: this.state.name,
125 | bytes: Number(this.state.ram)
126 | })
127 | tr.delegatebw({
128 | from: this.state.creator,
129 | receiver: this.state.name,
130 | stake_net_quantity: this.state.net + ' EOS',
131 | stake_cpu_quantity: this.state.cpu + ' EOS',
132 | transfer: this.state.transfer ? 1 : 0
133 | })
134 | }).then((data) => {
135 | console.log(data.transaction_id);
136 | this.setState({loading:false, error:false, success: data.transaction_id});
137 | }).catch((e) => {
138 | let error = JSON.stringify(e);
139 | this.setState({loading:false, error:true});
140 |
141 | if(error.includes('name is already taken')) {
142 | this.setState({reason:'Someone already owns that name.'});
143 | } else if(error.includes('Missing required accounts')) {
144 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
145 | }
146 | });
147 | }
148 |
149 |
150 |
151 |
152 | render() {
153 | const isError = this.state.error;
154 | const isLoading = this.state.loading;
155 | const isSuccess = this.state.success;
156 |
157 | const contract = (
158 |
159 | Action - {'{ newaccount }'}
160 | Description
161 | The {'{ newaccount }'} action creates a new account.
162 |
163 | As an authorized party I {'{ signer }'} wish to exercise the authority of {'{ creator }'} to create a new account on this system named {'{ name }'} such that the new account's owner public key shall be {'{ owner }'} and the active public key shall be {'{ active }'}.
164 |
165 |
166 | );
167 |
168 | const RenderStatus = () => {
169 | if(isError) {
170 | return (
171 |
172 | Transaction failed. {this.state.reason}
173 |
174 | );
175 | }
176 |
177 | if(isLoading) {
178 | return( );
179 | }
180 |
181 | if(isSuccess !== '') {
182 | return (
183 |
184 | Transaction sent. TxId: {isSuccess}
185 |
186 | );
187 | }
188 | return('');
189 | }
190 |
191 | return (
192 |
193 |
194 |
272 |
273 |
274 |
275 |
276 |
277 | );
278 | }
279 | }
280 | module.hot.accept();
281 |
--------------------------------------------------------------------------------
/src/tools/account-lookup.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table,Label } from 'react-bootstrap';
4 | import EosClient from '../eos-client.jsx';
5 |
6 | export default class AccountLookup extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 |
10 | this.handlePubkey = this.handlePubkey.bind(this);
11 | this.handleName = this.handleName.bind(this);
12 |
13 | this.state = {
14 | loading: false,
15 | error: false,
16 | pubkey: '',
17 | name: '',
18 | accounts: [],
19 | eos: EosClient()
20 | };
21 | }
22 |
23 | handlePubkey(e) {
24 | this.setState({ pubkey: e.target.value });
25 | }
26 |
27 | handleName(e) {
28 | this.setState({ name: e.target.value });
29 | }
30 |
31 | lookupAccountsByKey(e) {
32 | e.preventDefault();
33 | this.setState({accounts:[]});
34 | this.setState({loading:true, error:false});
35 | this.state.eos.getKeyAccounts(this.state.pubkey).then((data) => {
36 | data.account_names.map((name) => {this.getAccountDetail(name)});
37 | }).catch((e) => {
38 | console.error(e);
39 | this.setState({loading:false, error:true});
40 | })
41 | }
42 |
43 | lookupAccountsByName(e) {
44 | e.preventDefault();
45 | this.setState({accounts:[]});
46 | this.setState({loading:true, error:false});
47 | this.getAccountDetail(this.state.name);
48 | }
49 |
50 | getAccountDetail(name) {
51 | this.state.eos.getAccount(name).then((data) => {
52 | this.state.eos.getCurrencyBalance('eosio.token',name).then((currency) => {
53 | data.currency = currency;
54 | console.log(data);
55 | const newAccounts = update(this.state.accounts, {$push: [
56 | data,
57 | ]});
58 | this.setState({ loading:false, error:false, accounts: newAccounts })
59 | });
60 | }).catch((e) => {
61 | console.error(e);
62 | this.setState({loading:false, error:true});
63 | })
64 | }
65 |
66 | renderPermission(permission) {
67 | const keys = permission.required_auth.keys.map((k)=>{
68 | let key = {
69 | perm_name: permission.perm_name,
70 | key: k.key,
71 | weight: k.weight,
72 | }
73 | return key;
74 | });
75 | const renderKey = (k) => {
76 | return (
77 |
78 | {k.perm_name}
79 | {k.key}
80 | {k.weight}
81 |
82 | );
83 | }
84 | return (
85 | keys.map(renderKey.bind(this))
86 | );
87 | return(test );
88 | }
89 |
90 | renderAccount(account) {
91 | const cpu = Number(account.self_delegated_bandwidth ? account.self_delegated_bandwidth.cpu_weight.slice(0,-4) : 0);
92 | const net = Number(account.self_delegated_bandwidth ? account.self_delegated_bandwidth.net_weight.slice(0,-4) : 0);
93 | const eos = Number(account.currency[0] ? account.currency[0].slice(0,-4) : 0);
94 |
95 | return (
96 | // {account.account_name}
97 |
98 |
99 | {account.account_name} {cpu+net+eos} EOS
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | Available Currency
110 |
111 |
112 | {account.currency.map((value)=>{return {value} })}
113 |
114 |
115 |
116 |
117 |
118 |
119 | Resources
120 |
121 |
122 |
123 | NET Stake
124 | {account.total_resources.net_weight}
125 |
126 |
127 | CPU Stake
128 | {account.total_resources.cpu_weight}
129 |
130 |
131 | RAM Used
132 | {(account.ram_usage/1024).toFixed(3)} kB
133 |
134 |
135 | RAM Quota
136 | {(account.ram_quota/1024).toFixed(3)} kB
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | Permission
148 | Key
149 | Weight
150 |
151 |
152 |
153 | {account.permissions.map(this.renderPermission.bind(this))}
154 |
155 |
156 |
157 |
158 |
159 |
160 | Votes:
161 | {account.voter_info ? account.voter_info.producers.join(',') : ''}
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | );
171 | }
172 |
173 | render() {
174 | const isError = this.state.error;
175 | const isLoading = this.state.loading;
176 | return (
177 |
178 |
191 |
OR...
192 |
205 |
206 | {isError ? (
207 |
208 | No results! The public key or name provided may be invalid or does not exist.
209 |
210 | ) : (
211 | isLoading ? (
212 |
213 | ) : (
214 | this.state.accounts.map(this.renderAccount.bind(this))
215 | )
216 | )}
217 |
218 |
219 | );
220 | }
221 | }
222 | module.hot.accept();
223 |
--------------------------------------------------------------------------------
/src/tools/buy-sell-ram.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table,OverlayTrigger,Popover } from 'react-bootstrap';
4 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
5 |
6 | export default class BuySellRam extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 |
10 | this.handlePayer = this.handlePayer.bind(this);
11 | this.handleReceiver = this.handleReceiver.bind(this);
12 | this.handleQuant = this.handleQuant.bind(this);
13 | this.handleBytes = this.handleBytes.bind(this);
14 | this.handleAccount = this.handleAccount.bind(this);
15 |
16 | this.state = {
17 | loading: false,
18 | error: false,
19 | reason: '',
20 | success: '',
21 | payer: '',
22 | receiver: '',
23 | account: '',
24 | bytes: null,
25 | quant: null,
26 | eos: null
27 | };
28 |
29 | document.addEventListener('scatterLoaded', scatterExtension => {
30 | console.log('Scatter connected')
31 | let client = EosClient();
32 | this.setState({ eos: client});
33 |
34 | setInterval(() => {
35 | bindNameToState(this.setState.bind(this), ['payer']);
36 | bindNameToState(this.setState.bind(this), ['account']);
37 | if (!this.state.receiver) bindNameToState(this.setState.bind(this), ['receiver']);
38 | }, 1000)
39 | });
40 | }
41 |
42 | componentDidMount() {
43 | if(window.scatter !== undefined) {
44 | this.setState({ eos: EosClient()});
45 | bindNameToState(this.setState.bind(this), ['payer']);
46 | bindNameToState(this.setState.bind(this), ['account']);
47 | if (!this.state.receiver) bindNameToState(this.setState.bind(this), ['receiver']);
48 | }
49 | }
50 |
51 | handlePayer(e) {
52 | this.setState({ payer: e.target.value });
53 | }
54 |
55 | handleReceiver(e) {
56 | this.setState({ receiver: e.target.value });
57 | }
58 |
59 | handleQuant(e) {
60 | this.setState({ quant: e.target.value });
61 | }
62 |
63 | handleAccount(e) {
64 | this.setState({ account: e.target.value });
65 | }
66 |
67 | handleBytes(e) {
68 | this.setState({ bytes: e.target.value });
69 | }
70 |
71 | buyRAM(e) {
72 | e.preventDefault();
73 | this.setState({loading:true, error:false, success: ''});
74 | this.state.eos.transaction(tr => {
75 | tr.buyram({
76 | payer: this.state.payer,
77 | receiver: this.state.receiver,
78 | quant: this.state.quant + ' EOS',
79 | })
80 | }).then((data) => {
81 | console.log(data.transaction_id);
82 | this.setState({loading:false, error:false, success: data.transaction_id});
83 | }).catch((e) => {
84 | if (e.message) {
85 | this.setState({loading:false, error:true, reason: e.message})
86 | }
87 | else {
88 | const error = JSON.parse(e).error;
89 | if (error.details.length) {
90 | this.setState({loading:false, error:true, reason: error.details[0].message})
91 | }
92 | }
93 | })
94 | }
95 | sellRAM(e) {
96 | e.preventDefault();
97 | this.setState({loading:true, error:false, success: ''});
98 | this.state.eos.transaction(tr => {
99 | tr.sellram({
100 | account: this.state.account,
101 | bytes: Number(this.state.bytes),
102 | })
103 | }).then((data) => {
104 | console.log(data.transaction_id);
105 | this.setState({loading:false, error:false, success: data.transaction_id});
106 | }).catch((e) => {
107 | if (e.message) {
108 | this.setState({loading:false, error:true, reason: e.message})
109 | }
110 | else {
111 | const error = JSON.parse(e).error;
112 | if (error.details.length) {
113 | this.setState({loading:false, error:true, reason: error.details[0].message})
114 | }
115 | }
116 | })
117 | }
118 |
119 | render() {
120 | const isError = this.state.error;
121 | const isLoading = this.state.loading;
122 | const isSuccess = this.state.success;
123 |
124 | const contractBuyRAM = (
125 |
126 | Action - {'{ buyram }'}
127 | Description
128 | This action will attempt to reserve about {'{ quant }'} worth of RAM on behalf of {'{ receiver }'}.
129 |
130 | {'{ buyer }'} authorizes this contract to transfer {'{ quant }'} to buy RAM based upon the current price as determined by the market maker algorithm.
131 |
132 | {'{ buyer }'} accepts that a 0.5% fee will be charged on the amount spent and that the actual RAM received may be slightly less than expected due to the approximations necessary to enable this service.
133 |
134 | {'{ buyer }'} accepts that a 0.5% fee will be charged if and when they sell the RAM received.
135 |
136 | {'{ buyer }'} accepts that rounding errors resulting from limits of computational precision may result in less RAM being allocated.
137 |
138 | {'{ buyer }'} acknowledges that the supply of RAM may be increased at any time up to the limits of off-the-shelf computer equipment and that this may result in RAM selling for less than purchase price.
139 |
140 | {'{ buyer }'} acknowledges that the price of RAM may increase or decrease over time according to supply and demand.
141 |
142 | {'{ buyer }'} acknowledges that RAM is non-transferrable.
143 |
144 | {'{ buyer }'} acknowledges RAM currently in use by their account cannot be sold until it is freed and that freeing RAM may be subject to terms of other contracts.
145 |
146 | );
147 | const contractSellRAM = (
148 |
149 | Action - {'{ sellram }'}
150 | Description
151 | The {'{ sellram }'} action sells unused RAM for tokens.
152 |
153 | As an authorized party I {'{ signer }'} wish to sell {'{ bytes }'} of unused RAM from account {'{ account }'}.
154 |
155 | );
156 |
157 | const RenderStatus = () => {
158 | if(isError) {
159 | return (
160 |
161 | Transaction failed. {this.state.reason}
162 |
163 | );
164 | }
165 |
166 | if(isLoading) {
167 | return( );
168 | }
169 |
170 | if(isSuccess !== '') {
171 | return (
172 |
173 | Transaction sent. TxId: {isSuccess}
174 |
175 | );
176 | }
177 | return('');
178 | }
179 |
180 | return (
181 |
182 | {/* Buy RAM */}
183 |
Buy RAM This action will attempt to reserve about {'{ quant }'} worth of RAM on behalf of {'{ receiver }'}.
184 |
185 | Read Contract
186 |
187 |
219 |
220 | {/* Sell RAM */}
221 |
Sell RAM The {'{ sellram }'} action sells unused RAM for tokens.
222 |
223 | Read Contract
224 |
225 |
247 |
248 |
249 |
250 |
251 | );
252 | }
253 | }
254 | module.hot.accept();
255 |
--------------------------------------------------------------------------------
/src/tools/manage-proxy.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table, OverlayTrigger,Popover } from 'react-bootstrap';
4 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
5 |
6 | export default class ManageProxy extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 |
10 | this.handleRegProxy = this.handleRegProxy.bind(this);
11 | this.handleSetProxy = this.handleSetProxy.bind(this);
12 | this.handleSetName = this.handleSetName.bind(this);
13 |
14 | this.state = {
15 | loading: false,
16 | error: false,
17 | success: '',
18 | reason: '',
19 | regProxy: '',
20 | setProxy: '',
21 | setName: '',
22 | eos: null
23 | };
24 |
25 |
26 | document.addEventListener('scatterLoaded', scatterExtension => {
27 | console.log('Scatter connected')
28 | let client = EosClient();
29 | this.setState({ eos: client});
30 |
31 | setInterval(() => {
32 | bindNameToState(this.setState.bind(this), ['regProxy', 'setName']);
33 | }, 1000)
34 | });
35 | }
36 |
37 | componentDidMount() {
38 | if(window.scatter !== undefined) {
39 | this.setState({ eos: EosClient()});
40 | bindNameToState(this.setState.bind(this), ['regProxy', 'setName']);
41 | }
42 | }
43 |
44 | handleRegProxy(e) {
45 | this.setState({ regProxy: e.target.value });
46 | }
47 |
48 | handleSetProxy(e) {
49 | this.setState({ setProxy: e.target.value });
50 | }
51 |
52 | handleSetName(e) {
53 | this.setState({ setName: e.target.value });
54 | }
55 |
56 | resetForms() {
57 | this.setState({
58 | regProxy: '',
59 | setProxy: '',
60 | setName: '',
61 | });
62 | }
63 |
64 | regProxy(e) {
65 | e.preventDefault();
66 | this.setState({loading:true, error:false, success:''});
67 | this.state.eos.transaction(tr => {
68 | tr.regproxy({
69 | proxy: this.state.regProxy,
70 | isproxy: 1
71 | })
72 | }).then((data) => {
73 | console.log(data);
74 | this.resetForms();
75 | this.setState({loading:false, error:false, success: data.transaction_id});
76 | }).catch((e) => {
77 | let error = JSON.stringify(e);
78 | this.setState({loading:false, error:true});
79 | if(error.includes('Missing required accounts')) {
80 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
81 | }
82 | });
83 | }
84 |
85 | setProxy(e) {
86 | e.preventDefault();
87 | this.setState({loading:true, error:false, success:''});
88 | this.state.eos.transaction(tr => {
89 | tr.voteproducer({
90 | voter: this.state.setName,
91 | proxy: this.state.setProxy
92 | })
93 | }).then((data) => {
94 | console.log(data.transaction_id);
95 | this.resetForms();
96 | this.setState({loading:false, error:false, success: data.transaction_id});
97 | }).catch((e) => {
98 | let error = JSON.stringify(e);
99 | this.setState({loading:false, error:true});
100 | if(error.includes('Missing required accounts')) {
101 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
102 | }
103 | });
104 | }
105 |
106 | render() {
107 | const isError = this.state.error;
108 | const isLoading = this.state.loading;
109 | const isSuccess = this.state.success;
110 |
111 | const contract = (
112 |
113 | Action - {'{ voteproducer }'}
114 | Description
115 | The intent of the {'{ voteproducer }'} action is to cast a valid vote for up to 30 BP candidates.
116 |
117 | As an authorized party I {'{ signer }'} wish to vote on behalf of {'{ voter }'} in favor of the block producer candidates {'{ producers }'} with a voting weight equal to all tokens currently owned by {'{ voter }'} and staked for CPU or bandwidth.
118 |
119 | If I am not the beneficial owner of these shares I stipulate I have proof that I’ve been authorized to vote these shares by their beneficial owner(s).
120 |
121 | I stipulate I have not and will not accept anything of value in exchange for these votes, on penalty of confiscation of these tokens, and other penalties.
122 |
123 | I acknowledge that using any system of automatic voting, re-voting, or vote refreshing, or allowing such a system to be used on my behalf or on behalf of another, is forbidden and doing so violates this contract.
124 |
125 | );
126 |
127 | const RenderStatus = () => {
128 | if(isError) {
129 | return (
130 |
131 | Transaction failed. {this.state.reason}
132 |
133 | );
134 | }
135 |
136 | if(isLoading) {
137 | return( );
138 | }
139 |
140 | if(isSuccess !== '') {
141 | return (
142 |
143 | Transaction sent. TxId: {isSuccess}
144 |
145 | );
146 | }
147 | return('');
148 | }
149 |
150 | return (
151 |
152 |
Register as Proxy: You will vote on behalf of others.
153 |
167 |
Set a Proxy: They will vote on your behalf.
168 |
169 | Read Contract
170 |
171 |
196 |
197 |
198 |
199 |
200 | );
201 | }
202 | }
203 | module.hot.accept();
204 |
--------------------------------------------------------------------------------
/src/tools/tools.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Panel } from 'react-bootstrap';
3 | import AccountLookup from './account-lookup.jsx'
4 | import AccountCreate from './account-create.jsx'
5 | import ManageProxy from './manage-proxy.jsx'
6 | import BuySellRam from './buy-sell-ram.jsx'
7 | import VoteGenereos from './vote-genereos.jsx'
8 |
9 | export default class Tools extends React.Component {
10 | constructor(props, context) {
11 | super(props, context);
12 | }
13 |
14 | render() {
15 | return (
16 |
17 |
18 |
19 | Lookup Accounts
20 |
21 |
22 |
23 |
24 |
25 | Create Account
26 |
27 |
28 |
29 |
30 |
31 | Proxy Management
32 |
33 |
34 |
35 |
36 |
37 | Buy/Sell RAM - Thanks EOSNation for Contributing
38 |
39 |
40 |
41 |
42 |
43 | Vote
44 |
45 |
46 |
47 |
48 | );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/tools/vote-genereos.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table,OverlayTrigger,Popover } from 'react-bootstrap';
4 | import { EosClient, bindNameToState } from '../scatter-client.jsx';
5 |
6 | export default class VoteGenereos extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 |
10 | this.handleSetName = this.handleSetName.bind(this);
11 |
12 | this.state = {
13 | loading: false,
14 | error: false,
15 | success: '',
16 | setName: '',
17 | eos: null
18 | };
19 |
20 |
21 | document.addEventListener('scatterLoaded', scatterExtension => {
22 | console.log('Scatter connected')
23 | let client = EosClient();
24 | this.setState({ eos: client});
25 |
26 | setInterval(() => {
27 | bindNameToState(this.setState.bind(this), ['setName']);
28 | }, 1000)
29 | });
30 | }
31 |
32 | componentDidMount() {
33 | if(window.scatter !== undefined) {
34 | this.setState({ eos: EosClient()});
35 | bindNameToState(this.setState.bind(this), ['setName']);
36 | }
37 | }
38 |
39 | handleSetName(e) {
40 | this.setState({ setName: e.target.value });
41 | }
42 |
43 | vote(e) {
44 | e.preventDefault();
45 | this.setState({loading:true, error:false, success: ''});
46 | this.state.eos.transaction(tr => {
47 | tr.voteproducer({
48 | voter: this.state.setName,
49 | proxy: "",
50 | producers: ['aus1genereos'],
51 | })
52 | }).then((data) => {
53 | console.log(data.transaction_id);
54 | this.resetForms();
55 | this.setState({loading:false, error:false, success: data.transaction_id});
56 | }).catch((e) => {
57 | let error = JSON.stringify(e);
58 | this.setState({loading:false, error:true});
59 | if(error.includes('Missing required accounts')) {
60 | this.setState({reason:'Incorrect scatter account - please review chain id, network, and account name.'});
61 | }
62 | });
63 | }
64 |
65 |
66 |
67 | render() {
68 | const isError = this.state.error;
69 | const isLoading = this.state.loading;
70 | const isSuccess = this.state.success;
71 |
72 | const contract = (
73 |
74 | Action - {'{ voteproducer }'}
75 | Description
76 | The intent of the {'{ voteproducer }'} action is to cast a valid vote for up to 30 BP candidates.
77 |
78 | As an authorized party I {'{ signer }'} wish to vote on behalf of {'{ voter }'} in favor of the block producer candidates {'{ producers }'} with a voting weight equal to all tokens currently owned by {'{ voter }'} and staked for CPU or bandwidth.
79 |
80 | If I am not the beneficial owner of these shares I stipulate I have proof that I’ve been authorized to vote these shares by their beneficial owner(s).
81 |
82 | I stipulate I have not and will not accept anything of value in exchange for these votes, on penalty of confiscation of these tokens, and other penalties.
83 |
84 | I acknowledge that using any system of automatic voting, re-voting, or vote refreshing, or allowing such a system to be used on my behalf or on behalf of another, is forbidden and doing so violates this contract.
85 |
86 | );
87 |
88 | const RenderStatus = () => {
89 | if(isError) {
90 | return (
91 |
92 | Transaction failed. {this.state.reason}
93 |
94 | );
95 | }
96 |
97 | if(isLoading) {
98 | return( );
99 | }
100 |
101 | if(isSuccess !== '') {
102 | return (
103 |
104 | Transaction sent. TxId: {isSuccess}
105 |
106 | );
107 | }
108 | return('');
109 | }
110 |
111 | return (
112 |
113 |
A vote for GenerEOS is a vote for Charity
114 |
115 | Read Contract
116 |
117 |
If you wish to vote for a full set of 30 block producers we encourage you to use EOS Portal .
118 | However, if you would like to support us directly please use this form.
119 | You can read about our charitiable goals on our steemit article .
120 |
134 |
135 |
136 |
137 |
138 | );
139 | }
140 | }
141 | module.hot.accept();
142 |
--------------------------------------------------------------------------------
/src/unlock.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import update from 'react-addons-update';
3 | import { Grid, Row, Col, Panel, Form, FormGroup, FormControl, ControlLabel, HelpBlock,ListGroup,ListGroupItem, Button, ProgressBar, Alert, Table,Label } from 'react-bootstrap';
4 | import EosClient from './eos-client.jsx';
5 |
6 | export default class Unlock extends React.Component {
7 | constructor(props, context) {
8 | super(props, context);
9 | this.eosClient = EosClient();
10 |
11 | this.state = {
12 | total_vote: 0,
13 | }
14 | }
15 |
16 | componentDidMount() {
17 | this.interval = setInterval(() => {
18 | var stake = {
19 | json: true,
20 | scope: "eosio",
21 | code: "eosio",
22 | table: "global",
23 | limit: 500
24 | }
25 |
26 | this.eosClient.getTableRows(stake).then((table)=>{
27 | this.setState({total_vote: table.rows[0].total_activated_stake})
28 | });
29 | }, 1000);
30 | }
31 |
32 | componentWillUnmount() {
33 | clearInterval(this.interval);
34 | }
35 |
36 | render() {
37 | return (
38 | Check out the new eostoolkit.io. Better interface, Transfers, and Permission changing
39 | );
40 | }
41 | }
42 | module.hot.accept();
43 |
--------------------------------------------------------------------------------
/src/votes/vote-table.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { render } from "react-dom";
3 | import update from 'react-addons-update';
4 | import EosClient from '../eos-client.jsx';
5 | import { Button } from 'react-bootstrap';
6 |
7 | // Import React Table
8 | import ReactTable from "react-table";
9 | import "react-table/react-table.css";
10 |
11 | export default class BidTable extends React.Component {
12 | constructor() {
13 | super();
14 | this.state = {
15 | data: [],
16 | loading:false
17 | };
18 |
19 |
20 | this.eosClient = EosClient();
21 | }
22 |
23 | componentDidMount() {
24 | this.getBids();
25 | }
26 |
27 | getBids() {
28 |
29 | this.setState({loading:true});
30 | var bids = {
31 | json: true,
32 | scope: "eosio",
33 | code: "eosio",
34 | table: "voters",
35 | table_key: "owner",
36 | limit: 1000,
37 | lower_bound: "g42dknjzgmge"
38 | }
39 |
40 | this.eosClient.getTableRows(bids).then((table)=>{
41 | console.log(table.more);
42 | console.log(table.rows.length);
43 | console.log(table.rows[0]);
44 | console.log(table.rows[table.rows.length-1]);
45 | this.setState({data: table.rows,loading:false});
46 | });
47 | }
48 |
49 | formatDate(date) {
50 | let newDate = new Date(date/1000);
51 | return newDate.toUTCString();
52 | }
53 |
54 | formatProds(prod) {
55 | //console.log(prod);
56 | return prod.join(',');
57 | }
58 |
59 | render() {
60 | const { data, loading } = this.state;
61 | return (
62 |
63 | Refresh
64 | (
75 | {(row.value/10000)} EOS
76 | )
77 | },
78 | {
79 | Header: "Vote Weight",
80 | id: "last_vote_weight",
81 | accessor: "last_vote_weight",
82 | Cell: row => (
83 | {(row.value/10000)}
84 | )
85 | },
86 | {
87 | Header: "Producers",
88 | accessor: "producers",
89 | Cell: row => (
90 | {this.formatProds(row.value)}
91 | )
92 | },
93 | ]}
94 | defaultPageSize={20}
95 | data={data}
96 | className="-striped -highlight"
97 | loading={loading} // Display the loading overlay when we need it
98 | filterable
99 | defaultSorted={[
100 | {
101 | id: "last_vote_weight",
102 | desc: true
103 | }
104 | ]}
105 | />
106 |
107 |
108 | );
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/src/votes/votes.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Panel } from 'react-bootstrap';
3 | import VoteTable from './vote-table.jsx'
4 |
5 | export default class Votes extends React.Component {
6 | constructor(props, context) {
7 | super(props, context);
8 | }
9 |
10 | render() {
11 | return (
12 |
13 |
14 |
15 | );
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack');
2 | var HtmlWebpackPlugin = require('html-webpack-plugin');
3 | var CleanWebpackPlugin = require('clean-webpack-plugin');
4 |
5 | module.exports = {
6 | entry: ['react-hot-loader/patch', './src/index.jsx'],
7 | module: {
8 | rules: [
9 | { test: /\.(js|jsx)$/, exclude: /node_modules/, use: ['babel-loader'] },
10 | { test:/\.css$/, use:['style-loader','css-loader']}
11 | ],
12 | },
13 | resolve: { extensions: ['*', '.js', '.jsx'] },
14 | output: { path: __dirname + '/dist', publicPath: '/', filename: '[name].[hash].js' },
15 | plugins: [
16 | new webpack.HotModuleReplacementPlugin(),
17 | new CleanWebpackPlugin(['dist']),
18 | new HtmlWebpackPlugin({hash: true, template: 'src/index.html'})
19 | ],
20 | devServer: { contentBase: './dist', hot: true }
21 | };
22 |
--------------------------------------------------------------------------------