mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
web3 updated
This commit is contained in:
parent
aa6b2e0323
commit
85302180ec
2 changed files with 75 additions and 13 deletions
File diff suppressed because one or more lines are too long
|
|
@ -3715,6 +3715,13 @@ var inputBlockNumberFormatter = function (blockNumber) {
|
||||||
return utils.toHex(blockNumber);
|
return utils.toHex(blockNumber);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var inputEpochNumberFormatter = function (epochNumber) {
|
||||||
|
if (epochNumber === undefined || epochNumber === "latest") {
|
||||||
|
return "latest";
|
||||||
|
}
|
||||||
|
return utils.toHex(epochNumber);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats the input of a transaction and converts all values to HEX
|
* Formats the input of a transaction and converts all values to HEX
|
||||||
*
|
*
|
||||||
|
|
@ -3840,6 +3847,22 @@ var outputBlockFormatter = function(block) {
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Formats the output of a blockSigner list
|
||||||
|
*
|
||||||
|
* @method outputBlockFormatter
|
||||||
|
* @param {Object} blockSigners
|
||||||
|
* @returns {Object}
|
||||||
|
*/
|
||||||
|
var outputBlockSignersFormatter = function(blockSigners) {
|
||||||
|
if (utils.isArray(blockSigners)) {
|
||||||
|
blockSigners.forEach(function(item){
|
||||||
|
if(!utils.isString(item))
|
||||||
|
return formatOutputAddress(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return blockSigners;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats the output of a log
|
* Formats the output of a log
|
||||||
|
|
@ -3950,6 +3973,7 @@ var outputSyncingFormatter = function(result) {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
|
inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,
|
||||||
inputBlockNumberFormatter: inputBlockNumberFormatter,
|
inputBlockNumberFormatter: inputBlockNumberFormatter,
|
||||||
|
inputEpochNumberFormatter: inputEpochNumberFormatter,
|
||||||
inputCallFormatter: inputCallFormatter,
|
inputCallFormatter: inputCallFormatter,
|
||||||
inputTransactionFormatter: inputTransactionFormatter,
|
inputTransactionFormatter: inputTransactionFormatter,
|
||||||
inputAddressFormatter: inputAddressFormatter,
|
inputAddressFormatter: inputAddressFormatter,
|
||||||
|
|
@ -3958,6 +3982,7 @@ module.exports = {
|
||||||
outputTransactionFormatter: outputTransactionFormatter,
|
outputTransactionFormatter: outputTransactionFormatter,
|
||||||
outputTransactionReceiptFormatter: outputTransactionReceiptFormatter,
|
outputTransactionReceiptFormatter: outputTransactionReceiptFormatter,
|
||||||
outputBlockFormatter: outputBlockFormatter,
|
outputBlockFormatter: outputBlockFormatter,
|
||||||
|
outputBlockSignersFormatter: outputBlockSignersFormatter,
|
||||||
outputLogFormatter: outputLogFormatter,
|
outputLogFormatter: outputLogFormatter,
|
||||||
outputPostFormatter: outputPostFormatter,
|
outputPostFormatter: outputPostFormatter,
|
||||||
outputSyncingFormatter: outputSyncingFormatter
|
outputSyncingFormatter: outputSyncingFormatter
|
||||||
|
|
@ -5210,6 +5235,14 @@ 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) ? "eth_getBlockByHash" : "eth_getBlockByNumber";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var blockSignersCall = function (args) {
|
||||||
|
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockSignersByHash" : "eth_getBlockSignersByNumber";
|
||||||
|
};
|
||||||
|
|
||||||
|
var blockFinalityCall = function (args) {
|
||||||
|
return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockFinalityByHash" : "eth_getBlockFinalityByNumber";
|
||||||
|
};
|
||||||
|
|
||||||
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) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';
|
||||||
};
|
};
|
||||||
|
|
@ -5297,6 +5330,22 @@ var methods = function () {
|
||||||
outputFormatter: formatters.outputBlockFormatter
|
outputFormatter: formatters.outputBlockFormatter
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var getBlockSigners = new Method({
|
||||||
|
name: 'getBlockSigners',
|
||||||
|
call: blockSignersCall,
|
||||||
|
params: 1,
|
||||||
|
inputFormatter: [formatters.inputBlockNumberFormatter],
|
||||||
|
outputFormatter: formatters.outputBlockSignersFormatter
|
||||||
|
});
|
||||||
|
|
||||||
|
var getBlockFinality = new Method({
|
||||||
|
name: 'getBlockFinality',
|
||||||
|
call: blockFinalityCall,
|
||||||
|
params: 1,
|
||||||
|
inputFormatter: [formatters.inputBlockNumberFormatter],
|
||||||
|
outputFormatter: formatters.formatOutputInt
|
||||||
|
});
|
||||||
|
|
||||||
var getUncle = new Method({
|
var getUncle = new Method({
|
||||||
name: 'getUncle',
|
name: 'getUncle',
|
||||||
call: uncleCall,
|
call: uncleCall,
|
||||||
|
|
@ -5431,11 +5480,20 @@ var methods = function () {
|
||||||
params: 0
|
params: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var getCandidateStatus = new Method({
|
||||||
|
name: 'getCandidateStatus',
|
||||||
|
call: 'eth_getCandidateStatus',
|
||||||
|
params: 2,
|
||||||
|
inputFormatter: [formatters.inputAddressFormatter, formatters.inputEpochNumberFormatter]
|
||||||
|
});
|
||||||
return [
|
return [
|
||||||
getBalance,
|
getBalance,
|
||||||
getStorageAt,
|
getStorageAt,
|
||||||
getCode,
|
getCode,
|
||||||
getBlock,
|
getBlock,
|
||||||
|
getBlockSigners,
|
||||||
|
getBlockFinality,
|
||||||
|
getCandidateStatus,
|
||||||
getUncle,
|
getUncle,
|
||||||
getCompilers,
|
getCompilers,
|
||||||
getBlockTransactionCount,
|
getBlockTransactionCount,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue