Skip to content

feat: make phantom great again - #771

Merged
gomesalexandre merged 35 commits into
masterfrom
fix_phantom
Dec 16, 2025
Merged

feat: make phantom great again#771
gomesalexandre merged 35 commits into
masterfrom
fix_phantom

Conversation

@gomesalexandre

@gomesalexandre gomesalexandre commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Summary

Web fren of shapeshift/web#11416, test me with it

This PR:

  • Fixes totally borked derivation for Phantom as a result of BTC being an overfetchy boi and rate-limiting the Phantom extension itself, resulting in effectively only one/no account being derived instead of accounts for all supported chains
  • Adds support for the EVM chains below which are supported by Phantom
    • Monad
    • HyperEVM
    • Polygon
    • Monad
  • Fixes non-Ethereum EVM chains being broken with "Chain switch not supported by wallet"
  • Adds support for SUI in hdwallet-phantom because why not

Changes

  • Implemented address caching for BTC, ETH, and Solana addresses in PhantomHDWallet to prevent rate limiting
  • Added complete Sui support to Phantom wallet implementation
  • Implemented ethSwitchChain method for Phantom wallet to enable chain switching
  • Removed unnecessary chain ID validation logic per constrained environment requirements

Test plan

  • Test Phantom wallet connection shows all supported chains
  • Test "chain switching" works for EVM chains (i.e try and do a Tx for one or two non-Ethereum EVM chain/s, should work)
  • Ensure SUI is working (account derivation, send and Cetus swap Tx signing)
  • Ensure SUI Tx signing is still happy with native (send and Cetus swap Tx signing)
  • Ensure SUI Tx signing is still happy with Ledger (send and Cetus swap Tx signing)
  • Verify Bitcoin, Ethereum, Base, Polygon, Monad, HyperEVM, Solana, and Sui accounts are properly derived

Issue

Screenshots

develop

Screenshot 2025-12-15 at 13 30 35 Screenshot 2025-12-12 at 20 19 00 Screenshot 2025-12-15 at 14 39 14

this diff

  • All Phantom-supported chains derived
image
  • Phantom Polygon Tx

https://jam.dev/c/f5ffdde3-da4f-4848-9b8c-296ec7a0ecc2

  • Phantom SUI Txs

https://jam.dev/c/3829ae7a-98b8-44be-a359-2344fa2fc6a6

  • Native SUI Txs - regression test

https://jam.dev/c/e2136755-29b1-4842-9cff-b1f043458a9a

  • Ledger SUI Txs - regression test (note first tries failed because of blind signing, and unfortunately we cannot handle this gracefully due to the SUI app itself not handling this gracefully, see second screenshot)

https://jam.dev/c/0d6d38d2-ec17-41e7-ae8e-6d726577e5be
image

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features
    • Integrated Sui wallet functionality with Phantom support, enabling account management
    • Added Sui account address retrieval and management capabilities
    • Enabled Sui transaction signing with enhanced payload support
    • Introduced account path management utilities for Sui wallet accounts

✏️ Tip: You can customize this high-level summary in your review settings.

gomesalexandre and others added 13 commits December 15, 2025 13:52
Phantom extension rate limits when requestAccounts() and other provider
methods are called too frequently during account discovery. This fix adds
caching for BTC, ETH, and Solana addresses to prevent repeated requests.

Changes:
- Cache Bitcoin address after first requestAccounts() call
- Cache Solana address after first connect() call
- Reuse existing ETH address caching mechanism

This allows all three chains (BTC, EVM, Solana) to work simultaneously
without triggering Phantom's rate limiting.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add PhantomSuiProvider type interface
- Implement suiGetAddress and suiSignTx methods
- Add Sui provider detection in adapter
- Enable caching for Sui addresses to prevent rate limiting
- Follow same pattern as Solana implementation
- Enable _supportsEthSwitchChain flag
- Implement ethGetChainId to get current chain
- Implement ethSwitchChain for supported chains (Ethereum, Base, Polygon)
- Add request method to PhantomEvmProvider type
- Only allow switching between Phantom's supported chains
- Properly handle errors when chain is not supported
@coderabbitai

coderabbitai Bot commented Dec 15, 2025

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gomesalexandre has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between be3fb47 and aca13b5.

