Skip to content

feat: evm core wagmi#414

Merged
cgilbe27 merged 6 commits intodevelopfrom
feat/evm-core-wagmi
Nov 6, 2025
Merged

feat: evm core wagmi#414
cgilbe27 merged 6 commits intodevelopfrom
feat/evm-core-wagmi

Conversation

@cgilbe27
Copy link
Contributor

@cgilbe27 cgilbe27 commented Nov 3, 2025

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Warning

Rate limit exceeded

@cgilbe27 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 43 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ffc8f0d and c734a81.

📒 Files selected for processing (5)
  • .github/workflows/release.yaml (1 hunks)
  • .github/workflows/test-ts-sdk.yaml (1 hunks)
  • .nvmrc (1 hunks)
  • package.json (5 hunks)
  • src/sdk/query/query.test.ts (1 hunks)
📝 Walkthrough

Walkthrough

This PR replaces TypeChain code generation with Wagmi/Viem codegen for the evm-core module. Changes include adding Wagmi dependencies, configuring the Wagmi CLI, defining precompile contract ABIs and addresses, and generating Wagmi-based contract wrappers and React hooks.

Changes

Cohort / File(s) Change Summary
Submodule Update
nibiru
Submodule pointer advanced to a new commit, tracking state changes without altering code logic.
Dependencies & Build Configuration
package.json, wagmi.config.ts
Added wagmi, @wagmi/cli, @nibiruchain/solidity dependencies and devDependencies; new wagmi.config.ts defines code generation output, contracts, and plugins.
Build Pipeline Integration
scripts/build.sh
Added yarn wagmi:generate command at the start of build script before existing gql-generate and proto-gen steps.
Precompile Contract Definitions
src/evm-core/precompile/precompile.ts, src/evm-core/precompile/funtoken.ts, src/evm-core/precompile/oracle.ts, src/evm-core/precompile/wasm.ts, src/evm-core/precompile/index.ts
Added HexAddr type alias and precompile contract address/ABI constants for FunToken, Oracle, and Wasm; consolidated exports via index.
Contract Constants & Generated Wrappers
src/evm-core/const.ts, src/evm-core/generated.ts
Added ADDR_WNIBI, ADDR_ERIS_EVM, and ERIS_CONST constants; generated comprehensive Wagmi-based read/write/simulate/watch functions and React hooks for ErisEvm, IFunToken, IOracle, IWasm, and WNIBI contracts.
Public API Surface
src/evm-core/index.ts, src/index.ts
Re-exported precompile, const, and generated modules from src/evm-core; exposed evm-core exports from root src/index.ts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Wagmi configuration and code generation setup: Verify wagmi.config.ts correctly specifies contracts, ABIs, and output paths
  • Precompile ABI accuracy: Cross-check FunToken, Oracle, and Wasm ABI definitions for correct function signatures, input/output types, and state mutability
  • Build script integration: Ensure wagmi:generate runs in correct sequence and properly handles errors
  • Generated contract wrappers: Spot-check that read/write/simulate/watch functions and React hooks correctly bind ABIs and addresses
  • Export consolidation: Confirm re-exports at src/evm-core/index.ts and src/index.ts properly expose intended public API

Possibly related PRs

Suggested reviewers

  • CalicoNino
  • k-yang

Poem

