Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions packages/stellar-sdk-helpers/src/orchestration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ describe("resolvePositions", () => {
expect(positions).toEqual([BLEND_USDC]);
});

it("returns Blend positions even when the DeFindex fetch throws", async () => {
it("propagates DeFindex fetch errors to the caller", async () => {
vi.mocked(fetchDefindexPosition).mockRejectedValueOnce(new Error("RPC down"));
const positions = await resolvePositions(WALLET, network, addresses);
expect(positions).toEqual([BLEND_USDC]);
await expect(resolvePositions(WALLET, network, addresses)).rejects.toThrow("RPC down");
});
});
11 changes: 3 additions & 8 deletions packages/stellar-sdk-helpers/src/orchestration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export async function buildDepositTx(

/**
* Fetches all positions for `publicKey` across Blend reserves and (optionally)
* the DeFindex vault. The DeFindex call is isolated — a failure there is logged
* and swallowed so the Blend positions are always returned.
* the DeFindex vault. Errors from either protocol propagate to the caller.
*/
export async function resolvePositions(
publicKey: string,
Expand All @@ -52,12 +51,8 @@ export async function resolvePositions(
]);

if (addresses.defindexVault) {
try {
const dfx = await fetchDefindexPosition(network, addresses.defindexVault, "defindex-usdc", publicKey);
positions.push(...dfx);
} catch (err) {
console.warn("[positions] defindex read failed:", err);
}
const dfx = await fetchDefindexPosition(network, addresses.defindexVault, "defindex-usdc", publicKey);
positions.push(...dfx);
}

return positions;
Expand Down