diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-11-21 03:35:16 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-11-29 08:38:11 +0800 |
commit | 62e6b22789b349dda7885d3317c76c90ecb3c882 (patch) | |
tree | 75725c6a0287330745ab1aecc95ce25bbb6ee21c | |
parent | 0ed1819143fa82163502fb412bcb5ed44c041456 (diff) | |
download | dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.tar dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.tar.gz dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.tar.bz2 dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.tar.lz dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.tar.xz dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.tar.zst dexon-sol-tools-62e6b22789b349dda7885d3317c76c90ecb3c882.zip |
Fixed linter errors on tests
-rw-r--r-- | packages/utils/test/abi_encoder_test.ts | 99 | ||||
-rw-r--r-- | packages/utils/test/abi_samples.ts | 93 | ||||
-rw-r--r-- | packages/utils/test/optimizer_abis.ts | 57 | ||||
-rw-r--r-- | packages/utils/test/return_value_abis.ts | 25 |
4 files changed, 141 insertions, 133 deletions
diff --git a/packages/utils/test/abi_encoder_test.ts b/packages/utils/test/abi_encoder_test.ts index c7986fa00..e99528b06 100644 --- a/packages/utils/test/abi_encoder_test.ts +++ b/packages/utils/test/abi_encoder_test.ts @@ -1,13 +1,13 @@ import * as chai from 'chai'; +import * as ethUtil from 'ethereumjs-util'; import 'mocha'; -import { chaiSetup } from './utils/chai_setup'; -import { BigNumber, AbiEncoder } from '../src/'; +import { AbiEncoder, BigNumber } from '../src/'; + import * as AbiSamples from './abi_samples'; import * as OptimizedAbis from './optimizer_abis'; import * as ReturnValueAbis from './return_value_abis'; -import { DecodingRules } from '../src/abi_encoder'; -import ethUtil = require('ethereumjs-util'); +import { chaiSetup } from './utils/chai_setup'; chaiSetup.configure(); const expect = chai.expect; @@ -349,8 +349,8 @@ describe.only('ABI Encoder', () => { // Generate calldata const method = new AbiEncoder.Method(OptimizedAbis.arrayElementsDuplicatedAsSeparateParameter); const array = ['Hello', 'Hello', 'Hello', 'World']; - const string = 'Hello'; - const args = [array, string]; + const str = 'Hello'; + const args = [array, str]; // Validate calldata const optimizedCalldata = method.encode(args, { optimize: true }); const expectedOptimizedCalldata = @@ -392,7 +392,8 @@ describe.only('ABI Encoder', () => { const method = new AbiEncoder.Method(AbiSamples.arrayOfStaticTuplesWithDefinedLengthAbi); let value = 0; const arrayOfTuples = []; - for (let i = 0; i < 8; ++i) { + const arrayOfTuplesLength = 8; + for (let i = 0; i < arrayOfTuplesLength; ++i) { arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value)]); } const args = [arrayOfTuples]; @@ -412,7 +413,8 @@ describe.only('ABI Encoder', () => { const method = new AbiEncoder.Method(AbiSamples.arrayOfStaticTuplesWithDynamicLengthAbi); let value = 0; const arrayOfTuples = []; - for (let i = 0; i < 8; ++i) { + const arrayOfTuplesLength = 8; + for (let i = 0; i < arrayOfTuplesLength; ++i) { arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value)]); } const args = [arrayOfTuples]; @@ -432,7 +434,8 @@ describe.only('ABI Encoder', () => { const method = new AbiEncoder.Method(AbiSamples.arrayOfDynamicTuplesWithDefinedLengthAbi); let value = 0; const arrayOfTuples = []; - for (let i = 0; i < 8; ++i) { + const arrayOfTuplesLength = 8; + for (let i = 0; i < arrayOfTuplesLength; ++i) { arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value).toString()]); } const args = [arrayOfTuples]; @@ -452,7 +455,8 @@ describe.only('ABI Encoder', () => { const method = new AbiEncoder.Method(AbiSamples.arrayOfDynamicTuplesWithUndefinedLengthAbi); let value = 0; const arrayOfTuples = []; - for (let i = 0; i < 8; ++i) { + const arrayOfTuplesLength = 8; + for (let i = 0; i < arrayOfTuplesLength; ++i) { arrayOfTuples.push([new BigNumber(++value), new BigNumber(++value).toString()]); } const args = [arrayOfTuples]; @@ -473,7 +477,8 @@ describe.only('ABI Encoder', () => { // Eight 3-dimensional arrays of uint8[2][2][2] let value = 0; const args = []; - for (let i = 0; i < 8; ++i) { + const argsLength = 8; + for (let i = 0; i < argsLength; ++i) { args.push([ [ [new BigNumber(++value), new BigNumber(++value)], @@ -503,7 +508,8 @@ describe.only('ABI Encoder', () => { // Eight 3-dimensional arrays of string[2][2][2] let value = 0; const args = []; - for (let i = 0; i < 4; ++i) { + const argsLength = 4; + for (let i = 0; i < argsLength; ++i) { args.push([ [ [new BigNumber(++value).toString(), new BigNumber(++value).toString()], @@ -741,13 +747,13 @@ describe.only('ABI Encoder', () => { }; const someArrayOfTuplesWithDynamicTypes = [someTupleWithDynamicTypes2, someTupleWithDynamicTypes3]; const args = { - someStaticArray: someStaticArray, - someStaticArrayWithDynamicMembers: someStaticArrayWithDynamicMembers, - someDynamicArrayWithDynamicMembers: someDynamicArrayWithDynamicMembers, - some2DArray: some2DArray, - someTuple: someTuple, - someTupleWithDynamicTypes: someTupleWithDynamicTypes, - someArrayOfTuplesWithDynamicTypes: someArrayOfTuplesWithDynamicTypes, + someStaticArray, + someStaticArrayWithDynamicMembers, + someDynamicArrayWithDynamicMembers, + some2DArray, + someTuple, + someTupleWithDynamicTypes, + someArrayOfTuplesWithDynamicTypes, }; const calldata = method.encode(args); // Validate calldata @@ -900,8 +906,6 @@ describe.only('ABI Encoder', () => { const args = [array1, array2]; // Encode Args and validate result const encodedArgs = dataType.encode(args); - console.log(encodedArgs); - console.log(dataType.encode(args, { annotate: true })); const expectedEncodedArgs = '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000401020304000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004050607080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040910111200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000410111213000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004141516170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041819202100000000000000000000000000000000000000000000000000000000'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); @@ -963,7 +967,7 @@ describe.only('ABI Encoder', () => { '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000001'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -985,7 +989,7 @@ describe.only('ABI Encoder', () => { '0x00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008abcdef0123456789000000000000000000000000000000000000000000000000'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -1007,7 +1011,7 @@ describe.only('ABI Encoder', () => { '0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -1029,7 +1033,7 @@ describe.only('ABI Encoder', () => { '0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -1053,7 +1057,7 @@ describe.only('ABI Encoder', () => { '0x0102030400000000000000000000000000000000000000000000000000000000050607080000000000000000000000000000000000000000000000000000000009101112000000000000000000000000000000000000000000000000000000001314151600000000000000000000000000000000000000000000000000000000'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -1077,7 +1081,7 @@ describe.only('ABI Encoder', () => { '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004010203040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040506070800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004091011120000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041314151600000000000000000000000000000000000000000000000000000000'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -1109,7 +1113,7 @@ describe.only('ABI Encoder', () => { '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffb0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008abcdef0123456789000000000000000000000000000000000000000000000000'; expect(encodedArgs).to.be.equal(expectedEncodedArgs); // Decode Encoded Args and validate result - const decodingRules = { structsAsObjects: true } as DecodingRules; + const decodingRules: AbiEncoder.DecodingRules = { structsAsObjects: true }; const decodedArgs = dataType.decode(encodedArgs, decodingRules); const decodedArgsAsJson = JSON.stringify(decodedArgs); const argsAsJson = JSON.stringify(args); @@ -1224,6 +1228,13 @@ describe.only('ABI Encoder', () => { }); describe('Integer', () => { + /* tslint:disable custom-no-magic-numbers */ + const max256BitInteger = new BigNumber(2).pow(255).minus(1); + const min256BitInteger = new BigNumber(2).pow(255).times(-1); + const max32BitInteger = new BigNumber(2).pow(31).minus(1); + const min32BitInteger = new BigNumber(2).pow(31).times(-1); + /* tslint:enable custom-no-magic-numbers */ + it('Int256 - Positive Base Case', async () => { // Create DataType object const testDataItem = { name: 'Integer (256)', type: 'int' }; @@ -1261,7 +1272,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (256)', type: 'int' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const max256BitInteger = new BigNumber(2).pow(255).minus(1); const args = max256BitInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1278,7 +1288,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (256)', type: 'int' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const min256BitInteger = new BigNumber(2).pow(255).times(-1); const args = min256BitInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1295,7 +1304,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (256)', type: 'int' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const max256BitInteger = new BigNumber(2).pow(255).minus(1); const args = max256BitInteger.plus(1); // Encode Args and validate result expect(() => { @@ -1307,7 +1315,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (256)', type: 'int' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const min256BitInteger = new BigNumber(2).pow(255).times(-1); const args = min256BitInteger.minus(1); // Encode Args and validate result expect(() => { @@ -1351,7 +1358,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (32)', type: 'int32' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const max32BitInteger = new BigNumber(2).pow(31).minus(1); const args = max32BitInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1368,7 +1374,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (32)', type: 'int32' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const min32BitInteger = new BigNumber(2).pow(31).times(-1); const args = min32BitInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1385,7 +1390,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (32)', type: 'int32' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const max32BitInteger = new BigNumber(2).pow(31).minus(1); const args = max32BitInteger.plus(1); // Encode Args and validate result expect(() => { @@ -1397,7 +1401,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Integer (32)', type: 'int32' }; const dataType = new AbiEncoder.Int(testDataItem); // Construct args to be encoded - const min32BitInteger = new BigNumber(2).pow(31).times(-1); const args = min32BitInteger.minus(1); // Encode Args and validate result expect(() => { @@ -1407,6 +1410,13 @@ describe.only('ABI Encoder', () => { }); describe('Unsigned Integer', () => { + /* tslint:disable custom-no-magic-numbers */ + const max256BitUnsignedInteger = new BigNumber(2).pow(256).minus(1); + const min256BitUnsignedInteger = new BigNumber(0); + const max32BitUnsignedInteger = new BigNumber(2).pow(32).minus(1); + const min32BitUnsignedInteger = new BigNumber(0); + /* tslint:enable custom-no-magic-numbers */ + it('UInt256 - Positive Base Case', async () => { // Create DataType object const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' }; @@ -1428,7 +1438,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const max256BitUnsignedInteger = new BigNumber(2).pow(256).minus(1); const args = max256BitUnsignedInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1445,7 +1454,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const min256BitUnsignedInteger = new BigNumber(0); const args = min256BitUnsignedInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1462,7 +1470,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const max256BitUnsignedInteger = new BigNumber(2).pow(256).minus(1); const args = max256BitUnsignedInteger.plus(1); // Encode Args and validate result expect(() => { @@ -1474,7 +1481,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (256)', type: 'uint' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const min256BitUnsignedInteger = new BigNumber(0); const args = min256BitUnsignedInteger.minus(1); // Encode Args and validate result expect(() => { @@ -1502,7 +1508,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const max32BitUnsignedInteger = new BigNumber(2).pow(32).minus(1); const args = max32BitUnsignedInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1519,7 +1524,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const min32BitUnsignedInteger = new BigNumber(0); const args = min32BitUnsignedInteger; // Encode Args and validate result const encodedArgs = dataType.encode(args); @@ -1536,7 +1540,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const max32BitUnsignedInteger = new BigNumber(2).pow(32).minus(1); const args = max32BitUnsignedInteger.plus(1); // Encode Args and validate result expect(() => { @@ -1548,7 +1551,6 @@ describe.only('ABI Encoder', () => { const testDataItem = { name: 'Unsigned Integer (32)', type: 'uint32' }; const dataType = new AbiEncoder.UInt(testDataItem); // Construct args to be encoded - const min32BitUnsignedInteger = new BigNumber(0); const args = min32BitUnsignedInteger.minus(1); // Encode Args and validate result expect(() => { @@ -1733,7 +1735,8 @@ describe.only('ABI Encoder', () => { const dataType = new AbiEncoder.Bytes(testDataItem); // Construct args to be encoded // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes. - const args = '0x' + '61'.repeat(40); + const bytesLength = 40; + const args = '0x' + '61'.repeat(bytesLength); // Encode Args and validate result const encodedArgs = dataType.encode(args); const expectedEncodedArgs = @@ -1813,7 +1816,8 @@ describe.only('ABI Encoder', () => { const dataType = new AbiEncoder.SolString(testDataItem); // Construct args to be encoded // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes. - const args = 'a'.repeat(40); + const bytesLength = 40; + const args = 'a'.repeat(bytesLength); // Encode Args and validate result const encodedArgs = dataType.encode(args); const expectedEncodedArgs = @@ -1831,7 +1835,8 @@ describe.only('ABI Encoder', () => { const dataType = new AbiEncoder.SolString(testDataItem); // Construct args to be encoded // Note: There will be padding because this is a bytes32 but we are only passing in 4 bytes. - const args = '0x' + 'a'.repeat(40); + const strLength = 40; + const args = '0x' + 'a'.repeat(strLength); // Encode Args and validate result const encodedArgs = dataType.encode(args); const expectedEncodedArgs = diff --git a/packages/utils/test/abi_samples.ts b/packages/utils/test/abi_samples.ts index 0c3354044..fc552c127 100644 --- a/packages/utils/test/abi_samples.ts +++ b/packages/utils/test/abi_samples.ts @@ -1,6 +1,7 @@ +/* tslint:disable max-file-line-count */ import { MethodAbi } from 'ethereum-types'; -export const simpleAbi = { +export const simpleAbi: MethodAbi = { constant: false, inputs: [ { @@ -17,9 +18,9 @@ export const simpleAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const stringAbi = { +export const stringAbi: MethodAbi = { constant: false, inputs: [ { @@ -32,9 +33,9 @@ export const stringAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const GAbi = { +export const GAbi: MethodAbi = { constant: false, inputs: [ { @@ -66,9 +67,9 @@ export const GAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const typesWithDefaultWidthsAbi = { +export const typesWithDefaultWidthsAbi: MethodAbi = { constant: false, inputs: [ { @@ -101,9 +102,9 @@ export const typesWithDefaultWidthsAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const multiDimensionalArraysStaticTypeAbi = { +export const multiDimensionalArraysStaticTypeAbi: MethodAbi = { constant: false, inputs: [ { @@ -144,9 +145,9 @@ export const multiDimensionalArraysStaticTypeAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const multiDimensionalArraysDynamicTypeAbi = { +export const multiDimensionalArraysDynamicTypeAbi: MethodAbi = { constant: false, inputs: [ { @@ -171,9 +172,9 @@ export const multiDimensionalArraysDynamicTypeAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const dynamicTupleAbi = { +export const dynamicTupleAbi: MethodAbi = { constant: false, inputs: [ { @@ -196,9 +197,9 @@ export const dynamicTupleAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayOfStaticTuplesWithDefinedLengthAbi = { +export const arrayOfStaticTuplesWithDefinedLengthAbi: MethodAbi = { constant: false, inputs: [ { @@ -221,9 +222,9 @@ export const arrayOfStaticTuplesWithDefinedLengthAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayOfStaticTuplesWithDynamicLengthAbi = { +export const arrayOfStaticTuplesWithDynamicLengthAbi: MethodAbi = { constant: false, inputs: [ { @@ -246,9 +247,9 @@ export const arrayOfStaticTuplesWithDynamicLengthAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayOfDynamicTuplesWithDefinedLengthAbi = { +export const arrayOfDynamicTuplesWithDefinedLengthAbi: MethodAbi = { constant: false, inputs: [ { @@ -271,9 +272,9 @@ export const arrayOfDynamicTuplesWithDefinedLengthAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayOfDynamicTuplesWithUndefinedLengthAbi = { +export const arrayOfDynamicTuplesWithUndefinedLengthAbi: MethodAbi = { constant: false, inputs: [ { @@ -296,9 +297,9 @@ export const arrayOfDynamicTuplesWithUndefinedLengthAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayOfDynamicTuplesAbi = { +export const arrayOfDynamicTuplesAbi: MethodAbi = { constant: false, inputs: [ { @@ -321,9 +322,9 @@ export const arrayOfDynamicTuplesAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const multidimensionalArrayOfDynamicTuplesAbi = { +export const multidimensionalArrayOfDynamicTuplesAbi: MethodAbi = { constant: false, inputs: [ { @@ -346,9 +347,9 @@ export const multidimensionalArrayOfDynamicTuplesAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const staticTupleAbi = { +export const staticTupleAbi: MethodAbi = { constant: false, inputs: [ { @@ -379,9 +380,9 @@ export const staticTupleAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const staticArrayAbi = { +export const staticArrayAbi: MethodAbi = { constant: false, inputs: [ { @@ -394,9 +395,9 @@ export const staticArrayAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const staticArrayDynamicMembersAbi = { +export const staticArrayDynamicMembersAbi: MethodAbi = { constant: false, inputs: [ { @@ -409,9 +410,9 @@ export const staticArrayDynamicMembersAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const dynamicArrayDynamicMembersAbi = { +export const dynamicArrayDynamicMembersAbi: MethodAbi = { constant: false, inputs: [ { @@ -424,9 +425,9 @@ export const dynamicArrayDynamicMembersAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const dynamicArrayStaticMembersAbi = { +export const dynamicArrayStaticMembersAbi: MethodAbi = { constant: false, inputs: [ { @@ -439,9 +440,9 @@ export const dynamicArrayStaticMembersAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const largeFlatAbi = { +export const largeFlatAbi: MethodAbi = { constant: false, inputs: [ { @@ -486,9 +487,9 @@ export const largeFlatAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const largeNestedAbi = { +export const largeNestedAbi: MethodAbi = { constant: false, inputs: [ { @@ -579,9 +580,9 @@ export const largeNestedAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const nestedTuples = { +export const nestedTuples: MethodAbi = { constant: false, inputs: [ { @@ -668,9 +669,9 @@ export const nestedTuples = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const simpleAbi2 = { +export const simpleAbi2: MethodAbi = { constant: false, inputs: [ { @@ -695,9 +696,9 @@ export const simpleAbi2 = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const fillOrderAbi = { +export const fillOrderAbi: MethodAbi = { constant: false, inputs: [ { @@ -776,4 +777,4 @@ export const fillOrderAbi = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; diff --git a/packages/utils/test/optimizer_abis.ts b/packages/utils/test/optimizer_abis.ts index ea562e5b5..7cfd7a118 100644 --- a/packages/utils/test/optimizer_abis.ts +++ b/packages/utils/test/optimizer_abis.ts @@ -1,6 +1,7 @@ +/* tslint:disable max-file-line-count */ import { MethodAbi } from 'ethereum-types'; -export const duplicateDynamicArraysWithStaticElements = { +export const duplicateDynamicArraysWithStaticElements: MethodAbi = { constant: false, inputs: [ { @@ -17,9 +18,9 @@ export const duplicateDynamicArraysWithStaticElements = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateDynamicArraysWithDynamicElements = { +export const duplicateDynamicArraysWithDynamicElements: MethodAbi = { constant: false, inputs: [ { @@ -36,9 +37,9 @@ export const duplicateDynamicArraysWithDynamicElements = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateStaticArraysWithStaticElements = { +export const duplicateStaticArraysWithStaticElements: MethodAbi = { constant: false, inputs: [ { @@ -55,9 +56,9 @@ export const duplicateStaticArraysWithStaticElements = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateStaticArraysWithDynamicElements = { +export const duplicateStaticArraysWithDynamicElements: MethodAbi = { constant: false, inputs: [ { @@ -74,9 +75,9 @@ export const duplicateStaticArraysWithDynamicElements = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateArrayElements = { +export const duplicateArrayElements: MethodAbi = { constant: false, inputs: [ { @@ -89,9 +90,9 @@ export const duplicateArrayElements = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateTupleFields = { +export const duplicateTupleFields: MethodAbi = { constant: false, inputs: [ { @@ -114,9 +115,9 @@ export const duplicateTupleFields = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateStrings = { +export const duplicateStrings: MethodAbi = { constant: false, inputs: [ { @@ -133,9 +134,9 @@ export const duplicateStrings = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateBytes = { +export const duplicateBytes: MethodAbi = { constant: false, inputs: [ { @@ -152,9 +153,9 @@ export const duplicateBytes = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateTuples = { +export const duplicateTuples: MethodAbi = { constant: false, inputs: [ { @@ -191,9 +192,9 @@ export const duplicateTuples = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateArraysNestedInTuples = { +export const duplicateArraysNestedInTuples: MethodAbi = { constant: false, inputs: [ { @@ -226,9 +227,9 @@ export const duplicateArraysNestedInTuples = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateTuplesNestedInTuples = { +export const duplicateTuplesNestedInTuples: MethodAbi = { constant: false, inputs: [ { @@ -273,9 +274,9 @@ export const duplicateTuplesNestedInTuples = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const duplicateTwoDimensionalArrays = { +export const duplicateTwoDimensionalArrays: MethodAbi = { constant: false, inputs: [ { @@ -292,9 +293,9 @@ export const duplicateTwoDimensionalArrays = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayElementsDuplicatedAsSeparateParameter = { +export const arrayElementsDuplicatedAsSeparateParameter: MethodAbi = { constant: false, inputs: [ { @@ -311,9 +312,9 @@ export const arrayElementsDuplicatedAsSeparateParameter = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const arrayElementsDuplicatedAsTupleFields = { +export const arrayElementsDuplicatedAsTupleFields: MethodAbi = { constant: false, inputs: [ { @@ -336,4 +337,4 @@ export const arrayElementsDuplicatedAsTupleFields = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; diff --git a/packages/utils/test/return_value_abis.ts b/packages/utils/test/return_value_abis.ts index 847559dac..ac2124011 100644 --- a/packages/utils/test/return_value_abis.ts +++ b/packages/utils/test/return_value_abis.ts @@ -1,6 +1,7 @@ +/* tslint:disable max-file-line-count */ import { MethodAbi } from 'ethereum-types'; -export const noReturnValues = { +export const noReturnValues: MethodAbi = { constant: false, inputs: [], name: 'simpleFunction', @@ -8,9 +9,9 @@ export const noReturnValues = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const singleStaticReturnValue = { +export const singleStaticReturnValue: MethodAbi = { constant: false, inputs: [], name: 'simpleFunction', @@ -23,9 +24,9 @@ export const singleStaticReturnValue = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const multipleStaticReturnValues = { +export const multipleStaticReturnValues: MethodAbi = { constant: false, inputs: [], name: 'simpleFunction', @@ -42,9 +43,9 @@ export const multipleStaticReturnValues = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const singleDynamicReturnValue = { +export const singleDynamicReturnValue: MethodAbi = { constant: false, inputs: [], name: 'simpleFunction', @@ -57,9 +58,9 @@ export const singleDynamicReturnValue = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const multipleDynamicReturnValues = { +export const multipleDynamicReturnValues: MethodAbi = { constant: false, inputs: [], name: 'simpleFunction', @@ -76,9 +77,9 @@ export const multipleDynamicReturnValues = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; -export const mixedStaticAndDynamicReturnValues = { +export const mixedStaticAndDynamicReturnValues: MethodAbi = { constant: false, inputs: [], name: 'simpleFunction', @@ -95,4 +96,4 @@ export const mixedStaticAndDynamicReturnValues = { payable: false, stateMutability: 'nonpayable', type: 'function', -} as MethodAbi; +}; |