Skip to content

Conversation

@NeOMakinG
Copy link
Collaborator

Summary

Adds TON (The Open Network) blockchain as a second-class citizen in ShapeShift Web.

Changes

Chain Adapter (packages/chain-adapters/src/ton/)

  • TonChainAdapter.ts - Full chain adapter implementation
    • Address derivation from public key (WalletV4R2 StateInit)
    • Account balance fetching via TON Center API
    • Transaction building with proper BoC encoding
    • Transaction signing via hdwallet
    • Transaction broadcasting
    • Fee estimation
    • Transaction status polling
  • types.ts - TON-specific types (Account, BuildTxInput, FeeData, TonSignTx)

CAIP Constants (packages/caip/src/constants.ts)

  • Added tonAssetId, tonChainId
  • Added CHAIN_NAMESPACE.Ton, CHAIN_REFERENCE.TonMainnet
  • Added ASSET_REFERENCE.Ton

CoinGecko Integration (packages/caip/src/adapters/coingecko/)

  • Added Ton = 'the-open-network' to CoingeckoAssetPlatform enum
  • Added TON mappings in chainIdToCoingeckoAssetPlatform and coingeckoAssetPlatformToChainId

Plugin (src/plugins/ton/)

  • TON plugin with Ton feature flag
  • Chain adapter registration with VITE_TON_NODE_URL

Config & Feature Flags

  • Added VITE_TON_NODE_URL environment variable
  • Added VITE_FEATURE_TON feature flag
  • Added Ton to FeatureFlags type and initial state

Asset Generation (scripts/generateAssetData/ton/)

  • TON asset generation script using CoinGecko

Utility Functions

  • chainIdToFeeAssetId.ts - Added TON case
  • getChainShortName.ts - Added TON case (returns 'TON')
  • getBaseAsset.ts - Added TON case
  • baseAssets.ts - Added TON base asset definition

TON Chain Specifications

Property Value
SLIP44 Coin Type 607
Derivation Path m/44'/607'/<account>' (3-level hardened)
Signing Algorithm Ed25519
Address Format User-friendly base64 (48 chars, WalletV4R2)
Decimals 9
CoinGecko Platform the-open-network

Dependencies

Requires hdwallet TON support: https://github.com/shapeshift/hdwallet/pull/XXX

Environment Variables

VITE_TON_NODE_URL=https://toncenter.com/api/v2/jsonRPC
VITE_FEATURE_TON=true

Testing

  • Build packages: yarn build:packages
  • Type check: yarn type-check
  • Generate assets: yarn generate:asset-data
  • Manual testing with native wallet

- Add TON chain adapter with address derivation, transaction building, signing, broadcasting
- Add TON plugin with feature flag
- Add TON to CoinGecko adapter for asset discovery
- Add TON asset generation script
- Add VITE_TON_NODE_URL and VITE_FEATURE_TON config
- Add TON base asset definition and utility functions

TON Chain specs:
- SLIP44 Coin Type: 607
- Derivation Path: m/44'/607'/<account>' (3-level hardened, Ed25519)
- Address Format: User-friendly base64 (WalletV4R2 StateInit)
- Decimals: 9
- CoinGecko Platform: the-open-network
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ton-chain

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.

2 participants