From b9ae59f30987b3c9f0d8b57f2f5be925c5fc9a48 Mon Sep 17 00:00:00 2001 From: mtam Date: Fri, 17 Mar 2023 10:30:59 +0700 Subject: [PATCH 1/6] [TamTM6] update amount validator (cherry picked from commit 0cc1879bc4b6d00f646c23dc402933b7d7252251) --- src/app/core/constants/messages.constant.ts | 3 +++ .../soulbound-token-create-popup.component.html | 2 +- .../soulbound-token-create-popup.component.scss | 6 ++++++ .../popup-delegate/popup-delegate.component.html | 6 +++++- .../user-wallet-info.component.html | 8 +++++++- src/app/pages/validators/validators.component.html | 14 +++++++++++--- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/app/core/constants/messages.constant.ts b/src/app/core/constants/messages.constant.ts index 07f4a034a..a74d167dd 100644 --- a/src/app/core/constants/messages.constant.ts +++ b/src/app/core/constants/messages.constant.ts @@ -2,6 +2,7 @@ export const MESSAGES_CODE = { SUCCESSFUL: { Code: 'SUCCESSFUL', Message: 'Successfully!' }, }; +//v0.45.11 export const MESSAGES_CODE_STAKING = { 2: { Code: 2, Message: 'empty validator address' }, 3: { Code: 3, Message: 'validator does not exist' }, @@ -50,6 +51,7 @@ export const MESSAGES_CODE_STAKING = { 39: { Code: 39, Message: 'empty validator public key' }, }; +//v0.45.11 export const MESSAGES_CODE_PROPOSAL = { 2: { Code: 2, Message: 'unknown proposal' }, 3: { Code: 3, Message: 'inactive proposal' }, @@ -64,6 +66,7 @@ export const MESSAGES_CODE_PROPOSAL = { 9: { Code: 9, Message: 'no handler exists for proposal type' }, }; +//v0.45.11 export const MESSAGES_CODE_CONTRACT = { 2: { Code: 2, Message: 'create wasm contract failed' }, 3: { Code: 3, Message: 'contract account already exists' }, diff --git a/src/app/pages/soulbound-token/soulbound-token-create-popup/soulbound-token-create-popup.component.html b/src/app/pages/soulbound-token/soulbound-token-create-popup/soulbound-token-create-popup.component.html index 2856f1282..bfb3dffcf 100644 --- a/src/app/pages/soulbound-token/soulbound-token-create-popup/soulbound-token-create-popup.component.html +++ b/src/app/pages/soulbound-token/soulbound-token-create-popup/soulbound-token-create-popup.component.html @@ -1,4 +1,4 @@ -
+
Create New
Pending Reward
- {{ data?.validatorDetail?.pending_reward || 0 | mask: 'separator.6' }} + {{ + data.validatorDetail?.pending_reward < 0.000001 + ? '0' + : data.validatorDetail?.pending_reward | mask : 'separator.6' + }} {{ denom }}
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 449143f2a..a7ac4d0ea 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 @@ -169,7 +169,13 @@
*ngIf="!template?.desktopOnly"> {{ template['headerCellDef'] }}
- {{ validator[template.matColumnDef] | mask : 'separator.6' }} + + {{ + validator[template.matColumnDef] < 0.000001 + ? '0' + : validator[template.matColumnDef] | mask : 'separator.6' + }} + {{ denom }} diff --git a/src/app/pages/validators/validators.component.html b/src/app/pages/validators/validators.component.html index f5f90ebb4..5ae1689ef 100644 --- a/src/app/pages/validators/validators.component.html +++ b/src/app/pages/validators/validators.component.html @@ -353,7 +353,7 @@
- +
- +
@@ -203,10 +209,10 @@

Yes

- {{ proposalDetail.yesPercent | number: global.formatNumber2Decimal }}% + {{ proposalDetail.yesPercent | number : global.formatNumber2Decimal }}%
- {{ proposalDetail.pro_votes_yes | mask: 'separator.6' }} + {{ proposalDetail.pro_votes_yes | mask : 'separator.6' }}
@@ -217,10 +223,10 @@

