Starkzap Sdk 标志

Starkzap Sdk

组织
keep-starknet-strange
starkzap-sdk

Reference for integrating or maintaining applications built with keep-starknet-strange/starkzap, including StarkSDK setup, onboarding, wallet lifecycle, sponsored transactions, ERC20 flows, staking, and transaction builder usage.

概览

发布者keep-starknet-strange
代码仓库starknet-agentic
技能名称starkzap-sdk
星标数
81
复刻数
26
附带文件
8
许可协议Apache-2.0
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 8 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 keep-starknet-strange 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Starkzap Sdk AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/keep-starknet-strange/starknet-agentic/tree/main/skills/starkzap-sdk
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/keep-starknet-strange/starknet-agentic.git /tmp/starknet-agentic
mkdir -p .claude/skills
cp -r /tmp/starknet-agentic/skills/starkzap-sdk .claude/skills/starkzap-sdk
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Starkzap Sdk,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Starkzap Sdk。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Starkzap Sdk 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Starkzap SDK

Project-focused guide for https://github.com/keep-starknet-strange/starkzap.

Use this skill when requests involve Starkzap SDK code, examples, or docs.

When to Use

Trigger for tasks like:

  • "Add a new onboarding flow in Starkzap"
  • "Fix sponsored transaction behavior in wallet.execute"
  • "Update staking pool logic or validator presets"
  • "Patch Privy signer/server integration"
  • "Review Starkzap tests/docs/examples"

When NOT to Use

  • Generic Starknet SDK work outside the Starkzap codebase.
  • Cairo contract authoring, deployment operations, or security audits.

Quick Start

  1. Open the target Starkzap repository paths below and choose the smallest workflow surface first.
  2. Use skills catalog when the task crosses into generic Starknet wallet, deployment, or audit flows.

Repository Map

