Skip to content

feat(mesh-rpc): migrate MeshRpcAdapter to beaconRpcWait link protocol#80

Merged
Magicred-1 merged 2 commits into
v3from
feat/beacon-link-rpc
May 18, 2026
Merged

feat(mesh-rpc): migrate MeshRpcAdapter to beaconRpcWait link protocol#80
Magicred-1 merged 2 commits into
v3from
feat/beacon-link-rpc

Conversation

@Magicred-1
Copy link
Copy Markdown
Member

Summary

  • MeshRpcAdapter: replaces BeaconBroadcastRpcFn with BeaconRpcWaitFn — routes to a specific beacon by destHashHex via a Reticulum Link. rpc() now handles isError: true by throwing an Error with the JSON-RPC error message/code.
  • LxmfContext: exposes beaconRpcWait from useLxmf() in LxmfCtxValue + forwards through useMemo.
  • NetworkModeContext: destructures beaconRpcWait and passes it to the MeshRpcAdapter constructor. Dep array updated.

Old vs new

Old New
Transport LXMF broadcast Reticulum Link
Wire format {id,type,method,params} base64 JSON-RPC 2.0 + zlib
Destination Any responsive beacon Specific beacon by hash
Error handling Silent resultJson isError: true → thrown Error
JS routing Would have needed handleIncoming Native handles correlation

Test plan

  • npx tsc --noEmit — no new errors in changed files
  • Offline + beacon on BLE/TCP mesh → mode === "mesh" in NetworkModeContext
  • Balance fetch routes through beaconRpcWait(destHash, 'getBalance', ...) → Solana → back
  • RPC error from beacon (isError: true) surfaces as user-readable error in UI

Replaces beaconBroadcastRpc (fire-and-forget LXMF broadcast) with
beaconRpcWait (Reticulum Link + JSON-RPC 2.0 with zlib compression).

- MeshRpcAdapter: swap BeaconBroadcastRpcFn → BeaconRpcWaitFn; rpc()
  now passes destHashHex and propagates isError as a thrown Error
- LxmfContext: expose beaconRpcWait from useLxmf() in LxmfCtxValue
- NetworkModeContext: destructure and pass beaconRpcWait to adapter

Native module handles correlation, retransmit, and link management.
No JS-side message routing needed.
@Magicred-1 Magicred-1 merged commit 641d335 into v3 May 18, 2026
1 check passed
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.

1 participant