Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions skills/bitflow-hodlmm-deposit/bitflow-hodlmm-deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,18 @@ async function getBins(poolId: string): Promise<BinsResponse> {
}

async function getUserBins(wallet: string, poolId: string): Promise<Array<{ binId: number; userLiquidity: bigint; price?: string | number }>> {
const response = await fetchJson<UserBinsResponse>(
`${BITFLOW_API}/api/app/v1/users/${wallet}/positions/${poolId}/bins?fresh=true`
);
let response: UserBinsResponse;
try {
response = await fetchJson<UserBinsResponse>(
`${BITFLOW_API}/api/app/v1/users/${wallet}/positions/${poolId}/bins?fresh=true`
);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
if (message.startsWith("HTTP 404 ") && message.includes("has no pool bins")) {
return [];
}
throw error;
}
const bins = Array.isArray(response.bins) ? response.bins : [];
return bins
.map((bin) => ({
Expand Down
Loading