8
n8n 中文网amn8n.com

多链1Shot加油站

高级

这是一个Crypto Trading, Multimodal AI领域的自动化工作流,包含 22 个节点。主要使用 If, Code, Webhook, OneShot, HttpRequest 等节点。 基于Li.Fi的多链代币交换中继器

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "hLSP3IRTzc3oceob",
  "meta": {
    "instanceId": "62f017ec8f130d172e2e5f39bbf09515036bfd403dfa60fe06f5ab14b78705d0"
  },
  "name": "多链 1Shot 加油站",
  "tags": [],
  "nodes": [
    {
      "id": "61942572-cf88-4d9a-bb8b-d9fdbe69f0e5",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        672
      ],
      "parameters": {
        "width": 360,
        "height": 300,
        "content": "## x402 支付端点"
      },
      "typeVersion": 1
    },
    {
      "id": "0ea9c803-e6bd-424d-8185-94f3f35047ee",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        1280
      ],
      "parameters": {
        "width": 840,
        "height": 500,
        "content": "## 示例 Curl 命令"
      },
      "typeVersion": 1
    },
    {
      "id": "a229f609-6a92-4423-bfb5-176b5635dbe0",
      "name": "响应:200 - 支付成功",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1456,
        416
      ],
      "parameters": {
        "options": {
          "responseCode": 200
        },
        "respondWith": "text",
        "responseBody": "={ \"transactionHash\": \"{{ $json.transactionHash }}\" }"
      },
      "typeVersion": 1.3
    },
    {
      "id": "2290b67c-ad8d-4021-919d-16ce4ff48623",
      "name": "响应:支付无效",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1456,
        640
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "{\n  \"x402Version\": \"1\",\n  \"error\": \"X-PAYMENT payment invalid\",\n  \"accepts\": [\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"1000000\",\n      \"resource\": \"https://n8n.1shotapi.dev/webhook-test/gas-station\",\n      \"description\": \"Swap stablecoins for gas tokens\",\n      \"mimeType\": \"\",\n      \"payTo\": \"0xA1BfEd6c6F1C3A516590edDAc7A8e359C2189A61\",\n      \"maxTimeoutSeconds\": 150,\n      \"asset\": \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\",\n      \"extra\": {\n        \"name\": \"USD Coin\",\n        \"version\": \"2\"\n      }\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "bd1b6655-770c-4c32-ad45-7704474b785d",
      "name": "确保支付载荷格式正确",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ae6f06ed-217e-4820-9e0c-a9f4c4c7c5e2",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.signature }}",
              "rightValue": ""
            },
            {
              "id": "a8ac3461-1615-4de6-81ce-6ca3f92fca04",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.from }}",
              "rightValue": ""
            },
            {
              "id": "851fbfb8-4023-473b-af00-6f466cfd72fc",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.to }}",
              "rightValue": ""
            },
            {
              "id": "1fe53533-d162-46bc-8b9e-8170a2297263",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.value }}",
              "rightValue": ""
            },
            {
              "id": "f7621873-14cb-4d7d-9b9d-3c7818bed576",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.validAfter }}",
              "rightValue": ""
            },
            {
              "id": "b9c9c1fd-ddbc-48bb-b42a-d781743b755b",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.validBefore }}",
              "rightValue": ""
            },
            {
              "id": "c37c20db-22a3-4f45-90ed-0abae3dbf0ef",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.nonce }}",
              "rightValue": ""
            },
            {
              "id": "3fdd1014-3673-4a37-bd1b-7ca3ab817c8a",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.decodedXPayment.payload.authorization.value }}",
              "rightValue": "={{ $('Webhook').item.json.body.fromAmount }}"
            },
            {
              "id": "ce8b9784-3927-4329-be27-533a9bed4455",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ parseInt($json.decodedXPayment.payload.authorization.validBefore) - Math.floor(DateTime.now()/1000) }}",
              "rightValue": 120
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "91525929-27ef-4000-8291-90e63e6bd88d",
      "name": "1Shot API 提交并等待",
      "type": "n8n-nodes-1shot.oneShotSynch",
      "position": [
        1232,
        464
      ],
      "parameters": {
        "params": "={\n  \"tokenAddress\": \"{{ $('Webhook').item.json.body.fromToken }}\",\n  \"from\":  \"{{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.from }}\",\n  \"value\": \"{{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.value }}\",\n  \"validAfter\": \"{{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.validAfter }}\",\n  \"validBefore\": \"{{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.validBefore }}\",\n  \"nonce\": \"{{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.nonce }}\",\n  \"signature\": \"{{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.signature }}\",\n  \"diamondCalldata\": \"{{ $('Ensure Well Formatted Payment Payload').item.json.transactionRequest.data }}\"\n} ",
        "additionalFields": {
          "memo": "=Li.Fi swap - receiver:  {{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.from }}, token: {{ $('Webhook').item.json.body.fromToken }},amount: {{ $('Ensure Well Formatted Payment Payload').item.json.decodedXPayment.payload.authorization.value }}, chain: {{ $('Webhook').item.json.body.fromChain }}",
          "gasLimit": "={{ $('Fetch Li.Fi Quote').item.json.transactionRequest.gasLimit }}"
        },
        "contractMethodId": "={{ $('Lookup Payment Configs').item.json.paymentConfig.contractMethodId }}"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "id": "nkfF9AitCKUCrErK",
          "name": "1Shot account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b100e695-c36e-45cc-87d4-5a2c1641bfe2",
      "name": "在成功支付模拟时",
      "type": "n8n-nodes-base.if",
      "position": [
        1008,
        544
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "81c67679-e256-4fd2-bed7-8f4272c2392b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.success.toString() }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1c7c6614-8838-479d-8643-c4c23c28996d",
      "name": "模拟支付",
      "type": "n8n-nodes-1shot.oneShot",
      "position": [
        784,
        544
      ],
      "parameters": {
        "params": "={\n  \"tokenAddress\": \"{{ $('Webhook').item.json.body.fromToken }}\",\n  \"from\":  \"{{ $json.decodedXPayment.payload.authorization.from }}\",\n  \"value\": \"{{ $json.decodedXPayment.payload.authorization.value }}\",\n  \"validAfter\": \"{{ $json.decodedXPayment.payload.authorization.validAfter }}\",\n  \"validBefore\": \"{{ $json.decodedXPayment.payload.authorization.validBefore }}\",\n  \"nonce\": \"{{ $json.decodedXPayment.payload.authorization.nonce }}\",\n  \"signature\": \"{{ $json.decodedXPayment.payload.signature }}\",\n  \"diamondCalldata\": \"{{ $json.transactionRequest.data }}\"\n} ",
        "gasLimit": "={{ parseInt($json.transactionRequest.gasLimit, 16).toString() }}",
        "operation": "simulate",
        "contractMethodId": "={{ $('Lookup Payment Configs').item.json.paymentConfig.contractMethodId }}"
      },
      "credentials": {
        "oneShotOAuth2Api": {
          "id": "nkfF9AitCKUCrErK",
          "name": "1Shot account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "111be73d-9efd-405c-8a40-37a658ffbd6d",
      "name": "解码并验证 X-Payment",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        640
      ],
      "parameters": {
        "jsCode": "try {\n    // Decode the x-payment header from base64\n    const xPaymentHeader = $('Webhook').first().json.headers['x-payment'];\n    const decodedXPayment = Buffer.from(xPaymentHeader, 'base64').toString('utf-8');\n\n    // Parse the decoded value into a JSON object\n    const decodedXPaymentJson = JSON.parse(decodedXPayment);\n\n    // Add the parsed JSON object to the input\n    $input.first().json.decodedXPayment = decodedXPaymentJson;\n\n    return $input.all();\n} catch (error) {\n    // Return an error object if the token format is invalid\n    return { error: \"invalid token format\" };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "65cfb1b1-3757-4d68-be84-87dc39d15663",
      "name": "检查是否存在 X-HEADER",
      "type": "n8n-nodes-base.if",
      "position": [
        112,
        736
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2ff83590-61f3-41d8-8500-a96103c3844c",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $('Webhook').item.json.headers['x-payment'] }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f39716c2-10c5-4db8-abd2-a3c1a4abef53",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -784,
        1024
      ],
      "webhookId": "92c5ca23-99a7-437d-85da-84aef8bd2a25",
      "parameters": {
        "path": "=gas-station",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "efdbe5bb-7786-45da-95f7-f2f4771d94e9",
      "name": "获取 Li.Fi 报价",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -112,
        832
      ],
      "parameters": {
        "url": "https://li.quest/v1/quote",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "fromChain",
              "value": "={{ $('Webhook').item.json.body.fromChain }}"
            },
            {
              "name": "fromToken",
              "value": "={{ $('Webhook').item.json.body.fromToken }}"
            },
            {
              "name": "fromAddress",
              "value": "={{ $('Webhook').item.json.body.fromAddress }}"
            },
            {
              "name": "toChain",
              "value": "={{ $('Webhook').item.json.body.toChain }}"
            },
            {
              "name": "toToken",
              "value": "=0x0000000000000000000000000000000000000000"
            },
            {
              "name": "toAddress",
              "value": "={{ $('Webhook').item.json.body.fromAddress }}"
            },
            {
              "name": "slippage",
              "value": "0.05"
            },
            {
              "name": "integrator",
              "value": "oneshot-gas-station"
            },
            {
              "name": "=fromAmount",
              "value": "={{ $('Webhook').item.json.body.fromAmount }}"
            },
            {
              "name": "allowBridges",
              "value": "gasZipBridge"
            },
            {
              "name": "fee",
              "value": "0.005"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-lifi-api-key",
              "value": "6477de9d-675c-49e8-9d79-d89b849a5101.bd63c1c7-af76-4605-87c6-43344d951395"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "3a877b1c-a8c3-4f6d-b4bf-4597d9f915ec",
      "name": "确保请求体参数",
      "type": "n8n-nodes-base.if",
      "position": [
        -560,
        1024
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "de6db9c5-eadc-4ccb-a74c-f18e9bb1370c",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.fromToken }}",
              "rightValue": ""
            },
            {
              "id": "db76fbee-12ef-4aa4-8e1b-f94ed21a5802",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.toChain }}",
              "rightValue": ""
            },
            {
              "id": "9e65c67e-e175-4b40-bd7c-d998cc19d787",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.fromToken }}",
              "rightValue": ""
            },
            {
              "id": "12e5e3d0-5490-4f45-b091-90ac248b95c7",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.fromAmount }}",
              "rightValue": ""
            },
            {
              "id": "fa9e0727-5f48-42b8-ae5f-7b066a72f7bd",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.body.fromAddress }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c9b84d33-94ec-4524-91a7-17e107fa9956",
      "name": "响应:缺少或无效的请求体参数",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -336,
        1120
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "{\n  \"x402Version\": \"1\",\n  \"error\": \"Missing request parameters: fromAddress, fromToken, fromChain, fromAmount, toChain\",\n  \"accepts\": []\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "693717c9-e36c-4db3-99bf-54922afccd40",
      "name": "响应:无 X-Payment 头部",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        336,
        832
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"x402Version\": \"1\",\n  \"error\": \"Missing x-payment header\",\n  \"estimate\": {\n    \"toAmountMin\": {{ $json.estimate.toAmountMin }},\n    \"toAmountUSD\": {{ $json.estimate.toAmountUSD }},\n    \"executionDuration\": {{ $json.estimate.executionDuration }}\n  },\n  \"accepts\": [\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"1000000\",\n      \"resource\": \"https://n8n.1shotapi.dev/webhook-test/gas-station\",\n      \"description\": \"Swap stablecoins for gas tokens\",\n      \"mimeType\": \"\",\n      \"payTo\": \"0x4E43836F329B5f176A5d1a21519d0C61f819429C\",\n      \"maxTimeoutSeconds\": 150,\n      \"asset\": \"{{ $('Lookup Payment Configs').item.json.paymentConfig.tokenAddress }}\",\n      \"extra\": {\n        \"name\": \"{{ $('Lookup Payment Configs').item.json.paymentConfig.name }}\",\n        \"version\": \"{{ $('Lookup Payment Configs').item.json.paymentConfig.version }}\"\n      }\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "4a92e220-7ca7-4857-bd93-1a6ac99b4fc5",
      "name": "响应:缺少或无效的 X-Payment 头部",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        784,
        736
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"x402Version\": \"1\",\n  \"error\": \"Missing or invalid x-payment header\",\n  \"accepts\": [\n    {\n      \"scheme\": \"exact\",\n      \"network\": \"base\",\n      \"maxAmountRequired\": \"1000000\",\n      \"resource\": \"https://n8n.1shotapi.dev/webhook-test/gas-station\",\n      \"description\": \"Swap stablecoins for gas tokens\",\n      \"mimeType\": \"\",\n      \"payTo\": \"0x4E43836F329B5f176A5d1a21519d0C61f819429C\",\n      \"maxTimeoutSeconds\": 180,\n      \"asset\": \"{{ $('Lookup Payment Configs').item.json.paymentConfig.tokenAddress }}\",\n      \"extra\": {\n        \"name\": \"{{ $('Lookup Payment Configs').item.json.paymentConfig.name }}\",\n        \"version\": \"{{ $('Lookup Payment Configs').item.json.paymentConfig.version }}\"\n      }\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "71a79e54-197c-472a-be5d-2b4d7386b661",
      "name": "查找支付配置",
      "type": "n8n-nodes-base.code",
      "onError": "continueErrorOutput",
      "position": [
        -336,
        928
      ],
      "parameters": {
        "jsCode": "const fromToken = $input.first().json.body.fromToken;\nconst fromChain = $input.first().json.body.fromChain;\n\nconst config = {\n  \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\": {\n    tokenAddress: \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\",\n    chain: \"8453\",\n    name: \"USD Coin\",\n    version: \"2\",\n    contractMethodId: \"c181f867-b03c-4a34-a8b1-de3cc05021c1\"\n  },\n  \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\": {\n    tokenAddress: \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\",\n    chain: \"43114\",\n    name: \"USD Coin\",\n    version: \"2\",\n    contractMethodId: \"d359bee6-83f5-4e0d-972c-5385c0f6ece2\"\n  },\n  \"0xaf88d065e77c8cc2239327c5edb3a432268e5831\": {\n    tokenAddress: \"0xaf88d065e77c8cc2239327c5edb3a432268e5831\",\n    chain: \"42161\",\n    name: \"USD Coin\",\n    version: \"2\",\n    contractMethodId: \"507a44d3-42c9-45e8-9101-ab6cfa42be68\"\n  }\n};\n\n// Check if fromToken exists in config\nif (!config[fromToken]) {\n  throw new Error(`Token ${fromToken} not found in configuration`);\n}\n\n// Optionally you could also validate the chain if needed\nif (config[fromToken].chain !== fromChain) {\n  throw new Error(`Invalid chain for token ${fromToken}`);\n}\n\n// Add the parsed JSON object to the input\n$input.first().json.paymentConfig = config[fromToken];\n\nreturn $input.all();\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "52db2011-d0da-4234-9fd2-8c5edd6312c3",
      "name": "响应:错误的代币地址",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -112,
        1024
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "{\n  \"x402Version\": \"1\",\n  \"error\": \"Please provide a valid stablecoin to swap\",\n  \"accepts\": []\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "fdd6c3b7-60b3-4966-83d5-d7d1aeb6ce13",
      "name": "响应:获取报价失败",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        112,
        928
      ],
      "parameters": {
        "options": {
          "responseCode": 402
        },
        "respondWith": "json",
        "responseBody": "={\n  \"x402Version\": \"1\",\n  \"error\": \"Bad quote input parameters, check out payload values.\",\n  \"accepts\": []\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "5bb57721-3431-49b5-a650-f39df5365cb9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        656
      ],
      "parameters": {
        "width": 336,
        "height": 144,
        "content": "## 从 Li.Fi 获取兑换路由和报价"
      },
      "typeVersion": 1
    },
    {
      "id": "7ac5e876-92f3-4666-b466-3eac67202b02",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        784,
        272
      ],
      "parameters": {
        "width": 512,
        "content": "## 使用 1Shot API 模拟并提交兑换"
      },
      "typeVersion": 1
    },
    {
      "id": "e054c47e-26f4-4541-a9a5-214c09ff14f4",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        1264
      ],
      "parameters": {
        "width": 592,
        "height": 352,
        "content": "## 支付配置"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0a501f8e-a095-4f67-be82-ec96b88a27ee",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Ensure Request Body Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simulate Payment": {
      "main": [
        [
          {
            "node": "On Successful Payment Simulation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Li.Fi Quote": {
      "main": [
        [
          {
            "node": "Check for presence of X-HEADER",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Failed to Get Quote",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup Payment Configs": {
      "main": [
        [
          {
            "node": "Fetch Li.Fi Quote",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Bad Token Address",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1Shot API Submit & Wait": {
      "main": [
        [
          {
            "node": "Response: 200 - Payment Successful",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Payment Invalid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decode & Validate X-Payment": {
      "main": [
        [
          {
            "node": "Ensure Well Formatted Payment Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for presence of X-HEADER": {
      "main": [
        [
          {
            "node": "Decode & Validate X-Payment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: No X-Payment Header",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ensure Request Body Parameters": {
      "main": [
        [
          {
            "node": "Lookup Payment Configs",
            "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: Payment Invalid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ensure Well Formatted Payment Payload": {
      "main": [
        [
          {
            "node": "Simulate Payment",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response: Missing or Invalid X-Payment Header",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 加密货币交易, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量22
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
1Shot API

1Shot API

@oneshotapi

1Shot API lets you bring onchain actions into your n8n workflows.

外部链接
在 n8n.io 查看

分享此工作流