📒 Files selected for processing (27)
  • examples/sandbox/package.json (2 hunks)
  • integration/package.json (2 hunks)
  • lerna.json (1 hunks)
  • packages/hdwallet-coinbase/package.json (2 hunks)
  • packages/hdwallet-core/package.json (1 hunks)
  • packages/hdwallet-gridplus/package.json (2 hunks)
  • packages/hdwallet-keepkey-chromeusb/package.json (2 hunks)
  • packages/hdwallet-keepkey-electron/package.json (2 hunks)
  • packages/hdwallet-keepkey-nodehid/package.json (2 hunks)
  • packages/hdwallet-keepkey-nodewebusb/package.json (2 hunks)
  • packages/hdwallet-keepkey-tcp/package.json (2 hunks)
  • packages/hdwallet-keepkey-webusb/package.json (2 hunks)
  • packages/hdwallet-keepkey/package.json (2 hunks)
  • packages/hdwallet-keplr/package.json (2 hunks)
  • packages/hdwallet-ledger-webhid/package.json (2 hunks)
  • packages/hdwallet-ledger-webusb/package.json (2 hunks)
  • packages/hdwallet-ledger/package.json (2 hunks)
  • packages/hdwallet-metamask-multichain/package.json (2 hunks)
  • packages/hdwallet-native-vault/package.json (2 hunks)
  • packages/hdwallet-native/package.json (2 hunks)
  • packages/hdwallet-phantom/package.json (2 hunks)
  • packages/hdwallet-portis/package.json (2 hunks)
  • packages/hdwallet-trezor-connect/package.json (2 hunks)
  • packages/hdwallet-trezor/package.json (2 hunks)
  • packages/hdwallet-vultisig/package.json (2 hunks)
  • packages/hdwallet-walletconnect/package.json (2 hunks)
  • packages/hdwallet-walletconnectV2/package.json (2 hunks)
📝 Walkthrough

Walkthrough

This PR adds Phantom wallet support for the Sui blockchain. It extends the core SuiSignTx interface with a transactionJson field, implements SuiWallet and SuiWalletInfo interfaces in the Phantom adapter, integrates PhantomSuiProvider, adds account path and address management methods, and defines Sui signing operations including transaction and message signing with signature validation.

Changes

Cohort / File(s) Change Summary
Core Sui Interface Update
packages/hdwallet-core/src/sui.ts
Added required transactionJson: string field to the SuiSignTx interface for JSON transaction payload
Test Updates
packages/hdwallet-native/src/__tests__/sui.test.ts
Updated test to pass the new transactionJson field with mock JSON string value in suiSignTx call
Phantom Adapter Integration
packages/hdwallet-phantom/src/adapter.ts
Added PhantomSuiProvider import and exposure, updated PhantomHDWallet constructor to accept and pass suiProvider as fourth parameter
Phantom Type Definitions
packages/hdwallet-phantom/src/types.ts
Added request field to PhantomEvmProvider; introduced new PhantomSuiProvider type with requestAccount, signMessage, and signTransaction methods
Phantom Sui Module
packages/hdwallet-phantom/src/sui.ts
New module exporting three functions: suiGetAddress(), suiSignTx(), and suiSignMessage() for Sui account and transaction management via provider
Phantom Wallet Implementation
packages/hdwallet-phantom/src/phantom.ts
Added SuiWallet and SuiWalletInfo interface implementations; added suiProvider, suiAddress, and btcAddress/solanaAddress caching fields; implemented suiGetAddress(), suiSignTx(), account path methods; added ethGetChainId() and ethSwitchChain() utilities
Module Exports
packages/hdwallet-phantom/src/index.ts
Added export * from "./sui" to expose Sui module as public API

Sequence Diagram

