Skip to main content

Marketplace

GraphQL Endpoint

https://platform.beta.enjin.io/graphql

All marketplace actions are submitted through CreateTransaction, with the action selected by the field set on the transaction input. The response shape is always a Transaction — the examples below all return the standard { uuid, action, state } selection.

To read listings, see Marketplace Queries.

createListing

Creates a new listing on the marketplace. Three listing types are supported via listingData.type:

  • FIXED_PRICE — sell amount of makeAssetId for price of takeAssetId.
  • AUCTION — same shape, but buyers place bids via placeBid; the auction ends at endBlock.
  • OFFER — a buy offer: the seller of takeAssetId decides whether to fill.

Set takeAssetId to ENJ by passing { collectionId: 0, tokenId: 0 }. Set usesWhitelist: true to restrict who can fill / bid; manage the whitelist with addWhitelistedAccounts / removeWhitelistedAccounts.

mutation CreateFixedListing {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
createListing: {
makeAssetId: { collectionId: 91829, tokenId: 1 }
takeAssetId: { collectionId: 0, tokenId: 0 } # ENJ
amount: 1
price: 10000000000000000000 # 10 ENJ
usesWhitelist: false
listingData: { type: FIXED_PRICE }
}
}
) {
uuid
action
state
}
}

Once the transaction finalizes, a Marketplace.ListingCreated event is emitted containing the new listing's id (a hex string assigned by the chain). See Working with Events for how to read it, or look the listing up after the fact via GetListings.

fillListing

Buys (or sells, for an offer listing) amount of a FIXED_PRICE / OFFER listing.

mutation FillListing {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
fillListing: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
amount: 1
}
}
) {
uuid
action
state
}
}

placeBid

Place a bid on an AUCTION listing. The bid must be at least the current highestPrice + minimum increment (or the reserve price for the first bid).

mutation PlaceBid {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
placeBid: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
price: 12000000000000000000 # 12 ENJ
}
}
) {
uuid
action
state
}
}

finalizeAuction

Closes an auction past its endBlock, transferring the asset to the highest bidder and the bid to the seller. Anyone can call this.

mutation FinalizeAuction {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
finalizeAuction: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
}
}
) {
uuid
action
state
}
}

cancelListing

Cancels an active listing. The signer must be the listing's seller.

mutation CancelListing {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
cancelListing: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
}
}
) {
uuid
action
state
}
}

placeCounterOffer

On an OFFER listing, place a counter-offer with a different price. The original listing creator can then accept, reject, or counter again.

mutation PlaceCounterOffer {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
placeCounterOffer: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
price: 6000000000000000000
}
}
) {
uuid
action
state
}
}

answerCounterOffer

Respond to a counter-offer placed via placeCounterOffer. response is one of:

  • ACCEPT — fill the listing at the counter-offered price.
  • REJECT — decline the counter-offer.
  • COUNTER — make a new counter-offer at counterPrice.
mutation AnswerCounterOffer {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
answerCounterOffer: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
creator: "efCounterOfferer"
response: COUNTER
counterPrice: 5500000000000000000
}
}
) {
uuid
action
state
}
}

addWhitelistedAccounts

Add accounts (with optional per-account allowance) to a whitelist-restricted listing.

mutation AddWhitelistedAccounts {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
addWhitelistedAccounts: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
accounts: [
{ address: "efAllowedBuyer1", allowance: 5 }
{ address: "efAllowedBuyer2" }
]
}
}
) {
uuid
action
state
}
}

removeWhitelistedAccounts

Remove accounts from a whitelist-restricted listing.

mutation RemoveWhitelistedAccounts {
CreateTransaction(
network: ENJIN
chain: MATRIX
transaction: {
removeWhitelistedAccounts: {
id: "8bd40957579f61b8a04ddaf7c86fbd51329e88f5ec735e910a320169377db161"
addresses: [
"efRevokedBuyer1"
"efRevokedBuyer2"
]
}
}
) {
uuid
action
state
}
}