Assets Listing

Workflow for listing creation, fetching and deletion.

  1. Prepare listing (to generate unsigned psbt for client to sign)

post

Prepare listing

Body
receiverstringRequired
sellerAddressstringRequired
marketTypestringRequired

Only support "token" for now.

tickerstringRequired
isAfterSplitbooleanOptional
Responses
200Success
post
POST /market/v1/bid/bulk-new HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 176

{
  "receiver": "text",
  "sellerAddress": "text",
  "marketType": "text",
  "ticker": "text",
  "items": [
    {
      "price": 1,
      "txid": "text",
      "index": 1,
      "atomical_id": "text",
      "amount": 1
    }
  ],
  "isAfterSplit": true
}
200Success
{
  "psbt": "text",
  "bidIds": [
    "text"
  ]
}
  1. Client sign psbt from last step's response

import { Psbt, Transaction } from "bitcoinjs-lib";
const sellerPsbt = Psbt.fromHex(psbt);
const toSignInputs = sellerPsbt.data.inputs.map((_, index) => ({
  address, // seller address
  index,
  sighashTypes: [
    Transaction.SIGHASH_SINGLE | Transaction.SIGHASH_ANYONECANPAY,
  ],
}));
// injectProvider could be unisat (https://docs.unisat.io/dev/unisat-wallet-api)
const signedSellerPsbt = await injectProvider.signPsbt(psbt, {
  autoFinalized: false,
  toSignInputs: toSignInputs,
});
  1. Confirm listing psbt in the post body is last step's signedSellerPsbt

post

Confirm listing

Body
psbtstringRequired

Signed psbt

bidIdsstring[]Required
Responses
200Success
post
POST /market/v1/bid/bulk-confirm HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 33

{
  "psbt": "text",
  "bidIds": [
    "text"
  ]
}
200Success
{
  "success": true
}
  1. Get listings by address

Deprecated
get

Get listing history by wallet and ticker. Deprecated, use /:market/:wallet/listing instead.

Path parameters
marketanyRequired

"token"|"collection|"realm"

Query parameters
offsetanyOptional
limitanyOptional
tickerstringOptional
walletstringRequired
Responses
200Success
get
GET /market/v1/{market}/listHistory?wallet=text HTTP/1.1
Host: 
Accept: */*
200Success
{
  "result": [
    {
      "bid_id": "text",
      "price_sats": 1,
      "atomical_Id": "text",
      "seller_address": "text",
      "date": 1,
      "atomical_content": {
        "Ticker": "text",
        "Amount": 1
      },
      "atomical_number": 1
    }
  ],
  "total": 1
}
  1. Delist listing

    1. Generate the message to be signed by the client: const generateSigningMessage = (bidId) => You are signing this message to unlist your asset (Listing ID: ${bidId}) from AM.

    2. Post by /market/v1/token_atom/unlist

post
Path parameters
marketanyRequired

"token"|"collection|"realm"

Body
bidstringRequired
pubkeystringRequired
sigstringRequired

From signing the message: "You are signing this message to unlist your asset (Listing ID: [:bidId]) from AM.

Responses
200Success
post
POST /market/v1/{market}/unlist HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 43

{
  "bid": "text",
  "pubkey": "text",
  "sig": "text"
}
200Success
{
  "success": true
}

Last updated