Skip to content

fix: convert TON WalletConnect sendMessage params to spec-compliant format - #5567

Merged
0xmkh merged 2 commits into
mainfrom
fix/ton-wc-send-message-params
Feb 27, 2026
Merged

fix: convert TON WalletConnect sendMessage params to spec-compliant format#5567
0xmkh merged 2 commits into
mainfrom
fix/ton-wc-send-message-params

Conversation

@enesozturk

@enesozturk enesozturk commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Description

Fix TON sendMessage via WalletConnect failing with TonValidationError: Messages are absent on the wallet side.

The TonWalletConnectConnector was passing sendMessage params through to the WalletConnect provider without converting field names to the snake_case format required by the WalletConnect TON JSON-RPC spec. This caused wallets (including the WalletConnect sample wallet) to fail validation because:

  1. Wrong field names: validUntil / extraCurrency (camelCase) instead of valid_until / extra_currency (snake_case)
  2. Array wrapping issue: params were sent as [{...}] but the sample wallet's approveTonRequest passes request.params directly to wallet.sendMessage() without unwrapping — unlike signData which correctly uses request.params[0]

The injected wallet connector (TonConnectConnector) already handled this conversion correctly.

Changes:

  • Convert validUntilvalid_until (with default 60s expiry)
  • Convert extraCurrencyextra_currency in message objects
  • Ensure amount is always a string (wallets validate typeof)
  • Send params as a plain object instead of array for broader wallet compatibility

Type of change

  • Bug fix (non-breaking change which fixes an issue)

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

Medium Risk
Touches TON transaction submission over WalletConnect by changing the JSON-RPC ton_sendMessage payload shape/field names; could affect wallet compatibility if any clients relied on the previous (incorrect) format.

Overview
Fixes TON WalletConnect sendMessage request formatting to match the WalletConnect TON JSON-RPC spec.

TonWalletConnectConnector.sendMessage now normalizes message fields (stringifies amount, maps extraCurrency to extra_currency, and builds a messages array) and sends ton_sendMessage params as a plain object with valid_until (defaulting to now+60s) instead of wrapping the params in an array.

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

…ormat

The TonWalletConnectConnector was passing sendMessage params through
without converting field names to the snake_case format required by
the WalletConnect TON JSON-RPC spec. This caused wallets to fail with
"Messages are absent" because:

1. Field names were camelCase (validUntil, extraCurrency) instead of
   snake_case (valid_until, extra_currency) as required by the spec
2. Params were wrapped in an array, but the sample wallet's
   approveTonRequest handler passes request.params directly to
   sendMessage without unwrapping — unlike signData which correctly
   unwraps with request.params[0]

Changes:
- Convert validUntil to valid_until with a default 60s expiry
- Convert extraCurrency to extra_currency in message objects
- Ensure amount is always a string (wallets validate typeof)
- Send params as a plain object instead of array for compatibility

The injected wallet connector (TonConnectConnector) already handled
this conversion correctly.

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

vercel Bot commented Feb 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
appkit-demo Ready Ready Preview, Comment Feb 27, 2026 2:52pm
appkit-gallery Ready Ready Preview, Comment Feb 27, 2026 2:52pm
appkit-headless-sample-app Ready Ready Preview, Comment Feb 27, 2026 2:52pm
appkit-laboratory Ready Ready Preview, Comment Feb 27, 2026 2:52pm
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
appkit-basic-example Ignored Ignored Feb 27, 2026 2:52pm
appkit-basic-sign-client-example Ignored Ignored Feb 27, 2026 2:52pm
appkit-basic-up-example Ignored Ignored Feb 27, 2026 2:52pm
appkit-ethers5-bera Ignored Ignored Feb 27, 2026 2:52pm
appkit-nansen-demo Ignored Ignored Feb 27, 2026 2:52pm
appkit-wagmi-cdn-example Ignored Ignored Feb 27, 2026 2:52pm
ethereum-provider-wagmi-example Ignored Ignored Feb 27, 2026 2:52pm
next-wagmi-solana-bitcoin-example Ignored Ignored Feb 27, 2026 2:52pm
vue-wagmi-example Ignored Ignored Feb 27, 2026 2:52pm

Request Review

@changeset-bot

changeset-bot Bot commented Feb 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d2d1433

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions

github-actions Bot commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Visual Regression Test Results ✅ Passed

⚠️ 15 visual change(s) detected

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

👉 Please review the visual changes in Chromatic and accept or reject them.

@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         75.64 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 368 ms   on Snapdragon 410
Total time:   1.9 s
@reown/appkit/react
Size limit:   235 kB
Size:         233.9 kB with all dependencies, minified and gzipped
Loading time: 4.6 s    on slow 3G
Running time: 562 ms   on Snapdragon 410
Total time:   5.2 s
@reown/appkit/vue
Size limit:   80 kB
Size:         75.64 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 155 ms   on Snapdragon 410
Total time:   1.7 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         213.73 kB with all dependencies, minified and gzipped
Loading time: 4.2 s     on slow 3G
Running time: 452 ms    on Snapdragon 410
Total time:   4.7 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.16 kB with all dependencies, minified and gzipped
Loading time: 258 ms   on slow 3G
Running time: 34 ms    on Snapdragon 410
Total time:   291 ms

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.63% 39610 / 50372
🔵 Statements 78.63% 39610 / 50372
🔵 Functions 76.34% 4251 / 5568
🔵 Branches 86.7% 9636 / 11113
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/adapters/ton/src/connectors/TonWalletConnectConnector.ts 35.71% 75% 25% 35.71% 34-35, 38-39, 42-43, 52-55, 58-72, 75-104, 107-108, 112-113, 116-117
Generated in workflow #16946 for commit d2d1433 by the Vitest Coverage Report Action

@0xmkh
0xmkh merged commit 329ea79 into main Feb 27, 2026
40 of 43 checks passed
@0xmkh
0xmkh deleted the fix/ton-wc-send-message-params branch February 27, 2026 15:07
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 27, 2026
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.

2 participants