Common Types

Common types and objects that the API uses

For data fetching API calls the params will consists of a condition, order by, and pagination info params. Every response returned by the client is a promise.

Condition

The condition param is specific to the corresponding API.

String Input Arg

For some of our api calls that require searching, we now support fuzzy matching or exact match.

StringInputArg {
    operation: "FUZZY" | "EXACT"
    value: string
}

Order Config

Sorting is handled by the orderBy param which is a OrderConfig type. Each API that accepts this config will have fields that are sortable (e.g. floor_price etc).

type OrderConfig {
  field_name: string;
  sort_order: SortOrderEnum
}

 enum SortOrderEnum {
  Asc = 'ASC',
  Desc = 'DESC'
}

Pagination Info

For APIs with many responses we support pagination input. Our docs will specify which API has paginated results. Keep in the mind the limits of how much you can request.

For performance, we now have a progressive_load flag. This flag enables faster response time by skipping the count querying (will not return a valid total_page_number value) and returns true for has_next_page until there are no results.

 type PaginationConfig = {
  page_number: number;
  page_size: number;
  progressive_load: boolean;
};

 type PaginationInfoResponseType = {
  current_page_number: number;
  current_page_size: number
  has_next_page: boolean;
  total_page_number: number;
};

Marketplace Action Response

Any action that interacts with the marketplace will return MarketPlaceTxOutput object. This consists of a data buffer that needs to be signed by the user and then sent to the chain via RPC. In addition there is an optional error object that returns.

MarketPlaceTxOutput {
    data: Buffer array of ints
    error: {
        error_type: MarketPlaceTxErrorEnum
        message: string
    }
}

enum MarketPlaceTxErrorEnum {
  AlreadyOwnedNft = 'ALREADY_OWNED_NFT',
  BasisPointsMismatch = 'BASIS_POINTS_MISMATCH',
  BidNotFound = 'BID_NOT_FOUND',
  BidStateAlreadyExists = 'BID_STATE_ALREADY_EXISTS',
  BrokerMismatch = 'BROKER_MISMATCH',
  BuyerHasInsufficientFunds = 'BUYER_HAS_INSUFFICIENT_FUNDS',
  EscrowWithdrawAmountError = 'ESCROW_WITHDRAW_AMOUNT_ERROR',
  InternalServerError = 'INTERNAL_SERVER_ERROR',
  InvalidInputError = 'INVALID_INPUT_ERROR',
  InvalidTokenAddress = 'INVALID_TOKEN_ADDRESS',
  InvalidUserBalance = 'INVALID_USER_BALANCE',
  ItemListingNotFound = 'ITEM_LISTING_NOT_FOUND',
  ItemNoLongerAvailable = 'ITEM_NO_LONGER_AVAILABLE',
  MarketplaceBuyingIsDisabled = 'MARKETPLACE_BUYING_IS_DISABLED',
  MarketplaceOperationIsDisabled = 'MARKETPLACE_OPERATION_IS_DISABLED',
  PriceHasUpdatedToBeHigher = 'PRICE_HAS_UPDATED_TO_BE_HIGHER',
  PriceHasUpdatedToBeLower = 'PRICE_HAS_UPDATED_TO_BE_LOWER',
  PriceMismatch = 'PRICE_MISMATCH',
  RpcError = 'RPC_ERROR',
  SellerOwnerMismatch = 'SELLER_OWNER_MISMATCH'
}

Last updated