> For the complete documentation index, see [llms.txt](https://docs.atomicalmarket.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atomicalmarket.com/api/guides/assets-listing.md).

# Assets Listing

Workflow for listing creation, fetching and deletion.

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

{% openapi src="/files/EhlQrEhRJOmoaUrfFxb2" path="/market/v1/bid/bulk-new" method="post" %}
[json 1503.json](https://46173898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcsPhR6KWjYNyFUZFICd3%2Fuploads%2FrqrormeBCVFGy4pYGT5A%2Fjson%201503.json?alt=media\&token=7a15ade9-9f83-44b3-8706-a5b0232c8309)
{% endopenapi %}

2. Client sign `psbt` from last step's response

```javascript
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,
});
```

3. Confirm listing\
   `psbt` in the post body is last step's `signedSellerPsbt`

{% openapi src="/files/EhlQrEhRJOmoaUrfFxb2" path="/market/v1/bid/bulk-confirm" method="post" %}
[json 1503.json](https://46173898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcsPhR6KWjYNyFUZFICd3%2Fuploads%2FrqrormeBCVFGy4pYGT5A%2Fjson%201503.json?alt=media\&token=7a15ade9-9f83-44b3-8706-a5b0232c8309)
{% endopenapi %}

4. Get listings by address

{% openapi src="/files/EhlQrEhRJOmoaUrfFxb2" path="/market/v1/{market}/listHistory" method="get" %}
[json 1503.json](https://46173898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcsPhR6KWjYNyFUZFICd3%2Fuploads%2FrqrormeBCVFGy4pYGT5A%2Fjson%201503.json?alt=media\&token=7a15ade9-9f83-44b3-8706-a5b0232c8309)
{% endopenapi %}

5. 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. Get `sig` by signing the message (eg using <https://docs.unisat.io/dev/unisat-developer-service/unisat-wallet#signmessage>)
   3. Post by /market/v1/token\_atom/unlist

{% openapi src="/files/EhlQrEhRJOmoaUrfFxb2" path="/market/v1/{market}/unlist" method="post" %}
[json 1503.json](https://46173898-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcsPhR6KWjYNyFUZFICd3%2Fuploads%2FrqrormeBCVFGy4pYGT5A%2Fjson%201503.json?alt=media\&token=7a15ade9-9f83-44b3-8706-a5b0232c8309)
{% endopenapi %}
