# Starknet Defi

Execute DeFi operations on Starknet including token swaps via avnu aggregator, DCA...

- Repository: https://github.com/internet-court/internet-court-skill (7050 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-26
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add internet-court/internet-court-skill --skill starknet-defi -g -a claude-code -y`
Codex: `npx skills add internet-court/internet-court-skill --skill starknet-defi -g -a codex -y`
Cursor: `npx skills add internet-court/internet-court-skill --skill starknet-defi -g -a cursor -y`
Gemini CLI: `npx skills add internet-court/internet-court-skill --skill starknet-defi -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add internet-court/internet-court-skill`

## Description

Execute DeFi operations on Starknet including token swaps via avnu aggregator, DCA recurring buys, STRK staking, and lending/borrowing. Supports gasless transactions.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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

1. Install the AVNU + starknet.js dependencies and point the skill at a funded Starknet account.
2. Use [skills catalog](../README.md) when the flow expands into wallet setup, deployment, or auditing.

## Prerequisites

```bash
npm install starknet@^8.9.1 @avnu/avnu-sdk@^4.0.1
```

## Token Swaps (avnu SDK v4)

### Get Quote and Execute Swap

```typescript
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);
```

The rest: https://github.com/internet-court/internet-court-skill/blob/HEAD/vendored/starknet/starknet-defi/SKILL.md
