getTransaction

Get information about a specific transaction.

Input Arguments

ParameterDescription

txid: string

The id of the transaction you would like to get information about

Success Response

The wallet will return the direct response from the RPC node.

Error Response

ParameterDescription

type: string

The type of error which has occured

description: string

A description of the error which has occured

data: string

Any raw data associated with the error

Example

Request

neolineN3.getTransaction({
    txid: '0xe5a5fdacad0ba4e8d34d2fa0638357adb0f05e7fc902ec150739616320870f50'
})
.then(result => {
    console.log('Transaction details: ' + JSON.stringify(result));
})
.catch((error) => {
    const {type, description, data} = error;
    switch(type) {
        case 'NO_PROVIDER':
            console.log('No provider available.');
            break;
        case 'RPC_ERROR':
            console.log('There was an error when broadcasting this transaction to the network.');
            break;
        default:
            // Not an expected error object.  Just write the error to the console.
            console.error(error);
            break;
    }
});

Response

{
    "hash": "0xc156988547570d1c852d9a56324b2e09d89077ff0aee2070d0b470332ae1e083",
    "size": 244,
    "sys_fee": "0.0997775",
    "net_fee": "0.0124379",
    "block_index": 103879,
    "block_time": 1618238381713,
    "version": 0,
    "transfers": [
        {
            "hash": "0xc156988547570d1c852d9a56324b2e09d89077ff0aee2070d0b470332ae1e083",
            "src": "tx",
            "contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
            "from": "",
            "to": "NaUjKgf5vMuFt7Ffgfffcpc41uH3adx1jq",
            "amount": "0.00004914"
        },
        {
            "hash": "0xc156988547570d1c852d9a56324b2e09d89077ff0aee2070d0b470332ae1e083",
            "src": "tx",
            "contract": "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
            "from": "NaUjKgf5vMuFt7Ffgfffcpc41uH3adx1jq",
            "to": "NaUjKgf5vMuFt7Ffgfffcpc41uH3adx1jq",
            "amount": "1"
        }
    ]
}

最后更新于