Skip to content

sync with main repo#3

Open
disenotov wants to merge 56 commits intogluwa:mainfrom
wormhole-foundation:main
Open

sync with main repo#3
disenotov wants to merge 56 commits intogluwa:mainfrom
wormhole-foundation:main

Conversation

@disenotov
Copy link
Collaborator

No description provided.

martin0995 and others added 30 commits December 2, 2025 13:38
* add token-transfer main logic

* add new command into index

* update error handling for duplicated flags

* update readability

* add warning log for RPCs

* add desciptive comments to functions

* add dependency for token-transfer

* add deployment types

* add error handling

* import logic

* adapt to ntt transfers

* update script

* add error handling

* update error handling

* catch errors

* removed any types

* update clone

* add comments

* add link to readme

* update function naming

* validate executor quote fields

* update comment

* mainnet confirmation prompt

* update spinner

* consolidate rpc handling

* update dependencies

* update error

* update error

---------

Co-authored-by: evgeniko <97796468+evgeniko@users.noreply.github.com>
…on to root (#754)

* cli: add output message to init command and move example-overrides.json to root

* remove not needed tick
* solana: use updated crates

We no longer need to depend on backported forks of
`wormhole-anchor-sdk`, `wormhole-verify-vaa-shim-interface`, and
`wormhole-post-message-shim-interface` as these have been updated to
support all anchor versions.

Furthermore, the new versions of these crates encode the program
IDs (such as Wormhole) as a static value again, meaning they will be in
the rodata section of the binary just like before, so the binary
patching method works on them for replacing the address.

* cli: properly build svm binaries by passing core address

Newer versions of NTT support a `bridge-address-from-env` flag, which
allows specifying the address of the Wormhole program from an
environment variable rather than relying on a pre-defined set of
addresses. We use that flag when available, and fall back to patching
the binary when it's not.

This way of detecting the cargo flag allows us to:
- build the binary properly for new versions going forward
- support building older NTT releases without modification for other
SVMs (e.g. fogo) by patching the binary
- if the `bridge-address-from-env` feature is backported to older
NTTs (should be straightforward), then the CLI will just pick up that
compilation path automatically
…763)

* cli: remove chalk & ora deps and replace with minimal color utility

* add missing colors file
* feat: add megaeth nttWithExecutor

---------

Co-authored-by: evgeniko <97796468+evgeniko@users.noreply.github.com>
* reformat solidity files and add foundry linting rules

* itemized dependabot tracking
* chore: update @wormhole-foundation/sdk packages to ^4.7.0

Update all wormhole SDK dependencies from ^4.4.0 to ^4.7.0

* Update gas for route
* cli: quote rpc urls to prevent forge command to fail on rpc urls with special characters (&)

* run prettier

* add prettier workflow that should run before other expensive workflows + run prettier in the sui directory

* add prettier.yml

* add prettierignore

* extend prettierignore and adjust npm run prettier command

* pin prettier version

* genertae package-lock.json

* verify prettier version in workflow

---------

Co-authored-by: Evgeni Kozyr <wfek@Evgenis-MacBook-Pro.local>
#773)

* perf(ci): add path filters, concurrency controls, and parallelization

- Add path filters to all workflows to skip unnecessary CI runs
- Add concurrency groups to cancel in-progress runs on new commits
- Parallelize EVM and Solana test jobs where possible
- Move Solana jobs from tilt-kube-public to ubuntu-latest

* feat(ci): add reusable anchor-base image for faster CLI builds

- Add Dockerfile.anchor-base with Solana toolchain and Anchor
- Add anchor-base.yml reusable workflow to build/cache the image
- Image is pushed to ghcr.io and reused across CLI workflow jobs

* feat(ci): optimize CLI workflow with parallel Solana builds and caching

- Split Solana v1/v2 contract builds into parallel jobs
- Cache pre-built .so artifacts between runs using GHA cache
- Use fixed test program keypair for reproducible builds
- Add Dockerfile.cli-test-evm and Dockerfile.cli-test-solana
- Run test-solana directly in container with proper environment
- Cache key includes all build dependencies (scripts, Dockerfiles, Anchor.toml)

* feat(ci): optimize Tilt CI with pre-built images and Docker caching

