Skip to content

Comments

Added PULSE_NODE_URL#439

Merged
vignesha22 merged 3 commits intostagingfrom
PRO-3809-Enable_Trading_Bug
Oct 24, 2025
Merged

Added PULSE_NODE_URL#439
vignesha22 merged 3 commits intostagingfrom
PRO-3809-Enable_Trading_Bug

Conversation

@vignesha22
Copy link
Contributor

@vignesha22 vignesha22 commented Oct 23, 2025

Description

  • Added PULSE_NODE_URL env and use it upon initialising the intent sdk
  • Fixed minor bug on refresh icon in transaction detail page

How Has This Been Tested?

  • Tested locally

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Summary by CodeRabbit

  • Bug Fixes

    • Correctly report module installation state for both installed and not-installed outcomes.
  • Improvements

    • Narrowed dispensable asset eligibility to honor the active stablecoin chain context.
    • Updated transaction details close control styling for improved alignment and appearance.
    • Added option to specify a Pulse node endpoint in SDK configuration.
  • Documentation

    • Added example environment variable for the Pulse node URL.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 23, 2025

Walkthrough

Added a chainId filter to dispensable-asset selection and passed the max stable-coin chainId from Buy. Adjusted TransactionDetails close-button styling. Made useModularSdk explicitly set modules-installed = false when API reports not installed. Added pulseNodeUrl option to Intent SDK and documented VITE_PULSE_NODE_URL in .env.example.

Changes

Cohort / File(s) Summary
Dispensable asset filtering & call-site
src/apps/pulse/utils/intent.ts, src/apps/pulse/components/Buy/Buy.tsx
getDispensableAssets gained an optional maxStablecoinChainId?: number parameter and now requires maxStablecoinChainId === token.chainId in its eligibility check. Buy.tsx now passes maxStableCoinBalance.chainId to the function.
TransactionDetails UI refinement
src/apps/pulse/components/Transaction/TransactionDetails.tsx
Adjusted close button container to use flex layout and horizontal margin; for "Transaction Pending" the Esc icon is wrapped in a styled square (background, fixed size, rounded, centered).
Module installation state handling
src/apps/pulse/hooks/useModularSdk.ts
Added explicit else branch to set areModulesInstalled = false when API indicates modules are not installed, making both true/false outcomes explicit.
Intent SDK option & env
src/apps/pulse/hooks/useIntentSdk.ts, .env.example
Added new option pulseNodeUrl (sourced from VITE_PULSE_NODE_URL) to Intent SDK options; added VITE_PULSE_NODE_URL to .env.example with default URL.

Sequence Diagram(s)

sequenceDiagram
  participant UI as Buy Component
  participant Utils as intent.getDispensableAssets
  participant Data as PortfolioData

  UI->>Utils: getDispensableAssets(input, portfolioData, maxStablecoinChainId)
  Utils->>Data: iterate tokens
  alt token.chainId == maxStablecoinChainId && usdEq > input && hasStableToken
    Utils->>UI: include token as dispensable
  else
    Utils->>UI: skip token
  end
Loading
sequenceDiagram
  participant Hook as useModularSdk
  participant API as isPulseModulesInstalled

  Hook->>API: request module status
  API-->>Hook: { allValidatorsPresent: true } or { allValidatorsPresent: false }
  alt true
    Hook->>Hook: set areModulesInstalled = true
  else
    Hook->>Hook: set areModulesInstalled = false
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • IAmKio
  • RanaBug

Poem

🐰
I hopped through code with careful paws,
ChainId gates now guard the cause,
A tidy square makes closing sweet,
Flags set true or false — tidy feat,
Hoppity-hop, Pulse stays on its beats.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Added PULSE_NODE_URL" directly corresponds to a significant change in the pull request—the addition of the VITE_PULSE_NODE_URL environment variable in .env.example and its integration into the Intent SDK initialization in useIntentSdk.ts. While the PR also includes additional changes such as the maxStablecoinChainId parameter logic and a UI layout fix, the title appropriately highlights the primary feature addition. The title is concise, clear, and descriptive enough that a teammate reviewing the commit history would understand the main change being introduced.
Description Check ✅ Passed The pull request description aligns with the required template structure and includes all key sections: a Description section summarizing the changes (PULSE_NODE_URL addition and refresh icon bug fix), a How Has This Been Tested section (tested locally), a Screenshots section, and a Types of Changes section with an appropriate checkbox selected. While the testing description is brief and could include more implementation details, the description is mostly complete and follows the expected format, with sufficient information for reviewers to understand the scope of changes.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch PRO-3809-Enable_Trading_Bug

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.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 23, 2025

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: f2075a1
Status: ✅  Deploy successful!
Preview URL: https://571850aa.x-e62.pages.dev
Branch Preview URL: https://pro-3809-enable-trading-bug.x-e62.pages.dev

