mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
changed topics to topic
This commit is contained in:
parent
fdecc11128
commit
4ce02e621b
57 changed files with 2873 additions and 1743 deletions
|
|
@ -40,23 +40,23 @@
|
||||||
document.querySelector("#id").innerHTML = id;
|
document.querySelector("#id").innerHTML = id;
|
||||||
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
|
document.querySelector("#known").innerHTML = shh.haveIdentity(id);
|
||||||
|
|
||||||
var watch = shh.watch({topics: ["test"]})
|
var watch = shh.watch({topic: ["test"]})
|
||||||
watch.arrived(function(message) {
|
watch.arrived(function(message) {
|
||||||
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
|
document.querySelector("#table").innerHTML += "<tr><td colspan='2'>"+JSON.stringify(message)+"</td></tr>";
|
||||||
});
|
});
|
||||||
|
|
||||||
var selfWatch = shh.watch({to: id, topics: ["test"]})
|
var selfWatch = shh.watch({to: id, topic: ["test"]})
|
||||||
selfWatch.arrived(function(message) {
|
selfWatch.arrived(function(message) {
|
||||||
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
|
document.querySelector("#table").innerHTML += "<tr><td>To me</td><td>"+JSON.stringify(message)+"</td></tr>";
|
||||||
});
|
});
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
shh.post({topics: ["test"], payload: web3.fromAscii("test it")});
|
shh.post({topic: ["test"], payload: web3.fromAscii("test it")});
|
||||||
count();
|
count();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test2() {
|
function test2() {
|
||||||
shh.post({to: id, topics: ["test"], payload: web3.fromAscii("Private")});
|
shh.post({to: id, topic: ["test"], payload: web3.fromAscii("Private")});
|
||||||
count();
|
count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
This is the Ethereum compatible [JavaScript API](https://github.com/ethereum/wiki/wiki/JavaScript-API)
|
This is the Ethereum compatible [JavaScript API](https://github.com/ethereum/wiki/wiki/JavaScript-API)
|
||||||
which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. It's available on npm as a node module and also for bower and component as an embeddable js
|
which implements the [Generic JSON RPC](https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC) spec. It's available on npm as a node module and also for bower and component as an embeddable js
|
||||||
|
|
||||||
[![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]
|
[![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]
|
||||||
|
|
||||||
<!-- [](https://ci.testling.com/ethereum/ethereum.js) -->
|
<!-- [](https://ci.testling.com/ethereum/ethereum.js) -->
|
||||||
|
|
||||||
|
|
@ -30,9 +30,9 @@ Require the library:
|
||||||
|
|
||||||
var web3 = require('web3');
|
var web3 = require('web3');
|
||||||
|
|
||||||
Set a provider (QtProvider, WebSocketProvider, HttpRpcProvider)
|
Set a provider (QtSyncProvider, HttpSyncProvider)
|
||||||
|
|
||||||
var web3.setProvider(new web3.providers.WebSocketProvider('ws://localhost:40404/eth'));
|
web3.setProvider(new web3.providers.HttpSyncProvider());
|
||||||
|
|
||||||
There you go, now you can use it:
|
There you go, now you can use it:
|
||||||
|
|
||||||
|
|
@ -93,4 +93,6 @@ ethereum -ws -loglevel=4
|
||||||
[dep-url]: https://david-dm.org/ethereum/ethereum.js
|
[dep-url]: https://david-dm.org/ethereum/ethereum.js
|
||||||
[dep-dev-image]: https://david-dm.org/ethereum/ethereum.js/dev-status.svg
|
[dep-dev-image]: https://david-dm.org/ethereum/ethereum.js/dev-status.svg
|
||||||
[dep-dev-url]: https://david-dm.org/ethereum/ethereum.js#info=devDependencies
|
[dep-dev-url]: https://david-dm.org/ethereum/ethereum.js#info=devDependencies
|
||||||
|
[coveralls-image]: https://coveralls.io/repos/ethereum/ethereum.js/badge.svg?branch=master
|
||||||
|
[coveralls-url]: https://coveralls.io/r/ethereum/ethereum.js?branch=master
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "ethereum.js",
|
"name": "ethereum.js",
|
||||||
"namespace": "ethereum",
|
"namespace": "ethereum",
|
||||||
"version": "0.0.13",
|
"version": "0.0.15",
|
||||||
"description": "Ethereum Compatible JavaScript API",
|
"description": "Ethereum Compatible JavaScript API",
|
||||||
"main": ["./dist/ethereum.js", "./dist/ethereum.min.js"],
|
"main": ["./dist/ethereum.js", "./dist/ethereum.min.js"],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
791
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
vendored
791
cmd/mist/assets/ext/ethereum.js/dist/ethereum.js
vendored
|
|
@ -210,7 +210,7 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"./const":2,"./formatters":6,"./types":11,"./utils":12,"./web3":13}],2:[function(require,module,exports){
|
},{"./const":2,"./formatters":8,"./types":14,"./utils":15,"./web3":17}],2:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -264,7 +264,8 @@ module.exports = {
|
||||||
ETH_PADDING: 32,
|
ETH_PADDING: 32,
|
||||||
ETH_SIGNATURE_LENGTH: 4,
|
ETH_SIGNATURE_LENGTH: 4,
|
||||||
ETH_UNITS: ETH_UNITS,
|
ETH_UNITS: ETH_UNITS,
|
||||||
ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }
|
ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN },
|
||||||
|
ETH_POLLING_TIMEOUT: 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -295,6 +296,7 @@ var web3 = require('./web3');
|
||||||
var abi = require('./abi');
|
var abi = require('./abi');
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
var eventImpl = require('./event');
|
var eventImpl = require('./event');
|
||||||
|
var filter = require('./filter');
|
||||||
|
|
||||||
var exportNatspecGlobals = function (vars) {
|
var exportNatspecGlobals = function (vars) {
|
||||||
// it's used byt natspec.js
|
// it's used byt natspec.js
|
||||||
|
|
@ -416,11 +418,11 @@ var addEventsToContract = function (contract, desc, address) {
|
||||||
var signature = abi.eventSignatureFromAscii(e.name);
|
var signature = abi.eventSignatureFromAscii(e.name);
|
||||||
var event = eventImpl.inputParser(address, signature, e);
|
var event = eventImpl.inputParser(address, signature, e);
|
||||||
var o = event.apply(null, params);
|
var o = event.apply(null, params);
|
||||||
o._onWatchEventResult = function (data) {
|
var outputFormatter = function (data) {
|
||||||
var parser = eventImpl.outputParser(e);
|
var parser = eventImpl.outputParser(e);
|
||||||
return parser(data);
|
return parser(data);
|
||||||
};
|
};
|
||||||
return web3.eth.watch(o);
|
return web3.eth.watch(o, undefined, undefined, outputFormatter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// this property should be used by eth.filter to check if object is an event
|
// this property should be used by eth.filter to check if object is an event
|
||||||
|
|
@ -487,7 +489,131 @@ var contract = function (address, desc) {
|
||||||
module.exports = contract;
|
module.exports = contract;
|
||||||
|
|
||||||
|
|
||||||
},{"./abi":1,"./event":4,"./utils":12,"./web3":13}],4:[function(require,module,exports){
|
},{"./abi":1,"./event":6,"./filter":7,"./utils":15,"./web3":17}],4:[function(require,module,exports){
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file db.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.db api methods
|
||||||
|
var methods = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'put', call: 'db_put' },
|
||||||
|
{ name: 'get', call: 'db_get' },
|
||||||
|
{ name: 'putString', call: 'db_putString' },
|
||||||
|
{ name: 'getString', call: 'db_getString' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
methods: methods
|
||||||
|
};
|
||||||
|
|
||||||
|
},{}],5:[function(require,module,exports){
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file eth.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.eth api methods
|
||||||
|
var methods = function () {
|
||||||
|
var blockCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber";
|
||||||
|
};
|
||||||
|
|
||||||
|
var transactionCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
var uncleCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
var transactionCountCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_transactionCountByHash' : 'eth_transactionCountByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
var uncleCountCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_uncleCountByHash' : 'eth_uncleCountByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
{ name: 'balanceAt', call: 'eth_balanceAt' },
|
||||||
|
{ name: 'stateAt', call: 'eth_stateAt' },
|
||||||
|
{ name: 'storageAt', call: 'eth_storageAt' },
|
||||||
|
{ name: 'countAt', call: 'eth_countAt'},
|
||||||
|
{ name: 'codeAt', call: 'eth_codeAt' },
|
||||||
|
{ name: 'transact', call: 'eth_transact' },
|
||||||
|
{ name: 'call', call: 'eth_call' },
|
||||||
|
{ name: 'block', call: blockCall },
|
||||||
|
{ name: 'transaction', call: transactionCall },
|
||||||
|
{ name: 'uncle', call: uncleCall },
|
||||||
|
{ name: 'compilers', call: 'eth_compilers' },
|
||||||
|
{ name: 'flush', call: 'eth_flush' },
|
||||||
|
{ name: 'lll', call: 'eth_lll' },
|
||||||
|
{ name: 'solidity', call: 'eth_solidity' },
|
||||||
|
{ name: 'serpent', call: 'eth_serpent' },
|
||||||
|
{ name: 'logs', call: 'eth_logs' },
|
||||||
|
{ name: 'transactionCount', call: transactionCountCall },
|
||||||
|
{ name: 'uncleCount', call: uncleCountCall }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.eth api properties
|
||||||
|
var properties = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },
|
||||||
|
{ name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },
|
||||||
|
{ name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },
|
||||||
|
{ name: 'gasPrice', getter: 'eth_gasPrice' },
|
||||||
|
{ name: 'accounts', getter: 'eth_accounts' },
|
||||||
|
{ name: 'peerCount', getter: 'eth_peerCount' },
|
||||||
|
{ name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },
|
||||||
|
{ name: 'number', getter: 'eth_number'}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
methods: methods,
|
||||||
|
properties: properties
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
},{}],6:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -589,6 +715,7 @@ var outputParser = function (event) {
|
||||||
args: {}
|
args: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
output.topics = output.topic; // fallback for go-ethereum
|
||||||
if (!output.topic) {
|
if (!output.topic) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -624,7 +751,7 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"./abi":1,"./utils":12}],5:[function(require,module,exports){
|
},{"./abi":1,"./utils":15}],7:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -650,84 +777,96 @@ module.exports = {
|
||||||
* @date 2014
|
* @date 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var web3 = require('./web3'); // jshint ignore:line
|
/// Should be called to check if filter implementation is valid
|
||||||
|
/// @returns true if it is, otherwise false
|
||||||
|
var implementationIsValid = function (i) {
|
||||||
|
return !!i &&
|
||||||
|
typeof i.newFilter === 'function' &&
|
||||||
|
typeof i.getMessages === 'function' &&
|
||||||
|
typeof i.uninstallFilter === 'function' &&
|
||||||
|
typeof i.startPolling === 'function' &&
|
||||||
|
typeof i.stopPolling === 'function';
|
||||||
|
};
|
||||||
|
|
||||||
/// should be used when we want to watch something
|
/// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones
|
||||||
|
/// @param should be string or object
|
||||||
|
/// @returns options string or object
|
||||||
|
var getOptions = function (options) {
|
||||||
|
if (typeof options === 'string') {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
if (options.topics) {
|
||||||
|
console.warn('"topics" is deprecated, is "topic" instead');
|
||||||
|
}
|
||||||
|
|
||||||
|
// evaluate lazy properties
|
||||||
|
return {
|
||||||
|
to: options.to,
|
||||||
|
topic: options.topic,
|
||||||
|
earliest: options.earliest,
|
||||||
|
latest: options.latest,
|
||||||
|
max: options.max,
|
||||||
|
skip: options.skip,
|
||||||
|
address: options.address
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Should be used when we want to watch something
|
||||||
/// it's using inner polling mechanism and is notified about changes
|
/// it's using inner polling mechanism and is notified about changes
|
||||||
/// TODO: change 'options' name cause it may be not the best matching one, since we have events
|
/// @param options are filter options
|
||||||
var Filter = function(options, impl) {
|
/// @param implementation, an abstract polling implementation
|
||||||
|
/// @param formatter (optional), callback function which formats output before 'real' callback
|
||||||
if (typeof options !== "string") {
|
var filter = function(options, implementation, formatter) {
|
||||||
|
if (!implementationIsValid(implementation)) {
|
||||||
// topics property is deprecated, warn about it!
|
console.error('filter implemenation is invalid');
|
||||||
if (options.topics) {
|
return;
|
||||||
console.warn('"topics" is deprecated, use "topic" instead');
|
|
||||||
}
|
|
||||||
|
|
||||||
this._onWatchResult = options._onWatchEventResult;
|
|
||||||
|
|
||||||
// evaluate lazy properties
|
|
||||||
options = {
|
|
||||||
to: options.to,
|
|
||||||
topic: options.topic,
|
|
||||||
earliest: options.earliest,
|
|
||||||
latest: options.latest,
|
|
||||||
max: options.max,
|
|
||||||
skip: options.skip,
|
|
||||||
address: options.address
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.impl = impl;
|
options = getOptions(options);
|
||||||
this.callbacks = [];
|
var callbacks = [];
|
||||||
|
var filterId = implementation.newFilter(options);
|
||||||
|
var onMessages = function (messages) {
|
||||||
|
messages.forEach(function (message) {
|
||||||
|
message = formatter ? formatter(message) : message;
|
||||||
|
callbacks.forEach(function (callback) {
|
||||||
|
callback(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
this.id = impl.newFilter(options);
|
implementation.startPolling(filterId, onMessages, implementation.uninstallFilter);
|
||||||
web3.provider.startPolling({method: impl.changed, params: [this.id]}, this.id, this.trigger.bind(this));
|
|
||||||
|
var changed = function (callback) {
|
||||||
|
callbacks.push(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
var messages = function () {
|
||||||
|
return implementation.getMessages(filterId);
|
||||||
|
};
|
||||||
|
|
||||||
|
var uninstall = function (callback) {
|
||||||
|
implementation.stopPolling(filterId);
|
||||||
|
implementation.uninstallFilter(filterId);
|
||||||
|
callbacks = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
changed: changed,
|
||||||
|
arrived: changed,
|
||||||
|
happened: changed,
|
||||||
|
messages: messages,
|
||||||
|
logs: messages,
|
||||||
|
uninstall: uninstall
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// alias for changed*
|
module.exports = filter;
|
||||||
Filter.prototype.arrived = function(callback) {
|
|
||||||
this.changed(callback);
|
|
||||||
};
|
|
||||||
Filter.prototype.happened = function(callback) {
|
|
||||||
this.changed(callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// gets called when there is new eth/shh message
|
|
||||||
Filter.prototype.changed = function(callback) {
|
|
||||||
this.callbacks.push(callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// trigger calling new message from people
|
},{}],8:[function(require,module,exports){
|
||||||
Filter.prototype.trigger = function(messages) {
|
|
||||||
for (var i = 0; i < this.callbacks.length; i++) {
|
|
||||||
for (var j = 0; j < messages.length; j++) {
|
|
||||||
var message = this._onWatchResult ? this._onWatchResult(messages[j]) : messages[j];
|
|
||||||
this.callbacks[i].call(this, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// should be called to uninstall current filter
|
|
||||||
Filter.prototype.uninstall = function() {
|
|
||||||
this.impl.uninstallFilter(this.id);
|
|
||||||
web3.provider.stopPolling(this.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// should be called to manually trigger getting latest messages from the client
|
|
||||||
Filter.prototype.messages = function() {
|
|
||||||
return this.impl.getMessages(this.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// alias for messages
|
|
||||||
Filter.prototype.logs = function () {
|
|
||||||
return this.messages();
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = Filter;
|
|
||||||
|
|
||||||
},{"./web3":13}],6:[function(require,module,exports){
|
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -883,7 +1022,7 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"./const":2,"./utils":12}],7:[function(require,module,exports){
|
},{"./const":2,"./utils":15}],9:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -923,15 +1062,17 @@ HttpSyncProvider.prototype.send = function (payload) {
|
||||||
request.open('POST', this.host, false);
|
request.open('POST', this.host, false);
|
||||||
request.send(JSON.stringify(payload));
|
request.send(JSON.stringify(payload));
|
||||||
|
|
||||||
// check request.status
|
|
||||||
var result = request.responseText;
|
var result = request.responseText;
|
||||||
|
// check request.status
|
||||||
|
if(request.status !== 200)
|
||||||
|
return;
|
||||||
return JSON.parse(result);
|
return JSON.parse(result);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = HttpSyncProvider;
|
module.exports = HttpSyncProvider;
|
||||||
|
|
||||||
|
|
||||||
},{}],8:[function(require,module,exports){
|
},{}],10:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -998,111 +1139,7 @@ module.exports = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},{}],9:[function(require,module,exports){
|
},{}],11:[function(require,module,exports){
|
||||||
/*
|
|
||||||
This file is part of ethereum.js.
|
|
||||||
|
|
||||||
ethereum.js is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
ethereum.js is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/** @file providermanager.js
|
|
||||||
* @authors:
|
|
||||||
* Jeffrey Wilcke <jeff@ethdev.com>
|
|
||||||
* Marek Kotewicz <marek@ethdev.com>
|
|
||||||
* Marian Oancea <marian@ethdev.com>
|
|
||||||
* Gav Wood <g@ethdev.com>
|
|
||||||
* @date 2014
|
|
||||||
*/
|
|
||||||
|
|
||||||
var web3 = require('./web3');
|
|
||||||
var jsonrpc = require('./jsonrpc');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provider manager object prototype
|
|
||||||
* It's responsible for passing messages to providers
|
|
||||||
* If no provider is set it's responsible for queuing requests
|
|
||||||
* It's also responsible for polling the ethereum node for incoming messages
|
|
||||||
* Default poll timeout is 12 seconds
|
|
||||||
* If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,
|
|
||||||
* and provider manager polling mechanism is not used
|
|
||||||
*/
|
|
||||||
var ProviderManager = function() {
|
|
||||||
this.polls = [];
|
|
||||||
this.provider = undefined;
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var poll = function () {
|
|
||||||
self.polls.forEach(function (data) {
|
|
||||||
var result = self.send(data.data);
|
|
||||||
|
|
||||||
if (!(result instanceof Array) || result.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
data.callback(result);
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(poll, 1000);
|
|
||||||
};
|
|
||||||
poll();
|
|
||||||
};
|
|
||||||
|
|
||||||
/// sends outgoing requests
|
|
||||||
/// @params data - an object with at least 'method' property
|
|
||||||
ProviderManager.prototype.send = function(data) {
|
|
||||||
var payload = jsonrpc.toPayload(data.method, data.params);
|
|
||||||
|
|
||||||
if (this.provider === undefined) {
|
|
||||||
console.error('provider is not set');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = this.provider.send(payload);
|
|
||||||
|
|
||||||
if (!jsonrpc.isValidResponse(result)) {
|
|
||||||
console.log(result);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// setups provider, which will be used for sending messages
|
|
||||||
ProviderManager.prototype.set = function(provider) {
|
|
||||||
this.provider = provider;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// this method is only used, when we do not have native qt bindings and have to do polling on our own
|
|
||||||
/// should be callled, on start watching for eth/shh changes
|
|
||||||
ProviderManager.prototype.startPolling = function (data, pollId, callback) {
|
|
||||||
this.polls.push({data: data, id: pollId, callback: callback});
|
|
||||||
};
|
|
||||||
|
|
||||||
/// should be called to stop polling for certain watch changes
|
|
||||||
ProviderManager.prototype.stopPolling = function (pollId) {
|
|
||||||
for (var i = this.polls.length; i--;) {
|
|
||||||
var poll = this.polls[i];
|
|
||||||
if (poll.id === pollId) {
|
|
||||||
this.polls.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = ProviderManager;
|
|
||||||
|
|
||||||
|
|
||||||
},{"./jsonrpc":8,"./web3":13}],10:[function(require,module,exports){
|
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -1137,7 +1174,151 @@ QtSyncProvider.prototype.send = function (payload) {
|
||||||
module.exports = QtSyncProvider;
|
module.exports = QtSyncProvider;
|
||||||
|
|
||||||
|
|
||||||
},{}],11:[function(require,module,exports){
|
},{}],12:[function(require,module,exports){
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file requestmanager.js
|
||||||
|
* @authors:
|
||||||
|
* Jeffrey Wilcke <jeff@ethdev.com>
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* Marian Oancea <marian@ethdev.com>
|
||||||
|
* Gav Wood <g@ethdev.com>
|
||||||
|
* @date 2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
var jsonrpc = require('./jsonrpc');
|
||||||
|
var c = require('./const');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It's responsible for passing messages to providers
|
||||||
|
* It's also responsible for polling the ethereum node for incoming messages
|
||||||
|
* Default poll timeout is 1 second
|
||||||
|
*/
|
||||||
|
var requestManager = function() {
|
||||||
|
var polls = [];
|
||||||
|
var provider;
|
||||||
|
|
||||||
|
var send = function (data) {
|
||||||
|
var payload = jsonrpc.toPayload(data.method, data.params);
|
||||||
|
|
||||||
|
if (!provider) {
|
||||||
|
console.error('provider is not set');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = provider.send(payload);
|
||||||
|
|
||||||
|
if (!jsonrpc.isValidResponse(result)) {
|
||||||
|
console.log(result);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.result;
|
||||||
|
};
|
||||||
|
|
||||||
|
var setProvider = function (p) {
|
||||||
|
provider = p;
|
||||||
|
};
|
||||||
|
|
||||||
|
var startPolling = function (data, pollId, callback, uninstall) {
|
||||||
|
polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall});
|
||||||
|
};
|
||||||
|
|
||||||
|
var stopPolling = function (pollId) {
|
||||||
|
for (var i = polls.length; i--;) {
|
||||||
|
var poll = polls[i];
|
||||||
|
if (poll.id === pollId) {
|
||||||
|
polls.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var reset = function () {
|
||||||
|
polls.forEach(function (poll) {
|
||||||
|
poll.uninstall(poll.id);
|
||||||
|
});
|
||||||
|
polls = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
var poll = function () {
|
||||||
|
polls.forEach(function (data) {
|
||||||
|
var result = send(data.data);
|
||||||
|
if (!(result instanceof Array) || result.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data.callback(result);
|
||||||
|
});
|
||||||
|
setTimeout(poll, c.ETH_POLLING_TIMEOUT);
|
||||||
|
};
|
||||||
|
|
||||||
|
poll();
|
||||||
|
|
||||||
|
return {
|
||||||
|
send: send,
|
||||||
|
setProvider: setProvider,
|
||||||
|
startPolling: startPolling,
|
||||||
|
stopPolling: stopPolling,
|
||||||
|
reset: reset
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = requestManager;
|
||||||
|
|
||||||
|
|
||||||
|
},{"./const":2,"./jsonrpc":10}],13:[function(require,module,exports){
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file shh.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.shh api methods
|
||||||
|
var methods = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'post', call: 'shh_post' },
|
||||||
|
{ name: 'newIdentity', call: 'shh_newIdentity' },
|
||||||
|
{ name: 'haveIdentity', call: 'shh_haveIdentity' },
|
||||||
|
{ name: 'newGroup', call: 'shh_newGroup' },
|
||||||
|
{ name: 'addToGroup', call: 'shh_addToGroup' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
methods: methods
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
},{}],14:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -1218,7 +1399,7 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"./formatters":6}],12:[function(require,module,exports){
|
},{"./formatters":8}],15:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -1362,7 +1543,58 @@ module.exports = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
},{"./const":2}],13:[function(require,module,exports){
|
},{"./const":2}],16:[function(require,module,exports){
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file watches.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.eth.watch api methods
|
||||||
|
var eth = function () {
|
||||||
|
var newFilter = function (args) {
|
||||||
|
return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
{ name: 'newFilter', call: newFilter },
|
||||||
|
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' },
|
||||||
|
{ name: 'getMessages', call: 'eth_filterLogs' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.shh.watch api methods
|
||||||
|
var shh = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'newFilter', call: 'shh_newFilter' },
|
||||||
|
{ name: 'uninstallFilter', call: 'shh_uninstallFilter' },
|
||||||
|
{ name: 'getMessages', call: 'shh_getMessages' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
eth: eth,
|
||||||
|
shh: shh
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
},{}],17:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
This file is part of ethereum.js.
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
|
@ -1392,7 +1624,13 @@ if ("build" !== 'build') {/*
|
||||||
var BigNumber = require('bignumber.js');
|
var BigNumber = require('bignumber.js');
|
||||||
*/}
|
*/}
|
||||||
|
|
||||||
|
var eth = require('./eth');
|
||||||
|
var db = require('./db');
|
||||||
|
var shh = require('./shh');
|
||||||
|
var watches = require('./watches');
|
||||||
|
var filter = require('./filter');
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
|
var requestManager = require('./requestmanager');
|
||||||
|
|
||||||
/// @returns an array of objects describing web3 api methods
|
/// @returns an array of objects describing web3 api methods
|
||||||
var web3Methods = function () {
|
var web3Methods = function () {
|
||||||
|
|
@ -1401,100 +1639,6 @@ var web3Methods = function () {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.eth api methods
|
|
||||||
var ethMethods = function () {
|
|
||||||
var blockCall = function (args) {
|
|
||||||
return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber";
|
|
||||||
};
|
|
||||||
|
|
||||||
var transactionCall = function (args) {
|
|
||||||
return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber';
|
|
||||||
};
|
|
||||||
|
|
||||||
var uncleCall = function (args) {
|
|
||||||
return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber';
|
|
||||||
};
|
|
||||||
|
|
||||||
var methods = [
|
|
||||||
{ name: 'balanceAt', call: 'eth_balanceAt' },
|
|
||||||
{ name: 'register', call: 'eth_register' },
|
|
||||||
{ name: 'unregister', call: 'eth_unregister' },
|
|
||||||
{ name: 'stateAt', call: 'eth_stateAt' },
|
|
||||||
{ name: 'storageAt', call: 'eth_storageAt' },
|
|
||||||
{ name: 'countAt', call: 'eth_countAt'},
|
|
||||||
{ name: 'codeAt', call: 'eth_codeAt' },
|
|
||||||
{ name: 'transact', call: 'eth_transact' },
|
|
||||||
{ name: 'call', call: 'eth_call' },
|
|
||||||
{ name: 'block', call: blockCall },
|
|
||||||
{ name: 'transaction', call: transactionCall },
|
|
||||||
{ name: 'uncle', call: uncleCall },
|
|
||||||
{ name: 'compilers', call: 'eth_compilers' },
|
|
||||||
{ name: 'flush', call: 'eth_flush' },
|
|
||||||
{ name: 'lll', call: 'eth_lll' },
|
|
||||||
{ name: 'solidity', call: 'eth_solidity' },
|
|
||||||
{ name: 'serpent', call: 'eth_serpent' },
|
|
||||||
{ name: 'logs', call: 'eth_logs' }
|
|
||||||
];
|
|
||||||
return methods;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.eth api properties
|
|
||||||
var ethProperties = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },
|
|
||||||
{ name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },
|
|
||||||
{ name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },
|
|
||||||
{ name: 'gasPrice', getter: 'eth_gasPrice' },
|
|
||||||
{ name: 'accounts', getter: 'eth_accounts' },
|
|
||||||
{ name: 'peerCount', getter: 'eth_peerCount' },
|
|
||||||
{ name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },
|
|
||||||
{ name: 'number', getter: 'eth_number'}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.db api methods
|
|
||||||
var dbMethods = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'put', call: 'db_put' },
|
|
||||||
{ name: 'get', call: 'db_get' },
|
|
||||||
{ name: 'putString', call: 'db_putString' },
|
|
||||||
{ name: 'getString', call: 'db_getString' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.shh api methods
|
|
||||||
var shhMethods = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'post', call: 'shh_post' },
|
|
||||||
{ name: 'newIdentity', call: 'shh_newIdentity' },
|
|
||||||
{ name: 'haveIdentity', call: 'shh_haveIdentity' },
|
|
||||||
{ name: 'newGroup', call: 'shh_newGroup' },
|
|
||||||
{ name: 'addToGroup', call: 'shh_addToGroup' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.eth.watch api methods
|
|
||||||
var ethWatchMethods = function () {
|
|
||||||
var newFilter = function (args) {
|
|
||||||
return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';
|
|
||||||
};
|
|
||||||
|
|
||||||
return [
|
|
||||||
{ name: 'newFilter', call: newFilter },
|
|
||||||
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' },
|
|
||||||
{ name: 'getMessages', call: 'eth_filterLogs' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.shh.watch api methods
|
|
||||||
var shhWatchMethods = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'newFilter', call: 'shh_newFilter' },
|
|
||||||
{ name: 'uninstallFilter', call: 'shh_uninstallFilter' },
|
|
||||||
{ name: 'getMessages', call: 'shh_getMessages' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// creates methods in a given object based on method description on input
|
/// creates methods in a given object based on method description on input
|
||||||
/// setups api calls for these methods
|
/// setups api calls for these methods
|
||||||
var setupMethods = function (obj, methods) {
|
var setupMethods = function (obj, methods) {
|
||||||
|
|
@ -1502,7 +1646,7 @@ var setupMethods = function (obj, methods) {
|
||||||
obj[method.name] = function () {
|
obj[method.name] = function () {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
var call = typeof method.call === 'function' ? method.call(args) : method.call;
|
var call = typeof method.call === 'function' ? method.call(args) : method.call;
|
||||||
return web3.provider.send({
|
return web3.manager.send({
|
||||||
method: call,
|
method: call,
|
||||||
params: args
|
params: args
|
||||||
});
|
});
|
||||||
|
|
@ -1516,14 +1660,14 @@ var setupProperties = function (obj, properties) {
|
||||||
properties.forEach(function (property) {
|
properties.forEach(function (property) {
|
||||||
var proto = {};
|
var proto = {};
|
||||||
proto.get = function () {
|
proto.get = function () {
|
||||||
return web3.provider.send({
|
return web3.manager.send({
|
||||||
method: property.getter
|
method: property.getter
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (property.setter) {
|
if (property.setter) {
|
||||||
proto.set = function (val) {
|
proto.set = function (val) {
|
||||||
return web3.provider.send({
|
return web3.manager.send({
|
||||||
method: property.setter,
|
method: property.setter,
|
||||||
params: [val]
|
params: [val]
|
||||||
});
|
});
|
||||||
|
|
@ -1533,10 +1677,30 @@ var setupProperties = function (obj, properties) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var startPolling = function (method, id, callback, uninstall) {
|
||||||
|
web3.manager.startPolling({
|
||||||
|
method: method,
|
||||||
|
params: [id]
|
||||||
|
}, id, callback, uninstall);
|
||||||
|
};
|
||||||
|
|
||||||
|
var stopPolling = function (id) {
|
||||||
|
web3.manager.stopPolling(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
var ethWatch = {
|
||||||
|
startPolling: startPolling.bind(null, 'eth_changed'),
|
||||||
|
stopPolling: stopPolling
|
||||||
|
};
|
||||||
|
|
||||||
|
var shhWatch = {
|
||||||
|
startPolling: startPolling.bind(null, 'shh_changed'),
|
||||||
|
stopPolling: stopPolling
|
||||||
|
};
|
||||||
|
|
||||||
/// setups web3 object, and it's in-browser executed methods
|
/// setups web3 object, and it's in-browser executed methods
|
||||||
var web3 = {
|
var web3 = {
|
||||||
_callbacks: {},
|
manager: requestManager(),
|
||||||
_events: {},
|
|
||||||
providers: {},
|
providers: {},
|
||||||
|
|
||||||
/// @returns ascii string representation of hex value prefixed with 0x
|
/// @returns ascii string representation of hex value prefixed with 0x
|
||||||
|
|
@ -1575,11 +1739,12 @@ var web3 = {
|
||||||
/// @param filter may be a string, object or event
|
/// @param filter may be a string, object or event
|
||||||
/// @param indexed is optional, this is an object with optional event indexed params
|
/// @param indexed is optional, this is an object with optional event indexed params
|
||||||
/// @param options is optional, this is an object with optional event options ('max'...)
|
/// @param options is optional, this is an object with optional event options ('max'...)
|
||||||
watch: function (filter, indexed, options) {
|
/// TODO: fix it, 4 params? no way
|
||||||
if (filter._isEvent) {
|
watch: function (fil, indexed, options, formatter) {
|
||||||
return filter(indexed, options);
|
if (fil._isEvent) {
|
||||||
|
return fil(indexed, options);
|
||||||
}
|
}
|
||||||
return new web3.filter(filter, ethWatch);
|
return filter(fil, ethWatch, formatter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1588,54 +1753,44 @@ var web3 = {
|
||||||
|
|
||||||
/// shh object prototype
|
/// shh object prototype
|
||||||
shh: {
|
shh: {
|
||||||
|
|
||||||
/// @param filter may be a string, object or event
|
/// @param filter may be a string, object or event
|
||||||
watch: function (filter, indexed) {
|
watch: function (fil) {
|
||||||
return new web3.filter(filter, shhWatch);
|
return filter(fil, shhWatch);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setProvider: function (provider) {
|
||||||
|
web3.manager.setProvider(provider);
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Should be called to reset state of web3 object
|
||||||
|
/// Resets everything except manager
|
||||||
|
reset: function () {
|
||||||
|
web3.manager.reset();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// setups all api methods
|
/// setups all api methods
|
||||||
setupMethods(web3, web3Methods());
|
setupMethods(web3, web3Methods());
|
||||||
setupMethods(web3.eth, ethMethods());
|
setupMethods(web3.eth, eth.methods());
|
||||||
setupProperties(web3.eth, ethProperties());
|
setupProperties(web3.eth, eth.properties());
|
||||||
setupMethods(web3.db, dbMethods());
|
setupMethods(web3.db, db.methods());
|
||||||
setupMethods(web3.shh, shhMethods());
|
setupMethods(web3.shh, shh.methods());
|
||||||
|
setupMethods(ethWatch, watches.eth());
|
||||||
var ethWatch = {
|
setupMethods(shhWatch, watches.shh());
|
||||||
changed: 'eth_changed'
|
|
||||||
};
|
|
||||||
|
|
||||||
setupMethods(ethWatch, ethWatchMethods());
|
|
||||||
|
|
||||||
var shhWatch = {
|
|
||||||
changed: 'shh_changed'
|
|
||||||
};
|
|
||||||
|
|
||||||
setupMethods(shhWatch, shhWatchMethods());
|
|
||||||
|
|
||||||
web3.setProvider = function(provider) {
|
|
||||||
web3.provider.set(provider);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = web3;
|
module.exports = web3;
|
||||||
|
|
||||||
|
|
||||||
},{"./utils":12}],"web3":[function(require,module,exports){
|
},{"./db":4,"./eth":5,"./filter":7,"./requestmanager":12,"./shh":13,"./utils":15,"./watches":16}],"web3":[function(require,module,exports){
|
||||||
var web3 = require('./lib/web3');
|
var web3 = require('./lib/web3');
|
||||||
var ProviderManager = require('./lib/providermanager');
|
|
||||||
web3.provider = new ProviderManager();
|
|
||||||
web3.filter = require('./lib/filter');
|
|
||||||
web3.providers.HttpSyncProvider = require('./lib/httpsync');
|
web3.providers.HttpSyncProvider = require('./lib/httpsync');
|
||||||
web3.providers.QtSyncProvider = require('./lib/qtsync');
|
web3.providers.QtSyncProvider = require('./lib/qtsync');
|
||||||
web3.eth.contract = require('./lib/contract');
|
web3.eth.contract = require('./lib/contract');
|
||||||
web3.abi = require('./lib/abi');
|
web3.abi = require('./lib/abi');
|
||||||
|
|
||||||
|
|
||||||
module.exports = web3;
|
module.exports = web3;
|
||||||
|
|
||||||
},{"./lib/abi":1,"./lib/contract":3,"./lib/filter":5,"./lib/httpsync":7,"./lib/providermanager":9,"./lib/qtsync":10,"./lib/web3":13}]},{},["web3"])
|
},{"./lib/abi":1,"./lib/contract":3,"./lib/httpsync":9,"./lib/qtsync":11,"./lib/web3":17}]},{},["web3"])
|
||||||
|
|
||||||
|
|
||||||
//# sourceMappingURL=ethereum.js.map
|
//# sourceMappingURL=ethereum.js.map
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -17,11 +17,7 @@
|
||||||
var originalBalance = web3.toDecimal(balance);
|
var originalBalance = web3.toDecimal(balance);
|
||||||
document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
|
document.getElementById('original').innerText = 'original balance: ' + originalBalance + ' watching...';
|
||||||
|
|
||||||
<<<<<<< HEAD:cmd/mist/assets/ext/ethereum.js/example/balance.html
|
|
||||||
var filter = web3.eth.watch({address: coinbase}).changed(function() {
|
|
||||||
=======
|
|
||||||
web3.eth.watch('pending').changed(function() {
|
web3.eth.watch('pending').changed(function() {
|
||||||
>>>>>>> 859a1999cb204d2c6fcb08d6569c738c5af5cd86:example/balance.html
|
|
||||||
balance = web3.eth.balanceAt(coinbase)
|
balance = web3.eth.balanceAt(coinbase)
|
||||||
var currentBalance = web3.toDecimal(balance);
|
var currentBalance = web3.toDecimal(balance);
|
||||||
document.getElementById("current").innerText = 'current: ' + currentBalance;
|
document.getElementById("current").innerText = 'current: ' + currentBalance;
|
||||||
|
|
|
||||||
|
|
@ -15,90 +15,55 @@ var unreach = require('unreachable-branch-transform');
|
||||||
var source = require('vinyl-source-stream');
|
var source = require('vinyl-source-stream');
|
||||||
var exorcist = require('exorcist');
|
var exorcist = require('exorcist');
|
||||||
var bower = require('bower');
|
var bower = require('bower');
|
||||||
|
var streamify = require('gulp-streamify');
|
||||||
|
|
||||||
var DEST = './dist/';
|
var DEST = './dist/';
|
||||||
|
var src = 'index';
|
||||||
|
var dst = 'ethereum';
|
||||||
|
|
||||||
var build = function(src, dst, ugly) {
|
var browserifyOptions = {
|
||||||
var result = browserify({
|
debug: true,
|
||||||
debug: true,
|
insert_global_vars: false,
|
||||||
insert_global_vars: false,
|
detectGlobals: false,
|
||||||
detectGlobals: false,
|
bundleExternal: false
|
||||||
bundleExternal: false
|
|
||||||
})
|
|
||||||
.require('./' + src + '.js', {expose: 'web3'})
|
|
||||||
.add('./' + src + '.js')
|
|
||||||
.transform('envify', {
|
|
||||||
NODE_ENV: 'build'
|
|
||||||
})
|
|
||||||
.transform('unreachable-branch-transform');
|
|
||||||
|
|
||||||
if (ugly) {
|
|
||||||
result = result.transform('uglifyify', {
|
|
||||||
mangle: false,
|
|
||||||
compress: {
|
|
||||||
dead_code: false,
|
|
||||||
conditionals: true,
|
|
||||||
unused: false,
|
|
||||||
hoist_funs: true,
|
|
||||||
hoist_vars: true,
|
|
||||||
negate_iife: false
|
|
||||||
},
|
|
||||||
beautify: true,
|
|
||||||
warnings: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.bundle()
|
|
||||||
.pipe(exorcist(path.join( DEST, dst + '.js.map')))
|
|
||||||
.pipe(source(dst + '.js'))
|
|
||||||
.pipe(gulp.dest( DEST ));
|
|
||||||
};
|
|
||||||
|
|
||||||
var uglifyFile = function(file) {
|
|
||||||
return gulp.src( DEST + file + '.js')
|
|
||||||
.pipe(uglify())
|
|
||||||
.pipe(rename(file + '.min.js'))
|
|
||||||
.pipe(gulp.dest( DEST ));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('bower', function(cb){
|
gulp.task('bower', function(cb){
|
||||||
bower.commands.install().on('end', function (installed){
|
bower.commands.install().on('end', function (installed){
|
||||||
console.log(installed);
|
console.log(installed);
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean', ['lint'], function(cb) {
|
gulp.task('clean', ['lint'], function(cb) {
|
||||||
del([ DEST ], cb);
|
del([ DEST ], cb);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('lint', function(){
|
gulp.task('lint', function(){
|
||||||
return gulp.src(['./*.js', './lib/*.js'])
|
return gulp.src(['./*.js', './lib/*.js'])
|
||||||
.pipe(jshint())
|
.pipe(jshint())
|
||||||
.pipe(jshint.reporter('default'));
|
.pipe(jshint.reporter('default'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build', ['clean'], function () {
|
gulp.task('build', ['clean'], function () {
|
||||||
return build('index', 'ethereum', true);
|
return browserify(browserifyOptions)
|
||||||
});
|
.require('./' + src + '.js', {expose: 'web3'})
|
||||||
|
.add('./' + src + '.js')
|
||||||
gulp.task('buildDev', ['clean'], function () {
|
.transform('envify', { NODE_ENV: 'build' })
|
||||||
return build('index', 'ethereum', false);
|
.transform('unreachable-branch-transform')
|
||||||
});
|
.bundle()
|
||||||
|
.pipe(exorcist(path.join( DEST, dst + '.js.map')))
|
||||||
gulp.task('uglify', ['build'], function(){
|
.pipe(source(dst + '.js'))
|
||||||
return uglifyFile('ethereum');
|
.pipe(gulp.dest( DEST ))
|
||||||
});
|
.pipe(streamify(uglify()))
|
||||||
|
.pipe(rename(dst + '.min.js'))
|
||||||
gulp.task('uglifyDev', ['buildDev'], function(){
|
.pipe(gulp.dest( DEST ));
|
||||||
return uglifyFile('ethereum');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function() {
|
gulp.task('watch', function() {
|
||||||
gulp.watch(['./lib/*.js'], ['lint', 'prepare', 'build']);
|
gulp.watch(['./lib/*.js'], ['lint', 'build']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('release', ['bower', 'lint', 'build', 'uglify']);
|
gulp.task('dev', ['bower', 'lint', 'build']);
|
||||||
gulp.task('dev', ['bower', 'lint', 'buildDev', 'uglifyDev']);
|
|
||||||
gulp.task('default', ['dev']);
|
gulp.task('default', ['dev']);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
var web3 = require('./lib/web3');
|
var web3 = require('./lib/web3');
|
||||||
var ProviderManager = require('./lib/providermanager');
|
|
||||||
web3.provider = new ProviderManager();
|
|
||||||
web3.filter = require('./lib/filter');
|
|
||||||
web3.providers.HttpSyncProvider = require('./lib/httpsync');
|
web3.providers.HttpSyncProvider = require('./lib/httpsync');
|
||||||
web3.providers.QtSyncProvider = require('./lib/qtsync');
|
web3.providers.QtSyncProvider = require('./lib/qtsync');
|
||||||
web3.eth.contract = require('./lib/contract');
|
web3.eth.contract = require('./lib/contract');
|
||||||
web3.abi = require('./lib/abi');
|
web3.abi = require('./lib/abi');
|
||||||
|
|
||||||
|
|
||||||
module.exports = web3;
|
module.exports = web3;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ module.exports = {
|
||||||
ETH_PADDING: 32,
|
ETH_PADDING: 32,
|
||||||
ETH_SIGNATURE_LENGTH: 4,
|
ETH_SIGNATURE_LENGTH: 4,
|
||||||
ETH_UNITS: ETH_UNITS,
|
ETH_UNITS: ETH_UNITS,
|
||||||
ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }
|
ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN },
|
||||||
|
ETH_POLLING_TIMEOUT: 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ var web3 = require('./web3');
|
||||||
var abi = require('./abi');
|
var abi = require('./abi');
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
var eventImpl = require('./event');
|
var eventImpl = require('./event');
|
||||||
|
var filter = require('./filter');
|
||||||
|
|
||||||
var exportNatspecGlobals = function (vars) {
|
var exportNatspecGlobals = function (vars) {
|
||||||
// it's used byt natspec.js
|
// it's used byt natspec.js
|
||||||
|
|
@ -145,11 +146,11 @@ var addEventsToContract = function (contract, desc, address) {
|
||||||
var signature = abi.eventSignatureFromAscii(e.name);
|
var signature = abi.eventSignatureFromAscii(e.name);
|
||||||
var event = eventImpl.inputParser(address, signature, e);
|
var event = eventImpl.inputParser(address, signature, e);
|
||||||
var o = event.apply(null, params);
|
var o = event.apply(null, params);
|
||||||
o._onWatchEventResult = function (data) {
|
var outputFormatter = function (data) {
|
||||||
var parser = eventImpl.outputParser(e);
|
var parser = eventImpl.outputParser(e);
|
||||||
return parser(data);
|
return parser(data);
|
||||||
};
|
};
|
||||||
return web3.eth.watch(o);
|
return web3.eth.watch(o, undefined, undefined, outputFormatter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// this property should be used by eth.filter to check if object is an event
|
// this property should be used by eth.filter to check if object is an event
|
||||||
|
|
|
||||||
35
cmd/mist/assets/ext/ethereum.js/lib/db.js
Normal file
35
cmd/mist/assets/ext/ethereum.js/lib/db.js
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file db.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.db api methods
|
||||||
|
var methods = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'put', call: 'db_put' },
|
||||||
|
{ name: 'get', call: 'db_get' },
|
||||||
|
{ name: 'putString', call: 'db_putString' },
|
||||||
|
{ name: 'getString', call: 'db_getString' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
methods: methods
|
||||||
|
};
|
||||||
85
cmd/mist/assets/ext/ethereum.js/lib/eth.js
Normal file
85
cmd/mist/assets/ext/ethereum.js/lib/eth.js
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file eth.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.eth api methods
|
||||||
|
var methods = function () {
|
||||||
|
var blockCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber";
|
||||||
|
};
|
||||||
|
|
||||||
|
var transactionCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
var uncleCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
var transactionCountCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_transactionCountByHash' : 'eth_transactionCountByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
var uncleCountCall = function (args) {
|
||||||
|
return typeof args[0] === "string" ? 'eth_uncleCountByHash' : 'eth_uncleCountByNumber';
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
{ name: 'balanceAt', call: 'eth_balanceAt' },
|
||||||
|
{ name: 'stateAt', call: 'eth_stateAt' },
|
||||||
|
{ name: 'storageAt', call: 'eth_storageAt' },
|
||||||
|
{ name: 'countAt', call: 'eth_countAt'},
|
||||||
|
{ name: 'codeAt', call: 'eth_codeAt' },
|
||||||
|
{ name: 'transact', call: 'eth_transact' },
|
||||||
|
{ name: 'call', call: 'eth_call' },
|
||||||
|
{ name: 'block', call: blockCall },
|
||||||
|
{ name: 'transaction', call: transactionCall },
|
||||||
|
{ name: 'uncle', call: uncleCall },
|
||||||
|
{ name: 'compilers', call: 'eth_compilers' },
|
||||||
|
{ name: 'flush', call: 'eth_flush' },
|
||||||
|
{ name: 'lll', call: 'eth_lll' },
|
||||||
|
{ name: 'solidity', call: 'eth_solidity' },
|
||||||
|
{ name: 'serpent', call: 'eth_serpent' },
|
||||||
|
{ name: 'logs', call: 'eth_logs' },
|
||||||
|
{ name: 'transactionCount', call: transactionCountCall },
|
||||||
|
{ name: 'uncleCount', call: uncleCountCall }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.eth api properties
|
||||||
|
var properties = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },
|
||||||
|
{ name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },
|
||||||
|
{ name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },
|
||||||
|
{ name: 'gasPrice', getter: 'eth_gasPrice' },
|
||||||
|
{ name: 'accounts', getter: 'eth_accounts' },
|
||||||
|
{ name: 'peerCount', getter: 'eth_peerCount' },
|
||||||
|
{ name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },
|
||||||
|
{ name: 'number', getter: 'eth_number'}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
methods: methods,
|
||||||
|
properties: properties
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -99,6 +99,7 @@ var outputParser = function (event) {
|
||||||
args: {}
|
args: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
output.topics = output.topic; // fallback for go-ethereum
|
||||||
if (!output.topic) {
|
if (!output.topic) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,79 +23,91 @@
|
||||||
* @date 2014
|
* @date 2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var web3 = require('./web3'); // jshint ignore:line
|
/// Should be called to check if filter implementation is valid
|
||||||
|
/// @returns true if it is, otherwise false
|
||||||
|
var implementationIsValid = function (i) {
|
||||||
|
return !!i &&
|
||||||
|
typeof i.newFilter === 'function' &&
|
||||||
|
typeof i.getMessages === 'function' &&
|
||||||
|
typeof i.uninstallFilter === 'function' &&
|
||||||
|
typeof i.startPolling === 'function' &&
|
||||||
|
typeof i.stopPolling === 'function';
|
||||||
|
};
|
||||||
|
|
||||||
/// should be used when we want to watch something
|
/// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones
|
||||||
|
/// @param should be string or object
|
||||||
|
/// @returns options string or object
|
||||||
|
var getOptions = function (options) {
|
||||||
|
if (typeof options === 'string') {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
options = options || {};
|
||||||
|
|
||||||
|
if (options.topics) {
|
||||||
|
console.warn('"topics" is deprecated, is "topic" instead');
|
||||||
|
}
|
||||||
|
|
||||||
|
// evaluate lazy properties
|
||||||
|
return {
|
||||||
|
to: options.to,
|
||||||
|
topic: options.topic,
|
||||||
|
earliest: options.earliest,
|
||||||
|
latest: options.latest,
|
||||||
|
max: options.max,
|
||||||
|
skip: options.skip,
|
||||||
|
address: options.address
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Should be used when we want to watch something
|
||||||
/// it's using inner polling mechanism and is notified about changes
|
/// it's using inner polling mechanism and is notified about changes
|
||||||
/// TODO: change 'options' name cause it may be not the best matching one, since we have events
|
/// @param options are filter options
|
||||||
var Filter = function(options, impl) {
|
/// @param implementation, an abstract polling implementation
|
||||||
|
/// @param formatter (optional), callback function which formats output before 'real' callback
|
||||||
if (typeof options !== "string") {
|
var filter = function(options, implementation, formatter) {
|
||||||
|
if (!implementationIsValid(implementation)) {
|
||||||
// topics property is deprecated, warn about it!
|
console.error('filter implemenation is invalid');
|
||||||
if (options.topics) {
|
return;
|
||||||
console.warn('"topics" is deprecated, use "topic" instead');
|
|
||||||
}
|
|
||||||
|
|
||||||
this._onWatchResult = options._onWatchEventResult;
|
|
||||||
|
|
||||||
// evaluate lazy properties
|
|
||||||
options = {
|
|
||||||
to: options.to,
|
|
||||||
topic: options.topic,
|
|
||||||
earliest: options.earliest,
|
|
||||||
latest: options.latest,
|
|
||||||
max: options.max,
|
|
||||||
skip: options.skip,
|
|
||||||
address: options.address
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.impl = impl;
|
options = getOptions(options);
|
||||||
this.callbacks = [];
|
var callbacks = [];
|
||||||
|
var filterId = implementation.newFilter(options);
|
||||||
|
var onMessages = function (messages) {
|
||||||
|
messages.forEach(function (message) {
|
||||||
|
message = formatter ? formatter(message) : message;
|
||||||
|
callbacks.forEach(function (callback) {
|
||||||
|
callback(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
this.id = impl.newFilter(options);
|
implementation.startPolling(filterId, onMessages, implementation.uninstallFilter);
|
||||||
web3.provider.startPolling({method: impl.changed, params: [this.id]}, this.id, this.trigger.bind(this));
|
|
||||||
|
var changed = function (callback) {
|
||||||
|
callbacks.push(callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
var messages = function () {
|
||||||
|
return implementation.getMessages(filterId);
|
||||||
|
};
|
||||||
|
|
||||||
|
var uninstall = function (callback) {
|
||||||
|
implementation.stopPolling(filterId);
|
||||||
|
implementation.uninstallFilter(filterId);
|
||||||
|
callbacks = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
changed: changed,
|
||||||
|
arrived: changed,
|
||||||
|
happened: changed,
|
||||||
|
messages: messages,
|
||||||
|
logs: messages,
|
||||||
|
uninstall: uninstall
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// alias for changed*
|
module.exports = filter;
|
||||||
Filter.prototype.arrived = function(callback) {
|
|
||||||
this.changed(callback);
|
|
||||||
};
|
|
||||||
Filter.prototype.happened = function(callback) {
|
|
||||||
this.changed(callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// gets called when there is new eth/shh message
|
|
||||||
Filter.prototype.changed = function(callback) {
|
|
||||||
this.callbacks.push(callback);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// trigger calling new message from people
|
|
||||||
Filter.prototype.trigger = function(messages) {
|
|
||||||
for (var i = 0; i < this.callbacks.length; i++) {
|
|
||||||
for (var j = 0; j < messages.length; j++) {
|
|
||||||
var message = this._onWatchResult ? this._onWatchResult(messages[j]) : messages[j];
|
|
||||||
this.callbacks[i].call(this, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// should be called to uninstall current filter
|
|
||||||
Filter.prototype.uninstall = function() {
|
|
||||||
this.impl.uninstallFilter(this.id);
|
|
||||||
web3.provider.stopPolling(this.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// should be called to manually trigger getting latest messages from the client
|
|
||||||
Filter.prototype.messages = function() {
|
|
||||||
return this.impl.getMessages(this.id);
|
|
||||||
};
|
|
||||||
|
|
||||||
/// alias for messages
|
|
||||||
Filter.prototype.logs = function () {
|
|
||||||
return this.messages();
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = Filter;
|
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,10 @@ HttpSyncProvider.prototype.send = function (payload) {
|
||||||
request.open('POST', this.host, false);
|
request.open('POST', this.host, false);
|
||||||
request.send(JSON.stringify(payload));
|
request.send(JSON.stringify(payload));
|
||||||
|
|
||||||
// check request.status
|
|
||||||
var result = request.responseText;
|
var result = request.responseText;
|
||||||
|
// check request.status
|
||||||
|
if(request.status !== 200)
|
||||||
|
return;
|
||||||
return JSON.parse(result);
|
return JSON.parse(result);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of ethereum.js.
|
|
||||||
|
|
||||||
ethereum.js is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
ethereum.js is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/** @file providermanager.js
|
|
||||||
* @authors:
|
|
||||||
* Jeffrey Wilcke <jeff@ethdev.com>
|
|
||||||
* Marek Kotewicz <marek@ethdev.com>
|
|
||||||
* Marian Oancea <marian@ethdev.com>
|
|
||||||
* Gav Wood <g@ethdev.com>
|
|
||||||
* @date 2014
|
|
||||||
*/
|
|
||||||
|
|
||||||
var web3 = require('./web3');
|
|
||||||
var jsonrpc = require('./jsonrpc');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provider manager object prototype
|
|
||||||
* It's responsible for passing messages to providers
|
|
||||||
* If no provider is set it's responsible for queuing requests
|
|
||||||
* It's also responsible for polling the ethereum node for incoming messages
|
|
||||||
* Default poll timeout is 12 seconds
|
|
||||||
* If we are running ethereum.js inside ethereum browser, there are backend based tools responsible for polling,
|
|
||||||
* and provider manager polling mechanism is not used
|
|
||||||
*/
|
|
||||||
var ProviderManager = function() {
|
|
||||||
this.polls = [];
|
|
||||||
this.provider = undefined;
|
|
||||||
|
|
||||||
var self = this;
|
|
||||||
var poll = function () {
|
|
||||||
self.polls.forEach(function (data) {
|
|
||||||
var result = self.send(data.data);
|
|
||||||
|
|
||||||
if (!(result instanceof Array) || result.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
data.callback(result);
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(poll, 1000);
|
|
||||||
};
|
|
||||||
poll();
|
|
||||||
};
|
|
||||||
|
|
||||||
/// sends outgoing requests
|
|
||||||
/// @params data - an object with at least 'method' property
|
|
||||||
ProviderManager.prototype.send = function(data) {
|
|
||||||
var payload = jsonrpc.toPayload(data.method, data.params);
|
|
||||||
|
|
||||||
if (this.provider === undefined) {
|
|
||||||
console.error('provider is not set');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = this.provider.send(payload);
|
|
||||||
|
|
||||||
if (!jsonrpc.isValidResponse(result)) {
|
|
||||||
console.log(result);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// setups provider, which will be used for sending messages
|
|
||||||
ProviderManager.prototype.set = function(provider) {
|
|
||||||
this.provider = provider;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// this method is only used, when we do not have native qt bindings and have to do polling on our own
|
|
||||||
/// should be callled, on start watching for eth/shh changes
|
|
||||||
ProviderManager.prototype.startPolling = function (data, pollId, callback) {
|
|
||||||
this.polls.push({data: data, id: pollId, callback: callback});
|
|
||||||
};
|
|
||||||
|
|
||||||
/// should be called to stop polling for certain watch changes
|
|
||||||
ProviderManager.prototype.stopPolling = function (pollId) {
|
|
||||||
for (var i = this.polls.length; i--;) {
|
|
||||||
var poll = this.polls[i];
|
|
||||||
if (poll.id === pollId) {
|
|
||||||
this.polls.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = ProviderManager;
|
|
||||||
|
|
||||||
103
cmd/mist/assets/ext/ethereum.js/lib/requestmanager.js
Normal file
103
cmd/mist/assets/ext/ethereum.js/lib/requestmanager.js
Normal file
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file requestmanager.js
|
||||||
|
* @authors:
|
||||||
|
* Jeffrey Wilcke <jeff@ethdev.com>
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* Marian Oancea <marian@ethdev.com>
|
||||||
|
* Gav Wood <g@ethdev.com>
|
||||||
|
* @date 2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
var jsonrpc = require('./jsonrpc');
|
||||||
|
var c = require('./const');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It's responsible for passing messages to providers
|
||||||
|
* It's also responsible for polling the ethereum node for incoming messages
|
||||||
|
* Default poll timeout is 1 second
|
||||||
|
*/
|
||||||
|
var requestManager = function() {
|
||||||
|
var polls = [];
|
||||||
|
var provider;
|
||||||
|
|
||||||
|
var send = function (data) {
|
||||||
|
var payload = jsonrpc.toPayload(data.method, data.params);
|
||||||
|
|
||||||
|
if (!provider) {
|
||||||
|
console.error('provider is not set');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = provider.send(payload);
|
||||||
|
|
||||||
|
if (!jsonrpc.isValidResponse(result)) {
|
||||||
|
console.log(result);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.result;
|
||||||
|
};
|
||||||
|
|
||||||
|
var setProvider = function (p) {
|
||||||
|
provider = p;
|
||||||
|
};
|
||||||
|
|
||||||
|
var startPolling = function (data, pollId, callback, uninstall) {
|
||||||
|
polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall});
|
||||||
|
};
|
||||||
|
|
||||||
|
var stopPolling = function (pollId) {
|
||||||
|
for (var i = polls.length; i--;) {
|
||||||
|
var poll = polls[i];
|
||||||
|
if (poll.id === pollId) {
|
||||||
|
polls.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var reset = function () {
|
||||||
|
polls.forEach(function (poll) {
|
||||||
|
poll.uninstall(poll.id);
|
||||||
|
});
|
||||||
|
polls = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
var poll = function () {
|
||||||
|
polls.forEach(function (data) {
|
||||||
|
var result = send(data.data);
|
||||||
|
if (!(result instanceof Array) || result.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data.callback(result);
|
||||||
|
});
|
||||||
|
setTimeout(poll, c.ETH_POLLING_TIMEOUT);
|
||||||
|
};
|
||||||
|
|
||||||
|
poll();
|
||||||
|
|
||||||
|
return {
|
||||||
|
send: send,
|
||||||
|
setProvider: setProvider,
|
||||||
|
startPolling: startPolling,
|
||||||
|
stopPolling: stopPolling,
|
||||||
|
reset: reset
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = requestManager;
|
||||||
|
|
||||||
37
cmd/mist/assets/ext/ethereum.js/lib/shh.js
Normal file
37
cmd/mist/assets/ext/ethereum.js/lib/shh.js
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file shh.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.shh api methods
|
||||||
|
var methods = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'post', call: 'shh_post' },
|
||||||
|
{ name: 'newIdentity', call: 'shh_newIdentity' },
|
||||||
|
{ name: 'haveIdentity', call: 'shh_haveIdentity' },
|
||||||
|
{ name: 'newGroup', call: 'shh_newGroup' },
|
||||||
|
{ name: 'addToGroup', call: 'shh_addToGroup' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
methods: methods
|
||||||
|
};
|
||||||
|
|
||||||
49
cmd/mist/assets/ext/ethereum.js/lib/watches.js
Normal file
49
cmd/mist/assets/ext/ethereum.js/lib/watches.js
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
This file is part of ethereum.js.
|
||||||
|
|
||||||
|
ethereum.js is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
ethereum.js is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
/** @file watches.js
|
||||||
|
* @authors:
|
||||||
|
* Marek Kotewicz <marek@ethdev.com>
|
||||||
|
* @date 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.eth.watch api methods
|
||||||
|
var eth = function () {
|
||||||
|
var newFilter = function (args) {
|
||||||
|
return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';
|
||||||
|
};
|
||||||
|
|
||||||
|
return [
|
||||||
|
{ name: 'newFilter', call: newFilter },
|
||||||
|
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' },
|
||||||
|
{ name: 'getMessages', call: 'eth_filterLogs' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
/// @returns an array of objects describing web3.shh.watch api methods
|
||||||
|
var shh = function () {
|
||||||
|
return [
|
||||||
|
{ name: 'newFilter', call: 'shh_newFilter' },
|
||||||
|
{ name: 'uninstallFilter', call: 'shh_uninstallFilter' },
|
||||||
|
{ name: 'getMessages', call: 'shh_getMessages' }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
eth: eth,
|
||||||
|
shh: shh
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -27,7 +27,13 @@ if (process.env.NODE_ENV !== 'build') {
|
||||||
var BigNumber = require('bignumber.js');
|
var BigNumber = require('bignumber.js');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var eth = require('./eth');
|
||||||
|
var db = require('./db');
|
||||||
|
var shh = require('./shh');
|
||||||
|
var watches = require('./watches');
|
||||||
|
var filter = require('./filter');
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
|
var requestManager = require('./requestmanager');
|
||||||
|
|
||||||
/// @returns an array of objects describing web3 api methods
|
/// @returns an array of objects describing web3 api methods
|
||||||
var web3Methods = function () {
|
var web3Methods = function () {
|
||||||
|
|
@ -36,98 +42,6 @@ var web3Methods = function () {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.eth api methods
|
|
||||||
var ethMethods = function () {
|
|
||||||
var blockCall = function (args) {
|
|
||||||
return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber";
|
|
||||||
};
|
|
||||||
|
|
||||||
var transactionCall = function (args) {
|
|
||||||
return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber';
|
|
||||||
};
|
|
||||||
|
|
||||||
var uncleCall = function (args) {
|
|
||||||
return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber';
|
|
||||||
};
|
|
||||||
|
|
||||||
var methods = [
|
|
||||||
{ name: 'balanceAt', call: 'eth_balanceAt' },
|
|
||||||
{ name: 'stateAt', call: 'eth_stateAt' },
|
|
||||||
{ name: 'storageAt', call: 'eth_storageAt' },
|
|
||||||
{ name: 'countAt', call: 'eth_countAt'},
|
|
||||||
{ name: 'codeAt', call: 'eth_codeAt' },
|
|
||||||
{ name: 'transact', call: 'eth_transact' },
|
|
||||||
{ name: 'call', call: 'eth_call' },
|
|
||||||
{ name: 'block', call: blockCall },
|
|
||||||
{ name: 'transaction', call: transactionCall },
|
|
||||||
{ name: 'uncle', call: uncleCall },
|
|
||||||
{ name: 'compilers', call: 'eth_compilers' },
|
|
||||||
{ name: 'flush', call: 'eth_flush' },
|
|
||||||
{ name: 'lll', call: 'eth_lll' },
|
|
||||||
{ name: 'solidity', call: 'eth_solidity' },
|
|
||||||
{ name: 'serpent', call: 'eth_serpent' },
|
|
||||||
{ name: 'logs', call: 'eth_logs' }
|
|
||||||
];
|
|
||||||
return methods;
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.eth api properties
|
|
||||||
var ethProperties = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' },
|
|
||||||
{ name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' },
|
|
||||||
{ name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' },
|
|
||||||
{ name: 'gasPrice', getter: 'eth_gasPrice' },
|
|
||||||
{ name: 'accounts', getter: 'eth_accounts' },
|
|
||||||
{ name: 'peerCount', getter: 'eth_peerCount' },
|
|
||||||
{ name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' },
|
|
||||||
{ name: 'number', getter: 'eth_number'}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.db api methods
|
|
||||||
var dbMethods = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'put', call: 'db_put' },
|
|
||||||
{ name: 'get', call: 'db_get' },
|
|
||||||
{ name: 'putString', call: 'db_putString' },
|
|
||||||
{ name: 'getString', call: 'db_getString' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.shh api methods
|
|
||||||
var shhMethods = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'post', call: 'shh_post' },
|
|
||||||
{ name: 'newIdentity', call: 'shh_newIdentity' },
|
|
||||||
{ name: 'haveIdentity', call: 'shh_haveIdentity' },
|
|
||||||
{ name: 'newGroup', call: 'shh_newGroup' },
|
|
||||||
{ name: 'addToGroup', call: 'shh_addToGroup' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.eth.watch api methods
|
|
||||||
var ethWatchMethods = function () {
|
|
||||||
var newFilter = function (args) {
|
|
||||||
return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter';
|
|
||||||
};
|
|
||||||
|
|
||||||
return [
|
|
||||||
{ name: 'newFilter', call: newFilter },
|
|
||||||
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' },
|
|
||||||
{ name: 'getMessages', call: 'eth_filterLogs' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @returns an array of objects describing web3.shh.watch api methods
|
|
||||||
var shhWatchMethods = function () {
|
|
||||||
return [
|
|
||||||
{ name: 'newFilter', call: 'shh_newFilter' },
|
|
||||||
{ name: 'uninstallFilter', call: 'shh_uninstallFilter' },
|
|
||||||
{ name: 'getMessages', call: 'shh_getMessages' }
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
/// creates methods in a given object based on method description on input
|
/// creates methods in a given object based on method description on input
|
||||||
/// setups api calls for these methods
|
/// setups api calls for these methods
|
||||||
var setupMethods = function (obj, methods) {
|
var setupMethods = function (obj, methods) {
|
||||||
|
|
@ -135,7 +49,7 @@ var setupMethods = function (obj, methods) {
|
||||||
obj[method.name] = function () {
|
obj[method.name] = function () {
|
||||||
var args = Array.prototype.slice.call(arguments);
|
var args = Array.prototype.slice.call(arguments);
|
||||||
var call = typeof method.call === 'function' ? method.call(args) : method.call;
|
var call = typeof method.call === 'function' ? method.call(args) : method.call;
|
||||||
return web3.provider.send({
|
return web3.manager.send({
|
||||||
method: call,
|
method: call,
|
||||||
params: args
|
params: args
|
||||||
});
|
});
|
||||||
|
|
@ -149,14 +63,14 @@ var setupProperties = function (obj, properties) {
|
||||||
properties.forEach(function (property) {
|
properties.forEach(function (property) {
|
||||||
var proto = {};
|
var proto = {};
|
||||||
proto.get = function () {
|
proto.get = function () {
|
||||||
return web3.provider.send({
|
return web3.manager.send({
|
||||||
method: property.getter
|
method: property.getter
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (property.setter) {
|
if (property.setter) {
|
||||||
proto.set = function (val) {
|
proto.set = function (val) {
|
||||||
return web3.provider.send({
|
return web3.manager.send({
|
||||||
method: property.setter,
|
method: property.setter,
|
||||||
params: [val]
|
params: [val]
|
||||||
});
|
});
|
||||||
|
|
@ -166,10 +80,30 @@ var setupProperties = function (obj, properties) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var startPolling = function (method, id, callback, uninstall) {
|
||||||
|
web3.manager.startPolling({
|
||||||
|
method: method,
|
||||||
|
params: [id]
|
||||||
|
}, id, callback, uninstall);
|
||||||
|
};
|
||||||
|
|
||||||
|
var stopPolling = function (id) {
|
||||||
|
web3.manager.stopPolling(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
var ethWatch = {
|
||||||
|
startPolling: startPolling.bind(null, 'eth_changed'),
|
||||||
|
stopPolling: stopPolling
|
||||||
|
};
|
||||||
|
|
||||||
|
var shhWatch = {
|
||||||
|
startPolling: startPolling.bind(null, 'shh_changed'),
|
||||||
|
stopPolling: stopPolling
|
||||||
|
};
|
||||||
|
|
||||||
/// setups web3 object, and it's in-browser executed methods
|
/// setups web3 object, and it's in-browser executed methods
|
||||||
var web3 = {
|
var web3 = {
|
||||||
_callbacks: {},
|
manager: requestManager(),
|
||||||
_events: {},
|
|
||||||
providers: {},
|
providers: {},
|
||||||
|
|
||||||
/// @returns ascii string representation of hex value prefixed with 0x
|
/// @returns ascii string representation of hex value prefixed with 0x
|
||||||
|
|
@ -208,11 +142,12 @@ var web3 = {
|
||||||
/// @param filter may be a string, object or event
|
/// @param filter may be a string, object or event
|
||||||
/// @param indexed is optional, this is an object with optional event indexed params
|
/// @param indexed is optional, this is an object with optional event indexed params
|
||||||
/// @param options is optional, this is an object with optional event options ('max'...)
|
/// @param options is optional, this is an object with optional event options ('max'...)
|
||||||
watch: function (filter, indexed, options) {
|
/// TODO: fix it, 4 params? no way
|
||||||
if (filter._isEvent) {
|
watch: function (fil, indexed, options, formatter) {
|
||||||
return filter(indexed, options);
|
if (fil._isEvent) {
|
||||||
|
return fil(indexed, options);
|
||||||
}
|
}
|
||||||
return new web3.filter(filter, ethWatch);
|
return filter(fil, ethWatch, formatter);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -221,36 +156,30 @@ var web3 = {
|
||||||
|
|
||||||
/// shh object prototype
|
/// shh object prototype
|
||||||
shh: {
|
shh: {
|
||||||
|
|
||||||
/// @param filter may be a string, object or event
|
/// @param filter may be a string, object or event
|
||||||
watch: function (filter, indexed) {
|
watch: function (fil) {
|
||||||
return new web3.filter(filter, shhWatch);
|
return filter(fil, shhWatch);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setProvider: function (provider) {
|
||||||
|
web3.manager.setProvider(provider);
|
||||||
|
},
|
||||||
|
|
||||||
|
/// Should be called to reset state of web3 object
|
||||||
|
/// Resets everything except manager
|
||||||
|
reset: function () {
|
||||||
|
web3.manager.reset();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// setups all api methods
|
/// setups all api methods
|
||||||
setupMethods(web3, web3Methods());
|
setupMethods(web3, web3Methods());
|
||||||
setupMethods(web3.eth, ethMethods());
|
setupMethods(web3.eth, eth.methods());
|
||||||
setupProperties(web3.eth, ethProperties());
|
setupProperties(web3.eth, eth.properties());
|
||||||
setupMethods(web3.db, dbMethods());
|
setupMethods(web3.db, db.methods());
|
||||||
setupMethods(web3.shh, shhMethods());
|
setupMethods(web3.shh, shh.methods());
|
||||||
|
setupMethods(ethWatch, watches.eth());
|
||||||
var ethWatch = {
|
setupMethods(shhWatch, watches.shh());
|
||||||
changed: 'eth_changed'
|
|
||||||
};
|
|
||||||
|
|
||||||
setupMethods(ethWatch, ethWatchMethods());
|
|
||||||
|
|
||||||
var shhWatch = {
|
|
||||||
changed: 'shh_changed'
|
|
||||||
};
|
|
||||||
|
|
||||||
setupMethods(shhWatch, shhWatchMethods());
|
|
||||||
|
|
||||||
web3.setProvider = function(provider) {
|
|
||||||
web3.provider.set(provider);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = web3;
|
module.exports = web3;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,42 @@
|
||||||
{
|
{
|
||||||
"name": "ethereum.js",
|
"name": "ethereum.js",
|
||||||
"namespace": "ethereum",
|
"namespace": "ethereum",
|
||||||
"version": "0.0.13",
|
"version": "0.0.15",
|
||||||
"description": "Ethereum Compatible JavaScript API",
|
"description": "Ethereum Compatible JavaScript API",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "./lib"
|
"lib": "./lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"bignumber.js": ">=2.0.0",
|
||||||
"ws": "*",
|
"ws": "*",
|
||||||
"xmlhttprequest": "*",
|
"xmlhttprequest": "*"
|
||||||
"bignumber.js": ">=2.0.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bower": ">=1.3.0",
|
"bower": ">=1.3.0",
|
||||||
"browserify": ">=6.0",
|
"browserify": ">=6.0",
|
||||||
|
"coveralls": "^2.11.2",
|
||||||
"del": ">=0.1.1",
|
"del": ">=0.1.1",
|
||||||
"envify": "^3.0.0",
|
"envify": "^3.0.0",
|
||||||
"exorcist": "^0.1.6",
|
"exorcist": "^0.1.6",
|
||||||
"gulp": ">=3.4.0",
|
"gulp": ">=3.4.0",
|
||||||
"gulp-jshint": ">=1.5.0",
|
"gulp-jshint": ">=1.5.0",
|
||||||
"gulp-rename": ">=1.2.0",
|
"gulp-rename": ">=1.2.0",
|
||||||
|
"gulp-streamify": "0.0.5",
|
||||||
"gulp-uglify": ">=1.0.0",
|
"gulp-uglify": ">=1.0.0",
|
||||||
|
"istanbul": "^0.3.5",
|
||||||
"jshint": ">=2.5.0",
|
"jshint": ">=2.5.0",
|
||||||
"uglifyify": "^2.6.0",
|
"mocha": ">=2.1.0",
|
||||||
|
"mocha-lcov-reporter": "0.0.1",
|
||||||
"unreachable-branch-transform": "^0.1.0",
|
"unreachable-branch-transform": "^0.1.0",
|
||||||
"vinyl-source-stream": "^1.0.0",
|
"vinyl-source-stream": "^1.0.0"
|
||||||
"mocha": ">=2.1.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "gulp",
|
"build": "gulp",
|
||||||
"watch": "gulp watch",
|
"watch": "gulp watch",
|
||||||
"lint": "gulp lint",
|
"lint": "gulp lint",
|
||||||
"test": "mocha"
|
"test": "mocha",
|
||||||
|
"test-coveralls": "istanbul cover _mocha -- -R spec && cat coverage/lcov.info | coveralls --verbose"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ var clone = function (object) { return JSON.parse(JSON.stringify(object)); };
|
||||||
|
|
||||||
var description = [{
|
var description = [{
|
||||||
"name": "test",
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
"inputs": [{
|
"inputs": [{
|
||||||
"name": "a",
|
"name": "a",
|
||||||
"type": "uint256"
|
"type": "uint256"
|
||||||
|
|
@ -339,10 +340,12 @@ describe('abi', function() {
|
||||||
// given
|
// given
|
||||||
var d = [{
|
var d = [{
|
||||||
name: "test",
|
name: "test",
|
||||||
|
type: "function",
|
||||||
inputs: [{ type: "int" }],
|
inputs: [{ type: "int" }],
|
||||||
outputs: [{ type: "int" }]
|
outputs: [{ type: "int" }]
|
||||||
},{
|
},{
|
||||||
name: "test2",
|
name: "test2",
|
||||||
|
type: "function",
|
||||||
inputs: [{ type: "string" }],
|
inputs: [{ type: "string" }],
|
||||||
outputs: [{ type: "string" }]
|
outputs: [{ type: "string" }]
|
||||||
}];
|
}];
|
||||||
|
|
@ -420,441 +423,5 @@ describe('abi', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('outputParser', function() {
|
|
||||||
it('should parse output string', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: "string" }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"68656c6c6f000000000000000000000000000000000000000000000000000000")[0],
|
|
||||||
'hello'
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"776f726c64000000000000000000000000000000000000000000000000000000")[0],
|
|
||||||
'world'
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output uint', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'uint' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
|
||||||
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
|
||||||
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output uint256', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'uint256' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
|
||||||
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
|
||||||
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output uint128', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'uint128' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
|
||||||
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
|
||||||
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output int', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'int' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
|
||||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
|
||||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output int256', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'int256' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
|
||||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
|
||||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output int128', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'int128' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
|
||||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
|
||||||
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output hash', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'hash' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
|
||||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output hash256', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'hash256' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
|
||||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output hash160', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'hash160' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
|
||||||
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
|
||||||
);
|
|
||||||
// TODO shouldnt' the expected hash be shorter?
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output address', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'address' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
|
||||||
"0x407d73d8a49eeb85d32cf465507dd71d507100c1"
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output bool', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'bool' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], true);
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000000")[0], false);
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output real', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'real' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1);
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125);
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5);
|
|
||||||
assert.equal(parser.test("0xffffffffffffffffffffffffffffffff00000000000000000000000000000000")[0], -1);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output ureal', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'ureal' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1);
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125);
|
|
||||||
assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it('should parse multiple output strings', function() {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: "string" },
|
|
||||||
{ type: "string" }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"68656c6c6f000000000000000000000000000000000000000000000000000000" +
|
|
||||||
"776f726c64000000000000000000000000000000000000000000000000000000")[0],
|
|
||||||
'hello'
|
|
||||||
);
|
|
||||||
assert.equal(
|
|
||||||
parser.test("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"68656c6c6f000000000000000000000000000000000000000000000000000000" +
|
|
||||||
"776f726c64000000000000000000000000000000000000000000000000000000")[1],
|
|
||||||
'world'
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should use proper method name', function () {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
d[0].name = 'helloworld(int)';
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: "int" }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.helloworld("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.helloworld['int']("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
it('should parse multiple methods', function () {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = [{
|
|
||||||
name: "test",
|
|
||||||
inputs: [{ type: "int" }],
|
|
||||||
outputs: [{ type: "int" }]
|
|
||||||
},{
|
|
||||||
name: "test2",
|
|
||||||
inputs: [{ type: "string" }],
|
|
||||||
outputs: [{ type: "string" }]
|
|
||||||
}];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
//then
|
|
||||||
assert.equal(parser.test("0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
|
||||||
assert.equal(parser.test2("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"68656c6c6f000000000000000000000000000000000000000000000000000000")[0],
|
|
||||||
"hello"
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse output array', function () {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'int[]' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000002" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000006")[0][0],
|
|
||||||
5
|
|
||||||
);
|
|
||||||
assert.equal(parser.test("0x" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000002" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005" +
|
|
||||||
"0000000000000000000000000000000000000000000000000000000000000006")[0][1],
|
|
||||||
6
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse 0x value', function () {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'int' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x")[0], 0);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should parse 0x value', function () {
|
|
||||||
|
|
||||||
// given
|
|
||||||
var d = clone(description);
|
|
||||||
d[0].outputs = [
|
|
||||||
{ type: 'uint' }
|
|
||||||
];
|
|
||||||
|
|
||||||
// when
|
|
||||||
var parser = abi.outputParser(d);
|
|
||||||
|
|
||||||
// then
|
|
||||||
assert.equal(parser.test("0x")[0], 0);
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
461
cmd/mist/assets/ext/ethereum.js/test/abi.outputParser.js
Normal file
461
cmd/mist/assets/ext/ethereum.js/test/abi.outputParser.js
Normal file
|
|
@ -0,0 +1,461 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var BigNumber = require('bignumber.js');
|
||||||
|
var abi = require('../lib/abi.js');
|
||||||
|
var clone = function (object) { return JSON.parse(JSON.stringify(object)); };
|
||||||
|
|
||||||
|
var description = [{
|
||||||
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
describe('abi', function() {
|
||||||
|
describe('outputParser', function() {
|
||||||
|
it('should parse output string', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: "string" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"68656c6c6f000000000000000000000000000000000000000000000000000000")[0],
|
||||||
|
'hello'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"776f726c64000000000000000000000000000000000000000000000000000000")[0],
|
||||||
|
'world'
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output uint', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'uint' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
||||||
|
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
||||||
|
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output uint256', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'uint256' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
||||||
|
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
||||||
|
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output uint128', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'uint128' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0].toString(10),
|
||||||
|
new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).toString(10)
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0].toString(10),
|
||||||
|
new BigNumber("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0", 16).toString(10)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output int', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'int' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||||
|
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
||||||
|
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output int256', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'int256' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||||
|
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
||||||
|
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output int128', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'int128' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test("0x000000000000000000000000000000000000000000000000000000000000000a")[0], 10);
|
||||||
|
assert.equal(parser.test("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")[0], -1);
|
||||||
|
assert.equal(parser.test("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0")[0], -16);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output hash', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'hash' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||||
|
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output hash256', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'hash256' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||||
|
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output hash160', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'hash160' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||||
|
"0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||||
|
);
|
||||||
|
// TODO shouldnt' the expected hash be shorter?
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output address', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'address' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x000000000000000000000000407d73d8a49eeb85d32cf465507dd71d507100c1")[0],
|
||||||
|
"0x407d73d8a49eeb85d32cf465507dd71d507100c1"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output bool', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'bool' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], true);
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000000")[0], false);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output real', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'real' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1);
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125);
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5);
|
||||||
|
assert.equal(parser.test("0xffffffffffffffffffffffffffffffff00000000000000000000000000000000")[0], -1);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output ureal', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'ureal' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1);
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125);
|
||||||
|
assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should parse multiple output strings', function() {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: "string" },
|
||||||
|
{ type: "string" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"68656c6c6f000000000000000000000000000000000000000000000000000000" +
|
||||||
|
"776f726c64000000000000000000000000000000000000000000000000000000")[0],
|
||||||
|
'hello'
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
parser.test("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"68656c6c6f000000000000000000000000000000000000000000000000000000" +
|
||||||
|
"776f726c64000000000000000000000000000000000000000000000000000000")[1],
|
||||||
|
'world'
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should use proper method name', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
d[0].name = 'helloworld(int)';
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: "int" }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.helloworld("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.helloworld['int']("0x0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should parse multiple methods', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = [{
|
||||||
|
name: "test",
|
||||||
|
type: "function",
|
||||||
|
inputs: [{ type: "int" }],
|
||||||
|
outputs: [{ type: "int" }]
|
||||||
|
},{
|
||||||
|
name: "test2",
|
||||||
|
type: "function",
|
||||||
|
inputs: [{ type: "string" }],
|
||||||
|
outputs: [{ type: "string" }]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
//then
|
||||||
|
assert.equal(parser.test("0000000000000000000000000000000000000000000000000000000000000001")[0], 1);
|
||||||
|
assert.equal(parser.test2("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"68656c6c6f000000000000000000000000000000000000000000000000000000")[0],
|
||||||
|
"hello"
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse output array', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'int[]' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000002" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000006")[0][0],
|
||||||
|
5
|
||||||
|
);
|
||||||
|
assert.equal(parser.test("0x" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000002" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000005" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000006")[0][1],
|
||||||
|
6
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse 0x value', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'int' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x")[0], 0);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse 0x value', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var d = clone(description);
|
||||||
|
d[0].outputs = [
|
||||||
|
{ type: 'uint' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var parser = abi.outputParser(d);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(parser.test("0x")[0], 0);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
201
cmd/mist/assets/ext/ethereum.js/test/eth.contract.js
Normal file
201
cmd/mist/assets/ext/ethereum.js/test/eth.contract.js
Normal file
|
|
@ -0,0 +1,201 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var contract = require('../lib/contract.js');
|
||||||
|
|
||||||
|
describe('contract', function() {
|
||||||
|
it('should create simple contract with one method from abi with explicit type name', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test(uint256)",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var con = contract(null, description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal('function', typeof con.test);
|
||||||
|
assert.equal('function', typeof con.test['uint256']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create simple contract with one method from abi with implicit type name', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var con = contract(null, description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal('function', typeof con.test);
|
||||||
|
assert.equal('function', typeof con.test['uint256']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create contract with multiple methods', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
"name": "test2",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var con = contract(null, description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal('function', typeof con.test);
|
||||||
|
assert.equal('function', typeof con.test['uint256']);
|
||||||
|
assert.equal('function', typeof con.test2);
|
||||||
|
assert.equal('function', typeof con.test2['uint256']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create contract with overloaded methods', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var con = contract(null, description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal('function', typeof con.test);
|
||||||
|
assert.equal('function', typeof con.test['uint256']);
|
||||||
|
assert.equal('function', typeof con.test['string']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create contract with no methods', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test(uint256)",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
// when
|
||||||
|
var con = contract(null, description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal('undefined', typeof con.test);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create contract with one event', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test",
|
||||||
|
"type": "event",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
|
||||||
|
// when
|
||||||
|
var con = contract(null, description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal('function', typeof con.test);
|
||||||
|
assert.equal('function', typeof con.test['uint256']);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
@ -19,6 +19,8 @@ describe('web3', function() {
|
||||||
u.methodExists(web3.eth, 'solidity');
|
u.methodExists(web3.eth, 'solidity');
|
||||||
u.methodExists(web3.eth, 'serpent');
|
u.methodExists(web3.eth, 'serpent');
|
||||||
u.methodExists(web3.eth, 'logs');
|
u.methodExists(web3.eth, 'logs');
|
||||||
|
u.methodExists(web3.eth, 'transactionCount');
|
||||||
|
u.methodExists(web3.eth, 'uncleCount');
|
||||||
|
|
||||||
u.propertyExists(web3.eth, 'coinbase');
|
u.propertyExists(web3.eth, 'coinbase');
|
||||||
u.propertyExists(web3.eth, 'listening');
|
u.propertyExists(web3.eth, 'listening');
|
||||||
|
|
|
||||||
125
cmd/mist/assets/ext/ethereum.js/test/event.inputParser.js
Normal file
125
cmd/mist/assets/ext/ethereum.js/test/event.inputParser.js
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var event = require('../lib/event.js');
|
||||||
|
var f = require('../lib/formatters.js');
|
||||||
|
|
||||||
|
describe('event', function () {
|
||||||
|
describe('inputParser', function () {
|
||||||
|
it('should create basic filter input object', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var address = '0x012345';
|
||||||
|
var signature = '0x987654';
|
||||||
|
var e = {
|
||||||
|
name: 'Event',
|
||||||
|
inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event.inputParser(address, signature, e);
|
||||||
|
var result = impl();
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.address, address);
|
||||||
|
assert.equal(result.topic.length, 1);
|
||||||
|
assert.equal(result.topic[0], signature);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create filter input object with options', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var address = '0x012345';
|
||||||
|
var signature = '0x987654';
|
||||||
|
var options = {
|
||||||
|
earliest: 1,
|
||||||
|
latest: 2,
|
||||||
|
offset: 3,
|
||||||
|
max: 4
|
||||||
|
};
|
||||||
|
var e = {
|
||||||
|
name: 'Event',
|
||||||
|
inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event.inputParser(address, signature, e);
|
||||||
|
var result = impl({}, options);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.address, address);
|
||||||
|
assert.equal(result.topic.length, 1);
|
||||||
|
assert.equal(result.topic[0], signature);
|
||||||
|
assert.equal(result.earliest, options.earliest);
|
||||||
|
assert.equal(result.latest, options.latest);
|
||||||
|
assert.equal(result.offset, options.offset);
|
||||||
|
assert.equal(result.max, options.max);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create filter input object with indexed params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var address = '0x012345';
|
||||||
|
var signature = '0x987654';
|
||||||
|
var options = {
|
||||||
|
earliest: 1,
|
||||||
|
latest: 2,
|
||||||
|
offset: 3,
|
||||||
|
max: 4
|
||||||
|
};
|
||||||
|
var e = {
|
||||||
|
name: 'Event',
|
||||||
|
inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event.inputParser(address, signature, e);
|
||||||
|
var result = impl({a: 4}, options);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.address, address);
|
||||||
|
assert.equal(result.topic.length, 2);
|
||||||
|
assert.equal(result.topic[0], signature);
|
||||||
|
assert.equal(result.topic[1], f.formatInputInt(4));
|
||||||
|
assert.equal(result.earliest, options.earliest);
|
||||||
|
assert.equal(result.latest, options.latest);
|
||||||
|
assert.equal(result.offset, options.offset);
|
||||||
|
assert.equal(result.max, options.max);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create filter input object with an array of indexed params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var address = '0x012345';
|
||||||
|
var signature = '0x987654';
|
||||||
|
var options = {
|
||||||
|
earliest: 1,
|
||||||
|
latest: 2,
|
||||||
|
offset: 3,
|
||||||
|
max: 4
|
||||||
|
};
|
||||||
|
var e = {
|
||||||
|
name: 'Event',
|
||||||
|
inputs: [{"name":"a","type":"uint256","indexed":true},{"name":"b","type":"hash256","indexed":false}]
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event.inputParser(address, signature, e);
|
||||||
|
var result = impl({a: [4, 69]}, options);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.address, address);
|
||||||
|
assert.equal(result.topic.length, 2);
|
||||||
|
assert.equal(result.topic[0], signature);
|
||||||
|
assert.equal(result.topic[1][0], f.formatInputInt(4));
|
||||||
|
assert.equal(result.topic[1][1], f.formatInputInt(69));
|
||||||
|
assert.equal(result.earliest, options.earliest);
|
||||||
|
assert.equal(result.latest, options.latest);
|
||||||
|
assert.equal(result.offset, options.offset);
|
||||||
|
assert.equal(result.max, options.max);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
81
cmd/mist/assets/ext/ethereum.js/test/event.outputParser.js
Normal file
81
cmd/mist/assets/ext/ethereum.js/test/event.outputParser.js
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var event = require('../lib/event.js');
|
||||||
|
|
||||||
|
describe('event', function () {
|
||||||
|
describe('outputParser', function () {
|
||||||
|
it('should parse basic event output object', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var output = {
|
||||||
|
"address":"0x78dfc5983baecf65f73e3de3a96cee24e6b7981e",
|
||||||
|
"data":"0x000000000000000000000000000000000000000000000000000000000000004b",
|
||||||
|
"number":2,
|
||||||
|
"topic":[
|
||||||
|
"0x6e61ef44ac2747ff8b84d353a908eb8bd5c3fb118334d57698c5cfc7041196ad",
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000001"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
var e = {
|
||||||
|
name: 'Event',
|
||||||
|
inputs: [{"name":"a","type":"bool","indexed":true},{"name":"b","type":"uint256","indexed":false}]
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event.outputParser(e);
|
||||||
|
var result = impl(output);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.event, 'Event');
|
||||||
|
assert.equal(result.number, 2);
|
||||||
|
assert.equal(Object.keys(result.args).length, 2);
|
||||||
|
assert.equal(result.args.a, true);
|
||||||
|
assert.equal(result.args.b, 75);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should parse event output object arguments in correct order', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var output = {
|
||||||
|
"address":"0x78dfc5983baecf65f73e3de3a96cee24e6b7981e",
|
||||||
|
"data": "0x" +
|
||||||
|
"000000000000000000000000000000000000000000000000000000000000004b" +
|
||||||
|
"000000000000000000000000000000000000000000000000000000000000004c" +
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
|
"number":3,
|
||||||
|
"topic":[
|
||||||
|
"0x6e61ef44ac2747ff8b84d353a908eb8bd5c3fb118334d57698c5cfc7041196ad",
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
|
"0x0000000000000000000000000000000000000000000000000000000000000005"
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
var e = {
|
||||||
|
name: 'Event2',
|
||||||
|
inputs: [
|
||||||
|
{"name":"a","type":"bool","indexed":true},
|
||||||
|
{"name":"b","type":"int","indexed":false},
|
||||||
|
{"name":"c","type":"int","indexed":false},
|
||||||
|
{"name":"d","type":"int","indexed":true},
|
||||||
|
{"name":"e","type":"bool","indexed":false}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var impl = event.outputParser(e);
|
||||||
|
var result = impl(output);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(result.event, 'Event2');
|
||||||
|
assert.equal(result.number, 3);
|
||||||
|
assert.equal(Object.keys(result.args).length, 5);
|
||||||
|
assert.equal(result.args.a, true);
|
||||||
|
assert.equal(result.args.b, 75);
|
||||||
|
assert.equal(result.args.c, 76);
|
||||||
|
assert.equal(result.args.d, 5);
|
||||||
|
assert.equal(result.args.e, true);
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
27
cmd/mist/assets/ext/ethereum.js/test/filter.methods.js
Normal file
27
cmd/mist/assets/ext/ethereum.js/test/filter.methods.js
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var filter = require('../lib/filter');
|
||||||
|
var u = require('./test.utils.js');
|
||||||
|
|
||||||
|
var empty = function () {};
|
||||||
|
var implementation = {
|
||||||
|
newFilter: empty,
|
||||||
|
getMessages: empty,
|
||||||
|
uninstallFilter: empty,
|
||||||
|
startPolling: empty,
|
||||||
|
stopPolling: empty,
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('web3', function () {
|
||||||
|
describe('eth', function () {
|
||||||
|
describe('filter', function () {
|
||||||
|
var f = filter({}, implementation);
|
||||||
|
|
||||||
|
u.methodExists(f, 'arrived');
|
||||||
|
u.methodExists(f, 'happened');
|
||||||
|
u.methodExists(f, 'changed');
|
||||||
|
u.methodExists(f, 'messages');
|
||||||
|
u.methodExists(f, 'logs');
|
||||||
|
u.methodExists(f, 'uninstall');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
143
cmd/mist/assets/ext/ethereum.js/test/jsonrpc.isValidResponse.js
Normal file
143
cmd/mist/assets/ext/ethereum.js/test/jsonrpc.isValidResponse.js
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var jsonrpc = require('../lib/jsonrpc');
|
||||||
|
|
||||||
|
describe('jsonrpc', function () {
|
||||||
|
describe('isValidResponse', function () {
|
||||||
|
it('should validate basic jsonrpc response', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id: 1,
|
||||||
|
result: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate basic undefined response', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = undefined;
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response without jsonrpc field', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
id: 1,
|
||||||
|
result: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response with wrong jsonrpc version', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '1.0',
|
||||||
|
id: 1,
|
||||||
|
result: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response without id number', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
result: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response with wrong id field', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id: 'x',
|
||||||
|
result: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response without result field', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id: 1
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response with result field === false', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id: 1,
|
||||||
|
result: false
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should validate jsonrpc response with result field === 0', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var response = {
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
id: 1,
|
||||||
|
result: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var valid = jsonrpc.isValidResponse(response);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(valid, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var jsonrpc = require('../lib/jsonrpc');
|
||||||
|
|
||||||
|
describe('jsonrpc', function () {
|
||||||
|
describe('toBatchPayload', function () {
|
||||||
|
it('should create basic batch payload', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var messages = [{
|
||||||
|
method: 'helloworld'
|
||||||
|
}, {
|
||||||
|
method: 'test2',
|
||||||
|
params: [1]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var payload = jsonrpc.toBatchPayload(messages);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(payload instanceof Array, true);
|
||||||
|
assert.equal(payload.length, 2);
|
||||||
|
assert.equal(payload[0].jsonrpc, '2.0');
|
||||||
|
assert.equal(payload[1].jsonrpc, '2.0');
|
||||||
|
assert.equal(payload[0].method, 'helloworld');
|
||||||
|
assert.equal(payload[1].method, 'test2');
|
||||||
|
assert.equal(payload[0].params instanceof Array, true);
|
||||||
|
assert.equal(payload[1].params.length, 1);
|
||||||
|
assert.equal(payload[1].params[0], 1);
|
||||||
|
assert.equal(typeof payload[0].id, 'number');
|
||||||
|
assert.equal(typeof payload[1].id, 'number');
|
||||||
|
assert.equal(payload[0].id + 1, payload[1].id);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create batch payload for empty input array', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var messages = [];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var payload = jsonrpc.toBatchPayload(messages);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(payload instanceof Array, true);
|
||||||
|
assert.equal(payload.length, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
40
cmd/mist/assets/ext/ethereum.js/test/jsonrpc.toPayload.js
Normal file
40
cmd/mist/assets/ext/ethereum.js/test/jsonrpc.toPayload.js
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var jsonrpc = require('../lib/jsonrpc');
|
||||||
|
|
||||||
|
describe('jsonrpc', function () {
|
||||||
|
describe('toPayload', function () {
|
||||||
|
it('should create basic payload', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var method = 'helloworld';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var payload = jsonrpc.toPayload(method);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(payload.jsonrpc, '2.0');
|
||||||
|
assert.equal(payload.method, method);
|
||||||
|
assert.equal(payload.params instanceof Array, true);
|
||||||
|
assert.equal(payload.params.length, 0);
|
||||||
|
assert.equal(typeof payload.id, 'number');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create payload with params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var method = 'helloworld1';
|
||||||
|
var params = [123, 'test'];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var payload = jsonrpc.toPayload(method, params);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(payload.jsonrpc, '2.0');
|
||||||
|
assert.equal(payload.method, method);
|
||||||
|
assert.equal(payload.params.length, 2);
|
||||||
|
assert.equal(payload.params[0], params[0]);
|
||||||
|
assert.equal(payload.params[1], params[1]);
|
||||||
|
assert.equal(typeof payload.id, 'number');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var utils = require('../lib/utils.js');
|
||||||
|
|
||||||
|
describe('utils', function () {
|
||||||
|
describe('extractDisplayName', function () {
|
||||||
|
it('should extract display name from method with no params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld()';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var displayName = utils.extractDisplayName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(displayName, 'helloworld');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should extract display name from method with one param' , function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld1(int)';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var displayName = utils.extractDisplayName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(displayName, 'helloworld1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should extract display name from method with two params' , function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld2(int,string)';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var displayName = utils.extractDisplayName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(displayName, 'helloworld2');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var utils = require('../lib/utils.js');
|
||||||
|
|
||||||
|
describe('utils', function () {
|
||||||
|
describe('extractTypeName', function () {
|
||||||
|
it('should extract type name from method with no params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld()';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var typeName = utils.extractTypeName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(typeName, '');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should extract type name from method with one param', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld1(int)';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var typeName = utils.extractTypeName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(typeName, 'int');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should extract type name from method with two params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld2(int,string)';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var typeName = utils.extractTypeName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(typeName, 'int,string');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should extract type name from method with spaces between params', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var test = 'helloworld3(int, string)';
|
||||||
|
|
||||||
|
// when
|
||||||
|
var typeName = utils.extractTypeName(test);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(typeName, 'int,string');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
49
cmd/mist/assets/ext/ethereum.js/test/utils.filters.js
Normal file
49
cmd/mist/assets/ext/ethereum.js/test/utils.filters.js
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
var assert = require('assert');
|
||||||
|
var utils = require('../lib/utils.js');
|
||||||
|
|
||||||
|
describe('utils', function() {
|
||||||
|
it('should filter functions and events from input array properly', function () {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var description = [{
|
||||||
|
"name": "test",
|
||||||
|
"type": "function",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
"name": "test2",
|
||||||
|
"type": "event",
|
||||||
|
"inputs": [{
|
||||||
|
"name": "a",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"type": "uint256"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|
||||||
|
// when
|
||||||
|
var events = utils.filterEvents(description);
|
||||||
|
var functions = utils.filterFunctions(description);
|
||||||
|
|
||||||
|
// then
|
||||||
|
assert.equal(events.length, 1);
|
||||||
|
assert.equal(events[0].name, 'test2');
|
||||||
|
assert.equal(functions.length, 1);
|
||||||
|
assert.equal(functions[0].name, 'test');
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -6,5 +6,16 @@ describe('web3', function() {
|
||||||
u.methodExists(web3, 'sha3');
|
u.methodExists(web3, 'sha3');
|
||||||
u.methodExists(web3, 'toAscii');
|
u.methodExists(web3, 'toAscii');
|
||||||
u.methodExists(web3, 'fromAscii');
|
u.methodExists(web3, 'fromAscii');
|
||||||
|
u.methodExists(web3, 'toDecimal');
|
||||||
|
u.methodExists(web3, 'fromDecimal');
|
||||||
|
u.methodExists(web3, 'toEth');
|
||||||
|
u.methodExists(web3, 'setProvider');
|
||||||
|
u.methodExists(web3, 'reset');
|
||||||
|
|
||||||
|
u.propertyExists(web3, 'manager');
|
||||||
|
u.propertyExists(web3, 'providers');
|
||||||
|
u.propertyExists(web3, 'eth');
|
||||||
|
u.propertyExists(web3, 'db');
|
||||||
|
u.propertyExists(web3, 'shh');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -384,11 +384,11 @@ Rectangle {
|
||||||
params[fields[i]] = params[fields[i]] || "";
|
params[fields[i]] = params[fields[i]] || "";
|
||||||
}
|
}
|
||||||
if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
|
if(typeof params.payload !== "object") { params.payload = [params.payload]; } //params.payload = params.payload.join(""); }
|
||||||
params.topics = params.topics || [];
|
params.topic = params.topic || [];
|
||||||
params.priority = params.priority || 1000;
|
params.priority = params.priority || 1000;
|
||||||
params.ttl = params.ttl || 100;
|
params.ttl = params.ttl || 100;
|
||||||
|
|
||||||
shh.post(params.payload, params.to, params.from, params.topics, params.priority, params.ttl);
|
shh.post(params.payload, params.to, params.from, params.topic, params.priority, params.ttl);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,13 +44,13 @@ Rectangle {
|
||||||
placeholderText: "Data"
|
placeholderText: "Data"
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
id: topics
|
id: topic
|
||||||
placeholderText: "topic1, topic2, topic3, ..."
|
placeholderText: "topic1, topic2, topic3, ..."
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
text: "Send"
|
text: "Send"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
shh.post([eth.toHex(data.text)], "", identity, topics.text.split(","), 500, 50)
|
shh.post([eth.toHex(data.text)], "", identity, topic.text.split(","), 500, 50)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ type Filter struct {
|
||||||
skip int
|
skip int
|
||||||
address [][]byte
|
address [][]byte
|
||||||
max int
|
max int
|
||||||
topics [][]byte
|
topic [][]byte
|
||||||
|
|
||||||
BlockCallback func(*types.Block)
|
BlockCallback func(*types.Block)
|
||||||
PendingCallback func(*types.Block)
|
PendingCallback func(*types.Block)
|
||||||
|
|
@ -50,7 +50,7 @@ func (self *Filter) SetOptions(options FilterOptions) {
|
||||||
self.skip = options.Skip
|
self.skip = options.Skip
|
||||||
self.max = options.Max
|
self.max = options.Max
|
||||||
self.address = options.Address
|
self.address = options.Address
|
||||||
self.topics = options.Topics
|
self.topic = options.Topics
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,8 +69,8 @@ func (self *Filter) SetAddress(addr [][]byte) {
|
||||||
self.address = addr
|
self.address = addr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Filter) SetTopics(topics [][]byte) {
|
func (self *Filter) SetTopics(topic [][]byte) {
|
||||||
self.topics = topics
|
self.topic = topic
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Filter) SetMax(max int) {
|
func (self *Filter) SetMax(max int) {
|
||||||
|
|
@ -150,9 +150,9 @@ Logs:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
max := int(math.Min(float64(len(self.topics)), float64(len(log.Topics()))))
|
max := int(math.Min(float64(len(self.topic)), float64(len(log.Topics()))))
|
||||||
for i := 0; i < max; i++ {
|
for i := 0; i < max; i++ {
|
||||||
if !bytes.Equal(log.Topics()[i], self.topics[i]) {
|
if !bytes.Equal(log.Topics()[i], self.topic[i]) {
|
||||||
continue Logs
|
continue Logs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +178,7 @@ func (self *Filter) bloomFilter(block *types.Block) bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, topic := range self.topics {
|
for _, topic := range self.topic {
|
||||||
if !types.BloomLookup(block.Bloom(), topic) {
|
if !types.BloomLookup(block.Bloom(), topic) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func (self *JSBlock) GetTransaction(hash string) otto.Value {
|
||||||
|
|
||||||
type JSLog struct {
|
type JSLog struct {
|
||||||
Address string `json:address`
|
Address string `json:address`
|
||||||
Topics []string `json:topics`
|
Topics []string `json:topic`
|
||||||
Number int32 `json:number`
|
Number int32 `json:number`
|
||||||
Data string `json:data`
|
Data string `json:data`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ type RpcServer interface {
|
||||||
|
|
||||||
type Log struct {
|
type Log struct {
|
||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Topics []string `json:"topics"`
|
Topics []string `json:"topic"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
14
state/log.go
14
state/log.go
|
|
@ -16,12 +16,12 @@ type Log interface {
|
||||||
|
|
||||||
type StateLog struct {
|
type StateLog struct {
|
||||||
address []byte
|
address []byte
|
||||||
topics [][]byte
|
topic [][]byte
|
||||||
data []byte
|
data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLog(address []byte, topics [][]byte, data []byte) *StateLog {
|
func NewLog(address []byte, topic [][]byte, data []byte) *StateLog {
|
||||||
return &StateLog{address, topics, data}
|
return &StateLog{address, topic, data}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StateLog) Address() []byte {
|
func (self *StateLog) Address() []byte {
|
||||||
|
|
@ -29,7 +29,7 @@ func (self *StateLog) Address() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StateLog) Topics() [][]byte {
|
func (self *StateLog) Topics() [][]byte {
|
||||||
return self.topics
|
return self.topic
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StateLog) Data() []byte {
|
func (self *StateLog) Data() []byte {
|
||||||
|
|
@ -44,18 +44,18 @@ func NewLogFromValue(decoder *ethutil.Value) *StateLog {
|
||||||
|
|
||||||
it := decoder.Get(1).NewIterator()
|
it := decoder.Get(1).NewIterator()
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
log.topics = append(log.topics, it.Value().Bytes())
|
log.topic = append(log.topic, it.Value().Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
return log
|
return log
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StateLog) RlpData() interface{} {
|
func (self *StateLog) RlpData() interface{} {
|
||||||
return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topics), self.data}
|
return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topic), self.data}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StateLog) String() string {
|
func (self *StateLog) String() string {
|
||||||
return fmt.Sprintf(`log: %x %x %x`, self.address, self.topics, self.data)
|
return fmt.Sprintf(`log: %x %x %x`, self.address, self.topic, self.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Logs []Log
|
type Logs []Log
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -246,7 +246,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -329,7 +329,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -412,7 +412,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -495,7 +495,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -578,7 +578,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000002880000000000000000000010000004000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000002880000000000000000000010000004000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
"000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -662,7 +662,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -746,7 +746,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -980,7 +980,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1064,7 +1064,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1148,7 +1148,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1232,7 +1232,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -1316,7 +1316,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000002880000020000000000002010000004000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000002880000020000000000002010000004000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
"000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
||||||
]
|
]
|
||||||
|
|
@ -1401,7 +1401,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
]
|
]
|
||||||
|
|
@ -1486,7 +1486,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1721,7 +1721,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1806,7 +1806,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1891,7 +1891,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1976,7 +1976,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -2061,7 +2061,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000002880000020000000000002010000004000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000002880000020000000000002010000004000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
"000000000000000000000000095e7baea6a6c7c4c2dfeb977efac326af552d87"
|
||||||
|
|
@ -2147,7 +2147,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
|
|
@ -2233,7 +2233,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00003004000000000000800000000010000008000000000000000980000000000000000000000000000000000000000000001000000400000000000800000000",
|
"bloom" : "00003004000000000000800000000010000008000000000000000980000000000000000000000000000000000000000000001000000400000000000800000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000007",
|
"0000000000000000000000000000000000000000000000000000000000000007",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000006",
|
"0000000000000000000000000000000000000000000000000000000000000006",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005"
|
"0000000000000000000000000000000000000000000000000000000000000005"
|
||||||
|
|
@ -2319,7 +2319,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -2555,7 +2555,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -2641,7 +2641,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -2727,7 +2727,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -2813,7 +2813,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -2975,7 +2975,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
|
|
@ -3138,7 +3138,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -3375,7 +3375,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -3462,7 +3462,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -3549,7 +3549,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -3636,7 +3636,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -26,7 +26,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -135,7 +135,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -186,7 +186,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -237,7 +237,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -288,7 +288,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
@ -339,7 +339,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000008000000808100000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000008000000808100000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
|
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -391,7 +391,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +443,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -553,7 +553,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -605,7 +605,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -657,7 +657,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -709,7 +709,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -761,7 +761,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
|
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
|
||||||
]
|
]
|
||||||
|
|
@ -814,7 +814,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
]
|
]
|
||||||
|
|
@ -867,7 +867,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -978,7 +978,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1031,7 +1031,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1084,7 +1084,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1137,7 +1137,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
]
|
]
|
||||||
|
|
@ -1190,7 +1190,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000008000000808100000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
|
"000000000000000000000000cd1722f3947def4cf144679da39c4c32bdc35681"
|
||||||
|
|
@ -1244,7 +1244,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
|
|
@ -1298,7 +1298,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00003004000000000000800000000010000008000000000000000980000000000000000000000000000000000000000000001000000400000000000800000000",
|
"bloom" : "00003004000000000000800000000010000008000000000000000980000000000000000000000000000000000000000000001000000400000000000800000000",
|
||||||
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
"data" : "0xff00000000000000000000000000000000000000000000000000000000000000",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000007",
|
"0000000000000000000000000000000000000000000000000000000000000007",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000006",
|
"0000000000000000000000000000000000000000000000000000000000000006",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000005"
|
"0000000000000000000000000000000000000000000000000000000000000005"
|
||||||
|
|
@ -1352,7 +1352,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -1464,7 +1464,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -1518,7 +1518,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -1572,7 +1572,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -1626,7 +1626,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
|
@ -1724,7 +1724,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
"bloom" : "00000000000000200000800000000000000000000000000000000880000000000000000000000000000000000000000000000010000000000000000000000020",
|
||||||
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
"data" : "0xaabbffffffffffffffffffffffffffffffffffffffffffffffffffffffffccdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
|
|
@ -1823,7 +1823,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -1936,7 +1936,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0x",
|
"data" : "0x",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -1991,7 +1991,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -2046,7 +2046,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xaa",
|
"data" : "0xaa",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -2101,7 +2101,7 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000020000000000002000000000000000000080000000000000000000000000000000000",
|
||||||
"data" : "0xdd",
|
"data" : "0xdd",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
|
@ -2156,14 +2156,14 @@
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
"address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6",
|
||||||
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
"bloom" : "00000000000000000000800000000000000000000000000000000880000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"data" : "0xffffffffffffffffffffffffffffffff",
|
"data" : "0xffffffffffffffffffffffffffffffff",
|
||||||
"topics" : [
|
"topic" : [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ type Account struct {
|
||||||
type Log struct {
|
type Log struct {
|
||||||
AddressF string `json:"address"`
|
AddressF string `json:"address"`
|
||||||
DataF string `json:"data"`
|
DataF string `json:"data"`
|
||||||
TopicsF []string `json:"topics"`
|
TopicsF []string `json:"topic"`
|
||||||
BloomF string `json:"bloom"`
|
BloomF string `json:"bloom"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Fil
|
||||||
filter.SetSkip(int(val.Uint()))
|
filter.SetSkip(int(val.Uint()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if object["topics"] != nil {
|
if object["topic"] != nil {
|
||||||
filter.SetTopics(MakeTopics(object["topics"]))
|
filter.SetTopics(MakeTopics(object["topic"]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return filter
|
return filter
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ import (
|
||||||
func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Filter {
|
func NewFilterFromMap(object map[string]interface{}, eth core.Backend) *core.Filter {
|
||||||
filter := ui.NewFilterFromMap(object, eth)
|
filter := ui.NewFilterFromMap(object, eth)
|
||||||
|
|
||||||
if object["topics"] != nil {
|
if object["topic"] != nil {
|
||||||
filter.SetTopics(makeTopics(object["topics"]))
|
filter.SetTopics(makeTopics(object["topic"]))
|
||||||
}
|
}
|
||||||
|
|
||||||
return filter
|
return filter
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ func (self *Whisper) SetView(view qml.Object) {
|
||||||
self.view = view
|
self.view = view
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) Post(payload []string, to, from string, topics []string, priority, ttl uint32) {
|
func (self *Whisper) Post(payload []string, to, from string, topic []string, priority, ttl uint32) {
|
||||||
var data []byte
|
var data []byte
|
||||||
for _, d := range payload {
|
for _, d := range payload {
|
||||||
data = append(data, fromHex(d)...)
|
data = append(data, fromHex(d)...)
|
||||||
|
|
@ -49,7 +49,7 @@ func (self *Whisper) Post(payload []string, to, from string, topics []string, pr
|
||||||
Ttl: time.Duration(ttl) * time.Second,
|
Ttl: time.Duration(ttl) * time.Second,
|
||||||
To: crypto.ToECDSAPub(fromHex(to)),
|
To: crypto.ToECDSAPub(fromHex(to)),
|
||||||
From: key,
|
From: key,
|
||||||
Topics: whisper.TopicsFromString(topics...),
|
Topics: whisper.TopicsFromString(topic...),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -111,10 +111,10 @@ func filterFromMap(opts map[string]interface{}) (f whisper.Filter) {
|
||||||
if from, ok := opts["from"].(string); ok {
|
if from, ok := opts["from"].(string); ok {
|
||||||
f.From = crypto.ToECDSAPub(fromHex(from))
|
f.From = crypto.ToECDSAPub(fromHex(from))
|
||||||
}
|
}
|
||||||
if topicList, ok := opts["topics"].(*qml.List); ok {
|
if topicList, ok := opts["topic"].(*qml.List); ok {
|
||||||
var topics []string
|
var topic []string
|
||||||
topicList.Convert(&topics)
|
topicList.Convert(&topic)
|
||||||
f.Topics = whisper.TopicsFromString(topics...)
|
f.Topics = whisper.TopicsFromString(topic...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ func Transfer(from, to Account, amount *big.Int) error {
|
||||||
|
|
||||||
type Log struct {
|
type Log struct {
|
||||||
address []byte
|
address []byte
|
||||||
topics [][]byte
|
topic [][]byte
|
||||||
data []byte
|
data []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ func (self *Log) Address() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Log) Topics() [][]byte {
|
func (self *Log) Topics() [][]byte {
|
||||||
return self.topics
|
return self.topic
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Log) Data() []byte {
|
func (self *Log) Data() []byte {
|
||||||
|
|
@ -69,9 +69,9 @@ func (self *Log) Data() []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Log) RlpData() interface{} {
|
func (self *Log) RlpData() interface{} {
|
||||||
return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topics), self.data}
|
return []interface{}{self.address, ethutil.ByteSliceToInterface(self.topic), self.data}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Log) String() string {
|
func (self *Log) String() string {
|
||||||
return fmt.Sprintf("[A=%x T=%x D=%x]", self.address, self.topics, self.data)
|
return fmt.Sprintf("[A=%x T=%x D=%x]", self.address, self.topic, self.data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
vm/vm.go
6
vm/vm.go
|
|
@ -571,14 +571,14 @@ func (self *Vm) Run(me, caller ContextRef, code []byte, value, gas, price *big.I
|
||||||
self.Printf(" => [%d] %x [0] %x", n, x.Bytes(), y.Bytes())
|
self.Printf(" => [%d] %x [0] %x", n, x.Bytes(), y.Bytes())
|
||||||
case LOG0, LOG1, LOG2, LOG3, LOG4:
|
case LOG0, LOG1, LOG2, LOG3, LOG4:
|
||||||
n := int(op - LOG0)
|
n := int(op - LOG0)
|
||||||
topics := make([][]byte, n)
|
topic := make([][]byte, n)
|
||||||
mSize, mStart := stack.Popn()
|
mSize, mStart := stack.Popn()
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
topics[i] = ethutil.LeftPadBytes(stack.Pop().Bytes(), 32)
|
topic[i] = ethutil.LeftPadBytes(stack.Pop().Bytes(), 32)
|
||||||
}
|
}
|
||||||
|
|
||||||
data := mem.Get(mStart.Int64(), mSize.Int64())
|
data := mem.Get(mStart.Int64(), mSize.Int64())
|
||||||
log := &Log{context.Address(), topics, data}
|
log := &Log{context.Address(), topic, data}
|
||||||
self.env.AddLog(log)
|
self.env.AddLog(log)
|
||||||
|
|
||||||
self.Printf(" => %v", log)
|
self.Printf(" => %v", log)
|
||||||
|
|
|
||||||
12
vm/vm_jit.go
12
vm/vm_jit.go
|
|
@ -344,21 +344,21 @@ func env_log(_vm unsafe.Pointer, dataPtr unsafe.Pointer, dataLen uint64, _topic1
|
||||||
|
|
||||||
data := C.GoBytes(dataPtr, C.int(dataLen))
|
data := C.GoBytes(dataPtr, C.int(dataLen))
|
||||||
|
|
||||||
topics := make([][]byte, 0, 4)
|
topic := make([][]byte, 0, 4)
|
||||||
if _topic1 != nil {
|
if _topic1 != nil {
|
||||||
topics = append(topics, llvm2hash((*i256)(_topic1)))
|
topic = append(topic, llvm2hash((*i256)(_topic1)))
|
||||||
}
|
}
|
||||||
if _topic2 != nil {
|
if _topic2 != nil {
|
||||||
topics = append(topics, llvm2hash((*i256)(_topic2)))
|
topic = append(topic, llvm2hash((*i256)(_topic2)))
|
||||||
}
|
}
|
||||||
if _topic3 != nil {
|
if _topic3 != nil {
|
||||||
topics = append(topics, llvm2hash((*i256)(_topic3)))
|
topic = append(topic, llvm2hash((*i256)(_topic3)))
|
||||||
}
|
}
|
||||||
if _topic4 != nil {
|
if _topic4 != nil {
|
||||||
topics = append(topics, llvm2hash((*i256)(_topic4)))
|
topic = append(topic, llvm2hash((*i256)(_topic4)))
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.Env().AddLog(state.NewLog(vm.me.Address(), topics, data))
|
vm.Env().AddLog(state.NewLog(vm.me.Address(), topic, data))
|
||||||
}
|
}
|
||||||
|
|
||||||
//export env_extcode
|
//export env_extcode
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,10 @@ func (self *Envelope) Hash() Hash {
|
||||||
return self.hash
|
return self.hash
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewEnvelope(ttl time.Duration, topics [][]byte, data *Message) *Envelope {
|
func NewEnvelope(ttl time.Duration, topic [][]byte, data *Message) *Envelope {
|
||||||
exp := time.Now().Add(ttl)
|
exp := time.Now().Add(ttl)
|
||||||
|
|
||||||
return &Envelope{uint32(exp.Unix()), uint32(ttl.Seconds()), topics, data.Bytes(), 0, Hash{}}
|
return &Envelope{uint32(exp.Unix()), uint32(ttl.Seconds()), topic, data.Bytes(), 0, Hash{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Envelope) Seal(pow time.Duration) {
|
func (self *Envelope) Seal(pow time.Duration) {
|
||||||
|
|
|
||||||
|
|
@ -269,9 +269,9 @@ func (self *Whisper) Protocol() p2p.Protocol {
|
||||||
return self.protocol
|
return self.protocol
|
||||||
}
|
}
|
||||||
|
|
||||||
func createFilter(message *Message, topics [][]byte, key *ecdsa.PrivateKey) filter.Filter {
|
func createFilter(message *Message, topic [][]byte, key *ecdsa.PrivateKey) filter.Filter {
|
||||||
return filter.Generic{
|
return filter.Generic{
|
||||||
Str1: string(crypto.FromECDSAPub(&key.PublicKey)), Str2: string(crypto.FromECDSAPub(message.Recover())),
|
Str1: string(crypto.FromECDSAPub(&key.PublicKey)), Str2: string(crypto.FromECDSAPub(message.Recover())),
|
||||||
Data: bytesToMap(topics),
|
Data: bytesToMap(topic),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func NewWhisper(w *whisper.Whisper) *Whisper {
|
||||||
return &Whisper{w}
|
return &Whisper{w}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *Whisper) Post(payload string, to, from string, topics []string, priority, ttl uint32) error {
|
func (self *Whisper) Post(payload string, to, from string, topic []string, priority, ttl uint32) error {
|
||||||
if priority == 0 {
|
if priority == 0 {
|
||||||
priority = 1000
|
priority = 1000
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ func (self *Whisper) Post(payload string, to, from string, topics []string, prio
|
||||||
Ttl: time.Duration(ttl) * time.Second,
|
Ttl: time.Duration(ttl) * time.Second,
|
||||||
To: crypto.ToECDSAPub(fromHex(to)),
|
To: crypto.ToECDSAPub(fromHex(to)),
|
||||||
From: key,
|
From: key,
|
||||||
Topics: whisper.TopicsFromString(topics...),
|
Topics: whisper.TopicsFromString(topic...),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue