Allow setting of minBlock on sending (#3921)

* minBlock value formatting

* Allow Contract execute to specify minBock

* Transfer allows minBlock

* Cleanups

* Check errors, verify via testing

* Display Submitted/Submission block in MethodDecoding
This commit is contained in:
Jaco Greeff
2016-12-23 15:31:19 +01:00
committed by GitHub
parent 74efb22230
commit fc620d0d3e
16 changed files with 463 additions and 187 deletions

View File

@@ -137,6 +137,10 @@ export function inOptions (options) {
options[key] = inNumber16((new BigNumber(options[key])).round());
break;
case 'minBlock':
options[key] = options[key] ? inNumber16(options[key]) : null;
break;
case 'value':
case 'nonce':
options[key] = inNumber16(options[key]);

View File

@@ -204,7 +204,7 @@ describe('api/format/input', () => {
});
});
['gas', 'gasPrice', 'value', 'nonce'].forEach((input) => {
['gas', 'gasPrice', 'value', 'minBlock', 'nonce'].forEach((input) => {
it(`formats ${input} number as hexnumber`, () => {
const block = {};
block[input] = 0x123;
@@ -214,6 +214,10 @@ describe('api/format/input', () => {
});
});
it('passes minBlock as null when specified as such', () => {
expect(inOptions({ minBlock: null })).to.deep.equal({ minBlock: null });
});
it('ignores and passes through unknown keys', () => {
expect(inOptions({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' });
});

View File

@@ -205,6 +205,10 @@ export function outTransaction (tx) {
tx[key] = outNumber(tx[key]);
break;
case 'minBlock':
tx[key] = tx[key] ? outNumber(tx[key]) : null;
break;
case 'creates':
case 'from':
case 'to':

View File

@@ -283,7 +283,7 @@ describe('api/format/output', () => {
});
});
['blockNumber', 'gasPrice', 'gas', 'nonce', 'transactionIndex', 'value'].forEach((input) => {
['blockNumber', 'gasPrice', 'gas', 'minBlock', 'nonce', 'transactionIndex', 'value'].forEach((input) => {
it(`formats ${input} number as hexnumber`, () => {
const block = {};
block[input] = 0x123;
@@ -294,6 +294,10 @@ describe('api/format/output', () => {
});
});
it('passes minBlock as null when null', () => {
expect(outTransaction({ minBlock: null })).to.deep.equal({ minBlock: null });
});
it('ignores and passes through unknown keys', () => {
expect(outTransaction({ someRandom: 'someRandom' })).to.deep.equal({ someRandom: 'someRandom' });
});