Proxy Buy / Sweep

Unified API to bulk buy Ordinals from all different source sites via Ordyssey

Sweep Order

  1. Definition: Sweep Order is an Ordyssey object to save the user request to buy a set of Ordyssey listings. It includes a sequential execution pipeline of PSBTs / Bitcoin Tx generated by different marketplaces (sweep sources) which supports sweep function.

  2. Why it's stateful: The structure of a sweep PSBT / Tx depends on the real-time UTXO balance of a user wallet. This process is stateful and cannot concurrently apply unsigned + submit signed in only one step. After a Bitcoin Tx broadcasted, the UTXO distribution changes, and other PSBTs previously applied concurrently will be invalid. Therefore, we have to call the exchanges' purchasing interfaces step by step to generate unsigned PSBTs for users to sign and broadcast.

  3. Step Design: The marketplaces have different PSBT algorithms for sweep function. Usually a complete purchasing transaction includes a preceding Bitcoin Tx to make the UTXOs available for the algorithm, so we define PSBT Steps for them respectively. Each purchase step corresponds to a Bitcoin Tx.

  4. Demo video herearrow-up-right: you can use this endpoint to implement it.

Sweep Sources & PSBT Steps

Only listings from these sources can be generated as a Sweep Order so far, so you may need to do some listings source filter for the range of user selecting on your app's UI.

Sweep Source
PSBT Steps

Sweep Order Status

API Slug
Description

created

The order was just created.

partially_filled

The order has been partially filled.

filled

The order has been successfully filled.

timeout

The order was timeout to get signed PSBT response from user/developer.

failed

The order got an error from its source site.

Wallet Providers

Only these wallet providers are officially recognized by Ordyssey Open API so far:

Create a Sweep Order

Create a Sweep Order object with a set of Ordyssey listings to get an order UUID

POST https://open-api.ordyssey.com/v1/dex/sweep_order/create

Request Body

Name
Type
Description

buyer_pubkey*

String

Buyer public key of BTC wallet

buyer_wallet_provider*

String

One of unisat, okx, leather, xverse

buyer*

String

Buyer BTC address

buyer_receive_address

String

If no value passed, the purchasing address will be selected

listing_ids*

Int Array

The order IDs returned from listings API. Example: 1,21,34,900,902

View a Sweep Order

Get a summary of the Sweep Order, including detailed PSBT steps and executing status

GET https://open-api.ordyssey.com/v1/dex/sweep_order/view/<:order_uuid>

Path Parameters

Name
Type
Description

order_uuid*

String

The unique identifier of the sweep order

Call a Sweep Order

Interactively call the pipeline function to make next move for user's PSBT signing

POST https://open-api.ordyssey.com/v1/dex/sweep_order/call/<:order_uuid>

Apply for un-signed PSBT or post-back signed PSBT in the order defined by steps

Path Parameters

Name
Type
Description

order_uuid*

String

The unique identifier of the sweep order

Request Body

Name
Type
Description

fee_rate_tier

String

The gas level keywords defined by mempool.spacearrow-up-right, must be one of minimumFee, economyFee, hourFee, halfHourFee, fastestFee Most source exchanges follow the standard (while not directly use sats/vB), so we have no choice. Please make the gas price / cost data available for your users from this API https://mempool.space/api/v1/fees/recommendedarrow-up-right

signed_psbt_base64

String

Signed by user wallet and client side, such as from Unisat. But we need base64 format here. For the step of returning signed PSBT by user, it's required.

triangle-exclamation

Disclaimer for potential unexpected UTXO spending

In principle, if the sweep targets are from other marketplaces, Ordyssey Proxy Sweep is just a proxy service and does not have the authority to change the generation of PSBT/Tx structure. The returned PSBT is consistent with the result from the source site's UI.

For example, OrdinalsWalletarrow-up-right sweep PSBT algorithm has some issues here:

  1. Prioritize consuming small UTXOs as payment, including MagicEden's 600 size dummy.

  2. For payment UTXO selecting, OW does not recognize cursed inscriptions and rare sats.

For 1, if you have a large number of small UTXOs in your wallet, a simple payment Tx will have a large number of inputs, resulting in high gas fees.

For 2, we recommend developers also check the indexer results after receiving the unsigned PSBT to ensure that no inscriptions or rare sats are lost as payment UTXO. An additional layer of protection is required.

Ordyssey is not responsible for this kind of loss or UTXO protecting. Similarly, if a wallet is also a user of MagicEdenarrow-up-right or Sating.ioarrow-up-right, its rare sats are unidentified by most products in the ecosystem.

What developers can do here is:

  1. Identify the problem and risk for all inputs of the unsigned PSBT, reject the purchase request for user or do some advise.

  2. Make a pre-risk statement for your users.

  3. Try to contact with the source site developers to find out if there is room for optimization in their Tx structure and the behavior of consuming UTXO and indexer results.

Last updated