Skip to content

Conversation

@enesozturk
Copy link
Contributor

@enesozturk enesozturk commented Nov 4, 2025

Description

When sending ERC20 tokens, there is an issue with the writeContract method parameters where we get the following error when sending transactions using Wagmi adapter:

W3mWalletSendPreviewView:onSendClick - error sending transaction AppKitError: An unknown error occurred while executing the contract function "transfer".

Request Arguments:
  chain:  undefined (id: 30)
  from:   0xa9054cea9db7965C1dbDe7aa14aAa39ecda98F14
  to:     0x2AcC95758f8b5F583470ba265EB685a8F45fC9D5
  data:   0xa9059cbb000000000000000000000000a462ca0adfda8037ecac46fb0cecde8d103fd93e00000000000000000000000000000000000000000000000006f05b59d3b20000
 
Contract Call:
  address:   0x2AcC95758f8b5F583470ba265EB685a8F45fC9D5
  function:  transfer(address _to, uint256 _value)
  args:              (0xa462ca0adfda8037ecac46fb0cecde8d103fd93e, 500000000000000000)
  sender:    0xa9054cea9db7965C1dbDe7aa14aAa39ecda98F14

Docs: https://viem.sh/docs/contract/writeContract
Details: Cannot convert eip155:30 to a BigInt
Version: [email protected]
    at getContractError (getContractError.ts:78:10)
    at writeContract (writeContract.ts:208:27)
    at async writeContract (writeContract.ts:108:16)
    at async WagmiAdapter.writeContract (client.ts:436:16)
    ...

As seen in Details: Cannot convert eip155:30 to a BigInt, the Wagmi is getting the chain object with wrong parameters and finding the CAIP id from the network object. Passing the right Wagmi chain object to chain and removing chainId parameter (Viem doesn't have chainId param, see docs).

Steps to reproduce

*(1): Bc we use writeContract only when the token user want to send is ERC20, in SendController.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-4171
For GH issues: closes #...

Showcase (Optional)

If there is a UI change include the screenshots with before and after state.
If new feature is being introduced, include the link to demo recording.

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Note

Fixes writeContract to pass the correct Wagmi chain and updates tests; also adds Rootstock networks to lab constants.

  • Adapters (packages/adapters/wagmi/src/client.ts):
    • Update writeContract to resolve wagmiChain by chain.id and pass it via chain; remove chainId usage.
  • Tests (packages/adapters/wagmi/src/tests/client.test.ts):
    • Use Address for typed params; assert wagmiWriteContract is called with chain and correct args.
  • Lab app networks (apps/laboratory/src/utils/ConstantsUtil.ts):
    • Add rootstock and rootstockTestnet to EvmNetworks.
  • Changeset:
    • Patch release for @reown/appkit-adapter-wagmi noting writeContract param fix.

Written by Cursor Bugbot for commit 66a0c5c. This will update automatically on new commits. Configure here.

@linear
Copy link

linear bot commented Nov 4, 2025

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: 66a0c5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@reown/appkit-adapter-wagmi Patch
@reown/appkit-cdn Patch
@reown/appkit Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-common Patch
@reown/appkit-universal-connector Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-experimental Patch
@reown/appkit-testing Patch
@reown/appkit-cli Patch
@reown/appkit-pay Patch
@reown/appkit-codemod Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 4, 2025

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

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Nov 6, 2025 10:09am
appkit-demo Ready Ready Preview Comment Nov 6, 2025 10:09am
appkit-gallery Ready Ready Preview Comment Nov 6, 2025 10:09am
appkit-laboratory Ready Ready Preview Comment Nov 6, 2025 10:09am
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Nov 6, 2025 10:09am
appkit-basic-sign-client-example Ignored Ignored Nov 6, 2025 10:09am
appkit-basic-up-example Ignored Ignored Nov 6, 2025 10:09am
appkit-ethers5-bera Ignored Ignored Nov 6, 2025 10:09am
appkit-nansen-demo Ignored Ignored Nov 6, 2025 10:09am
appkit-vue-solana Ignored Ignored Nov 6, 2025 10:09am
appkit-wagmi-cdn-example Ignored Ignored Nov 6, 2025 10:09am
ethereum-provider-wagmi-example Ignored Ignored Nov 6, 2025 10:09am
next-wagmi-solana-bitcoin-example Ignored Ignored Nov 6, 2025 10:09am
vue-wagmi-example Ignored Ignored Nov 6, 2025 10:09am

@enesozturk enesozturk changed the title Fix/wagmi write contract params fix: wagmi write contract params Nov 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Visual Regression Test Results ✅ Passed

✨ No visual changes detected

Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=324
Storybook Preview: https://6493191bf4b10fed8ca7353f-jgzlpmshrf.chromatic.com/

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Warnings
⚠️

🔑 Potential UUID detected in packages/adapters/wagmi/src/tests/client.test.ts (line 407): 07ba87ed-43aa-4adf-4...

Generated by 🚫 dangerJS against 66a0c5c

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/[email protected] size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         70.59 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 649 ms   on Snapdragon 410
Total time:   2.1 s
@reown/appkit/react
Size limit:   230 kB
Size:         227.18 kB with all dependencies, minified and gzipped
Loading time: 4.5 s     on slow 3G
Running time: 935 ms    on Snapdragon 410
Total time:   5.4 s
@reown/appkit/vue
Size limit:   80 kB
Size:         70.59 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 408 ms   on Snapdragon 410
Total time:   1.8 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         207.22 kB with all dependencies, minified and gzipped
Loading time: 4.1 s     on slow 3G
Running time: 542 ms    on Snapdragon 410
Total time:   4.6 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.15 kB with all dependencies, minified and gzipped
Loading time: 257 ms   on slow 3G
Running time: 222 ms   on Snapdragon 410
Total time:   479 ms

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.9% 38046 / 47616
🔵 Statements 79.9% 38046 / 47616
🔵 Functions 77.95% 4110 / 5272
🔵 Branches 86.47% 9221 / 10663
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/wagmi/src/client.ts 76.01% 64.77% 81.39% 76.01% 123-124, 129-130, 141-143, 145, 207-208, 248-251, 361-362, 376, 396-397, 472-473, 485-486, 522-523, 540-555, 569-586, 606-607, 620-629, 640-641, 645-646, 651-683, 700-709, 713-719, 722-733, 742-743, 754-755, 776-778, 792-793, 806-807, 822-823, 866-867, 891-892, 900-901, 906-907, 914-915, 923-924, 929-930, 939-940, 948-949, 954-955, 961-983, 986-999
Generated in workflow #16233 for commit 66a0c5c by the Vitest Coverage Report Action

@linear
Copy link

linear bot commented Nov 4, 2025

@enesozturk enesozturk added this pull request to the merge queue Nov 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 4, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 4, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 5, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 5, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 6, 2025
@enesozturk enesozturk added this pull request to the merge queue Nov 7, 2025
Merged via the queue into main with commit 6e9f251 Nov 7, 2025
45 checks passed
@enesozturk enesozturk deleted the fix/wagmi-write-contract-params branch November 7, 2025 08:48
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants