Skip to content

feat: zcash support#11290

Merged
gomesalexandre merged 24 commits intodevelopfrom
zcash-support
Dec 5, 2025
Merged

feat: zcash support#11290
gomesalexandre merged 24 commits intodevelopfrom
zcash-support

Conversation

@kaladinlight
Copy link
Contributor

@kaladinlight kaladinlight commented Dec 4, 2025

Description

Zcash support for send/receive with balance and transaction history (ShapeShift wallet only).

Depends on shapeshift/hdwallet#760 (published at current alpha).

Issue (if applicable)

closes #11289

Risk

High Risk PRs Require 2 approvals

Low - new chain behind feature flag

What protocols, transaction types, wallets or contract interactions might be affected by this PR?

Testing

  • Ensure accurate balance and transaction history
  • Ensure ability to send and receive
  • Ensure asset and market data is available
  • Spot check account management

Engineering

☝️

Operations

  • 🏁 My feature is behind a flag and doesn't require operations testing (yet)

☝️

Screenshots (if applicable)

image image image image image

Summary by CodeRabbit

  • New Features
    • Opt-in Zcash (ZEC) support across the app: asset, chain, adapter, transaction parsing, ZIP317 fee calculation, and plugin registration.
  • Configuration
    • New feature flag (off by default) and HTTP/WS endpoints for Unchained Zcash.
  • UX / Integrations
    • Wallet, ledger, explorer labels and listings updated to surface ZEC when enabled; color and asset metadata added.
  • Tests
    • Updated fixtures and unit tests to include Zcash mappings.

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

@kaladinlight kaladinlight requested a review from a team as a code owner December 4, 2025 21:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

📝 Walkthrough

Walkthrough

Adds Zcash (ZEC) mainnet support guarded by a feature flag: environment variables and validators, CSP entry, CAIP constants and asset metadata, Unchained client and parser, a Zcash UTXO ChainAdapter with ZIP317 fee logic and assetId-based utxo selection, plugin registration, type updates, tests, color map/asset data, and Redux/state + typing integrations.

Changes

Cohort / File(s) Summary
Environment files
\.env, \.env.development, \.env.private, \.env.production, \.env.test
Added VITE_FEATURE_ZCASH flag and VITE_UNCHAINED_ZCASH_HTTP_URL / VITE_UNCHAINED_ZCASH_WS_URL endpoints
CSP headers
headers/csps/chains/zcash.ts, headers/csps/index.ts
New Zcash CSP module and inclusion in exported CSP list
CAIP / constants / utils
packages/caip/src/constants.ts, packages/caip/src/utils.ts, packages/types/src/base.ts
Introduced zecAssetId, zecChainId, ZcashMainnet and zcashAssetMap
Asset data & generation
packages/utils/src/assetData/baseAssets.ts, packages/utils/src/assetData/getBaseAsset.ts, scripts/generateAssetData/color-map.json, scripts/generateAssetData/*
Added Zcash base asset metadata, color mapping, and included in asset-generation scripts
Unchained client + parser
packages/unchained-client/openapitools.json, packages/unchained-client/src/utxo/zcash/*, packages/unchained-client/src/index.ts
OpenAPI generator entry for zcash; new generated exports and TransactionParser with midgardUrl arg; re-exports added
Chain adapters & UTXO selection
packages/chain-adapters/src/utxo/zcash/*, packages/chain-adapters/src/utxo/UtxoBaseAdapter.ts, packages/chain-adapters/src/utxo/utxoSelect/index.ts, packages/chain-adapters/src/utxo/index.ts
New ZcashChainAdapter; added Zcash to UtxoBaseAdapter provider unions; utxoSelect extended with assetId routing to coinSelectZcash and ZIP317 fee handling; public zcash export added
Chain-adapter types & utilities
packages/chain-adapters/src/types.ts, packages/chain-adapters/src/utils/*, packages/chain-adapters/src/coinselect.d.ts
Added ZcashMainnet to chain-specific type mappings and display enum; ledger app/coin name mappings; updated coinselect declaration generics
Adapters tests & small adapters
packages/caip/src/adapters/*, packages/chain-adapters/src/utxo/utxoSelect/index.test.ts, packages/chain-adapters/src/utxo/dogecoin/DogecoinChainAdapter.ts
Extended CoinCap/CoinGecko test mappings for ZEC; added assetId to utxoSelect tests and Dogecoin utxoSelectInput
App config & typing
src/config.ts, src/vite-env.d.ts, src/constants/chains.ts
Added env validators and ImportMetaEnv typings for Zcash endpoints/flag; feature-flag filter for known chains
Plugins & registration
src/plugins/zcash/index.tsx, src/plugins/activePlugins.ts, src/context/PluginProvider/PluginProvider.tsx
New Zcash plugin registering ZcashChainAdapter wired to Unchained HTTP/WS and Midgard URLs; active plugin and feature-flag gating added
Coingecko & asset services
src/lib/coingecko/constants.ts, src/lib/coingecko/utils.ts, src/lib/asset-service/service/AssetService.ts, src/lib/address/constants.ts
Added zec mappings to Coingecko constants and supported chains; asset-service filtering and URN mapping feature-gated by flag
UI / state integrations
src/hooks/useWalletSupportsChain/*, src/state/slices/*, src/test/mocks/store.ts, src/state/migrations/index.ts, src/state/slices/portfolioSlice/utils/index.ts, src/state/slices/preferencesSlice/preferencesSlice.ts
Wallet support, account labels, opportunities mapping, preferences feature flag (Zcash), mock store defaults, and migration entry added
Unchained & public exports
packages/unchained-client/src/utxo/index.ts, packages/unchained-client/src/utxo/zcash/index.ts
Public export namespaces for zcash added
Dependency bumps & patches
package.json, packages/chain-adapters/package.json, packages/swapper/package.json, patches/*bitcoinjs-lib*
Bumped @shapeshiftoss/hdwallet-* deps (to 1.62.23); added bitcoinjs-lib patch threading optional singleHash across PSBT/Transaction APIs

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant App as Application
    participant Plugin as Zcash Plugin
    participant Adapter as ZcashChainAdapter
    participant UTXO as UtxoSelect
    participant Fee as ZIP317 Calculator
    participant Client as Unchained Client

    App->>Plugin: register() [if VITE_FEATURE_ZCASH=true]
    Plugin->>Adapter: construct(http/ws providers, midgardUrl)
    App->>Adapter: buildSendApiTransaction(tx)
    Adapter->>UTXO: utxoSelect(input { assetId = zecAssetId, ... })
    UTXO->>UTXO: route → coinSelectZcash
    UTXO->>Fee: calculateZip317Fee(numInputs,numOutputs)
    Fee-->>UTXO: fee
    UTXO->>Client: request buildTransaction(inputs, outputs, fee)
    Client-->>Adapter: transaction data
    Adapter-->>App: ready tx for sign/broadcast
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas requiring focused review:
    • ZIP317 fee calculation, coinSelectZcash correctness (sendMax, insufficient funds, edge UTXO selection)
    • ZcashChainAdapter wiring (provider types, parser midgardUrl integration)
    • Public API/type changes (coinselect.d.ts generics, unchained.zcash provider unions)
    • bitcoinjs-lib patch impact on PSBT/Transaction signing paths and downstream consumers
    • Feature-flag gating and env validator coverage to prevent accidental exposure

Possibly related PRs

Suggested reviewers

  • NeOMakinG
  • gomesalexandre

Poem

🐰 I dug a burrow through UTXO dust,
I nibbled flags and envs with trust,
I hopped through parsers, midgard streams,
ZIP317 hummed in moonlit beams,
ZEC carrots gleam — a rabbit's must!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes directly support Zcash implementation. However, the bitcoinjs-lib patch introduces singleHash parameter changes unrelated to Zcash support, and coinselect.d.ts return type simplification also appears tangential to the core Zcash feature. Review and clarify whether the bitcoinjs-lib patch and coinselect type changes are intentional dependencies for Zcash support or separate concerns that should be in different PRs.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat: zcash support' directly and concisely describes the main change—adding Zcash support to the wallet.
Linked Issues check ✅ Passed The PR implements Zcash support for send/receive operations, balance display, and transaction history as required by issue #11289. Changes span environment configuration, chain adapters, Zcash-specific adapters, asset data, and feature flag integration.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch zcash-support

📜 Recent 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 3990a50 and 0c0c37a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • package.json (1 hunks)
  • packages/chain-adapters/package.json (1 hunks)
  • packages/chain-adapters/src/types.ts (6 hunks)
  • packages/chain-adapters/src/utxo/utxoSelect/index.ts (6 hunks)
  • packages/swapper/package.json (1 hunks)
  • patches/@shapeshiftoss+bitcoinjs-lib+7.0.0-shapeshift.0.patch (0 hunks)
  • src/state/migrations/index.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • patches/@shapeshiftoss+bitcoinjs-lib+7.0.0-shapeshift.0.patch
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/swapper/package.json
  • package.json
  • packages/chain-adapters/src/utxo/utxoSelect/index.ts
  • packages/chain-adapters/src/types.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Never assume a library is available - always check imports/package.json first
Prefer composition over inheritance
Write self-documenting code with clear variable and function names
Keep functions small and focused on a single responsibility
Avoid deep nesting - use early returns instead
Prefer procedural and easy to understand code
Never expose, log, or commit secrets, API keys, or credentials
Validate all inputs, especially user inputs
Handle errors gracefully with meaningful messages
Don't silently catch and ignore exceptions
Log errors appropriately for debugging
Provide fallback behavior when possible
Use appropriate data structures for the task
Never add code comments unless explicitly requested
When modifying code, do not add comments that reference previous implementations or explain what changed. Comments should only describe the current logic and functionality.
Use meaningful names for branches, variables, and functions
Always run yarn lint --fix and yarn type-check after making changes
Avoid let variable assignments - prefer const with inline IIFE switch statements or extract to functions for conditional logic

Files:

  • src/state/migrations/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Avoid useEffect where practical - use it only when necessary and following best practices
Avoid 'any' types - use specific type annotations instead
For default values with user overrides, use computed values (useMemo) instead of useEffect - pattern: userSelected ?? smartDefault ?? fallback
When function parameters are unused due to interface requirements, refactor the interface or implementation to remove them rather than prefixing with underscore
Sanitize data before displaying to prevent XSS
Memoize aggressively - wrap component variables in useMemo and callbacks in useCallback where possible
For static JSX icon elements (e.g., <TbCopy />) that don't depend on state/props, define them as constants outside the component to avoid re-renders instead of using useMemo
Account for light/dark mode using useColorModeValue hook
Account for responsive mobile designs in all UI components
When applying styles, use the existing standards and conventions of the codebase
Use Chakra UI components and conventions
All copy/text must use translation keys - never hardcode strings
Use the translation hook: useTranslate() from react-polyglot
Use useFeatureFlag('FlagName') hook to access feature flag values in components
Prefer type over interface for type definitions
Use strict typing - avoid any
Use Nominal types for domain identifiers (e.g., WalletId, AccountId)
Import types from @shapeshiftoss/caip for chain/account/asset IDs
Use useAppSelector for Redux state
Use useAppDispatch for Redux actions
Memoize expensive computations with useMemo
Memoize callbacks with useCallback

**/*.{ts,tsx}: Use Result<T, E> pattern for error handling in swappers and APIs; ALWAYS use Ok() and Err() from @sniptt/monads; AVOID throwing within swapper API implementations
ALWAYS use custom error classes from @shapeshiftoss/errors with meaningful error codes for internationalization and relevant details in error objects
ALWAYS wrap async op...

