|
@ -2,19 +2,19 @@ |
|
|
This file is part of ethereum.js. |
|
|
This file is part of ethereum.js. |
|
|
|
|
|
|
|
|
ethereum.js is free software: you can redistribute it and/or modify |
|
|
ethereum.js is free software: you can redistribute it and/or modify |
|
|
it under the terms of the GNU General Public License as published by |
|
|
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 |
|
|
the Free Software Foundation, either version 3 of the License, or |
|
|
(at your option) any later version. |
|
|
(at your option) any later version. |
|
|
|
|
|
|
|
|
ethereum.js is distributed in the hope that it will be useful, |
|
|
ethereum.js is distributed in the hope that it will be useful, |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
GNU General Public License for more details. |
|
|
GNU Lesser General Public License for more details. |
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License |
|
|
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/>.
|
|
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/ |
|
|
*/ |
|
|
/** @file ethereum.js |
|
|
/** @file main.js |
|
|
* @authors: |
|
|
* @authors: |
|
|
* Marek Kotewicz <marek@ethdev.com> |
|
|
* Marek Kotewicz <marek@ethdev.com> |
|
|
* @date 2014 |
|
|
* @date 2014 |
|
@ -66,82 +66,82 @@ |
|
|
|
|
|
|
|
|
var ethMethods = function () { |
|
|
var ethMethods = function () { |
|
|
var blockCall = function (args) { |
|
|
var blockCall = function (args) { |
|
|
return typeof args[0] === "string" ? "blockByHash" : "blockByNumber"; |
|
|
return typeof args[0] === "string" ? "eth_blockByHash" : "eth_blockByNumber"; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var transactionCall = function (args) { |
|
|
var transactionCall = function (args) { |
|
|
return typeof args[0] === "string" ? 'transactionByHash' : 'transactionByNumber'; |
|
|
return typeof args[0] === "string" ? 'eth_transactionByHash' : 'eth_transactionByNumber'; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var uncleCall = function (args) { |
|
|
var uncleCall = function (args) { |
|
|
return typeof args[0] === "string" ? 'uncleByHash' : 'uncleByNumber'; |
|
|
return typeof args[0] === "string" ? 'eth_uncleByHash' : 'eth_uncleByNumber'; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var methods = [ |
|
|
var methods = [ |
|
|
{ name: 'balanceAt', call: 'balanceAt' }, |
|
|
{ name: 'balanceAt', call: 'eth_balanceAt' }, |
|
|
{ name: 'stateAt', call: 'stateAt' }, |
|
|
{ name: 'stateAt', call: 'eth_stateAt' }, |
|
|
{ name: 'countAt', call: 'countAt'}, |
|
|
{ name: 'countAt', call: 'eth_countAt'}, |
|
|
{ name: 'codeAt', call: 'codeAt' }, |
|
|
{ name: 'codeAt', call: 'eth_codeAt' }, |
|
|
{ name: 'transact', call: 'transact' }, |
|
|
{ name: 'transact', call: 'eth_transact' }, |
|
|
{ name: 'call', call: 'call' }, |
|
|
{ name: 'call', call: 'eth_call' }, |
|
|
{ name: 'block', call: blockCall }, |
|
|
{ name: 'block', call: blockCall }, |
|
|
{ name: 'transaction', call: transactionCall }, |
|
|
{ name: 'transaction', call: transactionCall }, |
|
|
{ name: 'uncle', call: uncleCall }, |
|
|
{ name: 'uncle', call: uncleCall }, |
|
|
{ name: 'compile', call: 'compile' } |
|
|
{ name: 'compile', call: 'eth_compile' } |
|
|
]; |
|
|
]; |
|
|
return methods; |
|
|
return methods; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var ethProperties = function () { |
|
|
var ethProperties = function () { |
|
|
return [ |
|
|
return [ |
|
|
{ name: 'coinbase', getter: 'coinbase', setter: 'setCoinbase' }, |
|
|
{ name: 'coinbase', getter: 'eth_coinbase', setter: 'eth_setCoinbase' }, |
|
|
{ name: 'listening', getter: 'listening', setter: 'setListening' }, |
|
|
{ name: 'listening', getter: 'eth_listening', setter: 'eth_setListening' }, |
|
|
{ name: 'mining', getter: 'mining', setter: 'setMining' }, |
|
|
{ name: 'mining', getter: 'eth_mining', setter: 'eth_setMining' }, |
|
|
{ name: 'gasPrice', getter: 'gasPrice' }, |
|
|
{ name: 'gasPrice', getter: 'eth_gasPrice' }, |
|
|
{ name: 'account', getter: 'account' }, |
|
|
{ name: 'account', getter: 'eth_account' }, |
|
|
{ name: 'accounts', getter: 'accounts' }, |
|
|
{ name: 'accounts', getter: 'eth_accounts' }, |
|
|
{ name: 'peerCount', getter: 'peerCount' }, |
|
|
{ name: 'peerCount', getter: 'eth_peerCount' }, |
|
|
{ name: 'defaultBlock', getter: 'defaultBlock', setter: 'setDefaultBlock' }, |
|
|
{ name: 'defaultBlock', getter: 'eth_defaultBlock', setter: 'eth_setDefaultBlock' }, |
|
|
{ name: 'number', getter: 'number'} |
|
|
{ name: 'number', getter: 'eth_number'} |
|
|
]; |
|
|
]; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var dbMethods = function () { |
|
|
var dbMethods = function () { |
|
|
return [ |
|
|
return [ |
|
|
{ name: 'put', call: 'put' }, |
|
|
{ name: 'put', call: 'db_put' }, |
|
|
{ name: 'get', call: 'get' }, |
|
|
{ name: 'get', call: 'db_get' }, |
|
|
{ name: 'putString', call: 'putString' }, |
|
|
{ name: 'putString', call: 'db_putString' }, |
|
|
{ name: 'getString', call: 'getString' } |
|
|
{ name: 'getString', call: 'db_getString' } |
|
|
]; |
|
|
]; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var shhMethods = function () { |
|
|
var shhMethods = function () { |
|
|
return [ |
|
|
return [ |
|
|
{ name: 'post', call: 'post' }, |
|
|
{ name: 'post', call: 'shh_post' }, |
|
|
{ name: 'newIdentity', call: 'newIdentity' }, |
|
|
{ name: 'newIdentity', call: 'shh_newIdentity' }, |
|
|
{ name: 'haveIdentity', call: 'haveIdentity' }, |
|
|
{ name: 'haveIdentity', call: 'shh_haveIdentity' }, |
|
|
{ name: 'newGroup', call: 'newGroup' }, |
|
|
{ name: 'newGroup', call: 'shh_newGroup' }, |
|
|
{ name: 'addToGroup', call: 'addToGroup' } |
|
|
{ name: 'addToGroup', call: 'shh_addToGroup' } |
|
|
]; |
|
|
]; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var ethWatchMethods = function () { |
|
|
var ethWatchMethods = function () { |
|
|
var newFilter = function (args) { |
|
|
var newFilter = function (args) { |
|
|
return typeof args[0] === 'string' ? 'newFilterString' : 'newFilter'; |
|
|
return typeof args[0] === 'string' ? 'eth_newFilterString' : 'eth_newFilter'; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
return [ |
|
|
return [ |
|
|
{ name: 'newFilter', call: newFilter }, |
|
|
{ name: 'newFilter', call: newFilter }, |
|
|
{ name: 'uninstallFilter', call: 'uninstallFilter' }, |
|
|
{ name: 'uninstallFilter', call: 'eth_uninstallFilter' }, |
|
|
{ name: 'getMessages', call: 'getMessages' } |
|
|
{ name: 'getMessages', call: 'eth_getMessages' } |
|
|
]; |
|
|
]; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var shhWatchMethods = function () { |
|
|
var shhWatchMethods = function () { |
|
|
return [ |
|
|
return [ |
|
|
{ name: 'newFilter', call: 'shhNewFilter' }, |
|
|
{ name: 'newFilter', call: 'shh_newFilter' }, |
|
|
{ name: 'uninstallFilter', call: 'shhUninstallFilter' }, |
|
|
{ name: 'uninstallFilter', call: 'shh_uninstallFilter' }, |
|
|
{ name: 'getMessage', call: 'shhGetMessages' } |
|
|
{ name: 'getMessage', call: 'shh_getMessages' } |
|
|
]; |
|
|
]; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|