Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
38c3e93
feat: enable MetaMask support for second-class EVM chains
gomesalexandre Dec 12, 2025
2833d07
feat: enable Ledger support for second-class EVM chains
gomesalexandre Dec 12, 2025
e8444d7
fix: Ledger app validation for second-class EVM chains
gomesalexandre Dec 12, 2025
9da7d5b
refactor: use isEvmChainId for Ledger app gating
gomesalexandre Dec 12, 2025
0a579a9
fix: missing HyperEVM addresses in account import and send flow
gomesalexandre Dec 12, 2025
da23f60
feat: enable Trezor support for second-class EVM chains
gomesalexandre Dec 12, 2025
9e2d28b
feat: enable WalletConnect V2 support for second-class EVM chains
gomesalexandre Dec 12, 2025
7056684
chore: revert verdaccio config and version bumps
gomesalexandre Dec 12, 2025
2014470
[skip ci] feat: bump hdwallet versions to 1.62.29
gomesalexandre Dec 12, 2025
32f10e8
[skip ci] chore: temporarily disable second-class EVM chains for testing
gomesalexandre Dec 12, 2025
6d4bcbd
Revert "[skip ci] chore: temporarily disable second-class EVM chains …
gomesalexandre Dec 12, 2025
d2eb119
chore: trigger CI
gomesalexandre Dec 12, 2025
290eacc
Merge remote-tracking branch 'origin/develop' into feat_second_class_mm
gomesalexandre Dec 12, 2025
8a56626
[skip ci] chore: cancel CI
gomesalexandre Dec 12, 2025
8fdf1db
feat: bump
gomesalexandre Dec 16, 2025
c969bbc
feat: tron app gate
gomesalexandre Dec 16, 2025
0d17176
fix: add ledger app gate to tron chain adapter
gomesalexandre Dec 16, 2025
b90d4bb
fix: add Sui to ledger app gates
gomesalexandre Dec 16, 2025
89d931d
[skip ci]
gomesalexandre Dec 16, 2025
25189b8
Merge remote-tracking branch 'origin/develop' into feat_second_class_mm
gomesalexandre Dec 16, 2025
5366ca8
feat: implement HyperEVM transaction parsing for execution price
gomesalexandre Dec 16, 2025
8c93d0a
refactor: optimize address comparisons and extract inline logic [skip…
gomesalexandre Dec 16, 2025
d2bdb53
refactor: use bn instead of bnOrZero for defined values [skip ci]
gomesalexandre Dec 16, 2025
c9afc35
refactor: create SecondClassEvmAdapter base class [skip ci]
gomesalexandre Dec 16, 2025
8eda964
fix: use ChainId for supportedChainIds and getAddress for txHash [ski…
gomesalexandre Dec 16, 2025
bfcec8f
fix: use Hex type for txHash [skip ci]
gomesalexandre Dec 16, 2025
3870239
docs: update chain-integration skill for SecondClassEvmAdapter [skip ci]
gomesalexandre Dec 16, 2025
bae0f71
refactor: rename parseTx parameter to txHash for clarity [skip ci]
gomesalexandre Dec 16, 2025
841b1f0
debug: add comprehensive logging for cross-chain execution price [ski…
gomesalexandre Dec 16, 2025
05ce32c
cleanup: remove debug console logs [skip ci]
gomesalexandre Dec 16, 2025
4288fa5
Merge remote-tracking branch 'origin/develop' into feat_second_class_mm
gomesalexandre Dec 16, 2025
ec47899
fix: use receipt.blockHash instead of txHash for getBlock [skip ci]
gomesalexandre Dec 16, 2025
53d569f
feat: trigger ci
gomesalexandre Dec 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 83 additions & 7 deletions .claude/skills/chain-integration/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,85 @@ export const SECOND_CLASS_CHAINS = [

**Directory**: `packages/chain-adapters/src/[adaptertype]/[chainname]/`

**For EVM chains**: Extend `EvmBaseAdapter` (see Monad example)
**For non-EVM**: Implement `IChainAdapter` interface (see Sui/Tron examples)
#### **For EVM Chains** (SIMPLE!)

Extend `SecondClassEvmAdapter` - you only need ~50 lines!

**File**: `packages/chain-adapters/src/evm/[chainname]/[ChainName]ChainAdapter.ts`

```typescript
import { ASSET_REFERENCE, [chainLower]AssetId } from '@shapeshiftoss/caip'
import type { AssetId } from '@shapeshiftoss/caip'
import type { RootBip44Params } from '@shapeshiftoss/types'
import { KnownChainIds } from '@shapeshiftoss/types'

import { ChainAdapterDisplayName } from '../../types'
import { SecondClassEvmAdapter } from '../SecondClassEvmAdapter'
import type { TokenInfo } from '../SecondClassEvmAdapter'

const SUPPORTED_CHAIN_IDS = [KnownChainIds.[ChainName]Mainnet]
const DEFAULT_CHAIN_ID = KnownChainIds.[ChainName]Mainnet

export type ChainAdapterArgs = {
rpcUrl: string
knownTokens?: TokenInfo[]
}

export const is[ChainName]ChainAdapter = (adapter: unknown): adapter is ChainAdapter => {
return (adapter as ChainAdapter).getType() === KnownChainIds.[ChainName]Mainnet
}

export class ChainAdapter extends SecondClassEvmAdapter<KnownChainIds.[ChainName]Mainnet> {
public static readonly rootBip44Params: RootBip44Params = {
purpose: 44,
coinType: Number(ASSET_REFERENCE.[ChainName]),
accountNumber: 0,
}

constructor(args: ChainAdapterArgs) {
super({
assetId: [chainLower]AssetId,
chainId: DEFAULT_CHAIN_ID,
rootBip44Params: ChainAdapter.rootBip44Params,
supportedChainIds: SUPPORTED_CHAIN_IDS,
rpcUrl: args.rpcUrl,
knownTokens: args.knownTokens ?? [],
})
}

getDisplayName() {
return ChainAdapterDisplayName.[ChainName]
}

getName() {
return '[ChainName]'
}

getType(): KnownChainIds.[ChainName]Mainnet {
return KnownChainIds.[ChainName]Mainnet
}

getFeeAssetId(): AssetId {
return this.assetId
}
}

export type { TokenInfo }
```

**That's it!** SecondClassEvmAdapter automatically provides:
- ✅ Account balance fetching (native + ERC-20 tokens via multicall)
- ✅ Fee estimation
- ✅ Transaction broadcasting
- ✅ Transaction parsing with ERC-20 event decoding (for execution price)
- ✅ Rate limiting via PQueue
- ✅ Multicall batching for token balances

Just follow the pattern from HyperEVM, Monad, or Plasma adapters.

#### **For Non-EVM Chains** (COMPLEX)

Implement `IChainAdapter` interface - requires custom crypto adapters and ~500-1000 lines.

**Key Methods to Implement:**
- `getAccount()` - Get balances (native + tokens)
Expand All @@ -712,14 +789,13 @@ export const SECOND_CLASS_CHAINS = [
- `getTxHistory()` - Get tx history (stub out - return empty)

**Poor Man's Patterns:**
1. **No Unchained**: Use public RPC directly (ethers.js, @mysten/sui, tronweb, etc.)
1. **No Unchained**: Use public RPC directly (@mysten/sui, tronweb, etc.)
2. **No TX History**: Stub out `getTxHistory()` to return empty array
3. **Multicall for Tokens**: Batch token balance calls where possible
4. **Direct RPC Polling**: Use `eth_getTransactionReceipt` or equivalent for tx status
3. **Direct RPC Polling**: Use chain-specific RPC for tx status

**File**: `packages/chain-adapters/src/[adaptertype]/[chainname]/[ChainName]ChainAdapter.ts`
**File**: `packages/chain-adapters/src/[chainname]/[ChainName]ChainAdapter.ts`

See `MonadChainAdapter.ts` (EVM) or `SuiChainAdapter.ts` (non-EVM) for complete examples.
See `SuiChainAdapter.ts` or `TronChainAdapter.ts` for complete examples.

**Export**:
```typescript
Expand Down
Loading