Add method for get passPhrase and generation hex for account logo

This commit is contained in:
DwCay
2022-06-18 16:50:32 +03:00
parent 0da68ddd63
commit bfdddee46a
7 changed files with 74 additions and 46 deletions

View File

@@ -1,22 +1,41 @@
import { reaction, makeAutoObservable } from "mobx";
import {cryptography} from "@liskhq/lisk-client";
class RegistrationStore {
_accountData = {};
_accountData = {}
_passPhraseStore=''
_pubKey = ''
constructor() {
makeAutoObservable(this);
reaction(() => this.accountData, () => this.saveDataRegistration())
reaction(()=>this.passPhraseStore, ()=>this.savePubKey())
};
savePassPhrase(phrase) {
this._passPhraseStore = phrase
}
saveDataRegistration(data) {
this._accountData = data;
};
savePubKey() {
this._pubKey = cryptography.bufferToHex(cryptography.getAddressAndPublicKeyFromPassphrase(this.passPhraseStore).publicKey)
}
accountData() {
get passPhraseStore() {
return this._passPhraseStore
}
get accountData() {
return this._accountData
};
get pubKey() {
return this._pubKey
}
};
export const registrationStore = new RegistrationStore();