Code Monkey home page Code Monkey logo

xrpl-hooks-ide's People

Contributors

dangell7 avatar dependabot[bot] avatar janianttonen avatar jonijuup avatar mariopil avatar muzam1l avatar valstu avatar vbar avatar wietsewind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xrpl-hooks-ide's Issues

Hook testing

Design details defined in: #22

  • #48
  • Enable test tab name editing (needs design) [nice to have thingie]

Implement static analysis feedback to Monaco editor

  • Display feedback from static analysis inline (code)
  • Display feedback in console log (reference line number)

To start with, we can implement either, or both depending on the complexity of the implementations.

Reusable tabs component.

Just like in the editor area, but reusable enough to be used for various use cases like in test page, etc.

Change workspace from /tmp/c

Currently the client uses workspace at /tmp/c , and server puts project header files there (they must be on disk). For this setup, the /tmp location is problematic: it's auto-cleaned on development desktops after every reboot and occasionally even inside the xrpl-hooks-compile docker image. It should be changed to /work/c .

Download current files as .zip

  • Download open C-files (if multiple files supported)
  • Download test.json files (?)

TODO:

  • Specify what the download archive should contain

Documentation integration

Current status:

  • We focus on using https://xrpl-hooks.readme.io/ (domain may change, lets parameterize it) as the end point, opening the documentation links in new windows.
  • Exploring displaying readme.md as rendered markdown in a tab (can be switched between markdown / rendered, rendered being the default?)
  • Show diagnostic documentation on the right hand side (from clang-tidy), when clicking "Read more" from the language server pop-up. These mini docs can also contain links to the XRPL Hooks Documentation that will open in a new window.

Make header files (.h) read only

We should make header files, at least hookapi.h, maybe all of them read only. You shouldn't be able to modify them since they are included on the compile server.

These files at least should be read only if included in gist:

  • hookapi.h
  • sfcodes.h
  • hookmacro.h

Save current Hook & created accounts locally

  • Save current Hook C-file locally
  • Save created account hash & key pairs locally

NOTE: localStorage saving of secrets is not something we can do in production version of the Editor, and we probably need the cloud saving and encrypting the keys.

Define HookOn value when deploying the hook

At the moment when we're deploying a hook we are signing and sending following transaction

const tx = {
      Account: account.address,
      TransactionType: "SetHook",
      CreateCode: arrayBufferToHex(
        state.files?.[state.active]?.compiledContent
      ).toUpperCase(),
      HookOn: "0000000000000000",
      Sequence: account.sequence,
      Fee: "1000",
};

Now we're using hard coded HookOn value but it should be user defined. My initial idea is that when user clicks the deploy button a modal window opens where user can select on which transactions the hook will trigger:

Documentation how to calculate HookOn values

Later on when the hook deployment will be "parameterized" the same modal would be useful. User could define for example the savings account address or the percentage of savings hook.

Initial idea for the UI:
image

Monaco editor has unhandled runtime errors

in response to various commands - for example, after selecting a hook library function name, the user can right-click to open a local menu with a command Peek Definition (in Peek group). Executing it leads to an error popup:
err

Apparently it also breaks code parsing:
end

The hook file continues after the call but does not show...

Deploy UI: Show information of the compiled WASM file

  • Show the size of the compiled WASM file and a profiling the size (red, orange, green)
  • Enable showing the WASM as WAT file optional

TODO:
We need to specify the profiling specifications for WASM file with XRPL Labs (what is small, what is average, what is large)

image

Deleting Hooks feature

User should be able to delete hooks from account. Things to consider:

  • Deleting current hook (the one you have just deployed or written yourself)?
  • Deleting hooks you've added earlier, how to delete some other hook that isn't the one you're about to deploy?
  • How does the UI flow go in these cases?

Shortcuts with Alt- aren't cross-platform

For example View Problem (Alt-F8) doesn't work on Ubuntu (Windows key has to be used instead) nor on Mac (requires Fn key). They should be replaced with something that works as advertised, ideally something standartised.

Static analysis popup has insufficient z-index

For example on an empty source file, the first missing entry points error fits right over the editor pane border, which shows through, giving the appearance of crossing the error out:
layers

Confused me for a long time, what the difference between the first and second error is...

Deploy UI: Create faucet account

  • Enable user to create a faucet account (or multiple)
  • Enable user to see information of the account in a modal window (hash, balance, secret)
  • Assign a unique (random) name for each account
  • Create a faucet account when starting the editor, if there is none (or guide the user to do this manually in the wallet window)

Account window:
image

Account information:
image

Filename Dialog should not allow specifying paths

like /filename.c. It isn't clear how that's converted into workspace URL, but even in case it's successfully passed to Language Server, it shouldn't be - Language Server shouldn't operate on user-specified absolute paths... File names should stay in the workspace directory, IOW not contain '/'.

Fetch & Save logic for Github Gists

  • User should to be able to fetch correct files from Github Gists (if those are public)
  • User should be able to save files to Github Gist and share link to other users

Messages in development log are append-only

This is confusing after a user fixes a compilation error, which stays in the log: example

For better feedback (and to behave analogically to other C/C++ IDEs), the log should be cleared before every compilation.

Debug stream.

  • Have a dropdown to select the account, and subscribe to its debug stream.
  • design concept of the debug stream with @jonijuup
  • #104
  • #105
  • Clickable stuff in logs, like accounts and maybe transactions.

Workspace model should use valid URLs

Currently, Hooks Editor constructs source file URLs (used by the Monaco editor & Language Server Protocol) by interpolating file names into file://work/c/${file.name}, producing URLs where work should be interpreted as authority (per RFC 8089). This is (theoretically) incompatible with the Language Server, which expects the source files in its local /work/c directory (IOW interprets work as part of the absolute path) and works in practice only because the clangd Language Server parses URLs of the form file://work/c/filename.c (the least used & most obscure format specified by RFC 8089) incorrectly. The URL construction string should be changed to file:///work/c/${file.name}, producing correct URLs parsed the same way by both client & server.

The change described above had already been proposed (in b2c6aa7 ), but rolled back (in d85cc71 ) because it broke Wasm compilation. The cause of that problem was the IDE failing to identify the source file in comparing editorModel.uri.path against /c/${state.files[state.active].name} - when the path includes work, the comparison fails and the IDE sends an empty source to the compilation service, which produces non-empty but invalid Wasm from it. This must be fixed together with changing the URL format.

Error inset should be cleared on edit

because it's possible (indeed desirable) that a user looking at an error will fix it, in which case the displayed error message becomes outdated:
outdated

Ideally, the error list could be updated and the inset removed iff the new list is empty, but since the list arrives asynchronously from the Language Server, that's probably non-trivial to implement.

Finish initial Hook testing design

  • Enable multiple different tests
  • Predefined tests (?)
  • Could tests be configured in the Hook itself, on some level?
  • Bundling relevant tests with example Hooks (how?)

Development Log Panel

image

Basic development log component which shows (probably) both, language server errors and compile errors.

Github Login (next-auth)

We need to implement Github login so we can store the project files on Github Gist. We should probably use something like next-auth for this.

Hook testing UI - version 1

The UI / concept.
More info on #22

Unfilled:
image

Filled:
image

The basic idea:

  1. User selects the transaction type, and other fields are populated based on that (we can start with just ttPayment for first testing version now, but a ready feature should have all the transaction types)
  2. After user has filled the fields and selected the "to" and "from" account, you can make a test transaction and see a log from both accounts what happened and did the hook trigger as it should've triggered.
  • Additional feature would be to add other "tests" using the "+"-button, but we can start with having a one test and add the multiple test setup later
  • We can use the same (or similar) account component as we're using in the "deploy" section (adding accounts, looking information of an account in modal)

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.