Files:

  • src/state/migrations/index.ts
src/state/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

src/state/**/*.{ts,tsx}: Use createDeepEqualOutputSelector from @/state/selector-utils for deep equality checks
Use createCachedSelector from re-reselect for parameterized selectors

Files:

  • src/state/migrations/index.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/naming-conventions.mdc)

**/*.{js,jsx,ts,tsx}: Use camelCase for variables, functions, and methods with descriptive names that explain the purpose
Use verb prefixes for functions that perform actions (e.g., fetch, validate, execute, update, calculate)
Use UPPER_SNAKE_CASE for constants and configuration values with descriptive names
Use handle prefix for event handlers with descriptive names in camelCase
Use descriptive boolean variable names with is, has, can, should prefixes
Use named exports for components, functions, and utilities instead of default exports
Use descriptive import names and avoid renaming imports unless necessary
Avoid non-descriptive variable names like data, item, obj, and single-letter variable names except in loops
Avoid abbreviations in names unless they are widely understood
Avoid generic function names like fn, func, or callback

Files:

  • src/state/migrations/index.ts
🧠 Learnings (11)
📚 Learning: 2025-08-27T13:49:48.668Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10375
File: src/state/migrations/index.ts:214-215
Timestamp: 2025-08-27T13:49:48.668Z
Learning: The clearAssetsMigrations system in the ShapeShift web app works independently of the root persistConfig version. Migration numbers (like 171) don't need to match the root persistConfig version field, and the system has been functioning correctly for months/years without manual version bumps.

Applied to files:

  • src/state/migrations/index.ts
📚 Learning: 2025-11-24T21:20:04.979Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T21:20:04.979Z
Learning: Applies to src/state/slices/**/*.ts : Migrations are required when changing persisted state structure (see `src/state/migrations/`)

