Create and manage Starknet wallets for AI agents. Transfer tokens, check balances, manage session keys, deploy accounts, and interact with smart contracts using native Account Abstraction.
npx skills add https://github.com/internet-court/internet-court-skill --skill starknet-wallet
Manage Starknet wallets for AI agents with native Account Abstraction support.
starknet-defi.npm install starknet@^8.9.1 @avnu/avnu-sdk@^4.0.1
Environment variables:
STARKNET_RPC_URL=https://starknet-mainnet.g.alchemy.com/v2/YOUR_KEY
STARKNET_ACCOUNT_ADDRESS=0x...
STARKNET_PRIVATE_KEY=0x...
AVNU_BASE_URL=https://starknet.api.avnu.fi (optional)
AVNU_PAYMASTER_URL=https://starknet.paymaster.avnu.fi (optional)
AVNU_PAYMASTER_API_KEY=your_key (optional, for free gas)
The Starknet MCP Server provides these tools for wallet operations:
| Tool | Purpose | Key Features |
|------|---------|--------------|
| starknet_get_balance | Check single token balance | Simple, fast queries |
| starknet_get_balances | Check multiple token balances | Batch queries (up to 200 tokens), single RPC call |
| starknet_transfer | Send tokens | Supports gasless mode (paymaster) |
| starknet_call_contract | Read contract state | Call view functions |
| starknet_invoke_contract | Execute contract functions | Write operations, supports gasless |
| starknet_swap | Execute token swaps | AVNU integration, best price routing |
| starknet_get_quote | Get swap quotes | Price estimation before swap |
| starknet_register_agent | Register agent identity | ERC-8004 on-chain identity |
Query balance for one token. Use for simple cases.
Input:
token (required): Token symbol (ETH, STRK, USDC, USDT) or contract addressaddress (optional): Wallet address (defaults to agent's address)Response:
{
"address": "0x...",
"token": "ETH",
"tokenAddress": "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
"balance": "1.5",
"raw": "1500000000000000000",
"decimals": 18
}
Query balances for multiple tokens in a single RPC call. More efficient for portfolio views.
Input:
tokens (required): Array of token symbols or addresses (max 200)address (optional): Wallet addressResponse:
{
"address": "0x...",
"balances": [
{ "token": "ETH", "tokenAddress": "0x...", "balance": "1.5", "raw": "...", "decimals": 18 },
{ "token": "USDC", "tokenAddress": "0x...", "balance": "100", "raw": "...", "decimals": 6 }
],
"tokensQueried": 2,
"method": "balance_checker"
}
When to use:
Use the starknet_get_balance MCP tool for simple single-token queries:
// Via MCP tool (recommended)
const result = await mcpClient.callTool({
name: "starknet_get_balance",
arguments: {
address: "0x...", // Account address
token: "ETH", // Symbol (ETH, STRK, USDC, USDT) or contract address
}
});
// Returns: { address, token, tokenAddress, balance, raw, decimals }
Direct starknet.js usage:
import { RpcProvider, Contract } from "starknet";
const provider = new RpcProvider({ nodeUrl: process.env.STARKNET_RPC_URL });
// ETH balance (starknet.js v8 uses options object for Contract)
const ethAddress = "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7";
const ethContract = new Contract({
abi: erc20Abi,
address: ethAddress,
providerOrAccount: provider,
});
const balance = await ethContract.balanceOf(accountAddress);
// starknet.js v8: Convert uint256 to bigint
const balanceBigInt = BigInt(balance.low) + (BigInt(balance.high) << 128n);
// Format: (balanceBigInt / 10n ** 18n).toString() for whole units
Use starknet_get_balances for efficient multi-token queries (single RPC call):
// Via MCP tool (recommended for multiple tokens)
const result = await mcpClient.callTool({
name: "starknet_get_balances",
arguments: {
address: "0x...",
tokens: ["ETH", "STRK", "USDC", "USDT"], // Up to 200 tokens
}
});
// Returns:
// {
// address: "0x...",
// balances: [
// { token: "ETH", tokenAddress: "0x...", balance: "1.5", raw: "1500000000000000000", decimals: 18 },
// { token: "STRK", tokenAddress: "0x...", balance: "100", raw: "100000000000000000000", decimals: 18 },
// ...
// ],
// tokensQueried: 4,
// method: "balance_checker" // Uses BalanceChecker contract for efficiency
// }
Direct starknet.js usage with BalanceChecker contract:
import { RpcProvider, Contract } from "starknet";
const provider = new RpcProvider({ nodeUrl: process.env.STARKNET_RPC_URL });
// BalanceChecker contract (returns non-zero balances only)
const BALANCE_CHECKER_ADDRESS = "0x031ce64a666fbf9a2b1b2ca51c2af60d9a76d3b85e5fbfb9d5a8dbd3fedc9716";
const BALANCE_CHECKER_ABI = [
{
type: "struct",
name: "core::integer::u256",
members: [
{ name: "low", type: "core::integer::u128" },
{ name: "high", type: "core::integer::u128" },
],
},
{
type: "struct",
name: "governance::balance_checker::NonZeroBalance",
members: [
{ name: "token", type: "core::starknet::contract_address::ContractAddress" },
{ name: "balance", type: "core::integer::u256" },
],
},
{
type: "function",
name: "get_balances",
inputs: [
{ name: "address", type: "core::starknet::contract_address::ContractAddress" },
{ name: "tokens", type: "core::array::Span::<core::starknet::contract_address::ContractAddress>" },
],
outputs: [{ type: "core::array::Span::<governance::balance_checker::NonZeroBalance>" }],
state_mutability: "view",
},
];
const balanceChecker = new Contract({
abi: BALANCE_CHECKER_ABI,
address: BALANCE_CHECKER_ADDRESS,
providerOrAccount: provider,
});
// Query multiple tokens at once
const tokens = [
"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", // ETH
"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", // STRK
"0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", // USDC
];
const result = await balanceChecker.get_balances(accountAddress, tokens);
// Parse response (only non-zero balances returned)
for (const item of result) {
const tokenAddr = "0x" + BigInt(item.token).toString(16).padStart(64, "0");
const balance = BigInt(item.balance); // starknet.js converts u256 to bigint
console.log(`${tokenAddr}: ${balance}`);
}
When to use which:
starknet_get_balance: Single token, simple use casestarknet_get_balances: Multiple tokens, portfolio view, more efficientUse the starknet_transfer MCP tool with optional gasless mode:
// Via MCP tool (recommended)
const result = await mcpClient.callTool({
name: "starknet_transfer",
arguments: {
recipient: "0x...",
token: "STRK", // Symbol or contract address
amount: "10.5", // Human-readable amount
gasfree: false, // Optional: use paymaster
}
});
// Returns: { transactionHash, recipient, token, amount, gasfree }
Gasless Transfer (Pay gas in token instead of ETH/STRK):
// Pay gas in USDC instead of ETH/STRK
const result = await mcpClient.callTool({
name: "starknet_transfer",
arguments: {
recipient: "0x...",
token: "STRK",
amount: "100",
gasfree: true,
gasToken: "USDC", // Gas paid in USDC
}
});
Direct starknet.js usage:
import { Account, RpcProvider, CallData, cairo, 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: process.env.STARKNET_ACCOUNT_ADDRESS,
signer: process.env.STARKNET_PRIVATE_KEY,
transactionVersion: ETransactionVersion.V3,
});
const tokenAddress = "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"; // STRK
// starknet.js v8: Use cairo.uint256() instead of uint256.bnToUint256()
const { transaction_hash } = await account.execute({
contractAddress: tokenAddress,
entrypoint: "transfer",
calldata: CallData.compile({
recipient: recipientAddress,
amount: cairo.uint256(amountInWei),
}),
});
await account.waitForTransaction(transaction_hash);
const estimatedFee = await account.estimateInvokeFee({
contractAddress: tokenAddress,
entrypoint: "transfer",
calldata: CallData.compile({
recipient: recipientAddress,
amount: cairo.uint256(amountInWei),
}),
});
// estimatedFee.overall_fee -- total fee in STRK (V3 transactions)
Read contract state (view functions):
// Via MCP tool
const result = await mcpClient.callTool({
name: "starknet_call_contract",
arguments: {
contractAddress: "0x...",
entrypoint: "balanceOf",
calldata: [accountAddress],
}
});
Write to contracts (state-changing functions):
// Via MCP tool with gasless option
const result = await mcpClient.callTool({
name: "starknet_invoke_contract",
arguments: {
contractAddress: "0x...",
entrypoint: "approve",
calldata: [spenderAddress, ...uint256Amount],
gasfree: true, // Optional: use paymaster
gasToken: "USDC", // Optional: pay gas in token
}
});
// Execute multiple operations in a single transaction
const { transaction_hash } = await account.execute([
{
contractAddress: tokenA,
entrypoint: "approve",
calldata: CallData.compile({
spender: routerAddress,
amount: cairo.uint256(amount),
}),
},
{
contractAddress: routerAddress,
entrypoint: "swap",
calldata: CallData.compile({ /* swap params */ }),
},
]);
import { getQuotes, executeSwap } from "@avnu/avnu-sdk";
import { PaymasterRpc } from "starknet";
// SDK v4: Use PaymasterRpc from starknet.js
// Mainnet: https://starknet.paymaster.avnu.fi
// Sepolia: https://sepolia.paymaster.avnu.fi
const paymaster = new PaymasterRpc({
nodeUrl: process.env.AVNU_PAYMASTER_URL || "https://starknet.paymaster.avnu.fi",
});
// Any swap can be made gasless by adding paymaster option
const result = await executeSwap({
provider: account,
quote: bestQuote,
slippage: 0.01,
executeApprove: true,
paymaster: {
active: true,
provider: paymaster,
params: {
feeMode: {
mode: "default",
gasToken: usdcAddress, // Pay gas in USDC instead of ETH/STRK
},
},
},
});
The MCP server uses TokenService to resolve token symbols and addresses. Static tokens (ETH, STRK, USDC, USDT) are always available. For other tokens, the service fetches metadata from avnu SDK.
import { fetchTokenByAddress, fetchVerifiedTokenBySymbol } from '@avnu/avnu-sdk';
// Get token by symbol (verified tokens only)
const lords = await fetchVerifiedTokenBySymbol('LORDS');
console.log(lords.address, lords.decimals); // 0x0124aeb..., 18
// Get token by address (any token)
const token = await fetchTokenByAddress('0x...');
console.log(token.symbol, token.name, token.decimals);
// Get all verified tokens
import { fetchTokens } from '@avnu/avnu-sdk';
const page = await fetchTokens({ tags: ['Verified'], size: 100 });
page.content.forEach(t => console.log(t.symbol, t.address));
Static tokens available without network calls: ETH, STRK, USDC, USDT
Session keys allow agents to execute pre-approved transactions without per-action human approval:
Reference implementation: Cartridge Controller
| Variable | Purpose | Default |
|----------|---------|---------|
| STARKNET_RPC_URL | Starknet JSON-RPC endpoint | Required |
| STARKNET_ACCOUNT_ADDRESS | Agent's account address | Required |
| STARKNET_PRIVATE_KEY | Agent's signing key | Required |
| AVNU_BASE_URL | avnu API base URL | https://starknet.api.avnu.fi |
| AVNU_PAYMASTER_URL | avnu paymaster URL | https://starknet.paymaster.avnu.fi |
| Error | Cause | Resolution |
|-------|-------|------------|
| INSUFFICIENT_BALANCE | Not enough tokens | Check balance before transfer |
| INVALID_NONCE | Nonce mismatch | Retry with fresh nonce |
| TRANSACTION_REVERTED | Contract execution failed | Check calldata and allowances |
| FEE_TRANSFER_FAILURE | Can't pay gas fee | Use paymaster or add ETH/STRK |
Build professional financial services data packs from various sources including CIMs, offering memorandums, SEC filings, web search, or MCP servers. Extract, normalize, and standardize financial data into investment committee-ready Excel workbooks with consistent structure, proper formatting, and documented assumptions. Use for M&A due diligence, private equity analysis, investment committee materials, and standardizing financial reporting across portfolio companies. Do not use for simple financial calculations or working with already-completed data packs.
| Skill that analyzes 18-month scenarios from a news headline. Runs the primary analysis with the scenario-analyst agent and obtains a second opinion with the strategy-reviewer agent. Generates a comprehensive English report covering 1st/2nd/3rd-order impacts, recommended stocks, and a critical review. medium-to-long-term investment strategy
Analyze skill library to identify coverage gaps, redundant overlaps, optimization opportunities, and provide recommendations for skill portfolio improvement
> Use this skill when the user is doing hands-on DOCA SHA programming — offloading SHA-1, SHA-256, or SHA-512 hashing onto a BlueField DPU or ConnectX accelerator, picking between one-shot `doca_sha_task_hash` and incremental `doca_sha_task_partial_hash`, querying `doca_sha_cap_*` for algorithm support and min destination / max source buffer sizes, setting source / destination `doca_mmap` permissions, or decoding DOCA_ERROR_* returns from the SHA API. Trigger even when the user does not explicitly mention "DOCA SHA" or "doca_sha_task" — typical implicit phrasings include "hash a multi-GiB file on the DPU", "offload SHA-256 to the BlueField", "streaming hash over chunks", "partial hash returns BAD_STATE", "destination buffer too small for digest", or "is SHA-512 available on this card". Refuse and route elsewhere for general cryptographic-hash theory (collision resistance, SHA-3 selection), other DOCA crypto libraries (AES-GCM, Compress, DMA), or DOCA install / BFB bring-up — those belong to other skills.
Agent skill for agentic-payments - invoke with $agent-agentic-payments
>- Onchain OS onboarding and guide hub for first-time use, product introductions, OKX.AI, and customer-support intents. Classifies requests and routes them through the Intent Routing table. Use for questions about what Onchain OS is, what it can do, getting started, tutorials, onboarding, first-time setup, and introductions; for OKX.AI explanations and role-registration routing across User, ASP, and Evaluator roles, including spelling and language variants; and for Help Center, customer service, complaints, feedback, bug reports, FAQs, or user-guide requests. Do not use for direct on-chain actions such as swaps, wallet, balance, or token operations, or for Agent task lifecycle actions such as publish, accept, deliver, or dispute; those have dedicated skills.
> Analyze a blockchain transaction by its hash using TRES Finance MCP and generate a visual flow diagram showing all asset movements, followed by a plain-language explanation of what happened. Use this skill whenever the user provides a transaction hash and asks to "analyze", "explain", "visualize", "diagram", "show me what happened in", or "tell the story of" a transaction. Also trigger when the user pastes a tx hash (long hex string starting with 0x) and asks anything about it. Always use this skill for transaction hash analysis — do not attempt to answer from memory alone.
Tracks LLM token consumption and usage metrics for billing, monitoring, and optimization. Use this to log token usage, calculate costs, generate invoices, and understand which agents or users consume the most resources.
Take internet-court/starknet-wallet from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.