Skip to main content

Overview

warning

This page is purely demonstrative and does not reflect live or production functionality.
The features described here are not yet implemented and should not be considered available.

The Owney SDK is a TypeScript Library that allows you to integrate DeFi Agents into your application easily.

The SDK abstracts:

  • Wallet connection
  • Smart wallet deployment
  • Session key management
  • Strategy selection
  • Agent execution
  • Portfolio & earnings tracking

Currently supported agents:

  • Zyfai

Installation

npm install @owney/sdk

Initialization

Create a new SDK instance using your API keys.

import { OwneySDK } from "@owney/sdk";

const sdk = new OwneySDK({
apiKeys: {
zyfai: "YOUR_ZYFAI_API_KEY",
},
});

Activating an Agent

Activates an agent and deposits initial funds.

import { AgentsEnum } from "@owney/sdk";

await sdk.activateAgent(AgentsEnum.ZYFAI, {
provider,
chainId: 8453,
strategy: "aggressive",
amount: "1000",
});

Parameters

FieldTypeDescription
providerEIP-1193 ProviderWallet provider
chainIdSupportedChainIdBlockchain network
strategyStrategyconservative | ambitious | aggressive
amountstringDeposit amount in USDC

Depositing Additional Funds

await sdk.depositFunds(AgentsEnum.ZYFAI, {
provider,
chainId: 8453,
strategy: "aggressive",
amount: "500",
});

Withdrawing Funds

await sdk.withdraw(AgentsEnum.ZYFAI, {
provider,
chainId: 8453,
strategy: "aggressive",
amount: "200",
});

Portfolio & Positions

Retrieve current user positions:

const positions = await sdk.getPositions(AgentsEnum.ZYFAI, {
provider,
chainId: 8453,
strategy: "aggressive",
});

Earnings

Total On-Chain Earnings

const earnings = await sdk.getEarnings(
AgentsEnum.ZYFAI,
provider,
8453
);

Daily Earnings

const daily = await sdk.getDailyEarnings(
AgentsEnum.ZYFAI,
provider,
{
chainId: 8453,
startDate: "2025-01-01",
endDate: "2025-01-30",
}
);

Daily APY History

const apy = await sdk.getDailyApyHistory(
AgentsEnum.ZYFAI,
provider,
8453,
30
);

Transaction History

const history = await sdk.getHistory(
AgentsEnum.ZYFAI,
provider,
8453,
{
limit: 20,
offset: 0,
}
);

User Profile

Get User Details

const user = await sdk.getUserDetails(
AgentsEnum.ZYFAI,
provider,
8453
);

Update Strategy

await sdk.updateUserProfile(
AgentsEnum.ZYFAI,
provider,
8453,
"conservative"
);

Pause Agent

Pauses automated operations by clearing protocol allocations.

await sdk.pauseAgent(
AgentsEnum.ZYFAI,
provider,
8453
);

Available Protocols

const protocols = await sdk.getAvailableProtocols(
AgentsEnum.ZYFAI,
8453
);

Strategy APY

const apy = await sdk.getApyByStrategyAndAgent(
AgentsEnum.ZYFAI,
"aggressive",
30
);

Aggressive Opportunities

const opportunities = await sdk.getAggressiveOpportunities(
AgentsEnum.ZYFAI,
8453
);

Agent Allocation

const allocation = await sdk.getAgentAllocation();

Returns:

{
zyfai: 100,
sail: 0
}

Error Handling

All methods throw if:

  • The agent type is unsupported
  • Wallet connection fails
  • On-chain execution fails

Example:

try {
await sdk.activateAgent(...);
} catch (error) {
console.error("Activation failed:", error);
}

Architecture Overview

The SDK:

  1. Connects wallet
  2. Ensures smart wallet deployment
  3. Creates session keys
  4. Routes execution to the correct agent
  5. Disconnects wallet safely

This ensures:

  • Safe execution
  • Clean wallet lifecycle
  • Agent abstraction for multi-agent support

Next Steps

  • Read the Strategy Guide
  • Explore Agent-Specific Documentation
  • Integrate into your frontend or backend service