Orders

Endpoints to interact with and retrieve orders.

Get Orders

GET https://api.redshift.radar.tech/api/orders

This endpoint allows you to get orders via the lightning invoice and payment asset. Because an actual invoice could potentially exceed the maximum URL length, we use the invoice hash.

Query Parameters

Name
Type
Description

invoiceHash

string

The SHA256 hash of the Lightning invoice used to request the quote.

onchainTicker

string

The ticker code for the payment asset.

[
 {
  "id": string,
  "market": string,
  "onchainTicker": string,
  "createdAt": string,
  "state": string,
  "payToAddress": string,
  "amount": string | BigNumber
  "amountPaid": string | BigNumbe
  "expiryTimestamp": Date
 }
]

Example

$ curl https://api.redshift.radar.tech/api/orders?invoiceHash=0a942325eb07d744c3b98a3b8e0d50bee02d9d2fe4f0cd1734ff3ce8b60a994c
[
    {
        "id": "a61131f7-0b66-460e-b3d8-37d59f94b8aa",
        "market": "BTC_LBTC",
        "onchainTicker": "BTC",
        "createdAt": "2019-11-05T20:11:08.821Z",
        "state": "Complete",
        "payToAddress": "383HpQyScZvbyXJrdD6WCnLGRBeeQMBDX7",
        "amount": "0.0003559",
        "amountPaid": "0.0006669"
    },
    {
        "id": "0ec6f515-5d61-4998-ba93-97a4e51164e9",
        "market": "BTC_LBTC",
        "onchainTicker": "BTC",
        "createdAt": "2019-11-05T20:05:45.168Z",
        "state": "FundWindowElapsed",
        "payToAddress": "363ZmnA5BYYQq3FQhTBmYNcEKY5CwWoekS",
        "amount": "0.0003593",
        "amountPaid": "0"
    }
]

​Get Order

GET https://api.redshift.radar.tech/api/orders/:id

Path Parameters

Name
Type
Description

id

string

The id associated with the order.

{
  "id": string,
  "market": string,
  "onchainTicker": string,
  "createdAt": string,
  "state": string,
  "payToAddress": string,
  "amount": string | BigNumber
  "amountPaid": string | BigNumbe
  "expiryTimestamp": Date
 }

Example

$ curl https://api.redshift.radar.tech/api/orders/206820ee-0136-436b-8d0a-f288eb4011d0

{
    "market": "ETH_LBTC",
    "onchainTicker": "ETH",
    "createdAt": "2020-01-05T01:59:48.385Z",
    "state": "Complete",
    "payToAddress": "0x46340430971885eFfA5757eE03356eD228258ac0",
    "amount": "0.37583397",
    "amountPaid": "0.37583397",
    "invoice": "lnbc6500u1p0pzskxpp55n4d4gaahlnvrqg3exlmuvwtppkgu0h5h79wyhznxkljjh4qyw7qdqjg9kxcgrfdcsycsj5gvcqzpgxqyz5vq9rqymmgvr5h4kejvd99qe7xdpqakkraqrpdrpwhpmpwuv5ha830k50jqjv84t6a49gu633ykg3xwr2k2hjfeasq08l0lwhgkmy63s3spscplrl",
    "paymentHash": "a4eadaa3bdbfe6c18111c9bfbe31cb086c8e3ef4bf8ae25c5335bf295ea023bc",
    "paymentPreimage": "4073e2c3affd699b93959029a7d481ac4daf5a98bda8f040c6e8fbc0cf791001"
}

Get Order State

GET https://api.redshift.radar.tech/api/orders/:id/state

Path Parameters

Name
Type
Description

id

string

The id associated with the order.

WaitingForFundingTx | WaitingForFundingTxConfirmation | FundWindowElapsed

Example

$ curl https://api.redshift.radar.tech/api/orders/206820ee-0136-436b-8d0a-f288eb4011d0

"Complete"

​Get Order Funding Details

GET https://api.redshift.radar.tech/api/orders/:id/fundDetails

Path Parameters

Name
Type
Description

id

string

The id associated with the order.

