Conversation
The code snippet was not functional for multiple reasons
|
@juliangruber is attempting to deploy a commit to the FilOz Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Updates the warm storage “copy/paste” Synapse SDK snippet to be usable with the current SDK + viem-based account setup, aligning it with the warm storage integration flow used by the site.
Changes:
- Switch snippet from
ethers/old SDK usage toviemaccount creation andSynapse.create(...). - Add a
storage.prepare(...)+ optional transaction execution step before uploading. - Update upload/download calls to the newer storage API shape.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
chore: update synapse-code-snippet image
fix: update image
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const data = new TextEncoder().encode(\` | ||
| 🚀 Welcome to decentralized storage on Filecoin Onchain Cloud! | ||
| Onchain Proof of Data Possession ensures your data is always verifiable. | ||
| \`) |
There was a problem hiding this comment.
The template literal passed to TextEncoder().encode includes a leading newline and indentation spaces, which become part of the uploaded bytes and will change the resulting pieceCid. If you want the displayed message without extra whitespace, remove the indentation/leading newline or apply .trim() before encoding.
| const { transaction } = await synapse.storage.prepare({ | ||
| dataSize: BigInt(data.length) | ||
| }) | ||
| if (transaction) await transaction.execute() | ||
|
|
||
| await synapse.storage.download(pieceCid);` | ||
| const { pieceCid } = await synapse.storage.upload(data) | ||
| await synapse.storage.download({ pieceCid })` |
There was a problem hiding this comment.
The snippet uses top-level await statements but isn’t wrapped in an async context. This will fail when pasted into environments that don’t support top-level await (e.g., CommonJS or older TS configs). Consider wrapping the example in an async IIFE / main() function (or explicitly indicating it must run as an ESM module).

The code snippet was not functional for multiple reasons