Atomicals Market
  • API
    • Overview
    • Guides
      • Assets Listing
      • Assets Buying
      • Error Codes
      • Token split upgrade
Powered by GitBook
On this page
  1. API
  2. Guides

Assets Listing

Workflow for listing creation, fetching and deletion.

PreviousGuidesNextAssets Buying

Last updated 1 year ago

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

  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

  1. Get listings by address

  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

Get sig by signing the message (eg using )

https://docs.unisat.io/dev/unisat-developer-service/unisat-wallet#signmessage
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
}
  • POST/market/v1/bid/bulk-new
  • POST/market/v1/bid/bulk-confirm
  • GET/market/v1/{market}/listHistory
  • POST/market/v1/{market}/unlist
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"
  ]
}
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
}
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
}