Skip to content

Commit

Permalink
Merge pull request #2121 from aura-nw/baseline/main_20230720
Browse files Browse the repository at this point in the history
Baseline/main 20230720
  • Loading branch information
nhphuc2411 authored Jul 21, 2023
2 parents bec3826 + 446839e commit d21ac5b
Show file tree
Hide file tree
Showing 261 changed files with 7,952 additions and 6,399 deletions.
6 changes: 5 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
39 changes: 37 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,51 @@ import { CommonService } from './core/services/common.service';
import { TokenService } from './core/services/token.service';
import { getInfo } from './core/utils/common/info-common';
import { Globals } from './global/global';
// import eruda from 'eruda';
import { EnvironmentService } from 'src/app/core/data-services/environment.service';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {
constructor(private commonService: CommonService, private globals: Globals, private tokenService: TokenService) {}
// chainInfo = this.env.configValue.chain_info;
// TESTNET = ['aura-testnet-2', 'serenity-testnet-001'];
// isTestnet = this.TESTNET.includes(
// this.chainInfo?.chainId || ''
// );
constructor(
private commonService: CommonService,
private globals: Globals,
private tokenService: TokenService,
) // private env: EnvironmentService
{}
ngOnInit(): void {
this.getListNameTag();
this.getInfoCommon();
this.getPriceToken();

setInterval(() => {
this.getListNameTag();
this.getInfoCommon();
this.getPriceToken();
}, 60000);

// if (this.isTestnet) {
// let el = document.createElement('div');
// document.body.appendChild(el);
//
// eruda.init({
// container: el,
// tool: ['console', 'elements', 'resources', 'network'],
// });
// }
}

getInfoCommon(): void {
this.commonService.status().subscribe((res) => {
getInfo(this.globals, res.data);
getInfo(this.globals, res);
});
}

Expand All @@ -37,4 +61,15 @@ export class AppComponent implements OnInit {
this.globals.price.btc = res.data || 0;
});
}

