Starknet Defi
Execute DeFi operations on Starknet including token swaps via avnu aggregator, DCA...
Install
npx skills add internet-court/internet-court-skill --skill starknet-defi -g -a claude-code -y- Repository
- internet-court/internet-court-skill7k
- Category
- Engineering
- Updated
- 9d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 2,222 tokens
- Runs scripts
- No, instructions only
What it does
Execute DeFi operations on Starknet including token swaps via avnu aggregator, DCA recurring buys, STRK staking, and lending/borrowing. Supports gasless transactions.
Starknet DeFi Skill
Execute DeFi operations on Starknet using avnu aggregator and native protocols.
When to Use
- Swaps, DCA orders, staking, and lending or borrowing flows on Starknet.
- Agent workflows that need AVNU routing, paymaster support, or protocol-specific DeFi execution.
When NOT to Use
- Plain wallet management without DeFi intent.
- Cairo contract authoring, deployment operations, or security auditing.
Quick Start
- Install the AVNU + starknet.js dependencies and point the skill at a funded Starknet account.
- Use skills catalog when the flow expands into wallet setup, deployment, or auditing.
Prerequisites
npm install starknet@^8.9.1 @avnu/avnu-sdk@^4.0.1
Token Swaps (avnu SDK v4)
Get Quote and Execute Swap
import { getQuotes, executeSwap, type QuoteRequest } from "@avnu/avnu-sdk";
import { Account, RpcProvider, ETransactionVersion } from "starknet";
const provider = new RpcProvider({ nodeUrl: process.env.STARKNET_RPC_URL });
// starknet.js v8: Account uses options object
const account = new Account({
provider,
address,
signer: privateKey,
transactionVersion: ETransactionVersion.V3,
});
// Resolve token addresses via avnu SDK (or use MCP server's TokenService)
import { fetchVerifiedTokenBySymbol } from '@avnu/avnu-sdk';
const eth = await fetchVerifiedTokenBySymbol('ETH');
const strk = await fetchVerifiedTokenBySymbol('STRK');
// SDK v4: getQuotes takes QuoteRequest object directly
const quoteParams: QuoteRequest = {
sellTokenAddress: eth.address,
buyTokenAddress: strk.address,
sellAmount: BigInt(10 ** 17), // 0.1 ETH
takerAddress: account.address,
};
const quotes = await getQuotes(quoteParams);
const bestQuote = quotes[0];
// SDK v4: executeSwap takes single object param
const result = await executeSwap({
provider: account,
quote: bestQuote,
slippage: 0.01, // 1%
executeApprove: true,
});
console.log("Tx:", result.transactionHash);
