Skip to content

BLO-131: Contracts & SDK v3#288

Merged
drinkcoffee merged 15 commits into
mainfrom
chore/v3
May 22, 2026
Merged

BLO-131: Contracts & SDK v3#288
drinkcoffee merged 15 commits into
mainfrom
chore/v3

Conversation

@alex-connolly
Copy link
Copy Markdown
Contributor

@alex-connolly alex-connolly commented Nov 25, 2025

Summary

This PR releases @imtbl/contracts@3.0.0: a breaking major that turns the package into a lean ABI + addresses + Solidity sources artifact for viem / wagmi / ethers v6, with no runtime npm dependencies and no Hardhat/ethers v5/typechain in the published tarball.

The Solidity preset tree remains in the repo for Forge development and is still published (excluding mocks). What v3 removes is the old npm/TypeScript toolchain (Hardhat deploy scripts, generated ABI tree, ethers v5 clients, wagmi codegen, bundled third-party contract deps).

What's changed in v3 (vs main)

Toolchain: Hardhat → Foundry (development and CI)

Area v2 (main) v3 (chore/v3)
Compile / test hardhat compile, hardhat test, hardhat coverage forge build, forge test, forge coverage
Config hardhat.config.ts, Hardhat plugins (typechain, waffle, foundry bridge) foundry.toml, remappings.txt, git submodules
Deploy scripts deploy/ (Hardhat + deploy/utils.ts) Removed — use forge script / forge create (see BUILD.md)
Lint (TS) ESLint on clients/ Removed — no clients/ package
Lint (Solidity) solhint + prettier-plugin-solidity solhint + forge fmt
Static analysis (varied) Slither with --compile-force-framework forge
Package build tsup + typechain outputs tsc onlydist/

Deleted files (tooling): hardhat.config.ts, wagmi.config.ts, tsup.config.ts, .eslintrc.js, .eslintignore, .prettierrc, .prettierignore, root index.ts (wagmi re-exports), CHANGELOG.md.

npm package surface (breaking for consumers)

