hak-uniswap-plugin
v0.1.0
Published
The first Uniswap plugin for the Hedera Agent Kit — let a Hedera agent swap tokens through Uniswap permissionless liquidity on EVM chains. Cross-asset settlement, treasury rebalancing, optionally Ledger-gated.
Maintainers
Readme
hak-uniswap-plugin
The first Uniswap plugin for the Hedera Agent Kit.
Gives a Hedera agent the ability to swap tokens through Uniswap's permissionless liquidity on an EVM chain (Ethereum, Unichain, Base, …) via the Uniswap Trading API. A Hedera-native agent can now accept any token and rebalance or settle across assets autonomously — financial freedom for agents.
Part of the Aivy ecosystem; ships as a drag-and-drop node in Aivy Studio and runs live in Kickoff.bot's cross-asset settlement.
Why
Hedera's native DEX plugins (SaucerSwap) keep value on Hedera. This plugin extends a HAK agent across chains to Uniswap's liquidity — the missing piece for agents that receive arbitrary crypto and must transact freely. It's the only Uniswap plugin in the HAK ecosystem.
Install
npm i hak-uniswap-pluginUse
import { HederaLangchainToolkit } from 'hedera-agent-kit';
import { uniswapPlugin } from 'hak-uniswap-plugin';
const toolkit = new HederaLangchainToolkit({
client,
configuration: { plugins: [uniswapPlugin] },
});Tool: uniswap_swap
| param | type | notes |
|---|---|---|
| tokenIn | string | input token address or "native" |
| tokenOut | string | output token address or "native" |
| amountIn | string | amount in smallest units (wei) |
| chainId | number | default Unichain Sepolia (1301) |
| slippageBps | number | default 50 |
The tool quotes through the Uniswap Trading API, performs the dynamic ERC-20 allowance check + approval when the input is a token, optionally applies a Ledger threshold gate, then executes and returns the on-chain tx hash.
Config
UNISWAP_API_KEY=... # Uniswap Developer Platform
EVM_AGENT_PRIVATE_KEY=0x... # the agent's EVM signer (secp256k1)
EVM_CHAIN_ID=1301 # default chain (Unichain Sepolia)
KICKOFF_LEDGER_THRESHOLD=... # optional — above this (wei), returns unsigned
# tx for a Ledger Clear-Sign instead of executingLedger gate
When KICKOFF_LEDGER_THRESHOLD is set and a swap exceeds it, the tool returns
{ status: 'requires_ledger_approval', unsignedTx } instead of executing — hand
that to a hardware-wallet Clear-Sign flow so high-value swaps need explicit human
approval. Autonomous below the line, device-gated above it.
Proof — real on-chain swaps
Executed by a HAK agent through this plugin (native ETH → USDC, Ethereum Sepolia, chain 11155111):
- tx:
0x69babe82…2ea5fc— status SUCCESS, block 11049036 (0.001 ETH → ~24.37 USDC) - tx:
0xb1dc8201…ccbd9e— status SUCCESS, block 11053763 — fired automatically as the cross-asset settlement leg of a live Kickoff.bot deal (recorded back on Hedera HCS-10)
Both routed by the Uniswap Trading API.
License
MIT © Juan Gomez (jmgomezl)