No

- {{ proposalDetail.noPercent | number: global.formatNumber2Decimal }}% + {{ proposalDetail.noPercent | number : global.formatNumber2Decimal }}%
- {{ proposalDetail.pro_votes_no | mask: 'separator.6' }} + {{ proposalDetail.pro_votes_no | mask : 'separator.6' }}
@@ -231,10 +237,10 @@

NoWithVeto
- {{ proposalDetail.noWithVetoPercent | number: global.formatNumber2Decimal }}% + {{ proposalDetail.noWithVetoPercent | number : global.formatNumber2Decimal }}%
- {{ proposalDetail.pro_votes_no_with_veto | mask: 'separator.6' }} + {{ proposalDetail.pro_votes_no_with_veto | mask : 'separator.6' }}
@@ -245,10 +251,10 @@

Abstain
- {{ proposalDetail.abstainPercent | number: global.formatNumber2Decimal }}% + {{ proposalDetail.abstainPercent | number : global.formatNumber2Decimal }}%
- {{ proposalDetail.pro_votes_abstain | mask: 'separator.6' }} + {{ proposalDetail.pro_votes_abstain | mask : 'separator.6' }}
@@ -259,11 +265,11 @@

Yes - {{ this.proposalDetail.yesPercent | number: global.formatNumber2Decimal }}% + {{ this.proposalDetail.yesPercent | number : global.formatNumber2Decimal }}%

- {{ this.proposalDetail.pro_votes_yes || 0 | mask: 'separator.6' }} + {{ this.proposalDetail.pro_votes_yes || 0 | mask : 'separator.6' }} {{ denom }}

@@ -271,11 +277,11 @@

No - {{ this.proposalDetail.noPercent | number: global.formatNumber2Decimal }}% + {{ this.proposalDetail.noPercent | number : global.formatNumber2Decimal }}%

- {{ this.proposalDetail.pro_votes_no || 0 | mask: 'separator.6' }} + {{ this.proposalDetail.pro_votes_no || 0 | mask : 'separator.6' }} {{ denom }}

@@ -283,11 +289,11 @@

NoWithVeto - {{ this.proposalDetail.noWithVetoPercent | number: global.formatNumber2Decimal }}% + {{ this.proposalDetail.noWithVetoPercent | number : global.formatNumber2Decimal }}%

- {{ this.proposalDetail.pro_votes_no_with_veto || 0 | mask: 'separator.6' }} + {{ this.proposalDetail.pro_votes_no_with_veto || 0 | mask : 'separator.6' }} {{ denom }}

@@ -295,11 +301,11 @@

Abstain - {{ this.proposalDetail.abstainPercent | number: global.formatNumber2Decimal }}% + {{ this.proposalDetail.abstainPercent | number : global.formatNumber2Decimal }}%

- {{ this.proposalDetail.pro_votes_abstain || 0 | mask: 'separator.6' }} + {{ this.proposalDetail.pro_votes_abstain || 0 | mask : 'separator.6' }} {{ denom }}

diff --git a/src/app/pages/proposal/proposal.component.html b/src/app/pages/proposal/proposal.component.html index 0f0eb08e5..b0d0f076d 100644 --- a/src/app/pages/proposal/proposal.component.html +++ b/src/app/pages/proposal/proposal.component.html @@ -33,19 +33,33 @@
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' }}
+
+ - +
@@ -185,19 +199,37 @@

