From 011b1a00ae46af71bcb57d4e8323d5303ec1935d Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 26 Apr 2023 17:02:00 +0700 Subject: [PATCH 001/315] apply indexer v2 for block --- .../core/data-services/environment.service.ts | 3 + src/app/core/services/block.service.ts | 113 +++++++++++++++--- src/app/core/utils/common/info-common.ts | 19 +++ src/app/global/global.ts | 16 +-- .../block-detail/block-detail.component.ts | 19 ++- src/app/pages/blocks/blocks.component.ts | 9 +- .../pages/dashboard/dashboard.component.ts | 7 +- .../validators-detail.component.ts | 11 +- src/assets/config/config.json | 3 +- 9 files changed, 151 insertions(+), 49 deletions(-) diff --git a/src/app/core/data-services/environment.service.ts b/src/app/core/data-services/environment.service.ts index da88172dc..83a6d2a22 100644 --- a/src/app/core/data-services/environment.service.ts +++ b/src/app/core/data-services/environment.service.ts @@ -15,6 +15,7 @@ export interface IConfiguration { coins: any; env: string; indexerUri: string; + graphUrl: string; timeInterval: number; } @@ -32,6 +33,7 @@ export class EnvironmentService { coins: '', env: '', indexerUri: '', + graphUrl:'', timeInterval: null }); @@ -61,6 +63,7 @@ export class EnvironmentService { coins: config['coins'], env: config['env'], indexerUri: config['urlIndexer'], + graphUrl: config['graphUrl'], timeInterval: config['timeInterval'] || 4000, }; diff --git a/src/app/core/services/block.service.ts b/src/app/core/services/block.service.ts index ed4e31c6f..ad181f821 100644 --- a/src/app/core/services/block.service.ts +++ b/src/app/core/services/block.service.ts @@ -2,7 +2,9 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import * as _ from 'lodash'; import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { EnvironmentService } from '../data-services/environment.service'; +import { checkEnvQuery } from '../utils/common/info-common'; import { CommonService } from './common.service'; @Injectable() @@ -10,26 +12,12 @@ export class BlockService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; + graphUrl = `${this.environmentService.configValue.graphUrl}`; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); } - blocksIndexer(pageLimit: string | number, blockHeight = null): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - pageLimit, - blockHeight, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/block`, { - params, - }); - } - blockWithOperator(pageLimit: string | number, operatorAddress: string, nextKey = null): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -51,4 +39,99 @@ export class BlockService extends CommonService { const date = new Date(); return this.http.get(`${this.apiUrl}/metrics/transactions?range=${type}&timezone=${date.getTimezoneOffset()}`); } + + getBlockWithOperator(height) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query getBlockDetail($height: Int) { + ${envDB} { + block(where: {validator: {operator_address: {_eq: $address}}}, order_by: {time: desc}, limit: 100) { + height + hash + time + data(path: "block") + validator { + operator_address + description + } + transactions { + gas_used + gas_wanted + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + height: height, + }, + operationName: 'getBlockDetail', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + } + + getListBlock(limit) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query getListBlocks($limit: Int) { + ${envDB} { + block(limit: $limit, order_by: {time: desc}) { + height + hash + time + data(path: "block") + validator { + operator_address + description + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: limit, + }, + operationName: 'getListBlocks', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + } + + getBlockDetail(height) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query getBlockDetail($height: Int) { + ${envDB} { + block(where: {height: {_eq: $height}}) { + height + hash + time + data(path: "block") + validator { + operator_address + description + } + transactions { + gas_used + gas_wanted + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + height: height, + }, + operationName: 'getBlockDetail', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + } } diff --git a/src/app/core/utils/common/info-common.ts b/src/app/core/utils/common/info-common.ts index 4eccfc9c8..3005405c8 100644 --- a/src/app/core/utils/common/info-common.ts +++ b/src/app/core/utils/common/info-common.ts @@ -116,3 +116,22 @@ export function checkTypeFile(nft: any) { } return content_type; } + +export function checkEnvQuery(envValue){ + let envDB; + switch (envValue) { + case 'serenity': + envDB = 'serenity'; + break; + case 'euphoria': + envDB = 'euphoria'; + break; + case 'mainnet': + envDB = 'xstaxy'; + break; + default: + envDB = 'auratestnet'; + break; + } + return envDB; +} diff --git a/src/app/global/global.ts b/src/app/global/global.ts index 937d1ae26..7f185b5ae 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -10,6 +10,7 @@ import { } from '../core/constants/transaction.enum'; import { CommonDataDto } from '../core/models/common.model'; import { balanceOf } from '../core/utils/common/parsing'; +import { log } from 'console'; Injectable(); export class Globals { @@ -275,14 +276,13 @@ export function convertDataTransaction(data, coinInfo) { } export function convertDataBlock(data) { - const block = _.get(data, 'blocks').map((element) => { - const height = _.get(element, 'block.header.height'); - const block_hash = _.get(element, 'block_id.hash'); - const num_txs = _.get(element, 'block.data.txs.length'); - const proposer = _.get(element, 'validator_name'); - const operator_address = _.get(element, 'operator_address'); - const timestamp = _.get(element, 'block.header.time'); - + const block = _.get(data, 'block').map((element) => { + const height = _.get(element, 'height'); + const block_hash = _.get(element, 'hash'); + const num_txs = _.get(element, 'data.data.txs.length'); + const proposer = _.get(element, 'validator.description.moniker'); + const operator_address = _.get(element, 'validator.operator_address'); + const timestamp = _.get(element, 'time'); return { height, block_hash, num_txs, proposer, operator_address, timestamp }; }); return block; diff --git a/src/app/pages/blocks/block-detail/block-detail.component.ts b/src/app/pages/blocks/block-detail/block-detail.component.ts index ec0768ade..ff1bf6262 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.ts +++ b/src/app/pages/blocks/block-detail/block-detail.component.ts @@ -14,7 +14,7 @@ import { PAGE_EVENT } from '../../../../app/core/constants/common.constant'; import { TableTemplate } from '../../../../app/core/models/common.model'; import { BlockService } from '../../../../app/core/services/block.service'; import { CommonService } from '../../../../app/core/services/common.service'; -import { convertDataBlock, convertDataTransaction, Globals } from '../../../../app/global/global'; +import { Globals, convertDataBlock, convertDataTransaction } from '../../../../app/global/global'; @Component({ selector: 'app-block-detail', @@ -102,21 +102,20 @@ export class BlockDetailComponent implements OnInit { } getDetailByHeight() { - this.blockService.blocksIndexer(1, this.id).subscribe( + this.blockService.getBlockDetail(this.id).subscribe( async (res) => { - const { code, data } = res; - if (code === 200 && data?.blocks?.length > 0) { - const block = convertDataBlock(data)[0]; - block['round'] = _.get(data.blocks[0], 'block.last_commit.round'); - block['chainid'] = _.get(data.blocks[0], 'block.header.chain_id'); - block['json_data'] = _.get(data.blocks[0], 'block'); + if (res?.block?.length > 0) { + const block = convertDataBlock(res)[0]; + block['round'] = _.get(res.block[0], 'data.last_commit.round'); + block['chainid'] = _.get(res.block[0], 'data.header.chain_id'); + block['json_data'] = _.get(res.block[0], 'data'); block['gas_used'] = block['gas_wanted'] = 0; this.blockDetail = block; //get list tx detail let txs = []; - for (const key in data.blocks[0]?.block?.data?.txs) { - const element = data.blocks[0].block?.data?.txs[key]; + for (const key in res.block[0]?.data?.data?.txs) { + const element = res.block[0]?.data?.data?.txs[key]; const tx = sha256(Buffer.from(element, 'base64')).toUpperCase(); this.transactionService.txsIndexer(1, 0, tx).subscribe((res) => { if (res.data.transactions[0]) { diff --git a/src/app/pages/blocks/blocks.component.ts b/src/app/pages/blocks/blocks.component.ts index 7d6428136..e100f6726 100644 --- a/src/app/pages/blocks/blocks.component.ts +++ b/src/app/pages/blocks/blocks.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { MatTableDataSource } from '@angular/material/table'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { getInfo } from 'src/app/core/utils/common/info-common'; -import { convertDataBlock, Globals } from 'src/app/global/global'; +import { Globals, convertDataBlock } from 'src/app/global/global'; import { TableTemplate } from '../../../app/core/models/common.model'; import { BlockService } from '../../../app/core/services/block.service'; import { CommonService } from '../../../app/core/services/common.service'; @@ -42,11 +42,10 @@ export class BlocksComponent implements OnInit { } getList(): void { - this.blockService.blocksIndexer(this.pageSize).subscribe( + this.blockService.getListBlock(this.pageSize).subscribe( (res) => { - const { code, data } = res; - if (code === 200) { - const blocks = convertDataBlock(data); + if (res?.block?.length > 0) { + const blocks = convertDataBlock(res); this.dataSource = new MatTableDataSource(blocks); } }, diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 635200be8..73d2d4245 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -249,10 +249,9 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } getListBlock(): void { - this.blockService.blocksIndexer(this.PAGE_SIZE).subscribe((res) => { - const { code, data } = res; - if (code === 200) { - const blocks = convertDataBlock(data); + this.blockService.getListBlock(this.PAGE_SIZE).subscribe((res) => { + if (res?.block?.length > 0) { + const blocks = convertDataBlock(res); this.dataSourceBlock = new MatTableDataSource(blocks); } }); diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 4a3d4abd0..ecf717f3a 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -15,7 +15,7 @@ import { CommonService } from 'src/app/core/services/common.service'; import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { ValidatorService } from 'src/app/core/services/validator.service'; import { WalletService } from 'src/app/core/services/wallet.service'; -import { convertDataBlock, getAmount, Globals } from 'src/app/global/global'; +import { Globals, convertDataBlock, getAmount } from 'src/app/global/global'; import { balanceOf } from '../../../core/utils/common/parsing'; const marked = require('marked'); const encode = require('@cosmjs/encoding'); @@ -438,12 +438,11 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } getListUpTime(): void { - this.blockService.blocksIndexer(this.numberLastBlock).subscribe( + this.blockService.getListBlock(this.numberLastBlock).subscribe( (res) => { - const { code, data } = res; - if (code === 200) { - const block = _.get(data, 'blocks').map((element) => { - const height = _.get(element, 'block.header.height'); + if (res?.block?.length > 0) { + const block = _.get(res, 'block').map((element) => { + const height = _.get(element, 'height'); const isSyncFail = true; return { height, isSyncFail }; }); diff --git a/src/assets/config/config.json b/src/assets/config/config.json index 2e1dccf10..7743f5265 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -65,5 +65,6 @@ }, "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", + "graphUrl": "https://indexer-v2.dev.aurascan.io/v1/graphql", "timeInterval": 4000 -} +} \ No newline at end of file From 399c833aa2827a00668af6aab8a1b1a07ffb9840 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 27 Apr 2023 10:55:30 +0700 Subject: [PATCH 002/315] apply indexer v2 for block --- src/app/core/services/block.service.ts | 20 ++++++++++++------- .../validators-detail.component.ts | 18 +++++++++++------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/app/core/services/block.service.ts b/src/app/core/services/block.service.ts index ad181f821..a40511a2b 100644 --- a/src/app/core/services/block.service.ts +++ b/src/app/core/services/block.service.ts @@ -40,12 +40,18 @@ export class BlockService extends CommonService { return this.http.get(`${this.apiUrl}/metrics/transactions?range=${type}&timezone=${date.getTimezoneOffset()}`); } - getBlockWithOperator(height) { + getBlockWithOperator(payload) { + const address = payload.address; + const nextHeight = payload.nextHeight; + let updateQuery = ''; + if (nextHeight !== null) { + updateQuery = ', height: {_lt: ' + nextHeight + ', _lte:' + (nextHeight - 100) + '}'; + } const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query getBlockDetail($height: Int) { + query getBlockWithOperator($address: String) { ${envDB} { - block(where: {validator: {operator_address: {_eq: $address}}}, order_by: {time: desc}, limit: 100) { + block(where: {validator: {operator_address: {_eq: $address}} ${updateQuery}} , order_by: {time: desc}, limit: 100) { height hash time @@ -66,14 +72,14 @@ export class BlockService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { - height: height, + address: address, }, - operationName: 'getBlockDetail', + operationName: 'getBlockWithOperator', }) .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } - getListBlock(limit) { + getListBlock(limit: number) { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query getListBlocks($limit: Int) { @@ -102,7 +108,7 @@ export class BlockService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } - getBlockDetail(height) { + getBlockDetail(height: string | number) { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query getBlockDetail($height: Int) { diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index ecf717f3a..91e15b588 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -176,12 +176,18 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } getListBlockWithOperator(nextKeyBlock = null, isInit = true): void { - this.blockService.blockWithOperator(100, this.currentAddress, nextKeyBlock).subscribe( + let payload = { + address: this.currentAddress, + nextHeight: null, + }; + if (nextKeyBlock !== null) { + payload.nextHeight = nextKeyBlock; + } + this.blockService.getBlockWithOperator(payload).subscribe( (res) => { - const { code, data } = res; - this.nextKeyBlock = data.nextKey || null; - if (code === 200) { - const blocks = convertDataBlock(data); + this.nextKeyBlock = res.block[res.block.length - 1].height; + if (res.block.length > 0) { + const blocks = convertDataBlock(res); if (this.dataSourceBlock.data.length > 0 && isInit) { this.dataSourceBlock.data = [...this.dataSourceBlock.data, ...blocks]; } else { @@ -337,7 +343,7 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { const nextBlock = page.length <= (page.pageIndex + 2) * page.pageSize; if (nextBlock && this.nextKeyBlock && this.currentNextKeyBlock !== this.nextKeyBlock) { this.getListBlockWithOperator(this.nextKeyBlock); - this.currentNextKeyBlock = this.nextKeyBlock; + //this.currentNextKeyBlock = this.nextKeyBlock; } this.pageIndexBlock = page.pageIndex; break; From c0069cb84d11a06d9aa1b947eea3ea5cfc4230e0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 27 Apr 2023 11:20:09 +0700 Subject: [PATCH 003/315] apply indexer v2 for block --- .../validators-detail/validators-detail.component.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 91e15b588..89369b805 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -75,7 +75,6 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { nextKey = null; currentNextKey = null; nextKeyBlock = null; - currentNextKeyBlock = null; nextKeyDelegator = null; currentNextKeyDelegator = null; @@ -121,7 +120,6 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { loadData(isInit = true) { if (!this.isLeftPage) { if (this.pageIndexBlock === 0) { - this.currentNextKeyBlock = null; this.getListBlockWithOperator(null, isInit); } if (this.pageIndexDelegator === 0) { @@ -341,9 +339,8 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { page.pageIndex * page.pageSize + page.pageSize, ); const nextBlock = page.length <= (page.pageIndex + 2) * page.pageSize; - if (nextBlock && this.nextKeyBlock && this.currentNextKeyBlock !== this.nextKeyBlock) { + if (nextBlock && this.nextKeyBlock) { this.getListBlockWithOperator(this.nextKeyBlock); - //this.currentNextKeyBlock = this.nextKeyBlock; } this.pageIndexBlock = page.pageIndex; break; From bb6fca36d1a94cc27336489d2cb728cc88a08dec Mon Sep 17 00:00:00 2001 From: mtam Date: Mon, 8 May 2023 14:05:37 +0700 Subject: [PATCH 004/315] [TamTM6] update tx ver 2 part 1 --- src/app/core/services/contract.service.ts | 6 +- src/app/core/services/transaction.service.ts | 39 ++++++++++++ src/app/global/global.ts | 61 +++++++++++++++++++ .../pages/dashboard/dashboard.component.ts | 9 ++- .../transaction-detail.component.ts | 21 ++++--- .../transaction/transaction.component.ts | 25 +++++++- 6 files changed, 141 insertions(+), 20 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 0631f095f..d33c951d9 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -54,9 +54,9 @@ export class ContractService extends CommonService { }); } - getContractDetail(contractAddress): Observable { - return this.http.get(`${this.apiUrl}/contracts/${contractAddress}`); - } + // getContractDetail(contractAddress): Observable { + // return this.http.get(`${this.apiUrl}/contracts/${contractAddress}`); + // } verifyCodeID(data: any): Observable { return this.http.post(`${this.apiUrl}/contracts/verify-code-id`, data); diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 7fa2795d0..858ceca8e 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -6,17 +6,56 @@ import { Observable } from 'rxjs'; import { LCD_COSMOS } from '../constants/url.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; +import { checkEnvQuery } from '../utils/common/info-common'; +import { map } from 'rxjs/operators'; +import { LENGTH_CHARACTER } from '../constants/common.constant'; @Injectable() export class TransactionService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; + graphUrl = `${this.environmentService.configValue.graphUrl}`; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); } + getListTx(limit: number, offset: string | number, txHash = '') { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + let updateQuery = ''; + let path = '(path: "tx")'; + if (txHash?.length > 0 && txHash?.length === LENGTH_CHARACTER.TRANSACTION) { + updateQuery = 'where: {hash: {_eq: ' + `"${txHash}"` + '}}'; + path = ''; + } + const operationsDoc = ` + query getListTx($limit: Int) { + ${envDB} { + transaction(limit: $limit, order_by: {timestamp: desc}, ${updateQuery}) { + height + hash + timestamp + code + gas_used + gas_wanted + data${path} + } + } + } + `; + console.log(operationsDoc); + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: limit, + }, + operationName: 'getListTx', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + } + txsIndexer(pageLimit: string | number, offset: string | number, txHash = ''): Observable { const params = _({ chainid: this.chainInfo.chainId, diff --git a/src/app/global/global.ts b/src/app/global/global.ts index 7f185b5ae..f16b9fbdb 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -275,6 +275,67 @@ export function convertDataTransaction(data, coinInfo) { return txs; } +export function convertDataTransactionV2(data, coinInfo) { + const txs = _.get(data, 'transaction').map((element) => { + console.log(element); + if (!element['data']['body']) { + element['data']['body'] = element['data']['tx']['body']; + } + const code = _.get(element, 'code'); + const tx_hash = _.get(element, 'hash'); + const messages = _.get(element, 'data.body.messages'); + + let _type = _.get(element, 'data.body.messages[0].@type'); + let lstType = _.get(element, 'data.body.messages'); + let denom = coinInfo.coinDenom; + + // check send token ibc same chain + if (_type === TRANSACTION_TYPE_ENUM.Send && messages[0].amount[0].denom !== denom) { + denom = messages[0].amount[0].denom; + } + + if (lstType?.length > 1) { + lstType.forEach((type) => { + if (type['@type'] !== TRANSACTION_TYPE_ENUM.IBCUpdateClient && type['@type'].indexOf('ibc') > -1) { + _type = type['@type']; + try { + let dataEncode = atob(type?.packet?.data); + const data = JSON.parse(dataEncode); + denom = data.denom; + } catch (e) { + denom = coinInfo.coinDenom; + } + return; + } + }); + } + const type = _.find(TYPE_TRANSACTION, { label: _type })?.value || 'Execute'; + + const status = + _.get(element, 'code') == CodeTransaction.Success ? StatusTransaction.Success : StatusTransaction.Fail; + + const _amount = getAmount( + _.get(element, 'data.body.messages'), + _type, + _.get(element, 'data.body.raw_log'), + coinInfo.coinMinimalDenom, + ); + + const amount = _.isNumber(_amount) && _amount > 0 ? _amount.toFixed(coinInfo.coinDecimals) : _amount; + + const fee = balanceOf(_.get(element, 'data.auth_info.fee.amount[0].amount') || 0, coinInfo.coinDecimals).toFixed( + coinInfo.coinDecimals, + ); + const height = _.get(element, 'height'); + const timestamp = _.get(element, 'timestamp'); + const gas_used = _.get(element, 'gas_used'); + const gas_wanted = _.get(element, 'gas_wanted'); + + return { code, tx_hash, type, status, amount, fee, height, timestamp, gas_used, gas_wanted, denom, messages }; + }); + return txs; +} + export function convertDataBlock(data) { const block = _.get(data, 'block').map((element) => { const height = _.get(element, 'height'); diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 73d2d4245..7bbdf40d0 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -19,7 +19,7 @@ import { BlockService } from '../../../app/core/services/block.service'; import { CommonService } from '../../../app/core/services/common.service'; import { TransactionService } from '../../../app/core/services/transaction.service'; import { CHART_RANGE, PAGE_EVENT, TOKEN_ID_GET_PRICE } from '../../core/constants/common.constant'; -import { convertDataBlock, convertDataTransaction, Globals } from '../../global/global'; +import { convertDataBlock, convertDataTransaction, convertDataTransactionV2, Globals } from '../../global/global'; import { CHART_CONFIG, DASHBOARD_AREA_SERIES_CHART_OPTIONS, DASHBOARD_CHART_OPTIONS } from './dashboard-chart-options'; import { ValidatorService } from 'src/app/core/services/validator.service'; @@ -258,11 +258,10 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } getListTransaction(): void { - this.transactionService.txsIndexer(this.PAGE_SIZE, 0).subscribe((res) => { + this.transactionService.getListTx(this.PAGE_SIZE, 0).subscribe((res) => { this.dataSourceTx.data = []; - const { code, data } = res; - if (code === 200) { - const txs = convertDataTransaction(data, this.coinInfo); + if (res?.transaction?.length > 0) { + const txs = convertDataTransactionV2(res, this.coinInfo); if (this.dataSourceTx.data.length > 0) { this.dataSourceTx.data = [...this.dataSourceTx.data, ...txs]; diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index 58b09c64a..272ac57c7 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -9,7 +9,7 @@ import { CodeTransaction } from '../../../core/constants/transaction.enum'; import { CommonService } from '../../../core/services/common.service'; import { MappingErrorService } from '../../../core/services/mapping-error.service'; import { TransactionService } from '../../../core/services/transaction.service'; -import { convertDataTransaction, Globals } from '../../../global/global'; +import { convertDataTransaction, convertDataTransactionV2, Globals } from '../../../global/global'; import { Clipboard } from '@angular/cdk/clipboard'; @Component({ @@ -65,20 +65,21 @@ export class TransactionDetailComponent implements OnInit { getDetail(): void { if (this.txHash?.length === LENGTH_CHARACTER.TRANSACTION) { - this.transactionService.txsIndexer(1, 0, this.txHash).subscribe( + this.transactionService.getListTx(1, 0, this.txHash).subscribe( (res) => { - const { code, data } = res; - if (code === 200 && data.transactions?.length > 0) { - const txs = convertDataTransaction(data, this.coinInfo); + console.log('res dash') + if (res?.transaction?.length > 0) { + const txs = convertDataTransactionV2(res, this.coinInfo); + console.log(txs); this.transaction = txs[0]; this.transaction = { ...this.transaction, chainid: this.chainId, - gas_used: _.get(res?.data.transactions[0], 'tx_response.gas_used'), - gas_wanted: _.get(res?.data.transactions[0], 'tx_response.gas_wanted'), - raw_log: _.get(res?.data.transactions[0], 'tx_response.raw_log'), - type: _.get(res?.data.transactions[0], 'tx_response.tx.body.messages[0].@type'), - tx: _.get(res?.data.transactions[0], 'tx_response'), + gas_used: _.get(res?.transaction[0], 'gas_used'), + gas_wanted: _.get(res?.transaction[0], 'gas_wanted'), + raw_log: _.get(res?.transaction[0], 'data.tx_response.raw_log'), + type: _.get(res?.transaction[0], 'data.body.messages[0].@type'), + tx: _.get(res?.transaction[0], 'tx_hash'), }; if (this.transaction.raw_log && +this.transaction.code !== CodeTransaction.Success) { diff --git a/src/app/pages/transaction/transaction.component.ts b/src/app/pages/transaction/transaction.component.ts index 90e602489..d5149f9d9 100644 --- a/src/app/pages/transaction/transaction.component.ts +++ b/src/app/pages/transaction/transaction.component.ts @@ -5,7 +5,7 @@ import { TYPE_TRANSACTION } from '../../../app/core/constants/transaction.consta import { TableTemplate } from '../../../app/core/models/common.model'; import { CommonService } from '../../../app/core/services/common.service'; import { TransactionService } from '../../../app/core/services/transaction.service'; -import { convertDataTransaction, Globals } from '../../../app/global/global'; +import { convertDataTransaction, convertDataTransactionV2, Globals } from '../../../app/global/global'; @Component({ selector: 'app-transaction', @@ -41,7 +41,28 @@ export class TransactionComponent implements OnInit { ) {} ngOnInit(): void { - this.getList(); + // this.getList(); + this.getListTx(); + } + + getListTx(): void { + this.transactionService.getListTx(this.pageSize, 0).subscribe( + (res) => { + if (res?.transaction?.length > 0) { + const txs = convertDataTransactionV2(res, this.coinInfo); + if (this.dataSource.data.length > 0) { + this.dataSource.data = [...this.dataSource.data, ...txs]; + } else { + this.dataSource.data = [...txs]; + } + this.dataTx = txs; + } + }, + () => {}, + () => { + this.loading = false; + }, + ); } getList(): void { From 1d2f42e3abac8b5f14f4745edf81aba7404c15a5 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 16 May 2023 09:44:33 +0700 Subject: [PATCH 005/315] apply horoscope v2 for validator --- src/app/core/helpers/jwt.interceptor.ts | 36 ++++++----------- src/app/core/services/validator.service.ts | 40 ++++++++++++------- .../validators-detail.component.ts | 8 ++-- .../pages/validators/validators.component.ts | 13 +++--- 4 files changed, 47 insertions(+), 50 deletions(-) diff --git a/src/app/core/helpers/jwt.interceptor.ts b/src/app/core/helpers/jwt.interceptor.ts index 20f42869c..3c0ea43a7 100644 --- a/src/app/core/helpers/jwt.interceptor.ts +++ b/src/app/core/helpers/jwt.interceptor.ts @@ -1,32 +1,20 @@ import { Injectable } from '@angular/core'; -import { - HttpRequest, - HttpHandler, - HttpEvent, - HttpInterceptor, -} from '@angular/common/http'; +import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http'; import { Observable } from 'rxjs'; - import { AuthenticationService } from '../services/auth.service'; @Injectable() export class JwtInterceptor implements HttpInterceptor { - constructor( - private authenticationService: AuthenticationService, - ) { } + constructor(private authenticationService: AuthenticationService) {} - intercept( - request: HttpRequest, - next: HttpHandler - ): Observable> { - const currentUser = this.authenticationService.currentUserValue; - if (currentUser && currentUser.data && currentUser.data.access_token) { - request = request.clone({ - setHeaders: { - Authorization: `Bearer ${currentUser.data.access_token}`, - }, - }); - } - return next.handle(request); - } + intercept(request: HttpRequest, next: HttpHandler): Observable> { + const currentUser = this.authenticationService.currentUserValue; + request = request.clone({ + setHeaders: { + 'x-hasura-admin-secret': 'abc@123', + 'Hasura-Client-Name': 'hasura-console', + }, + }); + return next.handle(request); + } } diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 6f7a681c3..71d13fc10 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -7,6 +7,8 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { CommonService } from 'src/app/core/services/common.service'; import { LCD_COSMOS } from '../constants/url.constant'; import { Globals } from 'src/app/global/global'; +import { checkEnvQuery } from '../utils/common/info-common'; +import { map } from 'rxjs/operators'; @Injectable({ providedIn: 'root', @@ -15,6 +17,7 @@ export class ValidatorService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; + graphUrl = `${this.environmentService.configValue.graphUrl}`; stakingAPRSubject: BehaviorSubject; constructor( @@ -48,19 +51,28 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators`); } - validatorsFromIndexer(address: string): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - operatorAddress: address, - pageLimit: 100, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/validator`, { - params, - }); + getMissedBlockCounter(address = '') { + let updateQuery = ''; + if (address !== '') { + updateQuery = '(where: {operator_address: {_similar: ' + address + '}})'; + } + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query getMissedBlockCounter { + ${envDB} { + validator ${updateQuery} { + account_address + missed_blocks_counter + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + operationName: 'getMissedBlockCounter', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } validatorsDetail(address: string): Observable { @@ -95,7 +107,7 @@ export class ValidatorService extends CommonService { ); } - delegators(pageLimit = 100, address: string, nextKey = null) { + delegators(pageLimit = 100, address: string, nextKey = null) { return axios.get( `${this.chainInfo.rest}/${LCD_COSMOS.STAKING}/validators/${address}/delegations?pagination.limit=${pageLimit}&pagination.key=${nextKey}&pagination.reverse=true`, ); diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 96ade9c54..315cfd009 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -155,7 +155,7 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { identity: res?.data?.identity, }; this.addressBase64 = encode.toBase64(encode.fromHex(this.currentValidatorDetail.cons_address)); - this.getDetailValidatorIndexer(); + this.getMissedBlockCounter(); if (isInit) { if (this.currentValidatorDetail?.status === this.statusValidator.Active) { this.getLastHeight(); @@ -438,10 +438,10 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } } - getDetailValidatorIndexer() { - this.validatorService.validatorsFromIndexer(this.currentValidatorDetail.operator_address).subscribe((res) => { + getMissedBlockCounter() { + this.validatorService.getMissedBlockCounter(this.currentValidatorDetail.operator_address).subscribe((res) => { this.currentValidatorDetail['up_time'] = - (NUM_BLOCK - +res.data.validators[0].val_signing_info.missed_blocks_counter) / 100; + (NUM_BLOCK - +res.validator[0].missed_blocks_counter) / 100; }); } diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index 01e79b4c7..cdbea6a4b 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -4,14 +4,13 @@ import { Component, HostListener, OnDestroy, OnInit, ViewChild, ViewEncapsulatio import { MatSort, Sort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { Router } from '@angular/router'; -import { fromBech32, toHex } from '@cosmjs/encoding'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { forkJoin, Subject, Subscription } from 'rxjs'; +import { Subject, Subscription, forkJoin } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { VOTING_POWER_STATUS } from 'src/app/core/constants/validator.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { getFee } from 'src/app/core/utils/signing/fee'; import { NUMBER_CONVERT, NUM_BLOCK, TIME_OUT_CALL_API } from '../../../app/core/constants/common.constant'; -import { CodeTransaction } from '../../../app/core/constants/transaction.enum'; import { DIALOG_STAKE_MODE, STATUS_VALIDATOR } from '../../../app/core/constants/validator.enum'; import { ESigningType, SIGNING_MESSAGE_TYPES } from '../../../app/core/constants/wallet.constant'; import { DataDelegateDto, ResponseDto, TableTemplate } from '../../../app/core/models/common.model'; @@ -19,12 +18,10 @@ import { AccountService } from '../../../app/core/services/account.service'; import { CommonService } from '../../../app/core/services/common.service'; import { MappingErrorService } from '../../../app/core/services/mapping-error.service'; import { NgxToastrService } from '../../../app/core/services/ngx-toastr.service'; -import { TransactionService } from '../../../app/core/services/transaction.service'; import { ValidatorService } from '../../../app/core/services/validator.service'; import { WalletService } from '../../../app/core/services/wallet.service'; import local from '../../../app/core/utils/storage/local'; import { Globals } from '../../../app/global/global'; -import { VOTING_POWER_STATUS } from 'src/app/core/constants/validator.constant'; @Component({ selector: 'app-validators', @@ -206,8 +203,8 @@ export class ValidatorsComponent implements OnInit, OnDestroy { } getBlocksMiss() { - this.validatorService.validatorsFromIndexer(null).subscribe((res) => { - this.lstUptime = res.data.validators; + this.validatorService.getMissedBlockCounter('').subscribe((res) => { + this.lstUptime = res.validator; }); } @@ -215,7 +212,7 @@ export class ValidatorsComponent implements OnInit, OnDestroy { const itemUptime = this.lstUptime.find((k) => k.account_address === address); let result = NUM_BLOCK; if (itemUptime) { - result = NUM_BLOCK - +itemUptime.val_signing_info.missed_blocks_counter; + result = NUM_BLOCK - +itemUptime.missed_blocks_counter; } return result / 100; } From 6d339b0102a27164d9bf28a7b528539e0d539a16 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 17 May 2023 10:19:43 +0700 Subject: [PATCH 006/315] call lcd undelegate --- src/app/core/services/validator.service.ts | 10 ++-- .../pages/validators/validators.component.ts | 53 ++++++++----------- 2 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 71d13fc10..ba136bf3f 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -101,12 +101,6 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators/delegations/${address}`); } - validatorsListUndelegateWallet(address: string): Observable { - return this.http.get( - `${this.indexerUrl}/account-unbonds?chainid=${this.chainInfo.chainId}&address=${address}`, - ); - } - delegators(pageLimit = 100, address: string, nextKey = null) { return axios.get( `${this.chainInfo.rest}/${LCD_COSMOS.STAKING}/validators/${address}/delegations?pagination.limit=${pageLimit}&pagination.key=${nextKey}&pagination.reverse=true`, @@ -131,4 +125,8 @@ export class ValidatorService extends CommonService { } return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.BLOCK}/${block}`); } + + getListUndelegateLCD(address) { + return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.STAKING}/delegators/${address}/unbonding_delegations`); + } } diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index cdbea6a4b..0c0b7fedf 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -392,8 +392,7 @@ export class ValidatorsComponent implements OnInit, OnDestroy { this.lstUndelegate = null; } } - - this.getDataUndelegate(); + this.getListUndelegate(); // store data wallet info dataInfoWallet['dataDelegate'] = JSON.stringify(this.dataDelegate); @@ -414,11 +413,6 @@ export class ValidatorsComponent implements OnInit, OnDestroy { } } - // async getListDelegators(address) { - // const res = await this.validatorService.delegators(5, 0, address); - // this.totalDelegator = res?.data?.pagination?.total; - // } - checkAmountStaking(): void { let amountCheck; if (this.dataDelegate.dialogMode === this.dialogMode.Delegate) { @@ -635,30 +629,29 @@ export class ValidatorsComponent implements OnInit, OnDestroy { }, 500); } - getDataUndelegate() { - this.validatorService.validatorsListUndelegateWallet(this.userAddress).subscribe((res) => { - let listUnDelegator = res; - if (listUnDelegator) { - this.lstUndelegate = []; - const now = new Date(); - listUnDelegator.data.account_unbonding.forEach((data) => { - data.entries.forEach((f) => { - f['validator_identity'] = data.validator_description?.description?.identity; - f.balance = f.balance / NUMBER_CONVERT; - f.validator_address = data.validator_address; - f.validator_name = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.title; - f.jailed = data.validator_description?.jailed || false; - let timeConvert = new Date(f.completion_time); - if (now < timeConvert) { - this.lstUndelegate.push(f); - } - }); + async getListUndelegate() { + const res = await this.validatorService.getListUndelegateLCD(this.userAddress); + let listUnDelegator = res; + if (listUnDelegator) { + this.lstUndelegate = []; + const now = new Date(); + listUnDelegator.data.unbonding_responses.forEach((data) => { + data.entries.forEach((f) => { + f['validator_identity'] = data.validator_description?.description?.identity; + f.balance = f.balance / NUMBER_CONVERT; + f.validator_address = data.validator_address; + f.validator_name = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.title; + f.jailed = data.validator_description?.jailed || false; + let timeConvert = new Date(f.completion_time); + if (now < timeConvert) { + this.lstUndelegate.push(f); + } }); + }); - this.lstUndelegate = this.lstUndelegate.sort((a, b) => { - return this.compare(a.completion_time, b.completion_time, true); - }); - } - }); + this.lstUndelegate = this.lstUndelegate.sort((a, b) => { + return this.compare(a.completion_time, b.completion_time, true); + }); + } } } From 962cde044a278b519363d80752c076101c75ea16 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 17 May 2023 14:19:11 +0700 Subject: [PATCH 007/315] call lcd param tallying --- src/app/core/services/common.service.ts | 15 +++------------ .../summary-info/summary-info.component.ts | 8 ++++---- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 3dd54b633..05df9d5c1 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -9,6 +9,7 @@ import { CHART_RANGE, DATEFORMAT } from '../constants/common.constant'; import { STATUS_VALIDATOR } from '../constants/validator.enum'; import { EnvironmentService } from '../data-services/environment.service'; import { formatTimeInWords, formatWithSchema } from '../helpers/date'; +import { LCD_COSMOS } from '../constants/url.constant'; @Injectable() export class CommonService { @@ -39,18 +40,8 @@ export class CommonService { return this._http.get(`${this.apiUrl}/status`); } - getParamFromIndexer() { - const params = _({ - chainid: this.chainInfo.chainId, - module: 'gov', - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this._http.get(`${this.indexerUrl}/param`, { - params, - }); + getParamTallyingFromLCD() { + return axios.get(`${this.chainInfo.rest}/cosmos/gov/v1beta1/params/tallying`); } setURL() { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 37d54e49a..d5ef8b8ea 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -4,6 +4,7 @@ import { AfterViewChecked, Component, EventEmitter, Input, OnInit, Output } from import { MatDialog } from '@angular/material/dialog'; import * as _ from 'lodash'; import * as moment from 'moment'; +import { from } from 'rxjs'; import { map, mergeMap } from 'rxjs/operators'; import { Globals } from '../../../../../app/global/global'; import { @@ -45,7 +46,6 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { isNotReached = true; quorumStatus = VOTING_QUORUM.NOT_REACHED; timerGetUpTime: any; - denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; constructor( @@ -89,19 +89,19 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { this.proposalDetail.pro_turnout = this.proposalDetail.turnout; } } - return this.commonService.getParamFromIndexer(); + return from(this.commonService.getParamTallyingFromLCD()); }), ); } else { throw new Error(''); } }), - map((paramFromIndexer) => paramFromIndexer.data?.result[0]), + map((paramFromIndexer) => paramFromIndexer?.data?.tally_params), map((result) => { if (!result) { return; } - const { quorum, threshold, veto_threshold } = result.params?.tallying_param; + const { quorum, threshold, veto_threshold } = result; if (this.proposalDetail) { const { pro_votes_yes, pro_total_vote, pro_votes_abstain, pro_votes_no_with_veto } = this.proposalDetail; From c43c883a547ee4d3901bcd8a2019f7d47050e6d1 Mon Sep 17 00:00:00 2001 From: mtam Date: Wed, 17 May 2023 15:46:06 +0700 Subject: [PATCH 008/315] [TamTM6] update tx ver 2 part 2 --- src/app/core/constants/contract.constant.ts | 4 +- .../core/constants/transaction.constant.ts | 1 + src/app/core/constants/transaction.enum.ts | 2 + src/app/core/helpers/jwt.interceptor.ts | 38 ++--- src/app/core/services/block.service.ts | 33 +--- src/app/core/services/common.service.ts | 11 -- src/app/core/services/contract.service.ts | 72 ++++++--- src/app/core/services/proposal.service.ts | 107 +++++++++---- src/app/core/services/token.service.ts | 94 +++++++++--- src/app/core/services/transaction.service.ts | 142 ++++++++++++------ src/app/core/services/validator.service.ts | 3 - src/app/core/utils/common/info-common.ts | 22 +-- src/app/global/global.ts | 34 ++++- .../horizontaltopbar.component.ts | 14 +- .../account-detail.component.ts | 18 +-- .../block-detail/block-detail.component.ts | 12 +- .../code-id-contracts-tab.component.html | 5 +- .../code-id-contracts-tab.component.ts | 4 +- .../contract-content.component.html | 6 +- .../contract-content.component.ts | 55 ++----- .../contracts-transactions.component.ts | 95 ++++++------ .../depositors/depositors.component.ts | 26 ++-- .../summary-info/summary-info.component.ts | 2 +- src/app/pages/proposal/proposal.component.ts | 2 +- .../token/nft-detail/nft-detail.component.ts | 41 ++--- .../token-transfers-tab.component.ts | 48 +++--- .../transaction-detail.component.ts | 5 +- .../transaction-messages.component.html | 14 +- .../transaction-messages.component.ts | 75 +++++---- .../transaction/transaction.component.ts | 40 ++--- .../pages/validators/validators.component.ts | 7 +- .../contract-table.component.html | 2 +- .../contract-table.component.ts | 43 +++--- 33 files changed, 616 insertions(+), 461 deletions(-) diff --git a/src/app/core/constants/contract.constant.ts b/src/app/core/constants/contract.constant.ts index 0dcdc2b0c..2d81be535 100644 --- a/src/app/core/constants/contract.constant.ts +++ b/src/app/core/constants/contract.constant.ts @@ -35,8 +35,8 @@ export const MAX_LENGTH_SEARCH_CONTRACT = 200; export const CONTRACT_TABLE_TEMPLATES: Array = [ // { matColumnDef: 'popover', headerCellDef: '', type: 'popover', headerWidth: 4 }, { matColumnDef: 'txHash', headerCellDef: 'Txn Hash', type: 'hash-url', headerWidth: 12, isUrl: '/transaction' }, - { matColumnDef: 'method', headerCellDef: 'Method', type: 'status', headerWidth: 10 }, - { matColumnDef: 'status', headerCellDef: 'Result', type: 'result', headerWidth: 10 }, + { matColumnDef: 'method', headerCellDef: 'Method', type: 'status', headerWidth: 12 }, + { matColumnDef: 'status', headerCellDef: 'Result', type: 'result', headerWidth: 9 }, { matColumnDef: 'blockHeight', headerCellDef: 'Block', diff --git a/src/app/core/constants/transaction.constant.ts b/src/app/core/constants/transaction.constant.ts index b3a77ca16..2d86f9078 100644 --- a/src/app/core/constants/transaction.constant.ts +++ b/src/app/core/constants/transaction.constant.ts @@ -10,6 +10,7 @@ export const TYPE_TRANSACTION = [ { label: TRANSACTION_TYPE_ENUM.IBCConnectionOpenInit, value: TypeTransaction.IBCConnectionOpenInit }, { label: TRANSACTION_TYPE_ENUM.IBCCreateClient, value: TypeTransaction.IBCCreateClient }, { label: TRANSACTION_TYPE_ENUM.IBCChannelOpenAck, value: TypeTransaction.IBCChannelOpenAck }, + { label: TRANSACTION_TYPE_ENUM.IBCMsgConnectionOpenTry, value: TypeTransaction.IBCMsgConnectionOpenTry }, { label: TRANSACTION_TYPE_ENUM.Send, value: TypeTransaction.Send }, { label: TRANSACTION_TYPE_ENUM.MultiSend, value: TypeTransaction.MultiSend }, { label: TRANSACTION_TYPE_ENUM.Delegate, value: TypeTransaction.Delegate }, diff --git a/src/app/core/constants/transaction.enum.ts b/src/app/core/constants/transaction.enum.ts index 03a3a0d11..1d309dad6 100644 --- a/src/app/core/constants/transaction.enum.ts +++ b/src/app/core/constants/transaction.enum.ts @@ -8,6 +8,7 @@ export enum TypeTransaction { IBCConnectionOpenInit = 'IBC Connect Open Init', IBCCreateClient = 'IBC Create Client', IBCChannelOpenAck = 'IBC Channel Open Ack', + IBCMsgConnectionOpenTry = 'Connection Open Try', Send = 'Send', Received = 'Receive', MultiSend = 'Multi Send', @@ -56,6 +57,7 @@ export enum TRANSACTION_TYPE_ENUM { IBCConnectionOpenInit = '/ibc.core.connection.v1.MsgConnectionOpenInit', IBCCreateClient = '/ibc.core.client.v1.MsgCreateClient', IBCChannelOpenAck = '/ibc.core.channel.v1.MsgChannelOpenAck', + IBCMsgConnectionOpenTry = '/ibc.core.connection.v1.MsgConnectionOpenTry', Send = '/cosmos.bank.v1beta1.MsgSend', MultiSend = '/cosmos.bank.v1beta1.MsgMultiSend', Delegate = '/cosmos.staking.v1beta1.MsgDelegate', diff --git a/src/app/core/helpers/jwt.interceptor.ts b/src/app/core/helpers/jwt.interceptor.ts index 20f42869c..c05db2880 100644 --- a/src/app/core/helpers/jwt.interceptor.ts +++ b/src/app/core/helpers/jwt.interceptor.ts @@ -1,32 +1,22 @@ import { Injectable } from '@angular/core'; -import { - HttpRequest, - HttpHandler, - HttpEvent, - HttpInterceptor, -} from '@angular/common/http'; +import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http'; import { Observable } from 'rxjs'; - import { AuthenticationService } from '../services/auth.service'; @Injectable() export class JwtInterceptor implements HttpInterceptor { - constructor( - private authenticationService: AuthenticationService, - ) { } + constructor(private authenticationService: AuthenticationService) {} - intercept( - request: HttpRequest, - next: HttpHandler - ): Observable> { - const currentUser = this.authenticationService.currentUserValue; - if (currentUser && currentUser.data && currentUser.data.access_token) { - request = request.clone({ - setHeaders: { - Authorization: `Bearer ${currentUser.data.access_token}`, - }, - }); - } - return next.handle(request); - } + intercept(request: HttpRequest, next: HttpHandler): Observable> { + const currentUser = this.authenticationService.currentUserValue; + request = request.clone({ + setHeaders: { + // 'Access-Control-Allow-Origin': '*', + // 'Access-Control-Allow-Credentials': 'true', + 'x-hasura-admin-secret': 'abc@123', + 'Hasura-Client-Name': 'hasura-console', + }, + }); + return next.handle(request); + } } diff --git a/src/app/core/services/block.service.ts b/src/app/core/services/block.service.ts index a40511a2b..0d0287e37 100644 --- a/src/app/core/services/block.service.ts +++ b/src/app/core/services/block.service.ts @@ -13,29 +13,13 @@ export class BlockService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; graphUrl = `${this.environmentService.configValue.graphUrl}`; + envDB = checkEnvQuery(this.environmentService.configValue.env); constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); } - blockWithOperator(pageLimit: string | number, operatorAddress: string, nextKey = null): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - pageLimit, - operatorAddress, - nextKey, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/block`, { - params, - }); - } - getBlockAndTxs(type: string): Observable { - this.setURL(); const date = new Date(); return this.http.get(`${this.apiUrl}/metrics/transactions?range=${type}&timezone=${date.getTimezoneOffset()}`); } @@ -47,10 +31,9 @@ export class BlockService extends CommonService { if (nextHeight !== null) { updateQuery = ', height: {_lt: ' + nextHeight + ', _lte:' + (nextHeight - 100) + '}'; } - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query getBlockWithOperator($address: String) { - ${envDB} { + ${this.envDB} { block(where: {validator: {operator_address: {_eq: $address}} ${updateQuery}} , order_by: {time: desc}, limit: 100) { height hash @@ -76,14 +59,13 @@ export class BlockService extends CommonService { }, operationName: 'getBlockWithOperator', }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } getListBlock(limit: number) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query getListBlocks($limit: Int) { - ${envDB} { + ${this.envDB} { block(limit: $limit, order_by: {time: desc}) { height hash @@ -105,14 +87,13 @@ export class BlockService extends CommonService { }, operationName: 'getListBlocks', }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } getBlockDetail(height: string | number) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query getBlockDetail($height: Int) { - ${envDB} { + ${this.envDB} { block(where: {height: {_eq: $height}}) { height hash @@ -138,6 +119,6 @@ export class BlockService extends CommonService { }, operationName: 'getBlockDetail', }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } } diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 3dd54b633..a9d15ecbf 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -35,7 +35,6 @@ export class CommonService { } status(): Observable { - this.setURL(); return this._http.get(`${this.apiUrl}/status`); } @@ -53,15 +52,6 @@ export class CommonService { }); } - setURL() { - if (this.networkQuerySubject.value === 1) { - this.apiUrl = `${this._environmentService.configValue.fabric}`; - } - if (this.networkQuerySubject.value === 2) { - this.apiUrl = `${this._environmentService.configValue.beUri}`; - } - } - getDateValue(time, isCustom = true) { if (time) { try { @@ -117,7 +107,6 @@ export class CommonService { } getTokenByCoinId(range: string, id: string) { - this.setURL(); return this._http.get(`${this.apiUrl}/metrics/token?range=${range}&coidId=${id}`); } diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index d33c951d9..a41ad410d 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -1,4 +1,4 @@ -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import axios from 'axios'; import * as _ from 'lodash'; @@ -7,6 +7,8 @@ import { IResponsesTemplates } from 'src/app/core/models/common.model'; import { DeployContractListReq, SmartContractListReq } from 'src/app/core/models/contract.model'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; +import { checkEnvQuery } from '../utils/common/info-common'; +import { map } from 'rxjs/operators'; @Injectable() export class ContractService extends CommonService { @@ -15,6 +17,7 @@ export class ContractService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; apiUrl = `${this.environmentService.configValue.beUri}`; + graphUrl = `${this.environmentService.configValue.graphUrl}`; get contract() { return this.contract$.value; @@ -30,34 +33,57 @@ export class ContractService extends CommonService { return this.http.post(`${this.apiUrl}/contracts`, data); } - getTransactionsIndexer( + getTransactionsIndexerV2( pageLimit: string | number, contractAddress = '', type: string, + hashIns = '', nextKey = null, - ): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - searchType: type, - searchKey: '_contract_address', - searchValue: contractAddress, - pageLimit, - nextKey, - // countTotal: true, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/transaction`, { - params, - }); + ) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + let filterQuery = ''; + if (type) { + if (type === 'execute' && hashIns) { + filterQuery = `, hash: {_neq: ${hashIns}}`; + } else if (type === 'instantiate') { + filterQuery = `, events : {type: {_eq: "${type}" }}`; + } + } + if (nextKey) { + filterQuery = filterQuery.concat(', id: {_lt: ' + `${nextKey}` + '}'); + } + + const operationsDoc = ` + query getListTx($limit: Int, $event_attr_val: String, $tx_msg_val: jsonb) { + ${envDB} { + transaction(limit: $limit, order_by: {timestamp: desc}, where: {_and: {_or: [{events: {event_attributes: {key: {_eq: "_contract_address"}, value: {_eq: $event_attr_val}}}}, {transaction_messages: {content: {_contains: $tx_msg_val}}}] ${filterQuery} }}) { + id + height + hash + timestamp + code + gas_used + gas_wanted + data(path: "tx") + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: pageLimit, + event_attr_val: contractAddress, + tx_msg_val: { + contract: contractAddress, + }, + }, + operationName: 'getListTx', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } - // getContractDetail(contractAddress): Observable { - // return this.http.get(`${this.apiUrl}/contracts/${contractAddress}`); - // } - verifyCodeID(data: any): Observable { return this.http.post(`${this.apiUrl}/contracts/verify-code-id`, data); } diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 6c54fb220..c1cb8ef70 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -5,11 +5,15 @@ import { Observable, Subject } from 'rxjs'; import { VOTE_OPTION } from '../constants/proposal.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; +import { checkEnvQuery } from '../utils/common/info-common'; +import { map } from 'rxjs/operators'; @Injectable() export class ProposalService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; + graphUrl = `${this.environmentService.configValue.graphUrl}`; + envDB = checkEnvQuery(this.environmentService.configValue.env); reloadList$ = new Subject(); pageIndexObj = {}; @@ -21,21 +25,46 @@ export class ProposalService extends CommonService { super(http, environmentService); } - getVotes(payload) { - const params = _({ - chainid: this.chainInfo.chainId, - searchValue: payload.proposalId, - searchType: 'proposal_vote', - searchKey: 'proposal_id', - ['queryAnd[]']: 'transfer.sender='+payload.wallet, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/transaction`, { params }); + getVotes(payload): Observable { + const operationsDoc = ` + query getVotes($proposalId: String, $tx_msg_val: jsonb) { + ${this.envDB} { + transaction(order_by: {timestamp: desc}, limit: 1, where: {transaction_messages: {type: {_eq: "/cosmos.gov.v1beta1.MsgVote"}, content: {_contains: $tx_msg_val}}, event_attributes: {key: {_eq: "proposal_id"}, value: {_eq: $proposalId}}}) { + height + data + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + proposalId: payload.proposalId.toString(), + tx_msg_val: { + voter: payload.wallet, + }, + }, + operationName: 'getVotes', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } + // getVotes(payload) { + // const params = _({ + // chainid: this.chainInfo.chainId, + // searchValue: payload.proposalId, + // searchType: 'proposal_vote', + // searchKey: 'proposal_id', + // ['queryAnd[]']: 'transfer.sender='+payload.wallet, + // }) + // .omitBy(_.isNull) + // .omitBy(_.isUndefined) + // .value(); + + // return this.http.get(`${this.indexerUrl}/transaction`, { params }); + // } + getValidatorVotesFromIndexer(proposalid): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -49,22 +78,46 @@ export class ProposalService extends CommonService { } getDepositors(payload) { - const params = _({ - chainid: this.chainInfo.chainId, - searchValue: payload.proposalId, - searchType: 'proposal_deposit', - searchKey: 'proposal_id', - pageLimit: payload.pageLimit, - nextKey: payload.nextKey, - // countTotal: true, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/transaction`, { params }); + const operationsDoc = ` + query getDepositors($limit: Int, $proposalId: String) { + ${this.envDB} { + transaction(limit: $limit, order_by: {timestamp: desc}, where: {event_attributes: {key: {_eq: "proposal_id"}, value: {_eq: $proposalId}}, events: {type: {_eq: "proposal_deposit"} }}) { + hash + timestamp + data(path:"tx") + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.pageLimit, + proposalId: payload.proposalId.toString(), + }, + operationName: 'getDepositors', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } + // getDepositors(payload) { + // const params = _({ + // chainid: this.chainInfo.chainId, + // searchValue: payload.proposalId, + // searchType: 'proposal_deposit', + // searchKey: 'proposal_id', + // pageLimit: payload.pageLimit, + // nextKey: payload.nextKey, + // // countTotal: true, + // }) + // .omitBy(_.isNull) + // .omitBy(_.isUndefined) + // .value(); + + // return this.http.get(`${this.indexerUrl}/transaction`, { params }); + // } + getListVoteFromIndexer(payload, option): Observable { const params = _({ chainid: this.chainInfo.chainId, diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index f22fab110..c999b4675 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -7,11 +7,15 @@ import { LENGTH_CHARACTER } from '../constants/common.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { RangeType } from '../models/common.model'; import { CommonService } from './common.service'; +import { checkEnvQuery } from '../utils/common/info-common'; +import { map } from 'rxjs/operators'; @Injectable() export class TokenService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; + envDB = checkEnvQuery(this.environmentService.configValue.env); + graphUrl = `${this.environmentService.configValue.graphUrl}`; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); @@ -33,37 +37,89 @@ export class TokenService extends CommonService { return this.http.get(`${this.apiUrl}/cw721-tokens/${address}`); } - getListTokenTransferIndexer(pageLimit: string | number, contractAddress: string, filterData: any, nextKey = null) { - const params = _({ - chainid: this.chainInfo.chainId, - searchType: 'execute', - searchKey: '_contract_address', - searchValue: contractAddress, - needFullLog: true, - pageLimit, - nextKey, - // countTotal: true, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - + getListTokenTransferIndexerV2(pageLimit: string | number, contractAddress = '', filterData: any, nextKey = null) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + let filterQuery = ''; if (filterData?.keyWord) { if ( filterData?.keyWord.length === LENGTH_CHARACTER.TRANSACTION && filterData?.keyWord == filterData?.keyWord.toUpperCase() ) { - params['txHash'] = filterData?.keyWord; + filterQuery = filterQuery.concat(`, hash: {_eq: "${filterData?.keyWord}" }`); } else if (filterData['isSearchWallet']) { - params['addressInContract'] = filterData?.keyWord; + filterQuery = filterQuery.concat(`, events: {event_attributes: {value: {_eq: "${filterData?.keyWord}" }}}`); } else { - params['query'] = 'wasm.token_id=' + filterData?.keyWord; + filterQuery = filterQuery.concat( + `, events: {event_attributes: {key: {_eq: "token_id"}, value: {_eq: "${filterData?.keyWord}" }}}`, + ); } } + if (nextKey) { + filterQuery = filterQuery.concat(', id: {_lt: ' + `${nextKey}` + '}'); + } - return axios.get(`${this.indexerUrl}/transaction`, { params }); + const operationsDoc = ` + query getListTx($limit: Int, $event_attr_val: String, $tx_msg_val: jsonb) { + ${envDB} { + transaction(limit: $limit, order_by: {timestamp: desc}, where: {_or: [{events: {event_attributes: {key: {_eq: "_contract_address"}, value: {_eq: $event_attr_val}}, type: {_eq: "execute"}}}, {transaction_messages: {content: {_contains: $tx_msg_val}}}] ${filterQuery} }) { + id + height + hash + timestamp + code + gas_used + gas_wanted + data(path: "tx") + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: pageLimit, + event_attr_val: contractAddress, + tx_msg_val: { + contract: contractAddress, + }, + }, + operationName: 'getListTx', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } + // getListTokenTransferIndexerOld(pageLimit: string | number, contractAddress: string, filterData: any, nextKey = null) { + // const params = _({ + // chainid: this.chainInfo.chainId, + // searchType: 'execute', + // searchKey: '_contract_address', + // searchValue: contractAddress, + // needFullLog: true, + // pageLimit, + // nextKey, + // // countTotal: true, + // }) + // .omitBy(_.isNull) + // .omitBy(_.isUndefined) + // .value(); + + // if (filterData?.keyWord) { + // if ( + // filterData?.keyWord.length === LENGTH_CHARACTER.TRANSACTION && + // filterData?.keyWord == filterData?.keyWord.toUpperCase() + // ) { + // params['txHash'] = filterData?.keyWord; + // } else if (filterData['isSearchWallet']) { + // params['addressInContract'] = filterData?.keyWord; + // } else { + // params['query'] = 'wasm.token_id=' + filterData?.keyWord; + // } + // } + + // return axios.get(`${this.indexerUrl}/transaction`, { params }); + // } + getListTokenNFTFromIndexer(payload): Observable { const params = _({ chainid: this.chainInfo.chainId, diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 858ceca8e..5bc9756ec 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -16,23 +16,23 @@ export class TransactionService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; graphUrl = `${this.environmentService.configValue.graphUrl}`; + envDB = checkEnvQuery(this.environmentService.configValue.env); constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); } getListTx(limit: number, offset: string | number, txHash = '') { - const envDB = checkEnvQuery(this.environmentService.configValue.env); let updateQuery = ''; let path = '(path: "tx")'; if (txHash?.length > 0 && txHash?.length === LENGTH_CHARACTER.TRANSACTION) { - updateQuery = 'where: {hash: {_eq: ' + `"${txHash}"` + '}}'; + updateQuery = ', where: {hash: {_eq: ' + `"${txHash}"` + '}}'; path = ''; } const operationsDoc = ` query getListTx($limit: Int) { - ${envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, ${updateQuery}) { + ${this.envDB} { + transaction(limit: $limit, order_by: {timestamp: desc} ${updateQuery}) { height hash timestamp @@ -44,7 +44,6 @@ export class TransactionService extends CommonService { } } `; - console.log(operationsDoc); return this.http .post(this.graphUrl, { query: operationsDoc, @@ -53,57 +52,108 @@ export class TransactionService extends CommonService { }, operationName: 'getListTx', }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - txsIndexer(pageLimit: string | number, offset: string | number, txHash = ''): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - pageLimit, - offset, - txHash, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); + // txsIndexer(pageLimit: string | number, offset: string | number, txHash = ''): Observable { + // const params = _({ + // chainid: this.chainInfo.chainId, + // pageLimit, + // offset, + // txHash, + // }) + // .omitBy(_.isNull) + // .omitBy(_.isUndefined) + // .value(); - return this.http.get(`${this.indexerUrl}/transaction`, { - params, - }); - } + // return this.http.get(`${this.indexerUrl}/transaction`, { + // params, + // }); + // } txsDetailLcd(txhash: string) { return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.TX}/txs/${txhash}`); } - getAccountTxFromHoroscope(chainId: string, address: string, pageLimit = 10, nextKey = null): Observable { - const params = _({ - chainid: chainId, - address, - pageLimit, - nextKey, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/transaction`, { - params, - }); + getAccountTxFromHoroscope(address: string, pageLimit = 10, nextKey = null): Observable { + let filterQuery = ''; + if (nextKey) { + filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; + } + const operationsDoc = ` + query getListTx($limit: Int) { + ${this.envDB} { + transaction(limit: $limit, order_by: {timestamp: desc}, where: {event_attribute_index: {value: {_eq: "${address}"} ${filterQuery} }}) { + id + height + hash + timestamp + code + gas_used + gas_wanted + data(path: "tx") + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: pageLimit, + }, + operationName: 'getListTx', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getListIBCSequence(sequence): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - pageLimit: 20, - sequenceIBC: sequence, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); + // getAccountTxFromHoroscope(chainId: string, address: string, pageLimit = 10, nextKey = null): Observable { + // const params = _({ + // chainid: chainId, + // address, + // pageLimit, + // nextKey, + // }) + // .omitBy(_.isNull) + // .omitBy(_.isUndefined) + // .value(); + + // return this.http.get(`${this.indexerUrl}/transaction`, { + // params, + // }); + // } - return this.http.get(`${this.indexerUrl}/transaction`, { - params, - }); + getListIBCSequence(sequence, channel): Observable { + const operationsDoc = ` + query getListSequence($limit: Int, $compositeKey: [String!] = "", $value: String = "") { + ${this.envDB} { + transaction(limit: $limit, where: {event_attributes: {composite_key: {_in: ["acknowledge_packet.packet_src_channel","send_packet.packet_src_channel", "recv_packet.packet_src_channel"]}, value: {_eq: "${channel}" }}, _and: {event_attributes: {composite_key: {_in: $compositeKey}, value: {_eq: $value}}}}) { + height + hash + timestamp + code + gas_used + gas_wanted + data + event_attributes (where: {composite_key: {_eq: "denomination_trace.denom"}}) { + value + composite_key + key + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: 20, + compositeKey: ["send_packet.packet_sequence", "recv_packet.packet_sequence", "acknowledge_packet.packet_sequence", "timeout_packet.packet_sequence"], + value: sequence + }, + operationName: 'getListSequence', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } } diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 6f7a681c3..03b721d07 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -44,7 +44,6 @@ export class ValidatorService extends CommonService { } validators(): Observable { - this.setURL(); return this.http.get(`${this.apiUrl}/validators`); } @@ -64,7 +63,6 @@ export class ValidatorService extends CommonService { } validatorsDetail(address: string): Observable { - this.setURL(); return this.http.get(`${this.apiUrl}/validators/${address}`); } @@ -85,7 +83,6 @@ export class ValidatorService extends CommonService { } validatorsDetailWallet(address: string): Observable { - this.setURL(); return this.http.get(`${this.apiUrl}/validators/delegations/${address}`); } diff --git a/src/app/core/utils/common/info-common.ts b/src/app/core/utils/common/info-common.ts index 944480187..4a44e4531 100644 --- a/src/app/core/utils/common/info-common.ts +++ b/src/app/core/utils/common/info-common.ts @@ -51,29 +51,29 @@ export function formatNumber(number: number, args?: any): any { } export function parseDataTransaction(trans: any, coinMinimalDenom: string, tokenID = '') { - let typeOrigin = trans.tx_response?.tx?.body?.messages[0]['@type']; + let typeOrigin = trans.data?.body?.messages[0]['@type']; const typeTrans = TYPE_TRANSACTION.find((f) => f.label.toLowerCase() === typeOrigin?.toLowerCase()); - trans.tx_hash = trans.tx_response?.txhash; + trans.tx_hash = trans.hash; //get amount of transaction trans.amount = getAmount( - trans.tx_response?.tx?.body?.messages, + trans.data?.body?.messages, typeOrigin, trans.tx_response?.raw_log, coinMinimalDenom, ); - trans.fee = balanceOf(trans?.tx_response?.tx?.auth_info?.fee?.amount[0]?.amount); - trans.gas_limit = balanceOf(trans?.tx_response?.tx?.auth_info?.fee?.gas_limit); - trans.height = trans.tx_response?.height; - trans.timestamp = trans.tx_response?.timestamp; + trans.fee = balanceOf(trans?.data?.auth_info?.fee?.amount[0]?.amount); + trans.gas_limit = balanceOf(trans?.data?.auth_info?.fee?.gas_limit); + trans.height = trans?.height; + trans.timestamp = trans?.timestamp; trans.status = StatusTransaction.Fail; - if (Number(trans.tx_response?.code) === CodeTransaction.Success) { + if (Number(trans?.code) === CodeTransaction.Success) { trans.status = StatusTransaction.Success; } [trans.from_address, trans.to_address, trans.amountToken, trans.method, trans.token_id, trans.modeExecute] = - getDataInfo(trans.tx_response?.tx?.body?.messages, tokenID, trans.tx_response?.raw_log); + getDataInfo(trans.data?.body?.messages, tokenID, trans.tx_response?.raw_log); trans.type = trans.method || typeTrans?.value; - trans.depositors = trans.tx_response?.tx?.body?.messages[0]?.depositor; - trans.price = balanceOf(_.get(trans, 'tx_response.tx.body.messages[0].funds[0].amount')); + trans.depositors = trans.data?.body?.messages[0]?.depositor; + trans.price = balanceOf(_.get(trans, 'data.body.messages[0].funds[0].amount')); return trans; } diff --git a/src/app/global/global.ts b/src/app/global/global.ts index 51146cf63..307a8e7f2 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -11,7 +11,6 @@ import { } from '../core/constants/transaction.enum'; import { CommonDataDto } from '../core/models/common.model'; import { balanceOf } from '../core/utils/common/parsing'; -import { log } from 'console'; Injectable(); export class Globals { @@ -126,6 +125,12 @@ export function getDataInfo(arrayMsg, addressContract, rawLog = '') { case eTransType.ExecuteContract: method = 'mint'; itemMessage.msg = itemMessage.msg || ''; + if (typeof itemMessage.msg === 'string') { + try { + itemMessage.msg = JSON.parse(itemMessage.msg); + } catch (e) {} + } + if (itemMessage.msg) { method = Object.keys(itemMessage.msg)[0]; } @@ -290,10 +295,11 @@ export function convertDataTransaction(data, coinInfo) { export function convertDataTransactionV2(data, coinInfo) { const txs = _.get(data, 'transaction').map((element) => { - console.log(element); if (!element['data']['body']) { element['data']['body'] = element['data']['tx']['body']; + element['data']['auth_info'] = element['data']['tx']['auth_info']; } + const code = _.get(element, 'code'); const tx_hash = _.get(element, 'hash'); const messages = _.get(element, 'data.body.messages'); @@ -322,7 +328,8 @@ export function convertDataTransactionV2(data, coinInfo) { } }); } - const type = _.find(TYPE_TRANSACTION, { label: _type })?.value || 'Execute'; + const typeOrigin = _type; + const type = _.find(TYPE_TRANSACTION, { label: _type })?.value || _type.split('.').pop(); const status = _.get(element, 'code') == CodeTransaction.Success ? StatusTransaction.Success : StatusTransaction.Fail; @@ -343,8 +350,27 @@ export function convertDataTransactionV2(data, coinInfo) { const timestamp = _.get(element, 'timestamp'); const gas_used = _.get(element, 'gas_used'); const gas_wanted = _.get(element, 'gas_wanted'); + let tx = _.get(element, 'data.tx_response'); + if (tx) { + tx['tx'] = _.get(element, 'data.tx'); + } - return { code, tx_hash, type, status, amount, fee, height, timestamp, gas_used, gas_wanted, denom, messages }; + return { + code, + tx_hash, + type, + status, + amount, + fee, + height, + timestamp, + gas_used, + gas_wanted, + denom, + messages, + tx, + typeOrigin, + }; }); return txs; } diff --git a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts index a28744a53..9170084e9 100644 --- a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts +++ b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts @@ -13,8 +13,8 @@ import { WalletService } from '../../core/services/wallet.service'; import { LAYOUT_MODE } from '../layouts.model'; import { MENU, MenuName } from './menu'; import { MenuItem } from './menu.model'; -import {from} from "rxjs"; -import {delay, mergeMap} from "rxjs/operators"; +import { from } from 'rxjs'; +import { delay, mergeMap } from 'rxjs/operators'; @Component({ selector: 'app-horizontaltopbar', @@ -50,7 +50,6 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { currentAddress; isAllowInABTWhiteList = true; - /** * Language Listing */ @@ -152,7 +151,6 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { this.isAllowInABTWhiteList = false; } }); - } checkWL() { @@ -165,7 +163,7 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { checkEnv() { this.env = this.environmentService.configValue.env; - + this.innerWidth = window.innerWidth; switch (this.env) { case 'serenity': @@ -367,9 +365,9 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { } getTxhDetail(value): void { - this.transactionService.txsIndexer(1, 0, decodeURI(value)).subscribe( - (res: ResponseDto) => { - if (res.data) { + this.transactionService.getListTx(1, 0, decodeURI(value)).subscribe( + (res) => { + if (res?.transaction?.length > 0) { this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => { this.router.navigate(['transaction', this.searchValue]); }); diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index 293f29f37..e13c7795b 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -28,7 +28,7 @@ import { TableTemplate } from '../../../core/models/common.model'; import { AccountService } from '../../../core/services/account.service'; import { CommonService } from '../../../core/services/common.service'; import { TransactionService } from '../../../core/services/transaction.service'; -import { convertDataTransaction, Globals } from '../../../global/global'; +import { convertDataTransaction, convertDataTransactionV2, Globals } from '../../../global/global'; import { chartCustomOptions, ChartOptions, CHART_OPTION } from './chart-options'; @Component({ @@ -309,16 +309,14 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { } getTxsFromHoroscope(nextKey = null): void { - const chainId = this.environmentService.configValue.chainId; const address = this.currentAddress; - - this.transactionService.getAccountTxFromHoroscope(chainId, address, 40, nextKey).subscribe({ - next: (txResponse) => { - const { code, data } = txResponse; - this.nextKey = data.nextKey || null; - - if (code === 200) { - const txs = convertDataTransaction(data, this.coinInfo); + this.transactionService.getAccountTxFromHoroscope(address, 40, nextKey).subscribe({ + next: (data) => { + if (data?.transaction?.length >= 40) { + this.nextKey = data?.transaction[data.length - 1].id; + } + if (data?.transaction?.length > 0) { + const txs = convertDataTransactionV2(data, this.coinInfo); txs.forEach((element) => { if (element.type === 'Send') { if (!element.messages.find((k) => k.from_address === this.currentAddress)) { diff --git a/src/app/pages/blocks/block-detail/block-detail.component.ts b/src/app/pages/blocks/block-detail/block-detail.component.ts index ff1bf6262..7e957a6a7 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.ts +++ b/src/app/pages/blocks/block-detail/block-detail.component.ts @@ -14,7 +14,7 @@ import { PAGE_EVENT } from '../../../../app/core/constants/common.constant'; import { TableTemplate } from '../../../../app/core/models/common.model'; import { BlockService } from '../../../../app/core/services/block.service'; import { CommonService } from '../../../../app/core/services/common.service'; -import { Globals, convertDataBlock, convertDataTransaction } from '../../../../app/global/global'; +import { Globals, convertDataBlock, convertDataTransaction, convertDataTransactionV2 } from '../../../../app/global/global'; @Component({ selector: 'app-block-detail', @@ -117,9 +117,9 @@ export class BlockDetailComponent implements OnInit { for (const key in res.block[0]?.data?.data?.txs) { const element = res.block[0]?.data?.data?.txs[key]; const tx = sha256(Buffer.from(element, 'base64')).toUpperCase(); - this.transactionService.txsIndexer(1, 0, tx).subscribe((res) => { - if (res.data.transactions[0]) { - txs.push(res.data.transactions[0]); + this.transactionService.getListTx(1, 0, tx).subscribe((res) => { + if (res?.transaction[0]) { + txs.push(res?.transaction[0]); } }); } @@ -128,9 +128,9 @@ export class BlockDetailComponent implements OnInit { setTimeout(() => { if (txs?.length > 0) { let dataTempTx = {}; - dataTempTx['transactions'] = txs; + dataTempTx['transaction'] = txs; if (txs.length > 0) { - txs = convertDataTransaction(dataTempTx, this.coinInfo); + txs = convertDataTransactionV2(dataTempTx, this.coinInfo); txs.forEach((k) => { this.blockDetail['gas_used'] += +k.gas_used; this.blockDetail['gas_wanted'] += +k.gas_wanted; diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html index 514696b10..b495ea80b 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html @@ -29,7 +29,10 @@ {{ shortenAddress(data[template.matColumnDef]) || '-' }} diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts index ef823de5d..cd5b8b288 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts @@ -2,7 +2,7 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnInit } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; -import { DATEFORMAT, PAGE_EVENT } from 'src/app/core/constants/common.constant'; +import { DATEFORMAT, LENGTH_CHARACTER, PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { CONTRACT_RESULT } from 'src/app/core/constants/contract.constant'; import { TableTemplate } from 'src/app/core/models/common.model'; import { ContractService } from 'src/app/core/services/contract.service'; @@ -30,6 +30,8 @@ export class CodeIdContractsTabComponent implements OnInit { { matColumnDef: 'verified_at', headerCellDef: 'Verified at' }, ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); + lengthAddress = LENGTH_CHARACTER.ADDRESS; + constructor(private contractService: ContractService, private datePipe: DatePipe) {} ngOnInit(): void { diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.html b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.html index 8d955923f..53d7bfafb 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.html +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.html @@ -27,16 +27,16 @@
+
diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index 790ba2bf4..09dbab647 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -6,7 +6,7 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { TableTemplate } from 'src/app/core/models/common.model'; import { ContractService } from 'src/app/core/services/contract.service'; import { isContract } from 'src/app/core/utils/common/validation'; -import { convertDataTransaction } from 'src/app/global/global'; +import { convertDataTransaction, convertDataTransactionV2 } from 'src/app/global/global'; import { CONTRACT_TAB, CONTRACT_TABLE_TEMPLATES } from '../../../../core/constants/contract.constant'; import { ContractTab, ContractVerifyType } from '../../../../core/constants/contract.enum'; @@ -36,7 +36,6 @@ export class ContractContentComponent implements OnInit, OnDestroy { countCurrent: string = ContractTab.Transactions; contractTab = ContractTab; contractVerifyType = ContractVerifyType; - nextKey = null; activeId = 0; limit = 25; contractTransaction = {}; @@ -49,6 +48,7 @@ export class ContractContentComponent implements OnInit, OnDestroy { popover: true, }; dataInstantiate = []; + loadingContract = true; destroyed$ = new Subject(); timerGetUpTime: any; @@ -120,14 +120,12 @@ export class ContractContentComponent implements OnInit, OnDestroy { getTransaction(isInit = true): void { if (isContract(this.contractsAddress)) { - this.contractService - .getTransactionsIndexer(this.limit, this.contractsAddress, 'execute') - .subscribe((dataExecute) => { - const { code, data } = dataExecute; - this.nextKey = dataExecute.data.nextKey; - if (code === 200) { - const txsExecute = convertDataTransaction(data, this.coinInfo); - if (dataExecute?.data?.transactions?.length > 0) { + this.contractService.getTransactionsIndexerV2(this.limit, this.contractsAddress, 'execute').subscribe( + (res) => { + const data = res; + if (res) { + const txsExecute = convertDataTransactionV2(data, this.coinInfo); + if (res?.transaction?.length > 0) { this.contractTransaction['data'] = txsExecute; this.contractTransaction['count'] = this.contractTransaction['data'].length || 0; } @@ -136,36 +134,15 @@ export class ContractContentComponent implements OnInit, OnDestroy { this.contractTransaction['data'] = [...this.contractTransaction['data'], this.dataInstantiate[0]]; this.contractTransaction['count'] = this.contractTransaction['count'] + this.dataInstantiate?.length; } - - //check data < 25 record - if (isInit) { - if (this.contractTransaction['data']?.length < this.limit || !this.contractTransaction['data']) { - this.contractService - .getTransactionsIndexer(this.limit, this.contractsAddress, 'instantiate') - .subscribe((dataInstantiate) => { - if (dataInstantiate.data?.transactions?.length > 0) { - const txsInstantiate = convertDataTransaction(dataInstantiate.data, this.coinInfo); - txsInstantiate[0]['type'] = - dataInstantiate.data.transactions[0].tx_response.tx.body.messages[0]['@type']; - txsInstantiate[0]['contract_address'] = this.contractsAddress; - let data = []; - this.dataInstantiate = txsInstantiate; - if (this.contractTransaction['data']?.length >= 1) { - data = [...this.contractTransaction['data'], txsInstantiate[0]]; - } else { - data = txsInstantiate; - } - let count = data.length || 0; - this.contractTransaction = { - data, - count, - }; - } - }); - } - } } - }); + }, + () => {}, + () => { + this.loadingContract = false; + }, + ); + } else { + this.loadingContract = false; } } diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts index 7ad85201d..db64fe140 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts @@ -4,12 +4,11 @@ import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; import { CONTRACT_TABLE_TEMPLATES } from 'src/app/core/constants/contract.constant'; -import { TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { ITableContract } from 'src/app/core/models/contract.model'; import { ContractService } from 'src/app/core/services/contract.service'; -import { convertDataTransaction } from 'src/app/global/global'; +import { convertDataTransaction, convertDataTransactionV2 } from 'src/app/global/global'; import { TableData } from 'src/app/shared/components/contract-table/contract-table.component'; @Component({ @@ -46,6 +45,9 @@ export class ContractsTransactionsComponent implements OnInit { txsInstantiate = []; currentPage = 0; destroyed$ = new Subject(); + modeTxType = { Out: 0, In: 1, Instantiate: 2 }; + hashIns = ''; + hasLoadIns = false; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); coinInfo = this.environmentService.configValue.chain_info.currencies[0]; @@ -71,7 +73,9 @@ export class ContractsTransactionsComponent implements OnInit { ngOnInit(): void { this.contractAddress = this.route.snapshot.paramMap.get('addressId'); + this.contractInfo.contractsAddress = this.contractAddress; this.getData(); + this.getDataInstantiate(); this.timerGetUpTime = setInterval(() => { // reload when page = 0 if (this.currentPage === 0) { @@ -93,31 +97,34 @@ export class ContractsTransactionsComponent implements OnInit { getData(isReload = false) { this.route.queryParams.subscribe((params) => { if (params['label']) { - this.label = params['label'] || 0; - } - switch (+this.label) { - case 1: - this.getDataTable(null, isReload); - break; - case 2: - this.getDataInstantiate(); - break; - default: - this.getDataTable(null, isReload); + this.label = params['label'] || this.modeTxType.Out; } + this.getDataTable(null, isReload); + // switch (+this.label) { + // case 1: + // this.getDataTable(null, isReload); + // break; + // default: + // this.getDataTable(null, isReload); + // } }); } getDataTable(nextKey = null, isReload = false) { - if (!this.label || +this.label == 1) { - this.contractService.getTransactionsIndexer(100, this.contractAddress, 'execute', nextKey).subscribe( + if (+this.label == this.modeTxType.In && !this.hasLoadIns) { + return; + } + if (!this.label || +this.label == this.modeTxType.In) { + const type = +this.label == this.modeTxType.In ? 'execute' : ''; + this.contractService.getTransactionsIndexerV2(100, this.contractAddress, type, this.hashIns, nextKey).subscribe( (dataExecute) => { - const { code, data } = dataExecute; - if (code === 200) { - const txsExecute = convertDataTransaction(data, this.coinInfo); + if (dataExecute) { + const txsExecute = convertDataTransactionV2(dataExecute, this.coinInfo); this.lengthTxsExecute = txsExecute.length; - if (dataExecute.data.transactions?.length > 0) { - this.nextKey = dataExecute.data.nextKey; + if (dataExecute.transaction?.length > 0) { + if (txsExecute.length >= 100) { + this.nextKey = dataExecute?.transaction[txsExecute.length - 1].id; + } if (this.contractTransaction['data']?.length > 0 && !isReload) { this.contractTransaction['data'] = [...this.contractTransaction['data'], ...txsExecute]; } else if (txsExecute.length > 0) { @@ -126,15 +133,9 @@ export class ContractsTransactionsComponent implements OnInit { } this.contractTransaction['count'] = this.contractTransaction['data']?.length; - if (this.label != 1) { - if (isReload && txsExecute?.length > 0 && txsExecute?.length < 100) { - this.contractTransaction['data'] = [...this.contractTransaction['data'], this.txsInstantiate[0]]; - this.contractTransaction['count'] = this.contractTransaction['data']?.length; - } - } if (!isReload) { - if (this.nextKey === null) { + if (this.nextKey === null && +this.label == this.modeTxType.Instantiate) { this.getDataInstantiate(); } } @@ -151,35 +152,25 @@ export class ContractsTransactionsComponent implements OnInit { } getDataInstantiate(): void { - this.contractService.getTransactionsIndexer(1, this.contractAddress, 'instantiate').subscribe( + this.contractService.getTransactionsIndexerV2(1, this.contractAddress, 'instantiate').subscribe( (dataInstantiate) => { - if (dataInstantiate.data.transactions?.length > 0) { - this.txsInstantiate = convertDataTransaction(dataInstantiate.data, this.coinInfo); - if (this.txsInstantiate.length > 0) { - this.txsInstantiate[0]['type'] = - dataInstantiate.data?.transactions[0]?.tx_response?.tx?.body.messages[0]['@type']; - this.txsInstantiate[0]['contract_address'] = this.contractAddress; - if (+this.label == 2) { - this.contractTransaction['data'] = this.txsInstantiate; - this.contractTransaction['count'] = this.txsInstantiate.length || 0; - return; - } - if (!this.label) { - if (this.contractTransaction['data']?.length >= 1) { - this.contractTransaction['data'].push(this.txsInstantiate[0]); - } else { - this.contractTransaction['data'] = this.txsInstantiate; - } - this.contractTransaction['count'] = this.contractTransaction['data']?.length || 0; - return; - } + this.hasLoadIns = true; + if (dataInstantiate.transaction?.length > 0) { + this.hashIns = dataInstantiate.transaction[0]?.hash; + if (+this.label == this.modeTxType.Instantiate) { + this.txsInstantiate = convertDataTransactionV2(dataInstantiate, this.coinInfo); + this.contractTransaction['data'] = this.txsInstantiate; + this.contractTransaction['count'] = this.txsInstantiate.length || 0; + } + if (+this.label == this.modeTxType.In) { + this.getDataTable(); + } else { + this.isLoadingTX = false; } } }, () => {}, - () => { - this.isLoadingTX = false; - }, + () => {}, ); } @@ -187,7 +178,7 @@ export class ContractsTransactionsComponent implements OnInit { const { pageIndex, pageSize } = event; this.currentPage = pageIndex; const next = event.length <= (pageIndex + 2) * pageSize; - if (next && this.nextKey && this.currentKey !== this.nextKey ) { + if (next && this.nextKey && this.currentKey !== this.nextKey) { this.getDataTable(this.nextKey); this.currentKey = this.nextKey; } diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index 3547e71d1..2f9c5cb91 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -45,25 +45,25 @@ export class DepositorsComponent implements OnInit { this.proposalService.getDepositors(payload).subscribe( (res) => { let dataList: any[] = []; - if (res?.data?.transactions?.length > 0) { - this.dataLength = res.data?.transactions?.length || 0; - dataList = res?.data?.transactions?.filter( + if (res?.transaction?.length > 0) { + this.dataLength = res.transaction?.length || 0; + dataList = res?.transaction?.filter( (transaction) => - transaction?.tx_response?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.Deposit || - (transaction?.tx_response?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx && - transaction?.tx_response?.tx?.body?.messages[0]?.initial_deposit?.length > 0), + transaction?.data?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.Deposit || + (transaction?.data?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx && + transaction?.data?.body?.messages[0]?.initial_deposit?.length > 0), ); dataList.forEach((item) => { - if (item.tx_response?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx) { - item.depositors = item.tx_response?.tx?.body?.messages[0]?.proposer; - item.amount = balanceOf(item.tx_response?.tx?.body?.messages[0].initial_deposit[0].amount); + if (item.data?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx) { + item.depositors = item.data?.body?.messages[0]?.proposer; + item.amount = balanceOf(item.data?.body?.messages[0].initial_deposit[0].amount); } else { - item.depositors = item.tx_response?.tx?.body?.messages[0]?.depositor; - item.amount = balanceOf(item.tx_response?.tx?.body?.messages[0].amount[0].amount); + item.depositors = item.data?.body?.messages[0]?.depositor; + item.amount = balanceOf(item.data?.body?.messages[0].amount[0].amount); } - item.txhash = item?.tx_response?.txhash; - item.timestamp = item?.tx_response?.timestamp; + item.txhash = item?.hash; + item.timestamp = item?.timestamp; }); this.depositorsList = dataList; } diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 37d54e49a..242466d16 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -333,7 +333,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { }; this.proposalService.getVotes(payload).subscribe((res) => { const optionVote = this.proposalService.getVoteMessageByConstant( - res?.data?.transactions[0]?.tx_response?.tx?.body?.messages[0]?.option, + res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, ); this.proposalVotes = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; this.voteValue = { diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index de805bc7d..5b72d9217 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -114,7 +114,7 @@ export class ProposalComponent implements OnInit { wallet: addr, }; this.proposalService.getVotes(payload).subscribe((res) => { - const optionVote = this.proposalService.getVoteMessageByConstant(res?.data?.transactions[0]?.tx_response?.tx?.body?.messages[0]?.option); + const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.tx?.body?.messages[0]?.option); pro.vote_option = this.voteConstant.find( (s) => s.key === optionVote, )?.voteOption; diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index 39170a836..fd25bd3c3 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -190,24 +190,31 @@ export class NFTDetailComponent implements OnInit { let filterData = {}; filterData['keyWord'] = this.nftId; - const res = await this.tokenService.getListTokenTransferIndexer(100, this.contractAddress, filterData, nextKey); - if (res?.data?.code === 200) { - res?.data?.data?.transactions.forEach((trans) => { - trans = parseDataTransaction(trans, this.coinMinimalDenom, this.contractAddress); - }); - let txs = []; - res.data?.data?.transactions.forEach((element, index) => { - txs.push(element); - if (element.type === 'buy') { - let txTransfer = { ...element }; - txTransfer['type'] = 'transfer'; - txTransfer['price'] = 0; - txs.push(txTransfer); + this.tokenService.getListTokenTransferIndexerV2(100, this.contractAddress, filterData).subscribe( + (res) => { + if (res) { + res?.transaction.forEach((trans) => { + trans = parseDataTransaction(trans, this.coinMinimalDenom, this.contractAddress); + }); + let txs = []; + res?.transaction.forEach((element, index) => { + txs.push(element); + if (element.type === 'buy') { + let txTransfer = { ...element }; + txTransfer['type'] = 'transfer'; + txTransfer['price'] = 0; + txs.push(txTransfer); + } + }); + this.dataSource.data = txs; + this.pageData.length = txs?.length; } - }); - this.dataSource.data = txs; - this.pageData.length = txs?.length; - } + }, + () => {}, + () => { + this.loading = false; + }, + ); } paginatorEmit(event): void { diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts index 2a41bbba2..7a8f1364c 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts @@ -17,7 +17,7 @@ import { TableTemplate } from '../../../../../../core/models/common.model'; import { CommonService } from '../../../../../../core/services/common.service'; import { TokenService } from '../../../../../../core/services/token.service'; import { shortenAddress } from '../../../../../../core/utils/common/shorten'; -import { Globals } from '../../../../../../global/global'; +import { Globals, convertDataTransactionV2 } from '../../../../../../global/global'; @Component({ selector: 'app-token-transfers-tab', @@ -80,6 +80,7 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { coinMinimalDenom = this.environmentService.configValue.chain_info.currencies[0].coinMinimalDenom; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; prefixAdd = this.environmentService.configValue.chain_info.bech32Config.bech32PrefixAccAddr; + coinInfo = this.environmentService.configValue.chain_info.currencies[0]; constructor( public global: Globals, @@ -130,27 +131,30 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { filterData['isSearchWallet'] = true; } - const res = await this.tokenService.getListTokenTransferIndexer(100, this.contractAddress, filterData, nextKey); - if (res?.data?.code === 200) { - this.nextKey = res.data.data.nextKey || null; - res?.data?.data?.transactions.forEach((trans) => { - trans = parseDataTransaction(trans, this.coinMinimalDenom, this.contractAddress); - }); - - if (this.dataSource.data.length > 0 && !isReload) { - this.dataSource.data = [...this.dataSource.data, ...res.data.data.transactions]; - } else { - this.dataSource.data = [...res.data.data.transactions]; - } - this.pageData.length = this.dataSource.data.length; - this.resultLength.emit(this.pageData.length); - if (this.nextKey) { - this.hasMore.emit(true); - } else { - this.hasMore.emit(false); - } - } - this.loading = false; + this.tokenService.getListTokenTransferIndexerV2(100, this.contractAddress, filterData).subscribe( + (res) => { + if (res) { + if (res.transaction.length >= 100) { + this.nextKey = res?.transaction[res.transaction.length - 1].id; + } + res.transaction?.forEach((trans) => { + trans = parseDataTransaction(trans, this.coinMinimalDenom, this.contractAddress); + }); + + if (this.dataSource.data.length > 0 && !isReload) { + this.dataSource.data = [...this.dataSource.data, ...res.transaction]; + } else { + this.dataSource.data = [...res.transaction]; + } + this.pageData.length = this.dataSource.data.length; + this.resultLength.emit(this.pageData.length); + } + }, + () => {}, + () => { + this.loading = false; + }, + ); } compare(a: number | string, b: number | string, isAsc: boolean) { diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index 8e3f1c994..cdd6a70d2 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -71,10 +71,8 @@ export class TransactionDetailComponent implements OnInit { if (this.txHash?.length === LENGTH_CHARACTER.TRANSACTION) { this.transactionService.getListTx(1, 0, this.txHash).subscribe( (res) => { - console.log('res dash') if (res?.transaction?.length > 0) { const txs = convertDataTransactionV2(res, this.coinInfo); - console.log(txs); this.transaction = txs[0]; this.transaction = { ...this.transaction, @@ -82,8 +80,7 @@ export class TransactionDetailComponent implements OnInit { gas_used: _.get(res?.transaction[0], 'gas_used'), gas_wanted: _.get(res?.transaction[0], 'gas_wanted'), raw_log: _.get(res?.transaction[0], 'data.tx_response.raw_log'), - type: _.get(res?.transaction[0], 'data.body.messages[0].@type'), - tx: _.get(res?.transaction[0], 'tx_hash'), + type: _.get(res?.transaction[0], 'data.tx.body.messages[0].@type'), }; if (this.transaction.raw_log && +this.transaction.code !== CodeTransaction.Success) { diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index cb70d859e..6d41a1134 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -135,7 +135,7 @@

Amount
@@ -157,7 +157,7 @@

{{ getDataIBC(ibcListMapping.Receive) }}
Amount
@@ -177,7 +177,7 @@

{{ getDataIBC(ibcListMapping.Ack) }}
Amount
@@ -225,7 +225,7 @@

{{ getDataIBC(ibcListMapping.TimeOut, index) }} @@ -257,7 +257,7 @@

[value]="ibcData?.time_out[index - 1]?.proof_height?.revision_height"> + [value]="getLongValue(ibcData?.time_out[index - 1]?.next_sequence_recv)"> diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index 141726b0f..ce54bb1d3 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -13,6 +13,7 @@ import { TransactionService } from 'src/app/core/services/transaction.service'; import * as _ from 'lodash'; import { formatWithSchema } from '../../../../core/helpers/date'; import { ProposalService } from 'src/app/core/services/proposal.service'; +import * as Long from 'long'; @Component({ selector: 'app-transaction-messages', @@ -308,15 +309,15 @@ export class TransactionMessagesComponent implements OnInit { case this.eTransType.StoreCode: result.push({ key: 'Sender', - value: data.sender || data.validator_address, + value: data?.sender || data?.validator_address, link: { url: '/account' }, }); result.push({ key: 'Code Id', value: this.getStoreCode(index), link: { url: '/code-ids/detail' } }); - result.push({ value: data.wasm_byte_code, specialCase: this.specialCase.ByteCode }); + result.push({ value: data?.wasm_byte_code, specialCase: this.specialCase.ByteCode }); break; case this.eTransType.Vote: - result.push({ key: 'Proposal Id', value: data.proposal_id, link: { url: '/votings' } }); + result.push({ key: 'Proposal Id', value: this.getLongValue(data.proposal_id), link: { url: '/votings' } }); result.push({ key: 'Voter', value: data.voter, link: { url: '/account' } }); result.push({ key: 'Option', value: this.parsingOptionVote(data?.option) }); break; @@ -414,7 +415,7 @@ export class TransactionMessagesComponent implements OnInit { if (this.transactionDetail?.tx?.logs?.length > 0) { result.push({ key: 'Proposal Id', - value: this.transactionDetail?.tx?.logs[0].events[4].attributes[0].value, + value: this.getLongValue(this.transactionDetail?.tx?.logs[0].events[4].attributes[0].value), link: { url: '/votings' }, }); result.push({ @@ -477,7 +478,7 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.Deposit: - result.push({ key: 'Proposal Id', value: data.proposal_id, link: { url: '/votings' } }); + result.push({ key: 'Proposal Id', value: this.getLongValue(data.proposal_id), link: { url: '/votings' } }); result.push({ key: 'Depositor', value: data.depositor, link: { url: '/account' } }); result.push({ key: 'Amount', @@ -488,7 +489,7 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.Deposit: - result.push({ key: 'Proposal Id', value: data.proposal_id, link: { url: '/votings' } }); + result.push({ key: 'Proposal Id', value: this.getLongValue(data.proposal_id), link: { url: '/votings' } }); result.push({ key: 'Depositor', value: data.depositor, link: { url: '/account' } }); result.push({ key: 'Amount', @@ -615,8 +616,17 @@ export class TransactionMessagesComponent implements OnInit { } displayMsgRaw(): void { - this.objMsgContract = _.get(this.transactionDetail.tx.tx.body, 'messages').map((element) => { + this.objMsgContract = _.get( + this.transactionDetail?.tx?.tx?.body || this.transactionDetail?.tx?.body, + 'messages', + ).map((element) => { let msg = _.get(element, 'msg'); + try { + if (typeof msg !== 'object' && msg !== null) { + msg = JSON.parse(msg); + } + } catch {} + //get type mint don't type token id if (!msg && this.transactionDetail?.raw_log.indexOf('mint') >= 0) { try { @@ -686,7 +696,6 @@ export class TransactionMessagesComponent implements OnInit { this.ibcData['time_out'] = this.transactionDetail?.tx?.tx?.body?.messages.filter( (k) => k['@type'] === TRANSACTION_TYPE_ENUM.IBCTimeout, ); - this.ibcData['update_client'] = this.transactionDetail?.tx?.tx?.body?.messages.find( (k) => k['@type'] === TRANSACTION_TYPE_ENUM.IBCUpdateClient, ); @@ -713,17 +722,20 @@ export class TransactionMessagesComponent implements OnInit { } if (this.ibcData['acknowledgement']) { + let data; try { let dataEncode = atob(this.ibcData['acknowledgement']?.packet?.data); - const data = JSON.parse(dataEncode); - this.ibcData['acknowledgement'] = { - ...this.ibcData['acknowledgement'], - amount: data.amount, - denom: data.denom, - receiver: data.receiver, - sender: data.sender, - }; - } catch (e) {} + data = JSON.parse(dataEncode); + } catch (e) { + data = this.ibcData['acknowledgement']?.packet?.data; + } + this.ibcData['acknowledgement'] = { + ...this.ibcData['acknowledgement'], + amount: data.amount, + denom: data.denom, + receiver: data.receiver, + sender: data.sender, + }; } if (this.ibcData['receive']) { @@ -744,19 +756,18 @@ export class TransactionMessagesComponent implements OnInit { if (!sequence) { return; } - this.transactionService.getListIBCSequence(sequence).subscribe((res) => { - const { code, data } = res; - if (code === 200) { + this.transactionService.getListIBCSequence(sequence, this.ibcData?.packet_src_channel).subscribe((res) => { + if (res?.transaction?.length > 0) { let typeTx; this.listIBCProgress = []; - let txs = _.get(data, 'transactions').map((element) => { - const code = _.get(element, 'tx_response.code'); - const tx_hash = _.get(element, 'tx_response.txhash'); - const time = _.get(element, 'tx_response.timestamp'); + let txs = _.get(res, 'transaction').map((element) => { + const code = _.get(element, 'data.tx_response.code'); + const tx_hash = _.get(element, 'data.tx_response.txhash'); + const time = _.get(element, 'data.tx_response.timestamp'); const effected = _.get(element, 'indexes.fungible_token_packet_success')?.length > 0 ? 1 : 0; - typeTx = _.get(element, 'tx_response.tx.body.messages[0].@type'); - const lstType = _.get(element, 'tx_response.tx.body.messages'); + typeTx = _.get(element, 'data.tx.body.messages[0].@type'); + const lstType = _.get(element, 'data.tx.body.messages'); if (lstType?.length > 0) { lstType.forEach((type) => { if (type['@type'] !== TRANSACTION_TYPE_ENUM.IBCUpdateClient) { @@ -766,13 +777,13 @@ export class TransactionMessagesComponent implements OnInit { }); } - let temp = _.get(element, 'tx_response.tx.auth_info.fee.amount[0].denom') || this.coinMinimalDenom; + let temp = _.get(element, 'data.tx.auth_info.fee.amount[0].denom') || this.coinMinimalDenom; const denom = temp === this.coinMinimalDenom ? this.denom : temp; return { code, tx_hash, typeTx, denom, time, effected }; }); if (this.ibcData['typeProgress'] === this.eTransType.IBCReceived) { txs = txs.filter((k) => k.typeTx === this.eTransType.IBCReceived); - this.denomIBC = data.transactions[0].indexes.denomination_trace_denom[0]; + this.denomIBC = res.transaction[0]?.event_attributes[0]?.value; } else { txs = txs.filter((k) => k.typeTx !== this.eTransType.IBCReceived); } @@ -841,4 +852,12 @@ export class TransactionMessagesComponent implements OnInit { } return value; } + + getLongValue(value) { + const longProposalId = Long.fromValue(value); + if (Long.isLong(longProposalId)) { + value = longProposalId.toString(); + } + return value; + } } diff --git a/src/app/pages/transaction/transaction.component.ts b/src/app/pages/transaction/transaction.component.ts index d5149f9d9..41a282bb2 100644 --- a/src/app/pages/transaction/transaction.component.ts +++ b/src/app/pages/transaction/transaction.component.ts @@ -65,26 +65,26 @@ export class TransactionComponent implements OnInit { ); } - getList(): void { - this.transactionService.txsIndexer(this.pageSize, 0).subscribe( - (res) => { - const { code, data } = res; - if (code === 200) { - const txs = convertDataTransaction(data, this.coinInfo); - if (this.dataSource.data.length > 0) { - this.dataSource.data = [...this.dataSource.data, ...txs]; - } else { - this.dataSource.data = [...txs]; - } - this.dataTx = txs; - } - }, - () => {}, - () => { - this.loading = false; - }, - ); - } + // getList(): void { + // this.transactionService.txsIndexer(this.pageSize, 0).subscribe( + // (res) => { + // const { code, data } = res; + // if (code === 200) { + // const txs = convertDataTransaction(data, this.coinInfo); + // if (this.dataSource.data.length > 0) { + // this.dataSource.data = [...this.dataSource.data, ...txs]; + // } else { + // this.dataSource.data = [...txs]; + // } + // this.dataTx = txs; + // } + // }, + // () => {}, + // () => { + // this.loading = false; + // }, + // ); + // } checkAmountValue(amount: number, txHash: string) { if (amount === 0) { diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index 01e79b4c7..0add89f83 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -4,14 +4,13 @@ import { Component, HostListener, OnDestroy, OnInit, ViewChild, ViewEncapsulatio import { MatSort, Sort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { Router } from '@angular/router'; -import { fromBech32, toHex } from '@cosmjs/encoding'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; -import { forkJoin, Subject, Subscription } from 'rxjs'; +import { Subject, Subscription, forkJoin } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; +import { VOTING_POWER_STATUS } from 'src/app/core/constants/validator.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { getFee } from 'src/app/core/utils/signing/fee'; import { NUMBER_CONVERT, NUM_BLOCK, TIME_OUT_CALL_API } from '../../../app/core/constants/common.constant'; -import { CodeTransaction } from '../../../app/core/constants/transaction.enum'; import { DIALOG_STAKE_MODE, STATUS_VALIDATOR } from '../../../app/core/constants/validator.enum'; import { ESigningType, SIGNING_MESSAGE_TYPES } from '../../../app/core/constants/wallet.constant'; import { DataDelegateDto, ResponseDto, TableTemplate } from '../../../app/core/models/common.model'; @@ -19,12 +18,10 @@ import { AccountService } from '../../../app/core/services/account.service'; import { CommonService } from '../../../app/core/services/common.service'; import { MappingErrorService } from '../../../app/core/services/mapping-error.service'; import { NgxToastrService } from '../../../app/core/services/ngx-toastr.service'; -import { TransactionService } from '../../../app/core/services/transaction.service'; import { ValidatorService } from '../../../app/core/services/validator.service'; import { WalletService } from '../../../app/core/services/wallet.service'; import local from '../../../app/core/utils/storage/local'; import { Globals } from '../../../app/global/global'; -import { VOTING_POWER_STATUS } from 'src/app/core/constants/validator.constant'; @Component({ selector: 'app-validators', diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index a18d65fa1..0602573a3 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -1,7 +1,7 @@
- {{ nextKey || isMoreTx ? 'More than' : 'A total of' }} + {{ nextKey ? 'More than' : 'A total of' }} {{ contractInfo.count | mask : 'separator.6' }}
{{ parseLabel(label) }}
diff --git a/src/app/shared/components/contract-table/contract-table.component.ts b/src/app/shared/components/contract-table/contract-table.component.ts index 565716262..688736874 100644 --- a/src/app/shared/components/contract-table/contract-table.component.ts +++ b/src/app/shared/components/contract-table/contract-table.component.ts @@ -2,13 +2,14 @@ import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angu import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; +import * as _ from 'lodash'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { ContractTransactionType } from 'src/app/core/constants/contract.enum'; -import { ModeExecuteTransaction, TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; +import { TYPE_TRANSACTION } from 'src/app/core/constants/transaction.constant'; +import { TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { DROPDOWN_ELEMENT, IContractPopoverData, ITableContract } from 'src/app/core/models/contract.model'; -import { ContractService } from 'src/app/core/services/contract.service'; import { balanceOf, parseLabel } from 'src/app/core/utils/common/parsing'; import { Globals } from 'src/app/global/global'; import { DropdownElement } from 'src/app/shared/components/dropdown/dropdown.component'; @@ -65,7 +66,6 @@ export class ContractTableComponent implements OnInit, OnChanges { public translate: TranslateService, public global: Globals, private environmentService: EnvironmentService, - private contractService: ContractService, ) {} ngOnChanges(): void { @@ -79,7 +79,6 @@ export class ContractTableComponent implements OnInit, OnChanges { ngOnInit(): void { this.displayedColumns = this.templates?.map((dta) => dta.matColumnDef); - this.checkTotal(); } loadTableData() { @@ -143,12 +142,19 @@ export class ContractTableComponent implements OnInit, OnChanges { let from = ''; let to = ''; let method = ''; - switch (contract.type) { + let msg = contract.messages[0]?.msg; + if (typeof msg === 'string') { + try { + msg = JSON.parse(contract.messages[0]?.msg); + } catch (e) {} + } + + switch (contract.typeOrigin) { case TRANSACTION_TYPE_ENUM.InstantiateContract: case TRANSACTION_TYPE_ENUM.InstantiateContract2: method = 'instantiate'; from = contract.messages[0].sender; - to = contract.contract_address; + to = contract.contract_address || this.contractInfo.contractsAddress; break; case TRANSACTION_TYPE_ENUM.Send: method = 'transfer'; @@ -157,24 +163,21 @@ export class ContractTableComponent implements OnInit, OnChanges { to = contract.messages[0].to_address; break; case TRANSACTION_TYPE_ENUM.ExecuteContract: - method = Object.keys(contract.messages[0].msg)[0]; + method = Object.keys(msg)[0]; value = +contract.messages[0].funds[0]?.amount; from = contract.messages[0].sender; to = contract.messages[0].contract; break; default: - if (contract.messages[0]?.msg?.accept_nft_offer?.funds_amount) { - method = ModeExecuteTransaction.AcceptOffer; - // value = +contract.messages[0]?.msg?.accept_nft_offer?.funds_amount; + if (Object.keys(msg)[0]?.length > 1) { + method = Object.keys(msg)[0]; } else { - method = 'mint'; + const typeTemp = contract.messages[0]['@type']; + method = _.find(TYPE_TRANSACTION, { label: typeTemp })?.value || typeTemp.split('.').pop(); } if (contract.messages[0]?.funds) { value = +contract.messages[0]?.funds[0]?.amount; } - if (contract.messages[0]?.msg) { - method = Object.keys(contract.messages[0]?.msg)[0]; - } from = contract.messages[0].sender; to = contract.messages[0].contract; break; @@ -212,16 +215,4 @@ export class ContractTableComponent implements OnInit, OnChanges { }, 2000); } } - - checkTotal() { - if (!this.viewAll && this.dataList?.data?.length === this.pageSize) { - this.contractService - .getTransactionsIndexer(1, this.contractInfo?.contractsAddress, 'instantiate') - .subscribe((res) => { - if (res?.data?.transactions?.length > 0) { - this.isMoreTx = true; - } - }); - } - } } From dc1ebef9bed1cfa9010ae01ddaef65626281ddea Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 18 May 2023 10:27:30 +0700 Subject: [PATCH 009/315] [TamTM6] update tx ver 2 part 3 --- src/app/core/services/transaction.service.ts | 2 +- src/app/core/services/validator.service.ts | 38 ++++++++++++++++++- .../validators-detail.component.ts | 24 ++++++------ 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 5bc9756ec..2683c55d6 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -83,7 +83,7 @@ export class TransactionService extends CommonService { const operationsDoc = ` query getListTx($limit: Int) { ${this.envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {event_attribute_index: {value: {_eq: "${address}"} ${filterQuery} }}) { + transaction(limit: $limit, order_by: {timestamp: desc}, where: {event_attribute_index: {value: {_eq: "${address}"}} ${filterQuery} }) { id height hash diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 03b721d07..4b0168020 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -7,6 +7,8 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { CommonService } from 'src/app/core/services/common.service'; import { LCD_COSMOS } from '../constants/url.constant'; import { Globals } from 'src/app/global/global'; +import { checkEnvQuery } from '../utils/common/info-common'; +import { map } from 'rxjs/operators'; @Injectable({ providedIn: 'root', @@ -15,6 +17,8 @@ export class ValidatorService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; + graphUrl = `${this.environmentService.configValue.graphUrl}`; + envDB = checkEnvQuery(this.environmentService.configValue.env); stakingAPRSubject: BehaviorSubject; constructor( @@ -66,7 +70,39 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators/${address}`); } - validatorsDetailListPower(address: string, pageLimit = 10, nextKey = null): Observable { + validatorsDetailListPower(address: string, limit = 10, nextKey = null) { + let filterQuery = ''; + if (nextKey) { + filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; + } + const operationsDoc = ` + query getListPower($type: [String]) { + ${this.envDB} { + transaction(limit: ${limit}, order_by: {timestamp: desc}, where: {events: {event_attributes: {key: {_in: ["validator", "destination_validator"]}, value: {_eq: "${address}" }}}, transaction_messages: {type: {_in: $type}} ${filterQuery} }) { + id + hash + height + timestamp + data(path: "tx") + power_events { + amount + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + type: ["/cosmos.staking.v1beta1.MsgDelegate","/cosmos.staking.v1beta1.MsgUndelegate","/cosmos.staking.v1beta1.MsgBeginRedelegate"] + }, + operationName: 'getListPower', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + + validatorsDetailListPowerOld(address: string, pageLimit = 10, nextKey = null): Observable { const params = _({ chainid: this.chainInfo.chainId, address, diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 96ade9c54..2bc92e190 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -267,15 +267,15 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { getListPower(nextKey = null, isInit = true): void { this.validatorService.validatorsDetailListPower(this.currentAddress, 100, nextKey).subscribe( (res) => { - const { code, data } = res; - this.nextKey = data.nextKey || null; - - if (code === 200) { - const txs = _.get(data, 'transactions').map((element) => { + if (res?.transaction?.length > 0) { + if (res?.transaction?.length >= 100) { + this.nextKey = res?.transaction[res?.transaction?.length - 1].id; + } + const txs = _.get(res, 'transaction').map((element) => { let isStakeMode = false; - const tx_hash = _.get(element, 'tx_response.txhash'); - const address = _.get(element, 'tx_response.tx.body.messages[0].validator_dst_address'); - const _type = _.get(element, 'tx_response.tx.body.messages[0].@type'); + const tx_hash = _.get(element, 'hash'); + const address = _.get(element, 'data.body.messages[0].validator_dst_address'); + const _type = _.get(element, 'data.body.messages[0].@type'); if ( _type === TRANSACTION_TYPE_ENUM.Delegate || (_type === TRANSACTION_TYPE_ENUM.Redelegate && address === this.currentAddress) || @@ -285,17 +285,17 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { isStakeMode = true; } let amount = getAmount( - _.get(element, 'tx_response.tx.body.messages'), + _.get(element, 'data.body.messages'), _type, - _.get(element, 'tx_response.tx.body.raw_log'), + _.get(element, 'data.body.raw_log'), ); if (amount === 0 && element?.tx_response?.tx?.body?.messages.length > 0) { amount = 'More'; } - const height = _.get(element, 'tx_response.height'); - const timestamp = _.get(element, 'tx_response.timestamp'); + const height = _.get(element, 'height'); + const timestamp = _.get(element, 'timestamp'); return { tx_hash, amount, isStakeMode, height, timestamp }; }); From d313bb9fc1270fc0d86dc27ca09624e69ec43389 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 18 May 2023 11:28:38 +0700 Subject: [PATCH 010/315] apply horoscope v2 for account (cherry picked from commit 4bbd7235495cbd2e5ca2f5ee5d501e00fc54a6c6) --- src/app/core/services/wallet.service.ts | 75 +++++++++++++++---------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/src/app/core/services/wallet.service.ts b/src/app/core/services/wallet.service.ts index fda1cbe37..df205912c 100644 --- a/src/app/core/services/wallet.service.ts +++ b/src/app/core/services/wallet.service.ts @@ -21,6 +21,7 @@ import { WalletStorage } from '../models/wallet'; import { getKeplr, handleErrors } from '../utils/keplr'; import local from '../utils/storage/local'; import { NgxToastrService } from './ngx-toastr.service'; +import { checkEnvQuery } from '../utils/common/info-common'; export type WalletKey = Partial | AccountResponse; @@ -31,7 +32,7 @@ export class WalletService implements OnDestroy { apiUrl = `${this.environmentService.configValue.beUri}`; chainId = this.environmentService.configValue.chainId; chainInfo = this.environmentService.configValue.chain_info; - urlIndexer = this.environmentService.configValue.indexerUri; + graphUrl = `${this.environmentService.configValue.graphUrl}`; coin98Client: Coin98Client; destroyed$ = new Subject(); @@ -314,38 +315,52 @@ export class WalletService implements OnDestroy { } private makeSignDocData(address, signDoc: Partial): Observable { - return this.http.get(`${this.urlIndexer}/account-info?address=${address}&chainId=${signDoc.chain_id}`).pipe( - map((res) => { - let accountAuth; - accountAuth = _.get(res, 'data.account_auth.account'); - let account: { - account_number: number | string; - sequence: number | string; - }; - - if (accountAuth && accountAuth['@type'] === EAccountType.BaseAccount) { - account = accountAuth; - } else { - account = _.get(accountAuth, 'base_vesting_account.base_account'); + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query getAccountInfo { + ${envDB} { + account (where: {address: {_eq: $address}}) { + account_number + sequence + type } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + address: address, + }, + operationName: 'getAccountInfo', + }) + .pipe( + map((res) => { + let accountAuth; + accountAuth = res?.data[envDB].account; + let account: { + account_number: number | string; + sequence: number | string; + }; - if (!account.account_number) { - throw new Error('Can not get Account'); - } + if (!res?.data[envDB].account) { + throw new Error('Can not get Account'); + } - if (account) { - return makeSignDoc( - signDoc.msgs, - signDoc.fee, - signDoc.chain_id, - signDoc.memo, - account.account_number, - account.sequence || 0, - ); - } - throw new Error('Can not get Account'); - }), - ); + if (account) { + return makeSignDoc( + signDoc.msgs, + signDoc.fee, + signDoc.chain_id, + signDoc.memo, + res?.data[envDB].account.account_number, + res?.data[envDB].account.sequence || 0, + ); + } + throw new Error('Can not get Account'); + }), + ); } signMessage(base64String: string) { From dd2bc40385ab65422d8ce6e232e4afb4f25d8eec Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 18 May 2023 13:51:18 +0700 Subject: [PATCH 011/315] apply horoscope v2 for account (cherry picked from commit 6b9b846be46a4c39923380c1d8505d81154fb518) --- src/app/core/services/wallet.service.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/app/core/services/wallet.service.ts b/src/app/core/services/wallet.service.ts index df205912c..b773b3d28 100644 --- a/src/app/core/services/wallet.service.ts +++ b/src/app/core/services/wallet.service.ts @@ -317,7 +317,7 @@ export class WalletService implements OnDestroy { private makeSignDocData(address, signDoc: Partial): Observable { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query getAccountInfo { + query getAccountInfo ($address: String) { ${envDB} { account (where: {address: {_eq: $address}}) { account_number @@ -331,31 +331,28 @@ export class WalletService implements OnDestroy { .post(this.graphUrl, { query: operationsDoc, variables: { - address: address, + address, }, operationName: 'getAccountInfo', }) .pipe( map((res) => { - let accountAuth; - accountAuth = res?.data[envDB].account; - let account: { - account_number: number | string; - sequence: number | string; - }; - - if (!res?.data[envDB].account) { + if (!res?.data[envDB].account[0]) { throw new Error('Can not get Account'); } + const accountAuth: { + account_number: number | string; + sequence: number | string; + } = res?.data[envDB].account[0]; - if (account) { + if (accountAuth) { return makeSignDoc( signDoc.msgs, signDoc.fee, signDoc.chain_id, signDoc.memo, - res?.data[envDB].account.account_number, - res?.data[envDB].account.sequence || 0, + accountAuth.account_number, + accountAuth.sequence || 0, ); } throw new Error('Can not get Account'); From fb1395524ff98f5c15a58ba855f0c9c2ea970dd4 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 18 May 2023 16:37:47 +0700 Subject: [PATCH 012/315] [TamTM6] fix display multisend (cherry picked from commit e5852db30b9f9d328113ffc2841afce042fe02d5) --- .../transaction-messages.component.html | 54 +++++++++---------- .../transaction-messages.component.scss | 27 ++++++++++ .../transaction-messages.component.ts | 5 -- 3 files changed, 53 insertions(+), 33 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 6a578f8ef..21eac9613 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -397,36 +397,34 @@

- -
- - - -
-
Amount
-
- {{ item?.coins[0]?.amount | balanceOf | mask : 'separator.6' }} - {{ denom }} +
+
+ + Multisend +
+
+ +
+
From
+ + {{ transactionDetail?.messages[0]?.inputs[0]?.address }} + +
To
+ + {{ item?.address }} + +
+ +
+ {{ item?.coins[0]?.amount | balanceOf | mask : 'separator.6' }} + {{ denom }} +
+
-
+
- -
- -
+
+
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 9a5a17cfd..356d2e96e 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -69,3 +69,30 @@ overflow: hidden; text-overflow: ellipsis; } + +.box-multisend { + .card-text { + padding-bottom: var(--spacer-3); + border-bottom: 1px solid var(--aura-gray-8); + } + .body-multisend { + max-height: 440px; + overflow-y: scroll; + .txt-label { + min-width: 75px; + } + .txt-address { + min-width: 365px; + } + .txt-amount { + min-width: 100px; + display: flex; + align-items: center; + text-align: right; + } + } + + @media (max-width: 1366px) { + overflow: scroll; + } +} diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index 7323ffc0b..7bc008f53 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -53,7 +53,6 @@ export class TransactionMessagesComponent implements OnInit { Ack: 'acknowledge_packet', TimeOut: 'timeout_packet', }; - numberListSend = 5; spendLimitAmount = 0; typeGrantAllowance = 'Basic'; denomIBC = ''; @@ -820,10 +819,6 @@ export class TransactionMessagesComponent implements OnInit { return typeTrans?.value; } - loadMoreSend() { - this.numberListSend += 5; - } - getDataJson(key) { try { const jsonData = JSON.parse(this.transactionDetail?.raw_log); From 9719ca01e42a618ebac44bd7e2259ae06ae7017b Mon Sep 17 00:00:00 2001 From: mtam Date: Mon, 22 May 2023 14:20:04 +0700 Subject: [PATCH 013/315] [TamTM6] fix indexer v2 part 3 --- src/app/core/helpers/jwt.interceptor.ts | 5 +- src/app/core/services/block.service.ts | 92 ++--------- src/app/core/services/contract.service.ts | 53 ------ src/app/core/services/proposal.service.ts | 127 ++++++-------- src/app/core/services/token.service.ts | 32 ---- src/app/core/services/transaction.service.ts | 155 ++++++++---------- src/app/core/services/validator.service.ts | 62 +++++-- src/app/global/global.ts | 5 +- .../horizontaltopbar.component.ts | 6 +- .../account-detail.component.ts | 18 +- .../block-detail/block-detail.component.html | 2 +- .../block-detail/block-detail.component.ts | 25 ++- src/app/pages/blocks/blocks.component.ts | 5 +- .../contract-content.component.ts | 11 +- .../contracts-transactions.component.ts | 39 +++-- .../pages/dashboard/dashboard.component.ts | 16 +- .../depositors/depositors.component.html | 2 +- .../depositors/depositors.component.ts | 9 +- .../summary-info/summary-info.component.ts | 12 +- src/app/pages/proposal/proposal.component.ts | 12 +- .../token/nft-detail/nft-detail.component.ts | 19 ++- .../token-inventory-tab.component.ts | 6 +- .../token-transfers-tab.component.ts | 46 ++++-- .../transaction-detail.component.ts | 8 +- .../transaction-messages.component.ts | 4 +- .../transaction/transaction.component.ts | 8 +- .../validators-detail.component.ts | 39 ++--- .../pages/validators/validators.component.ts | 2 +- 28 files changed, 370 insertions(+), 450 deletions(-) diff --git a/src/app/core/helpers/jwt.interceptor.ts b/src/app/core/helpers/jwt.interceptor.ts index 3c0ea43a7..d3acfdc46 100644 --- a/src/app/core/helpers/jwt.interceptor.ts +++ b/src/app/core/helpers/jwt.interceptor.ts @@ -10,10 +10,7 @@ export class JwtInterceptor implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable> { const currentUser = this.authenticationService.currentUserValue; request = request.clone({ - setHeaders: { - 'x-hasura-admin-secret': 'abc@123', - 'Hasura-Client-Name': 'hasura-console', - }, + setHeaders: {}, }); return next.handle(request); } diff --git a/src/app/core/services/block.service.ts b/src/app/core/services/block.service.ts index cc91c86de..c0782b50e 100644 --- a/src/app/core/services/block.service.ts +++ b/src/app/core/services/block.service.ts @@ -23,89 +23,20 @@ export class BlockService extends CommonService { return this.http.get(`${this.apiUrl}/metrics/transactions?range=${type}&timezone=${date.getTimezoneOffset()}`); } - getBlockWithOperator(payload) { - const address = payload.address; - const nextHeight = payload.nextHeight; - let updateQuery = ''; - if (nextHeight !== null) { - updateQuery = ', height: {_lt: ' + nextHeight + ', _lte:' + (nextHeight - 100) + '}'; - } + getDataBlock(payload) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query getBlockWithOperator($address: String) { - ${this.envDB} { - block(where: {validator: {operator_address: {_eq: $address}} ${updateQuery}} , order_by: {time: desc}, limit: 100) { - height - hash - time - data(path: "block") + query auratestnet_block($limit: Int = 100, $order: order_by = desc, $height: Int = null, $hash: String = null, $path: String = null, $operatorAddress: String = null, $heightGT: Int = null, $heightLT: Int = null) { + ${envDB} { + block(limit: $limit, order_by: {height: $order}, where: {height: {_eq: $height, _gt: $heightGT, _lt: $heightLT}, hash: {_eq: $hash}, validator: {operator_address: {_eq: $operatorAddress}}}) { + data(path: $path) validator { operator_address description } - transactions { - gas_used - gas_wanted - } - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - address: address, - }, - operationName: 'getBlockWithOperator', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - getListBlock(limit: number) { - const operationsDoc = ` - query getListBlocks($limit: Int) { - ${this.envDB} { - block(limit: $limit, order_by: {time: desc}) { - height hash - time - data(path: "block") - validator { - operator_address - description - } - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: limit, - }, - operationName: 'getListBlocks', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - getBlockDetail(height: string | number) { - const operationsDoc = ` - query getBlockDetail($height: Int) { - ${this.envDB} { - block(where: {height: {_eq: $height}}) { height - hash time - data(path: "block") - validator { - operator_address - description - } - transactions { - gas_used - gas_wanted - } } } } @@ -114,9 +45,16 @@ export class BlockService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { - height: height, + limit: payload.limit, + order: 'desc', + hash: null, + height: payload.height, + path: 'block', + operatorAddress: payload.address, + heightGT: null, + heightLT: payload.nextHeight, }, - operationName: 'getBlockDetail', + operationName: 'auratestnet_block', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 7c9987ad5..ea223e424 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -1,11 +1,9 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; import { IResponsesTemplates } from 'src/app/core/models/common.model'; import { SmartContractListReq } from 'src/app/core/models/contract.model'; import { EnvironmentService } from '../data-services/environment.service'; -import { checkEnvQuery } from '../utils/common/info-common'; import { CommonService } from './common.service'; @Injectable() @@ -30,57 +28,6 @@ export class ContractService extends CommonService { return this.http.post(`${this.apiUrl}/contracts`, data); } - getTransactionsIndexerV2( - pageLimit: string | number, - contractAddress = '', - type: string, - hashIns = '', - nextKey = null, - ) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); - let filterQuery = ''; - if (type) { - if (type === 'execute' && hashIns) { - filterQuery = `, hash: {_neq: ${hashIns}}`; - } else if (type === 'instantiate') { - filterQuery = `, events : {type: {_eq: "${type}" }}`; - } - } - if (nextKey) { - filterQuery = filterQuery.concat(', id: {_lt: ' + `${nextKey}` + '}'); - } - - const operationsDoc = ` - query getListTx($limit: Int, $event_attr_val: String, $tx_msg_val: jsonb) { - ${envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {_and: {_or: [{events: {event_attributes: {key: {_eq: "_contract_address"}, value: {_eq: $event_attr_val}}}}, {transaction_messages: {content: {_contains: $tx_msg_val}}}] ${filterQuery} }}) { - id - height - hash - timestamp - code - gas_used - gas_wanted - data(path: "tx") - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: pageLimit, - event_attr_val: contractAddress, - tx_msg_val: { - contract: contractAddress, - }, - }, - operationName: 'getListTx', - }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); - } - verifyCodeID(data: any): Observable { return this.http.post(`${this.apiUrl}/contracts/verify-code-id`, data); } diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index c1cb8ef70..4e6077dad 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -25,46 +25,6 @@ export class ProposalService extends CommonService { super(http, environmentService); } - getVotes(payload): Observable { - const operationsDoc = ` - query getVotes($proposalId: String, $tx_msg_val: jsonb) { - ${this.envDB} { - transaction(order_by: {timestamp: desc}, limit: 1, where: {transaction_messages: {type: {_eq: "/cosmos.gov.v1beta1.MsgVote"}, content: {_contains: $tx_msg_val}}, event_attributes: {key: {_eq: "proposal_id"}, value: {_eq: $proposalId}}}) { - height - data - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - proposalId: payload.proposalId.toString(), - tx_msg_val: { - voter: payload.wallet, - }, - }, - operationName: 'getVotes', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - // getVotes(payload) { - // const params = _({ - // chainid: this.chainInfo.chainId, - // searchValue: payload.proposalId, - // searchType: 'proposal_vote', - // searchKey: 'proposal_id', - // ['queryAnd[]']: 'transfer.sender='+payload.wallet, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // return this.http.get(`${this.indexerUrl}/transaction`, { params }); - // } - getValidatorVotesFromIndexer(proposalid): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -77,47 +37,6 @@ export class ProposalService extends CommonService { return this.http.get(`${this.indexerUrl}/votes/validators`, { params }); } - getDepositors(payload) { - const operationsDoc = ` - query getDepositors($limit: Int, $proposalId: String) { - ${this.envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {event_attributes: {key: {_eq: "proposal_id"}, value: {_eq: $proposalId}}, events: {type: {_eq: "proposal_deposit"} }}) { - hash - timestamp - data(path:"tx") - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: payload.pageLimit, - proposalId: payload.proposalId.toString(), - }, - operationName: 'getDepositors', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - // getDepositors(payload) { - // const params = _({ - // chainid: this.chainInfo.chainId, - // searchValue: payload.proposalId, - // searchType: 'proposal_deposit', - // searchKey: 'proposal_id', - // pageLimit: payload.pageLimit, - // nextKey: payload.nextKey, - // // countTotal: true, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // return this.http.get(`${this.indexerUrl}/transaction`, { params }); - // } - getListVoteFromIndexer(payload, option): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -134,6 +53,52 @@ export class ProposalService extends CommonService { return this.http.get(`${this.indexerUrl}/votes`, { params }); } + // getProposalListDetail(payload) { + // const envDB = checkEnvQuery(this.environmentService.configValue.env); + // const operationsDoc = ` + // query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = 10) { + // ${envDB} { + // proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}}, order_by: {proposal_id: $order}) { + // content + // deposit_end_time + // description + // initial_deposit + // proposal_id + // proposer_address + // proposer { + // description + // operator_address + // account_address + // } + // status + // submit_time + // tally + // title + // total_deposit + // turnout + // type + // updated_at + // voting_end_time + // voting_start_time + // } + // } + // } + + // `; + // return this.http + // .post(this.graphUrl, { + // query: operationsDoc, + // variables: { + // limit: payload.limit, + // offset: 0, + // order: 'desc', + // proposalId: payload.proposalId, + // }, + // operationName: 'auratestnet_proposal', + // }) + // .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + // } + getProposalList(pageLimit = 20, nextKey = null, proposalId = null): Observable { const params = _({ chainid: this.chainInfo.chainId, diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index c999b4675..82bf37410 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -1,6 +1,5 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import axios from 'axios'; import * as _ from 'lodash'; import { Observable } from 'rxjs'; import { LENGTH_CHARACTER } from '../constants/common.constant'; @@ -89,37 +88,6 @@ export class TokenService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } - // getListTokenTransferIndexerOld(pageLimit: string | number, contractAddress: string, filterData: any, nextKey = null) { - // const params = _({ - // chainid: this.chainInfo.chainId, - // searchType: 'execute', - // searchKey: '_contract_address', - // searchValue: contractAddress, - // needFullLog: true, - // pageLimit, - // nextKey, - // // countTotal: true, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // if (filterData?.keyWord) { - // if ( - // filterData?.keyWord.length === LENGTH_CHARACTER.TRANSACTION && - // filterData?.keyWord == filterData?.keyWord.toUpperCase() - // ) { - // params['txHash'] = filterData?.keyWord; - // } else if (filterData['isSearchWallet']) { - // params['addressInContract'] = filterData?.keyWord; - // } else { - // params['query'] = 'wasm.token_id=' + filterData?.keyWord; - // } - // } - - // return axios.get(`${this.indexerUrl}/transaction`, { params }); - // } - getListTokenNFTFromIndexer(payload): Observable { const params = _({ chainid: this.chainInfo.chainId, diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 62ee42a0b..692814878 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -1,14 +1,12 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import axios from 'axios'; -import * as _ from 'lodash'; import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { LCD_COSMOS } from '../constants/url.constant'; import { EnvironmentService } from '../data-services/environment.service'; -import { CommonService } from './common.service'; import { checkEnvQuery } from '../utils/common/info-common'; -import { map } from 'rxjs/operators'; -import { LENGTH_CHARACTER } from '../constants/common.constant'; +import { CommonService } from './common.service'; @Injectable() export class TransactionService extends CommonService { @@ -21,24 +19,60 @@ export class TransactionService extends CommonService { super(http, environmentService); } - getListTx(limit: number, offset: string | number, txHash = '') { - let updateQuery = ''; - let path = '(path: "tx")'; - if (txHash?.length > 0 && txHash?.length === LENGTH_CHARACTER.TRANSACTION) { - updateQuery = ', where: {hash: {_eq: ' + `"${txHash}"` + '}}'; - path = ''; - } + getListTx(payload) { const operationsDoc = ` - query getListTx($limit: Int) { - ${this.envDB} { - transaction(limit: $limit, order_by: {timestamp: desc} ${updateQuery}) { + query auratestnet_transaction( + $limit: Int = 100 + $path: String = null + $order: order_by = desc + $compositeKey: String = null + $value: String = null + $key: String = null + $compositeKey2: String = null + $value2: String = null + $key2: String = null + $heightGT: Int = null + $heightLT: Int = null + $indexGT: Int = null + $indexLT: Int = null + $hash: String = null + $height: Int = null + ) { + auratestnet { + transaction( + limit: $limit + where: { + hash: { _eq: $hash } + height: { _eq: $height } + event_attribute_index: { + value: { _eq: $value } + composite_key: { _eq: $compositeKey } + key: { _eq: $key } + } + _and: [ + { height: { _gt: $heightGT } } + { index: { _gt: $indexGT } } + { height: { _lt: $heightLT } } + { index: { _lt: $indexLT } } + { + event_attribute_index: { + value: { _eq: $value2 } + composite_key: { _eq: $compositeKey2 } + key: { _eq: $key2 } + } + } + ] + } + order_by: { height: $order, index: $order } + ) { + id height hash timestamp code gas_used gas_wanted - data${path} + data(path: $path) } } } @@ -47,81 +81,31 @@ export class TransactionService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { - limit: limit, + limit: payload.limit, + order: 'desc', + hash: payload.hash, + compositeKey: payload.compositeKey, + value: payload.value, + path: 'tx', + key: payload.key, + heightGT: null, + heightLT: payload.heightLT, + indexGT: null, + indexLT: null, + height: null, + compositeKey2: payload.compositeKey2, + value2: payload.value2, + key2: payload.key2, }, - operationName: 'getListTx', + operationName: 'auratestnet_transaction', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - // txsIndexer(pageLimit: string | number, offset: string | number, txHash = ''): Observable { - // const params = _({ - // chainid: this.chainInfo.chainId, - // pageLimit, - // offset, - // txHash, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // return this.http.get(`${this.indexerUrl}/transaction`, { - // params, - // }); - // } - txsDetailLcd(txhash: string) { return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.TX}/txs/${txhash}`); } - getAccountTxFromHoroscope(address: string, pageLimit = 10, nextKey = null): Observable { - let filterQuery = ''; - if (nextKey) { - filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; - } - const operationsDoc = ` - query getListTx($limit: Int) { - ${this.envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {event_attribute_index: {value: {_eq: "${address}"}} ${filterQuery} }) { - id - height - hash - timestamp - code - gas_used - gas_wanted - data(path: "tx") - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: pageLimit, - }, - operationName: 'getListTx', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - // getAccountTxFromHoroscope(chainId: string, address: string, pageLimit = 10, nextKey = null): Observable { - // const params = _({ - // chainid: chainId, - // address, - // pageLimit, - // nextKey, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // return this.http.get(`${this.indexerUrl}/transaction`, { - // params, - // }); - // } - getListIBCSequence(sequence, channel): Observable { const operationsDoc = ` query getListSequence($limit: Int, $compositeKey: [String!] = "", $value: String = "") { @@ -148,8 +132,13 @@ export class TransactionService extends CommonService { query: operationsDoc, variables: { limit: 20, - compositeKey: ["send_packet.packet_sequence", "recv_packet.packet_sequence", "acknowledge_packet.packet_sequence", "timeout_packet.packet_sequence"], - value: sequence + compositeKey: [ + 'send_packet.packet_sequence', + 'recv_packet.packet_sequence', + 'acknowledge_packet.packet_sequence', + 'timeout_packet.packet_sequence', + ], + value: sequence, }, operationName: 'getListSequence', }) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 0616643e3..1215179e5 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -50,18 +50,37 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators`); } - getMissedBlockCounter(address = '') { - let updateQuery = ''; - if (address !== '') { - updateQuery = '(where: {operator_address: {_similar: ' + address + '}})'; - } + getDataValidator(payload) { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query getMissedBlockCounter { - ${envDB} { - validator ${updateQuery} { + query auratestnet_validator($offset: Int = 0, $limit: Int = 10, $operatorAddress: String = null) { + auratestnet { + validator(limit: $limit, offset: $offset, where: {operator_address: {_eq: $operatorAddress}}) { account_address + commission + consensus_address + consensus_hex_address + created_at + consensus_pubkey + delegator_shares + delegators_count + delegators_last_height + description + index_offset + jailed + jailed_until + min_self_delegation missed_blocks_counter + operator_address + percent_voting_power + self_delegation_balance + start_height + status + tokens + tombstoned + unbonding_height + unbonding_time + uptime } } } @@ -69,7 +88,12 @@ export class ValidatorService extends CommonService { return this.http .post(this.graphUrl, { query: operationsDoc, - operationName: 'getMissedBlockCounter', + variable: { + limit: payload?.limit || 1, + offset: payload?.offset || 0, + operatorAddress: payload?.operatorAddress || null, + }, + operationName: 'auratestnet_validator', }) .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } @@ -84,16 +108,18 @@ export class ValidatorService extends CommonService { filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; } const operationsDoc = ` - query getListPower($type: [String]) { - ${this.envDB} { - transaction(limit: ${limit}, order_by: {timestamp: desc}, where: {events: {event_attributes: {key: {_in: ["validator", "destination_validator"]}, value: {_eq: "${address}" }}}, transaction_messages: {type: {_in: $type}} ${filterQuery} }) { + query getListPower($operator_address: String) { + auratestnet { + power_event(order_by: {height: desc}, where: {_or: [{validatorDst: {operator_address: {_eq: $operator_address}}}, {validatorSrc: {operator_address: {_eq: $operator_address}}}]}) { id - hash + time height - timestamp - data(path: "tx") - power_events { - amount + transaction { + hash + transaction_messages { + type + } + data(path: "tx.body.messages") } } } @@ -103,7 +129,7 @@ export class ValidatorService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { - type: ["/cosmos.staking.v1beta1.MsgDelegate","/cosmos.staking.v1beta1.MsgUndelegate","/cosmos.staking.v1beta1.MsgBeginRedelegate"] + operator_address: address, }, operationName: 'getListPower', }) diff --git a/src/app/global/global.ts b/src/app/global/global.ts index b6fd33e46..12ee2200c 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -277,7 +277,10 @@ export function convertDataTransaction(data, coinInfo) { if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.GetReward) { type = TypeTransaction.GetReward; } else if (lstType?.length > 1) { - if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend) { + if ( + lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend || + lstType[1]['@type'] === TRANSACTION_TYPE_ENUM.Send + ) { type = TypeTransaction.MultiSend; } else { type = 'Multiple'; diff --git a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts index b06ad24f8..d89ddd9ea 100644 --- a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts +++ b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts @@ -351,7 +351,11 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { } getTxhDetail(value): void { - this.transactionService.getListTx(1, 0, decodeURI(value)).subscribe( + const payload = { + limit: 1, + hash: decodeURI(value), + }; + this.transactionService.getListTx(payload).subscribe( (res) => { if (res?.transaction?.length > 0) { this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => { diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index e9048bf77..80f54bedb 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -28,8 +28,8 @@ import { TableTemplate } from '../../../core/models/common.model'; import { AccountService } from '../../../core/services/account.service'; import { CommonService } from '../../../core/services/common.service'; import { TransactionService } from '../../../core/services/transaction.service'; -import { convertDataTransaction, convertDataTransactionV2, Globals } from '../../../global/global'; -import { chartCustomOptions, ChartOptions, CHART_OPTION } from './chart-options'; +import { Globals, convertDataTransactionV2 } from '../../../global/global'; +import { CHART_OPTION, ChartOptions, chartCustomOptions } from './chart-options'; @Component({ selector: 'app-account-detail', @@ -302,12 +302,18 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { getTxsFromHoroscope(nextKey = null): void { const address = this.currentAddress; - this.transactionService.getAccountTxFromHoroscope(address, 40, nextKey).subscribe({ + let payload = { + limit: 40, + value: address, + heightLT: nextKey, + }; + this.transactionService.getListTx(payload).subscribe({ next: (data) => { - if (data?.transaction?.length >= 40) { - this.nextKey = data?.transaction[data.length - 1].id; - } if (data?.transaction?.length > 0) { + this.nextKey = null; + if (data?.transaction?.length >= 40) { + this.nextKey = data?.transaction[data?.transaction?.length - 1].height; + } const txs = convertDataTransactionV2(data, this.coinInfo); txs.forEach((element) => { if (element.type === 'Send') { diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index d86490463..519abf9ec 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -4,7 +4,7 @@ - +
    { if (res?.block?.length > 0) { const block = convertDataBlock(res)[0]; @@ -117,7 +119,12 @@ export class BlockDetailComponent implements OnInit { for (const key in res.block[0]?.data?.data?.txs) { const element = res.block[0]?.data?.data?.txs[key]; const tx = sha256(Buffer.from(element, 'base64')).toUpperCase(); - this.transactionService.getListTx(1, 0, tx).subscribe((res) => { + + const payload = { + limit: 1, + hash: tx, + }; + this.transactionService.getListTx(payload).subscribe((res) => { if (res?.transaction[0]) { txs.push(res?.transaction[0]); } diff --git a/src/app/pages/blocks/blocks.component.ts b/src/app/pages/blocks/blocks.component.ts index e100f6726..9ff84e68f 100644 --- a/src/app/pages/blocks/blocks.component.ts +++ b/src/app/pages/blocks/blocks.component.ts @@ -42,7 +42,10 @@ export class BlocksComponent implements OnInit { } getList(): void { - this.blockService.getListBlock(this.pageSize).subscribe( + const payload = { + limit: 20, + }; + this.blockService.getDataBlock(payload).subscribe( (res) => { if (res?.block?.length > 0) { const blocks = convertDataBlock(res); diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index 09dbab647..f708ae485 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -5,8 +5,9 @@ import { takeUntil } from 'rxjs/operators'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { ContractService } from 'src/app/core/services/contract.service'; +import { TransactionService } from 'src/app/core/services/transaction.service'; import { isContract } from 'src/app/core/utils/common/validation'; -import { convertDataTransaction, convertDataTransactionV2 } from 'src/app/global/global'; +import { convertDataTransactionV2 } from 'src/app/global/global'; import { CONTRACT_TAB, CONTRACT_TABLE_TEMPLATES } from '../../../../core/constants/contract.constant'; import { ContractTab, ContractVerifyType } from '../../../../core/constants/contract.enum'; @@ -57,6 +58,7 @@ export class ContractContentComponent implements OnInit, OnDestroy { constructor( private contractService: ContractService, + private transactionService: TransactionService, private router: Router, private aRoute: ActivatedRoute, private environmentService: EnvironmentService, @@ -120,7 +122,12 @@ export class ContractContentComponent implements OnInit, OnDestroy { getTransaction(isInit = true): void { if (isContract(this.contractsAddress)) { - this.contractService.getTransactionsIndexerV2(this.limit, this.contractsAddress, 'execute').subscribe( + const payload = { + limit: this.limit, + value: this.contractsAddress, + key: '_contract_address' + } + this.transactionService.getListTx(payload).subscribe( (res) => { const data = res; if (res) { diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts index db64fe140..ad46f3083 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts @@ -7,8 +7,8 @@ import { CONTRACT_TABLE_TEMPLATES } from 'src/app/core/constants/contract.consta import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { ITableContract } from 'src/app/core/models/contract.model'; -import { ContractService } from 'src/app/core/services/contract.service'; -import { convertDataTransaction, convertDataTransactionV2 } from 'src/app/global/global'; +import { TransactionService } from 'src/app/core/services/transaction.service'; +import { convertDataTransactionV2 } from 'src/app/global/global'; import { TableData } from 'src/app/shared/components/contract-table/contract-table.component'; @Component({ @@ -48,6 +48,9 @@ export class ContractsTransactionsComponent implements OnInit { modeTxType = { Out: 0, In: 1, Instantiate: 2 }; hashIns = ''; hasLoadIns = false; + payload = { + limit: 100, + }; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); coinInfo = this.environmentService.configValue.chain_info.currencies[0]; @@ -55,10 +58,10 @@ export class ContractsTransactionsComponent implements OnInit { constructor( public translate: TranslateService, private router: Router, - private contractService: ContractService, private layout: BreakpointObserver, private environmentService: EnvironmentService, private route: ActivatedRoute, + private transactionService: TransactionService, ) { const valueColumn = this.templates.find((item) => item.matColumnDef === 'value'); @@ -74,6 +77,7 @@ export class ContractsTransactionsComponent implements OnInit { ngOnInit(): void { this.contractAddress = this.route.snapshot.paramMap.get('addressId'); this.contractInfo.contractsAddress = this.contractAddress; + this.payload['value'] = this.contractAddress; this.getData(); this.getDataInstantiate(); this.timerGetUpTime = setInterval(() => { @@ -99,14 +103,20 @@ export class ContractsTransactionsComponent implements OnInit { if (params['label']) { this.label = params['label'] || this.modeTxType.Out; } + this.payload['key'] = null; + this.payload['compositeKey'] = null; + switch (+this.label) { + case 1: + this.payload['compositeKey'] = 'execute._contract_address'; + break; + case 2: + this.payload['compositeKey'] = 'instantiate._contract_address'; + break; + default: + this.payload['key'] = '_contract_address'; + break; + } this.getDataTable(null, isReload); - // switch (+this.label) { - // case 1: - // this.getDataTable(null, isReload); - // break; - // default: - // this.getDataTable(null, isReload); - // } }); } @@ -115,15 +125,16 @@ export class ContractsTransactionsComponent implements OnInit { return; } if (!this.label || +this.label == this.modeTxType.In) { - const type = +this.label == this.modeTxType.In ? 'execute' : ''; - this.contractService.getTransactionsIndexerV2(100, this.contractAddress, type, this.hashIns, nextKey).subscribe( + this.payload['heightLT'] = nextKey; + this.transactionService.getListTx(this.payload).subscribe( (dataExecute) => { if (dataExecute) { const txsExecute = convertDataTransactionV2(dataExecute, this.coinInfo); this.lengthTxsExecute = txsExecute.length; if (dataExecute.transaction?.length > 0) { + this.nextKey = null; if (txsExecute.length >= 100) { - this.nextKey = dataExecute?.transaction[txsExecute.length - 1].id; + this.nextKey = dataExecute?.transaction[txsExecute.length - 1].height; } if (this.contractTransaction['data']?.length > 0 && !isReload) { this.contractTransaction['data'] = [...this.contractTransaction['data'], ...txsExecute]; @@ -152,7 +163,7 @@ export class ContractsTransactionsComponent implements OnInit { } getDataInstantiate(): void { - this.contractService.getTransactionsIndexerV2(1, this.contractAddress, 'instantiate').subscribe( + this.transactionService.getListTx(this.payload).subscribe( (dataInstantiate) => { this.hasLoadIns = true; if (dataInstantiate.transaction?.length > 0) { diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 7bbdf40d0..da3f1f107 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -1,7 +1,7 @@ import { DatePipe } from '@angular/common'; import { AfterViewInit, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { MatTableDataSource } from '@angular/material/table'; -import { createChart, IChartApi, ISeriesApi } from 'lightweight-charts'; +import { IChartApi, ISeriesApi, createChart } from 'lightweight-charts'; import * as moment from 'moment'; import { MaskPipe } from 'ngx-mask'; import { Subject, Subscription, timer } from 'rxjs'; @@ -12,6 +12,7 @@ import { timeToUnix } from 'src/app/core/helpers/date'; import { exportChart } from 'src/app/core/helpers/export'; import { ProposalService } from 'src/app/core/services/proposal.service'; import { TokenService } from 'src/app/core/services/token.service'; +import { ValidatorService } from 'src/app/core/services/validator.service'; import { WalletService } from 'src/app/core/services/wallet.service'; import { getInfo } from 'src/app/core/utils/common/info-common'; import { TableTemplate } from '../../../app/core/models/common.model'; @@ -19,9 +20,8 @@ import { BlockService } from '../../../app/core/services/block.service'; import { CommonService } from '../../../app/core/services/common.service'; import { TransactionService } from '../../../app/core/services/transaction.service'; import { CHART_RANGE, PAGE_EVENT, TOKEN_ID_GET_PRICE } from '../../core/constants/common.constant'; -import { convertDataBlock, convertDataTransaction, convertDataTransactionV2, Globals } from '../../global/global'; +import { Globals, convertDataBlock, convertDataTransactionV2 } from '../../global/global'; import { CHART_CONFIG, DASHBOARD_AREA_SERIES_CHART_OPTIONS, DASHBOARD_CHART_OPTIONS } from './dashboard-chart-options'; -import { ValidatorService } from 'src/app/core/services/validator.service'; @Component({ selector: 'app-dashboard', @@ -249,7 +249,10 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } getListBlock(): void { - this.blockService.getListBlock(this.PAGE_SIZE).subscribe((res) => { + const payload = { + limit: this.PAGE_SIZE, + } + this.blockService.getDataBlock(payload).subscribe((res) => { if (res?.block?.length > 0) { const blocks = convertDataBlock(res); this.dataSourceBlock = new MatTableDataSource(blocks); @@ -258,7 +261,10 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } getListTransaction(): void { - this.transactionService.getListTx(this.PAGE_SIZE, 0).subscribe((res) => { + const payload = { + limit: this.PAGE_SIZE, + }; + this.transactionService.getListTx(payload).subscribe((res) => { this.dataSourceTx.data = []; if (res?.transaction?.length > 0) { const txs = convertDataTransactionV2(res, this.coinInfo); diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html index 93be029bd..ec1727e4e 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html @@ -9,7 +9,7 @@ *ngIf="depositorsList.length > 0" [type]="proposalDeposit" [data]="depositorsList" - [length]="dataLength"> + [length]="depositorsList?.length">
    diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index 2f9c5cb91..a8533587e 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -6,6 +6,7 @@ import { TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { balanceOf } from 'src/app/core/utils/common/parsing'; import { ProposalService } from '../../../../../app/core/services/proposal.service'; +import { TransactionService } from 'src/app/core/services/transaction.service'; @Component({ selector: 'app-depositors', @@ -25,6 +26,7 @@ export class DepositorsComponent implements OnInit { private proposalService: ProposalService, private layout: BreakpointObserver, private environmentService: EnvironmentService, + private transactionService: TransactionService ) { this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { if (event) { @@ -39,10 +41,11 @@ export class DepositorsComponent implements OnInit { getDepositorsList(): void { const payload = { - proposalId: this.proposalId, - pageLimit: 100, + key: "proposal_id", + value: this.proposalId?.toString(), + limit: 100, }; - this.proposalService.getDepositors(payload).subscribe( + this.transactionService.getListTx(payload).subscribe( (res) => { let dataList: any[] = []; if (res?.transaction?.length > 0) { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 5c0faebe4..3c086a1dc 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -21,6 +21,7 @@ import { ProposalService } from '../../../../core/services/proposal.service'; import { WalletService } from '../../../../core/services/wallet.service'; import { balanceOf } from '../../../../core/utils/common/parsing'; import { ProposalVoteComponent } from '../../proposal-vote/proposal-vote.component'; +import { TransactionService } from 'src/app/core/services/transaction.service'; const marked = require('marked'); @Component({ @@ -57,6 +58,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { private layout: BreakpointObserver, public commonService: CommonService, private numberPipe: DecimalPipe, + private transactionService: TransactionService, ) {} ngOnInit(): void { @@ -328,12 +330,14 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { const addr = this.walletService.wallet?.bech32Address || null; if (addr) { const payload = { - proposalId: this.proposalId, - wallet: addr, + limit: 1, + composite_key: 'proposal_vote.proposal_id', + value: this.proposalId?.toString(), + value2: addr, }; - this.proposalService.getVotes(payload).subscribe((res) => { + this.transactionService.getListTx(payload).subscribe((res) => { const optionVote = this.proposalService.getVoteMessageByConstant( - res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, + res?.transaction[0]?.data?.body?.messages[0]?.option, ); this.proposalVotes = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; this.voteValue = { diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index 5b72d9217..8844aaf8f 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -18,6 +18,7 @@ import { WalletService } from '../../core/services/wallet.service'; import { balanceOf } from '../../core/utils/common/parsing'; import { shortenAddressStartEnd } from '../../core/utils/common/shorten'; import { ProposalVoteComponent } from './proposal-vote/proposal-vote.component'; +import { TransactionService } from 'src/app/core/services/transaction.service'; @Component({ selector: 'app-proposal', @@ -73,6 +74,7 @@ export class ProposalComponent implements OnInit { private layout: BreakpointObserver, private scroll: ViewportScroller, public commonService: CommonService, + private transactionService: TransactionService ) {} ngOnInit(): void { @@ -110,11 +112,13 @@ export class ProposalComponent implements OnInit { const getVoted = async () => { if (addr) { const payload = { - proposalId: pro.proposal_id, - wallet: addr, + limit: 1, + composite_key: 'proposal_vote.proposal_id', + value: pro.proposal_id?.toString(), + value2: addr, }; - this.proposalService.getVotes(payload).subscribe((res) => { - const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.tx?.body?.messages[0]?.option); + this.transactionService.getListTx(payload).subscribe((res) => { + const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.body?.messages[0]?.option); pro.vote_option = this.voteConstant.find( (s) => s.key === optionVote, )?.voteOption; diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index fd25bd3c3..ffc15d018 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -28,6 +28,7 @@ import { checkTypeFile, parseDataTransaction } from 'src/app/core/utils/common/i import { Globals } from 'src/app/global/global'; import { MediaExpandComponent } from 'src/app/shared/components/media-expand/media-expand.component'; import { PopupShareComponent } from './popup-share/popup-share.component'; +import { TransactionService } from 'src/app/core/services/transaction.service'; @Component({ selector: 'app-nft-detail', @@ -88,7 +89,7 @@ export class NFTDetailComponent implements OnInit { public global: Globals, public route: Router, private environmentService: EnvironmentService, - private tokenService: TokenService, + private transactionService: TransactionService, private router: ActivatedRoute, private soulboundService: SoulboundService, private walletService: WalletService, @@ -187,12 +188,22 @@ export class NFTDetailComponent implements OnInit { } async getDataTable(nextKey = null) { - let filterData = {}; - filterData['keyWord'] = this.nftId; + const payload = { + limit: 100, + value: this.contractAddress, + compositeKey: 'execute._contract_address', + key2: 'token_id', + value2: this.nftId, + heightLT: nextKey, + }; - this.tokenService.getListTokenTransferIndexerV2(100, this.contractAddress, filterData).subscribe( + this.transactionService.getListTx(payload).subscribe( (res) => { if (res) { + this.nextKey = null; + if (res.transaction.length >= 100) { + this.nextKey = res?.transaction[res.transaction.length - 1].height; + } res?.transaction.forEach((trans) => { trans = parseDataTransaction(trans, this.coinMinimalDenom, this.contractAddress); }); diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts index 06f0fed18..ee2a110e2 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts @@ -91,9 +91,11 @@ export class TokenInventoryComponent implements OnInit { this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, ); - if (this.pageData.length > 200) { - this.pageData.length = 200; + if (this.pageData.length >= 100) { this.isMoreTx = true; + if (this.pageData.length > 200) { + this.pageData.length = 200; + } } this.loading = false; }); diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts index 7a8f1364c..c9f3e1a5a 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts @@ -5,6 +5,7 @@ import { ActivatedRoute } from '@angular/router'; import { ContractRegisterType } from 'src/app/core/constants/contract.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { IContractPopoverData } from 'src/app/core/models/contract.model'; +import { TransactionService } from 'src/app/core/services/transaction.service'; import { parseDataTransaction } from 'src/app/core/utils/common/info-common'; import { LENGTH_CHARACTER, @@ -17,7 +18,7 @@ import { TableTemplate } from '../../../../../../core/models/common.model'; import { CommonService } from '../../../../../../core/services/common.service'; import { TokenService } from '../../../../../../core/services/token.service'; import { shortenAddress } from '../../../../../../core/utils/common/shorten'; -import { Globals, convertDataTransactionV2 } from '../../../../../../global/global'; +import { Globals } from '../../../../../../global/global'; @Component({ selector: 'app-token-transfers-tab', @@ -89,6 +90,7 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { private environmentService: EnvironmentService, private route: ActivatedRoute, private cdr: ChangeDetectorRef, + private transactionService: TransactionService, ) {} ngOnInit(): void { @@ -96,7 +98,7 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { this.keyWord = params?.a || ''; }); - this.getListTransactionToken(this.keyWord); + this.getListTransactionToken(); this.template = this.getTemplate(); this.displayedColumns = this.getTemplate().map((template) => template.matColumnDef); @@ -107,7 +109,7 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { this.timerGetUpTime = setInterval(() => { if (this.pageData.pageIndex === 0) { this.currentKey = null; - this.getListTransactionToken(null, null, true); + this.getListTransactionToken(null, true); } }, 5000); } @@ -118,24 +120,34 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { } } - async getListTransactionToken(dataSearch = '', nextKey = null, isReload = false) { - if (!this.dataSource.data) { - this.loading = true; - } - let filterData = {}; - filterData['keyWord'] = this.keyWord || dataSearch; - if ( - filterData['keyWord']?.length >= LENGTH_CHARACTER.ADDRESS && - filterData['keyWord']?.startsWith(this.prefixAdd) - ) { - filterData['isSearchWallet'] = true; + async getListTransactionToken(nextKey = null, isReload = false) { + let payload = { + limit: 100, + value: this.contractAddress, + compositeKey: 'execute._contract_address', + heightLT: nextKey, + }; + + if (this.keyWord) { + if (this.keyWord?.length === LENGTH_CHARACTER.TRANSACTION && this.keyWord == this?.keyWord.toUpperCase()) { + payload['hash'] = this.keyWord; + } else { + payload['value2'] = this.keyWord; + if (!(this.keyWord?.length >= LENGTH_CHARACTER.ADDRESS && this.keyWord?.startsWith(this.prefixAdd))) { + payload['key2'] = 'token_id'; + } + } } - this.tokenService.getListTokenTransferIndexerV2(100, this.contractAddress, filterData).subscribe( + this.transactionService.getListTx(payload).subscribe( (res) => { if (res) { + this.nextKey = null; if (res.transaction.length >= 100) { - this.nextKey = res?.transaction[res.transaction.length - 1].id; + this.nextKey = res?.transaction[res.transaction.length - 1].height; + this.hasMore.emit(true); + } else { + this.hasMore.emit(false); } res.transaction?.forEach((trans) => { trans = parseDataTransaction(trans, this.coinMinimalDenom, this.contractAddress); @@ -177,7 +189,7 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { const next = length <= (pageIndex + 2) * pageSize; this.pageData = e; if (next && this.nextKey && this.currentKey !== this.nextKey) { - this.getListTransactionToken(null, this.nextKey); + this.getListTransactionToken(this.nextKey); this.currentKey = this.nextKey; } } diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index 1de8c4f21..b91123efc 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -68,7 +68,11 @@ export class TransactionDetailComponent implements OnInit { getDetail(): void { if (this.txHash?.length === LENGTH_CHARACTER.TRANSACTION) { - this.transactionService.getListTx(1, 0, this.txHash).subscribe( + const payload = { + limit: 1, + hash: this.txHash, + }; + this.transactionService.getListTx(payload).subscribe( (res) => { if (res?.transaction?.length > 0) { const txs = convertDataTransactionV2(res, this.coinInfo); @@ -79,7 +83,7 @@ export class TransactionDetailComponent implements OnInit { gas_used: _.get(res?.transaction[0], 'gas_used'), gas_wanted: _.get(res?.transaction[0], 'gas_wanted'), raw_log: _.get(res?.transaction[0], 'data.tx_response.raw_log'), - type: _.get(res?.transaction[0], 'data.tx.body.messages[0].@type'), + type: this.transaction.typeOrigin, }; if (this.transaction.raw_log && +this.transaction.code !== CodeTransaction.Success) { diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index 7bc008f53..ea63dde6b 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -366,7 +366,7 @@ export class TransactionMessagesComponent implements OnInit { pipeType: pipeTypeData.BalanceOf, }); result.push({ key: 'Delegator Address', value: data.delegator_address, link: { url: '/account' } }); - result.push({ key: 'Validator Address', value: data.validator_address, link: { url: '/validators'} }); + result.push({ key: 'Validator Address', value: data.validator_address, link: { url: '/validators' } }); result.push({ key: 'Amount', value: data.value?.amount, @@ -620,7 +620,7 @@ export class TransactionMessagesComponent implements OnInit { displayMsgRaw(): void { this.objMsgContract = _.get( - this.transactionDetail?.tx?.tx?.body || this.transactionDetail?.tx?.body, + this.transactionDetail?.tx?.tx?.body || this.transactionDetail?.tx?.body || this.transactionDetail, 'messages', ).map((element) => { let msg = _.get(element, 'msg'); diff --git a/src/app/pages/transaction/transaction.component.ts b/src/app/pages/transaction/transaction.component.ts index 41a282bb2..04554be99 100644 --- a/src/app/pages/transaction/transaction.component.ts +++ b/src/app/pages/transaction/transaction.component.ts @@ -5,7 +5,7 @@ import { TYPE_TRANSACTION } from '../../../app/core/constants/transaction.consta import { TableTemplate } from '../../../app/core/models/common.model'; import { CommonService } from '../../../app/core/services/common.service'; import { TransactionService } from '../../../app/core/services/transaction.service'; -import { convertDataTransaction, convertDataTransactionV2, Globals } from '../../../app/global/global'; +import { Globals, convertDataTransactionV2 } from '../../../app/global/global'; @Component({ selector: 'app-transaction', @@ -41,12 +41,14 @@ export class TransactionComponent implements OnInit { ) {} ngOnInit(): void { - // this.getList(); this.getListTx(); } getListTx(): void { - this.transactionService.getListTx(this.pageSize, 0).subscribe( + const payload = { + limit: this.pageSize, + } + this.transactionService.getListTx(payload).subscribe( (res) => { if (res?.transaction?.length > 0) { const txs = convertDataTransactionV2(res, this.coinInfo); diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index d870ff32d..392f90241 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -175,13 +175,14 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { getListBlockWithOperator(nextKeyBlock = null, isInit = true): void { let payload = { + limit: 100, address: this.currentAddress, nextHeight: null, }; if (nextKeyBlock !== null) { payload.nextHeight = nextKeyBlock; } - this.blockService.getBlockWithOperator(payload).subscribe( + this.blockService.getDataBlock(payload).subscribe( (res) => { this.nextKeyBlock = res.block[res.block.length - 1].height; if (res.block.length > 0) { @@ -267,15 +268,15 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { getListPower(nextKey = null, isInit = true): void { this.validatorService.validatorsDetailListPower(this.currentAddress, 100, nextKey).subscribe( (res) => { - if (res?.transaction?.length > 0) { - if (res?.transaction?.length >= 100) { - this.nextKey = res?.transaction[res?.transaction?.length - 1].id; + if (res?.power_event?.length > 0) { + if (res?.power_event?.length >= 100) { + this.nextKey = res?.power_event[res?.power_event?.length - 1].id; } - const txs = _.get(res, 'transaction').map((element) => { + const txs = _.get(res, 'power_event').map((element) => { let isStakeMode = false; - const tx_hash = _.get(element, 'hash'); - const address = _.get(element, 'data.body.messages[0].validator_dst_address'); - const _type = _.get(element, 'data.body.messages[0].@type'); + const tx_hash = _.get(element, 'transaction.hash'); + const address = _.get(element, 'transaction.data[0].validator_dst_address'); + const _type = _.get(element, 'transaction.transaction_messages[0].type'); if ( _type === TRANSACTION_TYPE_ENUM.Delegate || (_type === TRANSACTION_TYPE_ENUM.Redelegate && address === this.currentAddress) || @@ -284,18 +285,14 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { ) { isStakeMode = true; } - let amount = getAmount( - _.get(element, 'data.body.messages'), - _type, - _.get(element, 'data.body.raw_log'), - ); + let amount = getAmount(_.get(element, 'transaction.data'), _type, _.get(element, 'data.body.raw_log')); - if (amount === 0 && element?.tx_response?.tx?.body?.messages.length > 0) { + if (amount === 0 && element?.transaction?.data?.length > 0) { amount = 'More'; } const height = _.get(element, 'height'); - const timestamp = _.get(element, 'timestamp'); + const timestamp = _.get(element, 'time'); return { tx_hash, amount, isStakeMode, height, timestamp }; }); @@ -439,14 +436,18 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } getMissedBlockCounter() { - this.validatorService.getMissedBlockCounter(this.currentValidatorDetail.operator_address).subscribe((res) => { - this.currentValidatorDetail['up_time'] = - (NUM_BLOCK - +res.validator[0].missed_blocks_counter) / 100; + const payload = { + limit: 1, + offset: 0, + operator_address: this.currentValidatorDetail.operator_address, + }; + this.validatorService.getDataValidator(payload).subscribe((res) => { + this.currentValidatorDetail['up_time'] = (NUM_BLOCK - +res.validator[0].missed_blocks_counter) / 100; }); } getListUpTime(): void { - this.blockService.getListBlock(this.numberLastBlock).subscribe( + this.blockService.getDataBlock(this.numberLastBlock).subscribe( (res) => { if (res?.block?.length > 0) { const block = _.get(res, 'block').map((element) => { diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index 0c0b7fedf..806ea0f20 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -203,7 +203,7 @@ export class ValidatorsComponent implements OnInit, OnDestroy { } getBlocksMiss() { - this.validatorService.getMissedBlockCounter('').subscribe((res) => { + this.validatorService.getDataValidator(null).subscribe((res) => { this.lstUptime = res.validator; }); } From fd2900b789e8308e22ea7e8a46afa8f8577f8b4e Mon Sep 17 00:00:00 2001 From: mtam Date: Mon, 22 May 2023 15:09:54 +0700 Subject: [PATCH 014/315] [TamTM6] fix indexer v2 part 4 --- src/app/core/helpers/jwt.interceptor.ts | 4 +- src/app/core/services/proposal.service.ts | 88 +++++++++---------- src/app/core/services/transaction.service.ts | 4 +- src/app/core/services/validator.service.ts | 16 ++-- src/app/core/utils/common/info-common.ts | 8 +- .../depositors/depositors.component.html | 4 +- .../depositors/depositors.component.ts | 16 ++-- .../summary-info/summary-info.component.ts | 34 +++---- .../votes/votes.component.html | 1 + .../proposal-detail/votes/votes.component.ts | 2 +- src/app/pages/proposal/proposal.component.ts | 2 +- 11 files changed, 92 insertions(+), 87 deletions(-) diff --git a/src/app/core/helpers/jwt.interceptor.ts b/src/app/core/helpers/jwt.interceptor.ts index d3acfdc46..d3b849394 100644 --- a/src/app/core/helpers/jwt.interceptor.ts +++ b/src/app/core/helpers/jwt.interceptor.ts @@ -10,7 +10,9 @@ export class JwtInterceptor implements HttpInterceptor { intercept(request: HttpRequest, next: HttpHandler): Observable> { const currentUser = this.authenticationService.currentUserValue; request = request.clone({ - setHeaders: {}, + setHeaders: { + 'x-hasura-admin-secret': 'abc@123', 'Hasura-Client-Name': 'hasura-console' + }, }); return next.handle(request); } diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 4e6077dad..3106c7ab7 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -53,51 +53,51 @@ export class ProposalService extends CommonService { return this.http.get(`${this.indexerUrl}/votes`, { params }); } - // getProposalListDetail(payload) { - // const envDB = checkEnvQuery(this.environmentService.configValue.env); - // const operationsDoc = ` - // query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = 10) { - // ${envDB} { - // proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}}, order_by: {proposal_id: $order}) { - // content - // deposit_end_time - // description - // initial_deposit - // proposal_id - // proposer_address - // proposer { - // description - // operator_address - // account_address - // } - // status - // submit_time - // tally - // title - // total_deposit - // turnout - // type - // updated_at - // voting_end_time - // voting_start_time - // } - // } - // } + getProposalListDetail(payload) { + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = 10) { + ${envDB} { + proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}}, order_by: {proposal_id: $order}) { + content + deposit_end_time + description + initial_deposit + proposal_id + proposer_address + proposer { + description + operator_address + account_address + } + status + submit_time + tally + title + total_deposit + turnout + type + updated_at + voting_end_time + voting_start_time + } + } + } - // `; - // return this.http - // .post(this.graphUrl, { - // query: operationsDoc, - // variables: { - // limit: payload.limit, - // offset: 0, - // order: 'desc', - // proposalId: payload.proposalId, - // }, - // operationName: 'auratestnet_proposal', - // }) - // .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - // } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.limit, + offset: 0, + order: 'desc', + proposalId: payload.proposalId, + }, + operationName: 'auratestnet_proposal', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } getProposalList(pageLimit = 20, nextKey = null, proposalId = null): Observable { const params = _({ diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 692814878..95e661171 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -23,7 +23,6 @@ export class TransactionService extends CommonService { const operationsDoc = ` query auratestnet_transaction( $limit: Int = 100 - $path: String = null $order: order_by = desc $compositeKey: String = null $value: String = null @@ -72,7 +71,7 @@ export class TransactionService extends CommonService { code gas_used gas_wanted - data(path: $path) + data } } } @@ -86,7 +85,6 @@ export class TransactionService extends CommonService { hash: payload.hash, compositeKey: payload.compositeKey, value: payload.value, - path: 'tx', key: payload.key, heightGT: null, heightLT: payload.heightLT, diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 1215179e5..80b479639 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -103,14 +103,14 @@ export class ValidatorService extends CommonService { } validatorsDetailListPower(address: string, limit = 10, nextKey = null) { - let filterQuery = ''; - if (nextKey) { - filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; - } + // let filterQuery = ''; + // if (nextKey) { + // filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; + // } const operationsDoc = ` - query getListPower($operator_address: String) { + query auratestnet_powerevent($operator_address: String, $limit: Int = 10, $offset: Int = 0) { auratestnet { - power_event(order_by: {height: desc}, where: {_or: [{validatorDst: {operator_address: {_eq: $operator_address}}}, {validatorSrc: {operator_address: {_eq: $operator_address}}}]}) { + power_event(order_by: {height: desc}, where: {_or: [{validatorDst: {operator_address: {_eq: $operator_address}}}, {validatorSrc: {operator_address: {_eq: $operator_address}}}]}, limit: $limit, offset: $offset) { id time height @@ -119,7 +119,7 @@ export class ValidatorService extends CommonService { transaction_messages { type } - data(path: "tx.body.messages") + data } } } @@ -131,7 +131,7 @@ export class ValidatorService extends CommonService { variables: { operator_address: address, }, - operationName: 'getListPower', + operationName: 'auratestnet_powerevent', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } diff --git a/src/app/core/utils/common/info-common.ts b/src/app/core/utils/common/info-common.ts index 958d12062..6fd6af385 100644 --- a/src/app/core/utils/common/info-common.ts +++ b/src/app/core/utils/common/info-common.ts @@ -50,12 +50,12 @@ export function formatNumber(number: number, args?: any): any { } export function parseDataTransaction(trans: any, coinMinimalDenom: string, tokenID = '') { - let typeOrigin = trans.data?.body?.messages[0]['@type']; + let typeOrigin = trans.data?.tx?.body?.messages[0]['@type']; const typeTrans = TYPE_TRANSACTION.find((f) => f.label.toLowerCase() === typeOrigin?.toLowerCase()); trans.tx_hash = trans.hash; //get amount of transaction trans.amount = getAmount( - trans.data?.body?.messages, + trans.data?.tx?.body?.messages, typeOrigin, trans.tx_response?.raw_log, coinMinimalDenom, @@ -69,9 +69,9 @@ export function parseDataTransaction(trans: any, coinMinimalDenom: string, token trans.status = StatusTransaction.Success; } [trans.from_address, trans.to_address, trans.amountToken, trans.method, trans.token_id, trans.modeExecute] = - getDataInfo(trans.data?.body?.messages, tokenID, trans.tx_response?.raw_log); + getDataInfo(trans.data?.tx?.body?.messages, tokenID, trans.tx_response?.raw_log); trans.type = trans.method || typeTrans?.value; - trans.depositors = trans.data?.body?.messages[0]?.depositor; + trans.depositors = trans.data?.tx?.body?.messages[0]?.depositor; trans.price = balanceOf(_.get(trans, 'data.body.messages[0].funds[0].amount')); return trans; } diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html index ec1727e4e..8e00dc966 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html @@ -6,12 +6,12 @@
    -
    +
    diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index a8533587e..be3003204 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -52,18 +52,18 @@ export class DepositorsComponent implements OnInit { this.dataLength = res.transaction?.length || 0; dataList = res?.transaction?.filter( (transaction) => - transaction?.data?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.Deposit || - (transaction?.data?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx && - transaction?.data?.body?.messages[0]?.initial_deposit?.length > 0), + transaction?.data?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.Deposit || + (transaction?.data?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx && + transaction?.data?.tx?.body?.messages[0]?.initial_deposit?.length > 0), ); dataList.forEach((item) => { - if (item.data?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx) { - item.depositors = item.data?.body?.messages[0]?.proposer; - item.amount = balanceOf(item.data?.body?.messages[0].initial_deposit[0].amount); + if (item.data?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.SubmitProposalTx) { + item.depositors = item.data?.tx?.body?.messages[0]?.proposer; + item.amount = balanceOf(item.data?.tx?.body?.messages[0].initial_deposit[0].amount); } else { - item.depositors = item.data?.body?.messages[0]?.depositor; - item.amount = balanceOf(item.data?.body?.messages[0].amount[0].amount); + item.depositors = item.data?.tx?.body?.messages[0]?.depositor; + item.amount = balanceOf(item.data?.tx?.body?.messages[0].amount[0].amount); } item.txhash = item?.hash; item.timestamp = item?.timestamp; diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 3c086a1dc..7e4fda64b 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -67,16 +67,20 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } getProposalDetail(): void { + let payload = { + limit: 1, + proposalId: this.proposalId + } this.proposalService - .getProposalList(1, null, this.proposalId) + .getProposalListDetail(payload) .pipe( - map((dta) => dta.data), + map((dta) => dta), mergeMap((data) => { - if (data?.count > 0) { - if (data.proposals[0].status === VOTING_STATUS.PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT) { + if (data?.proposal?.length > 0) { + if (data.proposal[0].status === VOTING_STATUS.PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT) { this.proposalDtl.emit(null); } - this.proposalDetail = this.makeProposalDataDetail(data.proposals[0]); + this.proposalDetail = this.makeProposalDataDetail(data.proposal[0]); if (this.proposalDetail?.content?.amount) { this.proposalDetail['request_amount'] = balanceOf(this.proposalDetail?.content?.amount[0]?.amount); } @@ -84,7 +88,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { mergeMap((res) => { if (res.data) { this.proposalDetail.total_bonded_token = balanceOf(res.data.bonded_tokens); - if (data.proposals[0].status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { + if (data.proposal[0].status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { this.proposalDetail.pro_turnout = (this.proposalDetail.pro_total_vote * 100) / this.proposalDetail.total_bonded_token; } else { @@ -191,15 +195,15 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } makeProposalDataDetail(data) { - let pro_votes_yes = balanceOf(+data.final_tally_result.yes); - let pro_votes_no = balanceOf(+data.final_tally_result.no); - let pro_votes_no_with_veto = balanceOf(+data.final_tally_result.no_with_veto); - let pro_votes_abstain = balanceOf(+data.final_tally_result.abstain); + let pro_votes_yes = balanceOf(+data.final_tally_result?.yes); + let pro_votes_no = balanceOf(+data.final_tally_result?.no); + let pro_votes_no_with_veto = balanceOf(+data.final_tally_result?.no_with_veto); + let pro_votes_abstain = balanceOf(+data.final_tally_result?.abstain); if (data.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { - pro_votes_yes = balanceOf(+data.tally.yes); - pro_votes_no = balanceOf(+data.tally.no); - pro_votes_no_with_veto = balanceOf(+data.tally.no_with_veto); - pro_votes_abstain = balanceOf(+data.tally.abstain); + pro_votes_yes = balanceOf(+data.tally?.yes); + pro_votes_no = balanceOf(+data.tally?.no); + pro_votes_no_with_veto = balanceOf(+data.tally?.no_with_veto); + pro_votes_abstain = balanceOf(+data.tally?.abstain); } const pro_total_vote = pro_votes_yes + pro_votes_no + pro_votes_no_with_veto + pro_votes_abstain; @@ -337,7 +341,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { }; this.transactionService.getListTx(payload).subscribe((res) => { const optionVote = this.proposalService.getVoteMessageByConstant( - res?.transaction[0]?.data?.body?.messages[0]?.option, + res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, ); this.proposalVotes = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; this.voteValue = { diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.html b/src/app/pages/proposal/proposal-detail/votes/votes.component.html index 468744aa2..9742056b4 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.html +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.html @@ -19,6 +19,7 @@
{ + this.proposalDetail?.total_vote?.forEach((f) => { switch (f.answer) { case VOTE_OPTION.VOTE_OPTION_YES: this.countTotal.yes = f.count; diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index 8844aaf8f..2fa0b5a5a 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -118,7 +118,7 @@ export class ProposalComponent implements OnInit { value2: addr, }; this.transactionService.getListTx(payload).subscribe((res) => { - const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.body?.messages[0]?.option); + const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.tx?.body?.messages[0]?.option); pro.vote_option = this.voteConstant.find( (s) => s.key === optionVote, )?.voteOption; From 3aa4f9a39302c565f9bf8f3d5b9698cac3754fc6 Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 23 May 2023 15:42:28 +0700 Subject: [PATCH 015/315] [TamTM6] update event log --- .../transaction-detail.component.html | 29 +++--- .../messages-item.component.html | 2 +- .../transaction-messages.component.html | 63 ++++++++++--- .../transaction-messages.component.scss | 17 ++++ .../transaction-messages.component.ts | 92 ++++++++++++++----- 5 files changed, 150 insertions(+), 53 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index 6954d07de..206435f5d 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -42,18 +42,18 @@

Transaction Details

{{ errorMessage }}
-
+
Chain Id
{{ transaction?.chainid }}
-
+
TxHash
{{ transaction?.tx_hash }} {{ transaction?.tx_hash | cutStringPipe : 8 : 8 }}
-
+
Status
Transaction Details

}}
-
+ -
+
Time
{{ commonService.getDateValue(transaction?.timestamp)[0] }}
@@ -90,7 +90,7 @@

Transaction Details

-
+
Fee
{{ +transaction?.fee | mask : 'separator.6' }} {{ denom }} @@ -111,13 +111,16 @@

Transaction Details

-
- - -
+ +

Messages

+
+ + +
+
Read
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html index 0d4a6bea8..96bdea880 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html @@ -1,4 +1,4 @@ -
+
{{ label }}
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 21eac9613..e46875d13 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -1,14 +1,14 @@ -

+
{{ checkTypeMessage() }} -
+
[pipeType]="item.pipeType">
-
+
Byte Code
@@ -53,12 +53,45 @@

+
+
+
Event Log
+
+ +
+ {{ element.events.type }} + +
+
+ {{ item.type }} +
+ +
+ {{ + data.key + }} + + {{ data.value }} + + +
+
+
+
+
+
+
+
+
-
+
Message
 
   
-
+
Message

@@ -136,11 +169,13 @@ 

[label]="'Sequence'" [value]="getLongValue(ibcData?.packet_sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ transactionDetail?.tx?.tx?.body?.messages[0]?.token?.amount | balanceOf | mask : 'separator.6' }} - {{ commonService.mappingNameIBC(transactionDetail?.tx?.tx?.body?.messages[0]?.token?.denom) }} + {{ + commonService.mappingNameIBC(transactionDetail?.tx?.tx?.body?.messages[0]?.token?.denom) + }}
[label]="'Sequence'" [value]="getLongValue(data?.packet?.sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ ibcData?.amount | balanceOf | mask : 'separator.6' }} @@ -192,7 +227,7 @@

[label]="'Sequence'" [value]="getLongValue(ibcData?.packet_sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ ibcData?.acknowledgement?.amount | balanceOf | mask : 'separator.6' }} @@ -230,7 +265,7 @@

-
+
Data
 
   
     
-
-
+
+
IBC Progress
-
+
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 356d2e96e..179545dad 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -96,3 +96,20 @@ overflow: scroll; } } + +.card-info { + background-color: var(--aura-gray-10); +} + +.box-event-log { + background-color: var(--aura-gray-9); + border-radius: 8px; + padding: 8px 20px; + padding-left: calc(var(--bs-gutter-x) * .5); + .item-event-log:not(:last-child) { + margin-bottom: var(--spacer-7); + } + .txt-event-key { + color: var(--aura-gray-4); + } +} \ No newline at end of file diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index ea63dde6b..a07ce0684 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -65,9 +65,13 @@ export class TransactionMessagesComponent implements OnInit { specialCase = { ByteCode: 'ByteCode', MultiSend: 'MultiSend', + EventLog: 'EventLog', }; currentIndex = 0; transactionTypeArr = []; + pipeData = pipeTypeData; + eventLogData = []; + idxLog = 0; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; coinMinimalDenom = this.environmentService.configValue.chain_info.currencies[0].coinMinimalDenom; @@ -157,7 +161,6 @@ export class TransactionMessagesComponent implements OnInit { if (this.currentIndex !== index) { return; } - this.currentIndex++; let result = []; const typeTrans = this.typeTransaction.find((f) => f.label.toLowerCase() === data['@type'].toLowerCase()); @@ -286,7 +289,7 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.ExecuteContract: - this.displayMsgRaw(); + this.displayMsgRaw(index); result.push({ key: 'Contract', value: data?.contract, link: { url: '/contracts' } }); result.push({ key: 'Sender', value: data?.sender, link: { url: '/account' } }); result.push({ key: 'Messages', value: this.objMsgContract, pipeType: pipeTypeData.Json }); @@ -294,7 +297,7 @@ export class TransactionMessagesComponent implements OnInit { case this.eTransType.InstantiateContract: case this.eTransType.InstantiateContract2: - this.displayMsgRaw(); + this.displayMsgRaw(index); result.push({ key: 'Contract', value: this.getDataJson('_contract_address'), @@ -540,7 +543,15 @@ export class TransactionMessagesComponent implements OnInit { default: break; } + console.log(this.transactionDetail?.tx?.logs[0]?.events); + + result.push({ + key: 'Event Log', + value: this.transactionDetail?.tx?.logs, + specialCase: this.specialCase.EventLog, + }); this.currentData.push(result); + this.currentIndex++; }); } @@ -618,37 +629,42 @@ export class TransactionMessagesComponent implements OnInit { } catch (e) {} } - displayMsgRaw(): void { - this.objMsgContract = _.get( + displayMsgRaw(idx = 0): void { + let msgs = _.get( this.transactionDetail?.tx?.tx?.body || this.transactionDetail?.tx?.body || this.transactionDetail, 'messages', - ).map((element) => { - let msg = _.get(element, 'msg'); - try { - if (typeof msg !== 'object' && msg !== null) { - msg = JSON.parse(msg); - } - } catch {} - - //get type mint don't type token id - if (!msg && this.transactionDetail?.raw_log.indexOf('mint') >= 0) { + ); + msgs?.forEach((element, index) => { + if (idx === index) { + let msg = _.get(element, 'msg'); try { - const jsonData = JSON.parse(this.transactionDetail?.raw_log); - if (jsonData && jsonData[0]) { - const data = jsonData[0]?.events[jsonData[0]?.events?.length - 1]?.attributes; - let tokenId = data.find((k) => k.key === 'token_id')?.value || null; - msg = { mint: { token_id: tokenId || null } }; + if (typeof msg !== 'object' && msg !== null) { + msg = JSON.parse(msg); + } + } catch {} + + //get type mint don't type token id + if (!msg && this.transactionDetail?.raw_log.indexOf('mint') >= 0) { + try { + const jsonData = JSON.parse(this.transactionDetail?.raw_log); + if (jsonData && jsonData[0]) { + const data = jsonData[0]?.events[jsonData[0]?.events?.length - 1]?.attributes; + let tokenId = data.find((k) => k.key === 'token_id')?.value || null; + msg = { mint: { token_id: tokenId || null } }; + } + } catch (e) { + msg = { mint: { token_id: null } }; } - } catch (e) { - msg = { mint: { token_id: null } }; } + const funds = _.get(element, 'funds'); + let result = { msg, funds }; + this.objMsgContract = result; + return; } - const funds = _.get(element, 'funds'); - return { msg, funds }; }); //get first data if array = 1 - if (this.objMsgContract.length === 1) { + if (this.objMsgContract?.length === 1) { this.objMsgContract = this.objMsgContract[0]; } } @@ -860,4 +876,30 @@ export class TransactionMessagesComponent implements OnInit { } return value; } + + displayLogAmount(value = '',index = 0) { + // let a = '100000000utaura'; + // this.transactionDetail?.tx?.logs[0]?.events?.forEach((element, index) => { + // let arr = element.attributes.filter(k => k.key === 'amount'); + // console.log(arr); + // // this.displayLogAmount.push({key:index, }) + // }); + // // console.log(index); + console.log(value); + + if (index === this.idxLog) { + let result = value.match(/\d+/g)[0]; + let denom = this.commonService.mappingNameIBC(value.replace(result, '') || this.denom); + result = balanceOf(result)?.toString(); + // if (value.indexOf('aura')) { + // result = balanceOf(result); + // } else if (value.indexOf('ibc')) { + // result = balanceOf(result); + // } + // return result; + this.idxLog++; + return result + `` + denom + ``; + } + return null; + } } From a40d8d6488da2550287dd59565b0ac295f243b98 Mon Sep 17 00:00:00 2001 From: mtam Date: Wed, 24 May 2023 08:46:02 +0700 Subject: [PATCH 016/315] [TamTM6] update event log part 2 --- .../transaction-messages.component.html | 30 ++++++++--- .../transaction-messages.component.scss | 50 ++++++++++++++++++- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index e46875d13..ce7271782 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -60,17 +60,30 @@
{{ element.events.type }} - -
-
+ + + + +
+ {{ item.type }} +
+
+ +
+ + +
-
- {{ +
+ {{ data.key }} - + {{ data.value }}
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 179545dad..36acba421 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -105,11 +105,57 @@ background-color: var(--aura-gray-9); border-radius: 8px; padding: 8px 20px; - padding-left: calc(var(--bs-gutter-x) * .5); + padding-left: calc(var(--bs-gutter-x) * 0.5); .item-event-log:not(:last-child) { margin-bottom: var(--spacer-7); } .txt-event-key { color: var(--aura-gray-4); } -} \ No newline at end of file +} + +.content-log { + position: relative; + &::before { + content: ''; + position: absolute; + left: 2px; + top: 0; + bottom: 0; + width: 2px; + border: 1px dashed gray; + } + &::after { + content: ''; + position: absolute; + left: -5px; + bottom: -1px; + width: 2px; + width: 0; + height: 0; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-top: 10px solid gray; + border-radius: 3px; + } +} + +.mat-expansion-panel { + background: none; + box-shadow: none !important; + mat-expansion-panel-header { + padding: 0 12px; + .txt-header::after { + font-family: 'Font Awesome 5 Free'; + font-weight: 700; + content: '\f077'; + color: var(--aura-gray-1); + font-size: 13px; + } + &[aria-expanded='true'] { + .txt-header::after { + content: '\f078'; + } + } + } +} From ed2bd0e9cf4e5294cea27ef10303ad2b094e690f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 17 May 2023 16:33:01 +0700 Subject: [PATCH 017/315] apply horoscope v2 for proposal excluded vote (cherry picked from commit 8250a3fa7b73684f23276cdb9e3a8f9f66fa665a) # Conflicts: # src/app/core/services/proposal.service.ts # src/app/pages/proposal/proposal.component.ts --- src/app/core/services/proposal.service.ts | 96 ++++++++----------- .../pages/dashboard/dashboard.component.ts | 10 +- .../summary-info/summary-info.component.html | 6 +- .../summary-info/summary-info.component.ts | 31 +++--- .../pages/proposal/proposal.component.html | 4 +- src/app/pages/proposal/proposal.component.ts | 41 ++++---- 6 files changed, 80 insertions(+), 108 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 4e6077dad..3e02de3ef 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -53,65 +53,45 @@ export class ProposalService extends CommonService { return this.http.get(`${this.indexerUrl}/votes`, { params }); } - // getProposalListDetail(payload) { - // const envDB = checkEnvQuery(this.environmentService.configValue.env); - // const operationsDoc = ` - // query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = 10) { - // ${envDB} { - // proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}}, order_by: {proposal_id: $order}) { - // content - // deposit_end_time - // description - // initial_deposit - // proposal_id - // proposer_address - // proposer { - // description - // operator_address - // account_address - // } - // status - // submit_time - // tally - // title - // total_deposit - // turnout - // type - // updated_at - // voting_end_time - // voting_start_time - // } - // } - // } - - // `; - // return this.http - // .post(this.graphUrl, { - // query: operationsDoc, - // variables: { - // limit: payload.limit, - // offset: 0, - // order: 'desc', - // proposalId: payload.proposalId, - // }, - // operationName: 'auratestnet_proposal', - // }) - // .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - // } + getProposalList(payload, proposal_id = '') { + const limit = payload.limit; + const nextKey = payload.nextKey; - getProposalList(pageLimit = 20, nextKey = null, proposalId = null): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - pageLimit: pageLimit, - nextKey, - reverse: false, - proposalId: proposalId, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/proposal`, { params }); + let updateQuery = ''; + if (payload.nextKey !== null) { + updateQuery = + ', where: {proposal_id: {_lt: ' + nextKey + ', _lte:' + (nextKey - 40 > 0 ? nextKey - 40 : 1) + '}}'; + } + if (proposal_id !== '') { + updateQuery = ', where: {proposal_id: {_eq: ' + proposal_id + '}}'; + } + const envDB = checkEnvQuery(this.environmentService.configValue.env); + const operationsDoc = ` + query getListProposal ($limit: Int) { + ${envDB} { + proposal (limit: $limit, order_by: {proposal_id: desc} ${updateQuery}) { + tally + proposal_id + content + status + proposer_address + title + voting_end_time + voting_start_time + total_deposit + submit_time + initial_deposit + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { limit: limit }, + operationName: 'getListProposal', + }) + .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); } getVoteMessageByConstant(option: any) { diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index da3f1f107..793294ad0 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -411,9 +411,13 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } getVotingPeriod() { - this.proposalService.getProposalList(20, null).subscribe((res) => { - if (res?.data?.proposals) { - let tempDta = res.data.proposals; + let payload = { + limit: 20, + nextKey: null, + }; + this.proposalService.getProposalList(payload).subscribe((res) => { + if (res?.proposal) { + let tempDta = res.proposal; this.voting_Period_arr = tempDta.filter((k) => k?.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD); this.voting_Period_arr.forEach((pro, index) => { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index 31ace86d8..2cd01362a 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -57,12 +57,12 @@

- {{ proposalDetail.proposer_name ? proposalDetail.proposer_name : proposalDetail.proposer_address }} + {{ proposalDetail.proposer ? proposalDetail.proposer.description.moniker : proposalDetail.proposer_address }} {{ - proposalDetail.proposer_name - ? proposalDetail.proposer_name + proposalDetail.proposer + ? proposalDetail.proposer.description.moniker : (proposalDetail.proposer_address | cutStringPipe : 8 : 8) }} diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 3c086a1dc..2f8831e7b 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -67,16 +67,20 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } getProposalDetail(): void { + let payload = { + limit: 1, + nextKey: null, + }; this.proposalService - .getProposalList(1, null, this.proposalId) + .getProposalList(payload, this.proposalId.toString()) .pipe( - map((dta) => dta.data), + map((dta) => dta.proposal), mergeMap((data) => { - if (data?.count > 0) { - if (data.proposals[0].status === VOTING_STATUS.PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT) { + if (data?.length > 0) { + if (data[0].status === VOTING_STATUS.PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT) { this.proposalDtl.emit(null); } - this.proposalDetail = this.makeProposalDataDetail(data.proposals[0]); + this.proposalDetail = this.makeProposalDataDetail(data[0]); if (this.proposalDetail?.content?.amount) { this.proposalDetail['request_amount'] = balanceOf(this.proposalDetail?.content?.amount[0]?.amount); } @@ -84,7 +88,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { mergeMap((res) => { if (res.data) { this.proposalDetail.total_bonded_token = balanceOf(res.data.bonded_tokens); - if (data.proposals[0].status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { + if (data[0].status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { this.proposalDetail.pro_turnout = (this.proposalDetail.pro_total_vote * 100) / this.proposalDetail.total_bonded_token; } else { @@ -106,7 +110,6 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { const { quorum, threshold, veto_threshold } = result; if (this.proposalDetail) { const { pro_votes_yes, pro_total_vote, pro_votes_abstain, pro_votes_no_with_veto } = this.proposalDetail; - this.proposalDetail['quorum'] = quorum * 100; this.proposalDetail['threshold'] = threshold * 100; this.proposalDetail['veto_threshold'] = veto_threshold * 100; @@ -191,16 +194,10 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } makeProposalDataDetail(data) { - let pro_votes_yes = balanceOf(+data.final_tally_result.yes); - let pro_votes_no = balanceOf(+data.final_tally_result.no); - let pro_votes_no_with_veto = balanceOf(+data.final_tally_result.no_with_veto); - let pro_votes_abstain = balanceOf(+data.final_tally_result.abstain); - if (data.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { - pro_votes_yes = balanceOf(+data.tally.yes); - pro_votes_no = balanceOf(+data.tally.no); - pro_votes_no_with_veto = balanceOf(+data.tally.no_with_veto); - pro_votes_abstain = balanceOf(+data.tally.abstain); - } + let pro_votes_yes = balanceOf(+data.tally.yes); + let pro_votes_no = balanceOf(+data.tally.no); + let pro_votes_no_with_veto = balanceOf(+data.tally.no_with_veto); + let pro_votes_abstain = balanceOf(+data.tally.abstain); const pro_total_vote = pro_votes_yes + pro_votes_no + pro_votes_no_with_veto + pro_votes_abstain; return { diff --git a/src/app/pages/proposal/proposal.component.html b/src/app/pages/proposal/proposal.component.html index b0d0f076d..143170feb 100644 --- a/src/app/pages/proposal/proposal.component.html +++ b/src/app/pages/proposal/proposal.component.html @@ -25,8 +25,8 @@
Proposer
{{ - lastedItem.proposer_name - ? lastedItem.proposer_name + lastedItem.proposer + ? lastedItem.proposer.description.moniker : (lastedItem.proposer_address | cutStringPipe : 8 : 8) }} diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index 8844aaf8f..c82e20fb5 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -83,32 +83,26 @@ export class ProposalComponent implements OnInit { } getFourLastedProposal() { - this.proposalService.getProposalList(4, null).subscribe((res) => { - if (res?.data?.proposals) { + let payload = { + limit: 4, + nextKey: null, + }; + this.proposalService.getProposalList(payload).subscribe((res) => { + if (res?.proposal) { const addr = this.walletService.wallet?.bech32Address || null; - this.proposalData = res.data.proposals; + this.proposalData = res.proposal; if (this.proposalData?.length > 0) { this.proposalData.forEach((pro, index) => { if (pro?.tally) { const { yes, no, no_with_veto, abstain } = pro?.tally; let totalVote = +yes + +no + +no_with_veto + +abstain; - if (this.proposalData[index].tally) { this.proposalData[index].tally.yes = (+yes * 100) / totalVote; this.proposalData[index].tally.no = (+no * 100) / totalVote; this.proposalData[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; this.proposalData[index].tally.abstain = (+abstain * 100) / totalVote; } - } else if (pro?.final_tally_result) { - const { yes, no, no_with_veto, abstain } = pro.final_tally_result; - let totalVote = +yes + +no + +no_with_veto + +abstain; - this.proposalData[index]['tally'] = { yes: 0, no: 0, no_with_veto: 0, abstain: 0 }; - this.proposalData[index].tally.yes = (+yes * 100) / totalVote; - this.proposalData[index].tally.no = (+no * 100) / totalVote; - this.proposalData[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; - this.proposalData[index].tally.abstain = (+abstain * 100) / totalVote; } - const getVoted = async () => { if (addr) { const payload = { @@ -133,19 +127,16 @@ export class ProposalComponent implements OnInit { } getListProposal(nextKey = null) { - this.proposalService.getProposalList(40, nextKey).subscribe((res) => { - this.nextKey = res.data.nextKey ? res.data.nextKey : null; - if (res?.data?.proposals) { - let tempDta = res.data.proposals; - tempDta.forEach((pro, index) => { + let payload = { + limit: 40, + nextKey: nextKey, + }; + this.proposalService.getProposalList(payload).subscribe((res) => { + this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; + if (res?.proposal) { + let tempDta = res.proposal; + tempDta.forEach((pro) => { pro.total_deposit[0].amount = balanceOf(pro.total_deposit[0].amount); - const { yes, no, no_with_veto, abstain } = pro.final_tally_result; - let totalVote = +yes + +no + +no_with_veto + +abstain; - tempDta[index]['tally'] = { yes: 0, no: 0, no_with_veto: 0, abstain: 0 }; - tempDta[index].tally.yes = (+yes * 100) / totalVote; - tempDta[index].tally.no = (+no * 100) / totalVote; - tempDta[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; - tempDta[index].tally.abstain = (+abstain * 100) / totalVote; }); if (this.dataSource.data.length > 0) { this.dataSource.data = [...this.dataSource.data, ...tempDta]; From 14580fa5c1c3a121b69d040ee40ce6ff855340d3 Mon Sep 17 00:00:00 2001 From: mtam Date: Wed, 24 May 2023 16:57:41 +0700 Subject: [PATCH 018/315] [TamTM6] update event log part 3 --- src/app/core/pipes/common-pipe.module.ts | 3 + src/app/core/pipes/common.pipe.ts | 19 +- .../block-detail/block-detail.component.html | 39 +++ .../transaction-detail.component.html | 12 +- .../messages-item.component.html | 2 +- .../transaction-messages.component.html | 281 +++++++++--------- .../transaction-messages.component.scss | 5 + .../transaction-messages.component.ts | 42 +-- 8 files changed, 222 insertions(+), 181 deletions(-) diff --git a/src/app/core/pipes/common-pipe.module.ts b/src/app/core/pipes/common-pipe.module.ts index a9c46c6a2..e709bbaf9 100644 --- a/src/app/core/pipes/common-pipe.module.ts +++ b/src/app/core/pipes/common-pipe.module.ts @@ -9,6 +9,7 @@ import { StringEllipsis, ReplaceIpfs, ConvertUauraToAura, + convertLogAmount, } from './common.pipe'; import { JsonPipe } from './json.pipe'; @@ -23,6 +24,7 @@ import { JsonPipe } from './json.pipe'; BalanceOf, ReplaceIpfs, ConvertUauraToAura, + convertLogAmount, ], imports: [CommonModule], exports: [ @@ -35,6 +37,7 @@ import { JsonPipe } from './json.pipe'; BalanceOf, ReplaceIpfs, ConvertUauraToAura, + convertLogAmount, ], }) export class CommonPipeModule {} diff --git a/src/app/core/pipes/common.pipe.ts b/src/app/core/pipes/common.pipe.ts index b9e2ec44d..9caa38c74 100644 --- a/src/app/core/pipes/common.pipe.ts +++ b/src/app/core/pipes/common.pipe.ts @@ -2,6 +2,8 @@ import { formatDate } from '@angular/common'; import { Pipe, PipeTransform } from '@angular/core'; import BigNumber from 'bignumber.js'; import { EnvironmentService } from '../data-services/environment.service'; +import { CommonService } from '../services/common.service'; +import { balanceOf } from '../utils/common/parsing'; @Pipe({ name: 'calDate' }) export class pipeCalDate implements PipeTransform { @@ -27,7 +29,7 @@ export class pipeCalDate implements PipeTransform { export class PipeCutString implements PipeTransform { transform(value: string, start: number, end?: number): string { let endChar = end || 0; - if (value && value.length > (start + endChar)) { + if (value && value.length > start + endChar) { if (end) { const firstChar = value.substring(0, start); const lastChar = value.substring(value.length - end); @@ -94,3 +96,18 @@ export class ConvertUauraToAura implements PipeTransform { return value / Math.pow(10, powNum); } } + +@Pipe({ name: 'convertLogAmount' }) +export class convertLogAmount implements PipeTransform { + constructor(private commonService: CommonService) {} + transform(value: string): string { + let result = value.match(/\d+/g)[0]; + let denom = this.commonService.mappingNameIBC(value.replace(result, '')); + result = balanceOf(result)?.toString(); + console.log(result); + if (+result <= 0) { + return '-'; + } + return result + `` + denom + ``; + } +} diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index 519abf9ec..d89488364 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -243,6 +243,45 @@

Transactions

+ + +
+

Events

+
+
+ +
+
+
diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index 206435f5d..72d118f97 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -113,13 +113,11 @@

Transaction Details

Messages

-
- - -
+ +
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html index 96bdea880..dbe5b05ae 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html @@ -1,4 +1,4 @@ -
+
{{ label }}
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index ce7271782..69ecf240e 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -1,120 +1,77 @@ - -
+
{{ checkTypeMessage() }} -
- +
+ - - - - -
-
-
Byte Code
-
-
- {{ item?.value }} -
-
- See More -
-
- See Less + "> + + + + +
+
+
Byte Code
+
+
+ {{ item?.value }} +
+
+ See More +
+
+ See Less +
-
-
-
-
Event Log
-
- -
- {{ element.events.type }} - - - - -
- {{ item.type }} -
-
- -
- - -
- -
- {{ - data.key - }} - - {{ data.value }} - - -
-
-
-
- -
-
-
+
+ +
-
+ - - -
-
Message
-
-

+              
+                
+
Message
+
+

+                  
-
- + +
@@ -122,36 +79,44 @@ -
- - - -
- - -
-
- - -
-
- - -
-
- - -
-
- - - -
-
- - -
-
+
+
+ + + +
+ + + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + + +
+
+ + +
+
+ + +
@@ -159,7 +124,7 @@
-
+
Message

@@ -183,7 +148,7 @@
       [label]="'Sequence'"
       [value]="getLongValue(ibcData?.packet_sequence)"
       [pipeType]="pipeTypeData.Number">
-    
+
Amount
{{ transactionDetail?.tx?.tx?.body?.messages[0]?.token?.amount | balanceOf | mask : 'separator.6' }} @@ -207,7 +172,7 @@ [label]="'Sequence'" [value]="getLongValue(data?.packet?.sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ ibcData?.amount | balanceOf | mask : 'separator.6' }} @@ -241,7 +206,7 @@ [label]="'Sequence'" [value]="getLongValue(ibcData?.packet_sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ ibcData?.acknowledgement?.amount | balanceOf | mask : 'separator.6' }} @@ -279,7 +244,7 @@ -
+
Data
     
-
+
IBC Progress
+ +
+
Event Log
+
+ +
+ {{ element.events.type }} + + + +
+ {{ item.type }} +
+
+ +
+ +
+ +
+ {{ data.key }} + + {{ data.value }} + + +
+
+
+
+
+
+
+
+
+
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 36acba421..9f2449308 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -106,6 +106,8 @@ border-radius: 8px; padding: 8px 20px; padding-left: calc(var(--bs-gutter-x) * 0.5); + max-height: 420px; + overflow-y: scroll; .item-event-log:not(:last-child) { margin-bottom: var(--spacer-7); } @@ -145,6 +147,9 @@ box-shadow: none !important; mat-expansion-panel-header { padding: 0 12px; + .mat-expanded { + height: 40px; + } .txt-header::after { font-family: 'Font Awesome 5 Free'; font-weight: 700; diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index a07ce0684..bdee0040b 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -5,7 +5,7 @@ import { balanceOf } from 'src/app/core/utils/common/parsing'; import { DATEFORMAT } from '../../../../core/constants/common.constant'; import { PROPOSAL_VOTE } from '../../../../core/constants/proposal.constant'; import { TYPE_TRANSACTION } from '../../../../core/constants/transaction.constant'; -import { pipeTypeData, TRANSACTION_TYPE_ENUM, TypeTransaction } from '../../../../core/constants/transaction.enum'; +import { CodeTransaction, pipeTypeData, TRANSACTION_TYPE_ENUM, TypeTransaction } from '../../../../core/constants/transaction.enum'; import { getAmount, Globals } from '../../../../global/global'; import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { CommonService } from 'src/app/core/services/common.service'; @@ -543,13 +543,15 @@ export class TransactionMessagesComponent implements OnInit { default: break; } - console.log(this.transactionDetail?.tx?.logs[0]?.events); + + if (this.transactionDetail.code === CodeTransaction.Success) { + result.push({ + key: 'Event Log', + value: this.transactionDetail?.tx?.logs, + specialCase: this.specialCase.EventLog, + }); + } - result.push({ - key: 'Event Log', - value: this.transactionDetail?.tx?.logs, - specialCase: this.specialCase.EventLog, - }); this.currentData.push(result); this.currentIndex++; }); @@ -876,30 +878,4 @@ export class TransactionMessagesComponent implements OnInit { } return value; } - - displayLogAmount(value = '',index = 0) { - // let a = '100000000utaura'; - // this.transactionDetail?.tx?.logs[0]?.events?.forEach((element, index) => { - // let arr = element.attributes.filter(k => k.key === 'amount'); - // console.log(arr); - // // this.displayLogAmount.push({key:index, }) - // }); - // // console.log(index); - console.log(value); - - if (index === this.idxLog) { - let result = value.match(/\d+/g)[0]; - let denom = this.commonService.mappingNameIBC(value.replace(result, '') || this.denom); - result = balanceOf(result)?.toString(); - // if (value.indexOf('aura')) { - // result = balanceOf(result); - // } else if (value.indexOf('ibc')) { - // result = balanceOf(result); - // } - // return result; - this.idxLog++; - return result + `` + denom + ``; - } - return null; - } } From fd9ea2e085730b12f7a3cb531c8cbce009ff11fd Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 25 May 2023 11:12:13 +0700 Subject: [PATCH 019/315] apply horoscope v2 for proposal --- src/app/core/services/proposal.service.ts | 89 +++++-------------- .../pages/dashboard/dashboard.component.ts | 3 +- .../summary-info/summary-info.component.ts | 6 +- src/app/pages/proposal/proposal.component.ts | 5 +- 4 files changed, 29 insertions(+), 74 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index fdc1c7b8b..4d3f61330 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -56,89 +56,46 @@ export class ProposalService extends CommonService { getProposalData(payload) { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = 10) { + query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null) { ${envDB} { - proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}}, order_by: {proposal_id: $order}) { - content - deposit_end_time + proposal(limit: $limit, where: {proposal_id: {_eq: $proposalId, _lt: $nextKey}}, order_by: {proposal_id: $order}) { + content + deposit_end_time + description + initial_deposit + proposal_id + proposer_address + proposer { description - initial_deposit - proposal_id - proposer_address - proposer { - description - operator_address - account_address - } - status - submit_time - tally - title - total_deposit - turnout - type - updated_at - voting_end_time - voting_start_time + operator_address + account_address } + status + submit_time + tally + title + total_deposit + turnout + type + updated_at + voting_end_time + voting_start_time } } - - `; + }`; return this.http .post(this.graphUrl, { query: operationsDoc, variables: { limit: payload.limit, - offset: 0, order: 'desc', + nextKey: payload.nextKey, proposalId: payload.proposalId, }, operationName: 'auratestnet_proposal', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - - getProposalList(payload, proposal_id = '') { - const limit = payload.limit; - const nextKey = payload.nextKey; - - let updateQuery = ''; - if (payload.nextKey !== null) { - updateQuery = - ', where: {proposal_id: {_lt: ' + nextKey + ', _lte:' + (nextKey - 40 > 0 ? nextKey - 40 : 1) + '}}'; - } - if (proposal_id !== '') { - updateQuery = ', where: {proposal_id: {_eq: ' + proposal_id + '}}'; - } - const envDB = checkEnvQuery(this.environmentService.configValue.env); - const operationsDoc = ` - query getListProposal ($limit: Int) { - ${envDB} { - proposal (limit: $limit, order_by: {proposal_id: desc} ${updateQuery}) { - tally - proposal_id - content - status - proposer_address - title - voting_end_time - voting_start_time - total_deposit - submit_time - initial_deposit - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { limit: limit }, - operationName: 'getListProposal', - }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); - } getVoteMessageByConstant(option: any) { if (typeof option === 'string') { diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 793294ad0..f0b04ad52 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -413,9 +413,8 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { getVotingPeriod() { let payload = { limit: 20, - nextKey: null, }; - this.proposalService.getProposalList(payload).subscribe((res) => { + this.proposalService.getProposalData(payload).subscribe((res) => { if (res?.proposal) { let tempDta = res.proposal; this.voting_Period_arr = tempDta.filter((k) => k?.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD); diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 4527b5cc4..bb6c12473 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -6,6 +6,7 @@ import * as _ from 'lodash'; import * as moment from 'moment'; import { from } from 'rxjs'; import { map, mergeMap } from 'rxjs/operators'; +import { TransactionService } from 'src/app/core/services/transaction.service'; import { Globals } from '../../../../../app/global/global'; import { PROPOSAL_STATUS, @@ -21,7 +22,6 @@ import { ProposalService } from '../../../../core/services/proposal.service'; import { WalletService } from '../../../../core/services/wallet.service'; import { balanceOf } from '../../../../core/utils/common/parsing'; import { ProposalVoteComponent } from '../../proposal-vote/proposal-vote.component'; -import { TransactionService } from 'src/app/core/services/transaction.service'; const marked = require('marked'); @Component({ @@ -69,8 +69,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { getProposalDetail(): void { let payload = { limit: 1, - proposalId: this.proposalId - } + proposalId: this.proposalId, + }; this.proposalService .getProposalData(payload) .pipe( diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index 6d49b647d..6ec13eb10 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -85,9 +85,8 @@ export class ProposalComponent implements OnInit { getFourLastedProposal() { let payload = { limit: 4, - nextKey: null, }; - this.proposalService.getProposalList(payload).subscribe((res) => { + this.proposalService.getProposalData(payload).subscribe((res) => { if (res?.proposal) { const addr = this.walletService.wallet?.bech32Address || null; this.proposalData = res.proposal; @@ -131,7 +130,7 @@ export class ProposalComponent implements OnInit { limit: 40, nextKey: nextKey, }; - this.proposalService.getProposalList(payload).subscribe((res) => { + this.proposalService.getProposalData(payload).subscribe((res) => { this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; if (res?.proposal) { let tempDta = res.proposal; From 1998ea97acd5a32d9f031044b898420f7b9c8dca Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 18 May 2023 16:37:47 +0700 Subject: [PATCH 020/315] [TamTM6] update event log part 4 --- src/app/core/services/validator.service.ts | 10 ++--- src/app/global/global.ts | 3 +- .../messages-item.component.html | 2 +- .../transaction-messages.component.html | 39 +++++++++++-------- .../transaction-messages.component.scss | 2 +- .../transaction-messages.component.ts | 20 +++++----- .../validators-detail.component.ts | 12 +++--- 7 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 80b479639..af32b7731 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -108,19 +108,17 @@ export class ValidatorService extends CommonService { // filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; // } const operationsDoc = ` - query auratestnet_powerevent($operator_address: String, $limit: Int = 10, $offset: Int = 0) { + query auratestnet_powerevent($operator_address: String, $limit: Int = 10, $nextKey: Int = null) { auratestnet { - power_event(order_by: {height: desc}, where: {_or: [{validatorDst: {operator_address: {_eq: $operator_address}}}, {validatorSrc: {operator_address: {_eq: $operator_address}}}]}, limit: $limit, offset: $offset) { + power_event(order_by: {height: desc}, where: {_or: [{validatorDst: {operator_address: {_eq: $operator_address}}}, {validatorSrc: {operator_address: {_eq: $operator_address}}}], id: {_lt: $nextKey}}, limit: $limit) { id time height + type transaction { hash - transaction_messages { - type - } - data } + amount } } } diff --git a/src/app/global/global.ts b/src/app/global/global.ts index 12ee2200c..c30e49d4e 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -278,8 +278,7 @@ export function convertDataTransaction(data, coinInfo) { type = TypeTransaction.GetReward; } else if (lstType?.length > 1) { if ( - lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend || - lstType[1]['@type'] === TRANSACTION_TYPE_ENUM.Send + lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend ) { type = TypeTransaction.MultiSend; } else { diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html index dbe5b05ae..bb85edb17 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html @@ -1,4 +1,4 @@ -
+
{{ label }}
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 69ecf240e..79c1aaaef 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -2,7 +2,7 @@
{{ checkTypeMessage() }} - +
@@ -29,7 +29,7 @@ [pipeType]="item.pipeType">
-
+
Byte Code
@@ -61,7 +61,7 @@ -
+
Message
     
-      
+
Message

@@ -148,7 +148,7 @@
       [label]="'Sequence'"
       [value]="getLongValue(ibcData?.packet_sequence)"
       [pipeType]="pipeTypeData.Number">
-    
+
Amount
{{ transactionDetail?.tx?.tx?.body?.messages[0]?.token?.amount | balanceOf | mask : 'separator.6' }} @@ -172,7 +172,7 @@ [label]="'Sequence'" [value]="getLongValue(data?.packet?.sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ ibcData?.amount | balanceOf | mask : 'separator.6' }} @@ -206,7 +206,7 @@ [label]="'Sequence'" [value]="getLongValue(ibcData?.packet_sequence)" [pipeType]="pipeTypeData.Number"> -
+
Amount
{{ ibcData?.acknowledgement?.amount | balanceOf | mask : 'separator.6' }} @@ -244,7 +244,7 @@ -
+
Data
     
-
+
IBC Progress
From
- + {{ transactionDetail?.messages[0]?.inputs[0]?.address }}
To
- + {{ item?.address }}
- {{ item?.coins[0]?.amount | balanceOf | mask : 'separator.6' }} - {{ denom }} +
+ +
-
+
Event Log
@@ -462,9 +467,9 @@
-
- {{ data.key }} - +
+ {{ data.key }} + {{ data.value }} diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 9f2449308..599fa3f57 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -93,7 +93,7 @@ } @media (max-width: 1366px) { - overflow: scroll; + overflow-y: scroll; } } diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index bdee0040b..20a841a0d 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -1,19 +1,19 @@ +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { DatePipe } from '@angular/common'; import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core'; +import * as _ from 'lodash'; +import * as Long from 'long'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { CommonService } from 'src/app/core/services/common.service'; +import { ProposalService } from 'src/app/core/services/proposal.service'; +import { TransactionService } from 'src/app/core/services/transaction.service'; import { balanceOf } from 'src/app/core/utils/common/parsing'; import { DATEFORMAT } from '../../../../core/constants/common.constant'; import { PROPOSAL_VOTE } from '../../../../core/constants/proposal.constant'; import { TYPE_TRANSACTION } from '../../../../core/constants/transaction.constant'; -import { CodeTransaction, pipeTypeData, TRANSACTION_TYPE_ENUM, TypeTransaction } from '../../../../core/constants/transaction.enum'; -import { getAmount, Globals } from '../../../../global/global'; -import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { CommonService } from 'src/app/core/services/common.service'; -import { TransactionService } from 'src/app/core/services/transaction.service'; -import * as _ from 'lodash'; +import { CodeTransaction, TRANSACTION_TYPE_ENUM, TypeTransaction, pipeTypeData } from '../../../../core/constants/transaction.enum'; import { formatWithSchema } from '../../../../core/helpers/date'; -import { ProposalService } from 'src/app/core/services/proposal.service'; -import * as Long from 'long'; +import { Globals, getAmount } from '../../../../global/global'; @Component({ selector: 'app-transaction-messages', @@ -84,10 +84,12 @@ export class TransactionMessagesComponent implements OnInit { private layout: BreakpointObserver, public commonService: CommonService, private transactionService: TransactionService, - private proposalService: ProposalService, + private proposalService: ProposalService ) {} ngOnInit(): void { + console.log(this.transactionDetail); + this.currentIndex = 0; // check if contract type not belongTo TypeTransaction enum if (Object.values(TRANSACTION_TYPE_ENUM).includes(this.transactionDetail?.type)) { diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 392f90241..3896e959c 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -275,17 +275,15 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { const txs = _.get(res, 'power_event').map((element) => { let isStakeMode = false; const tx_hash = _.get(element, 'transaction.hash'); - const address = _.get(element, 'transaction.data[0].validator_dst_address'); - const _type = _.get(element, 'transaction.transaction_messages[0].type'); + // const address = _.get(element, 'transaction.data[0].validator_dst_address'); + const _type = _.get(element, 'type'); if ( - _type === TRANSACTION_TYPE_ENUM.Delegate || - (_type === TRANSACTION_TYPE_ENUM.Redelegate && address === this.currentAddress) || - _type === TRANSACTION_TYPE_ENUM.CreateValidator || - _type === TRANSACTION_TYPE_ENUM.ExecuteAuthz + _type === 'delegate' ) { isStakeMode = true; } - let amount = getAmount(_.get(element, 'transaction.data'), _type, _.get(element, 'data.body.raw_log')); + // let amount = getAmount(_.get(element, 'transaction.data'), _type, _.get(element, 'data.body.raw_log')); + let amount = balanceOf(element.amount) || '0'; if (amount === 0 && element?.transaction?.data?.length > 0) { amount = 'More'; From 4ae6948d099e74471911f57d44d954d1423e5d14 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 25 May 2023 15:38:19 +0700 Subject: [PATCH 021/315] apply horoscope v2 for proposal --- src/app/core/services/transaction.service.ts | 34 ++++++++------------ 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 900170f46..95e661171 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -30,12 +30,6 @@ export class TransactionService extends CommonService { $compositeKey2: String = null $value2: String = null $key2: String = null - $compositeKeyIn: [String!] = null - $valueIn: [String!] = null - $keyIn: [String!] = null - $compositeKeyIn2: [String!] = null - $valueIn2: [String!] = null - $keyIn2: [String!] = null $heightGT: Int = null $heightLT: Int = null $indexGT: Int = null @@ -50,9 +44,9 @@ export class TransactionService extends CommonService { hash: { _eq: $hash } height: { _eq: $height } event_attribute_index: { - value: { _eq: $value, _in: $valueIn } - composite_key: { _eq: $compositeKey, _in: $compositeKeyIn } - key: { _eq: $key, _in: $keyIn } + value: { _eq: $value } + composite_key: { _eq: $compositeKey } + key: { _eq: $key } } _and: [ { height: { _gt: $heightGT } } @@ -61,9 +55,9 @@ export class TransactionService extends CommonService { { index: { _lt: $indexLT } } { event_attribute_index: { - value: { _eq: $value2, _in: $valueIn2 } - composite_key: { _eq: $compositeKey2, _in: $compositeKeyIn2 } - key: { _eq: $key2, _in: $keyIn2 } + value: { _eq: $value2 } + composite_key: { _eq: $compositeKey2 } + key: { _eq: $key2 } } } ] @@ -85,21 +79,21 @@ export class TransactionService extends CommonService { return this.http .post(this.graphUrl, { query: operationsDoc, - variables:{ + variables: { limit: payload.limit, - order: "desc", - hash: null, - key: payload.key, + order: 'desc', + hash: payload.hash, compositeKey: payload.compositeKey, value: payload.value, - key2: null, - compositeKey2: null, - value2: null, + key: payload.key, heightGT: null, heightLT: payload.heightLT, indexGT: null, indexLT: null, - height: null + height: null, + compositeKey2: payload.compositeKey2, + value2: payload.value2, + key2: payload.key2, }, operationName: 'auratestnet_transaction', }) From ded9e8f5fa2c34e67c7eebfa88be7096b5e33d49 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 25 May 2023 16:56:41 +0700 Subject: [PATCH 022/315] update signer --- src/app/core/services/wallet.service.ts | 2 +- src/app/core/utils/signing/signer.ts | 2 +- src/app/core/utils/signing/transaction-manager.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/core/services/wallet.service.ts b/src/app/core/services/wallet.service.ts index b773b3d28..c3f5acff8 100644 --- a/src/app/core/services/wallet.service.ts +++ b/src/app/core/services/wallet.service.ts @@ -392,7 +392,7 @@ export class WalletService implements OnDestroy { if (this.isMobileMatched && !this.checkExistedCoin98()) { return this.coin98Client.execute(userAddress, contract_address, msg, '', undefined, fee, undefined); } else { - signer = window.getOfflineSignerOnlyAmino(this.chainId); + signer = await window.getOfflineSignerAuto(this.chainId); } return SigningCosmWasmClient.connectWithSigner(this.chainInfo.rpc, signer, fee).then((client) => diff --git a/src/app/core/utils/signing/signer.ts b/src/app/core/utils/signing/signer.ts index 249e58415..dcbe04a07 100644 --- a/src/app/core/utils/signing/signer.ts +++ b/src/app/core/utils/signing/signer.ts @@ -2,7 +2,7 @@ import { ESigningType } from '../../constants/wallet.constant'; export async function getSigner(signingType: ESigningType = ESigningType.Keplr, chainId: string) { if (signingType === ESigningType.Keplr) { - return window.getOfflineSignerOnlyAmino(chainId); + return await window.getOfflineSignerAuto(chainId); } throw new Error(`Signing via ${signingType} is not supported`); diff --git a/src/app/core/utils/signing/transaction-manager.ts b/src/app/core/utils/signing/transaction-manager.ts index dfbfbca5b..df6fd3382 100644 --- a/src/app/core/utils/signing/transaction-manager.ts +++ b/src/app/core/utils/signing/transaction-manager.ts @@ -66,7 +66,7 @@ export async function getNetworkFee(network, address, messageType, memo = ''): P let gasEstimation = 0; try { - const signer = window.getOfflineSignerOnlyAmino(network.chainId); + const signer = await window.getOfflineSignerAuto(network.chainId); const onlineClient = await SigningCosmWasmClient.connectWithSigner(network.rpc, signer); gasEstimation = await onlineClient.simulate(address, Array.isArray(messageType) ? messageType : [messageType], ''); } catch (e) { From febd1f80205017d3ad9dcbe9f95b1aea85816498 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 25 May 2023 17:03:22 +0700 Subject: [PATCH 023/315] [TamTM6] update event log part 5 --- src/app/core/pipes/common.pipe.ts | 6 ++-- src/app/global/global.ts | 31 +++++++++++++------ .../block-detail/block-detail.component.html | 8 ++--- .../transaction-messages.component.html | 16 ++++++---- .../transaction-messages.component.scss | 15 +++++++-- .../transaction-messages.component.ts | 2 -- .../pages/transaction/transaction.module.ts | 6 ++-- 7 files changed, 54 insertions(+), 30 deletions(-) diff --git a/src/app/core/pipes/common.pipe.ts b/src/app/core/pipes/common.pipe.ts index 9caa38c74..1a61dfc29 100644 --- a/src/app/core/pipes/common.pipe.ts +++ b/src/app/core/pipes/common.pipe.ts @@ -4,6 +4,7 @@ import BigNumber from 'bignumber.js'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from '../services/common.service'; import { balanceOf } from '../utils/common/parsing'; +import { MaskPipe } from 'ngx-mask'; @Pipe({ name: 'calDate' }) export class pipeCalDate implements PipeTransform { @@ -99,12 +100,11 @@ export class ConvertUauraToAura implements PipeTransform { @Pipe({ name: 'convertLogAmount' }) export class convertLogAmount implements PipeTransform { - constructor(private commonService: CommonService) {} + constructor(private commonService: CommonService, private mask: MaskPipe) {} transform(value: string): string { let result = value.match(/\d+/g)[0]; let denom = this.commonService.mappingNameIBC(value.replace(result, '')); - result = balanceOf(result)?.toString(); - console.log(result); + result = this.mask.transform(balanceOf(result), 'separator.6'); if (+result <= 0) { return '-'; } diff --git a/src/app/global/global.ts b/src/app/global/global.ts index c30e49d4e..35cbe1211 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -277,9 +277,7 @@ export function convertDataTransaction(data, coinInfo) { if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.GetReward) { type = TypeTransaction.GetReward; } else if (lstType?.length > 1) { - if ( - lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend - ) { + if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend) { type = TypeTransaction.MultiSend; } else { type = 'Multiple'; @@ -334,11 +332,6 @@ export function convertDataTransactionV2(data, coinInfo) { } }); } - const typeOrigin = _type; - const type = _.find(TYPE_TRANSACTION, { label: _type })?.value || _type.split('.').pop(); - - const status = - _.get(element, 'code') == CodeTransaction.Success ? StatusTransaction.Success : StatusTransaction.Fail; const _amount = getAmount( _.get(element, 'data.body.messages'), @@ -347,7 +340,27 @@ export function convertDataTransactionV2(data, coinInfo) { coinInfo.coinMinimalDenom, ); - const amount = _.isNumber(_amount) && _amount > 0 ? _amount.toFixed(coinInfo.coinDecimals) : _amount; + const typeOrigin = _type; + let amount = _.isNumber(_amount) && _amount > 0 ? _amount.toFixed(coinInfo.coinDecimals) : _amount; + let type = _.find(TYPE_TRANSACTION, { label: _type })?.value || _type.split('.').pop(); + + try { + if (lstType[0]['@type'].indexOf('ibc') == -1) { + if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.GetReward) { + type = TypeTransaction.GetReward; + } else if (lstType?.length > 1) { + if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend) { + type = TypeTransaction.MultiSend; + } else { + type = 'Multiple'; + } + amount = 'More'; + } + } + } catch (e) {} + + const status = + _.get(element, 'code') == CodeTransaction.Success ? StatusTransaction.Success : StatusTransaction.Fail; const fee = balanceOf(_.get(element, 'data.auth_info.fee.amount[0].amount') || 0, coinInfo.coinDecimals).toFixed( coinInfo.coinDecimals, diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index d89488364..9a1f9c8d6 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -245,11 +245,11 @@

Transactions

-
+ +
-
+
--> diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 79c1aaaef..841114556 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -432,16 +432,20 @@
- +
- - +
+ + +
@@ -469,7 +473,7 @@
{{ data.key }} - + {{ data.value }} diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 599fa3f57..3a9e31e87 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -1,5 +1,8 @@ @import '../../../../../assets/scss/color.scss'; +::-webkit-scrollbar { + height: 4px; +} .msg-image { width: auto; height: 24px; @@ -90,6 +93,9 @@ align-items: center; text-align: right; } + ::-webkit-scrollbar { + width: 8px; + } } @media (max-width: 1366px) { @@ -104,10 +110,10 @@ .box-event-log { background-color: var(--aura-gray-9); border-radius: 8px; - padding: 8px 20px; + // padding: 8px 20px; padding-left: calc(var(--bs-gutter-x) * 0.5); max-height: 420px; - overflow-y: scroll; + overflow-y: auto; .item-event-log:not(:last-child) { margin-bottom: var(--spacer-7); } @@ -148,7 +154,7 @@ mat-expansion-panel-header { padding: 0 12px; .mat-expanded { - height: 40px; + height: 48px; } .txt-header::after { font-family: 'Font Awesome 5 Free'; @@ -163,4 +169,7 @@ } } } + .mat-expansion-panel-header.mat-expanded { + height: 48px; + } } diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index 20a841a0d..2ba9c5f54 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -88,8 +88,6 @@ export class TransactionMessagesComponent implements OnInit { ) {} ngOnInit(): void { - console.log(this.transactionDetail); - this.currentIndex = 0; // check if contract type not belongTo TypeTransaction enum if (Object.values(TRANSACTION_TYPE_ENUM).includes(this.transactionDetail?.type)) { diff --git a/src/app/pages/transaction/transaction.module.ts b/src/app/pages/transaction/transaction.module.ts index c6ad043a4..cc65d8bcc 100644 --- a/src/app/pages/transaction/transaction.module.ts +++ b/src/app/pages/transaction/transaction.module.ts @@ -2,7 +2,7 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { TranslateModule } from '@ngx-translate/core'; -import { NgxMaskModule } from 'ngx-mask'; +import { MaskPipe, NgxMaskModule } from 'ngx-mask'; import { MaterialModule } from '../../../app/app.module'; import { CommonPipeModule } from '../../../app/core/pipes/common-pipe.module'; import { MappingErrorService } from '../../../app/core/services/mapping-error.service'; @@ -15,7 +15,7 @@ import { TransactionRoutingModule } from './transaction-routing.module'; import { TransactionComponent } from './transaction.component'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { MessagesItemComponent } from './transaction-detail/transaction-messages/messages-item/messages-item.component'; -import {NgxJsonViewerModule} from "ngx-json-viewer"; +import { NgxJsonViewerModule } from 'ngx-json-viewer'; import { ProposalService } from 'src/app/core/services/proposal.service'; @NgModule({ @@ -35,6 +35,6 @@ import { ProposalService } from 'src/app/core/services/proposal.service'; NgbNavModule, NgxJsonViewerModule, ], - providers: [TransactionService, MappingErrorService, ProposalService], + providers: [TransactionService, MappingErrorService, ProposalService, MaskPipe], }) export class TransactionModule {} From d19f63ac2f163203fb98d947e4d9570a33e06921 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 26 May 2023 13:39:12 +0700 Subject: [PATCH 024/315] [TamTM6] update event log part 6 --- src/app/core/pipes/common.pipe.ts | 8 +-- src/app/core/services/common.service.ts | 6 +-- .../account-detail.component.html | 2 +- .../block-detail/block-detail.component.html | 2 +- .../contract-content.component.ts | 2 +- .../messages-item.component.html | 7 ++- .../messages-item/messages-item.component.ts | 2 +- .../transaction-messages.component.html | 4 +- .../transaction-messages.component.ts | 50 +++++++++++-------- .../transaction/transaction.component.html | 4 +- .../transaction/transaction.component.ts | 21 -------- .../contract-table.component.ts | 2 +- 12 files changed, 47 insertions(+), 63 deletions(-) diff --git a/src/app/core/pipes/common.pipe.ts b/src/app/core/pipes/common.pipe.ts index 1a61dfc29..fb5b65407 100644 --- a/src/app/core/pipes/common.pipe.ts +++ b/src/app/core/pipes/common.pipe.ts @@ -79,7 +79,7 @@ export class CustomDate implements PipeTransform { @Pipe({ name: 'balanceOf' }) export class BalanceOf implements PipeTransform { transform(amount: string | number, decimal = 6) { - return +(new BigNumber(amount).toNumber() / Math.pow(10, 6)).toFixed(decimal); + return +(new BigNumber(amount).toNumber() / Math.pow(10, decimal)).toFixed(decimal); } } @@ -103,11 +103,11 @@ export class convertLogAmount implements PipeTransform { constructor(private commonService: CommonService, private mask: MaskPipe) {} transform(value: string): string { let result = value.match(/\d+/g)[0]; - let denom = this.commonService.mappingNameIBC(value.replace(result, '')); - result = this.mask.transform(balanceOf(result), 'separator.6'); + let data = this.commonService.mappingNameIBC(value.replace(result, '')); + result = this.mask.transform(balanceOf(result, data.decimals), 'separator.6'); if (+result <= 0) { return '-'; } - return result + `` + denom + ``; + return result + `` + data.display + ``; } } diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index dbdb8220a..b8c20c645 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -77,12 +77,12 @@ export class CommonService { } mappingNameIBC(value) { - let result = value; + let result = {display: value, decimals: 6}; if (value.indexOf('ibc') >= 0) { let temp = value.slice(value.indexOf('ibc')); - result = this.coins.find((k) => k.denom === temp)?.display || {}; + result = this.coins.find((k) => k.denom === temp); } else { - result = this.chainInfo.currencies[0].coinDenom; + result = {display: this.chainInfo.currencies[0].coinDenom, decimals: 6}; } return result; } diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index 7ff4a9519..bb576a1cb 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -180,7 +180,7 @@

Coins & Tokens ({{ totalAssets || 0 }})

{{ +data[template.matColumnDef] | mask : 'separator.6' }} - {{ commonService.mappingNameIBC(data?.denom) }} + {{ commonService.mappingNameIBC(data?.denom)?.display }} - diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index 9a1f9c8d6..7dd60bc92 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -184,7 +184,7 @@

Transactions

{{ +data[template.matColumnDef] | mask : 'separator.6' }} - {{ commonService.mappingNameIBC(data?.denom) }} + {{ commonService.mappingNameIBC(data?.denom)?.display }} - diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index f708ae485..1a21a8024 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -137,7 +137,7 @@ export class ContractContentComponent implements OnInit, OnDestroy { this.contractTransaction['count'] = this.contractTransaction['data'].length || 0; } - if (!isInit) { + if (!isInit && this.dataInstantiate?.length > 0) { this.contractTransaction['data'] = [...this.contractTransaction['data'], this.dataInstantiate[0]]; this.contractTransaction['count'] = this.contractTransaction['count'] + this.dataInstantiate?.length; } diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html index bb85edb17..4956f98f9 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html @@ -22,18 +22,17 @@ {{ (value | mask : 'separator.6') || '-' }} - {{ value > 0 ? (value | balanceOf | mask : 'separator.6') : '-' }} + {{ value > 0 ? (value | balanceOf : denom.decimals | mask : 'separator.6') : '-' }} - {{ value | balanceOf | mask : 'separator.6' }}

       
{{ value | percent : global.formatNumber2Decimal }} {{ value || '-' }} - {{ denom }}{{ denom?.display }}
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.ts index 68e1f3796..cc84fba7f 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.ts @@ -13,7 +13,7 @@ export class MessagesItemComponent implements OnInit { @Input() label: string; @Input() value: any; @Input() dataLink: any; - @Input() denom: string = ''; + @Input() denom: any = { display: null, decimal: 6 }; @Input() pipeType: string = ''; pipeTypeData = pipeTypeData; diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 841114556..7a7e6fd90 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -153,7 +153,7 @@
{{ transactionDetail?.tx?.tx?.body?.messages[0]?.token?.amount | balanceOf | mask : 'separator.6' }} {{ - commonService.mappingNameIBC(transactionDetail?.tx?.tx?.body?.messages[0]?.token?.denom) + commonService.mappingNameIBC(transactionDetail?.tx?.tx?.body?.messages[0]?.token?.denom)?.display }}
@@ -373,7 +373,7 @@
-
{{ denomIBC ? commonService.mappingNameIBC(denomIBC) : item.denom }}
+
{{ denomIBC ? commonService.mappingNameIBC(denomIBC)?.display : item.denom }}
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index 2ba9c5f54..a90dfde07 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -11,7 +11,12 @@ import { balanceOf } from 'src/app/core/utils/common/parsing'; import { DATEFORMAT } from '../../../../core/constants/common.constant'; import { PROPOSAL_VOTE } from '../../../../core/constants/proposal.constant'; import { TYPE_TRANSACTION } from '../../../../core/constants/transaction.constant'; -import { CodeTransaction, TRANSACTION_TYPE_ENUM, TypeTransaction, pipeTypeData } from '../../../../core/constants/transaction.enum'; +import { + CodeTransaction, + TRANSACTION_TYPE_ENUM, + TypeTransaction, + pipeTypeData, +} from '../../../../core/constants/transaction.enum'; import { formatWithSchema } from '../../../../core/helpers/date'; import { Globals, getAmount } from '../../../../global/global'; @@ -84,7 +89,7 @@ export class TransactionMessagesComponent implements OnInit { private layout: BreakpointObserver, public commonService: CommonService, private transactionService: TransactionService, - private proposalService: ProposalService + private proposalService: ProposalService, ) {} ngOnInit(): void { @@ -166,6 +171,7 @@ export class TransactionMessagesComponent implements OnInit { const typeTrans = this.typeTransaction.find((f) => f.label.toLowerCase() === data['@type'].toLowerCase()); this.transactionTypeArr.push(typeTrans?.value || data['@type'].split('.').pop()); const denom = data?.amount?.length > 0 ? data?.amount[0]?.denom : this.denom; + let dataDenom = this.commonService.mappingNameIBC(denom); switch (data['@type']) { case this.eTransType.Send: result.push({ key: 'From Address', value: data?.from_address, link: { url: '/account' } }); @@ -173,7 +179,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: data?.amount[0]?.amount, - denom: this.commonService.mappingNameIBC(denom), + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); break; @@ -206,7 +212,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: amount || '-', - denom: amount ? this.denom : null, + denom: dataDenom, pipeType: pipeType, }); @@ -219,7 +225,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Auto Claim Reward', value: this.listAmountClaim[index], - denom: this.denom, + denom: dataDenom, pipeType: pipeTypeData.Number, }); } @@ -244,14 +250,14 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: data.amount?.amount, - denom: this.commonService.mappingNameIBC(denom), + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); if (this.amountClaim > 0) { result.push({ key: 'Auto Claim Reward', value: this.amountClaim, - denom: this.commonService.mappingNameIBC(denom), + denom: dataDenom, pipeType: pipeTypeData.Number, }); } @@ -265,7 +271,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Limit', value: data?.grant?.authorization?.max_tokens?.amount, - denom: this.denom, + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); break; @@ -276,7 +282,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Total Amount Execute', value: this.totalAmountExecute, - denom: this.denom, + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); result.push({ key: 'Json', value: data?.msgs, pipeType: pipeTypeData.Json }); @@ -338,7 +344,7 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.EditValidator: - result.push({ key: 'Validator Address', value: data.validator_address, link: { url: '/account' } }); + result.push({ key: 'Validator Address', value: data.validator_address, link: { url: '/validators' } }); result.push({ key: 'Details', value: data.description?.details }); result.push({ key: 'Moniker', value: data.description?.moniker }); result.push({ @@ -356,7 +362,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Min Self Delegation', value: data.min_self_delegation, - denom: data.min_self_delegation > 0 ? this.denom : null, + denom: data.min_self_delegation > 0 ? { display: this.denom } : null, pipeType: pipeTypeData.BalanceOf, }); break; @@ -365,7 +371,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Min Self Delegation', value: data.min_self_delegation, - denom: data.min_self_delegation > 0 ? this.denom : null, + denom: data.min_self_delegation > 0 ? { display: this.denom } : null, pipeType: pipeTypeData.BalanceOf, }); result.push({ key: 'Delegator Address', value: data.delegator_address, link: { url: '/account' } }); @@ -373,7 +379,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: data.value?.amount, - denom: this.denom, + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); result.push({ key: 'Details', value: data.description?.details }); @@ -406,7 +412,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Validator Address', value: this.transactionDetail?.tx?.tx?.body?.messages[0]?.validator_addr, - link: { url: '/account' }, + link: { url: '/validators' }, }); break; @@ -415,7 +421,7 @@ export class TransactionMessagesComponent implements OnInit { key: 'Amount', value: data.initial_deposit[0].amount, pipeType: pipeTypeData.BalanceOf, - denom: data.initial_deposit[0].amount > 0 ? this.denom : null, + denom: data.initial_deposit[0].amount > 0 ? { display: this.denom } : null, }); result.push({ key: 'Proposer', value: data.proposer, link: { url: '/account' } }); if (this.transactionDetail?.tx?.logs?.length > 0) { @@ -440,7 +446,7 @@ export class TransactionMessagesComponent implements OnInit { key: 'Spend Limit', value: this.spendLimitAmount, pipeType: pipeTypeData.BalanceOf, - denom: this.spendLimitAmount > 0 ? this.denom : null, + denom: this.spendLimitAmount > 0 ? { display: this.denom } : null, }); result.push({ key: 'Expiration', @@ -463,7 +469,7 @@ export class TransactionMessagesComponent implements OnInit { data?.allowance?.period_spend_limit[0].amount || 0, pipeType: pipeTypeData.BalanceOf, - denom: this.denom, + denom: dataDenom, }); result.push({ key: 'Period', @@ -489,7 +495,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: data?.amount[0]?.amount, - denom: this.commonService.mappingNameIBC(denom), + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); break; @@ -500,7 +506,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: data?.amount[0]?.amount, - denom: this.commonService.mappingNameIBC(denom), + denom: dataDenom, pipeType: pipeTypeData.BalanceOf, }); break; @@ -527,7 +533,7 @@ export class TransactionMessagesComponent implements OnInit { result.push({ key: 'Amount', value: this.commissionAutoClaim, - denom: this.denom, + denom: dataDenom, pipeType: pipeTypeData.Number, }); } @@ -543,7 +549,7 @@ export class TransactionMessagesComponent implements OnInit { default: break; } - + if (this.transactionDetail.code === CodeTransaction.Success) { result.push({ key: 'Event Log', @@ -765,7 +771,7 @@ export class TransactionMessagesComponent implements OnInit { data = element.events.find((k) => k['type'] === this.typeGetData.Transfer); }); let temp = data?.attributes.find((j) => j['key'] === 'amount')?.value; - this.ibcData['receive']['denom'] = this.commonService.mappingNameIBC(temp) || ''; + this.ibcData['receive']['denom'] = this.commonService.mappingNameIBC(temp)?.display || ''; this.ibcData['typeProgress'] = this.eTransType.IBCReceived; } } diff --git a/src/app/pages/transaction/transaction.component.html b/src/app/pages/transaction/transaction.component.html index 733b10362..b8a163c04 100644 --- a/src/app/pages/transaction/transaction.component.html +++ b/src/app/pages/transaction/transaction.component.html @@ -57,7 +57,7 @@
{{ +data[template.matColumnDef] | mask: 'separator.6' }} - {{ commonService.mappingNameIBC(data?.denom) }} + {{ commonService.mappingNameIBC(data?.denom)?.display }} - @@ -103,7 +103,7 @@ class: 'body-01-mob text--gray-1', info: data.amount > 0 - ? (+data.amount | mask: 'separator.6') + ' ' + commonService.mappingNameIBC(data?.denom) + '' + ? (+data.amount | mask: 'separator.6') + ' ' + commonService.mappingNameIBC(data?.denom)?.display + '' : checkAmountValue(data.amount, data.tx_hash) }, { diff --git a/src/app/pages/transaction/transaction.component.ts b/src/app/pages/transaction/transaction.component.ts index 04554be99..67bfa770c 100644 --- a/src/app/pages/transaction/transaction.component.ts +++ b/src/app/pages/transaction/transaction.component.ts @@ -67,27 +67,6 @@ export class TransactionComponent implements OnInit { ); } - // getList(): void { - // this.transactionService.txsIndexer(this.pageSize, 0).subscribe( - // (res) => { - // const { code, data } = res; - // if (code === 200) { - // const txs = convertDataTransaction(data, this.coinInfo); - // if (this.dataSource.data.length > 0) { - // this.dataSource.data = [...this.dataSource.data, ...txs]; - // } else { - // this.dataSource.data = [...txs]; - // } - // this.dataTx = txs; - // } - // }, - // () => {}, - // () => { - // this.loading = false; - // }, - // ); - // } - checkAmountValue(amount: number, txHash: string) { if (amount === 0) { return '-'; diff --git a/src/app/shared/components/contract-table/contract-table.component.ts b/src/app/shared/components/contract-table/contract-table.component.ts index 688736874..102b2a6cd 100644 --- a/src/app/shared/components/contract-table/contract-table.component.ts +++ b/src/app/shared/components/contract-table/contract-table.component.ts @@ -169,7 +169,7 @@ export class ContractTableComponent implements OnInit, OnChanges { to = contract.messages[0].contract; break; default: - if (Object.keys(msg)[0]?.length > 1) { + if (msg && Object.keys(msg)[0]?.length > 1) { method = Object.keys(msg)[0]; } else { const typeTemp = contract.messages[0]['@type']; From 2ece818fe1b24e94d1677f12c01507262f8b968e Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 30 May 2023 15:11:59 +0700 Subject: [PATCH 025/315] [TamTM6] update event log part 7 --- .../core/directives/big-number.directive.ts | 11 ++- src/app/core/models/proposal.model.ts | 2 +- src/app/core/pipes/common-pipe.module.ts | 3 + src/app/core/pipes/common.pipe.ts | 7 ++ src/app/core/services/block.service.ts | 5 +- src/app/core/services/proposal.service.ts | 36 ++++++++-- src/app/core/services/transaction.service.ts | 2 +- src/app/core/services/validator.service.ts | 13 ++-- src/app/global/global.ts | 2 +- .../nft-list/nft-list.component.html | 2 +- .../token-table/token-table.component.ts | 2 +- .../block-detail/block-detail.component.html | 67 +++++++++--------- .../block-detail/block-detail.component.scss | 70 +++++++++++++++++++ .../block-detail/block-detail.component.ts | 13 ++-- src/app/pages/blocks/blocks.module.ts | 4 +- .../summary-info/summary-info.component.ts | 9 +-- .../proposal-detail/votes/votes.component.ts | 51 +++++++------- .../proposal-table.component.html | 6 +- .../proposal-table.component.ts | 6 +- .../messages-item.component.html | 2 +- .../transaction-messages.component.html | 8 ++- .../transaction-messages.component.ts | 1 + .../user-wallet-info.component.html | 4 +- .../user-wallet-info.component.ts | 20 ++---- .../validators-detail.component.ts | 6 +- 25 files changed, 231 insertions(+), 121 deletions(-) diff --git a/src/app/core/directives/big-number.directive.ts b/src/app/core/directives/big-number.directive.ts index 6075ae108..92d8f6d07 100644 --- a/src/app/core/directives/big-number.directive.ts +++ b/src/app/core/directives/big-number.directive.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core'; +import { AfterViewInit, Directive, ElementRef, Input, SimpleChanges } from '@angular/core'; import BigNumber from 'bignumber.js'; import { MaskPipe } from 'ngx-mask'; import { Globals } from 'src/app/global/global'; @@ -9,7 +9,7 @@ import { IntlFormat } from '../utils/common/parsing'; }) export class BigNumberDirective implements AfterViewInit { @Input() decimal: number = 6; - @Input() appBigNumber: string; + @Input() appBigNumber: any; @Input() tokenPrice: any; @Input() auraValue: boolean = false; @Input() votingPower: boolean = false; @@ -19,8 +19,13 @@ export class BigNumberDirective implements AfterViewInit { this.element = elRef.nativeElement; } + ngOnChanges(changes: SimpleChanges): void { + if(changes.appBigNumber.currentValue !== changes.appBigNumber.previousValue){ + this.convertNumber(); + } + } + ngAfterViewInit(): void { - this.convertNumber(); } convertNumber() { diff --git a/src/app/core/models/proposal.model.ts b/src/app/core/models/proposal.model.ts index 08cddb1fc..9f2dd893b 100644 --- a/src/app/core/models/proposal.model.ts +++ b/src/app/core/models/proposal.model.ts @@ -1,5 +1,5 @@ export interface IListVoteQuery { - proposalid: number; + proposalId: number; pageLimit: number; nextKey?: string; } diff --git a/src/app/core/pipes/common-pipe.module.ts b/src/app/core/pipes/common-pipe.module.ts index e709bbaf9..713bbd954 100644 --- a/src/app/core/pipes/common-pipe.module.ts +++ b/src/app/core/pipes/common-pipe.module.ts @@ -10,6 +10,7 @@ import { ReplaceIpfs, ConvertUauraToAura, convertLogAmount, + decodeData, } from './common.pipe'; import { JsonPipe } from './json.pipe'; @@ -25,6 +26,7 @@ import { JsonPipe } from './json.pipe'; ReplaceIpfs, ConvertUauraToAura, convertLogAmount, + decodeData ], imports: [CommonModule], exports: [ @@ -38,6 +40,7 @@ import { JsonPipe } from './json.pipe'; ReplaceIpfs, ConvertUauraToAura, convertLogAmount, + decodeData ], }) export class CommonPipeModule {} diff --git a/src/app/core/pipes/common.pipe.ts b/src/app/core/pipes/common.pipe.ts index fb5b65407..1b5aae0fe 100644 --- a/src/app/core/pipes/common.pipe.ts +++ b/src/app/core/pipes/common.pipe.ts @@ -111,3 +111,10 @@ export class convertLogAmount implements PipeTransform { return result + `` + data.display + ``; } } + +@Pipe({ name: 'decodeData' }) +export class decodeData implements PipeTransform { + transform(value: string): string { + return atob(value); + } +} diff --git a/src/app/core/services/block.service.ts b/src/app/core/services/block.service.ts index c0782b50e..83d9ea637 100644 --- a/src/app/core/services/block.service.ts +++ b/src/app/core/services/block.service.ts @@ -26,10 +26,10 @@ export class BlockService extends CommonService { getDataBlock(payload) { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query auratestnet_block($limit: Int = 100, $order: order_by = desc, $height: Int = null, $hash: String = null, $path: String = null, $operatorAddress: String = null, $heightGT: Int = null, $heightLT: Int = null) { + query auratestnet_block($limit: Int = 100, $order: order_by = desc, $height: Int = null, $hash: String = null, $operatorAddress: String = null, $heightGT: Int = null, $heightLT: Int = null) { ${envDB} { block(limit: $limit, order_by: {height: $order}, where: {height: {_eq: $height, _gt: $heightGT, _lt: $heightLT}, hash: {_eq: $hash}, validator: {operator_address: {_eq: $operatorAddress}}}) { - data(path: $path) + data validator { operator_address description @@ -49,7 +49,6 @@ export class BlockService extends CommonService { order: 'desc', hash: null, height: payload.height, - path: 'block', operatorAddress: payload.address, heightGT: null, heightLT: payload.nextHeight, diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 3106c7ab7..33406fd80 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -53,11 +53,40 @@ export class ProposalService extends CommonService { return this.http.get(`${this.indexerUrl}/votes`, { params }); } + getListVoteFromIndexerV2(payload, option): Observable { + const operationsDoc = ` + query auratestnet_vote($limit: Int = 10, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { + ${this.envDB} { + vote(limit: $limit, where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: $voteOption}}, order_by: {proposal_id: $order, txhash: asc}) { + height + proposal_id + txhash + updated_at + vote_option + voter + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.pageLimit, + // nextKey: payload.nextKey, + order: 'desc', + proposalId: payload.proposalId, + voteOption: option || null + }, + operationName: 'auratestnet_vote', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getProposalListDetail(payload) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` - query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = 10) { - ${envDB} { + query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null) { + ${this.envDB} { proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}}, order_by: {proposal_id: $order}) { content deposit_end_time @@ -83,7 +112,6 @@ export class ProposalService extends CommonService { } } } - `; return this.http .post(this.graphUrl, { diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 95e661171..117914263 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -62,7 +62,7 @@ export class TransactionService extends CommonService { } ] } - order_by: { height: $order, index: $order } + order_by: [{ height: $order}, {index: $order }] ) { id height diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index af32b7731..0f5a484d4 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -103,10 +103,6 @@ export class ValidatorService extends CommonService { } validatorsDetailListPower(address: string, limit = 10, nextKey = null) { - // let filterQuery = ''; - // if (nextKey) { - // filterQuery = ', id: {_lt: ' + `${nextKey}` + '}'; - // } const operationsDoc = ` query auratestnet_powerevent($operator_address: String, $limit: Int = 10, $nextKey: Int = null) { auratestnet { @@ -114,11 +110,17 @@ export class ValidatorService extends CommonService { id time height - type transaction { hash } + type amount + validatorSrc { + operator_address + } + validatorDst { + operator_address + } } } } @@ -128,6 +130,7 @@ export class ValidatorService extends CommonService { query: operationsDoc, variables: { operator_address: address, + limit: limit }, operationName: 'auratestnet_powerevent', }) diff --git a/src/app/global/global.ts b/src/app/global/global.ts index 35cbe1211..3bfba5865 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -398,7 +398,7 @@ export function convertDataBlock(data) { const block = _.get(data, 'block').map((element) => { const height = _.get(element, 'height'); const block_hash = _.get(element, 'hash'); - const num_txs = _.get(element, 'data.data.txs.length'); + const num_txs = _.get(element, 'data.block.data.txs.length'); const proposer = _.get(element, 'validator.description.moniker'); const operator_address = _.get(element, 'validator.operator_address'); const timestamp = _.get(element, 'time'); diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.html b/src/app/pages/account/account-detail/nft-list/nft-list.component.html index 42061f5b1..eb0053fb7 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.html +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.html @@ -1,4 +1,4 @@ -

NFTs ({{ pageData.length || 0 }} NFTs and more)

+

NFTs ({{ nftList.length || 0 }} NFTs and more)

diff --git a/src/app/pages/account/account-detail/token-table/token-table.component.ts b/src/app/pages/account/account-detail/token-table/token-table.component.ts index ce5f9fa3a..f07fa6103 100644 --- a/src/app/pages/account/account-detail/token-table/token-table.component.ts +++ b/src/app/pages/account/account-detail/token-table/token-table.component.ts @@ -94,11 +94,11 @@ export class TokenTableComponent implements OnChanges { lstToken = lstToken.filter((k) => k?.symbol); this.dataSource = new MatTableDataSource(lstToken); this.pageData.length = res.meta.count; - this.totalAssets.emit(this.pageData.length); } else { this.pageData.length = 0; this.dataSource.data = []; } + this.totalAssets.emit(this.pageData.length); }, () => {}, () => { diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index 7dd60bc92..21f5ac77e 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -245,43 +245,46 @@

Transactions

- +
diff --git a/src/app/pages/blocks/block-detail/block-detail.component.scss b/src/app/pages/blocks/block-detail/block-detail.component.scss index 4e1d4a6e9..5d7d5ec7f 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.scss +++ b/src/app/pages/blocks/block-detail/block-detail.component.scss @@ -10,3 +10,73 @@ padding-bottom: 2px !important; } } + +.box-event-log { + border-radius: 8px; + padding-left: calc(var(--bs-gutter-x) * 0.5); + max-height: 420px; + overflow-y: auto; + background-color: transparent; + .item-event-log:not(:last-child) { + margin-bottom: var(--spacer-7); + } + .txt-event-key { + color: var(--aura-gray-4); + } + .mat-expansion-panel { + background: none; + box-shadow: none !important; + } +} + +.content-log { + position: relative; + &::before { + content: ''; + position: absolute; + left: 2px; + top: 0; + bottom: 0; + width: 2px; + border: 1px dashed gray; + } + &::after { + content: ''; + position: absolute; + left: -5px; + bottom: -1px; + width: 2px; + width: 0; + height: 0; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-top: 10px solid gray; + border-radius: 3px; + } +} + +.mat-expansion-panel { + background: none; + box-shadow: none !important; + mat-expansion-panel-header { + padding: 0 12px; + .mat-expanded { + height: 48px; + } + .txt-header::after { + font-family: 'Font Awesome 5 Free'; + font-weight: 700; + content: '\f077'; + color: var(--aura-gray-1); + font-size: 13px; + } + &[aria-expanded='true'] { + .txt-header::after { + content: '\f078'; + } + } + } + .mat-expansion-panel-header.mat-expanded { + height: 48px; + } +} diff --git a/src/app/pages/blocks/block-detail/block-detail.component.ts b/src/app/pages/blocks/block-detail/block-detail.component.ts index 3ddd06d15..981fb3c84 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.ts +++ b/src/app/pages/blocks/block-detail/block-detail.component.ts @@ -108,16 +108,17 @@ export class BlockDetailComponent implements OnInit { async (res) => { if (res?.block?.length > 0) { const block = convertDataBlock(res)[0]; - block['round'] = _.get(res.block[0], 'data.last_commit.round'); - block['chainid'] = _.get(res.block[0], 'data.header.chain_id'); - block['json_data'] = _.get(res.block[0], 'data'); + block['round'] = _.get(res.block[0], 'data.block.last_commit.round'); + block['chainid'] = _.get(res.block[0], 'data.block.header.chain_id'); + block['json_data'] = _.get(res.block[0], 'data.block'); block['gas_used'] = block['gas_wanted'] = 0; + block['events'] = _.get(res.block[0], 'data.block_result.txs_results[0].events'); this.blockDetail = block; - + //get list tx detail let txs = []; - for (const key in res.block[0]?.data?.data?.txs) { - const element = res.block[0]?.data?.data?.txs[key]; + for (const key in res.block[0]?.data?.block?.data?.txs) { + const element = res.block[0]?.data?.block?.data?.txs[key]; const tx = sha256(Buffer.from(element, 'base64')).toUpperCase(); const payload = { diff --git a/src/app/pages/blocks/blocks.module.ts b/src/app/pages/blocks/blocks.module.ts index 308fe4307..4a14ad83e 100644 --- a/src/app/pages/blocks/blocks.module.ts +++ b/src/app/pages/blocks/blocks.module.ts @@ -3,7 +3,7 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; -import { NgxMaskModule } from 'ngx-mask'; +import { MaskPipe, NgxMaskModule } from 'ngx-mask'; import { PaginatorModule } from 'src/app/shared/components/paginator/paginator.module'; import { MaterialModule } from '../../../app/app.module'; import { CommonPipeModule } from '../../../app/core/pipes/common-pipe.module'; @@ -30,6 +30,6 @@ import { BlocksComponent } from './blocks.component'; NgbNavModule, PaginatorModule, ], - providers: [BlockService], + providers: [BlockService, MaskPipe], }) export class BlocksModule {} diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 7e4fda64b..7c09c38b3 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -69,8 +69,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { getProposalDetail(): void { let payload = { limit: 1, - proposalId: this.proposalId - } + proposalId: this.proposalId, + }; this.proposalService .getProposalListDetail(payload) .pipe( @@ -81,6 +81,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { this.proposalDtl.emit(null); } this.proposalDetail = this.makeProposalDataDetail(data.proposal[0]); + if (this.proposalDetail?.content?.amount) { this.proposalDetail['request_amount'] = balanceOf(this.proposalDetail?.content?.amount[0]?.amount); } @@ -206,9 +207,9 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { pro_votes_abstain = balanceOf(+data.tally?.abstain); } const pro_total_vote = pro_votes_yes + pro_votes_no + pro_votes_no_with_veto + pro_votes_abstain; - + const dataDetail = this.proposalDetail || data; return { - ...data, + ...dataDetail, initial_deposit: balanceOf(_.get(data, 'initial_deposit[0].amount') || 0), pro_total_deposits: balanceOf(_.get(data, 'total_deposit[0].amount') || 0), pro_type: data?.content['@type']?.split('.').pop(), diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index b6545d998..bf26c71df 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -82,7 +82,7 @@ export class VotesComponent implements OnChanges { if (this.proposalDetail?.proposal_id) { const payloads: IListVoteQuery = { pageLimit: 25, - proposalid: this.proposalDetail.proposal_id, + proposalId: this.proposalDetail.proposal_id, }; this.proposalDetail?.total_vote?.forEach((f) => { @@ -104,20 +104,20 @@ export class VotesComponent implements OnChanges { combineLatest([ this.proposalService - .getListVoteFromIndexer(payloads, null) - .pipe(map((item) => ({ nextKey: item.data.nextKey, votes: item.data.votes }))), + .getListVoteFromIndexerV2(payloads, null) + .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES) - .pipe(map((item) => ({ nextKey: item.data.nextKey, votes: item.data.votes }))), + .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES) + .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO) - .pipe(map((item) => ({ nextKey: item.data.nextKey, votes: item.data.votes }))), + .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO) + .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) - .pipe(map((item) => ({ nextKey: item.data.nextKey, votes: item.data.votes }))), + .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) + .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) - .pipe(map((item) => ({ nextKey: item.data.nextKey, votes: item.data.votes }))), + .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) + .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), ]).subscribe((res) => { this.voteDataListLoading = true; res[0] && ((dta) => (this.voteData.all = dta))(res[0]); @@ -130,14 +130,15 @@ export class VotesComponent implements OnChanges { if (this.voteData?.all) { voteData = [...this.voteData?.all.votes]; } - if (voteData) { - voteData.forEach((item: any) => { - item.voter = item.tx_response?.tx?.body?.messages[0]?.voter; - item.tx_hash = item.tx_response?.txhash; - item.option = item.tx_response?.tx?.body?.messages[0]?.option; - item.updated_at = item.tx_response?.timestamp; - }); - } + + // if (voteData) { + // voteData.forEach((item: any) => { + // // item.voter_address = item.voter; + // // item.tx_hash = item.txhash; + // // item.vote_option = item.vote_option; + // // item.timestamp = item.updated_at; + // }); + // } this.countTotal.all = this.countTotal.yes + this.countTotal.no + this.countTotal.noWithVeto + this.countTotal.abstain; @@ -183,7 +184,7 @@ export class VotesComponent implements OnChanges { loadMore($event): void { const payloads: IListVoteQuery = { pageLimit: 25, - proposalid: this.proposalDetail.proposal_id, + proposalId: this.proposalDetail.proposal_id, nextKey: null, }; @@ -191,7 +192,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_YES: payloads.nextKey = this.voteData.yes.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { + this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { if (res.data.votes) { if (this.voteData.yes.votes.length % 25 !== res.data.votes.length) { this.voteData.yes = { @@ -207,7 +208,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_ABSTAIN: payloads.nextKey = this.voteData.abstain.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { + this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { if (res.data.votes) { if (this.voteData.abstain.votes.length % 25 !== res.data.votes.length) { this.voteData.abstain = { @@ -223,7 +224,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_NO: payloads.nextKey = this.voteData.no.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { + this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { if (res.data.votes) { if (this.voteData.no.votes.length % 25 !== res.data.votes.length) { this.voteData.no = { @@ -240,7 +241,7 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.noWithVeto.nextKey; if (payloads.nextKey) { this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) + .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) .subscribe((res) => { if (res.data.votes) { if (this.voteData.noWithVeto.votes.length % 25 !== res.data.votes.length) { @@ -257,7 +258,7 @@ export class VotesComponent implements OnChanges { default: payloads.nextKey = this.voteData.all?.nextKey; if (payloads?.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, null).subscribe((res) => { + this.proposalService.getListVoteFromIndexerV2(payloads, null).subscribe((res) => { if (res.data.votes) { if (this.voteData.all.votes.length % 25 !== res.data.votes.length) { this.voteData.all = { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index ce58ba954..ede03868e 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -48,7 +48,7 @@ }} {{ denom }} - + {{ getVoteValue(data[template.matColumnDef]) }} @@ -135,7 +135,7 @@ (data.txhash ? shortenAddress(data.txhash) : '-') + '
' }, - { label: 'Answer', class: 'body-01 text--gray-1', info: getVoteValue(data.answer) }, + { label: 'Answer', class: 'body-01 text--gray-1', info: getVoteValue(data.vote_option) }, { label: 'Time', class: 'card__date text--gray-1 body-01', @@ -173,7 +173,7 @@ '' : '-' }, - { label: 'Answer', class: 'body-01 text--gray-1', info: getVoteValue(data.answer) }, + { label: 'Answer', class: 'body-01 text--gray-1', info: getVoteValue(data.vote_option) }, { label: 'Time', class: 'card__date text--gray-1 body-01', diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index e451bb75c..f93c32213 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -47,10 +47,10 @@ export class ProposalTableComponent implements OnInit, OnChanges { validatorImgArr; votesTemplates: Array = [ - { matColumnDef: 'voter_address', headerCellDef: 'Voter', isUrl: '/account', isShort: true }, + { matColumnDef: 'voter', headerCellDef: 'Voter', isUrl: '/account', isShort: true }, { matColumnDef: 'txhash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true, desktopOnly: true }, - { matColumnDef: 'answer', headerCellDef: 'Answer' }, - { matColumnDef: 'timestamp', headerCellDef: 'Time', desktopOnly: true }, + { matColumnDef: 'vote_option', headerCellDef: 'Answer' }, + { matColumnDef: 'updated_at', headerCellDef: 'Time', desktopOnly: true }, ]; validatorsVotesTemplates: Array = [ diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html index 4956f98f9..5464ff677 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html @@ -31,7 +31,7 @@ {{ value | percent : global.formatNumber2Decimal }} {{ value || '-' }} - {{ denom?.display }} diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 7a7e6fd90..a4f529646 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -440,7 +440,7 @@
-
+
@@ -474,8 +474,10 @@
{{ data.key }} - {{ data.value }} - + {{ data.value }} +
diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index a90dfde07..749f24863 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -77,6 +77,7 @@ export class TransactionMessagesComponent implements OnInit { pipeData = pipeTypeData; eventLogData = []; idxLog = 0; + codeTransaction = CodeTransaction; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; coinMinimalDenom = this.environmentService.configValue.chain_info.currencies[0].coinMinimalDenom; diff --git a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html index a9aa42fce..d5f7cfb13 100644 --- a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html +++ b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html @@ -7,14 +7,14 @@
Available Balance:
- + {{ denom }}
Total Staked:
- + {{ denom }}
diff --git a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts index 105eb9cc7..27562590f 100644 --- a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts +++ b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts @@ -14,7 +14,7 @@ export class UserWalletInfoComponent implements OnChanges { @Input() breakpoint: any; @Input() userAddress: string; @Input() arrayDelegate: any[] = []; - @Input() dataDelegate: DataDelegateDto; + @Input() dataDelegate: any; @Input() lstUndelegate: any[] = []; @Input() modalManage: any; @Input() denom: any; @@ -23,6 +23,7 @@ export class UserWalletInfoComponent implements OnChanges { validatorImgArr; dataSourceWallet = new MatTableDataSource(); + dataStakeInfo = {}; templatesWallet: Array = [ { matColumnDef: 'validator_name', headerCellDef: 'Name', desktopOnly: true }, { matColumnDef: 'amount_staked', headerCellDef: 'Amount Staked' }, @@ -42,27 +43,14 @@ export class UserWalletInfoComponent implements OnChanges { ngOnChanges(changes: SimpleChanges): void { if (changes.arrayDelegate) { - if (changes.arrayDelegate.currentValue?.length !== changes.arrayDelegate.previousValue?.length) { - this.dataSourceWallet = new MatTableDataSource(this.arrayDelegate); - } else { - Object.keys(this.arrayDelegate).forEach((key) => { - if (this.dataSourceWallet.data[key]) { - Object.assign(this.dataSourceWallet.data[key], this.arrayDelegate[key]); - } else { - this.dataSourceWallet.data[key] = this.arrayDelegate[key]; - } - }); - } - if (changes.arrayDelegate.currentValue?.length > 0) { - // get ValidatorAddressArr - this.getValidatorAvatar(changes.arrayDelegate.currentValue); - } + this.dataSourceWallet = new MatTableDataSource(this.arrayDelegate); } if (changes.dataDelegate) { if (Number(this.dataDelegate?.stakingToken) > 0) { this.isDisableClaim = false; } + this.dataStakeInfo = changes.dataDelegate.currentValue; } if (changes.lstUndelegate) { diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 3896e959c..9459c1c7a 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -275,11 +275,9 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { const txs = _.get(res, 'power_event').map((element) => { let isStakeMode = false; const tx_hash = _.get(element, 'transaction.hash'); - // const address = _.get(element, 'transaction.data[0].validator_dst_address'); + const address = _.get(element, 'validatorDst.operator_address'); const _type = _.get(element, 'type'); - if ( - _type === 'delegate' - ) { + if (_type === 'delegate' || (_type === 'redelegate' && address === this.currentAddress)) { isStakeMode = true; } // let amount = getAmount(_.get(element, 'transaction.data'), _type, _.get(element, 'data.body.raw_log')); From c892bba039ee8b2d19c668b79e216892a612a1c9 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 30 May 2023 17:03:43 +0700 Subject: [PATCH 026/315] implement community pool --- src/app/app-routing.module.ts | 4 + src/app/core/constants/url.constant.ts | 1 + src/app/core/services/token.service.ts | 5 + .../community-pool-routing.module.ts | 16 ++ .../community-pool.component.html | 101 +++++++++ .../community-pool.component.scss | 58 ++++++ .../community-pool.component.ts | 192 ++++++++++++++++++ .../community-pool/community-pool.module.ts | 53 +++++ .../pages/dashboard/dashboard.component.html | 60 ++++-- .../pages/dashboard/dashboard.component.ts | 6 + src/app/pages/dashboard/dashboard.module.ts | 2 +- src/assets/config/config.json | 59 ++---- 12 files changed, 492 insertions(+), 65 deletions(-) create mode 100644 src/app/pages/community-pool/community-pool-routing.module.ts create mode 100644 src/app/pages/community-pool/community-pool.component.html create mode 100644 src/app/pages/community-pool/community-pool.component.scss create mode 100644 src/app/pages/community-pool/community-pool.component.ts create mode 100644 src/app/pages/community-pool/community-pool.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index de338953a..7edc77b5a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -56,6 +56,10 @@ const routes: Routes = [ loadChildren: () => import('./pages/soulbound-token/soulbound-token.module').then((m) => m.SoulboundTokenModule), }, + { + path: 'community-pool', + loadChildren: () => import('./pages/community-pool/community-pool.module').then((m) => m.CommunityPoolModule), + }, ], }, { path: 'account', loadChildren: () => import('./pages/account/account.module').then((m) => m.AccountModule) }, diff --git a/src/app/core/constants/url.constant.ts b/src/app/core/constants/url.constant.ts index 953650096..6c25312cf 100644 --- a/src/app/core/constants/url.constant.ts +++ b/src/app/core/constants/url.constant.ts @@ -3,4 +3,5 @@ export const LCD_COSMOS = { TX: 'cosmos/tx/v1beta1', SLASHING: 'cosmos/slashing/v1beta1', BLOCK: 'cosmos/base/tendermint/v1beta1/blocks', + DISTRIBUTION: 'cosmos/distribution/v1beta1/community_pool' }; diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index c999b4675..b53003d7f 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -9,6 +9,7 @@ import { RangeType } from '../models/common.model'; import { CommonService } from './common.service'; import { checkEnvQuery } from '../utils/common/info-common'; import { map } from 'rxjs/operators'; +import { LCD_COSMOS } from '../constants/url.constant'; @Injectable() export class TokenService extends CommonService { @@ -171,4 +172,8 @@ export class TokenService extends CommonService { params: { rangeType, coinId, min, max }, }); } + + getListAssetCommunityPool() { + return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.DISTRIBUTION}`); + } } diff --git a/src/app/pages/community-pool/community-pool-routing.module.ts b/src/app/pages/community-pool/community-pool-routing.module.ts new file mode 100644 index 000000000..98e7522ae --- /dev/null +++ b/src/app/pages/community-pool/community-pool-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule, Routes } from '@angular/router'; +import { CommunityPoolComponent } from './community-pool.component'; + +const routes: Routes = [ + { + path: '', + component: CommunityPoolComponent, + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class CommunityPoolRoutingModule {} diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html new file mode 100644 index 000000000..628671407 --- /dev/null +++ b/src/app/pages/community-pool/community-pool.component.html @@ -0,0 +1,101 @@ +

Community Pool Details

+
+ +
+
+ +
+
+ A total of {{ pageData?.length | number }} Token Contract{{ pageData?.length > 1 ? 's' : '' }} found +
+
+
+ + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name +
+ +
{{ element.name ? element.name : 'Aura' }}
+
+
Symbol + {{ element.symbol ? element.symbol : 'AURA' }} + Denom + {{ element.denom }} + Amount + +
+ {{ 'NO DATA' | translate }} +
+
+ + + + + + +
+
+
+ - +
diff --git a/src/app/pages/community-pool/community-pool.component.scss b/src/app/pages/community-pool/community-pool.component.scss new file mode 100644 index 000000000..93ce57b87 --- /dev/null +++ b/src/app/pages/community-pool/community-pool.component.scss @@ -0,0 +1,58 @@ +.search-form { + min-width: 100%; + @media (min-width: 992px) { + min-width: 410px; + } +} +.box-search-data { + max-height: 350px; + width: 90%; + @media (min-width: 992px) { + width: 410px; + } + .logo-token { + margin-top: 3px; + width: 20px; + height: 20px; + } + .box-price { + background-color: rgba(94, 230, 208, 0.2); + border-radius: 4px; + color: var(--aura-green); + padding: 1px 6px; + margin-left: var(--spacer-2); + } + .search-result { + border: 1px solid transparent; + transition: border-color 0.35s ease-in-out; + &:hover { + border: 1px solid var(--aura-green-3); + border-radius: 4px; + } + } +} +@media (max-width: 991.99px) { + .aura-table th.mat-header-cell:not(:nth-child(2)) { + min-width: 150px; + } + .aura-table th.mat-header-cell:nth-child(6), + .aura-table th.mat-header-cell:nth-child(7) { + min-width: 220px; + } + .aura-table th.mat-header-cell:nth-child(2) { + min-width: 250px; + } + .aura-table th.mat-header-cell:nth-child(1) { + min-width: 50px; + } +} +.vertical-align-top { + vertical-align: top; +} +.desc { + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts new file mode 100644 index 000000000..fd971c8b2 --- /dev/null +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -0,0 +1,192 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { PageEvent } from '@angular/material/paginator'; +import { MatSort, Sort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; +import { TranslateService } from '@ngx-translate/core'; +import * as _ from 'lodash'; +import { Subject } from 'rxjs'; +import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; +import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; +import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { TableTemplate } from 'src/app/core/models/common.model'; +import { TokenService } from 'src/app/core/services/token.service'; +import { Globals } from 'src/app/global/global'; +import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; + +@Component({ + selector: 'app-community-pool', + templateUrl: './community-pool.component.html', + styleUrls: ['./community-pool.component.scss'], +}) +export class CommunityPoolComponent implements OnInit { + @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; + textSearch = ''; + templates: Array = [ + { matColumnDef: 'name', headerCellDef: 'name' }, + { matColumnDef: 'symbol', headerCellDef: 'symbol' }, + { matColumnDef: 'denom', headerCellDef: 'denom' }, + { matColumnDef: 'amount', headerCellDef: 'amount' }, + ]; + displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); + + pageData: PageEvent = { + length: PAGE_EVENT.LENGTH, + pageSize: 20, + pageIndex: PAGE_EVENT.PAGE_INDEX, + }; + + dataSource: MatTableDataSource = new MatTableDataSource([]); + sortedData: any; + sort: MatSort; + filterSearchData = []; + maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; + denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; + image_s3 = this.environmentService.configValue.image_s3; + defaultLogoToken = this.image_s3 + 'images/icons/token-logo.png'; + listCoin = this.environmentService.configValue.coins; + + searchSubject = new Subject(); + destroy$ = new Subject(); + + constructor( + public translate: TranslateService, + public global: Globals, + public tokenService: TokenService, + private environmentService: EnvironmentService, + ) {} + + // ngOnDestroy(): void { + // // throw new Error('Method not implemented.'); + // this.destroy$.next(); + // this.destroy$.complete(); + // } + + ngOnInit(): void { + this.getListToken(); + + // this.searchSubject + // .asObservable() + // .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + // .subscribe(() => { + // if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { + // this.getListToken(); + // } else { + // this.pageChange.selectPage(0); + // } + // }); + } + + onKeyUp() { + // this.searchSubject.next(this.textSearch); + } + + async getListToken() { + const res = await this.tokenService.getListAssetCommunityPool(); + let listAssetLcd = _.get(res, 'data.pool'); + + listAssetLcd.forEach((element) => { + let test = this.listCoin.find((i) => i.denom === element.denom); + console.log(test); + if (test) { + element.decimal = test.decimal; + element.symbol = test.display; + element.logo = test.logo; + element.name = test.name; + } else { + element.decimal = 6; + element.symbol = ''; + element.logo = ''; + element.name = ''; + } + }); + this.dataSource = new MatTableDataSource(listAssetLcd) + this.pageData.length = listAssetLcd.length; + + // this.tokenService.getListToken(payload).subscribe((res: ResponseDto) => { + // res.data.forEach((data) => { + // Object.assign(data, { + // ...data, + // circulating_market_cap: +data.circulating_market_cap || 0, + // onChainMarketCap: +data.circulating_market_cap || 0, + // volume: +data.volume_24h, + // price: +data.price, + // isValueUp: data.price_change_percentage_24h < 0 ? false : true, + // change: Number(data.price_change_percentage_24h.toString()), + // isHolderUp: data.holders_change_percentage_24h < 0 ? false : true, + // holders: +data.holders, + // holderChange: Number(data.holders_change_percentage_24h.toString()), + // }); + // }); + + // this.dataSource = new MatTableDataSource(res.data); + // this.pageData.length = res.meta.count; + // }); + } + + paginatorEmit(event): void { + this.dataSource.paginator = event; + } + + sortData(sort: Sort) { + this.dataSource.data.forEach((data) => { + data.circulating_market_cap = +data.circulating_market_cap; + data.volume = +data.volume_24h; + data.price = +data.price; + data.holders = +data.holders; + }); + + let data = this.dataSource.data.slice(); + if (!sort.active || sort.direction === '') { + this.sortedData = data; + return; + } + + const isAsc = sort.direction === 'asc'; + this.sortedData = data.sort((a, b) => { + switch (sort.active) { + case 'price': + return this.compare(a.price, b.price, isAsc); + case 'volume': + return this.compare(a.volume, b.volume, isAsc); + case 'circulating_market_cap': + return this.compare(a.circulating_market_cap, b.circulating_market_cap, isAsc); + case 'onChainMarketCap': + return this.compare(a.onChainMarketCap, b.onChainMarketCap, isAsc); + default: + return 0; + } + }); + + if (sort.active === 'change') { + let lstUp = this.sortedData + .filter((data) => data.isValueUp) + ?.sort((a, b) => this.compare(a.change, b.change, isAsc)); + let lstDown = this.sortedData + .filter((data) => !data.isValueUp) + .sort((a, b) => this.compare(a.change, b.change, !isAsc)); + this.sortedData = isAsc ? lstDown.concat(lstUp) : lstUp.concat(lstDown); + } + + let dataFilter = this.sortedData; + this.pageData = { + length: this.pageData.length, + pageSize: this.pageData.pageSize, + pageIndex: this.pageData.pageIndex, + }; + this.dataSource = new MatTableDataSource(dataFilter); + } + + compare(a: number | string, b: number | string, isAsc: boolean) { + return (a < b ? -1 : 1) * (isAsc ? 1 : -1); + } + + resetSearch() { + this.textSearch = ''; + // this.onKeyUp(); + } + + pageEvent(e: PageEvent): void { + this.pageData.pageIndex = e.pageIndex; + this.getListToken(); + } +} diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts new file mode 100644 index 000000000..c6f56be07 --- /dev/null +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -0,0 +1,53 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { MatTableModule } from '@angular/material/table'; +import { NgbNavModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateModule } from '@ngx-translate/core'; +import { NgxMaskModule } from 'ngx-mask'; +import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; +import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; +import { AccountService } from 'src/app/core/services/account.service'; +import { AudioPlayerModule } from 'src/app/shared/components/audio-player/audio-player.module'; +import { NftCardModule } from 'src/app/shared/components/cards/nft-card/nft-card.module'; +import { ContractPopoverModule } from 'src/app/shared/components/contract-popover/contract-popover.module'; +import { ModelViewModule } from 'src/app/shared/components/model-view/model-view.module'; +import { MaterialModule } from '../../../app/app.module'; +import { PaginatorModule } from '../../../app/shared/components/paginator/paginator.module'; +import { TableNoDataModule } from '../../../app/shared/components/table-no-data/table-no-data.module'; +import { SharedModule } from '../../../app/shared/shared.module'; +import { TokenService } from '../../core/services/token.service'; +import { ReadContractModule } from '../contracts/contracts-detail/contracts-contents/contract/read-contract/read-contract.module'; +import { WriteContractModule } from '../contracts/contracts-detail/contracts-contents/contract/write-contact/write-contract.module'; +import { ContractsModule } from '../contracts/contracts.module'; +import { CommunityPoolRoutingModule } from './community-pool-routing.module'; +import { CommunityPoolComponent } from './community-pool.component'; + +@NgModule({ + declarations: [CommunityPoolComponent], + imports: [ + CommunityPoolRoutingModule, + CommonModule, + SharedModule, + NgbNavModule, + TranslateModule, + PaginatorModule, + TableNoDataModule, + MatTableModule, + MaterialModule, + FormsModule, + NgbPopoverModule, + CommonPipeModule, + ContractPopoverModule, + NgxMaskModule, + WriteContractModule, + ReadContractModule, + ModelViewModule, + NftCardModule, + AudioPlayerModule, + ContractsModule, + CommonDirectiveModule, + ], + // providers: [TokenService, AccountService], +}) +export class CommunityPoolModule {} diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 1c1850cd7..710978201 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -5,7 +5,10 @@
- Random first slide + Random first slide
@@ -154,8 +157,11 @@
-
+
Community Pool
+
+ +
@@ -222,7 +228,10 @@
- Random first slide + Random first slide
@@ -230,18 +239,21 @@
-
+
Votings
+ *ngIf="curr_voting_Period" + href="/votings/{{ curr_voting_Period.proposal_id }}" + class="button button--sm button-outline button-pill px-4"> View detail
@@ -277,7 +289,9 @@
Yes
{{ - curr_voting_Period ? (curr_voting_Period.tally.yes | number : global.formatNumber2Decimal) : '0,0' + curr_voting_Period + ? (curr_voting_Period.tally.yes | number : global.formatNumber2Decimal) + : '0,0' }}%
@@ -294,8 +308,8 @@
{{ curr_voting_Period - ? (curr_voting_Period.tally.no_with_veto | number : global.formatNumber2Decimal) - : '0,0' + ? (curr_voting_Period.tally.no_with_veto | number : global.formatNumber2Decimal) + : '0,0' }}%
@@ -304,16 +318,18 @@
{{ curr_voting_Period - ? (curr_voting_Period.tally.abstain | number : global.formatNumber2Decimal) - : '0,0' + ? (curr_voting_Period.tally.abstain | number : global.formatNumber2Decimal) + : '0,0' }}%
-
- +
+
No proposal within the voting period
diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 7bbdf40d0..51956bd99 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -22,6 +22,7 @@ import { CHART_RANGE, PAGE_EVENT, TOKEN_ID_GET_PRICE } from '../../core/constant import { convertDataBlock, convertDataTransaction, convertDataTransactionV2, Globals } from '../../global/global'; import { CHART_CONFIG, DASHBOARD_AREA_SERIES_CHART_OPTIONS, DASHBOARD_CHART_OPTIONS } from './dashboard-chart-options'; import { ValidatorService } from 'src/app/core/services/validator.service'; +import { Router } from '@angular/router'; @Component({ selector: 'app-dashboard', @@ -105,6 +106,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { private token: TokenService, private walletService: WalletService, private validatorService: ValidatorService, + private router: Router, ) {} ngOnInit(): void { @@ -443,4 +445,8 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { } }); } + + navigateToCommunityPool(): void { + this.router.navigate([`/community-pool`]); + } } diff --git a/src/app/pages/dashboard/dashboard.module.ts b/src/app/pages/dashboard/dashboard.module.ts index a97f72d32..09f8274f6 100644 --- a/src/app/pages/dashboard/dashboard.module.ts +++ b/src/app/pages/dashboard/dashboard.module.ts @@ -2,7 +2,7 @@ import { CommonModule, DatePipe, DecimalPipe } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; -import {NgbCarouselModule, NgbDropdownModule, NgbNavModule} from '@ng-bootstrap/ng-bootstrap'; +import { NgbCarouselModule, NgbDropdownModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { MaskPipe, NgxMaskModule } from 'ngx-mask'; import { MaterialModule } from 'src/app/app.module'; diff --git a/src/assets/config/config.json b/src/assets/config/config.json index 31eee306e..35256795d 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -4,25 +4,21 @@ "chainId": "aura-testnet-2", "timeStaking": "86400", "env": "dev", - "urlSocket": "https://explorer-ws.dev.aura.network", + "urlSocket": "https://explorer-api.dev.aura.network", "validator_s3": "https://validator-logos.s3.ap-southeast-1.amazonaws.com", - "coins": [ - { - "name": "Serenity Aura", - "display": "AURA", - "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", - "decimal": 6, - "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" - } - ], + "coins":[ + {"name": "Serenity Aura", + "display": "AURA", + "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", + "decimal": 6, + "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png"} + ], "chain_info": { "chainId": "aura-testnet-2", "chainName": "aura devnet", "rpc": "https://rpc.dev.aura.network", "rest": "https://lcd.dev.aura.network", - "bip44": { - "coinType": 118 - }, + "bip44": { "coinType": 118 }, "bech32Config": { "bech32PrefixAccAddr": "aura", "bech32PrefixAccPub": "aurapub", @@ -31,41 +27,20 @@ "bech32PrefixConsAddr": "auravalcons", "bech32PrefixConsPub": "auravalconspub" }, - "currencies": [ - { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - } - ], - "feeCurrencies": [ - { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - } - ], - "stakeCurrency": { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - }, + "currencies": [{ "coinDenom": "TAURA", "coinMinimalDenom": "utaura", "coinDecimals": 6 }], + "feeCurrencies": [{ "coinDenom": "TAURA", "coinMinimalDenom": "utaura", "coinDecimals": 6 }], + "stakeCurrency": { "coinDenom": "TAURA", "coinMinimalDenom": "utaura", "coinDecimals": 6 }, "coinType": 118, - "gasPriceStep": { - "low": 0.001, - "average": 0.0025, - "high": 0.004 - }, - "features": [ - "ibc-transfer" - ], + "gasPriceStep": { "low": 0.001, "average": 0.0025, "high": 0.004 }, + "features": ["ibc-transfer"], "walletUrlForStaking": "https://explorer.dev.aura.network/validators", "logo": "https://i.imgur.com/zi0mTYb.png", "explorer": "https://explorer.dev.aura.network/" }, "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", - "graphUrl": "https://indexer-v2.dev.aurascan.io/v1/graphql", "timeInterval": 4000, - "evnLabel": { "desktop": "Develop Testnet Network", "mobile": "Develop Testnet" } + "ipfsDomain": "https://ipfs.io/", + "evnLabel": { "desktop": "Develop Testnet Network", "mobile": "Develop Testnet" }, + "graphUrl": "https://indexer-v2.dev.aurascan.io/v1/graphql" } From 12b6e5c1c041bf8ab110f7a6ababbd774ae0f45f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 31 May 2023 11:38:34 +0700 Subject: [PATCH 027/315] implement community pool --- .../community-pool.component.html | 22 +-- .../community-pool.component.ts | 178 ++++++------------ 2 files changed, 70 insertions(+), 130 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html index 628671407..aa28b41f8 100644 --- a/src/app/pages/community-pool/community-pool.component.html +++ b/src/app/pages/community-pool/community-pool.component.html @@ -4,25 +4,20 @@

Community Pool Details

-
-
- A total of {{ pageData?.length | number }} Token Contract{{ pageData?.length > 1 ? 's' : '' }} found -
+
+

Asset

-

- +
@@ -71,7 +66,8 @@

Community Pool Details

diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts index fd971c8b2..55c9bcb2d 100644 --- a/src/app/pages/community-pool/community-pool.component.ts +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -1,10 +1,10 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; -import { MatSort, Sort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import * as _ from 'lodash'; import { Subject } from 'rxjs'; +import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; @@ -18,7 +18,7 @@ import { PaginatorComponent } from 'src/app/shared/components/paginator/paginato templateUrl: './community-pool.component.html', styleUrls: ['./community-pool.component.scss'], }) -export class CommunityPoolComponent implements OnInit { +export class CommunityPoolComponent implements OnInit, OnDestroy { @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; textSearch = ''; templates: Array = [ @@ -28,7 +28,6 @@ export class CommunityPoolComponent implements OnInit { { matColumnDef: 'amount', headerCellDef: 'amount' }, ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); - pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, @@ -36,15 +35,13 @@ export class CommunityPoolComponent implements OnInit { }; dataSource: MatTableDataSource = new MatTableDataSource([]); - sortedData: any; - sort: MatSort; filterSearchData = []; maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; image_s3 = this.environmentService.configValue.image_s3; defaultLogoToken = this.image_s3 + 'images/icons/token-logo.png'; listCoin = this.environmentService.configValue.coins; - + listAssetLcd = []; searchSubject = new Subject(); destroy$ = new Subject(); @@ -55,138 +52,85 @@ export class CommunityPoolComponent implements OnInit { private environmentService: EnvironmentService, ) {} - // ngOnDestroy(): void { - // // throw new Error('Method not implemented.'); - // this.destroy$.next(); - // this.destroy$.complete(); - // } + ngOnDestroy(): void { + // throw new Error('Method not implemented.'); + this.destroy$.next(); + this.destroy$.complete(); + } ngOnInit(): void { - this.getListToken(); - - // this.searchSubject - // .asObservable() - // .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) - // .subscribe(() => { - // if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { - // this.getListToken(); - // } else { - // this.pageChange.selectPage(0); - // } - // }); + this.getListAsset(); + this.searchSubject + .asObservable() + .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + .subscribe(() => { + if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { + this.getListAsset(); + } else { + this.pageChange.selectPage(0); + } + }); } onKeyUp() { - // this.searchSubject.next(this.textSearch); + this.searchSubject.next(this.textSearch); } - async getListToken() { - const res = await this.tokenService.getListAssetCommunityPool(); - let listAssetLcd = _.get(res, 'data.pool'); - - listAssetLcd.forEach((element) => { - let test = this.listCoin.find((i) => i.denom === element.denom); - console.log(test); - if (test) { - element.decimal = test.decimal; - element.symbol = test.display; - element.logo = test.logo; - element.name = test.name; - } else { - element.decimal = 6; - element.symbol = ''; - element.logo = ''; - element.name = ''; - } - }); - this.dataSource = new MatTableDataSource(listAssetLcd) - this.pageData.length = listAssetLcd.length; - - // this.tokenService.getListToken(payload).subscribe((res: ResponseDto) => { - // res.data.forEach((data) => { - // Object.assign(data, { - // ...data, - // circulating_market_cap: +data.circulating_market_cap || 0, - // onChainMarketCap: +data.circulating_market_cap || 0, - // volume: +data.volume_24h, - // price: +data.price, - // isValueUp: data.price_change_percentage_24h < 0 ? false : true, - // change: Number(data.price_change_percentage_24h.toString()), - // isHolderUp: data.holders_change_percentage_24h < 0 ? false : true, - // holders: +data.holders, - // holderChange: Number(data.holders_change_percentage_24h.toString()), - // }); - // }); - - // this.dataSource = new MatTableDataSource(res.data); - // this.pageData.length = res.meta.count; - // }); + async getListAsset() { + let auraAsset; + if (this.textSearch) { + this.filterSearchData = this.listAssetLcd; + this.filterSearchData = this.filterSearchData.filter( + (k) => k.name.toLowerCase().includes(this.textSearch) === true, + ); + this.dataSource = new MatTableDataSource(this.filterSearchData); + this.pageData.length = this.filterSearchData.length; + } else { + const res = await this.tokenService.getListAssetCommunityPool(); + this.listAssetLcd = _.get(res, 'data.pool'); + + this.listAssetLcd.forEach((element) => { + let test = this.listCoin.find((i) => i.denom === element.denom); + if (test) { + element.decimal = test.decimal; + element.symbol = test.display; + element.logo = test.logo; + element.name = test.name; + } else { + element.decimal = 6; + element.symbol = ''; + element.logo = ''; + element.name = 'Aura'; + auraAsset = element; + } + }); + this.listAssetLcd = this.listAssetLcd.filter((k) => k.symbol !== ''); + this.listAssetLcd = this.listAssetLcd.sort((a, b) => { + return this.compare(a.amount, b.amount, false); + }); + this.listAssetLcd.unshift(auraAsset); + this.filterSearchData = this.listAssetLcd; + this.dataSource = new MatTableDataSource(this.listAssetLcd); + this.dataSource = new MatTableDataSource(this.listAssetLcd); + this.pageData.length = this.listAssetLcd.length; + } } paginatorEmit(event): void { this.dataSource.paginator = event; } - sortData(sort: Sort) { - this.dataSource.data.forEach((data) => { - data.circulating_market_cap = +data.circulating_market_cap; - data.volume = +data.volume_24h; - data.price = +data.price; - data.holders = +data.holders; - }); - - let data = this.dataSource.data.slice(); - if (!sort.active || sort.direction === '') { - this.sortedData = data; - return; - } - - const isAsc = sort.direction === 'asc'; - this.sortedData = data.sort((a, b) => { - switch (sort.active) { - case 'price': - return this.compare(a.price, b.price, isAsc); - case 'volume': - return this.compare(a.volume, b.volume, isAsc); - case 'circulating_market_cap': - return this.compare(a.circulating_market_cap, b.circulating_market_cap, isAsc); - case 'onChainMarketCap': - return this.compare(a.onChainMarketCap, b.onChainMarketCap, isAsc); - default: - return 0; - } - }); - - if (sort.active === 'change') { - let lstUp = this.sortedData - .filter((data) => data.isValueUp) - ?.sort((a, b) => this.compare(a.change, b.change, isAsc)); - let lstDown = this.sortedData - .filter((data) => !data.isValueUp) - .sort((a, b) => this.compare(a.change, b.change, !isAsc)); - this.sortedData = isAsc ? lstDown.concat(lstUp) : lstUp.concat(lstDown); - } - - let dataFilter = this.sortedData; - this.pageData = { - length: this.pageData.length, - pageSize: this.pageData.pageSize, - pageIndex: this.pageData.pageIndex, - }; - this.dataSource = new MatTableDataSource(dataFilter); - } - compare(a: number | string, b: number | string, isAsc: boolean) { return (a < b ? -1 : 1) * (isAsc ? 1 : -1); } resetSearch() { this.textSearch = ''; - // this.onKeyUp(); + this.onKeyUp(); } pageEvent(e: PageEvent): void { this.pageData.pageIndex = e.pageIndex; - this.getListToken(); + this.getListAsset(); } } From 58cb2cbbc9a74473acf912b3f7a44889338c9449 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 31 May 2023 15:35:47 +0700 Subject: [PATCH 028/315] implement community pool --- .../community-pool.component.html | 92 +++++++++++-------- .../community-pool.component.ts | 21 ++++- .../token-cw20/token-cw20.component.html | 1 - .../card-mob-simple.component.html | 17 ++++ .../card-mob-simple.component.ts | 15 ++- .../card-mob-simple/card-mob-simple.module.ts | 3 +- 6 files changed, 103 insertions(+), 46 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html index aa28b41f8..4665084f6 100644 --- a/src/app/pages/community-pool/community-pool.component.html +++ b/src/app/pages/community-pool/community-pool.component.html @@ -1,5 +1,5 @@

Community Pool Details

-
+
@@ -33,44 +33,60 @@

Asset

-
-
Name
- -
{{ element.name ? element.name : 'Aura' }}
+ +
{{ element.name }}
Amount - + +
- - - - - - - - - - - + +
+
Name -
- -
{{ element.name }}
-
-
Symbol - {{ element.symbol ? element.symbol : 'AURA' }} -
+ + + + + - - - - - + + + + + - - - - - + + + + + + + + + + +
Name +
+ +
{{ element.name }}
+
+
Denom - {{ element.denom }} - Symbol + {{ element.symbol ? element.symbol : 'AURA' }} + Amount - - - Amount + + +
+ {{ 'NO DATA' | translate }} +
+
+ + + + + @@ -78,8 +94,8 @@

Asset

{{ 'NO DATA' | translate }} - -
+ + = [ { matColumnDef: 'name', headerCellDef: 'name' }, { matColumnDef: 'symbol', headerCellDef: 'symbol' }, - { matColumnDef: 'denom', headerCellDef: 'denom' }, { matColumnDef: 'amount', headerCellDef: 'amount' }, ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); @@ -33,8 +34,10 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { pageSize: 20, pageIndex: PAGE_EVENT.PAGE_INDEX, }; - - dataSource: MatTableDataSource = new MatTableDataSource([]); + assetList: []; + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); + dataSource: MatTableDataSource; + dataSourceMob: any[]; filterSearchData = []; maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; @@ -50,6 +53,7 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { public global: Globals, public tokenService: TokenService, private environmentService: EnvironmentService, + private layout: BreakpointObserver, ) {} ngOnDestroy(): void { @@ -84,6 +88,10 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { (k) => k.name.toLowerCase().includes(this.textSearch) === true, ); this.dataSource = new MatTableDataSource(this.filterSearchData); + this.dataSourceMob = this.dataSource.data.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); this.pageData.length = this.filterSearchData.length; } else { const res = await this.tokenService.getListAssetCommunityPool(); @@ -111,7 +119,10 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { this.listAssetLcd.unshift(auraAsset); this.filterSearchData = this.listAssetLcd; this.dataSource = new MatTableDataSource(this.listAssetLcd); - this.dataSource = new MatTableDataSource(this.listAssetLcd); + this.dataSourceMob = this.dataSource.data.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); this.pageData.length = this.listAssetLcd.length; } } diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html index 6e1027a2a..fb40caeb7 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html @@ -86,7 +86,6 @@

CW-20 Tokens

[appBigNumber]="element.price" [auraValue]="true" [decimal]="0"> {{ denom }} -
diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html index 598eec56d..6f6efe657 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html @@ -56,6 +56,23 @@
+
+
+ +
+
+
+ {{ tokenData.info }} +
+
+
Amount
+ + +
Date: Wed, 31 May 2023 17:05:41 +0700 Subject: [PATCH 029/315] implement community pool - fake data --- .../community-pool.component.html | 4 +- .../community-pool.component.scss | 54 +------- .../community-pool.component.ts | 116 ++++++++++++++++-- .../card-mob-simple.component.html | 2 +- 4 files changed, 117 insertions(+), 59 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html index 4665084f6..6be0f5e81 100644 --- a/src/app/pages/community-pool/community-pool.component.html +++ b/src/app/pages/community-pool/community-pool.component.html @@ -11,7 +11,7 @@

Asset

Asset

- + +
NameName
diff --git a/src/app/pages/community-pool/community-pool.component.scss b/src/app/pages/community-pool/community-pool.component.scss index 93ce57b87..3daeda372 100644 --- a/src/app/pages/community-pool/community-pool.component.scss +++ b/src/app/pages/community-pool/community-pool.component.scss @@ -4,55 +4,13 @@ min-width: 410px; } } -.box-search-data { - max-height: 350px; - width: 90%; - @media (min-width: 992px) { - width: 410px; - } - .logo-token { - margin-top: 3px; - width: 20px; - height: 20px; - } - .box-price { - background-color: rgba(94, 230, 208, 0.2); - border-radius: 4px; - color: var(--aura-green); - padding: 1px 6px; - margin-left: var(--spacer-2); - } - .search-result { - border: 1px solid transparent; - transition: border-color 0.35s ease-in-out; - &:hover { - border: 1px solid var(--aura-green-3); - border-radius: 4px; - } - } -} -@media (max-width: 991.99px) { - .aura-table th.mat-header-cell:not(:nth-child(2)) { - min-width: 150px; - } - .aura-table th.mat-header-cell:nth-child(6), - .aura-table th.mat-header-cell:nth-child(7) { - min-width: 220px; - } - .aura-table th.mat-header-cell:nth-child(2) { - min-width: 250px; - } - .aura-table th.mat-header-cell:nth-child(1) { - min-width: 50px; + +@media (min-width: 991.99px) { + ::ng-deep table.aura-table th.mat-header-cell { + width: 33%; } } + .vertical-align-top { vertical-align: top; -} -.desc { - overflow: hidden; - text-overflow: ellipsis; - display: -webkit-box; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; -} +} \ No newline at end of file diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts index 4933ee97a..95484d286 100644 --- a/src/app/pages/community-pool/community-pool.component.ts +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -3,7 +3,6 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; -import * as _ from 'lodash'; import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; @@ -11,7 +10,6 @@ import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { TokenService } from 'src/app/core/services/token.service'; -import { Globals } from 'src/app/global/global'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; @Component({ @@ -31,7 +29,7 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); pageData: PageEvent = { length: PAGE_EVENT.LENGTH, - pageSize: 20, + pageSize: 5, pageIndex: PAGE_EVENT.PAGE_INDEX, }; assetList: []; @@ -47,10 +45,91 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { listAssetLcd = []; searchSubject = new Subject(); destroy$ = new Subject(); + pool: any = [ + { + denom: 'utaura', + amount: '66655519380.574680591140134408', + }, + { + denom: 'ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20', + amount: '1000000.000000000000000000', + }, + { + denom: '12', + amount: '1', + }, + { + denom: '13', + amount: '2', + }, + { + denom: '14', + amount: '3', + }, + { + denom: '15', + amount: '4', + }, + { + denom: '16', + amount: '4', + }, + { + denom: '17', + amount: '4', + }, + { + denom: '18', + amount: '4', + }, + { + denom: '19', + amount: '4', + }, + { + denom: '20', + amount: '4', + }, + { + denom: '21', + amount: '4', + }, + { + denom: '22', + amount: '4', + }, + { + denom: '23', + amount: '4', + }, + { + denom: '24', + amount: '4', + }, + { + denom: '25', + amount: '4', + }, + { + denom: '26', + amount: '4', + }, + { + denom: '27', + amount: '4', + }, + { + denom: '28', + amount: '4', + }, + { + denom: '29', + amount: '4', + }, + ]; constructor( public translate: TranslateService, - public global: Globals, public tokenService: TokenService, private environmentService: EnvironmentService, private layout: BreakpointObserver, @@ -85,9 +164,16 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { if (this.textSearch) { this.filterSearchData = this.listAssetLcd; this.filterSearchData = this.filterSearchData.filter( - (k) => k.name.toLowerCase().includes(this.textSearch) === true, + (k) => + k.name.toLowerCase().includes(this.textSearch.toLowerCase()) === true || + k.symbol.toLowerCase().includes(this.textSearch.toLowerCase()) === true, + ); + this.dataSource = new MatTableDataSource( + this.filterSearchData.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ), ); - this.dataSource = new MatTableDataSource(this.filterSearchData); this.dataSourceMob = this.dataSource.data.slice( this.pageData.pageIndex * this.pageData.pageSize, this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, @@ -95,7 +181,9 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { this.pageData.length = this.filterSearchData.length; } else { const res = await this.tokenService.getListAssetCommunityPool(); - this.listAssetLcd = _.get(res, 'data.pool'); + // this.listAssetLcd = _.get(res, 'data.pool'); + let abc = this.pool; + this.listAssetLcd = abc; this.listAssetLcd.forEach((element) => { let test = this.listCoin.find((i) => i.denom === element.denom); @@ -118,7 +206,19 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { }); this.listAssetLcd.unshift(auraAsset); this.filterSearchData = this.listAssetLcd; - this.dataSource = new MatTableDataSource(this.listAssetLcd); + if (!this.dataSource) { + this.dataSource = new MatTableDataSource( + this.listAssetLcd.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ), + ); + } else { + this.dataSource.data = this.listAssetLcd.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); + } this.dataSourceMob = this.dataSource.data.slice( this.pageData.pageIndex * this.pageData.pageSize, this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html index 6f6efe657..65c875eba 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html @@ -56,7 +56,7 @@
+
From 761d7ac79991a93bc12389a31aaa64a964724794 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 1 Jun 2023 13:47:42 +0700 Subject: [PATCH 030/315] implement community pool --- .../community-pool.component.html | 32 ++--- .../community-pool.component.ts | 136 ++++-------------- .../pages/dashboard/dashboard.component.html | 2 +- .../card-mob-simple.component.html | 9 +- .../card-mob-simple.component.scss | 6 + .../card-mob-simple.component.ts | 3 +- 6 files changed, 57 insertions(+), 131 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html index 6be0f5e81..03acc488a 100644 --- a/src/app/pages/community-pool/community-pool.component.html +++ b/src/app/pages/community-pool/community-pool.component.html @@ -31,7 +31,7 @@

Asset

-
+
@@ -57,7 +57,7 @@

Asset

-
AmountAmount Asset
+ + @@ -85,23 +91,17 @@

Asset

name: data.name, info: data.symbol ? data.symbol : 'AURA' }" - [tokenAmount]="{ amount: data.amount, decimal: data.decimal ? data.decimal : 0 }"> + [tokenAmount]="{ amount: data.amount, decimal: data.decimal, isAura: true ? data.logo === '' : false }"> - - - - - {{ 'NO DATA' | translate }} - -
+ +
- - + diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts index 95484d286..be8cdc0a9 100644 --- a/src/app/pages/community-pool/community-pool.component.ts +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -3,13 +3,15 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; +import * as _ from 'lodash'; import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; -import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; +import { NUMBER_CONVERT, PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { TokenService } from 'src/app/core/services/token.service'; +import { balanceOf } from 'src/app/core/utils/common/parsing'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; @Component({ @@ -29,10 +31,10 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); pageData: PageEvent = { length: PAGE_EVENT.LENGTH, - pageSize: 5, + pageSize: 10, pageIndex: PAGE_EVENT.PAGE_INDEX, }; - assetList: []; + pageSizeMob = 5; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); dataSource: MatTableDataSource; dataSourceMob: any[]; @@ -45,88 +47,6 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { listAssetLcd = []; searchSubject = new Subject(); destroy$ = new Subject(); - pool: any = [ - { - denom: 'utaura', - amount: '66655519380.574680591140134408', - }, - { - denom: 'ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20', - amount: '1000000.000000000000000000', - }, - { - denom: '12', - amount: '1', - }, - { - denom: '13', - amount: '2', - }, - { - denom: '14', - amount: '3', - }, - { - denom: '15', - amount: '4', - }, - { - denom: '16', - amount: '4', - }, - { - denom: '17', - amount: '4', - }, - { - denom: '18', - amount: '4', - }, - { - denom: '19', - amount: '4', - }, - { - denom: '20', - amount: '4', - }, - { - denom: '21', - amount: '4', - }, - { - denom: '22', - amount: '4', - }, - { - denom: '23', - amount: '4', - }, - { - denom: '24', - amount: '4', - }, - { - denom: '25', - amount: '4', - }, - { - denom: '26', - amount: '4', - }, - { - denom: '27', - amount: '4', - }, - { - denom: '28', - amount: '4', - }, - { - denom: '29', - amount: '4', - }, - ]; constructor( public translate: TranslateService, @@ -168,22 +88,18 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { k.name.toLowerCase().includes(this.textSearch.toLowerCase()) === true || k.symbol.toLowerCase().includes(this.textSearch.toLowerCase()) === true, ); - this.dataSource = new MatTableDataSource( - this.filterSearchData.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ), - ); - this.dataSourceMob = this.dataSource.data.slice( + this.dataSource.data = this.filterSearchData.slice( this.pageData.pageIndex * this.pageData.pageSize, this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, ); + this.dataSourceMob = this.filterSearchData.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, + ); this.pageData.length = this.filterSearchData.length; } else { const res = await this.tokenService.getListAssetCommunityPool(); - // this.listAssetLcd = _.get(res, 'data.pool'); - let abc = this.pool; - this.listAssetLcd = abc; + this.listAssetLcd = _.get(res, 'data.pool'); this.listAssetLcd.forEach((element) => { let test = this.listCoin.find((i) => i.denom === element.denom); @@ -197,38 +113,40 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { element.symbol = ''; element.logo = ''; element.name = 'Aura'; + element.amount = element.amount / NUMBER_CONVERT; auraAsset = element; } }); this.listAssetLcd = this.listAssetLcd.filter((k) => k.symbol !== ''); this.listAssetLcd = this.listAssetLcd.sort((a, b) => { - return this.compare(a.amount, b.amount, false); + return this.compare(balanceOf(a.amount, a.decimal), balanceOf(b.amount, b.decimal), false); }); this.listAssetLcd.unshift(auraAsset); this.filterSearchData = this.listAssetLcd; if (!this.dataSource) { - this.dataSource = new MatTableDataSource( - this.listAssetLcd.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ), + this.dataSource = new MatTableDataSource(this.listAssetLcd); + this.dataSourceMob = this.listAssetLcd.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, ); } else { - this.dataSource.data = this.listAssetLcd.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + this.dataSource.data = this.listAssetLcd; + this.dataSourceMob = this.listAssetLcd.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, ); } - this.dataSourceMob = this.dataSource.data.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ); this.pageData.length = this.listAssetLcd.length; } } paginatorEmit(event): void { - this.dataSource.paginator = event; + if (this.dataSource) { + this.dataSource.paginator = event; + } else { + this.dataSource = new MatTableDataSource(); + this.dataSource.paginator = event; + } } compare(a: number | string, b: number | string, isAsc: boolean) { diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 710978201..7293b3bc4 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -160,7 +160,7 @@
Community Pool
- +
diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html index 65c875eba..8f551f16b 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html @@ -61,15 +61,16 @@
-
+
{{ tokenData.info }}

Amount
- - +
diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss index a09e2dd61..ab91c6658 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss @@ -89,6 +89,12 @@ } } +.ellipsis-text { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + ::ng-deep.card__date { span:first-child { margin-right: 16px; diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.ts b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.ts index afddba7d2..5ded10fa6 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.ts +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.ts @@ -34,7 +34,8 @@ export interface CardMobSimpleToken { export interface CardMobSimpleAmount{ amount: string; - decimal: number + decimal: number; + isAura: boolean; } @Component({ From 0bebb26480cba05f834c7185dab5b9f52108c309 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 1 Jun 2023 14:01:33 +0700 Subject: [PATCH 031/315] implement community pool --- .../community-pool.component.ts | 12 ++-- .../community-pool/community-pool.module.ts | 22 ------- .../card-mob-simple.component.html | 2 +- .../card-mob-simple.component.scss | 1 + src/assets/config/config.json | 59 +++++++++++++------ 5 files changed, 50 insertions(+), 46 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts index be8cdc0a9..be0250ae0 100644 --- a/src/app/pages/community-pool/community-pool.component.ts +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -102,12 +102,12 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { this.listAssetLcd = _.get(res, 'data.pool'); this.listAssetLcd.forEach((element) => { - let test = this.listCoin.find((i) => i.denom === element.denom); - if (test) { - element.decimal = test.decimal; - element.symbol = test.display; - element.logo = test.logo; - element.name = test.name; + let findItem = this.listCoin.find((i) => i.denom === element.denom); + if (findItem) { + element.decimal = findItem.decimal; + element.symbol = findItem.display; + element.logo = findItem.logo; + element.name = findItem.name; } else { element.decimal = 6; element.symbol = ''; diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts index c6f56be07..44d155144 100644 --- a/src/app/pages/community-pool/community-pool.module.ts +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -2,24 +2,13 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { MatTableModule } from '@angular/material/table'; -import { NgbNavModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { NgxMaskModule } from 'ngx-mask'; import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; -import { AccountService } from 'src/app/core/services/account.service'; -import { AudioPlayerModule } from 'src/app/shared/components/audio-player/audio-player.module'; -import { NftCardModule } from 'src/app/shared/components/cards/nft-card/nft-card.module'; -import { ContractPopoverModule } from 'src/app/shared/components/contract-popover/contract-popover.module'; -import { ModelViewModule } from 'src/app/shared/components/model-view/model-view.module'; -import { MaterialModule } from '../../../app/app.module'; import { PaginatorModule } from '../../../app/shared/components/paginator/paginator.module'; import { TableNoDataModule } from '../../../app/shared/components/table-no-data/table-no-data.module'; import { SharedModule } from '../../../app/shared/shared.module'; -import { TokenService } from '../../core/services/token.service'; -import { ReadContractModule } from '../contracts/contracts-detail/contracts-contents/contract/read-contract/read-contract.module'; -import { WriteContractModule } from '../contracts/contracts-detail/contracts-contents/contract/write-contact/write-contract.module'; -import { ContractsModule } from '../contracts/contracts.module'; import { CommunityPoolRoutingModule } from './community-pool-routing.module'; import { CommunityPoolComponent } from './community-pool.component'; @@ -29,25 +18,14 @@ import { CommunityPoolComponent } from './community-pool.component'; CommunityPoolRoutingModule, CommonModule, SharedModule, - NgbNavModule, TranslateModule, PaginatorModule, TableNoDataModule, MatTableModule, - MaterialModule, FormsModule, - NgbPopoverModule, CommonPipeModule, - ContractPopoverModule, NgxMaskModule, - WriteContractModule, - ReadContractModule, - ModelViewModule, - NftCardModule, - AudioPlayerModule, - ContractsModule, CommonDirectiveModule, ], - // providers: [TokenService, AccountService], }) export class CommunityPoolModule {} diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html index 8f551f16b..4660d4276 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.html @@ -61,7 +61,7 @@
-
+
{{ tokenData.info }}
diff --git a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss index ab91c6658..0fd0badcc 100644 --- a/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss +++ b/src/app/shared/components/cards/card-mob-simple/card-mob-simple.component.scss @@ -93,6 +93,7 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + max-width: 130px; } ::ng-deep.card__date { diff --git a/src/assets/config/config.json b/src/assets/config/config.json index 35256795d..31eee306e 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -4,21 +4,25 @@ "chainId": "aura-testnet-2", "timeStaking": "86400", "env": "dev", - "urlSocket": "https://explorer-api.dev.aura.network", + "urlSocket": "https://explorer-ws.dev.aura.network", "validator_s3": "https://validator-logos.s3.ap-southeast-1.amazonaws.com", - "coins":[ - {"name": "Serenity Aura", - "display": "AURA", - "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", - "decimal": 6, - "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png"} - ], + "coins": [ + { + "name": "Serenity Aura", + "display": "AURA", + "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", + "decimal": 6, + "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" + } + ], "chain_info": { "chainId": "aura-testnet-2", "chainName": "aura devnet", "rpc": "https://rpc.dev.aura.network", "rest": "https://lcd.dev.aura.network", - "bip44": { "coinType": 118 }, + "bip44": { + "coinType": 118 + }, "bech32Config": { "bech32PrefixAccAddr": "aura", "bech32PrefixAccPub": "aurapub", @@ -27,20 +31,41 @@ "bech32PrefixConsAddr": "auravalcons", "bech32PrefixConsPub": "auravalconspub" }, - "currencies": [{ "coinDenom": "TAURA", "coinMinimalDenom": "utaura", "coinDecimals": 6 }], - "feeCurrencies": [{ "coinDenom": "TAURA", "coinMinimalDenom": "utaura", "coinDecimals": 6 }], - "stakeCurrency": { "coinDenom": "TAURA", "coinMinimalDenom": "utaura", "coinDecimals": 6 }, + "currencies": [ + { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + } + ], + "feeCurrencies": [ + { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + } + ], + "stakeCurrency": { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + }, "coinType": 118, - "gasPriceStep": { "low": 0.001, "average": 0.0025, "high": 0.004 }, - "features": ["ibc-transfer"], + "gasPriceStep": { + "low": 0.001, + "average": 0.0025, + "high": 0.004 + }, + "features": [ + "ibc-transfer" + ], "walletUrlForStaking": "https://explorer.dev.aura.network/validators", "logo": "https://i.imgur.com/zi0mTYb.png", "explorer": "https://explorer.dev.aura.network/" }, "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", + "graphUrl": "https://indexer-v2.dev.aurascan.io/v1/graphql", "timeInterval": 4000, - "ipfsDomain": "https://ipfs.io/", - "evnLabel": { "desktop": "Develop Testnet Network", "mobile": "Develop Testnet" }, - "graphUrl": "https://indexer-v2.dev.aurascan.io/v1/graphql" + "evnLabel": { "desktop": "Develop Testnet Network", "mobile": "Develop Testnet" } } From 53b9a361143b0fb5cd98d278fb8694a0466cd2fb Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 1 Jun 2023 15:40:22 +0700 Subject: [PATCH 032/315] statitic indexer v2 --- src/app/app.component.ts | 2 +- src/app/core/models/common.model.ts | 6 +++--- src/app/core/services/common.service.ts | 8 ++++---- src/app/core/services/validator.service.ts | 2 +- src/app/core/utils/common/info-common.ts | 10 +++------- src/app/pages/blocks/blocks.component.ts | 2 +- src/app/pages/dashboard/dashboard.component.html | 10 +++++----- src/app/pages/dashboard/dashboard.component.ts | 2 +- .../summary-info/summary-info.component.ts | 4 ++-- .../components/pagetitle/pagetitle.component.html | 4 ++-- 10 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 8c3139dd2..8cf4991f5 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -47,7 +47,7 @@ export class AppComponent implements OnInit { getInfoCommon(): void { this.commonService.status().subscribe((res) => { - getInfo(this.globals, res.data); + getInfo(this.globals, res); }); } diff --git a/src/app/core/models/common.model.ts b/src/app/core/models/common.model.ts index 769e2c236..00912d1b2 100644 --- a/src/app/core/models/common.model.ts +++ b/src/app/core/models/common.model.ts @@ -125,17 +125,17 @@ export class ResponseDto { } export class CommonDataDto { - block_height?: number; + total_blocks?: number; block_time: string; bonded_tokens: number; community_pool: number; inflation: string; - total_txs_num: number; + total_transactions: number; total_validator_active_num: number; total_validator_num: number; bonded_tokens_format: number; community_pool_format: number; - supply: number; + total_aura: number; } export interface DataDelegateDto { diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index dbdb8220a..b080639ab 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -2,14 +2,12 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import axios from 'axios'; import { formatDistanceToNowStrict } from 'date-fns'; -import * as _ from 'lodash'; import * as moment from 'moment'; import { BehaviorSubject, Observable } from 'rxjs'; -import { CHART_RANGE, DATEFORMAT } from '../constants/common.constant'; +import { DATEFORMAT } from '../constants/common.constant'; import { STATUS_VALIDATOR } from '../constants/validator.enum'; import { EnvironmentService } from '../data-services/environment.service'; import { formatTimeInWords, formatWithSchema } from '../helpers/date'; -import { LCD_COSMOS } from '../constants/url.constant'; @Injectable() export class CommonService { @@ -18,6 +16,7 @@ export class CommonService { private networkQuerySubject: BehaviorSubject; public networkQueryOb: Observable; chainInfo = this._environmentService.configValue.chain_info; + graphUrl = `${this._environmentService.configValue.graphUrl}`; constructor(private _http: HttpClient, private _environmentService: EnvironmentService) { this.apiUrl = `${this._environmentService.configValue.beUri}`; @@ -35,7 +34,8 @@ export class CommonService { } status(): Observable { - return this._http.get(`${this.apiUrl}/status`); + let api_link= this.graphUrl.replace('v1/graphql','api/v1'); + return this._http.get(`${api_link}/dashboard-statistics`); } getParamTallyingFromLCD() { diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 0616643e3..c976de160 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -40,7 +40,7 @@ export class ValidatorService extends CommonService { if (!inflation && !bonded_tokens && !supply) { inflation = this.global.dataHeader.inflation.slice(0, -1); bonded_tokens = this.global.dataHeader.bonded_tokens.toString().slice(0, -1); - supply = this.global.dataHeader.supply.toString().slice(0, -1); + supply = this.global.dataHeader.total_aura.toString().slice(0, -1); this.stakingAPRSubject.next((inflation * (1 - communityTax)) / (bonded_tokens / supply)); } }, 500); diff --git a/src/app/core/utils/common/info-common.ts b/src/app/core/utils/common/info-common.ts index 958d12062..db9aa0bde 100644 --- a/src/app/core/utils/common/info-common.ts +++ b/src/app/core/utils/common/info-common.ts @@ -8,10 +8,11 @@ import { balanceOf } from './parsing'; export function getInfo(globals: any, data: any): void { globals.dataHeader = data; globals.dataHeader.bonded_tokens = formatNumber(globals.dataHeader.bonded_tokens / NUMBER_CONVERT) || 0; - globals.dataHeader.supply = formatNumber(globals?.dataHeader?.supply / NUMBER_CONVERT); + globals.dataHeader.total_aura = formatNumber(+globals?.dataHeader?.total_aura / NUMBER_CONVERT); globals.dataHeader.bonded_tokens_format = formatNumber(globals?.dataHeader?.bonded_tokens); globals.dataHeader.community_pool = Math.round(globals?.dataHeader?.community_pool / NUMBER_CONVERT); globals.dataHeader.community_pool_format = formatNumber(globals?.dataHeader?.community_pool); + globals.dataHeader.inflation = globals?.dataHeader?.inflation * 100 + '%'; } export function formatNumber(number: number, args?: any): any { @@ -54,12 +55,7 @@ export function parseDataTransaction(trans: any, coinMinimalDenom: string, token const typeTrans = TYPE_TRANSACTION.find((f) => f.label.toLowerCase() === typeOrigin?.toLowerCase()); trans.tx_hash = trans.hash; //get amount of transaction - trans.amount = getAmount( - trans.data?.body?.messages, - typeOrigin, - trans.tx_response?.raw_log, - coinMinimalDenom, - ); + trans.amount = getAmount(trans.data?.body?.messages, typeOrigin, trans.tx_response?.raw_log, coinMinimalDenom); trans.fee = balanceOf(trans?.data?.auth_info?.fee?.amount[0]?.amount); trans.gas_limit = balanceOf(trans?.data?.auth_info?.fee?.gas_limit); trans.height = trans?.height; diff --git a/src/app/pages/blocks/blocks.component.ts b/src/app/pages/blocks/blocks.component.ts index e100f6726..df552e1a8 100644 --- a/src/app/pages/blocks/blocks.component.ts +++ b/src/app/pages/blocks/blocks.component.ts @@ -58,7 +58,7 @@ export class BlocksComponent implements OnInit { getInfoCommon(): void { this.commonService.status().subscribe((res) => { - getInfo(this.globals, res.data); + getInfo(this.globals, res); }); } } diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 7293b3bc4..cddd26dc8 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -149,8 +149,8 @@
Height
-
- {{ global?.dataHeader?.block_height || 0 | number }} +
+ {{ global?.dataHeader?.total_blocks || 0 | number }}
@@ -176,8 +176,8 @@
Transactions
-
- {{ global?.dataHeader?.total_txs_num | number }} +
+ {{ global?.dataHeader?.total_transactions | number }}
@@ -192,7 +192,7 @@
- {{ global?.dataHeader?.bonded_tokens || 0 }} / {{ global?.dataHeader?.supply || 0 }} + {{ global?.dataHeader?.bonded_tokens || 0 }} / {{ global?.dataHeader?.total_aura || 0 }}
diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 51956bd99..69ab0e9f5 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -325,7 +325,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { getInfoCommon(): void { this.commonService.status().subscribe((res) => { - getInfo(this.global, res.data); + getInfo(this.global, res); }); } diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 5c0faebe4..6893584d0 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -80,8 +80,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } return this.commonService.status().pipe( mergeMap((res) => { - if (res.data) { - this.proposalDetail.total_bonded_token = balanceOf(res.data.bonded_tokens); + if (res) { + this.proposalDetail.total_bonded_token = balanceOf(res.bonded_tokens); if (data.proposals[0].status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD) { this.proposalDetail.pro_turnout = (this.proposalDetail.pro_total_vote * 100) / this.proposalDetail.total_bonded_token; diff --git a/src/app/shared/components/pagetitle/pagetitle.component.html b/src/app/shared/components/pagetitle/pagetitle.component.html index 33e8703b7..627267561 100644 --- a/src/app/shared/components/pagetitle/pagetitle.component.html +++ b/src/app/shared/components/pagetitle/pagetitle.component.html @@ -10,8 +10,8 @@

{{ title }}

-
- Height: {{ global?.dataHeader?.block_height | number }} +
+ Height: {{ global?.dataHeader?.total_blocks | number }}
Bonded: {{ global?.dataHeader?.bonded_tokens }} From 8415fea01423239cf425bd4f9924acdd5d175d7a Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 1 Jun 2023 15:55:13 +0700 Subject: [PATCH 033/315] [TamTM6] update event log part 8 --- .../core/data-services/environment.service.ts | 5 +- src/app/core/services/proposal.service.ts | 81 +++++++---- src/app/core/services/transaction.service.ts | 132 +++++++++++++++++- src/app/core/services/validator.service.ts | 7 +- .../account-detail.component.ts | 2 +- .../block-detail/block-detail.component.ts | 8 +- .../contract-content.component.ts | 2 +- .../contracts-transactions.component.ts | 4 +- .../pages/dashboard/dashboard.component.html | 2 +- .../pages/dashboard/dashboard.component.ts | 2 +- .../depositors/depositors.component.ts | 2 +- .../summary-info/summary-info.component.ts | 4 +- .../validators-votes.component.html | 3 +- .../validators-votes.component.ts | 25 +++- .../proposal-detail/votes/votes.component.ts | 98 +++++-------- .../proposal-table.component.html | 21 +-- .../proposal-table.component.ts | 15 +- src/app/pages/proposal/proposal.component.ts | 4 +- .../token/nft-detail/nft-detail.component.ts | 2 +- .../token-transfers-tab.component.ts | 2 +- 20 files changed, 286 insertions(+), 135 deletions(-) diff --git a/src/app/core/data-services/environment.service.ts b/src/app/core/data-services/environment.service.ts index e66a8d943..6ac9a4933 100644 --- a/src/app/core/data-services/environment.service.ts +++ b/src/app/core/data-services/environment.service.ts @@ -19,6 +19,7 @@ export interface IConfiguration { timeInterval: number; ipfsDomain: string; evnLabel: any; + maxValidator: number; } @Injectable() @@ -39,6 +40,7 @@ export class EnvironmentService { ipfsDomain: '', graphUrl:'', evnLabel: '', + maxValidator: null }); get configValue(): IConfiguration { @@ -70,7 +72,8 @@ export class EnvironmentService { graphUrl: config['graphUrl'], timeInterval: config['timeInterval'] || 4000, ipfsDomain: config['ipfsDomain'], - evnLabel: config['evnLabel'] + evnLabel: config['evnLabel'], + maxValidator: config['maxValidator'] || 200 }; this.config.next(data); diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 6b0a5118e..8112a2272 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -13,6 +13,7 @@ export class ProposalService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; graphUrl = `${this.environmentService.configValue.graphUrl}`; + maxValidator = `${this.environmentService.configValue.maxValidator}`; envDB = checkEnvQuery(this.environmentService.configValue.env); reloadList$ = new Subject(); pageIndexObj = {}; @@ -37,6 +38,35 @@ export class ProposalService extends CommonService { return this.http.get(`${this.indexerUrl}/votes/validators`, { params }); } + getValidatorVotesFromIndexerV2(proposalId): Observable { + const operationsDoc = ` + query auratestnet_validator($proposalId: Int = null, $limit: Int = 10) { + ${this.envDB} { + validator(where: {status: {_eq: "BOND_STATUS_BONDED"}}, order_by: {percent_voting_power: desc}, limit: $limit) { + vote(where: {proposal_id: {_eq: $proposalId}}) { + id + vote_option + txhash + proposal_id + updated_at + } + description + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: +this.maxValidator || 100, + proposalId: proposalId, + }, + operationName: 'auratestnet_validator', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getListVoteFromIndexer(payload, option): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -54,35 +84,36 @@ export class ProposalService extends CommonService { } getProposalData(payload) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null) { - ${envDB} { + ${this.envDB} { proposal(limit: $limit, where: {proposal_id: {_eq: $proposalId, _lt: $nextKey}}, order_by: {proposal_id: $order}) { - content - deposit_end_time - description - initial_deposit - proposal_id - proposer_address - proposer { + content + deposit_end_time description - operator_address - account_address + initial_deposit + proposal_id + proposer_address + count_vote + proposer { + description + operator_address + account_address + } + status + submit_time + tally + title + total_deposit + turnout + type + updated_at + voting_end_time + voting_start_time } - status - submit_time - tally - title - total_deposit - turnout - type - updated_at - voting_end_time - voting_start_time } } - }`; + `; return this.http .post(this.graphUrl, { query: operationsDoc, @@ -99,9 +130,9 @@ export class ProposalService extends CommonService { getListVoteFromIndexerV2(payload, option): Observable { const operationsDoc = ` - query auratestnet_vote($limit: Int = 10, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { + query auratestnet_vote($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { ${this.envDB} { - vote(limit: $limit, where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: $voteOption}}, order_by: {proposal_id: $order, txhash: asc}) { + vote(limit: $limit, where: {proposal_id: {_eq: $proposalId}, height: {_lt: $nextKey}, vote_option: {_eq: $voteOption}}, order_by: {height: $order}) { height proposal_id txhash @@ -117,7 +148,7 @@ export class ProposalService extends CommonService { query: operationsDoc, variables: { limit: payload.pageLimit, - // nextKey: payload.nextKey, + nextKey: payload.nextKey, order: 'desc', proposalId: payload.proposalId, voteOption: option || null, diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 117914263..08479a642 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -20,6 +20,136 @@ export class TransactionService extends CommonService { } getListTx(payload) { + const operationsDoc = ` + query auratestnet_transaction_top( + $limit: Int = 100 + $order: order_by = desc + $heightGT: Int = null + $heightLT: Int = null + $indexGT: Int = null + $indexLT: Int = null + $hash: String = null + $height: Int = null + ) { + ${this.envDB} { + transaction( + limit: $limit + where: { + hash: { _eq: $hash } + height: { _eq: $height } + _and: [ + { height: { _gt: $heightGT } } + { index: { _gt: $indexGT } } + { height: { _lt: $heightLT } } + { index: { _lt: $indexLT } } + ] + } + order_by: [{ height: $order}, {index: $order }] + ) { + id + height + hash + timestamp + code + gas_used + gas_wanted + data + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.limit, + order: 'desc', + hash: payload.hash, + value: payload.value, + key: payload.key, + heightGT: null, + heightLT: payload.heightLT, + indexGT: null, + indexLT: null, + height: null, + }, + operationName: 'auratestnet_transaction_top', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + + getListTxCondition(payload) { + const operationsDoc = ` + query auratestnet_transaction( + $limit: Int = 100 + $order: order_by = desc + $compositeKey: String = null + $value: String = null + $key: String = null + $compositeKeyIn: [String!] = null + $valueIn: [String!] = null + $keyIn: [String!] = null + $heightGT: Int = null + $heightLT: Int = null + $indexGT: Int = null + $indexLT: Int = null + $hash: String = null + $height: Int = null + ) { + ${this.envDB} { + transaction( + limit: $limit + where: { + hash: { _eq: $hash } + height: { _eq: $height } + event_attribute_index: { + value: { _eq: $value, _in: $valueIn } + composite_key: { _eq: $compositeKey, _in: $compositeKeyIn } + key: { _eq: $key, _in: $keyIn } + } + _and: [ + { height: { _gt: $heightGT } } + { index: { _gt: $indexGT } } + { height: { _lt: $heightLT } } + { index: { _lt: $indexLT } } + ] + } + order_by: [{ height: $order}, {index: $order }] + ) { + id + height + hash + timestamp + code + gas_used + gas_wanted + data + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.limit, + order: 'desc', + hash: payload.hash, + compositeKey: payload.compositeKey, + value: payload.value, + key: payload.key, + heightGT: null, + heightLT: payload.heightLT, + indexGT: null, + indexLT: null, + height: null, + }, + operationName: 'auratestnet_transaction', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + + getListTxMultiCondition(payload) { const operationsDoc = ` query auratestnet_transaction( $limit: Int = 100 @@ -37,7 +167,7 @@ export class TransactionService extends CommonService { $hash: String = null $height: Int = null ) { - auratestnet { + ${this.envDB} { transaction( limit: $limit where: { diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 0f5a484d4..d7f2c8011 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -54,7 +54,7 @@ export class ValidatorService extends CommonService { const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query auratestnet_validator($offset: Int = 0, $limit: Int = 10, $operatorAddress: String = null) { - auratestnet { + ${this.envDB} { validator(limit: $limit, offset: $offset, where: {operator_address: {_eq: $operatorAddress}}) { account_address commission @@ -105,7 +105,7 @@ export class ValidatorService extends CommonService { validatorsDetailListPower(address: string, limit = 10, nextKey = null) { const operationsDoc = ` query auratestnet_powerevent($operator_address: String, $limit: Int = 10, $nextKey: Int = null) { - auratestnet { + ${this.envDB} { power_event(order_by: {height: desc}, where: {_or: [{validatorDst: {operator_address: {_eq: $operator_address}}}, {validatorSrc: {operator_address: {_eq: $operator_address}}}], id: {_lt: $nextKey}}, limit: $limit) { id time @@ -130,7 +130,8 @@ export class ValidatorService extends CommonService { query: operationsDoc, variables: { operator_address: address, - limit: limit + limit: limit, + nextKey: nextKey }, operationName: 'auratestnet_powerevent', }) diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index 80f54bedb..c06f9cd9b 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -307,7 +307,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { value: address, heightLT: nextKey, }; - this.transactionService.getListTx(payload).subscribe({ + this.transactionService.getListTxCondition(payload).subscribe({ next: (data) => { if (data?.transaction?.length > 0) { this.nextKey = null; diff --git a/src/app/pages/blocks/block-detail/block-detail.component.ts b/src/app/pages/blocks/block-detail/block-detail.component.ts index 981fb3c84..cacdfd79f 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.ts +++ b/src/app/pages/blocks/block-detail/block-detail.component.ts @@ -112,9 +112,13 @@ export class BlockDetailComponent implements OnInit { block['chainid'] = _.get(res.block[0], 'data.block.header.chain_id'); block['json_data'] = _.get(res.block[0], 'data.block'); block['gas_used'] = block['gas_wanted'] = 0; - block['events'] = _.get(res.block[0], 'data.block_result.txs_results[0].events'); + block['events'] = _.get(res.block[0], 'data.block_result.begin_block_events'); + const blockEnd = _.get(res.block[0], 'data.block_result.end_block_events'); + if (blockEnd) { + block['events'] = block['events'].concat(blockEnd); + } this.blockDetail = block; - + //get list tx detail let txs = []; for (const key in res.block[0]?.data?.block?.data?.txs) { diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index 1a21a8024..6970148b7 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -127,7 +127,7 @@ export class ContractContentComponent implements OnInit, OnDestroy { value: this.contractsAddress, key: '_contract_address' } - this.transactionService.getListTx(payload).subscribe( + this.transactionService.getListTxCondition(payload).subscribe( (res) => { const data = res; if (res) { diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts index ad46f3083..39e058681 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts @@ -126,7 +126,7 @@ export class ContractsTransactionsComponent implements OnInit { } if (!this.label || +this.label == this.modeTxType.In) { this.payload['heightLT'] = nextKey; - this.transactionService.getListTx(this.payload).subscribe( + this.transactionService.getListTxCondition(this.payload).subscribe( (dataExecute) => { if (dataExecute) { const txsExecute = convertDataTransactionV2(dataExecute, this.coinInfo); @@ -163,7 +163,7 @@ export class ContractsTransactionsComponent implements OnInit { } getDataInstantiate(): void { - this.transactionService.getListTx(this.payload).subscribe( + this.transactionService.getListTxCondition(this.payload).subscribe( (dataInstantiate) => { this.hasLoadIns = true; if (dataInstantiate.transaction?.length > 0) { diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 1c1850cd7..96045fbc2 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -294,7 +294,7 @@
{{ curr_voting_Period - ? (curr_voting_Period.tally.no_with_veto | number : global.formatNumber2Decimal) + ? (curr_voting_Period.tally.noWithVeto | number : global.formatNumber2Decimal) : '0,0' }}%
diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index f0b04ad52..8eb4e387c 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -426,7 +426,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { if (this.voting_Period_arr[index].tally) { this.voting_Period_arr[index].tally.yes = (+yes * 100) / totalVote || 0; this.voting_Period_arr[index].tally.no = (+no * 100) / totalVote || 0; - this.voting_Period_arr[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote || 0; + this.voting_Period_arr[index].tally.noWithVeto = (+no_with_veto * 100) / totalVote || 0; this.voting_Period_arr[index].tally.abstain = (+abstain * 100) / totalVote || 0; } } diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index be3003204..4e26689b2 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -45,7 +45,7 @@ export class DepositorsComponent implements OnInit { value: this.proposalId?.toString(), limit: 100, }; - this.transactionService.getListTx(payload).subscribe( + this.transactionService.getListTxCondition(payload).subscribe( (res) => { let dataList: any[] = []; if (res?.transaction?.length > 0) { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 6bdc36959..a51df7337 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -211,8 +211,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { pro_votes_no_with_veto, pro_votes_abstain, pro_total_vote, - count_vote: data.total_vote, request_amount: balanceOf(data.request_amount), + proposer_name: _.get(data, 'description.moniker'), }; } @@ -333,7 +333,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { value: this.proposalId?.toString(), value2: addr, }; - this.transactionService.getListTx(payload).subscribe((res) => { + this.transactionService.getListTxMultiCondition(payload).subscribe((res) => { const optionVote = this.proposalService.getVoteMessageByConstant( res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, ); diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html index 86756cf10..854775acb 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html @@ -22,7 +22,8 @@ [tabId]="countCurrent" [type]="proposalValidatorVote" [length]="countVote.get(countCurrent)" - [data]="voteDataList"> + [data]="voteDataList" + *ngIf="!voteDataListLoading">
diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index ccc1455f7..f3d545523 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -4,6 +4,7 @@ import { NgbNav } from '@ng-bootstrap/ng-bootstrap'; import { debounceTime } from 'rxjs/operators'; import { ProposalService } from '../../../../../app/core/services/proposal.service'; import { PROPOSAL_TABLE_MODE, PROPOSAL_VOTE, VOTE_OPTION } from '../../../../core/constants/proposal.constant'; +import * as _ from 'lodash'; export interface IValidatorVotes { rank: number; @@ -70,15 +71,25 @@ export class ValidatorsVotesComponent implements OnInit { getValidatorVotes(isInit = false): void { if (this.proposalId) { - this.proposalService.getValidatorVotesFromIndexer(this.proposalId).subscribe((res) => { + this.proposalService.getValidatorVotesFromIndexerV2(this.proposalId).subscribe((res) => { + let validatorVote = []; + if (res?.validator) { + validatorVote = _.get(res, 'validator').map((item) => { + const validator_name = item.description?.moniker; + const timestamp = _.get(item, 'vote[0].updated_at'); + const vote_option = _.get(item, 'vote[0].vote_option'); + const txhash = _.get(item, 'vote[0].txhash'); + return { validator_name, timestamp, vote_option, txhash }; + }); + } this.voteDataListLoading = true; - this.voteData.all = res.data; - this.voteData.yes = res.data.filter((f) => f.answer === VOTE_OPTION.VOTE_OPTION_YES); - this.voteData.abstain = res.data.filter((f) => f.answer === VOTE_OPTION.VOTE_OPTION_ABSTAIN); - this.voteData.no = res.data.filter((f) => f.answer === VOTE_OPTION.VOTE_OPTION_NO); - this.voteData.noWithVeto = res.data.filter((f) => f.answer === VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO); - this.voteData.didNotVote = res.data.filter((f) => f.answer === ''); + this.voteData.all = validatorVote; + this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_YES); + this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_ABSTAIN); + this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_NO); + this.voteData.noWithVeto = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO); + this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); this.voteDataList = [...this.voteData.all]; this.countVote.set('', this.voteData.all.length); diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index bf26c71df..29c11274d 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -85,39 +85,22 @@ export class VotesComponent implements OnChanges { proposalId: this.proposalDetail.proposal_id, }; - this.proposalDetail?.total_vote?.forEach((f) => { - switch (f.answer) { - case VOTE_OPTION.VOTE_OPTION_YES: - this.countTotal.yes = f.count; - break; - case VOTE_OPTION.VOTE_OPTION_ABSTAIN: - this.countTotal.abstain = f.count; - break; - case VOTE_OPTION.VOTE_OPTION_NO: - this.countTotal.no = f.count; - break; - case VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO: - this.countTotal.noWithVeto = f.count; - break; - } - }); - combineLatest([ this.proposalService .getListVoteFromIndexerV2(payloads, null) - .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), + .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES) - .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), + .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO) - .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), + .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) - .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), + .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) - .pipe(map((item) => ({ nextKey: null, votes: item.vote }))), + .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), ]).subscribe((res) => { this.voteDataListLoading = true; res[0] && ((dta) => (this.voteData.all = dta))(res[0]); @@ -127,29 +110,22 @@ export class VotesComponent implements OnChanges { res[4] && ((dta) => (this.voteData.abstain = dta))(res[4]); let voteData: any[]; - if (this.voteData?.all) { + if (this.voteData?.all && !this.countCurrent) { voteData = [...this.voteData?.all.votes]; + this.voteDataList = [...voteData]; } - - // if (voteData) { - // voteData.forEach((item: any) => { - // // item.voter_address = item.voter; - // // item.tx_hash = item.txhash; - // // item.vote_option = item.vote_option; - // // item.timestamp = item.updated_at; - // }); - // } - - this.countTotal.all = - this.countTotal.yes + this.countTotal.no + this.countTotal.noWithVeto + this.countTotal.abstain; - this.voteDataList = [...voteData]; + const countAll = + +this.proposalDetail.count_vote.yes + + +this.proposalDetail.count_vote.abstain + + +this.proposalDetail.count_vote.no + + +this.proposalDetail.count_vote.no_with_veto; - this.countVote.set('', this.countTotal?.all); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_YES, this.countTotal?.yes); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_ABSTAIN, this.countTotal?.abstain); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO, this.countTotal?.no); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, this.countTotal?.noWithVeto); + this.countVote.set('', countAll); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_YES, this.proposalDetail.count_vote.yes); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_ABSTAIN, this.proposalDetail.count_vote.abstain); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO, this.proposalDetail.count_vote.no); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, this.proposalDetail.count_vote.no_with_veto); this.voteDataListLoading = false; this.changeTab(this.countCurrent); @@ -193,11 +169,11 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.yes.nextKey; if (payloads.nextKey) { this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { - if (res.data.votes) { - if (this.voteData.yes.votes.length % 25 !== res.data.votes.length) { + if (res.vote) { + if (this.voteData.yes.votes.length % 25 !== res.vote?.length) { this.voteData.yes = { - nextKey: res.data.nextKey, - votes: [...this.voteData.yes.votes, ...res.data.votes], + nextKey: res.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.yes.votes, ...res.vote], }; } this.voteDataList = this.voteData?.yes.votes; @@ -209,11 +185,11 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.abstain.nextKey; if (payloads.nextKey) { this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { - if (res.data.votes) { - if (this.voteData.abstain.votes.length % 25 !== res.data.votes.length) { + if (res.vote) { + if (this.voteData.abstain.votes.length % 25 !== res.vote?.length) { this.voteData.abstain = { - nextKey: res.data.nextKey, - votes: [...this.voteData.abstain.votes, ...res.data.votes], + nextKey: res.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.abstain.votes, ...res.vote], }; } this.voteDataList = this.voteData?.abstain.votes; @@ -225,11 +201,11 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.no.nextKey; if (payloads.nextKey) { this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { - if (res.data.votes) { - if (this.voteData.no.votes.length % 25 !== res.data.votes.length) { + if (res.vote) { + if (this.voteData.no.votes.length % 25 !== res.vote?.length) { this.voteData.no = { - nextKey: res.data.nextKey, - votes: [...this.voteData.no.votes, ...res.data.votes], + nextKey: res.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.no.votes, ...res.vote], }; } this.voteDataList = this.voteData?.no.votes; @@ -243,11 +219,11 @@ export class VotesComponent implements OnChanges { this.proposalService .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) .subscribe((res) => { - if (res.data.votes) { - if (this.voteData.noWithVeto.votes.length % 25 !== res.data.votes.length) { + if (res.vote) { + if (this.voteData.noWithVeto.votes.length % 25 !== res.vote.length) { this.voteData.noWithVeto = { - nextKey: res.data.nextKey, - votes: [...this.voteData.noWithVeto.votes, ...res.data.votes], + nextKey: res.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.noWithVeto.votes, ...res.vote], }; } this.voteDataList = this.voteData?.noWithVeto.votes; @@ -259,11 +235,11 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.all?.nextKey; if (payloads?.nextKey) { this.proposalService.getListVoteFromIndexerV2(payloads, null).subscribe((res) => { - if (res.data.votes) { - if (this.voteData.all.votes.length % 25 !== res.data.votes.length) { + if (res.vote) { + if (this.voteData.all.votes.length % 25 !== res.vote.length) { this.voteData.all = { - nextKey: res.data.nextKey, - votes: [...this.voteData.all.votes, ...res.data.votes], + nextKey: res.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.all.votes, ...res.vote], }; } this.voteDataList = this.voteData?.all.votes; diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index ede03868e..b78a08f6d 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -55,20 +55,7 @@ {{ getVoteValue(data[template.matColumnDef]) }} - {{ - data[template.matColumnDef] - }} - - -
-
{{ commonService.getDateValue(data[template.matColumnDef])[0] }}
-
- {{ data[template.matColumnDef] | customDate : 'yyyy-MM-dd' }} -
- {{ data[template.matColumnDef] | customDate : 'HH:mm:ss' }} -
-
-
-
+ {{ pageValidatorIndex * 5 + j + 1 }}
@@ -165,11 +152,11 @@ { label: 'TxHash', class: 'body-01', - info: data.tx_hash + info: data.txhash ? '' + - shortenAddress(data.tx_hash) + + shortenAddress(data.txhash) + '' : '-' }, diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index f93c32213..1f0ab833c 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -50,7 +50,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { { matColumnDef: 'voter', headerCellDef: 'Voter', isUrl: '/account', isShort: true }, { matColumnDef: 'txhash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true, desktopOnly: true }, { matColumnDef: 'vote_option', headerCellDef: 'Answer' }, - { matColumnDef: 'updated_at', headerCellDef: 'Time', desktopOnly: true }, + { matColumnDef: 'timestamp', headerCellDef: 'Time', desktopOnly: true }, ]; validatorsVotesTemplates: Array = [ @@ -62,8 +62,8 @@ export class ProposalTableComponent implements OnInit, OnChanges { paramField: 'operator_address', prefix: 'operator_address', }, - { matColumnDef: 'tx_hash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true, desktopOnly: true }, - { matColumnDef: 'answer', headerCellDef: 'Answer' }, + { matColumnDef: 'txhash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true, desktopOnly: true }, + { matColumnDef: 'vote_option', headerCellDef: 'Answer' }, { matColumnDef: 'timestamp', headerCellDef: 'Time', desktopOnly: true }, ]; @@ -80,6 +80,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { dataSource: MatTableDataSource; pageSize = 5; pageIndex = 0; + pageValidatorIndex = 0; proposalMode = PROPOSAL_TABLE_MODE; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); @@ -96,6 +97,10 @@ export class ProposalTableComponent implements OnInit, OnChanges { ) {} ngOnChanges(changes: SimpleChanges): void { + this.data.forEach((element) => { + element.timestamp = element.timestamp || element.updated_at; + element.updated_at = null; + }); if (this.dataSource) { this.dataSource.data = this.data; } else { @@ -118,7 +123,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { this.data.forEach((d) => { operatorAddArr.push(d.operator_address); }); - if (operatorAddArr.length > 0) { + if (operatorAddArr.length > 0 && operatorAddArr[0]) { // get validator logo this.validatorService.getValidatorInfoByList(operatorAddArr).subscribe((res) => { if (res?.data) { @@ -187,6 +192,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { const { length, pageIndex, pageSize, previousPageIndex } = e; const next = length <= (pageIndex + 2) * pageSize; + if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { @@ -197,6 +203,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { this.tabId = this.tabId || 'all'; this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES] = {}; this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES][this.tabId] = pageIndex; + this.pageValidatorIndex = pageIndex; } if (next) { diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index 6ec13eb10..f4b22e77e 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -98,7 +98,7 @@ export class ProposalComponent implements OnInit { if (this.proposalData[index].tally) { this.proposalData[index].tally.yes = (+yes * 100) / totalVote; this.proposalData[index].tally.no = (+no * 100) / totalVote; - this.proposalData[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; + this.proposalData[index].tally.noWithVeto = (+no_with_veto * 100) / totalVote; this.proposalData[index].tally.abstain = (+abstain * 100) / totalVote; } } @@ -110,7 +110,7 @@ export class ProposalComponent implements OnInit { value: pro.proposal_id?.toString(), value2: addr, }; - this.transactionService.getListTx(payload).subscribe((res) => { + this.transactionService.getListTxMultiCondition(payload).subscribe((res) => { const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.tx?.body?.messages[0]?.option); pro.vote_option = this.voteConstant.find( (s) => s.key === optionVote, diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index ffc15d018..df8b56ff9 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -197,7 +197,7 @@ export class NFTDetailComponent implements OnInit { heightLT: nextKey, }; - this.transactionService.getListTx(payload).subscribe( + this.transactionService.getListTxMultiCondition(payload).subscribe( (res) => { if (res) { this.nextKey = null; diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts index c9f3e1a5a..da012a664 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.ts @@ -139,7 +139,7 @@ export class TokenTransfersTabComponent implements OnInit, AfterViewInit { } } - this.transactionService.getListTx(payload).subscribe( + this.transactionService.getListTxMultiCondition(payload).subscribe( (res) => { if (res) { this.nextKey = null; From 769b408e144901472c23fb2eae207a286aa33341 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 1 Jun 2023 16:14:54 +0700 Subject: [PATCH 034/315] [TamTM6] update transaction service multi search --- src/app/core/services/transaction.service.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 08479a642..6c5db8f74 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -160,6 +160,12 @@ export class TransactionService extends CommonService { $compositeKey2: String = null $value2: String = null $key2: String = null + $compositeKeyIn: [String!] = null + $valueIn: [String!] = null + $keyIn: [String!] = null + $compositeKeyIn2: [String!] = null + $valueIn2: [String!] = null + $keyIn2: [String!] = null $heightGT: Int = null $heightLT: Int = null $indexGT: Int = null @@ -174,9 +180,9 @@ export class TransactionService extends CommonService { hash: { _eq: $hash } height: { _eq: $height } event_attribute_index: { - value: { _eq: $value } - composite_key: { _eq: $compositeKey } - key: { _eq: $key } + value: { _eq: $value, _in: $valueIn } + composite_key: { _eq: $compositeKey, _in: $compositeKeyIn } + key: { _eq: $key, _in: $keyIn } } _and: [ { height: { _gt: $heightGT } } @@ -185,9 +191,9 @@ export class TransactionService extends CommonService { { index: { _lt: $indexLT } } { event_attribute_index: { - value: { _eq: $value2 } - composite_key: { _eq: $compositeKey2 } - key: { _eq: $key2 } + value: { _eq: $value2, _in: $valueIn2 } + composite_key: { _eq: $compositeKey2, _in: $compositeKeyIn2 } + key: { _eq: $key2, _in: $keyIn2 } } } ] From 4298ffbbc669b7c38038f4c097b8efb404f9d813 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 2 Jun 2023 09:57:27 +0700 Subject: [PATCH 035/315] [TamTM6] update proposal get data v2 --- .../summary-info/summary-info.component.ts | 2 +- .../proposal-detail/votes/votes.component.ts | 19 +++++++++---------- .../proposal-vote/proposal-vote.component.ts | 6 +----- src/app/pages/proposal/proposal.component.ts | 4 ++-- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index a51df7337..ebb0a9fdb 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -197,7 +197,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { makeProposalDataDetail(data) { let pro_votes_yes = balanceOf(+data.tally.yes); let pro_votes_no = balanceOf(+data.tally.no); - let pro_votes_no_with_veto = balanceOf(+data.tally.no_with_veto); + let pro_votes_no_with_veto = balanceOf(+(data.tally.no_with_veto || data.tally.noWithVeto)); let pro_votes_abstain = balanceOf(+data.tally.abstain); const pro_total_vote = pro_votes_yes + pro_votes_no + pro_votes_no_with_veto + pro_votes_abstain; const dataDetail = this.proposalDetail || data; diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index 29c11274d..3b6495008 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -102,7 +102,6 @@ export class VotesComponent implements OnChanges { .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), ]).subscribe((res) => { - this.voteDataListLoading = true; res[0] && ((dta) => (this.voteData.all = dta))(res[0]); res[1] && ((dta) => (this.voteData.yes = dta))(res[1]); res[2] && ((dta) => (this.voteData.no = dta))(res[2]); @@ -111,21 +110,21 @@ export class VotesComponent implements OnChanges { let voteData: any[]; if (this.voteData?.all && !this.countCurrent) { - voteData = [...this.voteData?.all.votes]; + voteData = [...this.voteData?.all?.votes]; this.voteDataList = [...voteData]; } const countAll = - +this.proposalDetail.count_vote.yes + - +this.proposalDetail.count_vote.abstain + - +this.proposalDetail.count_vote.no + - +this.proposalDetail.count_vote.no_with_veto; + +this.proposalDetail.count_vote?.yes + + +this.proposalDetail.count_vote?.abstain + + +this.proposalDetail.count_vote?.no + + +this.proposalDetail.count_vote?.no_with_veto; this.countVote.set('', countAll); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_YES, this.proposalDetail.count_vote.yes); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_ABSTAIN, this.proposalDetail.count_vote.abstain); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO, this.proposalDetail.count_vote.no); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, this.proposalDetail.count_vote.no_with_veto); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_YES, this.proposalDetail.count_vote?.yes); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_ABSTAIN, this.proposalDetail.count_vote?.abstain); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO, this.proposalDetail.count_vote?.no); + this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, this.proposalDetail.count_vote?.no_with_veto); this.voteDataListLoading = false; this.changeTab(this.countCurrent); diff --git a/src/app/pages/proposal/proposal-vote/proposal-vote.component.ts b/src/app/pages/proposal/proposal-vote/proposal-vote.component.ts index 57bb78c48..30916fb9a 100644 --- a/src/app/pages/proposal/proposal-vote/proposal-vote.component.ts +++ b/src/app/pages/proposal/proposal-vote/proposal-vote.component.ts @@ -1,14 +1,11 @@ import { Component, Inject, OnInit } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { TIME_OUT_CALL_API } from 'src/app/core/constants/common.constant'; -import { TYPE_CODE_SPACE } from 'src/app/core/constants/messages.constant'; -import { CodeTransaction } from 'src/app/core/constants/transaction.enum'; import { ESigningType, SIGNING_MESSAGE_TYPES } from 'src/app/core/constants/wallet.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { IVotingDialog } from 'src/app/core/models/proposal.model'; import { MappingErrorService } from 'src/app/core/services/mapping-error.service'; import { NgxToastrService } from 'src/app/core/services/ngx-toastr.service'; -import { TransactionService } from 'src/app/core/services/transaction.service'; import { WalletService } from 'src/app/core/services/wallet.service'; @Component({ @@ -28,7 +25,6 @@ export class ProposalVoteComponent implements OnInit { private environmentService: EnvironmentService, private toastr: NgxToastrService, private walletService: WalletService, - private transactionService: TransactionService, private mappingErrorService: MappingErrorService, ) { this.keyVote = data.voteValue ?? null; diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index f4b22e77e..a5f8c660f 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -95,10 +95,10 @@ export class ProposalComponent implements OnInit { if (pro?.tally) { const { yes, no, no_with_veto, abstain } = pro?.tally; let totalVote = +yes + +no + +no_with_veto + +abstain; - if (this.proposalData[index].tally) { + if (this.proposalData[index].tally && totalVote > 0) { this.proposalData[index].tally.yes = (+yes * 100) / totalVote; this.proposalData[index].tally.no = (+no * 100) / totalVote; - this.proposalData[index].tally.noWithVeto = (+no_with_veto * 100) / totalVote; + this.proposalData[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; this.proposalData[index].tally.abstain = (+abstain * 100) / totalVote; } } From cc3e9732dc9871a205a50003e2a74d7dcb22de2c Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 2 Jun 2023 10:47:31 +0700 Subject: [PATCH 036/315] [TamTM6] update proposal get data v2 --- .../proposal-detail/summary-info/summary-info.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index ebb0a9fdb..6d3e70f99 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -227,7 +227,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { this.isNotReached = false; this.quorumStatus = VOTING_QUORUM.REACHED; - if (proposalDetail.currentYesPercent > proposalDetail.threshold) { + if ((currentYesPercent || proposalDetail.currentYesPercent) > proposalDetail.threshold) { if (proposalDetail.noWithVetoPercent < proposalDetail.veto_threshold) { // case pass this.currentStatus = VOTING_STATUS.PROPOSAL_STATUS_PASSED; From 6082084d88ed336fe918b31a38afc09efab80896 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Fri, 2 Jun 2023 17:12:52 +0700 Subject: [PATCH 037/315] add table proposal --- src/app/core/services/proposal.service.ts | 5 +- .../community-pool.component.html | 159 ++++++++++++++++++ .../community-pool.component.ts | 69 ++++++++ .../community-pool/community-pool.module.ts | 2 + 4 files changed, 233 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 8112a2272..be202377a 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -85,9 +85,9 @@ export class ProposalService extends CommonService { getProposalData(payload) { const operationsDoc = ` - query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null) { + query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $type: String = null) { ${this.envDB} { - proposal(limit: $limit, where: {proposal_id: {_eq: $proposalId, _lt: $nextKey}}, order_by: {proposal_id: $order}) { + proposal(limit: $limit, where: {proposal_id: {_eq: $proposalId, _lt: $nextKey}, type: {_eq: $type}}, order_by: {proposal_id: $order}) { content deposit_end_time description @@ -122,6 +122,7 @@ export class ProposalService extends CommonService { order: 'desc', nextKey: payload.nextKey, proposalId: payload.proposalId, + type: payload.type }, operationName: 'auratestnet_proposal', }) diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html index 03acc488a..4f7547911 100644 --- a/src/app/pages/community-pool/community-pool.component.html +++ b/src/app/pages/community-pool/community-pool.component.html @@ -110,4 +110,163 @@

Asset

- + + +
+
+
+

Community Pool Spent Proposals

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#ID#{{ element.proposal_id }}Title + {{ element.content.title }} + Status +
+ {{ getStatus(element.status).value }} +
+
Sender + + {{ shortenAddress(element.content.recipient) || '-' }} + + Receipient + + {{ shortenAddress(element.content.recipient) || '-' }} + + Amount + + {{ denom }} + Voting End +
+ {{ element.submit_time | customDate : 'yyyy-MM-dd' }} +
+ {{ element.submit_time | customDate : 'HH:mm:ss' }} +
+
+ {{ 'NO DATA' | translate }} +
+ + +
+
+
+ +
+
+ +
+
+

Proposals

+
+
+ +
+ + +
+ +
+
+
+

diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts index be0250ae0..06fe8a399 100644 --- a/src/app/pages/community-pool/community-pool.component.ts +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -7,11 +7,14 @@ import * as _ from 'lodash'; import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { NUMBER_CONVERT, PAGE_EVENT } from 'src/app/core/constants/common.constant'; +import { PROPOSAL_STATUS } from 'src/app/core/constants/proposal.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; +import { ProposalService } from 'src/app/core/services/proposal.service'; import { TokenService } from 'src/app/core/services/token.service'; import { balanceOf } from 'src/app/core/utils/common/parsing'; +import { shortenAddress } from 'src/app/core/utils/common/shorten'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; @Component({ @@ -28,7 +31,18 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { { matColumnDef: 'symbol', headerCellDef: 'symbol' }, { matColumnDef: 'amount', headerCellDef: 'amount' }, ]; + + templatesProposal: Array = [ + { matColumnDef: 'id', headerCellDef: 'ID' }, + { matColumnDef: 'title', headerCellDef: 'Title' }, + { matColumnDef: 'status', headerCellDef: 'Status' }, + { matColumnDef: 'sender', headerCellDef: 'Sender' }, + { matColumnDef: 'receipient', headerCellDef: 'receipient' }, + { matColumnDef: 'amount', headerCellDef: 'Amount' }, + { matColumnDef: 'voting_end_time', headerCellDef: 'Voting End' }, + ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); + displayedColumnsProposal: string[] = this.templatesProposal.map((dta) => dta.matColumnDef); pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 10, @@ -47,12 +61,18 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { listAssetLcd = []; searchSubject = new Subject(); destroy$ = new Subject(); + statusConstant = PROPOSAL_STATUS; + length: number; + nextKey = null; + dataSourceProposalMobile: any[]; + dataSourceProposal: MatTableDataSource; constructor( public translate: TranslateService, public tokenService: TokenService, private environmentService: EnvironmentService, private layout: BreakpointObserver, + private proposalService: ProposalService, ) {} ngOnDestroy(): void { @@ -63,6 +83,8 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { ngOnInit(): void { this.getListAsset(); + this.getListProposal(); + this.searchSubject .asObservable() .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) @@ -79,6 +101,13 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { this.searchSubject.next(this.textSearch); } + shortenAddress(address: string): string { + if (address) { + return shortenAddress(address, 8); + } + return ''; + } + async getListAsset() { let auraAsset; if (this.textSearch) { @@ -162,4 +191,44 @@ export class CommunityPoolComponent implements OnInit, OnDestroy { this.pageData.pageIndex = e.pageIndex; this.getListAsset(); } + + getStatus(key: string) { + let resObj: { value: string; class: string; key: string } = null; + const statusObj = this.statusConstant.find((s) => s.key === key); + if (statusObj !== undefined) { + resObj = { + value: statusObj.value, + class: statusObj.class, + key: statusObj.key, + }; + } + return resObj; + } + + getListProposal(nextKey = null) { + let payload = { + limit: 40, + nextKey: nextKey, + type: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + }; + this.proposalService.getProposalData(payload).subscribe((res) => { + this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; + if (res?.proposal) { + let tempDta = res.proposal; + tempDta.forEach((pro) => { + pro.total_deposit[0].amount = balanceOf(pro.total_deposit[0].amount); + }); + if (this.dataSourceProposal?.data?.length > 0) { + this.dataSourceProposal.data = [...this.dataSourceProposal.data, ...tempDta]; + } else { + this.dataSourceProposal = new MatTableDataSource(tempDta); + } + } + this.dataSourceProposalMobile = this.dataSourceProposal.data.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); + this.length = this.dataSourceProposal.data.length; + }); + } } diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts index 44d155144..57e7d9a2a 100644 --- a/src/app/pages/community-pool/community-pool.module.ts +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -11,6 +11,7 @@ import { TableNoDataModule } from '../../../app/shared/components/table-no-data/ import { SharedModule } from '../../../app/shared/shared.module'; import { CommunityPoolRoutingModule } from './community-pool-routing.module'; import { CommunityPoolComponent } from './community-pool.component'; +import { ProposalService } from 'src/app/core/services/proposal.service'; @NgModule({ declarations: [CommunityPoolComponent], @@ -27,5 +28,6 @@ import { CommunityPoolComponent } from './community-pool.component'; NgxMaskModule, CommonDirectiveModule, ], + providers: [ProposalService], }) export class CommunityPoolModule {} From baff0c48c81ab8932a978a10f697f9d733fc5558 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 5 Jun 2023 12:07:41 +0700 Subject: [PATCH 038/315] add table proposal --- .../community-pool-asset.component.html | 112 +++++++ .../community-pool-asset.component.scss | 31 ++ .../community-pool-asset.component.ts | 177 ++++++++++++ .../community-pool.component.html | 273 +----------------- .../community-pool.component.scss | 27 +- .../community-pool.component.ts | 230 +-------------- .../community-pool/community-pool.module.ts | 6 +- .../community-pool-proposal.component.html | 184 ++++++++++++ .../community-pool-proposal.component.scss | 35 +++ .../community-pool-proposal.component.ts | 154 ++++++++++ 10 files changed, 726 insertions(+), 503 deletions(-) create mode 100644 src/app/pages/community-pool/asset-list/community-pool-asset.component.html create mode 100644 src/app/pages/community-pool/asset-list/community-pool-asset.component.scss create mode 100644 src/app/pages/community-pool/asset-list/community-pool-asset.component.ts create mode 100644 src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html create mode 100644 src/app/pages/community-pool/proposal-list/community-pool-proposal.component.scss create mode 100644 src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts diff --git a/src/app/pages/community-pool/asset-list/community-pool-asset.component.html b/src/app/pages/community-pool/asset-list/community-pool-asset.component.html new file mode 100644 index 000000000..892746d04 --- /dev/null +++ b/src/app/pages/community-pool/asset-list/community-pool-asset.component.html @@ -0,0 +1,112 @@ +
+ +
+
+ +
+

Asset

+
+
+ + + +
+
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Name +
+ +
{{ element.name }}
+
+
Symbol + {{ element.symbol ? element.symbol : 'AURA' }} + Amount + + +
+ {{ 'NO DATA' | translate }} +
+
+ + +
+ + + + + + + + + + + + + +
+
+
+ - +
diff --git a/src/app/pages/community-pool/asset-list/community-pool-asset.component.scss b/src/app/pages/community-pool/asset-list/community-pool-asset.component.scss new file mode 100644 index 000000000..89810f31a --- /dev/null +++ b/src/app/pages/community-pool/asset-list/community-pool-asset.component.scss @@ -0,0 +1,31 @@ +.search-form { + min-width: 100%; + + @media (min-width: 992px) { + min-width: 410px; + } +} + +.vertical-align-top { + vertical-align: top; +} + +.proposal-title { + max-width: 370px; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(3), +.aura-table.proposal-table th.mat-header-cell:nth-child(4), +.aura-table.proposal-table th.mat-header-cell:nth-child(5), +.aura-table.proposal-table th.mat-header-cell:nth-child(6), +.aura-table.proposal-table th.mat-header-cell:nth-child(7) { + width: 7%; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(1) { + width: 4%; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(2) { + width: 20%; +} \ No newline at end of file diff --git a/src/app/pages/community-pool/asset-list/community-pool-asset.component.ts b/src/app/pages/community-pool/asset-list/community-pool-asset.component.ts new file mode 100644 index 000000000..b806bef6a --- /dev/null +++ b/src/app/pages/community-pool/asset-list/community-pool-asset.component.ts @@ -0,0 +1,177 @@ +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; +import { TranslateService } from '@ngx-translate/core'; +import * as _ from 'lodash'; +import { Subject } from 'rxjs'; +import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; +import { NUMBER_CONVERT, PAGE_EVENT } from 'src/app/core/constants/common.constant'; +import { PROPOSAL_STATUS } from 'src/app/core/constants/proposal.constant'; +import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; +import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { TableTemplate } from 'src/app/core/models/common.model'; +import { TokenService } from 'src/app/core/services/token.service'; +import { balanceOf } from 'src/app/core/utils/common/parsing'; +import { shortenAddress } from 'src/app/core/utils/common/shorten'; +import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; + +@Component({ + selector: 'app-community-pool-asset', + templateUrl: './community-pool-asset.component.html', + styleUrls: ['./community-pool-asset.component.scss'], +}) +export class CommunityPoolAssetComponent implements OnInit, OnDestroy { + @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; + @ViewChild(MatPaginator) paginator: MatPaginator; + textSearch = ''; + templates: Array = [ + { matColumnDef: 'name', headerCellDef: 'name' }, + { matColumnDef: 'symbol', headerCellDef: 'symbol' }, + { matColumnDef: 'amount', headerCellDef: 'amount' }, + ]; + + displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); + pageData: PageEvent = { + length: PAGE_EVENT.LENGTH, + pageSize: 10, + pageIndex: PAGE_EVENT.PAGE_INDEX, + }; + pageSizeMob = 5; + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); + dataSource: MatTableDataSource; + dataSourceMob: any[]; + filterSearchData = []; + maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; + denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; + image_s3 = this.environmentService.configValue.image_s3; + defaultLogoToken = this.image_s3 + 'images/icons/token-logo.png'; + listCoin = this.environmentService.configValue.coins; + listAssetLcd = []; + searchSubject = new Subject(); + destroy$ = new Subject(); + statusConstant = PROPOSAL_STATUS; + + constructor( + public translate: TranslateService, + public tokenService: TokenService, + private environmentService: EnvironmentService, + private layout: BreakpointObserver, + ) {} + + ngOnDestroy(): void { + // throw new Error('Method not implemented.'); + this.destroy$.next(); + this.destroy$.complete(); + } + + ngOnInit(): void { + this.getListAsset(); + + this.searchSubject + .asObservable() + .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + .subscribe(() => { + if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { + this.getListAsset(); + } else { + this.pageChange.selectPage(0); + } + }); + } + + onKeyUp() { + this.searchSubject.next(this.textSearch); + } + + shortenAddress(address: string): string { + if (address) { + return shortenAddress(address, 8); + } + return ''; + } + + async getListAsset() { + let auraAsset; + if (this.textSearch) { + this.filterSearchData = this.listAssetLcd; + this.filterSearchData = this.filterSearchData.filter( + (k) => + k.name.toLowerCase().includes(this.textSearch.toLowerCase()) === true || + k.symbol.toLowerCase().includes(this.textSearch.toLowerCase()) === true, + ); + this.dataSource.data = this.filterSearchData.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); + this.dataSourceMob = this.filterSearchData.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, + ); + this.pageData.length = this.filterSearchData.length; + } else { + const res = await this.tokenService.getListAssetCommunityPool(); + this.listAssetLcd = _.get(res, 'data.pool'); + + this.listAssetLcd.forEach((element) => { + let findItem = this.listCoin.find((i) => i.denom === element.denom); + if (findItem) { + element.decimal = findItem.decimal; + element.symbol = findItem.display; + element.logo = findItem.logo; + element.name = findItem.name; + } else { + element.decimal = 6; + element.symbol = ''; + element.logo = ''; + element.name = 'Aura'; + element.amount = element.amount / NUMBER_CONVERT; + auraAsset = element; + } + }); + this.listAssetLcd = this.listAssetLcd.filter((k) => k.symbol !== ''); + this.listAssetLcd = this.listAssetLcd.sort((a, b) => { + return this.compare(balanceOf(a.amount, a.decimal), balanceOf(b.amount, b.decimal), false); + }); + this.listAssetLcd.unshift(auraAsset); + this.filterSearchData = this.listAssetLcd; + if (!this.dataSource) { + this.dataSource = new MatTableDataSource(this.listAssetLcd); + this.dataSourceMob = this.listAssetLcd.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, + ); + } else { + this.dataSource.data = this.listAssetLcd; + this.dataSourceMob = this.listAssetLcd.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, + ); + } + this.pageData.length = this.listAssetLcd.length; + } + } + + paginatorEmit(event): void { + if (this.dataSource) { + this.dataSource.paginator = event; + } else { + this.dataSource = new MatTableDataSource(); + this.dataSource.paginator = event; + } + } + + compare(a: number | string, b: number | string, isAsc: boolean) { + return (a < b ? -1 : 1) * (isAsc ? 1 : -1); + } + + resetSearch() { + this.textSearch = ''; + this.onKeyUp(); + } + + pageEvent(e: PageEvent): void { + this.pageData.pageIndex = e.pageIndex; + this.getListAsset(); + } +} diff --git a/src/app/pages/community-pool/community-pool.component.html b/src/app/pages/community-pool/community-pool.component.html index 4f7547911..6b4f37bd7 100644 --- a/src/app/pages/community-pool/community-pool.component.html +++ b/src/app/pages/community-pool/community-pool.component.html @@ -1,272 +1,3 @@

Community Pool Details

-
- -
-
- -
-

Asset

-
-
- - - -
-
-
-
- - -
- - - - - - - - - - - - - - - - - - - - - - - - -
Name -
- -
{{ element.name }}
-
-
Symbol - {{ element.symbol ? element.symbol : 'AURA' }} - Amount - - -
- {{ 'NO DATA' | translate }} -
-
- - -
- - - - - - - - - - - - - -
-
-
- - - - -
-
-
-

Community Pool Spent Proposals

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#ID#{{ element.proposal_id }}Title - {{ element.content.title }} - Status -
- {{ getStatus(element.status).value }} -
-
Sender - - {{ shortenAddress(element.content.recipient) || '-' }} - - Receipient - - {{ shortenAddress(element.content.recipient) || '-' }} - - Amount - - {{ denom }} - Voting End -
- {{ element.submit_time | customDate : 'yyyy-MM-dd' }} -
- {{ element.submit_time | customDate : 'HH:mm:ss' }} -
-
- {{ 'NO DATA' | translate }} -
- - -
-
-
- -
-
- -
-
-

Proposals

-
-
- -
- - -
- -
-
-
-
-
+ + diff --git a/src/app/pages/community-pool/community-pool.component.scss b/src/app/pages/community-pool/community-pool.component.scss index 3daeda372..3a77b9e22 100644 --- a/src/app/pages/community-pool/community-pool.component.scss +++ b/src/app/pages/community-pool/community-pool.component.scss @@ -1,16 +1,35 @@ .search-form { min-width: 100%; + @media (min-width: 992px) { min-width: 410px; } } -@media (min-width: 991.99px) { - ::ng-deep table.aura-table th.mat-header-cell { - width: 33%; - } +.aura-table.assets-table th.mat-header-cell { + width: 33%; } .vertical-align-top { vertical-align: top; +} + +.proposal-title { + max-width: 370px; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(3), +.aura-table.proposal-table th.mat-header-cell:nth-child(4), +.aura-table.proposal-table th.mat-header-cell:nth-child(5), +.aura-table.proposal-table th.mat-header-cell:nth-child(6), +.aura-table.proposal-table th.mat-header-cell:nth-child(7) { + width: 7%; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(1) { + width: 4%; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(2) { + width: 20%; } \ No newline at end of file diff --git a/src/app/pages/community-pool/community-pool.component.ts b/src/app/pages/community-pool/community-pool.component.ts index 06fe8a399..3ef0213e6 100644 --- a/src/app/pages/community-pool/community-pool.component.ts +++ b/src/app/pages/community-pool/community-pool.component.ts @@ -1,234 +1,12 @@ -import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; -import { MatTableDataSource } from '@angular/material/table'; -import { TranslateService } from '@ngx-translate/core'; -import * as _ from 'lodash'; -import { Subject } from 'rxjs'; -import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; -import { NUMBER_CONVERT, PAGE_EVENT } from 'src/app/core/constants/common.constant'; -import { PROPOSAL_STATUS } from 'src/app/core/constants/proposal.constant'; -import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; -import { EnvironmentService } from 'src/app/core/data-services/environment.service'; -import { TableTemplate } from 'src/app/core/models/common.model'; -import { ProposalService } from 'src/app/core/services/proposal.service'; -import { TokenService } from 'src/app/core/services/token.service'; -import { balanceOf } from 'src/app/core/utils/common/parsing'; -import { shortenAddress } from 'src/app/core/utils/common/shorten'; -import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; +import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-community-pool', templateUrl: './community-pool.component.html', styleUrls: ['./community-pool.component.scss'], }) -export class CommunityPoolComponent implements OnInit, OnDestroy { - @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; - @ViewChild(MatPaginator) paginator: MatPaginator; - textSearch = ''; - templates: Array = [ - { matColumnDef: 'name', headerCellDef: 'name' }, - { matColumnDef: 'symbol', headerCellDef: 'symbol' }, - { matColumnDef: 'amount', headerCellDef: 'amount' }, - ]; +export class CommunityPoolComponent implements OnInit { + constructor() {} - templatesProposal: Array = [ - { matColumnDef: 'id', headerCellDef: 'ID' }, - { matColumnDef: 'title', headerCellDef: 'Title' }, - { matColumnDef: 'status', headerCellDef: 'Status' }, - { matColumnDef: 'sender', headerCellDef: 'Sender' }, - { matColumnDef: 'receipient', headerCellDef: 'receipient' }, - { matColumnDef: 'amount', headerCellDef: 'Amount' }, - { matColumnDef: 'voting_end_time', headerCellDef: 'Voting End' }, - ]; - displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); - displayedColumnsProposal: string[] = this.templatesProposal.map((dta) => dta.matColumnDef); - pageData: PageEvent = { - length: PAGE_EVENT.LENGTH, - pageSize: 10, - pageIndex: PAGE_EVENT.PAGE_INDEX, - }; - pageSizeMob = 5; - breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); - dataSource: MatTableDataSource; - dataSourceMob: any[]; - filterSearchData = []; - maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; - denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; - image_s3 = this.environmentService.configValue.image_s3; - defaultLogoToken = this.image_s3 + 'images/icons/token-logo.png'; - listCoin = this.environmentService.configValue.coins; - listAssetLcd = []; - searchSubject = new Subject(); - destroy$ = new Subject(); - statusConstant = PROPOSAL_STATUS; - length: number; - nextKey = null; - dataSourceProposalMobile: any[]; - dataSourceProposal: MatTableDataSource; - - constructor( - public translate: TranslateService, - public tokenService: TokenService, - private environmentService: EnvironmentService, - private layout: BreakpointObserver, - private proposalService: ProposalService, - ) {} - - ngOnDestroy(): void { - // throw new Error('Method not implemented.'); - this.destroy$.next(); - this.destroy$.complete(); - } - - ngOnInit(): void { - this.getListAsset(); - this.getListProposal(); - - this.searchSubject - .asObservable() - .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) - .subscribe(() => { - if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { - this.getListAsset(); - } else { - this.pageChange.selectPage(0); - } - }); - } - - onKeyUp() { - this.searchSubject.next(this.textSearch); - } - - shortenAddress(address: string): string { - if (address) { - return shortenAddress(address, 8); - } - return ''; - } - - async getListAsset() { - let auraAsset; - if (this.textSearch) { - this.filterSearchData = this.listAssetLcd; - this.filterSearchData = this.filterSearchData.filter( - (k) => - k.name.toLowerCase().includes(this.textSearch.toLowerCase()) === true || - k.symbol.toLowerCase().includes(this.textSearch.toLowerCase()) === true, - ); - this.dataSource.data = this.filterSearchData.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ); - this.dataSourceMob = this.filterSearchData.slice( - this.pageData.pageIndex * this.pageSizeMob, - this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, - ); - this.pageData.length = this.filterSearchData.length; - } else { - const res = await this.tokenService.getListAssetCommunityPool(); - this.listAssetLcd = _.get(res, 'data.pool'); - - this.listAssetLcd.forEach((element) => { - let findItem = this.listCoin.find((i) => i.denom === element.denom); - if (findItem) { - element.decimal = findItem.decimal; - element.symbol = findItem.display; - element.logo = findItem.logo; - element.name = findItem.name; - } else { - element.decimal = 6; - element.symbol = ''; - element.logo = ''; - element.name = 'Aura'; - element.amount = element.amount / NUMBER_CONVERT; - auraAsset = element; - } - }); - this.listAssetLcd = this.listAssetLcd.filter((k) => k.symbol !== ''); - this.listAssetLcd = this.listAssetLcd.sort((a, b) => { - return this.compare(balanceOf(a.amount, a.decimal), balanceOf(b.amount, b.decimal), false); - }); - this.listAssetLcd.unshift(auraAsset); - this.filterSearchData = this.listAssetLcd; - if (!this.dataSource) { - this.dataSource = new MatTableDataSource(this.listAssetLcd); - this.dataSourceMob = this.listAssetLcd.slice( - this.pageData.pageIndex * this.pageSizeMob, - this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, - ); - } else { - this.dataSource.data = this.listAssetLcd; - this.dataSourceMob = this.listAssetLcd.slice( - this.pageData.pageIndex * this.pageSizeMob, - this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, - ); - } - this.pageData.length = this.listAssetLcd.length; - } - } - - paginatorEmit(event): void { - if (this.dataSource) { - this.dataSource.paginator = event; - } else { - this.dataSource = new MatTableDataSource(); - this.dataSource.paginator = event; - } - } - - compare(a: number | string, b: number | string, isAsc: boolean) { - return (a < b ? -1 : 1) * (isAsc ? 1 : -1); - } - - resetSearch() { - this.textSearch = ''; - this.onKeyUp(); - } - - pageEvent(e: PageEvent): void { - this.pageData.pageIndex = e.pageIndex; - this.getListAsset(); - } - - getStatus(key: string) { - let resObj: { value: string; class: string; key: string } = null; - const statusObj = this.statusConstant.find((s) => s.key === key); - if (statusObj !== undefined) { - resObj = { - value: statusObj.value, - class: statusObj.class, - key: statusObj.key, - }; - } - return resObj; - } - - getListProposal(nextKey = null) { - let payload = { - limit: 40, - nextKey: nextKey, - type: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", - }; - this.proposalService.getProposalData(payload).subscribe((res) => { - this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; - if (res?.proposal) { - let tempDta = res.proposal; - tempDta.forEach((pro) => { - pro.total_deposit[0].amount = balanceOf(pro.total_deposit[0].amount); - }); - if (this.dataSourceProposal?.data?.length > 0) { - this.dataSourceProposal.data = [...this.dataSourceProposal.data, ...tempDta]; - } else { - this.dataSourceProposal = new MatTableDataSource(tempDta); - } - } - this.dataSourceProposalMobile = this.dataSourceProposal.data.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ); - this.length = this.dataSourceProposal.data.length; - }); - } + ngOnInit(): void {} } diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts index 57e7d9a2a..9547dbc12 100644 --- a/src/app/pages/community-pool/community-pool.module.ts +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -6,15 +6,17 @@ import { TranslateModule } from '@ngx-translate/core'; import { NgxMaskModule } from 'ngx-mask'; import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; +import { ProposalService } from 'src/app/core/services/proposal.service'; import { PaginatorModule } from '../../../app/shared/components/paginator/paginator.module'; import { TableNoDataModule } from '../../../app/shared/components/table-no-data/table-no-data.module'; import { SharedModule } from '../../../app/shared/shared.module'; +import { CommunityPoolAssetComponent } from './asset-list/community-pool-asset.component'; import { CommunityPoolRoutingModule } from './community-pool-routing.module'; +import { CommunityPoolProposalComponent } from './proposal-list/community-pool-proposal.component'; import { CommunityPoolComponent } from './community-pool.component'; -import { ProposalService } from 'src/app/core/services/proposal.service'; @NgModule({ - declarations: [CommunityPoolComponent], + declarations: [CommunityPoolAssetComponent, CommunityPoolProposalComponent, CommunityPoolComponent], imports: [ CommunityPoolRoutingModule, CommonModule, diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html new file mode 100644 index 000000000..4c3f982b1 --- /dev/null +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -0,0 +1,184 @@ +
+ +
+
+
+

Community Pool Spent Proposals

+
+
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#ID#{{ element.proposal_id }}Title + {{ element.content.title }} + Status +
+ {{ getStatus(element.status).value }} +
+
Sender + + {{ shortenAddress(element.content.recipient) || '-' }} + + Receipient + + {{ shortenAddress(element.content.recipient) || '-' }} + + Amount + + {{ denom }} + Voting End +
+ {{ element.submit_time | customDate : 'yyyy-MM-dd' }} +
+ {{ element.submit_time | customDate : 'HH:mm:ss' }} +
+
+ {{ 'NO DATA' | translate }} +
+ + +
+
+
+ +
+
+ +
+
+

Proposals

+
+
+ +
+ + +
+ +
+
+
+
+
diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.scss b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.scss new file mode 100644 index 000000000..3a77b9e22 --- /dev/null +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.scss @@ -0,0 +1,35 @@ +.search-form { + min-width: 100%; + + @media (min-width: 992px) { + min-width: 410px; + } +} + +.aura-table.assets-table th.mat-header-cell { + width: 33%; +} + +.vertical-align-top { + vertical-align: top; +} + +.proposal-title { + max-width: 370px; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(3), +.aura-table.proposal-table th.mat-header-cell:nth-child(4), +.aura-table.proposal-table th.mat-header-cell:nth-child(5), +.aura-table.proposal-table th.mat-header-cell:nth-child(6), +.aura-table.proposal-table th.mat-header-cell:nth-child(7) { + width: 7%; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(1) { + width: 4%; +} + +.aura-table.proposal-table th.mat-header-cell:nth-child(2) { + width: 20%; +} \ No newline at end of file diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts new file mode 100644 index 000000000..ad1a1a706 --- /dev/null +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -0,0 +1,154 @@ +import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; +import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { MatTableDataSource } from '@angular/material/table'; +import { TranslateService } from '@ngx-translate/core'; +import { Subject } from 'rxjs'; +import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; +import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; +import { PROPOSAL_STATUS } from 'src/app/core/constants/proposal.constant'; +import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; +import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { TableTemplate } from 'src/app/core/models/common.model'; +import { ProposalService } from 'src/app/core/services/proposal.service'; +import { TokenService } from 'src/app/core/services/token.service'; +import { shortenAddress } from 'src/app/core/utils/common/shorten'; +import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; + +@Component({ + selector: 'app-community-pool-proposal', + templateUrl: './community-pool-proposal.component.html', + styleUrls: ['./community-pool-proposal.component.scss'], +}) +export class CommunityPoolProposalComponent implements OnInit, OnDestroy { + @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; + @ViewChild(MatPaginator) paginator: MatPaginator; + textSearch = ''; + + templates: Array = [ + { matColumnDef: 'id', headerCellDef: 'ID' }, + { matColumnDef: 'title', headerCellDef: 'Title' }, + { matColumnDef: 'status', headerCellDef: 'Status' }, + { matColumnDef: 'sender', headerCellDef: 'Sender' }, + { matColumnDef: 'receipient', headerCellDef: 'receipient' }, + { matColumnDef: 'amount', headerCellDef: 'Amount' }, + { matColumnDef: 'voting_end_time', headerCellDef: 'Voting End' }, + ]; + displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); + pageData: PageEvent = { + length: PAGE_EVENT.LENGTH, + pageSize: 10, + pageIndex: PAGE_EVENT.PAGE_INDEX, + }; + pageSizeMob = 5; + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); + dataSource: MatTableDataSource; + dataSourceMob: any[]; + filterSearchData = []; + maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; + denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; + listCoin = this.environmentService.configValue.coins; + listAssetLcd = []; + searchSubject = new Subject(); + destroy$ = new Subject(); + statusConstant = PROPOSAL_STATUS; + nextKey = null; + + constructor( + public translate: TranslateService, + public tokenService: TokenService, + private environmentService: EnvironmentService, + private layout: BreakpointObserver, + private proposalService: ProposalService, + ) {} + + ngOnDestroy(): void { + // throw new Error('Method not implemented.'); + this.destroy$.next(); + this.destroy$.complete(); + } + + ngOnInit(): void { + this.getListProposal(); + + this.searchSubject + .asObservable() + .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + .subscribe(() => { + if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { + this.getListProposal(); + } else { + this.pageChange.selectPage(0); + } + }); + } + + onKeyUp() { + this.searchSubject.next(this.textSearch); + } + + shortenAddress(address: string): string { + if (address) { + return shortenAddress(address, 8); + } + return ''; + } + + paginatorEmit(event): void { + if (this.dataSource) { + this.dataSource.paginator = event; + } else { + this.dataSource = new MatTableDataSource(); + this.dataSource.paginator = event; + } + } + + resetSearch() { + this.textSearch = ''; + this.onKeyUp(); + } + + pageEvent(e: PageEvent): void { + this.pageData.pageIndex = e.pageIndex; + if (this.pageData.length <= this.pageData.pageSize * (this.pageData.pageIndex + 1)) { + this.getListProposal(); + } + } + + getStatus(key: string) { + let resObj: { value: string; class: string; key: string } = null; + const statusObj = this.statusConstant.find((s) => s.key === key); + if (statusObj !== undefined) { + resObj = { + value: statusObj.value, + class: statusObj.class, + key: statusObj.key, + }; + } + return resObj; + } + + getListProposal() { + let payload = { + limit: 40, + nextKey: this.nextKey, + type: '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal', + }; + this.proposalService.getProposalData(payload).subscribe((res) => { + this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; + if (res?.proposal) { + let tempDta = res.proposal; + if (this.dataSource?.data?.length > 0) { + this.dataSource.data = [...this.dataSource.data, ...tempDta]; + } else { + this.dataSource = new MatTableDataSource(tempDta); + } + } + this.dataSourceMob = this.dataSource.data.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); + this.pageData.length = this.dataSource.data.length; + }); + } +} From 650a44da0bec93deb8e4fcca0c39c338b8005661 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 5 Jun 2023 15:56:39 +0700 Subject: [PATCH 039/315] add table proposal --- src/app/core/services/common.service.ts | 8 ++++---- .../proposal-list/community-pool-proposal.component.html | 7 ++++--- .../proposal-list/community-pool-proposal.component.ts | 9 +++++++++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 9d78c3692..514bb7651 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -42,6 +42,10 @@ export class CommonService { return axios.get(`${this.chainInfo.rest}/cosmos/gov/v1beta1/params/tallying`); } + getAccountDistribution() { + return axios.get(`${this.chainInfo.rest}/cosmos/auth/v1beta1/module_accounts/distribution`); + } + getDateValue(time, isCustom = true) { if (time) { try { @@ -72,10 +76,6 @@ export class CommonService { } } - getValidatorImg(identity: string) { - return axios.get(`https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=${identity}&fields=pictures`); - } - mappingNameIBC(value) { let result = {display: value, decimals: 6}; if (value.indexOf('ibc') >= 0) { diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index 4c3f982b1..7a04ed2c6 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -61,8 +61,8 @@

Community Pool Spent Proposals

Sender - - {{ shortenAddress(element.content.recipient) || '-' }} + + {{ shortenAddress(distributionAcc) || '-' }} @@ -143,8 +143,9 @@

Proposals

class: 'aura-status-inline text-capitalize body-02-mob ' + getStatus(data.status).class, info: '' + getStatus(data.status).value + '' }, + { - label: 'Voting Start', + label: 'Sender', class: 'card__date text--gray-1 body-01', info: data.status !== 'PROPOSAL_STATUS_DEPOSIT_PERIOD' diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts index ad1a1a706..828b54664 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -10,6 +10,7 @@ import { PROPOSAL_STATUS } from 'src/app/core/constants/proposal.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; +import { CommonService } from 'src/app/core/services/common.service'; import { ProposalService } from 'src/app/core/services/proposal.service'; import { TokenService } from 'src/app/core/services/token.service'; import { shortenAddress } from 'src/app/core/utils/common/shorten'; @@ -53,6 +54,7 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { destroy$ = new Subject(); statusConstant = PROPOSAL_STATUS; nextKey = null; + distributionAcc = ''; constructor( public translate: TranslateService, @@ -60,6 +62,7 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { private environmentService: EnvironmentService, private layout: BreakpointObserver, private proposalService: ProposalService, + private commonService: CommonService, ) {} ngOnDestroy(): void { @@ -69,6 +72,7 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { } ngOnInit(): void { + this.getAddressDistribution(); this.getListProposal(); this.searchSubject @@ -87,6 +91,11 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { this.searchSubject.next(this.textSearch); } + async getAddressDistribution() { + const res = await this.commonService.getAccountDistribution(); + this.distributionAcc = res.data.account.base_account.address; + } + shortenAddress(address: string): string { if (address) { return shortenAddress(address, 8); From 87c7b730f6b067bcf26f8033e80d486d39fcc077 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Mon, 5 Jun 2023 17:10:33 +0700 Subject: [PATCH 040/315] update Community-pool-proposal create card-mob-explain --- .../community-pool-proposal.component.html | 57 ++++++++++--------- .../community-pool-proposal.component.ts | 1 + .../card-mob-explain.component.html | 26 +++++++++ .../card-mob-explain.component.scss | 36 ++++++++++++ .../card-mob-explain.component.ts | 32 +++++++++++ src/app/shared/shared.module.ts | 8 ++- 6 files changed, 131 insertions(+), 29 deletions(-) create mode 100644 src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html create mode 100644 src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.scss create mode 100644 src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index 7a04ed2c6..1c5dd898a 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -127,48 +127,53 @@

Community Pool Spent Proposals

Proposals

- + ]" + >
+
+
+
+ {{ title.label | stringEllipsis : 20}} + #{{title.subLabel}} +
+
+
+ {{status.value}} +
+
+
+ +
+
+
+
{{data.label}}
+
+
+
+
diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.scss b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.scss new file mode 100644 index 000000000..2abe8bc6e --- /dev/null +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.scss @@ -0,0 +1,36 @@ +.card-mob-explain { + background-color: var(--aura-gray-9); + border-radius: var(--spacer-2); + padding: var(--spacer-4); + padding-bottom: 0; + margin-bottom: var(--spacer-4); + overflow: hidden; + &>* { + color: var(--aura-white); + } + .card__content { + max-height: 0; + &.show { + transition: all .35s ease-in-out; + max-height: 900px; + padding-bottom: var(--spacer-4); + } + &-item { + display: flex; + align-items: center; + justify-content: space-between; + font-weight: 400; + font-size: 1.4rem; + line-height: 1.8rem; + &:not(:last-child){ + margin-bottom: 6px; + } + } + } +} +.button-explain:has(.rotate) { + transform: rotate(180deg); +} +.text-gray-3 { + color: #B4B8C0; +} diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts new file mode 100644 index 000000000..0822d737c --- /dev/null +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts @@ -0,0 +1,32 @@ +import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; + + +export interface CardMobExplainTitle { + label: string; + labelLink: string; + subLabel: string; +} +export interface CardMobContent { + label: string; + class?: string; + info: any; +} +@Component({ + selector: 'app-card-mob-explain', + templateUrl: './card-mob-explain.component.html', + styleUrls: ['./card-mob-explain.component.scss'] +}) + +export class CardMobExplainComponent implements OnInit, OnChanges { + @Input() title: CardMobExplainTitle; + @Input() status: any; + @Input() content: CardMobContent[]; + constructor() { } + + ngOnInit(): void { + } + + ngOnChanges(changes: SimpleChanges): void { + } + +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index d0bfcd365..14404ae27 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -5,10 +5,12 @@ import { CardMobSimpleModule } from './components/cards/card-mob-simple/card-mob import { LoadingSprintComponent } from './components/loading-sprint/loading-sprint.component'; import { PagetitleComponent } from './components/pagetitle/pagetitle.component'; import { SoulboundFeatureTokensModule } from './components/soulbound-feature-tokens/soulbound-feature-tokens.module'; +import { CardMobExplainComponent } from './components/cards/card-mob-explain/card-mob-explain.component'; +import {CommonPipeModule} from "src/app/core/pipes/common-pipe.module"; @NgModule({ - declarations: [PagetitleComponent, LoadingSprintComponent], - imports: [CommonModule, CardMobSimpleModule, SoulboundFeatureTokensModule], - exports: [PagetitleComponent, LoadingSprintComponent, CardMobSimpleComponent], + declarations: [PagetitleComponent, LoadingSprintComponent, CardMobExplainComponent], + imports: [CommonModule, CardMobSimpleModule, SoulboundFeatureTokensModule, CommonPipeModule], + exports: [PagetitleComponent, LoadingSprintComponent, CardMobSimpleComponent, CardMobExplainComponent], }) export class SharedModule {} From b812d0f4628e87c4f126b17705603838a10f5542 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Mon, 5 Jun 2023 17:11:10 +0700 Subject: [PATCH 041/315] . --- .../cards/card-mob-explain/card-mob-explain.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html index 418ad9191..979090e00 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html @@ -3,7 +3,7 @@
{{ title.label | stringEllipsis : 20}} - #{{title.subLabel}} + {{title.subLabel}}
From ef43157cbca230e2a4bcc3c3b4f2c4f0d433d0b8 Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 6 Jun 2023 08:30:01 +0700 Subject: [PATCH 042/315] [TamTM6] update data proposal, tx v2 --- .../core/data-services/environment.service.ts | 7 ++-- src/app/core/services/block.service.ts | 6 ++-- src/app/core/services/proposal.service.ts | 35 ++++++++++--------- src/app/core/services/transaction.service.ts | 3 +- src/app/core/services/validator.service.ts | 6 ++-- src/app/core/services/wallet.service.ts | 3 +- .../summary-info/summary-info.component.ts | 7 ++-- .../proposal-table.component.html | 4 +-- .../proposal-table.component.ts | 2 +- src/app/pages/proposal/proposal.component.ts | 12 +++---- 10 files changed, 43 insertions(+), 42 deletions(-) diff --git a/src/app/core/data-services/environment.service.ts b/src/app/core/data-services/environment.service.ts index 6ac9a4933..d618df520 100644 --- a/src/app/core/data-services/environment.service.ts +++ b/src/app/core/data-services/environment.service.ts @@ -20,6 +20,7 @@ export interface IConfiguration { ipfsDomain: string; evnLabel: any; maxValidator: number; + horoscopeSelectedChain: string } @Injectable() @@ -40,7 +41,8 @@ export class EnvironmentService { ipfsDomain: '', graphUrl:'', evnLabel: '', - maxValidator: null + maxValidator: null, + horoscopeSelectedChain: '' }); get configValue(): IConfiguration { @@ -73,7 +75,8 @@ export class EnvironmentService { timeInterval: config['timeInterval'] || 4000, ipfsDomain: config['ipfsDomain'], evnLabel: config['evnLabel'], - maxValidator: config['maxValidator'] || 200 + maxValidator: config['maxValidator'] || 200, + horoscopeSelectedChain: config['horoscopeSelectedChain'] }; this.config.next(data); diff --git a/src/app/core/services/block.service.ts b/src/app/core/services/block.service.ts index 83d9ea637..4ac2a57b9 100644 --- a/src/app/core/services/block.service.ts +++ b/src/app/core/services/block.service.ts @@ -4,7 +4,6 @@ import * as _ from 'lodash'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { EnvironmentService } from '../data-services/environment.service'; -import { checkEnvQuery } from '../utils/common/info-common'; import { CommonService } from './common.service'; @Injectable() @@ -12,7 +11,7 @@ export class BlockService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; graphUrl = `${this.environmentService.configValue.graphUrl}`; - envDB = checkEnvQuery(this.environmentService.configValue.env); + envDB = this.environmentService.configValue.horoscopeSelectedChain; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); @@ -24,10 +23,9 @@ export class BlockService extends CommonService { } getDataBlock(payload) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query auratestnet_block($limit: Int = 100, $order: order_by = desc, $height: Int = null, $hash: String = null, $operatorAddress: String = null, $heightGT: Int = null, $heightLT: Int = null) { - ${envDB} { + ${this.envDB} { block(limit: $limit, order_by: {height: $order}, where: {height: {_eq: $height, _gt: $heightGT, _lt: $heightLT}, hash: {_eq: $hash}, validator: {operator_address: {_eq: $operatorAddress}}}) { data validator { diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 8112a2272..ff7fa0be1 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -5,7 +5,6 @@ import { Observable, Subject } from 'rxjs'; import { VOTE_OPTION } from '../constants/proposal.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; -import { checkEnvQuery } from '../utils/common/info-common'; import { map } from 'rxjs/operators'; @Injectable() @@ -14,7 +13,7 @@ export class ProposalService extends CommonService { indexerUrl = `${this.environmentService.configValue.indexerUri}`; graphUrl = `${this.environmentService.configValue.graphUrl}`; maxValidator = `${this.environmentService.configValue.maxValidator}`; - envDB = checkEnvQuery(this.environmentService.configValue.env); + envDB = this.environmentService.configValue.horoscopeSelectedChain; reloadList$ = new Subject(); pageIndexObj = {}; @@ -67,21 +66,21 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getListVoteFromIndexer(payload, option): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - nextKey: payload.nextKey, - reverse: false, - pageLimit: payload.pageLimit, - answer: option, - proposalid: payload.proposalid, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); + // getListVoteFromIndexer(payload, option): Observable { + // const params = _({ + // chainid: this.chainInfo.chainId, + // nextKey: payload.nextKey, + // reverse: false, + // pageLimit: payload.pageLimit, + // answer: option, + // proposalid: payload.proposalid, + // }) + // .omitBy(_.isNull) + // .omitBy(_.isUndefined) + // .value(); - return this.http.get(`${this.indexerUrl}/votes`, { params }); - } + // return this.http.get(`${this.indexerUrl}/votes`, { params }); + // } getProposalData(payload) { const operationsDoc = ` @@ -136,9 +135,11 @@ export class ProposalService extends CommonService { height proposal_id txhash - updated_at vote_option voter + transaction { + timestamp + } } } } diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 6c5db8f74..eac624010 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -5,7 +5,6 @@ import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; import { LCD_COSMOS } from '../constants/url.constant'; import { EnvironmentService } from '../data-services/environment.service'; -import { checkEnvQuery } from '../utils/common/info-common'; import { CommonService } from './common.service'; @Injectable() @@ -13,7 +12,7 @@ export class TransactionService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; graphUrl = `${this.environmentService.configValue.graphUrl}`; - envDB = checkEnvQuery(this.environmentService.configValue.env); + envDB = this.environmentService.configValue.horoscopeSelectedChain; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index d7f2c8011..e3892a091 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -7,7 +7,6 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { CommonService } from 'src/app/core/services/common.service'; import { LCD_COSMOS } from '../constants/url.constant'; import { Globals } from 'src/app/global/global'; -import { checkEnvQuery } from '../utils/common/info-common'; import { map } from 'rxjs/operators'; @Injectable({ @@ -17,7 +16,7 @@ export class ValidatorService extends CommonService { apiUrl = `${this.environmentService.configValue.beUri}`; chainInfo = this.environmentService.configValue.chain_info; graphUrl = `${this.environmentService.configValue.graphUrl}`; - envDB = checkEnvQuery(this.environmentService.configValue.env); + envDB = this.environmentService.configValue.horoscopeSelectedChain; stakingAPRSubject: BehaviorSubject; constructor( @@ -51,7 +50,6 @@ export class ValidatorService extends CommonService { } getDataValidator(payload) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); const operationsDoc = ` query auratestnet_validator($offset: Int = 0, $limit: Int = 10, $operatorAddress: String = null) { ${this.envDB} { @@ -95,7 +93,7 @@ export class ValidatorService extends CommonService { }, operationName: 'auratestnet_validator', }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } validatorsDetail(address: string): Observable { diff --git a/src/app/core/services/wallet.service.ts b/src/app/core/services/wallet.service.ts index c3f5acff8..302843506 100644 --- a/src/app/core/services/wallet.service.ts +++ b/src/app/core/services/wallet.service.ts @@ -21,7 +21,6 @@ import { WalletStorage } from '../models/wallet'; import { getKeplr, handleErrors } from '../utils/keplr'; import local from '../utils/storage/local'; import { NgxToastrService } from './ngx-toastr.service'; -import { checkEnvQuery } from '../utils/common/info-common'; export type WalletKey = Partial | AccountResponse; @@ -315,7 +314,7 @@ export class WalletService implements OnDestroy { } private makeSignDocData(address, signDoc: Partial): Observable { - const envDB = checkEnvQuery(this.environmentService.configValue.env); + const envDB = this.environmentService.configValue.horoscopeSelectedChain; const operationsDoc = ` query getAccountInfo ($address: String) { ${envDB} { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 6d3e70f99..74e773890 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -203,6 +203,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { const dataDetail = this.proposalDetail || data; return { ...dataDetail, + count_vote: data.count_vote || dataDetail.count_vote, initial_deposit: balanceOf(_.get(data, 'initial_deposit[0].amount') || 0), pro_total_deposits: balanceOf(_.get(data, 'total_deposit[0].amount') || 0), pro_type: data?.content['@type']?.split('.').pop(), @@ -252,6 +253,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { '%'; } } else { + this.isNotReached = true; + this.quorumStatus = VOTING_QUORUM.NOT_REACHED; this.currentStatus = VOTING_STATUS.PROPOSAL_STATUS_REJECTED; this.currentSubTitle = 'Current quorum is less than ' + @@ -329,7 +332,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { if (addr) { const payload = { limit: 1, - composite_key: 'proposal_vote.proposal_id', + compositeKey: 'proposal_vote.proposal_id', value: this.proposalId?.toString(), value2: addr, }; @@ -337,7 +340,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { const optionVote = this.proposalService.getVoteMessageByConstant( res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, ); - this.proposalVotes = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; + this.proposalVotes = this.voteConstant?.find((s) => s.key === optionVote)?.voteOption; this.voteValue = { keyVote: optionVote, }; diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index b78a08f6d..72b93987d 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -107,9 +107,9 @@ class: 'h5 mb-0 text--primary', info: '' + - (data.voter_address ? shortenAddress(data.voter_address) : '-') + + (data.voter ? shortenAddress(data.voter) : '-') + '' }, { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 1f0ab833c..64cb8897e 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -98,7 +98,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { ngOnChanges(changes: SimpleChanges): void { this.data.forEach((element) => { - element.timestamp = element.timestamp || element.updated_at; + element.timestamp = element?.transaction?.timestamp || element.timestamp || element.updated_at; element.updated_at = null; }); if (this.dataSource) { diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index a5f8c660f..f54b8cfbd 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -74,7 +74,7 @@ export class ProposalComponent implements OnInit { private layout: BreakpointObserver, private scroll: ViewportScroller, public commonService: CommonService, - private transactionService: TransactionService + private transactionService: TransactionService, ) {} ngOnInit(): void { @@ -106,15 +106,15 @@ export class ProposalComponent implements OnInit { if (addr) { const payload = { limit: 1, - composite_key: 'proposal_vote.proposal_id', + compositeKey: 'proposal_vote.proposal_id', value: pro.proposal_id?.toString(), value2: addr, }; this.transactionService.getListTxMultiCondition(payload).subscribe((res) => { - const optionVote = this.proposalService.getVoteMessageByConstant(res?.transaction[0]?.data?.tx?.body?.messages[0]?.option); - pro.vote_option = this.voteConstant.find( - (s) => s.key === optionVote, - )?.voteOption; + const optionVote = this.proposalService.getVoteMessageByConstant( + res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, + ); + pro.vote_option = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; }); } }; From 23f4bb8e5812c8e4e37932855728b1073f91b2e0 Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 6 Jun 2023 08:31:43 +0700 Subject: [PATCH 043/315] [TamTM6] update token temp --- src/app/core/services/token.service.ts | 96 ++++++++----------- .../nft-list/nft-list.component.ts | 57 ++++++----- .../token-holders-tab.component.ts | 48 +++++++++- .../token-inventory-tab.component.ts | 77 ++++++++++++++- 4 files changed, 189 insertions(+), 89 deletions(-) diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 292339014..d949b0f95 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -1,21 +1,19 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import axios from 'axios'; import * as _ from 'lodash'; import { Observable } from 'rxjs'; -import { LENGTH_CHARACTER } from '../constants/common.constant'; +import { map } from 'rxjs/operators'; +import { LCD_COSMOS } from '../constants/url.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { RangeType } from '../models/common.model'; import { CommonService } from './common.service'; -import { checkEnvQuery } from '../utils/common/info-common'; -import { map } from 'rxjs/operators'; -import { LCD_COSMOS } from '../constants/url.constant'; -import axios from 'axios'; @Injectable() export class TokenService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; indexerUrl = `${this.environmentService.configValue.indexerUri}`; - envDB = checkEnvQuery(this.environmentService.configValue.env); + envDB = this.environmentService.configValue.horoscopeSelectedChain; graphUrl = `${this.environmentService.configValue.graphUrl}`; constructor(private http: HttpClient, private environmentService: EnvironmentService) { @@ -38,58 +36,6 @@ export class TokenService extends CommonService { return this.http.get(`${this.apiUrl}/cw721-tokens/${address}`); } - getListTokenTransferIndexerV2(pageLimit: string | number, contractAddress = '', filterData: any, nextKey = null) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); - let filterQuery = ''; - if (filterData?.keyWord) { - if ( - filterData?.keyWord.length === LENGTH_CHARACTER.TRANSACTION && - filterData?.keyWord == filterData?.keyWord.toUpperCase() - ) { - filterQuery = filterQuery.concat(`, hash: {_eq: "${filterData?.keyWord}" }`); - } else if (filterData['isSearchWallet']) { - filterQuery = filterQuery.concat(`, events: {event_attributes: {value: {_eq: "${filterData?.keyWord}" }}}`); - } else { - filterQuery = filterQuery.concat( - `, events: {event_attributes: {key: {_eq: "token_id"}, value: {_eq: "${filterData?.keyWord}" }}}`, - ); - } - } - if (nextKey) { - filterQuery = filterQuery.concat(', id: {_lt: ' + `${nextKey}` + '}'); - } - - const operationsDoc = ` - query getListTx($limit: Int, $event_attr_val: String, $tx_msg_val: jsonb) { - ${envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {_or: [{events: {event_attributes: {key: {_eq: "_contract_address"}, value: {_eq: $event_attr_val}}, type: {_eq: "execute"}}}, {transaction_messages: {content: {_contains: $tx_msg_val}}}] ${filterQuery} }) { - id - height - hash - timestamp - code - gas_used - gas_wanted - data(path: "tx") - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: pageLimit, - event_attr_val: contractAddress, - tx_msg_val: { - contract: contractAddress, - }, - }, - operationName: 'getListTx', - }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); - } - getListTokenNFTFromIndexer(payload): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -120,6 +66,36 @@ export class TokenService extends CommonService { return this.http.get(url); } + getListTokenHolderNFT(payload) { + const operationsDoc = ` + query MyQuery($contract_address: String, $limit: Int = 10) { + ${this.envDB} { + view_count_holder_cw721(limit: $limit, where: {contract_address: {_eq: $contract_address}}, order_by: {count: desc}) { + contract_address + count + owner + } + view_count_holder_cw721_aggregate(where: {contract_address: {_eq: $contract_address}}) { + aggregate { + count + } + } + } + } + `; + payload['contractAddress'] = "aura1vl8mq97m5r48sejm5rtlxc724mzjtgs80nseka00xx6vyysffk2s3kpavh"; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variable: { + limit: payload?.limit || 20, + contract_address: "", + }, + operationName: 'MyQuery', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getContractDetail(tokenAddress): Observable { return this.http.get(`${this.apiUrl}/contracts/${tokenAddress}`); } @@ -145,4 +121,8 @@ export class TokenService extends CommonService { getListAssetCommunityPool() { return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.DISTRIBUTION}`); } + + getAssetCW721ByContract(payload): Observable { + return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-contract/`,payload); + } } diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts index 1d9384cc8..604ea6d2c 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts @@ -1,5 +1,6 @@ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; +import * as _ from 'lodash'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; @@ -51,7 +52,6 @@ export class NftListComponent implements OnChanges { } getNftData() { - this.loading = true; this.searchValue = this.searchValue?.trim(); const payload = { @@ -60,30 +60,41 @@ export class NftListComponent implements OnChanges { keyword: this.searchValue, next_key: this.nextKey, }; - this.accountService.getAssetCW721ByOwner(payload).subscribe((res: ResponseDto) => { - if (res?.data?.length > 0) { - if (this.nftList.length > 0) { - this.nftList = [...this.nftList, ...res.data]; + this.accountService.getAssetCW721ByOwner(payload).subscribe( + (res: ResponseDto) => { + console.log('res 721 ne', res); + + if (res?.data?.length > 0) { + if (this.nftList.length > 0) { + this.nftList = [...this.nftList, ...res.data]; + } else { + this.nftList = res?.data; + } + this.nextKey = res.meta?.next_key; + this.pageData.length = this.nftList.length; + + this.nftList.forEach((element) => { + element.contract_address = _.get(element, 'cw721_contract.smart_contract.address'); + element.token_name = _.get(element, 'media_info.onchain.metadata.name'); + element.image = _.get(element, 'media_info.offchain.image'); + element.metadata = _.get(element, 'media_info.onchain.metadata'); + if (!this.searchValue) { + this.totalValue += element.price * +element.balance || 0; + } + }); + let start = this.pageData.pageIndex * this.pageData.pageSize; + let end = this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize; + this.showedData = this.nftList.slice(start, end); + this.totalValueNft.emit(this.totalValue); } else { - this.nftList = res?.data; + this.nftList.length = 0; } - this.nextKey = res.meta?.next_key; - this.pageData.length = this.nftList.length; - - this.nftList.forEach((element) => { - if (!this.searchValue) { - this.totalValue += element.price * +element.balance || 0; - } - }); - let start = this.pageData.pageIndex * this.pageData.pageSize; - let end = this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize; - this.showedData = this.nftList.slice(start, end); - this.totalValueNft.emit(this.totalValue); - } else { - this.nftList.length = 0; - } - }); - this.loading = false; + }, + () => {}, + () => { + this.loading = false; + }, + ); } resetSearch(): void { diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts index 3f4040bb9..160036f18 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts @@ -64,13 +64,13 @@ export class TokenHoldersTabComponent implements OnInit { if (this.typeContract !== ContractRegisterType.CW20) { this.getQuantity(); } else { - this.getListTokenHolder(); + this.getHolder(); } this.template = this.getTemplate(); this.displayedColumns = this.getTemplate().map((template) => template.matColumnDef); } - getListTokenHolder() { + getHolder() { this.tokenService.getListTokenHolder(this.numberTopHolder, 0, this.typeContract, this.contractAddress).subscribe( (res) => { if (res && res.data?.resultAsset?.length > 0) { @@ -103,6 +103,48 @@ export class TokenHoldersTabComponent implements OnInit { ); } + getHolderNFT() { + const payload = { + limit: this.numberTopHolder, + contractAddress: this.contractAddress, + }; + this.tokenService.getListTokenHolderNFT(payload).subscribe( + (res) => { + console.log(res); + if (res?.view_count_holder_cw721?.length > 0) { + this.totalHolder = res.view_count_holder_cw721_aggregate?.aggregate?.count; + if (this.totalHolder > this.numberTopHolder) { + this.pageData.length = this.numberTopHolder; + } else { + this.pageData.length = this.totalHolder; + } + + res?.view_count_holder_cw721.forEach((element) => { + element['quantity'] = element.count; + }); + + let topHolder = Math.max(...res?.view_count_holder_cw721.map((o) => o.quantity)) || 1; + this.numberTop = topHolder > this.numberTop ? topHolder : this.numberTop; + res?.view_count_holder_cw721.forEach((element) => { + element['value'] = 0; + }); + + if (this.totalQuantity) { + res?.view_count_holder_cw721.forEach((k) => { + k['percent_hold'] = (k.quantity / this.totalQuantity) * 100; + k['width_chart'] = (k.quantity / this.numberTop) * 100; + }); + } + this.dataSource = new MatTableDataSource(res.view_count_holder_cw721); + } + }, + () => {}, + () => { + this.loading = false; + }, + ); + } + compare(a: number | string, b: number | string, isAsc: boolean) { return (a < b ? -1 : 1) * (isAsc ? 1 : -1); } @@ -127,7 +169,7 @@ export class TokenHoldersTabComponent implements OnInit { try { const config = await client.queryContractSmart(this.contractAddress, queryData); this.totalQuantity = config?.count || 0; - this.getListTokenHolder(); + this.getHolderNFT(); } catch (error) {} } } diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts index ee2a110e2..b42204e8c 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts @@ -30,6 +30,7 @@ export class TokenInventoryComponent implements OnInit { prefixAdd = this.environmentService.configValue.chain_info.bech32Config.bech32PrefixAccAddr; isMoreTx = false; linkToken = 'token-nft'; + nextKey = null; constructor( private route: ActivatedRoute, @@ -39,9 +40,6 @@ export class TokenInventoryComponent implements OnInit { ) {} ngOnInit(): void { - if (this.typeContract === ContractRegisterType.CW4973) { - this.linkToken = 'token-abt'; - } this.route.params.subscribe((params) => { this.contractAddress = params?.contractAddress; }); @@ -49,7 +47,13 @@ export class TokenInventoryComponent implements OnInit { this.route.queryParams.subscribe((params) => { this.keyWord = params?.a || ''; }); - this.getNftData(); + + if (this.typeContract === ContractRegisterType.CW4973) { + this.linkToken = 'token-abt'; + this.getNftData(); + } else { + this.getNftCW721(); + } } getNftData() { @@ -101,10 +105,73 @@ export class TokenInventoryComponent implements OnInit { }); } + getNftCW721(nextKey = null) { + // if (this.keyWord) { + // if (this.keyWord?.length >= LENGTH_CHARACTER.ADDRESS && this.keyWord?.startsWith(this.prefixAdd)) { + // payload.owner = this.keyWord; + // } else if ( + // !(this.keyWord?.length === LENGTH_CHARACTER.TRANSACTION && this.keyWord == this.keyWord?.toUpperCase()) + // ) { + // payload.token_id = this.keyWord; + // } + // } + + let payload = { + contract_address: this.contractAddress, + limit: 100, + keyword: this.keyWord, + next_key: nextKey, + }; + + // if (this.keyWord) { + // if (this.keyWord?.length >= LENGTH_CHARACTER.ADDRESS && this.keyWord?.startsWith(this.prefixAdd)) { + // payload.owner = this.keyWord; + // } else if ( + // !(this.keyWord?.length === LENGTH_CHARACTER.TRANSACTION && this.keyWord == this.keyWord?.toUpperCase()) + // ) { + // payload.token_id = this.keyWord; + // } + // } + + this.tokenService.getAssetCW721ByContract(payload).subscribe( + (res) => { + console.log('res ne', res); + + const asset = _.get(res, `data.assets[${this.typeContract}]`); + this.pageData.length = _.get(res, `meta.count`); + + if (res.data.length > 0) { + this.nftData.data = [...this.nftData.data, ...res.data]; + } else { + this.nftData.data = [...res.data]; + } + this.dataSourceMobile = this.nftData.data.slice( + this.pageData.pageIndex * this.pageData.pageSize, + this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + ); + + if (this.pageData.length >= 100) { + this.isMoreTx = true; + if (this.pageData.length > 200) { + this.pageData.length = 200; + } + } + }, + () => {}, + () => { + this.loading = false; + }, + ); + } + pageEvent(e: PageEvent): void { if (e.pageIndex * e.pageSize >= this.nftData.data.length) { this.pageData = e; - this.getNftData(); + if (this.typeContract === ContractRegisterType.CW4973) { + this.getNftData(); + } else { + this.getNftCW721(this.nextKey); + } } else { this.dataSourceMobile = this.nftData.data.slice(e.pageIndex * e.pageSize, e.pageIndex * e.pageSize + e.pageSize); } From 3168874066f029ca5a38a1235dbe792f37cd0c70 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 09:43:33 +0700 Subject: [PATCH 044/315] add table proposal --- .../community-pool-proposal.component.html | 41 ++++++++----------- .../community-pool-proposal.component.ts | 2 +- .../card-mob-explain.component.html | 5 ++- .../card-mob-explain.component.ts | 23 ++++++----- src/app/shared/shared.module.ts | 7 ++-- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index 1c5dd898a..45bca4366 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -5,7 +5,7 @@

Community Pool Spent Proposals

-
+
@@ -67,9 +67,9 @@

Community Pool Spent Proposals

- - - Receipient + + + Recipient {{ shortenAddress(element.content.recipient) || '-' }} @@ -94,9 +94,9 @@

Community Pool Spent Proposals

Voting End
- {{ element.submit_time | customDate : 'yyyy-MM-dd' }} + {{ element.voting_end_time | customDate : 'yyyy-MM-dd' }}
- {{ element.submit_time | customDate : 'HH:mm:ss' }} + {{ element.voting_end_time | customDate : 'HH:mm:ss' }}
@@ -127,53 +127,48 @@

Community Pool Spent Proposals

Proposals

- + ]">
-
{{data.label}}
-
+
{{data.label}}
+
+
diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts index 0822d737c..415c22b81 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts @@ -1,5 +1,4 @@ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; - +import { Component, Input, OnInit } from '@angular/core'; export interface CardMobExplainTitle { label: string; @@ -11,22 +10,26 @@ export interface CardMobContent { class?: string; info: any; } +export interface CardMobSimpleAmount { + amount: string; + decimal: number; + isAura: boolean; +} + @Component({ selector: 'app-card-mob-explain', templateUrl: './card-mob-explain.component.html', - styleUrls: ['./card-mob-explain.component.scss'] + styleUrls: ['./card-mob-explain.component.scss'], }) - -export class CardMobExplainComponent implements OnInit, OnChanges { +export class CardMobExplainComponent implements OnInit { @Input() title: CardMobExplainTitle; @Input() status: any; @Input() content: CardMobContent[]; - constructor() { } + @Input() tokenAmount: any; + constructor() {} ngOnInit(): void { + console.log(this.tokenAmount); + } - - ngOnChanges(changes: SimpleChanges): void { - } - } diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index 14404ae27..dd42f21c5 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -1,16 +1,17 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; +import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; +import { CommonDirectiveModule } from '../core/directives/common-directive.module'; +import { CardMobExplainComponent } from './components/cards/card-mob-explain/card-mob-explain.component'; import { CardMobSimpleComponent } from './components/cards/card-mob-simple/card-mob-simple.component'; import { CardMobSimpleModule } from './components/cards/card-mob-simple/card-mob-simple.module'; import { LoadingSprintComponent } from './components/loading-sprint/loading-sprint.component'; import { PagetitleComponent } from './components/pagetitle/pagetitle.component'; import { SoulboundFeatureTokensModule } from './components/soulbound-feature-tokens/soulbound-feature-tokens.module'; -import { CardMobExplainComponent } from './components/cards/card-mob-explain/card-mob-explain.component'; -import {CommonPipeModule} from "src/app/core/pipes/common-pipe.module"; @NgModule({ declarations: [PagetitleComponent, LoadingSprintComponent, CardMobExplainComponent], - imports: [CommonModule, CardMobSimpleModule, SoulboundFeatureTokensModule, CommonPipeModule], + imports: [CommonModule, CardMobSimpleModule, SoulboundFeatureTokensModule, CommonPipeModule, CommonDirectiveModule], exports: [PagetitleComponent, LoadingSprintComponent, CardMobSimpleComponent, CardMobExplainComponent], }) export class SharedModule {} From c88544c5ac33a5b4e691c0a4b0248702007d3384 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 09:53:43 +0700 Subject: [PATCH 045/315] update config --- src/assets/config/config.json | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/assets/config/config.json b/src/assets/config/config.json index d0e043c3d..9cec1b65e 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -67,6 +67,10 @@ "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", "graphUrl": "https://indexer-v2.dev.aurascan.io/v1/graphql", "timeInterval": 4000, - "evnLabel": { "desktop": "Develop Testnet Network", "mobile": "Develop Testnet" }, - "maxValidator": 200 -} + "evnLabel": { + "desktop": "Develop Testnet Network", + "mobile": "Develop Testnet" + }, + "maxValidator": 200, + "horoscopeSelectedChain": "auratestnet" +} \ No newline at end of file From 3985f1078172d53d081364e52f882c0f574f20a2 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 10:00:46 +0700 Subject: [PATCH 046/315] Merge remote-tracking branch 'origin/develop' into baseline/serenity_20230606 # Conflicts: # src/app/core/services/token.service.ts # src/app/pages/dashboard/dashboard.component.ts --- src/app/core/helpers/jwt.interceptor.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/core/helpers/jwt.interceptor.ts b/src/app/core/helpers/jwt.interceptor.ts index d3b849394..8be34ef25 100644 --- a/src/app/core/helpers/jwt.interceptor.ts +++ b/src/app/core/helpers/jwt.interceptor.ts @@ -11,7 +11,6 @@ export class JwtInterceptor implements HttpInterceptor { const currentUser = this.authenticationService.currentUserValue; request = request.clone({ setHeaders: { - 'x-hasura-admin-secret': 'abc@123', 'Hasura-Client-Name': 'hasura-console' }, }); return next.handle(request); From 32172bec5fae46fdde761082beb313e3af8aa011 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 10:22:51 +0700 Subject: [PATCH 047/315] Merge remote-tracking branch 'origin/develop' into baseline/serenity_20230606 # Conflicts: # src/app/core/services/token.service.ts # src/app/pages/dashboard/dashboard.component.ts --- src/app/core/services/common.service.ts | 16 +---- src/app/core/services/proposal.service.ts | 32 +--------- src/app/core/services/token.service.ts | 61 +------------------ src/app/core/services/validator.service.ts | 6 +- .../nft-list/nft-list.component.html | 2 +- .../block-detail/block-detail.component.html | 4 +- .../summary-info/summary-info.component.html | 14 +++-- .../validators-votes.component.ts | 2 +- .../proposal-detail/votes/votes.component.ts | 39 ++++++------ .../validators-detail.component.ts | 2 +- 10 files changed, 42 insertions(+), 136 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index b8c20c645..b8c46c1f4 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -2,14 +2,12 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import axios from 'axios'; import { formatDistanceToNowStrict } from 'date-fns'; -import * as _ from 'lodash'; import * as moment from 'moment'; import { BehaviorSubject, Observable } from 'rxjs'; -import { CHART_RANGE, DATEFORMAT } from '../constants/common.constant'; +import { DATEFORMAT } from '../constants/common.constant'; import { STATUS_VALIDATOR } from '../constants/validator.enum'; import { EnvironmentService } from '../data-services/environment.service'; import { formatTimeInWords, formatWithSchema } from '../helpers/date'; -import { LCD_COSMOS } from '../constants/url.constant'; @Injectable() export class CommonService { @@ -72,17 +70,13 @@ export class CommonService { } } - getValidatorImg(identity: string) { - return axios.get(`https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=${identity}&fields=pictures`); - } - mappingNameIBC(value) { - let result = {display: value, decimals: 6}; + let result = { display: value, decimals: 6 }; if (value.indexOf('ibc') >= 0) { let temp = value.slice(value.indexOf('ibc')); result = this.coins.find((k) => k.denom === temp); } else { - result = {display: this.chainInfo.currencies[0].coinDenom, decimals: 6}; + result = { display: this.chainInfo.currencies[0].coinDenom, decimals: 6 }; } return result; } @@ -96,10 +90,6 @@ export class CommonService { return axios.get(`${this._environmentService.configValue.chain_info.rest}/cosmos/distribution/v1beta1/params`); } - getTokenByCoinId(range: string, id: string) { - return this._http.get(`${this.apiUrl}/metrics/token?range=${range}&coidId=${id}`); - } - getDefaultImg() { return this._environmentService.configValue.image_s3 + 'images/aura__ntf-default-img.png'; } diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index ff7fa0be1..812bb1659 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -25,19 +25,7 @@ export class ProposalService extends CommonService { super(http, environmentService); } - getValidatorVotesFromIndexer(proposalid): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - proposalid: proposalid, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/votes/validators`, { params }); - } - - getValidatorVotesFromIndexerV2(proposalId): Observable { + getValidatorVotesFromIndexer(proposalId): Observable { const operationsDoc = ` query auratestnet_validator($proposalId: Int = null, $limit: Int = 10) { ${this.envDB} { @@ -66,22 +54,6 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - // getListVoteFromIndexer(payload, option): Observable { - // const params = _({ - // chainid: this.chainInfo.chainId, - // nextKey: payload.nextKey, - // reverse: false, - // pageLimit: payload.pageLimit, - // answer: option, - // proposalid: payload.proposalid, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // return this.http.get(`${this.indexerUrl}/votes`, { params }); - // } - getProposalData(payload) { const operationsDoc = ` query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null) { @@ -127,7 +99,7 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getListVoteFromIndexerV2(payload, option): Observable { + getListVoteFromIndexer(payload, option): Observable { const operationsDoc = ` query auratestnet_vote($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { ${this.envDB} { diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 292339014..a68ae2d72 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -1,15 +1,13 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import axios from 'axios'; import * as _ from 'lodash'; import { Observable } from 'rxjs'; -import { LENGTH_CHARACTER } from '../constants/common.constant'; +import { LCD_COSMOS } from '../constants/url.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { RangeType } from '../models/common.model'; -import { CommonService } from './common.service'; import { checkEnvQuery } from '../utils/common/info-common'; -import { map } from 'rxjs/operators'; -import { LCD_COSMOS } from '../constants/url.constant'; -import axios from 'axios'; +import { CommonService } from './common.service'; @Injectable() export class TokenService extends CommonService { @@ -38,58 +36,6 @@ export class TokenService extends CommonService { return this.http.get(`${this.apiUrl}/cw721-tokens/${address}`); } - getListTokenTransferIndexerV2(pageLimit: string | number, contractAddress = '', filterData: any, nextKey = null) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); - let filterQuery = ''; - if (filterData?.keyWord) { - if ( - filterData?.keyWord.length === LENGTH_CHARACTER.TRANSACTION && - filterData?.keyWord == filterData?.keyWord.toUpperCase() - ) { - filterQuery = filterQuery.concat(`, hash: {_eq: "${filterData?.keyWord}" }`); - } else if (filterData['isSearchWallet']) { - filterQuery = filterQuery.concat(`, events: {event_attributes: {value: {_eq: "${filterData?.keyWord}" }}}`); - } else { - filterQuery = filterQuery.concat( - `, events: {event_attributes: {key: {_eq: "token_id"}, value: {_eq: "${filterData?.keyWord}" }}}`, - ); - } - } - if (nextKey) { - filterQuery = filterQuery.concat(', id: {_lt: ' + `${nextKey}` + '}'); - } - - const operationsDoc = ` - query getListTx($limit: Int, $event_attr_val: String, $tx_msg_val: jsonb) { - ${envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {_or: [{events: {event_attributes: {key: {_eq: "_contract_address"}, value: {_eq: $event_attr_val}}, type: {_eq: "execute"}}}, {transaction_messages: {content: {_contains: $tx_msg_val}}}] ${filterQuery} }) { - id - height - hash - timestamp - code - gas_used - gas_wanted - data(path: "tx") - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: pageLimit, - event_attr_val: contractAddress, - tx_msg_val: { - contract: contractAddress, - }, - }, - operationName: 'getListTx', - }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); - } - getListTokenNFTFromIndexer(payload): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -98,7 +44,6 @@ export class TokenService extends CommonService { contractAddress: payload.contractAddress, pageLimit: payload.pageLimit, pageOffset: payload.pageOffset, - // countTotal: true, contractType: payload.contractType, isBurned: false, }) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index e3892a091..a231f3883 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -140,7 +140,7 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators/delegations/${address}`); } - delegators(pageLimit = 100, address: string, nextKey = null) { + delegator(pageLimit = 100, address: string, nextKey = null) { return axios.get( `${this.chainInfo.rest}/${LCD_COSMOS.STAKING}/validators/${address}/delegations?pagination.limit=${pageLimit}&pagination.key=${nextKey}&pagination.reverse=true`, ); @@ -154,10 +154,6 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators/validator-info?address=${addressList}`); } - getStakeInfo(delegatorAddress: string): Observable { - return this.http.get(`${this.apiUrl}/validators/delegations/delegator/${delegatorAddress}`); - } - getUptimeLCD(block = null) { if (!block) { block = 'latest'; diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.html b/src/app/pages/account/account-detail/nft-list/nft-list.component.html index eb0053fb7..132a52900 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.html +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.html @@ -1,4 +1,4 @@ -

NFTs ({{ nftList.length || 0 }} NFTs and more)

+

NFTs ({{ nftList?.length || 0 }} NFTs and more)

diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index 21f5ac77e..30c408300 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -252,7 +252,7 @@

Events

@@ -264,7 +264,7 @@

Events

- +
{{ data.key | decodeData diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index 2cd01362a..b5f082952 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -55,15 +55,19 @@

Proposer
- + - {{ proposalDetail.proposer ? proposalDetail.proposer.description.moniker : proposalDetail.proposer_address }} + {{ + proposalDetail?.proposer + ? proposalDetail?.proposer?.description?.moniker + : proposalDetail?.proposer_address + }} {{ - proposalDetail.proposer - ? proposalDetail.proposer.description.moniker - : (proposalDetail.proposer_address | cutStringPipe : 8 : 8) + proposalDetail?.proposer + ? proposalDetail?.proposer?.description.moniker + : (proposalDetail?.proposer_address | cutStringPipe : 8 : 8) }} diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index f3d545523..9e8379314 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -71,7 +71,7 @@ export class ValidatorsVotesComponent implements OnInit { getValidatorVotes(isInit = false): void { if (this.proposalId) { - this.proposalService.getValidatorVotesFromIndexerV2(this.proposalId).subscribe((res) => { + this.proposalService.getValidatorVotesFromIndexer(this.proposalId).subscribe((res) => { let validatorVote = []; if (res?.validator) { validatorVote = _.get(res, 'validator').map((item) => { diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index 3b6495008..918872b71 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -43,7 +43,6 @@ export class VotesComponent implements OnChanges { countCurrent: string = ''; voteDataListLoading = true; isFirstChange = false; - TAB_ALL = 0; proposalVote = PROPOSAL_TABLE_MODE.VOTES; voteData = { @@ -87,19 +86,19 @@ export class VotesComponent implements OnChanges { combineLatest([ this.proposalService - .getListVoteFromIndexerV2(payloads, null) + .getListVoteFromIndexer(payloads, null) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), ]).subscribe((res) => { res[0] && ((dta) => (this.voteData.all = dta))(res[0]); @@ -167,7 +166,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_YES: payloads.nextKey = this.voteData.yes.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { if (res.vote) { if (this.voteData.yes.votes.length % 25 !== res.vote?.length) { this.voteData.yes = { @@ -183,7 +182,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_ABSTAIN: payloads.nextKey = this.voteData.abstain.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { if (res.vote) { if (this.voteData.abstain.votes.length % 25 !== res.vote?.length) { this.voteData.abstain = { @@ -199,7 +198,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_NO: payloads.nextKey = this.voteData.no.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { if (res.vote) { if (this.voteData.no.votes.length % 25 !== res.vote?.length) { this.voteData.no = { @@ -216,16 +215,16 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.noWithVeto.nextKey; if (payloads.nextKey) { this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) .subscribe((res) => { - if (res.vote) { - if (this.voteData.noWithVeto.votes.length % 25 !== res.vote.length) { + if (res?.vote) { + if (this.voteData.noWithVeto.votes.length % 25 !== res?.vote?.length) { this.voteData.noWithVeto = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.noWithVeto.votes, ...res.vote], + nextKey: res?.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.noWithVeto.votes, ...res?.vote], }; } - this.voteDataList = this.voteData?.noWithVeto.votes; + this.voteDataList = this.voteData?.noWithVeto?.votes; } }); } @@ -233,12 +232,12 @@ export class VotesComponent implements OnChanges { default: payloads.nextKey = this.voteData.all?.nextKey; if (payloads?.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, null).subscribe((res) => { - if (res.vote) { - if (this.voteData.all.votes.length % 25 !== res.vote.length) { + this.proposalService.getListVoteFromIndexer(payloads, null).subscribe((res) => { + if (res?.vote) { + if (this.voteData.all.votes.length % 25 !== res?.vote?.length) { this.voteData.all = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.all.votes, ...res.vote], + nextKey: res?.vote[res?.vote?.length - 1]?.height, + votes: [...this.voteData.all.votes, ...res?.vote], }; } this.voteDataList = this.voteData?.all.votes; diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 9459c1c7a..746dfa511 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -240,7 +240,7 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } async getListDelegator(nextKey = null, isInit = true) { - const res = await this.validatorService.delegators(100, this.currentAddress, nextKey); + const res = await this.validatorService.delegator(100, this.currentAddress, nextKey); if (res.data?.pagination?.next_key) { this.nextKeyDelegator = encodeURIComponent(res.data?.pagination?.next_key); From dafca76073c972fa93ce55810acde37cfb8b032f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 10:22:51 +0700 Subject: [PATCH 048/315] Merge remote-tracking branch 'origin/develop' into baseline/serenity_20230606 # Conflicts: # src/app/core/services/token.service.ts # src/app/pages/dashboard/dashboard.component.ts (cherry picked from commit 32172bec5fae46fdde761082beb313e3af8aa011) --- src/app/core/services/common.service.ts | 16 +---- src/app/core/services/proposal.service.ts | 32 +--------- src/app/core/services/token.service.ts | 61 +------------------ src/app/core/services/validator.service.ts | 6 +- .../nft-list/nft-list.component.html | 2 +- .../block-detail/block-detail.component.html | 4 +- .../summary-info/summary-info.component.html | 14 +++-- .../validators-votes.component.ts | 2 +- .../proposal-detail/votes/votes.component.ts | 39 ++++++------ .../validators-detail.component.ts | 2 +- 10 files changed, 42 insertions(+), 136 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index b8c20c645..b8c46c1f4 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -2,14 +2,12 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import axios from 'axios'; import { formatDistanceToNowStrict } from 'date-fns'; -import * as _ from 'lodash'; import * as moment from 'moment'; import { BehaviorSubject, Observable } from 'rxjs'; -import { CHART_RANGE, DATEFORMAT } from '../constants/common.constant'; +import { DATEFORMAT } from '../constants/common.constant'; import { STATUS_VALIDATOR } from '../constants/validator.enum'; import { EnvironmentService } from '../data-services/environment.service'; import { formatTimeInWords, formatWithSchema } from '../helpers/date'; -import { LCD_COSMOS } from '../constants/url.constant'; @Injectable() export class CommonService { @@ -72,17 +70,13 @@ export class CommonService { } } - getValidatorImg(identity: string) { - return axios.get(`https://keybase.io/_/api/1.0/user/lookup.json?key_suffix=${identity}&fields=pictures`); - } - mappingNameIBC(value) { - let result = {display: value, decimals: 6}; + let result = { display: value, decimals: 6 }; if (value.indexOf('ibc') >= 0) { let temp = value.slice(value.indexOf('ibc')); result = this.coins.find((k) => k.denom === temp); } else { - result = {display: this.chainInfo.currencies[0].coinDenom, decimals: 6}; + result = { display: this.chainInfo.currencies[0].coinDenom, decimals: 6 }; } return result; } @@ -96,10 +90,6 @@ export class CommonService { return axios.get(`${this._environmentService.configValue.chain_info.rest}/cosmos/distribution/v1beta1/params`); } - getTokenByCoinId(range: string, id: string) { - return this._http.get(`${this.apiUrl}/metrics/token?range=${range}&coidId=${id}`); - } - getDefaultImg() { return this._environmentService.configValue.image_s3 + 'images/aura__ntf-default-img.png'; } diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index ff7fa0be1..812bb1659 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -25,19 +25,7 @@ export class ProposalService extends CommonService { super(http, environmentService); } - getValidatorVotesFromIndexer(proposalid): Observable { - const params = _({ - chainid: this.chainInfo.chainId, - proposalid: proposalid, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/votes/validators`, { params }); - } - - getValidatorVotesFromIndexerV2(proposalId): Observable { + getValidatorVotesFromIndexer(proposalId): Observable { const operationsDoc = ` query auratestnet_validator($proposalId: Int = null, $limit: Int = 10) { ${this.envDB} { @@ -66,22 +54,6 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - // getListVoteFromIndexer(payload, option): Observable { - // const params = _({ - // chainid: this.chainInfo.chainId, - // nextKey: payload.nextKey, - // reverse: false, - // pageLimit: payload.pageLimit, - // answer: option, - // proposalid: payload.proposalid, - // }) - // .omitBy(_.isNull) - // .omitBy(_.isUndefined) - // .value(); - - // return this.http.get(`${this.indexerUrl}/votes`, { params }); - // } - getProposalData(payload) { const operationsDoc = ` query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null) { @@ -127,7 +99,7 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getListVoteFromIndexerV2(payload, option): Observable { + getListVoteFromIndexer(payload, option): Observable { const operationsDoc = ` query auratestnet_vote($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { ${this.envDB} { diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 292339014..a68ae2d72 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -1,15 +1,13 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import axios from 'axios'; import * as _ from 'lodash'; import { Observable } from 'rxjs'; -import { LENGTH_CHARACTER } from '../constants/common.constant'; +import { LCD_COSMOS } from '../constants/url.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { RangeType } from '../models/common.model'; -import { CommonService } from './common.service'; import { checkEnvQuery } from '../utils/common/info-common'; -import { map } from 'rxjs/operators'; -import { LCD_COSMOS } from '../constants/url.constant'; -import axios from 'axios'; +import { CommonService } from './common.service'; @Injectable() export class TokenService extends CommonService { @@ -38,58 +36,6 @@ export class TokenService extends CommonService { return this.http.get(`${this.apiUrl}/cw721-tokens/${address}`); } - getListTokenTransferIndexerV2(pageLimit: string | number, contractAddress = '', filterData: any, nextKey = null) { - const envDB = checkEnvQuery(this.environmentService.configValue.env); - let filterQuery = ''; - if (filterData?.keyWord) { - if ( - filterData?.keyWord.length === LENGTH_CHARACTER.TRANSACTION && - filterData?.keyWord == filterData?.keyWord.toUpperCase() - ) { - filterQuery = filterQuery.concat(`, hash: {_eq: "${filterData?.keyWord}" }`); - } else if (filterData['isSearchWallet']) { - filterQuery = filterQuery.concat(`, events: {event_attributes: {value: {_eq: "${filterData?.keyWord}" }}}`); - } else { - filterQuery = filterQuery.concat( - `, events: {event_attributes: {key: {_eq: "token_id"}, value: {_eq: "${filterData?.keyWord}" }}}`, - ); - } - } - if (nextKey) { - filterQuery = filterQuery.concat(', id: {_lt: ' + `${nextKey}` + '}'); - } - - const operationsDoc = ` - query getListTx($limit: Int, $event_attr_val: String, $tx_msg_val: jsonb) { - ${envDB} { - transaction(limit: $limit, order_by: {timestamp: desc}, where: {_or: [{events: {event_attributes: {key: {_eq: "_contract_address"}, value: {_eq: $event_attr_val}}, type: {_eq: "execute"}}}, {transaction_messages: {content: {_contains: $tx_msg_val}}}] ${filterQuery} }) { - id - height - hash - timestamp - code - gas_used - gas_wanted - data(path: "tx") - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: pageLimit, - event_attr_val: contractAddress, - tx_msg_val: { - contract: contractAddress, - }, - }, - operationName: 'getListTx', - }) - .pipe(map((res) => (res?.data ? res?.data[envDB] : null))); - } - getListTokenNFTFromIndexer(payload): Observable { const params = _({ chainid: this.chainInfo.chainId, @@ -98,7 +44,6 @@ export class TokenService extends CommonService { contractAddress: payload.contractAddress, pageLimit: payload.pageLimit, pageOffset: payload.pageOffset, - // countTotal: true, contractType: payload.contractType, isBurned: false, }) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index e3892a091..a231f3883 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -140,7 +140,7 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators/delegations/${address}`); } - delegators(pageLimit = 100, address: string, nextKey = null) { + delegator(pageLimit = 100, address: string, nextKey = null) { return axios.get( `${this.chainInfo.rest}/${LCD_COSMOS.STAKING}/validators/${address}/delegations?pagination.limit=${pageLimit}&pagination.key=${nextKey}&pagination.reverse=true`, ); @@ -154,10 +154,6 @@ export class ValidatorService extends CommonService { return this.http.get(`${this.apiUrl}/validators/validator-info?address=${addressList}`); } - getStakeInfo(delegatorAddress: string): Observable { - return this.http.get(`${this.apiUrl}/validators/delegations/delegator/${delegatorAddress}`); - } - getUptimeLCD(block = null) { if (!block) { block = 'latest'; diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.html b/src/app/pages/account/account-detail/nft-list/nft-list.component.html index eb0053fb7..132a52900 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.html +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.html @@ -1,4 +1,4 @@ -

NFTs ({{ nftList.length || 0 }} NFTs and more)

+

NFTs ({{ nftList?.length || 0 }} NFTs and more)

diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index 21f5ac77e..30c408300 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -252,7 +252,7 @@

Events

@@ -264,7 +264,7 @@

Events

- +
{{ data.key | decodeData diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index 2cd01362a..b5f082952 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -55,15 +55,19 @@

Proposer
- + - {{ proposalDetail.proposer ? proposalDetail.proposer.description.moniker : proposalDetail.proposer_address }} + {{ + proposalDetail?.proposer + ? proposalDetail?.proposer?.description?.moniker + : proposalDetail?.proposer_address + }} {{ - proposalDetail.proposer - ? proposalDetail.proposer.description.moniker - : (proposalDetail.proposer_address | cutStringPipe : 8 : 8) + proposalDetail?.proposer + ? proposalDetail?.proposer?.description.moniker + : (proposalDetail?.proposer_address | cutStringPipe : 8 : 8) }} diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index f3d545523..9e8379314 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -71,7 +71,7 @@ export class ValidatorsVotesComponent implements OnInit { getValidatorVotes(isInit = false): void { if (this.proposalId) { - this.proposalService.getValidatorVotesFromIndexerV2(this.proposalId).subscribe((res) => { + this.proposalService.getValidatorVotesFromIndexer(this.proposalId).subscribe((res) => { let validatorVote = []; if (res?.validator) { validatorVote = _.get(res, 'validator').map((item) => { diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index 3b6495008..918872b71 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -43,7 +43,6 @@ export class VotesComponent implements OnChanges { countCurrent: string = ''; voteDataListLoading = true; isFirstChange = false; - TAB_ALL = 0; proposalVote = PROPOSAL_TABLE_MODE.VOTES; voteData = { @@ -87,19 +86,19 @@ export class VotesComponent implements OnChanges { combineLatest([ this.proposalService - .getListVoteFromIndexerV2(payloads, null) + .getListVoteFromIndexer(payloads, null) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), ]).subscribe((res) => { res[0] && ((dta) => (this.voteData.all = dta))(res[0]); @@ -167,7 +166,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_YES: payloads.nextKey = this.voteData.yes.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { if (res.vote) { if (this.voteData.yes.votes.length % 25 !== res.vote?.length) { this.voteData.yes = { @@ -183,7 +182,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_ABSTAIN: payloads.nextKey = this.voteData.abstain.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { if (res.vote) { if (this.voteData.abstain.votes.length % 25 !== res.vote?.length) { this.voteData.abstain = { @@ -199,7 +198,7 @@ export class VotesComponent implements OnChanges { case VOTE_OPTION.VOTE_OPTION_NO: payloads.nextKey = this.voteData.no.nextKey; if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { if (res.vote) { if (this.voteData.no.votes.length % 25 !== res.vote?.length) { this.voteData.no = { @@ -216,16 +215,16 @@ export class VotesComponent implements OnChanges { payloads.nextKey = this.voteData.noWithVeto.nextKey; if (payloads.nextKey) { this.proposalService - .getListVoteFromIndexerV2(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) + .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) .subscribe((res) => { - if (res.vote) { - if (this.voteData.noWithVeto.votes.length % 25 !== res.vote.length) { + if (res?.vote) { + if (this.voteData.noWithVeto.votes.length % 25 !== res?.vote?.length) { this.voteData.noWithVeto = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.noWithVeto.votes, ...res.vote], + nextKey: res?.vote[res.vote?.length - 1]?.height, + votes: [...this.voteData.noWithVeto.votes, ...res?.vote], }; } - this.voteDataList = this.voteData?.noWithVeto.votes; + this.voteDataList = this.voteData?.noWithVeto?.votes; } }); } @@ -233,12 +232,12 @@ export class VotesComponent implements OnChanges { default: payloads.nextKey = this.voteData.all?.nextKey; if (payloads?.nextKey) { - this.proposalService.getListVoteFromIndexerV2(payloads, null).subscribe((res) => { - if (res.vote) { - if (this.voteData.all.votes.length % 25 !== res.vote.length) { + this.proposalService.getListVoteFromIndexer(payloads, null).subscribe((res) => { + if (res?.vote) { + if (this.voteData.all.votes.length % 25 !== res?.vote?.length) { this.voteData.all = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.all.votes, ...res.vote], + nextKey: res?.vote[res?.vote?.length - 1]?.height, + votes: [...this.voteData.all.votes, ...res?.vote], }; } this.voteDataList = this.voteData?.all.votes; diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 9459c1c7a..746dfa511 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -240,7 +240,7 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } async getListDelegator(nextKey = null, isInit = true) { - const res = await this.validatorService.delegators(100, this.currentAddress, nextKey); + const res = await this.validatorService.delegator(100, this.currentAddress, nextKey); if (res.data?.pagination?.next_key) { this.nextKeyDelegator = encodeURIComponent(res.data?.pagination?.next_key); From c77b852bf5ae15f1dd12c4ee820c83ad8ea23767 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Tue, 6 Jun 2023 10:30:41 +0700 Subject: [PATCH 049/315] handle amount --- .../community-pool-proposal.component.html | 2 +- .../card-mob-explain.component.html | 9 ++++++--- .../card-mob-explain/card-mob-explain.component.ts | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index 45bca4366..b3d213da3 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -135,7 +135,7 @@

Proposals

subLabel: '#' + data.proposal_id }" [status]="getStatus(data.status)" - [tokenAmount]="{ amount: data.content.amount[0].amount, decimal: data.decimal, isAura: true ? data.logo === '' : false }" + [tokenAmount]="{ amount: data.content.amount[0].amount, decimal: data.decimal, isAura: data.logo === '' }" [content]="[ { label: 'Sender', diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html index 8291271ab..954c99dae 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html @@ -18,10 +18,13 @@
-
+
{{data.label}}
-
- +
+
+ + {{denom}} +
diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts index 415c22b81..6d46d66e0 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; +import {EnvironmentService} from "src/app/core/data-services/environment.service"; export interface CardMobExplainTitle { label: string; @@ -22,14 +23,23 @@ export interface CardMobSimpleAmount { styleUrls: ['./card-mob-explain.component.scss'], }) export class CardMobExplainComponent implements OnInit { + denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; @Input() title: CardMobExplainTitle; @Input() status: any; @Input() content: CardMobContent[]; @Input() tokenAmount: any; - constructor() {} + constructor( + private environmentService: EnvironmentService,) {} ngOnInit(): void { - console.log(this.tokenAmount); + if(this.tokenAmount) { + this.content.splice(2, 0, { + label: 'Amount', + class: null, + info: this.tokenAmount.amount + }); + this.content.join(" ") + } } } From 370ed7d143230ecf5d2d29bf65f5e119f64c1db0 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Tue, 6 Jun 2023 10:38:16 +0700 Subject: [PATCH 050/315] handle amount --- .../community-pool-proposal.component.html | 7 ++++++- .../card-mob-explain.component.html | 4 ++-- .../card-mob-explain.component.ts | 18 ++++-------------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index b3d213da3..bafe530ab 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -135,7 +135,6 @@

Proposals

subLabel: '#' + data.proposal_id }" [status]="getStatus(data.status)" - [tokenAmount]="{ amount: data.content.amount[0].amount, decimal: data.decimal, isAura: data.logo === '' }" [content]="[ { label: 'Sender', @@ -157,6 +156,12 @@

Proposals

shortenAddress(data.content.recipient) + '
' }, + { + label: 'Amount', + class: '', + info: data.content.amount[0].amount, + isAmount: true + }, { label: 'Voting End', class: '', diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html index 954c99dae..66cef90b4 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.html @@ -20,8 +20,8 @@
{{data.label}}
-
-
+
+
{{denom}}
diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts index 6d46d66e0..c1416f18d 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts @@ -10,13 +10,8 @@ export interface CardMobContent { label: string; class?: string; info: any; + isAmount?: boolean; } -export interface CardMobSimpleAmount { - amount: string; - decimal: number; - isAura: boolean; -} - @Component({ selector: 'app-card-mob-explain', templateUrl: './card-mob-explain.component.html', @@ -32,14 +27,9 @@ export class CardMobExplainComponent implements OnInit { private environmentService: EnvironmentService,) {} ngOnInit(): void { - if(this.tokenAmount) { - this.content.splice(2, 0, { - label: 'Amount', - class: null, - info: this.tokenAmount.amount - }); - this.content.join(" ") - } + console.log(this.content) } } + +// [tokenAmount]="{ amount: data.content.amount[0].amount, decimal: data.decimal, isAura: data.logo === '' }" From 79e0ca78919ebfda618ed7e2d64448572223b970 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 11:16:44 +0700 Subject: [PATCH 051/315] add table proposal --- .../community-pool-proposal.component.html | 6 +++--- .../community-pool-proposal.component.ts | 10 +++++++--- .../card-mob-explain/card-mob-explain.component.ts | 12 +++--------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index bafe530ab..3153205c6 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -141,7 +141,7 @@

Proposals

class: '', info: '' + shortenAddress(distributionAcc) + '' @@ -151,7 +151,7 @@

Proposals

class: '', info: '' + shortenAddress(data.content.recipient) + '' @@ -177,7 +177,7 @@

Proposals

diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts index 4c192e999..18fd40556 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -121,6 +121,11 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { this.pageData.pageIndex = e.pageIndex; if (this.pageData.length <= this.pageData.pageSize * (this.pageData.pageIndex + 1)) { this.getListProposal(); + } else { + this.dataSourceMob = this.dataSource.data.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, + ); } } @@ -154,10 +159,9 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { } } this.dataSourceMob = this.dataSource.data.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, ); - console.log(this.dataSourceMob); this.pageData.length = this.dataSource.data.length; }); } diff --git a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts index c1416f18d..555a209f0 100644 --- a/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts +++ b/src/app/shared/components/cards/card-mob-explain/card-mob-explain.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; -import {EnvironmentService} from "src/app/core/data-services/environment.service"; +import { EnvironmentService } from 'src/app/core/data-services/environment.service'; export interface CardMobExplainTitle { label: string; @@ -23,13 +23,7 @@ export class CardMobExplainComponent implements OnInit { @Input() status: any; @Input() content: CardMobContent[]; @Input() tokenAmount: any; - constructor( - private environmentService: EnvironmentService,) {} + constructor(private environmentService: EnvironmentService) {} - ngOnInit(): void { - console.log(this.content) - - } + ngOnInit(): void {} } - -// [tokenAmount]="{ amount: data.content.amount[0].amount, decimal: data.decimal, isAura: data.logo === '' }" From e499bced95a4bc2e3a17e7507c174b1f8bef37e9 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 11:44:38 +0700 Subject: [PATCH 052/315] add table proposal --- .../proposal-list/community-pool-proposal.component.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts index 18fd40556..e608353f5 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -104,12 +104,17 @@ export class CommunityPoolProposalComponent implements OnInit, OnDestroy { } paginatorEmit(event): void { + this.pageData.pageIndex = PAGE_EVENT.PAGE_INDEX; if (this.dataSource) { this.dataSource.paginator = event; } else { this.dataSource = new MatTableDataSource(); this.dataSource.paginator = event; } + this.dataSourceMob = this.dataSource.data.slice( + this.pageData.pageIndex * this.pageSizeMob, + this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, + ); } resetSearch() { From 73598d18000363512bf20ff061abd2acb6c53f23 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 13:20:03 +0700 Subject: [PATCH 053/315] update link proposal --- .../proposal-list/community-pool-proposal.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index 3153205c6..8ddd3b931 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -41,7 +41,7 @@

Community Pool Spent Proposals

Title - {{ element.content.title }} + {{ element.content.title }} From c9404d88dcdb8c7a0b0ffa456a1efdffc2b3cbf0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 13:39:08 +0700 Subject: [PATCH 054/315] Merge branch 'develop' into feature/community_pool --- src/app/core/services/proposal.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 29b763739..e2a67bd8d 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -38,6 +38,7 @@ export class ProposalService extends CommonService { updated_at } description + operator_address } } } From 5e7fd369ef730f47fda1b88bc5ed0325e3f83189 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 6 Jun 2023 13:50:23 +0700 Subject: [PATCH 055/315] Merge branch 'develop' into feature/community_pool --- .../user-wallet-info/user-wallet-info.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html index d5f7cfb13..40eeb8205 100644 --- a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html +++ b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.html @@ -7,14 +7,14 @@
Available Balance:
- + {{ denom }}
Total Staked:
- + {{ denom }}
From 1c7ce585357ef94eefc894abe2dc3aee497c396b Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 6 Jun 2023 14:29:04 +0700 Subject: [PATCH 056/315] [TamTM6] update token temp v2 --- src/app/core/services/token.service.ts | 39 ++- src/app/core/utils/common/info-common.ts | 19 +- .../nft-list/nft-list.component.html | 15 +- .../nft-list/nft-list.component.ts | 9 +- .../token-holders-tab.component.ts | 1 - .../token-inventory-tab.component.ts | 227 +++++++++++------- .../cards/nft-card/nft-card.component.html | 18 +- .../cards/nft-card/nft-card.component.ts | 60 ++++- 8 files changed, 257 insertions(+), 131 deletions(-) diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index d949b0f95..5a9f57b32 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -56,6 +56,39 @@ export class TokenService extends CommonService { }); } + getListTokenNFTFromIndexerV2(payload): Observable { + const operationsDoc = ` + query MyQuery($contract_address: String, $limit: Int = 10) { + auratestnet { + cw721_token(limit: $limit, where: {cw721_contract: {smart_contract: {address: {_eq: $contract_address}}}}, order_by: {created_at: desc}) { + token_id + owner + media_info + last_updated_height + created_at + burned + cw721_contract { + smart_contract { + address + } + } + } + } + } + `; + payload['contractAddress'] = 'aura1vl8mq97m5r48sejm5rtlxc724mzjtgs80nseka00xx6vyysffk2s3kpavh'; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variable: { + limit: payload?.limit || 20, + contract_address: payload?.contract_address, + }, + operationName: 'MyQuery', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getListTokenHolder( limit: string | number, offset: string | number, @@ -83,13 +116,13 @@ export class TokenService extends CommonService { } } `; - payload['contractAddress'] = "aura1vl8mq97m5r48sejm5rtlxc724mzjtgs80nseka00xx6vyysffk2s3kpavh"; + payload['contractAddress'] = 'aura1vl8mq97m5r48sejm5rtlxc724mzjtgs80nseka00xx6vyysffk2s3kpavh'; return this.http .post(this.graphUrl, { query: operationsDoc, variable: { limit: payload?.limit || 20, - contract_address: "", + contract_address: '', }, operationName: 'MyQuery', }) @@ -123,6 +156,6 @@ export class TokenService extends CommonService { } getAssetCW721ByContract(payload): Observable { - return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-contract/`,payload); + return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-contract/`, payload); } } diff --git a/src/app/core/utils/common/info-common.ts b/src/app/core/utils/common/info-common.ts index 6fd6af385..fb8cbb75a 100644 --- a/src/app/core/utils/common/info-common.ts +++ b/src/app/core/utils/common/info-common.ts @@ -54,12 +54,7 @@ export function parseDataTransaction(trans: any, coinMinimalDenom: string, token const typeTrans = TYPE_TRANSACTION.find((f) => f.label.toLowerCase() === typeOrigin?.toLowerCase()); trans.tx_hash = trans.hash; //get amount of transaction - trans.amount = getAmount( - trans.data?.tx?.body?.messages, - typeOrigin, - trans.tx_response?.raw_log, - coinMinimalDenom, - ); + trans.amount = getAmount(trans.data?.tx?.body?.messages, typeOrigin, trans.tx_response?.raw_log, coinMinimalDenom); trans.fee = balanceOf(trans?.data?.auth_info?.fee?.amount[0]?.amount); trans.gas_limit = balanceOf(trans?.data?.auth_info?.fee?.gas_limit); trans.height = trans?.height; @@ -80,11 +75,15 @@ export function checkTypeFile(nft: any) { let nftType = nft.img_type || ''; let content_type = ''; if (!nftType) { - if (nft?.animation) { - nftType = nft?.animation?.content_type || ''; + if ( + (typeof nft?.media_info?.offchain?.animation === 'object' && + Object.keys(nft?.media_info?.offchain?.animation)?.length > 0) || + nft?.animation + ) { + nftType = nft?.media_info?.offchain?.animation?.content_type || nft?.animation?.content_type || ''; } - if (nft?.image && nftType == '') { - nftType = nft?.image?.content_type || ''; + if (nft?.media_info?.offchain?.image && nftType == '') { + nftType = nft?.media_info?.offchain?.image?.content_type || ''; } } diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.html b/src/app/pages/account/account-detail/nft-list/nft-list.component.html index eb0053fb7..4dc1bf902 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.html +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.html @@ -7,7 +7,7 @@

NFTs ({{ nftList.length || 0 }}
- +

+ *ngIf="data[template.matColumnDef] === ContractVerifyType.Verified"> {{ data['verified_at'] | customDate : 'yyyy-MM-dd' }}
{{ data['verified_at'] | customDate : 'HH:mm:ss' }}
-
-
+
-
{{ (data[template.matColumnDef] | cutStringPipe : 16) || '-' }} @@ -167,12 +167,13 @@

Contracts

- - + +
+ +
diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index ebf0d94e1..782c0b844 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -1,19 +1,16 @@ -import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { DatePipe } from '@angular/common'; -import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { ContractRegisterType, ContractVerifyType } from 'src/app/core/constants/contract.enum'; -import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; import { DATEFORMAT, PAGE_EVENT } from '../../../core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from '../../../core/constants/token.constant'; import { TableTemplate } from '../../../core/models/common.model'; import { ContractService } from '../../../core/services/contract.service'; import { shortenAddress } from '../../../core/utils/common/shorten'; -import { Globals } from '../../../global/global'; @Component({ selector: 'app-contracts-list', @@ -21,8 +18,6 @@ import { Globals } from '../../../global/global'; styleUrls: ['./contracts-list.component.scss'], }) export class ContractsListComponent implements OnInit, OnDestroy { - @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; - textSearch = ''; templates: Array = [ { matColumnDef: 'address', headerCellDef: 'Address', isUrl: '/contracts', isShort: true }, { matColumnDef: 'name', headerCellDef: 'Contract Name' }, @@ -36,29 +31,27 @@ export class ContractsListComponent implements OnInit, OnDestroy { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; - pageIndex = 0; - dataSource = new MatTableDataSource(); - maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; - breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); filterButtons = []; + listContract = []; + textSearch = ''; + + dataSource = new MatTableDataSource(); searchSubject = new Subject(); destroy$ = new Subject(); - contractRegisterType = ContractRegisterType; - listContract = []; - contractVerifyType = ContractVerifyType; + + ContractRegisterType = ContractRegisterType; + ContractVerifyType = ContractVerifyType; + MAX_LENGTH_SEARCH_TOKEN = MAX_LENGTH_SEARCH_TOKEN; constructor( public translate: TranslateService, - public global: Globals, private contractService: ContractService, private datePipe: DatePipe, - private layout: BreakpointObserver, ) {} ngOnDestroy(): void { - // throw new Error('Method not implemented.'); this.destroy$.next(); this.destroy$.complete(); } @@ -70,7 +63,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { .asObservable() .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) .subscribe(() => { - this.pageChange.selectPage(0); + this.pageEvent(0); }); } @@ -80,11 +73,12 @@ export class ContractsListComponent implements OnInit, OnDestroy { getListContract() { let payload = { - limit: 20, + limit: this.pageData.pageSize, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, keyword: this.textSearch, contractType: this.filterButtons?.length ? this.filterButtons : null, - offset: this.pageIndex * this.pageData.pageSize, }; + this.contractService.getListContract(payload).subscribe((res) => { if (res?.smart_contract?.length) { res?.smart_contract.forEach((item) => { @@ -96,7 +90,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { item.compiler_version = item.code?.code_id_verifications[0]?.compiler_version; item.contract_verification = item.code.code_id_verifications[0]?.verification_status; }); - this.dataSource.data = [...res.smart_contract]; + this.dataSource.data = res.smart_contract; this.pageData.length = res.smart_contract_aggregate?.aggregate?.count; } else { this.dataSource.data = []; @@ -106,12 +100,12 @@ export class ContractsListComponent implements OnInit, OnDestroy { }); } - paginatorEmit(event): void { - this.dataSource.paginator = event; - } + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; + } - pageEvent(e: PageEvent): void { - this.pageIndex = e.pageIndex; this.getListContract(); } @@ -125,20 +119,18 @@ export class ContractsListComponent implements OnInit, OnDestroy { resetFilterSearch() { this.textSearch = ''; this.filterButtons = []; - this.dataSource.data = []; - this.pageData.length = 0; - this.onKeyUp(); + + this.pageEvent(0); } filterButton(val: string) { + console.log(val); + const i = this.filterButtons.findIndex((i) => i === val); + switch (val) { case 'All': - if (i >= 0) { - this.filterButtons = this.filterButtons.filter((item) => item !== val); - } else { - this.filterButtons = []; - } + this.filterButtons = []; break; case ContractRegisterType.CW20: case ContractRegisterType.CW721: @@ -151,6 +143,6 @@ export class ContractsListComponent implements OnInit, OnDestroy { this.filterButtons.push(val); } } - this.pageChange.selectPage(0); + this.pageEvent(0); } } diff --git a/src/app/pages/contracts/contracts.module.ts b/src/app/pages/contracts/contracts.module.ts index 0d0ebf522..050ff5e96 100644 --- a/src/app/pages/contracts/contracts.module.ts +++ b/src/app/pages/contracts/contracts.module.ts @@ -30,6 +30,7 @@ import { ContractsRoutingModule } from './contracts-routing.module'; import { ContractsTransactionsComponent } from './contracts-transactions/contracts-transactions.component'; import { ContractVerifyStepsComponent } from './contracts-verify/contract-verify-steps/contract-verify-steps.component'; import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.component'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; @NgModule({ declarations: [ @@ -43,7 +44,7 @@ import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.co CodeContractComponent, ContractsVerifyComponent, ContractVerifyStepsComponent, - ContractsRegisterComponent + ContractsRegisterComponent, ], imports: [ CommonModule, @@ -65,7 +66,8 @@ import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.co ClickOutsideModule, WriteContractModule, ReadContractModule, - PopupAddZeroModule + PopupAddZeroModule, + APaginatorModule, ], providers: [ContractService], exports: [ContractVerifyStepsComponent], diff --git a/src/app/shared/components/a-paginator/a-paginator.component.html b/src/app/shared/components/a-paginator/a-paginator.component.html index bf87b3fdd..48f5a6a2c 100644 --- a/src/app/shared/components/a-paginator/a-paginator.component.html +++ b/src/app/shared/components/a-paginator/a-paginator.component.html @@ -1,19 +1,23 @@ - - + + + + Previous + + + Next + - - Previous - - - - Next - - - First - Last - {{ p }} - - \ No newline at end of file + First + Last + {{ p }} + + From 1472349eff3ce0e466b023962088618c31e54f07 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 14 Jun 2023 13:54:14 +0700 Subject: [PATCH 099/315] remove filed amount --- src/app/core/constants/contract.constant.ts | 10 +------- .../account-detail.component.html | 15 ----------- .../account-detail.component.ts | 1 - .../pages/dashboard/dashboard.component.html | 2 +- .../transaction/transaction.component.html | 25 ------------------- .../transaction/transaction.component.ts | 1 - 6 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/app/core/constants/contract.constant.ts b/src/app/core/constants/contract.constant.ts index 0340b9613..397820194 100644 --- a/src/app/core/constants/contract.constant.ts +++ b/src/app/core/constants/contract.constant.ts @@ -37,18 +37,11 @@ export const CONTRACT_TABLE_TEMPLATES: Array = [ { matColumnDef: 'txHash', headerCellDef: 'Txn Hash', type: 'hash-url', headerWidth: 12, isUrl: '/transaction' }, { matColumnDef: 'method', headerCellDef: 'Method', type: 'status', headerWidth: 12 }, { matColumnDef: 'status', headerCellDef: 'Result', type: 'result', headerWidth: 9 }, - { - matColumnDef: 'blockHeight', - headerCellDef: 'Block', - type: 'hash-url', - headerWidth: 6, - isUrl: '/blocks' - }, + { matColumnDef: 'blockHeight', headerCellDef: 'Block', type: 'hash-url', headerWidth: 6, isUrl: '/blocks' }, { matColumnDef: 'time', headerCellDef: 'Time', type: 'time-distance', headerWidth: 8, suffix: 'ago' }, { matColumnDef: 'from', headerCellDef: 'From', type: 'hash-url', headerWidth: 12, isUrl: '/account' }, { matColumnDef: 'label', headerCellDef: '', type: 'status', headerWidth: 6, justify: 'center' }, { matColumnDef: 'to', headerCellDef: 'To', type: 'hash-url', headerWidth: 12, isUrl: '/contracts' }, - { matColumnDef: 'value', headerCellDef: 'Value', type: 'numb', suffix: 'AURA', headerWidth: 10 }, { matColumnDef: 'fee', headerCellDef: 'Txn Fee', type: 'numb', headerWidth: 10 }, ]; @@ -118,7 +111,6 @@ export const REGISTER_CONTRACT = [ }, ]; - export const LIST_ZEROES = [ { value: '6', diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index bb92bf0f3..cd8b52170 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -177,21 +177,6 @@

Coins & Tokens ({{ totalAssets || 0 }})

{{ denom }}

-
{{ data[template.matColumnDef] }}
diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index 4c510b6ff..f4ecfdc4a 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -59,7 +59,6 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { { matColumnDef: 'tx_hash', headerCellDef: 'Tx Hash' }, { matColumnDef: 'type', headerCellDef: 'Type' }, { matColumnDef: 'status', headerCellDef: 'Result' }, - { matColumnDef: 'amount', headerCellDef: 'Amount' }, { matColumnDef: 'fee', headerCellDef: 'Fee' }, { matColumnDef: 'height', headerCellDef: 'Height' }, { matColumnDef: 'timestamp', headerCellDef: 'Time' }, diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 9f7ba1c9f..3c8d3f779 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -389,7 +389,7 @@

Blocks

*ngSwitchCase="'proposer'" class="text--primary cursor-pointer text-break" [routerLink]="['/validators', data.operator_address]"> - {{ data[template.matColumnDef] }} + {{ data[template.matColumnDef] | stringEllipsis : 10 }} {{ denom }}
-
{{ data[template.matColumnDef] }}
@@ -100,14 +83,6 @@ status: data.code }" [content]="[ - { - label: 'Amount', - class: 'body-01-mob text--gray-1', - info: - data.amount > 0 - ? (+data.amount | mask: 'separator.6') + ' ' + commonService.mappingNameIBC(data?.denom)?.display + '' - : checkAmountValue(data.amount, data.tx_hash) - }, { label: 'Fee', class: 'body-01-mob text--gray-1', diff --git a/src/app/pages/transaction/transaction.component.ts b/src/app/pages/transaction/transaction.component.ts index 67bfa770c..2bd9ca6b8 100644 --- a/src/app/pages/transaction/transaction.component.ts +++ b/src/app/pages/transaction/transaction.component.ts @@ -17,7 +17,6 @@ export class TransactionComponent implements OnInit { { matColumnDef: 'tx_hash', headerCellDef: 'Tx Hash' }, { matColumnDef: 'type', headerCellDef: 'Type' }, { matColumnDef: 'status', headerCellDef: 'Result' }, - { matColumnDef: 'amount', headerCellDef: 'Amount' }, { matColumnDef: 'fee', headerCellDef: 'Fee' }, { matColumnDef: 'height', headerCellDef: 'Height' }, { matColumnDef: 'timestamp', headerCellDef: 'Time' }, From f0c5cb796a4c5a2aaeaf31d7233b946933ea03d1 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Wed, 14 Jun 2023 15:47:42 +0700 Subject: [PATCH 100/315] update proposal vote list --- src/app/core/constants/proposal.constant.ts | 32 +-- src/app/core/services/proposal.service.ts | 84 ++++++- .../validators-votes.component.ts | 42 ++-- .../votes/votes.component.html | 6 +- .../proposal-detail/votes/votes.component.ts | 216 ++++-------------- .../proposal-table.component.html | 7 +- .../proposal-table.component.ts | 81 +++++-- src/app/pages/proposal/proposal.component.ts | 10 +- .../a-paginator/a-paginator.component.scss | 4 + 9 files changed, 238 insertions(+), 244 deletions(-) diff --git a/src/app/core/constants/proposal.constant.ts b/src/app/core/constants/proposal.constant.ts index 08d738bd2..e37d10525 100644 --- a/src/app/core/constants/proposal.constant.ts +++ b/src/app/core/constants/proposal.constant.ts @@ -4,7 +4,7 @@ export enum VOTING_STATUS { PROPOSAL_STATUS_VOTING_PERIOD = 'PROPOSAL_STATUS_VOTING_PERIOD', PROPOSAL_STATUS_DEPOSIT_PERIOD = 'PROPOSAL_STATUS_DEPOSIT_PERIOD', PROPOSAL_STATUS_FAILED = 'PROPOSAL_STATUS_FAILED', - PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT = 'PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT' + PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT = 'PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT', } export const PROPOSAL_STATUS = [ @@ -36,42 +36,42 @@ export const PROPOSAL_STATUS = [ ]; export enum VOTE_OPTION { - VOTE_OPTION_NULL = 'null', - VOTE_OPTION_UNSPECIFIED = 'VOTE_OPTION_UNSPECIFIED', - VOTE_OPTION_YES = 'VOTE_OPTION_YES', - VOTE_OPTION_ABSTAIN = 'VOTE_OPTION_ABSTAIN', - VOTE_OPTION_NO = 'VOTE_OPTION_NO', - VOTE_OPTION_NO_WITH_VETO = 'VOTE_OPTION_NO_WITH_VETO', - VOTE_OPTION_EMPTY = 'VOTE_OPTION_EMPTY' + NULL = 'null', + UNSPECIFIED = 'VOTE_OPTION_UNSPECIFIED', + YES = 'VOTE_OPTION_YES', + ABSTAIN = 'VOTE_OPTION_ABSTAIN', + NO = 'VOTE_OPTION_NO', + NO_WITH_VETO = 'VOTE_OPTION_NO_WITH_VETO', + EMPTY = 'VOTE_OPTION_EMPTY', } export const PROPOSAL_VOTE = [ { - key: VOTE_OPTION.VOTE_OPTION_UNSPECIFIED, + key: VOTE_OPTION.UNSPECIFIED, value: 'All', class: '', voteOption: '', }, { - key: VOTE_OPTION.VOTE_OPTION_YES, + key: VOTE_OPTION.YES, value: 'Yes', class: 'primary', voteOption: 'Yes', }, { - key: VOTE_OPTION.VOTE_OPTION_NO, + key: VOTE_OPTION.NO, value: 'No', class: 'danger', voteOption: 'No', }, { - key: VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, + key: VOTE_OPTION.NO_WITH_VETO, value: 'NoWithVeto', class: 'info', voteOption: 'NoWithVeto', }, { - key: VOTE_OPTION.VOTE_OPTION_ABSTAIN, + key: VOTE_OPTION.ABSTAIN, value: 'Abstain', class: 'secondary', voteOption: 'Abstain', @@ -96,11 +96,11 @@ export enum VOTING_SUBTITLE { REJECT_1 = 'This proposal is rejected because there are more than {{proposalDetail.noWithVetoPercent}}% of No With Veto votes.', REJECT_2 = 'This proposal is rejected because it is above the threshold and received more than 50.00% of No votes.', REJECT_3 = 'This proposal is failed because it did not reach the quorum.', - FAILED = 'This proposal is failed because the upgrade can\'t be executed', + FAILED = "This proposal is failed because the upgrade can't be executed", } export enum VOTING_QUORUM { - REACHED= '(Reached)', + REACHED = '(Reached)', NOT_REACHED = '(Not Reached)', } @@ -108,4 +108,4 @@ export enum PROPOSAL_TABLE_MODE { VOTES = 'VOTES', DEPOSITORS = 'DEPOSITORS', VALIDATORS_VOTES = 'VALIDATORS_VOTES', -} \ No newline at end of file +} diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index db2f535d8..b89d10c3a 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -160,6 +160,80 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } + getListVoteFromIndexer2(payload, option): Observable { + const operationsDoc = ` + query auratestnet_vote($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { + ${this.envDB} { + vote(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: $voteOption}}, order_by: {height: $order}) { + height + proposal_id + txhash + vote_option + voter + transaction { + timestamp + } + } + vote_aggregate(where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: $voteOption}}) { + aggregate { + count + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.pageLimit, + order: 'desc', + proposalId: payload.proposalId, + voteOption: option || null, + offset: payload?.offset, + }, + operationName: 'auratestnet_vote', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + + getProposalVoteTotal(proposalId: number) { + const operationsDoc = ` + query getProposalVoteTotal($proposalId: Int) { + auratestnet { + ALL: vote_aggregate(where: {proposal_id: {_eq: $proposalId}}) { + ...aggregateCountFragment + } + VOTE_OPTION_YES: vote_aggregate(where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: "VOTE_OPTION_YES"}}) { + ...aggregateCountFragment + } + VOTE_OPTION_ABSTAIN: vote_aggregate(where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: "VOTE_OPTION_ABSTAIN"}}) { + ...aggregateCountFragment + } + VOTE_OPTION_NO: vote_aggregate(where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: "VOTE_OPTION_NO"}}) { + ...aggregateCountFragment + } + VOTE_OPTION_NO_WITH_VETO: vote_aggregate(where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: "VOTE_OPTION_NO_WITH_VETO"}}) { + ...aggregateCountFragment + } + } + } + + fragment aggregateCountFragment on auratestnet_vote_aggregate { + aggregate { + count + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { proposalId }, + operationName: 'getProposalVoteTotal', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getListVoteFromIndexer(payload, option): Observable { const operationsDoc = ` query auratestnet_vote($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { @@ -199,19 +273,19 @@ export class ProposalService extends CommonService { let result = ''; switch (option) { case 1: - result = VOTE_OPTION.VOTE_OPTION_YES; + result = VOTE_OPTION.YES; break; case 2: - result = VOTE_OPTION.VOTE_OPTION_ABSTAIN; + result = VOTE_OPTION.ABSTAIN; break; case 3: - result = VOTE_OPTION.VOTE_OPTION_NO; + result = VOTE_OPTION.NO; break; case 4: - result = VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO; + result = VOTE_OPTION.NO_WITH_VETO; break; default: - result = VOTE_OPTION.VOTE_OPTION_EMPTY; + result = VOTE_OPTION.EMPTY; break; } return result; diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index 0f32381e9..f8a8bff71 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -23,7 +23,7 @@ export class ValidatorsVotesComponent implements OnInit { @Input() proposalId: number; @ViewChild('customNav') customNav: NgbNav; PROPOSAL_VOTE_EXT = PROPOSAL_VOTE.concat({ - key: VOTE_OPTION.VOTE_OPTION_NULL, + key: VOTE_OPTION.NULL, value: 'Did not vote', class: '', voteOption: '', @@ -31,17 +31,17 @@ export class ValidatorsVotesComponent implements OnInit { TABS = this.PROPOSAL_VOTE_EXT.filter((vote) => [ - VOTE_OPTION.VOTE_OPTION_UNSPECIFIED, - VOTE_OPTION.VOTE_OPTION_YES, - VOTE_OPTION.VOTE_OPTION_ABSTAIN, - VOTE_OPTION.VOTE_OPTION_NO, - VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, - VOTE_OPTION.VOTE_OPTION_NULL, + VOTE_OPTION.UNSPECIFIED, + VOTE_OPTION.YES, + VOTE_OPTION.ABSTAIN, + VOTE_OPTION.NO, + VOTE_OPTION.NO_WITH_VETO, + VOTE_OPTION.NULL, ].includes(vote.key), ).map((vote) => ({ ...vote, value: vote.value.toUpperCase(), - key: vote.key === VOTE_OPTION.VOTE_OPTION_UNSPECIFIED ? '' : vote.key, + key: vote.key === VOTE_OPTION.UNSPECIFIED ? '' : vote.key, })); voteDataList: IValidatorVotes[] = []; @@ -87,20 +87,18 @@ export class ValidatorsVotesComponent implements OnInit { } this.voteData.all = validatorVote; - this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_YES); - this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_ABSTAIN); - this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_NO); - this.voteData.noWithVeto = validatorVote.filter( - (f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, - ); + this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); + this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.ABSTAIN); + this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO); + this.voteData.noWithVeto = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO_WITH_VETO); this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); this.voteDataList = [...this.voteData.all]; this.countVote.set('', this.voteData.all.length); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_YES, this.voteData.yes.length); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_ABSTAIN, this.voteData.abstain.length); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO, this.voteData.no.length); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, this.voteData.noWithVeto.length); + this.countVote.set(VOTE_OPTION.YES, this.voteData.yes.length); + this.countVote.set(VOTE_OPTION.ABSTAIN, this.voteData.abstain.length); + this.countVote.set(VOTE_OPTION.NO, this.voteData.no.length); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, this.voteData.noWithVeto.length); this.countVote.set('null', this.voteData.didNotVote.length); this.voteDataListLoading = false; @@ -128,16 +126,16 @@ export class ValidatorsVotesComponent implements OnInit { case '': this.voteDataList = this.voteData.all; break; - case VOTE_OPTION.VOTE_OPTION_YES: + case VOTE_OPTION.YES: this.voteDataList = this.voteData.yes || 0; break; - case VOTE_OPTION.VOTE_OPTION_ABSTAIN: + case VOTE_OPTION.ABSTAIN: this.voteDataList = this.voteData.abstain || 0; break; - case VOTE_OPTION.VOTE_OPTION_NO: + case VOTE_OPTION.NO: this.voteDataList = this.voteData.no || 0; break; - case VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO: + case VOTE_OPTION.NO_WITH_VETO: this.voteDataList = this.voteData.noWithVeto || 0; break; default: diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.html b/src/app/pages/proposal/proposal-detail/votes/votes.component.html index 9742056b4..33382e9bf 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.html +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.html @@ -20,11 +20,11 @@
+ (pageEventChange)="pageEventChange($event)">
diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index daefb7737..1e744db3c 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -25,22 +25,18 @@ export class VotesComponent implements OnChanges { @ViewChild('customNav') customNav: NgbNav; TABS = PROPOSAL_VOTE.filter((vote) => - [ - VOTE_OPTION.VOTE_OPTION_UNSPECIFIED, - VOTE_OPTION.VOTE_OPTION_YES, - VOTE_OPTION.VOTE_OPTION_ABSTAIN, - VOTE_OPTION.VOTE_OPTION_NO, - VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, - ].includes(vote.key), + [VOTE_OPTION.UNSPECIFIED, VOTE_OPTION.YES, VOTE_OPTION.ABSTAIN, VOTE_OPTION.NO, VOTE_OPTION.NO_WITH_VETO].includes( + vote.key, + ), ).map((vote) => ({ ...vote, value: vote.value.toUpperCase(), - key: vote.key === VOTE_OPTION.VOTE_OPTION_UNSPECIFIED ? '' : vote.key, + key: vote.key === VOTE_OPTION.UNSPECIFIED ? '' : vote.key, })); voteDataList: IVotes[] = []; countVote: Map = new Map(); - countCurrent: string = ''; + voteDataListLoading = true; isFirstChange = false; proposalVote = PROPOSAL_TABLE_MODE.VOTES; @@ -60,191 +56,67 @@ export class VotesComponent implements OnChanges { no: 0, noWithVeto: 0, }; + + currentTabId = 'all'; + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { - this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { - if (event) { - this.getVotesList(); - } - }); + // this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { + // if (event) { + // this.getVotesList(); + // } + // }); } ngOnChanges(changes: SimpleChanges): void { if (changes['proposalDetail'].currentValue?.proposal_id && !this.isFirstChange) { this.isFirstChange = true; - this.getVotesList(); - } - } - - getVotesList(): void { - if (this.proposalDetail?.proposal_id) { - const payloads: IListVoteQuery = { - pageLimit: 25, + const payloads = { + pageLimit: 5, proposalId: this.proposalDetail.proposal_id, + offset: 0, + pageIndex: 0, }; - combineLatest([ - this.proposalService - .getListVoteFromIndexer(payloads, null) - .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), - this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES) - .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), - this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO) - .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), - this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) - .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), - this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN) - .pipe(map((item) => ({ nextKey: item.vote[item.vote?.length - 1]?.height, votes: item.vote }))), - ]).subscribe((res) => { - res[0] && ((dta) => (this.voteData.all = dta))(res[0]); - res[1] && ((dta) => (this.voteData.yes = dta))(res[1]); - res[2] && ((dta) => (this.voteData.no = dta))(res[2]); - res[3] && ((dta) => (this.voteData.noWithVeto = dta))(res[3]); - res[4] && ((dta) => (this.voteData.abstain = dta))(res[4]); - - let voteData: any[]; - if (this.voteData?.all && !this.countCurrent) { - voteData = [...this.voteData?.all?.votes]; - this.voteDataList = [...voteData]; - } - - const countAll = - +this.proposalDetail.count_vote?.yes + - +this.proposalDetail.count_vote?.abstain + - +this.proposalDetail.count_vote?.no + - +this.proposalDetail.count_vote?.no_with_veto; - - this.countVote.set('', countAll || 0); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_YES, this.proposalDetail.count_vote?.yes || 0); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_ABSTAIN, this.proposalDetail.count_vote?.abstain || 0); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO, this.proposalDetail.count_vote?.no || 0); - this.countVote.set(VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, this.proposalDetail.count_vote?.no_with_veto || 0); - + this.proposalService.getListVoteFromIndexer2(payloads, null).subscribe((res) => { this.voteDataListLoading = false; - this.changeTab(this.countCurrent); + this.voteDataList = res.vote; + this.countTotal.all = res.vote_aggregate.aggregate.count; + }); + + this.proposalService.getProposalVoteTotal(this.proposalDetail.proposal_id).subscribe((res) => { + this.countVote.set('', res['ALL']?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.YES, res[VOTE_OPTION.YES]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.ABSTAIN, res[VOTE_OPTION.ABSTAIN]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.NO, res[VOTE_OPTION.NO]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, res[VOTE_OPTION.NO_WITH_VETO]?.aggregate.count || 0); }); } } changeTab(tabId): void { - if (this.countCurrent !== tabId) { - this.proposalService.pageIndexObj['votes'] = {}; - } - this.countCurrent = tabId; - switch (tabId) { - case VOTE_OPTION.VOTE_OPTION_YES: - this.voteDataList = this.voteData.yes.votes; - break; - case VOTE_OPTION.VOTE_OPTION_ABSTAIN: - this.voteDataList = this.voteData.abstain.votes; - break; - case VOTE_OPTION.VOTE_OPTION_NO: - this.voteDataList = this.voteData.no.votes; - break; - case VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO: - this.voteDataList = this.voteData.noWithVeto.votes; - break; - default: - this.voteDataList = this.voteData.all.votes; - break; - } + this.pageEventChange({ tabId, pageIndex: 0, pageSize: 5 }); } - loadMore($event): void { - const payloads: IListVoteQuery = { - pageLimit: 25, + pageEventChange({ tabId, pageIndex, pageSize }: any) { + const payloads = { + pageLimit: pageSize, proposalId: this.proposalDetail.proposal_id, - nextKey: null, + offset: pageSize * pageIndex, + pageIndex, }; - switch ($event.tabId) { - case VOTE_OPTION.VOTE_OPTION_YES: - payloads.nextKey = this.voteData.yes.nextKey; - if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_YES).subscribe((res) => { - if (res.vote) { - if (this.voteData.yes.votes.length % 25 !== res.vote?.length) { - this.voteData.yes = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.yes.votes, ...res.vote], - }; - } - this.voteDataList = this.voteData?.yes.votes; - } - }); - } - break; - case VOTE_OPTION.VOTE_OPTION_ABSTAIN: - payloads.nextKey = this.voteData.abstain.nextKey; - if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_ABSTAIN).subscribe((res) => { - if (res.vote) { - if (this.voteData.abstain.votes.length % 25 !== res.vote?.length) { - this.voteData.abstain = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.abstain.votes, ...res.vote], - }; - } - this.voteDataList = this.voteData?.abstain.votes; - } - }); - } - break; - case VOTE_OPTION.VOTE_OPTION_NO: - payloads.nextKey = this.voteData.no.nextKey; - if (payloads.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO).subscribe((res) => { - if (res.vote) { - if (this.voteData.no.votes.length % 25 !== res.vote?.length) { - this.voteData.no = { - nextKey: res.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.no.votes, ...res.vote], - }; - } - this.voteDataList = this.voteData?.no.votes; - } - }); - } - break; - case VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO: - payloads.nextKey = this.voteData.noWithVeto.nextKey; - if (payloads.nextKey) { - this.proposalService - .getListVoteFromIndexer(payloads, VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO) - .subscribe((res) => { - if (res?.vote) { - if (this.voteData.noWithVeto.votes.length % 25 !== res?.vote?.length) { - this.voteData.noWithVeto = { - nextKey: res?.vote[res.vote?.length - 1]?.height, - votes: [...this.voteData.noWithVeto.votes, ...res?.vote], - }; - } - this.voteDataList = this.voteData?.noWithVeto?.votes; - } - }); - } - break; - default: - payloads.nextKey = this.voteData.all?.nextKey; - if (payloads?.nextKey) { - this.proposalService.getListVoteFromIndexer(payloads, null).subscribe((res) => { - if (res?.vote) { - if (this.voteData.all.votes.length % 25 !== res?.vote?.length) { - this.voteData.all = { - nextKey: res?.vote[res?.vote?.length - 1]?.height, - votes: [...this.voteData.all.votes, ...res?.vote], - }; - } - this.voteDataList = this.voteData?.all.votes; - } - }); - } - break; + const voteOption = tabId === 'all' ? null : tabId; + + if (this.currentTabId !== tabId) { + this.currentTabId = tabId; } + + this.proposalService.getListVoteFromIndexer2(payloads, voteOption).subscribe((res) => { + this.voteDataList = res.vote; + }); + + return; } } diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index 72b93987d..e819a1eb2 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -243,12 +243,15 @@
- - + --> +
+ +
diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 64cb8897e..28cbaa38b 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -24,9 +24,11 @@ import { Globals } from '../../../global/global'; import { PaginatorComponent } from '../../../shared/components/paginator/paginator.component'; interface CustomPageEvent { - next: number; + next?: number; type: string; tabId: string; + pageIndex?: number; + pageSize?: number; } @Component({ @@ -37,13 +39,17 @@ interface CustomPageEvent { }) export class ProposalTableComponent implements OnInit, OnChanges { @Input() type: PROPOSAL_TABLE_MODE; - @Input() tabId: string; + @Input() tabId: string = 'all'; @Input() data: any[]; @Input() length: number; - @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; - @ViewChild(MatPaginator) paginator: MatPaginator; + @Output() loadMore = new EventEmitter(); @Output() isNextPage = new EventEmitter(); + @Output() pageEventChange = new EventEmitter(); + + @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; + @ViewChild(MatPaginator) paginator: MatPaginator; + validatorImgArr; votesTemplates: Array = [ @@ -83,9 +89,14 @@ export class ProposalTableComponent implements OnInit, OnChanges { pageValidatorIndex = 0; proposalMode = PROPOSAL_TABLE_MODE; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); - denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; + pageData: PageEvent = { + length: 0, + pageSize: 5, + pageIndex: 1, + }; + constructor( public global: Globals, public commonService: CommonService, @@ -107,6 +118,10 @@ export class ProposalTableComponent implements OnInit, OnChanges { this.dataSource = new MatTableDataSource(this.data); } + if (changes.tabId?.currentValue != changes.tabId?.previousValue) { + this.pageData.pageIndex = 1; + } + let minus = 0; if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { minus = this.getUpdatePage(changes.data.currentValue?.length, this.proposalService.pageIndexObj[this.type]); @@ -188,10 +203,9 @@ export class ProposalTableComponent implements OnInit, OnChanges { return vote ? vote.value : 'Did not vote'; } - pageEvent(e: PageEvent): void { - const { length, pageIndex, pageSize, previousPageIndex } = e; - const next = length <= (pageIndex + 2) * pageSize; - + pageEvent2(index: number) { + const { pageIndex, pageSize } = this.pageData; + const next = length <= (pageIndex + 1) * pageSize; if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; @@ -208,22 +222,51 @@ export class ProposalTableComponent implements OnInit, OnChanges { if (next) { this.isNextPage.emit(true); - this.loadMore.emit({ - next: 1, + + this.pageEventChange.emit({ type: this.type, tabId: this.tabId, + pageIndex: index - 1, + pageSize, }); } } - paginatorEmit(e): void { - if (this.dataSource) { - this.dataSource.paginator = e; - } else { - this.dataSource = new MatTableDataSource(this.data); - this.dataSource.paginator = e; - } - } + // pageEvent(e: PageEvent): void { + // const { length, pageIndex, pageSize, previousPageIndex } = e; + // const next = length <= (pageIndex + 2) * pageSize; + + // if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; + // } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { + // this.tabId = this.tabId || 'all'; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES] = {}; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES][this.tabId] = pageIndex; + // } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { + // this.tabId = this.tabId || 'all'; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES] = {}; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES][this.tabId] = pageIndex; + // this.pageValidatorIndex = pageIndex; + // } + + // if (next) { + // this.isNextPage.emit(true); + // this.loadMore.emit({ + // next: 1, + // type: this.type, + // tabId: this.tabId, + // }); + // } + // } + + // paginatorEmit(e): void { + // if (this.dataSource) { + // this.dataSource.paginator = e; + // } else { + // this.dataSource = new MatTableDataSource(this.data); + // this.dataSource.paginator = e; + // } + // } getListData(): any[] { if (!(this.dataSource?.paginator && this.dataSource?.data)) { diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index e2e288d76..7dcddf5ed 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -176,16 +176,16 @@ export class ProposalComponent implements OnInit { if (!highest || highest > 100) { highest = 0; - key = VOTE_OPTION.VOTE_OPTION_YES; + key = VOTE_OPTION.YES; } else { if (highest === yes) { - key = VOTE_OPTION.VOTE_OPTION_YES; + key = VOTE_OPTION.YES; } else if (highest === no) { - key = VOTE_OPTION.VOTE_OPTION_NO; + key = VOTE_OPTION.NO; } else if (highest === noWithVeto) { - key = VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO; + key = VOTE_OPTION.NO_WITH_VETO; } else { - key = VOTE_OPTION.VOTE_OPTION_ABSTAIN; + key = VOTE_OPTION.ABSTAIN; } } diff --git a/src/app/shared/components/a-paginator/a-paginator.component.scss b/src/app/shared/components/a-paginator/a-paginator.component.scss index 425e447bf..fdeb4bc1f 100644 --- a/src/app/shared/components/a-paginator/a-paginator.component.scss +++ b/src/app/shared/components/a-paginator/a-paginator.component.scss @@ -17,6 +17,10 @@ border: none; padding: 0; color: var(--aura-white); + + &:focus { + box-shadow: none; + } } &.active { From c022a058109b415d40952ac6df30ed677f77fb4c Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Wed, 14 Jun 2023 16:26:18 +0700 Subject: [PATCH 101/315] update proposal --- .../votes/votes.component.html | 8 +-- .../proposal-detail/votes/votes.component.ts | 50 +++++++++---------- .../proposal-table.component.html | 2 +- .../proposal-table.component.ts | 4 +- .../a-paginator/a-paginator.component.scss | 5 +- 5 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.html b/src/app/pages/proposal/proposal-detail/votes/votes.component.html index 33382e9bf..3120dec30 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.html +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.html @@ -10,8 +10,8 @@
  • - {{ tab.value }} ({{ countVote.get(tab.key) }}) + + {{ tab.value }} ({{ countVote.get(tab.key) }})
  • @@ -21,8 +21,8 @@ diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index 1e744db3c..8d14b3961 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -1,5 +1,5 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; +import { ChangeDetectorRef, Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; import { NgbNav } from '@ng-bootstrap/ng-bootstrap'; import { combineLatest } from 'rxjs'; import { debounceTime, map } from 'rxjs/operators'; @@ -39,29 +39,17 @@ export class VotesComponent implements OnChanges { voteDataListLoading = true; isFirstChange = false; - proposalVote = PROPOSAL_TABLE_MODE.VOTES; - - voteData = { - all: null, - yes: null, - abstain: null, - no: null, - noWithVeto: null, - }; - - countTotal = { - all: 0, - yes: 0, - abstain: 0, - no: 0, - noWithVeto: 0, - }; + PROPOSAL_TABLE_MODE_VOTES = PROPOSAL_TABLE_MODE.VOTES; currentTabId = 'all'; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); - constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { + constructor( + private proposalService: ProposalService, + private layout: BreakpointObserver, + private cdr: ChangeDetectorRef, + ) { // this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { // if (event) { // this.getVotesList(); @@ -82,15 +70,23 @@ export class VotesComponent implements OnChanges { this.proposalService.getListVoteFromIndexer2(payloads, null).subscribe((res) => { this.voteDataListLoading = false; this.voteDataList = res.vote; - this.countTotal.all = res.vote_aggregate.aggregate.count; }); - this.proposalService.getProposalVoteTotal(this.proposalDetail.proposal_id).subscribe((res) => { - this.countVote.set('', res['ALL']?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.YES, res[VOTE_OPTION.YES]?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.ABSTAIN, res[VOTE_OPTION.ABSTAIN]?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.NO, res[VOTE_OPTION.NO]?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.NO_WITH_VETO, res[VOTE_OPTION.NO_WITH_VETO]?.aggregate.count || 0); + this.proposalService.getProposalVoteTotal(this.proposalDetail.proposal_id).subscribe({ + next: (res) => { + if (res) { + this.countVote.set('', res['ALL']?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.YES, res[VOTE_OPTION.YES]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.ABSTAIN, res[VOTE_OPTION.ABSTAIN]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.NO, res[VOTE_OPTION.NO]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, res[VOTE_OPTION.NO_WITH_VETO]?.aggregate.count || 0); + } + + this.voteDataListLoading = false; + }, + error: (error) => { + this.voteDataListLoading = true; + }, }); } } @@ -110,7 +106,7 @@ export class VotesComponent implements OnChanges { const voteOption = tabId === 'all' ? null : tabId; if (this.currentTabId !== tabId) { - this.currentTabId = tabId; + this.currentTabId = tabId || 'all'; } this.proposalService.getListVoteFromIndexer2(payloads, voteOption).subscribe((res) => { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index e819a1eb2..a3049605a 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -249,7 +249,7 @@ (paginator)="paginatorEmit($event)" (pageEvent)="pageEvent($event)"> --> -
    +
    diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 28cbaa38b..660bb8d9c 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -39,7 +39,7 @@ interface CustomPageEvent { }) export class ProposalTableComponent implements OnInit, OnChanges { @Input() type: PROPOSAL_TABLE_MODE; - @Input() tabId: string = 'all'; + @Input() tabId: string; @Input() data: any[]; @Input() length: number; @@ -118,7 +118,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { this.dataSource = new MatTableDataSource(this.data); } - if (changes.tabId?.currentValue != changes.tabId?.previousValue) { + if (changes.tabId.currentValue != changes.tabId.previousValue) { this.pageData.pageIndex = 1; } diff --git a/src/app/shared/components/a-paginator/a-paginator.component.scss b/src/app/shared/components/a-paginator/a-paginator.component.scss index fdeb4bc1f..6b3a189ec 100644 --- a/src/app/shared/components/a-paginator/a-paginator.component.scss +++ b/src/app/shared/components/a-paginator/a-paginator.component.scss @@ -3,7 +3,7 @@ margin: 0 2px; min-width: 24px; height: 24px; - padding: 0 4px; + // padding: 0 ; display: flex; align-items: center; @@ -13,6 +13,9 @@ color: var(--aura-white); .page-link { + flex-grow: 1; + text-align: center; + background: transparent; border: none; padding: 0; From 0048ac28aaa561c2fa8aa843422681c9499b6250 Mon Sep 17 00:00:00 2001 From: mtam Date: Wed, 14 Jun 2023 17:16:50 +0700 Subject: [PATCH 102/315] [TamTM6] update cw721 v2 part 2, code id v2 --- src/app/core/services/contract.service.ts | 4 ++ src/app/core/services/token.service.ts | 17 +++++--- .../code-id-contracts-tab.component.ts | 4 +- .../contract-info-card.component.html | 4 +- .../contract-info-card.component.ts | 6 ++- .../code-contract.component.html | 14 +++--- .../contract/contract.component.ts | 16 +++++-- .../contracts-detail.component.ts | 5 +++ .../contracts-list.component.ts | 4 ++ .../token/nft-detail/nft-detail.component.ts | 6 ++- .../token-contract-tab.component.html | 4 +- .../token-contract-tab.component.ts | 35 +++++++++++++-- .../token-content.component.html | 3 +- .../token-detail/token-detail.component.ts | 43 +++++++++++++++---- .../token-overview.component.html | 2 +- .../token-overview.component.ts | 2 +- .../token-cw721/token-cw721.component.html | 6 +-- .../token-cw721/token-cw721.component.ts | 41 ++++-------------- .../validators-detail.component.ts | 5 +++ 19 files changed, 147 insertions(+), 74 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index d5c0eee38..5a2f08344 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -100,6 +100,9 @@ export class ContractService extends CommonService { cw721_contract { name symbol + smart_contract { + name + } } code { type @@ -117,6 +120,7 @@ export class ContractService extends CommonService { updated_at verification_status verified_at + s3_location } } } diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 80ab0243b..e87af4037 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -25,18 +25,22 @@ export class TokenService extends CommonService { return this.http.post(`${this.apiUrl}/cw721-tokens`, payload); } - getListCW721TokenV2(payload): Observable { + getListCW721TokenV2(payload, textSearch = null): Observable { + if (textSearch?.length > 0) { + textSearch = '%' + textSearch + '%'; + } + let querySort = `, order_by: {${payload.sort_column}: ${payload.sort_order}}`; const operationsDoc = ` - query MyQuery { + query MyQuery($limit: Int = 10, $offset: Int = 0, $contract_address: String = null, $name: String = null) { ${this.envDB} { - list_token: m_view_count_cw721_txs { + list_token: m_view_count_cw721_txs(limit: $limit, offset: $offset ${querySort}, where: {_or: [{contract_address: {_like: $contract_address}}, {name: {_like: $name}}]}) { contract_address symbol name total_tx transfer_24h } - total_token: m_view_count_cw721_txs_aggregate { + total_token: m_view_count_cw721_txs_aggregate(where: {_or: [{contract_address: {_like: $contract_address}}, {name: {_like: $name}}]}){ aggregate { count } @@ -48,7 +52,10 @@ export class TokenService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { - + limit: payload.limit || 20, + offset: payload.offset || 0, + contract_address: textSearch || null, + name: textSearch || null, }, operationName: 'MyQuery', }) diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts index f6c5d2a50..d1b3ebd6e 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts @@ -70,8 +70,8 @@ export class CodeIdContractsTabComponent implements OnInit { item.contract_address = item?.address; item.tx_hash = item?.instantiate_hash; item.creator_address = item?.creator; - item.verified_at = _.get(item, 'code.code_id_verifications.verified_at'); - item.type = item.type || '-'; + item.verified_at = _.get(item, 'code.code_id_verifications[0].verified_at'); + item.type = item.code?.type || '-'; if (item.type === ContractRegisterType.CW721 && item.smart_contracts?.name === TYPE_CW4973) { item.type = ContractRegisterType.CW4973; } diff --git a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html index 36b6d6d2a..e3c65f025 100644 --- a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html +++ b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html @@ -43,14 +43,14 @@ Token Tracker: - {{ contractDetail?.cw721_contract?.name }} ({{ contractDetail?.cw721_contract?.symbol }}) + [routerLink]="['/tokens/' + linkNft, contractDetail?.address]"> {{ contractDetail?.cw721_contract?.name }} ({{ contractDetail?.cw721_contract?.symbol }}) diff --git a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.ts b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.ts index ca5a76dc7..d4da504c3 100644 --- a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.ts +++ b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; import { ContractRegisterType } from 'src/app/core/constants/contract.enum'; @Component({ @@ -15,7 +16,10 @@ export class ContractInfoCardComponent implements OnInit, OnChanges { ngOnInit(): void {} ngOnChanges(changes: SimpleChanges): void { - if (this.contractDetail?.code?.type === ContractRegisterType.CW4973) { + if ( + this.contractDetail?.code?.type === ContractRegisterType.CW4973 || + this.contractDetail?.cw721_contract.smart_contract.name === TYPE_CW4973 + ) { this.linkNft = 'token-abt'; } } diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html index a9db6a67a..da04c76f7 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html @@ -45,7 +45,7 @@
    -
    +
    File Contract Source Code @@ -69,10 +69,14 @@ { - if (data) { - this.contractDetail = data; + mergeMap((res) => { + if (res) { + res.tx_hash = res.instantiate_hash; + res.execute_msg_schema = _.get(res, 'code.code_id_verifications[0].execute_msg_schema'); + res.instantiate_msg_schema = _.get(res, 'code.code_id_verifications[0].instantiate_msg_schema'); + res.query_msg_schema = _.get(res, 'code.code_id_verifications[0].query_msg_schema'); + res.contract_hash = _.get(res, 'code.code_id_verifications[0].data_hash'); + res.contract_name = _.get(res, 'cw721_contract.smart_contract.name'); + res.compiler_version = _.get(res, 'code.code_id_verifications[0].compiler_version'); + this.contractDetail = res; } - if (data?.code?.code_id_verifications[0]?.verification_status === 'verifying' && !notCheck) { + if (res?.code?.code_id_verifications[0]?.verification_status === 'verifying' && !notCheck) { this.isVerifying = true; } else { this.isVerifying = false; diff --git a/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts b/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts index 9bb39dc51..f64b7d3f0 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts @@ -1,6 +1,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import * as _ from 'lodash'; import { Subscription } from 'rxjs'; import { ContractService } from 'src/app/core/services/contract.service'; @@ -39,6 +40,10 @@ export class ContractsDetailComponent implements OnInit, OnDestroy { this.subscription = this.contractService.contractObservable.subscribe((res) => { if (res) { res.tx_hash = res.instantiate_hash; + res.execute_msg_schema = _.get(res, 'code.code_id_verifications[0].execute_msg_schema'); + res.instantiate_msg_schema = _.get(res, 'code.code_id_verifications[0].instantiate_msg_schema'); + res.query_msg_schema = _.get(res, 'code.code_id_verifications[0].query_msg_schema'); + res.contract_hash = _.get(res, 'code.code_id_verifications[0].data_hash'); this.contractDetail = res; } else { this.contractDetail = null; diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index ebf0d94e1..e0d73d20a 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -14,6 +14,7 @@ import { TableTemplate } from '../../../core/models/common.model'; import { ContractService } from '../../../core/services/contract.service'; import { shortenAddress } from '../../../core/utils/common/shorten'; import { Globals } from '../../../global/global'; +import { TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; @Component({ selector: 'app-contracts-list', @@ -93,6 +94,9 @@ export class ContractsListComponent implements OnInit, OnDestroy { DATEFORMAT.DATETIME_UTC, ); item.type = item.code.type; + if (item.type === ContractRegisterType.CW721 && item?.name === TYPE_CW4973) { + item.type = ContractRegisterType.CW4973; + } item.compiler_version = item.code?.code_id_verifications[0]?.compiler_version; item.contract_verification = item.code.code_id_verifications[0]?.verification_status; }); diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index df8b56ff9..a3f4a23b6 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -29,6 +29,7 @@ import { Globals } from 'src/app/global/global'; import { MediaExpandComponent } from 'src/app/shared/components/media-expand/media-expand.component'; import { PopupShareComponent } from './popup-share/popup-share.component'; import { TransactionService } from 'src/app/core/services/transaction.service'; +import { TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; @Component({ selector: 'app-nft-detail', @@ -155,7 +156,10 @@ export class NFTDetailComponent implements OnInit { this.imageUrl = this.nftDetail?.image?.link_s3; } } - } else if (this.nftDetail.type === ContractRegisterType.CW4973) { + } else if ( + this.nftDetail.type === ContractRegisterType.CW4973 || + this.nftDetail?.cw721_contract.smart_contract.name === TYPE_CW4973 + ) { if (this.nftDetail.status !== SB_TYPE.EQUIPPED) { this.toastr.error('Token invalid'); return; diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.html index 286158a99..87ce4b0b9 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.html @@ -1,6 +1,6 @@ -
    +
    - +
    { + // check data for type cw20 v1 + if (res.data.contract_verification === 'VERIFIED') { + res.data.contract_verification = ContractVerifyType.Verified; + } else if (res.data.contract_verification === 'VERIFYFAIL') { + res.data.contract_verification = ContractVerifyType.VerifiedFail; + } this.tokenDetail = res?.data; }); } + getContractDetailNFT() { + this.contractService.loadContractDetailV2(this.contractAddress).subscribe((res: ResponseDto) => { + if (res['smart_contract']?.length > 0) { + let data = res['smart_contract'][0]; + let contract_verification = data?.code?.code_id_verifications[0]?.verification_status; + let execute_msg_schema = _.get(data, 'code.code_id_verifications[0].execute_msg_schema'); + let query_msg_schema = _.get(data, 'code.code_id_verifications[0].query_msg_schema'); + let tx_hash = data.instantiate_hash; + + this.tokenDetail = { contract_verification, execute_msg_schema, query_msg_schema, tx_hash }; + } + }); + } + navigateToVerify() { sessionStorage.setItem('codeIdPrePage', this.router.url); this.router.navigate(['/code-ids/verify', this.tokenDetail.code_id]); diff --git a/src/app/pages/token/token-detail/token-content/token-content.component.html b/src/app/pages/token/token-detail/token-content/token-content.component.html index f695d7020..25d745d12 100644 --- a/src/app/pages/token/token-detail/token-content/token-content.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content.component.html @@ -140,6 +140,7 @@ + [contractAddress]="contractAddress" + [typeContract]="tokenDetail?.type">
    diff --git a/src/app/pages/token/token-detail/token-detail.component.ts b/src/app/pages/token/token-detail/token-detail.component.ts index bde227ae6..ab2f259b4 100644 --- a/src/app/pages/token/token-detail/token-detail.component.ts +++ b/src/app/pages/token/token-detail/token-detail.component.ts @@ -1,8 +1,10 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; +import * as _ from 'lodash'; import { ContractRegisterType } from 'src/app/core/constants/contract.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { ResponseDto } from 'src/app/core/models/common.model'; +import { ContractService } from 'src/app/core/services/contract.service'; import { TokenService } from 'src/app/core/services/token.service'; @Component({ @@ -22,6 +24,7 @@ export class TokenDetailComponent implements OnInit { private route: Router, private tokenService: TokenService, private environmentService: EnvironmentService, + private contractService: ContractService, ) {} ngOnInit(): void { @@ -29,18 +32,40 @@ export class TokenDetailComponent implements OnInit { if (this.contractAddress === 'null') { this.route.navigate(['/']); } - this.getTokenDetail(); + + if (this.router.snapshot.url[0]?.path === 'token') { + this.getTokenDetail(); + } else { + this.getTokenDetailNFT(); + } } getTokenDetail(): void { - this.loading = true; - this.tokenService.getTokenDetail(this.contractAddress).subscribe((res: ResponseDto) => { - this.tokenDetail = res.data; - if (this.tokenDetail?.type !== ContractRegisterType.CW20) { - this.tokenDetail.isNFTContract = true; - } - }); - this.loading = false; + this.tokenService.getTokenDetail(this.contractAddress).subscribe( + (res: ResponseDto) => { + this.tokenDetail = res.data; + }, + () => {}, + () => { + this.loading = false; + }, + ); + } + + getTokenDetailNFT(): void { + this.contractService.loadContractDetailV2(this.contractAddress).subscribe( + (res) => { + const name = _.get(res, 'smart_contract[0].cw721_contract.name'); + let type = ContractRegisterType.CW721; + const isNFTContract = true; + const contract_address = _.get(res, 'smart_contract[0].address'); + this.tokenDetail = { name, type, contract_address, isNFTContract }; + }, + () => {}, + () => { + this.loading = false; + }, + ); } getLength(result: string) { diff --git a/src/app/pages/token/token-detail/token-overview/token-overview.component.html b/src/app/pages/token/token-detail/token-overview/token-overview.component.html index 53a10822c..c8e04e288 100644 --- a/src/app/pages/token/token-detail/token-overview/token-overview.component.html +++ b/src/app/pages/token/token-detail/token-overview/token-overview.component.html @@ -75,7 +75,7 @@
    - {{ tokenDetail.num_tokens | number : global.formatNumberOnlyDecimal }} + {{ tokenDetail.num_tokens || 0 | number : global.formatNumberOnlyDecimal }}
    diff --git a/src/app/pages/token/token-detail/token-overview/token-overview.component.ts b/src/app/pages/token/token-detail/token-overview/token-overview.component.ts index 810e4de04..b8321fa13 100644 --- a/src/app/pages/token/token-detail/token-overview/token-overview.component.ts +++ b/src/app/pages/token/token-detail/token-overview/token-overview.component.ts @@ -60,7 +60,7 @@ export class TokenOverviewComponent implements OnInit { getTotalSupply() { this.tokenService.countTotalTokenCW721(this.tokenDetail?.contract_address).subscribe((res) => { - this.tokenDetail.holder = res.cw721_token_aggregate?.aggregate?.count || this.tokenDetail.holder || 0; + this.tokenDetail.num_tokens = res.cw721_token_aggregate?.aggregate?.count || this.tokenDetail.num_tokens || 0; }); } } diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html index ebc078e62..6dd9ad322 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html @@ -76,11 +76,11 @@

    Non-Fungible Tokens (NFT)

    {{ element.total_tx | number }} - + Transfers (24H) - - {{ element.transfers_24h | number }} + + {{ element.transfer_24h | number }} diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts index 0497fad1b..4db456cdb 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts @@ -10,7 +10,7 @@ import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TokenService } from 'src/app/core/services/token.service'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; -import { ResponseDto, TableTemplate } from '../../../../core/models/common.model'; +import { TableTemplate } from '../../../../core/models/common.model'; import { Globals } from '../../../../global/global'; @Component({ @@ -26,7 +26,7 @@ export class TokenCw721Component implements OnInit { { matColumnDef: 'token', headerCellDef: 'name' }, { matColumnDef: 'tokenContract', headerCellDef: 'tokenContract' }, { matColumnDef: 'total_tx', headerCellDef: 'total_tx' }, - { matColumnDef: 'transfers_24h', headerCellDef: 'transfer' }, + { matColumnDef: 'transfer_24h', headerCellDef: 'transfer' }, ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); pageData: PageEvent = { @@ -37,11 +37,7 @@ export class TokenCw721Component implements OnInit { dataSource: MatTableDataSource = new MatTableDataSource([]); maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; sort: MatSort; - typeSortBy = { - transfers24h: 'transfers_24h', - totalTx: 'total_tx', - }; - sortBy = this.typeSortBy.transfers24h; + sortBy = 'transfer_24h'; sortOrder = 'desc'; isSorting = true; searchSubject = new Subject(); @@ -81,17 +77,11 @@ export class TokenCw721Component implements OnInit { const payload = { limit: this.pageData.pageSize, offset: this.pageData.pageIndex * this.pageData.pageSize, - keyword: this.textSearch, sort_column: this.sortBy, sort_order: this.sortOrder, }; - this.tokenService.getListCW721TokenV2(payload).subscribe(res => { - this.isSorting = false; - if (res.list_token?.length > 0) { - res.total_token?.forEach((data) => { - console.log(data); - }); - } + + this.tokenService.getListCW721TokenV2(payload, this.textSearch).subscribe((res) => { this.dataSource = new MatTableDataSource(res.list_token); this.pageData.length = res.total_token?.aggregate?.count; }); @@ -116,23 +106,8 @@ export class TokenCw721Component implements OnInit { } sortData(sort: Sort) { - if (!this.isSorting) { - this.dataSource.data.sort((a, b) => { - switch (sort.active) { - case 'transfers_24h': - this.sortBy = this.typeSortBy.transfers24h; - this.sortOrder = sort.direction; - this.getTokenData(); - return 0; - case 'total_tx': - this.sortBy = this.typeSortBy.totalTx; - this.sortOrder = sort.direction; - this.getTokenData(); - return 0; - default: - return 0; - } - }); - } + this.sortBy = sort.active; + this.sortOrder = sort.direction; + this.getTokenData(); } } diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 6dd1656bf..bc1f670bc 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -109,6 +109,11 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { this.timerGetBlock = setInterval(() => { this.getLastHeight(); }, this.timeInterval); + + this.timerGetUpTime = setInterval(() => { + this.getDetail(); + this.loadData(false); + }, 5000); } loadData(isInit = true) { From c619eb56b62adeeef70153afacac592a9deee3a0 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 15 Jun 2023 08:59:55 +0700 Subject: [PATCH 103/315] revert code --- .../contracts-contents/contract-content.component.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index 0e16e5cea..6970148b7 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -107,9 +107,9 @@ export class ContractContentComponent implements OnInit, OnDestroy { } }); - // this.timerGetUpTime = setInterval(() => { - // this.getTransaction(false); - // }, 5000); + this.timerGetUpTime = setInterval(() => { + this.getTransaction(false); + }, 5000); } changeTab(tabId): void { From 0f5afe5d5f9c60d970127b9f92392a5815378072 Mon Sep 17 00:00:00 2001 From: nthduc95 Date: Thu, 15 Jun 2023 09:03:27 +0700 Subject: [PATCH 104/315] implement abt token list --- src/app/core/services/soulbound.service.ts | 55 +++++++++++++++++-- .../soulbound-contract-list.component.html | 34 ++++-------- .../soulbound-token-contract.component.html | 40 ++++---------- .../token-cw4973/token-cw4973.component.html | 46 ++++++---------- .../token-cw4973/token-cw4973.component.ts | 6 +- 5 files changed, 90 insertions(+), 91 deletions(-) diff --git a/src/app/core/services/soulbound.service.ts b/src/app/core/services/soulbound.service.ts index 19c178b47..2850b861b 100644 --- a/src/app/core/services/soulbound.service.ts +++ b/src/app/core/services/soulbound.service.ts @@ -4,6 +4,7 @@ import * as _ from 'lodash'; import { Observable } from 'rxjs'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; +import { map } from 'rxjs/operators'; @Injectable() export class SoulboundService extends CommonService { @@ -59,10 +60,56 @@ export class SoulboundService extends CommonService { } getListABT(payload): Observable { - const params = _(payload).omitBy(_.isNull).omitBy(_.isUndefined).value(); - return this.http.get(`${this.apiUrl}/soulbound-token/tokens-list`, { - params - }); + const operationsDoc = ` + query CW4973ListToken( + $keyword: String, + $limit: Int, + $offset: Int + ) { + ${this.envDB} { + cw721_contract( + limit: $limit, + where: { + smart_contract: { + name: {_eq: "crates.io:cw4973"} + }, + _or: [{name: {_like: $keyword}}, {smart_contract: {_or:[{address: {_like: $keyword}}, {creator: {_like: $keyword}}]}}] + }, + offset: $offset + ) { + name + symbol + smart_contract { + address + name + creator + } + } + cw721_contract_aggregate( + where: { + smart_contract: { + name: {_eq: "crates.io:cw4973"} + }, + _or: [{name: {_like: $keyword}}, {smart_contract: {_or:[{address: {_like: $keyword}}, {creator: {_like: $keyword}}]}}] + }) { + aggregate { + count + } + } + } + }`; + + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload.limit, + offset: payload.offset, + keyword: payload.keyword ? `%${payload.keyword}%` : null, + }, + operationName: 'CW4973ListToken', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } updateNotify(contractAddress: string, tokenId): Observable { diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html index e79d722df..781b6ea04 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html @@ -7,24 +7,14 @@

    Account Bound Token

    - @@ -111,4 +97,4 @@

    Account Bound Token

    - + \ No newline at end of file diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html index 7c519e6fc..e95440c7f 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html @@ -26,13 +26,8 @@

    Account Bound Token

    - +
    @@ -46,28 +41,16 @@

    Account Bound Token

    - + -
    @@ -146,10 +129,7 @@

    Account Bound Token

    - @@ -160,4 +140,4 @@

    Account Bound Token

    - + \ No newline at end of file diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html index 2dcea9e90..6653342cf 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html @@ -9,24 +9,15 @@

    Account Bound Tokens (ABT)

    - -
    @@ -45,30 +36,28 @@

    Account Bound Tokens (ABT)

    Token Token Contract - {{ - element.contract_address | cutStringPipe : 8 : 8 - }} + {{ + element.smart_contract.address | cutStringPipe : 8 : 8 + }} Creator - {{ - element.minter_address | cutStringPipe : 8 : 8 - }} + {{ + element.smart_contract.creator | cutStringPipe : 8 : 8 + }} @@ -81,10 +70,7 @@

    Account Bound Tokens (ABT)

    - @@ -95,4 +81,4 @@

    Account Bound Tokens (ABT)

    - - + \ No newline at end of file diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts index e1eda8daa..af849ccbe 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts @@ -75,9 +75,9 @@ export class TokenCw4973Component implements OnInit { offset: this.pageData.pageIndex * this.pageData.pageSize, keyword: this.textSearch, }; - this.soulboundService.getListABT(payload).subscribe((res: ResponseDto) => { - this.dataSource = new MatTableDataSource(res.data); - this.pageData.length = res.meta.count; + this.soulboundService.getListABT(payload).subscribe((res) => { + this.dataSource = new MatTableDataSource(res?.cw721_contract); + this.pageData.length = res?.cw721_contract_aggregate.aggregate.count; }); } From c8f74e38629b2547f172863b1c4707d5dd1cd9d5 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 15 Jun 2023 09:31:49 +0700 Subject: [PATCH 105/315] fix issue avatar validator --- .../validators/user-wallet-info/user-wallet-info.component.ts | 3 +-- .../delegate-item/delegate-item.component.html | 2 +- src/app/pages/validators/validators.component.ts | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts index 0ec3f690e..4b2c49f7c 100644 --- a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts +++ b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { MatTableDataSource } from '@angular/material/table'; -import { DataDelegateDto, TableTemplate } from 'src/app/core/models/common.model'; +import { TableTemplate } from 'src/app/core/models/common.model'; import { CommonService } from 'src/app/core/services/common.service'; import { ValidatorService } from 'src/app/core/services/validator.service'; import { Globals } from 'src/app/global/global'; @@ -67,7 +67,6 @@ export class UserWalletInfoComponent implements OnChanges { } }); this.lstUndelegate = lstUndelegateTemp; - if (this.lstUndelegate?.length > 0) { // get ValidatorAddressArr this.getValidatorAvatar(this.lstUndelegate); diff --git a/src/app/pages/validators/validators-detail/delegate-item/delegate-item.component.html b/src/app/pages/validators/validators-detail/delegate-item/delegate-item.component.html index 70d2ca375..10639ef36 100644 --- a/src/app/pages/validators/validators-detail/delegate-item/delegate-item.component.html +++ b/src/app/pages/validators/validators-detail/delegate-item/delegate-item.component.html @@ -14,7 +14,7 @@
    + [srcImg]="currentValidatorDetail.image_url">
    diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index 8997c35fc..07c1d8aa4 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -635,11 +635,11 @@ export class ValidatorsComponent implements OnInit, OnDestroy { const now = new Date(); listUnDelegator.data.unbonding_responses.forEach((data) => { data.entries.forEach((f) => { - f['validator_identity'] = data.validator_description?.description?.identity; f.balance = f.balance / NUMBER_CONVERT; f.validator_address = data.validator_address; f.validator_name = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.title; - f.jailed = data.validator_description?.jailed || false; + f.jailed = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.jailed; + f.validator_identity = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.identity; let timeConvert = new Date(f.completion_time); if (now < timeConvert) { this.lstUndelegate.push(f); From 274c1c7f4ebb1a04714cf6a2532bc5b863091d6e Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Thu, 15 Jun 2023 10:36:29 +0700 Subject: [PATCH 106/315] update reload list --- .../proposal-detail/votes/votes.component.ts | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index 8d14b3961..b8f5b9e03 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -1,10 +1,8 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { ChangeDetectorRef, Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; +import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; import { NgbNav } from '@ng-bootstrap/ng-bootstrap'; -import { combineLatest } from 'rxjs'; -import { debounceTime, map } from 'rxjs/operators'; +import { debounceTime } from 'rxjs/operators'; import { PROPOSAL_TABLE_MODE, PROPOSAL_VOTE, VOTE_OPTION } from '../../../../core/constants/proposal.constant'; -import { IListVoteQuery } from '../../../../core/models/proposal.model'; import { ProposalService } from '../../../../core/services/proposal.service'; export interface IVotes { id: number; @@ -42,19 +40,24 @@ export class VotesComponent implements OnChanges { PROPOSAL_TABLE_MODE_VOTES = PROPOSAL_TABLE_MODE.VOTES; currentTabId = 'all'; + payloads: { pageIndex?: number; pageLimit?: number; proposalId?: number | string; offset?: number }; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); - constructor( - private proposalService: ProposalService, - private layout: BreakpointObserver, - private cdr: ChangeDetectorRef, - ) { - // this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { - // if (event) { - // this.getVotesList(); - // } - // }); + constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { + this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { + if (event) { + this.pageEventChange({ + tabId: this.currentTabId, + pageIndex: this.payloads?.pageIndex || 0, + pageSize: this.payloads?.pageLimit || 5, + }); + } + }); + + setTimeout(() => { + this.proposalService.reloadList$.next(true); + }, 5500); } ngOnChanges(changes: SimpleChanges): void { @@ -96,7 +99,7 @@ export class VotesComponent implements OnChanges { } pageEventChange({ tabId, pageIndex, pageSize }: any) { - const payloads = { + this.payloads = { pageLimit: pageSize, proposalId: this.proposalDetail.proposal_id, offset: pageSize * pageIndex, @@ -109,10 +112,8 @@ export class VotesComponent implements OnChanges { this.currentTabId = tabId || 'all'; } - this.proposalService.getListVoteFromIndexer2(payloads, voteOption).subscribe((res) => { + this.proposalService.getListVoteFromIndexer2(this.payloads, voteOption).subscribe((res) => { this.voteDataList = res.vote; }); - - return; } } From 3ce375962c6a94cde0a6c002b3829396a5f53e5a Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 15 Jun 2023 10:41:45 +0700 Subject: [PATCH 107/315] [TamTM6] update cw721 detail v2 --- .../token/nft-detail/nft-detail.component.ts | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index a3f4a23b6..94e36a3bb 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -134,26 +134,37 @@ export class NFTDetailComponent implements OnInit { this.loading = false; return; } - this.nftDetail = res.data; + res.data['type'] = res.data['type'] || ContractRegisterType.CW721; + this.nftDetail = { + ...res.data, + contract_address: res.contract_address || res.data?.cw721_contract?.smart_contract?.address, + creator: res.creator || res.data?.cw721_contract?.smart_contract?.creator, + name: res.name || res.data?.cw721_contract?.name, + }; if (this.nftDetail.type === ContractRegisterType.CW721) { if (this.nftDetail?.asset_info?.data?.info?.extension?.image?.indexOf('twilight') > 1) { this.nftDetail['isDisplayName'] = true; this.nftDetail['nftName'] = this.nftDetail?.asset_info?.data?.info?.extension?.name || ''; } - if (this.nftDetail?.image?.link_s3) { - this.imageUrl = this.nftDetail.image?.link_s3; + if (this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url) { + this.imageUrl = this.nftDetail.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url; } - if (this.nftDetail.animation?.link_s3) { + if (this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url) { if (!this.nftDetail?.image?.link_s3) { - if (this.nftDetail.animation?.content_type === 'image/gif') { - this.imageUrl = this.nftDetail.animation?.link_s3; + if ( + (this.nftDetail.animation?.content_type || + this.nftDetail?.media_info?.offchain?.animation?.content_type) === 'image/gif' + ) { + this.imageUrl = this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain.animation?.url; } else { - this.animationUrl = this.nftDetail.animation?.link_s3; + this.animationUrl = + this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; } } else if (this.getTypeFile(this.nftDetail) !== MEDIA_TYPE.IMG) { - this.animationUrl = this.nftDetail.animation?.link_s3; + this.animationUrl = + this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; } else { - this.imageUrl = this.nftDetail?.image?.link_s3; + this.imageUrl = this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain.image?.url; } } } else if ( From bdca996468c429124b9388a099e806c2683cdf84 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 15 Jun 2023 13:31:20 +0700 Subject: [PATCH 108/315] check expired feegrant --- src/app/core/services/feegrant.service.ts | 55 +-------- .../my-grantees/my-grantees.component.ts | 2 +- .../my-granters/my-granters.component.ts | 2 +- .../popup-add-grant.component.ts | 106 ++++++++++-------- 4 files changed, 64 insertions(+), 101 deletions(-) diff --git a/src/app/core/services/feegrant.service.ts b/src/app/core/services/feegrant.service.ts index 6c80d47a4..69c899a0b 100644 --- a/src/app/core/services/feegrant.service.ts +++ b/src/app/core/services/feegrant.service.ts @@ -1,55 +1,20 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import axios from 'axios'; -import * as _ from 'lodash'; import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { LENGTH_CHARACTER } from '../constants/common.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; -import { map } from 'rxjs/operators'; @Injectable() export class FeeGrantService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; - indexerUrl = `${this.environmentService.configValue.indexerUri}`; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); } - getListFeeGrants(filterSearch, currentAddress, nextKey = null, isGranter = false): Observable { - let granter; - let grantee; - let isSearchAddress = true; - if (filterSearch['textSearch']?.length === LENGTH_CHARACTER.TRANSACTION) { - isSearchAddress = false; - } - if (isGranter) { - grantee = currentAddress; - granter = isSearchAddress ? filterSearch['textSearch'] : null; - } else { - granter = currentAddress; - grantee = isSearchAddress ? filterSearch['textSearch'] : null; - } - const params = _({ - chainid: this.chainInfo.chainId, - granter: granter, - grantee: grantee, - status: filterSearch['isActive'] ? 'Available' : 'Use up,Revoked,Fail', - pageLimit: 100, - nextKey: nextKey, - txhash: !isSearchAddress ? filterSearch['textSearch'] : null, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/feegrant/get-grants`, { - params, - }); - } - - getListFeeGrantsV2(payload, textSearch = ''): Observable { + getListFeeGrants(payload, textSearch = ''): Observable { if (textSearch?.length > 0) { if (textSearch?.length === LENGTH_CHARACTER.TRANSACTION) { payload.hash = textSearch; @@ -109,20 +74,4 @@ export class FeeGrantService extends CommonService { }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - - checkAddressValid(granter, grantee) { - const params = _({ - chainid: this.chainInfo.chainId, - grantee: grantee, - granter: granter, - status: 'Available', - pageLimit: 1, - expired: true, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return axios.get(`${this.indexerUrl}/feegrant/get-grants`, { params }); - } } diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index 394f9f59d..022ca4714 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -121,7 +121,7 @@ export class MyGranteesComponent implements OnInit { isGranter: false, }; - this.feeGrantService.getListFeeGrantsV2(payload, this.textSearch).subscribe( + this.feeGrantService.getListFeeGrants(payload, this.textSearch).subscribe( (res) => { res.feegrant?.forEach((element) => { element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index 8d8079958..35cd0b5b5 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -92,7 +92,7 @@ export class MyGrantersComponent implements OnInit { isGranter: true, }; - this.feeGrantService.getListFeeGrantsV2(payload, this.textSearch).subscribe( + this.feeGrantService.getListFeeGrants(payload, this.textSearch).subscribe( (res) => { res.feegrant?.forEach((element) => { element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; diff --git a/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts b/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts index c718b2534..36676b8f7 100644 --- a/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts +++ b/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts @@ -1,6 +1,6 @@ import { Component, Inject, OnInit } from '@angular/core'; import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MAT_DIALOG_DATA, MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog'; import { TranslateService } from '@ngx-translate/core'; import * as moment from 'moment'; import { LENGTH_CHARACTER } from 'src/app/core/constants/common.constant'; @@ -136,53 +136,67 @@ export class PopupAddGrantComponent implements OnInit { } = this.grantForm.value; if (granter && grantee_address) { - const req = await this.feeGrantService.checkAddressValid(granter, grantee_address); this.isRevoking = false; - if (req.data?.data?.grants?.length > 0) { - this.isRevoking = true; - this.showNotice(grantee_address, granter); - return; - } - } - - const timeEndDate = moment(expiration_time)?.toDate()?.setHours(23, 59, 59); - const executeAddGrant = async () => { - const { hash, error } = await this.walletService.signAndBroadcast({ - messageType: - isInstantiate || isExecute - ? SIGNING_MESSAGE_TYPES.GRANT_MSG_ALLOWANCE - : period_amount && this.periodShow - ? SIGNING_MESSAGE_TYPES.GRANT_PERIODIC_ALLOWANCE - : SIGNING_MESSAGE_TYPES.GRANT_BASIC_ALLOWANCE, - message: { - granter, - grantee: grantee_address?.trim(), - spendLimit: amount, - expiration: expiration_time ? timeEndDate : null, - period: period_day ? period_day * this.dayConvert : undefined, - periodSpendLimit: period_amount, - isPeriodic: this.periodShow, - isInstantiate: isInstantiate, - isExecute: isExecute, - executeContract: execute_contract, + const payload = { + limit: 100, + granter: granter, + grantee: grantee_address, + isActive: true, + isGranter: false, + }; + this.feeGrantService.getListFeeGrants(payload).subscribe( + (res) => { + if (res.feegrant[0]?.expiration) { + const timeCompare = new Date(res.feegrant[0]?.expiration).getTime(); + if (res.feegrant[0]?.status === 'Available' && timeCompare < Date.now()) { + this.isRevoking = true; + this.showNotice(grantee_address, granter); + return; + } + } + const timeEndDate = moment(expiration_time)?.toDate()?.setHours(23, 59, 59); + const executeAddGrant = async () => { + const { hash, error } = await this.walletService.signAndBroadcast({ + messageType: + isInstantiate || isExecute + ? SIGNING_MESSAGE_TYPES.GRANT_MSG_ALLOWANCE + : period_amount && this.periodShow + ? SIGNING_MESSAGE_TYPES.GRANT_PERIODIC_ALLOWANCE + : SIGNING_MESSAGE_TYPES.GRANT_BASIC_ALLOWANCE, + message: { + granter, + grantee: grantee_address?.trim(), + spendLimit: amount, + expiration: expiration_time ? timeEndDate : null, + period: period_day ? period_day * this.dayConvert : undefined, + periodSpendLimit: period_amount, + isPeriodic: this.periodShow, + isInstantiate: isInstantiate, + isExecute: isExecute, + executeContract: execute_contract, + }, + senderAddress: granter, + network: this.environmentService.configValue.chain_info, + signingType: ESigningType.Keplr, + chainId: this.walletService.chainId, + }); + + if (hash) { + this.closeDialog(hash); + } else { + if (error != 'Request rejected') { + let errorMessage = this.mappingErrorService.checkMappingError('', error); + this.toastr.error(errorMessage); + } + } + }; + + executeAddGrant(); }, - senderAddress: granter, - network: this.environmentService.configValue.chain_info, - signingType: ESigningType.Keplr, - chainId: this.walletService.chainId, - }); - - if (hash) { - this.closeDialog(hash); - } else { - if (error != 'Request rejected') { - let errorMessage = this.mappingErrorService.checkMappingError('', error); - this.toastr.error(errorMessage); - } - } - }; - - executeAddGrant(); + (error) => {}, + () => {}, + ); + } } addClassFocus(e: HTMLInputElement) { From 2bf79cc5fcbf388cc9059f7c57bcedbe4967bbc0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 15 Jun 2023 13:49:11 +0700 Subject: [PATCH 109/315] highlight expired --- src/app/pages/fee-grant/my-grantees/my-grantees.component.html | 2 +- src/app/pages/fee-grant/my-granters/my-granters.component.html | 2 +- src/app/pages/fee-grant/my-granters/my-granters.component.ts | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html index 12b00f66f..9d7210045 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html @@ -80,7 +80,7 @@
    - + {{ data[template.matColumnDef] ? (data[template.matColumnDef] | customDate : 'yyyy-MM-dd') diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.html b/src/app/pages/fee-grant/my-granters/my-granters.component.html index 4287d4cf4..dbe8260a4 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.html +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.html @@ -75,7 +75,7 @@
    - + {{ data[template.matColumnDef] ? (data[template.matColumnDef] | customDate : 'yyyy-MM-dd') diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index 35cd0b5b5..766a35d93 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -130,14 +130,12 @@ export class MyGrantersComponent implements OnInit { searchToken(): void { if (this.textSearch && this.textSearch.length > 0) { - // this.dataSource.data = []; this.getListGrant(); } } resetFilterSearch() { this.textSearch = ''; - // this.dataSource.data = []; this.getListGrant(); } From 592da268b5e7fb8ce8ba7d578f7e6f8335b63bb0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 15 Jun 2023 14:23:49 +0700 Subject: [PATCH 110/315] highlight expired --- .../pages/fee-grant/my-grantees/my-grantees.component.ts | 6 +++++- .../pages/fee-grant/my-granters/my-granters.component.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index 022ca4714..0ef276e65 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -142,10 +142,13 @@ export class MyGranteesComponent implements OnInit { if ( this.dataSource?.data?.length > 0 && this.dataSource.data.length !== res.feegrant?.length && - this.pageData.pageIndex != 0 + this.pageData.pageIndex != 0 && + !this.textSearch ) { this.dataSource.data = [...this.dataSource.data, ...res.feegrant]; } else { + this.dataSource.paginator.pageIndex = 0; + this.pageData.pageIndex = 0; this.dataSource.data = [...res.feegrant]; } this.pageData.length = res.feegrant?.length; @@ -165,6 +168,7 @@ export class MyGranteesComponent implements OnInit { resetFilterSearch() { this.textSearch = ''; + this.pageData.pageIndex = 0; this.getListGrant(); } diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index 766a35d93..7fabf7019 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -136,6 +136,7 @@ export class MyGrantersComponent implements OnInit { resetFilterSearch() { this.textSearch = ''; + this.dataSource.data = []; this.getListGrant(); } From bd7f7c911bf02c4399a09642039e16d8102f1abf Mon Sep 17 00:00:00 2001 From: nthduc95 Date: Thu, 15 Jun 2023 14:24:31 +0700 Subject: [PATCH 111/315] enhance contract list --- src/app/core/services/contract.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index fa202d6a7..aba21571f 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -33,6 +33,8 @@ export class ContractService extends CommonService { payload.address = null; payload.name = null; let updateQuery = ''; + const isFilterCW4973 = payload.contractType?.includes('CW4973'); + let typeQuery = isFilterCW4973 ? '_or: [{code: {type: {_in: $type}}}, {name: {_eq: "crates.io:cw4973"}}],' :'code: {type: {_in: $type}},'; if (payload.keyword?.length >= LENGTH_CHARACTER.CONTRACT) { payload.address = payload.keyword; @@ -41,7 +43,7 @@ export class ContractService extends CommonService { } else if (/^\d+$/.test(payload.keyword)) { payload.codeId = +payload.keyword; payload.name = '%' + payload.keyword + '%'; - updateQuery = `_or: [{name: {_like: "${payload.name}"}}, {code_id: {_eq: ${payload.codeId}}}],`; + updateQuery = `_and: {_or: [{name: {_like: "${payload.name}"}}, {code_id: {_eq: ${payload.codeId}}}]},`; } else if (payload.keyword?.length > 0) { payload.name = '%' + payload.keyword + '%'; updateQuery = `name: {_like: "${payload.name}"},`; @@ -51,7 +53,7 @@ export class ContractService extends CommonService { const operationsDoc = ` query auratestnet_smart_contract($limit: Int = 100, $offset: Int = 0, $type: [String!], $address: String = null, $creator: String =null) { ${this.envDB} { - smart_contract(limit: $limit, offset: $offset, order_by: {updated_at: desc}, where: {code: {type: {_in: $type}}, ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { + smart_contract(limit: $limit, offset: $offset, order_by: {updated_at: desc}, where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { address name code_id @@ -66,7 +68,7 @@ export class ContractService extends CommonService { updated_at creator } - smart_contract_aggregate(where: {code: {type: {_in: $type}}, ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { + smart_contract_aggregate(where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { aggregate { count } From 39a5deade04cf030d99606fb34cb06ada95c1596 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Thu, 15 Jun 2023 14:34:41 +0700 Subject: [PATCH 112/315] update proposal validator --- src/app/core/constants/proposal.constant.ts | 29 +++++++++ src/app/core/services/proposal.service.ts | 35 +++++++++++ .../validators-votes.component.html | 1 + .../validators-votes.component.ts | 59 ++++++++++++++++++- 4 files changed, 122 insertions(+), 2 deletions(-) diff --git a/src/app/core/constants/proposal.constant.ts b/src/app/core/constants/proposal.constant.ts index e37d10525..2197824d1 100644 --- a/src/app/core/constants/proposal.constant.ts +++ b/src/app/core/constants/proposal.constant.ts @@ -45,6 +45,35 @@ export enum VOTE_OPTION { EMPTY = 'VOTE_OPTION_EMPTY', } +/* + + VOTE_OPTION_UNSPECIFIED: vote_aggregate(where: {vote_option: {_eq: "VOTE_OPTION_UNSPECIFIED"}}) { + aggregate { + count + } + } + VOTE_OPTION_YES: vote_aggregate(where: {vote_option: {_eq: "VOTE_OPTION_YES"}}) { + aggregate { + count + } + } + VOTE_OPTION_NO: vote_aggregate(where: {vote_option: {_eq: "VOTE_OPTION_NO"}}) { + aggregate { + count + } + } + VOTE_OPTION_NO_WITH_VETO: vote_aggregate(where: {vote_option: {_eq: "VOTE_OPTION_NO_WITH_VETO"}}) { + aggregate { + count + } + } + VOTE_OPTION_ABSTAIN: vote_aggregate(where: {vote_option: {_eq: "VOTE_OPTION_ABSTAIN"}}) { + aggregate { + count + } + } +*/ + export const PROPOSAL_VOTE = [ { key: VOTE_OPTION.UNSPECIFIED, diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index b89d10c3a..59d7d1460 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -6,6 +6,7 @@ import { VOTE_OPTION } from '../constants/proposal.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; import { map } from 'rxjs/operators'; +import { offset } from '@popperjs/core'; @Injectable() export class ProposalService extends CommonService { @@ -52,6 +53,40 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } + getValidatorVotesFromIndexer2( + proposalId: number, + { limit, offset }: { limit: number; offset?: number }, + ): Observable { + const operationsDoc = ` + query auratestnet_validator($proposalId: Int = null, $limit: Int = 10, $offset: Int = 0) { + ${this.envDB} { + validator(where: {status: {_eq: "BOND_STATUS_BONDED"}}, order_by: {percent_voting_power: desc}, limit: $limit, offset: $offset) { + vote(where: {proposal_id: {_eq: $proposalId}}) { + id + vote_option + txhash + proposal_id + updated_at + } + description + operator_address + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + proposalId: proposalId, + limit: limit, + offset: offset || 0, + }, + operationName: 'auratestnet_validator', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getProposalData(payload) { const operationsDoc = ` query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $type: String = null) { diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html index 854775acb..6cef1551a 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.html @@ -23,6 +23,7 @@ [type]="proposalValidatorVote" [length]="countVote.get(countCurrent)" [data]="voteDataList" + (pageEventChange)="pageEventChange($event)" *ngIf="!voteDataListLoading">
    diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index f8a8bff71..32095e1bf 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -64,11 +64,60 @@ export class ValidatorsVotesComponent implements OnInit { constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { if (event) { - this.getValidatorVotes(); + // this.getValidatorVotes(); + this.getValidatorVotes2(); } }); } + getValidatorVotes2(isInit = false): void { + if (this.proposalId) { + this.proposalService + .getValidatorVotesFromIndexer2(this.proposalId, { + limit: 10, + }) + .subscribe( + (res) => { + let validatorVote = []; + if (res?.validator) { + validatorVote = _.get(res, 'validator').map((item) => { + const validator_name = item.description?.moniker; + const timestamp = _.get(item, 'vote[0].updated_at'); + const vote_option = _.get(item, 'vote[0].vote_option'); + const txhash = _.get(item, 'vote[0].txhash'); + const operator_address = _.get(item, 'operator_address'); + const validator_identity = _.get(item, 'description.identity'); + return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity }; + }); + } + + this.voteData.all = validatorVote; + this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); + this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.ABSTAIN); + this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO); + this.voteData.noWithVeto = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO_WITH_VETO); + this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); + this.voteDataList = [...this.voteData.all]; + + this.countVote.set('', this.voteData.all.length); + this.countVote.set(VOTE_OPTION.YES, this.voteData.yes.length); + this.countVote.set(VOTE_OPTION.ABSTAIN, this.voteData.abstain.length); + this.countVote.set(VOTE_OPTION.NO, this.voteData.no.length); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, this.voteData.noWithVeto.length); + this.countVote.set('null', this.voteData.didNotVote.length); + + this.voteDataListLoading = false; + this.changeTab(this.countCurrent); + }, + () => {}, + () => { + this.voteDataListLoading = false; + }, + ); + } + isInit && this.customNav?.select(this.tabAll); + } + getValidatorVotes(isInit = false): void { if (this.proposalId) { this.proposalService.getValidatorVotesFromIndexer(this.proposalId).subscribe( @@ -114,7 +163,9 @@ export class ValidatorsVotesComponent implements OnInit { } ngOnInit(): void { - this.getValidatorVotes(true); + // this.getValidatorVotes(true); + + this.getValidatorVotes2(); } changeTab(tabId): void { @@ -143,4 +194,8 @@ export class ValidatorsVotesComponent implements OnInit { break; } } + + pageEventChange(e) { + console.log(e); + } } From 862ecca151006238e99a9fb8c7f5d315f00b0a73 Mon Sep 17 00:00:00 2001 From: nthduc95 Date: Thu, 15 Jun 2023 14:54:43 +0700 Subject: [PATCH 113/315] format code --- .../token/token-list/token-cw4973/token-cw4973.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts index af849ccbe..2e0f070df 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts @@ -75,7 +75,7 @@ export class TokenCw4973Component implements OnInit { offset: this.pageData.pageIndex * this.pageData.pageSize, keyword: this.textSearch, }; - this.soulboundService.getListABT(payload).subscribe((res) => { + this.soulboundService.getListABT(payload).subscribe((res) => { this.dataSource = new MatTableDataSource(res?.cw721_contract); this.pageData.length = res?.cw721_contract_aggregate.aggregate.count; }); From 8d30cbc0e95b99cfd9c6b8e842cc18dadcb80427 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 15 Jun 2023 15:09:12 +0700 Subject: [PATCH 114/315] [TamTM6] update cw721, cw4973 call horoscope --- src/app/core/services/account.service.ts | 65 +++++++++- src/app/core/services/contract.service.ts | 38 +++++- src/app/core/services/token.service.ts | 12 -- src/app/core/services/validator.service.ts | 9 +- .../nft-list/nft-list.component.ts | 17 ++- .../soulbound-token-equipped.component.ts | 2 +- .../soulbound-token-unequipped.component.ts | 2 +- .../nft-detail/nft-detail.component.html | 4 +- .../token/nft-detail/nft-detail.component.ts | 121 +++++++++++------- .../validators-detail.component.ts | 33 +++-- .../soulbound-feature-tokens.component.ts | 2 +- 11 files changed, 215 insertions(+), 90 deletions(-) diff --git a/src/app/core/services/account.service.ts b/src/app/core/services/account.service.ts index 1e27b8cf3..b9f2be1ff 100644 --- a/src/app/core/services/account.service.ts +++ b/src/app/core/services/account.service.ts @@ -3,6 +3,8 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; +import { map } from 'rxjs/operators'; +import { TYPE_CW4973 } from '../constants/contract.constant'; @Injectable() export class AccountService extends CommonService { @@ -17,11 +19,70 @@ export class AccountService extends CommonService { } getAssetCW20ByOwner(payload): Observable { - return this.http.post(`${this.apiUrl}/cw20-tokens/get-by-owner/`,payload); + return this.http.post(`${this.apiUrl}/cw20-tokens/get-by-owner/`, payload); } getAssetCW721ByOwner(payload): Observable { - return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-owner/`,payload); + return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-owner/`, payload); + } + + getAssetCW721ByOwnerV2(payload): Observable { + const operationsDoc = ` + query Query( + $contract_address: String + $limit: Int = 10 + $nextKeyLastUpdatedHeight: Int = null + $nextKeyId: Int = null + $tokenId: String = null + $owner: String = null + ) { + ${this.envDB} { + cw721_token( + limit: $limit + where: { + cw721_contract: { + smart_contract: { address: { _eq: $contract_address }, name: {_neq: "${TYPE_CW4973}"} } + } + id: { _lt: $nextKeyId } + last_updated_height: { _lt: $nextKeyLastUpdatedHeight } + token_id: { _eq: $tokenId } + owner: { _eq: $owner } + } + order_by: [{ last_updated_height: desc }, { id: desc }] + ) { + id + token_id + owner + media_info + last_updated_height + created_at + burned + cw721_contract { + name + symbol + smart_contract { + name + address + } + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: payload?.limit || 20, + contract_address: payload?.contractAddress, + nextKeyLastUpdatedHeight: payload?.nextKey, + nextKeyId: payload?.nextKeyId, + tokenId: payload?.token_id, + owner: payload?.owner, + }, + operationName: 'Query', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } getTotalAssets(account_id: string): Observable { diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 5a2f08344..13937a454 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -216,10 +216,46 @@ export class ContractService extends CommonService { ); } - getNFTDetail(contractAddress: string, tokenId): Observable { + getDetailCW4973(contractAddress: string, tokenId): Observable { return this.http.get(`${this.apiUrl}/contracts/${contractAddress}/nft/${tokenId}`); } + getDetailCW721(address, tokenId): Observable { + const contractDoc = ` + query CW721Owner($address: String, $tokenId: String) { + ${this.envDB} { + data: cw721_token(where: { cw721_contract: {smart_contract: {address: {_eq: $address}, name: {_neq: "crates.io:cw4973"}}}, token_id: {_eq: $tokenId}}) { + id + token_id + owner + media_info + burned + cw721_contract { + name + smart_contract { + name + address + creator + } + symbol + minter + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: contractDoc, + variables: { + address: address, + tokenId: tokenId, + }, + operationName: 'CW721Owner', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getListContractById(codeId: number): Observable { return this.http.get(`${this.apiUrl}/contract-codes/${codeId}`); } diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index e87af4037..c03e5e662 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -21,10 +21,6 @@ export class TokenService extends CommonService { return this.http.post(`${this.apiUrl}/cw20-tokens`, payload); } - getListCW721Token(payload): Observable { - return this.http.post(`${this.apiUrl}/cw721-tokens`, payload); - } - getListCW721TokenV2(payload, textSearch = null): Observable { if (textSearch?.length > 0) { textSearch = '%' + textSearch + '%'; @@ -66,10 +62,6 @@ export class TokenService extends CommonService { return this.http.get(`${this.apiUrl}/contracts/token/${address}`); } - getTokenCW721Detail(address): Observable { - return this.http.get(`${this.apiUrl}/cw721-tokens/${address}`); - } - getListTokenNFTFromIndexerV2(payload): Observable { const operationsDoc = ` query Query( @@ -207,8 +199,4 @@ export class TokenService extends CommonService { getListAssetCommunityPool() { return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.DISTRIBUTION}`); } - - getAssetCW721ByContract(payload): Observable { - return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-contract/`, payload); - } } diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index d7b4ee7ca..893352ef1 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -159,11 +159,11 @@ export class ValidatorService extends CommonService { return axios.get(`${this.chainInfo.rest}/${LCD_COSMOS.BLOCK}/${block}`); } - getUptimeIndexer(consAddress = null, limit = 100) { + getUptimeIndexer(consAddress = null, limit = 100, height = null) { const operationsDoc = ` - query MyQuery($cons_address: String, $limit: Int = 100) { + query MyQuery($cons_address: String, $limit: Int = 100, $height: Int = 0) { ${this.envDB} { - block(order_by: {height: desc}, limit: $limit) { + block(order_by: {height: desc}, limit: $limit, where: {height: {_eq: $height}}) { height hash block_signatures(where: {validator_address: {_eq: $cons_address}}) { @@ -180,7 +180,8 @@ export class ValidatorService extends CommonService { query: operationsDoc, variables: { cons_address: consAddress, - limit: limit + limit: limit, + height: height }, operationName: 'MyQuery', }) diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts index 6348f164c..88c8eb9bc 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts @@ -4,7 +4,6 @@ import * as _ from 'lodash'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; -import { ResponseDto } from 'src/app/core/models/common.model'; import { AccountService } from 'src/app/core/services/account.service'; import { checkTypeFile } from 'src/app/core/utils/common/info-common'; import { Globals } from 'src/app/global/global'; @@ -56,21 +55,21 @@ export class NftListComponent implements OnChanges { this.searchValue = this.searchValue?.trim(); const payload = { - account_address: this.address, + owner: this.address, limit: 100, keyword: this.searchValue, next_key: nextKey, }; - this.accountService.getAssetCW721ByOwner(payload).subscribe( - (res: ResponseDto) => { - if (res?.data?.length > 0) { - if (res?.data?.length >= 100) { - this.nextKey = res?.data[res?.data?.length - 1].id; + this.accountService.getAssetCW721ByOwnerV2(payload).subscribe( + (res) => { + if (res?.cw721_token?.length > 0) { + if (res?.cw721_token?.length >= 100) { + this.nextKey = res?.cw721_token[res?.cw721_token?.length - 1].id; } if (this.nftList.length > 0) { - this.nftList = [...this.nftList, ...res.data]; + this.nftList = [...this.nftList, ...res.cw721_token]; } else { - this.nftList = res?.data; + this.nftList = res?.cw721_token; } this.pageData.length = this.nftList.length; diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts index e7b7d86af..7661f42b0 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts @@ -111,7 +111,7 @@ export class SoulboundTokenEquippedComponent implements OnInit { } getSBTDetail(contractAddress, tokenID, pick = true) { - this.contractService.getNFTDetail(contractAddress, tokenID).subscribe((res) => { + this.contractService.getDetailCW4973(contractAddress, tokenID).subscribe((res) => { if (res?.data) { this.updatePick(res.data, pick); } diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts index cdd49e4d9..36ef48d58 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts @@ -118,7 +118,7 @@ export class SoulboundTokenUnequippedComponent implements OnInit, OnChanges { getSBTDetail(contractAddress, tokenID, isNotify) { this.isClick = true; - this.contractService.getNFTDetail(contractAddress, tokenID).subscribe((res) => { + this.contractService.getDetailCW4973(contractAddress, tokenID).subscribe((res) => { if (res?.data) { this.openDialogDetail(res.data); if (isNotify) { diff --git a/src/app/pages/token/nft-detail/nft-detail.component.html b/src/app/pages/token/nft-detail/nft-detail.component.html index 6609824c1..bccbd8c9a 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.html +++ b/src/app/pages/token/nft-detail/nft-detail.component.html @@ -57,7 +57,9 @@

    controlsList="nodownload" *ngIf=" getTypeFile(nftDetail) === MEDIA_TYPE.VIDEO && - (nftDetail.animation?.link_s3 || nftDetail?.animation_url) + (nftDetail.animation?.link_s3 || + nftDetail?.animation_url || + nftDetail.media_info?.offchain?.animation?.url) " poster="{{ imageUrl }}"> dta.matColumnDef); isSoulBound = false; - loading = false; + loading = true; nftId = ''; contractAddress = ''; nftDetail: any; @@ -110,7 +110,6 @@ export class NFTDetailComponent implements OnInit { ngOnInit(): void { this.contractAddress = this.router.snapshot.paramMap.get('contractAddress'); this.nftId = this.router.snapshot.paramMap.get('nftId'); - this.getNFTDetail(); this.getDataTable(); this.walletService.wallet$.subscribe((wallet) => { if (wallet) { @@ -119,58 +118,89 @@ export class NFTDetailComponent implements OnInit { this.userAddress = null; } }); + + if (this.router.snapshot.url[0]?.path === 'token-nft') { + this.getDetailCW721(); + } else { + this.getDetailCW4973(); + } } error(): void { this.isError = true; } - getNFTDetail() { - this.loading = true; + getDetailCW721() { const encoded = encodeURIComponent(this.nftId); - this.contractService.getNFTDetail(this.contractAddress, encoded).subscribe((res) => { - if (!res?.data || res.data === null || res?.data.status === SB_TYPE.UNEQUIPPED) { - this.toastr.error('Token invalid'); - this.loading = false; - return; - } - res.data['type'] = res.data['type'] || ContractRegisterType.CW721; - this.nftDetail = { - ...res.data, - contract_address: res.contract_address || res.data?.cw721_contract?.smart_contract?.address, - creator: res.creator || res.data?.cw721_contract?.smart_contract?.creator, - name: res.name || res.data?.cw721_contract?.name, - }; - if (this.nftDetail.type === ContractRegisterType.CW721) { - if (this.nftDetail?.asset_info?.data?.info?.extension?.image?.indexOf('twilight') > 1) { - this.nftDetail['isDisplayName'] = true; - this.nftDetail['nftName'] = this.nftDetail?.asset_info?.data?.info?.extension?.name || ''; - } - if (this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url) { - this.imageUrl = this.nftDetail.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url; + this.contractService.getDetailCW721(this.contractAddress, encoded).subscribe( + (res) => { + res.data = res.data[0]; + + if (!res?.data || res.data === null || res?.data.status === SB_TYPE.UNEQUIPPED) { + this.toastr.error('Token invalid'); + this.loading = false; + return; } - if (this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url) { - if (!this.nftDetail?.image?.link_s3) { - if ( - (this.nftDetail.animation?.content_type || - this.nftDetail?.media_info?.offchain?.animation?.content_type) === 'image/gif' - ) { - this.imageUrl = this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain.animation?.url; - } else { + res.data['type'] = res.data['type'] || ContractRegisterType.CW721; + this.nftDetail = { + ...res.data, + contract_address: res.contract_address || res.data?.cw721_contract?.smart_contract?.address, + creator: res.creator || res.data?.cw721_contract?.smart_contract?.creator, + name: res.name || res.data?.cw721_contract?.name, + }; + if (this.nftDetail.type === ContractRegisterType.CW721) { + if (this.nftDetail?.asset_info?.data?.info?.extension?.image?.indexOf('twilight') > 1) { + this.nftDetail['isDisplayName'] = true; + this.nftDetail['nftName'] = this.nftDetail?.asset_info?.data?.info?.extension?.name || ''; + } + if (this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url) { + this.imageUrl = this.nftDetail.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url; + } + if (this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url) { + if (!this.nftDetail?.image?.link_s3) { + if ( + (this.nftDetail.animation?.content_type || + this.nftDetail?.media_info?.offchain?.animation?.content_type) === 'image/gif' + ) { + this.imageUrl = + this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain.animation?.url; + } else { + this.animationUrl = + this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; + } + } else if (this.getTypeFile(this.nftDetail) !== MEDIA_TYPE.IMG) { this.animationUrl = this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; + } else { + this.imageUrl = this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain.image?.url; } - } else if (this.getTypeFile(this.nftDetail) !== MEDIA_TYPE.IMG) { - this.animationUrl = - this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; - } else { - this.imageUrl = this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain.image?.url; } } - } else if ( - this.nftDetail.type === ContractRegisterType.CW4973 || - this.nftDetail?.cw721_contract.smart_contract.name === TYPE_CW4973 - ) { + }, + () => {}, + () => { + this.loading = false; + }, + ); + } + + getDetailCW4973() { + const encoded = encodeURIComponent(this.nftId); + this.contractService.getDetailCW4973(this.contractAddress, encoded).subscribe( + (res) => { + if (!res?.data || res.data === null || res?.data.status === SB_TYPE.UNEQUIPPED) { + this.toastr.error('Token invalid'); + this.loading = false; + return; + } + res.data['type'] = res.data['type'] || ContractRegisterType.CW721; + this.nftDetail = { + ...res.data, + contract_address: res.contract_address || res.data?.cw721_contract?.smart_contract?.address, + creator: res.creator || res.data?.cw721_contract?.smart_contract?.creator, + name: res.name || res.data?.cw721_contract?.name, + }; + if (this.nftDetail.status !== SB_TYPE.EQUIPPED) { this.toastr.error('Token invalid'); return; @@ -197,9 +227,12 @@ export class NFTDetailComponent implements OnInit { this.nftDetail['nftName'] = this.nftDetail.token_name_ipfs || this.nftDetail.ipfs?.name || ''; } this.isSoulBound = true; - } - this.loading = false; - }); + }, + () => {}, + () => { + this.loading = false; + }, + ); } async getDataTable(nextKey = null) { diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index bc1f670bc..b471cda6d 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -205,23 +205,28 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { getBlocksMiss(address = null, lastBlock = []) { //check is query last block - const limit = lastBlock?.length > 0 ? 5 : 100; - this.validatorService.getUptimeIndexer(address, limit).subscribe((res) => { + let limit = 100; + let height = null; + if (lastBlock?.length > 0) { + limit = 1; + height = lastBlock[0]?.height; + } + this.validatorService.getUptimeIndexer(address, limit, height).subscribe((res) => { this.arrBlockUptime = res?.block?.filter((h) => h.block_signatures.length === 0); - if (this.arrBlockUptime?.length > 0 && lastBlock?.length === 0) { - this.arrLastBlock?.forEach((element) => { - if (this.arrBlockUptime?.find((k) => k.height === element.height)) { - element['isSign'] = false; - } - }); + if (lastBlock?.length === 0) { + if (this.arrBlockUptime?.length > 0 && lastBlock?.length === 0) { + this.arrLastBlock?.forEach((element) => { + if (this.arrBlockUptime?.find((k) => k.height === element.height)) { + element['isSign'] = false; + } + }); + } + } else { + lastBlock[0]['isSign'] = this.arrBlockUptime?.find((k) => k.height === lastBlock[0]?.height) ? false : true; + this.arrLastBlock?.unshift(lastBlock[0]); + this.arrLastBlock?.pop(); } }); - - if (lastBlock?.length > 0) { - lastBlock[0]['isSign'] = this.arrBlockUptime?.find((k) => k.height === lastBlock[0]?.height) ? false : true; - this.arrLastBlock?.unshift(lastBlock[0]); - this.arrLastBlock?.pop(); - } } async getListDelegator(nextKey = null, isInit = true) { diff --git a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts index 0816cedbd..c83a95a5a 100644 --- a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts +++ b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts @@ -94,7 +94,7 @@ export class SoulboundFeatureTokensComponent implements OnInit { getSBTDetail(contractAddress, tokenID) { this.isClick = true; - this.contractService.getNFTDetail(contractAddress, tokenID).subscribe((res) => { + this.contractService.getDetailCW4973(contractAddress, tokenID).subscribe((res) => { this.isClick = false; if (res) { this.openDialogDetail(res.data); From 408d6600877b2ad02dcbc563921e9bbd0b48d25a Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 15 Jun 2023 15:12:33 +0700 Subject: [PATCH 115/315] format html --- .../soulbound-contract-list.component.html | 30 ++++++++++---- .../soulbound-token-contract.component.html | 40 ++++++++++++++----- .../token-cw4973/token-cw4973.component.html | 34 +++++++++++----- 3 files changed, 76 insertions(+), 28 deletions(-) diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html index 781b6ea04..178439916 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html @@ -7,14 +7,24 @@

    Account Bound Token

    - + -
    @@ -43,7 +53,7 @@

    Account Bound Token

    {{ element.smart_contract.address | cutStringPipe : 8 : 8 - }} + }}
    @@ -70,7 +80,8 @@

    Account Bound Token

    - @@ -86,7 +97,10 @@

    Account Bound Token

    - @@ -97,4 +111,4 @@

    Account Bound Token

    - \ No newline at end of file + diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html index e95440c7f..7c519e6fc 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html @@ -26,8 +26,13 @@

    Account Bound Token

    - +
    @@ -41,16 +46,28 @@

    Account Bound Token

    - + -
    @@ -129,7 +146,10 @@

    Account Bound Token

    - @@ -140,4 +160,4 @@

    Account Bound Token

    - \ No newline at end of file + diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html index 6653342cf..ca121618d 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html @@ -9,15 +9,24 @@

    Account Bound Tokens (ABT)

    - -
    @@ -37,8 +46,10 @@

    Account Bound Tokens (ABT)

    @@ -49,7 +60,7 @@

    Account Bound Tokens (ABT)

    {{ element.smart_contract.address | cutStringPipe : 8 : 8 - }} + }} @@ -57,7 +68,7 @@

    Account Bound Tokens (ABT)

    {{ element.smart_contract.creator | cutStringPipe : 8 : 8 - }} + }}
    @@ -70,7 +81,10 @@

    Account Bound Tokens (ABT)

    - @@ -81,4 +95,4 @@

    Account Bound Tokens (ABT)

    - - \ No newline at end of file + From dcf8041c9cd82a2676228b04fff62c75cd441c48 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 15 Jun 2023 15:22:09 +0700 Subject: [PATCH 116/315] remove code dont use --- src/app/core/services/account.service.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/app/core/services/account.service.ts b/src/app/core/services/account.service.ts index b9f2be1ff..f99ac8742 100644 --- a/src/app/core/services/account.service.ts +++ b/src/app/core/services/account.service.ts @@ -22,10 +22,6 @@ export class AccountService extends CommonService { return this.http.post(`${this.apiUrl}/cw20-tokens/get-by-owner/`, payload); } - getAssetCW721ByOwner(payload): Observable { - return this.http.post(`${this.apiUrl}/cw721-tokens/get-by-owner/`, payload); - } - getAssetCW721ByOwnerV2(payload): Observable { const operationsDoc = ` query Query( From c70a6340b762c984c9c3b6d9a9876129f06ed330 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Thu, 15 Jun 2023 15:32:36 +0700 Subject: [PATCH 117/315] update granter --- src/app/core/services/feegrant.service.ts | 87 +++++++++ .../my-grantees/my-grantees.component.html | 18 +- .../my-grantees/my-grantees.component.ts | 178 +++++------------- 3 files changed, 140 insertions(+), 143 deletions(-) diff --git a/src/app/core/services/feegrant.service.ts b/src/app/core/services/feegrant.service.ts index bbda98da5..831bd7d4e 100644 --- a/src/app/core/services/feegrant.service.ts +++ b/src/app/core/services/feegrant.service.ts @@ -75,4 +75,91 @@ export class FeeGrantService extends CommonService { }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } + + getListFeeGrants2( + { + limit, + hash, + isGranter, + granter, + grantee, + isActive, + offset, + }: { + limit?: number; + hash?: string; + isGranter?: boolean; + granter?: string; + grantee?: string; + isActive?: boolean; + offset?: number; + }, + textSearch = '', + ): Observable { + if (textSearch?.length > 0) { + if (textSearch?.length === LENGTH_CHARACTER.TRANSACTION) { + hash = textSearch; + } else { + if (isGranter) { + granter = textSearch; + } else { + grantee = textSearch; + } + } + } + + let updateQuery = ''; + if (isActive) { + updateQuery = ', status: {_eq: "Available"}'; + } else { + updateQuery = ', status: {_neq: "Available"}'; + } + + const operationsDoc = ` + query queryFeegrant($limit: Int = 100, $offset: Int = 0, $granter: String = null, $hash: String = null, $grantee: String = null) { + ${this.envDB} { + feegrant(limit: $limit, offset: $offset, where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee}, status: {_eq: "Available"}}, order_by: {init_tx_id: desc}) { + grantee + granter + expiration + type + status + spend_limit + denom + init_tx_id + transaction { + hash + timestamp + } + revoke_tx { + hash + } + feegrant_histories(where: {action: {_eq: "create"}}) { + id + amount + } + } + feegrant_aggregate(where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee}, status: {_eq: "Available"}}) { + aggregate { + count + } + } + } + } + `; + + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + limit: limit || 20, + granter: granter || null, + hash: hash || null, + grantee: grantee || null, + offset: offset || 0, + }, + operationName: 'queryFeegrant', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } } diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html index 8fa9a6230..f422d7da2 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html @@ -22,10 +22,7 @@ [maxLength]="maxLengthSearch" name="search" autocomplete="off" /> -
    @@ -123,18 +120,9 @@
    - +
    - diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index 958d3e372..a0dd878c9 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import * as _ from 'lodash'; @@ -56,7 +56,7 @@ export class MyGranteesComponent implements OnInit { pageSize: 20, pageIndex: 1, }; - nextKey = null; + currentKey = null; currentAddress = null; destroyed$ = new Subject(); @@ -89,7 +89,7 @@ export class MyGranteesComponent implements OnInit { }); this.timerGetFeeGrant = setInterval(() => { - this.getListGrant(); + this.getListGrant2(); }, 30000); } @@ -110,151 +110,73 @@ export class MyGranteesComponent implements OnInit { this.templates = this.templatesInActive; this.displayedColumns = this.templatesInActive.map((dta) => dta.matColumnDef); } - this.getListGrant(); + this.getListGrant2(); } - // getListGrant() { - // const payload = { - // limit: 100, - // granter: this.currentAddress, - // isActive: this.isActive, - // isGranter: false, - // }; - - // this.feeGrantService.getListFeeGrants(payload, this.textSearch).subscribe( - // (res) => { - // res.feegrant?.forEach((element) => { - // element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; - // element.spendable = element?.spend_limit || '0'; - // element.limit = element.feegrant_histories[0]?.amount || '0'; - // element.reason = element?.status; - // element.tx_hash = element?.transaction?.hash; - // element.timestamp = element?.transaction?.timestamp; - // element.origin_revoke_txhash = element?.revoke_tx?.hash; - // if (element?.expiration) { - // const timeCompare = new Date(element?.expiration).getTime(); - // if (element.status === 'Available' && timeCompare < Date.now()) { - // element.reason = 'Expired'; - // } - // } - // }); - - // if ( - // this.dataSource?.data?.length > 0 && - // this.dataSource.data.length !== res.feegrant?.length && - // this.pageData.pageIndex != 0 && - // !this.textSearch - // ) { - // this.dataSource.data = [...this.dataSource.data, ...res.feegrant]; - // } else { - // this.dataSource.paginator.pageIndex = 0; - // this.pageData.pageIndex = 0; - // this.dataSource.data = [...res.feegrant]; - // } - // this.pageData.length = res.feegrant?.length; - // }, - // (error) => {}, - // () => { - // this.loading = false; - // }, - // ); - // } - - getListGrant() { - const payload = { - limit: 100, - granter: this.currentAddress, - isActive: this.isActive, - isGranter: false, - }; - - this.feeGrantService.getListFeeGrants(payload, this.textSearch).subscribe( - (res) => { - res.feegrant?.forEach((element) => { - element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; - element.spendable = element?.spend_limit || '0'; - element.limit = element.feegrant_histories[0]?.amount || '0'; - element.reason = element?.status; - element.tx_hash = element?.transaction?.hash; - element.timestamp = element?.transaction?.timestamp; - element.origin_revoke_txhash = element?.revoke_tx?.hash; - if (element?.expiration) { - const timeCompare = new Date(element?.expiration).getTime(); - if (element.status === 'Available' && timeCompare < Date.now()) { - element.reason = 'Expired'; + getListGrant2() { + this.feeGrantService + .getListFeeGrants2( + { + limit: this.pageData.pageSize, + granter: this.currentAddress, + isActive: this.isActive, + isGranter: false, + offset: this.pageData.pageSize * (this.pageData.pageIndex - 1), + }, + this.textSearch, + ) + .subscribe( + (res) => { + res.feegrant?.forEach((element) => { + element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; + element.spendable = element?.spend_limit || '0'; + element.limit = element.feegrant_histories[0]?.amount || '0'; + element.reason = element?.status; + element.tx_hash = element?.transaction?.hash; + element.timestamp = element?.transaction?.timestamp; + element.origin_revoke_txhash = element?.revoke_tx?.hash; + if (element?.expiration) { + const timeCompare = new Date(element?.expiration).getTime(); + if (element.status === 'Available' && timeCompare < Date.now()) { + element.reason = 'Expired'; + } } - } - }); - - if ( - this.dataSource?.data?.length > 0 && - this.dataSource.data.length !== res.feegrant?.length && - this.pageData.pageIndex != 0 && - !this.textSearch - ) { - this.dataSource.data = [...this.dataSource.data, ...res.feegrant]; - } else { - this.dataSource.paginator.pageIndex = 0; - this.pageData.pageIndex = 0; - this.dataSource.data = [...res.feegrant]; - } - this.pageData.length = res.feegrant?.length; - }, - (error) => {}, - () => { - this.loading = false; - }, - ); + }); + this.dataSource.data = res.feegrant; + this.pageData.length = res.feegrant_aggregate.aggregate.count; + }, + (error) => {}, + () => { + this.loading = false; + }, + ); } searchToken(): void { - if (this.textSearch && this.textSearch.length > 0) { - this.getListGrant(); + if (this.textSearch && this.textSearch?.length > 0) { + this.pageEvent2(0); } } resetFilterSearch() { this.textSearch = ''; - this.getListGrant(); + this.pageEvent2(0); } - // paginatorEmit(e: MatPaginator): void { - // if (this.dataSource.paginator) { - // e.page.next({ - // length: this.dataSource.paginator.length, - // pageIndex: 0, - // pageSize: this.dataSource.paginator.pageSize, - // previousPageIndex: this.dataSource.paginator.pageIndex, - // }); - // this.dataSource.paginator = e; - // } else { - // this.dataSource.paginator = e; - // } - // } - - // pageEvent(e: PageEvent): void { - // const { pageIndex, pageSize } = e; - // const next = this.pageData.length <= (pageIndex + 2) * pageSize; - // this.pageData.pageIndex = e.pageIndex; - - // if (next && this.nextKey && this.currentKey !== this.nextKey) { - // this.getGranteesData(); - // this.currentKey = this.nextKey; - // } - // } - pageEvent(pageIndex: number): void { + pageEvent2(pageIndex: number): void { // reset page 1 if pageIndex = 0 if (pageIndex === 0) { this.pageData.pageIndex = 1; } + this.getGranteesData(); } async changeType(type: boolean) { this.isActive = type; - this.dataSource.data = []; - this.nextKey = null; - await this.getGranteesData(); + + this.pageEvent2(0); + this.loading = true; } showRevoke(granteeAddress: string, granterAddress: string) { @@ -270,7 +192,7 @@ export class MyGranteesComponent implements OnInit { if (result) { this.toastr.loading(result); setTimeout(() => { - this.mappingErrorService.checkDetailTx(result).then(() => this.getListGrant()); + this.mappingErrorService.checkDetailTx(result).then(() => this.pageEvent2(0)); }, 2000); } }); @@ -286,7 +208,7 @@ export class MyGranteesComponent implements OnInit { if (result) { this.toastr.loading(result); setTimeout(() => { - this.mappingErrorService.checkDetailTx(result).then(() => this.getListGrant()); + this.mappingErrorService.checkDetailTx(result).then(() => this.pageEvent2(0)); }, 2000); } }); From 9c16cfc3ea660d70e75c6000cf1c87654451a6f0 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Thu, 15 Jun 2023 15:58:27 +0700 Subject: [PATCH 118/315] update granter --- src/app/core/services/feegrant.service.ts | 66 +--------- .../my-grantees/my-grantees.component.html | 2 +- .../my-grantees/my-grantees.component.ts | 38 +++--- .../my-granters/my-granters.component.html | 10 +- .../my-granters/my-granters.component.ts | 115 +++++++----------- .../popup-add-grant.component.ts | 4 +- 6 files changed, 78 insertions(+), 157 deletions(-) diff --git a/src/app/core/services/feegrant.service.ts b/src/app/core/services/feegrant.service.ts index 831bd7d4e..07ffdc473 100644 --- a/src/app/core/services/feegrant.service.ts +++ b/src/app/core/services/feegrant.service.ts @@ -14,68 +14,6 @@ export class FeeGrantService extends CommonService { super(http, environmentService); } - getListFeeGrants(payload, textSearch = ''): Observable { - if (textSearch?.length > 0) { - if (textSearch?.length === LENGTH_CHARACTER.TRANSACTION) { - payload.hash = textSearch; - } else { - if (payload.isGranter) { - payload.granter = textSearch; - } else { - payload.grantee = textSearch; - } - } - } - - let updateQuery = ''; - if (payload.isActive) { - updateQuery = ', status: {_eq: "Available"}'; - } else { - updateQuery = ', status: {_neq: "Available"}'; - } - - const operationsDoc = ` - query auratestnet_feegrant($limit: Int = 100, $offset: Int = 0, $granter: String = null, $hash: String = null, $grantee: String = null) { - ${this.envDB} { - feegrant(limit: $limit, offset: $offset, where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee} ${updateQuery} }, order_by: {init_tx_id: desc}) { - grantee - granter - expiration - type - status - spend_limit - transaction { - hash - timestamp - } - denom - init_tx_id - revoke_tx { - hash - } - feegrant_histories(where: {action: {_eq: "create"}}) { - id - amount - } - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: payload?.limit || 20, - granter: payload?.granter || null, - hash: payload?.hash || null, - grantee: payload?.grantee || null, - offset: payload?.offset || 0, - }, - operationName: 'auratestnet_feegrant', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - getListFeeGrants2( { limit, @@ -118,7 +56,7 @@ export class FeeGrantService extends CommonService { const operationsDoc = ` query queryFeegrant($limit: Int = 100, $offset: Int = 0, $granter: String = null, $hash: String = null, $grantee: String = null) { ${this.envDB} { - feegrant(limit: $limit, offset: $offset, where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee}, status: {_eq: "Available"}}, order_by: {init_tx_id: desc}) { + feegrant(limit: $limit, offset: $offset, where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee} ${updateQuery} }, order_by: {init_tx_id: desc}) { grantee granter expiration @@ -139,7 +77,7 @@ export class FeeGrantService extends CommonService { amount } } - feegrant_aggregate(where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee}, status: {_eq: "Available"}}) { + feegrant_aggregate(where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee} ${updateQuery} }) { aggregate { count } diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html index f422d7da2..db6c4564f 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html @@ -120,7 +120,7 @@
    - +
    diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index a0dd878c9..bbba5581a 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -57,13 +57,11 @@ export class MyGranteesComponent implements OnInit { pageIndex: 1, }; - currentKey = null; currentAddress = null; destroyed$ = new Subject(); timerGetFeeGrant: any; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; - chainInfo = this.environmentService.configValue.chain_info; constructor( public commonService: CommonService, @@ -89,7 +87,7 @@ export class MyGranteesComponent implements OnInit { }); this.timerGetFeeGrant = setInterval(() => { - this.getListGrant2(); + this.getListGrant(); }, 30000); } @@ -110,10 +108,10 @@ export class MyGranteesComponent implements OnInit { this.templates = this.templatesInActive; this.displayedColumns = this.templatesInActive.map((dta) => dta.matColumnDef); } - this.getListGrant2(); + this.getListGrant(); } - getListGrant2() { + getListGrant() { this.feeGrantService .getListFeeGrants2( { @@ -125,8 +123,12 @@ export class MyGranteesComponent implements OnInit { }, this.textSearch, ) - .subscribe( - (res) => { + .subscribe({ + next: (res) => { + if (!res) { + return; + } + res.feegrant?.forEach((element) => { element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; element.spendable = element?.spend_limit || '0'; @@ -142,28 +144,28 @@ export class MyGranteesComponent implements OnInit { } } }); - this.dataSource.data = res.feegrant; - this.pageData.length = res.feegrant_aggregate.aggregate.count; + + this.dataSource.data = res?.feegrant; + this.pageData.length = res?.feegrant_aggregate?.aggregate?.count || 0; }, - (error) => {}, - () => { + complete: () => { this.loading = false; }, - ); + }); } searchToken(): void { if (this.textSearch && this.textSearch?.length > 0) { - this.pageEvent2(0); + this.pageEvent(0); } } resetFilterSearch() { this.textSearch = ''; - this.pageEvent2(0); + this.pageEvent(0); } - pageEvent2(pageIndex: number): void { + pageEvent(pageIndex: number): void { // reset page 1 if pageIndex = 0 if (pageIndex === 0) { this.pageData.pageIndex = 1; @@ -175,7 +177,7 @@ export class MyGranteesComponent implements OnInit { async changeType(type: boolean) { this.isActive = type; - this.pageEvent2(0); + this.pageEvent(0); this.loading = true; } @@ -192,7 +194,7 @@ export class MyGranteesComponent implements OnInit { if (result) { this.toastr.loading(result); setTimeout(() => { - this.mappingErrorService.checkDetailTx(result).then(() => this.pageEvent2(0)); + this.mappingErrorService.checkDetailTx(result).then(() => this.pageEvent(0)); }, 2000); } }); @@ -208,7 +210,7 @@ export class MyGranteesComponent implements OnInit { if (result) { this.toastr.loading(result); setTimeout(() => { - this.mappingErrorService.checkDetailTx(result).then(() => this.pageEvent2(0)); + this.mappingErrorService.checkDetailTx(result).then(() => this.pageEvent(0)); }, 2000); } }); diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.html b/src/app/pages/fee-grant/my-granters/my-granters.component.html index dbe8260a4..9d4c2f3dd 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.html +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.html @@ -34,7 +34,7 @@
    - {{ dataSource?.data?.length || 0 }} transaction{{ dataSource?.data?.length > 0 ? 's' : '' }} found + {{ pageData?.length || 0 }} transaction{{ pageData?.length > 0 ? 's' : '' }} found
    @@ -111,12 +111,16 @@
    - - + --> +
    + + +
    diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index 766a35d93..0a2d0f487 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import * as _ from 'lodash'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; @@ -46,10 +46,9 @@ export class MyGrantersComponent implements OnInit { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; - nextKey = null; - currentKey = null; + currentAddress = null; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; @@ -85,89 +84,67 @@ export class MyGrantersComponent implements OnInit { } getListGrant() { - const payload = { - limit: 100, - grantee: this.currentAddress, - isActive: this.isActive, - isGranter: true, - }; - - this.feeGrantService.getListFeeGrants(payload, this.textSearch).subscribe( - (res) => { - res.feegrant?.forEach((element) => { - element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; - element.spendable = element?.spend_limit || '0'; - element.limit = element.feegrant_histories[0]?.amount || '0'; - element.reason = element?.status; - element.tx_hash = element?.transaction?.hash; - element.timestamp = element?.transaction?.timestamp; - element.origin_revoke_txhash = element?.revoke_tx?.hash; - if (element?.expiration) { - const timeCompare = new Date(element?.expiration).getTime(); - if (element.status === 'Available' && timeCompare < Date.now()) { - element.reason = 'Expired'; + this.feeGrantService + .getListFeeGrants2( + { + limit: this.pageData.pageSize, + isActive: this.isActive, + isGranter: true, + grantee: this.currentAddress, + offset: this.pageData.pageSize * (this.pageData.pageIndex - 1), + }, + this.textSearch, + ) + .subscribe({ + next: (res) => { + res.feegrant?.forEach((element) => { + element.type = _.find(TYPE_TRANSACTION, { label: element.type })?.value; + element.spendable = element?.spend_limit || '0'; + element.limit = element.feegrant_histories[0]?.amount || '0'; + element.reason = element?.status; + element.tx_hash = element?.transaction?.hash; + element.timestamp = element?.transaction?.timestamp; + element.origin_revoke_txhash = element?.revoke_tx?.hash; + if (element?.expiration) { + const timeCompare = new Date(element?.expiration).getTime(); + if (element.status === 'Available' && timeCompare < Date.now()) { + element.reason = 'Expired'; + } } - } - }); + }); - if ( - this.dataSource?.data?.length > 0 && - this.dataSource.data.length !== res.feegrant?.length && - this.pageData.pageIndex != 0 - ) { - this.dataSource.data = [...this.dataSource.data, ...res.feegrant]; - } else { - this.dataSource.data = [...res.feegrant]; - } - this.pageData.length = res.feegrant?.length; - }, - () => {}, - () => { - this.loading = false; - }, - ); + this.dataSource.data = res.feegrant; + this.pageData.length = res.feegrant_aggregate.aggregate.count; + }, + complete: () => { + this.loading = false; + }, + }); } searchToken(): void { if (this.textSearch && this.textSearch.length > 0) { - this.getListGrant(); + this.pageEvent2(0); } } resetFilterSearch() { this.textSearch = ''; - this.getListGrant(); + this.pageEvent2(0); } - paginatorEmit(e: MatPaginator): void { - if (this.dataSource.paginator) { - e.page.next({ - length: this.dataSource.paginator.length, - pageIndex: 0, - pageSize: this.dataSource.paginator.pageSize, - previousPageIndex: this.dataSource.paginator.pageIndex, - }); - this.dataSource.paginator = e; - } else { - this.dataSource.paginator = e; + pageEvent2(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; } - } - - pageEvent(e: PageEvent): void { - const { pageIndex, pageSize } = e; - const next = this.pageData.length <= (pageIndex + 2) * pageSize; - this.pageData.pageIndex = e.pageIndex; - if (next && this.nextKey && this.currentKey !== this.nextKey) { - this.getGrantersData(); - this.currentKey = this.nextKey; - } + this.getGrantersData(); } async changeType(type: boolean) { this.isActive = type; - this.dataSource.data = null; - this.nextKey = null; - await this.getGrantersData(); + this.pageEvent2(0); + this.loading = true; } } diff --git a/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts b/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts index 36676b8f7..bb0772194 100644 --- a/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts +++ b/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts @@ -138,13 +138,13 @@ export class PopupAddGrantComponent implements OnInit { if (granter && grantee_address) { this.isRevoking = false; const payload = { - limit: 100, + limit: 1, granter: granter, grantee: grantee_address, isActive: true, isGranter: false, }; - this.feeGrantService.getListFeeGrants(payload).subscribe( + this.feeGrantService.getListFeeGrants2(payload).subscribe( (res) => { if (res.feegrant[0]?.expiration) { const timeCompare = new Date(res.feegrant[0]?.expiration).getTime(); From 382e48b0184798f73a007b9ac82b43353549d646 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 15 Jun 2023 16:10:47 +0700 Subject: [PATCH 119/315] update paginator feegrant --- src/app/core/services/feegrant.service.ts | 2 +- .../fee-grant/my-grantees/my-grantees.component.ts | 2 +- .../fee-grant/my-granters/my-granters.component.html | 8 +------- .../fee-grant/my-granters/my-granters.component.ts | 10 +++++----- .../popup-add-grant/popup-add-grant.component.ts | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/app/core/services/feegrant.service.ts b/src/app/core/services/feegrant.service.ts index 07ffdc473..cdc40d93a 100644 --- a/src/app/core/services/feegrant.service.ts +++ b/src/app/core/services/feegrant.service.ts @@ -14,7 +14,7 @@ export class FeeGrantService extends CommonService { super(http, environmentService); } - getListFeeGrants2( + getListFeeGrants( { limit, hash, diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index bbba5581a..dcd1e63ef 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -113,7 +113,7 @@ export class MyGranteesComponent implements OnInit { getListGrant() { this.feeGrantService - .getListFeeGrants2( + .getListFeeGrants( { limit: this.pageData.pageSize, granter: this.currentAddress, diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.html b/src/app/pages/fee-grant/my-granters/my-granters.component.html index 9d4c2f3dd..7076693a1 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.html +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.html @@ -111,14 +111,8 @@
    -
    - +
    diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index 0a2d0f487..ecea5acfe 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -85,7 +85,7 @@ export class MyGrantersComponent implements OnInit { getListGrant() { this.feeGrantService - .getListFeeGrants2( + .getListFeeGrants( { limit: this.pageData.pageSize, isActive: this.isActive, @@ -124,16 +124,16 @@ export class MyGrantersComponent implements OnInit { searchToken(): void { if (this.textSearch && this.textSearch.length > 0) { - this.pageEvent2(0); + this.pageEvent(0); } } resetFilterSearch() { this.textSearch = ''; - this.pageEvent2(0); + this.pageEvent(0); } - pageEvent2(pageIndex: number): void { + pageEvent(pageIndex: number): void { // reset page 1 if pageIndex = 0 if (pageIndex === 0) { this.pageData.pageIndex = 1; @@ -144,7 +144,7 @@ export class MyGrantersComponent implements OnInit { async changeType(type: boolean) { this.isActive = type; - this.pageEvent2(0); + this.pageEvent(0); this.loading = true; } } diff --git a/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts b/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts index bb0772194..8d0058d5a 100644 --- a/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts +++ b/src/app/pages/fee-grant/popup-add-grant/popup-add-grant.component.ts @@ -144,7 +144,7 @@ export class PopupAddGrantComponent implements OnInit { isActive: true, isGranter: false, }; - this.feeGrantService.getListFeeGrants2(payload).subscribe( + this.feeGrantService.getListFeeGrants(payload).subscribe( (res) => { if (res.feegrant[0]?.expiration) { const timeCompare = new Date(res.feegrant[0]?.expiration).getTime(); From 043114da39e0e5de6c249ecbd9583fc41a84cd79 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 15 Jun 2023 16:50:16 +0700 Subject: [PATCH 120/315] [TamTM6] fix path cw4973 --- .../code-id-contracts-tab/code-id-contracts-tab.component.ts | 4 ++-- .../token-inventory-tab/token-inventory-tab.component.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts index d1b3ebd6e..eb8169166 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts @@ -22,7 +22,7 @@ export class CodeIdContractsTabComponent implements OnInit { pageSize: 20, pageIndex: PAGE_EVENT.PAGE_INDEX, }; - dataSource: MatTableDataSource; + dataSource: MatTableDataSource = new MatTableDataSource([]); templates: Array = [ { matColumnDef: 'contract_address', headerCellDef: 'CONTRACT ADDRESS', isUrl: '/contracts' }, { matColumnDef: 'tx_hash', headerCellDef: 'TX HASH', isUrl: '/transaction' }, @@ -76,7 +76,7 @@ export class CodeIdContractsTabComponent implements OnInit { item.type = ContractRegisterType.CW4973; } }); - this.dataSource = res.smart_contract; + this.dataSource.data = res.smart_contract; } }); } diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts index fd004e3b7..522a1c9c5 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts @@ -50,7 +50,7 @@ export class TokenInventoryComponent implements OnInit { this.keyWord = params?.a || ''; }); - if (this.typeContract === ContractRegisterType.CW4973) { + if (this.route.snapshot.url[0]?.path === 'token-abt') { this.linkToken = 'token-abt'; } this.getNftData(); From bc877f0de0c94d9dd7ac5573b028e07b73ed4f37 Mon Sep 17 00:00:00 2001 From: Tam <99626599+mtamkg@users.noreply.github.com> Date: Thu, 15 Jun 2023 16:23:24 +0700 Subject: [PATCH 121/315] Merge pull request #1949 from aura-nw/feature/remove_amount check expired feegrant (cherry picked from commit 9ed507b41de19ef6cbc9f987b9221adebed052d1) # Conflicts: # src/app/core/services/contract.service.ts # src/app/pages/fee-grant/my-granters/my-granters.component.ts --- src/app/core/services/contract.service.ts | 102 +++- src/app/core/services/feegrant.service.ts | 109 ++--- src/app/core/services/proposal.service.ts | 62 +++ .../contracts-list.component.html | 35 +- .../contracts-list.component.ts | 62 ++- src/app/pages/contracts/contracts.module.ts | 6 +- src/app/pages/fee-grant/fee-grant.module.ts | 4 +- .../my-grantees/my-grantees.component.html | 19 +- .../my-grantees/my-grantees.component.ts | 127 +++-- .../my-granters/my-granters.component.html | 14 +- .../my-granters/my-granters.component.ts | 115 ++--- .../popup-add-grant.component.ts | 106 +++-- .../pages/proposal/proposal.component.html | 437 ++++++++---------- src/app/pages/proposal/proposal.component.ts | 203 ++++---- src/app/pages/proposal/proposal.module.ts | 2 + .../a-paginator/a-paginator.component.html | 23 + .../a-paginator/a-paginator.component.scss | 37 ++ .../a-paginator/a-paginator.component.ts | 17 + .../a-paginator/a-paginator.module.ts | 11 + 19 files changed, 770 insertions(+), 721 deletions(-) create mode 100644 src/app/shared/components/a-paginator/a-paginator.component.html create mode 100644 src/app/shared/components/a-paginator/a-paginator.component.scss create mode 100644 src/app/shared/components/a-paginator/a-paginator.component.ts create mode 100644 src/app/shared/components/a-paginator/a-paginator.module.ts diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 5a2f08344..a74026e3b 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -27,31 +27,49 @@ export class ContractService extends CommonService { this.contractObservable = this.contract$.asObservable(); } - getListContract(payload) { - payload.codeId = null; - payload.creator = null; - payload.address = null; - payload.name = null; + getListContract({ + codeId, + creator, + address, + name, + keyword, + limit, + offset, + contractType, + }: { + codeId?: number; + creator?: string; + address?: string; + name?: string; + keyword?: string; + limit?: number; + offset?: number; + contractType?: string[]; + }) { let updateQuery = ''; + const isFilterCW4973 = contractType?.includes('CW4973'); + let typeQuery = isFilterCW4973 + ? '_or: [{code: {type: {_in: $type}}}, {name: {_eq: "crates.io:cw4973"}}],' + : 'code: {type: {_in: $type}},'; - if (payload.keyword?.length >= LENGTH_CHARACTER.CONTRACT) { - payload.address = payload.keyword; - } else if (payload.keyword?.length >= LENGTH_CHARACTER.ADDRESS) { - payload.creator = payload.keyword; - } else if (/^\d+$/.test(payload.keyword)) { - payload.codeId = +payload.keyword; - payload.name = '%' + payload.keyword + '%'; - updateQuery = `_or: [{name: {_like: "${payload.name}"}}, {code_id: {_eq: ${payload.codeId}}}],`; - } else if (payload.keyword?.length > 0) { - payload.name = '%' + payload.keyword + '%'; - updateQuery = `name: {_like: "${payload.name}"},`; + if (keyword?.length >= LENGTH_CHARACTER.CONTRACT) { + address = keyword; + } else if (keyword?.length >= LENGTH_CHARACTER.ADDRESS) { + creator = keyword; + } else if (/^\d+$/.test(keyword)) { + codeId = +keyword; + name = '%' + keyword + '%'; + updateQuery = `_and: {_or: [{name: {_like: "${name}"}}, {code_id: {_eq: ${codeId}}}]},`; + } else if (keyword?.length > 0) { + name = '%' + keyword + '%'; + updateQuery = `name: {_like: "${name}"},`; } else { updateQuery = ''; } const operationsDoc = ` query auratestnet_smart_contract($limit: Int = 100, $offset: Int = 0, $type: [String!], $address: String = null, $creator: String =null) { ${this.envDB} { - smart_contract(limit: $limit, offset: $offset, order_by: {updated_at: desc}, where: {code: {type: {_in: $type}}, ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { + smart_contract(limit: $limit, offset: $offset, order_by: {updated_at: desc}, where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { address name code_id @@ -66,7 +84,7 @@ export class ContractService extends CommonService { updated_at creator } - smart_contract_aggregate(where: {code: {type: {_in: $type}}, ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { + smart_contract_aggregate(where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { aggregate { count } @@ -78,11 +96,11 @@ export class ContractService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { - limit: payload.limit, - offset: payload.offset, - type: payload.contractType, - creator: payload.creator, - address: payload.address, + limit: limit, + offset: offset, + type: contractType, + creator: creator, + address: address, }, operationName: 'auratestnet_smart_contract', }) @@ -216,10 +234,46 @@ export class ContractService extends CommonService { ); } - getNFTDetail(contractAddress: string, tokenId): Observable { + getDetailCW4973(contractAddress: string, tokenId): Observable { return this.http.get(`${this.apiUrl}/contracts/${contractAddress}/nft/${tokenId}`); } + getDetailCW721(address, tokenId): Observable { + const contractDoc = ` + query CW721Owner($address: String, $tokenId: String) { + ${this.envDB} { + data: cw721_token(where: { cw721_contract: {smart_contract: {address: {_eq: $address}, name: {_neq: "crates.io:cw4973"}}}, token_id: {_eq: $tokenId}}) { + id + token_id + owner + media_info + burned + cw721_contract { + name + smart_contract { + name + address + creator + } + symbol + minter + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: contractDoc, + variables: { + address: address, + tokenId: tokenId, + }, + operationName: 'CW721Owner', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getListContractById(codeId: number): Observable { return this.http.get(`${this.apiUrl}/contract-codes/${codeId}`); } diff --git a/src/app/core/services/feegrant.service.ts b/src/app/core/services/feegrant.service.ts index 65c2cc68d..cdc40d93a 100644 --- a/src/app/core/services/feegrant.service.ts +++ b/src/app/core/services/feegrant.service.ts @@ -1,90 +1,74 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import axios from 'axios'; -import * as _ from 'lodash'; import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; import { LENGTH_CHARACTER } from '../constants/common.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; -import { map } from 'rxjs/operators'; @Injectable() export class FeeGrantService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; - indexerUrl = `${this.environmentService.configValue.indexerUri}`; constructor(private http: HttpClient, private environmentService: EnvironmentService) { super(http, environmentService); } - getListFeeGrants(filterSearch, currentAddress, nextKey = null, isGranter = false): Observable { - let granter; - let grantee; - let isSearchAddress = true; - if (filterSearch['textSearch']?.length === LENGTH_CHARACTER.TRANSACTION) { - isSearchAddress = false; - } - if (isGranter) { - grantee = currentAddress; - granter = isSearchAddress ? filterSearch['textSearch'] : null; - } else { - granter = currentAddress; - grantee = isSearchAddress ? filterSearch['textSearch'] : null; - } - const params = _({ - chainid: this.chainInfo.chainId, - granter: granter, - grantee: grantee, - status: filterSearch['isActive'] ? 'Available' : 'Use up,Revoked,Fail', - pageLimit: 100, - nextKey: nextKey, - txhash: !isSearchAddress ? filterSearch['textSearch'] : null, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return this.http.get(`${this.indexerUrl}/feegrant/get-grants`, { - params, - }); - } - - getListFeeGrantsV2(payload, textSearch = ''): Observable { + getListFeeGrants( + { + limit, + hash, + isGranter, + granter, + grantee, + isActive, + offset, + }: { + limit?: number; + hash?: string; + isGranter?: boolean; + granter?: string; + grantee?: string; + isActive?: boolean; + offset?: number; + }, + textSearch = '', + ): Observable { if (textSearch?.length > 0) { if (textSearch?.length === LENGTH_CHARACTER.TRANSACTION) { - payload.hash = textSearch; + hash = textSearch; } else { - if (payload.isGranter) { - payload.granter = textSearch; + if (isGranter) { + granter = textSearch; } else { - payload.grantee = textSearch; + grantee = textSearch; } } } let updateQuery = ''; - if (payload.isActive) { + if (isActive) { updateQuery = ', status: {_eq: "Available"}'; } else { updateQuery = ', status: {_neq: "Available"}'; } const operationsDoc = ` - query auratestnet_feegrant($limit: Int = 100, $granter: String = null, $hash: String = null, $grantee: String = null) { + query queryFeegrant($limit: Int = 100, $offset: Int = 0, $granter: String = null, $hash: String = null, $grantee: String = null) { ${this.envDB} { - feegrant(limit: $limit, where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee} ${updateQuery} }, order_by: {init_tx_id: desc}) { + feegrant(limit: $limit, offset: $offset, where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee} ${updateQuery} }, order_by: {init_tx_id: desc}) { grantee granter expiration type status spend_limit + denom + init_tx_id transaction { hash timestamp } - denom - init_tx_id revoke_tx { hash } @@ -93,36 +77,27 @@ export class FeeGrantService extends CommonService { amount } } + feegrant_aggregate(where: {granter: {_eq: $granter}, transaction: {hash: {_eq: $hash}}, grantee: {_eq: $grantee} ${updateQuery} }) { + aggregate { + count + } + } } } `; + return this.http .post(this.graphUrl, { query: operationsDoc, variables: { - limit: payload?.limit || 100, - granter: payload?.granter || null, - hash: payload?.hash || null, - grantee: payload?.grantee || null, + limit: limit || 20, + granter: granter || null, + hash: hash || null, + grantee: grantee || null, + offset: offset || 0, }, - operationName: 'auratestnet_feegrant', + operationName: 'queryFeegrant', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - - checkAddressValid(granter, grantee) { - const params = _({ - chainid: this.chainInfo.chainId, - grantee: grantee, - granter: granter, - status: 'Available', - pageLimit: 1, - expired: true, - }) - .omitBy(_.isNull) - .omitBy(_.isUndefined) - .value(); - - return axios.get(`${this.indexerUrl}/feegrant/get-grants`, { params }); - } } diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index ee1de0403..db2f535d8 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -98,6 +98,68 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } + getProposalData2({ + limit, + offset, + proposalId, + type, + }: { + limit: number; + offset?: number; + proposalId?: number; + type?: string; + }) { + const operationsDoc = ` + query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $type: String = null, $n_status : String = "PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT") { + ${this.envDB} { + proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}, type: {_eq: $type}, status: {_neq: $n_status}}, order_by: {proposal_id: $order}) { + content + deposit_end_time + description + initial_deposit + proposal_id + proposer_address + count_vote + proposer { + description + operator_address + account_address + } + status + submit_time + tally + title + total_deposit + turnout + type + updated_at + voting_end_time + voting_start_time + } + proposal_aggregate(where: {proposal_id: {_eq: $proposalId}, type: {_eq: $type}, status: {_neq: "PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT"}}) { + aggregate { + count + } + } + } + } + `; + return this.http + .post(this.graphUrl, { + query: operationsDoc, + variables: { + n_status: 'PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT', + order: 'desc', + limit, + offset, + proposalId, + type, + }, + operationName: 'auratestnet_proposal', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getListVoteFromIndexer(payload, option): Observable { const operationsDoc = ` query auratestnet_vote($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index e4a9101aa..042109a4a 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -9,20 +9,20 @@

    Contracts

    class="form-control pl-0" placeholder="Search for Contract Name/ Address/ Creator address/ Code ID" [(ngModel)]="textSearch" - [maxLength]="maxLengthSearch" + [maxLength]="MAX_LENGTH_SEARCH_TOKEN" (keyup)="onKeyUp()" name="search" autocomplete="off" /> @@ -68,7 +68,7 @@

    Contracts

    class="form-control pl-0" placeholder="Search for Contract Name/ Address/ Creator address/ Code ID" [(ngModel)]="textSearch" - [maxLength]="maxLengthSearch" + [maxLength]="MAX_LENGTH_SEARCH_TOKEN" (keyup)="onKeyUp()" name="search" autocomplete="off" /> @@ -104,7 +104,7 @@

    Contracts

    contract_verificationContracts

    + *ngIf="data[template.matColumnDef] === ContractVerifyType.Verified"> {{ data['verified_at'] | customDate : 'yyyy-MM-dd' }}
    {{ data['verified_at'] | customDate : 'HH:mm:ss' }}
    -
    -
    +
    -
    {{ (data[template.matColumnDef] | cutStringPipe : 16) || '-' }} @@ -167,12 +167,13 @@

    Contracts

    - - + +
    + +

    diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index e0d73d20a..180fab596 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -1,19 +1,16 @@ -import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { DatePipe } from '@angular/common'; -import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; import { ContractRegisterType, ContractVerifyType } from 'src/app/core/constants/contract.enum'; -import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; import { DATEFORMAT, PAGE_EVENT } from '../../../core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from '../../../core/constants/token.constant'; import { TableTemplate } from '../../../core/models/common.model'; import { ContractService } from '../../../core/services/contract.service'; import { shortenAddress } from '../../../core/utils/common/shorten'; -import { Globals } from '../../../global/global'; import { TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; @Component({ @@ -22,8 +19,6 @@ import { TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; styleUrls: ['./contracts-list.component.scss'], }) export class ContractsListComponent implements OnInit, OnDestroy { - @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; - textSearch = ''; templates: Array = [ { matColumnDef: 'address', headerCellDef: 'Address', isUrl: '/contracts', isShort: true }, { matColumnDef: 'name', headerCellDef: 'Contract Name' }, @@ -37,29 +32,27 @@ export class ContractsListComponent implements OnInit, OnDestroy { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; - pageIndex = 0; - dataSource = new MatTableDataSource(); - maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; - breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); filterButtons = []; + listContract = []; + textSearch = ''; + + dataSource = new MatTableDataSource(); searchSubject = new Subject(); destroy$ = new Subject(); - contractRegisterType = ContractRegisterType; - listContract = []; - contractVerifyType = ContractVerifyType; + + ContractRegisterType = ContractRegisterType; + ContractVerifyType = ContractVerifyType; + MAX_LENGTH_SEARCH_TOKEN = MAX_LENGTH_SEARCH_TOKEN; constructor( public translate: TranslateService, - public global: Globals, private contractService: ContractService, private datePipe: DatePipe, - private layout: BreakpointObserver, ) {} ngOnDestroy(): void { - // throw new Error('Method not implemented.'); this.destroy$.next(); this.destroy$.complete(); } @@ -71,7 +64,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { .asObservable() .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) .subscribe(() => { - this.pageChange.selectPage(0); + this.pageEvent(0); }); } @@ -81,11 +74,12 @@ export class ContractsListComponent implements OnInit, OnDestroy { getListContract() { let payload = { - limit: 20, + limit: this.pageData.pageSize, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, keyword: this.textSearch, contractType: this.filterButtons?.length ? this.filterButtons : null, - offset: this.pageIndex * this.pageData.pageSize, }; + this.contractService.getListContract(payload).subscribe((res) => { if (res?.smart_contract?.length) { res?.smart_contract.forEach((item) => { @@ -100,7 +94,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { item.compiler_version = item.code?.code_id_verifications[0]?.compiler_version; item.contract_verification = item.code.code_id_verifications[0]?.verification_status; }); - this.dataSource.data = [...res.smart_contract]; + this.dataSource.data = res.smart_contract; this.pageData.length = res.smart_contract_aggregate?.aggregate?.count; } else { this.dataSource.data = []; @@ -110,12 +104,12 @@ export class ContractsListComponent implements OnInit, OnDestroy { }); } - paginatorEmit(event): void { - this.dataSource.paginator = event; - } + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; + } - pageEvent(e: PageEvent): void { - this.pageIndex = e.pageIndex; this.getListContract(); } @@ -129,20 +123,18 @@ export class ContractsListComponent implements OnInit, OnDestroy { resetFilterSearch() { this.textSearch = ''; this.filterButtons = []; - this.dataSource.data = []; - this.pageData.length = 0; - this.onKeyUp(); + + this.pageEvent(0); } filterButton(val: string) { + console.log(val); + const i = this.filterButtons.findIndex((i) => i === val); + switch (val) { case 'All': - if (i >= 0) { - this.filterButtons = this.filterButtons.filter((item) => item !== val); - } else { - this.filterButtons = []; - } + this.filterButtons = []; break; case ContractRegisterType.CW20: case ContractRegisterType.CW721: @@ -155,6 +147,6 @@ export class ContractsListComponent implements OnInit, OnDestroy { this.filterButtons.push(val); } } - this.pageChange.selectPage(0); + this.pageEvent(0); } } diff --git a/src/app/pages/contracts/contracts.module.ts b/src/app/pages/contracts/contracts.module.ts index 0d0ebf522..050ff5e96 100644 --- a/src/app/pages/contracts/contracts.module.ts +++ b/src/app/pages/contracts/contracts.module.ts @@ -30,6 +30,7 @@ import { ContractsRoutingModule } from './contracts-routing.module'; import { ContractsTransactionsComponent } from './contracts-transactions/contracts-transactions.component'; import { ContractVerifyStepsComponent } from './contracts-verify/contract-verify-steps/contract-verify-steps.component'; import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.component'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; @NgModule({ declarations: [ @@ -43,7 +44,7 @@ import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.co CodeContractComponent, ContractsVerifyComponent, ContractVerifyStepsComponent, - ContractsRegisterComponent + ContractsRegisterComponent, ], imports: [ CommonModule, @@ -65,7 +66,8 @@ import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.co ClickOutsideModule, WriteContractModule, ReadContractModule, - PopupAddZeroModule + PopupAddZeroModule, + APaginatorModule, ], providers: [ContractService], exports: [ContractVerifyStepsComponent], diff --git a/src/app/pages/fee-grant/fee-grant.module.ts b/src/app/pages/fee-grant/fee-grant.module.ts index 5a711b92b..cc42d0f7a 100644 --- a/src/app/pages/fee-grant/fee-grant.module.ts +++ b/src/app/pages/fee-grant/fee-grant.module.ts @@ -12,6 +12,7 @@ import { AccountService } from 'src/app/core/services/account.service'; import { FeeGrantService } from 'src/app/core/services/feegrant.service'; import { MappingErrorService } from 'src/app/core/services/mapping-error.service'; import { TransactionService } from 'src/app/core/services/transaction.service'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; import { PaginatorModule } from 'src/app/shared/components/paginator/paginator.module'; import { TableNoDataModule } from 'src/app/shared/components/table-no-data/table-no-data.module'; import { SharedModule } from 'src/app/shared/shared.module'; @@ -30,7 +31,7 @@ import { PopupRevokeComponent } from './popup-revoke/popup-revoke.component'; MyGrantersComponent, PopupAddGrantComponent, PopupRevokeComponent, - PopupNoticeComponent + PopupNoticeComponent, ], imports: [ CommonModule, @@ -47,6 +48,7 @@ import { PopupRevokeComponent } from './popup-revoke/popup-revoke.component'; MatDatepickerModule, ClickOutsideModule, NgxMaskModule, + APaginatorModule, ], providers: [FormBuilder, FeeGrantService, TransactionService, MappingErrorService, AccountService], }) diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html index 12b00f66f..db6c4564f 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html @@ -22,10 +22,7 @@ [maxLength]="maxLengthSearch" name="search" autocomplete="off" /> - - @@ -173,9 +151,7 @@

    {{ lastedItem.content.title }}

    -
    Voting Start
    -
    {{ lastedItem.voting_start_time | customDate : 'yyyy-MM-dd' - }} + }}
    {{ lastedItem.voting_start_time | customDate : 'HH:mm:ss' - }} + }}
    -
    -
    Voting End
    -
    {{ lastedItem.voting_end_time | customDate : 'yyyy-MM-dd' }}
    {{ lastedItem.voting_end_time | customDate : 'HH:mm:ss' }}
    -
    -
    @@ -235,28 +207,17 @@

      -
    • -
    • -
    • -
    • +
    • @@ -264,8 +225,7 @@

    Most voted on
    -
    ).class }}"> {{ - getHighestVote( - lastedItem.tally?.yes, - lastedItem.tally?.no, - lastedItem.tally?.no_with_veto, - lastedItem.tally.abstain - ).name + getHighestVote( + lastedItem.tally?.yes, + lastedItem.tally?.no, + lastedItem.tally?.no_with_veto, + lastedItem.tally.abstain + ).name }} {{ - getHighestVote( - lastedItem.tally?.yes, - lastedItem.tally?.no, - lastedItem.tally?.no_with_veto, - lastedItem.tally.abstain - ).value | number : global.formatNumber2Decimal + getHighestVote( + lastedItem.tally?.yes, + lastedItem.tally?.no, + lastedItem.tally?.no_with_veto, + lastedItem.tally.abstain + ).value | number : global.formatNumber2Decimal }}%
    @@ -297,8 +257,7 @@

    -
    +

    Proposals

    - - - - - - + - - - - - +
    #ID#{{ element.proposal_id }}Title - {{ element.content.title }} -
    + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + + + + + + + - - - - - + + + + + + + + + + + +
    #ID#{{ element.proposal_id }}Status -
    - {{ getStatus(element.status).value }} -
    -
    Title + {{ element.content.title }} + Voting Start -
    - {{ element.voting_start_time | customDate : 'yyyy-MM-dd' }} -
    - {{ element.voting_start_time | customDate : 'HH:mm:ss' }} -
    -
    - - -
    -
    Status +
    + {{ getStatus(element.status).value }} +
    +
    Submit Time -
    - {{ element.submit_time | customDate : 'yyyy-MM-dd' }} -
    - {{ element.submit_time | customDate : 'HH:mm:ss' }} -
    -
    Voting Start +
    + {{ element.voting_start_time | customDate : 'yyyy-MM-dd' }} +
    + {{ element.voting_start_time | customDate : 'HH:mm:ss' }} +
    +
    + - +
    +
    Submit Time +
    + {{ element.submit_time | customDate : 'yyyy-MM-dd' }} +
    + {{ element.submit_time | customDate : 'HH:mm:ss' }} +
    +
    Total Deposit - {{ element.total_deposit[0].amount | mask : 'separator.6' }} - {{ denom }} - Total Deposit + {{ element.total_deposit[0].amount | mask : 'separator.6' }} + {{ denom }} +
    + {{ 'NO DATA' | translate }} +
    + + + + + + + +
    + +
    - - - - - {{ 'NO DATA' | translate }} - - - - -
    - -
    -
    -

    Proposals

    -
    -
    - -
    - - -
    - -
    -
    -
    -
    - + + \ No newline at end of file diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index f54b8cfbd..e2e288d76 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -1,6 +1,6 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { ViewportScroller } from '@angular/common'; -import { Component, HostListener, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; @@ -16,9 +16,9 @@ import { DialogService } from '../../core/services/dialog.service'; import { ProposalService } from '../../core/services/proposal.service'; import { WalletService } from '../../core/services/wallet.service'; import { balanceOf } from '../../core/utils/common/parsing'; -import { shortenAddressStartEnd } from '../../core/utils/common/shorten'; import { ProposalVoteComponent } from './proposal-vote/proposal-vote.component'; import { TransactionService } from 'src/app/core/services/transaction.service'; +import { tap } from 'rxjs/operators'; @Component({ selector: 'app-proposal', @@ -39,30 +39,42 @@ export class ProposalComponent implements OnInit { { matColumnDef: 'submitTime', headerCellDef: 'Submit Time' }, { matColumnDef: 'totalDeposit', headerCellDef: 'Total Deposit' }, ]; - breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); + + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]).pipe( + tap((state) => { + this.pageData = { + length: PAGE_EVENT.LENGTH, + pageSize: state.matches ? 5 : 10, + pageIndex: 1, + }; + + this.getListProposal({ index: 1 }); + }), + ); + displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); dataSource: MatTableDataSource = new MatTableDataSource([]); - dataSourceMobile: any[]; + // dataSourceMobile: any[]; proposalData: any; length: number; nextKey = null; - isLoadingAction = false; - pageYOffset = 0; + // isLoadingAction = false; + // pageYOffset = 0; scrolling = false; pageData: PageEvent = { length: PAGE_EVENT.LENGTH, - pageSize: 10, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageSize: this.layout.isMatched([Breakpoints.Small, Breakpoints.XSmall]) ? 5 : 10, + pageIndex: 1, }; - proposalVotes: { - proId: number; - vote: string | null; - }[] = []; - - @HostListener('window:scroll', ['$event']) onScroll(event) { - this.pageYOffset = window.pageYOffset; - } + // proposalVotes: { + // proId: number; + // vote: string | null; + // }[] = []; + + // @HostListener('window:scroll', ['$event']) onScroll(event) { + // this.pageYOffset = window.pageYOffset; + // } denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; constructor( private proposalService: ProposalService, @@ -78,77 +90,70 @@ export class ProposalComponent implements OnInit { ) {} ngOnInit(): void { - this.getListProposal(); this.walletService.wallet$.subscribe((wallet) => this.getFourLastedProposal()); } getFourLastedProposal() { - let payload = { - limit: 4, - }; - this.proposalService.getProposalData(payload).subscribe((res) => { - if (res?.proposal) { - const addr = this.walletService.wallet?.bech32Address || null; - this.proposalData = res.proposal; - if (this.proposalData?.length > 0) { - this.proposalData.forEach((pro, index) => { - if (pro?.tally) { - const { yes, no, no_with_veto, abstain } = pro?.tally; - let totalVote = +yes + +no + +no_with_veto + +abstain; - if (this.proposalData[index].tally && totalVote > 0) { - this.proposalData[index].tally.yes = (+yes * 100) / totalVote; - this.proposalData[index].tally.no = (+no * 100) / totalVote; - this.proposalData[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; - this.proposalData[index].tally.abstain = (+abstain * 100) / totalVote; + this.proposalService + .getProposalData2({ + limit: 4, + }) + .subscribe((res) => { + if (res?.proposal) { + const addr = this.walletService.wallet?.bech32Address || null; + this.proposalData = res.proposal; + if (this.proposalData?.length > 0) { + this.proposalData.forEach((pro, index) => { + if (pro?.tally) { + const { yes, no, no_with_veto, abstain } = pro?.tally; + let totalVote = +yes + +no + +no_with_veto + +abstain; + if (this.proposalData[index].tally && totalVote > 0) { + this.proposalData[index].tally.yes = (+yes * 100) / totalVote; + this.proposalData[index].tally.no = (+no * 100) / totalVote; + this.proposalData[index].tally.no_with_veto = (+no_with_veto * 100) / totalVote; + this.proposalData[index].tally.abstain = (+abstain * 100) / totalVote; + } } - } - const getVoted = async () => { - if (addr) { - const payload = { - limit: 1, - compositeKey: 'proposal_vote.proposal_id', - value: pro.proposal_id?.toString(), - value2: addr, - }; - this.transactionService.getListTxMultiCondition(payload).subscribe((res) => { - const optionVote = this.proposalService.getVoteMessageByConstant( - res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, - ); - pro.vote_option = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; - }); - } - }; - getVoted(); - }); + const getVoted = async () => { + if (addr) { + const payload = { + limit: 1, + compositeKey: 'proposal_vote.proposal_id', + value: pro.proposal_id?.toString(), + value2: addr, + }; + this.transactionService.getListTxMultiCondition(payload).subscribe((res) => { + const optionVote = this.proposalService.getVoteMessageByConstant( + res?.transaction[0]?.data?.tx?.body?.messages[0]?.option, + ); + pro.vote_option = this.voteConstant.find((s) => s.key === optionVote)?.voteOption; + }); + } + }; + getVoted(); + }); + } } - } - }); + }); } - getListProposal(nextKey = null) { - let payload = { - limit: 40, - nextKey: nextKey, - }; - this.proposalService.getProposalData(payload).subscribe((res) => { - this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; - if (res?.proposal) { - let tempDta = res.proposal; - tempDta.forEach((pro) => { - pro.total_deposit[0].amount = balanceOf(pro.total_deposit[0].amount); - }); - if (this.dataSource.data.length > 0) { - this.dataSource.data = [...this.dataSource.data, ...tempDta]; - } else { - this.dataSource.data = [...tempDta]; + getListProposal({ index }) { + this.proposalService + .getProposalData2({ + limit: this.pageData.pageSize, + offset: (index - 1) * this.pageData.pageSize, + }) + .subscribe((res) => { + if (res?.proposal) { + let tempDta = res.proposal; + tempDta.forEach((pro) => { + pro.total_deposit[0].amount = balanceOf(pro.total_deposit[0].amount); + }); + + this.dataSource.data = tempDta; } - } - this.dataSourceMobile = this.dataSource.data.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ); - this.length = this.dataSource.data.length; - }); + this.length = res.proposal_aggregate.aggregate.count; + }); } getStatus(key: string) { @@ -236,46 +241,4 @@ export class ProposalComponent implements OnInit { this.scrolling = !this.scrolling; }, 500); } - - parsingStatus(sts) { - return ( - this.voteConstant.find((s) => { - return s.value?.toUpperCase() === sts?.toUpperCase(); - })?.voteOption || sts - ); - } - - shortenAddress(address: string): string { - return shortenAddressStartEnd(address, 6, 10); - } - - dlgServOpen(): void { - this.dlgService.showDialog({ - content: 'Please set up override Keplr in settings of Coin98 wallet', - title: '', - }); - } - - paginatorEmit(e: MatPaginator): void { - if (this.dataSource.paginator) { - e.page.next({ - length: this.dataSource.paginator.length, - pageIndex: 0, - pageSize: this.dataSource.paginator.pageSize, - previousPageIndex: this.dataSource.paginator.pageIndex, - }); - this.dataSource.paginator = e; - } else this.dataSource.paginator = e; - } - - pageEvent(e: PageEvent): void { - const { length, pageIndex, pageSize } = e; - const next = length <= (pageIndex + 2) * pageSize; - this.dataSourceMobile = this.dataSource.data.slice(pageIndex * pageSize, pageIndex * pageSize + pageSize); - - if (next && this.nextKey) { - this.getListProposal(this.nextKey); - } - this.pageData.pageIndex = e.pageIndex; - } } diff --git a/src/app/pages/proposal/proposal.module.ts b/src/app/pages/proposal/proposal.module.ts index 1d4cadecc..f6d488622 100644 --- a/src/app/pages/proposal/proposal.module.ts +++ b/src/app/pages/proposal/proposal.module.ts @@ -24,6 +24,7 @@ import { ProposalRoutingModule } from './proposal-routing.module'; import { ProposalTableComponent } from './proposal-table/proposal-table.component'; import { ProposalVoteComponent } from './proposal-vote/proposal-vote.component'; import { ProposalComponent } from './proposal.component'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; @NgModule({ declarations: [ @@ -52,6 +53,7 @@ import { ProposalComponent } from './proposal.component'; TableNoDataModule, PaginatorModule, LoadingImageModule, + APaginatorModule, ], providers: [ProposalService, MappingErrorService, DecimalPipe, ValidatorService], }) diff --git a/src/app/shared/components/a-paginator/a-paginator.component.html b/src/app/shared/components/a-paginator/a-paginator.component.html new file mode 100644 index 000000000..48f5a6a2c --- /dev/null +++ b/src/app/shared/components/a-paginator/a-paginator.component.html @@ -0,0 +1,23 @@ + + + + Previous + + + + Next + + + First + Last + {{ p }} + + diff --git a/src/app/shared/components/a-paginator/a-paginator.component.scss b/src/app/shared/components/a-paginator/a-paginator.component.scss new file mode 100644 index 000000000..425e447bf --- /dev/null +++ b/src/app/shared/components/a-paginator/a-paginator.component.scss @@ -0,0 +1,37 @@ +::ng-deep .pagination { + .page-item { + margin: 0 2px; + min-width: 24px; + height: 24px; + padding: 0 4px; + + display: flex; + align-items: center; + justify-content: center; + + cursor: pointer; + color: var(--aura-white); + + .page-link { + background: transparent; + border: none; + padding: 0; + color: var(--aura-white); + } + + &.active { + color: var(--aura-primary); + border: 1px solid var(--aura-primary); + border-radius: 4px; + + .page-link { + color: var(--aura-primary); + } + } + + &.disabled { + opacity: 0.4; + pointer-events: none; + } + } +} diff --git a/src/app/shared/components/a-paginator/a-paginator.component.ts b/src/app/shared/components/a-paginator/a-paginator.component.ts new file mode 100644 index 000000000..1545829fe --- /dev/null +++ b/src/app/shared/components/a-paginator/a-paginator.component.ts @@ -0,0 +1,17 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { PageEvent } from '@angular/material/paginator'; + +@Component({ + selector: 'app-a-paginator', + templateUrl: './a-paginator.component.html', + styleUrls: ['./a-paginator.component.scss'], +}) +export class APaginatorComponent { + @Input() paginator: PageEvent; + @Input() length: number; + @Input() maxSize = 5; + + @Output() pageChange = new EventEmitter(); + + constructor() {} +} diff --git a/src/app/shared/components/a-paginator/a-paginator.module.ts b/src/app/shared/components/a-paginator/a-paginator.module.ts new file mode 100644 index 000000000..3addd7dc9 --- /dev/null +++ b/src/app/shared/components/a-paginator/a-paginator.module.ts @@ -0,0 +1,11 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { APaginatorComponent } from './a-paginator.component'; +import { NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap'; + +@NgModule({ + declarations: [APaginatorComponent], + imports: [CommonModule, NgbPaginationModule], + exports: [APaginatorComponent], +}) +export class APaginatorModule {} From f8e6203b61c71fcc98e0dcc7d990a1ca5fb311e5 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 15 Jun 2023 16:56:35 +0700 Subject: [PATCH 122/315] Merge pull request #1949 from aura-nw/feature/remove_amount check expired feegrant (cherry picked from commit 9ed507b41de19ef6cbc9f987b9221adebed052d1) # Conflicts: # src/app/core/services/contract.service.ts # src/app/pages/fee-grant/my-granters/my-granters.component.ts --- .../soulbound-token-equipped.component.ts | 2 +- .../soulbound-token-unequipped.component.ts | 2 +- src/app/pages/token/nft-detail/nft-detail.component.ts | 2 +- .../soulbound-feature-tokens.component.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts index e7b7d86af..7661f42b0 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts @@ -111,7 +111,7 @@ export class SoulboundTokenEquippedComponent implements OnInit { } getSBTDetail(contractAddress, tokenID, pick = true) { - this.contractService.getNFTDetail(contractAddress, tokenID).subscribe((res) => { + this.contractService.getDetailCW4973(contractAddress, tokenID).subscribe((res) => { if (res?.data) { this.updatePick(res.data, pick); } diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts index cdd49e4d9..36ef48d58 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts @@ -118,7 +118,7 @@ export class SoulboundTokenUnequippedComponent implements OnInit, OnChanges { getSBTDetail(contractAddress, tokenID, isNotify) { this.isClick = true; - this.contractService.getNFTDetail(contractAddress, tokenID).subscribe((res) => { + this.contractService.getDetailCW4973(contractAddress, tokenID).subscribe((res) => { if (res?.data) { this.openDialogDetail(res.data); if (isNotify) { diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index a3f4a23b6..47004ce57 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -128,7 +128,7 @@ export class NFTDetailComponent implements OnInit { getNFTDetail() { this.loading = true; const encoded = encodeURIComponent(this.nftId); - this.contractService.getNFTDetail(this.contractAddress, encoded).subscribe((res) => { + this.contractService.getDetailCW4973(this.contractAddress, encoded).subscribe((res) => { if (!res?.data || res.data === null || res?.data.status === SB_TYPE.UNEQUIPPED) { this.toastr.error('Token invalid'); this.loading = false; diff --git a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts index 0816cedbd..c83a95a5a 100644 --- a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts +++ b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.ts @@ -94,7 +94,7 @@ export class SoulboundFeatureTokensComponent implements OnInit { getSBTDetail(contractAddress, tokenID) { this.isClick = true; - this.contractService.getNFTDetail(contractAddress, tokenID).subscribe((res) => { + this.contractService.getDetailCW4973(contractAddress, tokenID).subscribe((res) => { this.isClick = false; if (res) { this.openDialogDetail(res.data); From 50eeac906be1a653d1cf2e6362928a099d7b6227 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Thu, 15 Jun 2023 16:57:33 +0700 Subject: [PATCH 123/315] update voting depositor --- src/app/core/services/transaction.service.ts | 24 +++++++++++++++++++ .../depositors/depositors.component.html | 7 +++--- .../depositors/depositors.component.ts | 11 ++++++--- .../validators-votes.component.ts | 2 +- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 67c96ec4b..4796d9442 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -92,10 +92,12 @@ export class TransactionService extends CommonService { $indexLT: Int = null $hash: String = null $height: Int = null + $offset: Int = 0 ) { ${this.envDB} { transaction( limit: $limit + offset: $offset where: { hash: { _eq: $hash } height: { _eq: $height } @@ -122,6 +124,27 @@ export class TransactionService extends CommonService { gas_wanted data } + transaction_aggregate( + where: { + hash: {_eq: $hash}, + height: {_eq: $height}, + event_attribute_index: { + value: {_eq: $value, _in: $valueIn}, + composite_key: {_eq: $compositeKey, _in: $compositeKeyIn}, + key: {_eq: $key, _in: $keyIn} + }, + _and: [ + {height: {_gt: $heightGT}}, + {index: {_gt: $indexGT}}, + {height: {_lt: $heightLT}}, + {index: {_lt: $indexLT}} + ] + } + ) { + aggregate { + count + } + } } } `; @@ -140,6 +163,7 @@ export class TransactionService extends CommonService { indexGT: null, indexLT: null, height: null, + offset: payload?.offset || 0, }, operationName: 'auratestnet_transaction', }) diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html index 8e00dc966..0ccf0e15d 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html @@ -6,12 +6,13 @@

    + [length]="dataLength" + (pageEventChange)="pageEventChange($event)"> -
    +
    diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index 4e26689b2..ea0d2e9ef 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -26,7 +26,7 @@ export class DepositorsComponent implements OnInit { private proposalService: ProposalService, private layout: BreakpointObserver, private environmentService: EnvironmentService, - private transactionService: TransactionService + private transactionService: TransactionService, ) { this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { if (event) { @@ -41,9 +41,10 @@ export class DepositorsComponent implements OnInit { getDepositorsList(): void { const payload = { - key: "proposal_id", + key: 'proposal_id', value: this.proposalId?.toString(), - limit: 100, + limit: 5, + offset: 0, }; this.transactionService.getListTxCondition(payload).subscribe( (res) => { @@ -77,4 +78,8 @@ export class DepositorsComponent implements OnInit { }, ); } + + pageEventChange({ tabId, pageIndex, pageSize }: any) { + console.log({ tabId, pageIndex, pageSize }); + } } diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index 32095e1bf..3a4d43d8f 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -74,7 +74,7 @@ export class ValidatorsVotesComponent implements OnInit { if (this.proposalId) { this.proposalService .getValidatorVotesFromIndexer2(this.proposalId, { - limit: 10, + limit: 2, }) .subscribe( (res) => { From 7247e0dff330b0935b83fd67ac7f9cfa869bf1ca Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 16 Jun 2023 10:00:40 +0700 Subject: [PATCH 124/315] [TamTM6] fix path cw4973, update name service, proposal vote fix rank, time update --- src/app/core/services/account.service.ts | 2 +- src/app/core/services/contract.service.ts | 12 +-- src/app/core/services/proposal.service.ts | 4 +- src/app/core/services/token.service.ts | 5 +- src/app/global/global.ts | 76 ------------------- .../account-detail.component.ts | 4 +- .../nft-list/nft-list.component.ts | 2 +- .../block-detail/block-detail.component.ts | 4 +- .../contract-content.component.ts | 10 +-- .../contracts-detail.component.ts | 2 +- .../contracts-list.component.ts | 2 - .../contracts-transactions.component.ts | 6 +- .../pages/dashboard/dashboard.component.ts | 4 +- .../validators-votes.component.ts | 9 ++- .../proposal-table.component.html | 2 +- .../token-contract-tab.component.ts | 2 +- .../token-inventory-tab.component.ts | 2 +- .../token-detail/token-detail.component.ts | 2 +- .../token-cw721/token-cw721.component.ts | 2 +- .../transaction-detail.component.ts | 4 +- .../transaction/transaction.component.ts | 4 +- 21 files changed, 43 insertions(+), 117 deletions(-) diff --git a/src/app/core/services/account.service.ts b/src/app/core/services/account.service.ts index f99ac8742..79d76e416 100644 --- a/src/app/core/services/account.service.ts +++ b/src/app/core/services/account.service.ts @@ -22,7 +22,7 @@ export class AccountService extends CommonService { return this.http.post(`${this.apiUrl}/cw20-tokens/get-by-owner/`, payload); } - getAssetCW721ByOwnerV2(payload): Observable { + getAssetCW721ByOwner(payload): Observable { const operationsDoc = ` query Query( $contract_address: String diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index a74026e3b..7c45f808a 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -107,7 +107,7 @@ export class ContractService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - loadContractDetailV2(contractAddress): Observable { + loadContractDetail(contractAddress): Observable { const contractDoc = ` query auratestnet_contract($contractAddress: String = null) { ${this.envDB} { @@ -207,11 +207,11 @@ export class ContractService extends CommonService { return this.http.get(`${this.apiUrl}/contracts/verify/status/${codeID}`); } - loadContractDetail(contractAddress): void { - this.http.get(`${this.apiUrl}/contracts/${contractAddress}`).subscribe((res) => { - this.contract$.next(res.data); - }); - } + // loadContractDetail(contractAddress): void { + // this.http.get(`${this.apiUrl}/contracts/${contractAddress}`).subscribe((res) => { + // this.contract$.next(res.data); + // }); + // } registerContractType(data: any): Observable { return this.http.post(`${this.apiUrl}/contract-codes`, data); diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index db2f535d8..1531fb2ed 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -32,7 +32,9 @@ export class ProposalService extends CommonService { vote_option txhash proposal_id - updated_at + transaction { + timestamp + } } description operator_address diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index c03e5e662..14180786e 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -21,7 +21,7 @@ export class TokenService extends CommonService { return this.http.post(`${this.apiUrl}/cw20-tokens`, payload); } - getListCW721TokenV2(payload, textSearch = null): Observable { + getListCW721Token(payload, textSearch = null): Observable { if (textSearch?.length > 0) { textSearch = '%' + textSearch + '%'; } @@ -62,7 +62,7 @@ export class TokenService extends CommonService { return this.http.get(`${this.apiUrl}/contracts/token/${address}`); } - getListTokenNFTFromIndexerV2(payload): Observable { + getListTokenNFTFromIndexer(payload): Observable { const operationsDoc = ` query Query( $contract_address: String @@ -83,6 +83,7 @@ export class TokenService extends CommonService { last_updated_height: { _lt: $nextKeyLastUpdatedHeight } token_id: { _eq: $tokenId } owner: { _eq: $owner } + burned: {_eq: false} } order_by: [{ last_updated_height: desc }, { id: desc }] ) { diff --git a/src/app/global/global.ts b/src/app/global/global.ts index a0f04cd01..9f8c29f9a 100644 --- a/src/app/global/global.ts +++ b/src/app/global/global.ts @@ -222,82 +222,6 @@ export function getDataInfo(arrayMsg, addressContract, rawLog = '') { } export function convertDataTransaction(data, coinInfo) { - const txs = _.get(data, 'transactions').map((element) => { - const code = _.get(element, 'tx_response.code'); - const tx_hash = _.get(element, 'tx_response.txhash'); - const messages = _.get(element, 'tx_response.tx.body.messages'); - - let _type = _.get(element, 'tx_response.tx.body.messages[0].@type'); - let lstType = _.get(element, 'tx_response.tx.body.messages'); - let denom = coinInfo.coinDenom; - - //check send token ibc same chain - if (_type === TRANSACTION_TYPE_ENUM.Send && messages[0].amount[0].denom !== denom) { - denom = messages[0].amount[0].denom; - } - - if (lstType?.length > 1) { - lstType.forEach((type) => { - if (type['@type'] !== TRANSACTION_TYPE_ENUM.IBCUpdateClient && type['@type'].indexOf('ibc') > -1) { - _type = type['@type']; - try { - let dataEncode = atob(type?.packet?.data); - const data = JSON.parse(dataEncode); - denom = data.denom; - } catch (e) { - denom = coinInfo.coinDenom; - } - return; - } - }); - } - - const _amount = getAmount( - _.get(element, 'tx_response.tx.body.messages'), - _type, - _.get(element, 'tx_response.tx.body.raw_log'), - coinInfo.coinMinimalDenom, - ); - - const fee = balanceOf( - _.get(element, 'tx_response.tx.auth_info.fee.amount[0].amount') || 0, - coinInfo.coinDecimals, - ).toFixed(coinInfo.coinDecimals); - - const height = _.get(element, 'tx_response.height'); - const timestamp = _.get(element, 'tx_response.timestamp'); - const gas_used = _.get(element, 'tx_response.gas_used'); - const gas_wanted = _.get(element, 'tx_response.gas_wanted'); - - let amount = _.isNumber(_amount) && _amount > 0 ? _amount.toFixed(coinInfo.coinDecimals) : _amount; - - let type = _.find(TYPE_TRANSACTION, { label: _type })?.value || _type.split('.').pop(); - try { - if (lstType[0]['@type'].indexOf('ibc') == -1) { - if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.GetReward) { - type = TypeTransaction.GetReward; - } else if (lstType?.length > 1) { - if (lstType[0]['@type'] === TRANSACTION_TYPE_ENUM.MultiSend) { - type = TypeTransaction.MultiSend; - } else { - type = 'Multiple'; - } - amount = 'More'; - } - } - } catch (e) {} - - const status = - _.get(element, 'tx_response.code') == CodeTransaction.Success - ? StatusTransaction.Success - : StatusTransaction.Fail; - - return { code, tx_hash, type, status, amount, fee, height, timestamp, gas_used, gas_wanted, denom, messages }; - }); - return txs; -} - -export function convertDataTransactionV2(data, coinInfo) { const txs = _.get(data, 'transaction').map((element) => { if (!element['data']['body']) { element['data']['body'] = element['data']['tx']['body']; diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index f4ecfdc4a..954130425 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -28,7 +28,7 @@ import { TableTemplate } from '../../../core/models/common.model'; import { AccountService } from '../../../core/services/account.service'; import { CommonService } from '../../../core/services/common.service'; import { TransactionService } from '../../../core/services/transaction.service'; -import { Globals, convertDataTransactionV2 } from '../../../global/global'; +import { Globals, convertDataTransaction } from '../../../global/global'; import { CHART_OPTION, ChartOptions, chartCustomOptions } from './chart-options'; @Component({ @@ -313,7 +313,7 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { if (data?.transaction?.length >= 40) { this.nextKey = data?.transaction[data?.transaction?.length - 1].height; } - const txs = convertDataTransactionV2(data, this.coinInfo); + const txs = convertDataTransaction(data, this.coinInfo); txs.forEach((element) => { if (element.type === 'Send') { if (!element.messages.find((k) => k.from_address === this.currentAddress)) { diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts index 88c8eb9bc..53ac218ef 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts @@ -60,7 +60,7 @@ export class NftListComponent implements OnChanges { keyword: this.searchValue, next_key: nextKey, }; - this.accountService.getAssetCW721ByOwnerV2(payload).subscribe( + this.accountService.getAssetCW721ByOwner(payload).subscribe( (res) => { if (res?.cw721_token?.length > 0) { if (res?.cw721_token?.length >= 100) { diff --git a/src/app/pages/blocks/block-detail/block-detail.component.ts b/src/app/pages/blocks/block-detail/block-detail.component.ts index cacdfd79f..e5ae37c49 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.ts +++ b/src/app/pages/blocks/block-detail/block-detail.component.ts @@ -14,7 +14,7 @@ import { PAGE_EVENT } from '../../../../app/core/constants/common.constant'; import { TableTemplate } from '../../../../app/core/models/common.model'; import { BlockService } from '../../../../app/core/services/block.service'; import { CommonService } from '../../../../app/core/services/common.service'; -import { Globals, convertDataBlock, convertDataTransactionV2 } from '../../../../app/global/global'; +import { Globals, convertDataBlock, convertDataTransaction } from '../../../../app/global/global'; @Component({ selector: 'app-block-detail', @@ -142,7 +142,7 @@ export class BlockDetailComponent implements OnInit { let dataTempTx = {}; dataTempTx['transaction'] = txs; if (txs.length > 0) { - txs = convertDataTransactionV2(dataTempTx, this.coinInfo); + txs = convertDataTransaction(dataTempTx, this.coinInfo); txs.forEach((k) => { this.blockDetail['gas_used'] += +k.gas_used; this.blockDetail['gas_wanted'] += +k.gas_wanted; diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index 0e16e5cea..bd909a87a 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -7,7 +7,7 @@ import { TableTemplate } from 'src/app/core/models/common.model'; import { ContractService } from 'src/app/core/services/contract.service'; import { TransactionService } from 'src/app/core/services/transaction.service'; import { isContract } from 'src/app/core/utils/common/validation'; -import { convertDataTransactionV2 } from 'src/app/global/global'; +import { convertDataTransaction } from 'src/app/global/global'; import { CONTRACT_TAB, CONTRACT_TABLE_TEMPLATES } from '../../../../core/constants/contract.constant'; import { ContractTab, ContractVerifyType } from '../../../../core/constants/contract.enum'; @@ -107,9 +107,9 @@ export class ContractContentComponent implements OnInit, OnDestroy { } }); - // this.timerGetUpTime = setInterval(() => { - // this.getTransaction(false); - // }, 5000); + this.timerGetUpTime = setInterval(() => { + this.getTransaction(false); + }, 5000); } changeTab(tabId): void { @@ -131,7 +131,7 @@ export class ContractContentComponent implements OnInit, OnDestroy { (res) => { const data = res; if (res) { - const txsExecute = convertDataTransactionV2(data, this.coinInfo); + const txsExecute = convertDataTransaction(data, this.coinInfo); if (res?.transaction?.length > 0) { this.contractTransaction['data'] = txsExecute; this.contractTransaction['count'] = this.contractTransaction['data'].length || 0; diff --git a/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts b/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts index f64b7d3f0..2f805c4be 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-detail.component.ts @@ -29,7 +29,7 @@ export class ContractsDetailComponent implements OnInit, OnDestroy { ngOnInit(): void { this.contractAddress = this.route.snapshot.paramMap.get('contractAddress'); if (this.contractAddress) { - this.contractService.loadContractDetailV2(this.contractAddress).subscribe((res) => { + this.contractService.loadContractDetail(this.contractAddress).subscribe((res) => { if (res?.smart_contract[0]) { this.contractService.setContract(res?.smart_contract[0]); } else { diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index 180fab596..8aed0feac 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -128,8 +128,6 @@ export class ContractsListComponent implements OnInit, OnDestroy { } filterButton(val: string) { - console.log(val); - const i = this.filterButtons.findIndex((i) => i === val); switch (val) { diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts index 39e058681..f83cb70a9 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts @@ -8,7 +8,7 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { TableTemplate } from 'src/app/core/models/common.model'; import { ITableContract } from 'src/app/core/models/contract.model'; import { TransactionService } from 'src/app/core/services/transaction.service'; -import { convertDataTransactionV2 } from 'src/app/global/global'; +import { convertDataTransaction } from 'src/app/global/global'; import { TableData } from 'src/app/shared/components/contract-table/contract-table.component'; @Component({ @@ -129,7 +129,7 @@ export class ContractsTransactionsComponent implements OnInit { this.transactionService.getListTxCondition(this.payload).subscribe( (dataExecute) => { if (dataExecute) { - const txsExecute = convertDataTransactionV2(dataExecute, this.coinInfo); + const txsExecute = convertDataTransaction(dataExecute, this.coinInfo); this.lengthTxsExecute = txsExecute.length; if (dataExecute.transaction?.length > 0) { this.nextKey = null; @@ -169,7 +169,7 @@ export class ContractsTransactionsComponent implements OnInit { if (dataInstantiate.transaction?.length > 0) { this.hashIns = dataInstantiate.transaction[0]?.hash; if (+this.label == this.modeTxType.Instantiate) { - this.txsInstantiate = convertDataTransactionV2(dataInstantiate, this.coinInfo); + this.txsInstantiate = convertDataTransaction(dataInstantiate, this.coinInfo); this.contractTransaction['data'] = this.txsInstantiate; this.contractTransaction['count'] = this.txsInstantiate.length || 0; } diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 05324dc98..8ce76bd35 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -20,7 +20,7 @@ import { BlockService } from '../../../app/core/services/block.service'; import { CommonService } from '../../../app/core/services/common.service'; import { TransactionService } from '../../../app/core/services/transaction.service'; import { CHART_RANGE, PAGE_EVENT, TOKEN_ID_GET_PRICE } from '../../core/constants/common.constant'; -import { Globals, convertDataBlock, convertDataTransactionV2 } from '../../global/global'; +import { Globals, convertDataBlock, convertDataTransaction } from '../../global/global'; import { CHART_CONFIG, DASHBOARD_AREA_SERIES_CHART_OPTIONS, DASHBOARD_CHART_OPTIONS } from './dashboard-chart-options'; import { Router } from '@angular/router'; @@ -270,7 +270,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { this.transactionService.getListTx(payload).subscribe((res) => { this.dataSourceTx.data = []; if (res?.transaction?.length > 0) { - const txs = convertDataTransactionV2(res, this.coinInfo); + const txs = convertDataTransaction(res, this.coinInfo); if (this.dataSourceTx.data.length > 0) { this.dataSourceTx.data = [...this.dataSourceTx.data, ...txs]; diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index 0f32381e9..b73202bc7 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -75,14 +75,15 @@ export class ValidatorsVotesComponent implements OnInit { (res) => { let validatorVote = []; if (res?.validator) { - validatorVote = _.get(res, 'validator').map((item) => { + validatorVote = _.get(res, 'validator').map((item, index) => { const validator_name = item.description?.moniker; - const timestamp = _.get(item, 'vote[0].updated_at'); + const timestamp = _.get(item, 'vote[0].transaction.timestamp'); const vote_option = _.get(item, 'vote[0].vote_option'); const txhash = _.get(item, 'vote[0].txhash'); const operator_address = _.get(item, 'operator_address'); const validator_identity = _.get(item, 'description.identity'); - return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity }; + const rank = index + 1; + return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity, rank }; }); } @@ -93,7 +94,7 @@ export class ValidatorsVotesComponent implements OnInit { this.voteData.noWithVeto = validatorVote.filter( (f) => f.vote_option === VOTE_OPTION.VOTE_OPTION_NO_WITH_VETO, ); - this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); + this.voteData.didNotVote = validatorVote.filter((f) => !f.vote_option || f.vote_option === ''); this.voteDataList = [...this.voteData.all]; this.countVote.set('', this.voteData.all.length); diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index 72b93987d..1bb8d3fc4 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -55,7 +55,7 @@ {{ getVoteValue(data[template.matColumnDef]) }} - {{ pageValidatorIndex * 5 + j + 1 }} + {{ data[template.matColumnDef] }}
    diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.ts index 5324b4ea9..909c8a5ee 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-contract-tab/token-contract-tab.component.ts @@ -48,7 +48,7 @@ export class TokenContractTabComponent implements OnInit { } getContractDetailNFT() { - this.contractService.loadContractDetailV2(this.contractAddress).subscribe((res: ResponseDto) => { + this.contractService.loadContractDetail(this.contractAddress).subscribe((res: ResponseDto) => { if (res['smart_contract']?.length > 0) { let data = res['smart_contract'][0]; let contract_verification = data?.code?.code_id_verifications[0]?.verification_status; diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts index 522a1c9c5..99a14fed2 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts @@ -76,7 +76,7 @@ export class TokenInventoryComponent implements OnInit { } } - this.tokenService.getListTokenNFTFromIndexerV2(payload).subscribe( + this.tokenService.getListTokenNFTFromIndexer(payload).subscribe( (res) => { const asset = _.get(res, `cw721_token`); if (asset?.length >= 100) { diff --git a/src/app/pages/token/token-detail/token-detail.component.ts b/src/app/pages/token/token-detail/token-detail.component.ts index ab2f259b4..52987987f 100644 --- a/src/app/pages/token/token-detail/token-detail.component.ts +++ b/src/app/pages/token/token-detail/token-detail.component.ts @@ -53,7 +53,7 @@ export class TokenDetailComponent implements OnInit { } getTokenDetailNFT(): void { - this.contractService.loadContractDetailV2(this.contractAddress).subscribe( + this.contractService.loadContractDetail(this.contractAddress).subscribe( (res) => { const name = _.get(res, 'smart_contract[0].cw721_contract.name'); let type = ContractRegisterType.CW721; diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts index 4db456cdb..fa59f67bf 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts @@ -81,7 +81,7 @@ export class TokenCw721Component implements OnInit { sort_order: this.sortOrder, }; - this.tokenService.getListCW721TokenV2(payload, this.textSearch).subscribe((res) => { + this.tokenService.getListCW721Token(payload, this.textSearch).subscribe((res) => { this.dataSource = new MatTableDataSource(res.list_token); this.pageData.length = res.total_token?.aggregate?.count; }); diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index b91123efc..3e6ef3479 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -11,7 +11,7 @@ import { CodeTransaction } from '../../../core/constants/transaction.enum'; import { CommonService } from '../../../core/services/common.service'; import { MappingErrorService } from '../../../core/services/mapping-error.service'; import { TransactionService } from '../../../core/services/transaction.service'; -import { Globals, convertDataTransactionV2 } from '../../../global/global'; +import { Globals, convertDataTransaction } from '../../../global/global'; @Component({ selector: 'app-transaction-detail', @@ -75,7 +75,7 @@ export class TransactionDetailComponent implements OnInit { this.transactionService.getListTx(payload).subscribe( (res) => { if (res?.transaction?.length > 0) { - const txs = convertDataTransactionV2(res, this.coinInfo); + const txs = convertDataTransaction(res, this.coinInfo); this.transaction = txs[0]; this.transaction = { ...this.transaction, diff --git a/src/app/pages/transaction/transaction.component.ts b/src/app/pages/transaction/transaction.component.ts index 2bd9ca6b8..a0cb59f45 100644 --- a/src/app/pages/transaction/transaction.component.ts +++ b/src/app/pages/transaction/transaction.component.ts @@ -5,7 +5,7 @@ import { TYPE_TRANSACTION } from '../../../app/core/constants/transaction.consta import { TableTemplate } from '../../../app/core/models/common.model'; import { CommonService } from '../../../app/core/services/common.service'; import { TransactionService } from '../../../app/core/services/transaction.service'; -import { Globals, convertDataTransactionV2 } from '../../../app/global/global'; +import { Globals, convertDataTransaction } from '../../../app/global/global'; @Component({ selector: 'app-transaction', @@ -50,7 +50,7 @@ export class TransactionComponent implements OnInit { this.transactionService.getListTx(payload).subscribe( (res) => { if (res?.transaction?.length > 0) { - const txs = convertDataTransactionV2(res, this.coinInfo); + const txs = convertDataTransaction(res, this.coinInfo); if (this.dataSource.data.length > 0) { this.dataSource.data = [...this.dataSource.data, ...txs]; } else { From 02fee9ec90ec3003550fbdf6eb6af1c73309dbd4 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 16 Jun 2023 10:12:36 +0700 Subject: [PATCH 125/315] [TamTM6] remove code dont use --- src/app/core/services/contract.service.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 7c45f808a..9e4181085 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -207,12 +207,6 @@ export class ContractService extends CommonService { return this.http.get(`${this.apiUrl}/contracts/verify/status/${codeID}`); } - // loadContractDetail(contractAddress): void { - // this.http.get(`${this.apiUrl}/contracts/${contractAddress}`).subscribe((res) => { - // this.contract$.next(res.data); - // }); - // } - registerContractType(data: any): Observable { return this.http.post(`${this.apiUrl}/contract-codes`, data); } From ddd0adc7c92fa040626883635d6083c80d19f3f7 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Fri, 16 Jun 2023 10:49:50 +0700 Subject: [PATCH 126/315] update proposal depositor --- angular.json | 6 +- src/app/core/services/proposal.service.ts | 4 +- src/app/core/services/transaction.service.ts | 24 --- .../contracts-list.component.ts | 2 - .../depositors/depositors.component.html | 2 +- .../depositors/depositors.component.ts | 29 ++-- .../votes/votes.component.html | 2 +- .../proposal-detail/votes/votes.component.ts | 72 ++++----- .../proposal-table.component.html | 2 +- .../proposal-table.component.ts | 142 +++++++++--------- src/assets/config/config.json | 78 ++++------ 11 files changed, 165 insertions(+), 198 deletions(-) diff --git a/angular.json b/angular.json index d0e58bf6f..a60785916 100644 --- a/angular.json +++ b/angular.json @@ -30,7 +30,11 @@ "@cosmjs/stargate", "simplebar", "simplebar-angular", - "@cosmjs/cosmwasm-stargate" + "@cosmjs/cosmwasm-stargate", + "@cosmjs/math", + "@cosmjs/amino", + "buffer", + "exceljs" ], "outputPath": "dist/frontend", "index": "src/index.html", diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 59d7d1460..81a8e0f8a 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -235,7 +235,7 @@ export class ProposalService extends CommonService { getProposalVoteTotal(proposalId: number) { const operationsDoc = ` query getProposalVoteTotal($proposalId: Int) { - auratestnet { + ${this.envDB} { ALL: vote_aggregate(where: {proposal_id: {_eq: $proposalId}}) { ...aggregateCountFragment } @@ -254,7 +254,7 @@ export class ProposalService extends CommonService { } } - fragment aggregateCountFragment on auratestnet_vote_aggregate { + fragment aggregateCountFragment on ${this.envDB}_vote_aggregate { aggregate { count } diff --git a/src/app/core/services/transaction.service.ts b/src/app/core/services/transaction.service.ts index 4796d9442..67c96ec4b 100644 --- a/src/app/core/services/transaction.service.ts +++ b/src/app/core/services/transaction.service.ts @@ -92,12 +92,10 @@ export class TransactionService extends CommonService { $indexLT: Int = null $hash: String = null $height: Int = null - $offset: Int = 0 ) { ${this.envDB} { transaction( limit: $limit - offset: $offset where: { hash: { _eq: $hash } height: { _eq: $height } @@ -124,27 +122,6 @@ export class TransactionService extends CommonService { gas_wanted data } - transaction_aggregate( - where: { - hash: {_eq: $hash}, - height: {_eq: $height}, - event_attribute_index: { - value: {_eq: $value, _in: $valueIn}, - composite_key: {_eq: $compositeKey, _in: $compositeKeyIn}, - key: {_eq: $key, _in: $keyIn} - }, - _and: [ - {height: {_gt: $heightGT}}, - {index: {_gt: $indexGT}}, - {height: {_lt: $heightLT}}, - {index: {_lt: $indexLT}} - ] - } - ) { - aggregate { - count - } - } } } `; @@ -163,7 +140,6 @@ export class TransactionService extends CommonService { indexGT: null, indexLT: null, height: null, - offset: payload?.offset || 0, }, operationName: 'auratestnet_transaction', }) diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index 180fab596..8aed0feac 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -128,8 +128,6 @@ export class ContractsListComponent implements OnInit, OnDestroy { } filterButton(val: string) { - console.log(val); - const i = this.filterButtons.findIndex((i) => i === val); switch (val) { diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html index 0ccf0e15d..8cf494db4 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.html @@ -8,7 +8,7 @@ diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index ea0d2e9ef..3e7c97bd8 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -4,9 +4,9 @@ import { debounceTime } from 'rxjs/operators'; import { PROPOSAL_TABLE_MODE } from 'src/app/core/constants/proposal.constant'; import { TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { TransactionService } from 'src/app/core/services/transaction.service'; import { balanceOf } from 'src/app/core/utils/common/parsing'; import { ProposalService } from '../../../../../app/core/services/proposal.service'; -import { TransactionService } from 'src/app/core/services/transaction.service'; @Component({ selector: 'app-depositors', @@ -16,12 +16,15 @@ import { TransactionService } from 'src/app/core/services/transaction.service'; export class DepositorsComponent implements OnInit { @Input() proposalId: number; depositorsList: any[] = []; + tableData = []; loading = true; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); coinMinimalDenom = this.environmentService.configValue.chain_info.currencies[0].coinMinimalDenom; dataLength = 0; proposalDeposit = PROPOSAL_TABLE_MODE.DEPOSITORS; + pageData = { pageIndex: 0, pageSize: 5 }; + constructor( private proposalService: ProposalService, private layout: BreakpointObserver, @@ -43,14 +46,13 @@ export class DepositorsComponent implements OnInit { const payload = { key: 'proposal_id', value: this.proposalId?.toString(), - limit: 5, - offset: 0, + limit: 100, // get all }; - this.transactionService.getListTxCondition(payload).subscribe( - (res) => { + + this.transactionService.getListTxCondition(payload).subscribe({ + next: (res) => { let dataList: any[] = []; if (res?.transaction?.length > 0) { - this.dataLength = res.transaction?.length || 0; dataList = res?.transaction?.filter( (transaction) => transaction?.data?.tx?.body?.messages[0]['@type'] === TRANSACTION_TYPE_ENUM.Deposit || @@ -69,17 +71,22 @@ export class DepositorsComponent implements OnInit { item.txhash = item?.hash; item.timestamp = item?.timestamp; }); + this.depositorsList = dataList; + this.dataLength = dataList?.length || 0; + + const { pageIndex, pageSize } = this.pageData; + this.tableData = this.depositorsList.slice(pageIndex * pageSize, pageIndex * pageSize + pageSize); } }, - () => {}, - () => { + complete: () => { this.loading = false; }, - ); + }); } - pageEventChange({ tabId, pageIndex, pageSize }: any) { - console.log({ tabId, pageIndex, pageSize }); + pageEventChange({ pageIndex, pageSize }: any) { + this.pageData = { pageIndex, pageSize }; + this.tableData = this.depositorsList.slice(pageIndex * pageSize, pageIndex * pageSize + pageSize); } } diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.html b/src/app/pages/proposal/proposal-detail/votes/votes.component.html index 3120dec30..3dad3b57d 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.html +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.html @@ -11,7 +11,7 @@
  • - {{ tab.value }} ({{ countVote.get(tab.key) }}) + {{ tab.value }} ({{ countVote.get(tab.key) || 0 }})
  • diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index b8f5b9e03..fd487d0ca 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -36,7 +36,6 @@ export class VotesComponent implements OnChanges { countVote: Map = new Map(); voteDataListLoading = true; - isFirstChange = false; PROPOSAL_TABLE_MODE_VOTES = PROPOSAL_TABLE_MODE.VOTES; currentTabId = 'all'; @@ -47,6 +46,8 @@ export class VotesComponent implements OnChanges { constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { if (event) { + this.getProposalVoteTotal(); + this.pageEventChange({ tabId: this.currentTabId, pageIndex: this.payloads?.pageIndex || 0, @@ -54,46 +55,47 @@ export class VotesComponent implements OnChanges { }); } }); - - setTimeout(() => { - this.proposalService.reloadList$.next(true); - }, 5500); } ngOnChanges(changes: SimpleChanges): void { - if (changes['proposalDetail'].currentValue?.proposal_id && !this.isFirstChange) { - this.isFirstChange = true; - const payloads = { - pageLimit: 5, - proposalId: this.proposalDetail.proposal_id, - offset: 0, - pageIndex: 0, - }; - - this.proposalService.getListVoteFromIndexer2(payloads, null).subscribe((res) => { - this.voteDataListLoading = false; - this.voteDataList = res.vote; - }); - - this.proposalService.getProposalVoteTotal(this.proposalDetail.proposal_id).subscribe({ - next: (res) => { - if (res) { - this.countVote.set('', res['ALL']?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.YES, res[VOTE_OPTION.YES]?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.ABSTAIN, res[VOTE_OPTION.ABSTAIN]?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.NO, res[VOTE_OPTION.NO]?.aggregate.count || 0); - this.countVote.set(VOTE_OPTION.NO_WITH_VETO, res[VOTE_OPTION.NO_WITH_VETO]?.aggregate.count || 0); - } - - this.voteDataListLoading = false; - }, - error: (error) => { - this.voteDataListLoading = true; - }, - }); + if (changes['proposalDetail'].currentValue?.proposal_id && changes['proposalDetail']?.firstChange) { + this.getListVoteFromIndexer(); + this.getProposalVoteTotal(); } } + getListVoteFromIndexer() { + const payloads = { + pageLimit: 5, + proposalId: this.proposalDetail.proposal_id, + offset: 0, + pageIndex: 0, + }; + this.proposalService.getListVoteFromIndexer2(payloads, null).subscribe((res) => { + this.voteDataListLoading = false; + this.voteDataList = res.vote; + }); + } + + getProposalVoteTotal() { + this.proposalService.getProposalVoteTotal(this.proposalDetail.proposal_id).subscribe({ + next: (res) => { + if (res) { + this.countVote.set('', res['ALL']?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.YES, res[VOTE_OPTION.YES]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.ABSTAIN, res[VOTE_OPTION.ABSTAIN]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.NO, res[VOTE_OPTION.NO]?.aggregate.count || 0); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, res[VOTE_OPTION.NO_WITH_VETO]?.aggregate.count || 0); + } + + this.voteDataListLoading = false; + }, + error: (error) => { + this.voteDataListLoading = true; + }, + }); + } + changeTab(tabId): void { this.pageEventChange({ tabId, pageIndex: 0, pageSize: 5 }); } diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index a3049605a..992976ff3 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -97,7 +97,7 @@
    - + (); @Output() pageEventChange = new EventEmitter(); - @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; - @ViewChild(MatPaginator) paginator: MatPaginator; + // @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; + // @ViewChild(MatPaginator) paginator: MatPaginator; validatorImgArr; @@ -103,7 +101,6 @@ export class ProposalTableComponent implements OnInit, OnChanges { private layout: BreakpointObserver, private validatorService: ValidatorService, private environmentService: EnvironmentService, - private proposalService: ProposalService, private cdr: ChangeDetectorRef, ) {} @@ -118,27 +115,29 @@ export class ProposalTableComponent implements OnInit, OnChanges { this.dataSource = new MatTableDataSource(this.data); } - if (changes.tabId.currentValue != changes.tabId.previousValue) { + if (changes.tabId?.currentValue != changes.tabId?.previousValue) { this.pageData.pageIndex = 1; } - let minus = 0; - if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { - minus = this.getUpdatePage(changes.data.currentValue?.length, this.proposalService.pageIndexObj[this.type]); - this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type] || 0) - minus); - } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { - minus = this.getUpdatePage( - changes.data.currentValue?.length, - this.proposalService.pageIndexObj[this.type][this.tabId], - ); - this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); - } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { - const operatorAddArr = []; + // // let minus = 0; + // if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { + // // minus = this.getUpdatePage(changes.data.currentValue?.length, this.proposalService.pageIndexObj[this.type]); + // // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type] || 0) - minus); + // } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { + // // minus = this.getUpdatePage( + // // changes.data.currentValue?.length, + // // this.proposalService.pageIndexObj[this.type][this.tabId], + // // ); + // // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); + // } else + if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { + const operatorAddArr = this.data.map((i) => i.operator_address); // get ValidatorAddressArr - this.data.forEach((d) => { - operatorAddArr.push(d.operator_address); - }); - if (operatorAddArr.length > 0 && operatorAddArr[0]) { + // this.data.forEach((d) => { + // operatorAddArr.push(d.operator_address); + // }); + + if (operatorAddArr.length > 0) { // get validator logo this.validatorService.getValidatorInfoByList(operatorAddArr).subscribe((res) => { if (res?.data) { @@ -151,26 +150,27 @@ export class ProposalTableComponent implements OnInit, OnChanges { } }); }); - this.cdr.markForCheck(); + + // this.cdr.markForCheck(); } }); } - minus = this.getUpdatePage( - changes.data.currentValue?.length, - this.proposalService.pageIndexObj[this.type][this.tabId], - ); - this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); + // minus = this.getUpdatePage( + // changes.data.currentValue?.length, + // this.proposalService.pageIndexObj[this.type][this.tabId], + // ); + // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); } } - getUpdatePage(data, page): number { - let minus = 0; - if (data % 25 !== 0 && Math.ceil(data / this.pageSize) <= page) { - minus = 1; - } - return minus; - } + // getUpdatePage(data, page): number { + // let minus = 0; + // if (data % 25 !== 0 && Math.ceil(data / this.pageSize) <= page) { + // minus = 1; + // } + // return minus; + // } ngOnInit(): void { this.template = this.getTemplate(this.type); @@ -192,10 +192,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { } shortenAddress(address: string): string { - if (address) { - return shortenAddress(address, 8); - } - return ''; + return shortenAddress(address, 8); } getVoteValue(voteKey) { @@ -205,31 +202,32 @@ export class ProposalTableComponent implements OnInit, OnChanges { pageEvent2(index: number) { const { pageIndex, pageSize } = this.pageData; - const next = length <= (pageIndex + 1) * pageSize; - - if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { - this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; - } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { - this.tabId = this.tabId || 'all'; - this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES] = {}; - this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES][this.tabId] = pageIndex; - } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { - this.tabId = this.tabId || 'all'; - this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES] = {}; - this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES][this.tabId] = pageIndex; - this.pageValidatorIndex = pageIndex; - } - if (next) { - this.isNextPage.emit(true); + // const next = length <= (pageIndex + 1) * pageSize; - this.pageEventChange.emit({ - type: this.type, - tabId: this.tabId, - pageIndex: index - 1, - pageSize, - }); - } + // if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { + // // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; + // } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { + // this.tabId = this.tabId || 'all'; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES] = {}; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES][this.tabId] = pageIndex; + // } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { + // this.tabId = this.tabId || 'all'; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES] = {}; + // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES][this.tabId] = pageIndex; + // this.pageValidatorIndex = pageIndex; + // } + + // if (next) { + // this.isNextPage.emit(true); + + this.pageEventChange.emit({ + type: this.type, + tabId: this.tabId, + pageIndex: pageIndex - 1, + pageSize, + }); + // } } // pageEvent(e: PageEvent): void { @@ -268,13 +266,13 @@ export class ProposalTableComponent implements OnInit, OnChanges { // } // } - getListData(): any[] { - if (!(this.dataSource?.paginator && this.dataSource?.data)) { - return []; - } - return this.dataSource.data.slice( - this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize, - this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize + this.dataSource.paginator.pageSize, - ); - } + // getListData(): any[] { + // if (!(this.dataSource?.paginator && this.dataSource?.data)) { + // return []; + // } + // return this.dataSource.data.slice( + // this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize, + // this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize + this.dataSource.paginator.pageSize, + // ); + // } } diff --git a/src/assets/config/config.json b/src/assets/config/config.json index b3e682244..07e398a3e 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -1,28 +1,33 @@ { "fabric": "", - "cosmos": "https://explorer-api.dev.aura.network/api/v1", - "chainId": "aura-testnet-2", + "cosmos": "https://serenity-api.aurascan.io/api/v1", + "chainId": "serenity-testnet-001", "timeStaking": "86400", - "env": "dev", - "urlSocket": "https://explorer-api.dev.aura.network", + "urlSocket": "https://serenity-api.aurascan.io", + "env": "serenity", "validator_s3": "https://validator-logos.s3.ap-southeast-1.amazonaws.com", "coins": [ { - "name": "Serenity Aura", - "display": "AURA", - "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", + "name": "Test Aura", + "display": "TAURA", + "denom": "ibc/6DF434CD72825125ACECEA86BF4A15DCF7CA0DE257C7683AF2A550D2BE34F79D", + "decimal": 6, + "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" + }, + { + "name": "Test Aura 2", + "display": "TAURA", + "denom": "ibc/88157C3B5E7755BF1ED3756691F96DE13780973B7061BBCA837665D97666F75C", "decimal": 6, "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" } ], "chain_info": { - "chainId": "aura-testnet-2", - "chainName": "aura devnet", - "rpc": "https://rpc.dev.aura.network", - "rest": "https://lcd.dev.aura.network", - "bip44": { - "coinType": 118 - }, + "chainId": "serenity-testnet-001", + "chainName": "Aura serenity testnet", + "rpc": "https://rpc.serenity.aura.network", + "rest": "https://lcd.serenity.aura.network", + "bip44": { "coinType": 118 }, "bech32Config": { "bech32PrefixAccAddr": "aura", "bech32PrefixAccPub": "aurapub", @@ -31,45 +36,22 @@ "bech32PrefixConsAddr": "auravalcons", "bech32PrefixConsPub": "auravalconspub" }, - "currencies": [ - { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - } - ], - "feeCurrencies": [ - { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - } - ], - "stakeCurrency": { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - }, + "currencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], + "feeCurrencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], + "stakeCurrency": { "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }, "coinType": 118, - "gasPriceStep": { - "low": 0.001, - "average": 0.0025, - "high": 0.004 - }, + "gasPriceStep": { "low": 0.001, "average": 0.0025, "high": 0.004 }, "features": ["ibc-transfer"], - "walletUrlForStaking": "https://explorer.dev.aura.network/validators", + "walletUrlForStaking": "https://serenity.aurascan.io/validators", "logo": "https://i.imgur.com/zi0mTYb.png", - "explorer": "https://explorer.dev.aura.network/" + "explorer": "https://serenity.aurascan.io/" }, - "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", - "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", - "timeInterval": 4000, + "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/serenity-assets/", + "urlIndexer": "https://indexer.staging.aurascan.io/api/v1", + "timeInterval": 2000, "ipfsDomain": "https://ipfs.io/", - "evnLabel": { - "desktop": "Develop Testnet Network", - "mobile": "Develop Testnet" - }, - "horoscopeSelectedChain": "auratestnet", + "evnLabel": { "desktop": "Serenity Testnet Network", "mobile": "Serenity Testnet" }, + "horoscopeSelectedChain": "serenity", "horoscopeUrl": "https://indexer-v2.dev.aurascan.io/", "horoscopePathGraphql": "api/v1/graphiql", "horoscopePathApi": "api/v1", From dcf55544ccb25654adff08c7f25e894360cbde4c Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 16 Jun 2023 11:26:16 +0700 Subject: [PATCH 127/315] [TamTM6] update time recall api --- .../soulbound-contract-list.component.ts | 2 +- .../soulbound-token-contract.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts index fae7a74fb..0b3c90967 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts @@ -112,7 +112,7 @@ export class SoulboundContractListComponent implements OnInit { if (result !== 'canceled') { setTimeout(() => { this.getListSmartContract(); - }, 2000); + }, 4000); } }); } diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts index 9f08c5e17..d8bc3f7ca 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts @@ -139,7 +139,7 @@ export class SoulboundTokenContractComponent implements OnInit { if (result !== 'canceled') { setTimeout(() => { this.getListToken(); - }, 2000); + }, 4000); } }); } From 82965f0b940c246258c3f6bbea81eb737543702e Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 16 Jun 2023 14:56:36 +0700 Subject: [PATCH 128/315] [TamTM6] update nft detail call v2 --- .../nft-detail/nft-detail.component.html | 7 +- .../token/nft-detail/nft-detail.component.ts | 82 +++++++++++-------- 2 files changed, 48 insertions(+), 41 deletions(-) diff --git a/src/app/pages/token/nft-detail/nft-detail.component.html b/src/app/pages/token/nft-detail/nft-detail.component.html index bccbd8c9a..fe107f753 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.html +++ b/src/app/pages/token/nft-detail/nft-detail.component.html @@ -2,12 +2,7 @@
    - +

    diff --git a/src/app/pages/token/nft-detail/nft-detail.component.ts b/src/app/pages/token/nft-detail/nft-detail.component.ts index a3d5d5766..348eaebe6 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.ts +++ b/src/app/pages/token/nft-detail/nft-detail.component.ts @@ -119,11 +119,12 @@ export class NFTDetailComponent implements OnInit { } }); - if (this.router.snapshot.url[0]?.path === 'token-nft') { - this.getDetailCW721(); - } else { - this.getDetailCW4973(); - } + this.getDetailCW721(); + // if (this.router.snapshot.url[0]?.path === 'token-nft') { + // this.getDetailCW721(); + // } else { + // this.getDetailCW4973(); + // } } error(): void { @@ -134,46 +135,57 @@ export class NFTDetailComponent implements OnInit { const encoded = encodeURIComponent(this.nftId); this.contractService.getDetailCW721(this.contractAddress, encoded).subscribe( (res) => { - res.data = res.data[0]; + console.log(res); + res = res.data[0]; - if (!res?.data || res.data === null || res?.data.status === SB_TYPE.UNEQUIPPED) { + if (!res || res === null) { this.toastr.error('Token invalid'); this.loading = false; return; } - res.data['type'] = res.data['type'] || ContractRegisterType.CW721; + + res['type'] = res['type'] || ContractRegisterType.CW721; + if (this.router.snapshot.url[0]?.path === 'token-abt') { + if (res.cw721_contract?.smart_contract?.name === TYPE_CW4973 && res.burned === false) { + res['type'] = ContractRegisterType.CW4973; + this.isSoulBound = true; + } else { + this.toastr.error('Token invalid'); + this.loading = false; + return; + } + } + + // if(res['name'] === TYPE_CW4973 && ) this.nftDetail = { - ...res.data, - contract_address: res.contract_address || res.data?.cw721_contract?.smart_contract?.address, - creator: res.creator || res.data?.cw721_contract?.smart_contract?.creator, - name: res.name || res.data?.cw721_contract?.name, + ...res, + contract_address: res.contract_address || res?.cw721_contract?.smart_contract?.address, + creator: res.creator || res?.cw721_contract?.smart_contract?.creator, + name: res.name || res?.cw721_contract?.name, }; - if (this.nftDetail.type === ContractRegisterType.CW721) { - if (this.nftDetail?.asset_info?.data?.info?.extension?.image?.indexOf('twilight') > 1) { - this.nftDetail['isDisplayName'] = true; - this.nftDetail['nftName'] = this.nftDetail?.asset_info?.data?.info?.extension?.name || ''; - } - if (this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url) { - this.imageUrl = this.nftDetail.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url; - } - if (this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url) { - if (!this.nftDetail?.image?.link_s3) { - if ( - (this.nftDetail.animation?.content_type || - this.nftDetail?.media_info?.offchain?.animation?.content_type) === 'image/gif' - ) { - this.imageUrl = - this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain.animation?.url; - } else { - this.animationUrl = - this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; - } - } else if (this.getTypeFile(this.nftDetail) !== MEDIA_TYPE.IMG) { + if (this.nftDetail?.asset_info?.data?.info?.extension?.image?.indexOf('twilight') > 1) { + this.nftDetail['isDisplayName'] = true; + this.nftDetail['nftName'] = this.nftDetail?.asset_info?.data?.info?.extension?.name || ''; + } + if (this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url) { + this.imageUrl = this.nftDetail.image?.link_s3 || this.nftDetail?.media_info?.offchain?.image?.url; + } + if (this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url) { + if (!this.nftDetail?.image?.link_s3) { + if ( + (this.nftDetail.animation?.content_type || + this.nftDetail?.media_info?.offchain?.animation?.content_type) === 'image/gif' + ) { + this.imageUrl = this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain.animation?.url; + } else { this.animationUrl = this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; - } else { - this.imageUrl = this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain.image?.url; } + } else if (this.getTypeFile(this.nftDetail) !== MEDIA_TYPE.IMG) { + this.animationUrl = + this.nftDetail.animation?.link_s3 || this.nftDetail?.media_info?.offchain?.animation?.url; + } else { + this.imageUrl = this.nftDetail?.image?.link_s3 || this.nftDetail?.media_info?.offchain.image?.url; } } }, From ec5f4b46cfa48953daad428df3d5fa3fc820c5ad Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Fri, 16 Jun 2023 15:50:07 +0700 Subject: [PATCH 129/315] update validator --- src/app/core/constants/proposal.constant.ts | 1 + src/app/core/services/proposal.service.ts | 6 +- .../validators-votes.component.ts | 144 +++++------------- .../proposal-detail/votes/votes.component.ts | 2 +- 4 files changed, 44 insertions(+), 109 deletions(-) diff --git a/src/app/core/constants/proposal.constant.ts b/src/app/core/constants/proposal.constant.ts index 2197824d1..91c53f19f 100644 --- a/src/app/core/constants/proposal.constant.ts +++ b/src/app/core/constants/proposal.constant.ts @@ -46,6 +46,7 @@ export enum VOTE_OPTION { } /* + ["VOTE_OPTION_YES", "VOTE_OPTION_ABSTAIN", "VOTE_OPTION_NO", "VOTE_OPTION_NO_WITH_VETO"] VOTE_OPTION_UNSPECIFIED: vote_aggregate(where: {vote_option: {_eq: "VOTE_OPTION_UNSPECIFIED"}}) { aggregate { diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 81a8e0f8a..f7e41af12 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -55,10 +55,10 @@ export class ProposalService extends CommonService { getValidatorVotesFromIndexer2( proposalId: number, - { limit, offset }: { limit: number; offset?: number }, + { limit, offset, voteOption }: { limit: number; offset?: number; voteOption?: string }, ): Observable { const operationsDoc = ` - query auratestnet_validator($proposalId: Int = null, $limit: Int = 10, $offset: Int = 0) { + query queryValidatorVotes($proposalId: Int = null, $limit: Int = 10, $offset: Int = 0) { ${this.envDB} { validator(where: {status: {_eq: "BOND_STATUS_BONDED"}}, order_by: {percent_voting_power: desc}, limit: $limit, offset: $offset) { vote(where: {proposal_id: {_eq: $proposalId}}) { @@ -82,7 +82,7 @@ export class ProposalService extends CommonService { limit: limit, offset: offset || 0, }, - operationName: 'auratestnet_validator', + operationName: 'queryValidatorVotes', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index 3a4d43d8f..d96550391 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -64,50 +64,26 @@ export class ValidatorsVotesComponent implements OnInit { constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { if (event) { - // this.getValidatorVotes(); - this.getValidatorVotes2(); + this.getValidatorVotes(); } }); } - getValidatorVotes2(isInit = false): void { + ngOnInit(): void { + this.getValidatorVotes(); + } + + getValidatorVotes(voteOption = null): void { if (this.proposalId) { this.proposalService .getValidatorVotesFromIndexer2(this.proposalId, { - limit: 2, + limit: 100, + voteOption, }) .subscribe( (res) => { - let validatorVote = []; - if (res?.validator) { - validatorVote = _.get(res, 'validator').map((item) => { - const validator_name = item.description?.moniker; - const timestamp = _.get(item, 'vote[0].updated_at'); - const vote_option = _.get(item, 'vote[0].vote_option'); - const txhash = _.get(item, 'vote[0].txhash'); - const operator_address = _.get(item, 'operator_address'); - const validator_identity = _.get(item, 'description.identity'); - return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity }; - }); - } - - this.voteData.all = validatorVote; - this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); - this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.ABSTAIN); - this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO); - this.voteData.noWithVeto = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO_WITH_VETO); - this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); - this.voteDataList = [...this.voteData.all]; - - this.countVote.set('', this.voteData.all.length); - this.countVote.set(VOTE_OPTION.YES, this.voteData.yes.length); - this.countVote.set(VOTE_OPTION.ABSTAIN, this.voteData.abstain.length); - this.countVote.set(VOTE_OPTION.NO, this.voteData.no.length); - this.countVote.set(VOTE_OPTION.NO_WITH_VETO, this.voteData.noWithVeto.length); - this.countVote.set('null', this.voteData.didNotVote.length); - this.voteDataListLoading = false; - this.changeTab(this.countCurrent); + this.loadValidatorVotes(res?.validator); }, () => {}, () => { @@ -115,87 +91,45 @@ export class ValidatorsVotesComponent implements OnInit { }, ); } - isInit && this.customNav?.select(this.tabAll); } - getValidatorVotes(isInit = false): void { - if (this.proposalId) { - this.proposalService.getValidatorVotesFromIndexer(this.proposalId).subscribe( - (res) => { - let validatorVote = []; - if (res?.validator) { - validatorVote = _.get(res, 'validator').map((item) => { - const validator_name = item.description?.moniker; - const timestamp = _.get(item, 'vote[0].updated_at'); - const vote_option = _.get(item, 'vote[0].vote_option'); - const txhash = _.get(item, 'vote[0].txhash'); - const operator_address = _.get(item, 'operator_address'); - const validator_identity = _.get(item, 'description.identity'); - return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity }; - }); - } - - this.voteData.all = validatorVote; - this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); - this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.ABSTAIN); - this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO); - this.voteData.noWithVeto = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO_WITH_VETO); - this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); - this.voteDataList = [...this.voteData.all]; - - this.countVote.set('', this.voteData.all.length); - this.countVote.set(VOTE_OPTION.YES, this.voteData.yes.length); - this.countVote.set(VOTE_OPTION.ABSTAIN, this.voteData.abstain.length); - this.countVote.set(VOTE_OPTION.NO, this.voteData.no.length); - this.countVote.set(VOTE_OPTION.NO_WITH_VETO, this.voteData.noWithVeto.length); - this.countVote.set('null', this.voteData.didNotVote.length); - - this.voteDataListLoading = false; - this.changeTab(this.countCurrent); - }, - () => {}, - () => { - this.voteDataListLoading = false; - }, - ); + loadValidatorVotes(validator) { + let validatorVote = []; + if (validator) { + validatorVote = validator.map((item) => { + const validator_name = item.description?.moniker; + const timestamp = _.get(item, 'vote[0].updated_at'); + const vote_option = _.get(item, 'vote[0].vote_option'); + const txhash = _.get(item, 'vote[0].txhash'); + const operator_address = _.get(item, 'operator_address'); + const validator_identity = _.get(item, 'description.identity'); + return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity }; + }); } - isInit && this.customNav?.select(this.tabAll); - } - ngOnInit(): void { - // this.getValidatorVotes(true); - - this.getValidatorVotes2(); + this.voteData.all = validatorVote; + this.voteData.yes = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); + this.voteData.abstain = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.ABSTAIN); + this.voteData.no = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO); + this.voteData.noWithVeto = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.NO_WITH_VETO); + this.voteData.didNotVote = validatorVote.filter((f) => f.vote_option === ''); + + this.voteDataList = validatorVote; + + this.countVote.set('', this.voteData.all.length); + this.countVote.set(VOTE_OPTION.YES, this.voteData.yes.length); + this.countVote.set(VOTE_OPTION.ABSTAIN, this.voteData.abstain.length); + this.countVote.set(VOTE_OPTION.NO, this.voteData.no.length); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, this.voteData.noWithVeto.length); + this.countVote.set('null', this.voteData.didNotVote.length); } changeTab(tabId): void { - if (this.countCurrent !== tabId) { - this.proposalService.pageIndexObj['validator_votes'] = {}; - } - this.countCurrent = tabId; - switch (tabId) { - case '': - this.voteDataList = this.voteData.all; - break; - case VOTE_OPTION.YES: - this.voteDataList = this.voteData.yes || 0; - break; - case VOTE_OPTION.ABSTAIN: - this.voteDataList = this.voteData.abstain || 0; - break; - case VOTE_OPTION.NO: - this.voteDataList = this.voteData.no || 0; - break; - case VOTE_OPTION.NO_WITH_VETO: - this.voteDataList = this.voteData.noWithVeto || 0; - break; - default: - this.voteDataList = this.voteData.didNotVote || 0; - break; - } + // this.pageEventChange({ tabId, pageIndex: 0, pageSize: 5 }); + this.voteDataList = this.voteData.yes; } pageEventChange(e) { - console.log(e); + this.getValidatorVotes(e?.tabId); } } diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index fd487d0ca..7fc03ff20 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -58,7 +58,7 @@ export class VotesComponent implements OnChanges { } ngOnChanges(changes: SimpleChanges): void { - if (changes['proposalDetail'].currentValue?.proposal_id && changes['proposalDetail']?.firstChange) { + if (changes['proposalDetail'].currentValue?.proposal_id) { this.getListVoteFromIndexer(); this.getProposalVoteTotal(); } From 62b3605993fe57b466b69e5ca287f5c69e8349a6 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 16 Jun 2023 16:49:27 +0700 Subject: [PATCH 130/315] [TamTM6] update event log, toggle button --- .../block-detail/block-detail.component.html | 16 ++-- .../transaction-detail.component.html | 25 ++---- .../messages-item.component.html | 4 +- .../transaction-messages.component.html | 89 ++++++++++--------- .../transaction-messages.component.scss | 10 ++- .../transaction-messages.component.ts | 5 ++ 6 files changed, 79 insertions(+), 70 deletions(-) diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index c9755a538..aa1ca14af 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -64,15 +64,15 @@

    {{ !isRawData ? 'Information' : 'Raw Data' }}

    -

    Height
    -
    +
    {{ transaction?.height | number }} @@ -79,7 +72,7 @@

    Transaction Details

    Time
    -
    +
    {{ commonService.getDateValue(transaction?.timestamp)[0] }}
    ( @@ -92,7 +85,7 @@

    Transaction Details

    Fee
    -
    +
    {{ +transaction?.fee | mask : 'separator.6' }} {{ denom }}
    @@ -101,7 +94,7 @@

    Transaction Details

    Gas
    (used / wanted)
    -
    +
    {{ transaction?.gas_used | number }} / {{ transaction?.gas_wanted | number }}
    diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html index 5464ff677..108359c6d 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/messages-item/messages-item.component.html @@ -1,6 +1,6 @@ -
    +
    {{ label }}
    -
    +
    {{ value }} diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 36e481b7a..7e6758444 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -61,7 +61,7 @@ -
    +
    Message
         
    -      
    +
    Message
    
    @@ -148,7 +148,7 @@
           [label]="'Sequence'"
           [value]="getLongValue(ibcData?.packet_sequence)"
           [pipeType]="pipeTypeData.Number">
    -    
    +
    Amount
    {{ transactionDetail?.tx?.tx?.body?.messages[0]?.token?.amount | balanceOf | mask : 'separator.6' }} @@ -172,7 +172,7 @@ [label]="'Sequence'" [value]="getLongValue(data?.packet?.sequence)" [pipeType]="pipeTypeData.Number"> -
    +
    Amount
    {{ ibcData?.amount | balanceOf | mask : 'separator.6' }} @@ -206,7 +206,7 @@ [label]="'Sequence'" [value]="getLongValue(ibcData?.packet_sequence)" [pipeType]="pipeTypeData.Number"> -
    +
    Amount
    {{ ibcData?.acknowledgement?.amount | balanceOf | mask : 'separator.6' }} @@ -244,7 +244,7 @@ -
    +
    Data
         
    -
    +
    IBC Progress
    Event Log
    -
    - -
    - {{ element.events.type }} - - - -
    - {{ item.type }} -
    -
    - -
    +
    + Show all events +
    + +
    + {{ element.events.type }} + + + +
    + {{ item.type }} +
    +
    + +
    -
    - -
    - {{ - data.key - }} - - {{ - data.value - }} - - -
    -
    -
    -
    -
    -
    +
    + +
    + {{ + data.key + }} + + {{ + data.value + }} + + +
    +
    +
    + +
    + +
    diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 3a9e31e87..84489c4c9 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -112,7 +112,7 @@ border-radius: 8px; // padding: 8px 20px; padding-left: calc(var(--bs-gutter-x) * 0.5); - max-height: 420px; + max-height: 210px; overflow-y: auto; .item-event-log:not(:last-child) { margin-bottom: var(--spacer-7); @@ -148,6 +148,14 @@ } } +.mat-slide-toggle.mat-checked .mat-slide-toggle-bar{ + background-color: #2BBBA3; +} + +.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb{ + background-color: var(--aura-white); +} + .mat-expansion-panel { background: none; box-shadow: none !important; diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index b008adf51..7075fbcb2 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -78,6 +78,7 @@ export class TransactionMessagesComponent implements OnInit { eventLogData = []; idxLog = 0; codeTransaction = CodeTransaction; + isDisplay = []; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; coinMinimalDenom = this.environmentService.configValue.chain_info.currencies[0].coinMinimalDenom; @@ -887,4 +888,8 @@ export class TransactionMessagesComponent implements OnInit { } return value; } + + changeShowData(idx){ + this.isDisplay[idx] = !this.isDisplay[idx]; + } } From 2e13e0687e94b1a0e8e939feeaa0a8a4393bd3b0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Fri, 16 Jun 2023 16:56:18 +0700 Subject: [PATCH 131/315] update paginator token --- .../token-cw4973/token-cw4973.component.html | 12 ++++------ .../token-cw4973/token-cw4973.component.ts | 20 +++++++--------- .../token-cw721/token-cw721.component.html | 12 ++++------ .../token-cw721/token-cw721.component.ts | 24 +++++++------------ src/app/pages/token/token.module.ts | 8 ++++--- 5 files changed, 33 insertions(+), 43 deletions(-) diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html index ca121618d..c886c1924 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html @@ -38,7 +38,7 @@

    Account Bound Tokens (ABT)

    # - {{ pageData?.pageIndex * 20 + i + 1 }} + {{ (pageData.pageIndex - 1) * pageData.pageSize + i + 1 }} @@ -81,12 +81,10 @@

    Account Bound Tokens (ABT)

    - - +
    + + +
    diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts index 2e0f070df..984ea94d7 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts @@ -32,7 +32,7 @@ export class TokenCw4973Component implements OnInit { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; dataSource: MatTableDataSource = new MatTableDataSource([]); maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; @@ -51,16 +51,11 @@ export class TokenCw4973Component implements OnInit { .asObservable() .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) .subscribe(() => { - if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { - this.getTokenData(); - } else { - this.pageChange.selectPage(0); - } + this.pageEvent(0); }); } ngOnDestroy(): void { - // throw new Error('Method not implemented.'); this.destroy$.next(); this.destroy$.complete(); } @@ -72,7 +67,7 @@ export class TokenCw4973Component implements OnInit { getTokenData() { const payload = { limit: this.pageData.pageSize, - offset: this.pageData.pageIndex * this.pageData.pageSize, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, keyword: this.textSearch, }; this.soulboundService.getListABT(payload).subscribe((res) => { @@ -85,13 +80,16 @@ export class TokenCw4973Component implements OnInit { this.dataSource.paginator = event; } - pageEvent(e: PageEvent): void { - this.pageData.pageIndex = e.pageIndex; + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; + } this.getTokenData(); } resetSearch() { this.textSearch = ''; - this.onKeyUp(); + this.pageEvent(0); } } diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html index 6dd9ad322..5832e51e4 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html @@ -43,7 +43,7 @@

    Non-Fungible Tokens (NFT)

    # - {{ pageData?.pageIndex * 20 + i + 1 }} + {{ (pageData.pageIndex - 1) * pageData.pageSize + i + 1 }} @@ -93,12 +93,10 @@

    Non-Fungible Tokens (NFT)

    - - +
    + + +
    diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts index fa59f67bf..495b50422 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts @@ -32,7 +32,7 @@ export class TokenCw721Component implements OnInit { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; dataSource: MatTableDataSource = new MatTableDataSource([]); maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; @@ -59,16 +59,11 @@ export class TokenCw721Component implements OnInit { .asObservable() .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) .subscribe(() => { - if (this.pageData.pageIndex === PAGE_EVENT.PAGE_INDEX) { - this.getTokenData(); - } else { - this.pageChange.selectPage(0); - } + this.pageEvent(0); }); } ngOnDestroy(): void { - // throw new Error('Method not implemented.'); this.destroy$.next(); this.destroy$.complete(); } @@ -76,7 +71,7 @@ export class TokenCw721Component implements OnInit { getTokenData() { const payload = { limit: this.pageData.pageSize, - offset: this.pageData.pageIndex * this.pageData.pageSize, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, sort_column: this.sortBy, sort_order: this.sortOrder, }; @@ -91,18 +86,17 @@ export class TokenCw721Component implements OnInit { this.searchSubject.next(this.textSearch); } - paginatorEmit(event): void { - this.dataSource.paginator = event; - } - - pageEvent(e: PageEvent): void { - this.pageData.pageIndex = e.pageIndex; + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; + } this.getTokenData(); } resetSearch() { this.textSearch = ''; - this.onKeyUp(); + this.pageEvent(0); } sortData(sort: Sort) { diff --git a/src/app/pages/token/token.module.ts b/src/app/pages/token/token.module.ts index 4de078a89..ac950b7df 100644 --- a/src/app/pages/token/token.module.ts +++ b/src/app/pages/token/token.module.ts @@ -5,8 +5,10 @@ import { MatTableModule } from '@angular/material/table'; import { NgbNavModule, NgbPopoverModule } from '@ng-bootstrap/ng-bootstrap'; import { TranslateModule } from '@ngx-translate/core'; import { NgxMaskModule } from 'ngx-mask'; +import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; import { AccountService } from 'src/app/core/services/account.service'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; import { AudioPlayerModule } from 'src/app/shared/components/audio-player/audio-player.module'; import { NftCardModule } from 'src/app/shared/components/cards/nft-card/nft-card.module'; import { ContractPopoverModule } from 'src/app/shared/components/contract-popover/contract-popover.module'; @@ -37,7 +39,6 @@ import { TokenCw20Component } from './token-list/token-cw20/token-cw20.component import { TokenCw4973Component } from './token-list/token-cw4973/token-cw4973.component'; import { TokenCw721Component } from './token-list/token-cw721/token-cw721.component'; import { TokenRoutingModule } from './token-routing.module'; -import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; @NgModule({ declarations: [ @@ -57,7 +58,7 @@ import { CommonDirectiveModule } from 'src/app/core/directives/common-directive. TokenInventoryComponent, NFTDetailComponent, PopupShareComponent, - TokenCw4973Component + TokenCw4973Component, ], imports: [ CommonModule, @@ -80,7 +81,8 @@ import { CommonDirectiveModule } from 'src/app/core/directives/common-directive. NftCardModule, AudioPlayerModule, ContractsModule, - CommonDirectiveModule + CommonDirectiveModule, + APaginatorModule, ], providers: [TokenService, AccountService], }) From 60e95fd8fe797ffbd0ec47d2446be2fb633331c6 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 19 Jun 2023 09:44:27 +0700 Subject: [PATCH 132/315] update paginator community pool proposal --- .../community-pool/community-pool.module.ts | 4 +- .../community-pool-proposal.component.html | 314 +++++++++--------- .../community-pool-proposal.component.ts | 69 ++-- .../pages/proposal/proposal.component.html | 283 +++++++++------- src/app/pages/proposal/proposal.component.ts | 19 +- 5 files changed, 342 insertions(+), 347 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts index 9547dbc12..e82a11904 100644 --- a/src/app/pages/community-pool/community-pool.module.ts +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -7,13 +7,14 @@ import { NgxMaskModule } from 'ngx-mask'; import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; import { ProposalService } from 'src/app/core/services/proposal.service'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; import { PaginatorModule } from '../../../app/shared/components/paginator/paginator.module'; import { TableNoDataModule } from '../../../app/shared/components/table-no-data/table-no-data.module'; import { SharedModule } from '../../../app/shared/shared.module'; import { CommunityPoolAssetComponent } from './asset-list/community-pool-asset.component'; import { CommunityPoolRoutingModule } from './community-pool-routing.module'; -import { CommunityPoolProposalComponent } from './proposal-list/community-pool-proposal.component'; import { CommunityPoolComponent } from './community-pool.component'; +import { CommunityPoolProposalComponent } from './proposal-list/community-pool-proposal.component'; @NgModule({ declarations: [CommunityPoolAssetComponent, CommunityPoolProposalComponent, CommunityPoolComponent], @@ -29,6 +30,7 @@ import { CommunityPoolComponent } from './community-pool.component'; CommonPipeModule, NgxMaskModule, CommonDirectiveModule, + APaginatorModule, ], providers: [ProposalService], }) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index 8c5ef45ed..a74317a23 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -1,177 +1,165 @@ -
    + -
    -
    +
    +
    -

    Community Pool Spent Proposals

    +

    Community Pool Spent Proposals

    -
    - - - - - - +
    + +
    #ID#{{ element.proposal_id }}
    + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - -
    #ID#{{ element.proposal_id }}Title - {{ - element.content.title - }} - Title + {{ + element.content.title + }} + Status -
    - {{ getStatus(element.status).value }} -
    -
    Status +
    + {{ getStatus(element.status).value }} +
    +
    Sender - - {{ shortenAddress(distributionAcc) || '-' }} - - Sender + + {{ shortenAddress(distributionAcc) || '-' }} + + Recipient - - {{ shortenAddress(element.content.recipient) || '-' }} - - Recipient + + {{ shortenAddress(element.content.recipient) || '-' }} + + Amount - - {{ denom }} - Amount + + {{ denom }} + Voting End -
    - {{ element.voting_end_time | customDate : 'yyyy-MM-dd' }} -
    - {{ element.voting_end_time | customDate : 'HH:mm:ss' }} -
    -
    - - -
    -
    Voting End +
    + {{ element.voting_end_time | customDate : 'yyyy-MM-dd' }} +
    + {{ element.voting_end_time | customDate : 'HH:mm:ss' }} +
    +
    + - +
    +
    - {{ 'NO DATA' | translate }} -
    - - -
    -
    -
    - -
    -
    - -
    -
    -

    Community Pool Spent Proposals

    -
    -
    - -
    - - -
    - + + + + + {{ 'NO DATA' | translate }} + + + + + +
    + + +
    + +
    + +
    + +
    -
    +
    + + + diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts index f148a7b21..b2ec91113 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -3,6 +3,7 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; +import { tap } from 'rxjs/operators'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { PROPOSAL_STATUS } from 'src/app/core/constants/proposal.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; @@ -35,17 +36,25 @@ export class CommunityPoolProposalComponent implements OnInit { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 10, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; - pageSizeMob = 5; - breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); + length: number; + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]).pipe( + tap((state) => { + this.pageData = { + length: PAGE_EVENT.LENGTH, + pageSize: state.matches ? 5 : 10, + pageIndex: 1, + }; + + this.getListProposal({ index: 1 }); + }), + ); dataSource: MatTableDataSource; dataSourceMob: any[]; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; listCoin = this.environmentService.configValue.coins; - listAssetLcd = []; statusConstant = PROPOSAL_STATUS; - nextKey = null; distributionAcc = ''; constructor( @@ -59,7 +68,7 @@ export class CommunityPoolProposalComponent implements OnInit { ngOnInit(): void { this.getAddressDistribution(); - this.getListProposal(); + // this.getListProposal({ index: 1 }); } async getAddressDistribution() { @@ -74,32 +83,6 @@ export class CommunityPoolProposalComponent implements OnInit { return ''; } - paginatorEmit(event): void { - this.pageData.pageIndex = PAGE_EVENT.PAGE_INDEX; - if (this.dataSource) { - this.dataSource.paginator = event; - } else { - this.dataSource = new MatTableDataSource(); - this.dataSource.paginator = event; - } - this.dataSourceMob = this.dataSource.data.slice( - this.pageData.pageIndex * this.pageSizeMob, - this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, - ); - } - - pageEvent(e: PageEvent): void { - this.pageData.pageIndex = e.pageIndex; - if (this.pageData.length <= this.pageData.pageSize * (this.pageData.pageIndex + 1)) { - this.getListProposal(); - } else { - this.dataSourceMob = this.dataSource.data.slice( - this.pageData.pageIndex * this.pageSizeMob, - this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, - ); - } - } - getStatus(key: string) { let resObj: { value: string; class: string; key: string } = null; const statusObj = this.statusConstant.find((s) => s.key === key); @@ -113,27 +96,17 @@ export class CommunityPoolProposalComponent implements OnInit { return resObj; } - getListProposal() { + getListProposal({ index }) { let payload = { - limit: 40, - nextKey: this.nextKey, + limit: this.pageData.pageSize, + offset: (index - 1) * this.pageData.pageSize, type: '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal', }; - this.proposalService.getProposalData(payload).subscribe((res) => { - this.nextKey = res.proposal[res.proposal.length - 1].proposal_id; + this.proposalService.getProposalData2(payload).subscribe((res) => { if (res?.proposal) { - let tempDta = res.proposal; - if (this.dataSource?.data?.length > 0) { - this.dataSource.data = [...this.dataSource.data, ...tempDta]; - } else { - this.dataSource = new MatTableDataSource(tempDta); - } + this.dataSource = new MatTableDataSource(res.proposal); } - this.dataSourceMob = this.dataSource.data.slice( - this.pageData.pageIndex * this.pageSizeMob, - this.pageData.pageIndex * this.pageSizeMob + this.pageSizeMob, - ); - this.pageData.length = this.dataSource.data.length; + this.length = res.proposal_aggregate.aggregate.count; }); } } diff --git a/src/app/pages/proposal/proposal.component.html b/src/app/pages/proposal/proposal.component.html index 3d01bd7ca..dcb74a6f1 100644 --- a/src/app/pages/proposal/proposal.component.html +++ b/src/app/pages/proposal/proposal.component.html @@ -13,7 +13,8 @@
    {{ lastedItem.content.title }}
    -
    {{ getStatus(lastedItem.status).value }}
    @@ -24,33 +25,38 @@
    Proposer
    {{ - lastedItem.proposer - ? lastedItem.proposer.description.moniker - : (lastedItem.proposer_address | cutStringPipe : 8 : 8) - }} + lastedItem.proposer + ? lastedItem.proposer.description.moniker + : (lastedItem.proposer_address | cutStringPipe : 8 : 8) + }}
    Voting Start
    -
    {{ lastedItem.voting_start_time | customDate : 'yyyy-MM-dd' }}
    {{ lastedItem.voting_start_time | customDate : 'HH:mm:ss' }}
    -
    -
    Voting End
    -
    {{ lastedItem.voting_end_time | customDate : 'yyyy-MM-dd' }}
    {{ lastedItem.voting_end_time | customDate : 'HH:mm:ss' }}
    -
    -
    @@ -60,17 +66,28 @@
      -
    • -
    • -
    • -
    • +
    • @@ -78,7 +95,8 @@
    Most voted on
    -
    {{ - getHighestVote( - lastedItem.tally?.yes, - lastedItem.tally?.no, - lastedItem.tally?.no_with_veto, - lastedItem.tally?.abstain - ).name + getHighestVote( + lastedItem.tally?.yes, + lastedItem.tally?.no, + lastedItem.tally?.no_with_veto, + lastedItem.tally?.abstain + ).name }} {{ - getHighestVote( - lastedItem.tally?.yes, - lastedItem.tally?.no, - lastedItem.tally?.no_with_veto, - lastedItem.tally?.abstain - ).value | number : global.formatNumber2Decimal - }}%   + getHighestVote( + lastedItem.tally?.yes, + lastedItem.tally?.no, + lastedItem.tally?.no_with_veto, + lastedItem.tally?.abstain + ).value | number : global.formatNumber2Decimal + }}%  
    @@ -112,23 +131,26 @@
    - You voted "{{ lastedItem.vote_option }}" for this - proposal + You voted "{{ lastedItem.vote_option }}" for this proposal
    - - @@ -151,7 +173,9 @@

    {{ lastedItem.content.title }}

    -
    Voting Start
    -
    {{ lastedItem.voting_start_time | customDate : 'yyyy-MM-dd' - }} + }}
    {{ lastedItem.voting_start_time | customDate : 'HH:mm:ss' - }} + }}
    -
    -
    Voting End
    -
    {{ lastedItem.voting_end_time | customDate : 'yyyy-MM-dd' }}
    {{ lastedItem.voting_end_time | customDate : 'HH:mm:ss' }}
    -
    -
    @@ -207,17 +235,28 @@

      -
    • -
    • -
    • -
    • +
    • @@ -225,7 +264,8 @@

    Most voted on
    -
    ).class }}"> {{ - getHighestVote( - lastedItem.tally?.yes, - lastedItem.tally?.no, - lastedItem.tally?.no_with_veto, - lastedItem.tally.abstain - ).name + getHighestVote( + lastedItem.tally?.yes, + lastedItem.tally?.no, + lastedItem.tally?.no_with_veto, + lastedItem.tally.abstain + ).name }} {{ - getHighestVote( - lastedItem.tally?.yes, - lastedItem.tally?.no, - lastedItem.tally?.no_with_veto, - lastedItem.tally.abstain - ).value | number : global.formatNumber2Decimal + getHighestVote( + lastedItem.tally?.yes, + lastedItem.tally?.no, + lastedItem.tally?.no_with_veto, + lastedItem.tally.abstain + ).value | number : global.formatNumber2Decimal }}%
    @@ -257,7 +297,8 @@

    - @@ -309,7 +349,8 @@

    Proposals

    - + From 4f679999cd792beaebfe89b0a59b32cc2f528dce Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Tue, 20 Jun 2023 10:06:54 +0700 Subject: [PATCH 145/315] change color dashboard notice-warning --- src/app/layouts/horizontaltopbar/menu.ts | 4 +- .../block-detail/block-detail.component.scss | 19 +++-- .../transaction-messages.component.scss | 38 +++++++-- src/assets/config/config.json | 82 +++++++------------ 4 files changed, 76 insertions(+), 67 deletions(-) diff --git a/src/app/layouts/horizontaltopbar/menu.ts b/src/app/layouts/horizontaltopbar/menu.ts index ebc0106b9..03232106d 100644 --- a/src/app/layouts/horizontaltopbar/menu.ts +++ b/src/app/layouts/horizontaltopbar/menu.ts @@ -26,7 +26,7 @@ export const MENU: MenuItem[] = [ id: 1, label: 'MENUITEMS.DASHBOARDS', icon: 'squares-four', - link: '/dashboard', + link: '/', name: MenuName.Dashboard, }, { @@ -172,7 +172,7 @@ export const MENU_MOB: MenuItem[] = [ id: 1, label: 'MENUITEMS.DASHBOARDS', icon: 'squares-four', - link: '/dashboard', + link: '/', name: MenuName.Dashboard, }, { diff --git a/src/app/pages/blocks/block-detail/block-detail.component.scss b/src/app/pages/blocks/block-detail/block-detail.component.scss index 5d7d5ec7f..f46abffc9 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.scss +++ b/src/app/pages/blocks/block-detail/block-detail.component.scss @@ -34,18 +34,17 @@ &::before { content: ''; position: absolute; - left: 2px; + left: 2.15px; top: 0; - bottom: 0; + bottom: 10px; width: 2px; - border: 1px dashed gray; + border-right: 2.5px dashed gray; } &::after { content: ''; position: absolute; left: -5px; bottom: -1px; - width: 2px; width: 0; height: 0; border-left: 8px solid transparent; @@ -54,6 +53,14 @@ border-radius: 3px; } } +::ng-deep mat-expansion-panel:last-child .mat-expansion-panel-content .content-log { + &::before { + bottom: 4px; + } + &::after { + content: unset; + } +} .mat-expansion-panel { background: none; @@ -66,13 +73,13 @@ .txt-header::after { font-family: 'Font Awesome 5 Free'; font-weight: 700; - content: '\f077'; + content: '\f078'; color: var(--aura-gray-1); font-size: 13px; } &[aria-expanded='true'] { .txt-header::after { - content: '\f078'; + content: '\f077'; } } } diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 84489c4c9..33ac79167 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -127,18 +127,17 @@ &::before { content: ''; position: absolute; - left: 2px; + left: 2.15px; top: 0; - bottom: 0; + bottom: 10px; width: 2px; - border: 1px dashed gray; + border-right: 2.5px dashed gray; } &::after { content: ''; position: absolute; left: -5px; bottom: -1px; - width: 2px; width: 0; height: 0; border-left: 8px solid transparent; @@ -147,8 +146,33 @@ border-radius: 3px; } } +mat-expansion-panel:last-child .mat-expansion-panel-content .content-log { + &::before { + bottom: 4px; + } + &::after { + content: unset; + } +} +.mat-slide-toggle-bar { + height: 20px !important; + border-radius: 12px !important; +} +.mat-slide-toggle-thumb-container { + width: 14px !important; + height: 14px !important; + top: 3px !important; + transform: translate3d(6px, 0, 0) !important; +} +.mat-slide-toggle.mat-checked .mat-slide-toggle-thumb-container { + transform: translate3d(16px, 0, 0) !important; +} -.mat-slide-toggle.mat-checked .mat-slide-toggle-bar{ +.mat-slide-toggle-thumb { + width: 14px !important; + height: 14px !important; +} +.mat-slide-toggle.mat-checked .mat-slide-toggle-bar { background-color: #2BBBA3; } @@ -167,13 +191,13 @@ .txt-header::after { font-family: 'Font Awesome 5 Free'; font-weight: 700; - content: '\f077'; + content: '\f078'; color: var(--aura-gray-1); font-size: 13px; } &[aria-expanded='true'] { .txt-header::after { - content: '\f078'; + content: '\f077'; } } } diff --git a/src/assets/config/config.json b/src/assets/config/config.json index b3e682244..c994be063 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -1,28 +1,29 @@ { "fabric": "", - "cosmos": "https://explorer-api.dev.aura.network/api/v1", - "chainId": "aura-testnet-2", + "cosmos": "https://serenity-api.aurascan.io/api/v1", + "chainId": "serenity-testnet-001", "timeStaking": "86400", - "env": "dev", - "urlSocket": "https://explorer-api.dev.aura.network", + "urlSocket": "https://serenity-api.aurascan.io", + "env": "serenity", "validator_s3": "https://validator-logos.s3.ap-southeast-1.amazonaws.com", - "coins": [ - { - "name": "Serenity Aura", - "display": "AURA", - "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", + "coins":[ + {"name": "Test Aura", + "display": "TAURA", + "denom": "ibc/6DF434CD72825125ACECEA86BF4A15DCF7CA0DE257C7683AF2A550D2BE34F79D", "decimal": 6, - "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" - } + "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png"}, + {"name": "Test Aura 2", + "display": "TAURA", + "denom": "ibc/88157C3B5E7755BF1ED3756691F96DE13780973B7061BBCA837665D97666F75C", + "decimal": 6, + "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png"} ], "chain_info": { - "chainId": "aura-testnet-2", - "chainName": "aura devnet", - "rpc": "https://rpc.dev.aura.network", - "rest": "https://lcd.dev.aura.network", - "bip44": { - "coinType": 118 - }, + "chainId": "serenity-testnet-001", + "chainName": "Aura serenity testnet", + "rpc": "https://rpc.serenity.aura.network", + "rest": "https://lcd.serenity.aura.network", + "bip44": { "coinType": 118 }, "bech32Config": { "bech32PrefixAccAddr": "aura", "bech32PrefixAccPub": "aurapub", @@ -31,45 +32,22 @@ "bech32PrefixConsAddr": "auravalcons", "bech32PrefixConsPub": "auravalconspub" }, - "currencies": [ - { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - } - ], - "feeCurrencies": [ - { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - } - ], - "stakeCurrency": { - "coinDenom": "TAURA", - "coinMinimalDenom": "utaura", - "coinDecimals": 6 - }, + "currencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], + "feeCurrencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], + "stakeCurrency": { "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }, "coinType": 118, - "gasPriceStep": { - "low": 0.001, - "average": 0.0025, - "high": 0.004 - }, + "gasPriceStep": { "low": 0.001, "average": 0.0025, "high": 0.004 }, "features": ["ibc-transfer"], - "walletUrlForStaking": "https://explorer.dev.aura.network/validators", + "walletUrlForStaking": "https://serenity.aurascan.io/validators", "logo": "https://i.imgur.com/zi0mTYb.png", - "explorer": "https://explorer.dev.aura.network/" + "explorer": "https://serenity.aurascan.io/" }, - "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", - "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", - "timeInterval": 4000, + "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/serenity-assets/", + "urlIndexer": "https://indexer.staging.aurascan.io/api/v1", + "timeInterval": 2000, "ipfsDomain": "https://ipfs.io/", - "evnLabel": { - "desktop": "Develop Testnet Network", - "mobile": "Develop Testnet" - }, - "horoscopeSelectedChain": "auratestnet", + "evnLabel": { "desktop": "Serenity Testnet Network", "mobile": "Serenity Testnet" }, + "horoscopeSelectedChain": "serenity", "horoscopeUrl": "https://indexer-v2.dev.aurascan.io/", "horoscopePathGraphql": "api/v1/graphiql", "horoscopePathApi": "api/v1", From 3917e431b31fbaa11c35e6ffa6de2e6daba17740 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 20 Jun 2023 10:14:34 +0700 Subject: [PATCH 146/315] revert code --- src/assets/config/config.json | 82 ++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/src/assets/config/config.json b/src/assets/config/config.json index c994be063..b3e682244 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -1,29 +1,28 @@ { "fabric": "", - "cosmos": "https://serenity-api.aurascan.io/api/v1", - "chainId": "serenity-testnet-001", + "cosmos": "https://explorer-api.dev.aura.network/api/v1", + "chainId": "aura-testnet-2", "timeStaking": "86400", - "urlSocket": "https://serenity-api.aurascan.io", - "env": "serenity", + "env": "dev", + "urlSocket": "https://explorer-api.dev.aura.network", "validator_s3": "https://validator-logos.s3.ap-southeast-1.amazonaws.com", - "coins":[ - {"name": "Test Aura", - "display": "TAURA", - "denom": "ibc/6DF434CD72825125ACECEA86BF4A15DCF7CA0DE257C7683AF2A550D2BE34F79D", + "coins": [ + { + "name": "Serenity Aura", + "display": "AURA", + "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", "decimal": 6, - "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png"}, - {"name": "Test Aura 2", - "display": "TAURA", - "denom": "ibc/88157C3B5E7755BF1ED3756691F96DE13780973B7061BBCA837665D97666F75C", - "decimal": 6, - "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png"} + "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" + } ], "chain_info": { - "chainId": "serenity-testnet-001", - "chainName": "Aura serenity testnet", - "rpc": "https://rpc.serenity.aura.network", - "rest": "https://lcd.serenity.aura.network", - "bip44": { "coinType": 118 }, + "chainId": "aura-testnet-2", + "chainName": "aura devnet", + "rpc": "https://rpc.dev.aura.network", + "rest": "https://lcd.dev.aura.network", + "bip44": { + "coinType": 118 + }, "bech32Config": { "bech32PrefixAccAddr": "aura", "bech32PrefixAccPub": "aurapub", @@ -32,22 +31,45 @@ "bech32PrefixConsAddr": "auravalcons", "bech32PrefixConsPub": "auravalconspub" }, - "currencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], - "feeCurrencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], - "stakeCurrency": { "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }, + "currencies": [ + { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + } + ], + "feeCurrencies": [ + { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + } + ], + "stakeCurrency": { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + }, "coinType": 118, - "gasPriceStep": { "low": 0.001, "average": 0.0025, "high": 0.004 }, + "gasPriceStep": { + "low": 0.001, + "average": 0.0025, + "high": 0.004 + }, "features": ["ibc-transfer"], - "walletUrlForStaking": "https://serenity.aurascan.io/validators", + "walletUrlForStaking": "https://explorer.dev.aura.network/validators", "logo": "https://i.imgur.com/zi0mTYb.png", - "explorer": "https://serenity.aurascan.io/" + "explorer": "https://explorer.dev.aura.network/" }, - "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/serenity-assets/", - "urlIndexer": "https://indexer.staging.aurascan.io/api/v1", - "timeInterval": 2000, + "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", + "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", + "timeInterval": 4000, "ipfsDomain": "https://ipfs.io/", - "evnLabel": { "desktop": "Serenity Testnet Network", "mobile": "Serenity Testnet" }, - "horoscopeSelectedChain": "serenity", + "evnLabel": { + "desktop": "Develop Testnet Network", + "mobile": "Develop Testnet" + }, + "horoscopeSelectedChain": "auratestnet", "horoscopeUrl": "https://indexer-v2.dev.aurascan.io/", "horoscopePathGraphql": "api/v1/graphiql", "horoscopePathApi": "api/v1", From 6c349fdea9abd958a135899452874806454c25bd Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 20 Jun 2023 14:14:54 +0700 Subject: [PATCH 147/315] [TamTM6] update layout ibc detail, cw4973 call horoscrope, layout soulbound validator detail --- src/app/core/services/common.service.ts | 8 +- src/app/core/services/contract.service.ts | 4 +- .../contract-verify-steps.component.ts | 2 +- .../nft-detail/nft-detail.component.html | 41 ++---- .../token/nft-detail/nft-detail.component.ts | 126 +++++++----------- .../messages-item.component.html | 2 +- .../transaction-messages.component.html | 8 +- .../transaction-messages.component.ts | 23 ++-- .../validators-detail.component.html | 1 + .../soulbound-feature-tokens.component.html | 8 +- .../soulbound-feature-tokens.component.scss | 8 +- .../soulbound-feature-tokens.component.ts | 1 + 12 files changed, 105 insertions(+), 127 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index a6e3c4dd6..0fa8175b3 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -83,10 +83,16 @@ export class CommonService { } mappingNameIBC(value) { + try { + let temp = value?.match(/\d+/g)[0]; + value = value?.replace(temp, ''); + } catch {} + let result = { display: value, decimals: 6 }; if (value.indexOf('ibc') >= 0) { let temp = value.slice(value.indexOf('ibc')); - result = this.coins.find((k) => k.denom === temp); + result = this.coins.find((k) => k.denom === temp) || {}; + result.display = result.display || value; } else { result = { display: this.chainInfo.currencies[0].coinDenom, decimals: 6 }; } diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index bc64e0da8..2ad2c34b1 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -239,11 +239,11 @@ export class ContractService extends CommonService { return this.http.get(`${this.apiUrl}/contracts/${contractAddress}/nft/${tokenId}`); } - getDetailCW721(address, tokenId): Observable { + getNFTDetail(address, tokenId): Observable { const contractDoc = ` query CW721Owner($address: String, $tokenId: String) { ${this.envDB} { - data: cw721_token(where: { cw721_contract: {smart_contract: {address: {_eq: $address}, name: {_neq: "crates.io:cw4973"}}}, token_id: {_eq: $tokenId}}) { + data: cw721_token(where: { cw721_contract: {smart_contract: {address: {_eq: $address}}}, token_id: {_eq: $tokenId}}) { id token_id owner diff --git a/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts b/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts index 9fb523410..2f4da3983 100644 --- a/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts +++ b/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts @@ -46,10 +46,10 @@ export class ContractVerifyStepsComponent implements OnInit { className: this.getClassName(dta.result), })); - let stepTemp = this.steps.find((dta) => dta.result !== 'Success')?.check_id; if (stepTemp) { this.currentStep = stepTemp - 1 > 0 ? stepTemp - 1 : 0; + this.steps[this.currentStep].className = 'isProcessing'; } else { this.currentStep = 8; this.isVerifySuccess.emit(true); diff --git a/src/app/pages/token/nft-detail/nft-detail.component.html b/src/app/pages/token/nft-detail/nft-detail.component.html index fe107f753..721cfbc0f 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.html +++ b/src/app/pages/token/nft-detail/nft-detail.component.html @@ -11,10 +11,10 @@

    #{{ nftDetail?.token_id | cutStringPipe : 8 : 8 }} {{ nftDetail?.nftName }} - - Burnt + Burnt

    Status -
    {{ getStatus(element.status).value }}
    @@ -320,13 +361,15 @@

    Proposals

    Voting Start -
    {{ element.voting_start_time | customDate : 'yyyy-MM-dd' }}
    {{ element.voting_start_time | customDate : 'HH:mm:ss' }}
    -
    -
    @@ -365,56 +408,58 @@

    Proposals

    - + - - -
    - +
    +
    -
    - \ No newline at end of file diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index e2e288d76..90642f030 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -2,23 +2,22 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { ViewportScroller } from '@angular/common'; import { Component, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import * as moment from 'moment'; +import { tap } from 'rxjs/operators'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { CommonService } from 'src/app/core/services/common.service'; +import { TransactionService } from 'src/app/core/services/transaction.service'; import { Globals } from '../../../app/global/global'; import { PROPOSAL_STATUS, PROPOSAL_VOTE, VOTE_OPTION } from '../../core/constants/proposal.constant'; import { EnvironmentService } from '../../core/data-services/environment.service'; import { TableTemplate } from '../../core/models/common.model'; import { IProposal } from '../../core/models/proposal.model'; -import { DialogService } from '../../core/services/dialog.service'; import { ProposalService } from '../../core/services/proposal.service'; import { WalletService } from '../../core/services/wallet.service'; import { balanceOf } from '../../core/utils/common/parsing'; import { ProposalVoteComponent } from './proposal-vote/proposal-vote.component'; -import { TransactionService } from 'src/app/core/services/transaction.service'; -import { tap } from 'rxjs/operators'; @Component({ selector: 'app-proposal', @@ -54,12 +53,9 @@ export class ProposalComponent implements OnInit { displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); dataSource: MatTableDataSource = new MatTableDataSource([]); - // dataSourceMobile: any[]; proposalData: any; length: number; nextKey = null; - // isLoadingAction = false; - // pageYOffset = 0; scrolling = false; pageData: PageEvent = { @@ -67,14 +63,6 @@ export class ProposalComponent implements OnInit { pageSize: this.layout.isMatched([Breakpoints.Small, Breakpoints.XSmall]) ? 5 : 10, pageIndex: 1, }; - // proposalVotes: { - // proId: number; - // vote: string | null; - // }[] = []; - - // @HostListener('window:scroll', ['$event']) onScroll(event) { - // this.pageYOffset = window.pageYOffset; - // } denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; constructor( private proposalService: ProposalService, @@ -82,7 +70,6 @@ export class ProposalComponent implements OnInit { public global: Globals, public walletService: WalletService, private environmentService: EnvironmentService, - private dlgService: DialogService, private layout: BreakpointObserver, private scroll: ViewportScroller, public commonService: CommonService, From accd865d9a5cbcafab09338093475a38de60dd79 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 19 Jun 2023 09:49:44 +0700 Subject: [PATCH 133/315] update paginator community pool proposal --- src/app/core/services/proposal.service.ts | 48 +------------------ .../community-pool-proposal.component.ts | 8 +--- src/app/pages/proposal/proposal.component.ts | 4 +- 3 files changed, 5 insertions(+), 55 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 1531fb2ed..bf32c99e6 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -54,53 +54,7 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getProposalData(payload) { - const operationsDoc = ` - query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $type: String = null) { - ${this.envDB} { - proposal(limit: $limit, where: {proposal_id: {_eq: $proposalId, _lt: $nextKey}, type: {_eq: $type}, status: {_neq: "PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT"}}, order_by: {proposal_id: $order}) { - content - deposit_end_time - description - initial_deposit - proposal_id - proposer_address - count_vote - proposer { - description - operator_address - account_address - } - status - submit_time - tally - title - total_deposit - turnout - type - updated_at - voting_end_time - voting_start_time - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: payload.limit, - order: 'desc', - nextKey: payload.nextKey, - proposalId: payload.proposalId, - type: payload.type, - }, - operationName: 'auratestnet_proposal', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - getProposalData2({ + getProposalData({ limit, offset, proposalId, diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts index b2ec91113..8e147e6a8 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -10,7 +10,6 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { TableTemplate } from 'src/app/core/models/common.model'; import { CommonService } from 'src/app/core/services/common.service'; import { ProposalService } from 'src/app/core/services/proposal.service'; -import { TokenService } from 'src/app/core/services/token.service'; import { shortenAddress } from 'src/app/core/utils/common/shorten'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; @@ -38,7 +37,6 @@ export class CommunityPoolProposalComponent implements OnInit { pageSize: 10, pageIndex: 1, }; - length: number; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]).pipe( tap((state) => { this.pageData = { @@ -50,8 +48,8 @@ export class CommunityPoolProposalComponent implements OnInit { this.getListProposal({ index: 1 }); }), ); + length: number; dataSource: MatTableDataSource; - dataSourceMob: any[]; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; listCoin = this.environmentService.configValue.coins; statusConstant = PROPOSAL_STATUS; @@ -59,7 +57,6 @@ export class CommunityPoolProposalComponent implements OnInit { constructor( public translate: TranslateService, - public tokenService: TokenService, private environmentService: EnvironmentService, private layout: BreakpointObserver, private proposalService: ProposalService, @@ -68,7 +65,6 @@ export class CommunityPoolProposalComponent implements OnInit { ngOnInit(): void { this.getAddressDistribution(); - // this.getListProposal({ index: 1 }); } async getAddressDistribution() { @@ -102,7 +98,7 @@ export class CommunityPoolProposalComponent implements OnInit { offset: (index - 1) * this.pageData.pageSize, type: '/cosmos.distribution.v1beta1.CommunityPoolSpendProposal', }; - this.proposalService.getProposalData2(payload).subscribe((res) => { + this.proposalService.getProposalData(payload).subscribe((res) => { if (res?.proposal) { this.dataSource = new MatTableDataSource(res.proposal); } diff --git a/src/app/pages/proposal/proposal.component.ts b/src/app/pages/proposal/proposal.component.ts index 90642f030..5df8c8352 100644 --- a/src/app/pages/proposal/proposal.component.ts +++ b/src/app/pages/proposal/proposal.component.ts @@ -82,7 +82,7 @@ export class ProposalComponent implements OnInit { getFourLastedProposal() { this.proposalService - .getProposalData2({ + .getProposalData({ limit: 4, }) .subscribe((res) => { @@ -126,7 +126,7 @@ export class ProposalComponent implements OnInit { getListProposal({ index }) { this.proposalService - .getProposalData2({ + .getProposalData({ limit: this.pageData.pageSize, offset: (index - 1) * this.pageData.pageSize, }) From 03ed7cc5ba4be8abd66c78994aab9a2dbd4c2ad2 Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Mon, 19 Jun 2023 13:05:50 +0700 Subject: [PATCH 134/315] update proposal --- src/app/core/services/validator.service.ts | 22 +++- .../depositors/depositors.component.ts | 15 ++- .../summary-info/summary-info.component.ts | 34 +++--- .../validators-votes.component.ts | 101 ++++++++++++++---- .../proposal-detail/votes/votes.component.ts | 32 +++--- .../proposal-table.component.ts | 40 ++++--- src/assets/config/config.json | 78 ++++++++------ 7 files changed, 208 insertions(+), 114 deletions(-) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 893352ef1..6ea822c5e 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -7,7 +7,7 @@ import { EnvironmentService } from 'src/app/core/data-services/environment.servi import { CommonService } from 'src/app/core/services/common.service'; import { LCD_COSMOS } from '../constants/url.constant'; import { Globals } from 'src/app/global/global'; -import { map } from 'rxjs/operators'; +import { map, shareReplay, tap } from 'rxjs/operators'; @Injectable({ providedIn: 'root', @@ -17,6 +17,15 @@ export class ValidatorService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; stakingAPRSubject: BehaviorSubject; + private cachedValidator$: Observable< + [ + { + image_url: string; + operator_address: string; + }, + ] + >; + constructor( private http: HttpClient, private environmentService: EnvironmentService, @@ -149,7 +158,14 @@ export class ValidatorService extends CommonService { } getValidatorInfoByList(addressList: string[]): Observable { - return this.http.get(`${this.apiUrl}/validators/validator-info?address=${addressList}`); + // Cache validator info, only get on the first time + if (!this.cachedValidator$) { + this.cachedValidator$ = this.http + .get(`${this.apiUrl}/validators/validator-info?address=${addressList}`) + .pipe(shareReplay(1)); + } + + return this.cachedValidator$; } getUptimeLCD(block = null) { @@ -181,7 +197,7 @@ export class ValidatorService extends CommonService { variables: { cons_address: consAddress, limit: limit, - height: height + height: height, }, operationName: 'MyQuery', }) diff --git a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts index 3e7c97bd8..c7984b116 100644 --- a/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts +++ b/src/app/pages/proposal/proposal-detail/depositors/depositors.component.ts @@ -1,6 +1,7 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Component, Input, OnInit } from '@angular/core'; -import { debounceTime } from 'rxjs/operators'; +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; import { PROPOSAL_TABLE_MODE } from 'src/app/core/constants/proposal.constant'; import { TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; @@ -13,7 +14,7 @@ import { ProposalService } from '../../../../../app/core/services/proposal.servi templateUrl: './depositors.component.html', styleUrls: ['./depositors.component.scss'], }) -export class DepositorsComponent implements OnInit { +export class DepositorsComponent implements OnInit, OnDestroy { @Input() proposalId: number; depositorsList: any[] = []; tableData = []; @@ -24,6 +25,7 @@ export class DepositorsComponent implements OnInit { proposalDeposit = PROPOSAL_TABLE_MODE.DEPOSITORS; pageData = { pageIndex: 0, pageSize: 5 }; + destroyed$ = new Subject(); constructor( private proposalService: ProposalService, @@ -31,13 +33,16 @@ export class DepositorsComponent implements OnInit { private environmentService: EnvironmentService, private transactionService: TransactionService, ) { - this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { + this.proposalService.reloadList$.pipe(takeUntil(this.destroyed$)).subscribe((event) => { if (event) { this.getDepositorsList(); } }); } - + ngOnDestroy(): void { + this.destroyed$.next(); + this.destroyed$.complete(); + } ngOnInit() { this.getDepositorsList(); } diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 5687e82f4..883087ab0 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -4,8 +4,8 @@ import { AfterViewChecked, Component, EventEmitter, Input, OnInit, Output } from import { MatDialog } from '@angular/material/dialog'; import * as _ from 'lodash'; import * as moment from 'moment'; -import { from } from 'rxjs'; -import { map, mergeMap } from 'rxjs/operators'; +import { from, interval } from 'rxjs'; +import { map, mergeMap, takeUntil } from 'rxjs/operators'; import { TransactionService } from 'src/app/core/services/transaction.service'; import { Globals } from '../../../../../app/global/global'; import { @@ -64,6 +64,14 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { ngOnInit(): void { this.getProposalDetail(); this.walletService.wallet$.subscribe((wallet) => this.getVotedProposal()); + + interval(30000) + .pipe() + .subscribe((r) => { + this.proposalService.reloadList(); + this.getProposalDetail(); + this.getVotedProposal(); + }); } getProposalDetail(): void { @@ -170,17 +178,17 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } //set interval reload when type = voting period or deposit period - if ( - this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD || - this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_DEPOSIT_PERIOD - ) { - this.timerGetUpTime = setInterval(() => { - this.proposalService.reloadList(); - this.getProposalDetail(); - this.getVotedProposal(); - clearInterval(this.timerGetUpTime); - }, 10000); - } + // if ( + // this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD || + // this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_DEPOSIT_PERIOD + // ) { + // this.timerGetUpTime = setInterval(() => { + // this.proposalService.reloadList(); + // this.getProposalDetail(); + // this.getVotedProposal(); + // clearInterval(this.timerGetUpTime); + // }, 10000); + // } }), ) .subscribe({ diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index 080502077..f8c6455b1 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -1,10 +1,12 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Component, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { NgbNav } from '@ng-bootstrap/ng-bootstrap'; -import { debounceTime } from 'rxjs/operators'; +import * as _ from 'lodash'; +import { Subject } from 'rxjs'; +import { map, mergeMap, takeUntil } from 'rxjs/operators'; import { ProposalService } from '../../../../../app/core/services/proposal.service'; import { PROPOSAL_TABLE_MODE, PROPOSAL_VOTE, VOTE_OPTION } from '../../../../core/constants/proposal.constant'; -import * as _ from 'lodash'; +import { ValidatorService } from 'src/app/core/services/validator.service'; export interface IValidatorVotes { rank: number; @@ -19,7 +21,7 @@ export interface IValidatorVotes { templateUrl: './validators-votes.component.html', styleUrls: ['./validators-votes.component.scss'], }) -export class ValidatorsVotesComponent implements OnInit { +export class ValidatorsVotesComponent implements OnInit, OnDestroy { @Input() proposalId: number; @ViewChild('customNav') customNav: NgbNav; PROPOSAL_VOTE_EXT = PROPOSAL_VOTE.concat({ @@ -59,16 +61,30 @@ export class ValidatorsVotesComponent implements OnInit { noWithVeto: null, didNotVote: null, }; + breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); - constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { - this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { + currentTabId = VOTE_OPTION.UNSPECIFIED; + + destroyed$ = new Subject(); + + constructor( + private proposalService: ProposalService, + private layout: BreakpointObserver, + private validatorService: ValidatorService, + ) { + this.proposalService.reloadList$.pipe(takeUntil(this.destroyed$)).subscribe((event) => { if (event) { this.getValidatorVotes(); } }); } + ngOnDestroy(): void { + this.destroyed$.next(); + this.destroyed$.complete(); + } + ngOnInit(): void { this.getValidatorVotes(); } @@ -80,10 +96,48 @@ export class ValidatorsVotesComponent implements OnInit { limit: 100, voteOption, }) + .pipe( + mergeMap((res) => { + const validator = res.validator; + + console.log(res); + const operatorAddressList = validator.map((validator) => validator.operator_address); + + return this.validatorService.getValidatorInfoByList(operatorAddressList).pipe( + map((validatorInfo) => { + const validatorsMap = validator.map((item, index) => { + const validator_name = item.description?.moniker; + const timestamp = _.get(item, 'vote[0].updated_at'); + const vote_option = _.get(item, 'vote[0].vote_option'); + const txhash = _.get(item, 'vote[0].txhash'); + const operator_address = _.get(item, 'operator_address'); + const validator_identity = _.get(item, 'description.identity'); + const rank = index + 1; + const image_url = + _.find(validatorInfo.validator, { operator_address })?.image_url || 'validator-default.svg'; + + return { + validator_name, + timestamp, + vote_option, + txhash, + operator_address, + validator_identity, + rank, + image_url, + }; + }); + return validatorsMap || null; + }), + ); + }), + ) .subscribe( - (res) => { + (validatorVote) => { + console.log(validatorVote); + this.voteDataListLoading = false; - this.loadValidatorVotes(res?.validator); + this.loadValidatorVotes(validatorVote); }, () => {}, () => { @@ -93,20 +147,20 @@ export class ValidatorsVotesComponent implements OnInit { } } - loadValidatorVotes(validator) { - let validatorVote = []; - if (validator) { - validatorVote = validator.map((item, index) => { - const validator_name = item.description?.moniker; - const timestamp = _.get(item, 'vote[0].updated_at'); - const vote_option = _.get(item, 'vote[0].vote_option'); - const txhash = _.get(item, 'vote[0].txhash'); - const operator_address = _.get(item, 'operator_address'); - const validator_identity = _.get(item, 'description.identity'); - const rank = index + 1; - return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity, rank }; - }); - } + loadValidatorVotes(validatorVote) { + // let validatorVote = []; + // if (validator) { + // validatorVote = validator.map((item, index) => { + // const validator_name = item.description?.moniker; + // const timestamp = _.get(item, 'vote[0].updated_at'); + // const vote_option = _.get(item, 'vote[0].vote_option'); + // const txhash = _.get(item, 'vote[0].txhash'); + // const operator_address = _.get(item, 'operator_address'); + // const validator_identity = _.get(item, 'description.identity'); + // const rank = index + 1; + // return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity, rank }; + // }); + // } this.voteData[VOTE_OPTION.UNSPECIFIED] = validatorVote; this.voteData[VOTE_OPTION.YES] = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); @@ -117,7 +171,7 @@ export class ValidatorsVotesComponent implements OnInit { this.voteDataList = validatorVote; - console.log(this.voteData); + this.voteDataList = this.voteData[this.currentTabId]; this.countVote.set(VOTE_OPTION.UNSPECIFIED, this.voteData[VOTE_OPTION.UNSPECIFIED].length); this.countVote.set(VOTE_OPTION.YES, this.voteData[VOTE_OPTION.YES].length); @@ -128,6 +182,7 @@ export class ValidatorsVotesComponent implements OnInit { } changeTab(tabId): void { + this.currentTabId = tabId; this.voteDataList = this.voteData[tabId]; } diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index 7fc03ff20..c1525871d 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -1,7 +1,8 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core'; +import { Component, Input, OnChanges, OnDestroy, SimpleChanges, ViewChild } from '@angular/core'; import { NgbNav } from '@ng-bootstrap/ng-bootstrap'; -import { debounceTime } from 'rxjs/operators'; +import { Subject } from 'rxjs'; +import { takeUntil } from 'rxjs/operators'; import { PROPOSAL_TABLE_MODE, PROPOSAL_VOTE, VOTE_OPTION } from '../../../../core/constants/proposal.constant'; import { ProposalService } from '../../../../core/services/proposal.service'; export interface IVotes { @@ -18,7 +19,7 @@ export interface IVotes { templateUrl: './votes.component.html', styleUrls: ['./votes.component.scss'], }) -export class VotesComponent implements OnChanges { +export class VotesComponent implements OnChanges, OnDestroy { @Input() proposalDetail; @ViewChild('customNav') customNav: NgbNav; @@ -42,9 +43,10 @@ export class VotesComponent implements OnChanges { payloads: { pageIndex?: number; pageLimit?: number; proposalId?: number | string; offset?: number }; breakpoint$ = this.layout.observe([Breakpoints.Small, Breakpoints.XSmall]); + destroyed$ = new Subject(); constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { - this.proposalService.reloadList$.pipe(debounceTime(3000)).subscribe((event) => { + this.proposalService.reloadList$.pipe(takeUntil(this.destroyed$)).subscribe((event) => { if (event) { this.getProposalVoteTotal(); @@ -57,26 +59,18 @@ export class VotesComponent implements OnChanges { }); } + ngOnDestroy(): void { + this.destroyed$.next(); + this.destroyed$.complete(); + } + ngOnChanges(changes: SimpleChanges): void { - if (changes['proposalDetail'].currentValue?.proposal_id) { - this.getListVoteFromIndexer(); + if (changes['proposalDetail'].currentValue?.proposal_id !== changes['proposalDetail'].previousValue?.proposal_id) { + this.pageEventChange({ tabId: 'all', pageIndex: 0, pageSize: 5 }); this.getProposalVoteTotal(); } } - getListVoteFromIndexer() { - const payloads = { - pageLimit: 5, - proposalId: this.proposalDetail.proposal_id, - offset: 0, - pageIndex: 0, - }; - this.proposalService.getListVoteFromIndexer2(payloads, null).subscribe((res) => { - this.voteDataListLoading = false; - this.voteDataList = res.vote; - }); - } - getProposalVoteTotal() { this.proposalService.getProposalVoteTotal(this.proposalDetail.proposal_id).subscribe({ next: (res) => { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 7420dde1d..0ba340cfd 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -131,31 +131,29 @@ export class ProposalTableComponent implements OnInit, OnChanges { // // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); // } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { - const operatorAddArr = this.data.map((i) => i.operator_address); + // const operatorAddArr = this.data.map((i) => i.operator_address); // get ValidatorAddressArr // this.data.forEach((d) => { // operatorAddArr.push(d.operator_address); // }); - - if (operatorAddArr.length > 0) { - // get validator logo - this.validatorService.getValidatorInfoByList(operatorAddArr).subscribe((res) => { - if (res?.data) { - this.validatorImgArr = res?.data; - // push image into validator array - this.dataSource.data.forEach((item) => { - this.validatorImgArr.forEach((imgObj) => { - if (imgObj.operator_address == item.operator_address) { - item['image_url'] = imgObj.image_url; - } - }); - }); - - // this.cdr.markForCheck(); - } - }); - } - + // if (operatorAddArr.length > 0) { + // // get validator logo + // this.validatorService.getValidatorInfoByList(operatorAddArr).subscribe((res) => { + // console.log(res); + // if (res?.data) { + // this.validatorImgArr = res?.data; + // // push image into validator array + // this.dataSource.data.forEach((item) => { + // this.validatorImgArr.forEach((imgObj) => { + // if (imgObj.operator_address == item.operator_address) { + // item['image_url'] = imgObj.image_url; + // } + // }); + // }); + // // this.cdr.markForCheck(); + // } + // }); + // } // minus = this.getUpdatePage( // changes.data.currentValue?.length, // this.proposalService.pageIndexObj[this.type][this.tabId], diff --git a/src/assets/config/config.json b/src/assets/config/config.json index 07e398a3e..b3e682244 100644 --- a/src/assets/config/config.json +++ b/src/assets/config/config.json @@ -1,33 +1,28 @@ { "fabric": "", - "cosmos": "https://serenity-api.aurascan.io/api/v1", - "chainId": "serenity-testnet-001", + "cosmos": "https://explorer-api.dev.aura.network/api/v1", + "chainId": "aura-testnet-2", "timeStaking": "86400", - "urlSocket": "https://serenity-api.aurascan.io", - "env": "serenity", + "env": "dev", + "urlSocket": "https://explorer-api.dev.aura.network", "validator_s3": "https://validator-logos.s3.ap-southeast-1.amazonaws.com", "coins": [ { - "name": "Test Aura", - "display": "TAURA", - "denom": "ibc/6DF434CD72825125ACECEA86BF4A15DCF7CA0DE257C7683AF2A550D2BE34F79D", - "decimal": 6, - "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" - }, - { - "name": "Test Aura 2", - "display": "TAURA", - "denom": "ibc/88157C3B5E7755BF1ED3756691F96DE13780973B7061BBCA837665D97666F75C", + "name": "Serenity Aura", + "display": "AURA", + "denom": "ibc/40CA5EF447F368B7F2276A689383BE3C427B15395D4BF6639B605D36C0846A20", "decimal": 6, "logo": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/token/download.png" } ], "chain_info": { - "chainId": "serenity-testnet-001", - "chainName": "Aura serenity testnet", - "rpc": "https://rpc.serenity.aura.network", - "rest": "https://lcd.serenity.aura.network", - "bip44": { "coinType": 118 }, + "chainId": "aura-testnet-2", + "chainName": "aura devnet", + "rpc": "https://rpc.dev.aura.network", + "rest": "https://lcd.dev.aura.network", + "bip44": { + "coinType": 118 + }, "bech32Config": { "bech32PrefixAccAddr": "aura", "bech32PrefixAccPub": "aurapub", @@ -36,22 +31,45 @@ "bech32PrefixConsAddr": "auravalcons", "bech32PrefixConsPub": "auravalconspub" }, - "currencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], - "feeCurrencies": [{ "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }], - "stakeCurrency": { "coinDenom": "AURA", "coinMinimalDenom": "uaura", "coinDecimals": 6 }, + "currencies": [ + { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + } + ], + "feeCurrencies": [ + { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + } + ], + "stakeCurrency": { + "coinDenom": "TAURA", + "coinMinimalDenom": "utaura", + "coinDecimals": 6 + }, "coinType": 118, - "gasPriceStep": { "low": 0.001, "average": 0.0025, "high": 0.004 }, + "gasPriceStep": { + "low": 0.001, + "average": 0.0025, + "high": 0.004 + }, "features": ["ibc-transfer"], - "walletUrlForStaking": "https://serenity.aurascan.io/validators", + "walletUrlForStaking": "https://explorer.dev.aura.network/validators", "logo": "https://i.imgur.com/zi0mTYb.png", - "explorer": "https://serenity.aurascan.io/" + "explorer": "https://explorer.dev.aura.network/" }, - "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/serenity-assets/", - "urlIndexer": "https://indexer.staging.aurascan.io/api/v1", - "timeInterval": 2000, + "image_s3": "https://aura-explorer-assets.s3.ap-southeast-1.amazonaws.com/dev-assets/", + "urlIndexer": "https://indexer.dev.aurascan.io/api/v1", + "timeInterval": 4000, "ipfsDomain": "https://ipfs.io/", - "evnLabel": { "desktop": "Serenity Testnet Network", "mobile": "Serenity Testnet" }, - "horoscopeSelectedChain": "serenity", + "evnLabel": { + "desktop": "Develop Testnet Network", + "mobile": "Develop Testnet" + }, + "horoscopeSelectedChain": "auratestnet", "horoscopeUrl": "https://indexer-v2.dev.aurascan.io/", "horoscopePathGraphql": "api/v1/graphiql", "horoscopePathApi": "api/v1", From f919e66daaccd45b13d5c0a1387acad5df8857cb Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 19 Jun 2023 15:29:52 +0700 Subject: [PATCH 135/315] update paginator nft list account detail --- src/app/core/services/account.service.ts | 18 ++++- .../account-detail/account-detail.module.ts | 4 +- .../nft-list/nft-list.component.html | 14 ++-- .../nft-list/nft-list.component.ts | 75 ++++--------------- .../contracts-list.component.ts | 1 - 5 files changed, 42 insertions(+), 70 deletions(-) diff --git a/src/app/core/services/account.service.ts b/src/app/core/services/account.service.ts index 79d76e416..031a7ac2a 100644 --- a/src/app/core/services/account.service.ts +++ b/src/app/core/services/account.service.ts @@ -5,6 +5,7 @@ import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; import { map } from 'rxjs/operators'; import { TYPE_CW4973 } from '../constants/contract.constant'; +import { LENGTH_CHARACTER } from '../constants/common.constant'; @Injectable() export class AccountService extends CommonService { @@ -23,24 +24,27 @@ export class AccountService extends CommonService { } getAssetCW721ByOwner(payload): Observable { + if (payload.keyword?.length >= LENGTH_CHARACTER.ADDRESS) { + payload.contractAddress = payload.keyword; + } else if (payload.keyword?.length > 0) { + payload.token_id = payload.keyword; + } const operationsDoc = ` query Query( $contract_address: String $limit: Int = 10 - $nextKeyLastUpdatedHeight: Int = null - $nextKeyId: Int = null $tokenId: String = null $owner: String = null + $offset: Int = 0 ) { ${this.envDB} { cw721_token( limit: $limit + offset: $offset where: { cw721_contract: { smart_contract: { address: { _eq: $contract_address }, name: {_neq: "${TYPE_CW4973}"} } } - id: { _lt: $nextKeyId } - last_updated_height: { _lt: $nextKeyLastUpdatedHeight } token_id: { _eq: $tokenId } owner: { _eq: $owner } } @@ -62,6 +66,11 @@ export class AccountService extends CommonService { } } } + cw721_token_aggregate(where: {cw721_contract: {smart_contract: {address: {_eq: $contract_address}, name: {_neq: "${TYPE_CW4973}"}}}, token_id: {_eq: $tokenId}, owner: {_eq: $owner}}, order_by: [{last_updated_height: desc}, {id: desc}]) { + aggregate { + count + } + } } } `; @@ -75,6 +84,7 @@ export class AccountService extends CommonService { nextKeyId: payload?.nextKeyId, tokenId: payload?.token_id, owner: payload?.owner, + offset: payload.offset }, operationName: 'Query', }) diff --git a/src/app/pages/account/account-detail/account-detail.module.ts b/src/app/pages/account/account-detail/account-detail.module.ts index 30fff170a..505337266 100644 --- a/src/app/pages/account/account-detail/account-detail.module.ts +++ b/src/app/pages/account/account-detail/account-detail.module.ts @@ -7,6 +7,7 @@ import { NgApexchartsModule } from 'ng-apexcharts'; import { NgxMaskModule } from 'ngx-mask'; import { SimplebarAngularModule } from 'simplebar-angular'; import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; import { NftCardModule } from 'src/app/shared/components/cards/nft-card/nft-card.module'; import { SoulboundFeatureTokensModule } from 'src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.module'; import { MaterialModule } from '../../../app.module'; @@ -45,7 +46,8 @@ import { TokenTableComponent } from './token-table/token-table.component'; NftCardModule, NgxMaskModule, SoulboundFeatureTokensModule, - CommonDirectiveModule + CommonDirectiveModule, + APaginatorModule, ], providers: [TransactionService, AccountService, DecimalPipe], }) diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.html b/src/app/pages/account/account-detail/nft-list/nft-list.component.html index 4782bb41c..65e0b025c 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.html +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.html @@ -1,4 +1,4 @@ -

    NFTs ({{ nftList?.length || 0 }} NFTs and more)

    +

    NFTs ({{ pageData?.length || 0 }} NFTs)

    @@ -35,12 +35,12 @@

    NFTs ({{ nftList?.length || 0 }} 0; else noValues"> +
    -
    +
    NFTs ({{ nftList?.length || 0 }} - +
    + +
    diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts index 53ac218ef..40dbf53cb 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.ts +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.ts @@ -17,21 +17,16 @@ export class NftListComponent implements OnChanges { @Input() address: string; @Output() totalValueNft = new EventEmitter(); image_s3 = this.environmentService.configValue.image_s3; - assetCW721: any[]; searchValue = ''; loading = true; pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; nftList = []; - showedData = []; maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; totalValue = 0; - nextKey = null; - currentKey = null; - isHandleSearch = false; constructor( private accountService: AccountService, @@ -41,37 +36,24 @@ export class NftListComponent implements OnChanges { ngOnChanges(changes: SimpleChanges): void { if (changes.address) { - this.nftList = []; - this.showedData = []; - this.pageData.pageIndex = PAGE_EVENT.PAGE_INDEX; - this.pageData.pageSize = 20; - this.nextKey = null; - this.currentKey = null; + this.pageEvent(0); } - this.getNftData(); } - getNftData(nextKey = null) { + getNftData() { this.searchValue = this.searchValue?.trim(); - const payload = { owner: this.address, - limit: 100, + limit: this.pageData.pageSize, keyword: this.searchValue, - next_key: nextKey, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, }; + this.accountService.getAssetCW721ByOwner(payload).subscribe( (res) => { if (res?.cw721_token?.length > 0) { - if (res?.cw721_token?.length >= 100) { - this.nextKey = res?.cw721_token[res?.cw721_token?.length - 1].id; - } - if (this.nftList.length > 0) { - this.nftList = [...this.nftList, ...res.cw721_token]; - } else { - this.nftList = res?.cw721_token; - } - this.pageData.length = this.nftList.length; + this.nftList = res?.cw721_token; + this.pageData.length = res.cw721_token_aggregate?.aggregate?.count; this.nftList.forEach((element) => { element.contract_address = _.get(element, 'cw721_contract.smart_contract.address'); @@ -80,58 +62,33 @@ export class NftListComponent implements OnChanges { this.totalValue += element.price * +element.balance || 0; } }); - let start = this.pageData.pageIndex * this.pageData.pageSize; - let end = this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize; - this.showedData = this.nftList.slice(start, end); this.totalValueNft.emit(this.totalValue); } else { - this.nftList.length = 0; + this.pageData.length = 0; } }, () => {}, () => { this.loading = false; - this.isHandleSearch = false; }, ); } resetSearch(): void { this.searchValue = ''; - this.pageData.pageIndex = 0; - this.nftList = []; - this.nextKey = null; - this.getNftData(); + this.pageEvent(0); } searchTokenNft(): void { - if (this.isHandleSearch) { - return; - } - this.isHandleSearch = true; - if (this.pageData.pageIndex !== 0) { - this.pageData.pageIndex = 0; - } else { - this.nextKey = null; - this.nftList = []; - this.getNftData(); - } + this.pageEvent(0); } - handlePageEvent(e: any) { - const { pageIndex, pageSize } = e; - const next = this.pageData.length <= (pageIndex + 2) * pageSize; - - this.pageData.pageIndex = e.pageIndex; - if (next && this.nextKey && this.currentKey !== this.nextKey) { - this.getNftData(this.nextKey); - this.currentKey = this.nextKey; - } else { - this.showedData = this.nftList.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ); + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; } + this.getNftData(); } handleRouterLink(link): void { diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index 8aed0feac..f857bd4a3 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -109,7 +109,6 @@ export class ContractsListComponent implements OnInit, OnDestroy { if (pageIndex === 0) { this.pageData.pageIndex = 1; } - this.getListContract(); } From 69c04f9839e6a2f949c7019e3f784f1c9fe3f09c Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Mon, 19 Jun 2023 16:18:46 +0700 Subject: [PATCH 136/315] update reload --- .../summary-info/summary-info.component.ts | 41 +++++++------- .../validators-votes.component.ts | 34 +++++------- .../proposal-table.component.ts | 53 +------------------ 3 files changed, 37 insertions(+), 91 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 883087ab0..d59dd105b 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -22,6 +22,7 @@ import { ProposalService } from '../../../../core/services/proposal.service'; import { WalletService } from '../../../../core/services/wallet.service'; import { balanceOf } from '../../../../core/utils/common/parsing'; import { ProposalVoteComponent } from '../../proposal-vote/proposal-vote.component'; +import { Bech32 } from '@cosmjs/encoding'; const marked = require('marked'); @Component({ @@ -49,6 +50,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { timerGetUpTime: any; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; + reload$; + constructor( private proposalService: ProposalService, public global: Globals, @@ -64,14 +67,18 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { ngOnInit(): void { this.getProposalDetail(); this.walletService.wallet$.subscribe((wallet) => this.getVotedProposal()); + } - interval(30000) - .pipe() - .subscribe((r) => { - this.proposalService.reloadList(); - this.getProposalDetail(); - this.getVotedProposal(); - }); + enabledReload() { + if (!this.reload$) { + this.reload$ = interval(10000) + .pipe() + .subscribe((r) => { + this.proposalService.reloadList(); + this.getProposalDetail(); + this.getVotedProposal(); + }); + } } getProposalDetail(): void { @@ -79,6 +86,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { limit: 1, proposalId: this.proposalId, }; + this.proposalService .getProposalData(payload) .pipe( @@ -177,18 +185,13 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { this.proposalDtl.emit(this.proposalDetail); } - //set interval reload when type = voting period or deposit period - // if ( - // this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD || - // this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_DEPOSIT_PERIOD - // ) { - // this.timerGetUpTime = setInterval(() => { - // this.proposalService.reloadList(); - // this.getProposalDetail(); - // this.getVotedProposal(); - // clearInterval(this.timerGetUpTime); - // }, 10000); - // } + // set interval reload when type = voting period or deposit period + if ( + this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_VOTING_PERIOD || + this.proposalDetail.status === VOTING_STATUS.PROPOSAL_STATUS_DEPOSIT_PERIOD + ) { + this.enabledReload(); + } }), ) .subscribe({ diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index f8c6455b1..172e95210 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -98,9 +98,11 @@ export class ValidatorsVotesComponent implements OnInit, OnDestroy { }) .pipe( mergeMap((res) => { - const validator = res.validator; + if (!res) { + throw new Error(); + } - console.log(res); + const validator = res.validator; const operatorAddressList = validator.map((validator) => validator.operator_address); return this.validatorService.getValidatorInfoByList(operatorAddressList).pipe( @@ -114,7 +116,7 @@ export class ValidatorsVotesComponent implements OnInit, OnDestroy { const validator_identity = _.get(item, 'description.identity'); const rank = index + 1; const image_url = - _.find(validatorInfo.validator, { operator_address })?.image_url || 'validator-default.svg'; + _.find(validatorInfo.data, { operator_address })?.image_url || 'validator-default.svg'; return { validator_name, @@ -134,34 +136,24 @@ export class ValidatorsVotesComponent implements OnInit, OnDestroy { ) .subscribe( (validatorVote) => { - console.log(validatorVote); - this.voteDataListLoading = false; this.loadValidatorVotes(validatorVote); }, - () => {}, - () => { + (_error) => { this.voteDataListLoading = false; + + this.countVote.set(VOTE_OPTION.UNSPECIFIED, 0); + this.countVote.set(VOTE_OPTION.YES, 0); + this.countVote.set(VOTE_OPTION.ABSTAIN, 0); + this.countVote.set(VOTE_OPTION.NO, 0); + this.countVote.set(VOTE_OPTION.NO_WITH_VETO, 0); + this.countVote.set(VOTE_OPTION.NULL, 0); }, ); } } loadValidatorVotes(validatorVote) { - // let validatorVote = []; - // if (validator) { - // validatorVote = validator.map((item, index) => { - // const validator_name = item.description?.moniker; - // const timestamp = _.get(item, 'vote[0].updated_at'); - // const vote_option = _.get(item, 'vote[0].vote_option'); - // const txhash = _.get(item, 'vote[0].txhash'); - // const operator_address = _.get(item, 'operator_address'); - // const validator_identity = _.get(item, 'description.identity'); - // const rank = index + 1; - // return { validator_name, timestamp, vote_option, txhash, operator_address, validator_identity, rank }; - // }); - // } - this.voteData[VOTE_OPTION.UNSPECIFIED] = validatorVote; this.voteData[VOTE_OPTION.YES] = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.YES); this.voteData[VOTE_OPTION.ABSTAIN] = validatorVote.filter((f) => f.vote_option === VOTE_OPTION.ABSTAIN); diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 0ba340cfd..90839ebb3 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -109,6 +109,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { element.timestamp = element?.transaction?.timestamp || element.timestamp || element.updated_at; element.updated_at = null; }); + if (this.dataSource) { this.dataSource.data = this.data; } else { @@ -118,62 +119,12 @@ export class ProposalTableComponent implements OnInit, OnChanges { if (changes.tabId?.currentValue != changes.tabId?.previousValue) { this.pageData.pageIndex = 1; } - - // // let minus = 0; - // if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { - // // minus = this.getUpdatePage(changes.data.currentValue?.length, this.proposalService.pageIndexObj[this.type]); - // // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type] || 0) - minus); - // } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { - // // minus = this.getUpdatePage( - // // changes.data.currentValue?.length, - // // this.proposalService.pageIndexObj[this.type][this.tabId], - // // ); - // // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); - // } else - if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { - // const operatorAddArr = this.data.map((i) => i.operator_address); - // get ValidatorAddressArr - // this.data.forEach((d) => { - // operatorAddArr.push(d.operator_address); - // }); - // if (operatorAddArr.length > 0) { - // // get validator logo - // this.validatorService.getValidatorInfoByList(operatorAddArr).subscribe((res) => { - // console.log(res); - // if (res?.data) { - // this.validatorImgArr = res?.data; - // // push image into validator array - // this.dataSource.data.forEach((item) => { - // this.validatorImgArr.forEach((imgObj) => { - // if (imgObj.operator_address == item.operator_address) { - // item['image_url'] = imgObj.image_url; - // } - // }); - // }); - // // this.cdr.markForCheck(); - // } - // }); - // } - // minus = this.getUpdatePage( - // changes.data.currentValue?.length, - // this.proposalService.pageIndexObj[this.type][this.tabId], - // ); - // this.pageChange?.selectPage((this.proposalService.pageIndexObj[this.type][this.tabId] || 0) - minus); - } } - // getUpdatePage(data, page): number { - // let minus = 0; - // if (data % 25 !== 0 && Math.ceil(data / this.pageSize) <= page) { - // minus = 1; - // } - // return minus; - // } - ngOnInit(): void { this.template = this.getTemplate(this.type); this.displayedColumns = this.getTemplate(this.type).map((template) => template.matColumnDef); - this.dataSource = new MatTableDataSource(this.data); + // this.dataSource = new MatTableDataSource(this.data); } getTemplate(type: PROPOSAL_TABLE_MODE): Array { From bbe3648e14fbbf745c8619505c565f92503acf8c Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 19 Jun 2023 16:21:18 +0700 Subject: [PATCH 137/315] update paginator nft list code id contracttab --- src/app/core/services/contract.service.ts | 17 +++++++++++------ .../code-id-contracts-tab.component.ts | 6 +++--- src/app/pages/fee-grant/fee-grant.module.ts | 2 -- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 9e4181085..969ca9607 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -67,7 +67,7 @@ export class ContractService extends CommonService { updateQuery = ''; } const operationsDoc = ` - query auratestnet_smart_contract($limit: Int = 100, $offset: Int = 0, $type: [String!], $address: String = null, $creator: String =null) { + query querySmartContractList($limit: Int = 100, $offset: Int = 0, $type: [String!], $address: String = null, $creator: String =null) { ${this.envDB} { smart_contract(limit: $limit, offset: $offset, order_by: {updated_at: desc}, where: {${typeQuery} ${updateQuery} address: {_eq: $address}, creator: {_eq: $creator}}) { address @@ -102,14 +102,14 @@ export class ContractService extends CommonService { creator: creator, address: address, }, - operationName: 'auratestnet_smart_contract', + operationName: 'querySmartContractList', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } loadContractDetail(contractAddress): Observable { const contractDoc = ` - query auratestnet_contract($contractAddress: String = null) { + query queryContractDetail($contractAddress: String = null) { ${this.envDB} { smart_contract(limit: 1, where: {address: {_eq: $contractAddress}}) { address @@ -151,14 +151,14 @@ export class ContractService extends CommonService { variables: { contractAddress: contractAddress, }, - operationName: 'auratestnet_contract', + operationName: 'queryContractDetail', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } getListContractByCode(payload): Observable { const contractDoc = ` - query MyQuery($code_id: Int = 0) { + query queryListContractByCodeID($code_id: Int = 0) { ${this.envDB} { smart_contract(where: {code_id: {_eq: $code_id}}, order_by: {updated_at: desc}) { id @@ -177,6 +177,11 @@ export class ContractService extends CommonService { } } } + smart_contract_aggregate(where: {code_id: {_eq: $code_id}}) { + aggregate { + count + } + } } } `; @@ -186,7 +191,7 @@ export class ContractService extends CommonService { variables: { code_id: payload.codeId, }, - operationName: 'MyQuery', + operationName: 'queryListContractByCodeID', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts index eb8169166..b3d383b58 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts @@ -2,13 +2,13 @@ import { DatePipe } from '@angular/common'; import { Component, Input, OnInit } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; +import * as _ from 'lodash'; import { DATEFORMAT, LENGTH_CHARACTER, PAGE_EVENT } from 'src/app/core/constants/common.constant'; -import { CONTRACT_RESULT, TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; +import { TYPE_CW4973 } from 'src/app/core/constants/contract.constant'; +import { ContractRegisterType } from 'src/app/core/constants/contract.enum'; import { TableTemplate } from 'src/app/core/models/common.model'; import { ContractService } from 'src/app/core/services/contract.service'; import { shortenAddress } from '../../../../core/utils/common/shorten'; -import { ContractRegisterType } from 'src/app/core/constants/contract.enum'; -import * as _ from 'lodash'; @Component({ selector: 'app-code-id-contracts-tab', diff --git a/src/app/pages/fee-grant/fee-grant.module.ts b/src/app/pages/fee-grant/fee-grant.module.ts index cc42d0f7a..a9753b55b 100644 --- a/src/app/pages/fee-grant/fee-grant.module.ts +++ b/src/app/pages/fee-grant/fee-grant.module.ts @@ -13,7 +13,6 @@ import { FeeGrantService } from 'src/app/core/services/feegrant.service'; import { MappingErrorService } from 'src/app/core/services/mapping-error.service'; import { TransactionService } from 'src/app/core/services/transaction.service'; import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; -import { PaginatorModule } from 'src/app/shared/components/paginator/paginator.module'; import { TableNoDataModule } from 'src/app/shared/components/table-no-data/table-no-data.module'; import { SharedModule } from 'src/app/shared/shared.module'; import { FeeGrantRoutingModule } from './fee-grant-routing.module'; @@ -40,7 +39,6 @@ import { PopupRevokeComponent } from './popup-revoke/popup-revoke.component'; FormsModule, CommonPipeModule, MatTableModule, - PaginatorModule, TableNoDataModule, TranslateModule, SharedModule, From 8060785e5fe177313f6bccdf48c4701b29f22df0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 19 Jun 2023 16:27:25 +0700 Subject: [PATCH 138/315] merge code --- src/app/core/services/proposal.service.ts | 36 ++----------------- .../validators-votes.component.ts | 2 +- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 459856665..f834bcb40 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -23,41 +23,9 @@ export class ProposalService extends CommonService { super(http, environmentService); } - getValidatorVotesFromIndexer(proposalId): Observable { - const operationsDoc = ` - query auratestnet_validator($proposalId: Int = null, $limit: Int = 10) { - ${this.envDB} { - validator(where: {status: {_eq: "BOND_STATUS_BONDED"}}, order_by: {percent_voting_power: desc}, limit: $limit) { - vote(where: {proposal_id: {_eq: $proposalId}}) { - id - vote_option - txhash - proposal_id - transaction { - timestamp - } - } - description - operator_address - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: +this.maxValidator || 100, - proposalId: proposalId, - }, - operationName: 'auratestnet_validator', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - getValidatorVotesFromIndexer2( + getValidatorVotesFromIndexer( proposalId: number, - { limit, offset, voteOption }: { limit: number; offset?: number; voteOption?: string }, + { limit, offset }: { limit: number; offset?: number; voteOption?: string }, ): Observable { const operationsDoc = ` query queryValidatorVotes($proposalId: Int = null, $limit: Int = 10, $offset: Int = 0) { diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index 172e95210..b2185873e 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -92,7 +92,7 @@ export class ValidatorsVotesComponent implements OnInit, OnDestroy { getValidatorVotes(voteOption = null): void { if (this.proposalId) { this.proposalService - .getValidatorVotesFromIndexer2(this.proposalId, { + .getValidatorVotesFromIndexer(this.proposalId, { limit: 100, voteOption, }) From a73ef2f78cb508cbb497f438b28abc17eaa51f1d Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Mon, 19 Jun 2023 16:31:15 +0700 Subject: [PATCH 139/315] change query name --- src/app/core/services/proposal.service.ts | 46 +++-------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index f834bcb40..91cdabb25 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -6,14 +6,12 @@ import { VOTE_OPTION } from '../constants/proposal.constant'; import { EnvironmentService } from '../data-services/environment.service'; import { CommonService } from './common.service'; import { map } from 'rxjs/operators'; -import { offset } from '@popperjs/core'; @Injectable() export class ProposalService extends CommonService { chainInfo = this.environmentService.configValue.chain_info; maxValidator = `${this.environmentService.configValue.maxValidator}`; reloadList$ = new Subject(); - pageIndexObj = {}; reloadList() { this.reloadList$.next(true); @@ -115,7 +113,7 @@ export class ProposalService extends CommonService { type?: string; }) { const operationsDoc = ` - query auratestnet_proposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $type: String = null, $n_status : String = "PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT") { + query queryProposal($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $type: String = null, $n_status : String = "PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT") { ${this.envDB} { proposal(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}, type: {_eq: $type}, status: {_neq: $n_status}}, order_by: {proposal_id: $order}) { content @@ -160,14 +158,14 @@ export class ProposalService extends CommonService { proposalId, type, }, - operationName: 'auratestnet_proposal', + operationName: 'queryProposal', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } getListVoteFromIndexer2(payload, option): Observable { const operationsDoc = ` - query auratestnet_vote($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { + query queryVote($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { ${this.envDB} { vote(limit: $limit, offset: $offset, where: {proposal_id: {_eq: $proposalId}, vote_option: {_eq: $voteOption}}, order_by: {height: $order}) { height @@ -197,14 +195,14 @@ export class ProposalService extends CommonService { voteOption: option || null, offset: payload?.offset, }, - operationName: 'auratestnet_vote', + operationName: 'queryVote', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } getProposalVoteTotal(proposalId: number) { const operationsDoc = ` - query getProposalVoteTotal($proposalId: Int) { + query queryProposalVoteTotal($proposalId: Int) { ${this.envDB} { ALL: vote_aggregate(where: {proposal_id: {_eq: $proposalId}}) { ...aggregateCountFragment @@ -234,39 +232,7 @@ export class ProposalService extends CommonService { .post(this.graphUrl, { query: operationsDoc, variables: { proposalId }, - operationName: 'getProposalVoteTotal', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - getListVoteFromIndexer(payload, option): Observable { - const operationsDoc = ` - query auratestnet_vote($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { - ${this.envDB} { - vote(limit: $limit, where: {proposal_id: {_eq: $proposalId}, height: {_lt: $nextKey}, vote_option: {_eq: $voteOption}}, order_by: {height: $order}) { - height - proposal_id - txhash - vote_option - voter - transaction { - timestamp - } - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: payload.pageLimit, - nextKey: payload.nextKey, - order: 'desc', - proposalId: payload.proposalId, - voteOption: option || null, - }, - operationName: 'auratestnet_vote', + operationName: 'queryProposalVoteTotal', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } From 6c12a4fa6c9f12af2f63152880e9f99298403fbc Mon Sep 17 00:00:00 2001 From: nttnguyen136 Date: Mon, 19 Jun 2023 16:36:36 +0700 Subject: [PATCH 140/315] remove comment --- .../proposal-table.component.html | 12 +-- .../proposal-table.component.ts | 75 +------------------ 2 files changed, 5 insertions(+), 82 deletions(-) diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index 4f7f67f56..a7e71d5b3 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -55,7 +55,9 @@ {{ getVoteValue(data[template.matColumnDef]) }} - {{ data[template.matColumnDef] }} + {{ + data[template.matColumnDef] + }}
    @@ -243,14 +245,8 @@
    -
    - +
    diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 90839ebb3..1ef3d72b5 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -45,11 +45,6 @@ export class ProposalTableComponent implements OnInit, OnChanges { @Output() isNextPage = new EventEmitter(); @Output() pageEventChange = new EventEmitter(); - // @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; - // @ViewChild(MatPaginator) paginator: MatPaginator; - - validatorImgArr; - votesTemplates: Array = [ { matColumnDef: 'voter', headerCellDef: 'Voter', isUrl: '/account', isShort: true }, { matColumnDef: 'txhash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true, desktopOnly: true }, @@ -99,9 +94,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { public global: Globals, public commonService: CommonService, private layout: BreakpointObserver, - private validatorService: ValidatorService, private environmentService: EnvironmentService, - private cdr: ChangeDetectorRef, ) {} ngOnChanges(changes: SimpleChanges): void { @@ -124,7 +117,6 @@ export class ProposalTableComponent implements OnInit, OnChanges { ngOnInit(): void { this.template = this.getTemplate(this.type); this.displayedColumns = this.getTemplate(this.type).map((template) => template.matColumnDef); - // this.dataSource = new MatTableDataSource(this.data); } getTemplate(type: PROPOSAL_TABLE_MODE): Array { @@ -149,79 +141,14 @@ export class ProposalTableComponent implements OnInit, OnChanges { return vote ? vote.value : 'Did not vote'; } - pageEvent2(index: number) { + pageEvent(_index: number) { const { pageIndex, pageSize } = this.pageData; - // const next = length <= (pageIndex + 1) * pageSize; - - // if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { - // // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; - // } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { - // this.tabId = this.tabId || 'all'; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES] = {}; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES][this.tabId] = pageIndex; - // } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { - // this.tabId = this.tabId || 'all'; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES] = {}; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES][this.tabId] = pageIndex; - // this.pageValidatorIndex = pageIndex; - // } - - // if (next) { - // this.isNextPage.emit(true); - this.pageEventChange.emit({ type: this.type, tabId: this.tabId, pageIndex: pageIndex - 1, pageSize, }); - // } } - - // pageEvent(e: PageEvent): void { - // const { length, pageIndex, pageSize, previousPageIndex } = e; - // const next = length <= (pageIndex + 2) * pageSize; - - // if (this.type === PROPOSAL_TABLE_MODE.DEPOSITORS) { - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.DEPOSITORS] = pageIndex; - // } else if (this.type === PROPOSAL_TABLE_MODE.VOTES) { - // this.tabId = this.tabId || 'all'; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES] = {}; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VOTES][this.tabId] = pageIndex; - // } else if (this.type === PROPOSAL_TABLE_MODE.VALIDATORS_VOTES) { - // this.tabId = this.tabId || 'all'; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES] = {}; - // this.proposalService.pageIndexObj[PROPOSAL_TABLE_MODE.VALIDATORS_VOTES][this.tabId] = pageIndex; - // this.pageValidatorIndex = pageIndex; - // } - - // if (next) { - // this.isNextPage.emit(true); - // this.loadMore.emit({ - // next: 1, - // type: this.type, - // tabId: this.tabId, - // }); - // } - // } - - // paginatorEmit(e): void { - // if (this.dataSource) { - // this.dataSource.paginator = e; - // } else { - // this.dataSource = new MatTableDataSource(this.data); - // this.dataSource.paginator = e; - // } - // } - - // getListData(): any[] { - // if (!(this.dataSource?.paginator && this.dataSource?.data)) { - // return []; - // } - // return this.dataSource.data.slice( - // this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize, - // this.dataSource.paginator.pageIndex * this.dataSource.paginator.pageSize + this.dataSource.paginator.pageSize, - // ); - // } } From 2f028c3120c731b92d0a2d9f5b47175f57a61af0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 19 Jun 2023 16:45:21 +0700 Subject: [PATCH 141/315] update paginator nft list code id contracttab --- src/app/core/services/contract.service.ts | 6 ++++-- .../code-id-contracts-tab.component.html | 10 ++++------ .../code-id-contracts-tab.component.ts | 18 +++++++++--------- src/app/pages/code-ids/code-ids.module.ts | 2 ++ 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 969ca9607..bc64e0da8 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -158,9 +158,9 @@ export class ContractService extends CommonService { getListContractByCode(payload): Observable { const contractDoc = ` - query queryListContractByCodeID($code_id: Int = 0) { + query queryListContractByCodeID($limit: Int = 100, $offset: Int = 0, $code_id: Int = 0) { ${this.envDB} { - smart_contract(where: {code_id: {_eq: $code_id}}, order_by: {updated_at: desc}) { + smart_contract(limit: $limit, offset: $offset, where: {code_id: {_eq: $code_id}}, order_by: {updated_at: desc}) { id instantiate_hash name @@ -190,6 +190,8 @@ export class ContractService extends CommonService { query: contractDoc, variables: { code_id: payload.codeId, + limit: payload.limit, + offset: payload.offset }, operationName: 'queryListContractByCodeID', }) diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html index b495ea80b..c521ca8d9 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html @@ -68,9 +68,7 @@
    - - + +
    + +
    diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts index b3d383b58..dd32b7c6a 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.ts @@ -20,7 +20,7 @@ export class CodeIdContractsTabComponent implements OnInit { pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; dataSource: MatTableDataSource = new MatTableDataSource([]); templates: Array = [ @@ -39,6 +39,7 @@ export class CodeIdContractsTabComponent implements OnInit { ngOnInit(): void { this.getListContractByCode(); } + shortenAddress(address: string): string { if (address) { return shortenAddress(address, 8); @@ -46,24 +47,23 @@ export class CodeIdContractsTabComponent implements OnInit { return ''; } - paginatorEmit(event): void { - this.dataSource.paginator = event; - } - - pageEvent(e: PageEvent): void { - this.pageData.pageIndex = e.pageIndex; + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; + } this.getListContractByCode(); } getListContractByCode() { let payload = { limit: this.pageData.pageSize, - offset: this.pageData.pageIndex * this.pageData.pageSize, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, codeId: this.codeId.toString(), }; this.contractService.getListContractByCode(payload).subscribe((res) => { - this.pageData.length = res?.smart_contract?.length || 0; + this.pageData.length = res?.smart_contract_aggregate?.aggregate?.count || 0; if (res?.smart_contract?.length > 0) { res?.smart_contract.forEach((item) => { item.updated_at = this.datePipe.transform(item?.created_at, DATEFORMAT.DATETIME_UTC); diff --git a/src/app/pages/code-ids/code-ids.module.ts b/src/app/pages/code-ids/code-ids.module.ts index fbd70e3d2..75a73dbb6 100644 --- a/src/app/pages/code-ids/code-ids.module.ts +++ b/src/app/pages/code-ids/code-ids.module.ts @@ -6,6 +6,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { MaterialModule } from 'src/app/app.module'; import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; import { ContractService } from 'src/app/core/services/contract.service'; +import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; import { PaginatorModule } from 'src/app/shared/components/paginator/paginator.module'; import { TableNoDataModule } from 'src/app/shared/components/table-no-data/table-no-data.module'; import { SharedModule } from 'src/app/shared/shared.module'; @@ -30,6 +31,7 @@ import { CodeIdsRoutingModule } from './code-ids-routing.module'; SharedModule, NgbNavModule, ContractsModule, + APaginatorModule, ], providers: [ContractService], }) From b5a6053389e4cdcc29a18a2b1b1dbfbbca3b2cd3 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 20 Jun 2023 09:35:05 +0700 Subject: [PATCH 142/315] update paginator inventory --- src/app/core/services/account.service.ts | 2 +- src/app/core/services/token.service.ts | 33 ++++++--- .../contracts-list.component.ts | 1 - .../token-inventory-tab.component.html | 35 ++++----- .../token-inventory-tab.component.ts | 73 +++++-------------- 5 files changed, 56 insertions(+), 88 deletions(-) diff --git a/src/app/core/services/account.service.ts b/src/app/core/services/account.service.ts index 031a7ac2a..0374dae31 100644 --- a/src/app/core/services/account.service.ts +++ b/src/app/core/services/account.service.ts @@ -79,12 +79,12 @@ export class AccountService extends CommonService { query: operationsDoc, variables: { limit: payload?.limit || 20, + offset: payload.offset, contract_address: payload?.contractAddress, nextKeyLastUpdatedHeight: payload?.nextKey, nextKeyId: payload?.nextKeyId, tokenId: payload?.token_id, owner: payload?.owner, - offset: payload.offset }, operationName: 'Query', }) diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 14180786e..d8e780fed 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -27,7 +27,7 @@ export class TokenService extends CommonService { } let querySort = `, order_by: {${payload.sort_column}: ${payload.sort_order}}`; const operationsDoc = ` - query MyQuery($limit: Int = 10, $offset: Int = 0, $contract_address: String = null, $name: String = null) { + query queryListCW721($limit: Int = 10, $offset: Int = 0, $contract_address: String = null, $name: String = null) { ${this.envDB} { list_token: m_view_count_cw721_txs(limit: $limit, offset: $offset ${querySort}, where: {_or: [{contract_address: {_like: $contract_address}}, {name: {_like: $name}}]}) { contract_address @@ -53,7 +53,7 @@ export class TokenService extends CommonService { contract_address: textSearch || null, name: textSearch || null, }, - operationName: 'MyQuery', + operationName: 'queryListCW721', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } @@ -64,23 +64,21 @@ export class TokenService extends CommonService { getListTokenNFTFromIndexer(payload): Observable { const operationsDoc = ` - query Query( + query queryListInventory( $contract_address: String $limit: Int = 10 - $nextKeyLastUpdatedHeight: Int = null - $nextKeyId: Int = null $tokenId: String = null $owner: String = null + $offset: Int = 0 ) { ${this.envDB} { cw721_token( limit: $limit + offset: $offset where: { cw721_contract: { smart_contract: { address: { _eq: $contract_address } } } - id: { _lt: $nextKeyId } - last_updated_height: { _lt: $nextKeyLastUpdatedHeight } token_id: { _eq: $tokenId } owner: { _eq: $owner } burned: {_eq: false} @@ -95,6 +93,22 @@ export class TokenService extends CommonService { created_at burned } + cw721_token_aggregate( + where: { + cw721_contract: { + smart_contract: { + address: { _eq: $contract_address } + } + } + token_id: { _eq: $tokenId } + owner: { _eq: $owner } + burned: {_eq: false} + } + ) { + aggregate { + count + } + } } } `; @@ -103,13 +117,12 @@ export class TokenService extends CommonService { query: operationsDoc, variables: { limit: payload?.limit || 20, + offset: payload.offset, contract_address: payload?.contractAddress, - nextKeyLastUpdatedHeight: payload?.nextKey, - nextKeyId: payload?.nextKeyId, tokenId: payload?.token_id, owner: payload?.owner, }, - operationName: 'Query', + operationName: 'queryListInventory', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index f857bd4a3..c34edb936 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -122,7 +122,6 @@ export class ContractsListComponent implements OnInit, OnDestroy { resetFilterSearch() { this.textSearch = ''; this.filterButtons = []; - this.pageEvent(0); } diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html index 73bf8b152..6506ddb69 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html @@ -1,14 +1,9 @@ - - More than {{ pageData?.length | number }} token{{ pageData?.length > 1 ? 's' : '' }} found - - + A total of {{ pageData?.length | number }} token{{ pageData?.length > 1 ? 's' : '' }} found -
    - @@ -17,7 +12,7 @@ class="nft-cards row row-cols-2 row-cols-md-3 row-cols-lg-4 row-cols-xl-5 g-2 g-md-3 g-lg-4 g-xl-5" id="nft-cards" *ngIf="!loading"> -
    +
    @@ -38,14 +33,14 @@ Owner: {{ item.owner | cutStringPipe: 6:6 }} + href="/tokens/{{ linkToken }}/{{ item.contract_address }}?a={{ item.owner }}" + >{{ item.owner | cutStringPipe : 6 : 6 }} + {{ item.owner | cutStringPipe: 8:8 }} + href="/tokens/{{ linkToken }}/{{ item.contract_address }}?a={{ item.owner }}" + >{{ item.owner | cutStringPipe : 8 : 8 }} +
    @@ -53,12 +48,12 @@
    - - +
    + +
    diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts index 99a14fed2..4538c8301 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts @@ -1,10 +1,9 @@ import { Component, Input, OnInit } from '@angular/core'; -import { MatPaginator, PageEvent } from '@angular/material/paginator'; +import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { ActivatedRoute, Router } from '@angular/router'; import * as _ from 'lodash'; import { LENGTH_CHARACTER, PAGE_EVENT } from 'src/app/core/constants/common.constant'; -import { ContractRegisterType } from 'src/app/core/constants/contract.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TokenService } from 'src/app/core/services/token.service'; import { checkTypeFile } from 'src/app/core/utils/common/info-common'; @@ -16,23 +15,17 @@ import { checkTypeFile } from 'src/app/core/utils/common/info-common'; }) export class TokenInventoryComponent implements OnInit { @Input() typeContract: string; - loading = true; pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, - pageIndex: PAGE_EVENT.PAGE_INDEX, + pageIndex: 1, }; - nftData: MatTableDataSource = new MatTableDataSource(); + nftData = new MatTableDataSource(); contractAddress = ''; keyWord = ''; - dataSourceMobile: any[]; prefixAdd = this.environmentService.configValue.chain_info.bech32Config.bech32PrefixAccAddr; - isMoreTx = false; linkToken = 'token-nft'; - nextKey = null; - currentNextKey = null; - nextKeyId = null; constructor( private route: ActivatedRoute, @@ -56,11 +49,10 @@ export class TokenInventoryComponent implements OnInit { this.getNftData(); } - getNftData(nextKey = null, nextKeyId = null) { + getNftData() { let payload = { - limit: 100, - nextKey: nextKey, - nextKeyId: nextKeyId, + limit: this.pageData.pageSize, + offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, contractAddress: this.contractAddress, owner: null, token_id: null, @@ -79,29 +71,13 @@ export class TokenInventoryComponent implements OnInit { this.tokenService.getListTokenNFTFromIndexer(payload).subscribe( (res) => { const asset = _.get(res, `cw721_token`); - if (asset?.length >= 100) { - this.isMoreTx = true; - this.nextKey = asset[asset?.length - 1]?.last_updated_height; - this.nextKeyId = asset[asset?.length - 1]?.id; - } else { - this.isMoreTx = false; - } - - asset.forEach((element) => { - element.contract_address = this.contractAddress; - }); - - if (this.nftData.data.length > 0) { - this.nftData.data = [...this.nftData.data, ...asset]; - } else { - this.nftData.data = [...asset]; + if (asset.length > 0) { + asset.forEach((element) => { + element.contract_address = this.contractAddress; + }); + this.nftData.data = asset; } - this.pageData.length = this.nftData.data?.length; - - this.dataSourceMobile = this.nftData.data.slice( - this.pageData.pageIndex * this.pageData.pageSize, - this.pageData.pageIndex * this.pageData.pageSize + this.pageData.pageSize, - ); + this.pageData.length = res?.cw721_token_aggregate?.aggregate?.count; }, () => {}, () => { @@ -110,27 +86,12 @@ export class TokenInventoryComponent implements OnInit { ); } - pageEvent(e: PageEvent): void { - const { length, pageIndex, pageSize } = e; - const next = length <= (pageIndex + 2) * pageSize; - if (next && this.nextKey && this.nextKey !== this.currentNextKey) { - this.getNftData(this.nextKey, this.nextKeyId); - this.currentNextKey = this.nextKey; - } else { - this.dataSourceMobile = this.nftData.data.slice(e.pageIndex * e.pageSize, e.pageIndex * e.pageSize + e.pageSize); + pageEvent(pageIndex: number): void { + // reset page 1 if pageIndex = 0 + if (pageIndex === 0) { + this.pageData.pageIndex = 1; } - } - - paginatorEmit(e: MatPaginator): void { - if (this.nftData.paginator) { - e.page.next({ - length: this.nftData.paginator.length, - pageIndex: 0, - pageSize: this.nftData.paginator.pageSize, - previousPageIndex: this.nftData.paginator.pageIndex, - }); - this.nftData.paginator = e; - } else this.nftData.paginator = e; + this.getNftData(); } handleRouterLink(e: Event, link, params?): void { From 158210dc402d7605c46308ac95bdc7e2bf3d7eee Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 20 Jun 2023 09:50:32 +0700 Subject: [PATCH 143/315] update code --- src/app/core/services/proposal.service.ts | 50 +------------------ .../proposal-detail/votes/votes.component.ts | 2 +- 2 files changed, 3 insertions(+), 49 deletions(-) diff --git a/src/app/core/services/proposal.service.ts b/src/app/core/services/proposal.service.ts index 91cdabb25..b2a4072eb 100644 --- a/src/app/core/services/proposal.service.ts +++ b/src/app/core/services/proposal.service.ts @@ -55,53 +55,7 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getProposalData(payload) { - const operationsDoc = ` - query auratestnet_proposal($limit: Int = 10, $nextKey: Int = null, $order: order_by = desc, $proposalId: Int = null, $type: String = null) { - ${this.envDB} { - proposal(limit: $limit, where: {proposal_id: {_eq: $proposalId, _lt: $nextKey}, type: {_eq: $type}, status: {_neq: "PROPOSAL_STATUS_NOT_ENOUGH_DEPOSIT"}}, order_by: {proposal_id: $order}) { - content - deposit_end_time - description - initial_deposit - proposal_id - proposer_address - count_vote - proposer { - description - operator_address - account_address - } - status - submit_time - tally - title - total_deposit - turnout - type - updated_at - voting_end_time - voting_start_time - } - } - } - `; - return this.http - .post(this.graphUrl, { - query: operationsDoc, - variables: { - limit: payload.limit, - order: 'desc', - nextKey: payload.nextKey, - proposalId: payload.proposalId, - type: payload.type, - }, - operationName: 'auratestnet_proposal', - }) - .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); - } - - getProposalData2({ + getProposalData({ limit, offset, proposalId, @@ -163,7 +117,7 @@ export class ProposalService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getListVoteFromIndexer2(payload, option): Observable { + getListVoteFromIndexer(payload, option): Observable { const operationsDoc = ` query queryVote($limit: Int = 10, $offset: Int = 0, $order: order_by = desc, $proposalId: Int = null, $voteOption: String = null) { ${this.envDB} { diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts index c1525871d..2809dfefc 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.ts @@ -108,7 +108,7 @@ export class VotesComponent implements OnChanges, OnDestroy { this.currentTabId = tabId || 'all'; } - this.proposalService.getListVoteFromIndexer2(this.payloads, voteOption).subscribe((res) => { + this.proposalService.getListVoteFromIndexer(this.payloads, voteOption).subscribe((res) => { this.voteDataList = res.vote; }); } From c3b0b359ed2714d78e12edfd998bdc6116e066eb Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 20 Jun 2023 09:56:46 +0700 Subject: [PATCH 144/315] update total transaction to total Activities --- .../token/token-list/token-cw721/token-cw721.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html index 5832e51e4..2b857f7e8 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html @@ -71,7 +71,7 @@

    Non-Fungible Tokens (NFT)

    Total TransactionsTotal Activities {{ element.total_tx | number }}
    @@ -57,11 +57,6 @@ - - -
    - {{ 'NO DATA' | translate }} -
    From 0fdcc1927a6e314d4fcd9623d8ed409aedb7191e Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 20 Jun 2023 14:31:07 +0700 Subject: [PATCH 149/315] [TamTM6] update text block detail --- src/app/pages/blocks/block-detail/block-detail.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index aa1ca14af..e9104d2e8 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -66,7 +66,7 @@

    {{ !isRawData ? 'Information' : 'Raw Data' }}

    Chain Id
    -
    {{ blockDetail?.chainid }}
    +
    {{ blockDetail?.chainid }}
    Height
    From a256c13c43ba3f588eae6fd1b422775f0895b7d8 Mon Sep 17 00:00:00 2001 From: nthduc95 Date: Tue, 20 Jun 2023 14:57:36 +0700 Subject: [PATCH 150/315] implement contract code v2 --- src/app/core/services/contract.service.ts | 94 ++++++++++++++++++- .../code-id-detail.component.ts | 6 +- .../code-id-list/code-id-list.component.ts | 10 +- 3 files changed, 97 insertions(+), 13 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 9e4181085..57f9c1707 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -268,10 +268,6 @@ export class ContractService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getListContractById(codeId: number): Observable { - return this.http.get(`${this.apiUrl}/contract-codes/${codeId}`); - } - getVerifyCodeStep(codeId: number): Observable { return this.http.get(`${this.apiUrl}/contracts/verify-code-id/${codeId}`); } @@ -280,7 +276,95 @@ export class ContractService extends CommonService { return this.http.post(`${this.apiUrl}/contracts/contract-code/list`, data); } + getListCodeId(data: any): Observable { + const keyword = data?.keyword ? data?.keyword : null; + let subQuery = ''; + if (keyword) { + if (keyword.length >= LENGTH_CHARACTER.CONTRACT) { + subQuery = `smart_contracts: {address: {_eq: "${keyword}"}}`; + } else if (keyword.length >= LENGTH_CHARACTER.ADDRESS) { + subQuery = `creator: {_eq: "${keyword}"}`; + } else { + subQuery = `code_id: {_eq: ${keyword}}` + }; + } + + const query = `query ContractCode($limit: Int, $offset: Int) { + ${this.envDB} { + code(where: {${subQuery}}, order_by: {code_id: desc}, limit: $limit, offset: $offset) { + code_id + creator + store_hash + type + status + created_at + code_id_verifications { + verified_at + compiler_version + github_url + verification_status + } + smart_contracts { + name + } + smart_contracts_aggregate { + aggregate { + count + } + } + } + code_aggregate(where: { ${subQuery} }) { + aggregate { + count + } + } + } + }` + return this.http + .post(this.graphUrl, { + query: query, + variables: { + limit: data?.limit, + offset: data?.offset, + }, + operationName: 'ContractCode', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); + } + getCodeIDDetail(codeId: number): Observable { - return this.http.get(`${this.apiUrl}/contracts/contract-code/${codeId}`); + const query = `query ContractCodeDetail($codeId: Int) { + ${this.envDB} { + code(where: {code_id: {_eq: ${codeId}}}) { + code_id + creator + store_hash + type + status + created_at + code_id_verifications { + verified_at + compiler_version + github_url + verification_status + } + smart_contracts { + name + } + smart_contracts_aggregate { + aggregate { + count + } + } + } + } + }` + return this.http + .post(this.graphUrl, { + query: query, + variables: {}, + operationName: 'ContractCodeDetail', + }) + .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } } diff --git a/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts index 50fb8df14..5020ea645 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts @@ -43,9 +43,9 @@ export class CodeIdDetailComponent implements OnInit { getCodeIdDetail() { this.contractService.getCodeIDDetail(this.codeId).subscribe((res) => { - if (res.data?.length > 0) { - let data = res.data[0]; - data.instantiates = data.smart_contracts?.length || 0; + if (res.code?.length > 0) { + let data = res.code[0]; + data.instantiates = data.smart_contracts_aggregate?.aggregate.count || 0; data.tx_hash = data.store_hash; data.verified_at = _.get(data, 'code_id_verifications[0].verified_at'); data.contract_verification = _.get(data, 'code_id_verifications[0].verification_status'); diff --git a/src/app/pages/code-ids/code-id-list/code-id-list.component.ts b/src/app/pages/code-ids/code-id-list/code-id-list.component.ts index 2be6073bc..04549b6a4 100644 --- a/src/app/pages/code-ids/code-id-list/code-id-list.component.ts +++ b/src/app/pages/code-ids/code-id-list/code-id-list.component.ts @@ -76,9 +76,9 @@ export class CodeIdListComponent implements OnInit, OnDestroy { keyword: this.textSearch, }; - this.contractService.getListCodeID(payload).subscribe((res) => { - res?.data?.forEach((k) => { - k.instantiates = k.smart_contracts?.length || 0; + this.contractService.getListCodeId(payload).subscribe((res) => { + res?.code?.forEach((k) => { + k.instantiates = k.smart_contracts_aggregate?.aggregate.count || 0; k.tx_hash = k.store_hash; k.verified_at = k.code_id_verifications[0]?.verified_at; k.contract_verification = k.code_id_verifications[0]?.verification_status; @@ -87,8 +87,8 @@ export class CodeIdListComponent implements OnInit, OnDestroy { } }); - this.dataSource.data = res.data; - this.pageData.length = res?.meta?.count; + this.dataSource.data = res.code; + this.pageData.length = res?.code_aggregate.aggregate.count; }); } From 64b43f09402803fe4a10bc247be3ffdc082c833a Mon Sep 17 00:00:00 2001 From: nthduc95 Date: Tue, 20 Jun 2023 15:03:28 +0700 Subject: [PATCH 151/315] add null check --- .../pages/code-ids/code-id-detail/code-id-detail.component.ts | 2 +- src/app/pages/code-ids/code-id-list/code-id-list.component.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts b/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts index 5020ea645..d153efc1c 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts +++ b/src/app/pages/code-ids/code-id-detail/code-id-detail.component.ts @@ -45,7 +45,7 @@ export class CodeIdDetailComponent implements OnInit { this.contractService.getCodeIDDetail(this.codeId).subscribe((res) => { if (res.code?.length > 0) { let data = res.code[0]; - data.instantiates = data.smart_contracts_aggregate?.aggregate.count || 0; + data.instantiates = data.smart_contracts_aggregate?.aggregate?.count || 0; data.tx_hash = data.store_hash; data.verified_at = _.get(data, 'code_id_verifications[0].verified_at'); data.contract_verification = _.get(data, 'code_id_verifications[0].verification_status'); diff --git a/src/app/pages/code-ids/code-id-list/code-id-list.component.ts b/src/app/pages/code-ids/code-id-list/code-id-list.component.ts index 04549b6a4..63424cf68 100644 --- a/src/app/pages/code-ids/code-id-list/code-id-list.component.ts +++ b/src/app/pages/code-ids/code-id-list/code-id-list.component.ts @@ -78,7 +78,7 @@ export class CodeIdListComponent implements OnInit, OnDestroy { this.contractService.getListCodeId(payload).subscribe((res) => { res?.code?.forEach((k) => { - k.instantiates = k.smart_contracts_aggregate?.aggregate.count || 0; + k.instantiates = k.smart_contracts_aggregate?.aggregate?.count || 0; k.tx_hash = k.store_hash; k.verified_at = k.code_id_verifications[0]?.verified_at; k.contract_verification = k.code_id_verifications[0]?.verification_status; @@ -88,7 +88,7 @@ export class CodeIdListComponent implements OnInit, OnDestroy { }); this.dataSource.data = res.code; - this.pageData.length = res?.code_aggregate.aggregate.count; + this.pageData.length = res?.code_aggregate?.aggregate?.count || 0; }); } From 2eefddc04311f51a8028d1107d7737546d73107f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 20 Jun 2023 16:13:48 +0700 Subject: [PATCH 152/315] fix reload proposal --- .../summary-info/summary-info.component.html | 48 +++++++++---------- .../summary-info/summary-info.component.ts | 9 ++-- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index b5f082952..48dd87b8f 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -11,18 +11,18 @@

    You voted "{{ proposalVotes }}" for this proposal

    -
    - {{ getStatus(proposalDetail.status)?.value }} +
    + {{ proposalStatus.value }}
    -
    - {{ getStatus(proposalDetail.status)?.value }} +
    + {{ proposalStatus.value }}
    @@ -90,12 +90,12 @@

    Voting Start
    -
    - {{ proposalDetail.voting_start_time | customDate : 'yyyy-MM-dd' }} +
    + {{ proposalDetail?.voting_start_time | customDate : 'yyyy-MM-dd' }}
    - {{ proposalDetail.voting_start_time | customDate : 'HH:mm:ss' }} + {{ proposalDetail?.voting_start_time | customDate : 'HH:mm:ss' }}
    -
    +
    -
    @@ -103,12 +103,12 @@

    Voting End
    -
    - {{ proposalDetail.voting_end_time | customDate : 'yyyy-MM-dd' }} +
    + {{ proposalDetail?.voting_end_time | customDate : 'yyyy-MM-dd' }}
    - {{ proposalDetail.voting_end_time | customDate : 'HH:mm:ss' }} + {{ proposalDetail?.voting_end_time | customDate : 'HH:mm:ss' }}
    -
    +
    -
    @@ -158,20 +158,20 @@

    Contracts

    + +
    + {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} + +
    @@ -110,15 +118,12 @@

    Contracts

    width="16px" height="16px" />
    - - {{ shortenAddress(data[template.matColumnDef]) || '-' }} -
    - + = [ - { matColumnDef: 'address', headerCellDef: 'Address', isUrl: '/contracts', isShort: true }, + { matColumnDef: 'address', headerCellDef: 'Address', isUrl: '/contracts', isShort: true, isNameTag: true }, { matColumnDef: 'name', headerCellDef: 'Contract Name' }, { matColumnDef: 'code_id', headerCellDef: 'Code ID' }, { matColumnDef: 'type', headerCellDef: 'Type Contract' }, { matColumnDef: 'compiler_version', headerCellDef: 'Version' }, { matColumnDef: 'contract_verification', headerCellDef: 'Verified' }, - { matColumnDef: 'creator', headerCellDef: 'Creator', isUrl: '/account', isShort: true }, + { matColumnDef: 'creator', headerCellDef: 'Creator', isUrl: '/account', isShort: true, isNameTag: true }, ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); pageData: PageEvent = { @@ -50,6 +51,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { public translate: TranslateService, private contractService: ContractService, private datePipe: DatePipe, + public commonService: CommonService ) {} ngOnDestroy(): void { @@ -73,6 +75,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { } getListContract() { + this.textSearch = this.textSearch?.trim(); let payload = { limit: this.pageData.pageSize, offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, diff --git a/src/app/pages/contracts/contracts-register/contracts-register.component.ts b/src/app/pages/contracts/contracts-register/contracts-register.component.ts index 234801090..ea4d404d8 100644 --- a/src/app/pages/contracts/contracts-register/contracts-register.component.ts +++ b/src/app/pages/contracts/contracts-register/contracts-register.component.ts @@ -109,7 +109,7 @@ export class ContractsRegisterComponent implements OnInit { } getListContract() { - this.loading = true; + this.textSearch = this.textSearch?.trim(); let payload = { account_address: this.userAddress, limit: this.pageData.pageSize, diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index dcd1e63ef..26c2d7cf7 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -112,6 +112,7 @@ export class MyGranteesComponent implements OnInit { } getListGrant() { + this.textSearch = this.textSearch?.trim(); this.feeGrantService .getListFeeGrants( { diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index ecea5acfe..f72953418 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -84,6 +84,7 @@ export class MyGrantersComponent implements OnInit { } getListGrant() { + this.textSearch = this.textSearch?.trim(); this.feeGrantService .getListFeeGrants( { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index a7e71d5b3..086993405 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -36,7 +36,12 @@ - {{ shortenAddress(data[template.matColumnDef]) || '-' }} + + {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} + + + {{ shortenAddress(data[template.matColumnDef]) || '-' }} + @@ -111,7 +116,7 @@ '' + - (data.voter ? shortenAddress(data.voter) : '-') + + (data.voter ? (commonService.setNameTag(data.voter) | cutStringPipe : 8 : 8) : '-') + '' }, { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index 1ef3d72b5..e9f41a191 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -46,7 +46,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { @Output() pageEventChange = new EventEmitter(); votesTemplates: Array = [ - { matColumnDef: 'voter', headerCellDef: 'Voter', isUrl: '/account', isShort: true }, + { matColumnDef: 'voter', headerCellDef: 'Voter', isUrl: '/account', isShort: true, isNameTag: true}, { matColumnDef: 'txhash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true, desktopOnly: true }, { matColumnDef: 'vote_option', headerCellDef: 'Answer' }, { matColumnDef: 'timestamp', headerCellDef: 'Time', desktopOnly: true }, @@ -67,7 +67,7 @@ export class ProposalTableComponent implements OnInit, OnChanges { ]; depositorsTemplates: Array = [ - { matColumnDef: 'depositors', headerCellDef: 'Depositors', isUrl: '/account', isShort: true, desktopOnly: true }, + { matColumnDef: 'depositors', headerCellDef: 'Depositors', isUrl: '/account', isShort: true, desktopOnly: true, isNameTag: true }, { matColumnDef: 'txhash', headerCellDef: 'TxHash', isUrl: '/transaction', isShort: true }, { matColumnDef: 'amount', headerCellDef: 'Amount' }, { matColumnDef: 'timestamp', headerCellDef: 'Time' }, diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts index 7661f42b0..f0ad3ba1e 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.ts @@ -25,7 +25,7 @@ export class SoulboundTokenEquippedComponent implements OnInit { textSearch = ''; maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; countSelected = 0; - loading = false; + loading = true; pageData: PageEvent = { length: PAGE_EVENT.LENGTH, pageSize: 20, @@ -81,22 +81,27 @@ export class SoulboundTokenEquippedComponent implements OnInit { } getListSB() { - this.loading = true; + this.textSearch = this.searchValue = this.textSearch?.trim(); const payload = { limit: this.pageData.pageSize, offset: this.pageData.pageIndex * this.pageData.pageSize, receiverAddress: this.userAddress, isEquipToken: true, - keyword: this.textSearch?.trim(), + keyword: this.textSearch, }; - this.soulboundService.getListSoulboundByAddress(payload).subscribe((res) => { - this.countSelected = res.data.filter((k) => k.picked)?.length || 0; - this.soulboundData.data = res.data; - this.pageData.length = res.meta.count; - this.totalSBT.emit(this.pageData.length); - }); - this.loading = false; + this.soulboundService.getListSoulboundByAddress(payload).subscribe( + (res) => { + this.countSelected = res.data.filter((k) => k.picked)?.length || 0; + this.soulboundData.data = res.data; + this.pageData.length = res.meta.count; + this.totalSBT.emit(this.pageData.length); + }, + () => {}, + () => { + this.loading = false; + }, + ); } paginatorEmit(event): void { diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts index 36ef48d58..84f7c91ce 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-unequipped/soulbound-token-unequipped.component.ts @@ -88,11 +88,12 @@ export class SoulboundTokenUnequippedComponent implements OnInit, OnChanges { } getListSB() { + this.searchValue = this.textSearch = this.textSearch?.trim(); const payload = { limit: this.pageData.pageSize, offset: this.pageData.pageIndex * this.pageData.pageSize, receiverAddress: this.currentAddress, - keyword: this.textSearch?.trim(), + keyword: this.textSearch, }; this.soulboundService.getListSoulboundByAddress(payload).subscribe((res) => { diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts index 0b3c90967..410d28d60 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts @@ -86,6 +86,7 @@ export class SoulboundContractListComponent implements OnInit { } getListSmartContract() { + this.textSearch = this.searchValue = this.textSearch?.trim(); const payload = { limit: this.pageData.pageSize, offset: this.pageData.pageIndex * this.pageData.pageSize, diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts index d8bc3f7ca..caf66aa7f 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts @@ -111,12 +111,13 @@ export class SoulboundTokenContractComponent implements OnInit { } getListToken() { + this.textSearch = this.textSearch?.trim(); const payload = { limit: this.pageData.pageSize, offset: this.pageData.pageIndex * this.pageData.pageSize, minterAddress: this.currentAddress, contractAddress: this.contractAddress, - keyword: this.textSearch?.trim(), + keyword: this.textSearch, status: this.selectedType, }; diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html index dbaa82715..3884a6882 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html @@ -66,13 +66,13 @@ *ngIf="this.typeContract !== contractType.CW20" href="/tokens/token-nft/{{ contractAddress }}?a={{ data[template.matColumnDef] }}" class="text-clamp" - >{{ data[template.matColumnDef] }}{{ commonService.setNameTag(data[template.matColumnDef]) }} {{ data[template.matColumnDef] }}{{ commonService.setNameTag(data[template.matColumnDef]) }} @@ -98,7 +98,10 @@ -
    +
    {{ data[template.matColumnDef] }} diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts index 8b3027799..1a2551b84 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.ts @@ -9,6 +9,7 @@ import { TokenService } from 'src/app/core/services/token.service'; import { TableTemplate } from '../../../../../../core/models/common.model'; import { Globals } from '../../../../../../global/global'; import * as _ from 'lodash'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-token-holders-tab', @@ -59,6 +60,7 @@ export class TokenHoldersTabComponent implements OnInit { public global: Globals, private tokenService: TokenService, private environmentService: EnvironmentService, + public commonService: CommonService, ) {} ngOnInit(): void { diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html index 6506ddb69..493874b38 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html @@ -34,12 +34,12 @@ {{ item.owner | cutStringPipe : 6 : 6 }} + >{{ commonService.setNameTag(item.owner) | cutStringPipe : 6 : 6 }} {{ item.owner | cutStringPipe : 8 : 8 }} + >{{ commonService.setNameTag(item.owner) | cutStringPipe : 8 : 8 }}
    diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts index 4538c8301..b839f52be 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.ts @@ -5,6 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import * as _ from 'lodash'; import { LENGTH_CHARACTER, PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { CommonService } from 'src/app/core/services/common.service'; import { TokenService } from 'src/app/core/services/token.service'; import { checkTypeFile } from 'src/app/core/utils/common/info-common'; @@ -32,6 +33,7 @@ export class TokenInventoryComponent implements OnInit { private tokenService: TokenService, private environmentService: EnvironmentService, private router: Router, + public commonService: CommonService ) {} ngOnInit(): void { diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html index 0cc307e72..a6b54a057 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html @@ -105,11 +105,11 @@ class="text--primary txt-from-address content-transfer" href="/tokens/{{ linkToken }}/{{ contractAddress }}?a={{ data[template.matColumnDef] }}" *ngIf="data.modeExecute !== modeExecuteTransaction.Mint && data[template.matColumnDef]"> - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} - {{ - data[template.matColumnDef] | cutStringPipe : 8 : 8 - }} + + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} + - - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} {{ data[template.matColumnDef] | stringEllipsis : 16 }} diff --git a/src/app/pages/token/token-detail/token-content/token-content.component.ts b/src/app/pages/token/token-detail/token-content/token-content.component.ts index 33dbcde77..49a9d086d 100644 --- a/src/app/pages/token/token-detail/token-content/token-content.component.ts +++ b/src/app/pages/token/token-detail/token-content/token-content.component.ts @@ -40,7 +40,7 @@ export class TokenContentComponent implements OnInit { lengthNormalAddress = LENGTH_CHARACTER.ADDRESS; linkToken = 'token-nft'; activeTabID = 0; - textPlaceHolder = 'Filter Address/ TX Hash'; + textPlaceHolder = 'Filter Address/Name Tag/Txn Hash'; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; prefixAdd = this.environmentService.configValue.chain_info.bech32Config.bech32PrefixAccAddr; diff --git a/src/app/pages/token/token-detail/token-summary/token-summary.component.html b/src/app/pages/token/token-detail/token-summary/token-summary.component.html index 72ca6ea9f..8a875af4e 100644 --- a/src/app/pages/token/token-detail/token-summary/token-summary.component.html +++ b/src/app/pages/token/token-detail/token-summary/token-summary.component.html @@ -32,7 +32,7 @@
    Contract:
    diff --git a/src/app/pages/token/token-detail/token-summary/token-summary.component.ts b/src/app/pages/token/token-detail/token-summary/token-summary.component.ts index 805812a5f..4355e0aca 100644 --- a/src/app/pages/token/token-detail/token-summary/token-summary.component.ts +++ b/src/app/pages/token/token-detail/token-summary/token-summary.component.ts @@ -1,5 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { ProjectDetail } from 'src/app/core/models/project'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-token-summary', @@ -10,7 +11,7 @@ export class TokenSummaryComponent implements OnInit { @Input() tokenDetail: any; projectDetail: ProjectDetail; - constructor() {} + constructor(public commonService: CommonService) {} ngOnInit(): void {} } diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts index e1fa74c38..b6acc4ed8 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts @@ -85,6 +85,7 @@ export class TokenCw20Component implements OnInit, OnDestroy { } getListToken() { + this.textSearch = this.textSearch?.trim(); const payload = { limit: this.pageData.pageSize, offset: this.pageData.pageIndex * this.pageData.pageSize, diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html index c886c1924..456720c14 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html @@ -12,7 +12,7 @@

    Account Bound Tokens (ABT)

    Account Bound Tokens (ABT)

    Creator {{ - element.smart_contract.creator | cutStringPipe : 8 : 8 + commonService.setNameTag(element.smart_contract.creator) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts index 984ea94d7..ed9e322d8 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts @@ -9,8 +9,9 @@ import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { TokenService } from 'src/app/core/services/token.service'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; -import { ResponseDto, TableTemplate } from '../../../../core/models/common.model'; +import { TableTemplate } from '../../../../core/models/common.model'; import { Globals } from '../../../../global/global'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-token-cw4973', @@ -42,6 +43,7 @@ export class TokenCw4973Component implements OnInit { public global: Globals, public tokenService: TokenService, public soulboundService: SoulboundService, + public commonService: CommonService, ) {} ngOnInit(): void { @@ -65,11 +67,18 @@ export class TokenCw4973Component implements OnInit { } getTokenData() { - const payload = { + this.textSearch = this.textSearch?.trim(); + let payload = { limit: this.pageData.pageSize, offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, keyword: this.textSearch, }; + + const addressNameTag = this.commonService.findNameTag(this.textSearch); + if (addressNameTag?.length > 0) { + payload['keyword'] = addressNameTag; + } + this.soulboundService.getListABT(payload).subscribe((res) => { this.dataSource = new MatTableDataSource(res?.cw721_contract); this.pageData.length = res?.cw721_contract_aggregate.aggregate.count; diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html index 80b86525f..4eaacb398 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html @@ -13,7 +13,7 @@

    Non-Fungible Tokens (NFT)

    Non-Fungible Tokens (NFT)
    - + {{ element.cw721_contract?.name | stringEllipsis : 16 }} ({{ element.cw721_contract?.symbol }}) @@ -65,9 +67,11 @@

    Non-Fungible Tokens (NFT)

    Token Contract - {{ - element.cw721_contract?.smart_contract?.address | cutStringPipe : 8 : 8 - }} + {{ + commonService.setNameTag(element.cw721_contract?.smart_contract?.address) | cutStringPipe : 8 : 8 + }} + diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts index 05bae409b..d32c7e505 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts @@ -12,6 +12,7 @@ import { TokenService } from 'src/app/core/services/token.service'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; import { TableTemplate } from '../../../../core/models/common.model'; import { Globals } from '../../../../global/global'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-token-cw721', @@ -50,6 +51,7 @@ export class TokenCw721Component implements OnInit { public global: Globals, public tokenService: TokenService, private environmentService: EnvironmentService, + public commonService: CommonService, ) {} ngOnInit(): void { @@ -69,6 +71,7 @@ export class TokenCw721Component implements OnInit { } getTokenData() { + this.textSearch = this.textSearch?.trim(); const payload = { limit: this.pageData.pageSize, offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, @@ -76,7 +79,13 @@ export class TokenCw721Component implements OnInit { sort_order: this.sortOrder, }; - this.tokenService.getListCW721Token(payload, this.textSearch).subscribe((res) => { + let keySearch = this.textSearch; + const addressNameTag = this.commonService.findNameTag(keySearch); + if (addressNameTag?.length > 0) { + keySearch = addressNameTag; + } + + this.tokenService.getListCW721Token(payload, keySearch).subscribe((res) => { this.dataSource = new MatTableDataSource(res.list_token); this.pageData.length = res.total_token?.aggregate?.count; }); diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts index 2fe3e925f..6eb81e237 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.ts @@ -176,8 +176,16 @@ export class TransactionMessagesComponent implements OnInit { let dataDenom = this.commonService.mappingNameIBC(denom); switch (data['@type']) { case this.eTransType.Send: - result.push({ key: 'From Address', value: data?.from_address, link: { url: '/account' } }); - result.push({ key: 'To Address', value: data?.to_address, link: { url: '/account' } }); + result.push({ + key: 'From Address', + value: this.commonService.setNameTag(data?.from_address), + link: { url: '/account', data: data?.from_address }, + }); + result.push({ + key: 'To Address', + value: this.commonService.setNameTag(data?.to_address), + link: { url: '/account', data: data?.to_address }, + }); result.push({ key: 'Amount', value: data?.amount[0]?.amount, @@ -196,8 +204,8 @@ export class TransactionMessagesComponent implements OnInit { this.checkGetReward(); result.push({ key: 'Delegator Address', - value: data?.delegator_address, - link: { url: '/account' }, + value: this.commonService.setNameTag(data?.delegator_address), + link: { url: '/account', data: data?.delegator_address }, }); result.push({ key: 'Validator Address', @@ -236,8 +244,8 @@ export class TransactionMessagesComponent implements OnInit { case this.eTransType.Redelegate: result.push({ key: 'Delegator Address', - value: data?.delegator_address, - link: { url: '/account' }, + value: this.commonService.setNameTag(data?.delegator_address), + link: { url: '/account', data: data?.delegator_address }, }); result.push({ key: 'Source Validator Address', @@ -266,8 +274,16 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.GrantAuthz: - result.push({ key: 'Granter', value: data?.granter, link: { url: '/account' } }); - result.push({ key: 'Grantee', value: data?.grantee, link: { url: '/account' } }); + result.push({ + key: 'Granter', + value: this.commonService.setNameTag(data?.granter), + link: { url: '/account', data: data?.granter }, + }); + result.push({ + key: 'Grantee', + value: this.commonService.setNameTag(data?.grantee), + link: { url: '/account', data: data?.grantee }, + }); result.push({ key: 'Authorization Type', value: data?.grant?.authorization?.authorization_type }); result.push({ key: 'Expiration', value: this.getDateValue(data?.grant?.expiration) || '-' }); result.push({ @@ -279,7 +295,11 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.ExecuteAuthz: - result.push({ key: 'Grantee', value: data?.grantee, link: { url: '/account' } }); + result.push({ + key: 'Grantee', + value: this.commonService.setNameTag(data?.grantee), + link: { url: '/account', data: data?.grantee }, + }); result.push({ key: 'Authorization Type', value: data?.msgs[0]['@type'] }); result.push({ key: 'Total Amount Execute', @@ -291,15 +311,31 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.RevokeAuthz: - result.push({ key: 'Granter', value: data?.granter, link: { url: '/account' } }); - result.push({ key: 'Grantee', value: data?.grantee, link: { url: '/account' } }); + result.push({ + key: 'Granter', + value: this.commonService.setNameTag(data?.granter), + link: { url: '/account', data: data?.granter }, + }); + result.push({ + key: 'Grantee', + value: this.commonService.setNameTag(data?.grantee), + link: { url: '/account', data: data?.grantee }, + }); result.push({ key: 'Message Type Url', value: data.msg_type_url }); break; case this.eTransType.ExecuteContract: this.displayMsgRaw(index); - result.push({ key: 'Contract', value: data?.contract, link: { url: '/contracts' } }); - result.push({ key: 'Sender', value: data?.sender, link: { url: '/account' } }); + result.push({ + key: 'Contract', + value: this.commonService.setNameTag(data?.contract), + link: { url: '/contracts', data: data?.contract }, + }); + result.push({ + key: 'Sender', + value: this.commonService.setNameTag(data?.sender), + link: { url: '/account', data: data?.sender }, + }); result.push({ key: 'Messages', value: this.objMsgContract, pipeType: pipeTypeData.Json }); break; @@ -308,19 +344,23 @@ export class TransactionMessagesComponent implements OnInit { this.displayMsgRaw(index); result.push({ key: 'Contract', - value: this.getDataJson('_contract_address'), - link: { url: '/contracts' }, + value: this.commonService.setNameTag(this.getDataJson('_contract_address')), + link: { url: '/contracts', data: this.getDataJson('_contract_address') }, }); result.push({ key: 'Label', value: data?.label }); - result.push({ key: 'Sender', value: data?.sender, link: { url: '/account' } }); + result.push({ + key: 'Sender', + value: this.commonService.setNameTag(data?.sender), + link: { url: '/account', data: data?.sender }, + }); result.push({ key: 'Messages', value: this.objMsgContract, pipeType: pipeTypeData.Json }); break; case this.eTransType.StoreCode: result.push({ key: 'Sender', - value: data?.sender || data?.validator_address, - link: { url: '/account' }, + value: this.commonService.setNameTag(data?.sender || data?.validator_address), + link: { url: '/account', data: data?.sender || data?.validator_address }, }); result.push({ key: 'Code Id', value: this.getStoreCode(index), link: { url: '/code-ids/detail' } }); result.push({ value: data?.wasm_byte_code, specialCase: this.specialCase.ByteCode }); @@ -328,20 +368,40 @@ export class TransactionMessagesComponent implements OnInit { case this.eTransType.Vote: result.push({ key: 'Proposal Id', value: this.getLongValue(data.proposal_id), link: { url: '/votings' } }); - result.push({ key: 'Voter', value: data.voter, link: { url: '/account' } }); + result.push({ + key: 'Voter', + value: this.commonService.setNameTag(data.voter), + link: { url: '/account', data: data.voter }, + }); result.push({ key: 'Option', value: this.parsingOptionVote(data?.option) }); break; case this.eTransType.PeriodicVestingAccount: - result.push({ key: 'From Address', value: data.from_address, link: { url: '/account' } }); - result.push({ key: 'To Address', value: data.to_address, link: { url: '/account' } }); + result.push({ + key: 'From Address', + value: this.commonService.setNameTag(data.from_address), + link: { url: '/account', data: data.from_address }, + }); + result.push({ + key: 'To Address', + value: this.commonService.setNameTag(data.to_address), + link: { url: '/account', data: data.to_address }, + }); result.push({ key: 'Start Time', value: this.dateVesting }); result.push({ key: 'Vesting Periods', value: data.vesting_periods, pipeType: pipeTypeData.Json }); break; case this.eTransType.Vesting: - result.push({ key: 'From Address', value: data.from_address, link: { url: '/account' } }); - result.push({ key: 'To Address', value: data.to_address, link: { url: '/account' } }); + result.push({ + key: 'From Address', + value: this.commonService.setNameTag(data.from_address), + link: { url: '/account', data: data.from_address }, + }); + result.push({ + key: 'To Address', + value: this.commonService.setNameTag(data.to_address), + link: { url: '/account', data: data.to_address }, + }); result.push({ key: 'Vesting Schedule', value: this.dateVesting }); break; @@ -376,7 +436,11 @@ export class TransactionMessagesComponent implements OnInit { denom: data.min_self_delegation > 0 ? { display: this.denom } : null, pipeType: pipeTypeData.BalanceOf, }); - result.push({ key: 'Delegator Address', value: data.delegator_address, link: { url: '/account' } }); + result.push({ + key: 'Delegator Address', + value: this.commonService.setNameTag(data.delegator_address), + link: { url: '/account', data: data.delegator_address }, + }); result.push({ key: 'Validator Address', value: data.validator_address, link: { url: '/validators' } }); result.push({ key: 'Amount', @@ -425,7 +489,11 @@ export class TransactionMessagesComponent implements OnInit { pipeType: pipeTypeData.BalanceOf, denom: data.initial_deposit[0].amount > 0 ? { display: this.denom } : null, }); - result.push({ key: 'Proposer', value: data.proposer, link: { url: '/account' } }); + result.push({ + key: 'Proposer', + value: this.commonService.setNameTag(data.proposer), + link: { url: '/account', data: data.proposer }, + }); if (this.transactionDetail?.tx?.logs?.length > 0) { result.push({ key: 'Proposal Id', @@ -441,8 +509,16 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.MsgGrantAllowance: - result.push({ key: 'Granter', value: data.granter, link: { url: '/account' } }); - result.push({ key: 'Grantee', value: data.grantee, link: { url: '/account' } }); + result.push({ + key: 'Granter', + value: this.commonService.setNameTag(data.granter), + link: { url: '/account', data: data.granter }, + }); + result.push({ + key: 'Grantee', + value: this.commonService.setNameTag(data.grantee), + link: { url: '/account', data: data.grantee }, + }); result.push({ key: 'Type', value: this.typeGrantAllowance }); result.push({ key: 'Spend Limit', @@ -487,13 +563,25 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.MsgRevokeAllowance: - result.push({ key: 'Granter', value: data.granter, link: { url: '/account' } }); - result.push({ key: 'Grantee', value: data.grantee, link: { url: '/account' } }); + result.push({ + key: 'Granter', + value: this.commonService.setNameTag(data.granter), + link: { url: '/account', data: data.granter }, + }); + result.push({ + key: 'Grantee', + value: this.commonService.setNameTag(data.grantee), + link: { url: '/account', data: data.grantee }, + }); break; case this.eTransType.Deposit: result.push({ key: 'Proposal Id', value: this.getLongValue(data.proposal_id), link: { url: '/votings' } }); - result.push({ key: 'Depositor', value: data.depositor, link: { url: '/account' } }); + result.push({ + key: 'Depositor', + value: this.commonService.setNameTag(data.depositor), + link: { url: '/account', data: data.depositor }, + }); result.push({ key: 'Amount', value: data?.amount[0]?.amount, @@ -504,7 +592,11 @@ export class TransactionMessagesComponent implements OnInit { case this.eTransType.Deposit: result.push({ key: 'Proposal Id', value: this.getLongValue(data.proposal_id), link: { url: '/votings' } }); - result.push({ key: 'Depositor', value: data.depositor, link: { url: '/account' } }); + result.push({ + key: 'Depositor', + value: this.commonService.setNameTag(data.depositor), + link: { url: '/account', data: data.depositor }, + }); result.push({ key: 'Amount', value: data?.amount[0]?.amount, @@ -514,14 +606,26 @@ export class TransactionMessagesComponent implements OnInit { break; case this.eTransType.MsgMigrateContract: - result.push({ key: 'Sender', value: data.sender, link: { url: '/account' } }); + result.push({ + key: 'Sender', + value: this.commonService.setNameTag(data.sender), + link: { url: '/account', data: data.sender }, + }); result.push({ key: 'Contract', value: data.contract, link: { url: '/contracts' } }); result.push({ key: 'Code ID', value: data.code_id, link: { url: '/code-ids/detail' } }); break; case this.eTransType.ModifyWithdrawAddress: - result.push({ key: 'Delegator Address', value: data.delegator_address, link: { url: '/account' } }); - result.push({ key: 'Withdraw Address', value: data.withdraw_address, link: { url: '/account' } }); + result.push({ + key: 'Delegator Address', + value: this.commonService.setNameTag(data.delegator_address), + link: { url: '/account', data: data.delegator_address }, + }); + result.push({ + key: 'Withdraw Address', + value: this.commonService.setNameTag(data.withdraw_address), + link: { url: '/account', data: data.withdraw_address }, + }); break; case this.eTransType.GetRewardCommission: diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.html b/src/app/pages/validators/validators-detail/validators-detail.component.html index 714a3f23e..7a5300040 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.html +++ b/src/app/pages/validators/validators-detail/validators-detail.component.html @@ -349,7 +349,7 @@

    Delegators

    *ngSwitchCase="'delegator_address'" class="text--primary cursor-pointer" [routerLink]="['/account', data.delegator_address]"> - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + {{ commonService.setNameTag(data[template.matColumnDef], global.listNameTag) | cutStringPipe : 8 : 8 }}
    {{ data[template.matColumnDef] | mask : 'separator.6' }} @@ -376,7 +376,7 @@

    Delegators

    [link]="'/account/' + data.delegator_address" [content]="[ { - label: data.delegator_address | cutStringPipe : 6 : 6, + label: commonService.setNameTag(data.delegator_address) | cutStringPipe : 6 : 6, info: '' }, { diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index 07c1d8aa4..aec10f55f 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -255,6 +255,7 @@ export class ValidatorsComponent implements OnInit, OnDestroy { } searchValidator(): void { + this.textSearch = this.textSearch?.trim(); let result = this.rawData.filter((event) => this.typeValidator === this.statusValidator.Active ? event.status === this.statusValidator.Active @@ -639,7 +640,9 @@ export class ValidatorsComponent implements OnInit, OnDestroy { f.validator_address = data.validator_address; f.validator_name = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.title; f.jailed = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.jailed; - f.validator_identity = this.lstValidatorOrigin.find((i) => i.operator_address === f.validator_address)?.identity; + f.validator_identity = this.lstValidatorOrigin.find( + (i) => i.operator_address === f.validator_address, + )?.identity; let timeConvert = new Date(f.completion_time); if (now < timeConvert) { this.lstUndelegate.push(f); diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index 0602573a3..0c2172c9c 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -58,7 +58,12 @@ template?.isUrl, template?.paramField ? data[template?.paramField] : data[template.matColumnDef] ]"> - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} + + + {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} +
    -
    diff --git a/src/app/shared/components/contract-table/contract-table.component.ts b/src/app/shared/components/contract-table/contract-table.component.ts index 102b2a6cd..a6e1bbb77 100644 --- a/src/app/shared/components/contract-table/contract-table.component.ts +++ b/src/app/shared/components/contract-table/contract-table.component.ts @@ -10,6 +10,7 @@ import { TRANSACTION_TYPE_ENUM } from 'src/app/core/constants/transaction.enum'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { DROPDOWN_ELEMENT, IContractPopoverData, ITableContract } from 'src/app/core/models/contract.model'; +import { CommonService } from 'src/app/core/services/common.service'; import { balanceOf, parseLabel } from 'src/app/core/utils/common/parsing'; import { Globals } from 'src/app/global/global'; import { DropdownElement } from 'src/app/shared/components/dropdown/dropdown.component'; @@ -66,6 +67,7 @@ export class ContractTableComponent implements OnInit, OnChanges { public translate: TranslateService, public global: Globals, private environmentService: EnvironmentService, + public commonService: CommonService ) {} ngOnChanges(): void { From 24aed075f8d4fab29a1d507f3defb0ba7d8bc055 Mon Sep 17 00:00:00 2001 From: mtam Date: Wed, 28 Jun 2023 16:37:22 +0700 Subject: [PATCH 190/315] [TamTM6] update name tag part 2 --- .../pages/proposal/proposal-table/proposal-table.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index 086993405..8c64e3176 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -196,7 +196,7 @@ ? '' + - shortenAddress(data.depositors) + + (commonService.setNameTag(data.depositors) | cutStringPipe : 8 : 8) + '' : '-' }, From ae5b39f806e3f321e9a92ba32e72cd4a294fd33f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 28 Jun 2023 16:53:05 +0700 Subject: [PATCH 191/315] fix issue CW20 --- .../token/token-list/token-cw20/token-cw20.component.html | 6 +----- .../token/token-list/token-cw20/token-cw20.component.ts | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html index 822cdaa6a..06f9d5482 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html @@ -73,10 +73,6 @@

    CW-20 Tokens

    class="ml-1 mb-1" *ngIf="element.verify_status === 'VERIFIED'" />
    - -
    @@ -178,7 +174,7 @@

    CW-20 Tokens

    - +
    diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts index 865721a1c..b6422f0b7 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts @@ -98,9 +98,9 @@ export class TokenCw20Component implements OnInit, OnDestroy { map((res) => { const count = _.get(res, `cw20_contract_aggregate`); const cw20Data = _.get(res, `cw20_contract`); - cw20Total = [...cw20Total, ...cw20Data]; // Get more data when response data less than total data if (cw20Total.length < count?.aggregate?.count) { + cw20Total = [...cw20Total, ...cw20Data]; payload = { offset: cw20Total.length, }; @@ -169,10 +169,6 @@ export class TokenCw20Component implements OnInit, OnDestroy { nChainMarketCap: +tokenFind?.circulating_market_cap || 0, volume: +tokenFind?.total_volume || 0, price: +tokenFind?.current_price || 0, - // isValueUp: data.price_change_percentage_24h < 0 ? false : true, - // change: Number(data.price_change_percentage_24h.toString()), - // isHolderUp: data.holders_change_percentage_24h < 0 ? false : true, - // holderChange: Number(data.holders_change_percentage_24h.toString()), isHolderUp: true, isValueUp: 0, change: 0, @@ -194,7 +190,7 @@ export class TokenCw20Component implements OnInit, OnDestroy { this.pageData.length = res?.length; }); }, - () => {}, + (e) => {}, () => { this.isLoading = false; }, From 5d5d35277d18c27c5c36ca2621a7d0fb191b9f8e Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 28 Jun 2023 17:06:21 +0700 Subject: [PATCH 192/315] fix issue --- .../code-id-contracts-tab/code-id-contracts-tab.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html index 2d4cd8bf5..af1bdd75a 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html @@ -34,7 +34,7 @@ data[template.matColumnDef] ]" [class.disabled-link]="!data[template.matColumnDef]"> - {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} + {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} From 83301203f527ac75c267c524e759ba455d6460c9 Mon Sep 17 00:00:00 2001 From: nthduc95 Date: Wed, 28 Jun 2023 17:37:50 +0700 Subject: [PATCH 193/315] fix filter contract list --- src/app/core/services/contract.service.ts | 16 +++++++++------- .../contracts-list/contracts-list.component.ts | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index ade4cf605..1460c3c02 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -49,7 +49,9 @@ export class ContractService extends CommonService { const isFilterCW4973 = contractType?.includes('CW4973'); let typeQuery = isFilterCW4973 ? '_or: [{code: {type: {_in: $type}}}, {name: {_eq: "crates.io:cw4973"}}],' - : 'code: {type: {_in: $type}}, name: {_neq: "crates.io:cw4973"}'; + : contractType?.includes('CW721') || contractType?.includes('CW20') + ? 'code: {type: {_in: $type}}, name: {_neq: "crates.io:cw4973"}' + : 'code: {_or: [{type: {_in: $type}}, {_and: {type: {_is_null: true}}}]}'; if (keyword?.length >= LENGTH_CHARACTER.CONTRACT) { address = keyword; @@ -192,7 +194,7 @@ export class ContractService extends CommonService { variables: { code_id: payload.codeId, limit: payload.limit, - offset: payload.offset + offset: payload.offset, }, operationName: 'queryListContractByCodeID', }) @@ -289,10 +291,10 @@ export class ContractService extends CommonService { } else if (keyword.length >= LENGTH_CHARACTER.ADDRESS) { subQuery = `creator: {_eq: "${keyword}"}`; } else { - subQuery = `code_id: {_eq: ${keyword}}` - }; + subQuery = `code_id: {_eq: ${keyword}}`; + } } - + const query = `query queryContractCode($limit: Int, $offset: Int) { ${this.envDB} { code(where: {${subQuery}}, order_by: {code_id: desc}, limit: $limit, offset: $offset) { @@ -323,7 +325,7 @@ export class ContractService extends CommonService { } } } - }` + }`; return this.http .post(this.graphUrl, { query: query, @@ -362,7 +364,7 @@ export class ContractService extends CommonService { } } } - }` + }`; return this.http .post(this.graphUrl, { query: query, diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index c34edb936..3c9015745 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -77,7 +77,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { limit: this.pageData.pageSize, offset: (this.pageData.pageIndex - 1) * this.pageData.pageSize, keyword: this.textSearch, - contractType: this.filterButtons?.length ? this.filterButtons : null, + contractType: this.filterButtons?.length > 0 && this.filterButtons?.length < 4 ? this.filterButtons : null, }; this.contractService.getListContract(payload).subscribe((res) => { From 439dfb777bd20f5b775df6e9958f3ab0ebc3ec77 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 29 Jun 2023 09:39:58 +0700 Subject: [PATCH 194/315] [TamTM6] update validator part 5, get rank, get image account detail tab stake --- .../account-detail-table.component.html | 8 +- .../account-detail-table.component.ts | 10 -- .../account-detail.component.ts | 157 +++++++++--------- .../validators-detail.component.ts | 18 +- 4 files changed, 93 insertions(+), 100 deletions(-) diff --git a/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.html b/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.html index dde4b25f2..a1521709d 100644 --- a/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.html +++ b/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.html @@ -60,7 +60,7 @@ + [srcImg]="data.image_src_url">
    @@ -76,7 +76,7 @@ + [srcImg]="data.image_dst_url">
    @@ -185,7 +185,7 @@ + [srcImg]="item['image_src_url']">
    @@ -205,7 +205,7 @@ + [srcImg]="item['image_dst_url']">
    diff --git a/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts b/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts index 58afe880c..0188f3b83 100644 --- a/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts +++ b/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts @@ -81,16 +81,6 @@ export class AccountDetailTableComponent implements OnInit, OnChanges, AfterView operatorAddArr.push(f.validator_src_address); operatorAddArr.push(f.validator_dst_address); } - - // if (this.pageEventType !== 'Redelegation' && imgObj.operator_address == item.validator_address) { - // item['image_url'] = imgObj.image_url; - // } - // if (this.pageEventType === 'Redelegation' && imgObj.operator_address == item.validator_src_address) { - // item['src_image_url'] = imgObj.image_url; - // } - // if (this.pageEventType === 'Redelegation' && imgObj.operator_address == item.validator_dst_address) { - // item['dst_image_url'] = imgObj.image_url; - // } }); } } diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index 954130425..9fef6e97b 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -351,87 +351,92 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { getAccountDetail(): void { this.isNoData = false; const halftime = 15000; - this.accountService.getAccountDetail(this.currentAddress).subscribe((res) => { - this.chartLoading = true; - this.accDetailLoading = true; - if (res.data.code === 200 && !res.data?.data) { - this.isNoData = true; - setTimeout(() => { - this.getAccountDetail(); - }, halftime); - return; - } + this.accountService.getAccountDetail(this.currentAddress).subscribe( + (res) => { + console.log(res); + + if (res.data.code === 200 && !res.data?.data) { + this.isNoData = true; + setTimeout(() => { + this.getAccountDetail(); + }, halftime); + return; + } + + if (res?.data) { + this.currentAccountDetail = res.data; + this.chartOptions.series = []; + if (+this.currentAccountDetail.commission > 0) { + this.chartOptions.labels.push(ACCOUNT_WALLET_COLOR_ENUM.Commission); + this.chartOptions.colors.push(WalletAcount.Commission); + this.chartCustomOptions.push({ + name: ACCOUNT_WALLET_COLOR_ENUM.Commission, + color: WalletAcount.Commission, + amount: '0.000000', + }); + } else { + this.chartCustomOptions = chartCustomOptions; + } - if (res?.data) { - this.currentAccountDetail = res.data; - this.chartOptions.series = []; - if (+this.currentAccountDetail.commission > 0) { - this.chartOptions.labels.push(ACCOUNT_WALLET_COLOR_ENUM.Commission); - this.chartOptions.colors.push(WalletAcount.Commission); - this.chartCustomOptions.push({ - name: ACCOUNT_WALLET_COLOR_ENUM.Commission, - color: WalletAcount.Commission, - amount: '0.000000', + this.chartCustomOptions.forEach((f) => { + switch (f.name) { + case ACCOUNT_WALLET_COLOR_ENUM.Available: + f.amount = this.currentAccountDetail.available; + break; + case ACCOUNT_WALLET_COLOR_ENUM.Delegated: + f.amount = this.currentAccountDetail.delegated; + break; + case ACCOUNT_WALLET_COLOR_ENUM.StakingReward: + f.amount = this.currentAccountDetail.stake_reward; + break; + case ACCOUNT_WALLET_COLOR_ENUM.Commission: + f.amount = this.currentAccountDetail.commission; + break; + case ACCOUNT_WALLET_COLOR_ENUM.Unbonding: + f.amount = this.currentAccountDetail.unbonding; + break; + case ACCOUNT_WALLET_COLOR_ENUM.DelegableVesting: + f.amount = this.currentAccountDetail?.delegable_vesting; + break; + default: + break; + } + f.amount = f.amount || '0'; + this.chartOptions.series.push(Number(f.amount)); }); - } else { - this.chartCustomOptions = chartCustomOptions; - } + this.dataSourceToken.data = this.currentAccountDetail?.balances; + this.pageDataToken.length = this.currentAccountDetail?.balances?.length; + this.dataSourceTokenBk = this.dataSourceToken; + + this.dataSourceDelegation.data = this.currentAccountDetail?.delegations; + this.pageDataDelegation.length = this.currentAccountDetail?.delegations?.length; - this.chartCustomOptions.forEach((f) => { - switch (f.name) { - case ACCOUNT_WALLET_COLOR_ENUM.Available: - f.amount = this.currentAccountDetail.available; - break; - case ACCOUNT_WALLET_COLOR_ENUM.Delegated: - f.amount = this.currentAccountDetail.delegated; - break; - case ACCOUNT_WALLET_COLOR_ENUM.StakingReward: - f.amount = this.currentAccountDetail.stake_reward; - break; - case ACCOUNT_WALLET_COLOR_ENUM.Commission: - f.amount = this.currentAccountDetail.commission; - break; - case ACCOUNT_WALLET_COLOR_ENUM.Unbonding: - f.amount = this.currentAccountDetail.unbonding; - break; - case ACCOUNT_WALLET_COLOR_ENUM.DelegableVesting: - f.amount = this.currentAccountDetail?.delegable_vesting; - break; - default: - break; + this.dataSourceUnBonding.data = this.currentAccountDetail?.unbonding_delegations; + this.pageDataUnbonding.length = this.currentAccountDetail?.unbonding_delegations?.length; + this.dataSourceReDelegation.data = this.currentAccountDetail?.redelegations; + this.pageDataRedelegation.length = this.currentAccountDetail?.redelegations?.length; + + if (this.currentAccountDetail?.vesting) { + this.dataSourceVesting = new MatTableDataSource([this.currentAccountDetail?.vesting]); + this.pageDataVesting.length = 1; + } + + if (this.userAddress === this.currentAddress) { + local.removeItem('accountDetail'); + //store data wallet info + let accountDetail = {}; + accountDetail['dataAccount'] = JSON.stringify(this.currentAccountDetail); + accountDetail['dataChart'] = JSON.stringify(this.chartOptions); + local.setItem('accountDetail', accountDetail); } - f.amount = f.amount || '0'; - this.chartOptions.series.push(Number(f.amount)); - }); - this.dataSourceToken.data = this.currentAccountDetail?.balances; - this.pageDataToken.length = this.currentAccountDetail?.balances?.length; - this.dataSourceTokenBk = this.dataSourceToken; - - this.dataSourceDelegation.data = this.currentAccountDetail?.delegations; - this.pageDataDelegation.length = this.currentAccountDetail?.delegations?.length; - - this.dataSourceUnBonding.data = this.currentAccountDetail?.unbonding_delegations; - this.pageDataUnbonding.length = this.currentAccountDetail?.unbonding_delegations?.length; - this.dataSourceReDelegation.data = this.currentAccountDetail?.redelegations; - this.pageDataRedelegation.length = this.currentAccountDetail?.redelegations?.length; - - if (this.currentAccountDetail?.vesting) { - this.dataSourceVesting = new MatTableDataSource([this.currentAccountDetail?.vesting]); - this.pageDataVesting.length = 1; } + }, + () => {}, + () => { this.accDetailLoading = false; this.chartLoading = false; - - if (this.userAddress === this.currentAddress) { - local.removeItem('accountDetail'); - //store data wallet info - let accountDetail = {}; - accountDetail['dataAccount'] = JSON.stringify(this.currentAccountDetail); - accountDetail['dataChart'] = JSON.stringify(this.chartOptions); - local.setItem('accountDetail', accountDetail); - } - } - }); + }, + ); } searchToken(): void { @@ -484,10 +489,6 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { }); } - splitDataSource(d: any[]) { - return d.slice(0, 5); - } - closePopup() { this.modalReference.close(); } diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index efe8e41da..6f8714b2a 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -141,19 +141,19 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { getDetail(isInit = false): void { if (!this.isLeftPage) { - const payload = { - limit: 1, - offset: 0, - operatorAddress: this.currentAddress, - }; - this.validatorService.getDataValidator(payload).subscribe( + this.validatorService.getDataValidator(null).subscribe( (res) => { if (res.status === 404 || res.validator?.length === 0) { this.router.navigate(['/']); return; } - const data = res.validator[0]; + const arrActive = res.validator.filter((k) => k.status === this.typeActive); + const arrInactive = res.validator.filter((k) => k.status !== this.typeActive && !k.jailed); + const arrJail = res.validator.filter((k) => k.status !== this.typeActive && k.jailed); + const arrRank = [...arrActive, ...arrInactive, ...arrJail]; + + const data = res.validator.find((k) => k.operator_address === this.currentAddress); this.currentValidatorDetail = { ...data, self_bonded: balanceOf(data.self_delegation_balance), @@ -167,9 +167,11 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { percent_power: data.percent_voting_power?.toFixed(2), bonded_height: data.start_height || 1, status: data.status === this.typeActive ? this.statusValidator.Active : data.status, + rank: arrRank?.findIndex((k) => k.operator_address === this.currentAddress) + 1 || 1, }; - const percentSelfBonded = (this.currentValidatorDetail.self_delegation_balance / this.currentValidatorDetail.tokens) * 100; + const percentSelfBonded = + (this.currentValidatorDetail.self_delegation_balance / this.currentValidatorDetail.tokens) * 100; this.currentValidatorDetail.percent_self_bonded = percentSelfBonded.toFixed(2) + '%'; if (this.currentValidatorDetail?.consensus_hex_address && isInit) { From 08f29ed7a9ec0645896cb088a34727bc9c49a6bb Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 29 Jun 2023 09:42:57 +0700 Subject: [PATCH 195/315] remove consolelog --- .../pages/account/account-detail/account-detail.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/pages/account/account-detail/account-detail.component.ts b/src/app/pages/account/account-detail/account-detail.component.ts index 9fef6e97b..2e2ce66dc 100644 --- a/src/app/pages/account/account-detail/account-detail.component.ts +++ b/src/app/pages/account/account-detail/account-detail.component.ts @@ -353,8 +353,6 @@ export class AccountDetailComponent implements OnInit, AfterViewInit { const halftime = 15000; this.accountService.getAccountDetail(this.currentAddress).subscribe( (res) => { - console.log(res); - if (res.data.code === 200 && !res.data?.data) { this.isNoData = true; setTimeout(() => { From 4ba2b968ebeaa664a60580dd21f1bdb94efb7059 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 29 Jun 2023 10:39:27 +0700 Subject: [PATCH 196/315] [TamTM6] update name tag part 3 --- src/app/app.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3ee6090cb..b7565aba8 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -64,7 +64,7 @@ export class AppComponent implements OnInit { getListNameTag(): void { const payload = { - limit: 200, + limit: 500, keyword: [], nextKey: 0, }; From 5f56274b448bebcaf1e21026482d19cdfb936fba Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 29 Jun 2023 11:27:47 +0700 Subject: [PATCH 197/315] uncomment statistic --- src/app/app-routing.module.ts | 8 +-- src/app/layouts/horizontaltopbar/menu.ts | 74 ++++++++++++------------ 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1e8fcbcee..7edc77b5a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -35,10 +35,10 @@ const routes: Routes = [ path: 'tokens', loadChildren: () => import('./pages/token/token.module').then((m) => m.TokenModule), }, - // { - // path: 'statistics', - // loadChildren: () => import('./pages/statistics/statistics.module').then((m) => m.StatisticsModule), - // }, + { + path: 'statistics', + loadChildren: () => import('./pages/statistics/statistics.module').then((m) => m.StatisticsModule), + }, { path: 'contracts', loadChildren: () => import('./pages/contracts/contracts.module').then((m) => m.ContractsModule), diff --git a/src/app/layouts/horizontaltopbar/menu.ts b/src/app/layouts/horizontaltopbar/menu.ts index cd61ec266..03232106d 100644 --- a/src/app/layouts/horizontaltopbar/menu.ts +++ b/src/app/layouts/horizontaltopbar/menu.ts @@ -116,29 +116,29 @@ export const MENU: MenuItem[] = [ }, ], }, - // { - // id: 6, - // label: 'MENUITEMS.STATISTICS', - // icon: 'chart-line', - // link: '/', - // name: MenuName.Statistic, - // subItems: [ - // { - // id: 1, - // label: 'MENUITEMS.CHART-STATS', - // link: '/statistics/charts-stats', - // name: MenuName.ChartStats, - // icon: 'line-segments', - // }, - // { - // id: 2, - // label: 'MENUITEMS.TOP-STATISTICS', - // link: '/statistics/top-statistic', - // name: MenuName.TopStatistics, - // icon: 'chart-line-up', - // }, - // ], - // }, + { + id: 6, + label: 'MENUITEMS.STATISTICS', + icon: 'chart-line', + link: '/', + name: MenuName.Statistic, + subItems: [ + { + id: 1, + label: 'MENUITEMS.CHART-STATS', + link: '/statistics/charts-stats', + name: MenuName.ChartStats, + icon: 'line-segments', + }, + { + id: 2, + label: 'MENUITEMS.TOP-STATISTICS', + link: '/statistics/top-statistic', + name: MenuName.TopStatistics, + icon: 'chart-line-up', + }, + ], + }, { id: 5, label: 'MENUITEMS.MORE', @@ -260,20 +260,20 @@ export const MENU_MOB: MenuItem[] = [ link: '/code-ids/list', name: MenuName.CodeList, }, - // { - // id: 3, - // label: 'MENUITEMS.CHART-STATS', - // link: '/statistics/charts-stats', - // name: MenuName.ChartStats, - // icon: 'line-segments', - // }, - // { - // id: 4, - // label: 'MENUITEMS.TOP-STATISTICS', - // link: '/statistics/top-statistic', - // name: MenuName.TopStatistics, - // icon: 'chart-line-up', - // }, + { + id: 3, + label: 'MENUITEMS.CHART-STATS', + link: '/statistics/charts-stats', + name: MenuName.ChartStats, + icon: 'line-segments', + }, + { + id: 4, + label: 'MENUITEMS.TOP-STATISTICS', + link: '/statistics/top-statistic', + name: MenuName.TopStatistics, + icon: 'chart-line-up', + }, ], }, { From 7d713aa98cd6999ac69609f95ac7011025d82204 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 30 Jun 2023 09:26:26 +0700 Subject: [PATCH 198/315] [TamTM6] update name tag part 4, add tooltip for nametag > 16 char --- src/app/core/services/common.service.ts | 9 ++++++++ src/app/core/services/token.service.ts | 2 +- .../horizontaltopbar.component.ts | 2 -- .../account-detail.component.html | 9 +++++--- .../account-detail.component.scss | 3 +++ .../code-id-contracts-tab.component.html | 12 +++++++--- .../code-id-list/code-id-list.component.html | 5 ++++- .../contract-info-card.component.html | 7 +++++- .../contracts-list.component.html | 3 +++ .../contracts-list.component.ts | 2 +- .../proposal-table.component.html | 5 ++++- .../token-holders-tab.component.html | 2 +- .../token-inventory-tab.component.html | 3 +++ .../token-transfers-tab.component.html | 18 +++++++++++++-- .../token-content.component.html | 2 +- .../token-content/token-content.component.ts | 3 +++ .../token-cw20/token-cw20.component.ts | 4 +--- .../token-cw4973/token-cw4973.component.html | 22 ++++++++++++++----- .../token-cw721/token-cw721.component.html | 9 +++++++- .../validators-detail.component.html | 13 +++++++++-- .../contract-table.component.html | 3 +++ src/assets/scss/aura-theme/table.scss | 4 ++++ src/assets/scss/custom.scss | 1 + 23 files changed, 114 insertions(+), 29 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 680c2026e..0a0d09a42 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -128,4 +128,13 @@ export class CommonService { return result; } } + + checkDisplayTooltip(address): boolean { + let result = true; + const nameTag = this.listNameTag?.find((k) => k.address === address); + if (nameTag?.name_tag !== address && nameTag?.name_tag?.length > 16) { + result = false; + } + return result; + } } diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 62163ec76..8f46cfaab 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -54,7 +54,7 @@ export class TokenService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - getTokenMarketData(payload): Observable { + getTokenMarketData(payload = {}): Observable { return this.http.post(`${this.apiUrl}/cw20-tokens/token-market`, payload); } diff --git a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts index 754869371..019b4e31e 100644 --- a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts +++ b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts @@ -354,8 +354,6 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { this.router.navigate(['blocks', this.searchValue]); }); } - } else { - this.searchValue = ''; } } } diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index 242e82d83..b93da353e 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -33,9 +33,12 @@ (click)="copyMessage(currentAddress); tooltip.toggle()" />
    -

    - {{ commonService.setNameTag(currentAddress) | cutStringPipe : 16 : 16 }} -

    +
    + {{ commonService.setNameTag(currentAddress) }} + {{ + commonService.setNameTag(currentAddress) | cutStringPipe : 8 : 8 + }} +
    Total Value
    diff --git a/src/app/pages/account/account-detail/account-detail.component.scss b/src/app/pages/account/account-detail/account-detail.component.scss index a9e9d5653..67683116b 100644 --- a/src/app/pages/account/account-detail/account-detail.component.scss +++ b/src/app/pages/account/account-detail/account-detail.component.scss @@ -157,3 +157,6 @@ section.account-detail { app-soulbound-feature-tokens { width: 100%; } +.name-tag { + width: fit-content; +} diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html index af1bdd75a..d99257636 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html @@ -14,8 +14,11 @@ - {{ shortenAddress(data[template.matColumnDef]) || '-' }} + [class.disabled-link]="!data[template.matColumnDef]" + [matTooltipPosition]="'above'" + [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" + matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}"> + {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} @@ -33,7 +36,10 @@ data[template.matColumnDef]?.length > lengthAddress ? '/contracts' : '/account', data[template.matColumnDef] ]" - [class.disabled-link]="!data[template.matColumnDef]"> + [class.disabled-link]="!data[template.matColumnDef]" + [matTooltipPosition]="'above'" + [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" + matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}"> {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} diff --git a/src/app/pages/code-ids/code-id-list/code-id-list.component.html b/src/app/pages/code-ids/code-id-list/code-id-list.component.html index b07c49ed3..c99af7bd6 100644 --- a/src/app/pages/code-ids/code-id-list/code-id-list.component.html +++ b/src/app/pages/code-ids/code-id-list/code-id-list.component.html @@ -102,7 +102,10 @@

    Code IDs

    + [class.disabled-link]="!data[template.matColumnDef]" + [matTooltipPosition]="'above'" + [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" + matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}"> {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} diff --git a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html index d67905cfc..9f5a776e3 100644 --- a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html +++ b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html @@ -35,7 +35,12 @@ Contract Creator: - + {{ commonService.setNameTag(contractDetail?.creator) | cutStringPipe : 8 : 8 }} at txn diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index 174fc4a08..18b6c2ef2 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -103,6 +103,9 @@

    Contracts

    {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.ts b/src/app/pages/contracts/contracts-list/contracts-list.component.ts index b1e0c509b..6982c0118 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.ts +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.ts @@ -64,7 +64,7 @@ export class ContractsListComponent implements OnInit, OnDestroy { this.searchSubject .asObservable() - .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + .pipe(debounceTime(500), takeUntil(this.destroy$)) .subscribe(() => { this.pageEvent(0); }); diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index 8c64e3176..d7b103f04 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -35,7 +35,10 @@ + [class.disabled-link]="!data[template.matColumnDef]" + [matTooltipPosition]="'above'" + [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" + matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}"> {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html index 3884a6882..cc1c231c8 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html @@ -31,7 +31,7 @@ - +
    diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html index 493874b38..d31cde965 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html @@ -38,6 +38,9 @@
    {{ commonService.setNameTag(item.owner) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html index a6b54a057..ef3be6a9f 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html @@ -103,11 +103,19 @@ diff --git a/src/app/pages/token/token-detail/token-content/token-content.component.html b/src/app/pages/token/token-detail/token-content/token-content.component.html index 1f1ddec6e..66b12c531 100644 --- a/src/app/pages/token/token-detail/token-content/token-content.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content.component.html @@ -22,7 +22,7 @@ {{ textSearch }}{{ commonService.setNameTag(textSearch) }}
    { - const listAddress = res?.map((item) => item.smart_contract.address); - const reqPayload = { contractAddress: listAddress }; - this.tokenService.getTokenMarketData(reqPayload).subscribe((tokenMarket) => { + this.tokenService.getTokenMarketData().subscribe((tokenMarket) => { // Flat data for mapping response api const dataFlat = res?.map((item) => { const tokenFind = tokenMarket?.find( diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html index 456720c14..473f39833 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html @@ -58,17 +58,27 @@

    Account Bound Tokens (ABT)

    Token Contract - {{ - element.smart_contract.address | cutStringPipe : 8 : 8 - }} + {{ commonService.setNameTag(element.smart_contract?.address) | cutStringPipe : 8 : 8 }} Creator - {{ - commonService.setNameTag(element.smart_contract.creator) | cutStringPipe : 8 : 8 - }} + {{ commonService.setNameTag(element.smart_contract?.creator) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html index 4eaacb398..2ffd657ec 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html @@ -67,7 +67,14 @@

    Non-Fungible Tokens (NFT)

    Token Contract - {{ commonService.setNameTag(element.cw721_contract?.smart_contract?.address) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.html b/src/app/pages/validators/validators-detail/validators-detail.component.html index 08064cb3e..9aec18ed6 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.html +++ b/src/app/pages/validators/validators-detail/validators-detail.component.html @@ -106,7 +106,10 @@
    Address
    Website
    @@ -348,8 +351,14 @@

    Delegators

    - {{ commonService.setNameTag(data[template.matColumnDef], global.listNameTag) | cutStringPipe : 8 : 8 }} + {{ + commonService.setNameTag(data[template.matColumnDef], global.listNameTag) + | cutStringPipe : 8 : 8 + }}
    {{ data[template.matColumnDef] | mask : 'separator.6' }} diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index 0c2172c9c..9394c8373 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -54,6 +54,9 @@ +
    +
    + icon + ERROR: +
    + {{errorMessage}} +
    diff --git a/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts b/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts index 5fdeab23e..d6d301dfc 100644 --- a/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts +++ b/src/app/pages/contracts/contracts-verify/contract-verify-steps/contract-verify-steps.component.ts @@ -13,6 +13,7 @@ export class ContractVerifyStepsComponent implements OnInit { @Output() isCompilerComplete = new EventEmitter(); @Output() isVerifyFail = new EventEmitter(); @Output() isVerifySuccess = new EventEmitter(); + errorMessage = null; currentStep = 0; steps = []; @@ -41,6 +42,7 @@ export class ContractVerifyStepsComponent implements OnInit { getDataVerify() { this.contractService.getVerifyCodeStep(this.currentCode).subscribe((res: IResponsesTemplates) => { + this.errorMessage = res?.error?.Message ?? null; this.steps = res?.data.map((dta) => ({ ...dta, className: this.getClassName(dta.result), diff --git a/src/app/pages/dashboard/dashboard.component.scss b/src/app/pages/dashboard/dashboard.component.scss index 30336278c..eca58f60d 100644 --- a/src/app/pages/dashboard/dashboard.component.scss +++ b/src/app/pages/dashboard/dashboard.component.scss @@ -256,37 +256,3 @@ img.icon-brand { padding-bottom: 0; } } - -.notice-warning { - padding: 16px; - background: rgba(213, 98, 94, 0.16); - border-radius: 8px; - - width: fit-content; - display: flex; - align-items: center; - flex-wrap: wrap; - - gap: 8px; - - .notice-icon { - display: flex; - align-items: center; - flex-shrink: 0; - gap: 8px; - - line-height: 18px; - - img { - height: 20px; - width: 20px; - } - } - .notice-content { - i { - font-size: 1.6rem !important; - vertical-align: text-top; - cursor: pointer; - } - } -} diff --git a/src/assets/scss/custom.scss b/src/assets/scss/custom.scss index 1819f29de..3cb0d1d95 100644 --- a/src/assets/scss/custom.scss +++ b/src/assets/scss/custom.scss @@ -631,3 +631,38 @@ body { font-size: 1.2rem !important; max-width: unset !important; } + + +.notice-warning { + padding: 16px; + background: rgba(213, 98, 94, 0.16); + border-radius: 8px; + + width: fit-content; + display: flex; + align-items: center; + flex-wrap: wrap; + + gap: 8px; + + .notice-icon { + display: flex; + align-items: center; + flex-shrink: 0; + gap: 8px; + + line-height: 18px; + + img { + height: 20px; + width: 20px; + } + } + .notice-content { + i { + font-size: 1.6rem !important; + vertical-align: text-top; + cursor: pointer; + } + } +} From 6c1b4ef7035f78f31fbd8a366cdf8fa2cd29d76b Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Fri, 30 Jun 2023 10:59:33 +0700 Subject: [PATCH 201/315] update range chart and disable scroll --- .../pages/statistics/chart-stats/chart-stats.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/pages/statistics/chart-stats/chart-stats.component.ts b/src/app/pages/statistics/chart-stats/chart-stats.component.ts index ace82b8e1..e6fb78b28 100644 --- a/src/app/pages/statistics/chart-stats/chart-stats.component.ts +++ b/src/app/pages/statistics/chart-stats/chart-stats.component.ts @@ -29,7 +29,7 @@ export class ChartStatsComponent implements OnInit { currTime = new Date(); currTimeMs = Date.parse(this.currTime + ''); - prevTime = new Date(Date.now() - 8 * 24 * 60 * 60 * 1000); + prevTime = new Date(Date.now() - 31 * 24 * 60 * 60 * 1000); prevTimeMs = Date.parse(this.prevTime + ''); constructor(public translate: TranslateService, private statisticService: StatisticService) {} @@ -77,6 +77,7 @@ export class ChartStatsComponent implements OnInit { secondsVisible: false, borderColor: '#494C58', }, + handleScroll: false }); this.dailyTransactionChartSeries = this.dailyTransactionChart.addAreaSeries({}); @@ -129,6 +130,7 @@ export class ChartStatsComponent implements OnInit { secondsVisible: false, borderColor: '#494C58', }, + handleScroll: false }); this.uniqueAddressChartSeries = this.uniqueAddressChart.addAreaSeries({}); this.uniqueAddressChartSeries.applyOptions({ @@ -179,6 +181,7 @@ export class ChartStatsComponent implements OnInit { secondsVisible: true, borderColor: '#494C58', }, + handleScroll: false }); this.dailyAddressChartSeries = this.dailyAddressChart.addAreaSeries({}); this.dailyAddressChartSeries.applyOptions({ From 0e7dbc71a053865699200d52cc9329279392c73d Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 30 Jun 2023 13:40:42 +0700 Subject: [PATCH 202/315] [TamTM6] update name tag part 5, add nametag nft detail, remove api validator --- src/app/core/services/validator.service.ts | 6 +-- .../nft-detail/nft-detail.component.html | 40 ++++++++++++++----- .../validators-detail.component.html | 2 +- .../pages/validators/validators.component.ts | 7 +--- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 05ec120fd..9155beb16 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -1,7 +1,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import axios from 'axios'; -import { BehaviorSubject, Observable } from 'rxjs'; +import { BehaviorSubject } from 'rxjs'; import { map } from 'rxjs/operators'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { CommonService } from 'src/app/core/services/common.service'; @@ -171,10 +171,6 @@ export class ValidatorService extends CommonService { .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } - validatorsDetailWallet(address: string): Observable { - return this.http.get(`${this.apiUrl}/validators/delegations/${address}`); - } - delegator(pageLimit = 100, address: string, nextKey = null) { return axios.get( `${this.chainInfo.rest}/${LCD_COSMOS.STAKING}/validators/${address}/delegations?pagination.limit=${pageLimit}&pagination.key=${nextKey}&pagination.reverse=true`, diff --git a/src/app/pages/token/nft-detail/nft-detail.component.html b/src/app/pages/token/nft-detail/nft-detail.component.html index 9c893d32f..a0bb9ea03 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.html +++ b/src/app/pages/token/nft-detail/nft-detail.component.html @@ -159,8 +159,11 @@

    Details

    - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 @@ -378,6 +390,9 @@

    Item Activity

    height="16px" /> Item Activity data.modeExecute !== modeExecuteTransaction.UnEquip && data[template.matColumnDef] "> - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }}{{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }}
    -
    diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.html b/src/app/pages/validators/validators-detail/validators-detail.component.html index 9aec18ed6..7e7d5c8ad 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.html +++ b/src/app/pages/validators/validators-detail/validators-detail.component.html @@ -80,7 +80,7 @@
    Operator Address
    diff --git a/src/app/pages/validators/validators.component.ts b/src/app/pages/validators/validators.component.ts index f1253ab3c..9aea10bd9 100644 --- a/src/app/pages/validators/validators.component.ts +++ b/src/app/pages/validators/validators.component.ts @@ -388,11 +388,8 @@ export class ValidatorsComponent implements OnInit, OnDestroy { const halftime = 10000; const currentUrl = this.router.url; if (this.userAddress && currentUrl.includes('/validators')) { - forkJoin({ - dataWallet: this.accountService.getAccountDetail(this.userAddress), - // listDelegator: this.validatorService.validatorsDetailWallet(this.userAddress), - }).subscribe( - ({ dataWallet }) => { + this.accountService.getAccountDetail(this.userAddress).subscribe( + (dataWallet) => { if (dataWallet) { this.dataDelegate = { ...this.dataDelegate, From 8c23008efb0820620ede47582041a92b329bb0fa Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 30 Jun 2023 13:42:51 +0700 Subject: [PATCH 203/315] update name query --- src/app/core/services/validator.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/validator.service.ts b/src/app/core/services/validator.service.ts index 9155beb16..19ad2a172 100644 --- a/src/app/core/services/validator.service.ts +++ b/src/app/core/services/validator.service.ts @@ -186,7 +186,7 @@ export class ValidatorService extends CommonService { getUptimeIndexer(consAddress = null, limit = 100, height = null) { const operationsDoc = ` - query MyQuery($cons_address: String, $limit: Int = 100, $height: Int = 0) { + query getUptimeIndexer($cons_address: String, $limit: Int = 100, $height: Int = 0) { ${this.envDB} { block(order_by: {height: desc}, limit: $limit, where: {height: {_eq: $height}}) { height @@ -208,7 +208,7 @@ export class ValidatorService extends CommonService { limit: limit, height: height, }, - operationName: 'MyQuery', + operationName: 'getUptimeIndexer', }) .pipe(map((res) => (res?.data ? res?.data[this.envDB] : null))); } From cdc077e514286aac0f742bf4897ddcf2a2c131e8 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 30 Jun 2023 14:01:06 +0700 Subject: [PATCH 204/315] [TamTM6] update display contract list --- .../contracts-list/contracts-list.component.html | 8 +++++++- .../contracts/contracts-list/contracts-list.component.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index 18b6c2ef2..ecdbd6271 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -100,7 +100,7 @@

    Contracts

    - + Contracts width="16px" height="16px" />
    + + {{ shortenAddress(data[template.matColumnDef]) || '-' }} +
    Date: Fri, 30 Jun 2023 14:06:00 +0700 Subject: [PATCH 205/315] [TamTM6] fix search --- .../token/token-list/token-cw4973/token-cw4973.component.ts | 6 +++--- .../token/token-list/token-cw721/token-cw721.component.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts index ed9e322d8..37ea58f85 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.ts @@ -3,15 +3,15 @@ import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; -import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; +import { debounceTime, takeUntil } from 'rxjs/operators'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; +import { CommonService } from 'src/app/core/services/common.service'; import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { TokenService } from 'src/app/core/services/token.service'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; import { TableTemplate } from '../../../../core/models/common.model'; import { Globals } from '../../../../global/global'; -import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-token-cw4973', @@ -51,7 +51,7 @@ export class TokenCw4973Component implements OnInit { this.searchSubject .asObservable() - .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + .pipe(debounceTime(500), takeUntil(this.destroy$)) .subscribe(() => { this.pageEvent(0); }); diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts index d32c7e505..1832001ab 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.ts @@ -4,15 +4,15 @@ import { MatSort, Sort } from '@angular/material/sort'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; -import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators'; +import { debounceTime, takeUntil } from 'rxjs/operators'; import { PAGE_EVENT } from 'src/app/core/constants/common.constant'; import { MAX_LENGTH_SEARCH_TOKEN } from 'src/app/core/constants/token.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { CommonService } from 'src/app/core/services/common.service'; import { TokenService } from 'src/app/core/services/token.service'; import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; import { TableTemplate } from '../../../../core/models/common.model'; import { Globals } from '../../../../global/global'; -import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-token-cw721', @@ -59,7 +59,7 @@ export class TokenCw721Component implements OnInit { this.searchSubject .asObservable() - .pipe(debounceTime(500), distinctUntilChanged(), takeUntil(this.destroy$)) + .pipe(debounceTime(500), takeUntil(this.destroy$)) .subscribe(() => { this.pageEvent(0); }); From 7cc4bb3c67c612a94a773c6120899b586b15f649 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 30 Jun 2023 14:32:16 +0700 Subject: [PATCH 206/315] [TamTM6] name tag, transaction contract --- .../contract-info-card.component.html | 13 ++++++++----- .../contracts-transactions.component.html | 2 +- .../contracts-transactions.component.ts | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html index 9f5a776e3..a85c42d89 100644 --- a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html +++ b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html @@ -9,11 +9,14 @@ My Name Tag: - {{ - commonService.setNameTag(contractDetail?.address) !== contractDetail?.address - ? commonService.setNameTag(contractDetail?.address) - : 'Not Available' - }} + + {{ commonService.setNameTag(contractDetail?.address) }} + {{ + commonService.setNameTag(contractDetail?.address) | cutStringPipe : 8 : 8 + }} + + Not Available diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.html b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.html index 32a99f05f..2558f70f6 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.html +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.html @@ -4,7 +4,7 @@

    Transactions

    diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts index f83cb70a9..f08cebdf6 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts @@ -7,6 +7,7 @@ import { CONTRACT_TABLE_TEMPLATES } from 'src/app/core/constants/contract.consta import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { ITableContract } from 'src/app/core/models/contract.model'; +import { CommonService } from 'src/app/core/services/common.service'; import { TransactionService } from 'src/app/core/services/transaction.service'; import { convertDataTransaction } from 'src/app/global/global'; import { TableData } from 'src/app/shared/components/contract-table/contract-table.component'; @@ -62,6 +63,7 @@ export class ContractsTransactionsComponent implements OnInit { private environmentService: EnvironmentService, private route: ActivatedRoute, private transactionService: TransactionService, + public commonService: CommonService ) { const valueColumn = this.templates.find((item) => item.matColumnDef === 'value'); From 26af70a51fb0a232ae46c316426e2b4b00177faa Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 30 Jun 2023 16:46:08 +0700 Subject: [PATCH 207/315] [TamTM6] update name tag --- .../community-pool/community-pool.module.ts | 2 ++ .../community-pool-proposal.component.html | 22 ++++++++++++++----- .../community-pool-proposal.component.ts | 2 +- .../summary-info/summary-info.component.html | 8 +++---- .../validators-detail.component.html | 6 ++--- .../validators-detail.component.scss | 7 ++++++ .../contract-table.component.html | 2 +- .../contract-table.component.scss | 4 ++++ 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts index e82a11904..f8a345f57 100644 --- a/src/app/pages/community-pool/community-pool.module.ts +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -15,6 +15,7 @@ import { CommunityPoolAssetComponent } from './asset-list/community-pool-asset.c import { CommunityPoolRoutingModule } from './community-pool-routing.module'; import { CommunityPoolComponent } from './community-pool.component'; import { CommunityPoolProposalComponent } from './proposal-list/community-pool-proposal.component'; +import { MatTooltipModule } from '@angular/material/tooltip'; @NgModule({ declarations: [CommunityPoolAssetComponent, CommunityPoolProposalComponent, CommunityPoolComponent], @@ -31,6 +32,7 @@ import { CommunityPoolProposalComponent } from './proposal-list/community-pool-p NgxMaskModule, CommonDirectiveModule, APaginatorModule, + MatTooltipModule ], providers: [ProposalService], }) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index a74317a23..adb690782 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -40,8 +40,13 @@

    Community Pool Spent Proposals

    Sender - - {{ shortenAddress(distributionAcc) || '-' }} + + {{ (commonService.setNameTag(distributionAcc) | cutStringPipe : 8 : 8) || '-' }} @@ -50,8 +55,13 @@

    Community Pool Spent Proposals

    Recipient - - {{ shortenAddress(element.content.recipient) || '-' }} + + {{ (commonService.setNameTag(element.content.recipient) | cutStringPipe : 8 : 8) || '-' }} @@ -114,7 +124,7 @@

    Community Pool Spent Proposals

    '' + - shortenAddress(distributionAcc) + + (commonService.setNameTag(distributionAcc) | cutStringPipe : 8 : 8) + '' }, { @@ -124,7 +134,7 @@

    Community Pool Spent Proposals

    '' + - shortenAddress(data.content.recipient) + + (commonService.setNameTag(data.content.recipient) | cutStringPipe : 8 : 8) + '' }, { diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts index 8e147e6a8..73b9bb077 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.ts @@ -60,7 +60,7 @@ export class CommunityPoolProposalComponent implements OnInit { private environmentService: EnvironmentService, private layout: BreakpointObserver, private proposalService: ProposalService, - private commonService: CommonService, + public commonService: CommonService, ) {} ngOnInit(): void { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index 48dd87b8f..2a282e6d1 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -59,15 +59,15 @@

    {{ proposalDetail?.proposer - ? proposalDetail?.proposer?.description?.moniker - : proposalDetail?.proposer_address + ? commonService.setNameTag(proposalDetail?.proposer?.description?.moniker) + : commonService.setNameTag(proposalDetail?.proposer_address) }} {{ proposalDetail?.proposer - ? proposalDetail?.proposer?.description.moniker - : (proposalDetail?.proposer_address | cutStringPipe : 8 : 8) + ? commonService.setNameTag(proposalDetail?.proposer?.description.moniker) + : (commonService.setNameTag(proposalDetail?.proposer_address) | cutStringPipe : 8 : 8) }} diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.html b/src/app/pages/validators/validators-detail/validators-detail.component.html index 7e7d5c8ad..5e324b7a6 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.html +++ b/src/app/pages/validators/validators-detail/validators-detail.component.html @@ -229,7 +229,7 @@

    Proposed Blocks

    -
    +
    Delegators -
    +
    Power Events -
    +
    div { + color: var(--aura-primary) !important; + } + } +} \ No newline at end of file diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index 9394c8373..1181777c7 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -30,7 +30,7 @@
    - +
    +
    +
    Changes
    +
    + + + + + + + + + + + + + + +
    {{row}}
    {{item[row]}}
    {{proposalDetail?.content?.plan[row]}}
    +
    +
    Details
    diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss index 8aea6023f..71734b6fc 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss @@ -234,4 +234,15 @@ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; -} \ No newline at end of file +} +.planTable { + th, td { + padding: 0 16px; + height: 32px; + } + tr { + th:first-child, td:first-child { + padding-left: 0; + } + } +} diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 66e44b191..a58a555a5 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -22,6 +22,7 @@ import { ProposalService } from '../../../../core/services/proposal.service'; import { WalletService } from '../../../../core/services/wallet.service'; import { balanceOf } from '../../../../core/utils/common/parsing'; import { ProposalVoteComponent } from '../../proposal-vote/proposal-vote.component'; +import {forEach} from "lodash"; const marked = require('marked'); @Component({ @@ -33,6 +34,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { @Input() proposalId: number; @Output() proposalDtl = new EventEmitter(); proposalDetail; + proposalDetailPlanTitleArr = [] statusConstant = PROPOSAL_STATUS; currentStatusConstant = VOTING_FINAL_STATUS; voteConstant = PROPOSAL_VOTE; @@ -49,6 +51,10 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { timerGetUpTime: any; denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; proposalStatus = null; + typeSpecial = { + SoftwareUpgrade: '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal', + ParameterChange: '/cosmos.params.v1beta1.ParameterChangeProposal' + } reload$; @@ -184,6 +190,14 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } else { this.finalSubTitle = VOTING_SUBTITLE.REJECT_3; } + + if(this.proposalDetail?.content?.plan) { + this.getProposalPlanTitle(this.proposalDetail?.content?.plan); + console.log(this.proposalDetail?.content?.plan) + console.log(this.proposalDetailPlanTitleArr) + } + + } else { this.proposalDtl.emit(this.proposalDetail); } @@ -406,4 +420,22 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { return; } } + + getProposalPlanTitle(data: any) { + if(typeof data !== "object" && data.length > 0) { + for (let key in data[0]) { + this.proposalDetailPlanTitleArr.push(key); + } + } + if(typeof data === "object") { + for (let prop in data) { + if (data.hasOwnProperty(prop)) { + this.proposalDetailPlanTitleArr.push(prop); + } + } + } + } + typeOf(value) { + return typeof value; + } } From 13e64543db8b5ac0804529293dc2c8030bb0f836 Mon Sep 17 00:00:00 2001 From: mtam Date: Mon, 3 Jul 2023 09:04:47 +0700 Subject: [PATCH 209/315] [TamTM6] get more detail proposal --- .../summary-info/summary-info.component.html | 46 ++++++++++++++----- .../summary-info/summary-info.component.ts | 34 +++++++------- 2 files changed, 50 insertions(+), 30 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index f651c03c3..c51f4d7f8 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -138,23 +138,45 @@

    -
    Changes
    + class="row justify-content-between mb-3 mb-md-4 body-02 body-01-mob" + *ngIf=" + (proposalDetail?.content['@type'] === typeSpecial.SoftwareUpgrade || + proposalDetail?.content['@type'] === typeSpecial.ParameterChange) && + proposalDetailTitleArr.length > 0 + "> +
    + Plan + + Changes + +
    - + - - - - + + + + + + + + + + + - - - - + + + + + + +
    {{row}}{{ row }}
    {{item[row]}}
    {{ item[row] }}
    {{ proposalDetail?.content?.plan[row] }}
    {{proposalDetail?.content?.plan[row]}}
    {{ item[row] }}
    diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index a58a555a5..2e5526bad 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -22,7 +22,7 @@ import { ProposalService } from '../../../../core/services/proposal.service'; import { WalletService } from '../../../../core/services/wallet.service'; import { balanceOf } from '../../../../core/utils/common/parsing'; import { ProposalVoteComponent } from '../../proposal-vote/proposal-vote.component'; -import {forEach} from "lodash"; +import { forEach } from 'lodash'; const marked = require('marked'); @Component({ @@ -34,7 +34,7 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { @Input() proposalId: number; @Output() proposalDtl = new EventEmitter(); proposalDetail; - proposalDetailPlanTitleArr = [] + proposalDetailTitleArr = []; statusConstant = PROPOSAL_STATUS; currentStatusConstant = VOTING_FINAL_STATUS; voteConstant = PROPOSAL_VOTE; @@ -53,8 +53,8 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { proposalStatus = null; typeSpecial = { SoftwareUpgrade: '/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal', - ParameterChange: '/cosmos.params.v1beta1.ParameterChangeProposal' - } + ParameterChange: '/cosmos.params.v1beta1.ParameterChangeProposal', + }; reload$; @@ -104,7 +104,12 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } this.proposalDetail = this.makeProposalDataDetail(data.proposal[0]); this.proposalStatus = this.getStatus(data.proposal[0].status); - + + //get more info proposal detail + if (this.proposalDetail?.content?.plan || this.proposalDetail?.content?.changes) { + this.getProposalMoreInfo(this.proposalDetail?.content?.plan || this.proposalDetail?.content?.changes); + } + if (this.proposalDetail?.content?.amount) { this.proposalDetail['request_amount'] = balanceOf(this.proposalDetail?.content?.amount[0]?.amount); } @@ -190,14 +195,6 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } else { this.finalSubTitle = VOTING_SUBTITLE.REJECT_3; } - - if(this.proposalDetail?.content?.plan) { - this.getProposalPlanTitle(this.proposalDetail?.content?.plan); - console.log(this.proposalDetail?.content?.plan) - console.log(this.proposalDetailPlanTitleArr) - } - - } else { this.proposalDtl.emit(this.proposalDetail); } @@ -421,16 +418,17 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } } - getProposalPlanTitle(data: any) { - if(typeof data !== "object" && data.length > 0) { + getProposalMoreInfo(data: any) { + if (typeof data !== 'object') { for (let key in data[0]) { - this.proposalDetailPlanTitleArr.push(key); + this.proposalDetailTitleArr.push(key); } } - if(typeof data === "object") { + if (typeof data === 'object') { + data = data[0] || data; for (let prop in data) { if (data.hasOwnProperty(prop)) { - this.proposalDetailPlanTitleArr.push(prop); + this.proposalDetailTitleArr.push(prop); } } } From 9cc7d8e477567aae4f595c5bec3642f72c0401c1 Mon Sep 17 00:00:00 2001 From: mtam Date: Mon, 3 Jul 2023 10:04:51 +0700 Subject: [PATCH 210/315] [TamTM6] get nametag top statistic --- src/app/core/services/contract.service.ts | 2 +- .../contract/contract.component.ts | 4 +- src/app/pages/statistics/statistics.module.ts | 2 + .../top-statistic-overview.component.html | 73 +++++++++++++------ .../top-statistic-overview.component.ts | 2 + .../top-statistic-transaction.component.html | 36 +++++++-- .../top-statistic-transaction.component.ts | 2 + 7 files changed, 86 insertions(+), 35 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 4246b3f0b..b212a03e5 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -134,7 +134,7 @@ export class ContractService extends CommonService { code { type code_id - code_id_verifications { + code_id_verifications(order_by: {updated_at: desc}) { code_id compiler_version created_at diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract.component.ts index 900135035..cd88076a6 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract.component.ts @@ -40,9 +40,9 @@ export class ContractComponent implements OnInit { res.query_msg_schema = _.get(res, 'code.code_id_verifications[0].query_msg_schema'); res.contract_hash = _.get(res, 'code.code_id_verifications[0].data_hash'); if (res?.cw20_contract) { - res.contract_name = _.get(res, 'cw20_contract.smart_contract.name'); + res.contract_name = _.get(res, 'cw20_contract.name'); } else { - res.contract_name = _.get(res, 'cw721_contract.smart_contract.name'); + res.contract_name = _.get(res, 'cw721_contract.name'); } res.compiler_version = _.get(res, 'code.code_id_verifications[0].compiler_version'); this.contractDetail = res; diff --git a/src/app/pages/statistics/statistics.module.ts b/src/app/pages/statistics/statistics.module.ts index b896302c3..485f9ba88 100644 --- a/src/app/pages/statistics/statistics.module.ts +++ b/src/app/pages/statistics/statistics.module.ts @@ -15,6 +15,7 @@ import { TopStatisticOverviewComponent } from './top-statistics/top-statistic-ov import { TopStatisticTransactionComponent } from './top-statistics/top-statistic-transaction/top-statistic-transaction.component'; import { TopStatisticsComponent } from './top-statistics/top-statistics.component'; import { MaskPipe, NgxMaskModule } from 'ngx-mask'; +import { MatTooltipModule } from '@angular/material/tooltip'; @NgModule({ declarations: [ @@ -35,6 +36,7 @@ import { MaskPipe, NgxMaskModule } from 'ngx-mask'; TranslateModule, TableNoDataModule, NgxMaskModule, + MatTooltipModule ], providers: [StatisticService, MaskPipe], }) diff --git a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html index e1b4e6556..a5dc1f543 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html @@ -29,19 +29,25 @@
    {{ - (transactionsData.top_aura_senders[0].result.total_sent_amount.amount + (transactionsData.top_aura_senders[0]?.result.total_sent_amount?.amount | convertUauraToAura : coinDecimals | mask : 'separator.6') ?? 0 }} @@ -58,19 +64,25 @@
    {{ - (transactionsData.top_aura_receivers[0].result.total_received_amount.amount + (transactionsData.top_aura_receivers[0]?.result?.total_received_amount?.amount | convertUauraToAura : coinDecimals | mask : 'separator.6') ?? 0 }} @@ -87,18 +99,24 @@
    @@ -112,18 +130,25 @@
    diff --git a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.ts b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.ts index 1ec4b2513..3c0ad4537 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.ts +++ b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.ts @@ -4,6 +4,7 @@ import { StatisticService } from 'src/app/core/services/statistic.service'; import { formatDate } from '@angular/common'; import { Globals } from 'src/app/global/global'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-top-statistic-overview', @@ -23,6 +24,7 @@ export class TopStatisticOverviewComponent implements OnInit { public global: Globals, private statisticService: StatisticService, private environmentService: EnvironmentService, + public commonService: CommonService ) {} ngOnInit(): void { diff --git a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html index 4819a53c0..7e1afc3e7 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html @@ -35,8 +35,13 @@

    Top {{ denom }} Senders

    address - - {{ element.address | cutStringPipe : 8 : 8 }} + + {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} @@ -91,8 +96,13 @@

    Top {{ denom }} Receivers

    address - - {{ element.address | cutStringPipe : 8 : 8 }} + + {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} @@ -148,8 +158,13 @@

    Top Txn Count Sent

    address - - {{ element.address | cutStringPipe : 8 : 8 }} + + {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} @@ -199,8 +214,13 @@

    Top Txn Count Received

    address - - {{ element.address | cutStringPipe : 8 : 8 }} + + {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts index 881b77eb8..5a3c67e18 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts +++ b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts @@ -6,6 +6,7 @@ import { TableTemplate } from 'src/app/core/models/common.model'; import { StatisticService } from 'src/app/core/services/statistic.service'; import { Globals } from 'src/app/global/global'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-top-statistic-transaction', @@ -41,6 +42,7 @@ export class TopStatisticTransactionComponent implements OnInit { public global: Globals, private statisticService: StatisticService, private environmentService: EnvironmentService, + public commonService: CommonService ) {} ngOnInit(): void { From 5a9375a66280c3ff006ac1fca45c6677440224dc Mon Sep 17 00:00:00 2001 From: mtam Date: Mon, 3 Jul 2023 14:01:38 +0700 Subject: [PATCH 211/315] [TamTM6] add nametag feegrant, abt --- .../contract-info-card.component.html | 2 +- src/app/pages/fee-grant/fee-grant.module.ts | 2 ++ .../my-grantees/my-grantees.component.html | 11 +++++++--- .../my-grantees/my-grantees.component.ts | 9 ++++++-- .../my-granters/my-granters.component.html | 11 +++++++--- .../my-granters/my-granters.component.ts | 9 ++++++-- .../summary-info/summary-info.component.ts | 21 +++++++++++-------- .../soulbound-contract-list.component.html | 13 ++++++++---- .../soulbound-contract-list.component.ts | 7 +++++++ .../soulbound-token-contract.component.html | 15 ++++++++----- .../soulbound-token-contract.component.scss | 2 +- .../soulbound-token-contract.component.ts | 7 +++++++ .../token-cw20/token-cw20.component.ts | 2 +- 13 files changed, 80 insertions(+), 31 deletions(-) diff --git a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html index a85c42d89..50adb94f9 100644 --- a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html +++ b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html @@ -7,7 +7,7 @@ - My Name Tag: + Public Name Tag: diff --git a/src/app/pages/fee-grant/fee-grant.module.ts b/src/app/pages/fee-grant/fee-grant.module.ts index a9753b55b..63308b43d 100644 --- a/src/app/pages/fee-grant/fee-grant.module.ts +++ b/src/app/pages/fee-grant/fee-grant.module.ts @@ -22,6 +22,7 @@ import { MyGrantersComponent } from './my-granters/my-granters.component'; import { PopupAddGrantComponent } from './popup-add-grant/popup-add-grant.component'; import { PopupNoticeComponent } from './popup-notice/popup-notice.component'; import { PopupRevokeComponent } from './popup-revoke/popup-revoke.component'; +import { MatTooltipModule } from '@angular/material/tooltip'; @NgModule({ declarations: [ @@ -47,6 +48,7 @@ import { PopupRevokeComponent } from './popup-revoke/popup-revoke.component'; ClickOutsideModule, NgxMaskModule, APaginatorModule, + MatTooltipModule ], providers: [FormBuilder, FeeGrantService, TransactionService, MappingErrorService, AccountService], }) diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html index db6c4564f..847cffae4 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html @@ -17,7 +17,7 @@ - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + [routerLink]="['/account', data[template.matColumnDef]]" + [matTooltipPosition]="'above'" + [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" + matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}"> + {{ + commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 + }}
    {{ data[template.matColumnDef] }} diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts index 26c2d7cf7..7ccbc38fc 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.ts @@ -112,7 +112,12 @@ export class MyGranteesComponent implements OnInit { } getListGrant() { - this.textSearch = this.textSearch?.trim(); + let keySearch = this.textSearch = this.textSearch?.trim(); + const addressNameTag = this.commonService.findNameTag(this.textSearch); + if (addressNameTag?.length > 0) { + keySearch = addressNameTag; + } + this.feeGrantService .getListFeeGrants( { @@ -122,7 +127,7 @@ export class MyGranteesComponent implements OnInit { isGranter: false, offset: this.pageData.pageSize * (this.pageData.pageIndex - 1), }, - this.textSearch, + keySearch, ) .subscribe({ next: (res) => { diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.html b/src/app/pages/fee-grant/my-granters/my-granters.component.html index 7076693a1..dd47485b0 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.html +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.html @@ -12,7 +12,7 @@ - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} + [routerLink]="['/account', data[template.matColumnDef]]" + [matTooltipPosition]="'above'" + [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" + matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}"> + {{ + commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 + }}
    {{ data[template.matColumnDef] }} diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.ts b/src/app/pages/fee-grant/my-granters/my-granters.component.ts index f72953418..c9b99507a 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.ts +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.ts @@ -84,7 +84,12 @@ export class MyGrantersComponent implements OnInit { } getListGrant() { - this.textSearch = this.textSearch?.trim(); + let keySearch = (this.textSearch = this.textSearch?.trim()); + const addressNameTag = this.commonService.findNameTag(this.textSearch); + if (addressNameTag?.length > 0) { + keySearch = addressNameTag; + } + this.feeGrantService .getListFeeGrants( { @@ -94,7 +99,7 @@ export class MyGrantersComponent implements OnInit { grantee: this.currentAddress, offset: this.pageData.pageSize * (this.pageData.pageIndex - 1), }, - this.textSearch, + keySearch, ) .subscribe({ next: (res) => { diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 2e5526bad..325bd6786 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -419,20 +419,23 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { } getProposalMoreInfo(data: any) { - if (typeof data !== 'object') { - for (let key in data[0]) { - this.proposalDetailTitleArr.push(key); + if (this.proposalDetailTitleArr?.length === 0) { + if (typeof data !== 'object') { + for (let key in data[0]) { + this.proposalDetailTitleArr.push(key); + } } - } - if (typeof data === 'object') { - data = data[0] || data; - for (let prop in data) { - if (data.hasOwnProperty(prop)) { - this.proposalDetailTitleArr.push(prop); + if (typeof data === 'object') { + data = data[0] || data; + for (let prop in data) { + if (data.hasOwnProperty(prop)) { + this.proposalDetailTitleArr.push(prop); + } } } } } + typeOf(value) { return typeof value; } diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html index a3ad78ca6..6d5024460 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html @@ -10,7 +10,7 @@

    Account Bound Token

    Account Bound Token diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts index 410d28d60..9dfe40cbf 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts @@ -11,6 +11,7 @@ import { TableTemplate } from 'src/app/core/models/common.model'; import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { WalletService } from 'src/app/core/services/wallet.service'; import { SoulboundTokenCreatePopupComponent } from '../soulbound-token-create-popup/soulbound-token-create-popup.component'; +import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-soulbound-contract-list', @@ -44,6 +45,7 @@ export class SoulboundContractListComponent implements OnInit { public dialog: MatDialog, private walletService: WalletService, private router: Router, + public commonService: CommonService, ) {} ngOnInit(): void { @@ -94,6 +96,11 @@ export class SoulboundContractListComponent implements OnInit { keyword: this.textSearch, }; + const addressNameTag = this.commonService.findNameTag(this.textSearch); + if (addressNameTag?.length > 0) { + payload['keyword'] = addressNameTag; + } + this.soulboundService.getListSoulbound(payload).subscribe((res) => { this.dataSource.data = res.data; this.pageData.length = res.meta.count; diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html index 7c519e6fc..e9d0df5d0 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html @@ -7,8 +7,8 @@

    Account Bound Token

    Contract
    - {{ contractAddress | stringEllipsis : 8 }} - {{ contractAddress }} + {{ commonService.setNameTag(contractAddress) | stringEllipsis : 8 }} + {{ commonService.setNameTag(contractAddress) }}
    From fa158124c2c1118993c6bc6165cb7591ad9f9d05 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Mon, 3 Jul 2023 15:38:56 +0700 Subject: [PATCH 213/315] update dashboard banner --- .../pages/dashboard/dashboard.component.html | 10 +++++----- src/assets/images/pages/banner_aurascan.png | Bin 0 -> 461961 bytes 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 src/assets/images/pages/banner_aurascan.png diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 0a70d1607..7d2e7efdd 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -4,12 +4,12 @@ @@ -244,9 +244,9 @@
    diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.ts b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.ts index 7c81a9a6d..bc5deabfc 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.ts +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, OnInit, SimpleChanges } from '@angular/co import { ActivatedRoute, Router } from '@angular/router'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import {LIMIT_NUM_SBT, SB_TYPE} from 'src/app/core/constants/soulbound.constant'; +import { CommonService } from 'src/app/core/services/common.service'; import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { WalletService } from 'src/app/core/services/wallet.service'; @@ -43,6 +44,7 @@ export class SoulboundAccountTokenListComponent implements OnInit { private walletService: WalletService, private cdr: ChangeDetectorRef, private soulboundService: SoulboundService, + public commonService: CommonService ) {} ngOnInit(): void { diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts index 9dfe40cbf..58c397cb4 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; @@ -12,6 +12,7 @@ import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { WalletService } from 'src/app/core/services/wallet.service'; import { SoulboundTokenCreatePopupComponent } from '../soulbound-token-create-popup/soulbound-token-create-popup.component'; import { CommonService } from 'src/app/core/services/common.service'; +import { PaginatorComponent } from 'src/app/shared/components/paginator/paginator.component'; @Component({ selector: 'app-soulbound-contract-list', @@ -19,6 +20,7 @@ import { CommonService } from 'src/app/core/services/common.service'; styleUrls: ['./soulbound-contract-list.component.scss'], }) export class SoulboundContractListComponent implements OnInit { + @ViewChild(PaginatorComponent) pageChange: PaginatorComponent; textSearch = ''; searchValue = ''; maxLengthSearch = MAX_LENGTH_SEARCH_TOKEN; @@ -75,6 +77,7 @@ export class SoulboundContractListComponent implements OnInit { resetSearch() { this.textSearch = ''; this.searchValue = ''; + this.pageChange.selectPage(0); this.getListSmartContract(); } diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts index 9518957d3..9403f0159 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.ts @@ -108,7 +108,7 @@ export class SoulboundTokenContractComponent implements OnInit { getSearchValue() { this.pageData.pageIndex = 0; - this.textSearch = this.searchValue; + this.textSearch = this.searchValue = this.searchValue.trim(); this.getListToken(); } diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html index ef3be6a9f..31f727e59 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html @@ -204,7 +204,6 @@ mat-icon-button aria-label="Example icon-button with a menu" placement="right" - (click)="getNFTDetail(data)" [ngbPopover]="popContent" popoverClass="custom-popover token-popover"> { - this.nftDetail = res.data; - }); - } - } - getPopoverData(data): IContractPopoverData { return { amount: data?.amountToken || 0, From 0242ce536938e9950ff961e64debf558a31bd365 Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 4 Jul 2023 08:44:40 +0700 Subject: [PATCH 216/315] [TamTM6] change editor --- .../summary-info/summary-info.component.ts | 19 ++++++++++--------- .../validators-detail.component.ts | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index 325bd6786..b3d73543f 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -1,6 +1,6 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { DecimalPipe } from '@angular/common'; -import { AfterViewChecked, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import * as _ from 'lodash'; import * as moment from 'moment'; @@ -22,7 +22,6 @@ import { ProposalService } from '../../../../core/services/proposal.service'; import { WalletService } from '../../../../core/services/wallet.service'; import { balanceOf } from '../../../../core/utils/common/parsing'; import { ProposalVoteComponent } from '../../proposal-vote/proposal-vote.component'; -import { forEach } from 'lodash'; const marked = require('marked'); @Component({ @@ -30,7 +29,7 @@ const marked = require('marked'); templateUrl: './summary-info.component.html', styleUrls: ['./summary-info.component.scss'], }) -export class SummaryInfoComponent implements OnInit, AfterViewChecked { +export class SummaryInfoComponent implements OnInit { @Input() proposalId: number; @Output() proposalDtl = new EventEmitter(); proposalDetail; @@ -410,12 +409,14 @@ export class SummaryInfoComponent implements OnInit, AfterViewChecked { return (isNegative ? '-' : '') + abs + key; } - ngAfterViewChecked(): void { - const editor = document.getElementById('marked'); - if (editor) { - editor.innerHTML = marked.parse(this.proposalDetail.content.description); - return; - } + ngAfterViewInit(): void { + setTimeout(() => { + const editor = document.getElementById('marked'); + if (editor) { + editor.innerHTML = marked.parse(this.proposalDetail.content.description); + return; + } + }, 500); } getProposalMoreInfo(data: any) { diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 6f8714b2a..ad38ee1bd 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -1,5 +1,5 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { AfterViewChecked, Component, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { ActivatedRoute, Router } from '@angular/router'; @@ -23,7 +23,7 @@ const encode = require('@cosmjs/encoding'); templateUrl: './validators-detail.component.html', styleUrls: ['./validators-detail.component.scss'], }) -export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { +export class ValidatorsDetailComponent implements OnInit { currentAddress: string; currentValidatorDetail: any; @@ -380,12 +380,14 @@ export class ValidatorsDetailComponent implements OnInit, AfterViewChecked { } } - ngAfterViewChecked(): void { - const editor = document.getElementById('marked'); - if (editor && this.currentValidatorDetail) { - editor.innerHTML = marked.parse(this.currentValidatorDetail.details); - return; - } + ngAfterViewInit(): void { + setTimeout(() => { + const editor = document.getElementById('marked'); + if (editor && this.currentValidatorDetail) { + editor.innerHTML = marked.parse(this.currentValidatorDetail.details); + return; + } + }, 500); } openDialog() { From fa0a91e19ef831f368c0049226b233a91568504d Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 4 Jul 2023 10:41:49 +0700 Subject: [PATCH 217/315] remove code --- src/app/core/utils/signing/messages.ts | 24 +----- .../core/utils/signing/transaction-manager.ts | 1 - .../horizontaltopbar.component.ts | 10 +-- .../account-detail-table.component.ts | 14 +--- src/app/pages/blocks/blocks.component.ts | 2 - .../contract-content.component.ts | 24 +++--- .../code-contract.component.html | 12 --- .../contracts-transactions.component.ts | 3 +- .../dashboard/dashboard-chart-options.ts | 61 +-------------- .../dashboard/dashboard-routing.module.ts | 1 - .../pages/dashboard/dashboard.component.ts | 1 - .../validators-votes.component.ts | 10 +-- .../votes/votes.component.scss | 8 -- .../pages/proposal/proposal-routing.module.ts | 4 +- .../proposal-table.component.ts | 5 +- .../proposal-vote.component.html | 78 ++++++++++++------- .../abt-reject-popup.component.html | 2 +- .../soulbound-account-token-list.component.ts | 4 +- .../soulbound-token-equipped.component.html | 4 +- .../soulbound-token-equipped.component.scss | 11 --- .../chart-detail/chart-detail.component.ts | 9 +-- .../token-holders-tab.component.html | 6 -- .../user-wallet-info.component.ts | 3 +- .../validators-detail.component.ts | 1 - 24 files changed, 85 insertions(+), 213 deletions(-) diff --git a/src/app/core/utils/signing/messages.ts b/src/app/core/utils/signing/messages.ts index 040918ef7..b08e70da7 100644 --- a/src/app/core/utils/signing/messages.ts +++ b/src/app/core/utils/signing/messages.ts @@ -1,10 +1,10 @@ import { ChainInfo } from '@keplr-wallet/types'; import { MsgWithdrawDelegatorReward } from 'cosmjs-types/cosmos/distribution/v1beta1/tx'; -import { MsgBeginRedelegate, MsgDelegate, MsgUndelegate } from 'cosmjs-types/cosmos/staking/v1beta1/tx'; +import { BasicAllowance, PeriodicAllowance } from 'cosmjs-types/cosmos/feegrant/v1beta1/feegrant'; import { MsgGrantAllowance, MsgRevokeAllowance } from 'cosmjs-types/cosmos/feegrant/v1beta1/tx'; -import { BasicAllowance, PeriodicAllowance, AllowedMsgAllowance } from 'cosmjs-types/cosmos/feegrant/v1beta1/feegrant'; -import { Timestamp } from 'cosmjs-types/google/protobuf/timestamp'; +import { MsgBeginRedelegate, MsgDelegate, MsgUndelegate } from 'cosmjs-types/cosmos/staking/v1beta1/tx'; import { Duration } from 'cosmjs-types/google/protobuf/duration'; +import { Timestamp } from 'cosmjs-types/google/protobuf/timestamp'; import { TRANSACTION_TYPE_ENUM } from '../../constants/transaction.enum'; import AllowedContractAllowance from './custom-feegrant'; // Staking @@ -217,24 +217,6 @@ export function GrantMsgAllowance( }); } - //comment allow message for version 0.45 - // const allowanceValue = { - // allowance: itemAllowance, - // allowedMessages: allowedMessages, - // }; - - // const allowanceEncode = AllowedMsgAllowance.encode(allowanceValue as any).finish(); - - // const allowance = { - // typeUrl: TRANSACTION_TYPE_ENUM.AllowedMsgAllowance, - // value: Uint8Array.from(allowanceEncode), - // }; - - // const allowedContractMsg = { - // allowance: allowance, - // allowedAddress: allowedAddress.length > 0 ? allowedAddress : [], - // }; - const allowedContractMsg = { allowance: itemAllowance, allowedAddress: allowedAddress.length > 0 ? allowedAddress : [], diff --git a/src/app/core/utils/signing/transaction-manager.ts b/src/app/core/utils/signing/transaction-manager.ts index df6fd3382..7614c4f1e 100644 --- a/src/app/core/utils/signing/transaction-manager.ts +++ b/src/app/core/utils/signing/transaction-manager.ts @@ -3,7 +3,6 @@ import { calculateFee, DeliverTxResponse, SigningStargateClient, StdFee } from ' import { ChainInfo } from '@keplr-wallet/types'; import { TRANSACTION_TYPE_ENUM } from '../../constants/transaction.enum'; import { KEPLR_ERRORS } from '../../constants/wallet.constant'; -import { getFee } from './fee'; import { messageCreators } from './messages'; import { getSigner } from './signer'; diff --git a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts index 019b4e31e..0aa78f4e3 100644 --- a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts +++ b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.ts @@ -2,10 +2,12 @@ import { AfterViewInit, Component, EventEmitter, HostListener, OnInit, Output } import { NavigationEnd, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { CookieService } from 'ngx-cookie-service'; +import { from } from 'rxjs'; +import { delay, mergeMap } from 'rxjs/operators'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; +import { CommonService } from 'src/app/core/services/common.service'; import { SoulboundService } from 'src/app/core/services/soulbound.service'; import { LENGTH_CHARACTER, NETWORK } from '../../../app/core/constants/common.constant'; -import { ResponseDto } from '../../core/models/common.model'; import { EventService } from '../../core/services/event.service'; import { LanguageService } from '../../core/services/language.service'; import { TransactionService } from '../../core/services/transaction.service'; @@ -13,9 +15,6 @@ import { WalletService } from '../../core/services/wallet.service'; import { LAYOUT_MODE } from '../layouts.model'; import { MENU, MenuName } from './menu'; import { MenuItem } from './menu.model'; -import { from } from 'rxjs'; -import { delay, mergeMap } from 'rxjs/operators'; -import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-horizontaltopbar', @@ -35,9 +34,6 @@ export class HorizontaltopbarComponent implements OnInit, AfterViewInit { cookieValue: any; countryName: any; valueset: any; - networks = NETWORK; - currentNetwork = JSON.parse(localStorage.getItem('currentNetwork')) || NETWORK[1]; - currentChanel = JSON.parse(localStorage.getItem('currentChanel')) || null; searchValue = null; env = null; pageTitle = null; diff --git a/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts b/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts index 0188f3b83..ff5a06415 100644 --- a/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts +++ b/src/app/pages/account/account-detail/account-detail-table/account-detail-table.component.ts @@ -1,19 +1,9 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; -import { - AfterViewInit, - ChangeDetectorRef, - Component, - EventEmitter, - Input, - OnChanges, - OnInit, - Output, -} from '@angular/core'; +import { AfterViewInit, Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core'; import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { TranslateService } from '@ngx-translate/core'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; -import { ValidatorService } from 'src/app/core/services/validator.service'; import { PageEventType } from '../../../../../app/core/constants/account.enum'; import { TableTemplate } from '../../../../core/models/common.model'; import { CommonService } from '../../../../core/services/common.service'; @@ -46,8 +36,6 @@ export class AccountDetailTableComponent implements OnInit, OnChanges, AfterView public commonService: CommonService, private layout: BreakpointObserver, private environmentService: EnvironmentService, - private validatorService: ValidatorService, - private cdr: ChangeDetectorRef, ) {} ngOnInit(): void {} diff --git a/src/app/pages/blocks/blocks.component.ts b/src/app/pages/blocks/blocks.component.ts index a63a3adb9..241e3ec09 100644 --- a/src/app/pages/blocks/blocks.component.ts +++ b/src/app/pages/blocks/blocks.component.ts @@ -22,8 +22,6 @@ export class BlocksComponent implements OnInit { ]; displayedColumns: string[] = this.templates.map((dta) => dta.matColumnDef); dataSource: MatTableDataSource; - dataBlock: any[]; - pageSize = 20; loading = true; diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts index bd909a87a..549015fc6 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract-content.component.ts @@ -20,19 +20,13 @@ export class ContractContentComponent implements OnInit, OnDestroy { @Input() contractsAddress = ''; @Input() contractTypeData: ContractVerifyType; - TABS = CONTRACT_TAB.filter((tab) => - [ - ContractTab.Transactions, - // ContractTab.Cw20Token, - ContractTab.Contract, - // ContractTab.Events, - // ContractTab.Analytics, - ].includes(tab.key), - ).map((tab) => ({ - ...tab, - value: tab.value, - key: tab.key === ContractTab.Transactions ? '' : tab.key, - })); + TABS = CONTRACT_TAB.filter((tab) => [ContractTab.Transactions, ContractTab.Contract].includes(tab.key)).map( + (tab) => ({ + ...tab, + value: tab.value, + key: tab.key === ContractTab.Transactions ? '' : tab.key, + }), + ); countCurrent: string = ContractTab.Transactions; contractTab = ContractTab; @@ -125,8 +119,8 @@ export class ContractContentComponent implements OnInit, OnDestroy { const payload = { limit: this.limit, value: this.contractsAddress, - key: '_contract_address' - } + key: '_contract_address', + }; this.transactionService.getListTxCondition(payload).subscribe( (res) => { const data = res; diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html index da04c76f7..53f6ca955 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html @@ -22,18 +22,6 @@
    -
    diff --git a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts index f08cebdf6..a28418e54 100644 --- a/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts +++ b/src/app/pages/contracts/contracts-transactions/contracts-transactions.component.ts @@ -42,7 +42,6 @@ export class ContractsTransactionsComponent implements OnInit { timerGetUpTime: any; isLoadingTX = true; lengthTxsExecute = 0; - isLoadInstantiate = false; txsInstantiate = []; currentPage = 0; destroyed$ = new Subject(); @@ -63,7 +62,7 @@ export class ContractsTransactionsComponent implements OnInit { private environmentService: EnvironmentService, private route: ActivatedRoute, private transactionService: TransactionService, - public commonService: CommonService + public commonService: CommonService, ) { const valueColumn = this.templates.find((item) => item.matColumnDef === 'value'); diff --git a/src/app/pages/dashboard/dashboard-chart-options.ts b/src/app/pages/dashboard/dashboard-chart-options.ts index 24d89f0f1..5fb1792e5 100644 --- a/src/app/pages/dashboard/dashboard-chart-options.ts +++ b/src/app/pages/dashboard/dashboard-chart-options.ts @@ -1,65 +1,6 @@ -import { ChartOptions, DeepPartial, ISeriesApi, SeriesPartialOptionsMap } from 'lightweight-charts'; -import { ApexAxisChartSeries, ApexChart, ApexXAxis, ApexStroke, ApexTooltip, ApexDataLabels } from 'ng-apexcharts'; +import { ChartOptions, DeepPartial, SeriesPartialOptionsMap } from 'lightweight-charts'; import { RangeType } from 'src/app/core/models/common.model'; -// export type ChartOptions = { -// series: ApexAxisChartSeries; -// chart: ApexChart; -// xAxis: ApexXAxis; -// stroke: ApexStroke; -// tooltip: ApexTooltip; -// dataLabels: ApexDataLabels; -// }; - -// export const DASHBOARD_CHART_OPTIONS: Partial = { -// series: [ -// { -// name: 'transactions', -// type: 'line', -// data: [], -// color: '#5EE6D0', -// }, -// ], -// chart: { -// height: 333, -// type: 'area', -// toolbar: { -// tools: { -// selection: false, -// download: ``, -// zoom: false, -// zoomin: ``, -// zoomout: ``, -// pan: false, -// reset: false, -// }, -// }, -// }, -// dataLabels: { -// enabled: false, -// }, -// stroke: { -// width: 3, -// curve: 'smooth', -// }, -// xAxis: { -// type: 'datetime', -// categories: [], -// labels: { -// datetimeUTC: false, -// }, -// axisBorder: { -// show: true, -// color: '#FFA741', -// }, -// }, -// tooltip: { -// x: { -// format: 'dd/MM/yy HH:mm', -// }, -// }, -// }; - export const DASHBOARD_CHART_OPTIONS: DeepPartial = { height: 300, crosshair: { diff --git a/src/app/pages/dashboard/dashboard-routing.module.ts b/src/app/pages/dashboard/dashboard-routing.module.ts index 969a5fbcf..7a937f826 100644 --- a/src/app/pages/dashboard/dashboard-routing.module.ts +++ b/src/app/pages/dashboard/dashboard-routing.module.ts @@ -1,6 +1,5 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; - import { DashboardComponent } from './dashboard.component'; const routes: Routes = [ diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 8ce76bd35..24086c64d 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -33,7 +33,6 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { chartRange = CHART_RANGE.M_60; chartRangeData = CHART_RANGE; PAGE_SIZE = PAGE_EVENT.PAGE_SIZE; - // public chartOptions: Partial = DASHBOARD_CHART_OPTIONS; templatesBlock: Array = [ { matColumnDef: 'height', headerCellDef: 'Height' }, diff --git a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts index d152277bf..3d7482bd4 100644 --- a/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts +++ b/src/app/pages/proposal/proposal-detail/validators-votes/validators-votes.component.ts @@ -3,10 +3,9 @@ import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { NgbNav } from '@ng-bootstrap/ng-bootstrap'; import * as _ from 'lodash'; import { Subject } from 'rxjs'; -import { map, mergeMap, takeUntil } from 'rxjs/operators'; +import { map, takeUntil } from 'rxjs/operators'; import { ProposalService } from '../../../../../app/core/services/proposal.service'; import { PROPOSAL_TABLE_MODE, PROPOSAL_VOTE, VOTE_OPTION } from '../../../../core/constants/proposal.constant'; -import { ValidatorService } from 'src/app/core/services/validator.service'; export interface IValidatorVotes { rank: number; @@ -43,7 +42,6 @@ export class ValidatorsVotesComponent implements OnInit, OnDestroy { ).map((vote) => ({ ...vote, value: vote.value.toUpperCase(), - // key: vote.key === VOTE_OPTION.UNSPECIFIED ? '' : vote.key, })); voteDataList: IValidatorVotes[] = []; @@ -68,11 +66,7 @@ export class ValidatorsVotesComponent implements OnInit, OnDestroy { destroyed$ = new Subject(); - constructor( - private proposalService: ProposalService, - private layout: BreakpointObserver, - private validatorService: ValidatorService, - ) { + constructor(private proposalService: ProposalService, private layout: BreakpointObserver) { this.proposalService.reloadList$.pipe(takeUntil(this.destroyed$)).subscribe((event) => { if (event) { this.getValidatorVotes(); diff --git a/src/app/pages/proposal/proposal-detail/votes/votes.component.scss b/src/app/pages/proposal/proposal-detail/votes/votes.component.scss index 6e80d25e8..b70d6ad3c 100644 --- a/src/app/pages/proposal/proposal-detail/votes/votes.component.scss +++ b/src/app/pages/proposal/proposal-detail/votes/votes.component.scss @@ -1,11 +1,3 @@ -.card__title { - font-size: 2.4rem; - line-height: 3.2rem; - font-weight: 500; - color: var(--aura-white); - margin-bottom: 32px; -} - .card__title-mobile { font-size: 2rem; line-height: 2.3rem; diff --git a/src/app/pages/proposal/proposal-routing.module.ts b/src/app/pages/proposal/proposal-routing.module.ts index 0f2c66602..3de6666ff 100644 --- a/src/app/pages/proposal/proposal-routing.module.ts +++ b/src/app/pages/proposal/proposal-routing.module.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import {ProposalComponent} from "./proposal.component"; -import {ProposalDetailComponent} from "./proposal-detail/proposal-detail.component"; +import { ProposalDetailComponent } from "./proposal-detail/proposal-detail.component"; +import { ProposalComponent } from "./proposal.component"; const routes: Routes = [ { diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index e9f41a191..97f3659a2 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -1,20 +1,17 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { ChangeDetectionStrategy, - ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnInit, Output, - SimpleChanges, + SimpleChanges } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; -import { ProposalService } from 'src/app/core/services/proposal.service'; -import { ValidatorService } from 'src/app/core/services/validator.service'; import { TableTemplate } from '../../../../app/core/models/common.model'; import { CommonService } from '../../../../app/core/services/common.service'; import { shortenAddress } from '../../../../app/core/utils/common/shorten'; diff --git a/src/app/pages/proposal/proposal-vote/proposal-vote.component.html b/src/app/pages/proposal/proposal-vote/proposal-vote.component.html index 2b7249452..1314cb247 100644 --- a/src/app/pages/proposal/proposal-vote/proposal-vote.component.html +++ b/src/app/pages/proposal/proposal-vote/proposal-vote.component.html @@ -1,28 +1,52 @@
    - -
    - -
    Your vote
    -
    -
    #{{data.id}} {{data.title}}
    -
    - - {{ 'PAGES.PROPOSAL.yes' | translate }} - - {{ 'PAGES.PROPOSAL.no' | translate }} - - {{ 'PAGES.PROPOSAL.noWithVeto' | translate }} - {{ 'PAGES.PROPOSAL.abstain' | translate - }} - -
    - - -
    -
    -
    -
    \ No newline at end of file + +
    + +
    Your vote
    +
    +
    #{{ data.id }} {{ data.title }}
    +
    + + {{ 'PAGES.PROPOSAL.yes' | translate }} + + {{ 'PAGES.PROPOSAL.no' | translate }} + + {{ + 'PAGES.PROPOSAL.noWithVeto' | translate + }} + {{ + 'PAGES.PROPOSAL.abstain' | translate + }} + +
    + + +
    +
    +
    +
    diff --git a/src/app/pages/soulbound-token/abt-reject-popup/abt-reject-popup.component.html b/src/app/pages/soulbound-token/abt-reject-popup/abt-reject-popup.component.html index 367e8de37..ec9e8877e 100644 --- a/src/app/pages/soulbound-token/abt-reject-popup/abt-reject-popup.component.html +++ b/src/app/pages/soulbound-token/abt-reject-popup/abt-reject-popup.component.html @@ -1,7 +1,7 @@
    - {{ !abtDetail.rejectAll ? 'Reject new ABTs from creator' : 'Reject all new ABTs from this creator'}} + {{ !abtDetail.rejectAll ? 'Reject new ABTs from creator' : 'Reject all new ABTs from this creator' }}
    Equipped ABT (pageEvent)="pageEvent($event)"> - +
    diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.scss b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.scss index 797b1cc49..562c3871e 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.scss +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-token-equipped/soulbound-token-equipped.component.scss @@ -2,17 +2,6 @@ position: relative; .nft-cards__item { padding: 0; - app-model-view, - app-audio-player, - app-custom-video-player { - height: 100%; - position: absolute; - top: 50%; - left: 0; - right: 0; - bottom: 0; - transform: translateY(-50%); - } .token-cards__img { min-height: unset; height: auto; diff --git a/src/app/pages/statistics/chart-detail/chart-detail.component.ts b/src/app/pages/statistics/chart-detail/chart-detail.component.ts index b42e287eb..9d6c81804 100644 --- a/src/app/pages/statistics/chart-detail/chart-detail.component.ts +++ b/src/app/pages/statistics/chart-detail/chart-detail.component.ts @@ -2,22 +2,21 @@ import { DatePipe, formatDate } from '@angular/common'; import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; -import { createChart, IChartApi, ISeriesApi, SeriesPartialOptionsMap } from 'lightweight-charts'; +import { IChartApi, ISeriesApi, createChart } from 'lightweight-charts'; import * as moment from 'moment'; +import { MaskPipe } from 'ngx-mask'; import { Subject } from 'rxjs'; import { debounceTime, takeUntil } from 'rxjs/operators'; import { CHART_RANGE } from 'src/app/core/constants/common.constant'; import { timeToUnix } from 'src/app/core/helpers/date'; import { exportStatisticChart } from 'src/app/core/helpers/export'; import { StatisticService } from 'src/app/core/services/statistic.service'; +import { Globals } from 'src/app/global/global'; import { CHART_CONFIG, - DASHBOARD_AREA_SERIES_CHART_OPTIONS, DASHBOARD_CHART_OPTIONS, - STATISTIC_AREA_SERIES_CHART_OPTIONS, + STATISTIC_AREA_SERIES_CHART_OPTIONS } from 'src/app/pages/dashboard/dashboard-chart-options'; -import { MaskPipe } from 'ngx-mask'; -import { Globals } from 'src/app/global/global'; @Component({ selector: 'app-chart-detail', diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html index cc1c231c8..1295fe121 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html @@ -1,10 +1,4 @@
    - - - - - -
    diff --git a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts index 31d27e712..1b1fd6c48 100644 --- a/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts +++ b/src/app/pages/validators/user-wallet-info/user-wallet-info.component.ts @@ -1,8 +1,7 @@ -import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; import { MatTableDataSource } from '@angular/material/table'; import { TableTemplate } from 'src/app/core/models/common.model'; import { CommonService } from 'src/app/core/services/common.service'; -import { ValidatorService } from 'src/app/core/services/validator.service'; import { Globals } from 'src/app/global/global'; @Component({ diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.ts b/src/app/pages/validators/validators-detail/validators-detail.component.ts index 6f8714b2a..cd2c66b56 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.ts +++ b/src/app/pages/validators/validators-detail/validators-detail.component.ts @@ -17,7 +17,6 @@ import { WalletService } from 'src/app/core/services/wallet.service'; import { Globals, convertDataBlock } from 'src/app/global/global'; import { balanceOf } from '../../../core/utils/common/parsing'; const marked = require('marked'); -const encode = require('@cosmjs/encoding'); @Component({ selector: 'app-validators-detail', templateUrl: './validators-detail.component.html', From aa55678f7fd8ea85c838b4462162cfeca6136b32 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Tue, 4 Jul 2023 10:45:17 +0700 Subject: [PATCH 218/315] update tooltip --- .../validators-detail.component.html | 43 +++++++++---------- .../tooltip-customize.component.html | 1 + .../tooltip-customize.component.scss | 21 +++++++++ .../tooltip-customize.component.ts | 15 +++++++ src/app/shared/shared.module.ts | 5 ++- src/assets/scss/custom.scss | 26 +++++++++++ 6 files changed, 86 insertions(+), 25 deletions(-) create mode 100644 src/app/shared/components/tooltip-customize/tooltip-customize.component.html create mode 100644 src/app/shared/components/tooltip-customize/tooltip-customize.component.scss create mode 100644 src/app/shared/components/tooltip-customize/tooltip-customize.component.ts diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.html b/src/app/pages/validators/validators-detail/validators-detail.component.html index ce79a2c0f..3e2a2fe92 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.html +++ b/src/app/pages/validators/validators-detail/validators-detail.component.html @@ -64,15 +64,13 @@
    {{ currentValidatorDetail?.title }}
    Operator Address
    -
    +
    +
    {{ currentValidatorDetail?.operator_address }} @@ -276,14 +274,12 @@

    Proposed Blocks

    diff --git a/src/app/shared/components/tooltip-customize/tooltip-customize.component.html b/src/app/shared/components/tooltip-customize/tooltip-customize.component.html new file mode 100644 index 000000000..196740506 --- /dev/null +++ b/src/app/shared/components/tooltip-customize/tooltip-customize.component.html @@ -0,0 +1 @@ +
    diff --git a/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss b/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss new file mode 100644 index 000000000..c7f9cee96 --- /dev/null +++ b/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss @@ -0,0 +1,21 @@ +.aura-tooltip { + display: none; + border-radius: 4px; + background-color: var(--aura-gray-8); + border: 1px solid var(--aura-gray-8); + color: var(--aura-white); + position: relative; + &:before { + content: ''; + position: absolute; + bottom: 0; + left: 50%; + transform: translate(-50%, 100%); + display: block; + width: 0; + height: 0; + border-left: 8px solid transparent; + border-right: 8px solid transparent; + border-top: 10px solid var(--aura-gray-8); + } +} diff --git a/src/app/shared/components/tooltip-customize/tooltip-customize.component.ts b/src/app/shared/components/tooltip-customize/tooltip-customize.component.ts new file mode 100644 index 000000000..498b0b254 --- /dev/null +++ b/src/app/shared/components/tooltip-customize/tooltip-customize.component.ts @@ -0,0 +1,15 @@ +import {Component, Input, OnInit} from '@angular/core'; + +@Component({ + selector: 'app-tooltip-customize', + templateUrl: './tooltip-customize.component.html', + styleUrls: ['./tooltip-customize.component.scss'] +}) +export class TooltipCustomizeComponent implements OnInit { + @Input() content: string; + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts index dd42f21c5..30865d39b 100644 --- a/src/app/shared/shared.module.ts +++ b/src/app/shared/shared.module.ts @@ -8,10 +8,11 @@ import { CardMobSimpleModule } from './components/cards/card-mob-simple/card-mob import { LoadingSprintComponent } from './components/loading-sprint/loading-sprint.component'; import { PagetitleComponent } from './components/pagetitle/pagetitle.component'; import { SoulboundFeatureTokensModule } from './components/soulbound-feature-tokens/soulbound-feature-tokens.module'; +import { TooltipCustomizeComponent } from './components/tooltip-customize/tooltip-customize.component'; @NgModule({ - declarations: [PagetitleComponent, LoadingSprintComponent, CardMobExplainComponent], + declarations: [PagetitleComponent, LoadingSprintComponent, CardMobExplainComponent, TooltipCustomizeComponent], imports: [CommonModule, CardMobSimpleModule, SoulboundFeatureTokensModule, CommonPipeModule, CommonDirectiveModule], - exports: [PagetitleComponent, LoadingSprintComponent, CardMobSimpleComponent, CardMobExplainComponent], + exports: [PagetitleComponent, LoadingSprintComponent, CardMobSimpleComponent, CardMobExplainComponent, TooltipCustomizeComponent], }) export class SharedModule {} diff --git a/src/assets/scss/custom.scss b/src/assets/scss/custom.scss index 3cb0d1d95..7a5d17f32 100644 --- a/src/assets/scss/custom.scss +++ b/src/assets/scss/custom.scss @@ -666,3 +666,29 @@ body { } } } +app-tooltip-customize { + width: max-content; + position: absolute; + left: 50%; + bottom: 100%; + transform: translate(-50%, -16px); + max-width: 0; + max-height: 0; + opacity: 0; + transition: opacity .35s ease-in-out; +} +.aura-tooltip-contain { + position: relative; + .aura-tooltip-object { + cursor: pointer; + &:not(.disabled-hover):hover ~ app-tooltip-customize, &.show ~ app-tooltip-customize { + max-width: 900px; + max-height: 900px; + opacity: 1; + .aura-tooltip { + display: block; + padding: 8px; + } + } + } +} From 4348f364d9869e71f998ce7cc070658aa120aa9f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 4 Jul 2023 15:33:50 +0700 Subject: [PATCH 219/315] fix issue check contract verified --- src/app/core/services/contract.service.ts | 2 +- src/app/core/services/token.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index b212a03e5..20dc6e5e7 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -82,7 +82,7 @@ export class ContractService extends CommonService { code_id code { type - code_id_verifications { + code_id_verifications(order_by: {updated_at: desc}) { compiler_version verified_at verification_status diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 89d2c7937..953f9686d 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -114,7 +114,7 @@ export class TokenService extends CommonService { decimal } code { - code_id_verifications { + code_id_verifications(order_by: {updated_at: desc}) { verification_status } } From 47b39054a241a5f005b86fffb78260597275241e Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 4 Jul 2023 15:36:44 +0700 Subject: [PATCH 220/315] fix issue check contract verified --- src/app/core/services/contract.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 20dc6e5e7..11587b9d0 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -181,7 +181,7 @@ export class ContractService extends CommonService { status type creator - code_id_verifications { + code_id_verifications(order_by: {updated_at: desc}) { verified_at } } From 7929eb9b7d165b7a3188c4c77ba86cd97d749ec2 Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 4 Jul 2023 15:51:43 +0700 Subject: [PATCH 221/315] [TamTM6] commit temp get-name-tag --- src/app/app.component.ts | 2 + src/app/core/services/common.service.ts | 6 +- .../account-detail.component.html | 7 +- .../code-id-contracts-tab.component.html | 25 +----- .../code-id-detail.component.html | 7 +- .../code-id-list/code-id-list.component.html | 10 +-- src/app/pages/code-ids/code-ids.module.ts | 2 + .../community-pool/community-pool.module.ts | 4 +- .../community-pool-proposal.component.html | 18 +---- .../contract-info-card.component.html | 15 +--- .../contracts-list.component.html | 43 ++++------- .../contracts-transactions.component.html | 6 +- src/app/pages/contracts/contracts.module.ts | 2 + src/app/pages/fee-grant/fee-grant.module.ts | 4 +- .../my-grantees/my-grantees.component.html | 12 +-- .../my-granters/my-granters.component.html | 12 +-- .../proposal-table.component.html | 14 +--- .../proposal-table.component.ts | 5 +- src/app/pages/proposal/proposal.module.ts | 2 + .../soulbound-contract-list.component.html | 9 +-- .../soulbound-token-contract.component.html | 2 +- .../soulbound-token/soulbound-token.module.ts | 2 + src/app/pages/statistics/statistics.module.ts | 4 +- .../top-statistic-overview.component.html | 77 ++----------------- .../top-statistic-transaction.component.html | 44 +++-------- .../top-statistic-transaction.component.ts | 4 +- .../nft-detail/nft-detail.component.html | 32 +++----- .../token-inventory-tab.component.html | 2 +- .../token-transfers-tab.component.html | 8 +- .../token-summary.component.html | 4 +- .../token-cw4973/token-cw4973.component.html | 18 +---- .../token-cw721/token-cw721.component.html | 13 +--- src/app/pages/token/token.module.ts | 2 + .../validators-detail.component.html | 2 +- .../contract-table.component.html | 39 ++++++---- .../contract-table.component.ts | 5 ++ .../name-tag/name-tag.component.html | 14 ++++ .../name-tag/name-tag.component.scss | 0 .../components/name-tag/name-tag.component.ts | 18 +++++ .../components/name-tag/name-tag.module.ts | 13 ++++ 40 files changed, 182 insertions(+), 326 deletions(-) create mode 100644 src/app/shared/components/name-tag/name-tag.component.html create mode 100644 src/app/shared/components/name-tag/name-tag.component.scss create mode 100644 src/app/shared/components/name-tag/name-tag.component.ts create mode 100644 src/app/shared/components/name-tag/name-tag.module.ts diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b7565aba8..f6a19c6df 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -70,6 +70,8 @@ export class AppComponent implements OnInit { }; this.commonService.getListNameTag(payload).subscribe((res) => { this.globals.listNameTag = this.commonService.listNameTag = res.data?.nameTags; + console.log(this.globals.listNameTag); + }); } } diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 0a0d09a42..121eb2b40 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -130,10 +130,10 @@ export class CommonService { } checkDisplayTooltip(address): boolean { - let result = true; + let result = false; const nameTag = this.listNameTag?.find((k) => k.address === address); - if (nameTag?.name_tag !== address && nameTag?.name_tag?.length > 16) { - result = false; + if (!nameTag || nameTag?.name_tag === address) { + result = true; } return result; } diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index b93da353e..b2a0c63ed 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -33,11 +33,16 @@ (click)="copyMessage(currentAddress); tooltip.toggle()" />
    -
    +
    {{ commonService.setNameTag(currentAddress) }} {{ commonService.setNameTag(currentAddress) | cutStringPipe : 8 : 8 }} + + +
    diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html index d99257636..b0fa594c2 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html @@ -11,15 +11,7 @@ - - {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} - + - - {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} - +
    {{ data[template.matColumnDef] }}
    diff --git a/src/app/pages/code-ids/code-id-detail/code-id-detail.component.html b/src/app/pages/code-ids/code-id-detail/code-id-detail.component.html index 48cadc497..62a3d36b8 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-detail.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-detail.component.html @@ -17,12 +17,7 @@

    Information

    Creator
    diff --git a/src/app/pages/code-ids/code-id-list/code-id-list.component.html b/src/app/pages/code-ids/code-id-list/code-id-list.component.html index c99af7bd6..46309945d 100644 --- a/src/app/pages/code-ids/code-id-list/code-id-list.component.html +++ b/src/app/pages/code-ids/code-id-list/code-id-list.component.html @@ -99,15 +99,7 @@

    Code IDs

    - - {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} - +
    diff --git a/src/app/pages/code-ids/code-ids.module.ts b/src/app/pages/code-ids/code-ids.module.ts index 75a73dbb6..12db7cbd1 100644 --- a/src/app/pages/code-ids/code-ids.module.ts +++ b/src/app/pages/code-ids/code-ids.module.ts @@ -16,6 +16,7 @@ import { CodeIdDetailComponent } from './code-id-detail/code-id-detail.component import { VerifyCodeIdComponent } from './code-id-detail/verify-code-id/verify-code-id.component'; import { CodeIdListComponent } from './code-id-list/code-id-list.component'; import { CodeIdsRoutingModule } from './code-ids-routing.module'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [CodeIdListComponent, CodeIdDetailComponent, VerifyCodeIdComponent, CodeIdContractsTabComponent], @@ -32,6 +33,7 @@ import { CodeIdsRoutingModule } from './code-ids-routing.module'; NgbNavModule, ContractsModule, APaginatorModule, + NameTagModule ], providers: [ContractService], }) diff --git a/src/app/pages/community-pool/community-pool.module.ts b/src/app/pages/community-pool/community-pool.module.ts index f8a345f57..ae0cc342a 100644 --- a/src/app/pages/community-pool/community-pool.module.ts +++ b/src/app/pages/community-pool/community-pool.module.ts @@ -16,6 +16,7 @@ import { CommunityPoolRoutingModule } from './community-pool-routing.module'; import { CommunityPoolComponent } from './community-pool.component'; import { CommunityPoolProposalComponent } from './proposal-list/community-pool-proposal.component'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [CommunityPoolAssetComponent, CommunityPoolProposalComponent, CommunityPoolComponent], @@ -32,7 +33,8 @@ import { MatTooltipModule } from '@angular/material/tooltip'; NgxMaskModule, CommonDirectiveModule, APaginatorModule, - MatTooltipModule + MatTooltipModule, + NameTagModule ], providers: [ProposalService], }) diff --git a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html index adb690782..53d939b19 100644 --- a/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html +++ b/src/app/pages/community-pool/proposal-list/community-pool-proposal.component.html @@ -40,14 +40,7 @@

    Community Pool Spent Proposals

    Sender - - {{ (commonService.setNameTag(distributionAcc) | cutStringPipe : 8 : 8) || '-' }} - + @@ -55,14 +48,7 @@

    Community Pool Spent Proposals

    Recipient - - {{ (commonService.setNameTag(element.content.recipient) | cutStringPipe : 8 : 8) || '-' }} - + diff --git a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html index 50adb94f9..eca7be4b3 100644 --- a/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html +++ b/src/app/pages/contracts/contracts-detail/contract-info-card/contract-info-card.component.html @@ -24,9 +24,9 @@
    Contract Creator:
    - - {{ commonService.setNameTag(contractDetail?.creator) | cutStringPipe : 8 : 8 }} - + + + at txn {{ contractDetail?.tx_hash | cutStringPipe : 8 : 8 }} @@ -38,14 +38,7 @@ Contract Creator: - - {{ commonService.setNameTag(contractDetail?.creator) | cutStringPipe : 8 : 8 }} - + at txn {{ contractDetail?.tx_hash | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index ecdbd6271..228a5b687 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -100,34 +100,23 @@

    Contracts

    - -
    - {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} - - - -
    diff --git a/src/app/pages/contracts/contracts.module.ts b/src/app/pages/contracts/contracts.module.ts index 050ff5e96..900a04d57 100644 --- a/src/app/pages/contracts/contracts.module.ts +++ b/src/app/pages/contracts/contracts.module.ts @@ -31,6 +31,7 @@ import { ContractsTransactionsComponent } from './contracts-transactions/contrac import { ContractVerifyStepsComponent } from './contracts-verify/contract-verify-steps/contract-verify-steps.component'; import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.component'; import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [ @@ -68,6 +69,7 @@ import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-pagina ReadContractModule, PopupAddZeroModule, APaginatorModule, + NameTagModule ], providers: [ContractService], exports: [ContractVerifyStepsComponent], diff --git a/src/app/pages/fee-grant/fee-grant.module.ts b/src/app/pages/fee-grant/fee-grant.module.ts index 63308b43d..98f9e1726 100644 --- a/src/app/pages/fee-grant/fee-grant.module.ts +++ b/src/app/pages/fee-grant/fee-grant.module.ts @@ -23,6 +23,7 @@ import { PopupAddGrantComponent } from './popup-add-grant/popup-add-grant.compon import { PopupNoticeComponent } from './popup-notice/popup-notice.component'; import { PopupRevokeComponent } from './popup-revoke/popup-revoke.component'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [ @@ -48,7 +49,8 @@ import { MatTooltipModule } from '@angular/material/tooltip'; ClickOutsideModule, NgxMaskModule, APaginatorModule, - MatTooltipModule + MatTooltipModule, + NameTagModule ], providers: [FormBuilder, FeeGrantService, TransactionService, MappingErrorService, AccountService], }) diff --git a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html index 847cffae4..efaf4a93b 100644 --- a/src/app/pages/fee-grant/my-grantees/my-grantees.component.html +++ b/src/app/pages/fee-grant/my-grantees/my-grantees.component.html @@ -57,17 +57,7 @@ [routerLink]="['/transaction', data[template.matColumnDef]]"> {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} - - {{ - commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 - }} - +
    {{ data[template.matColumnDef] }}
    diff --git a/src/app/pages/fee-grant/my-granters/my-granters.component.html b/src/app/pages/fee-grant/my-granters/my-granters.component.html index dd47485b0..c57efd583 100644 --- a/src/app/pages/fee-grant/my-granters/my-granters.component.html +++ b/src/app/pages/fee-grant/my-granters/my-granters.component.html @@ -55,17 +55,7 @@ [routerLink]="['/transaction', data[template.matColumnDef]]"> {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} - - {{ - commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 - }} - +
    {{ data[template.matColumnDef] }}
    diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.html b/src/app/pages/proposal/proposal-table/proposal-table.component.html index d7b103f04..167a1e186 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.html +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.html @@ -33,19 +33,7 @@ - - - {{ (commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8) || '-' }} - - - {{ shortenAddress(data[template.matColumnDef]) || '-' }} - - + diff --git a/src/app/pages/proposal/proposal-table/proposal-table.component.ts b/src/app/pages/proposal/proposal-table/proposal-table.component.ts index e9f41a191..97f3659a2 100644 --- a/src/app/pages/proposal/proposal-table/proposal-table.component.ts +++ b/src/app/pages/proposal/proposal-table/proposal-table.component.ts @@ -1,20 +1,17 @@ import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout'; import { ChangeDetectionStrategy, - ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnInit, Output, - SimpleChanges, + SimpleChanges } from '@angular/core'; import { PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; -import { ProposalService } from 'src/app/core/services/proposal.service'; -import { ValidatorService } from 'src/app/core/services/validator.service'; import { TableTemplate } from '../../../../app/core/models/common.model'; import { CommonService } from '../../../../app/core/services/common.service'; import { shortenAddress } from '../../../../app/core/utils/common/shorten'; diff --git a/src/app/pages/proposal/proposal.module.ts b/src/app/pages/proposal/proposal.module.ts index f6d488622..bb4e97d26 100644 --- a/src/app/pages/proposal/proposal.module.ts +++ b/src/app/pages/proposal/proposal.module.ts @@ -25,6 +25,7 @@ import { ProposalTableComponent } from './proposal-table/proposal-table.componen import { ProposalVoteComponent } from './proposal-vote/proposal-vote.component'; import { ProposalComponent } from './proposal.component'; import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [ @@ -54,6 +55,7 @@ import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-pagina PaginatorModule, LoadingImageModule, APaginatorModule, + NameTagModule ], providers: [ProposalService, MappingErrorService, DecimalPipe, ValidatorService], }) diff --git a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html index 6d5024460..214beed33 100644 --- a/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html +++ b/src/app/pages/soulbound-token/soulbound-contract-list/soulbound-contract-list.component.html @@ -51,14 +51,7 @@

    Account Bound Token

    diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html index e9d0df5d0..e957fd072 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html @@ -109,7 +109,7 @@

    Account Bound Token

    [routerLink]="['/account', element.receiver_address]" [matTooltipPosition]="'above'" [matTooltipDisabled]="commonService.checkDisplayTooltip(element.receiver_address)" - matTooltip="{{ commonService.setNameTag(element.receiver_address) }}"> + matTooltip="{{ 'Public Name Tag: ' + commonService.setNameTag(element.receiver_address) }}"> {{ commonService.setNameTag(element.receiver_address) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/soulbound-token/soulbound-token.module.ts b/src/app/pages/soulbound-token/soulbound-token.module.ts index d6ccb4afa..b6e7a21a3 100644 --- a/src/app/pages/soulbound-token/soulbound-token.module.ts +++ b/src/app/pages/soulbound-token/soulbound-token.module.ts @@ -26,6 +26,7 @@ import { SoulboundTokenDetailPopupComponent } from './soulbound-token-detail-pop import { SoulboundTokenRoutingModule } from './soulbound-token-routing.module'; import {ClickOutsideModule} from "ng-click-outside"; import { AbtRejectPopupComponent } from './abt-reject-popup/abt-reject-popup.component'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [ @@ -59,6 +60,7 @@ import { AbtRejectPopupComponent } from './abt-reject-popup/abt-reject-popup.com ModelViewModule, AudioPlayerModule, ClickOutsideModule, + NameTagModule ], providers: [FormBuilder, SoulboundService], }) diff --git a/src/app/pages/statistics/statistics.module.ts b/src/app/pages/statistics/statistics.module.ts index 485f9ba88..5b1a19081 100644 --- a/src/app/pages/statistics/statistics.module.ts +++ b/src/app/pages/statistics/statistics.module.ts @@ -16,6 +16,7 @@ import { TopStatisticTransactionComponent } from './top-statistics/top-statistic import { TopStatisticsComponent } from './top-statistics/top-statistics.component'; import { MaskPipe, NgxMaskModule } from 'ngx-mask'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [ @@ -36,7 +37,8 @@ import { MatTooltipModule } from '@angular/material/tooltip'; TranslateModule, TableNoDataModule, NgxMaskModule, - MatTooltipModule + MatTooltipModule, + NameTagModule ], providers: [StatisticService, MaskPipe], }) diff --git a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html index a5dc1f543..08e573f4d 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html @@ -27,23 +27,8 @@
    Total {{ denom }}
    -
    - - {{ - commonService.setNameTag(transactionsData.top_aura_senders[0]?.address) | cutStringPipe : 8 : 8 - }} - {{ - commonService.setNameTag(transactionsData.top_aura_senders[0]?.address) | cutStringPipe : 6 : 6 - }} - +
    +
    {{ @@ -62,23 +47,8 @@
    Total {{ denom }}
    -
    - - {{ - commonService.setNameTag(transactionsData.top_aura_receivers[0]?.address) | cutStringPipe : 8 : 8 - }} - {{ - commonService.setNameTag(transactionsData.top_aura_receivers[0]?.address) | cutStringPipe : 6 : 6 - }} - +
    +
    {{ @@ -97,23 +67,8 @@
    Total Txn
    -
    - - {{ - commonService.setNameTag(transactionsData.top_txn_count_sent[0]?.address) | cutStringPipe : 8 : 8 - }} - {{ - commonService.setNameTag(transactionsData.top_txn_count_sent[0]?.address) | cutStringPipe : 6 : 6 - }} - +
    +
    {{ (transactionsData.top_txn_count_sent[0]?.result?.total_sent_tx?.amount | number) ?? 0 }} @@ -128,24 +83,8 @@
    Total Txn
    -
    - - {{ - commonService.setNameTag(transactionsData.top_txn_count_received[0]?.address) - | cutStringPipe : 8 : 8 - }} - {{ - commonService.setNameTag(transactionsData.top_txn_count_received[0]?.address) | cutStringPipe : 6 : 6 - }} - +
    +
    {{ (transactionsData.top_txn_count_received[0]?.result?.total_received_tx?.amount | number) ?? 0 }} diff --git a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html index 7e1afc3e7..75113831f 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html @@ -35,14 +35,9 @@

    Top {{ denom }} Senders

    address - - {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} - +
    + +
    @@ -96,14 +91,9 @@

    Top {{ denom }} Receivers

    address - - {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} - +
    + +
    @@ -158,14 +148,9 @@

    Top Txn Count Sent

    address - - {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} - +
    + +
    @@ -214,14 +199,9 @@

    Top Txn Count Received

    address - - {{ commonService.setNameTag(element.address) | cutStringPipe : 8 : 8 }} - +
    + +
    diff --git a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts index 5a3c67e18..a044f2884 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts +++ b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.ts @@ -2,11 +2,10 @@ import { formatDate } from '@angular/common'; import { Component, OnInit } from '@angular/core'; import { MatTableDataSource } from '@angular/material/table'; import { AURA_TOP_STATISTIC_RANGE } from 'src/app/core/constants/chart.constant'; +import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { TableTemplate } from 'src/app/core/models/common.model'; import { StatisticService } from 'src/app/core/services/statistic.service'; import { Globals } from 'src/app/global/global'; -import { EnvironmentService } from 'src/app/core/data-services/environment.service'; -import { CommonService } from 'src/app/core/services/common.service'; @Component({ selector: 'app-top-statistic-transaction', @@ -42,7 +41,6 @@ export class TopStatisticTransactionComponent implements OnInit { public global: Globals, private statisticService: StatisticService, private environmentService: EnvironmentService, - public commonService: CommonService ) {} ngOnInit(): void { diff --git a/src/app/pages/token/nft-detail/nft-detail.component.html b/src/app/pages/token/nft-detail/nft-detail.component.html index a0bb9ea03..db7e3e10e 100644 --- a/src/app/pages/token/nft-detail/nft-detail.component.html +++ b/src/app/pages/token/nft-detail/nft-detail.component.html @@ -159,12 +159,7 @@

    Details

    class="text--primary content-transfer" [matTooltipPosition]="'above'" [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" - matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}" + matTooltip="{{ 'Public Name Tag: ' + commonService.setNameTag(data[template.matColumnDef]) }}" [routerLink]="['/account', data[template.matColumnDef]]" *ngIf="data.modeExecute !== modeExecuteTransaction.Mint && data[template.matColumnDef]"> {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} + {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} @@ -404,10 +395,11 @@

    Item Activity

    "> {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} + {{ commonService.setNameTag(item.owner) | cutStringPipe : 8 : 8 }} diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html index 31f727e59..ac78a779e 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-transfers-tab/token-transfers-tab.component.html @@ -105,7 +105,7 @@ class="text--primary txt-from-address content-transfer" [matTooltipPosition]="'above'" [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" - matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}" + matTooltip="{{ 'Public Name Tag: ' + commonService.setNameTag(data[template.matColumnDef]) }}" href="/tokens/{{ linkToken }}/{{ contractAddress }}?a={{ data[template.matColumnDef] }}" *ngIf="data.modeExecute !== modeExecuteTransaction.Mint && data[template.matColumnDef]"> {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} @@ -113,7 +113,7 @@ {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} @@ -151,7 +151,7 @@ href="/tokens/{{ linkToken }}/{{ contractAddress }}?a={{ data[template.matColumnDef] }}" [matTooltipPosition]="'above'" [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" - matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}" + matTooltip="{{ 'Public Name Tag: ' + commonService.setNameTag(data[template.matColumnDef]) }}" *ngIf=" data.modeExecute !== modeExecuteTransaction.Burn && data.modeExecute !== modeExecuteTransaction.UnEquip && @@ -162,7 +162,7 @@
    Contract:
    diff --git a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html index 473f39833..461017e57 100644 --- a/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html +++ b/src/app/pages/token/token-list/token-cw4973/token-cw4973.component.html @@ -58,27 +58,13 @@

    Account Bound Tokens (ABT)

    Token Contract - {{ commonService.setNameTag(element.smart_contract?.address) | cutStringPipe : 8 : 8 }} + Creator - {{ commonService.setNameTag(element.smart_contract?.creator) | cutStringPipe : 8 : 8 }} + diff --git a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html index 2ffd657ec..29e7741b2 100644 --- a/src/app/pages/token/token-list/token-cw721/token-cw721.component.html +++ b/src/app/pages/token/token-list/token-cw721/token-cw721.component.html @@ -67,18 +67,7 @@

    Non-Fungible Tokens (NFT)

    Token Contract - {{ - commonService.setNameTag(element.cw721_contract?.smart_contract?.address) | cutStringPipe : 8 : 8 - }} - + diff --git a/src/app/pages/token/token.module.ts b/src/app/pages/token/token.module.ts index cd0686096..110abc64c 100644 --- a/src/app/pages/token/token.module.ts +++ b/src/app/pages/token/token.module.ts @@ -36,6 +36,7 @@ import { TokenCw20Component } from './token-list/token-cw20/token-cw20.component import { TokenCw4973Component } from './token-list/token-cw4973/token-cw4973.component'; import { TokenCw721Component } from './token-list/token-cw721/token-cw721.component'; import { TokenRoutingModule } from './token-routing.module'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; @NgModule({ declarations: [ @@ -77,6 +78,7 @@ import { TokenRoutingModule } from './token-routing.module'; ContractsModule, CommonDirectiveModule, APaginatorModule, + NameTagModule ], providers: [TokenService, AccountService], }) diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.html b/src/app/pages/validators/validators-detail/validators-detail.component.html index ce79a2c0f..86483d4b0 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.html +++ b/src/app/pages/validators/validators-detail/validators-detail.component.html @@ -353,7 +353,7 @@

    Delegators

    class="text--primary cursor-pointer" [matTooltipPosition]="'above'" [matTooltipDisabled]="commonService.checkDisplayTooltip(data[template.matColumnDef])" - matTooltip="{{ commonService.setNameTag(data[template.matColumnDef]) }}" + matTooltip="{{ 'Public Name Tag: ' + commonService.setNameTag(data[template.matColumnDef]) }}" [routerLink]="['/account', data.delegator_address]"> {{ commonService.setNameTag(data[template.matColumnDef], global.listNameTag) diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index 1181777c7..74c463007 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -51,23 +51,28 @@
    - - - {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} - - - {{ data[template.matColumnDef] | cutStringPipe : 8 : 8 }} - - + + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} + + + {{ commonService.setNameTag(data[template.matColumnDef]) | cutStringPipe : 8 : 8 }} +
    -
    diff --git a/src/app/shared/components/contract-table/contract-table.component.ts b/src/app/shared/components/contract-table/contract-table.component.ts index a6e1bbb77..9e5e62c99 100644 --- a/src/app/shared/components/contract-table/contract-table.component.ts +++ b/src/app/shared/components/contract-table/contract-table.component.ts @@ -77,6 +77,11 @@ export class ContractTableComponent implements OnInit, OnChanges { } else { this.isLoading = false; } + + console.log(this.contractInfo); + + console.log(this.dataList); + } ngOnInit(): void { diff --git a/src/app/shared/components/name-tag/name-tag.component.html b/src/app/shared/components/name-tag/name-tag.component.html new file mode 100644 index 000000000..c42bb3f2f --- /dev/null +++ b/src/app/shared/components/name-tag/name-tag.component.html @@ -0,0 +1,14 @@ + + + {{ (commonService.setNameTag(value) | cutStringPipe : 8 : 8) || '-' }} + + + {{ commonService.setNameTag(value) || '-' }} + {{ (commonService.setNameTag(value) | cutStringPipe : 8 : 8) || '-' }} + + diff --git a/src/app/shared/components/name-tag/name-tag.component.scss b/src/app/shared/components/name-tag/name-tag.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/shared/components/name-tag/name-tag.component.ts b/src/app/shared/components/name-tag/name-tag.component.ts new file mode 100644 index 000000000..723ebd4f6 --- /dev/null +++ b/src/app/shared/components/name-tag/name-tag.component.ts @@ -0,0 +1,18 @@ +import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; +import { CommonService } from 'src/app/core/services/common.service'; + +@Component({ + selector: 'app-name-tag', + templateUrl: './name-tag.component.html', + styleUrls: ['./name-tag.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class NameTagComponent implements OnInit { + @Input() value = ''; + @Input() url = 'account'; + @Input() fullWidth = false; + + constructor(public commonService: CommonService) {} + + ngOnInit(): void {} +} diff --git a/src/app/shared/components/name-tag/name-tag.module.ts b/src/app/shared/components/name-tag/name-tag.module.ts new file mode 100644 index 000000000..a4832c4b3 --- /dev/null +++ b/src/app/shared/components/name-tag/name-tag.module.ts @@ -0,0 +1,13 @@ +import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; +import { MatTooltipModule } from '@angular/material/tooltip'; +import { CommonPipeModule } from 'src/app/core/pipes/common-pipe.module'; +import { NameTagComponent } from './name-tag.component'; +import { RouterModule } from '@angular/router'; + +@NgModule({ + declarations: [NameTagComponent], + imports: [CommonModule, MatTooltipModule, CommonPipeModule, RouterModule], + exports: [NameTagComponent], +}) +export class NameTagModule {} From 1340e653c6085582fae1049feb87e42b49cfef49 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 4 Jul 2023 16:35:29 +0700 Subject: [PATCH 222/315] fix issue count wrong number holder --- src/app/core/services/token.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 953f9686d..d5c5489e5 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -27,7 +27,7 @@ export class TokenService extends CommonService { smart_contract { address } - cw20_holders_aggregate { + cw20_holders_aggregate(where: {amount: {_gt: "0"}}) { aggregate { count } @@ -228,7 +228,7 @@ export class TokenService extends CommonService { ): Observable { const operationsDoc = `query queryCW20ListHolder($address: String, $limit: Int, $offset: Int) { ${this.envDB} { - cw20_holder(where: {cw20_contract: {smart_contract: {address: {_eq: $address}}}}, limit: $limit, offset: $offset, order_by: {amount: desc}) { + cw20_holder(where: {cw20_contract: {smart_contract: {address: {_eq: $address}}}, amount: {_gt: "0"}}, limit: $limit, offset: $offset, order_by: {amount: desc}) { amount address cw20_contract { @@ -236,7 +236,7 @@ export class TokenService extends CommonService { decimal } } - cw20_holder_aggregate(where: {cw20_contract: {smart_contract: {address: {_eq: $address}}}}) { + cw20_holder_aggregate(where: {cw20_contract: {smart_contract: {address: {_eq: $address}}}, amount: {_gt: "0"}}) { aggregate { count } From b58ad03d5a99bc2b2e9818ebcbd2ed7abeee31aa Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Tue, 4 Jul 2023 16:35:33 +0700 Subject: [PATCH 223/315] update proposal detail --- .../summary-info/summary-info.component.html | 66 +++++++++++-------- .../summary-info/summary-info.component.scss | 22 +++++-- .../summary-info/summary-info.component.ts | 25 ++++++- src/assets/scss/aura-theme/reboot.scss | 7 +- 4 files changed, 81 insertions(+), 39 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html index c51f4d7f8..7790bd03b 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.html @@ -138,7 +138,7 @@

    - - - - - - - - - - - - - - +
    + + + +
    +
    +
    + {{item[key]}} +
    +
    +
    - - - -
    - - - + +
    +
    + {{proposalDetail?.content?.plan[key]}} +
    +
    -
    {{ row }}
    {{ item[row] }}
    {{ proposalDetail?.content?.plan[row] }}
    {{ item[row] }}
    + + +
    +
    +
    + {{item[key]}} +
    +
    +
    +
    diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss index 71734b6fc..a4695c47c 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.scss @@ -235,14 +235,24 @@ -webkit-line-clamp: 2; -webkit-box-orient: vertical; } -.planTable { - th, td { - padding: 0 16px; +.nav-tabs-proposal.aura-nav-tabs.nav-tabs { + .nav-item { + flex-grow: 0; + padding: 0 12px; + @media (min-width: 991.98px) { + padding: 0 32px; + } + } + .nav-link { height: 32px; } - tr { - th:first-child, td:first-child { - padding-left: 0; +} +.overflow-scroll-x--md { + @media (min-width: 991.98px) { + overflow-x: scroll; + &::-webkit-scrollbar { + height: 4px; + width: 4px; } } } diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index b3d73543f..8d6a0b8c9 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -55,6 +55,8 @@ export class SummaryInfoComponent implements OnInit { ParameterChange: '/cosmos.params.v1beta1.ParameterChangeProposal', }; + activeId = 0; + reload$; constructor( @@ -422,22 +424,39 @@ export class SummaryInfoComponent implements OnInit { getProposalMoreInfo(data: any) { if (this.proposalDetailTitleArr?.length === 0) { if (typeof data !== 'object') { - for (let key in data[0]) { - this.proposalDetailTitleArr.push(key); + let index = 0; + for (let prop in data[0]) { + this.proposalDetailTitleArr.push({ + key: index, + value: prop + }); + index++; } } if (typeof data === 'object') { + let index = 0; data = data[0] || data; for (let prop in data) { if (data.hasOwnProperty(prop)) { - this.proposalDetailTitleArr.push(prop); + this.proposalDetailTitleArr.push({ + key: index, + value: prop + }); + index++; } } } } } + changeTab(key) { + this.activeId = key; + } typeOf(value) { return typeof value; } + + getObjectKey(object) { + return Object.keys(object) + } } diff --git a/src/assets/scss/aura-theme/reboot.scss b/src/assets/scss/aura-theme/reboot.scss index c854ce5b5..eeb9a2233 100644 --- a/src/assets/scss/aura-theme/reboot.scss +++ b/src/assets/scss/aura-theme/reboot.scss @@ -1,18 +1,19 @@ ::-webkit-scrollbar-track { -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1); - background-color: var(--aura-light-gray); border-radius: 10px; + background: linear-gradient(108.46deg, #5EE6D0 12.51%, #BFC6FF 51.13%, #FFBA69 87.49%); + width: 5px; } ::-webkit-scrollbar { width: 5px; - background-color: var(--aura-light-gray); + background-color: #F2F3F5; } ::-webkit-scrollbar-thumb { border-radius: 10px; background-color: #FFF; - background-image: var(--aura-gradient-general) + background: linear-gradient(108.46deg, #5EE6D0 12.51%, #BFC6FF 51.13%, #FFBA69 87.49%) } h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 { margin-bottom: 0; From 5eb2ed5347769760575a81aac5eab39ec4316322 Mon Sep 17 00:00:00 2001 From: mtam Date: Tue, 4 Jul 2023 16:48:24 +0700 Subject: [PATCH 224/315] [TamTM6] update event log tx detail --- .../transaction-messages.component.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 54848dcea..8a45cb7f9 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -124,10 +124,16 @@
    -
    -
    Message
    -
    -
    
    +      
    +
    +
    +
    Message
    +
    +
    
    +            
    +
    + +
    From c66d2f2f2125e372930025e1e515b90e4abbd069 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 5 Jul 2023 10:21:03 +0700 Subject: [PATCH 225/315] fix issue search data --- .../account-detail/nft-list/nft-list.component.html | 3 ++- .../account-detail/nft-list/nft-list.component.ts | 7 +++++-- .../token-table/token-table.component.html | 10 +++------- .../token-table/token-table.component.ts | 13 +++---------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/app/pages/account/account-detail/nft-list/nft-list.component.html b/src/app/pages/account/account-detail/nft-list/nft-list.component.html index 65e0b025c..82db6ca7a 100644 --- a/src/app/pages/account/account-detail/nft-list/nft-list.component.html +++ b/src/app/pages/account/account-detail/nft-list/nft-list.component.html @@ -9,7 +9,7 @@

    NFTs ({{ pageData?.length || 0 }} NFTs)

    -
    diff --git a/src/app/pages/contracts/contracts-detail/contracts-overview-card/contracts-overview-card.component.ts b/src/app/pages/contracts/contracts-detail/contracts-overview-card/contracts-overview-card.component.ts index d94b73505..3fd9c9dcf 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-overview-card/contracts-overview-card.component.ts +++ b/src/app/pages/contracts/contracts-detail/contracts-overview-card/contracts-overview-card.component.ts @@ -1,8 +1,9 @@ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; +import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; import { TYPE_ACCOUNT } from 'src/app/core/constants/account.constant'; import { EnvironmentService } from 'src/app/core/data-services/environment.service'; import { Globals } from '../../../../global/global'; -import {ContractService} from "src/app/core/services/contract.service"; +import { ContractService } from 'src/app/core/services/contract.service'; +import { LENGTH_CHARACTER } from 'src/app/core/constants/common.constant'; @Component({ selector: 'app-contracts-overview-card', @@ -16,19 +17,21 @@ export class ContractsOverviewCardComponent implements OnInit, OnChanges { priceToken = 0; selectedToken = '$0.00'; assetsType = TYPE_ACCOUNT; + lengthNormalAddress = LENGTH_CHARACTER.ADDRESS; + denom = this.environmentService.configValue.chain_info.currencies[0].coinDenom; constructor( public global: Globals, private environmentService: EnvironmentService, - private contractService: ContractService) {} + private contractService: ContractService, + ) {} - ngOnInit() { - } + ngOnInit() {} async ngOnChanges(changes: SimpleChanges) { const balanceReq = await this.contractService.getContractBalance(this.contractDetail.address); - if(balanceReq?.data) { + if (balanceReq?.data) { this.contractBalance = balanceReq.data.balances[0] ? balanceReq.data.balances[0] : 0; this.contractPrice = this.contractBalance * this.priceToken || 0; } diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html index d535acaeb..a81945102 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html @@ -32,9 +32,9 @@
    Owner: {{ commonService.setNameTag(item.owner) | cutStringPipe : 5 : 5 }} + >{{ commonService.setNameTag(item.owner) | cutStringPipe : 6 : 6 }} + class="mr-lg-3 mr-0 ml-3 ml-lg-0" />
    @@ -142,7 +142,7 @@
    -
    +
    diff --git a/src/app/shared/components/contract-table/contract-table.component.scss b/src/app/shared/components/contract-table/contract-table.component.scss index 8e40dc724..0c5ace671 100644 --- a/src/app/shared/components/contract-table/contract-table.component.scss +++ b/src/app/shared/components/contract-table/contract-table.component.scss @@ -1,22 +1,14 @@ .contract-table { - .aura-status { + .status { + font-size: 12px; + font-weight: 600; .TO, .IN { - background: rgba(84, 206, 140, 0.2); color: var(--aura-green-3); } - .OUT { - background: rgba(213, 98, 94, 0.2); color: var(--aura-red-3); } - - .TO, - .IN, - .OUT, - .CREATION { - font-weight: 500; - } } } diff --git a/src/app/shared/components/name-tag/name-tag.component.html b/src/app/shared/components/name-tag/name-tag.component.html index 1e47a92f8..52b0a5fa0 100644 --- a/src/app/shared/components/name-tag/name-tag.component.html +++ b/src/app/shared/components/name-tag/name-tag.component.html @@ -3,7 +3,7 @@ @@ -102,7 +102,7 @@ diff --git a/src/app/shared/components/name-tag/name-tag.component.scss b/src/app/shared/components/name-tag/name-tag.component.scss index 2d13c4716..a8a67c0b4 100644 --- a/src/app/shared/components/name-tag/name-tag.component.scss +++ b/src/app/shared/components/name-tag/name-tag.component.scss @@ -1,27 +1,27 @@ .box-name-tag { - background: var(--aura-gray-8); + // background: var(--aura-gray-8); border-radius: 16px; - min-width: 142px; + // min-width: 142px; display: inline-flex; - padding: 4px 8px; - font-size: 12px; + // padding: 4px 8px; + font-size: 14px; align-items: center; - justify-content: center; + // justify-content: center; font-weight: 400; word-break: break-word; @media (min-width: 992px) { - padding: 4px 8px; + // padding: 4px 8px; } &.w-auto { - min-width: auto; + // min-width: auto; } &:has(.icon-name-tag){ - min-width: 158px; + // min-width: 158px; } } .icon-name-tag { - width: 12px; - height: 12px; - margin-right: 8px; + width: 16px; + height: 16px; + margin-right: 4px; } diff --git a/src/assets/scss/custom.scss b/src/assets/scss/custom.scss index c8c8a17ab..15abea4e2 100644 --- a/src/assets/scss/custom.scss +++ b/src/assets/scss/custom.scss @@ -665,10 +665,10 @@ body { } .name-tag-label { - padding: 8px; - border-radius: 16px; - background-color: var(--aura-gray-8); - font-size: 12px; + // padding: 8px; + // border-radius: 16px; + // background-color: var(--aura-gray-8); + // font-size: 12px; } app-tooltip-customize { From 23d17f93e2e3cb76cc35d08b112ff6083b6e06ce Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 13 Jul 2023 14:57:51 +0700 Subject: [PATCH 286/315] [TamTM6] fix tooltip --- .../contracts/contracts-list/contracts-list.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index 5c02f8dc4..be8d71f57 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -92,7 +92,7 @@

    Contracts

    -
    +
    From ee6d4973ac7b1c27703c4e05f2c5aea8b07a648d Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Fri, 14 Jul 2023 09:30:05 +0700 Subject: [PATCH 287/315] update code holder --- .../pages/token/token-list/token-cw20/token-cw20.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts index d00d332aa..6036c5604 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts @@ -182,8 +182,8 @@ export class TokenCw20Component implements OnInit, OnDestroy { onChainMarketCap: +tokenFind?.circulating_market_cap || 0, volume: +tokenFind?.total_volume || 0, price: +tokenFind?.current_price || 0, - isHolderUp: true ? changePercent >= 0 : false, - isValueUp: true ? tokenFind?.price_change_percentage_24h >= 0 : false, + isHolderUp: changePercent >= 0 ? true : false, + isValueUp: tokenFind?.price_change_percentage_24h >= 0 ? true : false, change: tokenFind?.price_change_percentage_24h || 0, holderChange: changePercent, holders: item.cw20_holders_aggregate?.aggregate?.count, From a2a311edd6fe0717850a8d20e7e1fd3c8958c3d6 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Fri, 14 Jul 2023 14:50:33 +0700 Subject: [PATCH 288/315] fixbug tooltip --- .../account/account-detail/account-detail.component.html | 2 +- .../top-statistic-transaction.component.html | 8 ++++---- .../token-inventory-tab.component.html | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index 56600e32d..a1e136fe2 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -168,7 +168,7 @@

    Coins & Tokens ({{ totalAssets || 0 }})

    + [content]="data[template.matColumnDef]"> diff --git a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html index 75113831f..253dc862c 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html @@ -24,7 +24,7 @@

    Top {{ denom }} Senders

    -
    +
    @@ -80,7 +80,7 @@

    Top {{ denom }} Receivers

    -
    +
    @@ -137,7 +137,7 @@

    Top Txn Count Sent

    -
    +
    @@ -188,7 +188,7 @@

    Top Txn Count Received

    -
    +
    diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html index a81945102..a1ecdf444 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-inventory-tab/token-inventory-tab.component.html @@ -29,7 +29,7 @@ {{ item.token_id }} -
    +
    Owner: Date: Mon, 17 Jul 2023 10:41:57 +0700 Subject: [PATCH 289/315] [TamTM6] fix bug layout --- src/app/core/constants/contract.constant.ts | 2 +- .../contracts-list/contracts-list.component.html | 12 ++++-------- .../token-transfers-tab.component.scss | 1 - .../token/token-detail/token-detail.component.ts | 2 +- .../token-overview/token-overview.component.html | 2 +- .../token-list/token-cw20/token-cw20.component.html | 2 +- .../validators-detail.component.scss | 6 +++--- .../contract-table/contract-table.component.html | 9 ++++++++- .../contract-table/contract-table.component.scss | 12 ++++++++++++ 9 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/app/core/constants/contract.constant.ts b/src/app/core/constants/contract.constant.ts index 44e8dc41f..53554ce81 100644 --- a/src/app/core/constants/contract.constant.ts +++ b/src/app/core/constants/contract.constant.ts @@ -40,7 +40,7 @@ export const CONTRACT_TABLE_TEMPLATES: Array = [ { matColumnDef: 'blockHeight', headerCellDef: 'Block', type: 'hash-url', headerWidth: 6, isUrl: '/blocks' }, { matColumnDef: 'time', headerCellDef: 'Time', type: 'time-distance', headerWidth: 8, suffix: 'ago' }, { matColumnDef: 'from', headerCellDef: 'From', type: 'hash-url', headerWidth: 12, isUrl: '/account', isNameTag: true }, - { matColumnDef: 'label', headerCellDef: '', type: 'status', headerWidth: 6, justify: 'center' }, + { matColumnDef: 'label', headerCellDef: '', type: 'type', headerWidth: 6, justify: 'center' }, { matColumnDef: 'to', headerCellDef: 'To', type: 'hash-url', headerWidth: 12, isUrl: '/contracts', isNameTag: true }, { matColumnDef: 'fee', headerCellDef: 'Txn Fee', type: 'numb', headerWidth: 10 }, ]; diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index be8d71f57..ddcdc6c0d 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -103,14 +103,10 @@

    Contracts

    - +
    ({{ tokenDetail.isHolderUp ? '↑' : '↓' - }}{{ tokenDetail.holderChange | number : global.formatNumber2Decimal }}%)
    diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html index efd056607..51ccfa604 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html @@ -149,7 +149,7 @@

    CW-20 Tokens

    {{ element.isHolderUp ? '↑' : '↓' }} - {{ element.holderChange | number : global.formatNumber2Decimal }}% + {{ element.holderChange || 0 | number : global.formatNumber2Decimal }}%
    diff --git a/src/app/pages/validators/validators-detail/validators-detail.component.scss b/src/app/pages/validators/validators-detail/validators-detail.component.scss index f6229f6e6..eab9826c5 100644 --- a/src/app/pages/validators/validators-detail/validators-detail.component.scss +++ b/src/app/pages/validators/validators-detail/validators-detail.component.scss @@ -146,9 +146,9 @@ form.search-form { .titleMob { ::ng-deep app-card-mob-simple { .name-tag { - padding: 4px 8px; - border-radius: 16px; - background-color: var(--aura-gray-8); + // padding: 4px 8px; + // border-radius: 16px; + // background-color: var(--aura-gray-8); } .d-flex.justify-content-between.small-body:first-child > div { color: var(--aura-primary) !important; diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index 343a6d8ca..9158f5739 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -72,7 +72,7 @@
    @@ -80,6 +80,13 @@
    + +
    +
    + {{ data[template.matColumnDef] }} +
    +
    +
    diff --git a/src/app/shared/components/contract-table/contract-table.component.scss b/src/app/shared/components/contract-table/contract-table.component.scss index 0c5ace671..2202039bd 100644 --- a/src/app/shared/components/contract-table/contract-table.component.scss +++ b/src/app/shared/components/contract-table/contract-table.component.scss @@ -1,5 +1,17 @@ .contract-table { .status { + font-weight: 500; + &.TO, + &.IN { + background: rgba(84, 206, 140, 0.2); + color: var(--aura-green-3); + } + &.OUT { + background: rgba(213, 98, 94, 0.2); + color: var(--aura-red-3); + } + } + .method { font-size: 12px; font-weight: 600; .TO, From 4551bbddfeb2e8a5cb3e70bcd4381f5731c88344 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Mon, 17 Jul 2023 11:05:36 +0700 Subject: [PATCH 290/315] fix bug table responsive --- .../contracts-list/contracts-list.component.html | 2 +- .../top-statistic-transaction.component.html | 8 ++++---- src/assets/scss/custom.scss | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index be8d71f57..e1700954a 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -92,7 +92,7 @@

    Contracts

    -
    +
    diff --git a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html index 253dc862c..3f875b929 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-transaction/top-statistic-transaction.component.html @@ -24,7 +24,7 @@

    Top {{ denom }} Senders

    -
    +
    @@ -80,7 +80,7 @@

    Top {{ denom }} Receivers

    -
    +
    @@ -137,7 +137,7 @@

    Top Txn Count Sent

    -
    +
    @@ -188,7 +188,7 @@

    Top Txn Count Received

    -
    +
    diff --git a/src/assets/scss/custom.scss b/src/assets/scss/custom.scss index 15abea4e2..463445e8c 100644 --- a/src/assets/scss/custom.scss +++ b/src/assets/scss/custom.scss @@ -709,3 +709,7 @@ app-tooltip-customize { padding-top: 50px; margin-top: -40px; } +.overflow-scroll-x { + overflow-x: auto; + &::-webkit-scrollbar{ height : 6px; } +} From f1760d70ca18fb7607892e0d6003ff42e5a15f8d Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 17 Jul 2023 11:07:57 +0700 Subject: [PATCH 291/315] fix bug table responsive --- .../pages/account/account-detail/account-detail.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index a1e136fe2..af5c725d2 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -22,7 +22,7 @@
    From 0e086e97a88dd5c32bffd66630aba140ca185c89 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 17 Jul 2023 15:35:57 +0700 Subject: [PATCH 293/315] fix display value token --- .../token-holders-tab.component.html | 2 ++ .../token-content.component.html | 33 ++++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html index c9d70c12a..648a02a80 100644 --- a/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content-tab/token-holders-tab/token-holders-tab.component.html @@ -75,9 +75,11 @@
    + $0.00
    {{ data[template.matColumnDef] }} diff --git a/src/app/pages/token/token-detail/token-content/token-content.component.html b/src/app/pages/token/token-detail/token-content/token-content.component.html index ecceaf31f..e4bfe57f7 100644 --- a/src/app/pages/token/token-detail/token-content/token-content.component.html +++ b/src/app/pages/token/token-detail/token-content/token-content.component.html @@ -44,21 +44,24 @@
    VALUE
    -
    - ( -
    - {{ denom }}) + +
    + ( +
    + {{ denom }}) +
    + $0.00 (0 {{ denom }})
    From 0c079c0bdeb0e8fa46ffd1106128cdb19c6b11d4 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Mon, 17 Jul 2023 16:31:41 +0700 Subject: [PATCH 294/315] fix bug tooltip --- .../contracts-list.component.html | 1 + .../name-tag/name-tag.component.html | 1 + .../components/name-tag/name-tag.component.ts | 1 + .../soulbound-feature-tokens.component.html | 2 +- .../soulbound-feature-tokens.component.scss | 18 ------- .../tooltip-customize.component.scss | 24 +++++++++ src/assets/scss/aura-theme/tooltip.scss | 50 +++++++++++++++++++ src/assets/scss/custom.scss | 39 --------------- src/styles.scss | 3 +- 9 files changed, 80 insertions(+), 59 deletions(-) create mode 100644 src/assets/scss/aura-theme/tooltip.scss diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index feb4268e0..821158117 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -110,6 +110,7 @@

    Contracts

    diff --git a/src/app/shared/components/name-tag/name-tag.component.html b/src/app/shared/components/name-tag/name-tag.component.html index 52b0a5fa0..b3474c98e 100644 --- a/src/app/shared/components/name-tag/name-tag.component.html +++ b/src/app/shared/components/name-tag/name-tag.component.html @@ -12,6 +12,7 @@
    diff --git a/src/app/shared/components/name-tag/name-tag.component.ts b/src/app/shared/components/name-tag/name-tag.component.ts index b6b826002..c0392ee2d 100644 --- a/src/app/shared/components/name-tag/name-tag.component.ts +++ b/src/app/shared/components/name-tag/name-tag.component.ts @@ -26,6 +26,7 @@ export class NameTagComponent implements OnInit { @Input() isTokenDetail = false; @Input() extendUrl = false; @Input() widthAuto = false; + @Input() isNameTagContract = false; extendUrlLink = ''; constructor(public commonService: CommonService, public global: Globals) {} diff --git a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html index e8c309a23..76dfe231d 100644 --- a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html +++ b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html @@ -41,7 +41,7 @@ {{ soulboundUnclaimedNum > 99 ? '99+' : soulboundUnclaimedNum }} diff --git a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.scss b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.scss index 095b83ab4..6736b8bdf 100644 --- a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.scss +++ b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.scss @@ -91,21 +91,3 @@ padding: 0; align-items: flex-start; } -app-tooltip-customize.sb-tooltip { - left: unset; - right: 0; - transform: translate(0, -32px); - ::ng-deep { - .aura-tooltip { - border-bottom-right-radius: unset; - &:before { - border-top: 10px solid var(--aura-gray-8); - border-left: 10px solid transparent; - border-bottom: unset; - border-right: unset; - left: unset; - right: -6px; - } - } - } -} diff --git a/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss b/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss index 0918c32b7..af2bae2dd 100644 --- a/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss +++ b/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss @@ -32,3 +32,27 @@ top: 0; transform: translate(-50%, -100%); } + +::ng-deep app-tooltip-customize.tooltip--right .aura-tooltip { + border-bottom-left-radius: unset; + &:before { + border-top: 10px solid var(--aura-gray-8); + border-right: 10px solid transparent; + border-bottom: unset; + border-left: unset; + right: unset; + left: 4px; + } +} + +::ng-deep app-tooltip-customize.tooltip--left .aura-tooltip { + border-bottom-right-radius: unset; + &:before { + border-top: 10px solid var(--aura-gray-8); + border-left: 10px solid transparent; + border-bottom: unset; + border-right: unset; + left: unset; + right: -6px; + } +} diff --git a/src/assets/scss/aura-theme/tooltip.scss b/src/assets/scss/aura-theme/tooltip.scss new file mode 100644 index 000000000..89076efa8 --- /dev/null +++ b/src/assets/scss/aura-theme/tooltip.scss @@ -0,0 +1,50 @@ +app-tooltip-customize { + z-index: 10; + width: max-content; + position: absolute; + left: 50%; + bottom: 100%; + transform: translate(-50%, -16px); + max-width: 0; + max-height: 0; + opacity: 0; + transition: opacity .35s ease-in-out; + &.tooltip--below { + bottom: 0; + top: 100%; + transform: translate(-50%, 16px); + } +} +.aura-tooltip-contain { + display: inline-block; + position: relative; + .aura-tooltip-object { + cursor: pointer; + &:not(.disabled-hover):hover ~ app-tooltip-customize, &.show ~ app-tooltip-customize { + max-width: 900px; + max-height: 900px; + opacity: 1; + .aura-tooltip { + display: block; + padding: 8px; + } + } + } +} +.spacer-tooltip { + padding-top: 50px; + margin-top: -40px; +} + +app-tooltip-customize.tooltip--left { + left: unset; + right: 0; + transform: translate(0, -32px); +} + + +app-tooltip-customize.tooltip--right { + right: unset; + left: 0; + transform: translate(0, -16px); +} diff --git a/src/assets/scss/custom.scss b/src/assets/scss/custom.scss index 463445e8c..b8720ab85 100644 --- a/src/assets/scss/custom.scss +++ b/src/assets/scss/custom.scss @@ -670,45 +670,6 @@ body { // background-color: var(--aura-gray-8); // font-size: 12px; } - -app-tooltip-customize { - z-index: 10; - width: max-content; - position: absolute; - left: 50%; - bottom: 100%; - transform: translate(-50%, -16px); - max-width: 0; - max-height: 0; - opacity: 0; - transition: opacity .35s ease-in-out; - &.tooltip--below { - bottom: 0; - top: 100%; - transform: translate(-50%, 16px); - } -} - -.aura-tooltip-contain { - display: inline-block; - position: relative; - .aura-tooltip-object { - cursor: pointer; - &:not(.disabled-hover):hover ~ app-tooltip-customize, &.show ~ app-tooltip-customize { - max-width: 900px; - max-height: 900px; - opacity: 1; - .aura-tooltip { - display: block; - padding: 8px; - } - } - } -} -.spacer-tooltip { - padding-top: 50px; - margin-top: -40px; -} .overflow-scroll-x { overflow-x: auto; &::-webkit-scrollbar{ height : 6px; } diff --git a/src/styles.scss b/src/styles.scss index 6754ae0ef..cd12a1699 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -49,6 +49,7 @@ $minia-theme: mat.define-dark-theme((color: (primary: $minia-primary, @import "assets/scss/aura-theme/nav"; @import "assets/scss/aura-theme/popup"; @import "assets/scss/aura-theme/editorial"; +@import "assets/scss/aura-theme/tooltip"; @import "assets/scss/aura-theme/cards"; @import "assets/scss/aura-theme/border"; @import "assets/scss/aura-theme/chart"; @@ -63,4 +64,4 @@ body { body { margin: 0; font-family: "SFPro", sans-serif; -} \ No newline at end of file +} From 4aad9dd65cf420594a96ee0c2a1d5e404c01a619 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 17 Jul 2023 16:32:22 +0700 Subject: [PATCH 295/315] add tooltip proposal list --- .../summary-info/summary-info.component.ts | 1 - .../pages/proposal/proposal.component.html | 28 ++++++++++--------- .../name-tag/name-tag.component.html | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts index e71c372ce..8863ce16e 100644 --- a/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts +++ b/src/app/pages/proposal/proposal-detail/summary-info/summary-info.component.ts @@ -55,7 +55,6 @@ export class SummaryInfoComponent implements OnInit { ParameterChange: '/cosmos.params.v1beta1.ParameterChangeProposal', }; activeId = 0; - reload$; constructor( diff --git a/src/app/pages/proposal/proposal.component.html b/src/app/pages/proposal/proposal.component.html index b4695a228..b62b625e9 100644 --- a/src/app/pages/proposal/proposal.component.html +++ b/src/app/pages/proposal/proposal.component.html @@ -23,13 +23,14 @@
    Voting Start
    @@ -203,12 +204,13 @@

    diff --git a/src/app/shared/components/name-tag/name-tag.component.html b/src/app/shared/components/name-tag/name-tag.component.html index 52b0a5fa0..3798ff9d4 100644 --- a/src/app/shared/components/name-tag/name-tag.component.html +++ b/src/app/shared/components/name-tag/name-tag.component.html @@ -54,7 +54,7 @@ From 7fab2a855db8a5782d72888675c8cf658b3df2dd Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Mon, 17 Jul 2023 16:49:27 +0700 Subject: [PATCH 296/315] fix bug tooltip --- .../contracts-list/contracts-list.component.html | 16 ++++++++++------ .../tooltip-customize.component.scss | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/app/pages/contracts/contracts-list/contracts-list.component.html b/src/app/pages/contracts/contracts-list/contracts-list.component.html index 821158117..1616f0281 100644 --- a/src/app/pages/contracts/contracts-list/contracts-list.component.html +++ b/src/app/pages/contracts/contracts-list/contracts-list.component.html @@ -103,15 +103,19 @@

    Contracts

    -
    +
    + contract_verification +
    + + [isNameTagContract]="true">
    diff --git a/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss b/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss index af2bae2dd..54a519f8c 100644 --- a/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss +++ b/src/app/shared/components/tooltip-customize/tooltip-customize.component.scss @@ -41,7 +41,7 @@ border-bottom: unset; border-left: unset; right: unset; - left: 4px; + left: 20px; } } From f839b22d17f55aaa8d813507478ad17acc6a88c0 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 09:55:35 +0700 Subject: [PATCH 297/315] hide denom in block detail - transaction message --- .../blocks/block-detail/block-detail.component.html | 9 +-------- .../token-overview/token-overview.component.html | 8 -------- .../token-overview/token-overview.component.ts | 3 ++- .../token/token-list/token-cw20/token-cw20.component.ts | 4 ++-- .../transaction-messages.component.html | 7 +------ 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index 6a949487a..a0779d43c 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -264,14 +264,7 @@

    Events

    {{ data.key | decodeData }} - - {{ - data.value | decodeData - }} - - + {{ data.value | decodeData }}
    diff --git a/src/app/pages/token/token-detail/token-overview/token-overview.component.html b/src/app/pages/token/token-detail/token-overview/token-overview.component.html index 1185b3a72..95fc01b08 100644 --- a/src/app/pages/token/token-detail/token-overview/token-overview.component.html +++ b/src/app/pages/token/token-detail/token-overview/token-overview.component.html @@ -10,14 +10,6 @@ [CW-4973] -

    diff --git a/src/app/pages/token/token-detail/token-overview/token-overview.component.ts b/src/app/pages/token/token-detail/token-overview/token-overview.component.ts index eceb9f86f..f2565a6c8 100644 --- a/src/app/pages/token/token-detail/token-overview/token-overview.component.ts +++ b/src/app/pages/token/token-detail/token-overview/token-overview.component.ts @@ -43,7 +43,7 @@ export class TokenOverviewComponent implements OnInit { this.tokenDetail.change = Number(this.tokenDetail.change.toString().substring(1)); } - if (this.tokenDetail.cw20_contract.cw20_total_holder_stats.length > 0) { + if (this.tokenDetail.cw20_contract.cw20_total_holder_stats.length > 1) { this.tokenDetail.holderChange = (this.tokenDetail.cw20_contract.cw20_total_holder_stats[1].total_holder * 100) / this.tokenDetail.cw20_contract.cw20_total_holder_stats[0].total_holder - @@ -53,6 +53,7 @@ export class TokenOverviewComponent implements OnInit { this.tokenDetail['isHolderUp'] = true; if (this.tokenDetail.holderChange < 0) { this.tokenDetail['isHolderUp'] = false; + this.tokenDetail.holderChange = Math.abs(this.tokenDetail.holderChange); } } diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts index 6036c5604..eb37fd404 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts @@ -163,7 +163,7 @@ export class TokenCw20Component implements OnInit, OnDestroy { const tokenFind = tokenMarket?.find( (f) => String(f.contract_address) === item?.smart_contract?.address, ); - if (item.cw20_total_holder_stats.length > 0) { + if (item.cw20_total_holder_stats.length > 1) { changePercent = (item.cw20_total_holder_stats[1].total_holder * 100) / item.cw20_total_holder_stats[0].total_holder - @@ -185,7 +185,7 @@ export class TokenCw20Component implements OnInit, OnDestroy { isHolderUp: changePercent >= 0 ? true : false, isValueUp: tokenFind?.price_change_percentage_24h >= 0 ? true : false, change: tokenFind?.price_change_percentage_24h || 0, - holderChange: changePercent, + holderChange: Math.abs(changePercent), holders: item.cw20_holders_aggregate?.aggregate?.count, max_total_supply: tokenFind?.max_supply || 0, fully_diluted_market_cap: tokenFind?.fully_diluted_valuation || 0, diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html index 7401e5b55..e2010c779 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.html @@ -490,12 +490,7 @@
    {{ data.key }} - {{ - data.value - }} - + {{ data.value }}
    From 61e81f2422170ba499c4a5aae48890ceb1f6eec6 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 09:59:55 +0700 Subject: [PATCH 298/315] hide denom in block detail - transaction message --- .../token-detail/token-overview/token-overview.component.ts | 2 +- .../pages/token/token-list/token-cw20/token-cw20.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/pages/token/token-detail/token-overview/token-overview.component.ts b/src/app/pages/token/token-detail/token-overview/token-overview.component.ts index f2565a6c8..2b52b313a 100644 --- a/src/app/pages/token/token-detail/token-overview/token-overview.component.ts +++ b/src/app/pages/token/token-detail/token-overview/token-overview.component.ts @@ -43,7 +43,7 @@ export class TokenOverviewComponent implements OnInit { this.tokenDetail.change = Number(this.tokenDetail.change.toString().substring(1)); } - if (this.tokenDetail.cw20_contract.cw20_total_holder_stats.length > 1) { + if (this.tokenDetail.cw20_contract?.cw20_total_holder_stats?.length > 1) { this.tokenDetail.holderChange = (this.tokenDetail.cw20_contract.cw20_total_holder_stats[1].total_holder * 100) / this.tokenDetail.cw20_contract.cw20_total_holder_stats[0].total_holder - diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts index eb37fd404..990d657d3 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.ts @@ -163,7 +163,7 @@ export class TokenCw20Component implements OnInit, OnDestroy { const tokenFind = tokenMarket?.find( (f) => String(f.contract_address) === item?.smart_contract?.address, ); - if (item.cw20_total_holder_stats.length > 1) { + if (item.cw20_total_holder_stats?.length > 1) { changePercent = (item.cw20_total_holder_stats[1].total_holder * 100) / item.cw20_total_holder_stats[0].total_holder - From db9739a07c5b943f1b849c6a90039459e45459f3 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 10:12:36 +0700 Subject: [PATCH 299/315] fix color method transaction --- .../contract-table/contract-table.component.html | 4 ++-- .../contract-table/contract-table.component.scss | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/shared/components/contract-table/contract-table.component.html b/src/app/shared/components/contract-table/contract-table.component.html index 9158f5739..96ce02d3d 100644 --- a/src/app/shared/components/contract-table/contract-table.component.html +++ b/src/app/shared/components/contract-table/contract-table.component.html @@ -3,8 +3,8 @@
    {{ nextKey ? 'More than' : 'A total of' }} {{ contractInfo.count | mask : 'separator.6' }} -
    -
    {{ parseLabel(label) }}
    +
    +
    {{ parseLabel(label) }}
    transaction{{ contractInfo.count > 1 ? 's' : '' }} found
    diff --git a/src/app/shared/components/contract-table/contract-table.component.scss b/src/app/shared/components/contract-table/contract-table.component.scss index 2202039bd..07191fba3 100644 --- a/src/app/shared/components/contract-table/contract-table.component.scss +++ b/src/app/shared/components/contract-table/contract-table.component.scss @@ -1,23 +1,29 @@ .contract-table { .status { font-weight: 500; + &.TO, &.IN { background: rgba(84, 206, 140, 0.2); color: var(--aura-green-3); } + &.OUT { background: rgba(213, 98, 94, 0.2); color: var(--aura-red-3); } } + .method { + color: var(--aura-white); font-size: 12px; font-weight: 600; + .TO, .IN { color: var(--aura-green-3); } + .OUT { color: var(--aura-red-3); } @@ -48,4 +54,4 @@ .table-responsive::-webkit-scrollbar { height: 6px; -} +} \ No newline at end of file From d9ffa8c860b1facff9530e52307e15ea50041999 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 13:42:55 +0700 Subject: [PATCH 300/315] fix issue display power validator --- src/app/pages/validators/validators.component.html | 2 +- src/app/pages/validators/validators.component.scss | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/pages/validators/validators.component.html b/src/app/pages/validators/validators.component.html index d29af9345..584a56f4b 100644 --- a/src/app/pages/validators/validators.component.html +++ b/src/app/pages/validators/validators.component.html @@ -113,7 +113,7 @@

    Validators

    -
    diff --git a/src/app/pages/validators/validators.component.scss b/src/app/pages/validators/validators.component.scss index fe70cfdbd..ac77d3079 100644 --- a/src/app/pages/validators/validators.component.scss +++ b/src/app/pages/validators/validators.component.scss @@ -264,3 +264,15 @@ form.search-form-validators { width: 30%; } } + +@media (max-width: 1366px) { + tbody tr { + & td { + min-width: 150px; + } + + & td:nth-child(2) { + min-width: 400px; + } + } +} From cd06b86caa7b36503fe9e121d3c58d77f26d849a Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 14:52:12 +0700 Subject: [PATCH 301/315] fix bug --- .../transaction-detail.component.html | 10 +++++----- .../soulbound-feature-tokens.component.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index ebcca4e6c..2b94ee26f 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -13,14 +13,14 @@

    Transaction Details

    -
    +
    -
    Error:
    +
    Error:
    {{ errorMessage }}
    -
    - See More - See Less +
    + See more + See less
    diff --git a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html index 76dfe231d..731fa9929 100644 --- a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html +++ b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html @@ -28,7 +28,7 @@
    Date: Tue, 18 Jul 2023 15:22:42 +0700 Subject: [PATCH 302/315] fix issue display power validator --- src/app/pages/validators/validators.component.html | 6 +++--- src/app/pages/validators/validators.component.scss | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/pages/validators/validators.component.html b/src/app/pages/validators/validators.component.html index 584a56f4b..b43d8682b 100644 --- a/src/app/pages/validators/validators.component.html +++ b/src/app/pages/validators/validators.component.html @@ -113,12 +113,12 @@

    Validators

    -
    - @@ -170,7 +170,7 @@

    Validators

    -
    - + @@ -148,8 +148,9 @@

    CW-20 Tokens

    {{ element.holders | number : global.formatNumberOnlyDecimal }}
    - {{ element.isHolderUp ? '↑' : '↓' }} - {{ element.holderChange || 0 | number : global.formatNumber2Decimal }}% + {{ element.isHolderUp ? '↑' : '↓' + }}{{ element.holderChange || 0 | number : global.formatNumber2Decimal }}%
    From 91206f38f2455b9287452763311cb4b18e1d1697 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 19 Jul 2023 10:54:24 +0700 Subject: [PATCH 308/315] fix bug tooltip --- src/app/core/services/common.service.ts | 6 +++--- src/assets/scss/aura-theme/tooltip.scss | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 2de7aded1..30b6f95f4 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -141,11 +141,11 @@ export class CommonService { copyToolTipAction(ele, string) { const dummy = document.createElement('textarea'); document.body.appendChild(dummy); - dummy.value = string; + dummy.value = JSON.stringify(string); dummy.select(); document.execCommand('copy'); document.body.removeChild(dummy); - if(ele.classList.contains('disabled-hover')) { + if (ele.classList.contains('disabled-hover')) { ele.classList.remove('disabled-hover'); ele.classList.add('show'); setTimeout(function () { @@ -155,7 +155,7 @@ export class CommonService { } } - findUrlNameTag(address) { + findUrlNameTag(address) { let result = ''; const nameTag = this.listNameTag?.find((k) => k.address === address); if (nameTag?.enterpriseUrl?.length > 0) { diff --git a/src/assets/scss/aura-theme/tooltip.scss b/src/assets/scss/aura-theme/tooltip.scss index 5ee79dbe1..bafa5feda 100644 --- a/src/assets/scss/aura-theme/tooltip.scss +++ b/src/assets/scss/aura-theme/tooltip.scss @@ -25,8 +25,18 @@ app-tooltip-customize { cursor: pointer; @media (min-width: 991.98px) { + &:not(.disabled-hover):hover~app-tooltip-customize { + max-width: 900px; + max-height: 900px; + opacity: 1; + + .aura-tooltip { + display: block; + padding: 8px; + } + } + } - &:not(.disabled-hover):hover~app-tooltip-customize, &.show~app-tooltip-customize { max-width: 900px; max-height: 900px; @@ -37,7 +47,6 @@ app-tooltip-customize { padding: 8px; } } - } } } From 60dec20d9afc2000d788481a67c4d663871fcd77 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 19 Jul 2023 11:52:19 +0700 Subject: [PATCH 309/315] fix bug copy --- src/app/core/services/common.service.ts | 18 +++++-------- .../account-detail.component.html | 25 +++++++------------ .../account-detail/account-detail.module.ts | 6 +++-- .../block-detail/block-detail.component.html | 6 +++-- src/app/pages/blocks/blocks.module.ts | 2 ++ .../verify-code-id.component.html | 3 ++- src/app/pages/code-ids/code-ids.module.ts | 2 ++ .../code-contract.component.html | 14 ++++++----- .../contracts-detail.component.html | 3 ++- src/app/pages/contracts/contracts.module.ts | 2 ++ ...oulbound-account-token-list.component.html | 3 ++- .../soulbound-token-contract.component.html | 9 +++---- .../soulbound-token/soulbound-token.module.ts | 2 ++ .../nft-detail/nft-detail.component.html | 12 ++++++--- .../popup-share/popup-share.component.html | 3 ++- src/app/pages/token/token.module.ts | 2 ++ .../transaction-detail.component.html | 3 ++- .../pages/transaction/transaction.module.ts | 2 ++ 18 files changed, 65 insertions(+), 52 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 30b6f95f4..7bd07a2e6 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -138,19 +138,13 @@ export class CommonService { return result; } - copyToolTipAction(ele, string) { - const dummy = document.createElement('textarea'); - document.body.appendChild(dummy); - dummy.value = JSON.stringify(string); - dummy.select(); - document.execCommand('copy'); - document.body.removeChild(dummy); - if (ele.classList.contains('disabled-hover')) { - ele.classList.remove('disabled-hover'); - ele.classList.add('show'); + showToolTip(element) { + if (element.classList.contains('disabled-hover')) { + element.classList.remove('disabled-hover'); + element.classList.add('show'); setTimeout(function () { - ele.classList.remove('show'); - ele.classList.add('disabled-hover'); + element.classList.remove('show'); + element.classList.add('disabled-hover'); }, 800); } } diff --git a/src/app/pages/account/account-detail/account-detail.component.html b/src/app/pages/account/account-detail/account-detail.component.html index af5c725d2..4c899857f 100644 --- a/src/app/pages/account/account-detail/account-detail.component.html +++ b/src/app/pages/account/account-detail/account-detail.component.html @@ -20,19 +20,14 @@ {{ currentAddress | cutStringPipe : 8 : 8 }}
    - - - +
    Coins & Tokens ({{ totalAssets || 0 }})
    -
    +
    {{ data[template.matColumnDef] | stringEllipsis : 11 }}
    - +
    diff --git a/src/app/pages/account/account-detail/account-detail.module.ts b/src/app/pages/account/account-detail/account-detail.module.ts index 0ce9f6407..ebb1a9ffb 100644 --- a/src/app/pages/account/account-detail/account-detail.module.ts +++ b/src/app/pages/account/account-detail/account-detail.module.ts @@ -1,3 +1,4 @@ +import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule, DecimalPipe } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; @@ -9,7 +10,9 @@ import { SimplebarAngularModule } from 'simplebar-angular'; import { CommonDirectiveModule } from 'src/app/core/directives/common-directive.module'; import { APaginatorModule } from 'src/app/shared/components/a-paginator/a-paginator.module'; import { NftCardModule } from 'src/app/shared/components/cards/nft-card/nft-card.module'; +import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; import { SoulboundFeatureTokensModule } from 'src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.module'; +import { TooltipCustomizeModule } from 'src/app/shared/components/tooltip-customize/tooltip-customize.module'; import { MaterialModule } from '../../../app.module'; import { CommonPipeModule } from '../../../core/pipes/common-pipe.module'; import { AccountService } from '../../../core/services/account.service'; @@ -24,8 +27,6 @@ import { AccountDetailComponent } from './account-detail.component'; import { NftListComponent } from './nft-list/nft-list.component'; import { SoulboundTokenComponent } from './soulbound-token/soulbound-token.component'; import { TokenTableComponent } from './token-table/token-table.component'; -import { NameTagModule } from 'src/app/shared/components/name-tag/name-tag.module'; -import { TooltipCustomizeModule } from 'src/app/shared/components/tooltip-customize/tooltip-customize.module'; @NgModule({ declarations: [AccountDetailComponent, TokenTableComponent, NftListComponent, SoulboundTokenComponent], @@ -52,6 +53,7 @@ import { TooltipCustomizeModule } from 'src/app/shared/components/tooltip-custom APaginatorModule, NameTagModule, TooltipCustomizeModule, + ClipboardModule, ], providers: [TransactionService, AccountService, DecimalPipe], }) diff --git a/src/app/pages/blocks/block-detail/block-detail.component.html b/src/app/pages/blocks/block-detail/block-detail.component.html index a0779d43c..6f4d07562 100644 --- a/src/app/pages/blocks/block-detail/block-detail.component.html +++ b/src/app/pages/blocks/block-detail/block-detail.component.html @@ -30,7 +30,8 @@

    + (click)="commonService.showToolTip(tooltip)" + [cdkCopyToClipboard]="blockDetail?.json_data | json"> @@ -45,7 +46,8 @@

    {{ !isRawData ? 'Information' : 'Raw Data' }}

    class="button button--xxs button--sm-mob button-circle ml-2 aura-tooltip-object disabled-hover" *ngIf="isRawData" #tooltip - (click)="commonService.copyToolTipAction(tooltip, blockDetail?.json_data)"> + (click)="commonService.showToolTip(tooltip)" + [cdkCopyToClipboard]="blockDetail?.json_data | json"> diff --git a/src/app/pages/blocks/blocks.module.ts b/src/app/pages/blocks/blocks.module.ts index d4716c4a4..47b65485d 100644 --- a/src/app/pages/blocks/blocks.module.ts +++ b/src/app/pages/blocks/blocks.module.ts @@ -1,3 +1,4 @@ +import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -33,6 +34,7 @@ import { BlocksComponent } from './blocks.component'; PaginatorModule, CommonDirectiveModule, TooltipCustomizeModule, + ClipboardModule, ], providers: [BlockService, MaskPipe], }) diff --git a/src/app/pages/code-ids/code-id-detail/verify-code-id/verify-code-id.component.html b/src/app/pages/code-ids/code-id-detail/verify-code-id/verify-code-id.component.html index 60c794ee7..f9562ec09 100644 --- a/src/app/pages/code-ids/code-id-detail/verify-code-id/verify-code-id.component.html +++ b/src/app/pages/code-ids/code-id-detail/verify-code-id/verify-code-id.component.html @@ -88,7 +88,8 @@ diff --git a/src/app/pages/code-ids/code-ids.module.ts b/src/app/pages/code-ids/code-ids.module.ts index 06359e3b1..29e761a88 100644 --- a/src/app/pages/code-ids/code-ids.module.ts +++ b/src/app/pages/code-ids/code-ids.module.ts @@ -1,3 +1,4 @@ +import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; @@ -36,6 +37,7 @@ import { CodeIdsRoutingModule } from './code-ids-routing.module'; APaginatorModule, NameTagModule, TooltipCustomizeModule, + ClipboardModule, ], providers: [ContractService], }) diff --git a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html index afa7c80ff..9f601d405 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html +++ b/src/app/pages/contracts/contracts-detail/contracts-contents/contract/contract-code/code-contract.component.html @@ -39,9 +39,8 @@ @@ -118,7 +117,8 @@ @@ -176,7 +176,8 @@ @@ -234,7 +235,8 @@ diff --git a/src/app/pages/contracts/contracts-detail/contracts-detail.component.html b/src/app/pages/contracts/contracts-detail/contracts-detail.component.html index 980b691f7..5e69421ab 100644 --- a/src/app/pages/contracts/contracts-detail/contracts-detail.component.html +++ b/src/app/pages/contracts/contracts-detail/contracts-detail.component.html @@ -9,7 +9,8 @@

    Contract

    diff --git a/src/app/pages/contracts/contracts.module.ts b/src/app/pages/contracts/contracts.module.ts index 3e1415d44..7fb22947f 100644 --- a/src/app/pages/contracts/contracts.module.ts +++ b/src/app/pages/contracts/contracts.module.ts @@ -1,3 +1,4 @@ +import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -72,6 +73,7 @@ import { ContractsVerifyComponent } from './contracts-verify/contracts-verify.co APaginatorModule, NameTagModule, TooltipCustomizeModule, + ClipboardModule, ], providers: [ContractService], exports: [ContractVerifyStepsComponent], diff --git a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.html b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.html index 9f7c473bc..9f4430938 100644 --- a/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.html +++ b/src/app/pages/soulbound-token/soulbound-account-token-list/soulbound-account-token-list.component.html @@ -22,7 +22,8 @@ diff --git a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html index 328607ab0..337a1bb06 100644 --- a/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html +++ b/src/app/pages/soulbound-token/soulbound-token-contract/soulbound-token-contract.component.html @@ -6,8 +6,7 @@

    Account Bound Token

    Contract
    -
    +
    {{ commonService.setNameTag(contractAddress) | stringEllipsis : 8 }} @@ -25,9 +24,9 @@

    Account Bound Token

    A total of {{ pageData?.length | number }} record{{ pageData?.length > 1 ? 's' : '' }} found
    -
    +
    -
    +
    Account Bound Token
    -
    +
    Details diff --git a/src/app/pages/token/token.module.ts b/src/app/pages/token/token.module.ts index 8c58cd9b9..7a7ce5fc4 100644 --- a/src/app/pages/token/token.module.ts +++ b/src/app/pages/token/token.module.ts @@ -1,3 +1,4 @@ +import { ClipboardModule } from '@angular/cdk/clipboard'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; @@ -81,6 +82,7 @@ import { TokenRoutingModule } from './token-routing.module'; APaginatorModule, NameTagModule, TooltipCustomizeModule, + ClipboardModule, ], providers: [TokenService, AccountService], }) diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index 2b94ee26f..cf9e945bd 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -32,7 +32,8 @@

    class="button button--xxs button--sm-mob button-circle ml-2 aura-tooltip-object disabled-hover" *ngIf="isRawData" #tooltip - (click)="commonService.copyToolTipAction(tooltip, transaction.tx)"> + [cdkCopyToClipboard]="transaction.tx | json" + (click)="commonService.showToolTip(tooltip)"> diff --git a/src/app/pages/transaction/transaction.module.ts b/src/app/pages/transaction/transaction.module.ts index 3120ec437..09c08e222 100644 --- a/src/app/pages/transaction/transaction.module.ts +++ b/src/app/pages/transaction/transaction.module.ts @@ -20,6 +20,7 @@ import { MessagesItemComponent } from './transaction-detail/transaction-messages import { TransactionMessagesComponent } from './transaction-detail/transaction-messages/transaction-messages.component'; import { TransactionRoutingModule } from './transaction-routing.module'; import { TransactionComponent } from './transaction.component'; +import {ClipboardModule} from '@angular/cdk/clipboard'; @NgModule({ declarations: [TransactionComponent, TransactionDetailComponent, TransactionMessagesComponent, MessagesItemComponent], @@ -40,6 +41,7 @@ import { TransactionComponent } from './transaction.component'; CommonDirectiveModule, NameTagModule, TooltipCustomizeModule, + ClipboardModule ], providers: [TransactionService, MappingErrorService, ProposalService, MaskPipe], }) From 900277a5c32cd3eb117d61cfc8f85119d21d619e Mon Sep 17 00:00:00 2001 From: nhphuc <101378686+nhphuc2411@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:35:48 +0700 Subject: [PATCH 310/315] Merge pull request #2112 from aura-nw/feature/add-authen-email [TamTM6] fix bug search contract list (cherry picked from commit cc1b9f935615bd85ae834610baf9f18767b2655a) --- src/app/core/services/common.service.ts | 2 +- src/app/core/services/contract.service.ts | 15 ++++++++++----- .../code-id-contracts-tab.component.html | 2 +- .../transaction-detail.component.html | 12 ++++++------ .../transaction-detail.component.scss | 8 +------- .../transaction-detail.component.ts | 2 +- 6 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 7bd07a2e6..9302ba488 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -124,7 +124,7 @@ export class CommonService { findNameTag(keySearch, listNameTag = []) { this.listNameTag = this.listNameTag?.length > 0 ? this.listNameTag : listNameTag; if (this.listNameTag?.length > 0) { - const result = this.listNameTag?.find((k) => k.name_tag.trim() === keySearch.trim())?.address; + const result = this.listNameTag?.find((k) => k.name_tag?.trim() === keySearch?.trim())?.address || ''; return result; } } diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 454f8884d..27401df9a 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -48,11 +48,16 @@ export class ContractService extends CommonService { }) { let updateQuery = ''; const isFilterCW4973 = contractType?.includes('CW4973'); - let typeQuery = isFilterCW4973 - ? '_or: [{code: {type: {_in: $type}}}, {name: {_eq: "crates.io:cw4973"}}],' - : contractType?.includes('CW721') || contractType?.includes('CW20') - ? 'code: {type: {_in: $type}}, name: {_neq: "crates.io:cw4973"}' - : 'code: {_or: [{type: {_in: $type}}, {_and: {type: {_is_null: true}}}]}'; + let typeQuery = 'code: {or: [{type: {in: $type}}, {and: {type: {is_null: true}}}]}'; + if (isFilterCW4973) { + typeQuery = contractType?.includes('') + ? '_or: [{code: {or: [{type: {in: $type}}, {and: {type: {is_null: true}}}]}}, {name: {_eq: "crates.io:cw4973"}}],' + : '_or: [{code: {type: {in: $type}}}, {name: {eq: "crates.io:cw4973"}}],'; + } else if (contractType?.includes('CW721') || contractType?.includes('CW20')) { + typeQuery = contractType?.includes('') + ? 'code: {or: [{type: {in: $type}}, {and: {type: {is_null: true}}}]}, name: {_neq: "crates.io:cw4973"}' + : 'code: {type: {in: $type}}, name: {neq: "crates.io:cw4973"}'; + } const addressNameTag = this.findNameTag(keyword, this.global.listNameTag); if (addressNameTag?.length > 0) { diff --git a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html index b0fa594c2..5db0ae977 100644 --- a/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html +++ b/src/app/pages/code-ids/code-id-detail/code-id-contracts-tab/code-id-contracts-tab.component.html @@ -1,7 +1,7 @@
    A total of {{ pageData.length }} record{{ pageData.length > 1 ? 's' : '' }} found
    -
    +

    Decimals:
    -
    {{ tokenDetail?.decimal }}
    +
    {{ tokenDetail?.decimals }}
    - -
    +
    +
    +
    +
    diff --git a/src/app/pages/validators/validators.component.scss b/src/app/pages/validators/validators.component.scss index ac77d3079..99da44d86 100644 --- a/src/app/pages/validators/validators.component.scss +++ b/src/app/pages/validators/validators.component.scss @@ -268,11 +268,15 @@ form.search-form-validators { @media (max-width: 1366px) { tbody tr { & td { - min-width: 150px; + min-width: 130px; } & td:nth-child(2) { min-width: 400px; } + + & td:nth-child(1) { + min-width: 200px; + } } } From cf1d25f244155df51872cb7195b6060773a945a9 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 15:58:55 +0700 Subject: [PATCH 303/315] fix hide tooltip mobile --- src/assets/scss/aura-theme/tooltip.scss | 26 +++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/assets/scss/aura-theme/tooltip.scss b/src/assets/scss/aura-theme/tooltip.scss index 89076efa8..5ee79dbe1 100644 --- a/src/assets/scss/aura-theme/tooltip.scss +++ b/src/assets/scss/aura-theme/tooltip.scss @@ -9,28 +9,38 @@ app-tooltip-customize { max-height: 0; opacity: 0; transition: opacity .35s ease-in-out; + &.tooltip--below { bottom: 0; top: 100%; transform: translate(-50%, 16px); } } + .aura-tooltip-contain { display: inline-block; position: relative; + .aura-tooltip-object { cursor: pointer; - &:not(.disabled-hover):hover ~ app-tooltip-customize, &.show ~ app-tooltip-customize { - max-width: 900px; - max-height: 900px; - opacity: 1; - .aura-tooltip { - display: block; - padding: 8px; + + @media (min-width: 991.98px) { + + &:not(.disabled-hover):hover~app-tooltip-customize, + &.show~app-tooltip-customize { + max-width: 900px; + max-height: 900px; + opacity: 1; + + .aura-tooltip { + display: block; + padding: 8px; + } } } } } + .spacer-tooltip { padding-top: 50px; margin-top: -40px; @@ -47,4 +57,4 @@ app-tooltip-customize.tooltip--right { right: unset; left: 0; transform: translate(0, -16px); -} +} \ No newline at end of file From 969d19369c7973ae52eed35a733fc8a2ea7b5189 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 16:24:30 +0700 Subject: [PATCH 304/315] fix font size --- .../top-statistic-overview.component.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html index 08e573f4d..f0dcf1593 100644 --- a/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html +++ b/src/app/pages/statistics/top-statistics/top-statistic-overview/top-statistic-overview.component.html @@ -27,10 +27,10 @@
    Total {{ denom }}
    -
    +
    -
    +
    {{ (transactionsData.top_aura_senders[0]?.result.total_sent_amount?.amount | convertUauraToAura : coinDecimals @@ -47,10 +47,10 @@
    Total {{ denom }}
    -
    +
    -
    +
    {{ (transactionsData.top_aura_receivers[0]?.result?.total_received_amount?.amount | convertUauraToAura : coinDecimals @@ -67,10 +67,10 @@
    Total Txn
    -
    +
    -
    +
    {{ (transactionsData.top_txn_count_sent[0]?.result?.total_sent_tx?.amount | number) ?? 0 }}
    @@ -83,10 +83,10 @@
    Total Txn
    -
    +
    -
    +
    {{ (transactionsData.top_txn_count_received[0]?.result?.total_received_tx?.amount | number) ?? 0 }}
    From efc01711a6a7da0839c8a2797ebc7213945508b1 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Tue, 18 Jul 2023 16:59:34 +0700 Subject: [PATCH 305/315] fix bug button manage ABT --- .../soulbound-feature-tokens.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html index 731fa9929..7d33ab7cf 100644 --- a/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html +++ b/src/app/shared/components/soulbound-feature-tokens/soulbound-feature-tokens.component.html @@ -28,7 +28,7 @@
    Date: Wed, 19 Jul 2023 09:47:07 +0700 Subject: [PATCH 306/315] fix bug --- src/app/core/services/common.service.ts | 2 +- .../layouts/horizontaltopbar/horizontaltopbar.component.scss | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/core/services/common.service.ts b/src/app/core/services/common.service.ts index 621918802..2de7aded1 100644 --- a/src/app/core/services/common.service.ts +++ b/src/app/core/services/common.service.ts @@ -124,7 +124,7 @@ export class CommonService { findNameTag(keySearch, listNameTag = []) { this.listNameTag = this.listNameTag?.length > 0 ? this.listNameTag : listNameTag; if (this.listNameTag?.length > 0) { - const result = this.listNameTag?.find((k) => k.name_tag === keySearch)?.address; + const result = this.listNameTag?.find((k) => k.name_tag.trim() === keySearch.trim())?.address; return result; } } diff --git a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.scss b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.scss index dd6ec9e50..8d53d2835 100644 --- a/src/app/layouts/horizontaltopbar/horizontaltopbar.component.scss +++ b/src/app/layouts/horizontaltopbar/horizontaltopbar.component.scss @@ -10,6 +10,7 @@ align-items: center; justify-content: center; font-weight: 600; + white-space: nowrap; @media (min-width: 414.99px) { padding: 0 var(--spacer-2); } From 9e2414908c0bca9fdb01a93703268eabf7fa7588 Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Wed, 19 Jul 2023 10:03:19 +0700 Subject: [PATCH 307/315] fix bug --- .../token/token-list/token-cw20/token-cw20.component.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html index 51ccfa604..e21783d65 100644 --- a/src/app/pages/token/token-list/token-cw20/token-cw20.component.html +++ b/src/app/pages/token/token-list/token-cw20/token-cw20.component.html @@ -139,7 +139,7 @@

    CW-20 Tokens

    ${{ element.onChainMarketCap | number : global.formatNumber2Decimal }}
    diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index cf9e945bd..044f88ce5 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -13,12 +13,12 @@

    Transaction Details

    -
    - -
    Error:
    - {{ errorMessage }} -
    -
    +
    +
    +
    Error:
    + {{ errorMessage }} +
    +
    See more See less
    diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss b/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss index 78262b4dd..e726e1e58 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss @@ -18,13 +18,7 @@ word-break: break-word; font-size: 16px; font-weight: 400; - .ellipsis-text { - display: -webkit-box; - -webkit-line-clamp: 4; - -webkit-box-orient: vertical; - overflow: hidden; - text-overflow: ellipsis; - } + margin: 0px; } ::ng-deep app-transaction-messages .card-info:not(:last-child) { diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index 71b260047..027f045ee 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -96,7 +96,7 @@ export class TransactionDetailComponent implements OnInit { // get height error box setTimeout(() => { this.heightBoxError = document.getElementById('contentError')?.offsetHeight; - }, 500); + }, 1000); } this.getListValidator(); From aaaa596e9786c1d02f3249dc4307c526f7c0c7b5 Mon Sep 17 00:00:00 2001 From: Tam <99626599+mtamkg@users.noreply.github.com> Date: Thu, 20 Jul 2023 08:33:33 +0700 Subject: [PATCH 311/315] Merge pull request #2114 from aura-nw/fixing/fix_contract_list fix: fix syntax contract list query (cherry picked from commit 4966c6498cb3573e738f6185aade4853f1a39ac0) --- src/app/core/services/contract.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/core/services/contract.service.ts b/src/app/core/services/contract.service.ts index 27401df9a..e6b7db006 100644 --- a/src/app/core/services/contract.service.ts +++ b/src/app/core/services/contract.service.ts @@ -48,15 +48,15 @@ export class ContractService extends CommonService { }) { let updateQuery = ''; const isFilterCW4973 = contractType?.includes('CW4973'); - let typeQuery = 'code: {or: [{type: {in: $type}}, {and: {type: {is_null: true}}}]}'; + let typeQuery = 'code: {_or: [{type: {_in: $type}}, {_and: {type: {_is_null: true}}}]}'; if (isFilterCW4973) { typeQuery = contractType?.includes('') - ? '_or: [{code: {or: [{type: {in: $type}}, {and: {type: {is_null: true}}}]}}, {name: {_eq: "crates.io:cw4973"}}],' - : '_or: [{code: {type: {in: $type}}}, {name: {eq: "crates.io:cw4973"}}],'; + ? '_or: [{code: {_or: [{type: {_in: $type}}, {_and: {type: {_is_null: true}}}]}}, {name: {_eq: "crates.io:cw4973"}}],' + : '_or: [{code: {type: {_in: $type}}}, {name: {_eq: "crates.io:cw4973"}}],'; } else if (contractType?.includes('CW721') || contractType?.includes('CW20')) { typeQuery = contractType?.includes('') - ? 'code: {or: [{type: {in: $type}}, {and: {type: {is_null: true}}}]}, name: {_neq: "crates.io:cw4973"}' - : 'code: {type: {in: $type}}, name: {neq: "crates.io:cw4973"}'; + ? 'code: {_or: [{type: {_in: $type}}, {_and: {type: {_is_null: true}}}]}, name: {_neq: "crates.io:cw4973"}' + : 'code: {type: {_in: $type}}, name: {_neq: "crates.io:cw4973"}'; } const addressNameTag = this.findNameTag(keyword, this.global.listNameTag); From 0c149803b6eb32e3fb978b95a9cce92f0dcadf8f Mon Sep 17 00:00:00 2001 From: nhphuc2411 Date: Thu, 20 Jul 2023 09:22:26 +0700 Subject: [PATCH 312/315] Merge pull request #2114 from aura-nw/fixing/fix_contract_list fix: fix syntax contract list query (cherry picked from commit 4966c6498cb3573e738f6185aade4853f1a39ac0) --- .../transaction-messages/transaction-messages.component.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss index 649309eab..f550709a6 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-messages/transaction-messages.component.scss @@ -38,7 +38,7 @@ } .divider-lighter { - background-color: var(--aura-gray-5); + background-color: var(--aura-gray-6); max-height: 8px; } From c0c91902f9738bce6703864d65628ebc38079e49 Mon Sep 17 00:00:00 2001 From: nhphuc <101378686+nhphuc2411@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:22:20 +0700 Subject: [PATCH 313/315] Merge pull request #2117 from aura-nw/feature/fix-see-more [TamTM6] update see more (cherry picked from commit 47818eddd167783a0f31586ac3aac5ae5644b852) --- .../transaction-detail.component.html | 6 +++--- .../transaction-detail.component.ts | 12 +++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index 044f88ce5..02306605d 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -13,12 +13,12 @@

    Transaction Details

    -
    +
    Error:
    - {{ errorMessage }} + {{ errorMessage }}
    -
    +
    See more See less
    diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index 027f045ee..2b6a2fe61 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -44,7 +44,7 @@ export class TransactionDetailComponent implements OnInit { isReload = false; listValidator = []; seeLess = false; - heightBoxError = 0; + isDisplayMore = false; constructor( private route: ActivatedRoute, @@ -95,8 +95,14 @@ export class TransactionDetailComponent implements OnInit { // get height error box setTimeout(() => { - this.heightBoxError = document.getElementById('contentError')?.offsetHeight; - }, 1000); + const lengthChar = document.getElementById('contentError')?.innerText?.length; + const widthContent = document.getElementById('contentError')?.offsetWidth; + + // cal width text/content + if (lengthChar * 6.8 > widthContent * 3) { + this.isDisplayMore = true; + } + }, 500); } this.getListValidator(); From cbd43dd4203fbc6e8b7cab3366ed77b518fe90f8 Mon Sep 17 00:00:00 2001 From: nhphuc <101378686+nhphuc2411@users.noreply.github.com> Date: Thu, 20 Jul 2023 11:22:20 +0700 Subject: [PATCH 314/315] [TamTM6] update see more --- .../transaction-detail.component.html | 12 ++++++------ .../transaction-detail.component.ts | 10 ++++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html index cf9e945bd..02306605d 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.html +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.html @@ -13,12 +13,12 @@

    Transaction Details

    -
    - -
    Error:
    - {{ errorMessage }} -
    -
    +
    +
    +
    Error:
    + {{ errorMessage }} +
    +
    See more See less
    diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts index 71b260047..2b6a2fe61 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.ts @@ -44,7 +44,7 @@ export class TransactionDetailComponent implements OnInit { isReload = false; listValidator = []; seeLess = false; - heightBoxError = 0; + isDisplayMore = false; constructor( private route: ActivatedRoute, @@ -95,7 +95,13 @@ export class TransactionDetailComponent implements OnInit { // get height error box setTimeout(() => { - this.heightBoxError = document.getElementById('contentError')?.offsetHeight; + const lengthChar = document.getElementById('contentError')?.innerText?.length; + const widthContent = document.getElementById('contentError')?.offsetWidth; + + // cal width text/content + if (lengthChar * 6.8 > widthContent * 3) { + this.isDisplayMore = true; + } }, 500); } From 3768c17d19e87329f60576b375eecaa8da882332 Mon Sep 17 00:00:00 2001 From: mtam Date: Thu, 20 Jul 2023 13:40:35 +0700 Subject: [PATCH 315/315] [TamTM6] update see more --- .../transaction-detail/transaction-detail.component.scss | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss b/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss index 78262b4dd..183c895eb 100644 --- a/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss +++ b/src/app/pages/transaction/transaction-detail/transaction-detail.component.scss @@ -18,13 +18,7 @@ word-break: break-word; font-size: 16px; font-weight: 400; - .ellipsis-text { - display: -webkit-box; - -webkit-line-clamp: 4; - -webkit-box-orient: vertical; - overflow: hidden; - text-overflow: ellipsis; - } + margin: 0; } ::ng-deep app-transaction-messages .card-info:not(:last-child) {