brianium / bitkit

A fun Frankenstein monster for tracking bitcoin transactions through the mempool
0 stars 0 forks source link

Feature/transaction endpoint pt3 upsert #25

Closed brianium closed 6 years ago

brianium commented 6 years ago

This adds support for replacing existing transaction records.

There is also an optional method flag that can be passed via json. If omitted, the default is append

To test against staging: http://bitkit-staging.0ce25c51.svc.dockerapp.io:8080

Sample request payloads:

append

{
    "method": "append",
    "data": [
        {
            "txid": "testid-1",
            "fee_rate": 0.1234,
            "weight": 1
        },
        {
            "txid": "testid-2",
            "fee_rate": 0.2345,
            "weight": 2
        }
    ]
}

reset

{
    "method": "reset",
    "data": [
        {
            "txid": "testid-3",
            "fee_rate": 0.2345,
            "weight": 2
        }
    ]
}

upsert

{
    "method": "append",
    "data": [
        {
            "txid": "testid-3",
            "fee_rate": 0.2345,
            "weight": 7
        }
    ]
}

default

{
    "data": [
        {
            "txid": "testid-1",
            "fee_rate": 0.1234,
            "weight": 1
        },
        {
            "txid": "testid-2",
            "fee_rate": 0.2345,
            "weight": 2
        }
    ]
}