Primary implementation:

  • src/sdk.ts - top-level orchestration (StarkSDK)
  • src/wallet/* - wallet implementations and lifecycle
  • src/signer/* - StarkSigner, PrivySigner, signer adapter
  • src/tx/* - Tx and TxBuilder
  • src/erc20/* - token helpers, balance/transfer logic
  • src/staking/* - staking operations and pool discovery
  • src/types/* - shared domain types (Address, Amount, config)

Operational and docs:

  • tests/* and tests/integration/*
  • examples/web, examples/server, examples/mobile, examples/flappy-bird
  • scripts/* for generated artifacts in the Starkzap repo
  • docs/* and mintlify-docs/*

Skill resources:

  • skills/starkzap-sdk/references/signer-integration.md - signer trust boundaries and auth assumptions
  • skills/starkzap-sdk/references/sponsored-transactions.md - paymaster flow and fee mode behavior
  • skills/starkzap-sdk/references/erc20-helpers.md - Amount semantics and transfer patterns
  • skills/starkzap-sdk/references/staking-reliability.md - pool discovery and timeout/abort safety
  • skills/starkzap-sdk/scripts/wallet-execute-example.ts - wallet readiness and execute flow
  • skills/starkzap-sdk/scripts/staking-pool-discovery.ts - staking pool discovery and diagnostics

Quick Reference

Common starknet.js patterns (provider/account/call/execute/listen):

typescript
import { Account, Contract, RpcProvider } from "starknet";

const provider = await RpcProvider.create({
  nodeUrl: process.env.RPC_URL!,
});

const account = new Account({
  provider,
  address: process.env.ACCOUNT_ADDRESS!,
  signer: process.env.PRIVATE_KEY!,
  cairoVersion: "1",
});

const contract = new Contract({
  abi,
  address: process.env.CONTRACT_ADDRESS!,
  providerOrAccount: account,
});
await contract.call("balance_of", [account.address]); // read

const tx = await account.execute([
  {
    contractAddress: process.env.CONTRACT_ADDRESS!,
    entrypoint: "do_work",
    calldata: [],
  },
]);
await provider.waitForTransaction(tx.transaction_hash);
typescript
// With Starkzap Tx wrapper
const submitted = await wallet.execute(calls, { feeMode: "user_pays" });
const stop = submitted.watch(
  ({ finality, execution }) => console.log(finality, execution),
  { pollIntervalMs: 5000, timeoutMs: 120000 }
);
// stop(); // call to unsubscribe early

Common error classes and immediate recovery:

Error ClassTypical SignalImmediate Recovery
VALIDATION_ERRORInvalid token decimals, Amount.parse(...) failureRe-check token decimals/symbol, parse from known token preset, avoid mixing token types.
UNDEPLOYED_ACCOUNTAccount is not deployed on wallet.execute(...)Run wallet.ensureReady({ deploy: "if_needed" }) before user_pays writes.
RPC_OR_NETWORKtimeout, 429, provider mismatchRetry with backoff, confirm rpcUrl and chainId, switch to stable RPC for production.
TX_REVERTEDpreflight.ok === false or reverted receiptRun wallet.preflight({ calls }), inspect reason, reduce batch size, verify call ordering.
AUTH_OR_PERMISSIONPrivy 401/403, invalid signature responseVerify signer server auth, headers/body resolver, and trusted serverUrl.

See also:

  • skills/starkzap-sdk/references/* for implementation-specific troubleshooting
  • skills/starkzap-sdk/scripts/* for runnable diagnostic examples

Core Workflows

1) Configure StarkSDK and Connect Wallets

Common API path:

  1. Instantiate StarkSDK with network or rpcUrl + chainId.
  2. Use sdk.onboard(...) or sdk.connectWallet(...).
  3. Call wallet.ensureReady({ deploy: "if_needed" }) before user-pays writes.

Supported onboarding strategies:

  • OnboardStrategy.Signer
  • OnboardStrategy.Privy
  • OnboardStrategy.Cartridge

For Cartridge:

  • Treat as web-only runtime.
  • Expect popup/session behavior and policy scoping requirements.
typescript
import {
  ChainId,
  OnboardStrategy,
  StarkSDK,
  StarkSigner,
} from "starkzap";

const sdk = new StarkSDK({ network: "sepolia" });

const customSdk = new StarkSDK({
  rpcUrl: process.env.RPC_URL!,
  chainId: ChainId.SEPOLIA,
});

const signerResult = await sdk.onboard({
  strategy: OnboardStrategy.Signer,
  account: { signer: new StarkSigner(process.env.PRIVATE_KEY!) },
  feeMode: "user_pays",
  deploy: "if_needed",
});

const privyResult = await sdk.onboard({
  strategy: OnboardStrategy.Privy,
  privy: {
    resolve: async () => ({
      walletId: process.env.PRIVY_WALLET_ID!,
      publicKey: process.env.PRIVY_PUBLIC_KEY!,
      serverUrl: process.env.PRIVY_SIGNER_URL!,
    }),
  },
  feeMode: "sponsored",
});

const cartridgeResult = await sdk.onboard({
  strategy: OnboardStrategy.Cartridge,
  cartridge: {
    preset: "controller",
    policies: [{ target: "0xPOOL", method: "stake" }],
  },
});

const wallet = await sdk.connectWallet({
  account: { signer: new StarkSigner(process.env.PRIVATE_KEY!) },
  feeMode: "sponsored",
});

await wallet.ensureReady({ deploy: "if_needed" });

2) Execute Transactions (wallet.execute, wallet.preflight, wallet.tx)

Use:

  • wallet.execute(calls, options) for direct execution.
  • wallet.preflight({ calls, feeMode }) for simulation checks.
  • wallet.tx() (TxBuilder) for batched operations with deterministic ordering.
typescript
const calls = [
  {
    contractAddress: process.env.CONTRACT_ADDRESS!,
    entrypoint: "do_work",
    calldata: [],
  },
];

const preflight = await wallet.preflight({
  calls,
  feeMode: "user_pays",
});
if (!preflight.ok) {
  throw new Error(`Preflight failed: ${preflight.reason}`);
}

const userPaysTx = await wallet.execute(calls, { feeMode: "user_pays" });
await userPaysTx.wait();

const sponsoredTx = await wallet.execute(calls, { feeMode: "sponsored" });
await sponsoredTx.wait();

const batchedTx = await wallet
  .tx()
  .add(...calls)
  .send({ feeMode: "sponsored" });
await batchedTx.wait();
typescript
function getSdkErrorClass(error: unknown): string {
  const message = error instanceof Error ? error.message : String(error);
  if (message.includes("not deployed")) return "UNDEPLOYED_ACCOUNT";
  if (message.includes("timed out") || message.includes("429")) {
    return "RPC_OR_NETWORK";
  }
  if (message.includes("signature") || message.includes("Privy")) {
    return "AUTH_OR_PERMISSION";
  }
  if (message.includes("Invalid") || message.includes("Amount")) {
    return "VALIDATION_ERROR";
  }
  return "UNKNOWN";
}

try {
  await wallet.execute(calls, { feeMode: "user_pays" });
} catch (error) {
  const kind = getSdkErrorClass(error);
  if (kind === "UNDEPLOYED_ACCOUNT") {
    await wallet.ensureReady({ deploy: "if_needed" });
  }
  throw error;
}

When changing execution behavior:

  • Audit deploy vs execute path for undeployed accounts.
  • Verify runtime constraints (OnboardStrategy.Cartridge is web-only).
  • Cover both user_pays and sponsored branches in tests.

3) ERC20 and Staking Scope

ERC20 notes (starkzap-sdk internal token operations, no avnu required):

  • Validate Amount with the token preset used for the call.
  • Keep multicall ordering explicit for batched transfers.
typescript
import { Amount } from "starkzap";

const usdcAmount = Amount.parse("25", USDC);

try {
  const tx = await wallet
    .tx()
    .transfer(USDC, [
      { to: recipientA, amount: usdcAmount },
      { to: recipientB, amount: Amount.parse("5", USDC) },
    ])
    .send({ feeMode: "user_pays" });
  await tx.wait();
} catch (error) {
  // Re-parse Amount from the expected token preset before retrying.
  throw error;
}

Staking notes (starkzap-specific staking flows):

  • Membership-sensitive operations: enter, add, exit intent, exit.
  • Validate staking config and chain presets before execution.
  • Verify timeout/abort behavior where pool resolution is involved.

For general DeFi operations (swaps, DCA, lending) and STRK staking via the avnu aggregator, use the starknet-defi skill.

4) Examples + Integration Surfaces

Check for drift between:

  • examples/web/main.ts
  • examples/server/server.ts
  • README and docs links

Specifically verify endpoint and auth consistency for Privy + paymaster proxy flows.

Guardrails

Do not hand-edit generated files:

  • src/erc20/token/presets.ts
  • src/erc20/token/presets.sepolia.ts
  • src/staking/validator/presets.ts
  • src/staking/validator/presets.sepolia.ts
  • docs/api/**
  • docs/export/**

Regenerate with scripts:

bash
npm run generate:tokens
npm run generate:tokens:sepolia
npm run generate:validators
npm run generate:validators:sepolia
npm run docs:api
npm run docs:export

Keep API export changes explicit:

  • If new public API is added/removed, update src/index.ts.

Validation Checklist

Run minimal set first:

bash
npm run typecheck
npm test

Run broader checks when behavior is cross-cutting:

bash
npm run build
npm run test:all

Integration tests may require local devnet/fork setup:

bash
npm run test:integration

If not run, clearly report why.

Error Codes & Recovery

Map observed errors to actionable recovery:

Error ClassTypical TriggerRecovery Steps
VALIDATION_ERRORAmount.parse(...)/token mismatch, malformed address, invalid configConfirm token decimals/symbol, re-create Amount from known token presets, validate config against src/types/* and src/sdk.ts.
RPC_OR_NETWORKRPC timeout, 429, transient JSON-RPC failures, chain mismatchRetry with exponential backoff, check rpcUrl/chainId, verify provider health, reduce batch size for retries.
TX_REVERTEDwallet.preflight(...) fails or receipt is revertedRun wallet.preflight({ calls, feeMode }) first, inspect revert reason, reorder calls in wallet.tx(), split large multicalls.
RATE_LIMIT_OR_TIMEOUTtx.watch timeout, stalled polling, pool resolution timeoutIncrease timeout where appropriate, add abort handling, retry on fresh provider session, avoid parallel heavy queries.
AUTH_OR_PERMISSIONPrivy signing errors, 401/403, invalid signature payloadsVerify signer server auth headers/body, validate trusted serverUrl, check examples/server/server.ts auth middleware alignment.
UNDEPLOYED_ACCOUNTwallet.execute(..., { feeMode: "user_pays" }) on undeployed accountRun wallet.ensureReady({ deploy: "if_needed" }), then retry execution; use sponsored mode only when paymaster path is configured.
GENERATED_ASSET_DRIFTPreset/docs changes diverge from source of truthRegenerate via npm run generate:tokens, npm run generate:tokens:sepolia, npm run generate:validators, npm run generate:validators:sepolia, npm run docs:api, npm run docs:export.

If a fix is uncertain:

  • Reproduce with the closest example in examples/*.
  • Capture command, environment, and failing test IDs.
  • Report exact file/path + remediation attempted.

Useful Task Patterns

  • Bug fix in wallet lifecycle:

    • inspect src/wallet/index.ts, src/wallet/utils.ts
    • patch
    • update tests/wallet*.test.ts
  • Privy auth/signature issue:

    • inspect src/signer/privy.ts
    • align with examples/server/server.ts
    • update tests/privy-signer.test.ts
  • Staking regression:

    • inspect src/staking/staking.ts, src/staking/presets.ts
    • add/adjust integration assertions in tests/integration/staking.test.ts

Example Prompt

"Use this skill to fix Starkzap sponsored execution for undeployed accounts, add tests, and list behavior changes."

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Starkzap Sdk AI 技能有什么作用?

Reference for integrating or maintaining applications built with keep-starknet-strange/starkzap, including StarkSDK setup, onboarding, wallet lifecycle, sponsored transactions, ERC20 flows, staking, and transaction builder usage.

为什么在 TypingMind 中使用 Starkzap Sdk?

因为您只需安装一次,就能搭配任何模型使用。Starkzap Sdk 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Starkzap Sdk?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/keep-starknet-strange/starknet-agentic/tree/main/skills/starkzap-sdk。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Starkzap Sdk?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Starkzap Sdk 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Starkzap Sdk 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Starkzap Sdk AI 技能免费吗?

是的。keep-starknet-strange 已在 GitHub 上根据 Apache-2.0 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