diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index 6365370..caa85de 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ Decentralized mutual credit system based on Ethereum smart contracts. **For the moment this is an implementation of a Proof of Concept.** -![reciprokaWallet](https://raw.githubusercontent.com/arnaucode/reciproka/master/r1.png "reciprokaWallet") -![reciprokaWallet](https://raw.githubusercontent.com/arnaucode/reciproka/master/r2.png "reciprokaWallet") +![reciprokaWallet](https://raw.githubusercontent.com/arnaucode/reciproka/master/doc/r1.png "reciprokaWallet") +![reciprokaWallet](https://raw.githubusercontent.com/arnaucode/reciproka/master/doc/r2.png "reciprokaWallet") ## Components - Smart contracts @@ -16,7 +16,7 @@ Decentralized mutual credit system based on Ethereum smart contracts. ## Documentation -Each user connects to `reciproka` throught the frontend wallet app. Once the app is opened, it creates a new ethereum private key (if the user already have one, loads it). +Each user connects to `reciproka` throught the frontend wallet app. The app can be loaded from `IPFS`. Once the app is opened, it creates a new ethereum private key (if the user already have one, loads it). ### Transaction action: @@ -30,6 +30,8 @@ Each user connects to `reciproka` throught the frontend wallet app. Once the app - u2: 10 +![reciproka-diagram01](https://raw.githubusercontent.com/arnaucode/reciproka/master/doc/reciproka-diagram01.png "reciproka-diagram01") + ### Account Account data structure: ```solidity diff --git a/doc/r1.png b/doc/r1.png new file mode 100644 index 0000000..ea9e0bd Binary files /dev/null and b/doc/r1.png differ diff --git a/doc/r2.png b/doc/r2.png new file mode 100644 index 0000000..fe5c4f1 Binary files /dev/null and b/doc/r2.png differ diff --git a/doc/reciproka-diagram01.png b/doc/reciproka-diagram01.png new file mode 100644 index 0000000..9a33dec Binary files /dev/null and b/doc/reciproka-diagram01.png differ diff --git a/doc/reciproka-diagram01.xml b/doc/reciproka-diagram01.xml new file mode 100644 index 0000000..36a998d --- /dev/null +++ b/doc/reciproka-diagram01.xml @@ -0,0 +1 @@ +7Vldj9o4FP01SLsPgxybAPMIdGgfui3SPOxj5Uk8iXecOHKcAfrre02cBGxgUDd01WFHYrCvr6/jc+5XxIAsss1HRYv0LxkzMcAo3gzIhwHGwQiP4ctItrVkEoa1IFE8tkqd4JF/Z1aIrLTiMSsPFLWUQvPiUBjJPGeRPpBRpeT6UO1ZisNTC5owT/AYUeFL/+axTmvpNESd/BPjSdqcHCC78kSjl0TJKrfnDTB53v3VyxltbFn9MqWxXO+JyMOALJSUuh5lmwUTBtsGtnrf8sRq+9yK5fqiDc1z6G1zdxYDFHaayxy+5rsLMbMFwSzVmYBhAMNSU6VnBvBOeSdbciGs+j9M662lmFZagkgqncpE5lR8lrKwtuoHMaefvIsVlbJSkdXC1juoSpjVClscwT+ZzJhWW1BRTFDNXw+tU+soSavXgQUDi9dx7OzRr1RU1uhMcHguF1DguDDDKhOzSEsFd31lSnNwt8/0iYmVLLnmMgeVJ6m1zEBBmIV560wLKcy+D507dTbg0MTs1QbJfXJkpQXP2aKNEdSibPayzXmcfQTthsZ3bWxP7XTdBQqxonQvRsbo3yNOPMTn8und4z0K/zPAA/ybp4fQTw/kF6WH0HPWr+scBA86ZYpVGQy/ML2W6mVgyiUJDBp/rCD3Q7FAu3+zCoBQXG//3FM56e8821W1Kzo7LYvas5/5xvA93x05a6SokcA41drU6pmBCy+rQkgaD9f8hWcs5nQoVQJiMy/MHMaRzDKZlzDSaZVBVC+J+QAMyxVe3eU1VMPy1WwMMELF5s5ZGBZ50k/IBePwIOSwH3LBZOTHXDDtIegmnuPcDOXIfAD6ZRMk3wQkgm8YBSPLPA7HQPzx5f74x2Q8fNMDSOA7QNhH0j1S5qiguclpAC7yWza4qHYzr5IvrKHZpt5nyLqOiFqyIwCGqSNekPE4NsfM1ynX7LGgu8y6hrbfS/wnfMye1EchRA4locfJ5EghxH1wMvqfk6OckHs3TvxAuRopfon125U8dhqQPUYu7Sn82+/dLjxyu0Z2cVNhT1hJDgefcviw6SkaC3WnYzftv+WdtxNMHDt1e+TZ2eHfXvoySsbvnRKnMwgJ+klOHENty3EFUvyOogQSQGJe/1GkoB7r8hxPkaBlyaPfiyrntQmHPxs9Y8fQ9HpMTc+XmTvL2W3WGieNEezX/+m1Ss39eWJulxRy/zYrTb3pm5XGhp/Y8DvOa6Nwcoi4m48uTWxOghy57UV/ea255Lm8Nr3VCHLSWtsY/IIOuunOTvFys5y4rzVHSeknq8G0+72njq3uRzXy8AM= \ No newline at end of file diff --git a/r1.png b/r1.png deleted file mode 100644 index 03e2d9f..0000000 Binary files a/r1.png and /dev/null differ diff --git a/r2.png b/r2.png deleted file mode 100644 index a179b1c..0000000 Binary files a/r2.png and /dev/null differ diff --git a/wallet/package-lock.json b/wallet/package-lock.json index 9719e04..a691953 100644 --- a/wallet/package-lock.json +++ b/wallet/package-lock.json @@ -4,6 +4,14 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@sambego/storybook-state": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@sambego/storybook-state/-/storybook-state-1.0.7.tgz", + "integrity": "sha512-DxNt+qVttXhYIbZ7tOT+zIuCDg/ePfhYI2CNCYFyXO/gO183xNX5i+cs0UgAO7xLfqAo165zTY33rn45QoQNBw==", + "requires": { + "uuid": "3.3.2" + } + }, "abab": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", @@ -1891,6 +1899,11 @@ } } }, + "change-emitter": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/change-emitter/-/change-emitter-0.1.6.tgz", + "integrity": "sha1-6LL+PX8at9aaMhma/5HqaTFAlRU=" + }, "chardet": { "version": "0.4.2", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", @@ -2318,11 +2331,6 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" }, - "cookiejar": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", - "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" - }, "copy-descriptor": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", @@ -7751,6 +7759,17 @@ "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==" }, + "oce-components": { + "version": "git+https://github.com/opencooperativeecosystem/kit.git#9a2ec552c68974865a7d2554c369bf25ac8d4c86", + "requires": { + "@sambego/storybook-state": "1.0.7", + "moment": "2.22.1", + "rc-progress": "2.2.5", + "react-datepicker": "1.5.0", + "react-timeout": "1.1.1", + "recompose": "0.27.1" + } + }, "omit.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/omit.js/-/omit.js-1.0.0.tgz", @@ -8097,6 +8116,11 @@ "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==" }, + "popper.js": { + "version": "1.14.4", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.14.4.tgz", + "integrity": "sha1-juwdj/AqWjoVLdQ0FKFce3n9abY=" + }, "portfinder": { "version": "1.0.15", "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.15.tgz", @@ -10105,6 +10129,17 @@ "prop-types": "15.6.2" } }, + "react-datepicker": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-1.5.0.tgz", + "integrity": "sha512-Neh1rz0d1QeR7KuoTiYeR6oj73DJkqt0vuNSgfMuxXEwGmz/4sPynouYGo6gdKiQbxIXBJJ/FLDLHJEr5XNThw==", + "requires": { + "classnames": "2.2.6", + "prop-types": "15.6.2", + "react-onclickoutside": "6.7.1", + "react-popper": "0.9.5" + } + }, "react-dev-utils": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-5.0.1.tgz", @@ -10162,6 +10197,20 @@ "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" }, + "react-onclickoutside": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.7.1.tgz", + "integrity": "sha512-p84kBqGaMoa7VYT0vZ/aOYRfJB+gw34yjpda1Z5KeLflg70HipZOT+MXQenEhdkPAABuE2Astq4zEPdMqUQxcg==" + }, + "react-popper": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/react-popper/-/react-popper-0.9.5.tgz", + "integrity": "sha1-AqJO8+7DOvnlToNYq3DrDjMe3QU=", + "requires": { + "popper.js": "1.14.4", + "prop-types": "15.6.2" + } + }, "react-router": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/react-router/-/react-router-4.3.1.tgz", @@ -10262,6 +10311,16 @@ "resize-observer-polyfill": "1.5.0" } }, + "react-timeout": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/react-timeout/-/react-timeout-1.1.1.tgz", + "integrity": "sha512-zEJYHb3WvVq0/RdAOw5KHaOjTrN5Sm4fssJMPhqcu3efunecgQLfLfrKG5tfRM4IdjNJ3FCPI5hEKv62IHyZTw==", + "requires": { + "create-react-class": "15.6.3", + "hoist-non-react-statics": "2.5.5", + "object-assign": "4.1.1" + } + }, "read-pkg": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", @@ -10325,6 +10384,19 @@ "set-immediate-shim": "1.0.1" } }, + "recompose": { + "version": "0.27.1", + "resolved": "https://registry.npmjs.org/recompose/-/recompose-0.27.1.tgz", + "integrity": "sha512-p7xsyi/rfNjHfdP7vPU02uSFa+Q1eHhjKrvO+3+kRP4Ortj+MxEmpmd+UQtBGM2D2iNAjzNI5rCyBKp9Ob5McA==", + "requires": { + "babel-runtime": "6.26.0", + "change-emitter": "0.1.6", + "fbjs": "0.8.17", + "hoist-non-react-statics": "2.5.5", + "react-lifecycles-compat": "3.0.4", + "symbol-observable": "1.2.0" + } + }, "recursive-readdir": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.1.tgz", @@ -11597,6 +11669,11 @@ } } }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + }, "symbol-tree": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", @@ -12358,29 +12435,29 @@ } }, "web3": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.35.tgz", - "integrity": "sha512-xwDmUhvTcHQvvNnOPcPZZgCxKUsI2e+GbHy7JkTK3/Rmnutazy8x7fsAXT9myw7V1qpi3GgLoZ3fkglSUbg1Mg==", + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.33.tgz", + "integrity": "sha1-xgIbV2mSdyY3HBhLhoRFMRsTkpU=", "requires": { - "web3-bzz": "1.0.0-beta.35", - "web3-core": "1.0.0-beta.35", - "web3-eth": "1.0.0-beta.35", - "web3-eth-personal": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", - "web3-shh": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-bzz": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.0.0-beta.35.tgz", - "integrity": "sha512-BhAU0qhlr8zltm4gs/+P1gki2VkxHJaM2Rrh4DGesDW0lzwufRoNvWFlwx1bKHoFPWNbSmm9PRkHOYOINL/Tgw==", - "requires": { - "got": "7.1.0", - "swarm-js": "0.1.37", - "underscore": "1.8.3" + "web3-bzz": "1.0.0-beta.33", + "web3-core": "1.0.0-beta.33", + "web3-eth": "1.0.0-beta.33", + "web3-eth-personal": "1.0.0-beta.33", + "web3-net": "1.0.0-beta.33", + "web3-shh": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" }, "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + }, "got": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", @@ -12401,269 +12478,253 @@ "url-parse-lax": "1.0.0", "url-to-options": "1.0.1" } - } - } - }, - "web3-core": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.35.tgz", - "integrity": "sha512-ayGavbgVk4KL9Y88Uv411fBJ0SVgVfKhKEBweKYzmP0zOqneMzWt6YsyD1n6kRvjAbqA0AfUPEOKyMNjcx2tjw==", - "requires": { - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-requestmanager": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-core-helpers": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.35.tgz", - "integrity": "sha512-APOu3sEsamyqWt//8o4yq9KF25/uqGm+pQShson/sC4gKzmfJB07fLo2ond0X30E8fIqAPeVCotPXQxGciGUmA==", - "requires": { - "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-core-method": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.35.tgz", - "integrity": "sha512-jidImCide8q0GpfsO4L73qoHrbkeWgwU3uOH5DKtJtv0ccmG086knNMRgryb/o9ZgetDWLmDEsJnHjBSoIwcbA==", - "requires": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-promievent": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-core-promievent": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.35.tgz", - "integrity": "sha512-GvqXqKq07OmHuVi5uNRg6k79a1/CI0ViCC+EtNv4CORHtDRmYEt5Bvdv6z6FJEiaaQkD0lKbFwNhLxutx7HItw==", - "requires": { - "any-promise": "1.3.0", - "eventemitter3": "1.1.1" - }, - "dependencies": { - "eventemitter3": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", - "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" - } - } - }, - "web3-core-requestmanager": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.35.tgz", - "integrity": "sha512-S+zW2h17ZZQU9oe3yaCJE0E7aJS4C3Kf4kGPDv+nXjW0gKhQQhgVhw1Doq/aYQGqNSWJp7f1VHkz5gQWwg6RRg==", - "requires": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-providers-http": "1.0.0-beta.35", - "web3-providers-ipc": "1.0.0-beta.35", - "web3-providers-ws": "1.0.0-beta.35" - } - }, - "web3-core-subscriptions": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.35.tgz", - "integrity": "sha512-gXzLrWvcGkGiWq1y33Z4Y80XI8XMrwowiQJkrPSjQ81K5PBKquOGwcMffLaKcwdmEy/NpsOXDeFo3eLE1Ghvvw==", - "requires": { - "eventemitter3": "1.1.1", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35" - }, - "dependencies": { - "eventemitter3": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", - "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" - } - } - }, - "web3-eth": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.0.0-beta.35.tgz", - "integrity": "sha512-04mcb2nGPXThawuuYICPOxv0xOHofvQKsjZeIq+89nyOC8DQMGTAErDkGyMHQYtjpth5XDhic0wuEsA80AmFZA==", - "requires": { - "underscore": "1.8.3", - "web3-core": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", - "web3-eth-accounts": "1.0.0-beta.35", - "web3-eth-contract": "1.0.0-beta.35", - "web3-eth-iban": "1.0.0-beta.35", - "web3-eth-personal": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-eth-abi": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.35.tgz", - "integrity": "sha512-KUDC+EtFFYG8z01ZleKrASdjj327/rtWHzEt6RWsEj7bBa0bGp9nEh+nqdZx/Sdgz1O8tnfFzJlrRcXpfr1vGg==", - "requires": { - "bn.js": "4.11.6", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - } - } - }, - "web3-eth-accounts": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.35.tgz", - "integrity": "sha512-duIgRsfht/0kAW/eQ0X9lKtVIykbETrnM2H7EnvplCzPHtQLodpib4o9JXfh9n6ZDgdDC7cuJoiVB9QJg089ew==", - "requires": { - "any-promise": "1.3.0", - "crypto-browserify": "3.12.0", - "eth-lib": "0.2.7", - "scrypt.js": "0.2.0", - "underscore": "1.8.3", - "uuid": "2.0.1", - "web3-core": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - }, - "dependencies": { - "eth-lib": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", - "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", - "requires": { - "bn.js": "4.11.8", - "elliptic": "6.4.0", - "xhr-request-promise": "0.1.2" - } }, "uuid": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" - } - } - }, - "web3-eth-contract": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.35.tgz", - "integrity": "sha512-foPohOg5O1UCGKGZOIs+kQK5IZdV2QQ7pAWwNxH8WHplUA+fre1MurXNpoxknUmH6mYplFhXjqgYq2MsrBpHrA==", - "requires": { - "underscore": "1.8.3", - "web3-core": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-promievent": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", - "web3-eth-abi": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-eth-iban": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.35.tgz", - "integrity": "sha512-H5wkcNcAIc+h/WoDIKv7ZYmrM2Xqu3O7jBQl1IWo73EDVQji+AoB2i3J8tuwI1yZRInRwrfpI3Zuwuf54hXHmQ==", - "requires": { - "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.35" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" - } - } - }, - "web3-eth-personal": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.35.tgz", - "integrity": "sha512-AcM9nnlxu7ZRRxPvkrFB9eLxMM4A2cPfj2aCg21Wb2EpMnhR+b/O1cT33k7ApRowoMpM+T9M8vx2oPNwXfaCOQ==", - "requires": { - "web3-core": "1.0.0-beta.35", - "web3-core-helpers": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-net": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.35.tgz", - "integrity": "sha512-bbwaQ/KohGjIJ6HAKbZ6KrklCAaG6/B7hIbAbVLSFLxF+Yz9lmAgQYaDInpidpC/NLb3WOmcbRF+P77J4qMVIA==", - "requires": { - "web3-core": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-utils": "1.0.0-beta.35" - } - }, - "web3-providers-http": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.35.tgz", - "integrity": "sha512-DcIMFq52Fb08UpWyZ3ZlES6NsNqJnco4hBS/Ej6eOcASfuUayPI+GLkYVZsnF3cBYqlH+DOKuArcKSuIxK7jIA==", - "requires": { - "web3-core-helpers": "1.0.0-beta.35", - "xhr2-cookies": "1.1.0" - } - }, - "web3-providers-ipc": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.35.tgz", - "integrity": "sha512-iB0FG0HcpUnayfa8pn4guqEQ4Y1nrroi/jffdtQgFkrNt0sD3fMSwwC0AbmECqj3tDLl0e1slBR0RENll+ZF0g==", - "requires": { - "oboe": "2.1.3", - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35" - } - }, - "web3-providers-ws": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.35.tgz", - "integrity": "sha512-Cx64NgDStynKaUGDIIOfaCd0fZusL8h5avKTkdTjUu2aHhFJhZoVBGVLhoDtUaqZGWIZGcBJOoVf2JkGUOjDRQ==", - "requires": { - "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.35", - "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" - } - }, - "web3-shh": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.0.0-beta.35.tgz", - "integrity": "sha512-8qSonk/x0xabERS9Sr6AIADN/Ty+5KwARkkGIfSYHKqFpdMDz+76F7cUCxtoCZoS8K04xgZlDKYe0TJXLYA0Fw==", - "requires": { - "web3-core": "1.0.0-beta.35", - "web3-core-method": "1.0.0-beta.35", - "web3-core-subscriptions": "1.0.0-beta.35", - "web3-net": "1.0.0-beta.35" - } - }, - "web3-utils": { - "version": "1.0.0-beta.35", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.35.tgz", - "integrity": "sha512-Dq6f0SOKj3BDFRgOPnE6ALbzBDCKVIW8mKWVf7tGVhTDHf+wQaWwQSC3aArFSqdExB75BPBPyDpuMTNszhljpA==", - "requires": { - "bn.js": "4.11.6", - "eth-lib": "0.1.27", - "ethjs-unit": "0.1.6", - "number-to-bn": "1.7.0", - "randomhex": "0.1.5", - "underscore": "1.8.3", - "utf8": "2.1.1" - }, - "dependencies": { - "bn.js": { - "version": "4.11.6", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", - "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "web3-bzz": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.0.0-beta.33.tgz", + "integrity": "sha1-MVAPaZt+cO31FJDFXv+0J7+7OwE=", + "requires": { + "got": "7.1.0", + "swarm-js": "0.1.37", + "underscore": "1.8.3" + } + }, + "web3-core": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.33.tgz", + "integrity": "sha1-+C7VJfW2auzale7O08rSvWlfeDk=", + "requires": { + "web3-core-helpers": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-core-requestmanager": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-core-helpers": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.33.tgz", + "integrity": "sha1-Kvcz5QTbBefDZIwdrPV3sOwV3EM=", + "requires": { + "underscore": "1.8.3", + "web3-eth-iban": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-core-method": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.33.tgz", + "integrity": "sha1-7Y7ExK+rIdwJid41g2hEZlIrboY=", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.33", + "web3-core-promievent": "1.0.0-beta.33", + "web3-core-subscriptions": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-core-promievent": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.33.tgz", + "integrity": "sha1-0fXrtgFSfdSWViw2IXblWNly01g=", + "requires": { + "any-promise": "1.3.0", + "eventemitter3": "1.1.1" + } + }, + "web3-core-requestmanager": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.33.tgz", + "integrity": "sha1-ejbEA1QALfsXnKLb22pgEsn3Ges=", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.33", + "web3-providers-http": "1.0.0-beta.33", + "web3-providers-ipc": "1.0.0-beta.33", + "web3-providers-ws": "1.0.0-beta.33" + } + }, + "web3-core-subscriptions": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.33.tgz", + "integrity": "sha1-YCh1yfTV9NDhYhRitfwewZs1veM=", + "requires": { + "eventemitter3": "1.1.1", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.33" + } + }, + "web3-eth": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.0.0-beta.33.tgz", + "integrity": "sha1-hKn5TallUnyS2DitTlcN8CWJhJ8=", + "requires": { + "underscore": "1.8.3", + "web3-core": "1.0.0-beta.33", + "web3-core-helpers": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-core-subscriptions": "1.0.0-beta.33", + "web3-eth-abi": "1.0.0-beta.33", + "web3-eth-accounts": "1.0.0-beta.33", + "web3-eth-contract": "1.0.0-beta.33", + "web3-eth-iban": "1.0.0-beta.33", + "web3-eth-personal": "1.0.0-beta.33", + "web3-net": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-eth-abi": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.33.tgz", + "integrity": "sha1-IiH3FRZDZgAypN80D2EjSRaMgko=", + "requires": { + "bn.js": "4.11.6", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-eth-accounts": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.33.tgz", + "integrity": "sha1-JajX9OWOHpk7kvBpVILMzckhL5E=", + "requires": { + "any-promise": "1.3.0", + "crypto-browserify": "3.12.0", + "eth-lib": "0.2.7", + "scrypt.js": "0.2.0", + "underscore": "1.8.3", + "uuid": "2.0.1", + "web3-core": "1.0.0-beta.33", + "web3-core-helpers": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + }, + "dependencies": { + "eth-lib": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", + "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", + "requires": { + "bn.js": "4.11.6", + "elliptic": "6.4.0", + "xhr-request-promise": "0.1.2" + } + } + } + }, + "web3-eth-contract": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.33.tgz", + "integrity": "sha1-nlkZ8pF6PGe0+2Vp1JxeMDiSW84=", + "requires": { + "underscore": "1.8.3", + "web3-core": "1.0.0-beta.33", + "web3-core-helpers": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-core-promievent": "1.0.0-beta.33", + "web3-core-subscriptions": "1.0.0-beta.33", + "web3-eth-abi": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-eth-iban": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.33.tgz", + "integrity": "sha1-HXPQxSiKRWWxdUp1tfs+oLd6Uy8=", + "requires": { + "bn.js": "4.11.6", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-eth-personal": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.33.tgz", + "integrity": "sha1-tOSFh8xOfrAY2ib947Tzul+bmO8=", + "requires": { + "web3-core": "1.0.0-beta.33", + "web3-core-helpers": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-net": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-net": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.33.tgz", + "integrity": "sha1-tskNGg4WJuquiz2SKsFTZy/VZEU=", + "requires": { + "web3-core": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-utils": "1.0.0-beta.33" + } + }, + "web3-providers-http": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.33.tgz", + "integrity": "sha1-OzWuAO599blrSTSWKtSobypVmcE=", + "requires": { + "web3-core-helpers": "1.0.0-beta.33", + "xhr2": "0.1.4" + } + }, + "web3-providers-ipc": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.33.tgz", + "integrity": "sha1-Twrcmv6dEsBm5L5cPFNvUHPLB8Y=", + "requires": { + "oboe": "2.1.3", + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.33" + } + }, + "web3-providers-ws": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.33.tgz", + "integrity": "sha1-j93qQuGbvyUh7IeVRkV6Yjqdye8=", + "requires": { + "underscore": "1.8.3", + "web3-core-helpers": "1.0.0-beta.33", + "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" + } + }, + "web3-shh": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.0.0-beta.33.tgz", + "integrity": "sha1-+Z4mVz9uCZMhrw2fK/z+Pe01UKE=", + "requires": { + "web3-core": "1.0.0-beta.33", + "web3-core-method": "1.0.0-beta.33", + "web3-core-subscriptions": "1.0.0-beta.33", + "web3-net": "1.0.0-beta.33" + } + }, + "web3-utils": { + "version": "1.0.0-beta.33", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.33.tgz", + "integrity": "sha1-4JG3mU8JtxSwGYpAV9OtLrjL4jg=", + "requires": { + "bn.js": "4.11.6", + "eth-lib": "0.1.27", + "ethjs-unit": "0.1.6", + "number-to-bn": "1.7.0", + "randomhex": "0.1.5", + "underscore": "1.8.3", + "utf8": "2.1.1" + } + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "requires": { + "debug": "2.6.9", + "nan": "2.10.0", + "typedarray-to-buffer": "3.1.5", + "yaeti": "0.0.6" + } } } }, @@ -13070,15 +13131,6 @@ "source-map": "0.6.1" } }, - "websocket": { - "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", - "requires": { - "debug": "2.6.9", - "nan": "2.10.0", - "typedarray-to-buffer": "3.1.5", - "yaeti": "0.0.6" - } - }, "websocket-driver": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.0.tgz", @@ -13285,13 +13337,10 @@ "xhr-request": "1.1.0" } }, - "xhr2-cookies": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", - "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", - "requires": { - "cookiejar": "2.1.2" - } + "xhr2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.1.4.tgz", + "integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8=" }, "xml-name-validator": { "version": "2.0.1", diff --git a/wallet/package.json b/wallet/package.json index 0053b45..904ad68 100644 --- a/wallet/package.json +++ b/wallet/package.json @@ -12,7 +12,7 @@ "react-router": "^4.2.0", "react-router-dom": "^4.2.2", "react-scripts": "1.1.4", - "web3": "^1.0.0-beta.35" + "web3": "1.0.0-beta.33" }, "scripts": { "start": "react-scripts start", diff --git a/wallet/src/App.js b/wallet/src/App.js index 6b97b74..6b0dae4 100644 --- a/wallet/src/App.js +++ b/wallet/src/App.js @@ -5,14 +5,23 @@ import './App.css'; import { Row, Col } from 'antd'; +import mem from './mem/mem'; import DashboardView from './views/dashboard/dashboard'; import NewTxView from './views/newtx/newtx'; +import NotYet from './views/notyet/notyet'; import SidemenuView from './views/sidemenu/sidemenu'; -import './eth/eth.js'; +import './eth/eth'; + class App extends Component { + constructor(props) { + super(props); + this.state = { + account: mem.account + } + } render() { return ( @@ -21,10 +30,13 @@ class App extends Component { {/* */} @@ -35,8 +47,9 @@ class App extends Component {
- + + diff --git a/wallet/src/eth/accountsContractABI.js b/wallet/src/eth/accountsContractABI.js new file mode 100644 index 0000000..3dd418f --- /dev/null +++ b/wallet/src/eth/accountsContractABI.js @@ -0,0 +1,62 @@ +var accountsContractABI = [ + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "sender", + "type": "address" + }, + { + "indexed": false, + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "int64" + } + ], + "name": "BalanceUpdated", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "name": "_receiver", + "type": "address" + }, + { + "name": "_value", + "type": "int64" + } + ], + "name": "updateBalance", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_address", + "type": "address" + } + ], + "name": "getBalance", + "outputs": [ + { + "name": "", + "type": "int64" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +]; +export default accountsContractABI; diff --git a/wallet/src/eth/eth.js b/wallet/src/eth/eth.js index 4dec363..846fa16 100644 --- a/wallet/src/eth/eth.js +++ b/wallet/src/eth/eth.js @@ -1,15 +1,52 @@ +import mem from '../mem/mem'; +import accountsContractABI from './accountsContractABI'; +import { message } from 'antd'; + import Web3 from 'web3'; -const web3 = new Web3("https://ropsten.infura.io/TFnR8BWJlqZOKxHHZNcs"); +mem.web3 = new Web3("https://ropsten.infura.io/TFnR8BWJlqZOKxHHZNcs"); +console.log(mem.web3.version) -var account = web3.eth.accounts.create() -console.log("account", account) -console.log("address", account.address) -web3.eth.getAccounts(function(error, result){ +// localStorage.removeItem("privK"); +console.log(localStorage.getItem("privK")); +if (localStorage.getItem("privK")!==null) { + var privK = JSON.parse(localStorage.getItem("privK")); + console.log("privK found in localStorage", privK); + mem.account = mem.web3.eth.accounts.privateKeyToAccount(privK); + message.success('PrivateKey found in the local storage. Account imported.'); +} else { + console.log("privK not found in localStorage"); + mem.account = mem.web3.eth.accounts.create() + localStorage.setItem("privK", JSON.stringify(mem.account.privateKey)); + var privK = JSON.parse(localStorage.getItem("privK")); + console.log("saved privK", privK); + message.info('PrivateKey not found in the local storage. Account created and saved.'); +} +console.log("account", mem.account) +console.log("address", mem.account.address) +mem.web3.eth.getAccounts(function(error, result){ console.log(result) }) -web3.eth.getBalance(account.address) - .then(balance => { +mem.web3.eth.getBalance(mem.account.address) + .then(ethBalance => { - console.log("balance", balance) + console.log("eth balance", ethBalance) + mem.ethBalance = ethBalance; + console.log("eth balance", mem.ethBalance) }) + + +mem.accountsContract = new mem.web3.eth.Contract(accountsContractABI, mem.accountsContractAddr); +console.log("accountsContract: ", mem.accountsContract) +function getBalance(addr) { + return mem.accountsContract.methods.getBalance(addr).call(); +} +function sendCredits(receiver, value) { + mem.accountsContract.methods.updateBalance(receiver, value).call(); + return; +} +getBalance(mem.account.address).then(function(cr_balance){ + console.log("credit balance", cr_balance); + mem.balance=cr_balance; + +}) diff --git a/wallet/src/mem/mem.js b/wallet/src/mem/mem.js new file mode 100644 index 0000000..6e987b4 --- /dev/null +++ b/wallet/src/mem/mem.js @@ -0,0 +1,11 @@ +// Mem, Memory +let Mem = { + account: {}, + accountsContractAddr: "0xf0febc77136cf5d6e8f5c091c20bccffed71227a", + accountsContract: {}, + privK: "", + ethBalance: "", + balance: "", + web3: {} +}; +export default Mem; diff --git a/wallet/src/views/dashboard/dashboard.js b/wallet/src/views/dashboard/dashboard.js index 93dd509..09bab67 100644 --- a/wallet/src/views/dashboard/dashboard.js +++ b/wallet/src/views/dashboard/dashboard.js @@ -1,5 +1,7 @@ import React, { Component } from 'react'; +import mem from '../../mem/mem'; + // import {card, tx} from '../../kit/lib' import { Card, Button, Timeline, Row, Col, List, Icon } from 'antd'; import 'antd/dist/antd.css'; @@ -46,6 +48,8 @@ class dashboard extends Component {
+