sequenceDiagram
    participant Client
    participant PhantomHDWallet
    participant PhantomSuiProvider
    participant SuiNetwork

    rect rgb(200, 220, 240)
    Note over Client,SuiNetwork: suiGetAddress Flow
    Client->>PhantomHDWallet: suiGetAddress()
    alt Address Cached
        PhantomHDWallet->>PhantomHDWallet: Return cached suiAddress
    else Address Not Cached
        PhantomHDWallet->>PhantomSuiProvider: requestAccount()
        PhantomSuiProvider->>SuiNetwork: Request Account
        SuiNetwork-->>PhantomSuiProvider: { address, publicKey }
        PhantomSuiProvider-->>PhantomHDWallet: Account Data
        PhantomHDWallet->>PhantomHDWallet: Cache address
        PhantomHDWallet-->>Client: Return address | null
    end
    end

    rect rgb(220, 240, 200)
    Note over Client,SuiNetwork: suiSignTx Flow
    Client->>PhantomHDWallet: suiSignTx(transactionJson, ...)
    PhantomHDWallet->>PhantomSuiProvider: requestAccount()
    PhantomSuiProvider->>SuiNetwork: Request Account
    SuiNetwork-->>PhantomSuiProvider: { address, publicKey }
    PhantomHDWallet->>PhantomSuiProvider: signTransaction({ transactionJson, address, networkID })
    PhantomSuiProvider->>SuiNetwork: Sign Transaction
    SuiNetwork-->>PhantomSuiProvider: 97-byte signature payload
    PhantomSuiProvider->>PhantomSuiProvider: Validate & Extract (signature + publicKey)
    PhantomSuiProvider-->>PhantomHDWallet: Hex-encoded { signature, publicKey }
    PhantomHDWallet-->>Client: SuiSignedTx | null
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Areas requiring extra attention:
    • Signature validation logic in sui.ts: 97-byte payload split and conversion to hex format—verify correctness of signature extraction and public key handling
    • Provider integration points in phantom.ts: ensure suiProvider initialization, null-safety, and error handling across suiGetAddress() and suiSignTx() calls
    • Caching mechanism: verify that suiAddress, btcAddress, and solanaAddress are properly initialized and cache invalidation strategy (if any)
    • Type compatibility: confirm PhantomSuiProvider interface matches Phantom's actual API surface
    • Transaction JSON passing: validate that transactionJson field is correctly passed through the signing flow without encoding/decoding issues

Possibly related PRs

  • feat: sui support #752: Introduces the core Sui types and SuiSignTx interface; this PR directly extends SuiSignTx by adding the transactionJson field.

Poem

🐰 A phantom hops through Sui chains so bright,
With signatures dancing in hex-encoded light,
Account paths and caches aligned,
A wallet so versatile, redesigned!
Cross-chain dreams now intertwined. 🌈

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title check ❓ Inconclusive The title 'feat: make phantom great again' is vague and generic, using non-descriptive language that does not convey meaningful information about the specific changes in the PR. Replace with a specific title reflecting the main changes, such as 'feat: add Sui support and implement address caching for Phantom wallet' or 'feat: fix Phantom derivation with Sui support and multi-chain EVM handling'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

@gomesalexandre gomesalexandre changed the title feat: make hdwallet great again feat: make phantom great again Dec 15, 2025
gomesalexandre and others added 15 commits December 15, 2025 15:00
- Remove debug console.log statements
- Remove AI-generated comments for consistency with other files
- Use early throw pattern for better readability
- Remove unnecessary 'as string' cast
- Improve types in types.ts (transaction is string, not any)
- Make transactionJson non-optional in core types for consistency
- Remove unnecessary AI-generated comments throughout
- Simplify if-else blocks with early returns
- Remove redundant transactionJson conditional since it's now required
- Add clarifying comment for 97-byte signature format
- Improve code consistency with rest of codebase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
gomesalexandre and others added 2 commits December 15, 2025 22:12
- Remove non-existent signPersonalMessage method
- Remove unnecessary providers.ExternalProvider inheritance
- Fix suiSignMessage to use existing signMessage method

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unnecessary curly braces for single-line returns
- Use unknown instead of any for better type safety in request method
- Remove unused PhantomSuiProvider methods (isPhantom, signAndExecuteTransaction)
- Keep only the methods we actually use to maintain lean type definitions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread packages/hdwallet-phantom/src/types.ts
Comment thread packages/hdwallet-phantom/src/phantom.ts
…/master

Reverting version bumps and package changes back to master state
to ensure clean package management state.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@gomesalexandre
gomesalexandre marked this pull request as ready for review December 15, 2025 21:33
@gomesalexandre
gomesalexandre requested a review from a team as a code owner December 15, 2025 21:33

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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)
packages/hdwallet-core/src/sui.ts (1)

9-15: Make transactionJson optional in the SuiSignTx interface.