🐰 Wagmi now stitches the chain together,
No more TypeChain, we're lighter than feather,
Precompiles dance in our generated nest,
React hooks and reads—hooray, we're blessed!
viem's velocity carries us far,
This SDK now shines like a ✨ star!

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Feat/evm core wagmi' is concise and directly related to the main changes in the pull request. The changeset introduces wagmi integration for the EVM core module by adding wagmi dependencies, configuration, and generated contract helpers. While the title uses a shortened format ('Feat/evm core wagmi' rather than a full sentence), it clearly indicates the feature involves adding wagmi to the EVM core module, which accurately summarizes the primary change.
Description check ✅ Passed The PR description references two linked issues (#411 and #410) that directly relate to the changes in the pull request. Issue #411 addresses replacing TypeChain with viem/wagmi, and issue #410 addresses moving evm-core-ts to ts-sdk. The changeset demonstrates both objectives: integrating wagmi (addressing #411) and establishing an evm-core module within ts-sdk (addressing #410). Although minimal in text, the description is directly relevant to the changeset.
Linked Issues check ✅ Passed The pull request successfully addresses both linked issues. For issue #411 ('evm-core-ts should use viem/wagmi over typechain'), the PR introduces wagmi integration by adding @wagmi/cli and wagmi dependencies, creating wagmi.config.ts, and generating comprehensive Wagmi-based contract helpers in src/evm-core/generated.ts. For issue #410 ('Move evm-core-ts to ts-sdk'), the PR establishes the evm-core module structure within ts-sdk with proper exports through src/evm-core/index.ts and src/index.ts, ensuring chain code is accessible through the same utility package.
Out of Scope Changes check ✅ Passed All changes in the pull request are directly aligned with the stated objectives in linked issues #411 and #410. The changes include: adding wagmi dependencies and configuration, generating contract helpers using Wagmi, establishing precompile contract definitions, adding new constants for contract addresses, and creating proper export structure for the evm-core module. The submodule pointer update to nibiru and the build script modification (adding wagmi:generate step) are both necessary infrastructure changes to support the wagmi integration objective.

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.

@cgilbe27 cgilbe27 changed the title Feat/evm core wagmi feat: evm core wagmi Nov 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/evm-core/precompile/funtoken.ts (1)

1-1: Document the reason for disabling ESLint.

Consider documenting why ESLint is disabled for this file, or enable it with specific rule overrides if only certain rules are problematic.

-/* eslint-disable */
+/* eslint-disable @typescript-eslint/naming-convention */
+// Note: Disabled naming convention checks for ABI constants that follow Solidity conventions
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7fba00 and ffc8f0d.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (13)
  • nibiru (1 hunks)
  • package.json (4 hunks)
  • scripts/build.sh (1 hunks)
  • src/evm-core/const.ts (1 hunks)
  • src/evm-core/generated.ts (1 hunks)
  • src/evm-core/index.ts (1 hunks)
  • src/evm-core/precompile/funtoken.ts (1 hunks)
  • src/evm-core/precompile/index.ts (1 hunks)
  • src/evm-core/precompile/oracle.ts (1 hunks)
  • src/evm-core/precompile/precompile.ts (1 hunks)
  • src/evm-core/precompile/wasm.ts (1 hunks)
  • src/index.ts (1 hunks)
  • wagmi.config.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-10-16T16:15:54.452Z
Learnt from: Unique-Divine
Repo: NibiruChain/ts-sdk PR: 254
File: packages/nibijs/src/chain/types.ts:0-0
Timestamp: 2024-10-16T16:15:54.452Z
Learning: The user Unique-Divine has updated the code to remove the export of `newCoin` and `newCoins` from `cosmjs/proto-signing` to align with the PR objectives of not exporting third-party packages directly and avoiding unnecessary aliasing.

Applied to files:

  • src/evm-core/precompile/index.ts
  • src/evm-core/index.ts
  • src/index.ts
🧬 Code graph analysis (4)
src/evm-core/precompile/funtoken.ts (1)
src/evm-core/precompile/precompile.ts (1)
  • HexAddr (1-1)
src/evm-core/precompile/wasm.ts (1)
src/evm-core/precompile/precompile.ts (1)
  • HexAddr (1-1)
src/evm-core/precompile/oracle.ts (1)
src/evm-core/precompile/precompile.ts (1)
  • HexAddr (1-1)
wagmi.config.ts (4)
src/evm-core/precompile/wasm.ts (1)
  • ADDR_WASM_PRECOMPILE (4-5)
src/evm-core/precompile/oracle.ts (1)
  • ADDR_ORACLE_PRECOMPILE (4-5)
src/evm-core/precompile/funtoken.ts (1)
  • ADDR_FUNTOKEN_PRECOMPILE (5-6)
src/evm-core/const.ts (2)
  • ADDR_ERIS_EVM (7-7)
  • ADDR_WNIBI (1-1)
🔇 Additional comments (12)
nibiru (1)

1-1: Submodule commit does not align with stated PR objectives—manual verification required.

The nibiru submodule pointer update references commit 4abe1407f538470e1bf790eb9fa9340bae01802b, which is a valid, reachable commit. However, the commit message is "docs(bank): README fixes"—a documentation-only change unrelated to the stated PR objectives (TypeChain → Wagmi/Viem migration, evm-core relocation).

Concerns:

  • The submodule commit contains no code changes supporting the PR's stated refactoring goals
  • No related changes detected in parent repository (wagmi.config.ts, package.json updates, evm-core exports)
  • This suggests either incomplete integration or misaligned submodule targeting

Action: Confirm that:

  1. This submodule update is intentional and necessary for the PR
  2. Supporting integration changes (wagmi config, evm-core exports, dependency updates) exist in the parent ts-sdk repository
  3. The submodule pointer targets the correct nibiru commit with the required functionality
src/index.ts (1)

4-4: Root barrel now surfaces evm-core APIs.
This keeps the relocation effort cohesive—consumers can reach the new Wagmi-powered surface from the canonical entrypoint without path rewrites.

src/evm-core/precompile/precompile.ts (1)

1-1: Local HexAddr template keeps address typing self-contained.
Nice way to gate precompile constants behind a 0x-prefixed contract address type without leaking external typings—exactly in line with prior feedback on third-party exports. Based on learnings

src/evm-core/precompile/index.ts (1)

1-4: Unified precompile barrel keeps imports tidy.
Pulling the concrete precompile modules plus the shared types into one surface simplifies migration for downstream callers.

scripts/build.sh (1)

7-7: Early Wagmi codegen keeps build deterministic.
Running yarn wagmi:generate up front guarantees the generated contracts land before the GraphQL/proto pipelines kick in, so build:tsc and docgen never compile against stale stubs.

src/evm-core/index.ts (1)

1-3: Barrel completes the evm-core surface.
Exporting precompile, const, and generated modules together exposes the whole Wagmi toolset through one entry, matching the repository move objective.

wagmi.config.ts (2)

11-16: LGTM! Flexible ABI parsing.

The readAbi helper correctly handles both pure ABI arrays and Hardhat-style artifacts with an abi field, providing good flexibility for different ABI sources.


42-46: Verify WNIBI artifact exists in nibiru Git submodule or migrate to npm package.

The WNIBI artifact path ./nibiru/x/evm/embeds/artifacts/contracts/WNIBI.sol/WNIBI.json references a Git submodule (nibiru is defined in .gitmodules) that is not initialized in the current repository state. Unlike other ABIs which reference ./node_modules/@nibiruchain/solidity/abi/, the WNIBI path points to a local submodule artifact that may not be available at build time.

Ensure: (1) the nibiru submodule is properly initialized during the build process, (2) the artifact exists at that path in the nibiru repository, or (3) migrate WNIBI to use the npm package path like other ABIs for consistency.

src/evm-core/precompile/wasm.ts (1)

1-221: LGTM! Well-structured precompile definition.

The Wasm precompile address and ABI are correctly defined with proper type safety using as const. The ABI includes all necessary functions (execute, executeMulti, instantiate, query, queryRaw) with appropriate input/output types and state mutability.

src/evm-core/precompile/funtoken.ts (1)

4-251: LGTM! Complete FunToken precompile definition.

The FunToken precompile address and ABI are well-defined with comprehensive functions for token operations (balance queries, bank interactions, address conversion). The tuple structures for FunToken and NibiruAccount are properly specified.

src/evm-core/precompile/oracle.ts (1)

1-77: LGTM! Clean Oracle precompile definition.

The Oracle precompile address and ABI are correctly defined with two view functions for querying price data. The function signatures match standard oracle interfaces (ChainLink-style round data and exchange rate queries).

package.json (1)

39-39: Dependencies are already at current versions.

The package.json contains:

  • wagmi: 2.19.2 (matches latest)
  • @wagmi/cli: 2.7.1 (exceeds latest reported 1.5.0)
  • @nibiruchain/solidity: 0.0.7 (matches latest)

No version updates needed.

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Lines Statements Branches Functions
Coverage: 79%
81.37% (935/1149) 80.09% (177/221) 89.48% (315/352)

@cgilbe27 cgilbe27 merged commit 6681491 into develop Nov 6, 2025
3 checks passed
@cgilbe27 cgilbe27 deleted the feat/evm-core-wagmi branch November 6, 2025 13:04
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.

evm-core-ts should use viem/wagmi over typechain Move evm-core-ts to ts-sdk

2 participants