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
/market/v1/bid/bulk-new
200Success
  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
/market/v1/bid/bulk-confirm
200Success
  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
/market/v1/{market}/listHistory
200Success
  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
/market/v1/{market}/unlist
200Success

Last updated