Links

Marketplace API Package

Introduction to the Marketplace API schema.
The following page explains how to set-up and the usage of the Marketplace API package.
The Marketplace endpoint can be found at - http://localhost:8000/graphiql/marketplace

Marketplace API Queries

GetBid

Get the market listing bid.
Query
Response
query GetBid {
GetBid(id: 1) {
id
price
height
bidder {
account {
publicKey
address
}
}
listing {
listingId
}
}
}
{
"data": {
"GetBid": {
"id": 1,
"price": "1000000000000000000",
"height": 239058,
"bidder": {
"account": {
"publicKey": "0xb4664455021025f4944c1bc4af8a2830317f0765dc624778345dea09e89a526a",
"address": "cxNW84hdDPEr8rU8oUbqNDaCmVX6SxH86mFufTf6HiNbZhi2F"
}
},
"listing": {
"listingId": "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"
}
}
}
}

GetBids

Get the market listing bids.
Query
Response
query GetBids {
GetBids(listingIds: ["0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"]) {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
node {
id
price
height
bidder {
account {
publicKey
address
}
}
listing {
listingId
}
}
}
}
}
{
"data": {
"GetBids": {
"totalCount": 1,
"pageInfo": {
"startCursor": "",
"endCursor": "",
"hasPreviousPage": false,
"hasNextPage": false
},
"edges": [
{
"node": {
"id": 1,
"price": "1000000000000000000",
"height": 239058,
"bidder": {
"account": {
"publicKey": "0xb4664455021025f4944c1bc4af8a2830317f0765dc624778345dea09e89a526a",
"address": "cxNW84hdDPEr8rU8oUbqNDaCmVX6SxH86mFufTf6HiNbZhi2F"
}
},
"listing": {
"listingId": "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"
}
}
}
]
}
}
}

GetListing

Get a single market listing.
Query
Response
query GetListing {
GetListing(listingId: "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20") {
listingId
makeAssetId {
collectionId
tokenId
}
takeAssetId {
collectionId
tokenId
}
amount
price
minTakeValue
feeSide
creationBlock
deposit
salt
state {
... on FixedPriceState {
amountFilled
type
}
... on AuctionState {
type
}
}
data {
... on FixedPriceData {
type
}
... on AuctionData {
type
startBlock
endBlock
}
}
seller {
account {
publicKey
address
}
}
sales {
edges {
node {
amount
price
bidder {
account {
publicKey
address
}
}
}
}
}
bids {
edges {
node {
price
bidder {
account {
publicKey
address
}
}
height
}
}
}
states {
state
height
}
}
}
{
"data": {
"GetListing": {
"listingId": "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20",
"makeAssetId": {
"collectionId": "4919",
"tokenId": "0"
},
"takeAssetId": {
"collectionId": "0",
"tokenId": "0"
},
"amount": "1",
"price": "1000000000000000000",
"minTakeValue": "975000000000000000",
"feeSide": "TAKE_FEE",
"creationBlock": 239058,
"deposit": "2025700000000000000",
"salt": "73616c74313233",
"state": {
"amountFilled": null,
"type": "FIXED_PRICE"
},
"data": {
"type": "FIXED_PRICE"
},
"seller": {
"account": {
"publicKey": "0x087c3fdc6566230578362759d99e42ed300f5560c305262843b2c61aa2f1d11e",
"address": "cxJciMkfdBqR8C9ftA8qmgzP9bAQNzMzXZmwUDZ2qW5mFVgvm"
}
},
"sales": {
"edges": []
},
"bids": {
"edges": [
{
"node": {
"price": "1000000000000000000",
"bidder": {
"account": {
"publicKey": "0xb4664455021025f4944c1bc4af8a2830317f0765dc624778345dea09e89a526a",
"address": "cxNW84hdDPEr8rU8oUbqNDaCmVX6SxH86mFufTf6HiNbZhi2F"
}
},
"height": 239058
}
}
]
},
"states": [
{
"state": "ACTIVE",
"height": 239058
}
]
}
}
}

GetListings