v2 (main) v3
Version 2.2.18 (line) 3.0.0
type commonjs module (ESM)
Node .nvmrc 18.17 ≥20 (.nvmrc 22.12.0)
Runtime dependencies Many (@openzeppelin/contracts, Seaport fork aliases, Axelar, solmate, etc.) None
peerDependencies (none) @openzeppelin/contracts (consumers supply OZ when compiling .sol)
postinstall rimraf on Seaport foundry.toml Removed
Published layout dist/ + entire contracts/ + huge abi/ tree dist/ + contracts/**/*.sol excluding contracts/mocks/**
Tarball size (after build) ~241 kB ~85 kB (~65% smaller)

Removed from the published package:

  • abi/ — generated JSON ABIs, abi/index.ts, per-contract JSON subpaths (~1.1 MB of ABI payload in v2)
  • clients/ — ethers v5 helpers (erc20.ts, erc721.ts, erc721-mint-by-id.ts, config overrides)
  • contract_address.json — replaced by typed constants in src/addresses.ts
  • Bundled npm copies of OZ / Seaport / Axelar / solmate — consumers must install peers and use remappings (documented in README; same submodules as the repo)

Added / changed exports:

  • @imtbl/contractsImmutableERC721Abi, ImmutableERC721MintByIdAbi, ImmutableERC1155Abi, GuardedMulticaller2Abi, PaymentSplitterAbi, plus address maps (IMMUTABLE_SEAPORT, CHAIN_ID, bridge/wallet/zone addresses, etc.)
  • @imtbl/contracts/abis — ABI-only subpath
  • @imtbl/contracts/addresses — address constants only
  • @imtbl/contracts/contracts/* — Solidity sources for import/remapping in consumer projects

ABI naming (breaking): v2 re-exported camelCase names from abi/generated.ts (e.g. immutableErc721Abi). v3 uses PascalCase names aligned with v2.2.18 public API (ImmutableERC721Abi, etc.). Subpath imports change from @imtbl/contracts/abi/... to @imtbl/contracts/abis or root.

No longer shipped: typechain types, wagmi hooks from this package, ethers v5 clients, import contract_address.json.

Solidity in the repo vs in the tarball

  • The git repo still contains the full preset / bridge / trading / Seaport-related Solidity under contracts/ (Forge needs submodules; restored in dc7c7dc after an intermediate lean pass).
  • vs main in contracts/: one addition — contracts/trading/seaport16/zones/immutable-signed-zone/v3/interfaces/ITransferValidator.sol.
  • Mocks (contracts/mocks/**) remain in the repo for tests but are not published to npm.

CI (.github/workflows/test.yml)

Real jobs:

  • Run Forge Testsforge test with submodule init + Foundry cache (name matches branch protection)
  • Run solhint — Solidity lint
  • Check README.md is contained in each contracts directory
  • Package build (v3)yarn build + npm pack --dry-run
  • Run slither — Foundry compile + Slither (includes fix for Debian python3-typing-extensions conflict)

Legacy stub jobs (pass immediately until branch protection is updated for v3):

  • Run Hardhat Tests — documents Hardhat removal
  • Run eslint — documents ESLint removal

Publish workflow (.github/workflows/publish.yaml)

  • Checkout with recursive submodules, forge build before pack, yarn build, publish with pinned action SHA, tag: latest, npm provenance attestation on .tgz.

Breaking changes for npm consumers

  1. Pin @imtbl/contracts@2.2.18 until you migrate, or adopt v3 explicitly.
  2. Replace contract_address.json with IMMUTABLE_* / CHAIN_ID from @imtbl/contracts or @imtbl/contracts/addresses.
  3. Replace clients/* and abi/* JSON imports with viem/wagmi/ethers v6 + exported ABIs.
  4. Install @openzeppelin/contracts (and your own Seaport/Axelar remappings) when compiling published .sol files.
  5. Expect ESM ("type": "module") and Node ≥20.

Follow-ups (post-merge)

  • Update GitHub branch protection to require Run Forge Tests / drop Hardhat + eslint required checks
  • Announce v3 migration to SDK/app teams consuming @imtbl/contracts

Note

Medium Risk
Medium risk because this is a breaking release that changes the published npm surface (ESM, Node version, exports) and rewires CI/release workflows; it should not affect on-chain Solidity logic beyond one added interface file.

Overview
Updates @imtbl/contracts to v3.0.0 as a lean ESM package that publishes TypeScript ABIs + typed deployed address constants + Solidity sources, and removes the old TypeScript/Hardhat consumer surface (generated abi/, clients/, Hardhat deploy scripts/config, wagmi codegen, eslint/prettier configs, and contract_address.json).

Switches the development and CI toolchain to Foundry-first: workflows now run forge build/forge test, add Foundry build caching, add a package build/pack check, and keep stub “legacy” jobs for old branch protection. Packaging is tightened via exports, files, and .npmignore (excluding contracts/mocks/**), Node is bumped via .nvmrc/engines, and docs are updated to reflect the new consumption and migration guidance.

Reviewed by Cursor Bugbot for commit 2ee3fba. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread contract_address.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can't remove this file: it is the authoritative source of this information, referenced from here: https://docs.immutable.com/learn/products/contracts/

alex-connolly and others added 3 commits May 20, 2026 20:52
Drop Hardhat, typechain, bundled ethers clients, postinstall, and per-ABI JSON subpaths. Publish TypeScript ABIs and addresses from dist/ and Solidity sources via contracts/*. Keep PascalCase ABI export names aligned with v2.2.18 for ABI-only consumers.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve package.json in favor of v3.0.0 Foundry/npm layout.
Combine .npmignore rules from main (mocks, assets, diagrams)
with v3 dev exclusions.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep the lean npm package (dist + contracts exports) while restoring the full
Solidity sources, lib submodules, and remappings required by forge test.
Align foundry.toml with main, add recursive submodule checkout in CI, and
cache Foundry build output without lib/ (submodules + forge install supply deps).

Verified locally: forge build, forge test (867 passed), yarn build, npm pack.
@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 20, 2026

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report

alex-connolly and others added 3 commits May 21, 2026 05:49
Remove invalid `contents` input from JS-DevTools/npm-publish@v4 (package
files come from package.json `files` and .npmignore). Split PR CI into
forge-test (recursive submodules) and package-check only; run full forge
build and npm publish on release. Bump checkout and setup-node to v6.

Co-authored-by: Cursor <cursoragent@cursor.com>
Narrow published files to dist and contract sources only, exclude mocks and non-Solidity assets, and drop declaration maps from the package. Replace tsup with tsc, add ESM subpath exports, and restore solhint in CI.

Co-authored-by: Cursor <cursoragent@cursor.com>
Set rootDir for TS 6, drop rimraf/prettier, inline clean, bump @types/node and solhint, and align CI with .nvmrc.

Co-authored-by: Cursor <cursoragent@cursor.com>
@alex-connolly alex-connolly marked this pull request as ready for review May 20, 2026 23:26
@alex-connolly alex-connolly requested review from a team as code owners May 20, 2026 23:26
Comment thread .github/workflows/publish.yaml Outdated
Comment thread .github/workflows/publish.yaml
Comment thread .github/workflows/test.yml Outdated
Comment thread .github/workflows/publish.yaml Outdated
@alex-connolly alex-connolly changed the title SDK v3 Contracts & SDK v3 May 20, 2026
alex-connolly and others added 2 commits May 21, 2026 09:37
Rename Foundry job to match required status, restore README/slither jobs,
add v3 skip stubs for removed Hardhat/eslint, and harden npm publish workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
Match main branch workflow: apt remove python3-typing-extensions before pip install.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread package.json
"contracts/**/*.sol",
"!contracts/mocks",
"dist"
"!contracts/mocks/**"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Negation pattern in files has undefined npm behavior

