neo-modules icon indicating copy to clipboard operation
neo-modules copied to clipboard

neo2.x [RpcSystemAssetTracker] add API to query a list of UTXO tx history of specified address

Open longfeiWan9 opened this issue 4 years ago • 3 comments

version: neo2.x

Can we add a API in RpcSystemAssetTracker plugin to query a list of UTXO (NEO or GAS) transaction history of a specified address or specified time range?

API Name: getutxotransfers

Parameters

  • address:The address to query the transaction information.

  • asset (Optional):either NEO or GAS. If not specified, will return records for both.

  • timestamp (Optional): start, end

    • If start and end timestamps are specified, transactions occurred in that time range will be returned.

    • If only one timestamp is specified, transactions occurred since that time will be returned.

    • If not specified, transactions in recent seven days will be returned.

Request Example:

{
    "jsonrpc": "2.0",
    "id": 1
    "method": "getutxotransfers",
    "params": [
        "AbHgdBaWEnHkCiLtDZXjhvhaAK2cwFh5pF",
        "neo",
        1553105830,
        1557305830
    ]
}

Response Example:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "address": "ALsa2JWWsKiMuqZkCpKvZx2iSoBXjNdpZo",
        "sent": [
            {
                "asset_hash": "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
                "asset": "NEO",
                "total_amount": 125,
                "transactions": [
                    {
                        "block_index": 368082,
                        "timestamp": 1554283931,
                        "txid": "8e4e31dfcdbb664dd284318594e890be23f244507530305692eca6b90b612742",
                        "to_address": "AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM",
                        "amount": 100
                    },
                    {
                        "block_index": 3545313,
                        "timestamp": 1534313311,
                        "txid": "43cdcafb08ccfbf09acfa918c327e507a2a4b56f3c16257adb04cd5251ff4743",
                        "to_address": "AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis",
                        "amount": 25
                    }
                ]
            },
            {
                "asset_hash": "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "asset": "GAS",
                "total_amount": 150.768,
                "transactions": [
                    {
                        "block_index": 368082,
                        "timestamp": 1554283931,
                        "txid": "8e4e31dfcdbb664dd284318594e890be23f244507530305692eca6b90b612742",
                        "to_address": "AFmseVrdL9f9oyCzZefL9tG6UbvhPbdYzM",
                        "amount": 25.518
                    },
                    {
                        "block_index": 3545313,
                        "timestamp": 1534313311,
                        "txid": "43cdcafb08ccfbf09acfa918c327e507a2a4b56f3c16257adb04cd5251ff4743",
                        "to_address": "AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis",
                        "amount": 125.25
                    }
                ]
            }
        ],
        "received": [
            {
                "asset_hash": "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b",
                "asset": "NEO",
                "total_amount": 251,
                "transactions": [
                    {
                        "block_index": 368082,
                        "timestamp": 1554283931,
                        "txid": "8e4e31dfcdbb664dd284318594e890be23f244507530305692eca6b90b612742",
                        "from_address": "AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis",
                        "amount": 115
                    },
                    {
                        "block_index": 3545313,
                        "timestamp": 1534313311,
                        "txid": "43cdcafb08ccfbf09acfa918c327e507a2a4b56f3c16257adb04cd5251ff4743",
                        "from_address": "AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis",
                        "amount": 136
                    }
                ]
            },
            {
                "asset_hash": "602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7",
                "asset": "GAS",
                "total_amount": 39.246,
                "transactions": [
                    {
                        "block_index": 368082,
                        "timestamp": 1554283931,
                        "txid": "8e4e31dfcdbb664dd284318594e890be23f244507530305692eca6b90b612742",
                        "from_address": "AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis",
                        "amount": 20.225
                    },
                    {
                        "block_index": 3545313,
                        "timestamp": 1534313311,
                        "txid": "43cdcafb08ccfbf09acfa918c327e507a2a4b56f3c16257adb04cd5251ff4743",
                        "from_address": "AYwgBNMepiv5ocGcyNT4mA8zPLTQ8pDBis",
                        "amount": 19.021
                    }
                ]
            }
        ]
    }
}

longfeiWan9 avatar May 28 '20 05:05 longfeiWan9

Please if the issue it's for neo2, specify it in the title

shargon avatar May 28 '20 06:05 shargon

Please if the issue it's for neo2, specify it in the title

done. :)

longfeiWan9 avatar May 28 '20 06:05 longfeiWan9

@wanglongfei88 I will change to_address and from_address to transfer_address for consistency, and other parts will remain the same.

joeqian10 avatar Jun 01 '20 09:06 joeqian10