Skip to content

fix(sdk): remove unreachable baseUrl guard in LilySdk.create (#441) - #554

Merged
David-patrick-chuks-02 merged 8 commits into
Lilly-Protocol:mainfrom
Zhiyilang074811:fix/issue-441-dead-baseurl-guard
Sep 6, 2026
Merged

fix(sdk): remove unreachable baseUrl guard in LilySdk.create (#441)#554
David-patrick-chuks-02 merged 8 commits into
Lilly-Protocol:mainfrom
Zhiyilang074811:fix/issue-441-dead-baseurl-guard

Conversation

@Zhiyilang074811

Copy link
Copy Markdown
Contributor

What changed

Removed the dead \if (!baseUrl)\ throw in \LilySdk.create()\ since \DEFAULT_API_URL\ always provides a fallback, making the guard unreachable.

Fix

  • Removed unreachable error throw block
  • Updated JSDoc to document actual precedence: options > LILY_API_URL > LILY_BASE_URL > DEFAULT_API_URL
  • Added test verifying create() never throws for missing baseUrl
  • Added test for LILY_API_URL precedence over LILY_BASE_URL

Closes #441

…col#487 Lilly-Protocol#485 — client ID validation, non-2xx JSON errors, shared defaults, baseUrl fallback

- agent/wallet/payment clients: reject empty/whitespace IDs via validateNonEmptyString (Closes Lilly-Protocol#443, bounty Lilly-Protocol#489 )
- fetch-http-client: read body once as text then JSON.parse; throw LilyApiError (not ValidationError) on non-2xx JSON parse failures (Closes Lilly-Protocol#445, bounty Lilly-Protocol#488 )
- src/config/defaults.ts: new file with DEFAULT_TIMEOUT_MS, DEFAULT_RETRY_POLICY, DEFAULT_RETRYABLE_STATUS_CODES (bounty Lilly-Protocol#487 )
- resolve-config.ts: import from defaults; support LILY_BASE_URL env fallback alongside LILY_API_URL (Closes Lilly-Protocol#444, bounty Lilly-Protocol#485 )
- config.ts: export shared defaults
- Add tests: client-id-validation, shared-defaults, updated fetch-non-json tests
…-Protocol#446)

- Add validation block in createFetchHttpClient to reject negative,
  NaN, and Infinity timeoutMs values before the request loop starts
- Import LilyConfigError from sdk-error
- Add 4 test cases: negative, NaN, Infinity rejection + valid value pass
- Fixes Lilly-Protocol#446 (Bounty: )

Wallet: 3rb3NNaU5foZFvVk4faVuMmqMvoxfADW3Xw5Wv5vfZr6
- Add a new 'docs' job that builds typedoc API docs on every PR
- Fails CI if docs/api/ has uncommitted changes
- Closes Lilly-Protocol#435 (Bounty: )

Wallet: 3rb3NNaU5foZFvVk4faVuMmqMvoxfADW3Xw5Wv5vfZr6
…R_CODES (Lilly-Protocol#447)

- Add CANCELLED and RESPONSE_VALIDATION_ERROR entries to LILY_ERROR_CODES
- Replace literal string codes in fetch-http-client.ts with constant references
- Add tests verifying constant usage for abort and JSON parse failures
- Updates error-tojson test to assert new constants exist

Closes Lilly-Protocol#447 (Bounty: )

Wallet: 3rb3NNaU5foZFvVk4faVuMmqMvoxfADW3Xw5Wv5vfZr6
…Protocol#442)

- Pass this.httpClient to new LilySdk instance in withConfig
- Adds test verifying custom HttpClient is shared between parent and child

Closes Lilly-Protocol#442 (Bounty: )

Wallet: 3rb3NNaU5foZFvVk4faVuMmqMvoxfADW3Xw5Wv5vfZr6
…lly-Protocol#403)

- Change fetchPage signature to return CursorPage<T> instead of readonly T[]
- Feed nextCursor from response back through buildPaginationQuery
- Stop when hasMore is false or cursor is null instead of relying on item count
- Add tests for cursor advancement and no-duplicate-pages behavior
- Fix unused vi import in shared-defaults.test.ts

Closes Lilly-Protocol#403
…nt (Lilly-Protocol#439)

- Change slice(0,2) to slice(0,7) to respect Stellar's 7-digit precision
- Update tests to verify sub-cent amounts like 0.0000001 are preserved
- Prevents silent precision loss that could zero out real payment values

Closes Lilly-Protocol#439
@David-patrick-chuks-02
David-patrick-chuks-02 merged commit dc091a9 into Lilly-Protocol:main Sep 6, 2026
0 of 4 checks passed
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.

[Bounty: $90] Remove the unreachable missing-baseUrl error path in LilySdk.create and align its JSDoc with the DEFAULT_API_URL fallback

3 participants