From 428e1a1662a629e75d614c123f14992d58de460d Mon Sep 17 00:00:00 2001 From: vorujack Date: Sat, 16 Dec 2023 09:58:34 +0330 Subject: [PATCH 1/5] finalize cold signing problems --- src/components/qrcode/qrcode-types/index.tsx | 12 +- .../RequestQrcodeDisplay.tsx | 9 +- src/components/v2/data.js | 269 ++++++++++++++++++ 3 files changed, 284 insertions(+), 6 deletions(-) create mode 100644 src/components/v2/data.js diff --git a/src/components/qrcode/qrcode-types/index.tsx b/src/components/qrcode/qrcode-types/index.tsx index 53b4eb4..c753bf0 100644 --- a/src/components/qrcode/qrcode-types/index.tsx +++ b/src/components/qrcode/qrcode-types/index.tsx @@ -54,6 +54,7 @@ const detectPageFromJson = ( return { payload, page, total }; } } catch (e) { + console.log(e); /* empty */ } return null; @@ -102,9 +103,14 @@ const Types = [ ), type: ErgoPayR, detect: (value: string): DetectParam | null => { - return value.startsWith('ergopay://') - ? { page: 1, total: 1, payload: value.replace('ergopay://', '') } - : null; + try { + return value.startsWith('ergopay://') + ? { page: 1, total: 1, payload: value.replace('ergopay://', '') } + : null; + } catch (e) { + console.log(e); + } + return null; }, }, ]; diff --git a/src/components/request-qrcode-display/RequestQrcodeDisplay.tsx b/src/components/request-qrcode-display/RequestQrcodeDisplay.tsx index 4c652c9..7636517 100644 --- a/src/components/request-qrcode-display/RequestQrcodeDisplay.tsx +++ b/src/components/request-qrcode-display/RequestQrcodeDisplay.tsx @@ -18,8 +18,8 @@ const RequestQrcodeDisplay = (props: RequestQrcodeDisplayPropsType) => { chunks === 1 ? `{"${props.requestType}": "${requestData}"}` : `{"${props.requestType}": "` + - requestData.substring(chunk * chunkSize, chunkSize) + - `", "n": ${chunks}, "p": ${chunk + 1}`; + requestData.substring(chunk * chunkSize, (chunk + 1) * chunkSize) + + `", "n": ${chunks}, "p": ${chunk + 1}}`; const gotoNext = () => { if (chunk < chunks - 1) { setChunk(chunk + 1); @@ -78,7 +78,10 @@ const RequestQrcodeDisplay = (props: RequestQrcodeDisplayPropsType) => { step={100} marks min={200} - max={Math.min(MAX_CHUNK_SIZE, requestData.length)} + max={Math.min( + MAX_CHUNK_SIZE, + Math.ceil(requestData.length / 100) * 100 + )} /> diff --git a/src/components/v2/data.js b/src/components/v2/data.js new file mode 100644 index 0000000..80ab066 --- /dev/null +++ b/src/components/v2/data.js @@ -0,0 +1,269 @@ +import { DAppActions } from './pages/dApps/connectedDApp/ConnectedDAppLog'; + +export const MSTransactions = [ + { + stateId: 'COMMITMENT', + step: 0, + totalSteps: 3, + needAction: true, + needPassword: true, + amount: 22.3, + id: 'ae7ef086b2ef71cb236830841bd1d6add0506add2586b2eae7ef2c2c256f', + signatures: [], + }, + { + stateId: 'COMMITMENT', + step: 1, + totalSteps: 3, + needAction: false, + needPassword: false, + amount: 60.11, + id: '6506add086b2eae7ef2c25f71cb236830841bd1d6add086b2eae7ef2c25f', + signatures: [ + { + signed: false, + id: 'e2ef3c25f91c64162cb23650bd1d6add086add0825fa68308b2eae7eb2ef', + }, + ], + }, + { + stateId: 'COMMITMENT', + step: 2, + totalSteps: 3, + needAction: true, + needPassword: true, + amount: 60.15, + id: '6b6506a2c25f71cb236830841bd1086b2eae7ef2d6addc25fdd082eae7ef', + signatures: [ + { + signed: false, + id: 'e2ef3c25f91c64162cb23650bd1d6add086add0825fa68308b2eae7eb2ef', + }, + { + signed: false, + id: '162cb23650e2ed1d6dd0825fa6f3c2b2eae7538ebd0d086af91c2efa64b8', + }, + ], + }, + { + stateId: 'SIGNING', + step: 2, + totalSteps: 5, + needAction: false, + needPassword: false, + amount: 25.15, + id: 'cb236830846add086b2eae7ef2c25f71d086b2eae7ef2c25f1bd1d6ad650', + signatures: [ + { + signed: false, + id: 'e2ef3c25f91c64162cb23650bd1d6add086add0825fa68308b2eae7eb2ef', + }, + { + signed: false, + id: '4162cbe2ef3c25f9add086add01c623650bd1d6825f2eae7eb2efa68308b', + }, + { + signed: false, + id: '62cb236e2ef31d6add086add0825c25f91c668308b2eae4150beb2efdfa7', + }, + { + signed: true, + id: '162cb23650e2ed1d6dd0825fa6f3c2b2eae7538ebd0d086af91c2efa64b8', + }, + { + signed: true, + id: '50e2e162cb236d1d6dd7538eb0825fa6f3c2ed0d0b2ea86ab8f91c2efa64', + }, + ], + }, + { + stateId: 'SIGNING', + step: 2, + totalSteps: 3, + needAction: true, + needPassword: false, + amount: 1620, + id: 'b2eae7ef6c25f71cb23683506add08620841bd1deae7ef2c25f6add086b2', + signatures: [ + { + signed: false, + id: 'e2ef3c25f91c64162cb23650bd1d6add086add0825fa68308b2eae7eb2ef', + }, + { + signed: true, + id: '162cb23650e2ed1d6dd0825fa6f3c2b2eae7538ebd0d086af91c2efa64b8', + }, + { + signed: true, + id: '50e2e162cb236d1d6dd7538eb0825fa6f3c2ed0d0b2ea86ab8f91c2efa64', + }, + ], + }, + { + stateId: 'COMPLETED', + step: 3, + totalSteps: 3, + needAction: true, + needPassword: false, + amount: 40.5, + id: '2eae7ef2c6836506add71cb23841bd1d6a2086b025fc25fdd086b2eae7ef', + signatures: [ + { + signed: true, + id: 'e2ef3c25f91c64162cb23650bd1d6add086add0825fa68308b2eae7eb2ef', + }, + { + signed: true, + id: '162cb23650e2ed1d6dd0825fa6f3c2b2eae7538ebd0d086af91c2efa64b8', + }, + { + signed: true, + id: '50e2e162cb236d1d6dd7538eb0825fa6f3c2ed0d0b2ea86ab8f91c2efa64', + }, + ], + }, +]; + +export const WHITE_LIST = [ + { + name: 'Lorem ipsum dolor 1', + id: '6506add086b2', + src: '/Ergold.png', + logs: [ + { + name: DAppActions.SIGN_TX_INPUT, + date: '2019-01-21T07:19:01', + args: { + id: 'bf276f0fb50ed54fbb88f18253962e907b15c9eb', + input_id: 'input_id', + input_index: 'input_index', + }, + }, + { + name: DAppActions.SUBMIT_TX, + date: '2019-01-20T07:19:01', + args: { + output: '62e907b15cbf27d5425399ebf6f0fb50ebb88f18', + }, + }, + { + name: DAppActions.SIGN_TX, + date: '2019-01-20T07:13:10', + args: { + id: 'bf276f0fb50ed54fbb88f18253962e907b15c9eb', + }, + }, + { + name: DAppActions.SIGN_DATA, + date: '2019-01-20T07:12:11', + args: { + output: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', + }, + }, + { + name: DAppActions.USED_ADDRESS, + date: '2019-01-16T09:15:10', + args: { + output: ['62e907b15cbf27d5425399ebf6f0fb50ebb88f18'], + }, + }, + { + name: DAppActions.USED_ADDRESS, + date: '2019-01-16T09:15:04', + args: { + output: [], + }, + }, + { + name: DAppActions.UNUSED_ADDRESS, + date: '2019-01-16T09:14:10', + args: { + output: [ + '62e907b15cbf27d5425399ebf6f0fb50ebb88f18', + '62e907b15cbf27d5425399ebf6f0fb50ebb88f18', + '62e907b15cbf27d5425399ebf6f0fb50ebb88f18', + ], + }, + }, + { + name: DAppActions.CHANGE_ADDRESS, + date: '2019-01-16T09:13:10', + args: { + output: '62e907b15cbf27d5425399ebf6f0fb50ebb88f18', + }, + }, + { + name: DAppActions.BALANCE, + date: '2019-01-16T09:09:08', + args: { + token_id: 'ERG', + output: 1246007, + }, + }, + { + name: DAppActions.UTXOS, + date: '2019-01-15T12:21:15', + args: { + amount: 24361, + token_id: 'ERG', + output: [ + { boxId: '62e907b15cbf27d5425399ebf6f0fb50ebb88f18' }, + { boxId: '62e907b15cbf27d5425399ebf6f0fb50ebb88f18' }, + ], + }, + }, + { + name: DAppActions.UTXOS, + date: '2019-01-15T12:21:10', + args: { + amount: 24361, + token_id: 'ERG', + output: [], + }, + }, + { + name: DAppActions.UTXOS, + date: '2019-01-15T12:21:10', + args: { + amount: 0, + token_id: 'ERG', + }, + }, + { + name: DAppActions.CHECK_ACCESS, + date: '2019-01-15T07:37:07', + args: { + output: true, + }, + }, + { + name: DAppActions.REQUEST_ACCESS, + date: '2019-01-15T07:35:15', + args: { + output: true, + }, + }, + { + name: DAppActions.REQUEST_ACCESS, + date: '2019-01-15T07:32:00', + args: { + output: false, + }, + }, + ], + }, + { + name: 'Lorem ipsum dolor 2', + id: 'eae7ef2c25f7', + src: '/logo192.png', + }, + { + name: 'Lorem ipsum dolor 3', + id: '236830841bd1d', + }, + { + name: 'Lorem ipsum dolor 4', + id: 'f2c25f71c841b', + }, +]; From 6983c51bc90659f42b16dc262efc81a808a23c2a Mon Sep 17 00:00:00 2001 From: vorujack Date: Sat, 16 Dec 2023 10:04:31 +0330 Subject: [PATCH 2/5] fix pipeline for mac --- .github/workflows/release.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ae3acf8..f4b42c1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -63,7 +63,11 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: 16.12 + + - uses: actions/setup-python@v5 + with: + python-version: '3.5.4' - name: Install app dependencies run: npm install @@ -79,7 +83,7 @@ jobs: - name: Build Electron working-directory: ./electron - run: export PYTHON_PATH="$(which python2)"; CI=false; npm i; npm run build; npm run electron:pack; npm run electron:make + run: export PYTHON_PATH="$(which python)"; CI=false; npm i; npm run build; npm run electron:pack; npm run electron:make - name: Upload Executable File to release uses: softprops/action-gh-release@v1 From 1153082e076e59d33814ad1c3ebc821ed943723c Mon Sep 17 00:00:00 2001 From: vorujack Date: Sun, 7 Jan 2024 07:46:15 +0330 Subject: [PATCH 3/5] fix submit transaction add more error display and correction --- src/components/qrcode/QrCodeReaderView.tsx | 1 + .../qrcode/qrcode-types/QrCodeMoreChunk.tsx | 2 + .../TransactionPublishRequest.tsx | 33 +++++-- .../qrcode-types/TransactionSignRequest.tsx | 85 +++++++++++-------- src/util/network/node.ts | 9 +- 5 files changed, 83 insertions(+), 47 deletions(-) diff --git a/src/components/qrcode/QrCodeReaderView.tsx b/src/components/qrcode/QrCodeReaderView.tsx index 0c6aa11..6292beb 100644 --- a/src/components/qrcode/QrCodeReaderView.tsx +++ b/src/components/qrcode/QrCodeReaderView.tsx @@ -165,6 +165,7 @@ class QrCodeReaderView extends React.Component< ) : invalidChunkCount > 0 ? ( this.setState({ scanning: true })} /> diff --git a/src/components/qrcode/qrcode-types/QrCodeMoreChunk.tsx b/src/components/qrcode/qrcode-types/QrCodeMoreChunk.tsx index f4e7d9a..ad42930 100644 --- a/src/components/qrcode/qrcode-types/QrCodeMoreChunk.tsx +++ b/src/components/qrcode/qrcode-types/QrCodeMoreChunk.tsx @@ -5,6 +5,7 @@ import { Button, Container, Grid, Typography } from '@mui/material'; import qrcode from '../../../assets/qrcode.svg'; interface PropsType { chunks: Array; + type: string; close: () => unknown; scanNext: () => unknown; } @@ -35,6 +36,7 @@ const QrCodeMoreChunk = (props: PropsType) => {

{completed} / {props.chunks.length}

+

Qrcode Type is: {props.type}