Skip to content

Commit

Permalink
[update][619] hard code base account (#3608)
Browse files Browse the repository at this point in the history
* resolved conflict

* resolved conflict 2

* remove trash code

* format code

* update query and logic for warning address

* update nested if else

* resolved conflict

* update: query cosmos and evm

* update: new query account info

* update: rename variable

* update: new UI for warning address

* fix: evm and cosmos warning

* fix: remove redundant character

* update: logic check address type

* update: logic check receive token firstly

* update: hard code base account
  • Loading branch information
TranTrungTien authored Jul 10, 2024
1 parent 76b7ffa commit bba9695
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/core/constants/account.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ export const TABS_TITLE_ACCOUNT = [

export const EVM_ACCOUNT_MESSAGE_TYPE = "'/ethermint.types.v1.EthAccount'";
export const COSMOS_WARNING_MESSAGE = "An account created by a EVM wallet (such as Metamask, Rabby, etc.) cannot be used to sign Cosmos transactions."
export const EVM_WARNING_MESSAGE = "An account created by a Cosmos wallet (such as Keplr, Leap,...) cannot be used to sign EVM transactions."
export const EVM_WARNING_MESSAGE = "An account created by a Cosmos wallet (such as Keplr, Leap,...) cannot be used to sign EVM transactions."

export const BASE_ACCOUNT_ADDRESS = {
cosmos: "aura1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg4ha9y",
evm: "0x0000000000000000000000000000000000000000"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { WalletService } from 'src/app/core/services/wallet.service';
import { transferAddress } from 'src/app/core/utils/common/address-converter';
import local from 'src/app/core/utils/storage/local';
import { EnvironmentService } from '../../../../app/core/data-services/environment.service';
import { ACCOUNT_WALLET_COLOR, COSMOS_WARNING_MESSAGE, EVM_WARNING_MESSAGE, EVM_ACCOUNT_MESSAGE_TYPE } from '../../../core/constants/account.constant';
import { ACCOUNT_WALLET_COLOR, COSMOS_WARNING_MESSAGE, EVM_WARNING_MESSAGE, EVM_ACCOUNT_MESSAGE_TYPE, BASE_ACCOUNT_ADDRESS } from '../../../core/constants/account.constant';
import { ACCOUNT_WALLET_COLOR_ENUM, ENameTag, WalletAcount } from '../../../core/constants/account.enum';
import { DATE_TIME_WITH_MILLISECOND, STORAGE_KEYS } from '../../../core/constants/common.constant';
import { AccountService } from '../../../core/services/account.service';
Expand Down Expand Up @@ -142,6 +142,13 @@ export class AccountDetailComponent implements OnInit, OnDestroy {
const payload = {
address: accountAddress,
};

if(accountAddress === BASE_ACCOUNT_ADDRESS.cosmos && accountEvmAddress === BASE_ACCOUNT_ADDRESS.evm) {
this.accountType = 'evm';
this.tooltipCosmosText = COSMOS_WARNING_MESSAGE;
return;
}

this.userService.getAccountInfoOfAddress(payload).subscribe({
next: (data: { account?: {type?: any; sequence?: number; pubkey?: object}[] } = {}) => {
const { account } = data;
Expand Down

0 comments on commit bba9695

Please sign in to comment.