返回 Skill 市集

Trading Automation

zyfai

Zyfai turns any Ethereum EOA into a yield-generating account by deploying a deterministic Safe smart-wallet subaccount that is owned and withdrawable only by the user's EOA.

45 天前更新1 分鐘內設定完

總覽

Zyfai turns any Ethereum EOA into a yield-generating account by deploying a deterministic Safe smart-wallet subaccount that is owned and withdrawable only by the user's EOA.

Zyfai turns any Ethereum EOA into a yield-generating account by deploying a deterministic Safe smart-wallet subaccount that is owned and withdrawable only by the user's EOA. It automatically optimizes deposited funds across DeFi protocols and performs auto-rebalancing using session keys that enable automation but cannot withdraw to arbitrary addresses. Key features include non-custodial deterministic subaccounts (same EOA yields the same subaccount across Base, Arbitrum, and Plasma), automated yield optimization, instant deposit/withdraw flow, and programmatic API-key creation for agent-native integrations. Use cases include wallet providers, agents, and backend services that want to offer passive DeFi yield without custody, as well as developers integrating via the Node.js SDK (Node 18+, npm install @zyfai/sdk viem). Core value: secure, automated, and permissioned yield for any wallet.

Skill.md

這個 Skill 如何運作

Zyfai turns any Ethereum EOA into a yield-generating account by deploying a deterministic Safe smart-wallet subaccount that is owned and withdrawable only by the user's EOA.

SKILL.mdALPHIO / 已驗證

Zyfai — Yield for Any Wallet

Turn any Ethereum wallet into a yield-generating account.

What This Does

When a user wants to earn yield on their crypto, Zyfai creates a deterministic subaccount (Safe smart wallet) linked to their existing wallet (EOA). Funds deposited into this subaccount are automatically optimized across DeFi protocols. The user stays in full control and can withdraw anytime.

┌─────────────────┐      ┌──────────────────────┐
│   User's EOA    │ ───► │  Zyfai Subaccount    │
│  (their wallet) │      │  (Safe smart wallet) │
│                 │      │                      │
│  Owns & controls│      │  • Auto-rebalancing  │
│                 │      │  • Yield optimization│
│                 │      │  • Non-custodial     │
└─────────────────┘      └──────────────────────┘

Key points:

  • The subaccount is owned by the user's EOA — only they can withdraw
  • Session keys allow automated rebalancing but cannot withdraw to other addresses
  • Same EOA = same subaccount address across all chains

The Flow

1. DEPLOY    →  Create a deterministic subaccount linked to user's wallet
2. SESSION   →  Enable automated yield optimization  
3. DEPOSIT   →  Send funds to subaccount (starts earning)
4. WITHDRAW  →  Pull funds back to wallet (anytime)

Prerequisites

  • API Key — Get one programmatically (see below) or manually at sdk.zyf.ai
  • Wallet Connection — Either a wallet provider (browser) or secure key management (server)
  • Node.js 18+
npm install @zyfai/sdk viem

Programmatic API Key Creation (Agent-Native)

Agents can create their own API key without human intervention. You need the wallet address (public key) of the agent.

POST https://sdk.zyf.ai/api/sdk-api-keys/create
Content-Type: application/json

{
  "clientName": "my-agent",
  "walletAddress": "0x...",
  "email": "[email protected]"
}

Response:

{
  "success": true,
  "message": "SDK API key created successfully. Store the apiKey securely - it cannot be retrieved later!",
  "data": {
    "id": "936...",
    "apiKey": "zyfai_361ad41d083c2fe.....",
    "keyPrefix": "zyfai_361ad4",
    "clientName": "my-agent",
    "ownerWalletAddress": "0x..."
  }
}

Important: Store the apiKey securely — it cannot be retrieved later. The key is linked to the provided wallet address.

Supported Chains

ChainID
Arbitrum42161
Base8453
Plasma9745

Important: Always Use EOA Address

When calling SDK methods, always pass the EOA address (the user's wallet address) as userAddress — never the subaccount/Safe address. The SDK derives the subaccount address automatically from the EOA.

Wallet Connection Options

The SDK supports multiple ways to connect a wallet. Choose based on your security requirements and deployment context.

Option 1: Wallet Provider (Recommended for Browser/dApps)

Use an injected wallet provider like MetaMask. The private key never leaves the user's wallet.

import { ZyfaiSDK } from "@zyfai/sdk";

const sdk = new ZyfaiSDK({ apiKey: "your-api-key", referralSource: "openclaw-skill" });

// Connect using injected wallet provider (MetaMask, WalletConnect, etc.)
await sdk.connectAccount(window.ethereum, 8453);

Security: The private key stays in the user's wallet. The SDK only requests signatures when needed.

Option 2: Viem WalletClient (Recommended for Server Agents)

Use a pre-configured viem WalletClient. This is the recommended approach for server-side agents as it allows integration with secure key management solutions.

import { ZyfaiSDK } from "@zyfai/sdk";
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

// Create wallet client with your preferred key management
// Option A: From environment variable (simple but requires secure env management)
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);