Applied to files:

  • src/state/migrations/index.ts
📚 Learning: 2025-08-27T13:49:48.668Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10375
File: src/state/migrations/index.ts:214-215
Timestamp: 2025-08-27T13:49:48.668Z
Learning: The ShapeShift web app uses an automated versioning system for Redux Persist migrations. The version is calculated as `Math.max(...Object.keys(clearAssetsMigrations).map(Number))`, which automatically uses the highest migration number as the version. This eliminates the need to manually update persistConfig versions when adding new migrations - the system automatically bumps the version when new migration numbers are added to the migration objects.

Applied to files:

  • src/state/migrations/index.ts
📚 Learning: 2025-11-19T22:20:25.661Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10767
File: package.json:324-324
Timestamp: 2025-11-19T22:20:25.661Z
Learning: In shapeshift/web package.json, the resolution "gridplus-sdk/bs58check": "2.1.2" is intentional and must not be removed. It forces gridplus-sdk's transitive bs58check dependency from 4.0.0 down to 2.1.2 because bs58check 4.0.0 breaks legacy address validation (due to bs58 v6.0.0 and noble/hash vs 2.1.2's bs58 v4.0.0 and create-hash).

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-08-08T20:16:12.898Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10222
File: package.json:202-202
Timestamp: 2025-08-08T20:16:12.898Z
Learning: In shapeshift/web, the semver package must be included in dependencies (not devDependencies) because hdwallet packages have transient dependencies that require semver but don't ship it themselves. This ensures semver is available at runtime for hdwallet functionality.

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-08-08T20:27:02.203Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10222
File: package.json:202-202
Timestamp: 2025-08-08T20:27:02.203Z
Learning: In shapeshift/web, while gomesalexandre generally prefers pinned dependencies for security, semver with a caret range (^7.7.2) is acceptable as an exception since it's already a transient dependency of many packages and is being made explicit for hdwallet support.

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-12-04T22:57:50.839Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 11290
File: packages/chain-adapters/src/utxo/zcash/ZcashChainAdapter.ts:48-51
Timestamp: 2025-12-04T22:57:50.839Z
Learning: In packages/chain-adapters/src/**/*ChainAdapter.ts files, the getName() method uses the pattern `const enumIndex = Object.values(ChainAdapterDisplayName).indexOf(ChainAdapterDisplayName.XXX); return Object.keys(ChainAdapterDisplayName)[enumIndex]` to reverse-lookup the enum key from its value. This is the established pattern used consistently across almost all chain adapters (Bitcoin, Ethereum, Litecoin, Dogecoin, Polygon, Arbitrum, Cosmos, etc.) and should be preserved for consistency when adding new chain adapters.

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-08-29T18:09:45.982Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10376
File: vite.config.mts:136-137
Timestamp: 2025-08-29T18:09:45.982Z
Learning: In the ShapeShift web repository vite.config.mts, the commonjsOptions.exclude configuration using bare package name strings like ['shapeshiftoss/caip', 'shapeshiftoss/types'] works correctly for excluding specific packages from CommonJS transformation, despite theoretical concerns about module ID matching patterns.

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-11-20T12:00:45.005Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11078
File: src/setupVitest.ts:11-15
Timestamp: 2025-11-20T12:00:45.005Z
Learning: In shapeshift/web, src/setupVitest.ts must redirect 'ethers' to 'ethers5' for shapeshiftoss/hdwallet-trezor (and -trezor-connect), same as ledger and shapeshift-multichain. Removing 'trezor' from the regex causes CI/Vitest failures due to ethers v6 vs v5 API differences.

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-10-07T03:44:27.350Z
Learnt from: 0xApotheosis
Repo: shapeshift/web PR: 10760
File: src/components/ManageHiddenAssets/ManageHiddenAssetsList.tsx:78-84
Timestamp: 2025-10-07T03:44:27.350Z
Learning: In the ShapeShift web codebase, the following are stable references and do not need to be included in useCallback/useMemo dependency arrays:
- `navigate` from `useBrowserRouter()` hook
- Modal control objects (like `walletDrawer`) from `useModal()` hook (including their `isOpen`, `close`, and `open` methods)
- These are backed by stable context providers