View logs

Copy link
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: 0

Caution

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

⚠️ Outside diff range comments (1)
src/apps/pulse/utils/intent.ts (1)

22-50: Clarify the optionality of maxStablecoinChainId parameter.

The parameter maxStablecoinChainId is marked as optional (?:), but it's used as a required value in the condition at line 47 (maxStablecoinChainId === tokenItem.chainId). If maxStablecoinChainId is undefined, the equality check will always be false, causing the function to return empty arrays [[], [], []] for all inputs, effectively disabling dispensable asset selection.

While the current call site in Buy.tsx always provides this parameter, the optional signature suggests the function can be called without it, which would break functionality silently.

Recommendation: Either make the parameter required by removing the ?, or add explicit handling for the undefined case:

Option 1: Make it required (preferred if always needed):

 export function getDispensableAssets(
   input: string,
   portfolioData: PortfolioData | undefined,
-  maxStablecoinChainId?: number
+  maxStablecoinChainId: number
 ): [DispensableAsset[], bigint[], PayingToken[]] {

Option 2: Add a guard clause if undefined should be valid:

 export function getDispensableAssets(
   input: string,
   portfolioData: PortfolioData | undefined,
   maxStablecoinChainId?: number
 ): [DispensableAsset[], bigint[], PayingToken[]] {
   if (!portfolioData?.assets) {
     return [[], [], []];
   }
+  // Return early if maxStablecoinChainId is not provided
+  if (maxStablecoinChainId === undefined) {
+    return [[], [], []];
+  }
🧹 Nitpick comments (1)
src/apps/pulse/components/Transaction/TransactionDetails.tsx (1)

152-156: Note: PR description mentions "refresh icon" but this appears to be the Esc/close button.

The nested div wrapper and the Esc component button both use bg-[#1E1D24], creating two layers with identical background colors. While not harmful, this could be simplified by consolidating the styling into a single element.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a03b7b7 and 460d54d.

⛔ Files ignored due to path filters (1)
  • src/apps/pulse/components/Transaction/tests/__snapshots__/TransactionDetails.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • src/apps/pulse/components/Buy/Buy.tsx (1 hunks)
  • src/apps/pulse/components/Transaction/TransactionDetails.tsx (1 hunks)
  • src/apps/pulse/hooks/useModularSdk.ts (1 hunks)
  • src/apps/pulse/utils/intent.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/apps/pulse/components/Transaction/TransactionDetails.tsx (1)
src/apps/pulse/components/Misc/Esc.tsx (1)
  • Esc (7-36)
src/apps/pulse/utils/intent.ts (1)
src/types/api.ts (1)
  • PortfolioData (739-748)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: lint
  • GitHub Check: unit-tests
  • GitHub Check: build
🔇 Additional comments (3)
src/apps/pulse/components/Transaction/TransactionDetails.tsx (1)

149-149: Layout adjustment looks good.

The flex layout classes properly center the close button container.

src/apps/pulse/hooks/useModularSdk.ts (1)

142-143: Good improvement for explicit state management.

Adding the explicit else branch to set areModulesInstalled to false improves code clarity and ensures the state is always defined based on the module installation check.

src/apps/pulse/components/Buy/Buy.tsx (1)

257-261: Correct usage of the updated getDispensableAssets signature.

The call site properly passes maxStableCoinBalance.chainId as the third parameter, aligning with the function's updated signature in intent.ts.

@github-actions github-actions bot temporarily deployed to Preview (PRO-3809-Enable_Trading_Bug) October 24, 2025 10:57 Inactive
Copy link
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: 0

🧹 Nitpick comments (1)
src/apps/pulse/hooks/useIntentSdk.ts (1)

85-88: Consider more specific error messages for configuration issues.

The current error handling is generic and won't help users diagnose configuration-specific problems, such as an invalid or missing pulseNodeUrl. Consider adding validation before SDK initialization or catching and re-throwing errors with more context about which configuration value caused the failure.

Example enhancement:

+    // Validate required configuration
+    if (!options.bundlerApiKey) {
+      setError('Missing VITE_ETHERSPOT_BUNDLER_API_KEY environment variable.');
+      return;
+    }
+    if (!options.pulseNodeUrl) {
+      console.warn('VITE_PULSE_NODE_URL not configured, SDK may not function correctly.');
+    }
+
     try {
       // 1: Check if connected via Privy wallet
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 460d54d and 6010aad.

📒 Files selected for processing (1)
  • src/apps/pulse/hooks/useIntentSdk.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: unit-tests
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (1)
src/apps/pulse/hooks/useIntentSdk.ts (1)

32-32: Based on my verification efforts, I was unable to find definitive documentation for the @etherspot/intent-sdk v1.0.0-alpha.10 package or confirmation that the pulseNodeUrl field exists in its Options type. The codebase shows only a single usage of VITE_PULSE_NODE_URL (the line being reviewed), with no environment configuration files or documentation present.

Verify the pulseNodeUrl configuration field with the SDK team.

The addition of pulseNodeUrl from the environment variable cannot be verified against public SDK documentation:

  1. Unverified field: The pulseNodeUrl field's existence in the @etherspot/intent-sdk@1.0.0-alpha.10 Options type could not be confirmed through available documentation. As an alpha-version SDK, field names and types may be unstable or undocumented.

  2. Empty string fallback risk: The field falls back to an empty string if VITE_PULSE_NODE_URL is not set. Confirm with the SDK team whether an empty URL is safe or if validation/a warning should be added.

  3. Configuration visibility: No environment configuration files (.env, .env.example) exist in the codebase documenting this new variable or its expected format.

Before merging, verify:

  • The Options type actually includes pulseNodeUrl
  • Empty string is an acceptable fallback value
  • Consider documenting the required env var format

Copy link
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: 0

🧹 Nitpick comments (1)
.env.example (1)

13-13: Minor: Address static analysis linting suggestions.

The new environment variable has been added correctly, but two minor style notes from the linter:

  1. Key ordering: VITE_PULSE_NODE_URL should be placed before VITE_PX_DEVELOPMENT_ID to maintain alphabetical ordering.
  2. Quote character: The value uses double quotes; consider whether this is consistent with your project's .env conventions (though the API keys on lines 2–3 do use quotes).

Apply this diff if you'd like to reorder alphabetically:

- VITE_PX_DEVELOPMENT_ID="src-apps-development-dir"
  VITE_REOWN_PROJECT_ID="Your ReOwn project ID"
- VITE_SKANDHA_URL="https://rpc.etherspot.io/v2"
- VITE_SWAP_BUTTON_SWITCH="true"
- VITE_PAYMASTER_URL="http://localhost:5050"
- VITE_SENTRY_ENVIRONMENT="staging"
- VITE_PULSE_NODE_URL="https://pulse.etherspot.io"
+ VITE_PAYMASTER_URL="http://localhost:5050"
+ VITE_PX_DEVELOPMENT_ID="src-apps-development-dir"
+ VITE_PULSE_NODE_URL="https://pulse.etherspot.io"
+ VITE_REOWN_PROJECT_ID="Your ReOwn project ID"
+ VITE_SKANDHA_URL="https://rpc.etherspot.io/v2"
+ VITE_SENTRY_ENVIRONMENT="staging"
+ VITE_SWAP_BUTTON_SWITCH="true"
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6010aad and f2075a1.

📒 Files selected for processing (1)
  • .env.example (1 hunks)
🧰 Additional context used
🪛 dotenv-linter (4.0.0)
.env.example

[warning] 13-13: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 13-13: [UnorderedKey] The VITE_PULSE_NODE_URL key should go before the VITE_PX_DEVELOPMENT_ID key

(UnorderedKey)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: unit-tests
  • GitHub Check: lint
  • GitHub Check: build

@vignesha22 vignesha22 merged commit 3d1ca4e into staging Oct 24, 2025
6 checks passed
@vignesha22 vignesha22 deleted the PRO-3809-Enable_Trading_Bug branch October 24, 2025 12:05
@coderabbitai coderabbitai bot mentioned this pull request Oct 24, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 5, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 14, 2025
3 tasks
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