Validate Swap / Offer
Endpoint to validate a newly created swap / offer
Validate swap / offer
POST
https://api.withmystic.xyz/marketplace-api/validate-swap
This endpoint will receive an offer and its signature to check if the respective approvals have been completed and their signature is valid. If so, the swap will be updated to "validated", making it now able to be accepted by another user.
Headers
Bearer*
String
Your API key
Request Body
signature*
String
Provided by user's wallet
swapId*
String
Received in the create-swap endpoint response
{
"_id":"64e7aa3a04d9a703ce46cc13",
"orderComponents":{
"offerer":"0xA79d4cCC70Cc3DD01f7D3a70ED5C7ca73de812C4",
"zone":"0xF712B2B35a06016851ADd2f9c43785Ec29e243dE",
"zoneHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"startTime":"1692903991",
"endTime":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"orderType":2,
"offer":[
{
"itemType":2,
"token":"0x037aca480459ae361a87b023f189532d80cb6769",
"identifierOrCriteria":"46",
"startAmount":"1",
"endAmount":"1"
},
{
"itemType":2,
"token":"0x229dd7144fec1008dddf5fcf779ec63c3d576aa7",
"identifierOrCriteria":"36",
"startAmount":"1",
"endAmount":"1"
}
],
"consideration":[
{
"itemType":0,
"token":"0x0000000000000000000000000000000000000000",
"identifierOrCriteria":"0",
"startAmount":"2970000000000000",
"endAmount":"2970000000000000",
"recipient":"0xA79d4cCC70Cc3DD01f7D3a70ED5C7ca73de812C4"
},
{
"itemType":0,
"token":"0x0000000000000000000000000000000000000000",
"identifierOrCriteria":"0",
"startAmount":"30000000000000",
"endAmount":"30000000000000",
"recipient":"0xF712B2B35a06016851ADd2f9c43785Ec29e243dE"
}
],
"totalOriginalConsiderationItems":2,
"salt":"0x00000000000000000000000000000000000000000000000000000023245112a0",
"conduitKey":"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",
"counter":"0"
},
"chainId":5,
"signature":"",
"clientId":"64de82afc0885d14bbc3ab4e",
"status":"created",
"transactionHash":"",
"takerAddress":"",
"metadata":{
"tokensMetadata":[
],
"nftsMetadata":[
{
"contract":{
"address":"0x037aca480459ae361a87b023f189532d80cb6769",
"name":"Red Apples",
"symbol":"REDAPPLE",
"totalSupply":"63",
"tokenType":"ERC721",
"openSea":{
"lastIngestedAt":"2023-08-22T07:47:00.000Z"
},
"contractDeployer":"0xdd305dcf8c019b2e89ccecfedd80093726f611ef",
"deployedBlockNumber":8223329
},
"tokenId":"46",
"tokenType":"ERC721",
"title":"Apples Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"timeLastUpdated":"2023-08-11T16:19:41.014Z",
"rawMetadata":{
"date":1672329470274,
"image":"https://ipfs.io/ipfs/bafkreidhpw7njnpejg3ba3ygarti4nvk4paix2u6p4j3foccp3plhd2rny",
"external_url":"https://mysticswap.io",
"name":"Apples Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"edition":1,
"attributes":[
{
"value":"Red",
"trait_type":"Color"
},
{
"value":"Medium",
"trait_type":"Size"
}
]
},
"tokenUri":{
"gateway":"https://alchemy.mypinata.cloud/ipfs/bafkreiaxar3ugc7wp3cumxb3albbhvodfnmbtpj5ba6sqqq3ftomwhdi4m",
"raw":"https://ipfs.io/ipfs/bafkreiaxar3ugc7wp3cumxb3albbhvodfnmbtpj5ba6sqqq3ftomwhdi4m"
},
"media":[
{
"gateway":"https://nft-cdn.alchemy.com/eth-goerli/62ed77fa507e8235e867d04c5217e007",
"thumbnail":"https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/62ed77fa507e8235e867d04c5217e007",
"raw":"https://ipfs.io/ipfs/bafkreidhpw7njnpejg3ba3ygarti4nvk4paix2u6p4j3foccp3plhd2rny",
"format":"jpeg",
"bytes":55186
}
]
},
{
"contract":{
"address":"0x229dd7144fec1008dddf5fcf779ec63c3d576aa7",
"name":"Oranges",
"symbol":"ORANGE",
"totalSupply":"46",
"tokenType":"ERC721",
"openSea":{
"lastIngestedAt":"2023-08-23T13:27:21.000Z"
},
"contractDeployer":"0xdd305dcf8c019b2e89ccecfedd80093726f611ef",
"deployedBlockNumber":8226244
},
"tokenId":"36",
"tokenType":"ERC721",
"title":"Orange Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"timeLastUpdated":"2023-08-11T16:19:41.866Z",
"rawMetadata":{
"date":1672329470274,
"image":"https://ipfs.io/ipfs/bafkreid6lpiyizkjyl2fexdizbovhfl3ncl4ma32zuvev3v6lnsbkvfdtm",
"external_url":"https://mysticswap.io",
"name":"Orange Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"edition":1,
"attributes":[
{
"value":"Yellow",
"trait_type":"Color"
},
{
"value":"Large",
"trait_type":"Size"
}
]
},
"tokenUri":{
"gateway":"https://alchemy.mypinata.cloud/ipfs/bafkreiaktvjzpks4y5cxmf7lyiiwp5gcqxzizoe7lvp47ia5ronrrlsfd4",
"raw":"https://ipfs.io/ipfs/bafkreiaktvjzpks4y5cxmf7lyiiwp5gcqxzizoe7lvp47ia5ronrrlsfd4"
},
"media":[
{
"gateway":"https://nft-cdn.alchemy.com/eth-goerli/f4880a8ea160bf037d32e71c0dd83786",
"thumbnail":"https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/f4880a8ea160bf037d32e71c0dd83786",
"raw":"https://ipfs.io/ipfs/bafkreid6lpiyizkjyl2fexdizbovhfl3ncl4ma32zuvev3v6lnsbkvfdtm",
"format":"jpeg",
"bytes":41777
}
]
}
]
},
"createdAt":"2023-08-24T19:06:34.835Z",
"updatedAt":"2023-08-24T19:06:34.835Z",
"__v":0
}
Example
Let's simulate validating the swap we just created in the Create Swap / Offer example. In this case, what we'd be querying the API with would be (mock values):
{
"signature": "0xdf6bc9d5d887f2c9971e0dd4a44cece08c1d55f18a2a11040a6c5888ab759aab4a6cf3c98f01251575a7a2e010dbfd57159b4acdc9dc490987afec5f0d04eb98",
"swapId": "63fa3005750c34a30f1a8a8d",
}
And here we can find the response we would get from making this call (mock values):
{
"_id":"64e7aa3a04d9a703ce46cc13",
"orderComponents":{
"offerer":"0xA79d4cCC70Cc3DD01f7D3a70ED5C7ca73de812C4",
"zone":"0xF712B2B35a06016851ADd2f9c43785Ec29e243dE",
"zoneHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
"startTime":"1692903991",
"endTime":"115792089237316195423570985008687907853269984665640564039457584007913129639935",
"orderType":2,
"offer":[
{
"itemType":2,
"token":"0x037aca480459ae361a87b023f189532d80cb6769",
"identifierOrCriteria":"46",
"startAmount":"1",
"endAmount":"1"
},
{
"itemType":2,
"token":"0x229dd7144fec1008dddf5fcf779ec63c3d576aa7",
"identifierOrCriteria":"36",
"startAmount":"1",
"endAmount":"1"
}
],
"consideration":[
{
"itemType":0,
"token":"0x0000000000000000000000000000000000000000",
"identifierOrCriteria":"0",
"startAmount":"2970000000000000",
"endAmount":"2970000000000000",
"recipient":"0xA79d4cCC70Cc3DD01f7D3a70ED5C7ca73de812C4"
},
{
"itemType":0,
"token":"0x0000000000000000000000000000000000000000",
"identifierOrCriteria":"0",
"startAmount":"30000000000000",
"endAmount":"30000000000000",
"recipient":"0xF712B2B35a06016851ADd2f9c43785Ec29e243dE"
}
],
"totalOriginalConsiderationItems":2,
"salt":"0x00000000000000000000000000000000000000000000000000000023245112a0",
"conduitKey":"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",
"counter":"0"
},
"chainId":5,
"signature":"",
"clientId":"64de82afc0885d14bbc3ab4e",
"status":"created",
"transactionHash":"",
"takerAddress":"",
"metadata":{
"tokensMetadata":[
],
"nftsMetadata":[
{
"contract":{
"address":"0x037aca480459ae361a87b023f189532d80cb6769",
"name":"Red Apples",
"symbol":"REDAPPLE",
"totalSupply":"63",
"tokenType":"ERC721",
"openSea":{
"lastIngestedAt":"2023-08-22T07:47:00.000Z"
},
"contractDeployer":"0xdd305dcf8c019b2e89ccecfedd80093726f611ef",
"deployedBlockNumber":8223329
},
"tokenId":"46",
"tokenType":"ERC721",
"title":"Apples Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"timeLastUpdated":"2023-08-11T16:19:41.014Z",
"rawMetadata":{
"date":1672329470274,
"image":"https://ipfs.io/ipfs/bafkreidhpw7njnpejg3ba3ygarti4nvk4paix2u6p4j3foccp3plhd2rny",
"external_url":"https://mysticswap.io",
"name":"Apples Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"edition":1,
"attributes":[
{
"value":"Red",
"trait_type":"Color"
},
{
"value":"Medium",
"trait_type":"Size"
}
]
},
"tokenUri":{
"gateway":"https://alchemy.mypinata.cloud/ipfs/bafkreiaxar3ugc7wp3cumxb3albbhvodfnmbtpj5ba6sqqq3ftomwhdi4m",
"raw":"https://ipfs.io/ipfs/bafkreiaxar3ugc7wp3cumxb3albbhvodfnmbtpj5ba6sqqq3ftomwhdi4m"
},
"media":[
{
"gateway":"https://nft-cdn.alchemy.com/eth-goerli/62ed77fa507e8235e867d04c5217e007",
"thumbnail":"https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/62ed77fa507e8235e867d04c5217e007",
"raw":"https://ipfs.io/ipfs/bafkreidhpw7njnpejg3ba3ygarti4nvk4paix2u6p4j3foccp3plhd2rny",
"format":"jpeg",
"bytes":55186
}
]
},
{
"contract":{
"address":"0x229dd7144fec1008dddf5fcf779ec63c3d576aa7",
"name":"Oranges",
"symbol":"ORANGE",
"totalSupply":"46",
"tokenType":"ERC721",
"openSea":{
"lastIngestedAt":"2023-08-23T13:27:21.000Z"
},
"contractDeployer":"0xdd305dcf8c019b2e89ccecfedd80093726f611ef",
"deployedBlockNumber":8226244
},
"tokenId":"36",
"tokenType":"ERC721",
"title":"Orange Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"timeLastUpdated":"2023-08-11T16:19:41.866Z",
"rawMetadata":{
"date":1672329470274,
"image":"https://ipfs.io/ipfs/bafkreid6lpiyizkjyl2fexdizbovhfl3ncl4ma32zuvev3v6lnsbkvfdtm",
"external_url":"https://mysticswap.io",
"name":"Orange Mock NFTS",
"description":"This are Mock NFTS sharing the Same Image. They are used for testing in mysticswap.io",
"edition":1,
"attributes":[
{
"value":"Yellow",
"trait_type":"Color"
},
{
"value":"Large",
"trait_type":"Size"
}
]
},
"tokenUri":{
"gateway":"https://alchemy.mypinata.cloud/ipfs/bafkreiaktvjzpks4y5cxmf7lyiiwp5gcqxzizoe7lvp47ia5ronrrlsfd4",
"raw":"https://ipfs.io/ipfs/bafkreiaktvjzpks4y5cxmf7lyiiwp5gcqxzizoe7lvp47ia5ronrrlsfd4"
},
"media":[
{
"gateway":"https://nft-cdn.alchemy.com/eth-goerli/f4880a8ea160bf037d32e71c0dd83786",
"thumbnail":"https://res.cloudinary.com/alchemyapi/image/upload/thumbnailv2/eth-goerli/f4880a8ea160bf037d32e71c0dd83786",
"raw":"https://ipfs.io/ipfs/bafkreid6lpiyizkjyl2fexdizbovhfl3ncl4ma32zuvev3v6lnsbkvfdtm",
"format":"jpeg",
"bytes":41777
}
]
}
]
},
"createdAt":"2023-08-24T19:06:34.835Z",
"updatedAt":"2023-08-24T19:06:34.835Z",
"__v":0
}
Here is an example API call, for you to copy and modify:
{
"signature": "string",
"swapId": "string",
}
Happy coding!
Last updated