Merge branch 'master' into DID-9

This commit is contained in:
Kirill Andrusyak
2022-07-15 12:09:19 +03:00
committed by GitHub
8 changed files with 170 additions and 301 deletions

View File

@@ -13,6 +13,8 @@ class Store {
_userData = {}
_keysArray = []
_transactionsInfo = {}
constructor() {
makeAutoObservable(this);
@@ -20,6 +22,8 @@ class Store {
this.fetchNodeInfo()
reaction(() => this.tokenKey, () => this.getData())
reaction(() => this.tokenKey, () => this.fetchNewAccountData())
reaction(() => this.tokenKey, () => this.fetchTransactionsInfo())
};
getData() {
@@ -47,6 +51,17 @@ class Store {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}).then((res) => this.keysArrayFetchChange(res))
fetchTransactionsInfo() {
fetchWrapper.getAuth(`http://3.125.47.101/api/account/transactions/${this.accountMadeTransaction}?moduleID=1001&assetID=11`, {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
})
.then((res)=>this.saveInfoTransactions(res))
}
get accountMadeTransaction() {
return "b444b7ff3118cf2a30cbd54cfcdb8fd5d805017a"
}
userDataFetchChange(res) {
@@ -65,6 +80,10 @@ class Store {
return this._userData;
}
get transactionsInfo() {
return this._transactionsInfo
}
savePassPhrase(phrase) {
this._passPhrase = phrase
}
@@ -73,6 +92,10 @@ class Store {
this._accountData = data;
};
saveInfoTransactions(transaction) {
this._transactionsInfo = transaction
}
fetchNodeInfo() {
getNodeInfo()
.then((info) => this.fetchNodeInfoSuccess(info))

View File

@@ -0,0 +1,51 @@
import {makeAutoObservable, reaction} from "mobx";
import {registrationStore} from "./store";
import User05 from "../../src/images/user-28-05.jpg";
import User08 from "../../src/images/user-28-08.jpg";
import User09 from "../../src/images/user-28-09.jpg";
import User06 from "../../src/images/user-28-06.jpg";
const labelMap = {
firstname: 'First name',
secondname: 'Second name',
gender: "Gender",
birthdate: "Birthdate"
};
const usersImages = [User08,User06,User05,User09];
class TransactionsStore {
_transactionsData = [];
constructor() {
makeAutoObservable(this)
reaction(() => ({data: registrationStore.transactionsInfo}), ({data}) => {
this._transactionsData = data.data;
})
}
get transactionsData() {
return this._transactionsData.map(item=>{
return {
id: item.id,
users_images: usersImages.map(image=>{
return {
image: image,
size: 24
}
}),
transaction: item.asset.features.map(asset=>{
return {
transaction_id: item.id,
address: registrationStore.accountMadeTransaction,
value: asset.value,
label: labelMap[asset.label],
}
})
}
})
}
}
export const transactionsStore = new TransactionsStore()