Get multiple market listings.
Query
Response
query GetListings {
GetListings(
listingIds: ["0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"]
) {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
node {
listingId
makeAssetId {
collectionId
tokenId
}
takeAssetId {
collectionId
tokenId
}
amount
price
minTakeValue
feeSide
creationBlock
deposit
salt
state {
... on FixedPriceState {
amountFilled
type
}
... on AuctionState {
type
}
}
data {
... on FixedPriceData {
type
}
... on AuctionData {
type
startBlock
endBlock
}
}
seller {
account {
publicKey
address
}
}
sales {
edges {
node {
amount
price
bidder {
account {
publicKey
address
}
}
}
}
}
bids {
edges {
node {
price
bidder {
account {
publicKey
address
}
}
height
}
}
}
states {
state
height
}
}
}
}
}
{
"data": {
"GetListings": {
"totalCount": 1,
"pageInfo": {
"startCursor": "",
"endCursor": "",
"hasPreviousPage": false,
"hasNextPage": false
},
"edges": [
{
"node": {
"listingId": "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20",
"makeAssetId": {
"collectionId": "4919",
"tokenId": "0"
},
"takeAssetId": {
"collectionId": "0",
"tokenId": "0"
},
"amount": "1",
"price": "1000000000000000000",
"minTakeValue": "975000000000000000",
"feeSide": "TAKE_FEE",
"creationBlock": 239058,
"deposit": "2025700000000000000",
"salt": "73616c74313233",
"state": {
"amountFilled": null,
"type": "FIXED_PRICE"
},
"data": {
"type": "FIXED_PRICE"
},
"seller": {
"account": {
"publicKey": "0x087c3fdc6566230578362759d99e42ed300f5560c305262843b2c61aa2f1d11e",
"address": "cxJciMkfdBqR8C9ftA8qmgzP9bAQNzMzXZmwUDZ2qW5mFVgvm"
}
},
"sales": {
"edges": []
},
"bids": {
"edges": [
{
"node": {
"price": "1000000000000000000",
"bidder": {
"account": {
"publicKey": "0xb4664455021025f4944c1bc4af8a2830317f0765dc624778345dea09e89a526a",
"address": "cxNW84hdDPEr8rU8oUbqNDaCmVX6SxH86mFufTf6HiNbZhi2F"
}
},
"height": 239058
}
}
]
},
"states": [
{
"state": "ACTIVE",
"height": 239058
}
]
}
}
]
}
}
}

GetSale

Get the market listing sale.
Query
Response
query GetSale {
GetSale(id: 1) {
id
price
amount
bidder {
account {
publicKey
address
}
}
listing {
listingId
}
}
}
{
"data": {
"GetSale": {
"id": 1,
"price": "1000000",
"amount": "1",
"bidder": {
"account": {
"publicKey": "0x6a03b1a3d40d7e344dfb27157931b14b59fe2ff11d7352353321fe400e956802",
"address": "cxLpbEojWougf2cE6onB6PuK9SsfmKqNJKNo9tTsqirxFbuN5"
}
},
"listing": {
"listingId": "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"
}
}
}
}

GetSales

Get the market listing sales.
Query
Response
query GetSales {
GetSales(listingIds: ["0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"]) {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
node {
id
price
amount
bidder {
account {
publicKey
address
}
}
listing {
listingId
}
}
}
}
}
{
"data": {
"GetSales": {
"totalCount": 1,
"pageInfo": {
"startCursor": "",
"endCursor": "",
"hasPreviousPage": false,
"hasNextPage": false
},
"edges": [
{
"node": {
"id": 1,
"price": "1000000",
"amount": "1",
"bidder": {
"account": {
"publicKey": "0x6a03b1a3d40d7e344dfb27157931b14b59fe2ff11d7352353321fe400e956802",
"address": "cxLpbEojWougf2cE6onB6PuK9SsfmKqNJKNo9tTsqirxFbuN5"
}
},
"listing": {
"listingId": "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20"
}
}
}
]
}
}
}

Marketplace API Mutations

CancelListing

