-
Notifications
You must be signed in to change notification settings - Fork 570
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
Consider a static file API #1778
Labels
area-capabilities
Related to the kinds of things that snaps are able to do.
type-enhancement
New feature or request
type-research
A research task.
Comments
FrederikBolding
added
type-enhancement
New feature or request
type-research
A research task.
area-capabilities
Related to the kinds of things that snaps are able to do.
labels
Sep 25, 2023
Hi. I have 2 questions:
Overall, I find the idea great 👍 , and it would definitely help projects with large files. |
|
Thanks for clarifying, the concept makes sense and I like it. 🚀 |
Merged
FrederikBolding
added a commit
that referenced
this issue
Oct 16, 2023
Adds an API for snaps to access auxiliary files at runtime. Adds support for this new API in the simulator and adds an example snap that uses the API. The API lets devs specify a files field in the manifest under `source.files`: ```json { "source": { "shasum": ..., "location": ..., "files": [ "./src/foo.json" ] }, } ``` At install-time any files in this array are attempted loaded and stored in snaps state alongside the source code, icon etc. These files are then retrievable at run-time by calling `snap.request({ method: 'snap_getFile', params: { path: './src/foo.json' }})`. The files themselves are currently stored in base64 and returned to the snap in either base64 or hexadecimal. Fixes #1778
@martines3000 Coming soon to Flask 👀 |
benefacto
pushed a commit
to zenchain-protocol/zazen
that referenced
this issue
Jul 3, 2024
Adds an API for snaps to access auxiliary files at runtime. Adds support for this new API in the simulator and adds an example snap that uses the API. The API lets devs specify a files field in the manifest under `source.files`: ```json { "source": { "shasum": ..., "location": ..., "files": [ "./src/foo.json" ] }, } ``` At install-time any files in this array are attempted loaded and stored in snaps state alongside the source code, icon etc. These files are then retrievable at run-time by calling `snap.request({ method: 'snap_getFile', params: { path: './src/foo.json' }})`. The files themselves are currently stored in base64 and returned to the snap in either base64 or hexadecimal. Fixes MetaMask/snaps#1778
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-capabilities
Related to the kinds of things that snaps are able to do.
type-enhancement
New feature or request
type-research
A research task.
Seems that a general problem for larger snaps that require large WASM modules (or other large files) is that the cold start is slow. What if instead of using our state API for this (which is kind of hacky) we build an API that let's snaps lazy load it's own static files at runtime?
E.g.
A snap could then specify the static files it needs at runtime in the manifest.
The text was updated successfully, but these errors were encountered: