fix: ugly temp thor/maya chain fix - #11540
Conversation
📝 WalkthroughWalkthroughAdds nodeUrl-driven second-class chain support for Mayachain and Thorchain (new SecondClass adapters), switches plugin instantiation to those adapters, replaces Unchained API usage with node/midgard endpoints across swappers and status checks, and updates Mayachain environment URLs. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Client/UI
participant Plugin as Plugin (mayachain/thorchain)
participant Adapter as SecondClass Adapter
participant Node as Cosmos Node (nodeUrl)
participant Midgard as Midgard
participant EH as ErrorHandler
rect rgb(200,230,255)
Note over UI,Adapter: Account retrieval
UI->>Plugin: request account(pubkey)
Plugin->>Adapter: getAccount(pubkey)
Adapter->>Node: GET /cosmos/auth/v1beta1/accounts/{addr}
alt account found
Node-->>Adapter: account data
Adapter->>Node: GET /cosmos/bank/v1beta1/balances/{addr}
Node-->>Adapter: balances
Adapter-->>Plugin: Account (mapped assets)
Plugin-->>UI: Account
else node error
Node-->>Adapter: error
Adapter->>EH: wrap error
EH-->>UI: error
end
end
rect rgb(220,255,220)
Note over UI,Adapter: Broadcast flow
UI->>Plugin: broadcastTransaction({sender,receiver,hex})
Plugin->>Adapter: broadcastTransaction(...)
Adapter->>Adapter: sanction checks
alt addresses OK
Adapter->>Node: POST /cosmos/tx/v1beta1/txs (BROADCAST_MODE_SYNC) with hex
alt success (txhash / code 0)
Node-->>Adapter: tx hash
Adapter-->>Plugin: txHash
Plugin-->>UI: txHash
else node error / non-zero code
Node-->>Adapter: error
Adapter->>EH: wrap error
EH-->>UI: error
end
else sanctioned
Adapter->>EH: sanction error
EH-->>UI: error
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
09b1ba7 to
744e940
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.ts (1)
56-78: UnusedmayaMidgardUrlparameter.The
mayaMidgardUrlis accepted inSecondClassThorchainAdapterArgsbut not stored or used. Since this is a Thorchain adapter that only usesthorMidgardUrl, consider whether this parameter is needed.For a temporary fix, this is low priority, but worth noting for cleanup.
.env.development (1)
70-71: Environment URLs updated to public Mayachain endpoints.The URLs have been switched from ShapeShift's dev API (
dev-api.mayachain.shapeshift.com) to public Mayachain endpoints (mayanode.mayachain.info,midgard.mayachain.info), aligning with the PR's objective to use Maya-specific endpoints directly. Old values are preserved as comments for reference.Note: Static analysis reports key ordering warnings, but these are minor cosmetic issues that don't affect functionality. If you prefer alphabetical ordering of environment variables, consider reordering
VITE_MAYACHAIN_*keys to appear beforeVITE_THORCHAIN_*keys.Also applies to: 78-79
src/lib/utils/mayachain.ts (1)
17-28: Consider more descriptive error message.The generic "invalid chain adapter" error message could be more helpful for debugging. Consider including the chainId that was requested.
🔎 Suggested improvement
if (!isMayachainChainAdapter(adapter)) { - throw Error('invalid chain adapter') + throw Error(`Expected Mayachain chain adapter for chainId ${chainId}, but got invalid adapter`) }
📜 Review details
Configuration used: Organization 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.
📒 Files selected for processing (17)
.env.env.developmentpackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/constants/chains.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxsrc/lib/utils/mayachain.tssrc/lib/utils/thorchain/index.tssrc/plugins/mayachain/index.tsxsrc/plugins/thorchain/index.tsx
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{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 runyarn lint --fixandyarn type-checkafter making changes
Avoidletvariable assignments - preferconstwith inline IIFE switch statements or extract to functions for conditional logic
Files:
src/constants/chains.tssrc/lib/utils/mayachain.tspackages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tssrc/lib/utils/thorchain/index.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.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 inuseMemoand callbacks inuseCallbackwhere 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 usinguseColorModeValuehook
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()fromreact-polyglot
UseuseFeatureFlag('FlagName')hook to access feature flag values in components
Prefertypeoverinterfacefor type definitions
Use strict typing - avoidany
UseNominaltypes for domain identifiers (e.g.,WalletId,AccountId)
Import types from@shapeshiftoss/caipfor chain/account/asset IDs
UseuseAppSelectorfor Redux state
UseuseAppDispatchfor Redux actions
Memoize expensive computations withuseMemo
Memoize callbacks withuseCallback
**/*.{ts,tsx}: UseResult<T, E>pattern for error handling in swappers and APIs; ALWAYS useOk()andErr()from@sniptt/monads; AVOID throwing within swapper API implementations
ALWAYS use custom error classes from@shapeshiftoss/errorswith meaningful error codes for internationalization and relevant details in error objects
ALWAYS wrap async op...
Files:
src/constants/chains.tssrc/lib/utils/mayachain.tspackages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tssrc/lib/utils/thorchain/index.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.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
Usehandleprefix for event handlers with descriptive names in camelCase
Use descriptive boolean variable names withis,has,can,shouldprefixes
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 likedata,item,obj, and single-letter variable names except in loops
Avoid abbreviations in names unless they are widely understood
Avoid generic function names likefn,func, orcallback
Files:
src/constants/chains.tssrc/lib/utils/mayachain.tspackages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tssrc/lib/utils/thorchain/index.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
**/swapper{s,}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)
ALWAYS use
makeSwapErrorRightfor swapper errors withTradeQuoteErrorenum for error codes and provide detailed error information
Files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
packages/swapper/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)
packages/swapper/**/*.ts: Use TypeScript with explicit types (e.g., SupportedChainIds) for all code in the Swapper system
Use camelCase for variable and function names in the Swapper system
Use PascalCase for types, interfaces, and enums in the Swapper system
Use kebab-case for filenames in the Swapper system
Files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
packages/swapper/src/swappers/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)
packages/swapper/src/swappers/**/*.ts: Adhere to the Swapper directory structure: each swapper resides in packages/swapper/src/swappers// with required files (SwapperName.ts, endpoints.ts, types.ts, utils/constants.ts, utils/helpers.ts)
Validate inputs and log errors for debugging in Swapper system implementations
Swapper files must be located in packages/swapper/src/swappers/ directory structure and not placed outside this location
Avoid side effects in swap logic; ensure swap methods are deterministic and stateless
Files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
packages/swapper/src/swappers/*/*.ts
📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)
packages/swapper/src/swappers/*/*.ts: All swappers must implement the Swapper interface from packages/swapper/src/types.ts
Implement filterAssetIdsBySellable method to filter assets by supported chain IDs in the sell property
Implement filterBuyAssetsBySellAssetId method to filter assets by supported chain IDs in the buy property
Reuse executeEvmTransaction utility for EVM-based swappers instead of implementing custom transaction execution
Files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
packages/swapper/src/swappers/*/endpoints.ts
📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)
packages/swapper/src/swappers/*/endpoints.ts: All swapper API implementations must implement the SwapperApi interface from packages/swapper/src/types.ts
Reuse checkEvmSwapStatus utility for checking EVM swap status instead of implementing custom status checks
Files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)
**/*.{tsx,jsx}: ALWAYS wrap React components in error boundaries and provide user-friendly fallback components with error logging
ALWAYS useuseErrorToasthook for displaying errors with translated error messages and handle different error types appropriatelyUse PascalCase for React component names and match the component name to the file name
Files:
src/plugins/mayachain/index.tsxsrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)
**/*.{jsx,tsx}: ALWAYS useuseMemofor expensive computations, object/array creations, and filtered data
ALWAYS useuseMemofor derived values and computed properties
ALWAYS useuseMemofor conditional values and simple transformations
ALWAYS useuseCallbackfor event handlers and functions passed as props
ALWAYS useuseCallbackfor any function that could be passed as a prop or dependency
ALWAYS include all dependencies inuseEffect,useMemo,useCallbackdependency arrays
NEVER use// eslint-disable-next-line react-hooks/exhaustive-depsunless absolutely necessary, and ALWAYS explain why dependencies are excluded if using eslint disable
ALWAYS use named exports for components; NEVER use default exports for components
KEEP component files under 200 lines when possible; BREAK DOWN large components into smaller, reusable pieces
EXTRACT complex logic into custom hooks
ALWAYS wrap components in error boundaries for production
ALWAYS handle async errors properly in async operations
ALWAYS provide user-friendly error messages in error handling
ALWAYS use virtualization for lists with 100+ items
ALWAYS implement proper key props for list items
ALWAYS lazy load heavy components using React.lazy for code splitting
ALWAYS use Suspense wrapper for lazy loaded components
USE local state for component-level state; LIFT state up when needed across multiple components; USE Context for avoiding prop drilling; USE Redux only for global state shared across multiple places
Wrap components receiving props withmemofor performance optimization
Files:
src/plugins/mayachain/index.tsxsrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)
Ensure TypeScript types are explicit and proper; avoid use of
anytype
Files:
src/plugins/mayachain/index.tsxsrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
{.env.development,.env.production}
📄 CodeRabbit inference engine (CLAUDE.md)
Use
.env.developmentfor dev-only features and.env.productionfor prod settings
Files:
.env.development
🧠 Learnings (43)
📓 Common learnings
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: 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: 10461
File: src/plugins/walletConnectToDapps/utils/tenderly/index.ts:0-0
Timestamp: 2025-09-12T11:56:19.437Z
Learning: gomesalexandre rejected verbose try/catch error handling for address validation in Tenderly integration (PR #10461), calling the approach "ugly" but still implemented safety measures in commit ad7e424b89, preferring cleaner safety implementations over defensive programming patterns.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11536
File: src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx:252-265
Timestamp: 2025-12-27T16:02:52.792Z
Learning: When fixing critical bugs in shapeshift/web, gomesalexandre prefers to keep changes minimal and focused on correctness rather than combining bug fixes with code quality improvements like extracting duplicated logic, even when duplication is present.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10232
File: packages/unchained-client/openapitools.json:230-230
Timestamp: 2025-08-08T10:23:06.773Z
Learning: In shapeshift/web, for temporary monkey patches (e.g., OpenAPI inputSpec URLs in packages/unchained-client/openapitools.json), gomesalexandre is not concerned about commit SHA pinning; tag-based CDN URLs (e.g., jsDelivr branch) are acceptable during the temporary period.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10265
File: src/pages/ThorChainLP/queries/hooks/usePools.ts:93-0
Timestamp: 2025-08-13T13:45:25.748Z
Learning: In the ShapeShift web app, inbound addresses data for Thorchain pools requires aggressive caching settings (staleTime: 0, gcTime: 0, refetchInterval: 60_000) to ensure trading status and LP deposit availability are always current. This is intentional business-critical behavior, not a performance issue to be optimized.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/utils/constants.ts : Define supported chain IDs for each swapper in utils/constants.ts with both 'sell' and 'buy' properties following the pattern: SupportedChainIds type
Applied to files:
src/constants/chains.tssrc/lib/utils/mayachain.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.ts
📚 Learning: 2025-12-17T14:50:01.629Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11449
File: packages/chain-adapters/src/tron/TronChainAdapter.ts:570-596
Timestamp: 2025-12-17T14:50:01.629Z
Learning: In packages/chain-adapters/src/tron/TronChainAdapter.ts, the parseTx method uses `unknown` type for the txHashOrTx parameter intentionally. TRON is a "second-class chain" that works differently from other chains - it accepts either a string hash (to fetch TronTx via unchained client) or a TronTx object directly. The base chain-adapter interface is strongly typed and doesn't accommodate this flexible signature, so `unknown` is used as an appropriate escape hatch rather than a type safety issue.
Applied to files:
src/lib/utils/mayachain.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/lib/utils/thorchain/index.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.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 **/*.{ts,tsx} : Import types from `shapeshiftoss/caip` for chain/account/asset IDs
Applied to files:
src/lib/utils/mayachain.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-12-04T22:57:50.850Z
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.850Z
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:
src/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tssrc/plugins/mayachain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-11-19T16:59:50.569Z
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.
Applied to files:
src/lib/utils/mayachain.ts
📚 Learning: 2025-09-12T13:44:17.019Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/hooks/useSimulateEvmTransaction.ts:0-0
Timestamp: 2025-09-12T13:44:17.019Z
Learning: gomesalexandre prefers letting chain adapter errors throw naturally in useSimulateEvmTransaction rather than adding explicit error handling for missing adapters, consistent with his fail-fast approach and dismissal of defensive validation as "stale" in WalletConnect transaction simulation flows.
Applied to files:
src/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-10-23T14:27:19.073Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10857
File: src/plugins/walletConnectToDapps/eventsManager/useWalletConnectEventsHandler.ts:101-104
Timestamp: 2025-10-23T14:27:19.073Z
Learning: In WalletConnect wallet_switchEthereumChain and wallet_addEthereumChain requests, the chainId parameter is always present as per the protocol spec. Type guards checking for missing chainId in these handlers (like `if (!evmNetworkIdHex) return`) are solely for TypeScript compiler satisfaction, not real runtime edge cases.
Applied to files:
src/lib/utils/mayachain.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/endpoints.ts : Reuse checkEvmSwapStatus utility for checking EVM swap status instead of implementing custom status checks
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/endpoints.ts : All swapper API implementations must implement the SwapperApi interface from packages/swapper/src/types.ts
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-12-04T11:05:01.146Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11281
File: packages/swapper/src/swappers/PortalsSwapper/utils/fetchSquidStatus.ts:98-106
Timestamp: 2025-12-04T11:05:01.146Z
Learning: In packages/swapper/src/swappers/PortalsSwapper/utils/fetchSquidStatus.ts, getSquidTrackingLink should return blockchain explorer links (using Asset.explorerTxLink) rather than API endpoints. For non-GMP Squid swaps: return source chain explorer link with sourceTxHash when pending/failed, and destination chain explorer link with destinationTxHash when confirmed.
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/lib/utils/thorchain/index.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-12-09T21:06:15.748Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11335
File: packages/swapper/src/swappers/CetusSwapper/endpoints.ts:66-68
Timestamp: 2025-12-09T21:06:15.748Z
Learning: In packages/swapper/src/swappers/CetusSwapper/endpoints.ts, gomesalexandre is comfortable with throwing errors directly in getUnsignedSuiTransaction and similar transaction preparation methods, rather than using the Result pattern. The Result pattern with makeSwapErrorRight/TradeQuoteError is primarily for the main swapper API methods (getTradeQuote, getTradeRate), while helper/preparation methods can use throws.
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/**/*.test.ts : Write unit tests for swapper methods and API endpoints
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-12-01T22:01:37.982Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11240
File: packages/swapper/src/swappers/CetusSwapper/endpoints.ts:56-58
Timestamp: 2025-12-01T22:01:37.982Z
Learning: In packages/swapper/src/swappers/CetusSwapper/endpoints.ts, gomesalexandre is comfortable with mutating the shared Cetus SDK singleton instance (sdk.senderAddress = from) when required by the SDK API, preferring pragmatic working code over theoretical statelessness concerns.
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/**/*.ts : Avoid side effects in swap logic; ensure swap methods are deterministic and stateless
Applied to files:
packages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-11-24T21:20:17.804Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-11-24T21:20:17.804Z
Learning: Applies to **/swapper{s,}/**/*.{ts,tsx} : ALWAYS use `makeSwapErrorRight` for swapper errors with `TradeQuoteError` enum for error codes and provide detailed error information
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
📚 Learning: 2025-12-09T21:07:22.474Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11335
File: packages/swapper/src/swappers/CetusSwapper/utils/helpers.ts:3-3
Timestamp: 2025-12-09T21:07:22.474Z
Learning: In packages/swapper/src/swappers/CetusSwapper, mysten/sui types (SuiClient, Transaction) must be imported from the nested path within cetusprotocol/aggregator-sdk (e.g., 'cetusprotocol/aggregator-sdk/node_modules/mysten/sui/client') because the aggregator SDK bundles its own version of mysten/sui. Direct imports from 'mysten/sui' break at runtime even when specified in package.json.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/*.ts : Reuse executeEvmTransaction utility for EVM-based swappers instead of implementing custom transaction execution
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) for all code in the Swapper system
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-14T17:54:32.563Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx:97-108
Timestamp: 2025-08-14T17:54:32.563Z
Learning: In ReusableLpStatus component (src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx), the txAssets dependency is stable from first render because poolAsset, baseAsset, actionSide, and action are all defined first render, making the current txAssetsStatuses initialization pattern safe without needing useEffect synchronization.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/lib/utils/thorchain/index.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/*.ts : Implement filterAssetIdsBySellable method to filter assets by supported chain IDs in the sell property
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-08-05T23:36:13.214Z
Learnt from: premiumjibles
Repo: shapeshift/web PR: 10187
File: src/state/slices/preferencesSlice/selectors.ts:21-25
Timestamp: 2025-08-05T23:36:13.214Z
Learning: The AssetId type from 'shapeshiftoss/caip' package is a string type alias, so it can be used directly as a return type for cache key resolvers in re-reselect selectors without needing explicit string conversion.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-09-12T10:21:26.693Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/EIP712MessageDisplay.tsx:0-0
Timestamp: 2025-09-12T10:21:26.693Z
Learning: gomesalexandre explained that in WalletConnect V2, the request context chainId comes from params?.chainId following CAIP2 standards, making both the request params chainId and EIP-712 domain chainId equally reliable sources. He considers both approaches trustworthy ("both gucci") for WalletConnect dApps integration.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/plugins/mayachain/index.tsx
📚 Learning: 2025-08-26T19:04:38.672Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10369
File: packages/chain-adapters/src/cosmossdk/CosmosSdkBaseAdapter.ts:167-176
Timestamp: 2025-08-26T19:04:38.672Z
Learning: In packages/chain-adapters/src/cosmossdk/CosmosSdkBaseAdapter.ts, when processing assets from data.assets.reduce(), the team prefers using empty catch blocks to gracefully skip any assets that fail processing, rather than specific error type handling, to avoid useless noise and ensure robust asset filtering.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-08-22T12:58:26.590Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10323
File: src/components/Layout/Header/ActionCenter/components/GenericTransactionActionCard.tsx:108-111
Timestamp: 2025-08-22T12:58:26.590Z
Learning: In the RFOX GenericTransactionDisplayType flow in src/components/Layout/Header/ActionCenter/components/GenericTransactionActionCard.tsx, the txHash is always guaranteed to be present according to NeOMakinG, so defensive null checks for txLink are not needed in this context.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/lib/utils/thorchain/index.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
📚 Learning: 2025-08-04T15:36:25.122Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10171
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandedStepperSteps.tsx:458-458
Timestamp: 2025-08-04T15:36:25.122Z
Learning: In swap transaction handling, buy transaction hashes should always use the swapper's explorer (stepSource) because they are known by the swapper immediately upon swap execution. The conditional logic for using default explorers applies primarily to sell transactions which need to be detected/indexed by external systems like Thorchain or ViewBlock.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/index.ts : Export unique functions and types from packages/swapper/src/index.ts only if needed for external consumption
Applied to files:
packages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/index.ts
📚 Learning: 2025-08-22T15:07:18.021Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10326
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:37-41
Timestamp: 2025-08-22T15:07:18.021Z
Learning: In src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx, kaladinlight prefers not to await the upsertBasePortfolio call in the Base chain handling block, indicating intentional fire-and-forget behavior for Base portfolio upserts in the THORChain LP completion flow.
Applied to files:
src/lib/utils/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxpackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.ts
📚 Learning: 2025-12-27T16:02:52.792Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11536
File: src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx:252-265
Timestamp: 2025-12-27T16:02:52.792Z
Learning: When reviewing bug fixes, especially in shapeshift/web, prefer minimal changes that fix correctness over introducing broader refactors or quality-of-life improvements (e.g., extracting duplicated logic) unless such improvements are essential to the fix. Apply this guideline broadly to TSX files and related components, not just the specific location, to keep changes focused and maintainable.
Applied to files:
src/plugins/mayachain/index.tsxsrc/plugins/thorchain/index.tsxsrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
📚 Learning: 2025-08-17T21:53:03.806Z
Learnt from: 0xApotheosis
Repo: shapeshift/web PR: 10290
File: scripts/generateAssetData/color-map.json:41-47
Timestamp: 2025-08-17T21:53:03.806Z
Learning: In the ShapeShift web codebase, native assets (using CAIP-19 slip44 namespace like eip155:1/slip44:60, bip122:.../slip44:..., cosmos:.../slip44:...) are manually hardcoded and not generated via the automated asset generation script. Only ERC20/BEP20 tokens go through the asset generation process. The validation scripts should only validate generated assets, not manually added native assets.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-09-04T17:29:59.479Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10380
File: src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx:28-33
Timestamp: 2025-09-04T17:29:59.479Z
Learning: In shapeshift/web, the useGetPopularAssetsQuery function in src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx intentionally uses primaryAssets[assetId] instead of falling back to assets[assetId]. The design distributes primary assets across chains by iterating through their related assets and adding the primary asset to each related asset's chain. This ensures primary assets appear in all chains where they have related assets, supporting the grouped asset system.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/*.ts : Implement filterBuyAssetsBySellAssetId method to filter assets by supported chain IDs in the buy property
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-08-05T22:41:35.473Z
Learnt from: premiumjibles
Repo: shapeshift/web PR: 10187
File: src/pages/Assets/Asset.tsx:1-1
Timestamp: 2025-08-05T22:41:35.473Z
Learning: In the shapeshift/web codebase, component imports use direct file paths like '@/components/ComponentName/ComponentName' rather than barrel exports. The AssetAccountDetails component should be imported as '@/components/AssetAccountDetails/AssetAccountDetails', not from a directory index.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/**/*.ts : Validate inputs and log errors for debugging in Swapper system implementations
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 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/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-09-18T23:47:14.810Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10566
File: src/hooks/useWalletSupportsChain/useWalletSupportsChain.ts:55-66
Timestamp: 2025-09-18T23:47:14.810Z
Learning: In the useWalletSupportsChain architecture, checkWalletHasRuntimeSupport() determines if the app has runtime capability to interact with a chain type (not actual signing capabilities), while walletSupportsChain() does the actual capabilities detection by checking account IDs. For Ledger read-only mode, checkWalletHasRuntimeSupport should return true since the app can display balances/addresses, with KeyManager being the source of truth rather than wallet instance.
Applied to files:
packages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 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:
src/plugins/thorchain/index.tsx
📚 Learning: 2025-08-22T13:16:12.721Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10323
File: src/pages/RFOX/hooks/useRfoxRewardDistributionActionSubscriber.tsx:104-105
Timestamp: 2025-08-22T13:16:12.721Z
Learning: In src/pages/RFOX/hooks/useRfoxRewardDistributionActionSubscriber.tsx, the guard `if (!actions[actionId]) return` before upserting completed reward distributions is intentional product behavior. NeOMakinG confirmed that the system should only show completion notifications for reward distributions that were previously seen in a pending state, not for distributions the user missed during the pending phase.
Applied to files:
src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
📚 Learning: 2025-08-22T14:59:04.889Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10326
File: src/hooks/useActionCenterSubscribers/useGenericTransactionSubscriber.tsx:105-111
Timestamp: 2025-08-22T14:59:04.889Z
Learning: In the ShapeShift web Base chain handling, the await pattern inside forEach in useGenericTransactionSubscriber is intentional to delay the entire action completion flow (not just fetchBasePortfolio) for Base chain transactions. The user kaladinlight wants everything below the Base portfolio refresh - including dispatch, query invalidation, and toast notifications - to also be delayed by ~10 seconds to accommodate Base's degraded node state.
Applied to files:
src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
📚 Learning: 2025-12-03T23:19:39.158Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11275
File: headers/csps/chains/plasma.ts:1-10
Timestamp: 2025-12-03T23:19:39.158Z
Learning: For CSP files in headers/csps/chains/, gomesalexandre prefers using Vite's loadEnv() pattern directly to load environment variables (e.g., VITE_PLASMA_NODE_URL, VITE_MONAD_NODE_URL) for consistency with existing second-class chain CSP files, rather than using getConfig() from src/config.ts, even though other parts of the codebase use validated config values.
Applied to files:
.env.env.development
📚 Learning: 2025-08-13T13:45:25.748Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10265
File: src/pages/ThorChainLP/queries/hooks/usePools.ts:93-0
Timestamp: 2025-08-13T13:45:25.748Z
Learning: In the ShapeShift web app, inbound addresses data for Thorchain pools requires aggressive caching settings (staleTime: 0, gcTime: 0, refetchInterval: 60_000) to ensure trading status and LP deposit availability are always current. This is intentional business-critical behavior, not a performance issue to be optimized.
Applied to files:
.env.env.development
📚 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 {.env.development,.env.production} : Use `.env.development` for dev-only features and `.env.production` for prod settings
Applied to files:
.env.development
📚 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/config.ts : Default values always come from environment variables prefixed with `VITE_FEATURE_`
Applied to files:
.env.development
🧬 Code graph analysis (6)
src/lib/utils/mayachain.ts (2)
packages/caip/src/constants.ts (1)
mayachainChainId(82-82)src/config.ts (1)
getConfig(239-241)
src/lib/utils/thorchain/index.ts (2)
src/config.ts (1)
getConfig(239-241)packages/swapper/src/thorchain-utils/types.ts (1)
MidgardActionsResponse(107-109)
src/plugins/mayachain/index.tsx (1)
src/config.ts (1)
getConfig(239-241)
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.ts (5)
packages/chain-adapters/src/types.ts (3)
Account(61-67)BroadcastTransactionInput(409-413)CONTRACT_INTERACTION(30-30)packages/chain-adapters/src/cosmossdk/types.ts (1)
Account(7-15)packages/caip/src/assetId/assetId.ts (1)
AssetId(17-17)packages/caip/src/utils.ts (1)
generateAssetIdFromCosmosSdkDenom(21-32)packages/chain-adapters/src/utils/validateAddress.ts (1)
assertAddressNotSanctioned(7-24)
src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx (2)
src/lib/utils/thorchain/index.ts (1)
getThorchainSendTransactionStatus(41-73)src/lib/utils/mayachain.ts (1)
getMayachainTransactionStatus(30-52)
packages/swapper/src/swappers/ThorchainSwapper/endpoints.ts (1)
packages/swapper/src/thorchain-utils/checkTradeStatus.ts (1)
checkTradeStatus(16-105)
🪛 dotenv-linter (4.0.0)
.env
[warning] 161-161: [UnorderedKey] The VITE_MAYACHAIN_NODE_URL key should go before the VITE_MONAD_NODE_URL key
(UnorderedKey)
[warning] 162-162: [UnorderedKey] The VITE_SOLANA_NODE_URL key should go before the VITE_THORCHAIN_NODE_URL key
(UnorderedKey)
[warning] 164-164: [UnorderedKey] The VITE_ALCHEMY_POLYGON_URL key should go before the VITE_ARBITRUM_NODE_URL key
(UnorderedKey)
[warning] 170-170: [UnorderedKey] The VITE_MAYACHAIN_MIDGARD_URL key should go before the VITE_THORCHAIN_MIDGARD_URL key
(UnorderedKey)
.env.development
[warning] 71-71: [UnorderedKey] The VITE_MAYACHAIN_NODE_URL key should go before the VITE_MONAD_NODE_URL key
(UnorderedKey)
[warning] 72-72: [UnorderedKey] The VITE_SOLANA_NODE_URL key should go before the VITE_THORCHAIN_NODE_URL key
(UnorderedKey)
[warning] 79-79: [UnorderedKey] The VITE_MAYACHAIN_MIDGARD_URL key should go before the VITE_THORCHAIN_MIDGARD_URL 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). (1)
- GitHub Check: Call / Static
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
744e940 to
68e40c3
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/lib/utils/mayachain.ts (1)
10-15: Type guard needs method existence check before invocation.This issue was previously flagged. Calling
getChainId()without first verifying the method exists could throw at runtime for unexpected object shapes.
🧹 Nitpick comments (2)
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.ts (1)
416-450: Duplicate sanctions validation inbroadcastTransaction.The sanctions check is already performed in
signAndBroadcastTransaction(lines 337-340) before callingbroadcastTransaction. This method performs the same check again. While not harmful, it adds unnecessary latency.Consider whether this duplication is intentional (for standalone
broadcastTransactioncalls) or if it can be removed since callers already validate.🔎 If broadcastTransaction is only called via signAndBroadcastTransaction
async broadcastTransaction({ senderAddress, receiverAddress, hex, }: BroadcastTransactionInput): Promise<string> { try { - await Promise.all([ - assertAddressNotSanctioned(senderAddress), - receiverAddress !== CONTRACT_INTERACTION && assertAddressNotSanctioned(receiverAddress), - ]) - const response = await fetch(`${this.nodeUrl}/cosmos/tx/v1beta1/txs`, {src/lib/utils/mayachain.ts (1)
30-52: Consider adding Midgard fallback for consistency with Thorchain version.Unlike
getThorchainSendTransactionStatus, this function doesn't fall back to Midgard when the Cosmos endpoint lacks data. If MAYAChain has MsgDeposit-style transactions that the Cosmos endpoint doesn't handle, users may see incorrect "Unknown" status.Additionally, this uses
fetchwhile the Thorchain version usesaxios- minor inconsistency that could be unified.🔎 Optional: Add Midgard fallback for parity with Thorchain
+import axios from 'axios' +import type { MidgardActionsResponse } from '@shapeshiftoss/swapper' + export const getMayachainTransactionStatus = async (txHash: string): Promise<TxStatus> => { try { const nodeUrl = getConfig().VITE_MAYACHAIN_NODE_URL - const response = await fetch(`${nodeUrl}/cosmos/tx/v1beta1/txs/${txHash}`) + const response = await axios.get(`${nodeUrl}/cosmos/tx/v1beta1/txs/${txHash}`, { + validateStatus: () => true, + }) - if (!response.ok) { - if (response.status === 404) return TxStatus.Pending - return TxStatus.Unknown + if (response.data?.tx_response) { + if (response.data.tx_response.code === 0) return TxStatus.Confirmed + return TxStatus.Failed } - const data = (await response.json()) as { - tx_response?: { code: number; txhash: string } - } - - if (!data.tx_response) return TxStatus.Unknown - - if (data.tx_response.code === 0) return TxStatus.Confirmed - return TxStatus.Failed + // Fallback to Midgard for MsgDeposit txs + const midgardUrl = getConfig().VITE_MAYACHAIN_MIDGARD_URL + const midgardResponse = await axios.get<MidgardActionsResponse>( + `${midgardUrl}/actions?txid=${txHash}`, + { validateStatus: () => true }, + ) + + if (midgardResponse.data?.actions?.length) { + const action = midgardResponse.data.actions[0] + if (action.status === 'success') return TxStatus.Confirmed + if (action.status === 'pending') return TxStatus.Pending + return TxStatus.Failed + } + + return TxStatus.Pending } catch (error) {
📜 Review details
Configuration used: Organization 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.
📒 Files selected for processing (17)
.env.env.developmentpackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/index.tspackages/swapper/src/swappers/MayachainSwapper/endpoints.tspackages/swapper/src/swappers/ThorchainSwapper/endpoints.tspackages/swapper/src/thorchain-utils/checkTradeStatus.tssrc/constants/chains.tssrc/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsxsrc/lib/utils/mayachain.tssrc/lib/utils/thorchain/index.tssrc/plugins/mayachain/index.tsxsrc/plugins/thorchain/index.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
- packages/swapper/src/swappers/ThorchainSwapper/endpoints.ts
- packages/swapper/src/swappers/MayachainSwapper/endpoints.ts
- packages/chain-adapters/src/cosmossdk/thorchain/index.ts
- src/plugins/mayachain/index.tsx
- src/hooks/useActionCenterSubscribers/useSendActionSubscriber.tsx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{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 runyarn lint --fixandyarn type-checkafter making changes
Avoidletvariable assignments - preferconstwith inline IIFE switch statements or extract to functions for conditional logic
Files:
src/plugins/thorchain/index.tsxsrc/lib/utils/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tssrc/constants/chains.tspackages/swapper/src/thorchain-utils/checkTradeStatus.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 inuseMemoand callbacks inuseCallbackwhere 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 usinguseColorModeValuehook
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()fromreact-polyglot
UseuseFeatureFlag('FlagName')hook to access feature flag values in components
Prefertypeoverinterfacefor type definitions
Use strict typing - avoidany
UseNominaltypes for domain identifiers (e.g.,WalletId,AccountId)
Import types from@shapeshiftoss/caipfor chain/account/asset IDs
UseuseAppSelectorfor Redux state
UseuseAppDispatchfor Redux actions
Memoize expensive computations withuseMemo
Memoize callbacks withuseCallback
**/*.{ts,tsx}: UseResult<T, E>pattern for error handling in swappers and APIs; ALWAYS useOk()andErr()from@sniptt/monads; AVOID throwing within swapper API implementations
ALWAYS use custom error classes from@shapeshiftoss/errorswith meaningful error codes for internationalization and relevant details in error objects
ALWAYS wrap async op...
Files:
src/plugins/thorchain/index.tsxsrc/lib/utils/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tssrc/constants/chains.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)
**/*.{tsx,jsx}: ALWAYS wrap React components in error boundaries and provide user-friendly fallback components with error logging
ALWAYS useuseErrorToasthook for displaying errors with translated error messages and handle different error types appropriatelyUse PascalCase for React component names and match the component name to the file name
Files:
src/plugins/thorchain/index.tsx
**/*.{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
Usehandleprefix for event handlers with descriptive names in camelCase
Use descriptive boolean variable names withis,has,can,shouldprefixes
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 likedata,item,obj, and single-letter variable names except in loops
Avoid abbreviations in names unless they are widely understood
Avoid generic function names likefn,func, orcallback
Files:
src/plugins/thorchain/index.tsxsrc/lib/utils/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tssrc/constants/chains.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)
**/*.{jsx,tsx}: ALWAYS useuseMemofor expensive computations, object/array creations, and filtered data
ALWAYS useuseMemofor derived values and computed properties
ALWAYS useuseMemofor conditional values and simple transformations
ALWAYS useuseCallbackfor event handlers and functions passed as props
ALWAYS useuseCallbackfor any function that could be passed as a prop or dependency
ALWAYS include all dependencies inuseEffect,useMemo,useCallbackdependency arrays
NEVER use// eslint-disable-next-line react-hooks/exhaustive-depsunless absolutely necessary, and ALWAYS explain why dependencies are excluded if using eslint disable
ALWAYS use named exports for components; NEVER use default exports for components
KEEP component files under 200 lines when possible; BREAK DOWN large components into smaller, reusable pieces
EXTRACT complex logic into custom hooks
ALWAYS wrap components in error boundaries for production
ALWAYS handle async errors properly in async operations
ALWAYS provide user-friendly error messages in error handling
ALWAYS use virtualization for lists with 100+ items
ALWAYS implement proper key props for list items
ALWAYS lazy load heavy components using React.lazy for code splitting
ALWAYS use Suspense wrapper for lazy loaded components
USE local state for component-level state; LIFT state up when needed across multiple components; USE Context for avoiding prop drilling; USE Redux only for global state shared across multiple places
Wrap components receiving props withmemofor performance optimization
Files:
src/plugins/thorchain/index.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/react-best-practices.mdc)
Ensure TypeScript types are explicit and proper; avoid use of
anytype
Files:
src/plugins/thorchain/index.tsx
**/swapper{s,}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)
ALWAYS use
makeSwapErrorRightfor swapper errors withTradeQuoteErrorenum for error codes and provide detailed error information
Files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
packages/swapper/**/*.ts
📄 CodeRabbit inference engine (.cursor/rules/swapper.mdc)
packages/swapper/**/*.ts: Use TypeScript with explicit types (e.g., SupportedChainIds) for all code in the Swapper system
Use camelCase for variable and function names in the Swapper system
Use PascalCase for types, interfaces, and enums in the Swapper system
Use kebab-case for filenames in the Swapper system
Files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
{.env.development,.env.production}
📄 CodeRabbit inference engine (CLAUDE.md)
Use
.env.developmentfor dev-only features and.env.productionfor prod settings
Files:
.env.development
🧠 Learnings (41)
📓 Common learnings
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: 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: 10461
File: src/plugins/walletConnectToDapps/utils/tenderly/index.ts:0-0
Timestamp: 2025-09-12T11:56:19.437Z
Learning: gomesalexandre rejected verbose try/catch error handling for address validation in Tenderly integration (PR #10461), calling the approach "ugly" but still implemented safety measures in commit ad7e424b89, preferring cleaner safety implementations over defensive programming patterns.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11536
File: src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx:252-265
Timestamp: 2025-12-27T16:02:52.792Z
Learning: When fixing critical bugs in shapeshift/web, gomesalexandre prefers to keep changes minimal and focused on correctness rather than combining bug fixes with code quality improvements like extracting duplicated logic, even when duplication is present.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10232
File: packages/unchained-client/openapitools.json:230-230
Timestamp: 2025-08-08T10:23:06.773Z
Learning: In shapeshift/web, for temporary monkey patches (e.g., OpenAPI inputSpec URLs in packages/unchained-client/openapitools.json), gomesalexandre is not concerned about commit SHA pinning; tag-based CDN URLs (e.g., jsDelivr branch) are acceptable during the temporary period.
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.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10265
File: src/pages/ThorChainLP/queries/hooks/usePools.ts:93-0
Timestamp: 2025-08-13T13:45:25.748Z
Learning: In the ShapeShift web app, inbound addresses data for Thorchain pools requires aggressive caching settings (staleTime: 0, gcTime: 0, refetchInterval: 60_000) to ensure trading status and LP deposit availability are always current. This is intentional business-critical behavior, not a performance issue to be optimized.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/config.ts:127-128
Timestamp: 2025-08-07T11:20:44.614Z
Learning: gomesalexandre prefers required environment variables without default values in the config file (src/config.ts). They want explicit configuration and fail-fast behavior when environment variables are missing, rather than having fallback defaults.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/ContractInteractionBreakdown.tsx:0-0
Timestamp: 2025-09-13T16:45:18.813Z
Learning: gomesalexandre prefers aggressively deleting unused/obsolete code files ("ramboing") rather than fixing technical issues in code that won't be used, demonstrating his preference for keeping codebases clean and PR scope focused.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10458
File: src/plugins/walletConnectToDapps/types.ts:7-7
Timestamp: 2025-09-10T15:34:29.604Z
Learning: gomesalexandre is comfortable relying on transitive dependencies (like abitype through ethers/viem) rather than explicitly declaring them in package.json, preferring to avoid package.json bloat when the transitive dependency approach works reliably in practice.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10503
File: .env:56-56
Timestamp: 2025-09-16T13:17:02.938Z
Learning: gomesalexandre prefers to enable feature flags globally in the base .env file when the intent is to activate features everywhere, even when there are known issues like crashes, demonstrating his preference for intentional global feature rollouts over cautious per-environment enablement.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10249
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:447-503
Timestamp: 2025-08-13T17:07:10.763Z
Learning: gomesalexandre prefers relying on TypeScript's type system for validation rather than adding defensive runtime null checks when types are properly defined. They favor a TypeScript-first approach over defensive programming with runtime validations.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/hooks/useActionCenterSubscribers/useThorchainLpDepositActionSubscriber.tsx:61-66
Timestamp: 2025-08-14T17:51:47.556Z
Learning: gomesalexandre is not concerned about structured logging and prefers to keep console.error usage as-is rather than implementing structured logging patterns, even when project guidelines suggest otherwise.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10413
File: src/components/Modals/FiatRamps/fiatRampProviders/onramper/utils.ts:29-55
Timestamp: 2025-09-02T14:26:19.028Z
Learning: gomesalexandre prefers to keep preparatory/reference code simple until it's actively consumed, rather than implementing comprehensive error handling, validation, and robustness improvements upfront. They prefer to add these improvements when the code is actually being used in production.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/TransactionRow.tsx:396-402
Timestamp: 2025-08-14T17:55:57.490Z
Learning: gomesalexandre is comfortable with functions/variables that return undefined or true (tri-state) when only the truthy case matters, preferring to rely on JavaScript's truthy/falsy behavior rather than explicitly returning boolean values.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10783
File: src/context/ModalStackProvider/useModalRegistration.ts:30-41
Timestamp: 2025-10-16T11:14:40.657Z
Learning: gomesalexandre prefers to add lint rules (like typescript-eslint/strict-boolean-expressions for truthiness checks on numbers) to catch common issues project-wide rather than relying on code review to catch them.
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10206
File: src/lib/moralis.ts:47-85
Timestamp: 2025-08-07T11:22:16.983Z
Learning: gomesalexandre prefers console.error over structured logging for Moralis API integration debugging, as they find it more conventional and prefer to examine XHR requests directly rather than rely on structured logs for troubleshooting.
📚 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:
src/plugins/thorchain/index.tsx
📚 Learning: 2025-12-17T14:50:01.629Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11449
File: packages/chain-adapters/src/tron/TronChainAdapter.ts:570-596
Timestamp: 2025-12-17T14:50:01.629Z
Learning: In packages/chain-adapters/src/tron/TronChainAdapter.ts, the parseTx method uses `unknown` type for the txHashOrTx parameter intentionally. TRON is a "second-class chain" that works differently from other chains - it accepts either a string hash (to fetch TronTx via unchained client) or a TronTx object directly. The base chain-adapter interface is strongly typed and doesn't accommodate this flexible signature, so `unknown` is used as an appropriate escape hatch rather than a type safety issue.
Applied to files:
src/plugins/thorchain/index.tsxsrc/lib/utils/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.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 **/*.{ts,tsx} : Import types from `shapeshiftoss/caip` for chain/account/asset IDs
Applied to files:
src/plugins/thorchain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/utils/constants.ts : Define supported chain IDs for each swapper in utils/constants.ts with both 'sell' and 'buy' properties following the pattern: SupportedChainIds type
Applied to files:
src/plugins/thorchain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tssrc/constants/chains.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-12-04T22:57:50.850Z
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.850Z
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:
src/plugins/thorchain/index.tsxpackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/mayachain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-12-27T16:02:52.792Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11536
File: src/components/MultiHopTrade/components/TradeConfirm/hooks/useTradeExecution.tsx:252-265
Timestamp: 2025-12-27T16:02:52.792Z
Learning: When reviewing bug fixes, especially in shapeshift/web, prefer minimal changes that fix correctness over introducing broader refactors or quality-of-life improvements (e.g., extracting duplicated logic) unless such improvements are essential to the fix. Apply this guideline broadly to TSX files and related components, not just the specific location, to keep changes focused and maintainable.
Applied to files:
src/plugins/thorchain/index.tsx
📚 Learning: 2025-12-04T11:05:01.146Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11281
File: packages/swapper/src/swappers/PortalsSwapper/utils/fetchSquidStatus.ts:98-106
Timestamp: 2025-12-04T11:05:01.146Z
Learning: In packages/swapper/src/swappers/PortalsSwapper/utils/fetchSquidStatus.ts, getSquidTrackingLink should return blockchain explorer links (using Asset.explorerTxLink) rather than API endpoints. For non-GMP Squid swaps: return source chain explorer link with sourceTxHash when pending/failed, and destination chain explorer link with destinationTxHash when confirmed.
Applied to files:
src/lib/utils/thorchain/index.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-14T17:54:32.563Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10276
File: src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx:97-108
Timestamp: 2025-08-14T17:54:32.563Z
Learning: In ReusableLpStatus component (src/pages/ThorChainLP/components/ReusableLpStatus/ReusableLpStatus.tsx), the txAssets dependency is stable from first render because poolAsset, baseAsset, actionSide, and action are all defined first render, making the current txAssetsStatuses initialization pattern safe without needing useEffect synchronization.
Applied to files:
src/lib/utils/thorchain/index.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-22T15:07:18.021Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10326
File: src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx:37-41
Timestamp: 2025-08-22T15:07:18.021Z
Learning: In src/hooks/useActionCenterSubscribers/useThorchainLpActionSubscriber.tsx, kaladinlight prefers not to await the upsertBasePortfolio call in the Base chain handling block, indicating intentional fire-and-forget behavior for Base portfolio upserts in the THORChain LP completion flow.
Applied to files:
src/lib/utils/thorchain/index.tspackages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.ts
📚 Learning: 2025-08-22T12:58:26.590Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10323
File: src/components/Layout/Header/ActionCenter/components/GenericTransactionActionCard.tsx:108-111
Timestamp: 2025-08-22T12:58:26.590Z
Learning: In the RFOX GenericTransactionDisplayType flow in src/components/Layout/Header/ActionCenter/components/GenericTransactionActionCard.tsx, the txHash is always guaranteed to be present according to NeOMakinG, so defensive null checks for txLink are not needed in this context.
Applied to files:
src/lib/utils/thorchain/index.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-05T23:36:13.214Z
Learnt from: premiumjibles
Repo: shapeshift/web PR: 10187
File: src/state/slices/preferencesSlice/selectors.ts:21-25
Timestamp: 2025-08-05T23:36:13.214Z
Learning: The AssetId type from 'shapeshiftoss/caip' package is a string type alias, so it can be used directly as a return type for cache key resolvers in re-reselect selectors without needing explicit string conversion.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-17T21:53:03.806Z
Learnt from: 0xApotheosis
Repo: shapeshift/web PR: 10290
File: scripts/generateAssetData/color-map.json:41-47
Timestamp: 2025-08-17T21:53:03.806Z
Learning: In the ShapeShift web codebase, native assets (using CAIP-19 slip44 namespace like eip155:1/slip44:60, bip122:.../slip44:..., cosmos:.../slip44:...) are manually hardcoded and not generated via the automated asset generation script. Only ERC20/BEP20 tokens go through the asset generation process. The validation scripts should only validate generated assets, not manually added native assets.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-09-04T17:29:59.479Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10380
File: src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx:28-33
Timestamp: 2025-09-04T17:29:59.479Z
Learning: In shapeshift/web, the useGetPopularAssetsQuery function in src/components/TradeAssetSearch/hooks/useGetPopularAssetsQuery.tsx intentionally uses primaryAssets[assetId] instead of falling back to assets[assetId]. The design distributes primary assets across chains by iterating through their related assets and adding the primary asset to each related asset's chain. This ensures primary assets appear in all chains where they have related assets, supporting the grouped asset system.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/*.ts : Implement filterBuyAssetsBySellAssetId method to filter assets by supported chain IDs in the buy property
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/*.ts : Implement filterAssetIdsBySellable method to filter assets by supported chain IDs in the sell property
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-12-09T21:07:22.474Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11335
File: packages/swapper/src/swappers/CetusSwapper/utils/helpers.ts:3-3
Timestamp: 2025-12-09T21:07:22.474Z
Learning: In packages/swapper/src/swappers/CetusSwapper, mysten/sui types (SuiClient, Transaction) must be imported from the nested path within cetusprotocol/aggregator-sdk (e.g., 'cetusprotocol/aggregator-sdk/node_modules/mysten/sui/client') because the aggregator SDK bundles its own version of mysten/sui. Direct imports from 'mysten/sui' break at runtime even when specified in package.json.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-05T22:41:35.473Z
Learnt from: premiumjibles
Repo: shapeshift/web PR: 10187
File: src/pages/Assets/Asset.tsx:1-1
Timestamp: 2025-08-05T22:41:35.473Z
Learning: In the shapeshift/web codebase, component imports use direct file paths like '@/components/ComponentName/ComponentName' rather than barrel exports. The AssetAccountDetails component should be imported as '@/components/AssetAccountDetails/AssetAccountDetails', not from a directory index.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/index.ts : Export unique functions and types from packages/swapper/src/index.ts only if needed for external consumption
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/index.ts
📚 Learning: 2025-09-12T13:44:17.019Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/hooks/useSimulateEvmTransaction.ts:0-0
Timestamp: 2025-09-12T13:44:17.019Z
Learning: gomesalexandre prefers letting chain adapter errors throw naturally in useSimulateEvmTransaction rather than adding explicit error handling for missing adapters, consistent with his fail-fast approach and dismissal of defensive validation as "stale" in WalletConnect transaction simulation flows.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/**/*.ts : Validate inputs and log errors for debugging in Swapper system implementations
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-08-26T19:04:38.672Z
Learnt from: kaladinlight
Repo: shapeshift/web PR: 10369
File: packages/chain-adapters/src/cosmossdk/CosmosSdkBaseAdapter.ts:167-176
Timestamp: 2025-08-26T19:04:38.672Z
Learning: In packages/chain-adapters/src/cosmossdk/CosmosSdkBaseAdapter.ts, when processing assets from data.assets.reduce(), the team prefers using empty catch blocks to gracefully skip any assets that fail processing, rather than specific error type handling, to avoid useless noise and ensure robust asset filtering.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tspackages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-12-09T21:06:15.748Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11335
File: packages/swapper/src/swappers/CetusSwapper/endpoints.ts:66-68
Timestamp: 2025-12-09T21:06:15.748Z
Learning: In packages/swapper/src/swappers/CetusSwapper/endpoints.ts, gomesalexandre is comfortable with throwing errors directly in getUnsignedSuiTransaction and similar transaction preparation methods, rather than using the Result pattern. The Result pattern with makeSwapErrorRight/TradeQuoteError is primarily for the main swapper API methods (getTradeQuote, getTradeRate), while helper/preparation methods can use throws.
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 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/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-10-23T14:27:19.073Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10857
File: src/plugins/walletConnectToDapps/eventsManager/useWalletConnectEventsHandler.ts:101-104
Timestamp: 2025-10-23T14:27:19.073Z
Learning: In WalletConnect wallet_switchEthereumChain and wallet_addEthereumChain requests, the chainId parameter is always present as per the protocol spec. Type guards checking for missing chainId in these handlers (like `if (!evmNetworkIdHex) return`) are solely for TypeScript compiler satisfaction, not real runtime edge cases.
Applied to files:
packages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.tssrc/lib/utils/mayachain.tssrc/constants/chains.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-09-18T23:47:14.810Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10566
File: src/hooks/useWalletSupportsChain/useWalletSupportsChain.ts:55-66
Timestamp: 2025-09-18T23:47:14.810Z
Learning: In the useWalletSupportsChain architecture, checkWalletHasRuntimeSupport() determines if the app has runtime capability to interact with a chain type (not actual signing capabilities), while walletSupportsChain() does the actual capabilities detection by checking account IDs. For Ledger read-only mode, checkWalletHasRuntimeSupport should return true since the app can display balances/addresses, with KeyManager being the source of truth rather than wallet instance.
Applied to files:
packages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts
📚 Learning: 2025-11-19T16:59:50.569Z
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.
Applied to files:
src/lib/utils/mayachain.ts
📚 Learning: 2025-11-24T21:21:12.774Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/typescript-best-practices.mdc:0-0
Timestamp: 2025-11-24T21:21:12.774Z
Learning: Applies to **/*.{ts,tsx} : ALWAYS use type guards for runtime type checking in TypeScript
Applied to files:
src/lib/utils/mayachain.ts
📚 Learning: 2025-09-08T15:53:09.362Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10442
File: src/components/TradeAssetSearch/components/GroupedAssetList/GroupedAssetList.tsx:34-35
Timestamp: 2025-09-08T15:53:09.362Z
Learning: In DefaultAssetList.tsx, the GroupedAssetList component already receives the activeChainId prop correctly on line ~58, contrary to automated analysis that may flag it as missing.
Applied to files:
src/lib/utils/mayachain.ts
📚 Learning: 2025-11-12T12:49:17.895Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11016
File: packages/swapper/src/swappers/NearIntentsSwapper/swapperApi/getTradeQuote.ts:109-125
Timestamp: 2025-11-12T12:49:17.895Z
Learning: In packages/chain-adapters/src/evm/utils.ts, the getErc20Data function already includes a guard that returns an empty string when contractAddress is undefined (line 8: `if (!contractAddress) return ''`). This built-in handling means callers don't need to conditionally invoke getErc20Data—it safely handles both ERC20 tokens and native assets.
Applied to files:
src/lib/utils/mayachain.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/**/*.ts : Use TypeScript with explicit types (e.g., SupportedChainIds) for all code in the Swapper system
Applied to files:
packages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.tspackages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/endpoints.ts : Reuse checkEvmSwapStatus utility for checking EVM swap status instead of implementing custom status checks
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:17.804Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/error-handling.mdc:0-0
Timestamp: 2025-11-24T21:20:17.804Z
Learning: Applies to **/swapper{s,}/**/*.{ts,tsx} : ALWAYS use `makeSwapErrorRight` for swapper errors with `TradeQuoteError` enum for error codes and provide detailed error information
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/**/*.ts : Avoid side effects in swap logic; ensure swap methods are deterministic and stateless
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-11-24T21:20:57.909Z
Learnt from: CR
Repo: shapeshift/web PR: 0
File: .cursor/rules/swapper.mdc:0-0
Timestamp: 2025-11-24T21:20:57.909Z
Learning: Applies to packages/swapper/src/swappers/*/*.ts : Reuse executeEvmTransaction utility for EVM-based swappers instead of implementing custom transaction execution
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-09-12T10:21:26.693Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10461
File: src/plugins/walletConnectToDapps/components/modals/EIP712MessageDisplay.tsx:0-0
Timestamp: 2025-09-12T10:21:26.693Z
Learning: gomesalexandre explained that in WalletConnect V2, the request context chainId comes from params?.chainId following CAIP2 standards, making both the request params chainId and EIP-712 domain chainId equally reliable sources. He considers both approaches trustworthy ("both gucci") for WalletConnect dApps integration.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-08-04T15:36:25.122Z
Learnt from: NeOMakinG
Repo: shapeshift/web PR: 10171
File: src/components/MultiHopTrade/components/TradeConfirm/components/ExpandedStepperSteps.tsx:458-458
Timestamp: 2025-08-04T15:36:25.122Z
Learning: In swap transaction handling, buy transaction hashes should always use the swapper's explorer (stepSource) because they are known by the swapper immediately upon swap execution. The conditional logic for using default explorers applies primarily to sell transactions which need to be detected/indexed by external systems like Thorchain or ViewBlock.
Applied to files:
packages/swapper/src/thorchain-utils/checkTradeStatus.ts
📚 Learning: 2025-12-03T23:19:39.158Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 11275
File: headers/csps/chains/plasma.ts:1-10
Timestamp: 2025-12-03T23:19:39.158Z
Learning: For CSP files in headers/csps/chains/, gomesalexandre prefers using Vite's loadEnv() pattern directly to load environment variables (e.g., VITE_PLASMA_NODE_URL, VITE_MONAD_NODE_URL) for consistency with existing second-class chain CSP files, rather than using getConfig() from src/config.ts, even though other parts of the codebase use validated config values.
Applied to files:
.env.env.development
📚 Learning: 2025-08-13T13:45:25.748Z
Learnt from: gomesalexandre
Repo: shapeshift/web PR: 10265
File: src/pages/ThorChainLP/queries/hooks/usePools.ts:93-0
Timestamp: 2025-08-13T13:45:25.748Z
Learning: In the ShapeShift web app, inbound addresses data for Thorchain pools requires aggressive caching settings (staleTime: 0, gcTime: 0, refetchInterval: 60_000) to ensure trading status and LP deposit availability are always current. This is intentional business-critical behavior, not a performance issue to be optimized.
Applied to files:
.env.env.development
📚 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 {.env.development,.env.production} : Use `.env.development` for dev-only features and `.env.production` for prod settings
Applied to files:
.env.development
📚 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/config.ts : Default values always come from environment variables prefixed with `VITE_FEATURE_`
Applied to files:
.env.development
🧬 Code graph analysis (4)
src/lib/utils/thorchain/index.ts (3)
src/features/defi/components/TxStatus/TxStatus.tsx (1)
TxStatus(44-127)src/config.ts (1)
getConfig(239-241)packages/swapper/src/thorchain-utils/types.ts (1)
MidgardActionsResponse(107-109)
packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.ts (5)
packages/chain-adapters/src/types.ts (3)
Account(61-67)BroadcastTransactionInput(409-413)CONTRACT_INTERACTION(30-30)packages/chain-adapters/src/cosmossdk/types.ts (1)
Account(7-15)packages/caip/src/assetId/assetId.ts (1)
AssetId(17-17)packages/caip/src/utils.ts (1)
generateAssetIdFromCosmosSdkDenom(21-32)packages/chain-adapters/src/utils/validateAddress.ts (1)
assertAddressNotSanctioned(7-24)
packages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts (5)
packages/chain-adapters/src/types.ts (3)
Account(61-67)BroadcastTransactionInput(409-413)CONTRACT_INTERACTION(30-30)packages/chain-adapters/src/cosmossdk/types.ts (1)
Account(7-15)packages/caip/src/assetId/assetId.ts (1)
AssetId(17-17)packages/caip/src/utils.ts (1)
generateAssetIdFromCosmosSdkDenom(21-32)packages/chain-adapters/src/utils/validateAddress.ts (1)
assertAddressNotSanctioned(7-24)
src/lib/utils/mayachain.ts (3)
packages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts (1)
SecondClassMayachainAdapter(55-637)packages/caip/src/constants.ts (1)
mayachainChainId(82-82)src/config.ts (1)
getConfig(239-241)
🪛 dotenv-linter (4.0.0)
.env
[warning] 161-161: [UnorderedKey] The VITE_MAYACHAIN_NODE_URL key should go before the VITE_MONAD_NODE_URL key
(UnorderedKey)
[warning] 162-162: [UnorderedKey] The VITE_SOLANA_NODE_URL key should go before the VITE_THORCHAIN_NODE_URL key
(UnorderedKey)
[warning] 164-164: [UnorderedKey] The VITE_ALCHEMY_POLYGON_URL key should go before the VITE_ARBITRUM_NODE_URL key
(UnorderedKey)
[warning] 170-170: [UnorderedKey] The VITE_MAYACHAIN_MIDGARD_URL key should go before the VITE_THORCHAIN_MIDGARD_URL key
(UnorderedKey)
.env.development
[warning] 71-71: [UnorderedKey] The VITE_MAYACHAIN_NODE_URL key should go before the VITE_MONAD_NODE_URL key
(UnorderedKey)
[warning] 72-72: [UnorderedKey] The VITE_SOLANA_NODE_URL key should go before the VITE_THORCHAIN_NODE_URL key
(UnorderedKey)
[warning] 79-79: [UnorderedKey] The VITE_MAYACHAIN_MIDGARD_URL key should go before the VITE_THORCHAIN_MIDGARD_URL 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). (1)
- GitHub Check: Call / Static
🔇 Additional comments (22)
.env (1)
160-170: Mayachain endpoint migration looks correct.The switch to
mayanode.mayachain.infoandmidgard.mayachain.infoaligns with the PR objective to use Maya-specific endpoints instead of Thornode/Midgard for Maya. The commented-out old values provide a clear rollback path for this temporary fix..env.development (1)
70-79: Development environment configuration consistent with production.The Mayachain endpoint updates mirror the base
.envchanges, ensuring consistency between development and production environments for this temporary fix.packages/chain-adapters/src/cosmossdk/thorchain/ThorchainChainAdapter.ts (1)
376-388: Empty catch block follows established codebase pattern.The empty catch block for asset processing aligns with the established pattern in
CosmosSdkBaseAdapter.tswhere graceful skipping of failed assets is preferred to avoid noise. Based on learnings, this is intentional for robust asset filtering.src/constants/chains.ts (1)
14-15: Adding THOR and MAYA to second-class chains aligns with PR objectives.This change correctly marks ThorchainMainnet and MayachainMainnet as second-class chains, enabling the simplified transaction parsing and node-based operations described in the PR.
packages/chain-adapters/src/cosmossdk/mayachain/index.ts (1)
1-2: Clean export addition for the new adapter.Properly exposes
SecondClassMayachainAdapterwhile maintaining backward compatibility with existingMayachainChainAdapterexports.src/plugins/thorchain/index.tsx (1)
19-23: Clean migration to SecondClassThorchainAdapter.The simplified adapter instantiation removes the complex HTTP/WS provider setup in favor of direct nodeUrl configuration. This aligns with the PR's approach of treating THOR as a second-class chain with node-based operations.
src/lib/utils/thorchain/index.ts (1)
41-73: Well-structured status check with Midgard fallback.The two-tier approach correctly handles both standard Cosmos transactions and MsgDeposit transactions (RUNE/TCY/RUJI internal sends). The
validateStatus: () => truepattern prevents axios from throwing on non-2xx responses, allowing proper status interpretation.src/lib/utils/mayachain.ts (1)
17-28: Assertion helper is well-structured.Clean implementation that leverages the type guard and throws a clear error for invalid adapters.
packages/chain-adapters/src/cosmossdk/mayachain/MayachainChainAdapter.ts (4)
2-6: LGTM - Import additions support new functionality.The
generateAssetIdFromCosmosSdkDenomimport is used by the newgetAccountmethod for mapping Cosmos SDK denominations to asset IDs.
41-44: LGTM - nodeUrl integration follows established patterns.The constructor injection and protected field pattern is consistent with the codebase architecture and enables the new direct node endpoint calls.
Also applies to: 53-53, 70-70
265-324: Implementation looks correct for temporary second-class chain adapter.The account fetching logic properly:
- Fetches auth and balance data in parallel
- Validates HTTP responses
- Maps Cosmos SDK denoms to asset IDs using
generateAssetIdFromCosmosSdkDenom- Uses empty catch block for graceful asset filtering (consistent with established patterns per learnings)
- Wraps errors with ErrorHandler for i18n
The type assertion at line 317 assumes the constructed object matches
Account<KnownChainIds.MayachainMainnet>shape, which should be safe given the explicit property assignments.
326-360: LGTM - Broadcast implementation follows Cosmos SDK conventions.The method correctly:
- Validates addresses against sanctions list
- Uses
BROADCAST_MODE_SYNCfor synchronous transaction submission- Checks
tx_response.code !== 0per Cosmos SDK error conventions- Returns the transaction hash on success
- Wraps errors with ErrorHandler for consistent error handling
packages/chain-adapters/src/cosmossdk/mayachain/SecondClassMayachainAdapter.ts (5)
50-71: LGTM - Clean dependency injection pattern.The constructor properly initializes all required fields with readonly protection.
157-213: LGTM - Account fetching implementation is correct.The implementation properly handles:
- Parallel endpoint fetching
- Response validation
- Asset mapping with graceful error handling (empty catch at line 185 per established patterns)
- Consistent error wrapping
437-460: LGTM - Stub implementations appropriate for second-class adapter.These no-op implementations satisfy the
IChainAdapterinterface requirements. For a temporary second-class chain adapter, returning empty results is acceptable and aligns with the PR's stated scope.
462-636: Transaction parsing implementation handles dual endpoint fallback correctly.The
parseTxmethod properly implements a two-tier parsing strategy:
Primary path: Cosmos SDK endpoint parsing (lines 475-555)
- Handles
/types.MsgSendand/types.MsgDepositmessage types- Correctly identifies send vs. receive based on pubkey comparison
Fallback path: Midgard endpoint parsing (lines 557-635)
- Used when Cosmos endpoint fails (e.g., for certain transaction types)
- Reconstructs transfers from
actions.inandactions.out- Prevents duplicate receive transfers with
alreadyAddedcheck (line 607)The use of
unknownfortxHashparameter (line 462) with subsequentas stringassertion aligns with the established second-class chain pattern per learnings.Defensive optional chaining (lines 596, 613, 623, 640) prevents crashes from missing data in Midgard responses.
142-155: Verify if Maya addresses require length validation like Thorchain.The
validateAddressimplementation checks only the bech32 prefix but doesn't validate word length, unlike Thorchain adapters which enforcewordsLength === 32. Determine whether Maya addresses have a similar length requirement and add the check if needed. If Maya addresses don't have a fixed length requirement, the current implementation is sufficient.packages/chain-adapters/src/cosmossdk/thorchain/SecondClassThorchainAdapter.ts (5)
51-54: LGTM - Fee calculation handles automatic outbound fee.The
calculateFeefunction correctly accounts for Thorchain's automatic outbound fee by subtractingNATIVE_FEEand preventing negative results.
148-166: LGTM - Thorchain address validation includes length check.Unlike the Mayachain adapter, this implementation validates that decoded bech32 addresses have exactly 32 words (line 159), providing additional validation beyond prefix checking. This appears to be a Thorchain-specific requirement.
355-397: LGTM - Multi-coin support correctly handles RUNE, TCY, and RUJI.The implementation properly:
- Validates supported coin types (line 362)
- Maps coins to their respective denoms (lines 370-374)
- Applies
sendMaxcalculation only for THOR.RUNE (line 368), using exact values for TCY/RUJI- Adjusts fee using
calculateFeeto account for automatic outbound fee (line 388)
416-451: LGTM - Deposit transaction building handles multi-coin support.Consistent with
buildSendApiTransaction, properly validates coin types and applies fee calculation. The type assertion at line 433 is safe given the validation at line 423.
489-663: LGTM - Transaction parsing follows same pattern as Maya adapter.The dual-endpoint parsing strategy (Cosmos primary, Midgard fallback) is consistent with the Mayachain implementation, with appropriate adaptations for Thorchain-specific prefixes and endpoints.
premiumjibles
left a comment
There was a problem hiding this comment.
Swaps out of thor look good https://jam.dev/c/c88d12be-5f32-4d4b-aba7-1494e1a0b3b3
Sends work https://jam.dev/c/7afea22a-3219-4193-916b-b27dedf276e8
Ruji -> Rune works https://jam.dev/c/39d28738-32b0-4b6e-beab-107afad77c5e
All action center parsing looks good ✔️
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/swapper/src/thorchain-utils/checkTradeStatus.ts (1)
43-64: Cosmos tx error detection logic is sound.The new cosmos-based tx lookup correctly:
- Derives the cosmos node URL by stripping the chain-specific path suffix
- Fetches tx via the standard cosmos
tx/v1beta1/txsendpoint- Returns
Failedstatus whentx_response.code !== 0, including theraw_logfor debuggingThe empty catch block was flagged in a past review. Per gomesalexandre's preferences for console.error debugging and the PR's temporary nature, the current approach is acceptable—but adding minimal logging would aid debugging if issues arise.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Jibles <premiumjibles@gmail.com>
This reverts commit 688df39.
Description
Makes THOR and MAYA chains happy as temporary second-class chains given unchained is currently sad.
This PR:
This effectively fixes:
Note, as the title implies, this is very ugly and vibe-coded, provided as a best effort to unrug THOR/MAYA chains, and not intended to be kept for more than a few days.
Going forward, we should probably salvage the good parts from this, and do a mix of first-second class for THOR/MAYA (and other chains too because why not?) where we:
Issue (Required)
n/a
Risk (Required)
low assuming this gets reverted, can't bork what's already borked
Testing (Required)
Screenshots (Optional)
https://jam.dev/c/8f00026a-5bd2-49b3-b1ec-703978ee6669
Summary by CodeRabbit
New Features
Improvements
Chores
✏️ Tip: You can customize this high-level summary in your review settings.