0 || 'hidden'}`}>
-
Nationality 🖋️
+
+ Nationality 🖋️
+
- {nationalityData.map(data => {
+ {nationalityData.map((data) => {
return (
- )
+ );
})}
@@ -83,58 +124,64 @@ function ProfileTable({
{/* Social */}
0 || 'hidden'}`}>
-
Social 🖋️
+
+ Social 🖋️
+
- {socialData.map(data => {
- return (
-
- )
- })}
+ {socialData.map((data) => {
+ return (
+
+ );
+ })}
{/* Other */}
0 || 'hidden'}`}>
-
Other 🖋️
+
+ Other 🖋️
+
- {otherData.map(data => {
- return (
-
- )
- })}
+ {otherData.map((data) => {
+ return (
+
+ );
+ })}
>
- )
+ );
}
export default ProfileTable;
diff --git a/src/partials/profile/ProfileTableItem.jsx b/src/partials/profile/ProfileTableItem.jsx
index 371bc66..63f32a0 100644
--- a/src/partials/profile/ProfileTableItem.jsx
+++ b/src/partials/profile/ProfileTableItem.jsx
@@ -24,12 +24,21 @@ function ProfileTableItem(props) {
-
+
- {props.status === statusMap.blockchained || props.status === statusMap.processed
- ? `${props.value.slice(0, 4)}****${props.value.slice(props.value.length - 4)}`
+ {props.status === statusMap.blockchained ||
+ props.status === statusMap.processed
+ ? `${props.value.slice(0, 4)}****${props.value.slice(
+ props.value.length - 4
+ )}`
: props.value}
{props.property}
@@ -39,15 +48,25 @@ function ProfileTableItem(props) {
{props.status === statusMap.blockchained ? (
-
{props.status}
+
+ {props.status}
+
) : props.status === statusMap.processed ? (
-
{props.status}
+
+ {props.status}
+
) : props.status === statusMap.stored ? (
-
{props.status}
+
+ {props.status}
+
) : props.status === statusMap.completed ? (
-
{props.status}
+
+ {props.status}
+
) : (
-
{props.status}
+
+ {props.status}
+
)}
@@ -56,15 +75,15 @@ function ProfileTableItem(props) {
{props.avatars
? props.avatars.map((avatar, index) => (
-
- ))
+
+ ))
: null}
Add avatar
@@ -80,7 +99,10 @@ function ProfileTableItem(props) {
Link
-
+
@@ -89,7 +111,9 @@ function ProfileTableItem(props) {
setDescriptionOpen(!descriptionOpen)}
aria-controls={`description-${props.id}`}
@@ -106,7 +130,10 @@ function ProfileTableItem(props) {
-
+
Seed
@@ -127,7 +159,9 @@ function ProfileTableItem(props) {
-
Today
+
+ Today
+
@@ -141,32 +175,56 @@ function ProfileTableItem(props) {
aria-hidden="true"
>
) : null}
-
-
+
{data}
-
Transactions ID
+
+ Transactions ID
+
diff --git a/src/partials/sharedData/SharedDataRoadmap.jsx b/src/partials/sharedData/SharedDataRoadmap.jsx
index 634baca..0f72e62 100644
--- a/src/partials/sharedData/SharedDataRoadmap.jsx
+++ b/src/partials/sharedData/SharedDataRoadmap.jsx
@@ -1,44 +1,63 @@
-import React from "react";
+import React from 'react';
-import ValidationUsersImg from "../validationLog/ValidationUsersImg";
+import ValidationUsersImg from '../validationLog/ValidationUsersImg';
function SharedDataRoadMap({ data }) {
-
return (
-
-
-
-
-
-
-
- {data.value}
-
- {data.label}
-
+
+
+
+
+
+
+
+ {data.value}
+
+
+ {data.label}
+
- {data.seed && (
-
-
{data.seed.toUpperCase()}
-
seed
-
- )}
- {data.hash && (
-
-
{data.hash.toUpperCase()}
-
hash
-
- )}
-
Explore ->
+ {data.seed && (
+
+
+ {data.seed.toUpperCase()}
+
+
seed
+
+ )}
+ {data.hash && (
+
+
+ {data.hash.toUpperCase()}
+
+
hash
+
+ )}
+
+ Explore ->
+
-
- )
+
+
+ );
}
-export default SharedDataRoadMap;
+export default SharedDataRoadMap;
diff --git a/src/partials/validate/ValidateItem.jsx b/src/partials/validate/ValidateItem.jsx
index 270afa6..257a9dd 100644
--- a/src/partials/validate/ValidateItem.jsx
+++ b/src/partials/validate/ValidateItem.jsx
@@ -1,7 +1,6 @@
import React from 'react';
function ValidateTableItem(props) {
-
const statusColor = (status) => {
switch (status) {
case 'Correct':
@@ -13,49 +12,67 @@ function ValidateTableItem(props) {
}
};
- function openValidatePanel (event) {
- event.stopPropagation()
- props.setValidatePanelOpen(true)
+ function openValidatePanel(event) {
+ event.stopPropagation();
+ props.setValidatePanelOpen(true);
}
return (
-
openValidatePanel(e)}>
-
-
-
- Select
- {props.check && e.stopPropagation()} />}
-
+
openValidatePanel(e)}
+ >
+
+
+
+ Select
+ {props.check && (
+ e.stopPropagation()}
+ />
+ )}
+
+
+
+
+
+
+
+ {props.data}
+
+
+ {props.seed}
+
+
+
-
-
-
-
- {props.data}
-
-
- {props.seed}
-
-
-
-
-
- {/* Menu button */}
-
- Menu
-
-
-
-
-
-
-
-
+
+
+
+ {/* Menu button */}
+
+ Menu
+
+
+
+
+
+
+
+
);
}
diff --git a/src/partials/validate/ValidatePanel.jsx b/src/partials/validate/ValidatePanel.jsx
index 226465f..3439df4 100644
--- a/src/partials/validate/ValidatePanel.jsx
+++ b/src/partials/validate/ValidatePanel.jsx
@@ -2,109 +2,167 @@ import React from 'react';
import Image from '../../images/transactions-image-04.svg';
-function TransactionPanel({
- validatePanelOpen,
- setValidatePanelOpen
-}) {
-
+function TransactionPanel({ validatePanelOpen, setValidatePanelOpen }) {
return (
-
-
-
setValidatePanelOpen(false)}
- className="absolute top-0 right-0 mt-6 mr-6 group p-2"
+
+
+
setValidatePanelOpen(false)}
+ className="absolute top-0 right-0 mt-6 mr-6 group p-2"
+ >
+
-
-
-
-
-
-
-
Bank Transfer
-
22/01/2022, 8:56 PM
- {/* Details */}
-
- {/* Top */}
-
-
-
-
-
0.012 IDN
-
Total amount fee
+
+
+
+
+
+
+ Bank Transfer
+
+
+ 22/01/2022, 8:56 PM
+
+ {/* Details */}
+
+ {/* Top */}
+
+
+
- {/* Divider */}
-
-
-
-
-
-
-
-
+
+ 0.012 IDN
- {/* Bottom */}
-
-
- Validator:
- IT17 2207 1010 0504 0006 88
-
-
- Recipient:
- IT17 2207 1010 0504 0006 88
-
-
- Transaction:
- 145 bytes
-
+
+ Total amount fee
- {/* Receipts */}
-
+ {/* Receipts */}
+
+ {/* Notes */}
+
+ {/* Download / Report */}
+
+
- {/* Notes */}
-
-
Notes
-
- Write a note
-
-
-
- {/* Download / Report */}
-
+
);
}
diff --git a/src/partials/validate/ValidateTable.jsx b/src/partials/validate/ValidateTable.jsx
index fe5cdbe..d152844 100644
--- a/src/partials/validate/ValidateTable.jsx
+++ b/src/partials/validate/ValidateTable.jsx
@@ -1,10 +1,7 @@
-import React, {useEffect, useState} from "react";
-import ValidateTableItem from "./ValidateItem";
-
-function ValidateTable({
- setValidatePanelOpen
-}) {
+import React, { useEffect, useState } from 'react';
+import ValidateTableItem from './ValidateItem';
+function ValidateTable({ setValidatePanelOpen }) {
const validateData = [
{
id: '10',
@@ -59,35 +56,40 @@ function ValidateTable({
const handleSelectAll = () => {
setSelectAll(!selectAll);
- setMarked(selectedList.map(li => li.id));
+ setMarked(selectedList.map((li) => li.id));
if (selectAll) {
setMarked([]);
}
};
- const handleClick = e => {
+ const handleClick = (e) => {
const { id, checked } = e.target;
setSelectAll(false);
setMarked([...marked, id]);
if (!checked) {
- setMarked(marked.filter(item => item !== id));
+ setMarked(marked.filter((item) => item !== id));
}
};
return (
-
-
- {/* Table */}
-
-
- {/* Table header */}
-
+
+
);
}
diff --git a/src/partials/validationLog/ValidateRoadMap.jsx b/src/partials/validationLog/ValidateRoadMap.jsx
index d27e6ee..2de4718 100644
--- a/src/partials/validationLog/ValidateRoadMap.jsx
+++ b/src/partials/validationLog/ValidateRoadMap.jsx
@@ -1,38 +1,50 @@
-import React from "react";
+import React from 'react';
-import ValidationSeasonItem from "./ValidationSeasonItem";
-import ValidationUsersImg from "./ValidationUsersImg";
+import ValidationSeasonItem from './ValidationSeasonItem';
+import ValidationUsersImg from './ValidationUsersImg';
function ValidateRoadMap({ season }) {
-
return (
-
-
-
-
{''}
-
-
- {season.sender_avatar &&
+
+
+
+
+ {''}
+
+
+
+ {season.sender_avatar && (
}
- {/* List */}
-
- {/* List item(s) */}
- {season.transaction.map((item, index) => {
- return
- })}
-
-
+
+ )}
+ {/* List */}
+
+ {/* List item(s) */}
+ {season.transaction.map((item, index) => {
+ return (
+
+ );
+ })}
+
-
- )
+
+
+ );
}
-export default ValidateRoadMap;
+export default ValidateRoadMap;
diff --git a/src/partials/validationLog/ValidationSeasonItem.jsx b/src/partials/validationLog/ValidationSeasonItem.jsx
index c835ba9..70f1bfb 100644
--- a/src/partials/validationLog/ValidationSeasonItem.jsx
+++ b/src/partials/validationLog/ValidationSeasonItem.jsx
@@ -1,30 +1,59 @@
-import React from "react";
+import React from 'react';
function ValidationSeasonItem({ length, item, index }) {
return (
-
-
- {length-1!==index &&
}
-
-
- {item.address && }
-
-
-
- {`${item.label} ${item.address ? "by" : "Updated"}`} {item.address}
-
+
+
+ {length - 1 !== index && (
+
+ )}
+
+
+ {item.address && (
+
+ )}
+
-
-
{item.transaction_id}
-
Transactions ID
+
+ {`${item.label} ${item.address ? 'by' : 'Updated'}`}{' '}
+
+ {item.address}
+
+
+
+
+
+ {item.transaction_id}
-
-
{item.value}
-
{item.address ? "Validated data" : "Updated data"}
+
+ Transactions ID
+
+
+
+
+ {item.value}
-
Explore ->
-
+
+ {item.address ? 'Validated data' : 'Updated data'}
+
+
+
+ Explore ->
+
+
);
}
-export default ValidationSeasonItem
+export default ValidationSeasonItem;
diff --git a/src/partials/validationLog/ValidationUsersImg.jsx b/src/partials/validationLog/ValidationUsersImg.jsx
index 696d6b7..fb569f5 100644
--- a/src/partials/validationLog/ValidationUsersImg.jsx
+++ b/src/partials/validationLog/ValidationUsersImg.jsx
@@ -1,12 +1,17 @@
-import React from "react";
-
-function ValidationUsersImg({ image,size }) {
+import React from 'react';
+function ValidationUsersImg({ image, size }) {
return (
-
-
-
+
+
+
);
}
-export default ValidationUsersImg
+export default ValidationUsersImg;
diff --git a/src/shared/fetchWrapper.js b/src/shared/fetchWrapper.js
index 6f22841..e237abf 100644
--- a/src/shared/fetchWrapper.js
+++ b/src/shared/fetchWrapper.js
@@ -1,5 +1,5 @@
-import {store} from '../store/store';
-import {jsonReplacer} from '../utils/Utils';
+import { store } from '../store/store';
+import { jsonReplacer } from '../utils/Utils';
function prepareUrl(url) {
if (url.startsWith('http')) return url;
@@ -9,12 +9,11 @@ function prepareUrl(url) {
function handleRequest(method, url, headers, attempts, token, body) {
return new Promise((resolve, reject) => {
(function internalRequest() {
- if(store)
- store.loading = true;
+ if (store) store.loading = true;
return request(method, url, headers, token, body)
.then(resolve)
- .catch(err => --attempts > 0 ? internalRequest() : reject(err))
- })()
+ .catch((err) => (--attempts > 0 ? internalRequest() : reject(err)));
+ })();
})
.then((res) => {
store.loading = false;
@@ -22,10 +21,10 @@ function handleRequest(method, url, headers, attempts, token, body) {
})
.catch((err) => {
store.loading = false;
- console.log(err)
- return {}
- })
-};
+ console.log(err);
+ return {};
+ });
+}
/**
* Request
@@ -36,37 +35,37 @@ function handleRequest(method, url, headers, attempts, token, body) {
* @param {object} headers - request headers
*/
function request(method, url, headers = {}, token, body) {
- let controller = new AbortController;
+ let controller = new AbortController();
let requestOptions = {};
- if (method === 'GET' || method === 'DELETE'){
+ if (method === 'GET' || method === 'DELETE') {
requestOptions = {
method: method,
headers: {
Authorization: `IDNTTY ${token}`,
- ...headers
+ ...headers,
},
signal: controller.signal,
- }
- };
- if (method === 'POST' || method === 'PUT'){
+ };
+ }
+ if (method === 'POST' || method === 'PUT') {
requestOptions = {
method: method,
headers: {
Authorization: `IDNTTY ${token}`,
Accept: 'application/json',
'Content-Type': 'application/json',
- ...headers
+ ...headers,
},
body: JSON.stringify(body, jsonReplacer),
signal: controller.signal,
- }
- };
+ };
+ }
if (!token) {
requestOptions.headers.Authorization = null;
}
setTimeout(() => controller.abort(), 15000);
return fetch(prepareUrl(url), requestOptions);
-};
+}
function get(url, headers, attempts = 3) {
return handleRequest('GET', url, headers, attempts, null);
@@ -109,5 +108,5 @@ export const fetchWrapper = {
delAuth,
postAuth,
putAuth,
- baseUrl: ''
-};
\ No newline at end of file
+ baseUrl: '',
+};
diff --git a/src/shared/labelMap.js b/src/shared/labelMap.js
index 960a316..b0148a6 100644
--- a/src/shared/labelMap.js
+++ b/src/shared/labelMap.js
@@ -1,27 +1,27 @@
export const labelMap = {
firstname: 'First name',
secondname: 'Second name',
- gender: "Gender",
- birthdate: "Birthdate",
- placeofbirth: "Place of birth",
- nationality: "Nationality",
- nationalid: "National ID",
- nationaldoctype: "National doctype",
- nationaldocid: "National doc ID",
- nationaldocissuedate: "National doc issue date",
- nationaldocexpirydate: "National doc expiry date",
- telephone: "Telephone",
- twitter: "Twitter",
- facebook: "Facebook",
- instagram: "Instagram",
- youtube: "Youtube",
- wechat: "Wechat",
- tiktok: "Tiktok",
- linkedin: "Linkedin",
- vk: "Vk",
- github: "Github",
- telegram: "Telegram",
- qq: "Qq",
- snapchat: "Snapchat",
- reddit: "Reddit",
+ gender: 'Gender',
+ birthdate: 'Birthdate',
+ placeofbirth: 'Place of birth',
+ nationality: 'Nationality',
+ nationalid: 'National ID',
+ nationaldoctype: 'National doctype',
+ nationaldocid: 'National doc ID',
+ nationaldocissuedate: 'National doc issue date',
+ nationaldocexpirydate: 'National doc expiry date',
+ telephone: 'Telephone',
+ twitter: 'Twitter',
+ facebook: 'Facebook',
+ instagram: 'Instagram',
+ youtube: 'Youtube',
+ wechat: 'Wechat',
+ tiktok: 'Tiktok',
+ linkedin: 'Linkedin',
+ vk: 'Vk',
+ github: 'Github',
+ telegram: 'Telegram',
+ qq: 'Qq',
+ snapchat: 'Snapchat',
+ reddit: 'Reddit',
};
diff --git a/src/shared/statusMap.js b/src/shared/statusMap.js
index 964ab00..663cdbd 100644
--- a/src/shared/statusMap.js
+++ b/src/shared/statusMap.js
@@ -1,7 +1,7 @@
-export const statusMap={
- completed:'Completed',
- incorrect:'Incorrect',
+export const statusMap = {
+ completed: 'Completed',
+ incorrect: 'Incorrect',
stored: 'Stored',
blockchained: 'Blockchained',
- processed: 'Processed'
-}
+ processed: 'Processed',
+};
diff --git a/src/store/store.js b/src/store/store.js
index ac83b83..0a658fb 100644
--- a/src/store/store.js
+++ b/src/store/store.js
@@ -3,27 +3,27 @@ import {
makeAutoObservable,
onBecomeObserved,
onBecomeUnobserved,
-} from "mobx";
-import { cryptography } from "@liskhq/lisk-client";
-import { passphrase } from "@liskhq/lisk-client";
-import { getNodeInfo } from "../api/node";
-import { fetchWrapper } from "../shared/fetchWrapper";
-import { labelMap } from "../shared/labelMap";
-import { statusMap } from "../shared/statusMap";
-import { generateSvgAvatar } from "../images/GenerateOnboardingSvg/GenerateSvg";
-import { decryptedData } from "../utils/decryptedData";
+} from 'mobx';
+import { cryptography } from '@liskhq/lisk-client';
+import { passphrase } from '@liskhq/lisk-client';
+import { getNodeInfo } from '../api/node';
+import { fetchWrapper } from '../shared/fetchWrapper';
+import { labelMap } from '../shared/labelMap';
+import { statusMap } from '../shared/statusMap';
+import { generateSvgAvatar } from '../images/GenerateOnboardingSvg/GenerateSvg';
+import { decryptedData } from '../utils/decryptedData';
import {
encryptAccountData,
encryptSharedData,
generateTransaction,
hashAccountData,
-} from "../utils/Utils";
-import sodium from "sodium-universal";
+} from '../utils/Utils';
+import sodium from 'sodium-universal';
class Store {
_accountData = [];
- _passPhrase = "";
+ _passPhrase = '';
_nodeInfo = {};
@@ -63,18 +63,18 @@ class Store {
() => this.address,
() => this.fetchAccountInfo()
);
- onBecomeObserved(this, "decryptedAccountData", () =>
+ onBecomeObserved(this, 'decryptedAccountData', () =>
this.fetchNewAccountData()
);
- onBecomeUnobserved(this, "decryptedAccountData", () =>
+ onBecomeUnobserved(this, 'decryptedAccountData', () =>
this.unobservedAccountData()
);
- onBecomeObserved(this, "sharedData", () => this.fetchKeysArray());
- onBecomeUnobserved(this, "sharedData", () => this.unobservedSharedData());
- onBecomeObserved(this, "transactionsInfo", () =>
+ onBecomeObserved(this, 'sharedData', () => this.fetchKeysArray());
+ onBecomeUnobserved(this, 'sharedData', () => this.unobservedSharedData());
+ onBecomeObserved(this, 'transactionsInfo', () =>
this.fetchTransactionsInfo()
);
- onBecomeUnobserved(this, "transactionsInfo", () =>
+ onBecomeUnobserved(this, 'transactionsInfo', () =>
this.unobservedTransactionsInfo()
);
@@ -83,7 +83,7 @@ class Store {
fetchVPNServers() {
fetchWrapper
- .getAuth("vpn/servers")
+ .getAuth('vpn/servers')
.then((r) => this.fetchVPNServersSuccess(r));
}
@@ -98,7 +98,7 @@ class Store {
.then((info) => {
this.fetchNodeInfoSuccess(info);
fetchWrapper
- .getAuth("data/private", {
+ .getAuth('data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
})
@@ -120,7 +120,7 @@ class Store {
.then((info) => {
this.fetchNodeInfoSuccess(info);
fetchWrapper
- .getAuth("data/shared/", {
+ .getAuth('data/shared/', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
})
@@ -141,13 +141,13 @@ class Store {
fetchTempTransactions() {
fetchWrapper
- .get("node/transactions")
+ .get('node/transactions')
.then((res) => this.fetchTempTransactionsSuccess(res))
.catch((err) => this.throwError(err));
}
fetchPassPhrase() {
- this._passPhrase = sessionStorage.getItem("passPhrase") || "";
+ this._passPhrase = sessionStorage.getItem('passPhrase') || '';
}
fetchSharedData() {
@@ -170,7 +170,7 @@ class Store {
if (data.length > 0) {
fetchWrapper
.postAuth(
- "data/shared",
+ 'data/shared',
{
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
@@ -187,7 +187,7 @@ class Store {
pushAccountData(data = this.accountData) {
fetchWrapper
.postAuth(
- "data/private",
+ 'data/private',
{
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
@@ -218,7 +218,7 @@ class Store {
if (changed.length !== 0) signedTx = builder.update(changed);
if (signedTx) {
fetchWrapper
- .post("transactions", {}, signedTx)
+ .post('transactions', {}, signedTx)
.then(() => this.fetchTempTransactions())
.catch((err) => this.throwError(err));
this.accountInfo.sequence.nonce++;
@@ -237,7 +237,7 @@ class Store {
if (signedTx) {
fetchWrapper
- .post("transactions", {}, signedTx)
+ .post('transactions', {}, signedTx)
.then(() => this.fetchTempTransactions())
.catch((err) => this.throwError(err));
this.accountInfo.sequence.nonce++;
@@ -259,7 +259,7 @@ class Store {
if (signedTx) {
fetchWrapper
- .post("transactions", {}, signedTx)
+ .post('transactions', {}, signedTx)
.then(() => this.fetchTempTransactions())
.catch((err) => this.throwError(err));
this.accountInfo.sequence.nonce++;
@@ -268,12 +268,12 @@ class Store {
generatePassPhrase() {
this._passPhrase = passphrase.Mnemonic.generateMnemonic();
- sessionStorage.setItem("passPhrase", this._passPhrase);
+ sessionStorage.setItem('passPhrase', this._passPhrase);
}
savePastPassPhrase(phrase) {
this._passPhrase = phrase;
- sessionStorage.setItem("passPhrase", this._passPhrase);
+ sessionStorage.setItem('passPhrase', this._passPhrase);
}
unobservedTransactionsInfo() {
@@ -395,12 +395,12 @@ class Store {
}
get firstName() {
- return this.decryptedAccountData.find((item) => item.key === "firstname")
+ return this.decryptedAccountData.find((item) => item.key === 'firstname')
?.value;
}
get lastName() {
- return this.decryptedAccountData.find((item) => item.key === "secondname")
+ return this.decryptedAccountData.find((item) => item.key === 'secondname')
?.value;
}
@@ -441,27 +441,27 @@ class Store {
let x25519_sk = Buffer.alloc(sodium.crypto_box_SECRETKEYBYTES);
sodium.crypto_sign_ed25519_sk_to_curve25519(
x25519_sk,
- Buffer.from(this.privateKey, "hex")
+ Buffer.from(this.privateKey, 'hex')
);
- return x25519_sk.toString("Base64");
+ return x25519_sk.toString('Base64');
}
get pubKey() {
- return this.addressAndPubKey.publicKey.toString("hex");
+ return this.addressAndPubKey.publicKey.toString('hex');
}
get address() {
- return this.addressAndPubKey.address.toString("hex");
+ return this.addressAndPubKey.address.toString('hex');
}
get tokenKey() {
const stringToSign =
this.nodeInfo.networkIdentifier + this.nodeInfo.lastBlockID;
- if (!stringToSign) return "";
+ if (!stringToSign) return '';
const sign = cryptography
- .signDataWithPassphrase(Buffer.from(stringToSign, "hex"), this.passPhrase)
- .toString("hex");
- return this.pubKey + ":" + sign;
+ .signDataWithPassphrase(Buffer.from(stringToSign, 'hex'), this.passPhrase)
+ .toString('hex');
+ return this.pubKey + ':' + sign;
}
get accountIdentity() {
@@ -608,13 +608,13 @@ class Store {
let amount = this.processedVotes[address];
- if (amount) return "Pending";
+ if (amount) return 'Pending';
amount = this.accountSentVotes[address];
- if (amount) return "Unvote";
+ if (amount) return 'Unvote';
- return "Vote";
+ return 'Vote';
};
return this._delegates.data.map((delegate) => ({
diff --git a/src/tailwind.config.js b/src/tailwind.config.js
index 8fb1079..c0dbde8 100644
--- a/src/tailwind.config.js
+++ b/src/tailwind.config.js
@@ -1,14 +1,12 @@
const plugin = require('tailwindcss/plugin');
module.exports = {
- content: [
- './index.html',
- './src/**/*.{js,jsx,ts,tsx}',
- ],
+ content: ['./index.html', './src/**/*.{js,jsx,ts,tsx}'],
theme: {
extend: {
boxShadow: {
- DEFAULT: '0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.02)',
+ DEFAULT:
+ '0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px 0 rgba(0, 0, 0, 0.02)',
md: '0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.02)',
lg: '0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.01)',
xl: '0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.01)',
@@ -26,7 +24,10 @@ module.exports = {
sm: ['0.875rem', { lineHeight: '1.5715' }],
base: ['1rem', { lineHeight: '1.5', letterSpacing: '-0.01em' }],
lg: ['1.125rem', { lineHeight: '1.5', letterSpacing: '-0.01em' }],
- validateSize: ['1.125rem', { lineHeight: '1.875', letterSpacing: '-0.014em' }],
+ validateSize: [
+ '1.125rem',
+ { lineHeight: '1.875', letterSpacing: '-0.014em' },
+ ],
xl: ['1.25rem', { lineHeight: '1.5', letterSpacing: '-0.01em' }],
'2xl': ['1.5rem', { lineHeight: '1.33', letterSpacing: '-0.01em' }],
'3xl': ['1.88rem', { lineHeight: '1.33', letterSpacing: '-0.01em' }],
@@ -63,7 +64,12 @@ module.exports = {
// add custom variant for expanding sidebar
plugin(({ addVariant, e }) => {
addVariant('sidebar-expanded', ({ modifySelectors, separator }) => {
- modifySelectors(({ className }) => `.sidebar-expanded .${e(`sidebar-expanded${separator}${className}`)}`);
+ modifySelectors(
+ ({ className }) =>
+ `.sidebar-expanded .${e(
+ `sidebar-expanded${separator}${className}`
+ )}`
+ );
});
}),
],
diff --git a/src/utils/Schemas.js b/src/utils/Schemas.js
index 7c19235..964b2c1 100644
--- a/src/utils/Schemas.js
+++ b/src/utils/Schemas.js
@@ -1,31 +1,31 @@
export const IdentityModuleSchema = {
- $id: "idntty/identity/module",
- title: "Identity module account schema",
- type: "object",
+ $id: 'idntty/identity/module',
+ title: 'Identity module account schema',
+ type: 'object',
properties: {
features: {
fieldNumber: 1,
- type: "array",
+ type: 'array',
maxItems: 256,
items: {
- type: "object",
- required: ["label", "value"],
+ type: 'object',
+ required: ['label', 'value'],
properties: {
- label: { fieldNumber: 1, dataType: "string" },
- value: { fieldNumber: 2, dataType: "bytes" },
+ label: { fieldNumber: 1, dataType: 'string' },
+ value: { fieldNumber: 2, dataType: 'bytes' },
},
},
},
verifications: {
fieldNumber: 2,
- type: "array",
+ type: 'array',
items: {
- type: "object",
- required: ["label", "account", "tx"],
+ type: 'object',
+ required: ['label', 'account', 'tx'],
properties: {
- label: { fieldNumber: 1, dataType: "string" },
- account: { fieldNumber: 2, dataType: "bytes" },
- tx: { fieldNumber: 3, dataType: "bytes" },
+ label: { fieldNumber: 1, dataType: 'string' },
+ account: { fieldNumber: 2, dataType: 'bytes' },
+ tx: { fieldNumber: 3, dataType: 'bytes' },
},
},
},
@@ -34,22 +34,22 @@ export const IdentityModuleSchema = {
};
export const setFeatureAssetSchema = {
- $id: "idntty/identity/setfeature",
- title: "Asset schema to set or update account features for identity module",
- type: "object",
- required: ["features"],
+ $id: 'idntty/identity/setfeature',
+ title: 'Asset schema to set or update account features for identity module',
+ type: 'object',
+ required: ['features'],
properties: {
features: {
fieldNumber: 1,
- type: "array",
+ type: 'array',
minItems: 1,
maxItems: 16,
items: {
- type: "object",
- required: ["label", "value"],
+ type: 'object',
+ required: ['label', 'value'],
properties: {
- label: { fieldNumber: 1, dataType: "string", maxLength: 16 },
- value: { fieldNumber: 2, dataType: "bytes", maxLength: 32 },
+ label: { fieldNumber: 1, dataType: 'string', maxLength: 16 },
+ value: { fieldNumber: 2, dataType: 'bytes', maxLength: 32 },
},
},
},
@@ -57,21 +57,21 @@ export const setFeatureAssetSchema = {
};
export const removeFeatureAssetSchema = {
- $id: "idntty/identity/removefeature",
- title: "Asset schema to remove account features for identity module",
- type: "object",
- required: ["features"],
+ $id: 'idntty/identity/removefeature',
+ title: 'Asset schema to remove account features for identity module',
+ type: 'object',
+ required: ['features'],
properties: {
features: {
fieldNumber: 1,
- type: "array",
+ type: 'array',
minItems: 1,
maxItems: 16,
items: {
- type: "object",
- required: ["label"],
+ type: 'object',
+ required: ['label'],
properties: {
- label: { fieldNumber: 1, dataType: "string", maxLength: 16 },
+ label: { fieldNumber: 1, dataType: 'string', maxLength: 16 },
},
},
},
@@ -79,28 +79,28 @@ export const removeFeatureAssetSchema = {
};
export const validateFeatureAssetSchema = {
- $id: "idntty/identity/validatefeature",
- title: "Asset schema to validate account features for identity module",
- type: "object",
- required: ["recipientAddress", "features"],
+ $id: 'idntty/identity/validatefeature',
+ title: 'Asset schema to validate account features for identity module',
+ type: 'object',
+ required: ['recipientAddress', 'features'],
properties: {
recipientAddress: {
fieldNumber: 1,
- dataType: "bytes",
+ dataType: 'bytes',
minLength: 20,
maxLength: 20,
},
features: {
fieldNumber: 2,
- type: "array",
+ type: 'array',
minItems: 1,
maxItems: 16,
items: {
- type: "object",
- required: ["label", "value"],
+ type: 'object',
+ required: ['label', 'value'],
properties: {
- label: { fieldNumber: 1, dataType: "string", maxLength: 16 },
- value: { fieldNumber: 2, dataType: "bytes", maxLength: 32 },
+ label: { fieldNumber: 1, dataType: 'string', maxLength: 16 },
+ value: { fieldNumber: 2, dataType: 'bytes', maxLength: 32 },
},
},
},
@@ -108,27 +108,27 @@ export const validateFeatureAssetSchema = {
};
export const invalidateFeatureAssetSchema = {
- $id: "idntty/identity/invalidatefeature",
- title: "Asset schema to invalidate account features for identity module",
- type: "object",
- required: ["recipientAddress", "features"],
+ $id: 'idntty/identity/invalidatefeature',
+ title: 'Asset schema to invalidate account features for identity module',
+ type: 'object',
+ required: ['recipientAddress', 'features'],
properties: {
recipientAddress: {
fieldNumber: 1,
- dataType: "bytes",
+ dataType: 'bytes',
minLength: 20,
maxLength: 20,
},
features: {
fieldNumber: 2,
- type: "array",
+ type: 'array',
minItems: 1,
maxItems: 16,
items: {
- type: "object",
- required: ["label"],
+ type: 'object',
+ required: ['label'],
properties: {
- label: { fieldNumber: 1, dataType: "string", maxLength: 16 },
+ label: { fieldNumber: 1, dataType: 'string', maxLength: 16 },
},
},
},
@@ -136,26 +136,26 @@ export const invalidateFeatureAssetSchema = {
};
export const voteDelegateAssetSchema = {
- $id: "lisk/dpos/vote",
- type: "object",
- required: ["votes"],
+ $id: 'lisk/dpos/vote',
+ type: 'object',
+ required: ['votes'],
properties: {
votes: {
- type: "array",
+ type: 'array',
minItems: 1,
maxItems: 20,
items: {
- type: "object",
- required: ["delegateAddress", "amount"],
+ type: 'object',
+ required: ['delegateAddress', 'amount'],
properties: {
delegateAddress: {
- dataType: "bytes",
+ dataType: 'bytes',
fieldNumber: 1,
minLength: 20,
maxLength: 20,
},
amount: {
- dataType: "sint64",
+ dataType: 'sint64',
fieldNumber: 2,
},
},
@@ -166,30 +166,30 @@ export const voteDelegateAssetSchema = {
};
export const unlockDelegateAssetSchema = {
- $id: "lisk/dpos/unlock",
- type: "object",
- required: ["unlockObjects"],
+ $id: 'lisk/dpos/unlock',
+ type: 'object',
+ required: ['unlockObjects'],
properties: {
unlockObjects: {
- type: "array",
+ type: 'array',
minItems: 1,
maxItems: 20,
items: {
- type: "object",
- required: ["delegateAddress", "amount", "unvoteHeight"],
+ type: 'object',
+ required: ['delegateAddress', 'amount', 'unvoteHeight'],
properties: {
delegateAddress: {
- dataType: "bytes",
+ dataType: 'bytes',
fieldNumber: 1,
minLength: 20,
maxLength: 20,
},
amount: {
- dataType: "uint64",
+ dataType: 'uint64',
fieldNumber: 2,
},
unvoteHeight: {
- dataType: "uint32",
+ dataType: 'uint32',
fieldNumber: 3,
},
},
diff --git a/src/utils/Transition.jsx b/src/utils/Transition.jsx
index 74dd22f..3ec8bc4 100644
--- a/src/utils/Transition.jsx
+++ b/src/utils/Transition.jsx
@@ -3,13 +3,13 @@ import { CSSTransition as ReactCSSTransition } from 'react-transition-group';
const TransitionContext = React.createContext({
parent: {},
-})
+});
function useIsInitialRender() {
const isInitialRender = useRef(true);
useEffect(() => {
isInitialRender.current = false;
- }, [])
+ }, []);
return isInitialRender.current;
}
@@ -53,34 +53,40 @@ function CSSTransition({
unmountOnExit={removeFromDom}
in={show}
addEndListener={(done) => {
- nodeRef.current.addEventListener('transitionend', done, false)
+ nodeRef.current.addEventListener('transitionend', done, false);
}}
onEnter={() => {
if (!removeFromDom) nodeRef.current.style.display = null;
- addClasses(nodeRef.current, [...enterClasses, ...enterStartClasses])
+ addClasses(nodeRef.current, [...enterClasses, ...enterStartClasses]);
}}
onEntering={() => {
- removeClasses(nodeRef.current, enterStartClasses)
- addClasses(nodeRef.current, enterEndClasses)
+ removeClasses(nodeRef.current, enterStartClasses);
+ addClasses(nodeRef.current, enterEndClasses);
}}
onEntered={() => {
- removeClasses(nodeRef.current, [...enterEndClasses, ...enterClasses])
+ removeClasses(nodeRef.current, [...enterEndClasses, ...enterClasses]);
}}
onExit={() => {
- addClasses(nodeRef.current, [...leaveClasses, ...leaveStartClasses])
+ addClasses(nodeRef.current, [...leaveClasses, ...leaveStartClasses]);
}}
onExiting={() => {
- removeClasses(nodeRef.current, leaveStartClasses)
- addClasses(nodeRef.current, leaveEndClasses)
+ removeClasses(nodeRef.current, leaveStartClasses);
+ addClasses(nodeRef.current, leaveEndClasses);
}}
onExited={() => {
- removeClasses(nodeRef.current, [...leaveEndClasses, ...leaveClasses])
+ removeClasses(nodeRef.current, [...leaveEndClasses, ...leaveClasses]);
if (!removeFromDom) nodeRef.current.style.display = 'none';
}}
>
-
{children}
+
+ {children}
+
- )
+ );
}
function Transition({ show, appear, ...rest }) {
@@ -95,7 +101,7 @@ function Transition({ show, appear, ...rest }) {
show={parent.show}
{...rest}
/>
- )
+ );
}
return (
@@ -110,7 +116,7 @@ function Transition({ show, appear, ...rest }) {
>
- )
+ );
}
-export default Transition;
\ No newline at end of file
+export default Transition;
diff --git a/src/utils/Utils.js b/src/utils/Utils.js
index 7b77d5f..44cf4de 100644
--- a/src/utils/Utils.js
+++ b/src/utils/Utils.js
@@ -1,17 +1,17 @@
-import resolveConfig from "tailwindcss/resolveConfig";
-import { cryptography, transactions } from "@liskhq/lisk-client";
+import resolveConfig from 'tailwindcss/resolveConfig';
+import { cryptography, transactions } from '@liskhq/lisk-client';
import {
removeFeatureAssetSchema,
setFeatureAssetSchema,
unlockDelegateAssetSchema,
validateFeatureAssetSchema,
voteDelegateAssetSchema,
-} from "./Schemas";
-import { statusMap } from "../shared/statusMap";
+} from './Schemas';
+import { statusMap } from '../shared/statusMap';
export const tailwindConfig = () => {
// Tailwind config
- return resolveConfig("./src/tailwind.config.js");
+ return resolveConfig('./src/tailwind.config.js');
};
export const hexToRGB = (h) => {
@@ -31,17 +31,17 @@ export const hexToRGB = (h) => {
};
export const formatValue = (value) =>
- Intl.NumberFormat("en-US", {
- style: "currency",
- currency: "USD",
+ Intl.NumberFormat('en-US', {
+ style: 'currency',
+ currency: 'USD',
maximumSignificantDigits: 3,
- notation: "compact",
+ notation: 'compact',
}).format(value);
export const formatThousands = (value) =>
- Intl.NumberFormat("en-US", {
+ Intl.NumberFormat('en-US', {
maximumSignificantDigits: 3,
- notation: "compact",
+ notation: 'compact',
}).format(value);
export const formatAddressBig = (address) =>
@@ -50,12 +50,12 @@ export const formatAddressBig = (address) =>
address.length - 4
)} ${address.slice(address.length - 4)}`;
-export const encryptAccountData = (data = [], passPhrase = "", pubKey = "") => {
+export const encryptAccountData = (data = [], passPhrase = '', pubKey = '') => {
return data
.filter((item) => item.status !== statusMap.blockchained)
.map((item) => {
let value = cryptography.encryptMessageWithPassphrase(
- item.seed + ":" + item.value,
+ item.seed + ':' + item.value,
passPhrase,
pubKey
);
@@ -68,12 +68,12 @@ export const encryptAccountData = (data = [], passPhrase = "", pubKey = "") => {
});
};
-export const encryptSharedData = (data = [], passPhrase = "", pubKey = "") => {
+export const encryptSharedData = (data = [], passPhrase = '', pubKey = '') => {
return data.map((item) => {
let value = cryptography.encryptMessageWithPassphrase(
- item.seed + ":" + item.value,
+ item.seed + ':' + item.value,
passPhrase,
- Buffer.from(pubKey, "hex")
+ Buffer.from(pubKey, 'hex')
);
return {
label: item.key,
@@ -111,8 +111,8 @@ export const hashAccountData = (data = [], oldData = [], hashMap = {}) => {
const changed = data.reduce((acc, item) => {
if (!oldAccountMap[item.label]) return [...acc, item];
const oldValue = hashMap[item.key];
- const newValue = hashValue(item.value, item.seed).toString("hex");
- if (oldValue !== newValue && item.status === "new") return [...acc, item];
+ const newValue = hashValue(item.value, item.seed).toString('hex');
+ if (oldValue !== newValue && item.status === 'new') return [...acc, item];
return acc;
}, []);
return [
@@ -128,22 +128,22 @@ export const hashAccountData = (data = [], oldData = [], hashMap = {}) => {
};
export const jsonReplacer = (key, value) => {
- if (key === "big") {
+ if (key === 'big') {
return value.toString();
}
return value;
};
-export const hashValue = (value = "", seed = "") =>
+export const hashValue = (value = '', seed = '') =>
cryptography.hash(
- Buffer.concat([Buffer.from(seed, "utf8"), cryptography.hash(value, "utf8")])
+ Buffer.concat([Buffer.from(seed, 'utf8'), cryptography.hash(value, 'utf8')])
);
export const generateTransaction = (
nonce = BigInt(0),
- senderPublicKey = "",
- networkIdentifier = "",
- passPhrase = "",
+ senderPublicKey = '',
+ networkIdentifier = '',
+ passPhrase = '',
fee = BigInt(500000)
) => {
return {
@@ -202,9 +202,9 @@ export const generateTransaction = (
export const generateSetTransaction = (
features,
nonce = BigInt(0),
- senderPublicKey = "",
- networkIdentifier = "",
- passPhrase = "",
+ senderPublicKey = '',
+ networkIdentifier = '',
+ passPhrase = '',
fee = BigInt(500000)
) => {
const tx = {
@@ -223,15 +223,15 @@ export const generateSetTransaction = (
const signedTx = transactions.signTransaction(
setFeatureAssetSchema,
tx,
- Buffer.from(networkIdentifier, "hex"),
+ Buffer.from(networkIdentifier, 'hex'),
passPhrase
);
- signedTx.senderPublicKey = signedTx.senderPublicKey.toString("hex");
- signedTx.signatures[0] = signedTx.signatures[0].toString("hex");
+ signedTx.senderPublicKey = signedTx.senderPublicKey.toString('hex');
+ signedTx.signatures[0] = signedTx.signatures[0].toString('hex');
signedTx.asset.features = signedTx.asset.features.map((feature) => ({
...feature,
- value: feature.value.toString("hex"),
+ value: feature.value.toString('hex'),
}));
delete signedTx.id;
@@ -242,9 +242,9 @@ export const generateSetTransaction = (
export const generateRemoveTransaction = (
features,
nonce = BigInt(0),
- senderPublicKey = "",
- networkIdentifier = "",
- passPhrase = "",
+ senderPublicKey = '',
+ networkIdentifier = '',
+ passPhrase = '',
fee = BigInt(500000)
) => {
const tx = {
@@ -260,12 +260,12 @@ export const generateRemoveTransaction = (
const signedTx = transactions.signTransaction(
removeFeatureAssetSchema,
tx,
- Buffer.from(networkIdentifier, "hex"),
+ Buffer.from(networkIdentifier, 'hex'),
passPhrase
);
- signedTx.senderPublicKey = signedTx.senderPublicKey.toString("hex");
- signedTx.signatures[0] = signedTx.signatures[0].toString("hex");
+ signedTx.senderPublicKey = signedTx.senderPublicKey.toString('hex');
+ signedTx.signatures[0] = signedTx.signatures[0].toString('hex');
delete signedTx.id;
@@ -275,21 +275,21 @@ export const generateRemoveTransaction = (
const generateValidateTransaction = (
features,
nonce = BigInt(0),
- senderPublicKey = "",
- networkIdentifier = "",
- passPhrase = "",
+ senderPublicKey = '',
+ networkIdentifier = '',
+ passPhrase = '',
fee = BigInt(500000),
- recipientAddress = ""
+ recipientAddress = ''
) => {
const tx = {
moduleID: 1001,
assetID: 11,
nonce,
- senderPublicKey: Buffer.from(senderPublicKey, "hex"),
+ senderPublicKey: Buffer.from(senderPublicKey, 'hex'),
fee,
asset: {
features,
- recipientAddress: Buffer.from(recipientAddress, "hex"),
+ recipientAddress: Buffer.from(recipientAddress, 'hex'),
},
};
@@ -298,17 +298,17 @@ const generateValidateTransaction = (
const signedTx = transactions.signTransaction(
validateFeatureAssetSchema,
tx,
- Buffer.from(networkIdentifier, "hex"),
+ Buffer.from(networkIdentifier, 'hex'),
passPhrase
);
- signedTx.senderPublicKey = signedTx.senderPublicKey.toString("hex");
+ signedTx.senderPublicKey = signedTx.senderPublicKey.toString('hex');
signedTx.asset.recipientAddress =
- signedTx.asset.recipientAddress.toString("hex");
- signedTx.signatures[0] = signedTx.signatures[0].toString("hex");
+ signedTx.asset.recipientAddress.toString('hex');
+ signedTx.signatures[0] = signedTx.signatures[0].toString('hex');
signedTx.asset.features = signedTx.asset.features.map((feature) => ({
...feature,
- value: feature.value.toString("hex"),
+ value: feature.value.toString('hex'),
}));
delete signedTx.id;
@@ -318,23 +318,23 @@ const generateValidateTransaction = (
const generateVoteTransaction = (
nonce = BigInt(0),
- senderPublicKey = "",
- networkIdentifier = "",
- passPhrase = "",
+ senderPublicKey = '',
+ networkIdentifier = '',
+ passPhrase = '',
fee = BigInt(500000),
- delegateAddress = "",
+ delegateAddress = '',
amount = 0n
) => {
const tx = {
moduleID: 5,
assetID: 1,
nonce,
- senderPublicKey: Buffer.from(senderPublicKey, "hex"),
+ senderPublicKey: Buffer.from(senderPublicKey, 'hex'),
fee,
asset: {
votes: [
{
- delegateAddress: Buffer.from(delegateAddress, "hex"),
+ delegateAddress: Buffer.from(delegateAddress, 'hex'),
amount: amount * 100000000n,
},
],
@@ -344,15 +344,15 @@ const generateVoteTransaction = (
const signedTx = transactions.signTransaction(
voteDelegateAssetSchema,
tx,
- Buffer.from(networkIdentifier, "hex"),
+ Buffer.from(networkIdentifier, 'hex'),
passPhrase
);
- signedTx.senderPublicKey = signedTx.senderPublicKey.toString("hex");
- signedTx.signatures[0] = signedTx.signatures[0].toString("hex");
+ signedTx.senderPublicKey = signedTx.senderPublicKey.toString('hex');
+ signedTx.signatures[0] = signedTx.signatures[0].toString('hex');
signedTx.asset.votes = signedTx.asset.votes.map((vote) => ({
...vote,
- delegateAddress: vote.delegateAddress.toString("hex"),
+ delegateAddress: vote.delegateAddress.toString('hex'),
}));
delete signedTx.id;
@@ -362,11 +362,11 @@ const generateVoteTransaction = (
const generateUnlockTransaction = (
nonce = BigInt(0),
- senderPublicKey = "",
- networkIdentifier = "",
- passPhrase = "",
+ senderPublicKey = '',
+ networkIdentifier = '',
+ passPhrase = '',
fee = BigInt(500000),
- delegateAddress = "",
+ delegateAddress = '',
amount = 0n,
unvoteHeight = 0
) => {
@@ -374,12 +374,12 @@ const generateUnlockTransaction = (
moduleID: 5,
assetID: 2,
nonce,
- senderPublicKey: Buffer.from(senderPublicKey, "hex"),
+ senderPublicKey: Buffer.from(senderPublicKey, 'hex'),
fee,
asset: {
unlockObjects: [
{
- delegateAddress: Buffer.from(delegateAddress, "hex"),
+ delegateAddress: Buffer.from(delegateAddress, 'hex'),
amount: amount * 100000000n,
unvoteHeight,
},
@@ -390,15 +390,15 @@ const generateUnlockTransaction = (
const signedTx = transactions.signTransaction(
unlockDelegateAssetSchema,
tx,
- Buffer.from(networkIdentifier, "hex"),
+ Buffer.from(networkIdentifier, 'hex'),
passPhrase
);
- signedTx.senderPublicKey = signedTx.senderPublicKey.toString("hex");
- signedTx.signatures[0] = signedTx.signatures[0].toString("hex");
+ signedTx.senderPublicKey = signedTx.senderPublicKey.toString('hex');
+ signedTx.signatures[0] = signedTx.signatures[0].toString('hex');
signedTx.asset.unlockObjects = signedTx.asset.unlockObjects.map((vote) => ({
...vote,
- delegateAddress: vote.delegateAddress.toString("hex"),
+ delegateAddress: vote.delegateAddress.toString('hex'),
}));
delete signedTx.id;
diff --git a/src/utils/decryptedData.js b/src/utils/decryptedData.js
index 5d261f0..ce23cc8 100644
--- a/src/utils/decryptedData.js
+++ b/src/utils/decryptedData.js
@@ -1,54 +1,81 @@
-import {labelMap} from "../shared/labelMap";
-import {statusMap} from "../shared/statusMap";
-import {cryptography} from "@liskhq/lisk-client";
+import { labelMap } from '../shared/labelMap';
+import { statusMap } from '../shared/statusMap';
+import { cryptography } from '@liskhq/lisk-client';
-export const decryptedData=(serverData, blockchainData, passPhrase, pubKey, processedFeatures)=>{
- const allAccountData=serverData.concat(blockchainData.filter(item=>!serverData.find(elem=>elem.label===item.label)))
+export const decryptedData = (
+ serverData,
+ blockchainData,
+ passPhrase,
+ pubKey,
+ processedFeatures
+) => {
+ const allAccountData = serverData.concat(
+ blockchainData.filter(
+ (item) => !serverData.find((elem) => elem.label === item.label)
+ )
+ );
return allAccountData.map((elem) => {
- const initialData={
+ const initialData = {
...elem,
key: elem.label,
label: labelMap[elem.label] || elem.label,
status: '',
value: '',
- seed: ''
- }
- if(processedFeatures[elem.label])
+ seed: '',
+ };
+ if (processedFeatures[elem.label])
return {
...initialData,
status: statusMap.processed,
value: elem.value,
- }
- if(!serverData.find(item=>item.label===elem.label)) {
+ };
+ if (!serverData.find((item) => item.label === elem.label)) {
return {
...initialData,
status: statusMap.blockchained,
- value: elem.value
- }
+ value: elem.value,
+ };
}
- const [seed, value] = cryptography.decryptMessageWithPassphrase(elem.value, elem.value_nonce, passPhrase, pubKey).split(':');
- const hashValue=cryptography.hash(Buffer.concat([Buffer.from(seed, 'utf8'), cryptography.hash(value, 'utf8')])).toString('hex')
- if(!blockchainData.find(item=>item.label===elem.label)) {
+ const [seed, value] = cryptography
+ .decryptMessageWithPassphrase(
+ elem.value,
+ elem.value_nonce,
+ passPhrase,
+ pubKey
+ )
+ .split(':');
+ const hashValue = cryptography
+ .hash(
+ Buffer.concat([
+ Buffer.from(seed, 'utf8'),
+ cryptography.hash(value, 'utf8'),
+ ])
+ )
+ .toString('hex');
+ if (!blockchainData.find((item) => item.label === elem.label)) {
return {
...initialData,
status: statusMap.stored,
value,
- seed
- }
+ seed,
+ };
}
- if(blockchainData.find(item=>item.label===elem.label).value!==hashValue) {
+ if (
+ blockchainData.find((item) => item.label === elem.label).value !==
+ hashValue
+ ) {
return {
...initialData,
status: statusMap.incorrect,
value,
- seed
- }
+ seed,
+ };
}
return {
...initialData,
status: statusMap.completed,
value,
- seed
- }
- })
-}
+ seed,
+ };
+ });
+};
diff --git a/src/utils/test.js b/src/utils/test.js
index 799eaf1..65ab057 100644
--- a/src/utils/test.js
+++ b/src/utils/test.js
@@ -1,31 +1,50 @@
-import {cryptography, passphrase} from "@liskhq/lisk-client";
-import sodium from 'sodium-universal';
-
-let passphrase1 = passphrase.Mnemonic.generateMnemonic();
-const keys = cryptography.getPrivateAndPublicKeyFromPassphrase(passphrase1);
-console.log('IDNTTY Public & Private keys(hex):');
-console.log('publicKey:', keys.publicKey.length, keys.publicKey.toString('hex'));
-console.log('privateKey:', keys.privateKey.length, keys.privateKey.toString('hex'));
-
-console.log('');
-console.log('SODIUM Public & Private keys(hex):');
-
-let pk = Buffer.alloc(sodium.crypto_sign_PUBLICKEYBYTES);
-let sk = Buffer.alloc(sodium.crypto_sign_SECRETKEYBYTES);
-
-let x25519_sk = Buffer.alloc(sodium.crypto_box_SECRETKEYBYTES);
-let x25519_pk = Buffer.alloc(sodium.crypto_box_PUBLICKEYBYTES);
-
-sodium.crypto_sign_seed_keypair(pk, sk, cryptography.hash(Buffer.from(passphrase1, 'UTF-8')));
-
-sodium.crypto_sign_ed25519_sk_to_curve25519(x25519_sk, sk);
-sodium.crypto_sign_ed25519_pk_to_curve25519(x25519_pk, pk)
-
-console.log('Public & Private keys(hex):');
-console.log('publicKey:', pk.length, pk.toString('hex'));
-console.log('privateKey:', sk.length, sk.toString('hex'));
-console.log('');
-
-console.log('x25519_sk privateKey:', x25519_sk.length, x25519_sk.toString('Base64'));
-console.log('x25519_pk publicKey:', x25519_pk.length, x25519_pk.toString('Base64'));
-
+import { cryptography, passphrase } from '@liskhq/lisk-client';
+import sodium from 'sodium-universal';
+
+let passphrase1 = passphrase.Mnemonic.generateMnemonic();
+const keys = cryptography.getPrivateAndPublicKeyFromPassphrase(passphrase1);
+console.log('IDNTTY Public & Private keys(hex):');
+console.log(
+ 'publicKey:',
+ keys.publicKey.length,
+ keys.publicKey.toString('hex')
+);
+console.log(
+ 'privateKey:',
+ keys.privateKey.length,
+ keys.privateKey.toString('hex')
+);
+
+console.log('');
+console.log('SODIUM Public & Private keys(hex):');
+
+let pk = Buffer.alloc(sodium.crypto_sign_PUBLICKEYBYTES);
+let sk = Buffer.alloc(sodium.crypto_sign_SECRETKEYBYTES);
+
+let x25519_sk = Buffer.alloc(sodium.crypto_box_SECRETKEYBYTES);
+let x25519_pk = Buffer.alloc(sodium.crypto_box_PUBLICKEYBYTES);
+
+sodium.crypto_sign_seed_keypair(
+ pk,
+ sk,
+ cryptography.hash(Buffer.from(passphrase1, 'UTF-8'))
+);
+
+sodium.crypto_sign_ed25519_sk_to_curve25519(x25519_sk, sk);
+sodium.crypto_sign_ed25519_pk_to_curve25519(x25519_pk, pk);
+
+console.log('Public & Private keys(hex):');
+console.log('publicKey:', pk.length, pk.toString('hex'));
+console.log('privateKey:', sk.length, sk.toString('hex'));
+console.log('');
+
+console.log(
+ 'x25519_sk privateKey:',
+ x25519_sk.length,
+ x25519_sk.toString('Base64')
+);
+console.log(
+ 'x25519_pk publicKey:',
+ x25519_pk.length,
+ x25519_pk.toString('Base64')
+);