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-offerconst { data } =awaitaxios({ 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 requestawaitsignTransaction({ 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 } });