AutomationFlowsGeneral › Coinbase Cdp - Swap Tokens

Coinbase Cdp - Swap Tokens

Coinbase CDP - Swap Tokens. Uses CUSTOM. Event-driven trigger; 5 nodes.

Event trigger★★★★☆ complexity5 nodesCustom
General Trigger: Event Nodes: 5 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Coinbase CDP - Swap Tokens",
  "nodes": [
    {
      "parameters": {},
      "id": "trigger",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "resource": "account",
        "operation": "getOrCreate",
        "accountName": "trader-wallet"
      },
      "id": "create-account",
      "name": "Get Trader Account",
      "type": "CUSTOM.coinbaseCdp",
      "typeVersion": 1,
      "position": [
        480,
        300
      ],
      "credentials": {
        "coinbaseCdpApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "swap",
        "operation": "quote",
        "accountName": "trader-wallet",
        "fromToken": "0x4200000000000000000000000000000000000006",
        "toToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "fromAmount": "10000000000000000",
        "network": "base"
      },
      "id": "quote",
      "name": "Get Swap Quote (WETH -> USDC)",
      "type": "CUSTOM.coinbaseCdp",
      "typeVersion": 1,
      "position": [
        720,
        300
      ],
      "credentials": {
        "coinbaseCdpApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.liquidityAvailable }}",
              "value2": true
            }
          ]
        }
      },
      "id": "check-liquidity",
      "name": "Liquidity Available?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        960,
        300
      ]
    },
    {
      "parameters": {
        "resource": "swap",
        "operation": "execute",
        "accountName": "trader-wallet",
        "fromToken": "0x4200000000000000000000000000000000000006",
        "toToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "fromAmount": "10000000000000000",
        "network": "base"
      },
      "id": "swap",
      "name": "Execute Swap",
      "type": "CUSTOM.coinbaseCdp",
      "typeVersion": 1,
      "position": [
        1200,
        200
      ],
      "credentials": {
        "coinbaseCdpApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Get Trader Account",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Trader Account": {
      "main": [
        [
          {
            "node": "Get Swap Quote (WETH -> USDC)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Swap Quote (WETH -> USDC)": {
      "main": [
        [
          {
            "node": "Liquidity Available?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Liquidity Available?": {
      "main": [
        [
          {
            "node": "Execute Swap",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Coinbase CDP - Swap Tokens. Uses CUSTOM. Event-driven trigger; 5 nodes.

Source: https://github.com/pvdyck/n8n-nodes-coinbase-cdp/blob/5bbdac0c043cc42b52e367cddff36c2143a58da4/examples/swap-tokens.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

N8N-Community-Node-Klicktipp. Uses n8n-nodes-klicktipp, CUSTOM. Event-driven trigger; 22 nodes.

N8N Nodes Klicktipp, Custom
General

Wf-C0. Uses executeWorkflowTrigger, CUSTOM. Event-driven trigger; 10 nodes.

Execute Workflow Trigger, Custom
General

NotebookLM - Create and Download Infographic. Uses CUSTOM. Event-driven trigger; 6 nodes.

Custom
General

[E2E] Listing - Create, Approve, Close. Uses CUSTOM. Event-driven trigger; 9 nodes.

Custom
General

[E2E] Availability Exceptions - Create and Delete. Uses CUSTOM. Event-driven trigger; 7 nodes.

Custom