-
Notifications
You must be signed in to change notification settings - Fork 23
feat: (foc-localnet-v1-rc) Add Localnet Support to Synapse SDK #527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
synapse-dev | 5c094bc | Jan 13 2026, 04:44 AM |
|
@redpanda-f : will you take care of the lint failures? |
4431d7c to
ebfd645
Compare
| * ``` | ||
| */ | ||
|
|
||
| export { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was a mistake? we recently removed a bunch of stuff from here, are they needed for this PR?
| PDP_PERMISSION_NAMES, | ||
| } from '../packages/synapse-sdk/src/session/index.ts' | ||
|
|
||
| // Parse command line arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's not do this, it already uses env vars and we can stick to that, I don't really want to overcomplicate it for now and keep it ~clean, let's just extend the env var use to add in the devnet variables
| let WARM_STORAGE_ADDRESS = process.env.WARM_STORAGE_ADDRESS | ||
|
|
||
| // Set defaults based on network if not provided | ||
| if (!RPC_URL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, I don't think this is required, make the caller specify RPC_URL
ebfd645 to
5c094bc
Compare
hugomrdias
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just needs docs update, the utils folder i will leave to Rod.
ps. with viem all this "add multicall everywhere" wont be needed
| ## Quickstart (mainnet, calibration, devnet) | ||
|
|
||
| ```ts | ||
| import { Synapse } from '@filoz/synapse-sdk' | ||
|
|
||
| const synapse = await Synapse.create({ | ||
| // One of privateKey, provider, or signer (privateKey shown here) | ||
| privateKey: process.env.PRIVATE_KEY ?? '', | ||
| // Defaults: mainnet and calibration auto-discover addresses; devnet requires explicit values | ||
| rpcURL: process.env.RPC_URL ?? 'https://api.calibration.node.glif.io/rpc/v1', | ||
| // Devnet-only (required): provide your deployment addresses | ||
| warmStorageAddress: process.env.WARM_STORAGE_ADDRESS, | ||
| multicall3Address: process.env.MULTICALL3_ADDRESS, | ||
| // Optional: override USDFC or view contract addresses when testing | ||
| usdfcAddress: process.env.USDFC_ADDRESS, | ||
| warmStorageViewAddress: process.env.WARM_STORAGE_VIEW_ADDRESS, | ||
| }) | ||
|
|
||
| const file = new TextEncoder().encode('hello from synapse') | ||
| const result = await synapse.storage.upload(file) | ||
| console.log('pieceCid:', result.pieceCid) | ||
| ``` | ||
|
|
||
| - Networks supported: `mainnet`, `calibration`, `devnet` | ||
| - Devnet requires `rpcURL`, `warmStorageAddress`, and `multicall3Address` to be provided | ||
| - For session keys, payments, and registry access, services auto-discover addresses on mainnet/calibration | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the docs folder, we will remove the sdk readme in favor of the docs
This PR adds comprehensive support for local Filecoin networks to enable easier development and testing.
Changes
--network localnetoptionEnvironment Variables
The following environment variables can be used to configure localnet:
LOCALNET_CHAIN_ID(default: 1414)LOCALNET_RPC_URL(default: http://127.0.0.1:5700/rpc/v1)LOCALNET_RPC_WS_URL(default: ws://127.0.0.1:5700/rpc/v1)LOCALNET_BLOCK_EXPLORER_URL(default: http://localhost:8080)LOCALNET_MULTICALL3_ADDRESS,LOCALNET_USDFC_ADDRESS, etc. for contract addresses