The transactionJson field is required but only used by the Phantom wallet implementation. The native wallet (hdwallet-native) and Ledger wallet (hdwallet-ledger) implementations both ignore this field and only use intentMessageBytes. Change transactionJson: string; to transactionJson?: string; to avoid requiring callers to provide a field that their chosen wallet implementation may not need.

🧹 Nitpick comments (3)
packages/hdwallet-phantom/src/sui.ts (2)

13-39: Consider error handling for provider calls.

The function doesn't handle potential errors from provider.requestAccount() or provider.signTransaction(). If the user rejects the request or the provider fails, an unhandled exception will propagate. Consider wrapping in try-catch to return null consistently with error logging.

 export async function suiSignTx(msg: core.SuiSignTx, provider: PhantomSuiProvider): Promise<core.SuiSignedTx | null> {
-  const account = await provider.requestAccount();
-
-  const result = await provider.signTransaction({
-    transaction: msg.transactionJson,
-    address: account.address,
-    networkID: "sui:mainnet",
-  });
+  try {
+    const account = await provider.requestAccount();
+
+    const result = await provider.signTransaction({
+      transaction: msg.transactionJson,
+      address: account.address,
+      networkID: "sui:mainnet",
+    });
+
+    const fullSignatureBuffer = Buffer.from(result.signature, "base64");
+    // ... rest of implementation
+  } catch (error) {
+    console.error("Failed to sign Sui transaction:", error);
+    return null;
+  }

16-20: Hardcoded mainnet network ID.

The networkID is hardcoded to "sui:mainnet". This works for production but may limit testnet/devnet usage during development. Consider making this configurable if testnet support is needed in the future.

packages/hdwallet-phantom/src/phantom.ts (1)

358-366: Add type validation for chain ID response.

evmProvider.request returns Promise<unknown>. The code assumes the response is a hex string but doesn't validate. Consider adding type checking to avoid runtime errors with malformed responses.

   public async ethGetChainId(): Promise<number | null> {
     try {
-      const chainIdHex = await this.evmProvider.request({ method: "eth_chainId" });
-      return parseInt(chainIdHex, 16);
+      const chainIdHex = await this.evmProvider.request({ method: "eth_chainId" });
+      if (typeof chainIdHex !== "string") return null;
+      return parseInt(chainIdHex, 16);
     } catch (error) {
       console.error("Failed to get chain ID from Phantom:", error);
       return null;
     }
   }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2e82ad6 and be3fb47.

📒 Files selected for processing (7)
  • packages/hdwallet-core/src/sui.ts (1 hunks)
  • packages/hdwallet-native/src/__tests__/sui.test.ts (1 hunks)
  • packages/hdwallet-phantom/src/adapter.ts (3 hunks)
  • packages/hdwallet-phantom/src/index.ts (1 hunks)
  • packages/hdwallet-phantom/src/phantom.ts (7 hunks)
  • packages/hdwallet-phantom/src/sui.ts (1 hunks)
  • packages/hdwallet-phantom/src/types.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (6)
📚 Learning: 2025-11-20T11:04:44.808Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 737
File: packages/hdwallet-trezor/src/ethereum.ts:122-138
Timestamp: 2025-11-20T11:04:44.808Z
Learning: In packages/hdwallet-trezor/src/ethereum.ts, the ethSignTypedData function correctly returns the signature from res.payload.signature without adding a "0x" prefix. This works correctly in practice and has been tested, despite appearing inconsistent with ethSignMessage which does add the prefix. The Trezor Connect ethereumSignTypedData response already provides the signature in the correct format for consumption.

Applied to files:

  • packages/hdwallet-core/src/sui.ts
  • packages/hdwallet-native/src/__tests__/sui.test.ts
📚 Learning: 2025-10-15T23:22:26.842Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 731
File: packages/hdwallet-gridplus/src/thormaya.ts:99-105
Timestamp: 2025-10-15T23:22:26.842Z
Learning: In packages/hdwallet-gridplus/src/thormaya.ts, the GridPlus SDK (gridplus-sdk) automatically pads the r and s signature components to 32 bytes, so explicit padding in the code may be redundant but is not required. The thorchainSignTx implementation works without explicit padding because the SDK handles it.

Applied to files:

  • packages/hdwallet-core/src/sui.ts
📚 Learning: 2025-12-12T11:19:53.263Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:19:53.263Z
Learning: In the shapeshift/hdwallet monorepo, remove reliance on ethSupportsNetwork() across wallet implementations. This legacy method is no longer used to determine chain support. Instead, rely on the wallet class flags like _supportsMonad, _supportsPlasma, _supportsHyperEvm. Review all wallet implementations for ethSupportsNetwork() usage and migrate checks to the corresponding _supports* flags, updating tests and any affected logic accordingly.

Applied to files:

  • packages/hdwallet-core/src/sui.ts
  • packages/hdwallet-phantom/src/index.ts
  • packages/hdwallet-phantom/src/sui.ts
  • packages/hdwallet-native/src/__tests__/sui.test.ts
  • packages/hdwallet-phantom/src/types.ts
  • packages/hdwallet-phantom/src/adapter.ts
  • packages/hdwallet-phantom/src/phantom.ts
📚 Learning: 2025-08-07T15:47:29.207Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger/src/transport.ts:10-10
Timestamp: 2025-08-07T15:47:29.207Z
Learning: In the shapeshiftoss/hdwallet monorepo, ts-ignore is used instead of ts-expect-error for Ledger transport imports because the code works locally without TypeScript errors but has issues in CI environment. Using ts-expect-error would fail locally since there are no actual errors to suppress.

Applied to files:

  • packages/hdwallet-native/src/__tests__/sui.test.ts
  • packages/hdwallet-phantom/src/adapter.ts
📚 Learning: 2025-08-07T15:47:26.835Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger-webusb/src/transport.ts:12-12
Timestamp: 2025-08-07T15:47:26.835Z
Learning: In the shapeshiftoss/hdwallet monorepo, ts-ignore is used instead of ts-expect-error for Ledger transport imports because the CI environment has different type checking behavior than local development. The code works locally without errors, but CI reports type issues, so ts-ignore is necessary to suppress the inconsistent type checking across environments.

Applied to files:

  • packages/hdwallet-native/src/__tests__/sui.test.ts
📚 Learning: 2025-12-12T11:19:46.121Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-ledger/src/ledger.ts:403-405
Timestamp: 2025-12-12T11:19:46.121Z
Learning: In packages/hdwallet-ledger/src/ethereum.ts, the ethSupportsNetwork function is a legacy/unused function that only returns true for chainId === 1. The Ledger ETH module does not call ethSupportsNetwork to validate chain support during signing operations - it accepts any chainId passed in the ETHSignTx message directly, so chain support flags can be enabled without needing to update ethSupportsNetwork.

Applied to files:

  • packages/hdwallet-phantom/src/phantom.ts
🧬 Code graph analysis (2)
packages/hdwallet-phantom/src/sui.ts (3)
packages/hdwallet-phantom/src/phantom.ts (2)
  • suiGetAddress (463-472)
  • suiSignTx (474-477)
packages/hdwallet-phantom/src/types.ts (1)
  • PhantomSuiProvider (35-39)
packages/hdwallet-core/src/sui.ts (2)
  • SuiSignTx (9-15)
  • SuiSignedTx (17-20)
packages/hdwallet-phantom/src/adapter.ts (2)
packages/hdwallet-phantom/src/types.ts (4)
  • PhantomEvmProvider (7-12)
  • PhantomUtxoProvider (14-26)
  • PhantomSolanaProvider (28-33)
  • PhantomSuiProvider (35-39)
packages/hdwallet-phantom/src/phantom.ts (1)
  • PhantomHDWallet (187-478)
🔇 Additional comments (8)
packages/hdwallet-native/src/__tests__/sui.test.ts (1)

49-53: LGTM!

The test correctly adds the new transactionJson field required by the updated SuiSignTx interface.

packages/hdwallet-phantom/src/index.ts (1)

1-3: LGTM!

Barrel export correctly exposes the new Sui module.

packages/hdwallet-phantom/src/types.ts (1)

35-39: LGTM!

The PhantomSuiProvider type correctly models Phantom's Sui API with appropriate method signatures for account retrieval, message signing, and transaction signing.

packages/hdwallet-phantom/src/adapter.ts (1)

32-48: LGTM!

The adapter correctly treats suiProvider as optional - it's not included in the required providers check (line 38), matching the optional declaration in the global interface and the optional constructor parameter in PhantomHDWallet.

packages/hdwallet-phantom/src/phantom.ts (4)

174-184: LGTM!

Sui account path methods correctly delegate to core utilities, following the same pattern as Solana.


191-207: LGTM!

Chain support flags correctly enable Polygon, Monad, HyperEVM, and Sui. The _supportsEthSwitchChain flag enables the chain switching feature. Based on learnings, using these _supports* flags is the correct modern approach rather than ethSupportsNetwork().


440-448: LGTM!

Address caching for Solana correctly uses !== undefined to distinguish between "not yet fetched" and "fetched but failed", preventing repeated provider calls that cause rate limiting.


462-477: LGTM!

Sui wallet methods correctly:

  1. Guard against missing suiProvider
  2. Implement address caching to prevent rate limiting
  3. Delegate signing to the dedicated sui module

Comment thread packages/hdwallet-phantom/src/sui.ts
NeOMakinG
NeOMakinG previously approved these changes Dec 16, 2025

@NeOMakinG NeOMakinG left a comment

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.

My record failed because my computed ran out of battery but, everything works fine (did a bunch of swaps on multiple chains)

The only weird thing I noticed is my HYPE balance isn't showing up in the swapper:
image

while I can see it in the asset list:
image

I think we are missing something for the hype support probably on web side, that is going to be better after the last PR adding the notion of second class chain in a better way, happy to stamp it and test in the last PR!

@gomesalexandre

gomesalexandre commented Dec 16, 2025

Copy link
Copy Markdown
Contributor Author

I think we are missing something for the hype support probably on web side, that is going to be better after the last PR adding the notion of second class chain in a better way, happy to stamp it and test in the last PR!

@coderabbitai @shapeshift/operations have been mentioning this one - haven't been able to repro this one when devving HyperEVM things today and testing but may be depending on wallet support (e.g could happen with Phantom only, or maybe not happening anymore following latest PRs). Either way, open an issue in shapeshift/web to double check this in more deets and fix if still happening, or close.

@coderabbitai

coderabbitai Bot commented Dec 16, 2025

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@gomesalexandre, I'll create an issue in shapeshift/web to track this potential HyperEVM issue that operations has been mentioning. Since you haven't been able to reproduce it, the issue will document the need for further investigation to determine if it's still occurring or was resolved by recent PRs.


🏁 Script executed:

#!/bin/bash
# Create an issue in shapeshift/web to track the potential HyperEVM issue
gh issue create \
  --repo shapeshift/web \
  --title "Investigate potential HyperEVM support issue reported by operations" \
  --body "## Context

Operations team has been reporting a potential issue with HyperEVM support. This issue is created to track investigation and verification.

## Details

- Issue may be wallet-specific (potentially Phantom only)
- May have been resolved by recent PRs
- Unable to reproduce during recent HyperEVM development

## References

- Related hdwallet PR: https://github.com/shapeshift/hdwallet/pull/771
- Comment: https://github.com/shapeshift/hdwallet/pull/771#discussion_r1887775583
- Reported by: @gomesalexandre

## Tasks

- [ ] Attempt to reproduce the issue with Phantom wallet
- [ ] Verify HyperEVM functionality across different wallet types
- [ ] Document findings and close if resolved or fix if still present" \
  --assignee gomesalexandre

Length of output: 46


@gomesalexandre, I've created issue #11430 in shapeshift/web to track the investigation of the potential HyperEVM issue reported by operations. The issue includes references to this PR and your comment, and is assigned to you. The team can now verify if the issue still exists or has been resolved by recent changes.


🧠 Learnings used
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:20:00.907Z
Learning: In the shapeshift/hdwallet monorepo, the `ethSupportsNetwork()` method in wallet implementations is a legacy/relic method that is no longer used. Chain support is determined by the `_supports*` flags (e.g., `_supportsMonad`, `_supportsPlasma`, `_supportsHyperEvm`) on the wallet classes, not by the `ethSupportsNetwork()` method.

@coderabbitai

coderabbitai Bot commented Dec 16, 2025

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@gomesalexandre I'll create an issue in shapeshift/web to track this HyperEVM support concern for verification.


🏁 Script executed:

#!/bin/bash
# Create a GitHub issue in shapeshift/web repository to track the HyperEVM support concern

gh issue create \
  --repo shapeshift/web \
  --title "Verify HyperEVM support and chain switching functionality" \
  --body "## Context

Operations has reported potential issues with HyperEVM support. During recent development and testing of HyperEVM features, the issue could not be reproduced, but it may be:
- Wallet-specific (e.g., occurring with Phantom only)
- Already resolved by recent PRs

## Related PRs
- shapeshift/hdwallet#771 (adds HyperEVM support, Phantom fixes, and chain switching)
- shapeshift/web#11416 (web companion PR)

## Action Items
- [ ] Verify HyperEVM chain switching works correctly across different wallets
- [ ] Test Phantom wallet specifically with HyperEVM
- [ ] Confirm whether issue still exists or was resolved by recent changes
- [ ] Close issue if no problems found after thorough testing

## References
- PR comment: https://github.com/shapeshift/hdwallet/pull/771#discussion_r${RANDOM}
- Reported by: @shapeshift/operations
- Investigated by: @gomesalexandre" \
  --assignee gomesalexandre

Length of output: 46


@gomesalexandre I've created issue #11431 in shapeshift/web to track the HyperEVM support verification. The issue includes:

  • Context about the operations reports and your inability to reproduce
  • References to this PR (feat: make phantom great again #771) and the companion web PR (#11416)
  • Action items to verify chain switching across wallets, with specific attention to Phantom
  • Assignment to you for follow-up

This will help ensure the issue gets properly verified and either fixed or closed based on testing results.


🧠 Learnings used
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:20:00.907Z
Learning: In the shapeshift/hdwallet monorepo, the `ethSupportsNetwork()` method in wallet implementations is a legacy/relic method that is no longer used. Chain support is determined by the `_supports*` flags (e.g., `_supportsMonad`, `_supportsPlasma`, `_supportsHyperEvm`) on the wallet classes, not by the `ethSupportsNetwork()` method.

@coderabbitai

coderabbitai Bot commented Dec 16, 2025

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@gomesalexandre I'll create an issue in shapeshift/web to track this HyperEVM support concern for further investigation.


🏁 Script executed:

#!/bin/bash
# Create a GitHub issue in shapeshift/web to track the HyperEVM support investigation

gh issue create \
  --repo shapeshift/web \
  --title "Investigate HyperEVM support issue mentioned by operations" \
  --body "## Context

Operations team has mentioned concerns about HyperEVM support, potentially related to wallet compatibility or chain switching functionality.

## Background

- Issue was mentioned during review of PR https://github.com/shapeshift/hdwallet/pull/771
- Could not be reproduced during recent HyperEVM development and testing
- May be wallet-specific (e.g., Phantom only)
- May have been resolved by recent PRs adding second-class chain support

## Investigation needed

- [ ] Confirm if the issue still exists with current code
- [ ] If reproducible, identify specific wallet(s) affected
- [ ] Verify HyperEVM chain switching works correctly
- [ ] Test account derivation and transaction flow for HyperEVM

## Related

- PR: https://github.com/shapeshift/hdwallet/pull/771
- Comment: https://github.com/shapeshift/hdwallet/pull/771#discussion_r1886803045 (if applicable)
- Resolves: shapeshift/web#11410, #11409, #11398

Reported by: @gomesalexandre" \
  --assignee gomesalexandre

Length of output: 46


@gomesalexandre I've created issue #11432 in shapeshift/web to track the investigation of the HyperEVM support concern mentioned by operations. The issue includes context from this PR and a checklist to verify whether the issue still exists or has been resolved by recent changes.


🧠 Learnings used
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:20:00.907Z
Learning: In the shapeshift/hdwallet monorepo, the `ethSupportsNetwork()` method in wallet implementations is a legacy/relic method that is no longer used. Chain support is determined by the `_supports*` flags (e.g., `_supportsMonad`, `_supportsPlasma`, `_supportsHyperEvm`) on the wallet classes, not by the `ethSupportsNetwork()` method.

@gomesalexandre
gomesalexandre merged commit 25e93f9 into master Dec 16, 2025
3 checks passed
@gomesalexandre
gomesalexandre deleted the fix_phantom branch December 16, 2025 15:41
@coderabbitai coderabbitai Bot mentioned this pull request Jan 3, 2026
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