…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>
Description
Fix TON
sendMessagevia WalletConnect failing withTonValidationError: Messages are absenton the wallet side.The
TonWalletConnectConnectorwas passingsendMessageparams 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:validUntil/extraCurrency(camelCase) instead ofvalid_until/extra_currency(snake_case)[{...}]but the sample wallet'sapproveTonRequestpassesrequest.paramsdirectly towallet.sendMessage()without unwrapping — unlikesignDatawhich correctly usesrequest.params[0]The injected wallet connector (
TonConnectConnector) already handled this conversion correctly.Changes:
validUntil→valid_until(with default 60s expiry)extraCurrency→extra_currencyin message objectsamountis always a string (wallets validatetypeof)Type of change
Checklist
Note
Medium Risk
Touches TON transaction submission over WalletConnect by changing the JSON-RPC
ton_sendMessagepayload shape/field names; could affect wallet compatibility if any clients relied on the previous (incorrect) format.Overview
Fixes TON WalletConnect
sendMessagerequest formatting to match the WalletConnect TON JSON-RPC spec.TonWalletConnectConnector.sendMessagenow normalizes message fields (stringifiesamount, mapsextraCurrencytoextra_currency, and builds amessagesarray) and sendston_sendMessageparamsas a plain object withvalid_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.