Skip to content

feat(sdk-route): group executor overrides under executor namespace …#841

Open
kev1n-peters wants to merge 1 commit intomainfrom
kevin/dynamic-referrer-fee-callback
Open

feat(sdk-route): group executor overrides under executor namespace …#841
kev1n-peters wants to merge 1 commit intomainfrom
kevin/dynamic-referrer-fee-callback

Conversation

@kev1n-peters
Copy link
Contributor

@kev1n-peters kev1n-peters commented Mar 13, 2026

…on Config

Add executor.getCapabilities to NttExecutorRoute.Config and MultiTokenNttExecutorRoute.Config. Replace local type definitions with imports from sdk-definitions.

Summary by CodeRabbit

  • New Features

    • Executor routes now accept an optional custom capability fetcher so callers can provide alternate or cached capability sources for improved flexibility and performance.
  • Updates

    • Capability-related utilities and types have been promoted to the package public API and re-exported for easier integration and advanced customization.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4a7c757d-f303-451f-ac89-4ca5936c5a7b

📥 Commits

Reviewing files that changed from the base of the PR and between 621c7d7 and 6ee77c1.

📒 Files selected for processing (4)
  • sdk/route/src/executor/executor.ts
  • sdk/route/src/executor/multiToken.ts
  • sdk/route/src/executor/utils.ts
  • sdk/route/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • sdk/route/src/index.ts
  • sdk/route/src/executor/executor.ts
  • sdk/route/src/executor/multiToken.ts

📝 Walkthrough

Walkthrough

Adds an optional executor.getCapabilities(network) override to executor route configs, replaces local executor-related type/enum definitions with re-exports from @wormhole-foundation/sdk-definitions, and re-exports fetchCapabilities and CapabilitiesResponse from the package entry point.

Changes

Cohort / File(s) Summary
Executor Config Overrides
sdk/route/src/executor/executor.ts, sdk/route/src/executor/multiToken.ts
Added optional executor?: { getCapabilities?: (network: Network) => Promise<CapabilitiesResponse> } to route configs and use it when present instead of calling fetchCapabilities.
Executor Utils / Types
sdk/route/src/executor/utils.ts
Removed local enums/types and re-exported RelayStatus, RequestPrefix (values) and types CapabilitiesResponse, Capabilities, QuoteResponse, RelayData, RequestForExecution, StatusResponse, TxInfo from @wormhole-foundation/sdk-definitions; updated functions to use those re-exports.
Public Surface
sdk/route/src/index.ts
Added re-exports: fetchCapabilities and type CapabilitiesResponse to package public API.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant Route as NttExecutorRoute
  participant Override as ExecutorOverride
  participant Remote as CapabilitiesService

  Client->>Route: request quote/execution
  Route->>Override: call getCapabilities(network)?
  alt override present
    Override-->>Route: CapabilitiesResponse
  else no override
    Route->>Remote: fetchCapabilities(network)
    Remote-->>Route: CapabilitiesResponse
  end
  Route->>Client: proceed with quote/validation using capabilities
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • dvgui
  • evgeniko

Poem

🐰 I hopped through types and gentle tweaks,

