Assets Listing
Workflow for listing creation, fetching and deletion.
Prepare listing (to generate unsigned psbt for client to sign)
Prepare listing
Only support "token" for now.
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
}
{
"psbt": "text",
"bidIds": [
"text"
]
}
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,
});
Confirm listing
psbt
in the post body is last step'ssignedSellerPsbt
Confirm listing
Signed psbt
POST /market/v1/bid/bulk-confirm HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 33
{
"psbt": "text",
"bidIds": [
"text"
]
}
{
"success": true
}
Get listings by address
Get listing history by wallet and ticker. Deprecated, use /:market/:wallet/listing instead.
"token"|"collection|"realm"
GET /market/v1/{market}/listHistory?wallet=text HTTP/1.1
Host:
Accept: */*
{
"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
}
Delist listing
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.
Get
sig
by signing the message (eg using https://docs.unisat.io/dev/unisat-developer-service/unisat-wallet#signmessage)Post by /market/v1/token_atom/unlist
"token"|"collection|"realm"
From signing the message: "You are signing this message to unlist your asset (Listing ID: [:bidId]) from AM.
POST /market/v1/{market}/unlist HTTP/1.1
Host:
Content-Type: application/json
Accept: */*
Content-Length: 43
{
"bid": "text",
"pubkey": "text",
"sig": "text"
}
{
"success": true
}
Last updated