mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
merge continue 6
fixing expanse.js Again not sure why this one got edited from the last one but -shrug-
This commit is contained in:
parent
9c61f49cfd
commit
61dd18aa9f
1 changed files with 54 additions and 54 deletions
|
|
@ -2543,7 +2543,7 @@ var IpcProvider = require('./web3/ipcprovider');
|
|||
function Web3 (provider) {
|
||||
this._requestManager = new RequestManager(provider);
|
||||
this.currentProvider = provider;
|
||||
this.eth = new Exp(this);
|
||||
this.exp = new Exp(this);
|
||||
this.db = new DB(this);
|
||||
this.shh = new Shh(this);
|
||||
this.net = new Net(this);
|
||||
|
|
@ -2618,7 +2618,7 @@ var properties = function () {
|
|||
}),
|
||||
new Property({
|
||||
name: 'version.expanse',
|
||||
getter: 'eth_protocolVersion',
|
||||
getter: 'exp_protocolVersion',
|
||||
inputFormatter: utils.toDecimal
|
||||
}),
|
||||
new Property({
|
||||
|
|
@ -2963,8 +2963,8 @@ var checkForContractAddress = function(contract, callback){
|
|||
* @method ContractFactory
|
||||
* @param {Array} abi
|
||||
*/
|
||||
var ContractFactory = function (eth, abi) {
|
||||
this.eth = eth;
|
||||
var ContractFactory = function (exp, abi) {
|
||||
this.exp = exp;
|
||||
this.abi = abi;
|
||||
|
||||
/**
|
||||
|
|
@ -2978,7 +2978,7 @@ var ContractFactory = function (eth, abi) {
|
|||
* @returns {Contract} returns contract instance
|
||||
*/
|
||||
this.new = function () {
|
||||
var contract = new Contract(this.eth, this.abi);
|
||||
var contract = new Contract(this.exp, this.abi);
|
||||
|
||||
// parse arguments
|
||||
var options = {}; // required!
|
||||
|
|
@ -3046,7 +3046,7 @@ var ContractFactory = function (eth, abi) {
|
|||
* otherwise calls callback function (err, contract)
|
||||
*/
|
||||
ContractFactory.prototype.at = function (address, callback) {
|
||||
var contract = new Contract(this.eth, this.abi, address);
|
||||
var contract = new Contract(this.exp, this.abi, address);
|
||||
|
||||
// this functions are not part of prototype,
|
||||
// because we dont want to spoil the interface
|
||||
|
|
@ -3086,8 +3086,8 @@ ContractFactory.prototype.getData = function () {
|
|||
* @param {Array} abi
|
||||
* @param {Address} contract address
|
||||
*/
|
||||
var Contract = function (eth, abi, address) {
|
||||
this._eth = eth;
|
||||
var Contract = function (exp, abi, address) {
|
||||
this._eth = exp;
|
||||
this.transactionHash = null;
|
||||
this.address = address;
|
||||
this.abi = abi;
|
||||
|
|
@ -3963,8 +3963,8 @@ var sha3 = require('../utils/sha3');
|
|||
/**
|
||||
* This prototype should be used to call/sendTransaction to solidity functions
|
||||
*/
|
||||
var SolidityFunction = function (eth, json, address) {
|
||||
this._eth = eth;
|
||||
var SolidityFunction = function (exp, json, address) {
|
||||
this._eth = exp;
|
||||
this._inputTypes = json.inputs.map(function (i) {
|
||||
return i.type;
|
||||
});
|
||||
|
|
@ -4134,7 +4134,7 @@ SolidityFunction.prototype.request = function () {
|
|||
var format = this.unpackOutput.bind(this);
|
||||
|
||||
return {
|
||||
method: this._constant ? 'eth_call' : 'eth_sendTransaction',
|
||||
method: this._constant ? 'exp_call' : 'exp_sendTransaction',
|
||||
callback: callback,
|
||||
params: [payload],
|
||||
format: format
|
||||
|
|
@ -5138,23 +5138,23 @@ var Iban = require('../iban');
|
|||
var transfer = require('../transfer');
|
||||
|
||||
var blockCall = function (args) {
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber";
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "exp_getBlockByHash" : "exp_getBlockByNumber";
|
||||
};
|
||||
|
||||
var transactionFromBlockCall = function (args) {
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'exp_getTransactionByBlockHashAndIndex' : 'exp_getTransactionByBlockNumberAndIndex';
|
||||
};
|
||||
|
||||
var uncleCall = function (args) {
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'exp_getUncleByBlockHashAndIndex' : 'exp_getUncleByBlockNumberAndIndex';
|
||||
};
|
||||
|
||||
var getBlockTransactionCountCall = function (args) {
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'exp_getBlockTransactionCountByHash' : 'exp_getBlockTransactionCountByNumber';
|
||||
};
|
||||
|
||||
var uncleCountCall = function (args) {
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';
|
||||
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'exp_getUncleCountByBlockHash' : 'exp_getUncleCountByBlockNumber';
|
||||
};
|
||||
|
||||
function Exp(web3) {
|
||||
|
|
@ -5200,7 +5200,7 @@ Object.defineProperty(Exp.prototype, 'defaultAccount', {
|
|||
var methods = function () {
|
||||
var getBalance = new Method({
|
||||
name: 'getBalance',
|
||||
call: 'eth_getBalance',
|
||||
call: 'exp_getBalance',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: formatters.outputBigNumberFormatter
|
||||
|
|
@ -5208,14 +5208,14 @@ var methods = function () {
|
|||
|
||||
var getStorageAt = new Method({
|
||||
name: 'getStorageAt',
|
||||
call: 'eth_getStorageAt',
|
||||
call: 'exp_getStorageAt',
|
||||
params: 3,
|
||||
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var getCode = new Method({
|
||||
name: 'getCode',
|
||||
call: 'eth_getCode',
|
||||
call: 'exp_getCode',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
|
@ -5239,7 +5239,7 @@ var methods = function () {
|
|||
|
||||
var getCompilers = new Method({
|
||||
name: 'getCompilers',
|
||||
call: 'eth_getCompilers',
|
||||
call: 'exp_getCompilers',
|
||||
params: 0
|
||||
});
|
||||
|
||||
|
|
@ -5261,7 +5261,7 @@ var methods = function () {
|
|||
|
||||
var getTransaction = new Method({
|
||||
name: 'getTransaction',
|
||||
call: 'eth_getTransactionByHash',
|
||||
call: 'exp_getTransactionByHash',
|
||||
params: 1,
|
||||
outputFormatter: formatters.outputTransactionFormatter
|
||||
});
|
||||
|
|
@ -5276,14 +5276,14 @@ var methods = function () {
|
|||
|
||||
var getTransactionReceipt = new Method({
|
||||
name: 'getTransactionReceipt',
|
||||
call: 'eth_getTransactionReceipt',
|
||||
call: 'exp_getTransactionReceipt',
|
||||
params: 1,
|
||||
outputFormatter: formatters.outputTransactionReceiptFormatter
|
||||
});
|
||||
|
||||
var getTransactionCount = new Method({
|
||||
name: 'getTransactionCount',
|
||||
call: 'eth_getTransactionCount',
|
||||
call: 'exp_getTransactionCount',
|
||||
params: 2,
|
||||
inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
|
||||
outputFormatter: utils.toDecimal
|
||||
|
|
@ -5291,35 +5291,35 @@ var methods = function () {
|
|||
|
||||
var sendRawTransaction = new Method({
|
||||
name: 'sendRawTransaction',
|
||||
call: 'eth_sendRawTransaction',
|
||||
call: 'exp_sendRawTransaction',
|
||||
params: 1,
|
||||
inputFormatter: [null]
|
||||
});
|
||||
|
||||
var sendTransaction = new Method({
|
||||
name: 'sendTransaction',
|
||||
call: 'eth_sendTransaction',
|
||||
call: 'exp_sendTransaction',
|
||||
params: 1,
|
||||
inputFormatter: [formatters.inputTransactionFormatter]
|
||||
});
|
||||
|
||||
var sign = new Method({
|
||||
name: 'sign',
|
||||
call: 'eth_sign',
|
||||
call: 'exp_sign',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputAddressFormatter, null]
|
||||
});
|
||||
|
||||
var call = new Method({
|
||||
name: 'call',
|
||||
call: 'eth_call',
|
||||
call: 'exp_call',
|
||||
params: 2,
|
||||
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||
});
|
||||
|
||||
var estimateGas = new Method({
|
||||
name: 'estimateGas',
|
||||
call: 'eth_estimateGas',
|
||||
call: 'exp_estimateGas',
|
||||
params: 1,
|
||||
inputFormatter: [formatters.inputCallFormatter],
|
||||
outputFormatter: utils.toDecimal
|
||||
|
|
@ -5327,31 +5327,31 @@ var methods = function () {
|
|||
|
||||
var compileSolidity = new Method({
|
||||
name: 'compile.solidity',
|
||||
call: 'eth_compileSolidity',
|
||||
call: 'exp_compileSolidity',
|
||||
params: 1
|
||||
});
|
||||
|
||||
var compileLLL = new Method({
|
||||
name: 'compile.lll',
|
||||
call: 'eth_compileLLL',
|
||||
call: 'exp_compileLLL',
|
||||
params: 1
|
||||
});
|
||||
|
||||
var compileSerpent = new Method({
|
||||
name: 'compile.serpent',
|
||||
call: 'eth_compileSerpent',
|
||||
call: 'exp_compileSerpent',
|
||||
params: 1
|
||||
});
|
||||
|
||||
var submitWork = new Method({
|
||||
name: 'submitWork',
|
||||
call: 'eth_submitWork',
|
||||
call: 'exp_submitWork',
|
||||
params: 3
|
||||
});
|
||||
|
||||
var getWork = new Method({
|
||||
name: 'getWork',
|
||||
call: 'eth_getWork',
|
||||
call: 'exp_getWork',
|
||||
params: 0
|
||||
});
|
||||
|
||||
|
|
@ -5386,34 +5386,34 @@ var properties = function () {
|
|||
return [
|
||||
new Property({
|
||||
name: 'coinbase',
|
||||
getter: 'eth_coinbase'
|
||||
getter: 'exp_coinbase'
|
||||
}),
|
||||
new Property({
|
||||
name: 'mining',
|
||||
getter: 'eth_mining'
|
||||
getter: 'exp_mining'
|
||||
}),
|
||||
new Property({
|
||||
name: 'hashrate',
|
||||
getter: 'eth_hashrate',
|
||||
getter: 'exp_hashrate',
|
||||
outputFormatter: utils.toDecimal
|
||||
}),
|
||||
new Property({
|
||||
name: 'syncing',
|
||||
getter: 'eth_syncing',
|
||||
getter: 'exp_syncing',
|
||||
outputFormatter: formatters.outputSyncingFormatter
|
||||
}),
|
||||
new Property({
|
||||
name: 'gasPrice',
|
||||
getter: 'eth_gasPrice',
|
||||
getter: 'exp_gasPrice',
|
||||
outputFormatter: formatters.outputBigNumberFormatter
|
||||
}),
|
||||
new Property({
|
||||
name: 'accounts',
|
||||
getter: 'eth_accounts'
|
||||
getter: 'exp_accounts'
|
||||
}),
|
||||
new Property({
|
||||
name: 'blockNumber',
|
||||
getter: 'eth_blockNumber',
|
||||
getter: 'exp_blockNumber',
|
||||
outputFormatter: utils.toDecimal
|
||||
})
|
||||
];
|
||||
|
|
@ -5475,7 +5475,7 @@ var Net = function (web3) {
|
|||
});
|
||||
};
|
||||
|
||||
/// @returns an array of objects describing web3.eth api properties
|
||||
/// @returns an array of objects describing web3.exp api properties
|
||||
var properties = function () {
|
||||
return [
|
||||
new Property({
|
||||
|
|
@ -5696,13 +5696,13 @@ var exp = function () {
|
|||
case 'latest':
|
||||
args.shift();
|
||||
this.params = 0;
|
||||
return 'eth_newBlockFilter';
|
||||
return 'exp_newBlockFilter';
|
||||
case 'pending':
|
||||
args.shift();
|
||||
this.params = 0;
|
||||
return 'eth_newPendingTransactionFilter';
|
||||
return 'exp_newPendingTransactionFilter';
|
||||
default:
|
||||
return 'eth_newFilter';
|
||||
return 'exp_newFilter';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -5714,19 +5714,19 @@ var exp = function () {
|
|||
|
||||
var uninstallFilter = new Method({
|
||||
name: 'uninstallFilter',
|
||||
call: 'eth_uninstallFilter',
|
||||
call: 'exp_uninstallFilter',
|
||||
params: 1
|
||||
});
|
||||
|
||||
var getLogs = new Method({
|
||||
name: 'getLogs',
|
||||
call: 'eth_getFilterLogs',
|
||||
call: 'exp_getFilterLogs',
|
||||
params: 1
|
||||
});
|
||||
|
||||
var poll = new Method({
|
||||
name: 'poll',
|
||||
call: 'eth_getFilterChanges',
|
||||
call: 'exp_getFilterChanges',
|
||||
params: 1
|
||||
});
|
||||
|
||||
|
|
@ -6260,7 +6260,7 @@ var pollSyncing = function(self) {
|
|||
};
|
||||
|
||||
self.requestManager.startPolling({
|
||||
method: 'eth_syncing',
|
||||
method: 'exp_syncing',
|
||||
params: [],
|
||||
}, self.pollId, onMessage, self.stopWatching.bind(self));
|
||||
|
||||
|
|
@ -6312,23 +6312,23 @@ var exchangeAbi = require('../contracts/SmartExchange.json');
|
|||
* @param {Value} value to be tranfered
|
||||
* @param {Function} callback, callback
|
||||
*/
|
||||
var transfer = function (eth, from, to, value, callback) {
|
||||
var transfer = function (exp, from, to, value, callback) {
|
||||
var iban = new Iban(to);
|
||||
if (!iban.isValid()) {
|
||||
throw new Error('invalid iban address');
|
||||
}
|
||||
|
||||
if (iban.isDirect()) {
|
||||
return transferToAddress(eth, from, iban.address(), value, callback);
|
||||
return transferToAddress(exp, from, iban.address(), value, callback);
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
var address = exp.icapNamereg().addr(iban.institution());
|
||||
return deposit(eth, from, address, value, iban.client());
|
||||
return deposit(exp, from, address, value, iban.client());
|
||||
}
|
||||
|
||||
exp.icapNamereg().addr(iban.institution(), function (err, address) {
|
||||
return deposit(eth, from, address, value, iban.client(), callback);
|
||||
return deposit(exp, from, address, value, iban.client(), callback);
|
||||
});
|
||||
|
||||
};
|
||||
|
|
@ -6342,7 +6342,7 @@ var transfer = function (eth, from, to, value, callback) {
|
|||
* @param {Value} value to be tranfered
|
||||
* @param {Function} callback, callback
|
||||
*/
|
||||
var transferToAddress = function (eth, from, to, value, callback) {
|
||||
var transferToAddress = function (exp, from, to, value, callback) {
|
||||
return exp.sendTransaction({
|
||||
address: to,
|
||||
from: from,
|
||||
|
|
@ -6360,7 +6360,7 @@ var transferToAddress = function (eth, from, to, value, callback) {
|
|||
* @param {String} client unique identifier
|
||||
* @param {Function} callback, callback
|
||||
*/
|
||||
var deposit = function (eth, from, to, value, client, callback) {
|
||||
var deposit = function (exp, from, to, value, client, callback) {
|
||||
var abi = exchangeAbi;
|
||||
return exp.contract(abi).at(to).deposit(client, {
|
||||
from: from,
|
||||
|
|
|
|||
Loading…
Reference in a new issue