@@ -13,8 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
- import { methodID , rawDecode , rawEncode } from 'ethereumjs-abi' ;
17
16
import BigNumber from 'bignumber.js' ;
17
+ import { methodID , rawDecode , rawEncode } from 'ethereumjs-abi' ;
18
18
19
19
const ethAbi = { methodID, rawDecode, rawEncode } ;
20
20
@@ -31,7 +31,7 @@ export interface OutputValue {
31
31
/**
32
32
* Converts function input parameters to TX's data field.
33
33
*/
34
- export function functionToData ( func : any , inputs : InputValues ) : string {
34
+ export function functionToData ( func : any , inputs : InputValues ) : string {
35
35
if ( func ) {
36
36
const types = [ ] ;
37
37
const values = [ ] ;
@@ -47,20 +47,20 @@ export function functionToData(func: any, inputs: InputValues): string {
47
47
throw new Error ( `Invalid function ABI: ${ func } ` ) ;
48
48
}
49
49
50
- export function dataToParams ( func : any , data : string ) : Array < OutputValue > {
50
+ export function dataToParams ( func : any , data : string ) : OutputValue [ ] {
51
51
const buffer = Buffer . from ( data . replace ( '0x' , '' ) , 'hex' ) ;
52
- const types = func . outputs . map ( output => output . type ) ;
52
+ const types = func . outputs . map ( ( output ) => output . type ) ;
53
53
const params = ethAbi . rawDecode ( types , buffer ) ;
54
54
return func . outputs . map ( ( o , i ) => ( {
55
55
type : o . type ,
56
56
name : o . name ,
57
- value : ( params [ i ] instanceof BigNumber ) ? params [ i ] . toString ( ) : params [ i ] ,
57
+ value : ( params [ i ] instanceof BigNumber ) ? params [ i ] . toString ( ) : params [ i ]
58
58
} ) ) ;
59
59
}
60
60
61
61
export default {
62
62
functionToData,
63
- dataToParams,
63
+ dataToParams
64
64
} ;
65
65
66
- export { default as Contract } from './Contract' ;
66
+ export { default as Contract } from './Contract' ;
0 commit comments