Voting Start
-
- {{ lastedItem.voting_start_time | customDate : 'yyyy-MM-dd' }} +
+ {{ + lastedItem.voting_start_time | customDate : 'yyyy-MM-dd' + }}
- {{ lastedItem.voting_start_time | customDate : 'HH:mm:ss' }} + {{ + 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' }}
+
+ - +
@@ -328,11 +360,16 @@

Proposals

Voting Start -
+
{{ element.voting_start_time | customDate : 'yyyy-MM-dd' }}
{{ element.voting_start_time | customDate : 'HH:mm:ss' }}
+
+ - +
@@ -403,22 +440,24 @@

Proposals

label: 'Voting Start', class: 'card__date text--gray-1 body-01', info: - '' + - (data.voting_start_time | customDate : 'yyyy-MM-dd') + - '' + - '' + - (data.voting_start_time | customDate : 'HH:mm:ss') + - '' + data.status !== 'PROPOSAL_STATUS_DEPOSIT_PERIOD' + ? '' + + (data.voting_start_time | customDate : 'yyyy-MM-dd') + + '' + + '' + + (data.voting_start_time | customDate : 'HH:mm:ss') + + '' + : '-' }, { label: 'Submit Time', class: 'card__date text--gray-1 body-01', info: '' + - (data.voting_end_time | customDate : 'yyyy-MM-dd') + + (data.submit_time | customDate : 'yyyy-MM-dd') + '' + '' + - (data.voting_end_time | customDate : 'HH:mm:ss') + + (data.submit_time | customDate : 'HH:mm:ss') + '' } ]"> From 2cf6e0092e076c3ef0b4ce05179129c7d16a9432 Mon Sep 17 00:00:00 2001 From: letrieuthien Date: Sat, 18 Mar 2023 11:52:05 +0700 Subject: [PATCH 3/6] fix bug dashboard's chart --- .../pages/dashboard/dashboard.component.html | 3 +- .../pages/dashboard/dashboard.component.scss | 40 +++++++++---------- .../pages/dashboard/dashboard.component.ts | 22 +++++++++- 3 files changed, 42 insertions(+), 23 deletions(-) diff --git a/src/app/pages/dashboard/dashboard.component.html b/src/app/pages/dashboard/dashboard.component.html index 585cbe91a..3408ceb60 100644 --- a/src/app/pages/dashboard/dashboard.component.html +++ b/src/app/pages/dashboard/dashboard.component.html @@ -116,8 +116,9 @@
-
+
+
diff --git a/src/app/pages/dashboard/dashboard.component.scss b/src/app/pages/dashboard/dashboard.component.scss index 83365aa82..2ed4e4fd6 100644 --- a/src/app/pages/dashboard/dashboard.component.scss +++ b/src/app/pages/dashboard/dashboard.component.scss @@ -18,7 +18,8 @@ } @media (max-width: 992px) { - .aura-table.blocks, .aura-table.transaction { + .aura-table.blocks, + .aura-table.transaction { th { min-width: 140px; &:last-child { @@ -72,20 +73,15 @@ background-color: var(--aura-gray-9); padding: 8px; } - .tv-lightweight-charts table tr:last-child { - //border-top: 1.5px solid #FFA741; - position: relative; - &::after { - content: ''; - position: absolute; - left: 0; - right: 0; - top: 0; - width: 100%; - height: 1.5px; - z-index: 2; - background: linear-gradient(113.1deg, #5EE6D0 13.45%, #BFC6FF 50.33%, #FFBA69 85.05%); - } + .line-chart { + position: absolute; + bottom: 24px; + left: 0; + right: 0; + z-index: 10; + height: 1.5px; + background: linear-gradient(113.1deg, #5ee6d0 13.45%, #bfc6ff 50.33%, #ffba69 85.05%); + width: 100%; } } .button-switch-stage { @@ -212,18 +208,22 @@ ul { bottom: 0; } &:before { - background: url("../../../assets/icons/icons-svg/basic/github-2.svg") no-repeat center; + background: url('../../../assets/icons/icons-svg/basic/github-2.svg') no-repeat center; background-size: contain; opacity: 1; } &:after { - background: url("../../../assets/icons/icons-svg/white/github-2.svg") no-repeat center; + background: url('../../../assets/icons/icons-svg/white/github-2.svg') no-repeat center; background-size: contain; opacity: 0; } &:hover { - &:before { opacity: 0; } - &:after { opacity: 1; } + &:before { + opacity: 0; + } + &:after { + opacity: 1; + } } } i.icon-info { @@ -252,7 +252,7 @@ img.icon-brand { font-weight: 400; font-size: 14px; line-height: 18px; - border: 1px solid #494C58; + border: 1px solid #494c58; border-radius: 8px; max-width: 100%; text-overflow: ellipsis; diff --git a/src/app/pages/dashboard/dashboard.component.ts b/src/app/pages/dashboard/dashboard.component.ts index 8ae421929..16088b6a8 100644 --- a/src/app/pages/dashboard/dashboard.component.ts +++ b/src/app/pages/dashboard/dashboard.component.ts @@ -12,8 +12,9 @@ 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 { WalletService } from 'src/app/core/services/wallet.service'; import { getInfo } from 'src/app/core/utils/common/info-common'; -import { RangeType, TableTemplate } from '../../../app/core/models/common.model'; +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 { TransactionService } from '../../../app/core/services/transaction.service'; @@ -85,6 +86,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { originalData = []; originalDataArr = []; + cacheData = []; logicalRangeChange$ = new Subject<{ from: number; to: number }>(); endData = false; @@ -101,6 +103,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { private proposalService: ProposalService, private maskService: MaskPipe, private token: TokenService, + private walletService: WalletService, ) {} ngOnInit(): void { @@ -115,6 +118,16 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { this.getCoinInfo(this.chartRange); this.currDate = moment(new Date()).format('DDMMYYYY_HHMMSS'); this.getVotingPeriod(); + // re-draw chart when connect coin98 app in mobile + this.walletService.wallet$.subscribe((wallet) => { + if (this.originalData.length === 0) { + this.originalData = this.cacheData; + this.chart.remove(); + this.chart = createChart(document.getElementById('chart'), DASHBOARD_CHART_OPTIONS); + this.areaSeries = this.chart.addAreaSeries(DASHBOARD_AREA_SERIES_CHART_OPTIONS); + this.subscribeVisibleLogicalRangeChange(); + } + }); } // config chart @@ -122,7 +135,6 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { this.chart = createChart(document.getElementById('chart'), DASHBOARD_CHART_OPTIONS); this.areaSeries = this.chart.addAreaSeries(DASHBOARD_AREA_SERIES_CHART_OPTIONS); this.initTooltip(); - this.subscribeVisibleLogicalRangeChange(); } @@ -155,6 +167,9 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { this.originalData = [...res?.data, ...this.originalData]; this.originalDataArr = [...chartData, ...this.originalDataArr]; + if (this.originalData.length > 0) { + this.cacheData = this.originalData; + } this.areaSeries.setData(this.originalDataArr); } else { this.endData = true; @@ -308,6 +323,9 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy { const { dataX, dataY } = this.parseDataFromApi(res.data); this.originalData = [...this.originalData, ...res?.data]; + if (this.originalData.length > 0) { + this.cacheData = this.originalData; + } this.drawChartFirstTime(dataX, dataY); this.chartEvent(); } From ffa5e4dd0ac982d634a85cdca0f2d88e1b0d8108 Mon Sep 17 00:00:00 2001 From: mtam Date: Sat, 18 Mar 2023 16:07:16 +0700 Subject: [PATCH 4/6] [TamTM6] fix simulate mobile --- src/app/core/utils/coin98-client.ts | 19 +++++++++++++++++++ .../core/utils/signing/transaction-manager.ts | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/app/core/utils/coin98-client.ts b/src/app/core/utils/coin98-client.ts index 9a4a31c0d..1497acbb1 100644 --- a/src/app/core/utils/coin98-client.ts +++ b/src/app/core/utils/coin98-client.ts @@ -1,7 +1,9 @@ import { Client } from '@coin98-com/connect-sdk'; import { requestParameter } from '@coin98-com/connect-sdk/dist/types/client'; import { StdSignDoc } from '@cosmjs/amino'; +import { calculateFee } from '@cosmjs/stargate'; import { ChainInfo } from '@keplr-wallet/types'; +import { getFee } from './signing/fee'; export type ConnectResponse = { result: any; @@ -165,4 +167,21 @@ export class Coin98Client { ], }); } + + getGasEstimateMobile(network, messageType, validatorsCount) { + const gasPrice = network.gasPriceStep.average.toString() + network.currencies[0].coinMinimalDenom; + const gasEstimate = validatorsCount ? getFee(messageType, validatorsCount) : getFee(messageType); + const calGasPrice = calculateFee(Math.round(+gasEstimate), gasPrice); + let result = { + amount: [ + { + denom: network.currencies[0].coinMinimalDenom, + amount: (calGasPrice?.amount[0]?.amount || network.gasPriceStep.average)?.toString(), + }, + ], + gas: validatorsCount ? getFee(messageType, validatorsCount) : getFee(messageType), + }; + + return result; + } } diff --git a/src/app/core/utils/signing/transaction-manager.ts b/src/app/core/utils/signing/transaction-manager.ts index e82f6b51e..dfbfbca5b 100644 --- a/src/app/core/utils/signing/transaction-manager.ts +++ b/src/app/core/utils/signing/transaction-manager.ts @@ -3,6 +3,7 @@ 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'; @@ -24,15 +25,17 @@ export async function createSignBroadcast( } else { // success const messagesSend = messageCreators[messageType](senderAddress, message, network); - const fee: StdFee = await getNetworkFee(network, senderAddress, messagesSend, ''); + let fee; let client; if (coin98Client) { client = coin98Client; + fee = client.getGasEstimateMobile(network, messageType, validatorsCount); } else { const signer = await getSigner(signingType, chainId); client = await SigningStargateClient.connectWithSigner(network.rpc, signer); + fee = await getNetworkFee(network, senderAddress, messagesSend, ''); } try { From 225f4b897c655f7f08479091a07226984422d56b Mon Sep 17 00:00:00 2001 From: mtam Date: Sat, 18 Mar 2023 16:25:53 +0700 Subject: [PATCH 5/6] [TamTM6] fix simulate mobile part 2 --- src/app/core/services/wallet.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/core/services/wallet.service.ts b/src/app/core/services/wallet.service.ts index a7552baff..2a49b82b0 100644 --- a/src/app/core/services/wallet.service.ts +++ b/src/app/core/services/wallet.service.ts @@ -262,7 +262,12 @@ export class WalletService implements OnDestroy { let signingClient; if (this.isMobileMatched && !this.checkExistedCoin98()) { const msgs = messageCreators[messageType](senderAddress, message, network); - const fee: StdFee = await getNetworkFee(network, senderAddress, msgs, ''); + let fee; + if (this.coin98Client) { + fee = this.coin98Client.getGasEstimateMobile(network, messageType, validatorsCount); + } else { + fee = await getNetworkFee(network, senderAddress, msgs, ''); + } return this.makeSignDocData(senderAddress, { msgs, From 3a3ea4348fae4cfb4e2cff45bace6c1d9ac753f3 Mon Sep 17 00:00:00 2001 From: mtam Date: Sat, 18 Mar 2023 16:28:20 +0700 Subject: [PATCH 6/6] [TamTM6] fix simulate mobile part 2 --- src/app/core/utils/coin98-client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/utils/coin98-client.ts b/src/app/core/utils/coin98-client.ts index 1497acbb1..4367dbc02 100644 --- a/src/app/core/utils/coin98-client.ts +++ b/src/app/core/utils/coin98-client.ts @@ -172,7 +172,7 @@ export class Coin98Client { const gasPrice = network.gasPriceStep.average.toString() + network.currencies[0].coinMinimalDenom; const gasEstimate = validatorsCount ? getFee(messageType, validatorsCount) : getFee(messageType); const calGasPrice = calculateFee(Math.round(+gasEstimate), gasPrice); - let result = { + const result = { amount: [ { denom: network.currencies[0].coinMinimalDenom,