{
    "orderId": string,
    "expiryTimestampMs": number,
    "amount": string,
    "details": {
        "redeemScript": string,
        "payToAddress": string,
        "refundableAtBlockHeight": number
    }
}

Example

$ curl https://api.redshift.radar.tech/api/orders/206820ee-0136-436b-8d0a-f288eb4011d0/fundDetails

{
    "orderId": "206820ee-0136-436b-8d0a-f288eb4011d0",
    "expiryTimestampMs": 1578190188508,
    "amount": "0.375833970000000000",
    "details": {
        "unsignedFundingTx": {
            "to": "0x46340430971885eFfA5757eE03356eD228258ac0",
            "data": "0x3fdcdd1e206820ee0136436b8d0af288eb4011d000000000000000000000000000000000a4eadaa3bdbfe6c18111c9bfbe31cb086c8e3ef4bf8ae25c5335bf295ea023bc",
            "value": "375833970000000000"
        }
    }
}

Get Order Transactions

GET https://api.redshift.radar.tech/api/orders/:id/transactions

Path Parameters

Name
Type
Description

id

string

The id associated with the order.

[
    {
        "type": string,
        "id": string
    }
]

Example

$ curl https://api.redshift.radar.tech/api/orders/206820ee-0136-436b-8d0a-f288eb4011d0/transactions

[
    {
        "type": "FUND",
        "id": "0x46ac9daadba75fd2af42584dd0cc3ddc1c66d2d9fa1af4f7af8f416cd5c6e83f"
    }
]

Get Refund

GET https://api.redshift.radar.tech/api/orders/:id/refund

Path Parameters

Name
Type
Description

id

string

The id associated with the order.

// Bitcoin Refund
{
    "market": string,
    "state": string,
    "blocksRemaining": number,
    "refundableAtBlockHeight": number,
    "refundableBalance": string,
    "details": {
        "refundAddress": string,
        "redeemScript": string,
        "currentBlockHeight": number,
        "feeTokensPerVirtualByte": number,
        "utxos": [
            {
                "txId": string,
                "index": number,
                "tokens": number
            }
        ]
    }
}

// Ethereum Refund
{
    "market": string,
    "state": string,
    "blocksRemaining": number,
    "refundableAtBlockHeight": number,
    "refundableBalance": string,
    "details": {
        "to": string,
        "data": string
    }
}

Example

// Bitcoin Order
$ curl https://api.redshift.radar.tech/api/orders/53f27403-98da-4e08-8578-04ec6cfba4b1/refund

{
    "market": "BTC_LBTC",
    "state": "Complete",
    "blocksRemaining": 0,
    "refundableAtBlockHeight": 607878,
    "refundableBalance": "0.0005263",
    "details": {
        "refundAddress": "bc1q50qmmgf3mtp95qesqq27h8gsdx9syuzv9p8qfa",
        "redeemScript": "76a9148ec7c524f0cfca47daaa56827c76d94e0ea47c2c8763752103698deb28d5807611b0545b2c0b59ea4ae84393b2e22b7f131f1b89694b43749a6703864609b17576a914a3c1bda131dac25a03300015eb9d10698b02704c8868ac",
        "currentBlockHeight": 612073,
        "feeTokensPerVirtualByte": 30,
        "utxos": [
            {
                "txId": "d2a153c4024152a06cb1ee6e5da1fac3548085ed77dc75f438586c37fed26678",
                "index": 1,
                "tokens": 52630
            }
        ]
    }
}

// Ethereum Order
$ curl https://api.redshift.radar.tech/api/orders/206820ee-0136-436b-8d0a-f288eb4011d0/refund

{
    "market": "ETH_LBTC",
    "state": "Complete",
    "blocksRemaining": 0,
    "refundableAtBlockHeight": 9224305,
    "refundableBalance": "0.37583397",
    "details": {
        "to": "0x46340430971885eFfA5757eE03356eD228258ac0",
        "data": "0xdfdecfaf206820ee0136436b8d0af288eb4011d000000000000000000000000000000000"
    }
}

Last updated

Was this helpful?