Skip to content

Replace implicit sdk-evm side-effect registration with explicit init#71

Merged
arentant merged 1 commit intomain-v2from
arentant/explicit-evm-sdk-init
Feb 28, 2026
Merged

Replace implicit sdk-evm side-effect registration with explicit init#71
arentant merged 1 commit intomain-v2from
arentant/explicit-evm-sdk-init

Conversation

@arentant
Copy link
Contributor

Summary

  • Moves top-level auto-registration in @train-protocol/sdk-evm into an exported, idempotent registerEvmSdk() function
  • Calls registerEvmSdk() once at client-side app startup in _app.js (guarded by typeof window !== 'undefined')
  • Removes all bare import '@train-protocol/sdk-evm' side-effect imports from createHTLCClient.ts, useHTLCWriteClient.ts, and evm.ts
  • Adds vitest tests covering registration, idempotency, createHTLCClient, and deriveKeyFromWallet wiring
  • Sets "sideEffects": false in sdk-evm package.json for proper tree-shaking
  • Updates registry error messages to reference registerEvmSdk() and adds sdk-evm README

Test plan

  • pnpm --filter @train-protocol/sdk check:types passes
  • pnpm --filter @train-protocol/sdk-evm check:types passes
  • pnpm --filter @train-protocol/sdk-evm test passes (5/5)
  • pnpm build compiles all packages and app successfully
  • No remaining import '@train-protocol/sdk-evm' side-effect-only imports
  • Manual smoke test: lock/refund/claim + wallet-sign derivation on EVM networks

🤖 Generated with Claude Code

…h explicit registerEvmSdk() init

Move top-level auto-registration out of sdk-evm index.ts into an exported
idempotent registerEvmSdk() function. Call it once at client-side app startup
in _app.js and remove bare side-effect imports from createHTLCClient.ts,
useHTLCWriteClient.ts, and evm.ts. Add vitest tests covering registration,
idempotency, and deriveKeyFromWallet wiring. Update registry error messages
and add sdk-evm README documenting the required initialization step.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trainapp-monorepo Building Building Preview, Comment Feb 28, 2026 11:25am

Request Review

@arentant arentant merged commit 079e2b7 into main-v2 Feb 28, 2026
2 checks passed
@arentant arentant deleted the arentant/explicit-evm-sdk-init branch February 28, 2026 11:42
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