Current Credit balance: {mem.balance}

+

Current ETH balance: {mem.ethBalance}

+ + +

@@ -81,12 +88,12 @@ class dashboard extends Component { Sended 20 credits · 2018-08-06 - - Received 15 credits · 2018-08-05 - Sended 20 credits · 2018-08-05 + + Received 15 credits · 2018-08-05 + Received 15 credits · 2018-08-04 diff --git a/wallet/src/views/newtx/newtx.js b/wallet/src/views/newtx/newtx.js index a988124..0fbaa7c 100644 --- a/wallet/src/views/newtx/newtx.js +++ b/wallet/src/views/newtx/newtx.js @@ -1,8 +1,11 @@ import React, { Component } from 'react'; +import mem from '../../mem/mem'; + // import {card, tx} from '../../kit/lib' import { Card, Button, Timeline, Row, Col, List, Icon, - Form, Input, InputNumber, Checkbox } from 'antd'; + Form, Input, InputNumber, Checkbox, message, + Progress } from 'antd'; import 'antd/dist/antd.css'; const FormItem = Form.Item; @@ -13,29 +16,81 @@ class newtx extends Component { super(props); this.state = { receiver: '', - value: 0 + value: 0, + percent: 0 }; + this.handleReceiverInputChange = this.handleReceiverInputChange.bind(this); + this.handleValueInputChange = this.handleValueInputChange.bind(this); + this.sendTx = this.sendTx.bind(this); + console.log("addr", mem.account.address); + } + handleReceiverInputChange(event) { + this.setState({receiver: event.target.value}) + } + handleValueInputChange(value) { + this.setState({value: value}) + } + sendTx(event) { + var receiver = this.state.receiver + console.log("receiver: ", receiver) + var value = this.state.value + console.log("value: ", value) + console.log(mem.accountsContractAddr) + console.log(mem.accountsContract) + console.log("options", mem.accountsContract.options) + mem.accountsContract.options.from = mem.account.address + mem.accountsContract.options.gas = 4000000 + console.log("options", mem.accountsContract.options) + + this.setState({ percent: this.state.percent + 20}) + mem.accountsContract.methods.updateBalance(receiver, value) + .send( + function(error, result) { + if(!error) { + console.log("result: ", result) + this.setState({ percent: 100 }) + + } else { + console.log("error: ", error) + message.error("Error on sending credits"); + this.setState({ percent: 0 }) + } + } + ); + } + updateProgress(val) { + this.setState({ percent: val }) } render() { const { receiver, value } = this.state; return (
- + } - style={{ width: 200 }} + style={{ width: 400 }} + onChange={this.handleReceiverInputChange} />

