Compare commits
9 Commits
feat/templ
...
feat/patch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
779f5aab0a | ||
|
|
02194d8a98 | ||
|
|
5677fe34dc | ||
|
|
895da89325 | ||
|
|
b138cc8d5b | ||
|
|
d85cc71817 | ||
|
|
bac3522078 | ||
|
|
b2c6aa7871 | ||
|
|
81e2a3673d |
75
README.md
75
README.md
@@ -26,6 +26,75 @@ You can start editing the page by modifying `pages/index.tsx`. The page auto-upd
|
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
||||
|
||||
## Github Login
|
||||
|
||||
If you want to use your Github app to provide login, here's the guide to do that.
|
||||
|
||||
- First go to https://github.com/settings/profile -> Developer Settings -> OAuth Apps
|
||||
- Click "New OAuth App" button
|
||||
- Give application some name eg. Xrpl Hooks Development
|
||||
- Give some homepage url eg. localhost:3000
|
||||
- Give some optional description (these values will show up on the popup when you login)
|
||||
- Authorization callback URL should be http://localhost:3000/api/auth/callback (if you're creating the app for local development)
|
||||
- Click register application
|
||||
- Then a page should open up where you can get client id and client secret values. Copy paste those to .env.local to use them:
|
||||
|
||||
```
|
||||
GITHUB_SECRET="client-secret-here"
|
||||
GITHUB_ID="client-id-here"
|
||||
```
|
||||
|
||||
Login should now work through your own Github OAuth app.
|
||||
|
||||
## Styling and Theming
|
||||
|
||||
This project uses Stitches (https://stitches.dev) for theming and styling the components. You should be quite familiar with the API if you have used for example styled-components earlier. Stitches should provide better performance, near zero runtime.
|
||||
|
||||
For components we try to use Radix-UI (https://www.radix-ui.com/) as much as possible. It may not provide all the necessary components so you're free to use other components/libraries if those makes sense. For colors we're using Radix-UI Colors (https://radix-ui.com/colors).
|
||||
|
||||
Theme file can be found under `./stitches.config.ts` file. When you're creating new components remeber to import `styled` from that file and not `@stitches` directly. That way it will provide the correct theme for you automatically.
|
||||
|
||||
Example:
|
||||
|
||||
```tsx
|
||||
// Use our stitches.config instead of @stitches/react
|
||||
import { styled } from "../stitches.config";
|
||||
|
||||
const Box = styled("div", {
|
||||
boxSizing: "border-box",
|
||||
});
|
||||
|
||||
export default Box;
|
||||
```
|
||||
|
||||
Custom components can be found from `./components` folder.
|
||||
|
||||
## Monaco Editor
|
||||
|
||||
Project is relying on Monaco editor heavily. Instead of using Monaco editor directly we're using `@monaco-editor/react` which provides little helpers to use Monaco editor.
|
||||
|
||||
On the Develop page we're using following loader for Monaco editor:
|
||||
|
||||
```js
|
||||
loader.config({
|
||||
paths: {
|
||||
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.30.1/min/vs",
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
By default `@monaco-editor/react` was using 0.29.? version of Monaco editor. @codingame/monaco-languageclient library (connects to clangd language server) was using API methods that were introduced in Monaco Editor 0.30 so that's why we're loading certain version of it.
|
||||
|
||||
Monaco Languageclient related stuff is found from `./utils/languageClient.ts`. Basically we're connecting the editor to clangd language server which lives on separate backend. That project can be found from https://github.com/eqlabs/xrpl-hooks-compiler/. If you need access to that project ask permissions from @vbar (Vaclav Barta) on GitHub.
|
||||
|
||||
## Global state management
|
||||
|
||||
Global state management is handled with library called Valtio (https://github.com/pmndrs/valtio). Initial state can be found from `./state/index.ts` file. All the actions which updates the state is found under `./state/actions/` folder.
|
||||
|
||||
## Special notes
|
||||
|
||||
Since we are dealing with greenfield tech and one of the dependencies (ripple-binary-codec) doesn't yet support signing `SetHook` transactions we had to monkey patch the library with patch-package (https://www.npmjs.com/package/patch-package). We modified the definitions.json file of the ripple-binary-codec library and then ran `yarn patch-package ripple-binary-codec` which created `patches/ripple-binary-codec+1.2.0.patch` file to this project. This file contains the modifications to `ripple-binary-codec` library. package.json contains postinstall hook which runs patch-package, and it will add the patch on the file mentioned earlier. This happens automatically after running patch package.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
@@ -34,9 +103,3 @@ To learn more about Next.js, take a look at the following resources:
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
|
||||
@@ -11,7 +11,6 @@ import Container from "./Container";
|
||||
import dark from "../theme/editor/amy.json";
|
||||
import light from "../theme/editor/xcode_default.json";
|
||||
import { saveFile } from "../state/actions";
|
||||
import { apiHeaderFiles } from "../state/constants";
|
||||
import state from "../state";
|
||||
|
||||
import EditorNavigation from "./EditorNavigation";
|
||||
@@ -27,26 +26,12 @@ loader.config({
|
||||
},
|
||||
});
|
||||
|
||||
const validateWritability = (editor: monaco.editor.IStandaloneCodeEditor) => {
|
||||
const currPath = editor.getModel()?.uri.path;
|
||||
if (apiHeaderFiles.find(h => currPath?.endsWith(h))) {
|
||||
editor.updateOptions({ readOnly: true });
|
||||
} else {
|
||||
editor.updateOptions({ readOnly: false });
|
||||
}
|
||||
};
|
||||
|
||||
const HooksEditor = () => {
|
||||
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>();
|
||||
const subscriptionRef = useRef<ReconnectingWebSocket | null>(null);
|
||||
const snap = useSnapshot(state);
|
||||
const router = useRouter();
|
||||
const { theme } = useTheme();
|
||||
|
||||
useEffect(() => {
|
||||
if (editorRef.current) validateWritability(editorRef.current);
|
||||
}, [snap.active]);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
subscriptionRef?.current?.close();
|
||||
@@ -71,20 +56,19 @@ const HooksEditor = () => {
|
||||
keepCurrentModel
|
||||
defaultLanguage={snap.files?.[snap.active]?.language}
|
||||
language={snap.files?.[snap.active]?.language}
|
||||
path={`file://tmp/c/${snap.files?.[snap.active]?.name}`}
|
||||
path={`file://work/c/${snap.files?.[snap.active]?.name}`}
|
||||
defaultValue={snap.files?.[snap.active]?.content}
|
||||
beforeMount={monaco => {
|
||||
beforeMount={(monaco) => {
|
||||
if (!snap.editorCtx) {
|
||||
snap.files.forEach(file =>
|
||||
snap.files.forEach((file) =>
|
||||
monaco.editor.createModel(
|
||||
file.content,
|
||||
file.language,
|
||||
monaco.Uri.parse(`file://tmp/c/${file.name}`)
|
||||
monaco.Uri.parse(`file://work/c/${file.name}`)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// monaco.editor.createModel(value, 'c', monaco.Uri.parse('file:///tmp/c/file.c'))
|
||||
// create the web socket
|
||||
if (!subscriptionRef.current) {
|
||||
monaco.languages.register({
|
||||
@@ -101,7 +85,7 @@ const HooksEditor = () => {
|
||||
// listen when the web socket is opened
|
||||
listen({
|
||||
webSocket: webSocket as WebSocket,
|
||||
onConnection: connection => {
|
||||
onConnection: (connection) => {
|
||||
// create and start the language client
|
||||
const languageClient = createLanguageClient(connection);
|
||||
const disposable = languageClient.start();
|
||||
@@ -140,10 +124,12 @@ const HooksEditor = () => {
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS, () => {
|
||||
saveFile();
|
||||
});
|
||||
validateWritability(editor)
|
||||
editor.addCommand(
|
||||
monaco.KeyMod.CtrlCmd | monaco.KeyCode.KeyS,
|
||||
() => {
|
||||
saveFile();
|
||||
}
|
||||
);
|
||||
}}
|
||||
theme={theme === "dark" ? "dark" : "light"}
|
||||
/>
|
||||
@@ -161,7 +147,9 @@ const HooksEditor = () => {
|
||||
<Box css={{ display: "inline-flex", pl: "35px" }}>
|
||||
<ArrowBendLeftUp size={30} />
|
||||
</Box>
|
||||
<Box css={{ pl: "0px", pt: "15px", flex: 1, display: "inline-flex" }}>
|
||||
<Box
|
||||
css={{ pl: "0px", pt: "15px", flex: 1, display: "inline-flex" }}
|
||||
>
|
||||
<Text
|
||||
css={{
|
||||
fontSize: "14px",
|
||||
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
DialogTrigger,
|
||||
} from "./Dialog";
|
||||
import PanelBox from "./PanelBox";
|
||||
import { templateFileIds } from '../state/constants';
|
||||
|
||||
const Navigation = () => {
|
||||
const router = useRouter();
|
||||
@@ -83,8 +82,12 @@ const Navigation = () => {
|
||||
<Spinner />
|
||||
) : (
|
||||
<>
|
||||
<Heading css={{ lineHeight: 1 }}>{snap.files?.[0]?.name || "XRPL Hooks"}</Heading>
|
||||
<Text css={{ fontSize: "$xs", color: "$mauve10", lineHeight: 1 }}>
|
||||
<Heading css={{ lineHeight: 1 }}>
|
||||
{snap.files?.[0]?.name || "XRPL Hooks"}
|
||||
</Heading>
|
||||
<Text
|
||||
css={{ fontSize: "$xs", color: "$mauve10", lineHeight: 1 }}
|
||||
>
|
||||
{snap.files.length > 0 ? "Gist: " : "Playground"}
|
||||
<Text css={{ color: "$mauve12" }}>
|
||||
{snap.files.length > 0 &&
|
||||
@@ -96,7 +99,10 @@ const Navigation = () => {
|
||||
</Flex>
|
||||
{router.isReady && (
|
||||
<ButtonGroup css={{ marginLeft: "auto" }}>
|
||||
<Dialog open={snap.mainModalOpen} onOpenChange={open => (state.mainModalOpen = open)}>
|
||||
<Dialog
|
||||
open={snap.mainModalOpen}
|
||||
onOpenChange={(open) => (state.mainModalOpen = open)}
|
||||
>
|
||||
<DialogTrigger asChild>
|
||||
<Button outline>
|
||||
<FolderOpen size="15px" />
|
||||
@@ -157,9 +163,12 @@ const Navigation = () => {
|
||||
mb: "$7",
|
||||
}}
|
||||
>
|
||||
Hooks add smart contract functionality to the XRP Ledger.
|
||||
Hooks add smart contract functionality to the XRP
|
||||
Ledger.
|
||||
</Text>
|
||||
<Flex css={{ flexDirection: "column", gap: "$2", mt: "$2" }}>
|
||||
<Flex
|
||||
css={{ flexDirection: "column", gap: "$2", mt: "$2" }}
|
||||
>
|
||||
<Text
|
||||
css={{
|
||||
display: "inline-flex",
|
||||
@@ -244,29 +253,43 @@ const Navigation = () => {
|
||||
},
|
||||
}}
|
||||
>
|
||||
<PanelBox as="a" href={`/develop/${templateFileIds.starter}`}>
|
||||
<PanelBox
|
||||
as="a"
|
||||
href="/develop/be088224fb37c0075e84491da0e602c1"
|
||||
>
|
||||
<Heading>Starter</Heading>
|
||||
<Text>Just an empty starter with essential imports</Text>
|
||||
<Text>
|
||||
Just an empty starter with essential imports
|
||||
</Text>
|
||||
</PanelBox>
|
||||
<PanelBox as="a" href={`/develop/${templateFileIds.starter}`}>
|
||||
<PanelBox
|
||||
as="a"
|
||||
href="/develop/be088224fb37c0075e84491da0e602c1"
|
||||
>
|
||||
<Heading>Firewall</Heading>
|
||||
<Text>This Hook essentially checks a blacklist of accounts</Text>
|
||||
<Text>
|
||||
This Hook essentially checks a blacklist of accounts
|
||||
</Text>
|
||||
</PanelBox>
|
||||
<PanelBox as="a" href={`/develop/${templateFileIds.accept}`}>
|
||||
<PanelBox
|
||||
as="a"
|
||||
href="/develop/be088224fb37c0075e84491da0e602c1"
|
||||
>
|
||||
<Heading>Accept</Heading>
|
||||
<Text>This hook just accepts any transaction coming through it</Text>
|
||||
<Text>
|
||||
This hook just accepts any transaction coming through
|
||||
it
|
||||
</Text>
|
||||
</PanelBox>
|
||||
<PanelBox as="a" href={`/develop/${templateFileIds.notary}`}>
|
||||
<Heading>Notary</Heading>
|
||||
<Text>Collecting signatures for multi-sign transactions</Text>
|
||||
</PanelBox>
|
||||
<PanelBox as="a" href={`/develop/${templateFileIds.carbon}`}>
|
||||
<Heading>Carbon</Heading>
|
||||
<Text>Send a percentage of sum to an address</Text>
|
||||
</PanelBox>
|
||||
<PanelBox as="a" href={`/develop/${templateFileIds.peggy}`}>
|
||||
<Heading>Peggy</Heading>
|
||||
<Text>An oracle based stabe coin hook</Text>
|
||||
<PanelBox
|
||||
as="a"
|
||||
href="/develop/be088224fb37c0075e84491da0e602c1"
|
||||
>
|
||||
<Heading>Accept</Heading>
|
||||
<Text>
|
||||
This hook just accepts any transaction coming through
|
||||
it
|
||||
</Text>
|
||||
</PanelBox>
|
||||
</Flex>
|
||||
</Flex>
|
||||
@@ -313,18 +336,42 @@ const Navigation = () => {
|
||||
}}
|
||||
>
|
||||
<ButtonGroup>
|
||||
<Link href={gistId ? `/develop/${gistId}` : "/develop"} passHref shallow>
|
||||
<Button as="a" outline={!router.pathname.includes("/develop")} uppercase>
|
||||
<Link
|
||||
href={gistId ? `/develop/${gistId}` : "/develop"}
|
||||
passHref
|
||||
shallow
|
||||
>
|
||||
<Button
|
||||
as="a"
|
||||
outline={!router.pathname.includes("/develop")}
|
||||
uppercase
|
||||
>
|
||||
Develop
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href={gistId ? `/deploy/${gistId}` : "/deploy"} passHref shallow>
|
||||
<Button as="a" outline={!router.pathname.includes("/deploy")} uppercase>
|
||||
<Link
|
||||
href={gistId ? `/deploy/${gistId}` : "/deploy"}
|
||||
passHref
|
||||
shallow
|
||||
>
|
||||
<Button
|
||||
as="a"
|
||||
outline={!router.pathname.includes("/deploy")}
|
||||
uppercase
|
||||
>
|
||||
Deploy
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href={gistId ? `/test/${gistId}` : "/test"} passHref shallow>
|
||||
<Button as="a" outline={!router.pathname.includes("/test")} uppercase>
|
||||
<Link
|
||||
href={gistId ? `/test/${gistId}` : "/test"}
|
||||
passHref
|
||||
shallow
|
||||
>
|
||||
<Button
|
||||
as="a"
|
||||
outline={!router.pathname.includes("/test")}
|
||||
uppercase
|
||||
>
|
||||
Test
|
||||
</Button>
|
||||
</Link>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/node_modules/ripple-binary-codec/dist/enums/definitions.json b/node_modules/ripple-binary-codec/dist/enums/definitions.json
|
||||
index 2333c42..99557cb 100644
|
||||
index 2333c42..b8f8eab 100644
|
||||
--- a/node_modules/ripple-binary-codec/dist/enums/definitions.json
|
||||
+++ b/node_modules/ripple-binary-codec/dist/enums/definitions.json
|
||||
@@ -1,3 +1,4 @@
|
||||
@@ -7,17 +7,18 @@ index 2333c42..99557cb 100644
|
||||
{
|
||||
"TYPES": {
|
||||
"Validation": 10003,
|
||||
@@ -40,8 +41,7 @@
|
||||
@@ -40,9 +41,7 @@
|
||||
"Check": 67,
|
||||
"Nickname": 110,
|
||||
"Contract": 99,
|
||||
- "NFTokenPage": 80,
|
||||
- "NFTokenOffer": 55,
|
||||
+ "GeneratorMap": 103,
|
||||
"NegativeUNL": 78
|
||||
- "NegativeUNL": 78
|
||||
+ "GeneratorMap": 103
|
||||
},
|
||||
"FIELDS": [
|
||||
@@ -95,16 +95,6 @@
|
||||
[
|
||||
@@ -95,16 +94,6 @@
|
||||
"type": "UInt16"
|
||||
}
|
||||
],
|
||||
@@ -34,7 +35,7 @@ index 2333c42..99557cb 100644
|
||||
[
|
||||
"Flags",
|
||||
{
|
||||
@@ -455,6 +445,16 @@
|
||||
@@ -455,6 +444,16 @@
|
||||
"type": "UInt32"
|
||||
}
|
||||
],
|
||||
@@ -51,7 +52,7 @@ index 2333c42..99557cb 100644
|
||||
[
|
||||
"IndexNext",
|
||||
{
|
||||
@@ -635,16 +635,6 @@
|
||||
@@ -635,16 +634,6 @@
|
||||
"type": "Hash256"
|
||||
}
|
||||
],
|
||||
@@ -68,7 +69,7 @@ index 2333c42..99557cb 100644
|
||||
[
|
||||
"BookDirectory",
|
||||
{
|
||||
@@ -916,7 +906,7 @@
|
||||
@@ -916,7 +905,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -77,7 +78,44 @@ index 2333c42..99557cb 100644
|
||||
{
|
||||
"nth": 5,
|
||||
"isVLEncoded": true,
|
||||
@@ -1156,7 +1146,7 @@
|
||||
@@ -1045,36 +1034,6 @@
|
||||
"type": "Blob"
|
||||
}
|
||||
],
|
||||
- [
|
||||
- "UNLModifyValidator",
|
||||
- {
|
||||
- "nth": 19,
|
||||
- "isVLEncoded": true,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "Blob"
|
||||
- }
|
||||
- ],
|
||||
- [
|
||||
- "ValidatorToDisable",
|
||||
- {
|
||||
- "nth": 20,
|
||||
- "isVLEncoded": true,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "Blob"
|
||||
- }
|
||||
- ],
|
||||
- [
|
||||
- "ValidatorToReEnable",
|
||||
- {
|
||||
- "nth": 21,
|
||||
- "isVLEncoded": true,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "Blob"
|
||||
- }
|
||||
- ],
|
||||
[
|
||||
"Account",
|
||||
{
|
||||
@@ -1156,7 +1115,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -86,7 +124,7 @@ index 2333c42..99557cb 100644
|
||||
{
|
||||
"nth": 9,
|
||||
"isVLEncoded": true,
|
||||
@@ -1276,9 +1266,9 @@
|
||||
@@ -1276,9 +1235,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -98,7 +136,7 @@ index 2333c42..99557cb 100644
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1286,9 +1276,9 @@
|
||||
@@ -1286,9 +1245,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -110,7 +148,7 @@ index 2333c42..99557cb 100644
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1296,9 +1286,9 @@
|
||||
@@ -1296,9 +1255,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -122,7 +160,7 @@ index 2333c42..99557cb 100644
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1306,9 +1296,9 @@
|
||||
@@ -1306,9 +1265,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -134,7 +172,7 @@ index 2333c42..99557cb 100644
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1395,16 +1385,6 @@
|
||||
@@ -1395,16 +1354,6 @@
|
||||
"type": "STArray"
|
||||
}
|
||||
],
|
||||
@@ -151,7 +189,24 @@ index 2333c42..99557cb 100644
|
||||
[
|
||||
"Majorities",
|
||||
{
|
||||
@@ -1535,16 +1515,6 @@
|
||||
@@ -1415,16 +1364,6 @@
|
||||
"type": "STArray"
|
||||
}
|
||||
],
|
||||
- [
|
||||
- "DisabledValidators",
|
||||
- {
|
||||
- "nth": 17,
|
||||
- "isVLEncoded": false,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "STArray"
|
||||
- }
|
||||
- ],
|
||||
[
|
||||
"CloseResolution",
|
||||
{
|
||||
@@ -1535,16 +1474,6 @@
|
||||
"type": "Vector256"
|
||||
}
|
||||
],
|
||||
@@ -168,129 +223,96 @@ index 2333c42..99557cb 100644
|
||||
[
|
||||
"Transaction",
|
||||
{
|
||||
@@ -1616,9 +1586,9 @@
|
||||
@@ -1596,7 +1525,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "TicketCount",
|
||||
+ "HookStateCount",
|
||||
{
|
||||
"nth": 40,
|
||||
"isVLEncoded": false,
|
||||
@@ -1606,7 +1535,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "TicketSequence",
|
||||
+ "HookReserveCount",
|
||||
{
|
||||
"nth": 41,
|
||||
"isVLEncoded": false,
|
||||
@@ -1616,7 +1545,7 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "TokenTaxon",
|
||||
+ "HookStateCount",
|
||||
+ "HookDataMaxSize",
|
||||
{
|
||||
- "nth": 42,
|
||||
+ "nth": 40,
|
||||
"nth": 42,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1626,9 +1596,9 @@
|
||||
@@ -1626,23 +1555,23 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "MintedTokens",
|
||||
+ "HookReserveCount",
|
||||
{
|
||||
- "nth": 43,
|
||||
+ "nth": 41,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1636,9 +1606,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "BurnedTokens",
|
||||
+ "HookDataMaxSize",
|
||||
{
|
||||
- "nth": 44,
|
||||
+ "nth": 42,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1646,29 +1616,29 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "Channel",
|
||||
+ "HookOn",
|
||||
{
|
||||
- "nth": 22,
|
||||
- "nth": 43,
|
||||
+ "nth": 16,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
- "type": "Hash256"
|
||||
- "type": "UInt32"
|
||||
+ "type": "UInt64"
|
||||
}
|
||||
],
|
||||
[
|
||||
- "ConsensusHash",
|
||||
- "BurnedTokens",
|
||||
+ "EmitBurden",
|
||||
{
|
||||
- "nth": 23,
|
||||
- "nth": 44,
|
||||
+ "nth": 12,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
- "type": "Hash256"
|
||||
- "type": "UInt32"
|
||||
+ "type": "UInt64"
|
||||
}
|
||||
],
|
||||
[
|
||||
- "CheckID",
|
||||
+ "Channel",
|
||||
{
|
||||
- "nth": 24,
|
||||
+ "nth": 22,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1676,9 +1646,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "ValidatedHash",
|
||||
+ "ConsensusHash",
|
||||
{
|
||||
- "nth": 25,
|
||||
+ "nth": 23,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1686,9 +1656,9 @@
|
||||
@@ -1686,29 +1615,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "PreviousPageMin",
|
||||
+ "CheckID",
|
||||
{
|
||||
- "nth": 26,
|
||||
+ "nth": 24,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1696,9 +1666,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "NextPageMin",
|
||||
+ "ValidatedHash",
|
||||
{
|
||||
- "nth": 27,
|
||||
+ "nth": 25,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1706,9 +1676,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
- "BuyOffer",
|
||||
+ "EmitParentTxnID",
|
||||
{
|
||||
- "nth": 26,
|
||||
- "isVLEncoded": false,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "Hash256"
|
||||
- }
|
||||
- ],
|
||||
- [
|
||||
- "NextPageMin",
|
||||
- {
|
||||
- "nth": 27,
|
||||
- "isVLEncoded": false,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "Hash256"
|
||||
- }
|
||||
- ],
|
||||
- [
|
||||
- "BuyOffer",
|
||||
- {
|
||||
- "nth": 28,
|
||||
+ "nth": 10,
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1716,9 +1686,9 @@
|
||||
@@ -1716,9 +1625,9 @@
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -302,7 +324,24 @@ index 2333c42..99557cb 100644
|
||||
"isVLEncoded": false,
|
||||
"isSerialized": true,
|
||||
"isSigningField": true,
|
||||
@@ -1754,36 +1724,6 @@
|
||||
@@ -1735,16 +1644,6 @@
|
||||
"type": "UInt8"
|
||||
}
|
||||
],
|
||||
- [
|
||||
- "UNLModifyDisabling",
|
||||
- {
|
||||
- "nth": 17,
|
||||
- "isVLEncoded": false,
|
||||
- "isSerialized": true,
|
||||
- "isSigningField": true,
|
||||
- "type": "UInt8"
|
||||
- }
|
||||
- ],
|
||||
[
|
||||
"DestinationNode",
|
||||
{
|
||||
@@ -1754,36 +1653,6 @@
|
||||
"isSigningField": true,
|
||||
"type": "UInt64"
|
||||
}
|
||||
@@ -339,7 +378,7 @@ index 2333c42..99557cb 100644
|
||||
]
|
||||
],
|
||||
"TRANSACTION_RESULTS": {
|
||||
@@ -1908,18 +1848,7 @@
|
||||
@@ -1908,18 +1777,7 @@
|
||||
"tecDUPLICATE": 149,
|
||||
"tecKILLED": 150,
|
||||
"tecHAS_OBLIGATIONS": 151,
|
||||
@@ -359,7 +398,7 @@ index 2333c42..99557cb 100644
|
||||
},
|
||||
"TRANSACTION_TYPES": {
|
||||
"Invalid": -1,
|
||||
@@ -1946,11 +1875,10 @@
|
||||
@@ -1946,13 +1804,11 @@
|
||||
"DepositPreauth": 19,
|
||||
"TrustSet": 20,
|
||||
"AccountDelete": 21,
|
||||
@@ -373,5 +412,8 @@ index 2333c42..99557cb 100644
|
||||
+ "Batch": 24,
|
||||
+
|
||||
"EnableAmendment": 100,
|
||||
"SetFee": 101,
|
||||
"UNLModify": 102
|
||||
- "SetFee": 101,
|
||||
- "UNLModify": 102
|
||||
+ "SetFee": 101
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Router from "next/router";
|
||||
|
||||
import toast from "react-hot-toast";
|
||||
import state, { FaucetAccountRes } from '../index';
|
||||
|
||||
@@ -36,7 +36,6 @@ export const addFaucetAccount = async (showToast: boolean = false) => {
|
||||
|
||||
|
||||
const toastId = showToast ? toast.loading("Creating account") : "";
|
||||
console.log(Router)
|
||||
const res = await fetch(`${window.location.origin}/api/faucet`, {
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Octokit } from "@octokit/core";
|
||||
import Router from "next/router";
|
||||
import state from '../index';
|
||||
import { templateFileIds } from '../constants';
|
||||
|
||||
|
||||
const octokit = new Octokit();
|
||||
|
||||
@@ -19,17 +17,6 @@ export const fetchFiles = (gistId: string) => {
|
||||
|
||||
octokit
|
||||
.request("GET /gists/{gist_id}", { gist_id: gistId })
|
||||
.then(res => {
|
||||
if (!Object.values(templateFileIds).includes(gistId)) {
|
||||
return res
|
||||
}
|
||||
// in case of templates, fetch header file(s) and append to res
|
||||
return octokit.request("GET /gists/{gist_id}", { gist_id: templateFileIds.headers }).then(({ data: { files: headerFiles } }) => {
|
||||
const files = { ...res.data.files, ...headerFiles }
|
||||
res.data.files = files
|
||||
return res
|
||||
})
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.data.files && Object.keys(res.data.files).length > 0) {
|
||||
const files = Object.keys(res.data.files).map((filename) => ({
|
||||
@@ -57,7 +44,6 @@ export const fetchFiles = (gistId: string) => {
|
||||
state.loading = false;
|
||||
})
|
||||
.catch((err) => {
|
||||
// console.error(err)
|
||||
state.loading = false;
|
||||
state.logs.push({
|
||||
type: "error",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export * from './templates'
|
||||
@@ -1,11 +0,0 @@
|
||||
export const templateFileIds = {
|
||||
'starter': '1d14e51e2e02dc0a508cb0733767a914', // TODO currently same as accept
|
||||
'accept': '1d14e51e2e02dc0a508cb0733767a914',
|
||||
'firewall': 'bcd6d0c0fcbe52545ddb802481ff9d26',
|
||||
'notary': 'a789c75f591eeab7932fd702ed8cf9ea',
|
||||
'carbon': '43925143fa19735d8c6505c34d3a6a47',
|
||||
'peggy': 'ceaf352e2a65741341033ab7ef05c448',
|
||||
'headers': '9b448e8a55fab11ef5d1274cb59f9cf3'
|
||||
}
|
||||
|
||||
export const apiHeaderFiles = ['hookapi.h', 'sfcodes.h', 'hookmacro.h']
|
||||
@@ -62,7 +62,9 @@ export interface IState {
|
||||
// let localStorageState: null | string = null;
|
||||
let initialState: IState = {
|
||||
files: [],
|
||||
// active file index on the Develop page editor
|
||||
active: 0,
|
||||
// Active file index on the Deploy page editor
|
||||
activeWat: 0,
|
||||
loading: false,
|
||||
compiling: false,
|
||||
|
||||
Reference in New Issue
Block a user