fix header mistake

This commit is contained in:
kandrusyak
2022-12-01 16:21:02 +03:00
parent a8bb75b2f5
commit 3e8a0e2233

View File

@@ -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,10 @@ class Store {
fetchVPNServers() {
fetchWrapper
.getAuth('vpn/servers')
.getAuth("vpn/servers", {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
})
.then((r) => this.fetchVPNServersSuccess(r));
}
@@ -98,7 +101,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 +123,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 +144,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 +173,7 @@ class Store {
if (data.length > 0) {
fetchWrapper
.postAuth(
'data/shared',
"data/shared",
{
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
@@ -187,7 +190,7 @@ class Store {
pushAccountData(data = this.accountData) {
fetchWrapper
.postAuth(
'data/private',
"data/private",
{
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID,
@@ -218,7 +221,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 +240,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 +262,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 +271,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 +398,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 +444,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 +611,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) => ({