// Option B: From KMS (AWS, GCP, etc.) - recommended for production
// const account = await getAccountFromKMS();

// Option C: From Wallet-as-a-Service (Turnkey, Privy, etc.)
// const account = await turnkeyClient.getAccount();

const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(),
});

const sdk = new ZyfaiSDK({ apiKey: "your-api-key", referralSource: "openclaw-skill" });

// Connect using the WalletClient
await sdk.connectAccount(walletClient, 8453);

Security: The WalletClient abstraction allows you to integrate with secure key management solutions like:

  • AWS KMS / GCP Cloud KMS — Hardware-backed key storage
  • Turnkey / Privy / Dynamic — Wallet-as-a-Service providers
  • Hardware wallets — Via WalletConnect or similar

Option 3: Private Key String (Development Only)

Direct private key usage.

import { ZyfaiSDK } from "@zyfai/sdk";

const sdk = new ZyfaiSDK({ apiKey: "your-api-key", referralSource: "openclaw-skill" });

// WARNING: Only use for development. Never hardcode private keys in production.
await sdk.connectAccount(process.env.PRIVATE_KEY, 8453);

Security Warning: Raw private keys in environment variables are a security risk. For production autonomous agents, use Option 2 with a proper key management solution.

Security Comparison

MethodSecurity LevelUse Case
Wallet ProviderHighBrowser dApps, user-facing apps
WalletClient + KMSHighProduction server agents
WalletClient + WaaSHighProduction server agents
Private Key StringLowDevelopment/testing only

Step-by-Step

1. Connect to Zyfai

import { ZyfaiSDK } from "@zyfai/sdk";
import { createWalletClient, http } from "viem";
import { base } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

const sdk = new ZyfaiSDK({ apiKey: "your-api-key", referralSource: "openclaw-skill" });

// For browser: use wallet provider
await sdk.connectAccount(window.ethereum, 8453);

// For server: use WalletClient (see Wallet Connection Options above)
const walletClient = createWalletClient({
  account: privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
  chain: base,
  transport: http(),
});
await sdk.connectAccount(walletClient, 8453);

2. Deploy Subaccount

const userAddress = "0x..."; // User's EOA (NOT the subaccount address!)
const chainId = 8453; // Base

// Check if subaccount exists
const wallet = await sdk.getSmartWalletAddress(userAddress, chainId);
console.log(`Subaccount: ${wallet.address}`);
console.log(`Deployed: ${wallet.isDeployed}`);

// Deploy if needed
if (!wallet.isDeployed) {
  const result = await sdk.deploySafe(userAddress, chainId, "conservative");
  console.log("Subaccount deployed:", result.safeAddress);
}

Strategies:

  • "conservative" — Stable yield, lower risk
  • "aggressive" — Higher yield, higher risk

3. Enable Yield Optimization

await sdk.createSessionKey(userAddress, chainId);

// Always verify the session key was activated
const user = await sdk.getUserDetails();
if (!user.hasActiveSessionKey) {
  // Session key not active — retry the process
  console.log("Session key not active, retrying...");
  await sdk.createSessionKey(userAddress, chainId);
  
  // Verify again
  const userRetry = await sdk.getUserDetails();
  if (!userRetry.hasActiveSessionKey) {
    throw new Error("Session key activation failed after retry. Contact support.");
  }
}
console.log("Session key active:", user.hasActiveSessionKey);

This allows Zyfai to rebalance funds automatically. Session keys cannot withdraw to arbitrary addresses — only optimize within the protocol.

最適合用於

何時使用

Zyfai turns any Ethereum EOA into a yield-generating account by deploying a deterministic Safe smart-wallet subaccount that is owned and withdrawable only by the user's EOA.

01 · 會前準備

準備決策簡報

在投資委員會開會前,把零散證據整理成結構化的論據。

02 · 團隊協作

統一交接標準

讓分析師、投資組合經理與 Agent 產出一致的研究結果。

03 · 即時更新

更新投資邏輯

出現新催化劑、KPI 發布或財報結果後,更新情境假設。

社群回饋

越用越好用。

隨著 Skill 被使用與評審,回饋將顯示在這裡。

提交回饋

探索更多

相關 Skills

查看全部
免費開始