getListNameTag(): void {
const payload = {
limit: 500,
keyword: [],
nextKey: 0,
};
this.commonService.getListNameTag(payload).subscribe((res) => {
this.globals.listNameTag = this.commonService.listNameTag = res.data?.nameTags;
});
}
}
6 changes: 2 additions & 4 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DatePipe } from '@angular/common';
import { HttpClient, HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HTTP_INTERCEPTORS, HttpClient, HttpClientModule } from '@angular/common/http';
import { APP_INITIALIZER, ErrorHandler, NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MAT_MOMENT_DATE_ADAPTER_OPTIONS, MomentDateAdapter } from '@angular/material-moment-adapter';
Expand All @@ -9,7 +9,7 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatChipsModule } from '@angular/material/chips';
import { DateAdapter, MatNativeDateModule, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion';
Expand All @@ -33,7 +33,6 @@ import { MatStepperModule } from '@angular/material/stepper';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgbModule, NgbNavModule, NgbPopoverModule, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
Expand Down Expand Up @@ -110,7 +109,6 @@ export const MY_FORMATS = {
MatTableModule,
MatTabsModule,
MatToolbarModule,
MatTooltipModule,
MatNativeDateModule,
MatFormFieldModule,
SchemaViewerModule,
Expand Down
4 changes: 1 addition & 3 deletions src/app/core/constants/common.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const NETWORK = [

export const DATEFORMAT = {
DATETIME_UTC: 'yyyy-MM-dd HH:mm:ss',
DATE_ONLY: 'dd/MM/yyyy',
DATE_ONLY: 'yyyy-MM-dd',
};

export const NUMBER_CONVERT = 1000000; //10^6 satoshi unit
Expand Down Expand Up @@ -68,8 +68,6 @@ export const TOKEN_ID_GET_PRICE = {
BTC: 'bitcoin'
};

export const LIST_TYPE_CONTRACT_ADDRESS = ['revoke_all', 'approve_all', 'revoke', 'approve'];

export enum MEDIA_TYPE {
IMG = 'img',
VIDEO = 'video',
Expand Down
23 changes: 9 additions & 14 deletions src/app/core/constants/contract.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,13 @@ export const MAX_LENGTH_SEARCH_CONTRACT = 200;
export const CONTRACT_TABLE_TEMPLATES: Array<TableTemplate> = [
// { 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: 'blockHeight',
headerCellDef: 'Block',
type: 'hash-url',
headerWidth: 6,
isUrl: '/blocks'
},
{ 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: '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: 'from', headerCellDef: 'From', type: 'hash-url', headerWidth: 12, isUrl: '/account', isNameTag: true },
{ 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 },
];

Expand All @@ -72,6 +65,7 @@ export const CONTRACT_VERSIONS = [
{ label: 'cosmwasm/rust-optimizer:0.12.11', value: 'cosmwasm/rust-optimizer:0.12.11' },
{ label: 'cosmwasm/rust-optimizer:0.12.12', value: 'cosmwasm/rust-optimizer:0.12.12' },
{ label: 'cosmwasm/rust-optimizer:0.12.13', value: 'cosmwasm/rust-optimizer:0.12.13' },
{ label: 'cosmwasm/rust-optimizer:0.13.0', value: 'cosmwasm/rust-optimizer:0.13.0' },

// { label: 'cosmwasm/rust-optimizer-arm64:0.12.4', value: 'cosmwasm/rust-optimizer-arm64:0.12.4' },
// { label: 'cosmwasm/rust-optimizer-arm64:0.12.5', value: 'cosmwasm/rust-optimizer-arm64:0.12.5' },
Expand All @@ -97,6 +91,7 @@ export const CONTRACT_VERSIONS = [
{ label: 'cosmwasm/workspace-optimizer:0.12.11', value: 'cosmwasm/workspace-optimizer:0.12.11' },
{ label: 'cosmwasm/workspace-optimizer:0.12.12', value: 'cosmwasm/workspace-optimizer:0.12.12' },
{ label: 'cosmwasm/workspace-optimizer:0.12.13', value: 'cosmwasm/workspace-optimizer:0.12.13' },
{ label: 'cosmwasm/workspace-optimizer:0.13.0', value: 'cosmwasm/workspace-optimizer:0.13.0' },

// { label: 'cosmwasm/workspace-optimizer-arm64:0.12.4', value: 'cosmwasm/workspace-optimizer-arm64:0.12.4' },
// { label: 'cosmwasm/workspace-optimizer-arm64:0.12.5', value: 'cosmwasm/workspace-optimizer-arm64:0.12.5' },
Expand All @@ -118,7 +113,6 @@ export const REGISTER_CONTRACT = [
},
];


export const LIST_ZEROES = [
{
value: '6',
Expand All @@ -134,3 +128,4 @@ export const LIST_ZEROES = [
},
];

export const TYPE_CW4973 = 'crates.io:cw4973';
6 changes: 3 additions & 3 deletions src/app/core/constants/contract.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export enum ContractTab {

export enum ContractVerifyType {
Unverified = 'UNVERIFIED',
Verified = 'VERIFIED',
VerifiedFail = 'VERIFYFAIL',
Verifying = 'VERIFYING'
Verified = 'SUCCESS',
VerifiedFail = 'FAIL',
Verifying = 'VERIFYING',
}

export enum ContractTransactionType {
Expand Down
32 changes: 16 additions & 16 deletions src/app/core/constants/proposal.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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',
Expand All @@ -96,16 +96,16 @@ 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)',
}

export enum PROPOSAL_TABLE_MODE {
VOTES = 'VOTES',
DEPOSITORS = 'DEPOSITORS',
VALIDATORS_VOTES = 'VALIDATORS_VOTES',
}
}
1 change: 1 addition & 0 deletions src/app/core/constants/transaction.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
4 changes: 3 additions & 1 deletion src/app/core/constants/transaction.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ 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',
MultiSend = 'Multisend',
Delegate = 'Delegate',
Undelegate = 'Undelegate',
Redelegate = 'Redelegate',
Expand Down Expand Up @@ -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',
Expand Down
5 changes: 4 additions & 1 deletion src/app/core/constants/url.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ export const LCD_COSMOS = {
TX: 'cosmos/tx/v1beta1',
SLASHING: 'cosmos/slashing/v1beta1',
BLOCK: 'cosmos/base/tendermint/v1beta1/blocks',
DISTRIBUTION: 'cosmos/distribution/v1beta1/community_pool'
DISTRIBUTION: 'cosmos/distribution/v1beta1/community_pool',
BALANCE: 'cosmos/bank/v1beta1/balances',
DELEGATION: 'cosmos/staking/v1beta1/delegations',
REWARD: 'cosmos/distribution/v1beta1/delegators'
};
6 changes: 6 additions & 0 deletions src/app/core/constants/validator.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ export enum DIALOG_STAKE_MODE {
Manage = 'manage',
Undelegate = 'undelegate',
Redelegate = 'redelegate',
}

export enum VOTING_POWER_LEVEL {
GREEN = '1',
YELLOW = '2',
RED = '3',
}
34 changes: 10 additions & 24 deletions src/app/core/helpers/jwt.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
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<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
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<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const currentUser = this.authenticationService.currentUserValue;
request = request.clone({
setHeaders: {
},
});
return next.handle(request);
}
}
Loading

0 comments on commit d21ac5b

Please sign in to comment.