Create buy offer

This endpoint is designed for creating an transaction to purchase an ordinal listed for sale on the marketplace. Platform Cost: A platform fee is applied only when an ordinal is sold. It is not charged for listing an ordinal. The current fee is 1% of sale amount charged to the seller.

Upon usage, it generates a Partially Signed Bitcoin Transaction (PSBT) encoded in base64. This PSBT must be signed by the individual intending to buy the ordinal.

Here's an example of executing a purchase transaction with Xverse wallet:

      
      // XVerse Wallet example of creating a signing request 
      // when buying an Ordinal

      // Create the purchase PSBT by calling /marketplace/create-offer
      const { data } = await axios({
        method: 'post'
        url: 'https://api.ordinalsbot.com/marketplace/create-offer',
        data: {
          ordinalId: id,
          buyerPaymentAddress: paymentAddress,
          buyerOrdinalAddress: ordinalsAddress,
          buyerPaymentPublicKey: paymentPublicKey
        },
        headers: {
        'x-api-key': API_KEY,
      });

      // returned response has a base64 encoded psbt to sign and an array of input
      // indices which the buyer needs to sign with the payment address wallet
      const buyerInput = {
        address: paymentAddress, // Buyer's payment wallet address
        signingIndexes: data.buyerInputIndices
      };

      // When using XVerse Wallet
      // Create the payload for signing the buyer transaction
      const payload = {
        network: { type: "Mainnet" },
        message: "Sign Buyer Transaction",
        psbtBase64: data.psbt,
        broadcast: false,
        inputsToSign: [buyerInput],
      };

      // Make signing request
      await signTransaction({
        payload,
        onFinish: async (response) => {
          try {
            // Here make a call to /submit-offer
            // Things to do after successful signing
          } catch (Error) {
            // error handling
          }
        },
        onCancel: () => { // User cancelled signing request }
      });

POST Buy an ordinal

Buy a listed ordinal

POST https://api.ordinalsbot.com/marketplace/create-offer

API Key is required in the header:

headers: { 'x-api-key': '<YOUR_API_KEY>', ...otherHeaders }

Request Body

NameTypeDescription

ordinalId*

String

Id of the ordinal to buy.

buyerPaymentAddress*

String

Buyer's payment wallet address. The buyer will need to pay the cost of the transaction from UTXOs belonging to this address.

buyerPaymentPublicKey*

String

Public Key for buyer's payment wallet address.

buyerOrdinalAddress*

String

Buyer's Ordinal wallet address. The purchased Ordinal will be transferred to this address.

feeRateTier

String

Transaction fee rate should be one of the following. Defaults to fastestFee if not specified: fastestFee halfHourFee hourFee minimumFee


{
    "psbt": "cHNidP8BA............z730AAAAAAAAAAA==",
    "buyerInputIndices": [ 0, 1, 3, 4, 5, 6 ]
}

Last updated