LogoLogo
Back to AppHelp Center
  • Getting Started
    • Welcome
  • OrdinalsBot API
    • Overview
    • Libraries
    • Template-App
    • Signet
    • Testnet
    • Fractal
    • Getting Prices
      • Getting Prices (Legacy)
    • Create a Direct Inscription Order
    • Create a Managed Inscription Order
    • Get Order Status
    • Create a Collection
    • Create a Collection Order
    • Create Text Inscription Order
    • Search Inscriptions
    • Check Rare Sats Inventory
    • Referral Scheme
    • Transaction Accelerator
    • Burning Assets
    • Webhooks
    • Order States
    • Order Types
  • Runes
    • Etch
    • Mint
    • Direct Mint
      • 1. Generate Direct Mint PSBT
      • 2. Direct Rune Mint Process PSBT
    • Launchpad
      • Create
      • Mint
      • Get Launchpad
    • Airdrop
  • Token Pay
    • What is TokenPay?
    • API Docs
      • API reference
        • Order
        • Create payment psbt
        • Create burn rune psbt
        • Validate burn rune tx
        • Create burn inscription psbt
        • Utils
          • Checktx
          • Submittx
          • Finalize psbt
        • User
          • Withdrawal
          • Order
            • Rune
          • Account
            • Withdraw
            • Balance
      • Specification
  • Marketplace
    • User Guide: Pre-Inscribed Launchpad API
    • API Docs
      • Data API
    • Editions Launchpad
  • Launchpad API
    • Create Marketplace
    • Create a new Launchpad
    • Retrieve Launch PSBT
    • Confirm Launch
    • Check Allocation
    • Check for Padding Outputs
    • Setup Padding Outputs
    • Create buy offer
    • Confirm buy offer
    • Get Launch Info
  • Sat Scanner API
    • Find Special Ranges
    • Find Special Ranges UTXO
    • Supported Satributes
  • Sat Extractor
    • Extract
  • BRC20 / BRC2.0PROG
    • OPI API
    • Bitcoin Remix
  • SNS API
    • SNS API
  • Mempool API
    • Mempool API
  • TAP PROTOCOL
    • Tap Reader API
  • UTXO
    • Split
  • User Guide
    • Inscribe your first Ordinal
    • Receiving Payments
  • Knowledge Base
    • Ordinals
      • What is an Ordinal?
      • Satoshi Rarity
      • What are BRC-20 Tokens?
      • Image Optimisation
      • Pixel Art
    • Bitcoin
      • Unspent Transaction Output (UTXO)
  • Official Links
    • Twitter
    • Discord
Powered by GitBook
On this page
  • POST Save listing data for ordinal
  • Save listing details
  1. MarketPlace API

Save listing

Save listing is part of the create listing process. create-listing end point returns a psbt which is signed by the client wallet, once signed the signed psbt needs to be saved in the listing database by calling /save-listing end point.

Here's an example of how you can sign a listing transaction with the Xverse wallet and then save it by calling /save-listing:

      
      // XVerse Wallet example of creating a signing request 
      // when listing an Ordinal for sale
      const sellerInput = {
        address: ordinalsAddress, // Seller's ordinal wallet address
        signingIndexes: [0], // always [0] when listing
        // Specify sigHash type as SIGHASH_SINGLE | SIGHASH_ANYONECANPAY
        sigHash: bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY,
      };

      // Create the listing PSBT by calling /marketplace/create-listing API
      // This returns a base64 PSBT in string format which needs to be signed
      const { data } = await axios({
        method: 'post'
        url: 'https://api.ordinalsbot.com/marketplace/create-listing',
        data: {
          sellerOrdinals
          sellerPaymentAddress,
          sellerOrdinalPublicKey
        },
        headers: {
        'x-api-key': API_KEY,
      });

      // When using XVerse Wallet
      // Create the payload for signing the seller transaction
      const payload = {
        network: { type: "Mainnet" },
        message: "Sign Seller Transaction",
        psbtBase64: data.psbt, // PSBT returned by the clear-listing API
        broadcast: false,
        inputsToSign: [sellerInput],
      };

      // Make signing request
      await signTransaction({
        payload,
        onFinish: async (response) => {
          try {
            // signed succesffully

            // Save the listing with the signed PSBT
            const updateListingData = {
              signedListingPSBT: response.psbtBase64,
            };

            // Save the listing PSBT by calling /marketplace/save-listing API
            // This returns a base64 PSBT in string format which needs to be signed
            const saveResponse= await axios({
              method: 'patch'
              url: 'https://api.ordinalsbot.com/marketplace/save-listing' + sellerOrdinals[0].id,
              data: {
                sellerOrdinals: [sellerOrdinals[0].id],
                updateListingData
              },
              headers: {
              'x-api-key': API_KEY,
              }
            });
      
          } catch (Error) {
            // error handling
          }
        },
        onCancel: () => { // User cancelled signing request }
      });

POST Save listing data for ordinal

Save listing details

POST https://api.ordinalsbot.com/marketplace/save-listing/

API Key is required in the header:

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

Request Body

Name
Type
Description

updateListingData*

Object

json object with a string signedListingPSBT. Ex:

{ sellerOrdinals: ["0c9...ai0"],

updateListingData: {

signedListingPSBT:

"cHNidP8...AAA"

}

}

sellerOrdinals*

Array

Array of ordinal Ids. The ids should be the same as ordinals ids used with /create-listing endpoint


{
    "_id": "7354826c46a5856b972795d7",
    "ordinalId": "8dc4e.....6ce70260i0",
    "price": 12345,
    "sellerPaymentAddress": "3Ny......yc4q",
    "sellerOrdinalPublicKey": "4fa4.....118fad4e476541",
    "status": "Active",
    "sellerOutputValue": 21111,
    "ordinalUtxoTxId": "3362....61449ef",
    "ordinalUtxoVout": 0,
    "marketPlaceMakerFee": 0,
    "marketPlaceTakerFee": 0,
    "platformMakerFee": 1000,
    "platformTakerFee": 1000,
    "signedListingPSBT": "cHNid......1rARj61OR2VBAAA="
}
{
    status: 'error',
    error: 'error reason'
}

Last updated 1 month ago