A capability path for those who seek,
Overrides snug where fetch once stood,
Re-exports tidy, tidy and good,
🥕 a small hop forward — code looks sleek.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: grouping executor overrides (specifically the new getCapabilities hook) under an executor namespace in Config objects across executor route modules.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kevin/dynamic-referrer-fee-callback
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@sdk/route/src/executor/executor.ts`:
- Around line 387-389: The issue is that extracting
this.staticConfig.executor?.getCapabilities into a local variable (fetchCaps)
drops its original this binding; change the call sites (in executor.ts where
fetchCaps and in multiToken.ts at the analogous location) to invoke the method
with the executor as the receiver instead of calling the unbound function—e.g.,
obtain the executor object (this.staticConfig.executor) and call its
getCapabilities using Function.prototype.call/apply or by binding (invoke
getCapabilities.call(executor, fromChain.network) or equivalent) and fall back
to fetchCapabilities when executor is undefined; ensure you reference the same
symbols: this.staticConfig.executor, getCapabilities, fetchCapabilities and
fromChain.network.

In `@sdk/route/src/executor/multiToken.ts`:
- Around line 357-359: The current extraction of getCapabilities into fetchCaps
can lose the executor's this binding if a user passed an unbound method; instead
call the method conditionally on the executor object so its this is preserved:
if this.staticConfig.executor?.getCapabilities exists, invoke it as
this.staticConfig.executor.getCapabilities(fromChain.network), otherwise call
the fallback fetchCapabilities(fromChain.network); assign the result to
capabilities (same variable) so behavior is unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f456464-2311-401b-8628-86e2b7b35f28

📥 Commits

Reviewing files that changed from the base of the PR and between 924730a and d499f62.

📒 Files selected for processing (4)
  • sdk/route/src/executor/executor.ts
  • sdk/route/src/executor/multiToken.ts
  • sdk/route/src/executor/utils.ts
  • sdk/route/src/index.ts

@kev1n-peters kev1n-peters force-pushed the kevin/dynamic-referrer-fee-callback branch from d499f62 to 621c7d7 Compare March 13, 2026 17:29
@kev1n-peters
Copy link
Contributor Author

@claude review this pr, focus on bugs and regressions

@github-actions
Copy link

github-actions bot commented Mar 18, 2026

Claude finished @kev1n-peters's task in 3m 21s —— View job


Review: PR #841 — Executor namespace on Config

  • Read changed files and understand the diff
  • Check for bugs and regressions
  • Post review findings

No bugs or regressions found. This is a clean, low-risk change. Here's the breakdown:

Changes reviewed

1. executor.getCapabilities override (executor.ts:65-68, multiToken.ts:55-58)

The new optional executor?.getCapabilities field on both NttExecutorRoute.Config and MultiTokenNttExecutorRoute.Config is straightforward. The ternary pattern used at the call sites correctly preserves this binding:

const capabilities = this.staticConfig.executor?.getCapabilities
  ? await this.staticConfig.executor.getCapabilities(fromChain.network)
  : await fetchCapabilities(fromChain.network);

This is the right approach (as opposed to the intermediate fetchCaps variable pattern that was flagged earlier by CodeRabbit and fixed before merge).

2. Type re-exports (utils.ts)

Local type/enum definitions (RelayStatus, RequestPrefix, Capabilities, CapabilitiesResponse, QuoteResponse, RelayData, RequestForExecution, StatusResponse, TxInfo) were replaced with re-exports from @wormhole-foundation/sdk-definitions. Since the exports are re-exported under the same names and the TS SDK CI builds and passes, there's no type incompatibility. Internal consumers (tracking.ts) only import fetchStatus and isRelayStatusFailed, which are unchanged.

3. Public API additions (index.ts:7-10)

fetchCapabilities and CapabilitiesResponse are now exported from the package public surface. This is additive-only and enables the override use case.

Notes

  • All 7 CI checks pass (TS SDK CI, EVM CI, Solana CI, etc.)
  • The PR is already approved by @connorstake
  • No behavioral regressions — the default code path (fetchCapabilities(fromChain.network)) is unchanged when executor?.getCapabilities is not provided

LGTM — no action items.


| Branch: kevin/dynamic-referrer-fee-callback

@kev1n-peters kev1n-peters requested a review from nascob March 18, 2026 15:56
…on Config

Add executor.getCapabilities to NttExecutorRoute.Config and
MultiTokenNttExecutorRoute.Config. Replace local type definitions
with imports from sdk-definitions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kev1n-peters kev1n-peters force-pushed the kevin/dynamic-referrer-fee-callback branch from 621c7d7 to 6ee77c1 Compare March 19, 2026 14:11
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