[Ethereum] How to convert transaction’s inputs to readable values

etheretherscansoliditytransactions

I've got the following transaction's input:

{
    name: 'trade',
    types: [
        'address',
        'uint256',
        'address',
        'uint256',
        'uint256',
        'uint256',
        'address',
        'uint8',
        'bytes32',
        'bytes32',
        'uint256'
    ],
    inputs: ['ac709fcb44a43c35f0da4e3163b117a17f3770f5',
        <BN: 878678326eac900000>,
        '0000000000000000000000000000000000000000', 
        <BN: bf2aa18455018000>, 
        <BN: 302bdf>,
        <BN: dc51da3a>,
        'd8eeda4ee2657bb267bc35c1d60babdc5aedd269', 
        <BN: 1c>,
        <Buffer b4 bf 0 d cd 37 ca 73 bd 5 a bc e9 53 2 b 03 3 d cc 64 27 be 16 06 83 de 11 3e fc a4 13 20 c2 7 f 3e>, 
        <Buffer 78 79 9 d 84 04 0e 5 c 24 58 28 b1 b5 31 ef 97 e1 af 12 49 46 f4 dc 1 d b5 a2 0 c f2 8 a 70 73 b2 69>, 
        <BN: 275dcc081d0c2351e0>
    ]
}

This data came from raw transaction input which is

0x0a19b14a000000000000000000000000ac709fcb44a43c35f0da4e3163b117a17f3770f50000000000000000000000000000000000000000000000878678326eac9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bf2aa184550180000000000000000000000000000000000000000000000000000000000000302bdf00000000000000000000000000000000000000000000000000000000dc51da3a000000000000000000000000d8eeda4ee2657bb267bc35c1d60babdc5aedd269000000000000000000000000000000000000000000000000000000000000001cb4bf0dcd37ca73bd5abce9532b033dcc6427be160683de113efca41320c27f3e78799d84040e5c245828b1b531ef97e1af124946f4dc1db5a20cf28a7073b2690000000000000000000000000000000000000000000000275dcc081d0c2351e0

How can I convert inputs to readable string values?

PS: by readable string values I mean converted values from BN and Buffer types to utf8 strings.

Best Answer

The tool ethereum-input-data-decoder, which you used to decode the encoded input data, returns uint types as Big Numbers and byte32 types as Buffers.

To convert to a readable format simply call the toString method.

Examples

// big number to decimal string
myBN.toString(10) 

// buffer to hex string
myBuffer.toString(16)