+ style={{marginRight: 10}} + onChange={this.handleValueInputChange} /> - + +

+
diff --git a/wallet/src/views/notyet/notyet.js b/wallet/src/views/notyet/notyet.js new file mode 100644 index 0000000..f0bd55b --- /dev/null +++ b/wallet/src/views/notyet/notyet.js @@ -0,0 +1,32 @@ +import React, { Component } from 'react'; + +import mem from '../../mem/mem'; + +// import {card, tx} from '../../kit/lib' +import { Card, Button, Timeline, Row, Col, List, Icon, + Form, Input, InputNumber, Checkbox, message, + Progress } from 'antd'; +import 'antd/dist/antd.css'; +const FormItem = Form.Item; + + + +class notyet extends Component { + constructor(props) { + super(props); + this.state = { + }; + } + + render() { + return ( +
+ + Not yet, but meanwhile, here is a penguin 🐧 + +
+ ); + } +} + +export default notyet; diff --git a/wallet/src/views/sidemenu/sidemenu.js b/wallet/src/views/sidemenu/sidemenu.js index c786173..99ecc7c 100644 --- a/wallet/src/views/sidemenu/sidemenu.js +++ b/wallet/src/views/sidemenu/sidemenu.js @@ -34,8 +34,16 @@ class dashboard extends Component { New transaction - History - Stats + + + History + + + + + Stats + + ); }