Skip to content

feat: intermediary fee types#520

Open
glarov95 wants to merge 16 commits intomainfrom
core-213-intermediary-fee-types
Open

feat: intermediary fee types#520
glarov95 wants to merge 16 commits intomainfrom
core-213-intermediary-fee-types

Conversation

@glarov95
Copy link
Copy Markdown
Contributor

Which Linear task is linked to this PR?

Why was it implemented this way?

Explain the reasoning behind the implementation. Were there alternative approaches? Why was this solution chosen?

Visual showcase (Screenshots or Videos)

If applicable, attach screenshots, GIFs, or videos to showcase the functionality, UI changes, or bug fixes.

Checklist before requesting a review

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Types API or adds new features that require documentation, I have updated the documentation in the public-docs repository.

@glarov95 glarov95 self-assigned this Apr 27, 2026
Signed-off-by: georgi <georgi@li.finance>
Signed-off-by: georgi <georgi@li.finance>
Signed-off-by: georgi <georgi@li.finance>
@glarov95 glarov95 force-pushed the core-213-intermediary-fee-types branch from d40b155 to 0ea7b4a Compare April 29, 2026 07:16
@glarov95 glarov95 changed the title Core 213 intermediary fee types feat: intermediary fee types Apr 29, 2026
glarov95 and others added 12 commits April 29, 2026 15:12
Signed-off-by: georgi <georgi@li.finance>
Signed-off-by: georgi <georgi@li.finance>
- Rename `FeeRecipientType` → `FeeSplitType` (consistent with the
  backend internal name and the CORE-252 PR description).
- Add `'DISTRIBUTION'` to the union — emitted on the wire by CORE-252
  partner-distribution recipients.
- Align `FeeRecipient` field names with the wire shape the backend has
  been emitting since CORE-214:
  - `integration` → `name`
  - `feeType` → `type` (now optional, matching `feeSplit.recipients[].type`)

Mirrors the consolidated CORE-213/214/252 shape in lifi-backend
(`utils/helpers.ts:FeeRecipient`, `feeCollection.ts:118-124`,
`statusService.evm.utils.ts:624`).
- Per-member JSDoc on FeeSplitType (FIXED / SHARED / DYNAMIC /
  INTERMEDIARY / DISTRIBUTION) so SDK consumers understand each
  value; recommend a default branch when narrowing since the union
  is expected to grow.
- Document the polymorphic FeeRecipient.name (lifi / integrator id /
  intermediary id / wallet address depending on type) and the UX
  hazard of rendering it raw without type-aware formatting.
- Document FeeRecipient.type? optionality so consumers null-check.
- Spell out FeeCost.feeSplit aggregate semantics: integratorFee is
  the sum of every non-LiFi recipient (and includes intermediaryFee);
  intermediaryFee is absent when no intermediary participates. Warn
  against summing the legacy aggregates to derive the parent amount.
Earlier wording described `integratorFee` as the sum of every non-LiFi
recipient (with `intermediaryFee` already included). The backend now
emits disjoint slices end-to-end: `lifiFee`, `integratorFee` (integrator
only), `intermediaryFee` (only when present). Distribution-recipient
amounts surface only on `recipients[]` entries tagged `DISTRIBUTION`.

Update the JSDoc to match. The three legacy aggregate fields plus
distribution recipients sum to the parent `FeeCost.amount`.
Earlier wording implied the disjoint slices summed to the parent
amount via `recipients[]` of `type: 'DISTRIBUTION'` entries on the
same `feeSplit`. In practice partner-distribution recipients are
emitted as separate `FeeCost` entries (one per receiver, name
"Fee Forward") at quote/route estimation time, while at status time
they may appear merged on the integrator's `FeeCost` for compactness.

Update the JSDoc to scope the slice contract to a single `FeeCost`
and note where distribution recipients live across estimate vs status.
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.

2 participants