Accept Swap / Offer

Endpoint to accept a listed swap / offer

Accept swap / offer

POST https://api.withmystic.xyz/marketplace-api/accept-swap

Receives a Swap ID and wallet address of the person accepting a swap. Returns all the approvals needed in order for the swap to be accepted, as well as the transaction itself.

Headers

Name
Type
Description

Bearer token*

String

Your API key

Request Body

Name
Type
Description

swapId*

String

Received in the validate-swap endpoint response

takerAddress*

String

Address of the person accepting the swap

[
   {
      "data":"0xfd9f1e10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a79d4ccc70cc3dd01f7d3a70ed5c7ca73de812c4000000000000000000000000f712b2b35a06016851add2f9c43785ec29e243de000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000064e7aa37ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023245112a00000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000037aca480459ae361a87b023f189532d80cb6769000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000229dd7144fec1008dddf5fcf779ec63c3d576aa70000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a8d3302fba000000000000000000000000000000000000000000000000000000a8d3302fba000000000000000000000000000a79d4ccc70cc3dd01f7d3a70ed5c7ca73de812c400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b48eb57e00000000000000000000000000000000000000000000000000000001b48eb57e000000000000000000000000000f712b2b35a06016851add2f9c43785ec29e243de",
      "to":"0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC"
   }
]

Example

Let's simulate accepting the swap we just validated in the Validate Swap / Offer example. In this case, what we'd query the API with would be (mock values):

{
  "swapId": "63fa3005750c34a30f1a8a8d",
  "takerAddress": "0xA0BC85720agB60BBda96458A87DCa21022e183ZL",
}

And here we can find the response we would get from making this call (mock values):

[
   {
      "data":"0xfd9f1e10000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a79d4ccc70cc3dd01f7d3a70ed5c7ca73de812c4000000000000000000000000f712b2b35a06016851add2f9c43785ec29e243de000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000064e7aa37ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023245112a00000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000037aca480459ae361a87b023f189532d80cb6769000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000229dd7144fec1008dddf5fcf779ec63c3d576aa70000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a8d3302fba000000000000000000000000000000000000000000000000000000a8d3302fba000000000000000000000000000a79d4ccc70cc3dd01f7d3a70ed5c7ca73de812c400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b48eb57e00000000000000000000000000000000000000000000000000000001b48eb57e000000000000000000000000000f712b2b35a06016851add2f9c43785ec29e243de",
      "to":"0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC"
   }
]

Here is an example API call, for you to copy and modify:

{
  "swapId": "string",
  "takerAddress": "string",
}

Happy coding!

Last updated