- Add tilt-images.yml to pre-build Solana/EVM contract images
- Make Tilt CI depend on tilt-images for warm Docker cache
- Add Docker layer caching for Tilt CI builds
- Remove dead devnet/** path filter (directory doesn't exist)

* fix(sdk): add timeout to waitForRelay to prevent infinite loop

- Add maxRetries parameter (default 60 = 2 minutes)
- Throw error after max retries instead of hanging forever
- Improve logging with attempt counter

* perf(ci): reuse SBF artifacts in Anchor Test to eliminate redundant build

- Upload SBF program artifacts from solana-sbf job
- Download pre-built .so files in anchor-test instead of rebuilding
- Remove 9+ minute anchor build that duplicated solana-sbf work
- Remove unnecessary Cargo toolchain/cache steps from anchor-test
- Build only TypeScript SDK (fast) instead of full make sdk

* perf(ci): cache SBF build artifacts to skip redundant rebuilds

- Add SBF artifact cache keyed on Cargo.lock + source files hash
- Skip build step entirely when cache hits (saves ~3.5 min)
- Build only runs when Solana source code actually changes
- Tests still run every time to verify correctness

* fix(ci): restore anchor-test parallelism, keep SBF caching

Reverts the misguided attempt to share artifacts between solana-sbf
and anchor-test jobs. These jobs are designed to run in parallel:

- solana-sbf: uses cargo build-sbf, runs cargo test-sbf
- anchor-test: uses anchor build (via make sdk), runs anchor test

Each job needs to build its own artifacts because:
- anchor-test needs IDL files that only anchor build generates
- The jobs test different things and should run in parallel

Keeps the SBF artifact caching optimization for solana-sbf job
which skips the build when Solana source code hasn't changed.

* fix(ci): use builder target for Solana Tilt image

The 'export' stage (FROM scratch) doesn't work for Tilt because
Dockerfile.test-validator does COPY --from=ntt-solana-contract and
requires the full builder filesystem. Reverting to 'builder' target
while keeping cache_from for layer caching benefits.

* fix(ci): validate SBF cache contains actual .so files before skipping build

The actions/cache@v4 was caching an empty directory (200 bytes) because
it saves/restores in the same step. When the cache "hit", it restored
nothing useful, causing tests to fail with "Program file data not available".

Fix:
- Split into actions/cache/restore@v4 (restore-only)
- Add verification step to check for actual .so files
- Use verification output for build condition instead of cache-hit
- Add separate actions/cache/save@v4 step after successful build

* cli: adjust the description for solana ata command (#776)

* refactor(ci): consolidate duplicate Solana build scripts into single parameterized script

- Merge build-solana-v1.sh and build-solana-v2.sh into build-solana.sh
- Script now takes version as argument (e.g., build-solana.sh 1.0.0)
- Update CLI workflow to use matrix strategy for parallel builds
- Fix artifact naming to match upload/download (solana-v1.0.0-artifacts)

---------

Co-authored-by: evgeniko <97796468+evgeniko@users.noreply.github.com>
Co-authored-by: Adam <20446095+aadam-10@users.noreply.github.com>
Co-authored-by: Adam <20446095+aadam-10@users.noreply.github.com>
* feat: add ntt with executor address

* tidy

* small fix

---------

Co-authored-by: Adam <20446095+aadam-10@users.noreply.github.com>
Co-authored-by: Adam <20446095+aadam-10@users.noreply.github.com>
* centralize validation helpers and tighten arg handling

* enforce strict timeout flag validation

* cap retry backoff with explicit constants

* update script removing all SR logic

* remove chalk

* update fetch logs in one line

* remove ts-ignore comments

* centralize payer validation and enforce required flag

---------

Co-authored-by: martin0995 <martin@papermoon.io>
Co-authored-by: Adam <20446095+aadam-10@users.noreply.github.com>
Co-authored-by: Guido De Vita <24706186+dvgui@users.noreply.github.com>
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 6.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](actions/setup-node@v4...v6)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Guido De Vita <24706186+dvgui@users.noreply.github.com>
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Guido De Vita <24706186+dvgui@users.noreply.github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v3...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Guido De Vita <24706186+dvgui@users.noreply.github.com>
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](actions/cache@v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* fix(ci): simplify CLI workflow to fix fork PR permissions

Remove ghcr.io push for cli-local image that was breaking fork PRs with
"installation not allowed to Write organization package" error.

Changes:
- Simplify cli.yml from 5 jobs to 2 parallel jobs (test-evm, test-solana)
- Remove ghcr.io push entirely for cli-local
- Use GHA layer caching (cache-from: type=gha) instead of registry
- Each job builds its own target directly with BuildKit
- Delete unused Dockerfile.cli-test-{evm,solana} files
- Add fork detection to anchor-base.yml with clear error message

Fork PRs now work because no registry writes are required. The anchor-base
image uses a default ARG in Dockerfile.cli pointing to a pre-built version
that fork PRs can pull (read-only access is allowed).

GHA layer cache provides sufficient performance by caching base layers
(apt, bun, foundry, anchor) and only rebuilding from source changes.

Fixes fork PR #756 permission error.

* fix(ci): use tilt-kube-public for Solana tests (disk space)

* fix(ci): free disk space on ubuntu-latest instead of tilt runner

Use jlumbroso/free-disk-space to remove ~25GB of unused software
(Android SDK, .NET, Haskell, large packages) before building Solana.
This avoids dependence on limited tilt-kube-public runners.

* fix(ci): split Solana build and test for parallelism

- Build v1.0.0 and v2.0.0 artifacts in parallel matrix jobs
- Cache artifacts by version + build script hash
- Test job downloads pre-built artifacts (no compilation needed)
- All jobs use ubuntu-latest with GHA layer cache (no tilt runners)
- No ghcr.io writes (fork PRs work)

* fix(ci): use interactive shell to source PATH for ntt command

* chore(ci): update actions/cache to v5
* feat: migrate from npm to bun package manager

- Replace npm with bun across all Dockerfiles, Makefiles, CI workflows
- Add bunfig.toml with hoisted linker for npm-compatible node_modules
- Add trustedDependencies for native packages with JS fallbacks
- Update GitHub Actions to use oven-sh/setup-bun@v2
- Update documentation and test file comments
- Preserve npm pack and registry publish commands as requested
- Standardize test script naming (test:ci → test in solana)
- Update Anchor.toml to reference correct test script

* fix(ci): free disk space before large Docker builds

Remove Android SDK (~14GB) to prevent 'no space left on device' errors
when loading cli-local Docker image to local daemon.

* fix(docker): use dummy workspaces for frozen lockfile support

Instead of stripping workspaces from package.json (which requires
bun install and risks dependency drift), create dummy package.json
files for missing workspace directories. This allows using bun ci
with frozen lockfile, ensuring reproducible builds.

* fix(ci): improve Tilt test stability and configuration

- Run Jest with Node instead of Bun (compatibility issues)
- Run jest from repo root directory
- Add init container with health checks for all services
- Use curl image for proper HTTP POST support in health checks
- Use container port 8545 for eth-devnet2 headless service
- Configure test RPC endpoints for Kubernetes service DNS names
- Set CI=true env var for proper test configuration

* fix(docker): copy real workspace package.json instead of dummies
* fix(ci): pin bun version to 1.3.4 in all workflows

* fix(cli): add pre-install cleanup and simplify build process

Addresses installation failures for users with existing ntt CLI installations
and removes hacky double-build workarounds.

Pre-install cleanup:
- Add cleanup_old_install function that runs before installation
- Remove old ntt binary from PATH if present
- Remove old source checkout (~/.ntt-cli/.checkout)
- Unlink old bun-linked package if registered
- Preserve ~/.ntt-cli/version for debugging

Build process simplification:
- Remove double-install and double-build hacks
- Remove unnecessary npm symlink workaround
- Use root `bun run build` script which handles dependency ordering
  (sdk-definitions-ntt must be built before other packages)
* chore: bump ts sdk

* add workaround for Bun npm alias resolution bug in the right package.json

* add cjs workaround directly to devDeps

* upgrade bun to fix npm alias resolution

* try 4.7.2

* revert back to 4.7.3

* revert tsx version change

* bun install

* bump to 4.7.4
* prompt for Solana Mainnet RPC overrides during add-chain

* prettier formatting

---------

Co-authored-by: martin0995 <martin@papermoon.io>
dvgui and others added 26 commits January 21, 2026 15:28
* SR deprecation and tests removal

* cli: remove all SR related code (#760)

* Add Custom Consistency Level (CCL) support

- Add ICustomConsistencyLevel interface for on-chain CCL contract interaction
- Add ConfigMakers library to encode CCL configurations
- Update WormholeTransceiver to support CCL immutables and configuration
- Update deployment scripts to read CCL environment variables
- Add IntegrationCustomConsistency test suite with Sepolia testnet tests
- Update mock transceivers for backward compatibility
- All 180 tests pass including 3 new CCL tests

* update deployment scripts, envs and add an integ test

* update deployment scripts, envs and add an integ test

* fix: update SDK tests to remove relayer support and upgrade SDK to 4.9.0

- Remove IWormholeRelayer import from test utils
- Update WormholeTransceiver constructor calls with CCL parameters:
  * Remove relayer and specialRelayer addresses
  * Add customConsistencyLevel, addtlBlocks, customConsistencyLevelAddress
  * Use consistency level 201 (finalized) for testing
- Disable waitForRelay function (relayer support removed)
- Force manual receive for all transfers (automatic: false)
- Remove relayer contract configuration from Wormhole initialization
- Remove deprecated setIsWormholeEvmChain and setIsWormholeRelayingEnabled calls
- Update @wormhole-foundation/sdk to 4.9.0 to get MegaETH type definition
- Update .prettierignore to exclude dist directories

Note: Echidna tests verified - no changes needed as they use DummyTransceiver

* ci: use echidna-action v2

* fix: skip package-lock.json in Docker to avoid bun conflicts

* address comments

* update typings

* cli: Add Custom Consistency Level (CCL) support to add-chain command (#792)

- Add --unsafe-custom-finality flag with format 'level:blocks' (e.g., '200:5')
- Implement warning message and confirmation prompt for CCL usage
- Add network-specific CCL contract address mapping (Testnet: Sepolia, Linea)
- Update deployEvm() to pass CCL parameters via environment variables
- Add CCL configuration summary output after deployment
- Update getImmutables() to fetch CCL parameters from deployed contracts
- Remove outdated relayer references from validation.ts

Tested with successful deployments on Sepolia and Linea testnets with CCL 200:5 configuration.

* resolve final comments
Add an optional `eta` field to TokenConfig that allows overriding
the dynamically calculated ETA in quotes. When specified, this value
(in milliseconds) is used instead of the finality time + guardian
attestation calculation.
* feat: add 0g executor contract

* prettier

* correct nttWithExecutor address
This crate is intended to be imported by integrators that may be on
different anchor versions. By relaxing the version like this, it will be
compatible with any downstream anchor version.
…807)

* feat(cli): add automated big blocks toggle for HyperEVM deployments

* graceful wallet error + guard against non‑Mainnet/Testnet networks when toggling big blocks.
…#813)

* Add governance deployment config files from deployment-scripts branch

Migrate deployment configuration files to main branch to enable prettier
CI checks on these JSON files. This fixes issue #811 (missing comma in
mainnet/contracts.json) and prevents similar formatting errors in the future.

Files added:
- evm/ts-scripts/config/mainnet/contracts.json
- evm/ts-scripts/config/mainnet/chains.json
- evm/ts-scripts/config/testnet/contracts.json
- evm/ts-scripts/config/testnet/chains.json
- solana/ts/scripts/config/mainnet/programs.json
- solana/ts/scripts/config/devnet/programs.json

Closes #811

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix MegaETH RPC URL to use public mainnet endpoint

Replace localhost:50444 with the official mainnet RPC endpoint from
wormhole-sdk-ts to ensure CI/production compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Trim contracts.json to governance-only

Remove contract types already available in wormhole-sdk-ts
(WormholeCoreContracts, WormholeRelayers, SpecializedRelayers) and
NTT-specific types not needed by docs scripts.

Keep only GeneralPurposeGovernances which is used by the docs governance
table generator script.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Adam <20446095+aadam-10@users.noreply.github.com>
* Add EVM v2.0.0 SDK bindings

- Update NttManager version to 2.0.0
- Update WormholeTransceiver version to 2.0.0
- Generate TypeScript ABI bindings for v2.0.0
- Update SDK to support v2.0.0 contract ABI

* fallback rpc

* fixed AbiBindings
* add inbound-limit prompts for new chains

* improve inbound limit prompts and ctrl+c handling

* add comments for logic interpretation

* update status code

* simplify inbound prompt source labels

* warn on malformed outbound limits in inbound-limit prompts

* add cli limit tests and warn on malformed outbound limits

* clarify placeholder outbound limit in setInboundLimit

* dedupe limit formatting helpers and expand cli limit tests

* fix limit formatting for small values and tighten cli jest timeout

* make limit formatting tests deterministic and expand invalid cases

* fix zero-decimal formatting bug and validation inconsistency

* skip inbound limit prompts in CI

* Deduplicate collectMissingInboundGroups, fix isZeroLimit, clean up PR, expand test coverage

* # prettier

---------

Co-authored-by: martin0995 <martin@papermoon.io>
Co-authored-by: Guido De Vita <24706186+dvgui@users.noreply.github.com>
* Improve ntt clone progress output and defer peer errors

* Refine ntt clone progress output

* Improve ntt clone progress output and error handling

* Simplify ntt clone concurrency handling

* Remove console.error interception in ntt clone

* Refine ntt clone concurrency loop

* Add success message after successful clone

* Format check

* parallelize pullDeployments for status/pull

* parallelize inbound limits and missing config checks

* centralize max concurrent RPC cap

* add --rpc-concurrency to tune read-only RPC fanout

* reuse runTaskPool in clone concurrency

* apply rpc concurrency to clone inbound limit pull

* serialize Solana RPC fanout and clarify concurrency

* clarify RPC concurrency semantics for sequential lane

* guard clone progress output for non‑TTY stdout

* cli: add rpc concurrency with tests and CI

* style: fix prettier formatting in concurrency tests

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

* refactor: structured error handling in pullDeployments

Make pullDeployments return structured results with fatal/non-fatal
failure distinction. Track transceiver/fetch errors as fatal while
keeping missing-manager non-fatal. Propagate failures to all call
sites (pull, push, status) so they can report and exit accordingly.

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

* run prettier check

* refactor: structured error handling in pullInboundLimits runTask

Wrap retryWithExponentialBackoff and decimals lookup in try-catch so a
single failing task no longer crashes the entire pool. Returns a
discriminated union result and applies successful values after all tasks
complete, matching the fetchPeerConfig / fetchDeployment pattern.

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

---------

Co-authored-by: martin0995 <martin@papermoon.io>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…825)

* feat: add explicit register() exports to NTT SDK packages

Add idempotent register() function exports to definitions, evm, solana,
and sui packages so consumers can use named imports instead of bare
side-effect imports. This gives bundlers (webpack/turbopack) a bound
import to preserve when sideEffects optimization is enabled.

Module-scope auto-registration is preserved for backward compatibility.

* style: fix prettier formatting

* refactor: use protocolIsRegistered instead of boolean flag

Check the actual SDK registry before attempting registration rather
than relying on a module-level _registered flag. This verifies the
protocols are actually registered, not just that the function ran.

* feat: add deprecation warning for auto-registration on import

Module-scope register() calls now emit console.warn when triggered
as a side effect of importing the package, nudging consumers to
import { register } and call it explicitly.
* ci(evm): enforce contract version bump checks

* ci(evm): avoid false version-check failure on tagged HEAD

* ci(evm): fix tag glob escaping and reject leading-zero semver components

Escape the `+` in the workflow tag filter so it matches literally, and
tighten is_semver to reject leading-zero components (e.g. 01.2.3) which
would cause bash arithmetic to misinterpret them as octal.

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

* ci(evm): skip version-bump check when PR does not touch src/

Only require the contract version to exceed the latest release tag
when the PR actually modifies EVM source files. PRs that only change
CI, scripts, or docs now run the sync check (NttManager ==
WormholeTransceiver) without comparing against the latest tag.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Add EVM v2.0.0 SDK bindings

- Update NttManager version to 2.0.0
- Update WormholeTransceiver version to 2.0.0
- Generate TypeScript ABI bindings for v2.0.0
- Update SDK to support v2.0.0 contract ABI

* fixed AbiBindings

* test: add bun test infrastructure for CLI

* test: add functional tests for CLI (help output, module exports, utilities)

- cli-help.test.ts: verifies all commands and subcommands appear in --help
- module-exports.test.ts: verifies all modules can be imported with correct shapes
- utils.test.ts: tests diffObjects, colorizeDiff, and colors utilities
- 2 tests skipped due to known circular dep (configuration.ts <-> index.ts)

* refactor: move ensureNttRoot to validation.ts, fix circular dependency

configuration.ts was importing ensureNttRoot from index.ts, creating a
circular dependency that prevented module-level testing. Now imports
from validation.ts directly. index.ts re-exports for backwards compat.

* refactor: extract shared options, types, and constants to commands/shared.ts

Moves options, CclConfig, SuiDeploymentResult, EXCLUDED_DIFF_PATHS,
CCL_CONTRACT_ADDRESSES, getNestedValue, and setNestedValue out of
index.ts into commands/shared.ts for reuse by extracted commands.

* refactor: extract all CLI commands to individual files in commands/

- Create 15 command files in cli/src/commands/ (add-chain, clone, config,
  hype, init, manual, new, pull, push, set-mint-authority, solana, status,
  transfer-ownership, update, upgrade)
- Create barrel file (commands/index.ts) re-exporting all command creators
- Export 19 functions from index.ts needed by extracted command files
- Add tests for commands/shared.ts exports and safe command creators

* refactor: wire extracted commands into yargs chain, replace 2150+ inline lines

- Replace inline yargs .command() chain with imports from commands/
- index.ts reduced from 5494 to 3240 lines
- Update help tests to run local CLI via Bun.spawn instead of global binary
- Add hype subcommand test
- All 35 tests pass, CLI help output verified for all commands

* fix: add missing return in builder functions for solana, hype, manual commands

Fixes 3 TypeScript errors where builder functions returned void instead
of the yargs instance. These errors also existed in the original inline
code before extraction.

* refactor: remove unused imports from index.ts after command extraction

Remove enableBigBlocks, hasExecutorDeployed, isNetwork, networks,
platforms, getNestedValue, setNestedValue - all now only used in their
respective command files.

* fix: wire 1.3.1 ABI bindings and fix CCL type errors in getImmutables

- Add 1_3_1 ethers contract bindings to ethers-contracts/index.ts and
  bindings.ts abiVersions (was on disk but not wired in)
- Fix TypeScript errors for customConsistencyLevel, additionalBlocks,
  customConsistencyLevelAddress by using a typed cast in the try/catch
  block (these methods only exist on contracts >= v1.3.1)
- tsc --noEmit now passes with zero errors

* refactor: clean up unused imports in index.ts

Remove 15 unused imports left over after command extraction:
RpcConnection, myEvmSigner, $, AddressLookupTableAccount,
SendTransactionError, TransactionMessage, VersionedTransaction,
UniversalAddress, bcs, Interface, loadConfig, collectMissingConfigs,
printMissingConfigReport, promptSolanaMainnetOverridesIfNeeded,
validatePayerOption. Add TODO for CCL type cast.

* refactor: remove stale comment in index.ts

* refactor: extract query/utility functions to query.ts

Move getImmutables, getPdas, getVersion, nttFromManager, formatNumber,
checkNumberFormatting, and pullInboundLimits into a separate query.ts
module. Re-export from index.ts for backward compatibility.

* refactor: extract EVM and Solana helpers to dedicated modules

Move EVM deployment helpers (withDeploymentScript, detectDeployScriptVersion,
supportsManagerVariants, getSlowFlag, getGasMultiplier, buildVerifierArgs)
to evm-helpers.ts and Solana build/binary helpers (patchSolanaBinary,
checkSvmBinary, checkSolanaVersion, checkAnchorVersion, cargoNetworkFeature,
hasBridgeAddressFromEnvFeature, checkSvmValidSplMultisig) to solana-helpers.ts.

* test: add unit, integration, and E2E tests for CLI modules

- cli-commands.test.ts: help output tests for all 16 subcommands
- e2e-anvil.test.ts: full NTT deploy flow on Anvil forks (Sepolia + Base Sepolia)
- evm-helpers.test.ts: detectDeployScriptVersion, getSlowFlag, getGasMultiplier, buildVerifierArgs
- query.test.ts: formatNumber, checkNumberFormatting
- solana-helpers.test.ts: cargoNetworkFeature, hasBridgeAddressFromEnvFeature
- validation.test.ts: ensureNttRoot

* ci: share forge build cache from EVM workflow to CLI E2E tests

- evm.yml: add forge build --via-ir + actions/cache/save after tests
- cli.yml: replace Docker-based test-evm with native runner (foundry v1.5.0,
  bun v1.3.4) and restore forge cache via actions/cache/restore
- index.ts: add seedForgeCache() to copy cached artifacts into worktree evm/
  directories in deployEvm and upgradeEvm when NTT_EVM_CACHE_DIR is set
- .gitignore: exclude docs/plans/

* fix(test): resolve CLI path and skip E2E when anvil unavailable

- cli-commands.test.ts: use path.resolve from import.meta.dir instead
  of relative path that breaks when CWD is cli/ (as in ts-sdk-ci)
- e2e-anvil.test.ts: skip test suite when anvil is not in PATH

* refactor: group chain-specific files into evm/, solana/, sui/, signers/ subdirectories

Move chain-specific helpers, signers, and utilities into dedicated
subdirectories for better organization. Also moves tokenTransfer.ts
into commands/ where it belongs as a command factory.

File moves:
- evm-helpers.ts, evmsigner.ts, hyperliquid.ts → evm/
- solana-helpers.ts, solanaHelpers.ts → solana/
- suisigner.ts → sui/
- getSigner.ts, signSendWait.ts → signers/
- tokenTransfer.ts → commands/token-transfer.ts

* refactor: extract remaining functions from index.ts into dedicated modules

Move all business logic out of index.ts (2597 → 141 lines), leaving only
the yargs command chain, nttVersion(), and re-exports for backward
compatibility.

New files:
- deploy.ts: deploy/upgrade dispatchers
- config-mgmt.ts: pushDeployment, pullDeployments, pullChainConfig
- evm/deploy.ts: deployEvm, upgradeEvm
- solana/deploy.ts: runAnchorBuild, buildSvm, deploySvm, upgradeSolana
- sui/deploy.ts: deploySui, upgradeSui
- sui/helpers.ts: withSuiEnv, updateMoveTomlForNetwork, performPackageUpgradeInPTB

Functions moved to existing files:
- askForConfirmation → prompts.ts
- parseCclFlag, confirmCustomFinality → commands/shared.ts
- validateChain, checkConfigErrors → validation.ts
- seedForgeCache → evm/helpers.ts
- resolveVersion, createWorkTree, warnLocalDeployment → tag.ts

The module-level `overrides` variable is now threaded as an explicit
parameter through pullDeployments, runAnchorBuild, buildSvm, deploy,
upgrade, and pushDeployment instead of being captured from module scope.

* style: fix prettier formatting in new modules

* fix CCL type cast using the same pattern from the sdk

* fix: resolve 8 preexisting bugs found by CodeRabbit review

- Replace hand-rolled formatNumber/checkNumberFormatting with ethers
  formatUnits/parseUnits, and BigInt(str.replace(".","")) with parseUnits
- Add missing process.exit(1) in set-mint-authority catch block
- Invert multisig validation at second call site (undeployed case)
- Fix --yes flag fallthrough for undeployed programs in solana.ts
- Pass undefined instead of evmVerify to deploySui, add block scoping
- Guard chainConf.limits before accessing .inbound in pullInboundLimits
- Replace execSync with execFileSync for sui keytool (no shell injection)
- Fix Sepolia counterpart check variable (c -> chain) in validateChain

* fix: resolve more preexisting bugs

* test: add regression tests for config validation and chain detection

* feat: integrate PR #808 (inbound limits) and PR #809 (parallelization)

Manually integrate changes from two PRs merged to main into the
restructured module layout:

PR #808 — Inbound limit prompts:
- Add limitFormatting.ts, limits.ts, configErrors.ts modules
- Add interactive inbound limit prompts to add-chain and pull commands
- Add abortOnSigint support to prompts.ts
- Add --yes flag to sepolia-bsc.sh test script

PR #809 — Bounded concurrency:
- Add utils/concurrency.ts (runTaskPool, runTaskPoolWithSequential)
- Parallelize pullDeployments, pullInboundLimits, collectMissingConfigs
- Return { deps, failures } from pullDeployments with failure handling
- Add --rpc-concurrency option to clone/pull/status commands
- Add concurrent peer discovery with progress UI to clone command

Also updates CI with test-cli-unit job and test format expectations
to match full-precision limit formatting.

* test: consolidate tests and move E2E to cli/e2e/

- Merge cli-commands.test.ts into cli-help.test.ts with a maintained
  EXPECTED_COMMANDS list instead of one test per command
- Move E2E test to cli/e2e/ so unit tests (bun run test) exclude it;
  remove skip logic, require anvil with clear error message
- Consolidate evm-helpers tests (8 individual → 2 data-driven)
- Consolidate module-exports tests (14 individual → 7 grouped)
- Suppress console.error noise in checkConfigErrors tests
- Delete unused setup.ts
- Add test:e2e script to package.json

* fix: address CodeRabbit review feedback on E2E tests and CI

- Add NTT_EVM_CACHE_DIR env var to E2E CI step for forge cache reuse
- Validate anvil_setStorageAt response in setCoreBridgeFee
- Check cast send exit code in grantRoleImpersonated
- Fix timeout race in ntt() helper to kill hung processes
- Remove unused SEPOLIA_CCL_CONTRACT constant

* fix: address second round CodeRabbit feedback on tests

- Assert status command exit code in E2E test
- Check cast call exit code in role-verification loop
- Use non-null assertion for warnSpy in limits test
* feat(cli/hype): add HyperCore link, bridge, and status commands

Rebased onto main's restructured CLI layout and ported all HyperCore
integration commands into the new commands/hype.ts + evm/hyperliquid.ts
module structure.

Commands added under `ntt hype`:
- link: links a HyperCore spot token to its HyperEVM ERC-20 contract.
  Runs request + finalize by default; --only-finalize skips the request
  step and reads tokenIndex from deployment.json if --token-index is omitted.
- bridge-in: bridges tokens from HyperEVM into HyperCore via asset bridge
- bridge-out: bridges tokens from HyperCore back to HyperEVM via spotSend
- status: shows HyperCore token index, asset bridge address, and token string

Also adds:
- HyperCoreConfig type + hypercore field to deployments.ts Config
- evm/hyperliquid.ts: spotRequestEvmContract, spotFinalizeEvmContract,
  spotSend, bridgeIn, computeAssetBridge, computeDeployNonce,
  computeDeployNonceFromHyperEvm, getDeployerAddress, getSpotTokenString
- hype/validation.ts: parseIntegerInRange, parsePositiveDecimalAmount,
  parseEvmAddress helpers
- Unit tests for hyperliquid helpers and validation helpers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(cli/hype): add fetch timeout to all HyperLiquid API calls

All raw fetch() calls in evm/hyperliquid.ts lacked timeouts and could
hang indefinitely. Introduce a shared fetchWithTimeout helper (30s default,
AbortController-based) and replace the four bare fetch() call sites:
sendL1Action, setHyperEvmBigBlocks, spotSend, and getSpotTokenString.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(test): add SUBPROCESS_TIMEOUT to hype subcommand help test

The 'manual and hype subcommands are listed' test was the only one in
cli-help.test.ts without an explicit timeout, relying on bun's default
5000ms. Adding imports to commands/hype.ts increased CLI startup time
enough to cause a flaky timeout in ts-sdk-ci. Apply the same
SUBPROCESS_TIMEOUT (30s) used by all other subprocess tests in the file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* sdk: add build transactions functions to route

* fix: prettier

* chore: refactor

* chore: prettier
…831)

* fix(evm-sdk): use dynamic transceiver indices instead of hardcoded 0

The SDK hardcoded transceiver index 0 in encodeOptions(), quoteDeliveryPrice(),
and verifyAddresses(). This breaks when the active transceiver has a non-zero
registered index (e.g. after removing the original transceiver and registering
a new one, since on-chain indices are monotonically increasing and never reused).

Additionally, the manager's quoteDeliveryPrice() has a bug where it sizes the
instructions array using enabledTransceivers.length instead of
numRegisteredTransceivers, causing ARRAY_RANGE_ERROR(50) when the active
transceiver's index >= enabled count. The SDK now bypasses the manager's
quoteDeliveryPrice and calls each transceiver directly as a workaround.

Changes:
- Add registeredIndex property to EvmNttWormholeTranceiver
- Add initTransceiverIndices() that fetches real indices via getTransceiverInfo()
- Fix encodeOptions() to use cached registered indices for all transceivers
- Fix quoteDeliveryPrice() to call transceivers directly (bypasses contract bug)
- Fix verifyAddresses() to match transceiver by address instead of array position

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

* test: add unit tests for dynamic transceiver index handling

14 tests covering:
- initTransceiverIndices: on-chain index fetching, case-insensitive address
  matching, graceful fallback for old ABIs, idempotency, multiple transceivers
- encodeOptions: uses registered index, sorted output, skipRelay flag encoding
- quoteDeliveryPrice: calls transceivers directly (not manager), correct
  instruction-to-transceiver pairing, price summation
- End-to-end: transceiver at index 1 after remove+re-add produces correct
  encoded bytes

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

* fix(evm-sdk): harden transceiver init for CI edge cases

* fix(evm-sdk): correctly filter non-wormhole transceivers

* fix(evm-sdk): restore manager-only transceiver discovery

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
…tatus (#833)

* fix(cli): use fs.symlinkSync for paths with spaces, show version in status

Replace shell `ln -fs` with Node.js fs.symlinkSync to handle paths
containing spaces. Extract nttVersion() into shared version.ts and
print CLI version in `ntt status` output.

* style: run prettier on changed files

* fix(cli): guard against malformed version file

* fix(cli): improve version check and add end-to-end symlink test

Use nttVersion() null check instead of string comparison in index.ts.
Replace source-level symlink assertion with an end-to-end test that
exercises createWorkTree in a temp repo with spaces in the path.

* style: run prettier on test file
* feat(sdk-route): accept dynamic callback for referrer fee config

Add getReferrerFee callback option to NttExecutorRoute and
MultiTokenNttExecutorRoute configs. When defined, it takes priority
over the static referrerFee config.

* chore: change comment

* chore: update comment
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.