Applied to files:

  • packages/chain-adapters/package.json
📚 Learning: 2025-08-07T11:20:05.201Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: package.json:0-0
Timestamp: 2025-08-07T11:20:05.201Z
Learning: gomesalexandre prefers pinned dependencies (exact versions without caret ranges) as a general security practice to prevent vulnerabilities from being introduced through automatic version bumps. He referenced the LedgerHQ/connect-kit vulnerability (GitHub issue #29) as an example of security risks from dependency updates.

Applied to files:

  • packages/chain-adapters/package.json
🧬 Code graph analysis (1)
src/state/migrations/index.ts (1)
src/state/migrations/clearAssets.ts (1)
  • clearAssets (6-8)
⏰ 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). (1)
  • GitHub Check: Call / Static
🔇 Additional comments (3)
src/state/migrations/index.ts (1)

281-281: LGTM! Migration follows the established pattern.

The addition of migration 234 correctly follows the pattern for clearing assets state when adding new chain support (Zcash). The automated versioning system will automatically bump the version to 234 based on the highest migration key.

packages/chain-adapters/package.json (2)

34-35: Version pins are appropriately secured.

The use of exact version pins (no caret ranges) for these critical hdwallet dependencies aligns with security best practices in this codebase. Both packages are updated in lockstep, which maintains consistency across hardware wallet support.


34-35: The specified version 1.62.23 does not exist on the npm registry.

The latest published version of @shapeshiftoss/hdwallet-core is 1.62.3 (published November 2025). Version 1.62.23 cannot be resolved during dependency installation. This appears to be a typo—update both @shapeshiftoss/hdwallet-core and @shapeshiftoss/hdwallet-ledger to 1.62.3, which was published after ShapeShift's October 9, 2025 Zcash support release.

