Marketplace

Buy and sell dragons and gateway keys on the marketplace

Marketplace API

List, buy, and sell dragons and other assets on the Drakaria marketplace. All prices are in USD cents (100 = $1.00).


Browse Listings {#list-listings}

Retrieve paginated marketplace listings with filtering.

Endpoint

GET /api/v1/marketplace/list

Authentication

Not required (public endpoint)

Query Parameters

ParameterTypeDescription
assetIdstringFilter by specific asset ID
listingTypestringLISTING_FIXED, LISTING_AUCTION, LISTING_OFFER, LISTING_TRADE
listingStatestring[]STATE_ACTIVE, STATE_PENDING, STATE_COMPLETED, STATE_CANCELLED, etc.
accIdstringFilter by asset owner account ID
acceptedCurrenciesstring[]USD, USDT, USDC, ETH, DRGN, DRAKMA
limitintegerItems per page
pageintegerPage number
orderBystringSort field (price, created, etc.)
orderDirstringasc or desc

Plus all asset filtering parameters (house, magic, golden, etc.)

Response

{
  "assets": [
    {
      "id": 12345,
      "assetId": 67890,
      "created": 1700000000,
      "modified": 1700000100,
      "listingType": "LISTING_FIXED",
      "listingState": "STATE_ACTIVE",
      "listingInfo": {
        "priceCent": "100000",
        "feeCent": "5000",
        "acceptedCurrencies": ["USD", "USDT", "ETH"]
      },
      "asset": { /* full asset details */ }
    }
  ],
  "total": 150
}

Notes

  • Prices and fees are in cents (100000 = $1,000.00)
  • Automatically calculates marketplace fees

Create Fixed Price Listing {#create-listing}

List an asset for sale at a fixed price.

Endpoint

POST /api/v1/marketplace/list/fixed

Authentication

Required - Must own the asset

Request Body

{
  "assetId": 67890,
  "price": 100000,
  "acceptedCurrencies": [
    "USD",
    "USDT",
    "ETH"
  ]
}

Request Fields

FieldTypeRequiredDescription
assetIdintegerYesAsset ID to list
priceintegerYesPrice in USD cents (100000 = $1,000.00)
acceptedCurrenciesstring[]YesAccepted payment currencies

Valid Currencies

  • USD - US Dollar
  • USDT - Tether
  • USDC - USD Coin
  • ETH - Ethereum
  • DRGN - Dragonchain Token
  • DRAKMA - Game Currency

Response

{
  "listingId": 12345,
  "assetId": 67890,
  "listingState": "STATE_ACTIVE",
  "price": "100000",
  "acceptedCurrencies": [
    "USD",
    "USDT",
    "ETH"
  ],
  "transactionId": "abc123def456",
  "status": "success"
}

Error Responses

StatusMessageReason
400Asset is already listedAsset has active listing
400You do not own this assetNot the asset owner
400Invalid currency: XInvalid currency specified

Cancel Listing {#cancel-listing}

Cancel an active marketplace listing.

Endpoint

POST /api/v1/marketplace/delist/{listingId}

Authentication

Required - Must own the asset

Path Parameters

ParameterTypeDescription
listingIdintegerListing ID to cancel

Response

{
  "status": "success"
}

Notes

  • Only the asset owner can delist
  • Listing state changes to STATE_CANCELLED
  • Posts transaction to Dragonchain

Lock Listing for Purchase {#lock-listing}

Create a time-limited purchase request to lock a listing.

Endpoint

POST /api/v1/marketplace/lock

Authentication

Required

Request Body

{
  "listingId": 12345,
  "cryptoSource": "USDT"
}

Request Fields

FieldTypeRequiredDescription
listingIdintegerYesListing ID to lock
cryptoSourcestringNoCrypto payment source (USDT, USDC, ETH, DRGN, DRAKMA)

Response

{
  "id": 789,
  "accId": "user123",
  "timestamp": "2024-11-21T10:00:00Z",
  "expires": "2024-11-21T10:15:00Z",
  "totalFee": "100000",
  "web3TotalFee": "102.50",
  "items": {
    "listingId": 12345,
    "cryptoSource": "USDT"
  },
  "purchaseInfo": {
    "source": "USDT"
  }
}

Notes

  • Only one user can lock a listing at a time
  • Purchase request expires after configured duration
  • If crypto source specified, calculates web3TotalFee

Purchase with Wallet {#purchase-listing}

Complete purchase using wallet balance.

Endpoint

POST /api/v1/marketplace/purchase

Authentication

Required - Must have sufficient wallet balance

Request Body

{
  "listingId": 12345,
  "currency": "USDT",
  "purchaseId": 789
}

Request Fields

FieldTypeRequiredDescription
listingIdintegerYesListing ID to purchase
currencystringYesPayment currency (USD, USDT, USDC, ETH, DRGN, DRAKMA)
purchaseIdintegerYesPurchase request ID from lock endpoint

Response

{
  "status": "success"
}

Error Responses

StatusMessageReason
400Invalid currency: XInvalid currency
403Listing not activeListing not STATE_ACTIVE
403insufficient fundsWallet balance too low
404Listing not foundInvalid listing ID

Transaction Flow

  1. Validates currency and wallet balance
  2. Changes listing state to PENDING
  3. Posts MARKETPLACE_PURCHASE transaction to Dragonchain
  4. Creates wallet transaction (deducts buyer, credits seller)
  5. Transfers asset ownership to buyer
  6. Changes listing state to COMPLETED
  7. Creates asset history entry

Notes

  • Wallet purchases only (not for crypto/web3 purchases)
  • Database transaction ensures atomicity
  • Rolls back on any error