Skip to content

Conversation

@niodamian
Copy link

@niodamian niodamian commented Aug 3, 2025

Summary by CodeRabbit

  • New Features
    • Added support for the Terra Classic (columbus-5) network, including configuration, address prefix, and native token details.
    • Enabled MintScan API queries for the Terra network.
    • Included Terra Classic in preset and migration network lists for improved compatibility.
    • Expanded earn provider support to include Terra network and its native token symbol (LUNC).

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • packages/components/svg/illus/terra.svg is excluded by !**/*.svg

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update adds support for the Terra Classic network ("columbus-5") across multiple modules. It introduces Terra in network configuration, vault settings, migration presets, and query mappings. Terra is registered with Cosmwasm query, while its MintScan registration is commented out. No existing logic or error handling is changed.

Changes

Cohort / File(s) Change Summary
Preset Network Configuration
packages/shared/src/config/presetNetworks.ts
Added Terra Classic (columbus-5) as a new Cosmos-based network with metadata, fee info, and logo.
Vault Network Settings
packages/kit-bg/src/vaults/impls/cosmos/settings.ts
Added network info for cosmos--columbus-5 (Terra): address prefix, cryptographic curve, and native token.
Migration Presets
packages/kit-bg/src/migrations/v4ToV5Migration/v4data/networkIds.ts
Added 'cosmos--columbus-5' to the preset network IDs array.
Migration Coin Type Mapping
packages/kit-bg/src/migrations/v4ToV5Migration/v4CoinTypeToNetworkId.ts
Added trailing whitespace after Terra coin type mapping; no logic change.
MintScan Network Mapping
packages/core/src/chains/cosmos/sdkCosmos/query/MintScanQuery.ts
Added Terra network ID mapping to MintScan API identifiers.
Query Registry
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts
Registered Terra with Cosmwasm query handler; commented out MintScan registration; updated comment for Terra Classic.
Earn Provider Constants
packages/shared/types/earn/earnProvider.constants.ts
Added Terra network ID to mainnet earn networks and mapped symbol 'LUNC' to Terra network ID.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or Summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@revan-zhang
Copy link
Contributor

revan-zhang commented Aug 3, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@niodamian
Copy link
Author

Also couldnt find where i could add CW20 support token for the network.

Wanted to add Juris protocol logo and ca with gecko id for price injection *

Terra Classic - https://github.com/cosmostation/chainlist/tree/main/chain/terra-classic

Terra classsic main 2 native coins are LUNC and USTC

[
{
"type": "native",
"denom": "uluna",
"name" : "Lunc",
"symbol": "LUNC",
"description": "The native staking coin of Terra Classic.",
"decimals": 6,
"image": "https://raw.githubusercontent.com/cosmostation/chainlist/master/chain/terra-classic/asset/lunc.png",
"coinGeckoId": "terra-luna",
"color": "#1E75EE"
},
{
"type": "native",
"denom": "uusd",
"name" : "USTC",
"symbol": "USTC",
"description": "The USD stablecoin of Terra Classic.",
"decimals": 6,
"image": "https://raw.githubusercontent.com/cosmostation/chainlist/master/chain/terra-classic/asset/uusd.png",
"coinGeckoId": "terrausd",
"color": "#1E75EE"
},

And wanted to add as well the logos and infos about the CW20 tokens : https://github.com/cosmostation/chainlist/blob/main/chain/terra-classic/cw20_2.json 

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (2)
packages/shared/types/earn/earnProvider.constants.ts (2)

60-76: Add “LUNC” to the staking whitelist.

isSupportStaking() still omits LUNC, so Terra Classic users cannot stake even after you add the network.

   'POL',
   'USDC',
   'USDT',
   'DAI',
   'WETH',
   'CBBTC',
   'WBTC',
   'USDF',
+  'LUNC',
 ].includes(symbol.toUpperCase());

91-109: Normalize function misses “lunc”.

normalizeToEarnSymbol() lacks a 'lunc' key. Calls with lowercase symbols will fail to resolve.

   'usde': 'USDe',
+  'lunc': 'LUNC',
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 077b8fa and 9272927.

📒 Files selected for processing (3)
  • packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (1 hunks)
  • packages/kit-bg/src/migrations/v4ToV5Migration/v4CoinTypeToNetworkId.ts (2 hunks)
  • packages/shared/types/earn/earnProvider.constants.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/shared/types/earn/earnProvider.constants.ts (1)
packages/shared/src/config/networkIds.ts (1)
  • getNetworkIdsMap (72-94)
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (2)
packages/shared/src/config/networkIds.ts (1)
  • getNetworkIdsMap (72-94)
packages/core/src/chains/cosmos/sdkCosmos/query/MintScanQuery.ts (1)
  • MintScanQuery (33-162)
🔇 Additional comments (3)
packages/kit-bg/src/migrations/v4ToV5Migration/v4CoinTypeToNetworkId.ts (2)

12-13: Good addition – constant imported.

The extra COINTYPE_TERRA import is correct and keeps the mapping list tidy.


58-59: Mapping looks right.

COINTYPE_TERRA → networkIdsMap.terra lines up with the new preset network.

packages/shared/types/earn/earnProvider.constants.ts (1)

190-194: Symbol map but no staking support.

Good to map 'LUNC' to Terra. Make sure the two earlier fixes land, otherwise the earn module will still refuse LUNC.

cursor[bot]

This comment was marked as outdated.

@niodamian
Copy link
Author

ok i did the changes bot said * how can i import logo of juris ? cw20 token

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9272927 and 81a337b.

📒 Files selected for processing (1)
  • packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (2)
packages/shared/src/config/networkIds.ts (1)
  • getNetworkIdsMap (72-94)
packages/core/src/chains/cosmos/sdkCosmos/query/MintScanQuery.ts (1)
  • MintScanQuery (33-162)
🪛 ESLint
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts

[error] 55-55: Expected exception block, space or tab after '//' in comment.

(spaced-comment)

🔇 Additional comments (1)
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (1)

62-62: Terra Classic MintScan registration looks good.

The switch from CosmwasmQuery to MintScanQuery for Terra Classic enables CW20 token catalog support, which aligns with the PR objective to add Terra Classic token support.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 81a337b and a89a170.

📒 Files selected for processing (1)
  • packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot

sidmorizon
sidmorizon previously approved these changes Aug 4, 2025
@originalix originalix requested a review from sidmorizon August 4, 2025 09:39
Copy link
Collaborator

@originalix originalix left a comment

Choose a reason for hiding this comment

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

Hi thanks for this pr. Supporting Terra Classic also requires server-side handling for token metadata, fee estimation, and other related features. Simply adding the network config on the client side won’t be sufficient for it to work properly.

So the review will be put on hold for now until server-side support is in place.

[COINTYPE_BCH]: networkIdsMap.bch,
[COINTYPE_XRP]: networkIdsMap.xrp,
[COINTYPE_COSMOS]: networkIdsMap.cosmoshub,
[COINTYPE_TERRA]: networkIdsMap.terra,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is COINTYPE_TERRA different from COINTYPE_COSMOS ?

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Terra uses more native coins LUNC / USTC / KRW should i add them or keep it only on uluna (LUNC ) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

We currently only support one native token.

@niodamian
Copy link
Author

Hi thanks for this pr. Supporting Terra Classic also requires server-side handling for token metadata, fee estimation, and other related features. Simply adding the network config on the client side won’t be sufficient for it to work properly.

So the review will be put on hold for now until server-side support is in place.

I believe I added the fees of terra ...keplr wallet https://github.com/chainapsis/keplr-chain-registry/blob/main/cosmos/columbus.json

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between a89a170 and 8f6477e.

📒 Files selected for processing (2)
  • packages/kit-bg/src/migrations/v4ToV5Migration/v4CoinTypeToNetworkId.ts (2 hunks)
  • packages/shared/src/config/presetNetworks.ts (1 hunks)

Comment on lines +11 to 12
COINTYPE_COSMOS,
COINTYPE_DNX,
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 4, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing Terra coin-type mapping – migration will drop user accounts.

Terra uses BIP-44 coin-type 330 (COINTYPE_TERRA). It is not imported or mapped, so any v4 wallet holding LUNC/USTC addresses will lose its link during migration.

@@
   COINTYPE_COSMOS,  
+  COINTYPE_TERRA,
@@
   [COINTYPE_COSMOS]: networkIdsMap.cosmoshub, 
+  [COINTYPE_TERRA]: networkIdsMap.terra,

⚠️ This fix also relies on networkIdsMap.terra being defined – ensure the previous file registers terra correctly.

Also applies to: 56-56

🤖 Prompt for AI Agents
In packages/kit-bg/src/migrations/v4ToV5Migration/v4CoinTypeToNetworkId.ts
around lines 11 to 12 and line 56, the Terra coin-type (BIP-44 coin-type 330,
COINTYPE_TERRA) is missing from the coin-type to network ID mapping, which will
cause user accounts with Terra addresses to be dropped during migration. Add the
import for COINTYPE_TERRA and include it in the mapping to networkIdsMap.terra.
Also verify that networkIdsMap.terra is properly defined in the related file to
ensure the migration handles Terra wallets correctly.

Copy link
Author

Choose a reason for hiding this comment

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

@originalix should i build the COINTYPE_TERRA ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@niodamian
Copy link
Author

changed mintscan to cosmwasmQuery - currently mintscan doesnt support the chain or it supports the chain its not on the website cause its facing performance issues currently

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 3ff081d and 05e5bf9.

📒 Files selected for processing (1)
  • packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (2)
packages/shared/src/config/networkIds.ts (1)
  • getNetworkIdsMap (72-94)
packages/core/src/chains/cosmos/sdkCosmos/query/MintScanQuery.ts (1)
  • MintScanQuery (33-162)
🪛 ESLint
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts

[error] 55-55: Delete ·

(prettier/prettier)

🔇 Additional comments (1)
packages/core/src/chains/cosmos/sdkCosmos/query/IQuery.ts (1)

62-62: Verify Terra CW20 metadata display
I ran a search for any Terra-specific CW20 calls but found no references in the codebase. Since you’ve removed the MintScan registry line and rely solely on CosmWasmQuery, we need to ensure Terra Classic CW20 token metadata (name, logo, decimals) still shows up in the UI.

Please manually verify that:

  • Terra Classic CW20 tokens load correctly in the token list
  • Their name, logo, and decimals appear as expected

@niodamian
Copy link
Author

removed terra 2.0 logo and added terra 1.0 logo -
On onekey site you guys had LUNC listed with Terra 2.0 logo on it - LUNC coin is on Terra classic aka Terra 1.0

@niodamian
Copy link
Author

Hi thanks for this pr. Supporting Terra Classic also requires server-side handling for token metadata, fee estimation, and other related features. Simply adding the network config on the client side won’t be sufficient for it to work properly.

So the review will be put on hold for now until server-side support is in place.

https://github.com/chainapsis/keplr-wallet/blob/7aa7dbf06fa1f28ffce3a6b05ab0ce7d7141c3b3/apps/extension/src/config.ts#L1252

Terra Classic uses all the natives coins but since we closed all the stablecoins we currently using USTC / LUNC

feeCurrencies: [
  {
    coinDenom: "LUNC",
    coinMinimalDenom: "uluna",
    coinDecimals: 6,
    coinGeckoId: "terra-luna",
    gasPriceStep: {
      low: 28.325,
      average: 28.325,
      high: 28.325,
    },
  },
  {
    coinDenom: "USTC",
    coinMinimalDenom: "uusd",
    coinDecimals: 6,
    coinGeckoId: "terrausd",
    gasPriceStep: {
      low: 0.75,
      average: 0.75,
      high: 0.75,
    },
  },

We got also a tax of 0.5% which applies on LUNC and USTC only CW20 tokens dont have a tax

@niodamian
Copy link
Author

originalix any update ? I already did some PRs on the other OneKey repos

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants