Skip to content

Conversation

@Eumaios1212
Copy link

@Eumaios1212 Eumaios1212 commented Nov 27, 2025

Summary

The CompatibleAsset type in @xchainjs/xchain-mayachain-query is missing TradeAsset, causing TypeScript errors when using trade assets with the MayaChain AMM.

Current:

export type CompatibleAsset = Asset | TokenAsset | SynthAsset

After this fix:

export type CompatibleAsset = Asset | TokenAsset | SynthAsset | TradeAsset

Problem

  • TradeAsset is already imported in types.ts but not included in the CompatibleAsset union
  • The package has trade asset methods (getTradeAssetUnits, getAddressTradeAccounts, etc.)
  • mayachain-amm uses CryptoAmount<CompatibleAsset> in function signatures, causing type errors when passing trade assets

Solution

Add TradeAsset to the CompatibleAsset type union, aligning with @xchainjs/xchain-thorchain-query which already includes it.

Testing

This is a type-only change. No runtime behavior is affected.

Summary by CodeRabbit

  • New Features
    • Extended asset compatibility to include TradeAsset, broadening the range of supported assets in the system.

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

The CompatibleAsset type was missing TradeAsset, even though TradeAsset
is already imported and the package has trade asset methods like
getTradeAssetUnits() and getAddressTradeAccounts().

This causes TypeScript errors when using trade assets with mayachain-amm,
which uses CryptoAmount<CompatibleAsset> in its function signatures.

This aligns mayachain-query with thorchain-query, which already includes
TradeAsset in its CompatibleAsset type.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

📝 Walkthrough

Walkthrough

Extended the CompatibleAsset type in the mayachain-query package to include TradeAsset in the union type, allowing it to encompass Asset, TokenAsset, SynthAsset, and TradeAsset types.

Changes

Cohort / File(s) Summary
Type Union Extension
packages/xchain-mayachain-query/src/types.ts
Updated CompatibleAsset type signature to add TradeAsset to the union of compatible asset types.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

  • Single type definition change with no logic modifications
  • Mechanical extension of existing union type
  • Minimal scope and straightforward to verify

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding TradeAsset to the CompatibleAsset type union, which is the primary modification in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b47704 and 57723d1.

📒 Files selected for processing (1)
  • packages/xchain-mayachain-query/src/types.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/xchain-mayachain-query/src/types.ts (1)
packages/xchain-util/src/types/asset.ts (4)
  • Asset (27-32)
  • TokenAsset (37-42)
  • SynthAsset (47-52)
  • TradeAsset (57-62)
🔇 Additional comments (1)
packages/xchain-mayachain-query/src/types.ts (1)

15-15: CompatibleAsset extension to include TradeAsset looks correct and aligned with usage

Including TradeAsset in CompatibleAsset is consistent with the imported types and with the rest of this file, which already defines several TradeAsset-related types. This is a pure type-level widening of the union, so it’s backward compatible and should resolve the TS errors around CryptoAmount<CompatibleAsset> when passing trade assets, without affecting runtime behavior.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant