├── src └── lib │ └── web3 │ ├── lib │ ├── version.json │ ├── utils │ │ ├── browser-bn.js │ │ ├── browser-xhr.js │ │ ├── sha3.js │ │ └── config.js │ └── web3 │ │ ├── qtsync.js │ │ ├── net.js │ │ ├── errors.js │ │ ├── db.js │ │ ├── shh.js │ │ ├── batch.js │ │ ├── allevents.js │ │ ├── jsonrpc.js │ │ ├── transfer.js │ │ ├── icap.js │ │ ├── namereg.js │ │ ├── httpprovider.js │ │ ├── watches.js │ │ ├── property.js │ │ └── method.js │ ├── .swp │ ├── .versions │ ├── .bowerrc │ ├── coverage │ └── lcov-report │ │ ├── sort-arrow-sprite.png │ │ ├── prettify.css │ │ ├── ethereum.js │ │ ├── index.html │ │ ├── lib │ │ │ ├── index.html │ │ │ ├── utils │ │ │ │ └── index.html │ │ │ ├── solidity │ │ │ │ └── index.html │ │ │ └── web3 │ │ │ │ └── qtsync.js.html │ │ └── index.js.html │ │ └── base.css │ ├── bower │ ├── bignumber.js │ │ ├── perf │ │ │ ├── lib │ │ │ │ ├── bigdecimal_GWT │ │ │ │ │ ├── BigDecTest.class │ │ │ │ │ ├── bugs.js │ │ │ │ │ └── BigDecTest.java │ │ │ │ └── bigdecimal_ICU4J │ │ │ │ │ └── LICENCE.txt │ │ │ └── README.md │ │ ├── bower.json │ │ ├── .bower.json │ │ └── LICENCE │ └── crypto-js │ │ ├── enc-hex.js │ │ ├── enc-utf8.js │ │ ├── enc-latin1.js │ │ ├── pad-pkcs7.js │ │ ├── format-openssl.js │ │ ├── hmac-md5.js │ │ ├── hmac-sha1.js │ │ ├── hmac-sha256.js │ │ ├── hmac-ripemd160.js │ │ ├── hmac-sha3.js │ │ ├── hmac-sha224.js │ │ ├── hmac-sha512.js │ │ ├── hmac-sha384.js │ │ ├── CONTRIBUTING.md │ │ ├── pad-nopadding.js │ │ ├── bower.json │ │ ├── package.json │ │ ├── .bower.json │ │ ├── mode-ecb.js │ │ ├── pad-iso97971.js │ │ ├── pad-zeropadding.js │ │ ├── pad-iso10126.js │ │ ├── pad-ansix923.js │ │ ├── mode-ofb.js │ │ ├── index.js │ │ ├── mode-ctr.js │ │ ├── format-hex.js │ │ ├── sha224.js │ │ ├── mode-cfb.js │ │ ├── lib-typedarrays.js │ │ ├── sha384.js │ │ ├── mode-ctr-gladman.js │ │ ├── enc-base64.js │ │ ├── rc4.js │ │ ├── evpkdf.js │ │ ├── hmac.js │ │ ├── sha1.js │ │ ├── enc-utf16.js │ │ ├── README.md │ │ └── pbkdf2.js │ ├── example │ ├── node-app.js │ ├── balance.html │ ├── contract.html │ ├── event_inc.html │ └── namereg.html │ ├── .jshintrc │ ├── index.js │ ├── package-init.js │ ├── LICENSE │ ├── package.js │ ├── bower.json │ ├── gulpfile.js │ └── README.md ├── .gitignore ├── index.js ├── public ├── assets │ └── img │ │ └── content.png └── index.html ├── content ├── assets │ ├── img │ │ └── content.png │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ ├── css │ │ ├── colors.less │ │ ├── content.css │ │ └── content.less │ └── js │ │ ├── content.coffee │ │ └── content.js ├── config ├── posts │ └── index.json └── index.html ├── run.sh ├── Dockerfile ├── Makefile ├── package.json └── contracts └── content.sol /src/lib/web3/lib/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.7.1" 3 | } 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .eth 3 | *.log 4 | .DS_Store 5 | content/posts 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require( 'coffee-script/register' ) 2 | require( './src/scribe.coffee' ) -------------------------------------------------------------------------------- /src/lib/web3/.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/src/lib/web3/.swp -------------------------------------------------------------------------------- /src/lib/web3/.versions: -------------------------------------------------------------------------------- 1 | ethereum:web3@0.5.0 2 | meteor@1.1.6 3 | underscore@1.0.3 4 | -------------------------------------------------------------------------------- /public/assets/img/content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/public/assets/img/content.png -------------------------------------------------------------------------------- /src/lib/web3/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower", 3 | "cwd": "./", 4 | "analytics": false 5 | } 6 | -------------------------------------------------------------------------------- /content/assets/img/content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/content/assets/img/content.png -------------------------------------------------------------------------------- /src/lib/web3/lib/utils/browser-bn.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = BigNumber; // jshint ignore:line 4 | 5 | -------------------------------------------------------------------------------- /content/assets/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/content/assets/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /content/assets/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/content/assets/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /content/assets/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/content/assets/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /content/assets/css/colors.less: -------------------------------------------------------------------------------- 1 | @text-color: black; 2 | @text-color-cta: blue; 3 | 4 | @bg-color: #C7C5ED; 5 | @bg-color-light: white; 6 | 7 | -------------------------------------------------------------------------------- /content/assets/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/content/assets/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /content/assets/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/content/assets/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/src/lib/web3/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8082 2 | ipfs daemon & 3 | IPFS_PID=$! 4 | echo "Running IPFS daemon PID: $IPFS_PID" 5 | sleep 5s 6 | node index.js 7 | -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/BigDecTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/d11e9/content/HEAD/src/lib/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/BigDecTest.class -------------------------------------------------------------------------------- /content/config: -------------------------------------------------------------------------------- 1 | { 2 | "app": "/content", 3 | "ipfs": { 4 | "id": "" 5 | }, 6 | "defaults": { 7 | "eth_port": 80, 8 | "eth_host": "eth.datagotchi.com", 9 | "shh_channel": "/content" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /content/posts/index.json: -------------------------------------------------------------------------------- 1 | ["QmPVWdxetdENQKJMKwgNLBBjfgEXJ4BwzBazidbtg5yvuH","QmSVABbof3GdqeWmYkpsyFYve13qSF6YvoHpoYiXMsHs9R","QmVvibXFZj8TCgx67t7EKVCVZvGV94K2vkgrZ75Z5McDgr","QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH","QmdipJ1f865NUZpnjbjUb8C4t6dkWtERLKJqNi8HozeKhw"] -------------------------------------------------------------------------------- /src/lib/web3/lib/utils/browser-xhr.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // go env doesn't have and need XMLHttpRequest 4 | if (typeof XMLHttpRequest === 'undefined') { 5 | exports.XMLHttpRequest = {}; 6 | } else { 7 | exports.XMLHttpRequest = XMLHttpRequest; // jshint ignore:line 8 | } 9 | 10 | -------------------------------------------------------------------------------- /src/lib/web3/example/node-app.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var web3 = require("../index.js"); 4 | 5 | web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); 6 | 7 | var coinbase = web3.eth.coinbase; 8 | console.log(coinbase); 9 | 10 | var balance = web3.eth.getBalance(coinbase); 11 | console.log(balance.toString(10)); 12 | 13 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM dockerfile/nodejs 2 | 3 | RUN sudo apt-get -y update 4 | RUN sudo apt-get -y install redis-tools 5 | 6 | RUN mkdir -p /var/app 7 | WORKDIR /var/app 8 | 9 | COPY ./package.json /var/app/ 10 | 11 | ENV VIRTUAL_HOST example.com 12 | ENV VIRTUAL_PORT 6002 13 | EXPOSE 6002 14 | EXPOSE 4001 15 | 16 | RUN npm install -g go-ipfs 17 | RUN ipfs init 18 | # RUN npm install 19 | 20 | COPY ./ /var/app/ 21 | 22 | CMD [ "npm", "run", "app" ] 23 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/enc-hex.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Hex; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/enc-utf8.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Utf8; 17 | 18 | })); -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | container_name = "content.datagotchi.com" 2 | 3 | all: build stop run 4 | 5 | stop: 6 | docker kill $(container_name); \ 7 | docker rm $(container_name); 8 | 9 | build: 10 | docker build -t $(container_name) . 11 | 12 | run: 13 | docker run -d --link redis:redis --link eth.datagotchi.com:eth -v $(shell pwd)/content:/var/data/content --name $(container_name) -t $(container_name); docker logs -f $(container_name); 14 | 15 | pwd: 16 | echo $(shell pwd) 17 | 18 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/enc-latin1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.enc.Latin1; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "browserify": true, 3 | "bitwise": true, 4 | "camelcase": true, 5 | "eqeqeq": true, 6 | "freeze": true, 7 | "funcscope": false, 8 | "maxcomplexity": 4, /* our target is 3! */ 9 | "maxdepth": 3, 10 | "maxerr": 50, 11 | /*"maxlen": 80*/ /*this should be our goal*/ 12 | /*"maxparams": 3,*/ 13 | "nonew": true, 14 | "unused": true, 15 | "undef": true, 16 | "predef": [ 17 | "console" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pad-pkcs7.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.pad.Pkcs7; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/format-openssl.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.format.OpenSSL; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-md5.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./md5"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./md5", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacMD5; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-sha1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha1", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA1; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-sha256.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA256; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-ripemd160.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./ripemd160"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./ripemd160", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacRIPEMD160; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/index.js: -------------------------------------------------------------------------------- 1 | var web3 = require('./lib/web3'); 2 | web3.providers.HttpProvider = require('./lib/web3/httpprovider'); 3 | web3.providers.QtSyncProvider = require('./lib/web3/qtsync'); 4 | web3.eth.contract = require('./lib/web3/contract'); 5 | web3.eth.namereg = require('./lib/web3/namereg'); 6 | web3.eth.sendIBANTransaction = require('./lib/web3/transfer'); 7 | 8 | // dont override global variable 9 | if (typeof window !== 'undefined' && typeof window.web3 === 'undefined') { 10 | window.web3 = web3; 11 | } 12 | 13 | module.exports = web3; 14 | 15 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-sha3.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha3"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha3", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJSHmacSHA3; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-sha224.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256"), require("./sha224"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256", "./sha224", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA224; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-sha512.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA512; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac-sha384.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512"), require("./sha384"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512", "./sha384", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS.HmacSHA384; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/package-init.js: -------------------------------------------------------------------------------- 1 | /* jshint ignore:start */ 2 | 3 | 4 | // Browser environment 5 | if(typeof window !== 'undefined') { 6 | web3 = (typeof window.web3 !== 'undefined') ? window.web3 : require('web3'); 7 | BigNumber = (typeof window.BigNumber !== 'undefined') ? window.BigNumber : require('bignumber.js'); 8 | } 9 | 10 | 11 | // Node environment 12 | if(typeof global !== 'undefined') { 13 | web3 = (typeof global.web3 !== 'undefined') ? global.web3 : require('web3'); 14 | BigNumber = (typeof global.BigNumber !== 'undefined') ? global.BigNumber : require('bignumber.js'); 15 | } 16 | 17 | /* jshint ignore:end */ -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution 2 | 3 | # Git Flow 4 | 5 | The crypto-js project uses [git flow](https://github.com/nvie/gitflow) to manage branches. 6 | Do your changes on the `develop` or even better on a `feature/*` branch. Don't do any changes on the `master` branch. 7 | 8 | # Pull request 9 | 10 | Target your pull request on `develop` branch. Other pull request won't be accepted. 11 | 12 | # How to build 13 | 14 | 1. Clone 15 | 16 | 2. Run 17 | 18 | ```sh 19 | npm install 20 | ``` 21 | 22 | 3. Run 23 | 24 | ```sh 25 | npm run build 26 | ``` 27 | 28 | 4. Check `build` folder -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "content", 3 | "version": "0.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "eth": "geth --networkid 89898989 --datadir './.eth' --rpc --shh --rpccorsdomain '*' --rpcapi 'shh,eth,web3' --nodiscover --nat none --port 9092", 9 | "app": "bash run.sh" 10 | }, 11 | "author": "", 12 | "license": "NONE", 13 | "dependencies": { 14 | "web3": "~0.7.1", 15 | "ipfs-api": "~1.1.8", 16 | "coffee-script": "~1.9.3", 17 | "mkdirp": "~0.5.1", 18 | "http-server": "~0.8.0", 19 | "less": "~2.5.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} 2 | -------------------------------------------------------------------------------- /src/lib/web3/LICENSE: -------------------------------------------------------------------------------- 1 | This file is part of web3.js. 2 | 3 | web3.js is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU Lesser General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | web3.js is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU Lesser General Public License for more details. 12 | 13 | You should have received a copy of the GNU Lesser General Public License 14 | along with web3.js. If not, see . 15 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pad-nopadding.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * A noop padding strategy. 18 | */ 19 | CryptoJS.pad.NoPadding = { 20 | pad: function () { 21 | }, 22 | 23 | unpad: function () { 24 | } 25 | }; 26 | 27 | 28 | return CryptoJS.pad.NoPadding; 29 | 30 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.4", 4 | "description": "Modularized port of googlecode project crypto-js.", 5 | "homepage": "http://github.com/evanvosberg/crypto-js", 6 | "repository": { 7 | "type": "git", 8 | "url": "http://github.com/evanvosberg/crypto-js.git" 9 | }, 10 | "keywords": [ 11 | "security", 12 | "crypto", 13 | "Hash", 14 | "MD5", 15 | "SHA1", 16 | "SHA-1", 17 | "SHA256", 18 | "SHA-256", 19 | "RC4", 20 | "Rabbit", 21 | "AES", 22 | "DES", 23 | "PBKDF2", 24 | "HMAC", 25 | "OFB", 26 | "CFB", 27 | "CTR", 28 | "CBC", 29 | "Base64" 30 | ], 31 | "main": "index.js", 32 | "dependencies": {}, 33 | "ignore": [] 34 | } 35 | -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bignumber.js", 3 | "main": "bignumber.js", 4 | "version": "2.0.7", 5 | "homepage": "https://github.com/MikeMcl/bignumber.js", 6 | "authors": [ 7 | "Michael Mclaughlin " 8 | ], 9 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "arbitrary", 17 | "precision", 18 | "arithmetic", 19 | "big", 20 | "number", 21 | "decimal", 22 | "float", 23 | "biginteger", 24 | "bigdecimal", 25 | "bignumber", 26 | "bigint", 27 | "bignum" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | ".*", 32 | "*.json", 33 | "test" 34 | ] 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.4", 4 | "description": "Modularized port of googlecode project crypto-js.", 5 | "author": { 6 | "name": "Evan Vosberg", 7 | "url": "http://github.com/evanvosberg" 8 | }, 9 | "homepage": "http://github.com/evanvosberg/crypto-js", 10 | "repository": { 11 | "type": "git", 12 | "url": "http://github.com/evanvosberg/crypto-js.git" 13 | }, 14 | "keywords": [ 15 | "security", 16 | "crypto", 17 | "Hash", 18 | "MD5", 19 | "SHA1", 20 | "SHA-1", 21 | "SHA256", 22 | "SHA-256", 23 | "RC4", 24 | "Rabbit", 25 | "AES", 26 | "DES", 27 | "PBKDF2", 28 | "HMAC", 29 | "OFB", 30 | "CFB", 31 | "CTR", 32 | "CBC", 33 | "Base64" 34 | ], 35 | "main": "index.js", 36 | "dependencies": {} 37 | } 38 | -------------------------------------------------------------------------------- /src/lib/web3/package.js: -------------------------------------------------------------------------------- 1 | /* jshint ignore:start */ 2 | Package.describe({ 3 | name: 'ethereum:web3', 4 | version: '0.7.1', 5 | summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', 6 | git: 'https://github.com/ethereum/ethereum.js', 7 | // By default, Meteor will default to using README.md for documentation. 8 | // To avoid submitting documentation, set this field to null. 9 | documentation: 'README.md' 10 | }); 11 | 12 | Package.onUse(function(api) { 13 | api.versionsFrom('1.0.3.2'); 14 | 15 | // api.use('3stack:bignumber@2.0.0', 'client'); 16 | 17 | api.export(['web3', 'BigNumber'], ['client', 'server']); 18 | 19 | api.addFiles('dist/web3.js', 'client'); 20 | api.addFiles('package-init.js', 'client'); 21 | }); 22 | 23 | // Package.onTest(function(api) { 24 | // api.use('tinytest'); 25 | // api.use('test'); 26 | // api.addFiles('test-tests.js'); 27 | // }); 28 | /* jshint ignore:end */ 29 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "crypto-js", 3 | "version": "3.1.4", 4 | "description": "Modularized port of googlecode project crypto-js.", 5 | "homepage": "http://github.com/evanvosberg/crypto-js", 6 | "repository": { 7 | "type": "git", 8 | "url": "http://github.com/evanvosberg/crypto-js.git" 9 | }, 10 | "keywords": [ 11 | "security", 12 | "crypto", 13 | "Hash", 14 | "MD5", 15 | "SHA1", 16 | "SHA-1", 17 | "SHA256", 18 | "SHA-256", 19 | "RC4", 20 | "Rabbit", 21 | "AES", 22 | "DES", 23 | "PBKDF2", 24 | "HMAC", 25 | "OFB", 26 | "CFB", 27 | "CTR", 28 | "CBC", 29 | "Base64" 30 | ], 31 | "main": "index.js", 32 | "dependencies": {}, 33 | "ignore": [], 34 | "_release": "3.1.4", 35 | "_resolution": { 36 | "type": "version", 37 | "tag": "3.1.4", 38 | "commit": "9cc7f829741eddabe693a704f10f972fb9c0d5a6" 39 | }, 40 | "_source": "git://github.com/evanvosberg/crypto-js.git", 41 | "_target": "~3.1.4", 42 | "_originalSource": "crypto-js", 43 | "_direct": true 44 | } -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/mode-ecb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Electronic Codebook block mode. 18 | */ 19 | CryptoJS.mode.ECB = (function () { 20 | var ECB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | ECB.Encryptor = ECB.extend({ 23 | processBlock: function (words, offset) { 24 | this._cipher.encryptBlock(words, offset); 25 | } 26 | }); 27 | 28 | ECB.Decryptor = ECB.extend({ 29 | processBlock: function (words, offset) { 30 | this._cipher.decryptBlock(words, offset); 31 | } 32 | }); 33 | 34 | return ECB; 35 | }()); 36 | 37 | 38 | return CryptoJS.mode.ECB; 39 | 40 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bignumber.js", 3 | "main": "bignumber.js", 4 | "version": "2.0.7", 5 | "homepage": "https://github.com/MikeMcl/bignumber.js", 6 | "authors": [ 7 | "Michael Mclaughlin " 8 | ], 9 | "description": "A library for arbitrary-precision decimal and non-decimal arithmetic", 10 | "moduleType": [ 11 | "amd", 12 | "globals", 13 | "node" 14 | ], 15 | "keywords": [ 16 | "arbitrary", 17 | "precision", 18 | "arithmetic", 19 | "big", 20 | "number", 21 | "decimal", 22 | "float", 23 | "biginteger", 24 | "bigdecimal", 25 | "bignumber", 26 | "bigint", 27 | "bignum" 28 | ], 29 | "license": "MIT", 30 | "ignore": [ 31 | ".*", 32 | "*.json", 33 | "test" 34 | ], 35 | "_release": "2.0.7", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "2.0.7", 39 | "commit": "3661d1caf389955e52ae93d4f451a8c5e7dc3c2d" 40 | }, 41 | "_source": "git://github.com/MikeMcl/bignumber.js.git", 42 | "_target": ">=2.0.0", 43 | "_originalSource": "bignumber.js" 44 | } -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pad-iso97971.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ISO/IEC 9797-1 Padding Method 2. 18 | */ 19 | CryptoJS.pad.Iso97971 = { 20 | pad: function (data, blockSize) { 21 | // Add 0x80 byte 22 | data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); 23 | 24 | // Zero pad the rest 25 | CryptoJS.pad.ZeroPadding.pad(data, blockSize); 26 | }, 27 | 28 | unpad: function (data) { 29 | // Remove zero padding 30 | CryptoJS.pad.ZeroPadding.unpad(data); 31 | 32 | // Remove one more byte -- the 0x80 byte 33 | data.sigBytes--; 34 | } 35 | }; 36 | 37 | 38 | return CryptoJS.pad.Iso97971; 39 | 40 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT Expat Licence. 2 | 3 | Copyright (c) 2012 Michael Mclaughlin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | 'Software'), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/qtsync.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file qtsync.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * Marian Oancea 21 | * @date 2014 22 | */ 23 | 24 | var QtSyncProvider = function () { 25 | }; 26 | 27 | QtSyncProvider.prototype.send = function (payload) { 28 | var result = navigator.qt.callMethod(JSON.stringify(payload)); 29 | return JSON.parse(result); 30 | }; 31 | 32 | module.exports = QtSyncProvider; 33 | 34 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pad-zeropadding.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Zero padding strategy. 18 | */ 19 | CryptoJS.pad.ZeroPadding = { 20 | pad: function (data, blockSize) { 21 | // Shortcut 22 | var blockSizeBytes = blockSize * 4; 23 | 24 | // Pad 25 | data.clamp(); 26 | data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); 27 | }, 28 | 29 | unpad: function (data) { 30 | // Shortcut 31 | var dataWords = data.words; 32 | 33 | // Unpad 34 | var i = data.sigBytes - 1; 35 | while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { 36 | i--; 37 | } 38 | data.sigBytes = i + 1; 39 | } 40 | }; 41 | 42 | 43 | return CryptoJS.pad.ZeroPadding; 44 | 45 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pad-iso10126.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ISO 10126 padding strategy. 18 | */ 19 | CryptoJS.pad.Iso10126 = { 20 | pad: function (data, blockSize) { 21 | // Shortcut 22 | var blockSizeBytes = blockSize * 4; 23 | 24 | // Count padding bytes 25 | var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; 26 | 27 | // Pad 28 | data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). 29 | concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); 30 | }, 31 | 32 | unpad: function (data) { 33 | // Get number of padding bytes from last byte 34 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 35 | 36 | // Remove padding 37 | data.sigBytes -= nPaddingBytes; 38 | } 39 | }; 40 | 41 | 42 | return CryptoJS.pad.Iso10126; 43 | 44 | })); -------------------------------------------------------------------------------- /src/lib/web3/example/balance.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 27 | 28 | 29 |

