Skip to content

Fix synapse-code-snippet.ts#279

Merged
rjan90 merged 7 commits intoFilOzone:mainfrom
juliangruber:patch-2
Mar 27, 2026
Merged

Fix synapse-code-snippet.ts#279
rjan90 merged 7 commits intoFilOzone:mainfrom
juliangruber:patch-2

Conversation

@juliangruber
Copy link
Copy Markdown
Member

@juliangruber juliangruber commented Mar 27, 2026

The code snippet was not functional for multiple reasons

The code snippet was not functional for multiple reasons
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@juliangruber is attempting to deploy a commit to the FilOz Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
filecoin-cloud Error Error Mar 27, 2026 9:37am

Request Review

@mirhamasala
Copy link
Copy Markdown
Collaborator

@juliangruber
CleanShot 2026-03-27 at 10 00 10@2x

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to viem account creation and Synapse.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.

mirhamasala and others added 3 commits March 27, 2026 10:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
chore: update synapse-code-snippet image
fix: update image
Copy link
Copy Markdown
Collaborator

@mirhamasala mirhamasala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🍄

@rjan90 rjan90 merged commit a8c7a51 into FilOzone:main Mar 27, 2026
8 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +9 to +12
const data = new TextEncoder().encode(\`
🚀 Welcome to decentralized storage on Filecoin Onchain Cloud!
Onchain Proof of Data Possession ensures your data is always verifiable.
\`)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +20
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 })`
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
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.

4 participants