GithubHelp home page GithubHelp logo

Comments (5)

kkomelin avatar kkomelin commented on August 27, 2024

A nice brief intro to keys from the Suibase Cookbook

from suibase.

kkomelin avatar kkomelin commented on August 27, 2024

Hey @mario4tier ,

Do you have/know an opensource JavaScript/TypeScript API to manage Sui keys? Should it be just Sui cli system calls?
Does VSCode extension have access to Sui cli in terms of permissions?

from suibase.

mario4tier avatar mario4tier commented on August 27, 2024

I recommend to do it with Sui cli call. Not aware of an API that does this.

Two locations the shell call can be done from (the code is already doing this from both places):
(1) From the "core" of the VSCode extension (not the webview).
(2) From the suibase-daemon (this is a JSON-RPC backend for the extension).

The advantage of the suibase-daemon is there is only one writer to the files (shell commands are serialized). Less possibility of messing up the files and better "single source of truth" when, say, there are two competing VSCode extension.

Doing it directly from the VSCode extension is simpler and would be good enough for a "first phase" implementation.

What is that core vs webview twist?
You might already know this, but saying just in case. In a VSCode extension a Webview (e.g. the "Suibase dashboard") does not run always on the same machine as the "core" VSCode extension. This happen when people do remote development (e.g. windows WSL).

Only the "core" of the extension is guaranteed to run on the machine where the sui.keystore files are located (and suibase-daemon is running).

This is why you will see in the code the Webview exchanging messages with the core to perform the shell calls (and get any backend data).

I have implemented all such message passing to conveniently work with react, and can walk you through this code as needed.

Typescript "Core" extension:~/suibase/typescript/vscode-extension/src
Typescript/react "webview": ~/suibase/typescript/vscode-extension/webview-ui

Some shell commands: ~/suibase/typescript/vscode-extension/src/SuibaseExec.ts

Example of a related view<->core messages in ~/suibase/typescript/vscode-extension/src/common/ViewMessages.ts:
image

from suibase.

mario4tier avatar mario4tier commented on August 27, 2024

The same visually:

image

This seems over-complicated, but it is necessary. The suibase-daemon is polling the filesystem to maintain a "single source of truth" and be the backend.

I do not have a lot of front-end experience, and wondering if something like redux would help to synchronize the webviews with the backend (keeping in mind that the "Core" extension is an intermediate)? For now, I did develop my own "data versioning polling" to minimize heavy data transfer.

from suibase.

kkomelin avatar kkomelin commented on August 27, 2024

Thank you for the detailed explanation of how Suibase VSCode extension communicates with Suibase backend @mario4tier.
I need to learn it further.

from suibase.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.