coinbase balance

30 | 31 |
32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pad-ansix923.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * ANSI X.923 padding strategy. 18 | */ 19 | CryptoJS.pad.AnsiX923 = { 20 | pad: function (data, blockSize) { 21 | // Shortcuts 22 | var dataSigBytes = data.sigBytes; 23 | var blockSizeBytes = blockSize * 4; 24 | 25 | // Count padding bytes 26 | var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; 27 | 28 | // Compute last byte position 29 | var lastBytePos = dataSigBytes + nPaddingBytes - 1; 30 | 31 | // Pad 32 | data.clamp(); 33 | data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); 34 | data.sigBytes += nPaddingBytes; 35 | }, 36 | 37 | unpad: function (data) { 38 | // Get number of padding bytes from last byte 39 | var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; 40 | 41 | // Remove padding 42 | data.sigBytes -= nPaddingBytes; 43 | } 44 | }; 45 | 46 | 47 | return CryptoJS.pad.Ansix923; 48 | 49 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/bugs.js: -------------------------------------------------------------------------------- 1 | // node bugs 2 | // Compare with BigDecTest.java 3 | 4 | var i, x, y, r, 5 | BigDecimal = require('./bigdecimal').BigDecimal; 6 | 7 | // remainder 8 | 9 | x = new BigDecimal("9.785496E-2"); 10 | y = new BigDecimal("-5.9219189762E-2"); 11 | r = x.remainder(y); 12 | console.log( r.toString() ); 13 | // 0.09785496 14 | // Should be 0.038635770238 15 | 16 | x = new BigDecimal("1.23693014661017964112E-5"); 17 | y = new BigDecimal("-6.9318042E-7"); 18 | r = x.remainder(y); 19 | console.log( r.toPlainString() ); 20 | // 0.0000123693014661017964112 21 | // Should be 0.0000005852343261017964112 22 | 23 | // divide 24 | 25 | x = new BigDecimal("6.9609119610E-78"); 26 | y = new BigDecimal("4E-48"); 27 | r = x.divide(y, 40, 6); // ROUND_HALF_EVEN 28 | console.log( r.toString() ); 29 | // 1.7402279903E-30 30 | // Should be 1.7402279902E-30 31 | 32 | x = new BigDecimal("5.383458817E-83"); 33 | y = new BigDecimal("8E-54"); 34 | r = x.divide(y, 40, 6); 35 | console.log( r.toString() ); 36 | // 6.7293235213E-30 37 | // Should be 6.7293235212E-30 38 | 39 | // compareTo 40 | 41 | x = new BigDecimal("0.04"); 42 | y = new BigDecimal("0.079393068"); 43 | i = x.compareTo(y); 44 | console.log(i); 45 | // 1 46 | // Should be -1 47 | 48 | x = new BigDecimal("7.88749578569876987785987658649E-10"); 49 | y = new BigDecimal("4.2545098709E-6"); 50 | i = x.compareTo(y); 51 | console.log(i); 52 | // 1 53 | // Should be -1 -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /content 5 | 6 | 24 | 25 | 26 | 27 | 28 |

/content

29 | 30 |

p2p community content platform

31 | 32 |
33 | 34 |

Built using IPFS and Ethereum. We're launching a private beta soon.

35 | 36 |

Beta

37 | 38 |

The private beta will be made up of a cohort of users without their own IPFS or Ethereum nodes. For those who are able and willing to run their own nodes, documentation will be released soon. Register your interest if you would like to participate.

39 | 40 |

Demo

41 | 42 |

You could check out the Read Only Demo if you'd like a better idea of what it is.

43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/lib/web3/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web3", 3 | "namespace": "ethereum", 4 | "version": "0.7.1", 5 | "description": "Ethereum Compatible JavaScript API", 6 | "main": [ 7 | "./dist/web3.js", 8 | "./dist/web3.min.js" 9 | ], 10 | "dependencies": { 11 | "bignumber.js": ">=2.0.0", 12 | "crypto-js": "~3.1.4" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/ethereum/web3.js.git" 17 | }, 18 | "homepage": "https://github.com/ethereum/web3.js", 19 | "bugs": { 20 | "url": "https://github.com/ethereum/web3.js/issues" 21 | }, 22 | "keywords": [ 23 | "ethereum", 24 | "javascript", 25 | "API" 26 | ], 27 | "authors": [ 28 | { 29 | "name": "Marek Kotewicz", 30 | "email": "marek@ethdev.com", 31 | "homepage": "https://github.com/debris" 32 | }, 33 | { 34 | "name": "Marian Oancea", 35 | "email": "marian@ethdev.com", 36 | "homepage": "https://github.com/cubedro" 37 | }, 38 | { 39 | "name": "Fabian Vogelsteller", 40 | "email": "fabian@ethdev.com", 41 | "homepage": "https://github.com/frozeman" 42 | } 43 | ], 44 | "license": "LGPL-3.0", 45 | "ignore": [ 46 | "example", 47 | "lib", 48 | "node_modules", 49 | "package.json", 50 | "package.js", 51 | ".versions", 52 | ".bowerrc", 53 | ".editorconfig", 54 | ".gitignore", 55 | ".jshintrc", 56 | ".npmignore", 57 | ".travis.yml", 58 | "gulpfile.js", 59 | "index.js", 60 | "**/*.txt" 61 | ] 62 | } 63 | -------------------------------------------------------------------------------- /src/lib/web3/lib/utils/sha3.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file sha3.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var utils = require('./utils'); 24 | var sha3 = require('crypto-js/sha3'); 25 | 26 | module.exports = function (str, isNew) { 27 | if (str.substr(0, 2) === '0x' && !isNew) { 28 | console.warn('requirement of using web3.fromAscii before sha3 is deprecated'); 29 | console.warn('new usage: \'web3.sha3("hello")\''); 30 | console.warn('see https://github.com/ethereum/web3.js/pull/205'); 31 | console.warn('if you need to hash hex value, you can do \'sha3("0xfff", true)\''); 32 | str = utils.toAscii(str); 33 | } 34 | 35 | return sha3(str, { 36 | outputLength: 256 37 | }).toString(); 38 | }; 39 | 40 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/net.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file eth.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var utils = require('../utils/utils'); 24 | var Property = require('./property'); 25 | 26 | /// @returns an array of objects describing web3.eth api methods 27 | var methods = [ 28 | ]; 29 | 30 | /// @returns an array of objects describing web3.eth api properties 31 | var properties = [ 32 | new Property({ 33 | name: 'listening', 34 | getter: 'net_listening' 35 | }), 36 | new Property({ 37 | name: 'peerCount', 38 | getter: 'net_peerCount', 39 | outputFormatter: utils.toDecimal 40 | }) 41 | ]; 42 | 43 | 44 | module.exports = { 45 | methods: methods, 46 | properties: properties 47 | }; 48 | 49 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/errors.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file errors.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | module.exports = { 24 | InvalidNumberOfParams: function () { 25 | return new Error('Invalid number of input parameters'); 26 | }, 27 | InvalidConnection: function (host){ 28 | return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +', is it running?'); 29 | }, 30 | InvalidProvider: function () { 31 | return new Error('Providor not set or invalid'); 32 | }, 33 | InvalidResponse: function (result){ 34 | var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response'; 35 | return new Error(message); 36 | } 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/db.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file db.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Method = require('./method'); 24 | 25 | var putString = new Method({ 26 | name: 'putString', 27 | call: 'db_putString', 28 | params: 3 29 | }); 30 | 31 | 32 | var getString = new Method({ 33 | name: 'getString', 34 | call: 'db_getString', 35 | params: 2 36 | }); 37 | 38 | var putHex = new Method({ 39 | name: 'putHex', 40 | call: 'db_putHex', 41 | params: 3 42 | }); 43 | 44 | var getHex = new Method({ 45 | name: 'getHex', 46 | call: 'db_getHex', 47 | params: 2 48 | }); 49 | 50 | var methods = [ 51 | putString, getString, putHex, getHex 52 | ]; 53 | 54 | module.exports = { 55 | methods: methods 56 | }; 57 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/mode-ofb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Output Feedback block mode. 18 | */ 19 | CryptoJS.mode.OFB = (function () { 20 | var OFB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | var Encryptor = OFB.Encryptor = OFB.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher 26 | var blockSize = cipher.blockSize; 27 | var iv = this._iv; 28 | var keystream = this._keystream; 29 | 30 | // Generate keystream 31 | if (iv) { 32 | keystream = this._keystream = iv.slice(0); 33 | 34 | // Remove IV for subsequent blocks 35 | this._iv = undefined; 36 | } 37 | cipher.encryptBlock(keystream, 0); 38 | 39 | // Encrypt 40 | for (var i = 0; i < blockSize; i++) { 41 | words[offset + i] ^= keystream[i]; 42 | } 43 | } 44 | }); 45 | 46 | OFB.Decryptor = Encryptor; 47 | 48 | return OFB; 49 | }()); 50 | 51 | 52 | return CryptoJS.mode.OFB; 53 | 54 | })); -------------------------------------------------------------------------------- /contracts/content.sol: -------------------------------------------------------------------------------- 1 | 2 | import "owned"; 3 | 4 | contract Archive is owned { 5 | 6 | struct Content { 7 | bool exists; 8 | address OP; 9 | bytes32[] archives; 10 | } 11 | 12 | uint public price; 13 | mapping(bytes32 => Content) public contents; 14 | 15 | event Post(bytes32 rootHash, bytes32 contentHash); 16 | 17 | modifier costs { if (msg.value >= price) _ } 18 | 19 | function archive( bytes32 rootContentHash, bytes32 archive, address OP, bool tip ) costs { 20 | address archiver = msg.sender; 21 | if (contents[rootContentHash].exists && archive != bytes32(0)) { 22 | 23 | // append to archive 24 | contents[rootContentHash].archives.length++; 25 | contents[rootContentHash].archives[contents[rootContentHash].archives.length] = archive; 26 | Post( rootContentHash, archive); 27 | handleTip( tip, OP ); 28 | 29 | } else if (!contents[rootContentHash].exists) { 30 | 31 | // first archival 32 | bytes32[] memory tmp; 33 | contents[rootContentHash] = Content( true, OP, tmp); 34 | Post( rootContentHash, bytes32(0)); 35 | handleTip( tip, OP ); 36 | } 37 | } 38 | 39 | function handleTip (bool tip, address OP) internal { 40 | if (tip && OP != address(0)) { 41 | OP.send( price ); 42 | } else { 43 | owner.send( price ); 44 | } 45 | } 46 | 47 | function changePrice(uint _price) onlyowner { 48 | price = _price; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/index.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./lib-typedarrays"), require("./enc-utf16"), require("./enc-base64"), require("./md5"), require("./sha1"), require("./sha256"), require("./sha224"), require("./sha512"), require("./sha384"), require("./sha3"), require("./ripemd160"), require("./hmac"), require("./pbkdf2"), require("./evpkdf"), require("./cipher-core"), require("./mode-cfb"), require("./mode-ctr"), require("./mode-ctr-gladman"), require("./mode-ofb"), require("./mode-ecb"), require("./pad-ansix923"), require("./pad-iso10126"), require("./pad-iso97971"), require("./pad-zeropadding"), require("./pad-nopadding"), require("./format-hex"), require("./aes"), require("./tripledes"), require("./rc4"), require("./rabbit"), require("./rabbit-legacy")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | root.CryptoJS = factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | return CryptoJS; 17 | 18 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/perf/lib/bigdecimal_GWT/BigDecTest.java: -------------------------------------------------------------------------------- 1 | // javac BigDecTest.java 2 | // java BigDecTest 3 | 4 | import java.math.BigDecimal; 5 | 6 | public class BigDecTest 7 | { 8 | public static void main(String[] args) { 9 | 10 | int i; 11 | BigDecimal x, y, r; 12 | 13 | // remainder 14 | 15 | x = new BigDecimal("9.785496E-2"); 16 | y = new BigDecimal("-5.9219189762E-2"); 17 | r = x.remainder(y); 18 | System.out.println( r.toString() ); 19 | // 0.038635770238 20 | 21 | 22 | x = new BigDecimal("1.23693014661017964112E-5"); 23 | y = new BigDecimal("-6.9318042E-7"); 24 | r = x.remainder(y); 25 | System.out.println( r.toPlainString() ); 26 | // 0.0000005852343261017964112 27 | 28 | 29 | // divide 30 | 31 | x = new BigDecimal("6.9609119610E-78"); 32 | y = new BigDecimal("4E-48"); 33 | r = x.divide(y, 40, 6); // ROUND_HALF_EVEN 34 | System.out.println( r.toString() ); 35 | // 1.7402279902E-30 36 | 37 | 38 | x = new BigDecimal("5.383458817E-83"); 39 | y = new BigDecimal("8E-54"); 40 | r = x.divide(y, 40, 6); 41 | System.out.println( r.toString() ); 42 | // 6.7293235212E-30 43 | 44 | 45 | // compareTo 46 | 47 | x = new BigDecimal("0.04"); 48 | y = new BigDecimal("0.079393068"); 49 | i = x.compareTo(y); 50 | System.out.println(i); 51 | // -1 52 | 53 | x = new BigDecimal("7.88749578569876987785987658649E-10"); 54 | y = new BigDecimal("4.2545098709E-6"); 55 | i = x.compareTo(y); 56 | System.out.println(i); 57 | // -1 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/mode-ctr.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Counter block mode. 18 | */ 19 | CryptoJS.mode.CTR = (function () { 20 | var CTR = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | var Encryptor = CTR.Encryptor = CTR.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher 26 | var blockSize = cipher.blockSize; 27 | var iv = this._iv; 28 | var counter = this._counter; 29 | 30 | // Generate keystream 31 | if (iv) { 32 | counter = this._counter = iv.slice(0); 33 | 34 | // Remove IV for subsequent blocks 35 | this._iv = undefined; 36 | } 37 | var keystream = counter.slice(0); 38 | cipher.encryptBlock(keystream, 0); 39 | 40 | // Increment counter 41 | counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 42 | 43 | // Encrypt 44 | for (var i = 0; i < blockSize; i++) { 45 | words[offset + i] ^= keystream[i]; 46 | } 47 | } 48 | }); 49 | 50 | CTR.Decryptor = Encryptor; 51 | 52 | return CTR; 53 | }()); 54 | 55 | 56 | return CryptoJS.mode.CTR; 57 | 58 | })); -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/shh.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file shh.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Method = require('./method'); 24 | var formatters = require('./formatters'); 25 | 26 | var post = new Method({ 27 | name: 'post', 28 | call: 'shh_post', 29 | params: 1, 30 | inputFormatter: [formatters.inputPostFormatter] 31 | }); 32 | 33 | var newIdentity = new Method({ 34 | name: 'newIdentity', 35 | call: 'shh_newIdentity', 36 | params: 0 37 | }); 38 | 39 | var hasIdentity = new Method({ 40 | name: 'hasIdentity', 41 | call: 'shh_hasIdentity', 42 | params: 1 43 | }); 44 | 45 | var newGroup = new Method({ 46 | name: 'newGroup', 47 | call: 'shh_newGroup', 48 | params: 0 49 | }); 50 | 51 | var addToGroup = new Method({ 52 | name: 'addToGroup', 53 | call: 'shh_addToGroup', 54 | params: 0 55 | }); 56 | 57 | var methods = [ 58 | post, 59 | newIdentity, 60 | hasIdentity, 61 | newGroup, 62 | addToGroup 63 | ]; 64 | 65 | module.exports = { 66 | methods: methods 67 | }; 68 | 69 | -------------------------------------------------------------------------------- /src/lib/web3/lib/utils/config.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file config.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | /** 24 | * Utils 25 | * 26 | * @module utils 27 | */ 28 | 29 | /** 30 | * Utility functions 31 | * 32 | * @class [utils] config 33 | * @constructor 34 | */ 35 | 36 | /// required to define ETH_BIGNUMBER_ROUNDING_MODE 37 | var BigNumber = require('bignumber.js'); 38 | 39 | var ETH_UNITS = [ 40 | 'wei', 41 | 'kwei', 42 | 'Mwei', 43 | 'Gwei', 44 | 'szabo', 45 | 'finney', 46 | 'femtoether', 47 | 'picoether', 48 | 'nanoether', 49 | 'microether', 50 | 'milliether', 51 | 'nano', 52 | 'micro', 53 | 'milli', 54 | 'ether', 55 | 'grand', 56 | 'Mether', 57 | 'Gether', 58 | 'Tether', 59 | 'Pether', 60 | 'Eether', 61 | 'Zether', 62 | 'Yether', 63 | 'Nether', 64 | 'Dether', 65 | 'Vether', 66 | 'Uether' 67 | ]; 68 | 69 | module.exports = { 70 | ETH_PADDING: 32, 71 | ETH_SIGNATURE_LENGTH: 4, 72 | ETH_UNITS: ETH_UNITS, 73 | ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }, 74 | ETH_POLLING_TIMEOUT: 1000/2, 75 | defaultBlock: 'latest', 76 | defaultAccount: undefined 77 | }; 78 | 79 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/batch.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file batch.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var RequestManager = require('./requestmanager'); 24 | 25 | var Batch = function () { 26 | this.requests = []; 27 | }; 28 | 29 | /** 30 | * Should be called to add create new request to batch request 31 | * 32 | * @method add 33 | * @param {Object} jsonrpc requet object 34 | */ 35 | Batch.prototype.add = function (request) { 36 | this.requests.push(request); 37 | }; 38 | 39 | /** 40 | * Should be called to execute batch request 41 | * 42 | * @method execute 43 | */ 44 | Batch.prototype.execute = function () { 45 | var requests = this.requests; 46 | RequestManager.getInstance().sendBatch(requests, function (err, results) { 47 | results = results || []; 48 | requests.map(function (request, index) { 49 | return results[index] || {}; 50 | }).map(function (result, index) { 51 | return requests[index].format ? requests[index].format(result.result) : result.result; 52 | }).forEach(function (result, index) { 53 | if (requests[index].callback) { 54 | requests[index].callback(err, result); 55 | } 56 | }); 57 | }); 58 | }; 59 | 60 | module.exports = Batch; 61 | 62 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/format-hex.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function (undefined) { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var CipherParams = C_lib.CipherParams; 21 | var C_enc = C.enc; 22 | var Hex = C_enc.Hex; 23 | var C_format = C.format; 24 | 25 | var HexFormatter = C_format.Hex = { 26 | /** 27 | * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. 28 | * 29 | * @param {CipherParams} cipherParams The cipher params object. 30 | * 31 | * @return {string} The hexadecimally encoded string. 32 | * 33 | * @static 34 | * 35 | * @example 36 | * 37 | * var hexString = CryptoJS.format.Hex.stringify(cipherParams); 38 | */ 39 | stringify: function (cipherParams) { 40 | return cipherParams.ciphertext.toString(Hex); 41 | }, 42 | 43 | /** 44 | * Converts a hexadecimally encoded ciphertext string to a cipher params object. 45 | * 46 | * @param {string} input The hexadecimally encoded string. 47 | * 48 | * @return {CipherParams} The cipher params object. 49 | * 50 | * @static 51 | * 52 | * @example 53 | * 54 | * var cipherParams = CryptoJS.format.Hex.parse(hexString); 55 | */ 56 | parse: function (input) { 57 | var ciphertext = Hex.parse(input); 58 | return CipherParams.create({ ciphertext: ciphertext }); 59 | } 60 | }; 61 | }()); 62 | 63 | 64 | return CryptoJS.format.Hex; 65 | 66 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/sha224.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha256")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha256"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var WordArray = C_lib.WordArray; 21 | var C_algo = C.algo; 22 | var SHA256 = C_algo.SHA256; 23 | 24 | /** 25 | * SHA-224 hash algorithm. 26 | */ 27 | var SHA224 = C_algo.SHA224 = SHA256.extend({ 28 | _doReset: function () { 29 | this._hash = new WordArray.init([ 30 | 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 31 | 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 32 | ]); 33 | }, 34 | 35 | _doFinalize: function () { 36 | var hash = SHA256._doFinalize.call(this); 37 | 38 | hash.sigBytes -= 4; 39 | 40 | return hash; 41 | } 42 | }); 43 | 44 | /** 45 | * Shortcut function to the hasher's object interface. 46 | * 47 | * @param {WordArray|string} message The message to hash. 48 | * 49 | * @return {WordArray} The hash. 50 | * 51 | * @static 52 | * 53 | * @example 54 | * 55 | * var hash = CryptoJS.SHA224('message'); 56 | * var hash = CryptoJS.SHA224(wordArray); 57 | */ 58 | C.SHA224 = SHA256._createHelper(SHA224); 59 | 60 | /** 61 | * Shortcut function to the HMAC's object interface. 62 | * 63 | * @param {WordArray|string} message The message to hash. 64 | * @param {WordArray|string} key The secret key. 65 | * 66 | * @return {WordArray} The HMAC. 67 | * 68 | * @static 69 | * 70 | * @example 71 | * 72 | * var hmac = CryptoJS.HmacSHA224(message, key); 73 | */ 74 | C.HmacSHA224 = SHA256._createHmacHelper(SHA224); 75 | }()); 76 | 77 | 78 | return CryptoJS.SHA224; 79 | 80 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/perf/README.md: -------------------------------------------------------------------------------- 1 | This directory contains two command-line applications *bigtime.js* and *bigtime-OOM.js*, and for the browser *bignumber-vs-bigdecimal.html*, which enable some of the methods of bignumber.js to be tested against the JavaScript translations of the two versions of BigDecimal in the *lib* directory. 2 | 3 | * GWT: java.math.BigDecimal 4 | 5 | * ICU4J: com.ibm.icu.math.BigDecimal 6 | 7 | 8 | The BigDecimal in Node's npm registry is the GWT version. It has some bugs: see the Node script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods. 9 | 10 | An example of using *bigtime.js* to compare the time taken by the bignumber.js `plus` method and the GWT BigDecimal `add` method: 11 | 12 | $ node bigtime plus 10000 40 13 | 14 | This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match. 15 | 16 | For help: 17 | 18 | $ node bigtime -h 19 | 20 | *bigtime-OOM.js* works in the same way, but includes separate timings for object creation and method calls. 21 | 22 | In general, *bigtime.js* is recommended over *bigtime-OOM.js*, which may run out of memory. 23 | 24 | The usage of *bignumber-vs-bigdecimal.html* should be more or less self-explanatory. 25 | 26 | --- 27 | 28 | ###### Further notes: 29 | 30 | ###### bigtime.js 31 | 32 | * Creates random numbers and BigNumber and BigDecimal objects in batches. 33 | * Unlikely to run out of memory. 34 | * Doesn't show separate times for object creation and method calls. 35 | * Tests methods with one or two operands (i.e. includes abs and negate). 36 | * Doesn't indicate random number creation completion. 37 | * Doesn't calculate average number of digits of operands. 38 | * Creates random numbers in exponential notation. 39 | 40 | ###### bigtime-OOM.js 41 | 42 | * Creates random numbers and BigNumber and BigDecimal objects all in one go. 43 | * May run out of memory, e.g. if iterations > 500000 and random digits > 40. 44 | * Shows separate times for object creation and method calls. 45 | * Only tests methods with two operands (i.e. no abs or negate). 46 | * Indicates random number creation completion. 47 | * Calculates average number of digits of operands. 48 | * Creates random numbers in normal notation. 49 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/mode-cfb.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** 17 | * Cipher Feedback block mode. 18 | */ 19 | CryptoJS.mode.CFB = (function () { 20 | var CFB = CryptoJS.lib.BlockCipherMode.extend(); 21 | 22 | CFB.Encryptor = CFB.extend({ 23 | processBlock: function (words, offset) { 24 | // Shortcuts 25 | var cipher = this._cipher; 26 | var blockSize = cipher.blockSize; 27 | 28 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 29 | 30 | // Remember this block to use with next block 31 | this._prevBlock = words.slice(offset, offset + blockSize); 32 | } 33 | }); 34 | 35 | CFB.Decryptor = CFB.extend({ 36 | processBlock: function (words, offset) { 37 | // Shortcuts 38 | var cipher = this._cipher; 39 | var blockSize = cipher.blockSize; 40 | 41 | // Remember this block to use with next block 42 | var thisBlock = words.slice(offset, offset + blockSize); 43 | 44 | generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); 45 | 46 | // This block becomes the previous block 47 | this._prevBlock = thisBlock; 48 | } 49 | }); 50 | 51 | function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { 52 | // Shortcut 53 | var iv = this._iv; 54 | 55 | // Generate keystream 56 | if (iv) { 57 | var keystream = iv.slice(0); 58 | 59 | // Remove IV for subsequent blocks 60 | this._iv = undefined; 61 | } else { 62 | var keystream = this._prevBlock; 63 | } 64 | cipher.encryptBlock(keystream, 0); 65 | 66 | // Encrypt 67 | for (var i = 0; i < blockSize; i++) { 68 | words[offset + i] ^= keystream[i]; 69 | } 70 | } 71 | 72 | return CFB; 73 | }()); 74 | 75 | 76 | return CryptoJS.mode.CFB; 77 | 78 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/lib-typedarrays.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Check if typed arrays are supported 18 | if (typeof ArrayBuffer != 'function') { 19 | return; 20 | } 21 | 22 | // Shortcuts 23 | var C = CryptoJS; 24 | var C_lib = C.lib; 25 | var WordArray = C_lib.WordArray; 26 | 27 | // Reference original init 28 | var superInit = WordArray.init; 29 | 30 | // Augment WordArray.init to handle typed arrays 31 | var subInit = WordArray.init = function (typedArray) { 32 | // Convert buffers to uint8 33 | if (typedArray instanceof ArrayBuffer) { 34 | typedArray = new Uint8Array(typedArray); 35 | } 36 | 37 | // Convert other array views to uint8 38 | if ( 39 | typedArray instanceof Int8Array || 40 | (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || 41 | typedArray instanceof Int16Array || 42 | typedArray instanceof Uint16Array || 43 | typedArray instanceof Int32Array || 44 | typedArray instanceof Uint32Array || 45 | typedArray instanceof Float32Array || 46 | typedArray instanceof Float64Array 47 | ) { 48 | typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); 49 | } 50 | 51 | // Handle Uint8Array 52 | if (typedArray instanceof Uint8Array) { 53 | // Shortcut 54 | var typedArrayByteLength = typedArray.byteLength; 55 | 56 | // Extract bytes 57 | var words = []; 58 | for (var i = 0; i < typedArrayByteLength; i++) { 59 | words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); 60 | } 61 | 62 | // Initialize this word array 63 | superInit.call(this, words, typedArrayByteLength); 64 | } else { 65 | // Else call normal init 66 | superInit.apply(this, arguments); 67 | } 68 | }; 69 | 70 | subInit.prototype = WordArray; 71 | }()); 72 | 73 | 74 | return CryptoJS.lib.WordArray; 75 | 76 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/sha384.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./x64-core"), require("./sha512")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./x64-core", "./sha512"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_x64 = C.x64; 20 | var X64Word = C_x64.Word; 21 | var X64WordArray = C_x64.WordArray; 22 | var C_algo = C.algo; 23 | var SHA512 = C_algo.SHA512; 24 | 25 | /** 26 | * SHA-384 hash algorithm. 27 | */ 28 | var SHA384 = C_algo.SHA384 = SHA512.extend({ 29 | _doReset: function () { 30 | this._hash = new X64WordArray.init([ 31 | new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), 32 | new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), 33 | new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), 34 | new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) 35 | ]); 36 | }, 37 | 38 | _doFinalize: function () { 39 | var hash = SHA512._doFinalize.call(this); 40 | 41 | hash.sigBytes -= 16; 42 | 43 | return hash; 44 | } 45 | }); 46 | 47 | /** 48 | * Shortcut function to the hasher's object interface. 49 | * 50 | * @param {WordArray|string} message The message to hash. 51 | * 52 | * @return {WordArray} The hash. 53 | * 54 | * @static 55 | * 56 | * @example 57 | * 58 | * var hash = CryptoJS.SHA384('message'); 59 | * var hash = CryptoJS.SHA384(wordArray); 60 | */ 61 | C.SHA384 = SHA512._createHelper(SHA384); 62 | 63 | /** 64 | * Shortcut function to the HMAC's object interface. 65 | * 66 | * @param {WordArray|string} message The message to hash. 67 | * @param {WordArray|string} key The secret key. 68 | * 69 | * @return {WordArray} The HMAC. 70 | * 71 | * @static 72 | * 73 | * @example 74 | * 75 | * var hmac = CryptoJS.HmacSHA384(message, key); 76 | */ 77 | C.HmacSHA384 = SHA512._createHmacHelper(SHA384); 78 | }()); 79 | 80 | 81 | return CryptoJS.SHA384; 82 | 83 | })); -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/allevents.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file allevents.js 19 | * @author Marek Kotewicz 20 | * @date 2014 21 | */ 22 | 23 | var sha3 = require('../utils/sha3'); 24 | var SolidityEvent = require('./event'); 25 | var formatters = require('./formatters'); 26 | var utils = require('../utils/utils'); 27 | var Filter = require('./filter'); 28 | var watches = require('./watches'); 29 | 30 | var AllSolidityEvents = function (json, address) { 31 | this._json = json; 32 | this._address = address; 33 | }; 34 | 35 | AllSolidityEvents.prototype.encode = function (options) { 36 | options = options || {}; 37 | var result = {}; 38 | 39 | ['fromBlock', 'toBlock'].filter(function (f) { 40 | return options[f] !== undefined; 41 | }).forEach(function (f) { 42 | result[f] = formatters.inputBlockNumberFormatter(options[f]); 43 | }); 44 | 45 | result.topics = [null, null, null, null, null]; // match all topics 46 | result.address = this._address; 47 | 48 | return result; 49 | }; 50 | 51 | AllSolidityEvents.prototype.decode = function (data) { 52 | data.data = data.data || ''; 53 | data.topics = data.topics || []; 54 | 55 | var eventTopic = data.topics[0].slice(2); 56 | var match = this._json.filter(function (j) { 57 | return eventTopic === sha3(utils.transformToFullName(j)); 58 | })[0]; 59 | 60 | if (!match) { // cannot find matching event? 61 | console.warn('cannot find event for log'); 62 | return data; 63 | } 64 | 65 | var event = new SolidityEvent(match, this._address); 66 | return event.decode(data); 67 | }; 68 | 69 | AllSolidityEvents.prototype.execute = function (options, callback) { 70 | var o = this.encode(options); 71 | var formatter = this.decode.bind(this); 72 | return new Filter(o, watches.eth(), formatter, callback); 73 | }; 74 | 75 | AllSolidityEvents.prototype.attachToContract = function (contract) { 76 | var execute = this.execute.bind(this); 77 | contract.allEvents = execute; 78 | }; 79 | 80 | module.exports = AllSolidityEvents; 81 | 82 | -------------------------------------------------------------------------------- /content/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | content 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 |
18 | 19 | Content 20 |

/content

21 |
22 |

p2p community content platform

23 |
24 | 25 | 30 | 31 |
    32 |
  • ipfs: ... eth: ...
  • 33 |
34 | 35 | 36 |
37 |

/content

38 |
status: ok; ~0 users here now
39 |

More about this sub

40 | 41 |
42 |
43 | 44 |
    45 |
  • Loading...
  • 46 |
47 | 48 | 49 | 50 | 51 | 52 | 68 | 69 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/lib/web3/example/contract.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 65 | 66 | 67 |

contract

68 |
69 |
70 |
71 | 72 |
73 | 76 |
77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/mode-ctr-gladman.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | /** @preserve 17 | * Counter block mode compatible with Dr Brian Gladman fileenc.c 18 | * derived from CryptoJS.mode.CTR 19 | * Jan Hruby jhruby.web@gmail.com 20 | */ 21 | CryptoJS.mode.CTRGladman = (function () { 22 | var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); 23 | 24 | function incWord(word) 25 | { 26 | if (((word >> 24) & 0xff) === 0xff) { //overflow 27 | var b1 = (word >> 16)&0xff; 28 | var b2 = (word >> 8)&0xff; 29 | var b3 = word & 0xff; 30 | 31 | if (b1 === 0xff) // overflow b1 32 | { 33 | b1 = 0; 34 | if (b2 === 0xff) 35 | { 36 | b2 = 0; 37 | if (b3 === 0xff) 38 | { 39 | b3 = 0; 40 | } 41 | else 42 | { 43 | ++b3; 44 | } 45 | } 46 | else 47 | { 48 | ++b2; 49 | } 50 | } 51 | else 52 | { 53 | ++b1; 54 | } 55 | 56 | word = 0; 57 | word += (b1 << 16); 58 | word += (b2 << 8); 59 | word += b3; 60 | } 61 | else 62 | { 63 | word += (0x01 << 24); 64 | } 65 | return word; 66 | } 67 | 68 | function incCounter(counter) 69 | { 70 | if ((counter[0] = incWord(counter[0])) === 0) 71 | { 72 | // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 73 | counter[1] = incWord(counter[1]); 74 | } 75 | return counter; 76 | } 77 | 78 | var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ 79 | processBlock: function (words, offset) { 80 | // Shortcuts 81 | var cipher = this._cipher 82 | var blockSize = cipher.blockSize; 83 | var iv = this._iv; 84 | var counter = this._counter; 85 | 86 | // Generate keystream 87 | if (iv) { 88 | counter = this._counter = iv.slice(0); 89 | 90 | // Remove IV for subsequent blocks 91 | this._iv = undefined; 92 | } 93 | 94 | incCounter(counter); 95 | 96 | var keystream = counter.slice(0); 97 | cipher.encryptBlock(keystream, 0); 98 | 99 | // Encrypt 100 | for (var i = 0; i < blockSize; i++) { 101 | words[offset + i] ^= keystream[i]; 102 | } 103 | } 104 | }); 105 | 106 | CTRGladman.Decryptor = Encryptor; 107 | 108 | return CTRGladman; 109 | }()); 110 | 111 | 112 | 113 | 114 | return CryptoJS.mode.CTRGladman; 115 | 116 | })); -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/jsonrpc.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file jsonrpc.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Jsonrpc = function () { 24 | // singleton pattern 25 | if (arguments.callee._singletonInstance) { 26 | return arguments.callee._singletonInstance; 27 | } 28 | arguments.callee._singletonInstance = this; 29 | 30 | this.messageId = 1; 31 | }; 32 | 33 | /** 34 | * @return {Jsonrpc} singleton 35 | */ 36 | Jsonrpc.getInstance = function () { 37 | var instance = new Jsonrpc(); 38 | return instance; 39 | }; 40 | 41 | /** 42 | * Should be called to valid json create payload object 43 | * 44 | * @method toPayload 45 | * @param {Function} method of jsonrpc call, required 46 | * @param {Array} params, an array of method params, optional 47 | * @returns {Object} valid jsonrpc payload object 48 | */ 49 | Jsonrpc.prototype.toPayload = function (method, params) { 50 | if (!method) 51 | console.error('jsonrpc method should be specified!'); 52 | 53 | return { 54 | jsonrpc: '2.0', 55 | method: method, 56 | params: params || [], 57 | id: this.messageId++ 58 | }; 59 | }; 60 | 61 | /** 62 | * Should be called to check if jsonrpc response is valid 63 | * 64 | * @method isValidResponse 65 | * @param {Object} 66 | * @returns {Boolean} true if response is valid, otherwise false 67 | */ 68 | Jsonrpc.prototype.isValidResponse = function (response) { 69 | return !!response && 70 | !response.error && 71 | response.jsonrpc === '2.0' && 72 | typeof response.id === 'number' && 73 | response.result !== undefined; // only undefined is not valid json object 74 | }; 75 | 76 | /** 77 | * Should be called to create batch payload object 78 | * 79 | * @method toBatchPayload 80 | * @param {Array} messages, an array of objects with method (required) and params (optional) fields 81 | * @returns {Array} batch payload 82 | */ 83 | Jsonrpc.prototype.toBatchPayload = function (messages) { 84 | var self = this; 85 | return messages.map(function (message) { 86 | return self.toPayload(message.method, message.params); 87 | }); 88 | }; 89 | 90 | module.exports = Jsonrpc; 91 | 92 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/transfer.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file transfer.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var web3 = require('../web3'); 24 | var ICAP = require('./icap'); 25 | var namereg = require('./namereg'); 26 | var contract = require('./contract'); 27 | 28 | /** 29 | * Should be used to make ICAP transfer 30 | * 31 | * @method transfer 32 | * @param {String} iban number 33 | * @param {String} from (address) 34 | * @param {Value} value to be tranfered 35 | * @param {Function} callback, callback 36 | */ 37 | var transfer = function (from, iban, value, callback) { 38 | var icap = new ICAP(iban); 39 | if (!icap.isValid()) { 40 | throw new Error('invalid iban address'); 41 | } 42 | 43 | if (icap.isDirect()) { 44 | return transferToAddress(from, icap.address(), value, callback); 45 | } 46 | 47 | if (!callback) { 48 | var address = namereg.addr(icap.institution()); 49 | return deposit(from, address, value, icap.client()); 50 | } 51 | 52 | namereg.addr(icap.insitution(), function (err, address) { 53 | return deposit(from, address, value, icap.client(), callback); 54 | }); 55 | 56 | }; 57 | 58 | /** 59 | * Should be used to transfer funds to certain address 60 | * 61 | * @method transferToAddress 62 | * @param {String} address 63 | * @param {String} from (address) 64 | * @param {Value} value to be tranfered 65 | * @param {Function} callback, callback 66 | */ 67 | var transferToAddress = function (from, address, value, callback) { 68 | return web3.eth.sendTransaction({ 69 | address: address, 70 | from: from, 71 | value: value 72 | }, callback); 73 | }; 74 | 75 | /** 76 | * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!) 77 | * 78 | * @method deposit 79 | * @param {String} address 80 | * @param {String} from (address) 81 | * @param {Value} value to be tranfered 82 | * @param {String} client unique identifier 83 | * @param {Function} callback, callback 84 | */ 85 | var deposit = function (from, address, value, client, callback) { 86 | var abi = [{"constant":false,"inputs":[{"name":"name","type":"bytes32"}],"name":"deposit","outputs":[],"type":"function"}]; 87 | return contract(abi).at(address).deposit(client, { 88 | from: from, 89 | value: value 90 | }, callback); 91 | }; 92 | 93 | module.exports = transfer; 94 | 95 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/icap.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file icap.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var utils = require('../utils/utils'); 24 | 25 | /** 26 | * This prototype should be used to extract necessary information from iban address 27 | * 28 | * @param {String} iban 29 | */ 30 | var ICAP = function (iban) { 31 | this._iban = iban; 32 | }; 33 | 34 | /** 35 | * Should be called to check if icap is correct 36 | * 37 | * @method isValid 38 | * @returns {Boolean} true if it is, otherwise false 39 | */ 40 | ICAP.prototype.isValid = function () { 41 | return utils.isIBAN(this._iban); 42 | }; 43 | 44 | /** 45 | * Should be called to check if iban number is direct 46 | * 47 | * @method isDirect 48 | * @returns {Boolean} true if it is, otherwise false 49 | */ 50 | ICAP.prototype.isDirect = function () { 51 | return this._iban.length === 34; 52 | }; 53 | 54 | /** 55 | * Should be called to check if iban number if indirect 56 | * 57 | * @method isIndirect 58 | * @returns {Boolean} true if it is, otherwise false 59 | */ 60 | ICAP.prototype.isIndirect = function () { 61 | return this._iban.length === 20; 62 | }; 63 | 64 | /** 65 | * Should be called to get iban checksum 66 | * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) 67 | * 68 | * @method checksum 69 | * @returns {String} checksum 70 | */ 71 | ICAP.prototype.checksum = function () { 72 | return this._iban.substr(2, 2); 73 | }; 74 | 75 | /** 76 | * Should be called to get institution identifier 77 | * eg. XREG 78 | * 79 | * @method institution 80 | * @returns {String} institution identifier 81 | */ 82 | ICAP.prototype.institution = function () { 83 | return this.isIndirect() ? this._iban.substr(7, 4) : ''; 84 | }; 85 | 86 | /** 87 | * Should be called to get client identifier within institution 88 | * eg. GAVOFYORK 89 | * 90 | * @method client 91 | * @returns {String} client identifier 92 | */ 93 | ICAP.prototype.client = function () { 94 | return this.isIndirect() ? this._iban.substr(11) : ''; 95 | }; 96 | 97 | /** 98 | * Should be called to get client direct address 99 | * 100 | * @method address 101 | * @returns {String} client direct address 102 | */ 103 | ICAP.prototype.address = function () { 104 | return this.isDirect() ? this._iban.substr(4) : ''; 105 | }; 106 | 107 | module.exports = ICAP; 108 | 109 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/namereg.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file namereg.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var contract = require('./contract'); 24 | 25 | var address = '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; 26 | 27 | var abi = [ 28 | {"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"name","outputs":[{"name":"o_name","type":"bytes32"}],"type":"function"}, 29 | {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"}, 30 | {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"content","outputs":[{"name":"","type":"bytes32"}],"type":"function"}, 31 | {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"addr","outputs":[{"name":"","type":"address"}],"type":"function"}, 32 | {"constant":false,"inputs":[{"name":"_name","type":"bytes32"}],"name":"reserve","outputs":[],"type":"function"}, 33 | {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"subRegistrar","outputs":[{"name":"o_subRegistrar","type":"address"}],"type":"function"}, 34 | {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_newOwner","type":"address"}],"name":"transfer","outputs":[],"type":"function"}, 35 | {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_registrar","type":"address"}],"name":"setSubRegistrar","outputs":[],"type":"function"}, 36 | {"constant":false,"inputs":[],"name":"Registrar","outputs":[],"type":"function"}, 37 | {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_a","type":"address"},{"name":"_primary","type":"bool"}],"name":"setAddress","outputs":[],"type":"function"}, 38 | {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_content","type":"bytes32"}],"name":"setContent","outputs":[],"type":"function"}, 39 | {"constant":false,"inputs":[{"name":"_name","type":"bytes32"}],"name":"disown","outputs":[],"type":"function"}, 40 | {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"register","outputs":[{"name":"","type":"address"}],"type":"function"}, 41 | {"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"}],"name":"Changed","type":"event"}, 42 | {"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"},{"indexed":true,"name":"addr","type":"address"}],"name":"PrimaryChanged","type":"event"} 43 | ]; 44 | 45 | module.exports = contract(abi).at(address); 46 | 47 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/httpprovider.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file httpprovider.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * Marian Oancea 21 | * Fabian Vogelsteller 22 | * @date 2014 23 | */ 24 | 25 | "use strict"; 26 | 27 | // resolves the problem for electron/atom shell environments, which use node integration, but have no process variable available 28 | var XMLHttpRequest = (typeof window !== 'undefined' && window.XMLHttpRequest) ? window.XMLHttpRequest : require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line 29 | var errors = require('./errors'); 30 | 31 | var HttpProvider = function (host) { 32 | this.host = host || 'http://localhost:8545'; 33 | }; 34 | 35 | HttpProvider.prototype.send = function (payload) { 36 | var request = new XMLHttpRequest(); 37 | 38 | request.open('POST', this.host, false); 39 | request.setRequestHeader('Content-type','application/json'); 40 | // request.setRequestHeader('Connection','Keep-Alive'); 41 | 42 | try { 43 | request.send(JSON.stringify(payload)); 44 | } catch(error) { 45 | throw errors.InvalidConnection(this.host); 46 | } 47 | 48 | 49 | // check request.status 50 | // TODO: throw an error here! it cannot silently fail!!! 51 | //if (request.status !== 200) { 52 | //return; 53 | //} 54 | 55 | var result = request.responseText; 56 | 57 | try { 58 | result = JSON.parse(result); 59 | } catch(e) { 60 | throw errors.InvalidResponse(result); 61 | } 62 | 63 | return result; 64 | }; 65 | 66 | HttpProvider.prototype.sendAsync = function (payload, callback) { 67 | var request = new XMLHttpRequest(); 68 | request.onreadystatechange = function() { 69 | if (request.readyState === 4) { 70 | var result = request.responseText; 71 | var error = null; 72 | 73 | try { 74 | result = JSON.parse(result); 75 | } catch(e) { 76 | error = errors.InvalidResponse(result); 77 | } 78 | 79 | callback(error, result); 80 | } 81 | }; 82 | 83 | request.open('POST', this.host, true); 84 | request.setRequestHeader('Content-type','application/json'); 85 | 86 | try { 87 | request.send(JSON.stringify(payload)); 88 | } catch(error) { 89 | callback(errors.InvalidConnection(this.host)); 90 | } 91 | }; 92 | 93 | module.exports = HttpProvider; 94 | 95 | -------------------------------------------------------------------------------- /src/lib/web3/gulpfile.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | var version = require('./lib/version.json'); 6 | var path = require('path'); 7 | 8 | var del = require('del'); 9 | var gulp = require('gulp'); 10 | var browserify = require('browserify'); 11 | var jshint = require('gulp-jshint'); 12 | var uglify = require('gulp-uglify'); 13 | var rename = require('gulp-rename'); 14 | var source = require('vinyl-source-stream'); 15 | var exorcist = require('exorcist'); 16 | var bower = require('bower'); 17 | var streamify = require('gulp-streamify'); 18 | var replace = require('gulp-replace'); 19 | 20 | var DEST = path.join(__dirname, 'dist/'); 21 | var src = 'index'; 22 | var dst = 'web3'; 23 | var lightDst = 'web3-light'; 24 | 25 | var browserifyOptions = { 26 | debug: true, 27 | insert_global_vars: false, // jshint ignore:line 28 | detectGlobals: false, 29 | bundleExternal: true 30 | }; 31 | 32 | gulp.task('version', function(){ 33 | gulp.src(['./package.json']) 34 | .pipe(replace(/\"version\"\: \"(.{5})\"/, '"version": "'+ version.version + '"')) 35 | .pipe(gulp.dest('./')); 36 | gulp.src(['./bower.json']) 37 | .pipe(replace(/\"version\"\: \"(.{5})\"/, '"version": "'+ version.version + '"')) 38 | .pipe(gulp.dest('./')); 39 | gulp.src(['./package.js']) 40 | .pipe(replace(/version\: \'(.{5})\'/, "version: '"+ version.version + "'")) 41 | .pipe(gulp.dest('./')); 42 | }); 43 | 44 | gulp.task('bower', ['version'], function(cb){ 45 | bower.commands.install().on('end', function (installed){ 46 | console.log(installed); 47 | cb(); 48 | }); 49 | }); 50 | 51 | gulp.task('lint', ['bower'], function(){ 52 | return gulp.src(['./*.js', './lib/*.js']) 53 | .pipe(jshint()) 54 | .pipe(jshint.reporter('default')); 55 | }); 56 | 57 | gulp.task('clean', ['lint'], function(cb) { 58 | del([ DEST ], cb); 59 | }); 60 | 61 | gulp.task('light', ['clean'], function () { 62 | return browserify(browserifyOptions) 63 | .require('./' + src + '.js', {expose: 'web3'}) 64 | .ignore('bignumber.js') 65 | .require('./lib/utils/browser-bn.js', {expose: 'bignumber.js'}) // fake bignumber.js 66 | .add('./' + src + '.js') 67 | .bundle() 68 | .pipe(exorcist(path.join( DEST, lightDst + '.js.map'))) 69 | .pipe(source(lightDst + '.js')) 70 | .pipe(gulp.dest( DEST )) 71 | .pipe(streamify(uglify())) 72 | .pipe(rename(lightDst + '.min.js')) 73 | .pipe(gulp.dest( DEST )); 74 | }); 75 | 76 | gulp.task('standalone', ['clean'], function () { 77 | return browserify(browserifyOptions) 78 | .require('./' + src + '.js', {expose: 'web3'}) 79 | .require('bignumber.js') // expose it to dapp users 80 | .add('./' + src + '.js') 81 | .ignore('crypto') 82 | .bundle() 83 | .pipe(exorcist(path.join( DEST, dst + '.js.map'))) 84 | .pipe(source(dst + '.js')) 85 | .pipe(gulp.dest( DEST )) 86 | .pipe(streamify(uglify())) 87 | .pipe(rename(dst + '.min.js')) 88 | .pipe(gulp.dest( DEST )); 89 | }); 90 | 91 | gulp.task('watch', function() { 92 | gulp.watch(['./lib/*.js'], ['lint', 'build']); 93 | }); 94 | 95 | gulp.task('default', ['version', 'bower', 'lint', 'clean', 'light', 'standalone']); 96 | 97 | -------------------------------------------------------------------------------- /content/assets/css/content.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | margin: 0; 4 | padding: 0; 5 | font-family: monospace; 6 | overflow: auto; 7 | } 8 | a { 9 | color: blue; 10 | } 11 | a:visited { 12 | color: blue; 13 | } 14 | #branding { 15 | padding: 1em 1em 3em 2em; 16 | background-color: #c7c5ed; 17 | height: 6em; 18 | } 19 | #branding a { 20 | text-decoration: none; 21 | color: inherit; 22 | cursor: pointer; 23 | } 24 | #branding a h1 { 25 | line-height: 0.8em; 26 | } 27 | #branding a img { 28 | height: 4em; 29 | float: left; 30 | } 31 | #branding p { 32 | padding-left: 0.65em; 33 | } 34 | #links { 35 | float: right; 36 | overflow: auto; 37 | width: 10em; 38 | margin: 0; 39 | padding: 2em; 40 | } 41 | #tabs { 42 | background-color: #c7c5ed; 43 | border-bottom: 1px solid black; 44 | clear: left; 45 | margin: 0; 46 | padding: 0; 47 | list-style: none; 48 | overflow: auto; 49 | } 50 | #tabs li { 51 | float: left; 52 | padding: 0.4em 1em; 53 | border: 1px solid #000; 54 | margin: 0 0.5em; 55 | position: relative; 56 | overflow: visible; 57 | border-bottom: 0 none; 58 | background-color: rgba(255, 255, 255, 0.5); 59 | } 60 | #tabs li.selected { 61 | background-color: white; 62 | } 63 | #network { 64 | float: right; 65 | margin: 0; 66 | padding: 0; 67 | list-style: none; 68 | overflow: auto; 69 | margin-top: -2.1em; 70 | } 71 | #network li { 72 | float: left; 73 | padding: 0.4em 1em; 74 | border: 1px solid #000; 75 | margin: 0 0.5em; 76 | position: relative; 77 | overflow: visible; 78 | border-bottom: 0 none; 79 | background-color: white; 80 | border-bottom: 1px solid black; 81 | background-color: #9896BF; 82 | color: white; 83 | border: 0 none; 84 | } 85 | #network #eth-status, 86 | #network #ipfs-status { 87 | display: inline-block; 88 | height: 1em; 89 | width: 1em; 90 | border-radius: 0.5em; 91 | background-color: red; 92 | color: transparent; 93 | } 94 | #network #eth-status.connected, 95 | #network #ipfs-status.connected, 96 | #network #eth-status.connected, 97 | #network #ipfs-status.connected { 98 | background-color: orange; 99 | } 100 | #meta { 101 | padding: 1em; 102 | background-color: white; 103 | box-sizing: border-box; 104 | } 105 | #meta #postContent .title, 106 | #meta #postContent .content { 107 | display: block; 108 | width: 100%; 109 | margin-bottom: 1em; 110 | } 111 | #meta #postContent .content { 112 | height: 5em; 113 | } 114 | #content { 115 | margin: 0; 116 | box-sizing: border-box; 117 | list-style: none; 118 | padding: 0; 119 | } 120 | #content li { 121 | font-size: 1.2em; 122 | padding: 0.6em; 123 | border-bottom: 1px solid black; 124 | } 125 | #content li:before { 126 | content: attr(data-index); 127 | margin-right: 1em; 128 | font-size: 1.2em; 129 | color: rgba(0, 0, 0, 0.25); 130 | } 131 | #content li .title { 132 | margin-right: 1em; 133 | } 134 | #content li .content { 135 | font-weight: bold; 136 | text-decoration: none; 137 | font-size: 1.2em; 138 | } 139 | #content li .comments { 140 | font-size: 0.8em; 141 | text-decoration: none; 142 | } 143 | #content li .score { 144 | margin-right: 1em; 145 | } 146 | #content li .score a { 147 | text-decoration: none; 148 | } 149 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/watches.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** @file watches.js 18 | * @authors: 19 | * Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var Method = require('./method'); 24 | 25 | /// @returns an array of objects describing web3.eth.filter api methods 26 | var eth = function () { 27 | var newFilterCall = function (args) { 28 | var type = args[0]; 29 | 30 | switch(type) { 31 | case 'latest': 32 | args.shift(); 33 | this.params = 0; 34 | return 'eth_newBlockFilter'; 35 | case 'pending': 36 | args.shift(); 37 | this.params = 0; 38 | return 'eth_newPendingTransactionFilter'; 39 | default: 40 | return 'eth_newFilter'; 41 | } 42 | }; 43 | 44 | var newFilter = new Method({ 45 | name: 'newFilter', 46 | call: newFilterCall, 47 | params: 1 48 | }); 49 | 50 | var uninstallFilter = new Method({ 51 | name: 'uninstallFilter', 52 | call: 'eth_uninstallFilter', 53 | params: 1 54 | }); 55 | 56 | var getLogs = new Method({ 57 | name: 'getLogs', 58 | call: 'eth_getFilterLogs', 59 | params: 1 60 | }); 61 | 62 | var poll = new Method({ 63 | name: 'poll', 64 | call: 'eth_getFilterChanges', 65 | params: 1 66 | }); 67 | 68 | return [ 69 | newFilter, 70 | uninstallFilter, 71 | getLogs, 72 | poll 73 | ]; 74 | }; 75 | 76 | /// @returns an array of objects describing web3.shh.watch api methods 77 | var shh = function () { 78 | var newFilter = new Method({ 79 | name: 'newFilter', 80 | call: 'shh_newFilter', 81 | params: 1 82 | }); 83 | 84 | var uninstallFilter = new Method({ 85 | name: 'uninstallFilter', 86 | call: 'shh_uninstallFilter', 87 | params: 1 88 | }); 89 | 90 | var getLogs = new Method({ 91 | name: 'getLogs', 92 | call: 'shh_getMessages', 93 | params: 1 94 | }); 95 | 96 | var poll = new Method({ 97 | name: 'poll', 98 | call: 'shh_getFilterChanges', 99 | params: 1 100 | }); 101 | 102 | return [ 103 | newFilter, 104 | uninstallFilter, 105 | getLogs, 106 | poll 107 | ]; 108 | }; 109 | 110 | module.exports = { 111 | eth: eth, 112 | shh: shh 113 | }; 114 | 115 | -------------------------------------------------------------------------------- /src/lib/web3/example/event_inc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 76 | 77 | 78 | 79 |
80 |
81 | 82 |
83 |
84 | 85 |
86 |
87 |
88 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/ethereum.js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for ethereum.js/ 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for ethereum.js/

17 |

18 | Statements: 88.89% (8 / 9)      19 | Branches: 50% (2 / 4)      20 | Functions: 100% (0 / 0)      21 | Lines: 88.89% (8 / 9)      22 | Ignored: none      23 |

24 |
All files » ethereum.js/
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
FileStatementsBranchesFunctionsLines
index.js88.89%(8 / 9)50%(2 / 4)100%(0 / 0)88.89%(8 / 9)
58 |
59 |
60 | 63 | 64 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/lib/web3/bower/bignumber.js/perf/lib/bigdecimal_ICU4J/LICENCE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Daniel Trebbien and other contributors 2 | Portions Copyright (c) 2003 STZ-IDA and PTV AG, Karlsruhe, Germany 3 | Portions Copyright (c) 1995-2001 International Business Machines Corporation and others 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 10 | 11 | Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. 12 | 13 | 14 | 15 | ICU4J license - ICU4J 1.3.1 and later 16 | COPYRIGHT AND PERMISSION NOTICE 17 | 18 | Copyright (c) 1995-2001 International Business Machines Corporation and others 19 | 20 | All rights reserved. 21 | 22 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25 | 26 | Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. 27 | 28 | 29 | -------------------------------------------------------------------------------- 30 | All trademarks and registered trademarks mentioned herein are the property of their respective owners. -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/ethereum.js/lib/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for ethereum.js/lib/ 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for ethereum.js/lib/

17 |

18 | Statements: 92.41% (73 / 79)      19 | Branches: 93.75% (15 / 16)      20 | Functions: 78.57% (11 / 14)      21 | Lines: 92.41% (73 / 79)      22 | Ignored: none      23 |

24 |
All files » ethereum.js/lib/
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
FileStatementsBranchesFunctionsLines
web3.js92.41%(73 / 79)93.75%(15 / 16)78.57%(11 / 14)92.41%(73 / 79)
58 |
59 |
60 | 63 | 64 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/ethereum.js/index.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for ethereum.js/index.js 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for ethereum.js/index.js

17 |

18 | Statements: 88.89% (8 / 9)      19 | Branches: 50% (2 / 4)      20 | Functions: 100% (0 / 0)      21 | Lines: 88.89% (8 / 9)      22 | Ignored: none      23 |

24 |
All files » ethereum.js/ » index.js
25 |
26 |
27 |

28 | 
71 | 
1 29 | 2 30 | 3 31 | 4 32 | 5 33 | 6 34 | 7 35 | 8 36 | 9 37 | 10 38 | 11 39 | 12 40 | 13 41 | 14 42 | 151 43 | 1 44 | 1 45 | 1 46 | 1 47 | 1 48 |   49 |   50 | 1 51 |   52 |   53 |   54 | 1 55 |   56 |  
var web3 = require('./lib/web3');
57 | web3.providers.HttpProvider = require('./lib/web3/httpprovider');
58 | web3.providers.QtSyncProvider = require('./lib/web3/qtsync');
59 | web3.eth.contract = require('./lib/web3/contract');
60 | web3.eth.namereg = require('./lib/web3/namereg');
61 | web3.eth.sendIBANTransaction = require('./lib/web3/transfer');
62 |  
63 | // dont override global variable
64 | Iif (typeof window !== 'undefined' && typeof window.web3 === 'undefined') {
65 |     window.web3 = web3;
66 | }
67 |  
68 | module.exports = web3;
69 |  
70 |  
72 | 73 |
74 | 77 | 78 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/property.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file property.js 19 | * @author Fabian Vogelsteller 20 | * @author Marek Kotewicz 21 | * @date 2015 22 | */ 23 | 24 | var RequestManager = require('./requestmanager'); 25 | 26 | var Property = function (options) { 27 | this.name = options.name; 28 | this.getter = options.getter; 29 | this.setter = options.setter; 30 | this.outputFormatter = options.outputFormatter; 31 | this.inputFormatter = options.inputFormatter; 32 | }; 33 | 34 | /** 35 | * Should be called to format input args of method 36 | * 37 | * @method formatInput 38 | * @param {Array} 39 | * @return {Array} 40 | */ 41 | Property.prototype.formatInput = function (arg) { 42 | return this.inputFormatter ? this.inputFormatter(arg) : arg; 43 | }; 44 | 45 | /** 46 | * Should be called to format output(result) of method 47 | * 48 | * @method formatOutput 49 | * @param {Object} 50 | * @return {Object} 51 | */ 52 | Property.prototype.formatOutput = function (result) { 53 | return this.outputFormatter && result !== null ? this.outputFormatter(result) : result; 54 | }; 55 | 56 | /** 57 | * Should attach function to method 58 | * 59 | * @method attachToObject 60 | * @param {Object} 61 | * @param {Function} 62 | */ 63 | Property.prototype.attachToObject = function (obj) { 64 | var proto = { 65 | get: this.get.bind(this), 66 | }; 67 | 68 | var names = this.name.split('.'); 69 | var name = names[0]; 70 | if (names.length > 1) { 71 | obj[names[0]] = obj[names[0]] || {}; 72 | obj = obj[names[0]]; 73 | name = names[1]; 74 | } 75 | 76 | Object.defineProperty(obj, name, proto); 77 | 78 | var toAsyncName = function (prefix, name) { 79 | return prefix + name.charAt(0).toUpperCase() + name.slice(1); 80 | }; 81 | 82 | obj[toAsyncName('get', name)] = this.getAsync.bind(this); 83 | }; 84 | 85 | /** 86 | * Should be used to get value of the property 87 | * 88 | * @method get 89 | * @return {Object} value of the property 90 | */ 91 | Property.prototype.get = function () { 92 | return this.formatOutput(RequestManager.getInstance().send({ 93 | method: this.getter 94 | })); 95 | }; 96 | 97 | /** 98 | * Should be used to asynchrounously get value of property 99 | * 100 | * @method getAsync 101 | * @param {Function} 102 | */ 103 | Property.prototype.getAsync = function (callback) { 104 | var self = this; 105 | RequestManager.getInstance().sendAsync({ 106 | method: this.getter 107 | }, function (err, result) { 108 | if (err) { 109 | return callback(err); 110 | } 111 | callback(err, self.formatOutput(result)); 112 | }); 113 | }; 114 | 115 | module.exports = Property; 116 | 117 | -------------------------------------------------------------------------------- /src/lib/web3/README.md: -------------------------------------------------------------------------------- 1 | # Ethereum JavaScript API 2 | 3 | [![Join the chat at https://gitter.im/ethereum/web3.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/web3.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 4 | 5 | This is the Ethereum compatible [JavaScript API](https://github.com/ethereum/wiki/wiki/JavaScript-API) 6 | which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC) spec. It's available on npm as a node module, for bower and component as an embeddable js and as a meteor.js package. 7 | 8 | [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url][![Coverage Status][coveralls-image]][coveralls-url][![Stories in Ready][waffle-image]][waffle-url] 9 | 10 | 11 | 12 | You need to run a local ethrereum node to use this library. 13 | 14 | [Documentation](https://github.com/ethereum/wiki/wiki/JavaScript-API) 15 | 16 | ## Installation 17 | 18 | ### Node.js 19 | 20 | $ npm install web3 21 | 22 | ### Meteor.js 23 | 24 | $ meteor add ethereum:web3 25 | 26 | ### As Browser module 27 | Bower 28 | 29 | $ bower install web3 30 | 31 | Component 32 | 33 | $ component install ethereum/web3.js 34 | 35 | * Include `ethereum.min.js` in your html file. (not required for the meteor package) 36 | * Include [bignumber.js](https://github.com/MikeMcl/bignumber.js/) (not required for the meteor package) 37 | 38 | ## Usage 39 | Use the `web3` object directly from global namespace: 40 | 41 | console.log(web3); // {eth: .., shh: ...} // it's here! 42 | 43 | Set a provider (QtSyncProvider, HttpProvider) 44 | 45 | web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545')); 46 | 47 | There you go, now you can use it: 48 | 49 | ``` 50 | var coinbase = web3.eth.coinbase; 51 | var balance = web3.eth.getBalance(coinbase); 52 | ``` 53 | 54 | 55 | For another example see `example/index.html`. 56 | 57 | 58 | ## Contribute! 59 | 60 | ### Requirements 61 | 62 | * Node.js 63 | * npm 64 | 65 | ```bash 66 | sudo apt-get update 67 | sudo apt-get install nodejs 68 | sudo apt-get install npm 69 | sudo apt-get install nodejs-legacy 70 | ``` 71 | 72 | ### Building (gulp) 73 | 74 | ```bash 75 | npm run-script build 76 | ``` 77 | 78 | 79 | ### Testing (mocha) 80 | 81 | ```bash 82 | npm test 83 | ``` 84 | 85 | ### Testing (karma) 86 | Karma allows testing within one or several browsers. 87 | 88 | ```bash 89 | npm run-script karma # default browsers are Chrome and Firefox 90 | npm run-script karma -- --browsers="Chrome,Safari" # custom browsers 91 | ``` 92 | 93 | 94 | **Please note this repo is in it's early stage.** 95 | 96 | If you'd like to run a Http ethereum node check out 97 | [cpp-ethereum](https://github.com/ethereum/cpp-ethereum). 98 | 99 | Install ethereum and spawn a node: 100 | 101 | ``` 102 | eth -j 103 | ``` 104 | 105 | [npm-image]: https://badge.fury.io/js/web3.png 106 | [npm-url]: https://npmjs.org/package/web3 107 | [travis-image]: https://travis-ci.org/ethereum/web3.js.svg 108 | [travis-url]: https://travis-ci.org/ethereum/web3.js 109 | [dep-image]: https://david-dm.org/ethereum/web3.js.svg 110 | [dep-url]: https://david-dm.org/ethereum/web3.js 111 | [dep-dev-image]: https://david-dm.org/ethereum/web3.js/dev-status.svg 112 | [dep-dev-url]: https://david-dm.org/ethereum/web3.js#info=devDependencies 113 | [coveralls-image]: https://coveralls.io/repos/ethereum/web3.js/badge.svg?branch=master 114 | [coveralls-url]: https://coveralls.io/r/ethereum/web3.js?branch=master 115 | [waffle-image]: https://badge.waffle.io/ethereum/web3.js.svg?label=ready&title=Ready 116 | [waffle-url]: http://waffle.io/ethereum/web3.js 117 | 118 | -------------------------------------------------------------------------------- /content/assets/css/content.less: -------------------------------------------------------------------------------- 1 | @import 'colors'; 2 | 3 | html, body { 4 | margin: 0; 5 | padding: 0; 6 | font-family: monospace; 7 | overflow: auto; 8 | } 9 | 10 | a { 11 | color: @text-color-cta; 12 | 13 | &:visited { 14 | color: @text-color-cta; 15 | } 16 | } 17 | 18 | #branding { 19 | padding: 1em 1em 3em 2em; 20 | background-color: @bg-color; 21 | height: 6em; 22 | 23 | a { 24 | text-decoration: none; 25 | color: inherit; 26 | cursor: pointer; 27 | 28 | h1 { 29 | line-height: 0.8em; 30 | } 31 | 32 | img { 33 | height: 4em; 34 | float: left; 35 | } 36 | } 37 | 38 | p { 39 | padding-left: 0.65em; 40 | } 41 | } 42 | 43 | 44 | #links { 45 | float: right; 46 | overflow: auto; 47 | width: 10em; 48 | margin: 0; 49 | padding: 2em; 50 | } 51 | 52 | 53 | 54 | #tabs { 55 | background-color: @bg-color; 56 | border-bottom: 1px solid black; 57 | clear: left; 58 | margin: 0; 59 | padding: 0; 60 | list-style: none; 61 | overflow: auto; 62 | 63 | li { 64 | float: left; 65 | padding: 0.4em 1em; 66 | border: 1px solid #000; 67 | margin: 0 0.5em; 68 | position: relative; 69 | overflow: visible; 70 | border-bottom: 0 none; 71 | background-color: rgba(255,255,255, 0.5); 72 | 73 | &.selected { 74 | background-color: white; 75 | } 76 | } 77 | } 78 | 79 | 80 | 81 | 82 | 83 | #network { 84 | float: right; 85 | margin: 0; 86 | padding: 0; 87 | list-style: none; 88 | overflow: auto; 89 | margin-top: -2.1em; 90 | 91 | li { 92 | float: left; 93 | padding: 0.4em 1em; 94 | border: 1px solid #000; 95 | margin: 0 0.5em; 96 | position: relative; 97 | overflow: visible; 98 | border-bottom: 0 none; 99 | background-color: white; 100 | border-bottom: 1px solid black; 101 | background-color: #9896BF; 102 | color: white; 103 | border: 0 none; 104 | } 105 | 106 | #eth-status, 107 | #ipfs-status { 108 | display: inline-block; 109 | height: 1em; 110 | width: 1em; 111 | border-radius: 0.5em; 112 | background-color: red; 113 | color: transparent; 114 | 115 | &.connected, 116 | &.connected { 117 | background-color: orange; 118 | } 119 | } 120 | } 121 | 122 | #meta { 123 | padding: 1em; 124 | background-color: white; 125 | box-sizing: border-box; 126 | 127 | #postContent { 128 | .title, 129 | .content { 130 | display: block; 131 | width: 100%; 132 | margin-bottom: 1em; 133 | } 134 | 135 | .content { 136 | height: 5em; 137 | } 138 | } 139 | } 140 | 141 | 142 | 143 | 144 | #content { 145 | margin: 0; 146 | box-sizing: border-box; 147 | list-style: none; 148 | padding: 0; 149 | 150 | li { 151 | font-size: 1.2em; 152 | padding: 0.6em; 153 | border-bottom: 1px solid black; 154 | 155 | &:before { 156 | content: attr(data-index); 157 | margin-right: 1em; 158 | font-size: 1.2em; 159 | color: rgba(0,0,0,0.25); 160 | } 161 | 162 | .title { 163 | margin-right: 1em; 164 | } 165 | 166 | .content { 167 | font-weight: bold; 168 | text-decoration: none; 169 | font-size: 1.2em; 170 | } 171 | 172 | .comments { 173 | font-size: 0.8em; 174 | text-decoration: none; 175 | } 176 | 177 | .score { 178 | margin-right: 1em; 179 | 180 | a { 181 | text-decoration: none; 182 | } 183 | } 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/enc-base64.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var WordArray = C_lib.WordArray; 21 | var C_enc = C.enc; 22 | 23 | /** 24 | * Base64 encoding strategy. 25 | */ 26 | var Base64 = C_enc.Base64 = { 27 | /** 28 | * Converts a word array to a Base64 string. 29 | * 30 | * @param {WordArray} wordArray The word array. 31 | * 32 | * @return {string} The Base64 string. 33 | * 34 | * @static 35 | * 36 | * @example 37 | * 38 | * var base64String = CryptoJS.enc.Base64.stringify(wordArray); 39 | */ 40 | stringify: function (wordArray) { 41 | // Shortcuts 42 | var words = wordArray.words; 43 | var sigBytes = wordArray.sigBytes; 44 | var map = this._map; 45 | 46 | // Clamp excess bits 47 | wordArray.clamp(); 48 | 49 | // Convert 50 | var base64Chars = []; 51 | for (var i = 0; i < sigBytes; i += 3) { 52 | var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; 53 | var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; 54 | var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; 55 | 56 | var triplet = (byte1 << 16) | (byte2 << 8) | byte3; 57 | 58 | for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { 59 | base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); 60 | } 61 | } 62 | 63 | // Add padding 64 | var paddingChar = map.charAt(64); 65 | if (paddingChar) { 66 | while (base64Chars.length % 4) { 67 | base64Chars.push(paddingChar); 68 | } 69 | } 70 | 71 | return base64Chars.join(''); 72 | }, 73 | 74 | /** 75 | * Converts a Base64 string to a word array. 76 | * 77 | * @param {string} base64Str The Base64 string. 78 | * 79 | * @return {WordArray} The word array. 80 | * 81 | * @static 82 | * 83 | * @example 84 | * 85 | * var wordArray = CryptoJS.enc.Base64.parse(base64String); 86 | */ 87 | parse: function (base64Str) { 88 | // Shortcuts 89 | var base64StrLength = base64Str.length; 90 | var map = this._map; 91 | 92 | // Ignore padding 93 | var paddingChar = map.charAt(64); 94 | if (paddingChar) { 95 | var paddingIndex = base64Str.indexOf(paddingChar); 96 | if (paddingIndex != -1) { 97 | base64StrLength = paddingIndex; 98 | } 99 | } 100 | 101 | // Convert 102 | var words = []; 103 | var nBytes = 0; 104 | for (var i = 0; i < base64StrLength; i++) { 105 | if (i % 4) { 106 | var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2); 107 | var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2); 108 | words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); 109 | nBytes++; 110 | } 111 | } 112 | 113 | return WordArray.create(words, nBytes); 114 | }, 115 | 116 | _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' 117 | }; 118 | }()); 119 | 120 | 121 | return CryptoJS.enc.Base64; 122 | 123 | })); -------------------------------------------------------------------------------- /src/lib/web3/example/namereg.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 62 | 63 | 64 | This example shows only part of namereg functionalities. Namereg contract is available here 65 | 66 |

Namereg

67 |

Search for name

68 |
69 | Address: 70 | 71 | Name: 72 | 73 |
74 |

Search for address

75 |
76 | Name: 77 | 78 | Address: 79 | 80 |
81 |

Register name

82 |
83 | Check if name is available: 84 | 85 | 86 |
87 |
88 | 89 |
90 |

91 | If you own the name, you can also change the address it points to 92 |
93 | Address: 94 | 95 | 96 | Current address : 97 | 98 |
99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/rc4.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var StreamCipher = C_lib.StreamCipher; 21 | var C_algo = C.algo; 22 | 23 | /** 24 | * RC4 stream cipher algorithm. 25 | */ 26 | var RC4 = C_algo.RC4 = StreamCipher.extend({ 27 | _doReset: function () { 28 | // Shortcuts 29 | var key = this._key; 30 | var keyWords = key.words; 31 | var keySigBytes = key.sigBytes; 32 | 33 | // Init sbox 34 | var S = this._S = []; 35 | for (var i = 0; i < 256; i++) { 36 | S[i] = i; 37 | } 38 | 39 | // Key setup 40 | for (var i = 0, j = 0; i < 256; i++) { 41 | var keyByteIndex = i % keySigBytes; 42 | var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; 43 | 44 | j = (j + S[i] + keyByte) % 256; 45 | 46 | // Swap 47 | var t = S[i]; 48 | S[i] = S[j]; 49 | S[j] = t; 50 | } 51 | 52 | // Counters 53 | this._i = this._j = 0; 54 | }, 55 | 56 | _doProcessBlock: function (M, offset) { 57 | M[offset] ^= generateKeystreamWord.call(this); 58 | }, 59 | 60 | keySize: 256/32, 61 | 62 | ivSize: 0 63 | }); 64 | 65 | function generateKeystreamWord() { 66 | // Shortcuts 67 | var S = this._S; 68 | var i = this._i; 69 | var j = this._j; 70 | 71 | // Generate keystream word 72 | var keystreamWord = 0; 73 | for (var n = 0; n < 4; n++) { 74 | i = (i + 1) % 256; 75 | j = (j + S[i]) % 256; 76 | 77 | // Swap 78 | var t = S[i]; 79 | S[i] = S[j]; 80 | S[j] = t; 81 | 82 | keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); 83 | } 84 | 85 | // Update counters 86 | this._i = i; 87 | this._j = j; 88 | 89 | return keystreamWord; 90 | } 91 | 92 | /** 93 | * Shortcut functions to the cipher's object interface. 94 | * 95 | * @example 96 | * 97 | * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); 98 | * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); 99 | */ 100 | C.RC4 = StreamCipher._createHelper(RC4); 101 | 102 | /** 103 | * Modified RC4 stream cipher algorithm. 104 | */ 105 | var RC4Drop = C_algo.RC4Drop = RC4.extend({ 106 | /** 107 | * Configuration options. 108 | * 109 | * @property {number} drop The number of keystream words to drop. Default 192 110 | */ 111 | cfg: RC4.cfg.extend({ 112 | drop: 192 113 | }), 114 | 115 | _doReset: function () { 116 | RC4._doReset.call(this); 117 | 118 | // Drop 119 | for (var i = this.cfg.drop; i > 0; i--) { 120 | generateKeystreamWord.call(this); 121 | } 122 | } 123 | }); 124 | 125 | /** 126 | * Shortcut functions to the cipher's object interface. 127 | * 128 | * @example 129 | * 130 | * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); 131 | * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); 132 | */ 133 | C.RC4Drop = StreamCipher._createHelper(RC4Drop); 134 | }()); 135 | 136 | 137 | return CryptoJS.RC4; 138 | 139 | })); -------------------------------------------------------------------------------- /content/assets/js/content.coffee: -------------------------------------------------------------------------------- 1 | $ -> 2 | 3 | CONTENT_CHANNEL = '/content' 4 | $content = $ '#content' 5 | ethHost = 'localhost' 6 | ethPort = 8545 7 | 8 | console.log("content init") 9 | 10 | refreshPosts = (newRoot) -> 11 | path = 'posts/' 12 | if newRoot 13 | path = '/ipfs/' + newRoot + '/' + path 14 | 15 | $.getJSON path + 'index.json', (posts, status, xhr) -> 16 | $('#content .loading').remove() 17 | console.log( "Loaded posts:", posts ) 18 | posts.map (post, index) -> 19 | $el = $("##{ post }") 20 | $content.append( buildPost( path, post, index, $el ) ) 21 | 22 | buildPost = ( path, post, index, $el ) -> 23 | $post = if $el.length 24 | $el 25 | else 26 | $( $('#post-template').html() ) 27 | 28 | $post.attr( 'data-index', index ) 29 | $post.attr( 'id', post ) 30 | 31 | getContent path + post + '/title', ( err, title) -> 32 | $post.find( '.title' ).html( title ) 33 | 34 | # link 35 | getContent path + post + '/content', ( err, content) -> 36 | isHttp = /^https?:\/\// 37 | if isHttp.test( content ) 38 | $post.find( '.content' ).attr( 'href', content ) 39 | else 40 | $post.find( '.content' ).attr( 'href', '/ipfs/' + post ) 41 | 42 | getContent path + post + '/index.json', ( err, comments) -> 43 | $post.find( '.comment-count' ).html( comments.length ) 44 | $post.find( '.comment' ).attr( 'href', post ) 45 | 46 | $post unless $el.length 47 | 48 | getContent = (url, cb) -> 49 | $.get url, (responseText, status, xhr) -> 50 | cb( !responseText, responseText ) 51 | 52 | 53 | 54 | config = null 55 | $config = $('
') 56 | $config.load 'config', -> 57 | console.log("Config request response: ", arguments ) 58 | try 59 | config = JSON.parse( $config.text() ) 60 | if config.defaults 61 | ethHost = config.defaults.eth_host 62 | ethPort = config.defaults.eth_port 63 | CONTENT_CHANNEL = config.defaults.shh_channel 64 | $('#ipfs-status').addClass('connected') 65 | catch err 66 | console.log( "Unable to parse config" ) 67 | 68 | 69 | web3.setProvider( new web3.providers.HttpProvider( "http://" + ethHost + ":" + ethPort ) ) 70 | try 71 | identity = web3.shh.newIdentity() 72 | messageFilter = web3.shh.filter( { topics: [CONTENT_CHANNEL] } ) 73 | $('#eth-status').addClass('connected') 74 | 75 | messageFilter.watch (err,msg) -> 76 | if !err and msg 77 | console.log( "Message: ", JSON.stringify( msg ) ) 78 | if !err and msg?.payload?.root 79 | console.log( "Received root hash update: ", msg ) 80 | refreshPosts( msg.payload.root ) 81 | catch err 82 | console.log err 83 | 84 | refreshPosts( null ) 85 | 86 | $('#createPost').click -> 87 | $('#postContent').html( $("#postContent-template").html() ) 88 | $('#postContent .submit').click -> 89 | 90 | content = $('#postContent .content').val() 91 | title = $('#postContent .title').val() 92 | 93 | web3.shh.post 94 | from: identity 95 | topics: [CONTENT_CHANNEL] 96 | payload: JSON.stringify 97 | from: identity 98 | content: content 99 | title: title 100 | 101 | console.log( "posted content to whisper channel" ) 102 | $('#postContent').empty() 103 | 104 | $(document.body).on 'click', '.post a', (ev) -> 105 | ev.preventDefault() 106 | $el = $(this) 107 | $post = $el.closest('.post') 108 | 109 | if $el.hasClass('comment') 110 | web3.shh.post 111 | from: identity 112 | topics: [CONTENT_CHANNEL] 113 | payload: JSON.stringify 114 | from: identity 115 | parent: $post.attr( 'id' ) 116 | content: "A comment!!" 117 | 118 | console.log( $el ) 119 | false 120 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/evpkdf.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha1", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var Base = C_lib.Base; 21 | var WordArray = C_lib.WordArray; 22 | var C_algo = C.algo; 23 | var MD5 = C_algo.MD5; 24 | 25 | /** 26 | * This key derivation function is meant to conform with EVP_BytesToKey. 27 | * www.openssl.org/docs/crypto/EVP_BytesToKey.html 28 | */ 29 | var EvpKDF = C_algo.EvpKDF = Base.extend({ 30 | /** 31 | * Configuration options. 32 | * 33 | * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) 34 | * @property {Hasher} hasher The hash algorithm to use. Default: MD5 35 | * @property {number} iterations The number of iterations to perform. Default: 1 36 | */ 37 | cfg: Base.extend({ 38 | keySize: 128/32, 39 | hasher: MD5, 40 | iterations: 1 41 | }), 42 | 43 | /** 44 | * Initializes a newly created key derivation function. 45 | * 46 | * @param {Object} cfg (Optional) The configuration options to use for the derivation. 47 | * 48 | * @example 49 | * 50 | * var kdf = CryptoJS.algo.EvpKDF.create(); 51 | * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); 52 | * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); 53 | */ 54 | init: function (cfg) { 55 | this.cfg = this.cfg.extend(cfg); 56 | }, 57 | 58 | /** 59 | * Derives a key from a password. 60 | * 61 | * @param {WordArray|string} password The password. 62 | * @param {WordArray|string} salt A salt. 63 | * 64 | * @return {WordArray} The derived key. 65 | * 66 | * @example 67 | * 68 | * var key = kdf.compute(password, salt); 69 | */ 70 | compute: function (password, salt) { 71 | // Shortcut 72 | var cfg = this.cfg; 73 | 74 | // Init hasher 75 | var hasher = cfg.hasher.create(); 76 | 77 | // Initial values 78 | var derivedKey = WordArray.create(); 79 | 80 | // Shortcuts 81 | var derivedKeyWords = derivedKey.words; 82 | var keySize = cfg.keySize; 83 | var iterations = cfg.iterations; 84 | 85 | // Generate key 86 | while (derivedKeyWords.length < keySize) { 87 | if (block) { 88 | hasher.update(block); 89 | } 90 | var block = hasher.update(password).finalize(salt); 91 | hasher.reset(); 92 | 93 | // Iterations 94 | for (var i = 1; i < iterations; i++) { 95 | block = hasher.finalize(block); 96 | hasher.reset(); 97 | } 98 | 99 | derivedKey.concat(block); 100 | } 101 | derivedKey.sigBytes = keySize * 4; 102 | 103 | return derivedKey; 104 | } 105 | }); 106 | 107 | /** 108 | * Derives a key from a password. 109 | * 110 | * @param {WordArray|string} password The password. 111 | * @param {WordArray|string} salt A salt. 112 | * @param {Object} cfg (Optional) The configuration options to use for this computation. 113 | * 114 | * @return {WordArray} The derived key. 115 | * 116 | * @static 117 | * 118 | * @example 119 | * 120 | * var key = CryptoJS.EvpKDF(password, salt); 121 | * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); 122 | * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); 123 | */ 124 | C.EvpKDF = function (password, salt, cfg) { 125 | return EvpKDF.create(cfg).compute(password, salt); 126 | }; 127 | }()); 128 | 129 | 130 | return CryptoJS.EvpKDF; 131 | 132 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/hmac.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var Base = C_lib.Base; 21 | var C_enc = C.enc; 22 | var Utf8 = C_enc.Utf8; 23 | var C_algo = C.algo; 24 | 25 | /** 26 | * HMAC algorithm. 27 | */ 28 | var HMAC = C_algo.HMAC = Base.extend({ 29 | /** 30 | * Initializes a newly created HMAC. 31 | * 32 | * @param {Hasher} hasher The hash algorithm to use. 33 | * @param {WordArray|string} key The secret key. 34 | * 35 | * @example 36 | * 37 | * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); 38 | */ 39 | init: function (hasher, key) { 40 | // Init hasher 41 | hasher = this._hasher = new hasher.init(); 42 | 43 | // Convert string to WordArray, else assume WordArray already 44 | if (typeof key == 'string') { 45 | key = Utf8.parse(key); 46 | } 47 | 48 | // Shortcuts 49 | var hasherBlockSize = hasher.blockSize; 50 | var hasherBlockSizeBytes = hasherBlockSize * 4; 51 | 52 | // Allow arbitrary length keys 53 | if (key.sigBytes > hasherBlockSizeBytes) { 54 | key = hasher.finalize(key); 55 | } 56 | 57 | // Clamp excess bits 58 | key.clamp(); 59 | 60 | // Clone key for inner and outer pads 61 | var oKey = this._oKey = key.clone(); 62 | var iKey = this._iKey = key.clone(); 63 | 64 | // Shortcuts 65 | var oKeyWords = oKey.words; 66 | var iKeyWords = iKey.words; 67 | 68 | // XOR keys with pad constants 69 | for (var i = 0; i < hasherBlockSize; i++) { 70 | oKeyWords[i] ^= 0x5c5c5c5c; 71 | iKeyWords[i] ^= 0x36363636; 72 | } 73 | oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; 74 | 75 | // Set initial values 76 | this.reset(); 77 | }, 78 | 79 | /** 80 | * Resets this HMAC to its initial state. 81 | * 82 | * @example 83 | * 84 | * hmacHasher.reset(); 85 | */ 86 | reset: function () { 87 | // Shortcut 88 | var hasher = this._hasher; 89 | 90 | // Reset 91 | hasher.reset(); 92 | hasher.update(this._iKey); 93 | }, 94 | 95 | /** 96 | * Updates this HMAC with a message. 97 | * 98 | * @param {WordArray|string} messageUpdate The message to append. 99 | * 100 | * @return {HMAC} This HMAC instance. 101 | * 102 | * @example 103 | * 104 | * hmacHasher.update('message'); 105 | * hmacHasher.update(wordArray); 106 | */ 107 | update: function (messageUpdate) { 108 | this._hasher.update(messageUpdate); 109 | 110 | // Chainable 111 | return this; 112 | }, 113 | 114 | /** 115 | * Finalizes the HMAC computation. 116 | * Note that the finalize operation is effectively a destructive, read-once operation. 117 | * 118 | * @param {WordArray|string} messageUpdate (Optional) A final message update. 119 | * 120 | * @return {WordArray} The HMAC. 121 | * 122 | * @example 123 | * 124 | * var hmac = hmacHasher.finalize(); 125 | * var hmac = hmacHasher.finalize('message'); 126 | * var hmac = hmacHasher.finalize(wordArray); 127 | */ 128 | finalize: function (messageUpdate) { 129 | // Shortcut 130 | var hasher = this._hasher; 131 | 132 | // Compute HMAC 133 | var innerHash = hasher.finalize(messageUpdate); 134 | hasher.reset(); 135 | var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); 136 | 137 | return hmac; 138 | } 139 | }); 140 | }()); 141 | 142 | 143 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/sha1.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var WordArray = C_lib.WordArray; 21 | var Hasher = C_lib.Hasher; 22 | var C_algo = C.algo; 23 | 24 | // Reusable object 25 | var W = []; 26 | 27 | /** 28 | * SHA-1 hash algorithm. 29 | */ 30 | var SHA1 = C_algo.SHA1 = Hasher.extend({ 31 | _doReset: function () { 32 | this._hash = new WordArray.init([ 33 | 0x67452301, 0xefcdab89, 34 | 0x98badcfe, 0x10325476, 35 | 0xc3d2e1f0 36 | ]); 37 | }, 38 | 39 | _doProcessBlock: function (M, offset) { 40 | // Shortcut 41 | var H = this._hash.words; 42 | 43 | // Working variables 44 | var a = H[0]; 45 | var b = H[1]; 46 | var c = H[2]; 47 | var d = H[3]; 48 | var e = H[4]; 49 | 50 | // Computation 51 | for (var i = 0; i < 80; i++) { 52 | if (i < 16) { 53 | W[i] = M[offset + i] | 0; 54 | } else { 55 | var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; 56 | W[i] = (n << 1) | (n >>> 31); 57 | } 58 | 59 | var t = ((a << 5) | (a >>> 27)) + e + W[i]; 60 | if (i < 20) { 61 | t += ((b & c) | (~b & d)) + 0x5a827999; 62 | } else if (i < 40) { 63 | t += (b ^ c ^ d) + 0x6ed9eba1; 64 | } else if (i < 60) { 65 | t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; 66 | } else /* if (i < 80) */ { 67 | t += (b ^ c ^ d) - 0x359d3e2a; 68 | } 69 | 70 | e = d; 71 | d = c; 72 | c = (b << 30) | (b >>> 2); 73 | b = a; 74 | a = t; 75 | } 76 | 77 | // Intermediate hash value 78 | H[0] = (H[0] + a) | 0; 79 | H[1] = (H[1] + b) | 0; 80 | H[2] = (H[2] + c) | 0; 81 | H[3] = (H[3] + d) | 0; 82 | H[4] = (H[4] + e) | 0; 83 | }, 84 | 85 | _doFinalize: function () { 86 | // Shortcuts 87 | var data = this._data; 88 | var dataWords = data.words; 89 | 90 | var nBitsTotal = this._nDataBytes * 8; 91 | var nBitsLeft = data.sigBytes * 8; 92 | 93 | // Add padding 94 | dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 95 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); 96 | dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; 97 | data.sigBytes = dataWords.length * 4; 98 | 99 | // Hash final blocks 100 | this._process(); 101 | 102 | // Return final computed hash 103 | return this._hash; 104 | }, 105 | 106 | clone: function () { 107 | var clone = Hasher.clone.call(this); 108 | clone._hash = this._hash.clone(); 109 | 110 | return clone; 111 | } 112 | }); 113 | 114 | /** 115 | * Shortcut function to the hasher's object interface. 116 | * 117 | * @param {WordArray|string} message The message to hash. 118 | * 119 | * @return {WordArray} The hash. 120 | * 121 | * @static 122 | * 123 | * @example 124 | * 125 | * var hash = CryptoJS.SHA1('message'); 126 | * var hash = CryptoJS.SHA1(wordArray); 127 | */ 128 | C.SHA1 = Hasher._createHelper(SHA1); 129 | 130 | /** 131 | * Shortcut function to the HMAC's object interface. 132 | * 133 | * @param {WordArray|string} message The message to hash. 134 | * @param {WordArray|string} key The secret key. 135 | * 136 | * @return {WordArray} The HMAC. 137 | * 138 | * @static 139 | * 140 | * @example 141 | * 142 | * var hmac = CryptoJS.HmacSHA1(message, key); 143 | */ 144 | C.HmacSHA1 = Hasher._createHmacHelper(SHA1); 145 | }()); 146 | 147 | 148 | return CryptoJS.SHA1; 149 | 150 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/enc-utf16.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var WordArray = C_lib.WordArray; 21 | var C_enc = C.enc; 22 | 23 | /** 24 | * UTF-16 BE encoding strategy. 25 | */ 26 | var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { 27 | /** 28 | * Converts a word array to a UTF-16 BE string. 29 | * 30 | * @param {WordArray} wordArray The word array. 31 | * 32 | * @return {string} The UTF-16 BE string. 33 | * 34 | * @static 35 | * 36 | * @example 37 | * 38 | * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); 39 | */ 40 | stringify: function (wordArray) { 41 | // Shortcuts 42 | var words = wordArray.words; 43 | var sigBytes = wordArray.sigBytes; 44 | 45 | // Convert 46 | var utf16Chars = []; 47 | for (var i = 0; i < sigBytes; i += 2) { 48 | var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; 49 | utf16Chars.push(String.fromCharCode(codePoint)); 50 | } 51 | 52 | return utf16Chars.join(''); 53 | }, 54 | 55 | /** 56 | * Converts a UTF-16 BE string to a word array. 57 | * 58 | * @param {string} utf16Str The UTF-16 BE string. 59 | * 60 | * @return {WordArray} The word array. 61 | * 62 | * @static 63 | * 64 | * @example 65 | * 66 | * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); 67 | */ 68 | parse: function (utf16Str) { 69 | // Shortcut 70 | var utf16StrLength = utf16Str.length; 71 | 72 | // Convert 73 | var words = []; 74 | for (var i = 0; i < utf16StrLength; i++) { 75 | words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); 76 | } 77 | 78 | return WordArray.create(words, utf16StrLength * 2); 79 | } 80 | }; 81 | 82 | /** 83 | * UTF-16 LE encoding strategy. 84 | */ 85 | C_enc.Utf16LE = { 86 | /** 87 | * Converts a word array to a UTF-16 LE string. 88 | * 89 | * @param {WordArray} wordArray The word array. 90 | * 91 | * @return {string} The UTF-16 LE string. 92 | * 93 | * @static 94 | * 95 | * @example 96 | * 97 | * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); 98 | */ 99 | stringify: function (wordArray) { 100 | // Shortcuts 101 | var words = wordArray.words; 102 | var sigBytes = wordArray.sigBytes; 103 | 104 | // Convert 105 | var utf16Chars = []; 106 | for (var i = 0; i < sigBytes; i += 2) { 107 | var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); 108 | utf16Chars.push(String.fromCharCode(codePoint)); 109 | } 110 | 111 | return utf16Chars.join(''); 112 | }, 113 | 114 | /** 115 | * Converts a UTF-16 LE string to a word array. 116 | * 117 | * @param {string} utf16Str The UTF-16 LE string. 118 | * 119 | * @return {WordArray} The word array. 120 | * 121 | * @static 122 | * 123 | * @example 124 | * 125 | * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); 126 | */ 127 | parse: function (utf16Str) { 128 | // Shortcut 129 | var utf16StrLength = utf16Str.length; 130 | 131 | // Convert 132 | var words = []; 133 | for (var i = 0; i < utf16StrLength; i++) { 134 | words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); 135 | } 136 | 137 | return WordArray.create(words, utf16StrLength * 2); 138 | } 139 | }; 140 | 141 | function swapEndian(word) { 142 | return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); 143 | } 144 | }()); 145 | 146 | 147 | return CryptoJS.enc.Utf16; 148 | 149 | })); -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/README.md: -------------------------------------------------------------------------------- 1 | # crypto-js 2 | 3 | Modularized port of googlecode project crypto-js. 4 | 5 | ## Node.js (Install) 6 | 7 | Requirements: 8 | 9 | - Node.js 10 | - npm (Node.js package manager) 11 | 12 | ```bash 13 | npm install crypto-js 14 | ``` 15 | 16 | ### Usage 17 | 18 | Modular include: 19 | 20 | ```javascript 21 | var AES = require("crypto-js/aes"); 22 | var SHA256 = require("crypto-js/sha256"); 23 | ... 24 | console.log(SHA256("Message")); 25 | ``` 26 | 27 | Including all libraries, for access to extra methods: 28 | 29 | ```javascript 30 | var CryptoJS = require("crypto-js"); 31 | console.log(CryptoJS.HmacSHA1("Message", "Key")); 32 | ``` 33 | 34 | ## Client (browser) 35 | 36 | Requirements: 37 | 38 | - Node.js 39 | - Bower (package manager for frontend) 40 | 41 | ```bash 42 | bower install crypto-js 43 | ``` 44 | 45 | ### Usage 46 | 47 | Modular include: 48 | 49 | ```javascript 50 | require.config({ 51 | packages: [ 52 | { 53 | name: 'crypto-js', 54 | location: 'path-to/bower_components/crypto-js', 55 | main: 'index' 56 | } 57 | ] 58 | }); 59 | 60 | require(["crypto-js/aes", "crypto-js/sha256"], function (AES, SHA256) { 61 | console.log(SHA256("Message")); 62 | }); 63 | ``` 64 | 65 | Including all libraries, for access to extra methods: 66 | 67 | ```javascript 68 | // Above-mentioned will work or use this simple form 69 | require.config({ 70 | paths: { 71 | 'require-js': 'path-to/bower_components/crypto-js/crypto-js' 72 | } 73 | }); 74 | 75 | require(["crypto-js"], function (CryptoJS) { 76 | console.log(CryptoJS.HmacSHA1("Message", "Key")); 77 | }); 78 | ``` 79 | 80 | ### Usage without RequireJS 81 | 82 | ```html 83 | 84 | 88 | 89 | ## API 90 | 91 | See: https://code.google.com/p/crypto-js 92 | 93 | ### List of modules 94 | 95 | 96 | - ```crypto-js/core``` 97 | - ```crypto-js/x64-core``` 98 | - ```crypto-js/lib-typedarrays``` 99 | 100 | --- 101 | 102 | - ```crypto-js/md5``` 103 | - ```crypto-js/sha1``` 104 | - ```crypto-js/sha256``` 105 | - ```crypto-js/sha224``` 106 | - ```crypto-js/sha512``` 107 | - ```crypto-js/sha384``` 108 | - ```crypto-js/sha3``` 109 | - ```crypto-js/ripemd160``` 110 | 111 | --- 112 | 113 | - ```crypto-js/hmac-md5``` 114 | - ```crypto-js/hmac-sha1``` 115 | - ```crypto-js/hmac-sha256``` 116 | - ```crypto-js/hmac-sha224``` 117 | - ```crypto-js/hmac-sha512``` 118 | - ```crypto-js/hmac-sha384``` 119 | - ```crypto-js/hmac-sha3``` 120 | - ```crypto-js/hmac-ripemd160``` 121 | 122 | --- 123 | 124 | - ```crypto-js/pbkdf2``` 125 | 126 | --- 127 | 128 | - ```crypto-js/aes``` 129 | - ```crypto-js/tripledes``` 130 | - ```crypto-js/rc4``` 131 | - ```crypto-js/rabbit``` 132 | - ```crypto-js/rabbit-legacy``` 133 | - ```crypto-js/evpkdf``` 134 | 135 | --- 136 | 137 | - ```crypto-js/format-openssl``` 138 | - ```crypto-js/format-hex``` 139 | 140 | --- 141 | 142 | - ```crypto-js/enc-latin1``` 143 | - ```crypto-js/enc-utf8``` 144 | - ```crypto-js/enc-hex``` 145 | - ```crypto-js/enc-utf16``` 146 | - ```crypto-js/enc-base64``` 147 | 148 | --- 149 | 150 | - ```crypto-js/mode-cfb``` 151 | - ```crypto-js/mode-ctr``` 152 | - ```crypto-js/mode-ctr-gladman``` 153 | - ```crypto-js/mode-ofb``` 154 | - ```crypto-js/mode-ecb``` 155 | 156 | --- 157 | 158 | - ```crypto-js/pad-pkcs7``` 159 | - ```crypto-js/pad-ansix923``` 160 | - ```crypto-js/pad-iso10126``` 161 | - ```crypto-js/pad-iso97971``` 162 | - ```crypto-js/pad-zeropadding``` 163 | - ```crypto-js/pad-nopadding``` 164 | 165 | ## License 166 | 167 | [The MIT License (MIT)](http://opensource.org/licenses/MIT) 168 | 169 | Copyright (c) 2009-2013 Jeff Mott 170 | Copyright (c) 2013-2015 Evan Vosberg 171 | 172 | Permission is hereby granted, free of charge, to any person obtaining a copy 173 | of this software and associated documentation files (the "Software"), to deal 174 | in the Software without restriction, including without limitation the rights 175 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 176 | copies of the Software, and to permit persons to whom the Software is 177 | furnished to do so, subject to the following conditions: 178 | 179 | The above copyright notice and this permission notice shall be included in 180 | all copies or substantial portions of the Software. 181 | 182 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 183 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 184 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 185 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 186 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 187 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 188 | THE SOFTWARE. -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/ethereum.js/lib/utils/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for ethereum.js/lib/utils/ 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for ethereum.js/lib/utils/

17 |

18 | Statements: 100% (124 / 124)      19 | Branches: 89.23% (58 / 65)      20 | Functions: 100% (28 / 28)      21 | Lines: 100% (123 / 123)      22 | Ignored: none      23 |

24 |
All files » ethereum.js/lib/utils/
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
FileStatementsBranchesFunctionsLines
config.js100%(3 / 3)100%(0 / 0)100%(0 / 0)100%(3 / 3)
sha3.js100%(10 / 10)100%(4 / 4)100%(1 / 1)100%(10 / 10)
utils.js100%(111 / 111)88.52%(54 / 61)100%(27 / 27)100%(110 / 110)
84 |
85 |
86 | 89 | 90 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/ethereum.js/lib/solidity/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for ethereum.js/lib/solidity/ 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for ethereum.js/lib/solidity/

17 |

18 | Statements: 99.36% (156 / 157)      19 | Branches: 87.23% (41 / 47)      20 | Functions: 100% (49 / 49)      21 | Lines: 99.36% (156 / 157)      22 | Ignored: none      23 |

24 |
All files » ethereum.js/lib/solidity/
25 |
26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
FileStatementsBranchesFunctionsLines
coder.js98.46%(64 / 65)89.47%(17 / 19)100%(18 / 18)98.46%(64 / 65)
formatters.js100%(44 / 44)80%(8 / 10)100%(14 / 14)100%(44 / 44)
param.js100%(48 / 48)88.89%(16 / 18)100%(17 / 17)100%(48 / 48)
84 |
85 |
86 | 89 | 90 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /content/assets/js/content.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.9.3 2 | (function() { 3 | $(function() { 4 | var $config, $content, CONTENT_CHANNEL, buildPost, config, ethHost, ethPort, getContent, refreshPosts; 5 | CONTENT_CHANNEL = '/content'; 6 | $content = $('#content'); 7 | ethHost = 'localhost'; 8 | ethPort = 8545; 9 | console.log("content init"); 10 | refreshPosts = function(newRoot) { 11 | var path; 12 | path = 'posts/'; 13 | if (newRoot) { 14 | path = '/ipfs/' + newRoot + '/' + path; 15 | } 16 | return $.getJSON(path + 'index.json', function(posts, status, xhr) { 17 | $('#content .loading').remove(); 18 | console.log("Loaded posts:", posts); 19 | return posts.map(function(post, index) { 20 | var $el; 21 | $el = $("#" + post); 22 | return $content.append(buildPost(path, post, index, $el)); 23 | }); 24 | }); 25 | }; 26 | buildPost = function(path, post, index, $el) { 27 | var $post; 28 | $post = $el.length ? $el : $($('#post-template').html()); 29 | $post.attr('data-index', index); 30 | $post.attr('id', post); 31 | getContent(path + post + '/title', function(err, title) { 32 | return $post.find('.title').html(title); 33 | }); 34 | getContent(path + post + '/content', function(err, content) { 35 | var isHttp; 36 | isHttp = /^https?:\/\//; 37 | if (isHttp.test(content)) { 38 | return $post.find('.content').attr('href', content); 39 | } else { 40 | return $post.find('.content').attr('href', '/ipfs/' + post); 41 | } 42 | }); 43 | getContent(path + post + '/index.json', function(err, comments) { 44 | $post.find('.comment-count').html(comments.length); 45 | return $post.find('.comment').attr('href', post); 46 | }); 47 | if (!$el.length) { 48 | return $post; 49 | } 50 | }; 51 | getContent = function(url, cb) { 52 | return $.get(url, function(responseText, status, xhr) { 53 | return cb(!responseText, responseText); 54 | }); 55 | }; 56 | config = null; 57 | $config = $('
'); 58 | return $config.load('config', function() { 59 | var err, identity, messageFilter; 60 | console.log("Config request response: ", arguments); 61 | try { 62 | config = JSON.parse($config.text()); 63 | if (config.defaults) { 64 | ethHost = config.defaults.eth_host; 65 | ethPort = config.defaults.eth_port; 66 | CONTENT_CHANNEL = config.defaults.shh_channel; 67 | $('#ipfs-status').addClass('connected'); 68 | } 69 | } catch (_error) { 70 | err = _error; 71 | console.log("Unable to parse config"); 72 | } 73 | web3.setProvider(new web3.providers.HttpProvider("http://" + ethHost + ":" + ethPort)); 74 | try { 75 | identity = web3.shh.newIdentity(); 76 | messageFilter = web3.shh.filter({ 77 | topics: [CONTENT_CHANNEL] 78 | }); 79 | $('#eth-status').addClass('connected'); 80 | messageFilter.watch(function(err, msg) { 81 | var ref; 82 | if (!err && msg) { 83 | console.log("Message: ", JSON.stringify(msg)); 84 | } 85 | if (!err && (msg != null ? (ref = msg.payload) != null ? ref.root : void 0 : void 0)) { 86 | console.log("Received root hash update: ", msg); 87 | return refreshPosts(msg.payload.root); 88 | } 89 | }); 90 | } catch (_error) { 91 | err = _error; 92 | console.log(err); 93 | } 94 | refreshPosts(null); 95 | $('#createPost').click(function() { 96 | $('#postContent').html($("#postContent-template").html()); 97 | return $('#postContent .submit').click(function() { 98 | var content, title; 99 | content = $('#postContent .content').val(); 100 | title = $('#postContent .title').val(); 101 | web3.shh.post({ 102 | from: identity, 103 | topics: [CONTENT_CHANNEL], 104 | payload: JSON.stringify({ 105 | from: identity, 106 | content: content, 107 | title: title 108 | }) 109 | }); 110 | console.log("posted content to whisper channel"); 111 | return $('#postContent').empty(); 112 | }); 113 | }); 114 | return $(document.body).on('click', '.post a', function(ev) { 115 | var $el, $post; 116 | ev.preventDefault(); 117 | $el = $(this); 118 | $post = $el.closest('.post'); 119 | if ($el.hasClass('comment')) { 120 | web3.shh.post({ 121 | from: identity, 122 | topics: [CONTENT_CHANNEL], 123 | payload: JSON.stringify({ 124 | from: identity, 125 | parent: $post.attr('id'), 126 | content: "A comment!!" 127 | }) 128 | }); 129 | } 130 | console.log($el); 131 | return false; 132 | }); 133 | }); 134 | }); 135 | 136 | }).call(this); 137 | -------------------------------------------------------------------------------- /src/lib/web3/bower/crypto-js/pbkdf2.js: -------------------------------------------------------------------------------- 1 | ;(function (root, factory, undef) { 2 | if (typeof exports === "object") { 3 | // CommonJS 4 | module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac")); 5 | } 6 | else if (typeof define === "function" && define.amd) { 7 | // AMD 8 | define(["./core", "./sha1", "./hmac"], factory); 9 | } 10 | else { 11 | // Global (browser) 12 | factory(root.CryptoJS); 13 | } 14 | }(this, function (CryptoJS) { 15 | 16 | (function () { 17 | // Shortcuts 18 | var C = CryptoJS; 19 | var C_lib = C.lib; 20 | var Base = C_lib.Base; 21 | var WordArray = C_lib.WordArray; 22 | var C_algo = C.algo; 23 | var SHA1 = C_algo.SHA1; 24 | var HMAC = C_algo.HMAC; 25 | 26 | /** 27 | * Password-Based Key Derivation Function 2 algorithm. 28 | */ 29 | var PBKDF2 = C_algo.PBKDF2 = Base.extend({ 30 | /** 31 | * Configuration options. 32 | * 33 | * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) 34 | * @property {Hasher} hasher The hasher to use. Default: SHA1 35 | * @property {number} iterations The number of iterations to perform. Default: 1 36 | */ 37 | cfg: Base.extend({ 38 | keySize: 128/32, 39 | hasher: SHA1, 40 | iterations: 1 41 | }), 42 | 43 | /** 44 | * Initializes a newly created key derivation function. 45 | * 46 | * @param {Object} cfg (Optional) The configuration options to use for the derivation. 47 | * 48 | * @example 49 | * 50 | * var kdf = CryptoJS.algo.PBKDF2.create(); 51 | * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); 52 | * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); 53 | */ 54 | init: function (cfg) { 55 | this.cfg = this.cfg.extend(cfg); 56 | }, 57 | 58 | /** 59 | * Computes the Password-Based Key Derivation Function 2. 60 | * 61 | * @param {WordArray|string} password The password. 62 | * @param {WordArray|string} salt A salt. 63 | * 64 | * @return {WordArray} The derived key. 65 | * 66 | * @example 67 | * 68 | * var key = kdf.compute(password, salt); 69 | */ 70 | compute: function (password, salt) { 71 | // Shortcut 72 | var cfg = this.cfg; 73 | 74 | // Init HMAC 75 | var hmac = HMAC.create(cfg.hasher, password); 76 | 77 | // Initial values 78 | var derivedKey = WordArray.create(); 79 | var blockIndex = WordArray.create([0x00000001]); 80 | 81 | // Shortcuts 82 | var derivedKeyWords = derivedKey.words; 83 | var blockIndexWords = blockIndex.words; 84 | var keySize = cfg.keySize; 85 | var iterations = cfg.iterations; 86 | 87 | // Generate key 88 | while (derivedKeyWords.length < keySize) { 89 | var block = hmac.update(salt).finalize(blockIndex); 90 | hmac.reset(); 91 | 92 | // Shortcuts 93 | var blockWords = block.words; 94 | var blockWordsLength = blockWords.length; 95 | 96 | // Iterations 97 | var intermediate = block; 98 | for (var i = 1; i < iterations; i++) { 99 | intermediate = hmac.finalize(intermediate); 100 | hmac.reset(); 101 | 102 | // Shortcut 103 | var intermediateWords = intermediate.words; 104 | 105 | // XOR intermediate with block 106 | for (var j = 0; j < blockWordsLength; j++) { 107 | blockWords[j] ^= intermediateWords[j]; 108 | } 109 | } 110 | 111 | derivedKey.concat(block); 112 | blockIndexWords[0]++; 113 | } 114 | derivedKey.sigBytes = keySize * 4; 115 | 116 | return derivedKey; 117 | } 118 | }); 119 | 120 | /** 121 | * Computes the Password-Based Key Derivation Function 2. 122 | * 123 | * @param {WordArray|string} password The password. 124 | * @param {WordArray|string} salt A salt. 125 | * @param {Object} cfg (Optional) The configuration options to use for this computation. 126 | * 127 | * @return {WordArray} The derived key. 128 | * 129 | * @static 130 | * 131 | * @example 132 | * 133 | * var key = CryptoJS.PBKDF2(password, salt); 134 | * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); 135 | * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); 136 | */ 137 | C.PBKDF2 = function (password, salt, cfg) { 138 | return PBKDF2.create(cfg).compute(password, salt); 139 | }; 140 | }()); 141 | 142 | 143 | return CryptoJS.PBKDF2; 144 | 145 | })); -------------------------------------------------------------------------------- /src/lib/web3/lib/web3/method.js: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of ethereum.js. 3 | 4 | ethereum.js is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU Lesser General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | ethereum.js is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with ethereum.js. If not, see . 16 | */ 17 | /** 18 | * @file method.js 19 | * @author Marek Kotewicz 20 | * @date 2015 21 | */ 22 | 23 | var RequestManager = require('./requestmanager'); 24 | var utils = require('../utils/utils'); 25 | var errors = require('./errors'); 26 | 27 | var Method = function (options) { 28 | this.name = options.name; 29 | this.call = options.call; 30 | this.params = options.params || 0; 31 | this.inputFormatter = options.inputFormatter; 32 | this.outputFormatter = options.outputFormatter; 33 | }; 34 | 35 | /** 36 | * Should be used to determine name of the jsonrpc method based on arguments 37 | * 38 | * @method getCall 39 | * @param {Array} arguments 40 | * @return {String} name of jsonrpc method 41 | */ 42 | Method.prototype.getCall = function (args) { 43 | return utils.isFunction(this.call) ? this.call(args) : this.call; 44 | }; 45 | 46 | /** 47 | * Should be used to extract callback from array of arguments. Modifies input param 48 | * 49 | * @method extractCallback 50 | * @param {Array} arguments 51 | * @return {Function|Null} callback, if exists 52 | */ 53 | Method.prototype.extractCallback = function (args) { 54 | if (utils.isFunction(args[args.length - 1])) { 55 | return args.pop(); // modify the args array! 56 | } 57 | }; 58 | 59 | /** 60 | * Should be called to check if the number of arguments is correct 61 | * 62 | * @method validateArgs 63 | * @param {Array} arguments 64 | * @throws {Error} if it is not 65 | */ 66 | Method.prototype.validateArgs = function (args) { 67 | if (args.length !== this.params) { 68 | throw errors.InvalidNumberOfParams(); 69 | } 70 | }; 71 | 72 | /** 73 | * Should be called to format input args of method 74 | * 75 | * @method formatInput 76 | * @param {Array} 77 | * @return {Array} 78 | */ 79 | Method.prototype.formatInput = function (args) { 80 | if (!this.inputFormatter) { 81 | return args; 82 | } 83 | 84 | return this.inputFormatter.map(function (formatter, index) { 85 | return formatter ? formatter(args[index]) : args[index]; 86 | }); 87 | }; 88 | 89 | /** 90 | * Should be called to format output(result) of method 91 | * 92 | * @method formatOutput 93 | * @param {Object} 94 | * @return {Object} 95 | */ 96 | Method.prototype.formatOutput = function (result) { 97 | return this.outputFormatter && result !== null ? this.outputFormatter(result) : result; 98 | }; 99 | 100 | /** 101 | * Should attach function to method 102 | * 103 | * @method attachToObject 104 | * @param {Object} 105 | * @param {Function} 106 | */ 107 | Method.prototype.attachToObject = function (obj) { 108 | var func = this.send.bind(this); 109 | func.request = this.request.bind(this); 110 | func.call = this.call; // that's ugly. filter.js uses it 111 | var name = this.name.split('.'); 112 | if (name.length > 1) { 113 | obj[name[0]] = obj[name[0]] || {}; 114 | obj[name[0]][name[1]] = func; 115 | } else { 116 | obj[name[0]] = func; 117 | } 118 | }; 119 | 120 | /** 121 | * Should create payload from given input args 122 | * 123 | * @method toPayload 124 | * @param {Array} args 125 | * @return {Object} 126 | */ 127 | Method.prototype.toPayload = function (args) { 128 | var call = this.getCall(args); 129 | var callback = this.extractCallback(args); 130 | var params = this.formatInput(args); 131 | this.validateArgs(params); 132 | 133 | return { 134 | method: call, 135 | params: params, 136 | callback: callback 137 | }; 138 | }; 139 | 140 | /** 141 | * Should be called to create pure JSONRPC request which can be used in batch request 142 | * 143 | * @method request 144 | * @param {...} params 145 | * @return {Object} jsonrpc request 146 | */ 147 | Method.prototype.request = function () { 148 | var payload = this.toPayload(Array.prototype.slice.call(arguments)); 149 | payload.format = this.formatOutput.bind(this); 150 | return payload; 151 | }; 152 | 153 | /** 154 | * Should send request to the API 155 | * 156 | * @method send 157 | * @param list of params 158 | * @return result 159 | */ 160 | Method.prototype.send = function () { 161 | var payload = this.toPayload(Array.prototype.slice.call(arguments)); 162 | if (payload.callback) { 163 | var self = this; 164 | return RequestManager.getInstance().sendAsync(payload, function (err, result) { 165 | payload.callback(err, self.formatOutput(result)); 166 | }); 167 | } 168 | return this.formatOutput(RequestManager.getInstance().send(payload)); 169 | }; 170 | 171 | module.exports = Method; 172 | 173 | -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/ethereum.js/lib/web3/qtsync.js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code coverage report for ethereum.js/lib/web3/qtsync.js 5 | 6 | 7 | 8 | 13 | 14 | 15 |
16 |

Code coverage report for ethereum.js/lib/web3/qtsync.js

17 |

18 | Statements: 100% (5 / 5)      19 | Branches: 100% (0 / 0)      20 | Functions: 100% (2 / 2)      21 | Lines: 100% (5 / 5)      22 | Ignored: none      23 |

24 | 25 |
26 |
27 |

 28 | 
128 | 
1 29 | 2 30 | 3 31 | 4 32 | 5 33 | 6 34 | 7 35 | 8 36 | 9 37 | 10 38 | 11 39 | 12 40 | 13 41 | 14 42 | 15 43 | 16 44 | 17 45 | 18 46 | 19 47 | 20 48 | 21 49 | 22 50 | 23 51 | 24 52 | 25 53 | 26 54 | 27 55 | 28 56 | 29 57 | 30 58 | 31 59 | 32 60 | 33 61 | 34  62 |   63 |   64 |   65 |   66 |   67 |   68 |   69 |   70 |   71 |   72 |   73 |   74 |   75 |   76 |   77 |   78 |   79 |   80 |   81 |   82 |   83 |   84 | 2 85 |   86 |   87 | 2 88 | 1 89 | 1 90 |   91 |   92 | 2 93 |   94 |  
/*
 95 |     This file is part of ethereum.js.
 96 |  
 97 |     ethereum.js is free software: you can redistribute it and/or modify
 98 |     it under the terms of the GNU Lesser General Public License as published by
 99 |     the Free Software Foundation, either version 3 of the License, or
100 |     (at your option) any later version.
101 |  
102 |     ethereum.js is distributed in the hope that it will be useful,
103 |     but WITHOUT ANY WARRANTY; without even the implied warranty of
104 |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
105 |     GNU Lesser General Public License for more details.
106 |  
107 |     You should have received a copy of the GNU Lesser General Public License
108 |     along with ethereum.js.  If not, see <http://www.gnu.org/licenses/>.
109 | */
110 | /** @file qtsync.js
111 |  * @authors:
112 |  *   Marek Kotewicz <marek@ethdev.com>
113 |  *   Marian Oancea <marian@ethdev.com>
114 |  * @date 2014
115 |  */
116 |  
117 | var QtSyncProvider = function () {
118 | };
119 |  
120 | QtSyncProvider.prototype.send = function (payload) {
121 |     var result = navigator.qt.callMethod(JSON.stringify(payload));
122 |     return JSON.parse(result);
123 | };
124 |  
125 | module.exports = QtSyncProvider;
126 |  
127 |  
129 | 130 |
131 | 134 | 135 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /src/lib/web3/coverage/lcov-report/base.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin:0; padding: 0; 3 | } 4 | body { 5 | font-family: Helvetica Neue, Helvetica,Arial; 6 | font-size: 10pt; 7 | } 8 | div.header, div.footer { 9 | background: #eee; 10 | padding: 1em; 11 | } 12 | div.header { 13 | z-index: 100; 14 | position: fixed; 15 | top: 0; 16 | border-bottom: 1px solid #666; 17 | width: 100%; 18 | } 19 | div.footer { 20 | border-top: 1px solid #666; 21 | } 22 | div.body { 23 | margin-top: 10em; 24 | } 25 | div.meta { 26 | font-size: 90%; 27 | text-align: center; 28 | } 29 | h1, h2, h3 { 30 | font-weight: normal; 31 | } 32 | h1 { 33 | font-size: 12pt; 34 | } 35 | h2 { 36 | font-size: 10pt; 37 | } 38 | pre { 39 | font-family: Consolas, Menlo, Monaco, monospace; 40 | margin: 0; 41 | padding: 0; 42 | line-height: 14px; 43 | font-size: 14px; 44 | -moz-tab-size: 2; 45 | -o-tab-size: 2; 46 | tab-size: 2; 47 | } 48 | 49 | div.path { font-size: 110%; } 50 | div.path a:link, div.path a:visited { color: #000; } 51 | table.coverage { border-collapse: collapse; margin:0; padding: 0 } 52 | 53 | table.coverage td { 54 | margin: 0; 55 | padding: 0; 56 | color: #111; 57 | vertical-align: top; 58 | } 59 | table.coverage td.line-count { 60 | width: 50px; 61 | text-align: right; 62 | padding-right: 5px; 63 | } 64 | table.coverage td.line-coverage { 65 | color: #777 !important; 66 | text-align: right; 67 | border-left: 1px solid #666; 68 | border-right: 1px solid #666; 69 | } 70 | 71 | table.coverage td.text { 72 | } 73 | 74 | table.coverage td span.cline-any { 75 | display: inline-block; 76 | padding: 0 5px; 77 | width: 40px; 78 | } 79 | table.coverage td span.cline-neutral { 80 | background: #eee; 81 | } 82 | table.coverage td span.cline-yes { 83 | background: #b5d592; 84 | color: #999; 85 | } 86 | table.coverage td span.cline-no { 87 | background: #fc8c84; 88 | } 89 | 90 | .cstat-yes { color: #111; } 91 | .cstat-no { background: #fc8c84; color: #111; } 92 | .fstat-no { background: #ffc520; color: #111 !important; } 93 | .cbranch-no { background: yellow !important; color: #111; } 94 | 95 | .cstat-skip { background: #ddd; color: #111; } 96 | .fstat-skip { background: #ddd; color: #111 !important; } 97 | .cbranch-skip { background: #ddd !important; color: #111; } 98 | 99 | .missing-if-branch { 100 | display: inline-block; 101 | margin-right: 10px; 102 | position: relative; 103 | padding: 0 4px; 104 | background: black; 105 | color: yellow; 106 | } 107 | 108 | .skip-if-branch { 109 | display: none; 110 | margin-right: 10px; 111 | position: relative; 112 | padding: 0 4px; 113 | background: #ccc; 114 | color: white; 115 | } 116 | 117 | .missing-if-branch .typ, .skip-if-branch .typ { 118 | color: inherit !important; 119 | } 120 | 121 | .entity, .metric { font-weight: bold; } 122 | .metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } 123 | .metric small { font-size: 80%; font-weight: normal; color: #666; } 124 | 125 | div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } 126 | div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } 127 | div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } 128 | div.coverage-summary th.file { border-right: none !important; } 129 | div.coverage-summary th.pic { border-left: none !important; text-align: right; } 130 | div.coverage-summary th.pct { border-right: none !important; } 131 | div.coverage-summary th.abs { border-left: none !important; text-align: right; } 132 | div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } 133 | div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } 134 | div.coverage-summary td.file { border-left: 1px solid #666; white-space: nowrap; } 135 | div.coverage-summary td.pic { min-width: 120px !important; } 136 | div.coverage-summary a:link { text-decoration: none; color: #000; } 137 | div.coverage-summary a:visited { text-decoration: none; color: #777; } 138 | div.coverage-summary a:hover { text-decoration: underline; } 139 | div.coverage-summary tfoot td { border-top: 1px solid #666; } 140 | 141 | div.coverage-summary .sorter { 142 | height: 10px; 143 | width: 7px; 144 | display: inline-block; 145 | margin-left: 0.5em; 146 | background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; 147 | } 148 | div.coverage-summary .sorted .sorter { 149 | background-position: 0 -20px; 150 | } 151 | div.coverage-summary .sorted-desc .sorter { 152 | background-position: 0 -10px; 153 | } 154 | 155 | .high { background: #b5d592 !important; } 156 | .medium { background: #ffe87c !important; } 157 | .low { background: #fc8c84 !important; } 158 | 159 | span.cover-fill, span.cover-empty { 160 | display:inline-block; 161 | border:1px solid #444; 162 | background: white; 163 | height: 12px; 164 | } 165 | span.cover-fill { 166 | background: #ccc; 167 | border-right: 1px solid #444; 168 | } 169 | span.cover-empty { 170 | background: white; 171 | border-left: none; 172 | } 173 | span.cover-full { 174 | border-right: none !important; 175 | } 176 | pre.prettyprint { 177 | border: none !important; 178 | padding: 0 !important; 179 | margin: 0 !important; 180 | } 181 | .com { color: #999 !important; } 182 | .ignore-none { color: #999; font-weight: normal; } 183 | --------------------------------------------------------------------------------