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) {
|
function Web3 (provider) {
|
||||||
this._requestManager = new RequestManager(provider);
|
this._requestManager = new RequestManager(provider);
|
||||||
this.currentProvider = provider;
|
this.currentProvider = provider;
|
||||||
this.eth = new Exp(this);
|
this.exp = new Exp(this);
|
||||||
this.db = new DB(this);
|
this.db = new DB(this);
|
||||||
this.shh = new Shh(this);
|
this.shh = new Shh(this);
|
||||||
this.net = new Net(this);
|
this.net = new Net(this);
|
||||||
|
|
@ -2618,7 +2618,7 @@ var properties = function () {
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'version.expanse',
|
name: 'version.expanse',
|
||||||
getter: 'eth_protocolVersion',
|
getter: 'exp_protocolVersion',
|
||||||
inputFormatter: utils.toDecimal
|
inputFormatter: utils.toDecimal
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
|
|
@ -2963,8 +2963,8 @@ var checkForContractAddress = function(contract, callback){
|
||||||
* @method ContractFactory
|
* @method ContractFactory
|
||||||
* @param {Array} abi
|
* @param {Array} abi
|
||||||
*/
|
*/
|
||||||
var ContractFactory = function (eth, abi) {
|
var ContractFactory = function (exp, abi) {
|
||||||
this.eth = eth;
|
this.exp = exp;
|
||||||
this.abi = abi;
|
this.abi = abi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2978,7 +2978,7 @@ var ContractFactory = function (eth, abi) {
|
||||||
* @returns {Contract} returns contract instance
|
* @returns {Contract} returns contract instance
|
||||||
*/
|
*/
|
||||||
this.new = function () {
|
this.new = function () {
|
||||||
var contract = new Contract(this.eth, this.abi);
|
var contract = new Contract(this.exp, this.abi);
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
var options = {}; // required!
|
var options = {}; // required!
|
||||||
|
|
@ -3046,7 +3046,7 @@ var ContractFactory = function (eth, abi) {
|
||||||
* otherwise calls callback function (err, contract)
|
* otherwise calls callback function (err, contract)
|
||||||
*/
|
*/
|
||||||
ContractFactory.prototype.at = function (address, callback) {
|
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,
|
// this functions are not part of prototype,
|
||||||
// because we dont want to spoil the interface
|
// because we dont want to spoil the interface
|
||||||
|
|
@ -3086,8 +3086,8 @@ ContractFactory.prototype.getData = function () {
|
||||||
* @param {Array} abi
|
* @param {Array} abi
|
||||||
* @param {Address} contract address
|
* @param {Address} contract address
|
||||||
*/
|
*/
|
||||||
var Contract = function (eth, abi, address) {
|
var Contract = function (exp, abi, address) {
|
||||||
this._eth = eth;
|
this._eth = exp;
|
||||||
this.transactionHash = null;
|
this.transactionHash = null;
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.abi = abi;
|
this.abi = abi;
|
||||||
|
|
@ -3963,8 +3963,8 @@ var sha3 = require('../utils/sha3');
|
||||||
/**
|
/**
|
||||||
* This prototype should be used to call/sendTransaction to solidity functions
|
* This prototype should be used to call/sendTransaction to solidity functions
|
||||||
*/
|
*/
|
||||||
var SolidityFunction = function (eth, json, address) {
|
var SolidityFunction = function (exp, json, address) {
|
||||||
this._eth = eth;
|
this._eth = exp;
|
||||||
this._inputTypes = json.inputs.map(function (i) {
|
this._inputTypes = json.inputs.map(function (i) {
|
||||||
return i.type;
|
return i.type;
|
||||||
});
|
});
|
||||||
|
|
@ -4134,7 +4134,7 @@ SolidityFunction.prototype.request = function () {
|
||||||
var format = this.unpackOutput.bind(this);
|
var format = this.unpackOutput.bind(this);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
method: this._constant ? 'eth_call' : 'eth_sendTransaction',
|
method: this._constant ? 'exp_call' : 'exp_sendTransaction',
|
||||||
callback: callback,
|
callback: callback,
|
||||||
params: [payload],
|
params: [payload],
|
||||||
format: format
|
format: format
|
||||||
|
|
@ -5138,23 +5138,23 @@ var Iban = require('../iban');
|
||||||
var transfer = require('../transfer');
|
var transfer = require('../transfer');
|
||||||
|
|
||||||
var blockCall = function (args) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
function Exp(web3) {
|
||||||
|
|
@ -5200,7 +5200,7 @@ Object.defineProperty(Exp.prototype, 'defaultAccount', {
|
||||||
var methods = function () {
|
var methods = function () {
|
||||||
var getBalance = new Method({
|
var getBalance = new Method({
|
||||||
name: 'getBalance',
|
name: 'getBalance',
|
||||||
call: 'eth_getBalance',
|
call: 'exp_getBalance',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter],
|
||||||
outputFormatter: formatters.outputBigNumberFormatter
|
outputFormatter: formatters.outputBigNumberFormatter
|
||||||
|
|
@ -5208,14 +5208,14 @@ var methods = function () {
|
||||||
|
|
||||||
var getStorageAt = new Method({
|
var getStorageAt = new Method({
|
||||||
name: 'getStorageAt',
|
name: 'getStorageAt',
|
||||||
call: 'eth_getStorageAt',
|
call: 'exp_getStorageAt',
|
||||||
params: 3,
|
params: 3,
|
||||||
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
|
||||||
var getCode = new Method({
|
var getCode = new Method({
|
||||||
name: 'getCode',
|
name: 'getCode',
|
||||||
call: 'eth_getCode',
|
call: 'exp_getCode',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
|
@ -5239,7 +5239,7 @@ var methods = function () {
|
||||||
|
|
||||||
var getCompilers = new Method({
|
var getCompilers = new Method({
|
||||||
name: 'getCompilers',
|
name: 'getCompilers',
|
||||||
call: 'eth_getCompilers',
|
call: 'exp_getCompilers',
|
||||||
params: 0
|
params: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -5261,7 +5261,7 @@ var methods = function () {
|
||||||
|
|
||||||
var getTransaction = new Method({
|
var getTransaction = new Method({
|
||||||
name: 'getTransaction',
|
name: 'getTransaction',
|
||||||
call: 'eth_getTransactionByHash',
|
call: 'exp_getTransactionByHash',
|
||||||
params: 1,
|
params: 1,
|
||||||
outputFormatter: formatters.outputTransactionFormatter
|
outputFormatter: formatters.outputTransactionFormatter
|
||||||
});
|
});
|
||||||
|
|
@ -5276,14 +5276,14 @@ var methods = function () {
|
||||||
|
|
||||||
var getTransactionReceipt = new Method({
|
var getTransactionReceipt = new Method({
|
||||||
name: 'getTransactionReceipt',
|
name: 'getTransactionReceipt',
|
||||||
call: 'eth_getTransactionReceipt',
|
call: 'exp_getTransactionReceipt',
|
||||||
params: 1,
|
params: 1,
|
||||||
outputFormatter: formatters.outputTransactionReceiptFormatter
|
outputFormatter: formatters.outputTransactionReceiptFormatter
|
||||||
});
|
});
|
||||||
|
|
||||||
var getTransactionCount = new Method({
|
var getTransactionCount = new Method({
|
||||||
name: 'getTransactionCount',
|
name: 'getTransactionCount',
|
||||||
call: 'eth_getTransactionCount',
|
call: 'exp_getTransactionCount',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
|
inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],
|
||||||
outputFormatter: utils.toDecimal
|
outputFormatter: utils.toDecimal
|
||||||
|
|
@ -5291,35 +5291,35 @@ var methods = function () {
|
||||||
|
|
||||||
var sendRawTransaction = new Method({
|
var sendRawTransaction = new Method({
|
||||||
name: 'sendRawTransaction',
|
name: 'sendRawTransaction',
|
||||||
call: 'eth_sendRawTransaction',
|
call: 'exp_sendRawTransaction',
|
||||||
params: 1,
|
params: 1,
|
||||||
inputFormatter: [null]
|
inputFormatter: [null]
|
||||||
});
|
});
|
||||||
|
|
||||||
var sendTransaction = new Method({
|
var sendTransaction = new Method({
|
||||||
name: 'sendTransaction',
|
name: 'sendTransaction',
|
||||||
call: 'eth_sendTransaction',
|
call: 'exp_sendTransaction',
|
||||||
params: 1,
|
params: 1,
|
||||||
inputFormatter: [formatters.inputTransactionFormatter]
|
inputFormatter: [formatters.inputTransactionFormatter]
|
||||||
});
|
});
|
||||||
|
|
||||||
var sign = new Method({
|
var sign = new Method({
|
||||||
name: 'sign',
|
name: 'sign',
|
||||||
call: 'eth_sign',
|
call: 'exp_sign',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputAddressFormatter, null]
|
inputFormatter: [formatters.inputAddressFormatter, null]
|
||||||
});
|
});
|
||||||
|
|
||||||
var call = new Method({
|
var call = new Method({
|
||||||
name: 'call',
|
name: 'call',
|
||||||
call: 'eth_call',
|
call: 'exp_call',
|
||||||
params: 2,
|
params: 2,
|
||||||
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
|
||||||
var estimateGas = new Method({
|
var estimateGas = new Method({
|
||||||
name: 'estimateGas',
|
name: 'estimateGas',
|
||||||
call: 'eth_estimateGas',
|
call: 'exp_estimateGas',
|
||||||
params: 1,
|
params: 1,
|
||||||
inputFormatter: [formatters.inputCallFormatter],
|
inputFormatter: [formatters.inputCallFormatter],
|
||||||
outputFormatter: utils.toDecimal
|
outputFormatter: utils.toDecimal
|
||||||
|
|
@ -5327,31 +5327,31 @@ var methods = function () {
|
||||||
|
|
||||||
var compileSolidity = new Method({
|
var compileSolidity = new Method({
|
||||||
name: 'compile.solidity',
|
name: 'compile.solidity',
|
||||||
call: 'eth_compileSolidity',
|
call: 'exp_compileSolidity',
|
||||||
params: 1
|
params: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
var compileLLL = new Method({
|
var compileLLL = new Method({
|
||||||
name: 'compile.lll',
|
name: 'compile.lll',
|
||||||
call: 'eth_compileLLL',
|
call: 'exp_compileLLL',
|
||||||
params: 1
|
params: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
var compileSerpent = new Method({
|
var compileSerpent = new Method({
|
||||||
name: 'compile.serpent',
|
name: 'compile.serpent',
|
||||||
call: 'eth_compileSerpent',
|
call: 'exp_compileSerpent',
|
||||||
params: 1
|
params: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
var submitWork = new Method({
|
var submitWork = new Method({
|
||||||
name: 'submitWork',
|
name: 'submitWork',
|
||||||
call: 'eth_submitWork',
|
call: 'exp_submitWork',
|
||||||
params: 3
|
params: 3
|
||||||
});
|
});
|
||||||
|
|
||||||
var getWork = new Method({
|
var getWork = new Method({
|
||||||
name: 'getWork',
|
name: 'getWork',
|
||||||
call: 'eth_getWork',
|
call: 'exp_getWork',
|
||||||
params: 0
|
params: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -5386,34 +5386,34 @@ var properties = function () {
|
||||||
return [
|
return [
|
||||||
new Property({
|
new Property({
|
||||||
name: 'coinbase',
|
name: 'coinbase',
|
||||||
getter: 'eth_coinbase'
|
getter: 'exp_coinbase'
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'mining',
|
name: 'mining',
|
||||||
getter: 'eth_mining'
|
getter: 'exp_mining'
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'hashrate',
|
name: 'hashrate',
|
||||||
getter: 'eth_hashrate',
|
getter: 'exp_hashrate',
|
||||||
outputFormatter: utils.toDecimal
|
outputFormatter: utils.toDecimal
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'syncing',
|
name: 'syncing',
|
||||||
getter: 'eth_syncing',
|
getter: 'exp_syncing',
|
||||||
outputFormatter: formatters.outputSyncingFormatter
|
outputFormatter: formatters.outputSyncingFormatter
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'gasPrice',
|
name: 'gasPrice',
|
||||||
getter: 'eth_gasPrice',
|
getter: 'exp_gasPrice',
|
||||||
outputFormatter: formatters.outputBigNumberFormatter
|
outputFormatter: formatters.outputBigNumberFormatter
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'accounts',
|
name: 'accounts',
|
||||||
getter: 'eth_accounts'
|
getter: 'exp_accounts'
|
||||||
}),
|
}),
|
||||||
new Property({
|
new Property({
|
||||||
name: 'blockNumber',
|
name: 'blockNumber',
|
||||||
getter: 'eth_blockNumber',
|
getter: 'exp_blockNumber',
|
||||||
outputFormatter: utils.toDecimal
|
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 () {
|
var properties = function () {
|
||||||
return [
|
return [
|
||||||
new Property({
|
new Property({
|
||||||
|
|
@ -5696,13 +5696,13 @@ var exp = function () {
|
||||||
case 'latest':
|
case 'latest':
|
||||||
args.shift();
|
args.shift();
|
||||||
this.params = 0;
|
this.params = 0;
|
||||||
return 'eth_newBlockFilter';
|
return 'exp_newBlockFilter';
|
||||||
case 'pending':
|
case 'pending':
|
||||||
args.shift();
|
args.shift();
|
||||||
this.params = 0;
|
this.params = 0;
|
||||||
return 'eth_newPendingTransactionFilter';
|
return 'exp_newPendingTransactionFilter';
|
||||||
default:
|
default:
|
||||||
return 'eth_newFilter';
|
return 'exp_newFilter';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -5714,19 +5714,19 @@ var exp = function () {
|
||||||
|
|
||||||
var uninstallFilter = new Method({
|
var uninstallFilter = new Method({
|
||||||
name: 'uninstallFilter',
|
name: 'uninstallFilter',
|
||||||
call: 'eth_uninstallFilter',
|
call: 'exp_uninstallFilter',
|
||||||
params: 1
|
params: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
var getLogs = new Method({
|
var getLogs = new Method({
|
||||||
name: 'getLogs',
|
name: 'getLogs',
|
||||||
call: 'eth_getFilterLogs',
|
call: 'exp_getFilterLogs',
|
||||||
params: 1
|
params: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
var poll = new Method({
|
var poll = new Method({
|
||||||
name: 'poll',
|
name: 'poll',
|
||||||
call: 'eth_getFilterChanges',
|
call: 'exp_getFilterChanges',
|
||||||
params: 1
|
params: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -6260,7 +6260,7 @@ var pollSyncing = function(self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.requestManager.startPolling({
|
self.requestManager.startPolling({
|
||||||
method: 'eth_syncing',
|
method: 'exp_syncing',
|
||||||
params: [],
|
params: [],
|
||||||
}, self.pollId, onMessage, self.stopWatching.bind(self));
|
}, self.pollId, onMessage, self.stopWatching.bind(self));
|
||||||
|
|
||||||
|
|
@ -6312,23 +6312,23 @@ var exchangeAbi = require('../contracts/SmartExchange.json');
|
||||||
* @param {Value} value to be tranfered
|
* @param {Value} value to be tranfered
|
||||||
* @param {Function} callback, callback
|
* @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);
|
var iban = new Iban(to);
|
||||||
if (!iban.isValid()) {
|
if (!iban.isValid()) {
|
||||||
throw new Error('invalid iban address');
|
throw new Error('invalid iban address');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iban.isDirect()) {
|
if (iban.isDirect()) {
|
||||||
return transferToAddress(eth, from, iban.address(), value, callback);
|
return transferToAddress(exp, from, iban.address(), value, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
var address = exp.icapNamereg().addr(iban.institution());
|
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) {
|
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 {Value} value to be tranfered
|
||||||
* @param {Function} callback, callback
|
* @param {Function} callback, callback
|
||||||
*/
|
*/
|
||||||
var transferToAddress = function (eth, from, to, value, callback) {
|
var transferToAddress = function (exp, from, to, value, callback) {
|
||||||
return exp.sendTransaction({
|
return exp.sendTransaction({
|
||||||
address: to,
|
address: to,
|
||||||
from: from,
|
from: from,
|
||||||
|
|
@ -6360,7 +6360,7 @@ var transferToAddress = function (eth, from, to, value, callback) {
|
||||||
* @param {String} client unique identifier
|
* @param {String} client unique identifier
|
||||||
* @param {Function} callback, callback
|
* @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;
|
var abi = exchangeAbi;
|
||||||
return exp.contract(abi).at(to).deposit(client, {
|
return exp.contract(abi).at(to).deposit(client, {
|
||||||
from: from,
|
from: from,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue