Skip to content

feat: introduce jumper solana provider#2805

Open
laurentsenta wants to merge 10 commits into
developfrom
feat/introduce-proxy-token-widget-amounts-JUM-779
Open

feat: introduce jumper solana provider#2805
laurentsenta wants to merge 10 commits into
developfrom
feat/introduce-proxy-token-widget-amounts-JUM-779

Conversation

@laurentsenta
Copy link
Copy Markdown
Contributor

@laurentsenta laurentsenta commented Apr 10, 2026

Which Jira task belongs to this PR?

Contributes to https://linear.app/lifi-linear/issue/JUM-779
We need to inject proxy amounts in earn to make the widget aware of our positions

Sister PR: https://github.com/jumperexchange/jumper-backend/pull/821

With this PR:

  • It should be possible to withdraw a proxy token (widget should NOT say "not enough token" if you do have a position). Deposit with your own wallet, our impersonate CPk2P7XVn6PHJxFbcCq6Lc864bF7Bz6S4oRW7GVmREt6 with Phantom, if position amount is > 0, you should be able to withdraw

Why did I implement it this way?

It uses inversion of control to inject a custom jumper behavior
It makes proxy tokens first class citizen in the app

Checklist before requesting a review

  • I have performed a self-review of my code
  • This pull request is as small as possible and only tackles one problem
  • I have added tests that cover the functionality / test the bug
  • If this changed the API, I have updated the documentation
  • I have provided QA instructions for the feature / fix implemented in this PR (if applicable)
  • I have provided instructions for any environment / deployment changes that this PR needs when merged

Summary by CodeRabbit

  • New Features

    • Wallet now shows balances for Solana "proxy" tokens alongside regular tokens.
    • Proxy token balances are retrieved and merged so balances display seamlessly in the UI.
  • Refactor

    • Consolidated SDK provider setup for consistent provider ordering and improved Solana provider integration.
    • Minor import and provider instrumentation adjustments to support the new behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df3771e4-f382-4c3e-8439-e8aebac7129b

📥 Commits

Reviewing files that changed from the base of the PR and between c71665b and 382240f.

📒 Files selected for processing (1)
  • src/utils/instrumentation/lifiSdkConfig.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/utils/instrumentation/lifiSdkConfig.ts

Walkthrough