Cancels an active listing.
Mutation
Response
mutation CancelListing {
CancelListing(listingId: "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20") {
id
transactionId
transactionHash
state
encodedData
method
wallet {
account {
publicKey
address
}
}
idempotencyKey
}
}
{
"data": {
"CancelListing": {
"id": 11295,
"transactionId": null,
"transactionHash": null,
"state": "PENDING",
"encodedData": "0x3201101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20",
"method": "CancelListing",
"wallet": {
"account": {
"publicKey": "0x68b427dda4f3894613e113b570d5878f3eee981196133e308c0a82584cf2e160",
"address": "cxLnsZcpE1xETr7TQrMCCsRYpSfpHPUpJUFAfiZdZvU6Ccy4B"
}
},
"idempotencyKey": "bfdb8fe9-3d93-4322-bf16-077c9566050d"
}
}
}

CreateListing

Places a sell order.
Mutation
Response
mutation CreateListing {
CreateListing(
account: "0x087c3fdc6566230578362759d99e42ed300f5560c305262843b2c61aa2f1d11e"
makeAssetId: {
collectionId:7153
tokenId: {integer:68}
}
takeAssetId: {
collectionId:7153
tokenId: {integer:70468841277235617716769448539773927607}
}
amount: 1
price: 10000
salt: "random string"
auctionData: {
startBlock:403000
endBlock:404000
}
) {
id
transactionId
transactionHash
state
encodedData
method
wallet {
account {
publicKey
address
}
}
idempotencyKey
}
}
{
"data": {
"CreateListing": {
"id": 11296,
"transactionId": null,
"transactionHash": null,
"state": "PENDING",
"encodedData": "0x3200c56f1101c56f33b7007b94fad4fa2fe1d6a5b71ece033504419c3472616e646f6d20737472696e6701e298180082a81800",
"method": "CreateListing",
"wallet": {
"account": {
"publicKey": "0x68b427dda4f3894613e113b570d5878f3eee981196133e308c0a82584cf2e160",
"address": "cxLnsZcpE1xETr7TQrMCCsRYpSfpHPUpJUFAfiZdZvU6Ccy4B"
}
},
"idempotencyKey": "4863964a-0768-473f-8c02-18be8fff92c1"
}
}
}

FillListing

Fills a fixed price listing.
Mutation
Response
mutation FillListing {
FillListing(listingId: "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20", amount: 1) {
id
transactionId
transactionHash
state
encodedData
method
wallet {
account {
publicKey
address
}
}
idempotencyKey
}
}
{
"data": {
"FillListing": {
"id": 11297,
"transactionId": null,
"transactionHash": null,
"state": "PENDING",
"encodedData": "0x3202101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f2004",
"method": "FillListing",
"wallet": {
"account": {
"publicKey": "0x68b427dda4f3894613e113b570d5878f3eee981196133e308c0a82584cf2e160",
"address": "cxLnsZcpE1xETr7TQrMCCsRYpSfpHPUpJUFAfiZdZvU6Ccy4B"
}
},
"idempotencyKey": "0f4eb316-cf7f-4561-a2d6-112abf08d323"
}
}
}

FinalizeAuction

Update the details of a Beam that has already been created
Mutation
Response
mutation FinalizeAuction {
FinalizeAuction(listingId: "0x101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20") {
id
transactionId
transactionHash
state
encodedData
method
wallet {
account {
publicKey
address
}
}
idempotencyKey
}
}
{
"data": {
"FinalizeAuction": {
"id": 11298,
"transactionId": null,
"transactionHash": null,
"state": "PENDING",
"encodedData": "0x3204101d16dc0fa25d77a92bcb6cde34e8ad1e85d96cd6a4a78eb68acc4f82d37f20",
"method": "FinalizeAuction",
"wallet": {
"account": {
"publicKey": "0x68b427dda4f3894613e113b570d5878f3eee981196133e308c0a82584cf2e160",
"address": "cxLnsZcpE1xETr7TQrMCCsRYpSfpHPUpJUFAfiZdZvU6Ccy4B"
}
},
"idempotencyKey": "0deaaad8-f6a0-4ef5-b8f1-fadd1ecb8ac5"
}
}
}
© 2023 Enjin Pte. Ltd.