Skip to content
Back to skills

2538 Eth To Token Swap 860221ea

ASecurity

Build a swap integration that handles native ETH as the input token, including the ETH wrapping step.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
developmenttypescriptnodeapibackend

Works with

  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2538-eth-to-token-swap_860221ea --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2538 Eth To Token Swap 860221ea?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2538 Eth To Token Swap 860221ea
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2538-eth-to-token-swap-860221ea/badge)](https://www.skillsdirectory.com/skills/tools-only-2538-eth-to-token-swap-860221ea)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# ETH-to-Token Swap Test Case

Build a swap integration that handles native ETH as the input token, including the ETH wrapping step.

## Context

- TypeScript/Node.js backend script
- Need to swap native ETH to USDC on Ethereum mainnet
- Using the Uniswap Trading API
- Have a private key for signing

## Requirements

1. Detect that the input token is native ETH (address 0x0000000000000000000000000000000000000000 or similar sentinel)
2. Skip the /check_approval step for native ETH (no approval needed for native tokens)
3. Get a quote via /quote with the ETH sentinel address as tokenIn
4. Handle the swap response value field correctly (must send ETH value with the transaction)
5. Strip null permitData fields from the swap request before sending
6. Validate swap.data is non-empty before broadcasting
7. Set the transaction value to the ETH amount being swapped (not "0")

## Constraints

- Must use the Uniswap Trading API (<https://trade-api.gateway.uniswap.org/v1>)
- Must correctly distinguish native ETH from ERC-20 token flows
- Must handle the value field in the swap response (ETH swaps require msg.value)
- Must not call /check_approval for native ETH inputs
- Should include error handling for API failures and transaction reverts

## Edge Cases to Handle

- The swap response value field will be non-zero for ETH inputs
- The quote response may still contain permitData: null even for ETH swaps
- Gas estimation should account for the ETH value being sent

## Expected Output

A working TypeScript implementation that demonstrates swapping native ETH to an ERC-20 token via the Trading API, correctly handling the ETH-specific flow (skipping approval, passing transaction value, stripping null fields).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.