⛔ Skipped due to learnings
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10767
File: package.json:324-324
Timestamp: 2025-11-19T22:20:25.661Z
Learning: In shapeshift/web package.json, the resolution "gridplus-sdk/bs58check": "2.1.2" is intentional and must not be removed. It forces gridplus-sdk's transitive bs58check dependency from 4.0.0 down to 2.1.2 because bs58check 4.0.0 breaks legacy address validation (due to bs58 v6.0.0 and noble/hash vs 2.1.2's bs58 v4.0.0 and create-hash).
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10222
File: package.json:202-202
Timestamp: 2025-08-08T20:27:02.203Z
Learning: In shapeshift/web, while gomesalexandre generally prefers pinned dependencies for security, semver with a caret range (^7.7.2) is acceptable as an exception since it's already a transient dependency of many packages and is being made explicit for hdwallet support.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10222
File: package.json:202-202
Timestamp: 2025-08-08T20:16:12.898Z
Learning: In shapeshift/web, the semver package must be included in dependencies (not devDependencies) because hdwallet packages have transient dependencies that require semver but don't ship it themselves. This ensures semver is available at runtime for hdwallet functionality.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: package.json:0-0
Timestamp: 2025-08-07T11:20:05.201Z
Learning: gomesalexandre prefers pinned dependencies (exact versions without caret ranges) as a general security practice to prevent vulnerabilities from being introduced through automatic version bumps. He referenced the LedgerHQ/connect-kit vulnerability (GitHub issue #29) as an example of security risks from dependency updates.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10232
File: packages/unchained-client/openapitools.json:61-61
Timestamp: 2025-08-08T10:23:16.843Z
Learning: In shapeshift/web, for temporary “monkey patch” PRs (e.g., packages/unchained-client/openapitools.json using jsDelivr CDN refs like cosmos/mayachain), gomesalexandre is fine with branch-based URLs and does not want SHA pinning. Treat this as a scoped exception to their general preference for pinned dependencies/refs.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11078
File: src/setupVitest.ts:11-15
Timestamp: 2025-11-20T12:00:45.005Z
Learning: In shapeshift/web, src/setupVitest.ts must redirect 'ethers' to 'ethers5' for shapeshiftoss/hdwallet-trezor (and -trezor-connect), same as ledger and shapeshift-multichain. Removing 'trezor' from the regex causes CI/Vitest failures due to ethers v6 vs v5 API differences.
Learnt from: kaladinlight
Repo: shapeshift/web PR: 11290
File: packages/chain-adapters/src/utxo/zcash/ZcashChainAdapter.ts:48-51
Timestamp: 2025-12-04T22:57:50.839Z
Learning: In packages/chain-adapters/src/**/*ChainAdapter.ts files, the getName() method uses the pattern `const enumIndex = Object.values(ChainAdapterDisplayName).indexOf(ChainAdapterDisplayName.XXX); return Object.keys(ChainAdapterDisplayName)[enumIndex]` to reverse-lookup the enum key from its value. This is the established pattern used consistently across almost all chain adapters (Bitcoin, Ethereum, Litecoin, Dogecoin, Polygon, Arbitrum, Cosmos, etc.) and should be preserved for consistency when adding new chain adapters.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11012
File: src/context/WalletProvider/Vultisig/components/Connect.tsx:24-59
Timestamp: 2025-11-19T16:59:50.569Z
Learning: In src/context/WalletProvider/*/components/Connect.tsx files across the ShapeShift web codebase, the established pattern for handling null/undefined adapter from getAdapter() is to simply check `if (adapter) { ... }` without an else clause. All wallet Connect components (Coinbase, Keplr, Phantom, Ledger, MetaMask, WalletConnectV2, KeepKey, Vultisig) follow this pattern—they reset loading state after the if block but do not show error messages when adapter is null. This is an intentional design decision and should be maintained for consistency.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11170
File: patches/@shapeshiftoss+bitcoinjs-lib+7.0.0-shapeshift.0.patch:9-19
Timestamp: 2025-11-25T21:43:10.838Z
Learning: In shapeshift/web, gomesalexandre will not expand PR scope to fix latent bugs in unused API surface (like bitcoinjs-lib patch validation methods) when comprehensive testing proves the actual used code paths work correctly, preferring to avoid costly hdwallet/web verdaccio publish cycles and full regression testing for conceptual issues with zero runtime impact.
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10231
File: src/components/MultiHopTrade/components/TradeInput/components/HighlightedTokens.tsx:14-14
Timestamp: 2025-08-08T15:00:22.321Z
Learning: In shapeshift/web reviews for NeOMakinG, avoid nitpicks to change deep-relative imports to '@/…' alias paths within feature/non-refactor PRs; defer such style-only changes to a dedicated follow-up refactor unless they fix an issue.

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.

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: 4

🧹 Nitpick comments (2)
src/lib/coingecko/utils.ts (1)

192-213: Confirm whether Zcash Coingecko support should respect the Zcash feature flag.

Adding zecChainId to getCoingeckoSupportedChainIds is structurally correct and matches the other chains. Given the PR notes that Zcash is behind a feature flag, please confirm if it’s intentional that Coingecko support is always enabled here (even when the flag is off), or if it should be gated similarly to Arbitrum Nova.

If you do want it gated, one possible adjustment:

 export const getCoingeckoSupportedChainIds = () => {
-  return [
+  const { VITE_FEATURE_ZCASH, VITE_FEATURE_ARBITRUM_NOVA } = getConfig()
+  return [
     ethChainId,
@@
-    suiChainId,
-    dogeChainId,
-    zecChainId,
-    ...(getConfig().VITE_FEATURE_ARBITRUM_NOVA ? [arbitrumNovaChainId] : []),
+    suiChainId,
+    dogeChainId,
+    ...(VITE_FEATURE_ZCASH ? [zecChainId] : []),
+    ...(VITE_FEATURE_ARBITRUM_NOVA ? [arbitrumNovaChainId] : []),
   ]
 }

This keeps Zcash fully behind the existing feature flag while following the same pattern as Arbitrum Nova.

src/state/slices/portfolioSlice/utils/index.ts (1)

116-117: Consider translation key for user-facing text.

The hardcoded 'Zcash' label appears to be user-facing text. Per coding guidelines, all copy/text should use translation keys rather than hardcoded strings. Consider whether this should use a translation key for internationalization support.

Additionally, if Zcash supports different account types (similar to Bitcoin's Legacy/Segwit/Segwit Native), those distinctions should be reflected in the label.

@gomesalexandre gomesalexandre self-requested a review December 5, 2025 11:21
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Implementation LGTM but impossible to test ZEC as it hasn't been regen'd.

image

Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Retested locally:

https://jam.dev/c/8775e669-a7a9-4a9e-a0b7-02936e414da1

  • can now see ZEC ✅
Image

Note, think the issue I was having before may be related to patch conflicts re: alpha i.e should autofix once we publish hdwallet. run yarn && yarn build:packages && yarn && yarn dev many times over + full cache nuke without luck, but yarn clean somehow saved it.

  • address derived is matching Trust's ✅

  • can swap to ZEC with Near ✅ (with #11298)

Image
  • can swap from ZEC with Near ✅ (with #11298)
Image
  • Tx history is happy (see Jam above) ✅

gomesalexandre and others added 3 commits December 5, 2025 16:22
Updates all @shapeshiftoss/hdwallet-* packages from 1.62.22-alpha.0 to 1.62.23 stable release.

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

Co-Authored-By: Claude <[email protected]>
Regenerated asset data and related asset index after merging develop.
Updates yarn.lock and migrations index.

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

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Sanity retest: https://jam.dev/c/3642bd17-351e-4da2-9eb4-1e30af16a921
Second sanity retest after 0c0c37a: https://jam.dev/c/c31ad5d1-b518-4bae-bb7f-a730a8bb5009
And third sanity retest because why not with flag off and Ledger to emulate prod , ensuring no crash: https://jam.dev/c/b709f41b-e47d-40ec-a9af-68bc8991f18a

@gomesalexandre gomesalexandre merged commit 77bb0d7 into develop Dec 5, 2025
4 checks passed
@gomesalexandre gomesalexandre deleted the zcash-support branch December 5, 2025 17:07
@coderabbitai coderabbitai bot mentioned this pull request Dec 10, 2025
1 task
@coderabbitai coderabbitai bot mentioned this pull request Dec 29, 2025
1 task
@coderabbitai coderabbitai bot mentioned this pull request Jan 12, 2026
1 task
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.

Zcash Support

2 participants