{
  "name": "Multi-chain token swap relayer with Li.Fi",
  "nodes": [
    {
      "id": "80932427-585a-4ca3-8ee2-cf8aaf756aae",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1888,
        512
      ],
      "parameters": {
        "width": 408,
        "height": 524,
        "content": "## x402 Payment Endpoint \n\nThis workflow lets the operator monetize swaps from ERC-20 tokens to native gas tokens on up to 100 different EVM blockchains via the [Li.Fi](https://li.fi/) protocol. \n\nThi"
      }
    },
    {
      "id": "39a72092-252c-4e96-9ecb-0b271da73cd5",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2176,
        1088
      ],
      "parameters": {
        "width": 840,
        "height": 596,
        "content": "## Example Curl Command\n\nThe workflow requires the following POST body parameters:\n\n- `fromChain` - the chain the user's EIP-3009 compatible tokens are on\n- `fromToken` - the address of the EIP-3009 c"
      }
    },
    {
      "id": "3e805ca4-f2f2-43db-9f50-ccffd5b770d2",
      "name": "Response: 200 - Payment Successful",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -64,
        416
      ]
    },
    {
      "id": "2708bdf9-fcbc-4d0b-b2c1-dbb1ba24e35f",
      "name": "1Shot API Submit & Wait",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        -288,
        512
      ]
    },
    {
      "id": "f7e3314b-5cab-4ca7-930e-d00b03dbc5b4",
      "name": "On Successful Payment Simulation",
      "type": "n8n-nodes-base.if",
      "position": [
        -512,
        608
      ]
    },
    {
      "id": "acfea100-cd3a-4099-b828-c6fe0bcfc3ba",
      "name": "Simulate Payment",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        -736,
        608
      ]
    },
    {
      "id": "f5089506-8709-4942-9062-ac66fe091bbe",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1856,
        896
      ]
    },
    {
      "id": "bd5ce8db-39eb-4194-ab5f-cffc73eb9397",
      "name": "Fetch Li.Fi Quote",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1184,
        800
      ]
    },
    {
      "id": "a6e7de73-8e9c-49fb-b172-47e98695de17",
      "name": "Response: Missing or Invalid Request Body Params",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -1184,
        992
      ]
    },
    {
      "id": "b226d9e6-8963-4556-a6be-16b98486a326",
      "name": "Response: Failed to Get Quote",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -960,
        896
      ]
    },
    {
      "id": "1f92afa5-ae85-41ce-9d2d-b868a37d5a03",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        384
      ],
      "parameters": {
        "width": 272,
        "height": 576,
        "content": "## Fetch Swap Route & Quote form Li.Fi\n\nThis block fetches a quote from the Li.Fi Route API that retuns the `callData` needed to call the Li.FI Diamond Proxy contract.\n\nYou'll need to get a Li.Fi API "
      }
    },
    {
      "id": "466fed72-b4fa-4f50-ab71-e3701d2e88a8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        352
      ],
      "parameters": {
        "width": 672,
        "height": 416,
        "content": "## Use 1Shot API to Simulate and Submit the Swap \n\n[1Shot API](https://1shotapi.com) handles simulating the transaction and submitting it the the appropriate blockchain network. "
      }
    },
    {
      "id": "fd5beb2b-9129-4d89-8ec2-9e20c1d303a4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        1184
      ],
      "parameters": {
        "width": 752,
        "height": 352,
        "content": "## Payment Token Configs\n\nYou must edit the \"Payment Token Configs\" node with the tokens you wish to support for swaps.\n\nYou need:\n\n1. The token address\n2. The EVM chain id\n3. The x402 name of the `to"
      }
    },
    {
      "id": "fefb995e-d5ee-4a4f-99ee-6e2c90d08d9d",
      "name": "Validate & Verify X-Payment Header",
      "type": "n8n-nodes-base.code",
      "position": [
        -960,
        704
      ]
    },
    {
      "id": "dad98431-090b-49f3-b35f-81ee8344ecad",
      "name": "Payment Token Configs",
      "type": "n8n-nodes-base.code",
      "position": [
        -1632,
        896
      ]
    },
    {
      "id": "dd5f6fd4-f74b-48cd-ab8a-66852214929c",
      "name": "Validate & Verify POST Body",
      "type": "n8n-nodes-base.code",
      "position": [
        -1408,
        896
      ]
    },
    {
      "id": "f8f41400-ca0f-410d-a53b-f41d2730c9cc",
      "name": "Response: No X-Payment Header2",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -736,
        800
      ]
    },
    {
      "id": "2a50dbb1-5078-4b0d-9415-23c418c68b81",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2560,
        496
      ],
      "parameters": {
        "width": 616,
        "height": 524,
        "content": "## x402 Payment Endpoint \n\nThis workflow fragment can be used to monetize any workflow you can build in n8n by accepting stablecoin payments via an API call.\n\nLearn more about the [x402 payment](https"
      }
    },
    {
      "id": "b05cea5a-9e77-4f85-b98a-2a7c40b2d12b",
      "name": "Response: Verify Failed",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -288,
        800
      ]
    },
    {
      "id": "f81d3b66-2a3a-4a8f-936f-41da1d86127e",
      "name": "Response: Settle Failed",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -64,
        608
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Payment Token Configs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simulate Payment": {
      "main": [
        [
          {
            "node": "On Successful Payment Simulation",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Fetch Li.Fi Quote": {
      "main": [
        [
          {
            "node": "Validate & Verify X-Payment Header",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Failed to Get Quote",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Payment Token Configs": {
      "main": [
        [
          {
            "node": "Validate & Verify POST Body",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "1Shot API Submit & Wait": {
      "main": [
        [
          {
            "node": "Response: 200 - Payment Successful",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Settle Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Verify POST Body": {
      "main": [
        [
          {
            "node": "Fetch Li.Fi Quote",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Missing or Invalid Request Body Params",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Successful Payment Simulation": {
      "main": [
        [
          {
            "node": "1Shot API Submit & Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Verify Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Verify X-Payment Header": {
      "main": [
        [
          {
            "node": "Simulate Payment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: No X-Payment Header2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}