Skip to content

Collapse payInvoice raw-fetch seam now that ibex-client 3.3.0 ApiError carries the body #478

Description

@islandbitcoin

Context

payInvoice in src/services/ibex/client.ts calls the generated SDK through Ibex.authentication.withAuth(() => Ibex.ibex.payInvoiceV2(...)) instead of the standard Ibex.payInvoiceV2(...) wrapper. That seam existed because ibex-client@3.2.0's ApiError discarded the response body (lnflash/ibex-client#6), which made "insufficient balance" 400s unclassifiable through the standard path.

As of ibex-client@3.3.0 (bumped in #477), ApiError extracts httpCode / ibexResponse / ibexMessage itself, and #477's integration tests prove errorHandler classifies a body-carrying ApiError through the standard path. The seam is now redundant and retained only as belt-and-braces.

Task

Restore the standard call:

return Ibex.payInvoiceV2(bodyWithHooks).then(errorHandler)

and remove the httpErrorHandler catch from this path (keeping httpErrorHandler itself as defense-in-depth for any remaining raw-fetch callers, or removing it if none remain). Collapsing a payment path deserves its own PR with its own test scrutiny — that's why it was not folded into the #477 deps bump.

Acceptance

  • payInvoice uses Ibex.payInvoiceV2(bodyWithHooks).then(errorHandler)
  • Insufficient-balance 400s still classify as InsufficientIbexBalance (existing unit tests in test/flash/unit/services/ibex/errors.spec.ts must keep passing; add a payInvoice-level test if feasible)
  • Unrecognized IBEX 400s still log the IBEX body detail exactly once

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions