From 692b52fa4191302ed4f769874090587ebe4c9880 Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sat, 28 Oct 2023 21:15:28 +0200
Subject: [PATCH 1/7] bump versions + change router after version bump
---
package.json | 18 +++++++++---------
src/components/Svg/SvgType.ts | 1 +
src/router/AppRouter.tsx | 22 +++++++++++-----------
3 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/package.json b/package.json
index a62d699..3d3a71b 100644
--- a/package.json
+++ b/package.json
@@ -6,22 +6,22 @@
"@monaco-editor/react": "^4.4.1",
"@noble/secp256k1": "^1.7.1",
"@script-wiz/lib": "^0.1.99",
- "@testing-library/jest-dom": "^5.11.4",
- "@testing-library/react": "^11.1.0",
- "@testing-library/user-event": "^12.1.10",
+ "@testing-library/jest-dom": "^5.17.0",
+ "@testing-library/react": "^13.4.0",
+ "@testing-library/user-event": "^13.5.0",
"@types/jest": "^26.0.15",
"@types/node": "^12.0.0",
- "@types/react": "^17.0.0",
- "@types/react-dom": "^17.0.0",
+ "@types/react": "^18.2.25",
+ "@types/react-dom": "^18.2.10",
"axios": "^0.26.0",
"big-integer": "^1.6.51",
"bn.js": "^5.2.1",
"monaco-editor": "^0.33.0",
- "react": "^17.0.2",
- "react-dom": "^17.0.2",
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0",
"react-mosaic-component": "^5.0.0",
- "react-router-dom": "^5.3.0",
- "react-scripts": "4.0.3",
+ "react-router-dom": "^6.16.0",
+ "react-scripts": "5.0.1",
"rsuite": "^5.5.0",
"sass": "^1.49.7",
"typescript": "^4.1.2",
diff --git a/src/components/Svg/SvgType.ts b/src/components/Svg/SvgType.ts
index ddae77d..e16a9b0 100644
--- a/src/components/Svg/SvgType.ts
+++ b/src/components/Svg/SvgType.ts
@@ -1,5 +1,6 @@
export type SvgType = {
path: string;
+ children?: React.ReactNode;
fill?: string;
bgColor?: string;
color?: string;
diff --git a/src/router/AppRouter.tsx b/src/router/AppRouter.tsx
index 7462dc2..9936307 100644
--- a/src/router/AppRouter.tsx
+++ b/src/router/AppRouter.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
+import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { ROUTE_PATH } from './ROUTE_PATH';
import { Helper } from '../pages/Helper/Helper';
import { Home } from '../pages/Home/Home';
@@ -13,16 +13,16 @@ import { BitCalculator } from '../pages/256BitCalculator/256BitCalculator';
export const AppRouter = (): JSX.Element => {
return (
-
-
-
-
-
-
-
-
-
-
+
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+ } />
+
);
};
From 32d54b017dc8c4495620cef7dda4130e5e2ee529 Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sun, 29 Oct 2023 20:22:45 +0100
Subject: [PATCH 2/7] bump dependencies, remove react-scripts, add vite for
building
---
public/index.html => index.html | 16 ++++----------
package.json | 39 +++++++++++++++++----------------
tsconfig.json | 2 +-
vite.config.js | 12 ++++++++++
4 files changed, 37 insertions(+), 32 deletions(-)
rename public/index.html => index.html (67%)
create mode 100644 vite.config.js
diff --git a/public/index.html b/index.html
similarity index 67%
rename from public/index.html
rename to index.html
index 53832ae..08a8bd2 100644
--- a/public/index.html
+++ b/index.html
@@ -2,13 +2,14 @@
-
+
-
+
+
@@ -25,16 +26,7 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
-
-
+
Script Wiz
diff --git a/package.json b/package.json
index 3d3a71b..548a22a 100644
--- a/package.json
+++ b/package.json
@@ -2,37 +2,37 @@
"name": "script-wiz-ui",
"version": "0.1.18",
"private": false,
+ "type": "module",
"dependencies": {
- "@monaco-editor/react": "^4.4.1",
- "@noble/secp256k1": "^1.7.1",
+ "@monaco-editor/react": "^4.6.0",
+ "@noble/secp256k1": "^2.0.0",
"@script-wiz/lib": "^0.1.99",
- "@testing-library/jest-dom": "^5.17.0",
- "@testing-library/react": "^13.4.0",
- "@testing-library/user-event": "^13.5.0",
- "@types/jest": "^26.0.15",
- "@types/node": "^12.0.0",
+ "@testing-library/jest-dom": "^6.1.4",
+ "@testing-library/react": "^14.0.0",
+ "@testing-library/user-event": "^14.5.1",
+ "@types/jest": "^29.5.6",
+ "@types/node": "^20.8.9",
"@types/react": "^18.2.25",
"@types/react-dom": "^18.2.10",
- "axios": "^0.26.0",
+ "@vitejs/plugin-react-swc": "^3.4.0",
+ "axios": "^1.6.0",
"big-integer": "^1.6.51",
"bn.js": "^5.2.1",
- "monaco-editor": "^0.33.0",
+ "monaco-editor": "^0.44.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
- "react-mosaic-component": "^5.0.0",
+ "react-mosaic-component": "^6.1.0",
"react-router-dom": "^6.16.0",
- "react-scripts": "5.0.1",
"rsuite": "^5.5.0",
"sass": "^1.49.7",
- "typescript": "^4.1.2",
- "web-vitals": "^1.0.1"
+ "typescript": "^5.2.2",
+ "vite": "^4.5.0",
+ "web-vitals": "^3.5.0"
},
"scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test",
- "eject": "react-scripts eject",
- "format": "prettier --write './src/**/*.{ts,tsx}'"
+ "start": "vite",
+ "build": "tsc && vite build",
+ "serve": "vite preview"
},
"eslintConfig": {
"extends": [
@@ -54,7 +54,8 @@
},
"devDependencies": {
"@types/bn.js": "^5.1.1",
- "@types/react-router-dom": "^5.3.0"
+ "@types/react-router-dom": "^5.3.0",
+ "vite-plugin-node-polyfills": "^0.15.0"
},
"homepage": "https://ide.scriptwiz.app"
}
diff --git a/tsconfig.json b/tsconfig.json
index a273b0c..34bbca6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,6 @@
{
"compilerOptions": {
- "target": "es5",
+ "target": "ESNext",
"lib": [
"dom",
"dom.iterable",
diff --git a/vite.config.js b/vite.config.js
new file mode 100644
index 0000000..4a0f9d9
--- /dev/null
+++ b/vite.config.js
@@ -0,0 +1,12 @@
+import { defineConfig } from 'vite'
+import { nodePolyfills } from 'vite-plugin-node-polyfills'
+import react from '@vitejs/plugin-react-swc'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+ base: '/',
+ plugins: [react(), nodePolyfills()],
+ build: {
+ outDir: 'build',
+ }
+})
From a6df4d80a63c318fe4c9f790d5494081228303a8 Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sun, 29 Oct 2023 20:23:46 +0100
Subject: [PATCH 3/7] fix: rsuite css import, rendering react app via react
doom using createRoot
---
src/index.scss | 2 +-
src/index.tsx | 15 +++++++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/index.scss b/src/index.scss
index 0895a03..c7409c5 100644
--- a/src/index.scss
+++ b/src/index.scss
@@ -1,4 +1,4 @@
-@import '~rsuite/dist/rsuite.min.css';
+@import 'rsuite/dist/rsuite.min.css';
body {
margin: 0;
diff --git a/src/index.tsx b/src/index.tsx
index 00324be..1b4b5e9 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import ReactDOM from 'react-dom';
+import { createRoot } from 'react-dom/client';
import './index.scss';
import App from './App';
import reportWebVitals from './reportWebVitals';
@@ -12,16 +12,19 @@ declare global {
}
}
-ReactDOM.render(
-
+const domNode = document.getElementById('root')!;
+const root = createRoot(domNode);
+
+// Disabling strict mode to avoid uncaught promise with Monaco: https://github.com/suren-atoyan/monaco-react/issues/440
+root.render(
+ //
- ,
- document.getElementById('root'),
+ // ,
);
// If you want to start measuring performance in your app, pass a function
-// to log results (for example: reportWebVitals(console.log))
+// to log results (for example: reportWebVitals(co nsole.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
From ae3ef4d86dc9025e7cf682641bb90da12b8fb114 Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sun, 29 Oct 2023 20:27:15 +0100
Subject: [PATCH 4/7] fix: @noble/secp256k1 no longer exports Point but
ProjectivePoint which is now 3d xyz
---
src/pages/EcCalculator/EcCalculator.tsx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pages/EcCalculator/EcCalculator.tsx b/src/pages/EcCalculator/EcCalculator.tsx
index 86ea817..cef3862 100644
--- a/src/pages/EcCalculator/EcCalculator.tsx
+++ b/src/pages/EcCalculator/EcCalculator.tsx
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { Button, Input, InputGroup, Tooltip, Whisper, RadioGroup, Radio, Checkbox } from 'rsuite';
import CopyIcon from '../../components/Svg/Icons/Copy';
-import { Point } from '@noble/secp256k1';
+import { ProjectivePoint } from '@noble/secp256k1';
import { ValueType } from 'rsuite/esm/Radio';
import BN from 'bn.js';
import { validHex } from '../../utils/helper';
@@ -38,9 +38,9 @@ export const EcCalculator = () => {
const pointMultiplation = () => {
try {
- const data = new Point(BigInt('0x' + point1), BigInt('0x' + ecinpY)).multiply(BigInt('0x' + point2));
- const yAxis = bigInt(data.y.toString(16), 16);
- // const yAxis = yfromX(data.x.toString(16));
+ const data = new ProjectivePoint(BigInt(point1), BigInt(ecinpY), BigInt(1)).multiply(BigInt(point2));
+ const affinePoint = data.toAffine(); // This is a hypothetical method.
+ const yAxis = bigInt(affinePoint.y.toString(16), 16);
setMulResult({ x: data.x.toString(16), y: yAxis.toString(16), isOdd: yAxis.isOdd() });
} catch (error) {
From d770e2392f3407b99ee858049b9860a1bcebf8a7 Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sun, 29 Oct 2023 20:33:58 +0100
Subject: [PATCH 5/7] fix: typescript error caused due to png type not being
defined
---
src/types.ts | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 src/types.ts
diff --git a/src/types.ts b/src/types.ts
new file mode 100644
index 0000000..a0993ed
--- /dev/null
+++ b/src/types.ts
@@ -0,0 +1,4 @@
+declare module '*.png' {
+ const value: any;
+ export = value;
+}
From 355fd7282caaef1240d4093072b4555be91c9afa Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sun, 29 Oct 2023 20:38:55 +0100
Subject: [PATCH 6/7] add .nvmrc
---
.nvmrc | 1 +
1 file changed, 1 insertion(+)
create mode 100644 .nvmrc
diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 0000000..9a2a0e2
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+v20
From 0f2bb75c0e30d6cc95dc6b2b33ca60b08d8b2300 Mon Sep 17 00:00:00 2001
From: katsu <0x0ff@onsats.org>
Date: Sun, 29 Oct 2023 20:41:27 +0100
Subject: [PATCH 7/7] add engine versions to package.json
---
package.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/package.json b/package.json
index 548a22a..1dd59f5 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,10 @@
"version": "0.1.18",
"private": false,
"type": "module",
+ "engines" : {
+ "npm" : ">=9.8.0",
+ "node" : ">=20"
+ },
"dependencies": {
"@monaco-editor/react": "^4.6.0",
"@noble/secp256k1": "^2.0.0",