Adds Solana proxy token balance querying: new backend DTOs and v1 endpoint, getProxyTokenBalances client helper, JumperSolanaProvider wrapper that partitions and fetches proxy balances, centralized makeProviders() SDK factory, wallet provider wiring, minor import reorderings, and pinned @lifi/* dependency versions.

Changes

Solana Proxy Token Balance Support

Layer / File(s) Summary
Backend Contracts and API Endpoint
src/types/jumper-backend.ts
Adds PostTokensDto and ProxyTokenBalances interfaces and portfolioControllerGetProxyTokenBalancesV1() POST method on JumperBackend v1.
API Client Helper
src/app/lib/getProxyTokenBalances.ts
Adds ProxyTokenBalance type and getProxyTokenBalances(body: PostTokensDto): Promise<ProxyTokenBalance[]> which calls the new v1 endpoint and returns response data.
JumperSolanaProvider Wrapper
src/utils/instrumentation/JumperSolanaProvider.ts
Exports JumperSolanaProvider() that wraps SolanaProvider.getBalance(), partitions tokens with isProxyToken (prefix proxy:), fetches regular balances via underlying provider and proxy balances via backend API, synthesizes blockNumber from Date.now(), and merges results.
SDK Provider Configuration Refactor
src/utils/instrumentation/lifiSdkConfig.ts
Adds makeProviders() returning provider instances (Ethereum, JumperSolana, Bitcoin, Sui, Tron) and updates initClient() to pass providers: makeProviders() into createClient() rather than calling _client.setProviders() later.
Wallet Provider Integration
src/providers/WalletProvider/WalletProvider.tsx
Imports JumperSolanaProvider and updates SolanaWidgetProvider initialization to use sdkProvider: ({ getWallet }) => JumperSolanaProvider({ getWallet }).
Widget Import Cleanup
src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx, src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx
Reorders and adjusts imports: AB-test hooks moved earlier, removed unused ChainType import, and relocated several imports in ZapWithdrawWidget.
Pinned LiFi Dependencies
package.json
Pins @lifi/wallet-management, @lifi/widget, and @lifi/widget-provider to 4.0.0-beta.19.

Sequence Diagram(s)

sequenceDiagram
  participant UI as Wallet Consumer
  participant Jumper as JumperSolanaProvider
  participant Classify as isProxyToken
  participant LiFi as SolanaProvider
  participant API as getProxyTokenBalances
  participant Backend as Jumper Backend

  UI->>Jumper: getBalance(address, tokens)
  Jumper->>Classify: split tokens by "proxy:" prefix
  Classify-->>Jumper: regularTokens, proxyTokens
  par Parallel Fetch
    Jumper->>LiFi: getBalance(regularTokens)
    Jumper->>API: portfolioControllerGetProxyTokenBalancesV1(proxyTokens)
    API->>Backend: POST /v1/portfolio/query/proxy-tokens
    Backend-->>API: ProxyTokenBalances
  and
  end
  LiFi-->>Jumper: TokenAmount[] (regular)
  API-->>Jumper: TokenAmount[] (proxy with synthetic blockNumber)
  Jumper-->>UI: merged TokenAmount[]
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • mmioana
  • oktapodia

Poem

🐰 I hop through Solana's fields so wide,
Proxy tokens tucked safe by my side,
I split, I fetch, I stitch the sums,
From endpoints called to wallet drums,
A tiny hop — balances aligned.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: introduce jumper solana provider' accurately summarizes the main change: adding a custom Solana provider wrapper that handles proxy token balances.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 feat/introduce-proxy-token-widget-amounts-JUM-779

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
jumper-exchange Ready Ready Preview, Comment May 12, 2026 3:56pm
jumper-exchange-storybook Error Error May 12, 2026 3:56pm

Request Review

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 10, 2026

✅ All snapshot tests passed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 10, 2026

Playwright test results

failed  2 failed
passed  43 passed
flaky  1 flaky

Details

stats  46 tests across 8 suites
duration  13 minutes, 10 seconds
commit  382240f

Failed tests

chromium › connectWallet.spec.ts › Connect/disconnect Metamask with Jumper app and open /profile page › Connect Metamask wallet to Jumper (Qase ID: 36)
chromium › landingPage.spec.ts › Landing page and navigation › Should navigate to the homepage and change tabs (Qase ID: 2)

Flaky tests

chromium › earnPage.spec.ts › Chains filters on Earn page › Should be able to filter by ethereum chain (Qase ID: 43)

📋 View Detailed Qase Report

Comment thread src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx Outdated
Comment thread src/utils/instrumentation/JumperSolanaProvider.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces a custom Solana SDK provider to support “proxy:” tokens (balances derived from DeFi positions) so the Jumper UI/LiFi widget can correctly display and withdraw positions in Earn flows.

Changes:

  • Added JumperSolanaProvider that overrides Solana getBalance to fetch proxy-token balances via the Jumper backend.
  • Wired the custom Solana provider into both the app’s LiFi SDK client config and the widget’s Solana provider.
  • Added backend client typings + a small client helper for POST /v1/portfolio/tokens (proxy token balances).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils/instrumentation/lifiSdkConfig.ts Switches Solana provider to JumperSolanaProvider and centralizes SDK providers via makeProviders().
src/utils/instrumentation/JumperSolanaProvider.ts New provider wrapper that partitions proxy vs regular tokens and fetches proxy balances from backend.
src/types/jumper-backend.ts Adds DTO/response types and generated client method for POST /v1/portfolio/tokens.
src/app/lib/getProxyTokenBalances.ts New helper calling the backend endpoint and returning typed proxy balances.
src/providers/WalletProvider/WalletProvider.tsx Injects JumperSolanaProvider into the widget Solana provider via sdkProvider.
src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx Cleans up imports (removes unused ChainType).
src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx Introduces a debug console.log (should be removed).
src/components/Widgets/variants/base/ZapWidget/ZapDepositBackendWidget.tsx Introduces a debug console.log (should be removed).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

};
}, [widgetEvents, refetchWithdrawToken, setSupportModalState]);

console.log('jumper w3');
};
}, [widgetEvents, refetchDepositToken, setSupportModalState]);

console.log('jumper w2');
Comment thread src/utils/instrumentation/lifiSdkConfig.ts Outdated
Comment thread src/utils/instrumentation/lifiSdkConfig.ts Outdated
Copy link
Copy Markdown
Contributor

@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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx (1)

134-143: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Gate the fee contribution treatment on the intended variant.

This condition is looser than the other A/B checks in the hook: any truthy string enables the treatment, so a "control" bucket would still render FeeContribution and contaminate the experiment.

Suggested fix
     if (
       type === 'main' &&
       feeContributionABTest.isEnabled &&
-      feeContributionABTest.value
+      (feeContributionABTest.value === 'test' ||
+        feeContributionABTest.value === true)
     ) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx` around
lines 134 - 143, The current condition lets any truthy
feeContributionABTest.value (e.g., "control") enable the treatment; update the
guard so the FeeContribution component is only added when the experiment value
matches the intended treatment variant (e.g., replace the truthy check with an
explicit equality check like feeContributionABTest.value === 'treatment') while
keeping the other checks (type === 'main' and feeContributionABTest.isEnabled)
and assigning to baseConfig.feeConfig as before.
🧹 Nitpick comments (1)
src/types/jumper-backend.ts (1)

865-868: ⚡ Quick win

Give the proxy-balance payload a concrete item type.

data: object[] removes compile-time checking on the new response shape and forces callers to cast it back later. That makes backend/frontend drift show up only at runtime in the balance merge path.

Example shape to model in the generated contract
+export interface ProxyTokenBalanceItem {
+  chainId: number;
+  address: string;
+  symbol: string;
+  name: string;
+  decimals: number;
+  logoURI?: string;
+  priceUSD: string;
+  amount?: string;
+}
+
 export interface ProxyTokenBalances {
   meta: MetadataWithUpdatedAt;
-  data: object[];
+  data: ProxyTokenBalanceItem[];
 }

Because this file is generated, the source OpenAPI schema should be updated as well so the type survives regeneration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/types/jumper-backend.ts` around lines 865 - 868, The ProxyTokenBalances
interface currently uses a loose data: object[] which removes compile-time
guarantees; change ProxyTokenBalances to use a concrete item type (e.g., data:
ProxyTokenBalanceItem[] or an appropriate named type) and define that item type
with the exact fields expected by the proxy balance payload, then update the
OpenAPI schema so the generator emits the concrete type (ensure the identifier
ProxyTokenBalances and the new ProxyTokenBalanceItem type are added/updated in
the contract schema to survive regeneration).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/instrumentation/JumperSolanaProvider.ts`:
- Around line 38-44: The current mapping over responseTokens only returns tokens
echoed by the backend, dropping requested proxy tokens with zero balance; update
the logic in the JumperSolanaProvider balance conversion (the responseTokens.map
block that returns TokenAmount) to iterate over the original requested proxy
token list (e.g., proxyTokens or the argument that lists requested tokens) and
for each requested token find a matching entry in responseTokens, returning that
entry converted to TokenAmount or, if missing, a TokenAmount with amount: 0n and
the same blockNumber; ensure you preserve other token fields when present and
use BigInt(amount) when amount is provided.

---

Outside diff comments:
In `@src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx`:
- Around line 134-143: The current condition lets any truthy
feeContributionABTest.value (e.g., "control") enable the treatment; update the
guard so the FeeContribution component is only added when the experiment value
matches the intended treatment variant (e.g., replace the truthy check with an
explicit equality check like feeContributionABTest.value === 'treatment') while
keeping the other checks (type === 'main' and feeContributionABTest.isEnabled)
and assigning to baseConfig.feeConfig as before.

---

Nitpick comments:
In `@src/types/jumper-backend.ts`:
- Around line 865-868: The ProxyTokenBalances interface currently uses a loose
data: object[] which removes compile-time guarantees; change ProxyTokenBalances
to use a concrete item type (e.g., data: ProxyTokenBalanceItem[] or an
appropriate named type) and define that item type with the exact fields expected
by the proxy balance payload, then update the OpenAPI schema so the generator
emits the concrete type (ensure the identifier ProxyTokenBalances and the new
ProxyTokenBalanceItem type are added/updated in the contract schema to survive
regeneration).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 21a4e173-655c-4627-9738-7fee4954d10e

📥 Commits

Reviewing files that changed from the base of the PR and between e173ebb and 0a9da11.

📒 Files selected for processing (8)
  • src/app/lib/getProxyTokenBalances.ts
  • src/components/Widgets/variants/base/ZapWidget/ZapDepositBackendWidget.tsx
  • src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx
  • src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx
  • src/providers/WalletProvider/WalletProvider.tsx
  • src/types/jumper-backend.ts
  • src/utils/instrumentation/JumperSolanaProvider.ts
  • src/utils/instrumentation/lifiSdkConfig.ts

Comment thread src/utils/instrumentation/JumperSolanaProvider.ts
Copy link
Copy Markdown
Contributor

@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: 1

♻️ Duplicate comments (1)
src/utils/instrumentation/JumperSolanaProvider.ts (1)

38-44: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Return a balance entry for every requested proxy token.

This issue was raised in a previous review and remains unresolved. The current code only returns tokens echoed by the backend. If the backend omits zero-balance proxy tokens, they disappear from the result entirely, leaving the widget in a perpetual loading state for those tokens.

The catch block (line 46) handles API errors but doesn't address this scenario.

🔧 Proposed fix to ensure all requested tokens are returned
-    return responseTokens.map(
-      ({ amount, ...token }): TokenAmount => ({
-        ...token,
-        amount: amount != null ? BigInt(amount) : 0n,
-        blockNumber,
-      }),
-    );
+    // Build a map of returned balances by address
+    const balancesByAddress = new Map(
+      responseTokens.map((token) => [token.address, token]),
+    );
+
+    // Return a balance for each requested token
+    return tokens.map((requestedToken): TokenAmount => {
+      const responseToken = balancesByAddress.get(requestedToken.address);
+      return {
+        ...requestedToken,
+        ...responseToken,
+        amount: responseToken?.amount != null ? BigInt(responseToken.amount) : 0n,
+        blockNumber,
+      };
+    });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/instrumentation/JumperSolanaProvider.ts` around lines 38 - 44, The
response currently maps only responseTokens to TokenAmount, so any requested
proxy token omitted by the backend disappears; after building the mapped list
(using responseTokens and blockNumber) create a lookup of returned mints and
then iterate the original requested proxy token list (the function's input list
of tokens, e.g., proxyTokens/requestedTokens) and append a TokenAmount for any
missing mint with amount: 0n and the same blockNumber; ensure this logic runs
both in the success path (where responseTokens is processed) and in the
catch/fallback path so every requested proxy token is always present in the
final returned array.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/instrumentation/lifiSdkConfig.ts`:
- Line 41: The file currently imports and calls createClient from `@lifi/sdk` but
in v4.0.1-alpha.0 you must import createConfig and call createConfig with the
configuration object (apiKey, apiUrl, providers, integrator, rpcUrls,
preloadChains). Replace the import of createClient with createConfig and change
the function invocation from createClient(...) to createConfig(...), ensuring
the providers value produced by makeProviders() is included in that createConfig
call along with the other config fields.

---

Duplicate comments:
In `@src/utils/instrumentation/JumperSolanaProvider.ts`:
- Around line 38-44: The response currently maps only responseTokens to
TokenAmount, so any requested proxy token omitted by the backend disappears;
after building the mapped list (using responseTokens and blockNumber) create a
lookup of returned mints and then iterate the original requested proxy token
list (the function's input list of tokens, e.g., proxyTokens/requestedTokens)
and append a TokenAmount for any missing mint with amount: 0n and the same
blockNumber; ensure this logic runs both in the success path (where
responseTokens is processed) and in the catch/fallback path so every requested
proxy token is always present in the final returned array.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 326309ba-69f9-40d4-842f-3cd91e07bfd8

📥 Commits

Reviewing files that changed from the base of the PR and between 0a9da11 and 982f858.

📒 Files selected for processing (7)
  • src/app/lib/getProxyTokenBalances.ts
  • src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx
  • src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx
  • src/providers/WalletProvider/WalletProvider.tsx
  • src/types/jumper-backend.ts
  • src/utils/instrumentation/JumperSolanaProvider.ts
  • src/utils/instrumentation/lifiSdkConfig.ts
💤 Files with no reviewable changes (1)
  • src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/lib/getProxyTokenBalances.ts

_client = createClient({
apiKey: config.NEXT_PUBLIC_LIFI_API_KEY,
apiUrl: getApiUrl(),
providers: makeProviders(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the SDKConfig type definition

# Search for SDKConfig type definition
rg -nP "type SDKConfig|interface SDKConfig" node_modules/@lifi/sdk/ -A20 || echo "Type not found in node_modules"

# Check if there's a setProviders method
rg -nP "setProviders" node_modules/@lifi/sdk/ -C3

# Look for examples of provider configuration in the SDK
rg -nP "providers:" node_modules/@lifi/sdk/ -C2

Repository: jumperexchange/jumper-exchange

Length of output: 315


🌐 Web query:

What is the correct way to configure providers with createClient in @lifi/sdk version 4.0.1-alpha.0?

💡 Result:

In @lifi/sdk v4.0.1-alpha.0, you configure ecosystem “providers” by passing a providers array into createConfig (not by calling createClient with providers directly). Each provider is created by the ecosystem-specific provider factory (for example, EVM({... })) and receives wallet/RPC switching hooks. Example (EVM provider): import { createConfig, EVM } from "@lifi/sdk"; createConfig({ integrator: "Your dApp/company name", providers: [ EVM({ getWalletClient: async => client, switchChain: async (chainId) => // Switch chain by creating a new wallet client createWalletClient({ account, chain: chains.find((chain) => chain.id == chainId) as Chain, transport: http, }), }), ], }); Providers are optional; they’re only necessary if you want to execute quotes/routes through the SDK. If you only call the LI.FI API and handle execution yourself, you can omit providers. You can also update provider configuration later via config.setProviders(...).

Citations:


🏁 Script executed:

cat -n src/utils/instrumentation/lifiSdkConfig.ts

Repository: jumperexchange/jumper-exchange

Length of output: 2761


🏁 Script executed:

rg -n "createConfig" src/ --type ts --type tsx

Repository: jumperexchange/jumper-exchange

Length of output: 102


🏁 Script executed:

rg -n "createConfig" src/

Repository: jumperexchange/jumper-exchange

Length of output: 56


🌐 Web query:

@lifi/sdk createConfig function API documentation v4.0.1-alpha

💡 Result:

In LI.FI’s SDK, createConfig is the function you call to initialize the global SDK configuration. Example (from LI.FI docs): import { createConfig } from "@lifi/sdk"; createConfig({ integrator: "Your dApp/company name", }); After calling createConfig, the docs state that config acts as a global configuration object, and you can update it via config.set(...) (the “Update SDK configuration” section explains get/set). [1] createConfig API / options (SDKConfig fields documented on Configure SDK page): - integrator (required): used to identify partners; format restrictions and max length are documented. [1] - apiKey (optional): unique API key to access LI.FI API services (for higher rate limits). [1] - apiUrl (optional): base URL for LI.FI API requests; defaults to https://li.quest/v1. [1] - userId (optional): identifier for your app user. [1] - routeOptions (optional): routing custom options used by getQuote/getRoutes/getContractCallsQuote. [1] - rpcUrls (optional): mapping from chain IDs to RPC URL arrays. [1] - chains (optional): chains the SDK will support; fetched from LI.FI API during initialization if not provided. [1] - preloadChains (optional): whether to preload chain configurations (defaults to true). [1] - disableVersionCheck (optional): whether to disable SDK version checks (defaults to false). [2] - providers (optional): provider configurations used for executing quotes/routes; only required if you plan to execute routes through the SDK. [1] Notes about “v4.0.1-alpha” specifically: - I did not find a LI.FI docs page that explicitly names “v4.0.1-alpha” for createConfig. The authoritative, current documentation I found describes createConfig and its configuration options without tying them to that exact pre-release version. [1] Sources: LI.FI “Configure SDK” and related pages that show createConfig usage and list the configuration options. [1][3]

Citations:


Replace createClient with createConfig in this file.

In @lifi/sdk v4.0.1-alpha.0, the configuration with providers must be passed to createConfig(), not createClient(). The providers parameter belongs in the createConfig() call. Update the import on line 3 and the function call on line 38 accordingly. All configuration options you're passing (apiKey, apiUrl, providers, integrator, rpcUrls, preloadChains) are valid for createConfig().

🧰 Tools
🪛 GitHub Check: lint-changes

[failure] 41-41:
Object literal may only specify known properties, and 'providers' does not exist in type 'SDKConfig'.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/instrumentation/lifiSdkConfig.ts` at line 41, The file currently
imports and calls createClient from `@lifi/sdk` but in v4.0.1-alpha.0 you must
import createConfig and call createConfig with the configuration object (apiKey,
apiUrl, providers, integrator, rpcUrls, preloadChains). Replace the import of
createClient with createConfig and change the function invocation from
createClient(...) to createConfig(...), ensuring the providers value produced by
makeProviders() is included in that createConfig call along with the other
config fields.

laurentsenta and others added 9 commits May 12, 2026 11:06
The widget reads chain providers through WalletManagementProviders
(isExternalContext=true), not via WidgetConfig.sdkConfig.providers which
was silently overridden at runtime and has now been removed from the type.

Inject JumperSolanaProvider through the Solana widget-provider's new
sdkProvider factory form so the widget supplies getWallet from its
wallet-standard context rather than the removed setOptions mutation path.

Also stamp a synthetic blockNumber (BigInt(Date.now())) on proxy token
balances — the widget's getTokenBalancesWithRetry retries until every
TokenAmount has a truthy blockNumber, causing infinite loading otherwise.

Remove dead sdkConfig.providers injection in useWidgetConfig and debug
console statements added during investigation.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
Contributor

@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.

♻️ Duplicate comments (1)
src/utils/instrumentation/JumperSolanaProvider.ts (1)

38-44: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Return a balance row for every requested proxy token.

Line 38 currently maps only backend-echoed tokens. If the API omits zero-balance proxy tokens, requested tokens vanish from the result and can keep widget state incorrect. Iterate over requested tokens and merge matched backend entries instead.

Suggested fix
-    return responseTokens.map(
-      ({ amount, ...token }): TokenAmount => ({
-        ...token,
-        amount: amount != null ? BigInt(amount) : 0n,
-        blockNumber,
-      }),
-    );
+    const responseByAddress = new Map(
+      responseTokens.map((token) => [token.address, token]),
+    );
+
+    return tokens.map((requestedToken): TokenAmount => {
+      const matched = responseByAddress.get(requestedToken.address);
+      const { amount, ...token } = matched ?? {};
+
+      return {
+        ...requestedToken,
+        ...token,
+        amount: amount != null ? BigInt(amount) : 0n,
+        blockNumber,
+      };
+    });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/instrumentation/JumperSolanaProvider.ts` around lines 38 - 44, The
current mapping returns only backend-echoed responseTokens, dropping any
requested proxy tokens omitted by the API; change the logic to iterate over the
requested tokens array (tokens) and for each requested token find the matching
entry in responseTokens (by the token's unique key such as mint/address/id),
then produce a TokenAmount object that spreads the requested token properties,
sets amount to BigInt(matched.amount) or 0n if no match, and includes
blockNumber; update the mapping expression that currently uses
responseTokens.map to use tokens.map and merge matched backend data from
responseTokens into the returned TokenAmount objects.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/utils/instrumentation/JumperSolanaProvider.ts`:
- Around line 38-44: The current mapping returns only backend-echoed
responseTokens, dropping any requested proxy tokens omitted by the API; change
the logic to iterate over the requested tokens array (tokens) and for each
requested token find the matching entry in responseTokens (by the token's unique
key such as mint/address/id), then produce a TokenAmount object that spreads the
requested token properties, sets amount to BigInt(matched.amount) or 0n if no
match, and includes blockNumber; update the mapping expression that currently
uses responseTokens.map to use tokens.map and merge matched backend data from
responseTokens into the returned TokenAmount objects.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3c4a115c-c1e8-4672-bd3e-fa1cf2b098fe

📥 Commits

Reviewing files that changed from the base of the PR and between 982f858 and c71665b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • package.json
  • src/app/lib/getProxyTokenBalances.ts
  • src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx
  • src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx
  • src/providers/WalletProvider/WalletProvider.tsx
  • src/types/jumper-backend.ts
  • src/utils/instrumentation/JumperSolanaProvider.ts
  • src/utils/instrumentation/lifiSdkConfig.ts
💤 Files with no reviewable changes (1)
  • src/components/Widgets/variants/base/ZapWidget/ZapWithdrawWidget.tsx
✅ Files skipped from review due to trivial changes (3)
  • package.json
  • src/components/Widgets/variants/widgetConfig/useWidgetConfig.tsx
  • src/types/jumper-backend.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/providers/WalletProvider/WalletProvider.tsx
  • src/app/lib/getProxyTokenBalances.ts
  • src/utils/instrumentation/lifiSdkConfig.ts

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@mmioana mmioana left a comment

Choose a reason for hiding this comment

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

Nice and straight-forward 🥇

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.

3 participants