Skip to content

fix(api): resolve multiple documentation and type inconsistencies - #571

Open
leonschh wants to merge 1 commit into
lifinance:mainfrom
leonschh:patch-1
Open

fix(api): resolve multiple documentation and type inconsistencies#571
leonschh wants to merge 1 commit into
lifinance:mainfrom
leonschh:patch-1

Conversation

@leonschh

@leonschh leonschh commented Sep 2, 2026

Copy link
Copy Markdown

Which Linear task is linked to this PR?

This PR was written during a project review.

Why was it implemented this way?

Four independent issues fixed in one PR since all changes are in the same file (src/api.ts):

  • containsSwitchChain (Line ~351)
    Why: The comment // Features required for route execution was semantically incorrect - the field is a boolean flag indicating chain switches, not a feature list
    Chosen: Updated to accurately describe the field's purpose

  • @deprecated annotation (Line ~591)
    Why: Block comments /* */ are not recognized by TypeScript/IDE tooling; only JSDoc /** */ triggers deprecation warnings
    Chosen: Converted to proper JSDoc format, consistent with other deprecated types in the file

  • INVALID status comment (Line ~673)
    Why: The comment // A third party service is not available contradicts official LI.FI documentation where INVALID means "Hash is not tied to the requested tool"
    Chosen: Updated to match official docs

  • RelayStatusRequest.taskId type (Lines ~1094)
    Why: RelayResponseData.taskId returns a string (UUID), but RelayStatusRequest.taskId expected Hash (0x${string}), causing type errors when passing taskId from response to status request
    Chosen: Changed RelayStatusRequest.taskId to string - widens the type safely (Hash is subset of string) and enables type-safe usage without as Hash assertions

All changes are backward compatible and maintain the same runtime behavior.

## Summary
Fixed multiple documentation and type inconsistencies in `api.ts` that affect developer experience, type safety, and code maintainability. All changes are **backward compatible** and do not affect runtime behavior.

---

## Changes

### 1. Fix misleading comment for `containsSwitchChain` (Line ~351)
**Before:** `// Features required for route execution`
**After:** `// Whether the route contains a chain switch during execution`

**Why:** The comment had no relation to the actual boolean flag semantics. This field indicates whether the route requires switching chains (multiple signatures), not a list of features.

### 2. Fix broken `@deprecated` annotation (Line ~675)
**Before:** `/* @deprecated */`
**After:**
```typescript
/**
 * @deprecated ContractCallQuoteRequest is deprecated and will be removed in future versions.
 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant