xrplf / xrpl-hooks-ide Goto Github PK
View Code? Open in Web Editor NEWXRPL Hooks Builder - Add smart contract functionality to the XRP Ledger
Home Page: https://hooks-builder.xrpl.org
XRPL Hooks Builder - Add smart contract functionality to the XRP Ledger
Home Page: https://hooks-builder.xrpl.org
To start with, we can implement either, or both depending on the complexity of the implementations.
Just like in the editor area, but reusable enough to be used for various use cases like in test page, etc.
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 .
You can create new faucet accounts by making POST calls to https://hooks-testnet.xrpl-labs.com/newcreds. That endpoint is now throttled so that you can only make 1 request / 10 seconds. We need to ask Xrpl Labs to disable throttling from certain IP addresses so that we can call endpoint as many times as possible.
TODO:
Current status:
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:
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.
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.
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:
Apparently it also breaks code parsing:
The hook file continues after the call but does not show...
Errors are unhandled and seen in console only.
Say Ctrl+Alt+N
for new file, Ctrl+Shift+C
to compile and so on. Probably a backlog as shortcuts needs to be discussed and shortcuts collision to be avoided.
User should be able to delete hooks from account. Things to consider:
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.
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 '/'.
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.
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:
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.
After typing filename, Enter
key should create file directly.
Ability to view and edit transactions as json.
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.
We need to build language server which supports C language so that we can show proper errors and warnings before compiling code.
The UI / concept.
More info on #22
The basic idea:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.