Skip to content

refactor: consolidate viem client helpers and FilecoinChain types - #909

Open
hugomrdias wants to merge 15 commits into
masterfrom
hugomrdias/895-split-viem-clients
Open

refactor: consolidate viem client helpers and FilecoinChain types#909
hugomrdias wants to merge 15 commits into
masterfrom
hugomrdias/895-split-viem-clients

Conversation

@hugomrdias

@hugomrdias hugomrdias commented Aug 7, 2026

Copy link
Copy Markdown
Member

Summary

  • Add @filoz/synapse-core/client with getTransport, asClient, and toReadClient (ranked Filecoin RPC transports; normalize clients to FilecoinChain; swap custom transports to HTTP for non-JSON-RPC accounts).
  • Introduce shared ReadClient / AccountClient / SessionKeyClient aliases and rename the FOC chain interface to FilecoinChain (avoids clashing with viem’s Chain).
  • Keep synapse-core action signatures on plain viem clients (Client<Transport, Chain> for reads, Client<Transport, Chain, Account> for writes/signing).
  • Update synapse-sdk so Synapse exposes client + readClient (both extended with publicActions) and threads them into payments / warm-storage / SP registry services.
  • Update synapse-react and the CLI to use connector/wallet clients for writes and receipt waits, and drop obsolete account-stripping tests.

Test plan

  • pnpm --filter @filoz/synapse-core test
  • pnpm --filter @filoz/synapse-sdk test
  • pnpm --filter @filoz/synapse-react build
  • Spot-check CLI deposit/list flows against calibration with a wallet client
  • Spot-check playground deposit + data-set list with a browser wallet

@github-project-automation github-project-automation Bot moved this to 📌 Triage in FOC Aug 7, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
synapse-dev d2725be Commit Preview URL

Branch Preview URL
Aug 12 2026, 10:38 AM

@hugomrdias
hugomrdias marked this pull request as ready for review August 7, 2026 10:52
@hugomrdias
hugomrdias requested a review from rvagg as a code owner August 7, 2026 10:52
@hugomrdias hugomrdias linked an issue Aug 7, 2026 that may be closed by this pull request
@hugomrdias hugomrdias self-assigned this Aug 7, 2026
@hugomrdias hugomrdias changed the title refactor: split read and account viem clients refactor: consolidate viem client helpers and FilecoinChain types Aug 7, 2026
@hugomrdias
hugomrdias requested a review from a team as a code owner August 7, 2026 16:23
@FilOzone FilOzone deleted a comment from FilOzzy Aug 8, 2026
Comment thread packages/synapse-core/src/client.ts Outdated
Type read actions as ReadClient and write actions as AccountClient, and move toReadClient into a dedicated client export so callers strip accounts explicitly.
Avoid clashing with viem's Chain type and tighten toReadClient/asClient around FilecoinChain.
Route service reads through Synapse.readClient and type wallet clients as AccountClient.
Drop ReadClient/AccountClient from action parameters in favor of Client<Transport, Chain> and Client<Transport, Chain, Account>.
Extend Synapse clients with publicActions, thread readClient into services, and update AccountClient/ReadClient usages for the reordered generics.
Clean up leftover chain generics and unused imports after the client type updates.
Update CLI and tests to pass wallet clients through for reads, and remove obsolete read-client / PDP contract tests.
Pass the original client through for internal reads and React/CLI query paths now that account stripping is no longer required.
Also drop the last toReadClient wrap in deposit-with-permit and use FilecoinChain naming in session keys.
Let SynapseFromClientOptions accept an optional public client instead of always deriving one from the wallet client.
Update synapse-core/synapse guides for getTransport and readClient, and fix the docs site Chain type import.
Set the rank option to false for both mainnetTransport and calibrationTransport to ensure consistent fallback behavior.
@hugomrdias
hugomrdias force-pushed the hugomrdias/895-split-viem-clients branch from 2a9afbd to d2725be Compare August 12, 2026 10:28
@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FOC Aug 12, 2026
@SgtPooki
SgtPooki requested review from SgtPooki and removed request for SgtPooki August 12, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Awaiting review

Development

Successfully merging this pull request may close these issues.

Split viem clients into read and write clients

2 participants