added estimateGas method
This commit is contained in:
parent
cd2e4622c6
commit
22ef4a1958
|
@ -1970,6 +1970,14 @@ var call = new Method({
|
||||||
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var estimateGas = new Method({
|
||||||
|
name: 'estimateGas',
|
||||||
|
call: 'eth_estimateGas',
|
||||||
|
params: 1,
|
||||||
|
inputFormatter: [formatters.inputTransactionFormatter],
|
||||||
|
outputFormatter: utils.toDecimal
|
||||||
|
});
|
||||||
|
|
||||||
var compileSolidity = new Method({
|
var compileSolidity = new Method({
|
||||||
name: 'compile.solidity',
|
name: 'compile.solidity',
|
||||||
call: 'eth_compileSolidity',
|
call: 'eth_compileSolidity',
|
||||||
|
@ -2013,6 +2021,7 @@ var methods = [
|
||||||
getTransactionFromBlock,
|
getTransactionFromBlock,
|
||||||
getTransactionCount,
|
getTransactionCount,
|
||||||
call,
|
call,
|
||||||
|
estimateGas,
|
||||||
sendTransaction,
|
sendTransaction,
|
||||||
compileSolidity,
|
compileSolidity,
|
||||||
compileLLL,
|
compileLLL,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1970,6 +1970,14 @@ var call = new Method({
|
||||||
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var estimateGas = new Method({
|
||||||
|
name: 'estimateGas',
|
||||||
|
call: 'eth_estimateGas',
|
||||||
|
params: 1,
|
||||||
|
inputFormatter: [formatters.inputTransactionFormatter],
|
||||||
|
outputFormatter: utils.toDecimal
|
||||||
|
});
|
||||||
|
|
||||||
var compileSolidity = new Method({
|
var compileSolidity = new Method({
|
||||||
name: 'compile.solidity',
|
name: 'compile.solidity',
|
||||||
call: 'eth_compileSolidity',
|
call: 'eth_compileSolidity',
|
||||||
|
@ -2013,6 +2021,7 @@ var methods = [
|
||||||
getTransactionFromBlock,
|
getTransactionFromBlock,
|
||||||
getTransactionCount,
|
getTransactionCount,
|
||||||
call,
|
call,
|
||||||
|
estimateGas,
|
||||||
sendTransaction,
|
sendTransaction,
|
||||||
compileSolidity,
|
compileSolidity,
|
||||||
compileLLL,
|
compileLLL,
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -174,6 +174,14 @@ var call = new Method({
|
||||||
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var estimateGas = new Method({
|
||||||
|
name: 'estimateGas',
|
||||||
|
call: 'eth_estimateGas',
|
||||||
|
params: 1,
|
||||||
|
inputFormatter: [formatters.inputTransactionFormatter],
|
||||||
|
outputFormatter: utils.toDecimal
|
||||||
|
});
|
||||||
|
|
||||||
var compileSolidity = new Method({
|
var compileSolidity = new Method({
|
||||||
name: 'compile.solidity',
|
name: 'compile.solidity',
|
||||||
call: 'eth_compileSolidity',
|
call: 'eth_compileSolidity',
|
||||||
|
@ -217,6 +225,7 @@ var methods = [
|
||||||
getTransactionFromBlock,
|
getTransactionFromBlock,
|
||||||
getTransactionCount,
|
getTransactionCount,
|
||||||
call,
|
call,
|
||||||
|
estimateGas,
|
||||||
sendTransaction,
|
sendTransaction,
|
||||||
compileSolidity,
|
compileSolidity,
|
||||||
compileLLL,
|
compileLLL,
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
var web3 = require('../index');
|
||||||
|
var testMethod = require('./helpers/test.method.js');
|
||||||
|
|
||||||
|
var method = 'call';
|
||||||
|
|
||||||
|
var tests = [{
|
||||||
|
args: [{
|
||||||
|
to: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
|
||||||
|
data: '0x23455654',
|
||||||
|
gas: 11,
|
||||||
|
gasPrice: 11
|
||||||
|
}],
|
||||||
|
formattedArgs: [{
|
||||||
|
to: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
|
||||||
|
data: '0x23455654',
|
||||||
|
gas: '0xb',
|
||||||
|
gasPrice: '0xb'
|
||||||
|
}, 'latest'],
|
||||||
|
result: '0x31981',
|
||||||
|
formattedResult: '0x31981',
|
||||||
|
call: 'eth_'+ method
|
||||||
|
},{
|
||||||
|
args: [{
|
||||||
|
to: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
|
||||||
|
data: '0x23455654',
|
||||||
|
gas: 11,
|
||||||
|
gasPrice: 11
|
||||||
|
}, 11],
|
||||||
|
formattedArgs: [{
|
||||||
|
to: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
|
||||||
|
data: '0x23455654',
|
||||||
|
gas: '0xb',
|
||||||
|
gasPrice: '0xb'
|
||||||
|
}, '0xb'],
|
||||||
|
result: '0x31981',
|
||||||
|
formattedResult: '0x31981',
|
||||||
|
call: 'eth_'+ method
|
||||||
|
}];
|
||||||
|
|
||||||
|
testMethod.runTests('eth', method, tests);
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
var web3 = require('../index');
|
||||||
|
var testMethod = require('./helpers/test.method.js');
|
||||||
|
|
||||||
|
var method = 'estimateGas';
|
||||||
|
|
||||||
|
var tests = [{
|
||||||
|
args: [{
|
||||||
|
to: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
|
||||||
|
data: '0x23455654',
|
||||||
|
gas: 11,
|
||||||
|
gasPrice: 11
|
||||||
|
}],
|
||||||
|
formattedArgs: [{
|
||||||
|
to: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
|
||||||
|
data: '0x23455654',
|
||||||
|
gas: '0xb',
|
||||||
|
gasPrice: '0xb'
|
||||||
|
}],
|
||||||
|
result: '0x31981',
|
||||||
|
formattedResult: 203137,
|
||||||
|
call: 'eth_'+ method
|
||||||
|
}];
|
||||||
|
|
||||||
|
testMethod.runTests('eth', method, tests);
|
||||||
|
|
Loading…
Reference in New Issue