JS API interface for parity_chainStatus
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import { inAddress, inData, inHex, inNumber16, inOptions } from '../../format/input';
|
||||
import { outAccountInfo, outAddress, outHistogram, outNumber, outPeers, outTransaction } from '../../format/output';
|
||||
import { outAccountInfo, outAddress, outChainStatus, outHistogram, outNumber, outPeers, outTransaction } from '../../format/output';
|
||||
|
||||
export default class Parity {
|
||||
constructor (transport) {
|
||||
@@ -44,6 +44,12 @@ export default class Parity {
|
||||
.execute('parity_addReservedPeer', encode);
|
||||
}
|
||||
|
||||
chainStatus () {
|
||||
return this._transport
|
||||
.execute('parity_chainStatus')
|
||||
.then(outChainStatus);
|
||||
}
|
||||
|
||||
changePassword (account, password, newPassword) {
|
||||
return this._transport
|
||||
.execute('parity_changePassword', inAddress(account), password, newPassword);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { TEST_HTTP_URL, mockHttp } from '../../../../test/mockRpc';
|
||||
import { isBigNumber } from '../../../../test/types';
|
||||
|
||||
@@ -45,6 +46,22 @@ describe('api/rpc/parity', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('chainStatus', () => {
|
||||
it('retrieves the chain status', () => {
|
||||
mockHttp([{ method: 'parity_chainStatus', reply: {
|
||||
result: {
|
||||
'blockGap': [0x123, 0x456]
|
||||
}
|
||||
} }]);
|
||||
|
||||
return instance.chainStatus().then((result) => {
|
||||
expect(result).to.deep.equal({
|
||||
'blockGap': [new BigNumber(0x123), new BigNumber(0x456)]
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('gasFloorTarget', () => {
|
||||
it('returns the gasfloor, formatted', () => {
|
||||
mockHttp([{ method: 'parity_gasFloorTarget', reply: { result: '0x123456' } }]);
|
||||
|
||||
Reference in New Issue
Block a user