Skip to content

Commit

Permalink
Merge pull request web3#198 from ethereum/minerMethods
Browse files Browse the repository at this point in the history
Miner methods
  • Loading branch information
debris committed May 12, 2015
2 parents 373fd1b + d1e1206 commit ae7762a
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 10 deletions.
15 changes: 15 additions & 0 deletions dist/web3-light.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/web3-light.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3-light.min.js

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions dist/web3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/web3.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ var toAddress = function (address) {
return '0x' + padLeft(toHex(address).substr(2), 40);
};


/**
* Returns true if object is BigNumber, otherwise false
*
Expand Down
14 changes: 14 additions & 0 deletions lib/web3/eth.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ var compileSerpent = new Method({
params: 1
});

var submitWork = new Method({
name: 'submitWork',
call: 'eth_submitWork',
params: 3
});

var getWork = new Method({
name: 'getWork',
call: 'eth_getWork',
params: 0
});

var methods = [
getBalance,
getStorageAt,
Expand All @@ -209,6 +221,8 @@ var methods = [
compileSolidity,
compileLLL,
compileSerpent,
submitWork,
getWork
];

/// @returns an array of objects describing web3.eth api properties
Expand Down
16 changes: 16 additions & 0 deletions test/web3.eth.getWork.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var chai = require('chai');
var web3 = require('../index');
var testMethod = require('./helpers/test.method.js');

var method = 'getWork';

var tests = [{
args: [],
formattedArgs: [],
result: true,
formattedResult: true,
call: 'eth_'+ method
}];

testMethod.runTests('eth', method, tests);

17 changes: 17 additions & 0 deletions test/web3.eth.submitWork.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var chai = require('chai');
var web3 = require('../index');
var testMethod = require('./helpers/test.method.js');

var method = 'submitWork';

var tests = [
{
args: ['0x567890abcdef5555', '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', '0xcdef1234567890abcdef1234567890abcdef0x1234567890abcf1234567890ab'],
formattedArgs: ['0x567890abcdef5555', '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', '0xcdef1234567890abcdef1234567890abcdef0x1234567890abcf1234567890ab'],
result: true,
formattedResult: true,
call: 'eth_'+ method
}];

testMethod.runTests('eth', method, tests);

0 comments on commit ae7762a

Please sign in to comment.