Medium Severity

The !contracts/mocks/** negation in the "files" array relies on behavior that npm explicitly documents as having "undefined consequences." Multiple npm versions (v7+) have had bugs where files negation is silently ignored, which would cause mock/test contracts to leak into the published tarball. The .npmignore has a backup exclusion, but the PR description incorrectly states .npmignore is ignored when "files" is set, risking future removal of that safety net.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1e11e98. Configure here.

@alex-connolly alex-connolly changed the title Contracts & SDK v3 BLO-131: Contracts & SDK v3 May 21, 2026
drinkcoffee
drinkcoffee previously approved these changes May 22, 2026
Copy link
Copy Markdown
Contributor

@drinkcoffee drinkcoffee left a comment

Choose a reason for hiding this comment

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

lgtm

Comment thread src/addresses.ts Outdated
Comment thread src/addresses.ts Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

There are 4 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2ee3fba. Configure here.

package: package.json
tag: latest
provenance: true
strategy: all
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Release tag ignores package version

High Severity

The publish workflow no longer validates the GitHub release tag or updates the package.json version before npm publish. This can cause the published package's version on NPM to diverge from the GitHub release tag, potentially confusing consumers.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ee3fba. Configure here.

- name: Attest build provenance
uses: actions/attest-build-provenance@v3
with:
subject-path: ./*.tgz
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Provenance attestation after publish

Medium Severity

The Attest build provenance step now runs after Publish to NPM. This reverses the previous workflow's order, allowing packages to be published without their build provenance attestation, which was a critical supply-chain security requirement.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ee3fba. Configure here.

function beforeAuthorizedTransfer(address token, uint256 tokenId) external;
function beforeAuthorizedTransferWithAmount(address token, uint256 tokenId, uint256 amount) external;
function afterAuthorizedTransferWithAmount(address token, uint256 tokenId) external;
} No newline at end of file
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused local transfer interface

Low Severity

The new ITransferValidator.sol under v3/interfaces/ is not imported anywhere; ImmutableSignedZoneV3.sol still imports Limit Break’s ITransferValidator. The duplicate ships in the npm tarball without participating in compilation.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2ee3fba. Configure here.

@drinkcoffee drinkcoffee merged commit 182b883 into main May 22, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants