Pool customization
Pool customization lets users choose which pools an agent may use for an asset.
The workflow has three parts:
- Load the available pools with
getPoolCatalog. - Restore the user's saved choices with
getPoolSelection. - Save new choices with
setPoolSelectionbefore depositing.
Without a saved pool selection for a protocol and chain, the agent uses its default pool selection. Saving pool names creates an explicit selection; saving an empty selection means none of the displayed pools are selected.
getPoolCatalog
Returns the selectable pools for an asset, grouped by protocol.
- Signature
- Example
getPoolCatalog(params: {
asset: OwneySupportedTokens;
strategy: "conservative" | "aggressive" | "yieldmaxxing";
agentId?: AgentId;
}): Promise<PoolCatalogProtocol[]>
const catalog = await owney.getPoolCatalog({
asset: "USDC",
strategy: "aggressive",
agentId,
});
Parameters
asset- Asset whose pools should be returned.strategy- Strategy used to load the available pool catalogue.agentId- Optional target agent.
Each PoolCatalogProtocol contains the protocol name, optional logo, and its AvailablePool entries. A pool includes its chain, asset, name, APY, TVL in USD, and optional link.
If one protocol cannot provide pools, it is omitted without discarding the rest of the catalogue.
getPoolSelection
Returns the pool selections and asset strategies currently saved for the requested protocol/chain pairs.
Requires wallet connection: Yes
- Signature
- Example
getPoolSelection(params: {
pairs: Array<{ protocolId: string; chainId: number }>;
assets: Array<"USDC" | "WETH">;
agentId?: AgentId;
}): Promise<SavedPoolSelection>
const pairs = catalog.flatMap((protocol) =>
[...new Set(protocol.pools.map((pool) => pool.chainId))].map(
(chainId) => ({ protocolId: protocol.protocolId, chainId }),
),
);
const saved = await owney.getPoolSelection({
pairs,
assets: ["USDC"],
agentId,
});
pairsdetermines which protocol/chain selections to read.assetsdetermines which saved asset strategies to read.- A pair omitted from
saved.pairsuses the agent's default pool selection. - A saved pair with an empty
poolsarray means no pools are selected for that protocol and chain.
setPoolSelection
Saves explicit pool selections for the user. Call it before deposit or swapAndDeposit.
Requires wallet connection: Yes
- Signature
- Example
setPoolSelection(params: {
selection: UserPoolSelectionRequest;
agentId?: AgentId;
}): Promise<void>
await owney.setPoolSelection({
agentId,
selection: {
strategies: [{ asset: "USDC", strategy: "aggressive" }],
selections: [
{
asset: "USDC",
protocolId,
chainId,
pools: selectedPoolNames,
availablePools: displayedPoolNames,
},
],
},
});
For each UserPoolSelection:
poolscontains the pool names selected by the user.availablePoolsmust contain every pool shown for the same asset, protocol, and chain—not only the selected pools. The SDK uses the complete list to preserve choices belonging to other assets.- An empty
poolsarray, with a non-emptyavailablePoolsarray, selects none of the displayed pools.
If saving fails, do not start the deposit.