Skip to content

Commit

Permalink
Release/euphoria 15072024 (#3630)
Browse files Browse the repository at this point in the history
* [feat][Erc721] - implement token-tracker overview ,transfers tab, inventory tab (#3377)

- [576] implement NFT Transfer box of Transaction details

* [feat][Erc721] - implement token details page (#3378)

* [feat-fix][Erc721] - fix method name (#3381)

* [feat-fix][Erc721] - fix method name

* [feat-fix][Erc721] - fix filter token for token tranfer tab

* [feat-fix][Erc721] - fix text for write contract tab

* [feat-fix][Erc721] - fix read contract (#3383) (#3384)

* [feat-fix][Erc721] - fix read contract (#3383)

* [feat-fix][Erc721] - fix show error for read/write contract

* [feat][fix][575] fix nft Token Standard (#3385)

* [feat-fix][Erc721] - fix reset error

---------

Co-authored-by: Huynh Van Son <hvson96@gmail.com>

* [feat][Erc721] - implement non fungible tokens list view (#3387)

* [feat-fix][Erc721] - fix show icon contract for tranfers tab, fix contract tab (#3389)

* [feat][557] account detail ERC721 nfts (#3392)

* [feat-fix][Erc721] - fix text (#3393)

* [feat][578] erc721 nft transfers (#3396)

* [feat][580] erc721 token tracker - holder tab (#3397)

* [FeatFix][Erc721] fix contract icon (#3400)

* [featfix][erc721] fix nft filter order (#3402)

* [FeatFix][Erc721] fix holder tab (#3404)

* fix: smartContractList is undefined at first render

* fix: smartContractList is undefined at first render (holder tab)

* [FeatFix][Erc721] fix holders tab (#3409)

* [FeatFix][Erc721] fix search Non-fungible Tokens (#3411)

* [FeatFix][Erc721] fix search nft box (#3413)

* [FeatFix][Erc721] fix bug icon contract (#3415)

* fix: no action when to click metamask (if metamask is not installed)

* [FeatFix][Erc721] fix bug token detail nft tranfer tab (#3420)

* [FeatFix][Erc721] fix write contract (#3422)

* [FeatFix][Erc721] fix write contract

* [FeatFix][Erc721] fix bug link

* [FeatFix][Erc721] fix search by name tag (#3425)

* [FeatFix][Erc721] fix text (#3426)

* [FeatFix][Erc721] fix search private name tag (#3428)

* [FeatFix][Erc721] fix search (#3430)

* [FeatFix][575] fix nft modal (#3433)

* fix: crash app when reading undefined var

* fix: metamask redirect to home automatically although it's installed

* Fix topics for Event Logs - Transaction details page (#3438)

* [Feat][595] implement staking for evm (#3441)

* [FeatFix] fix link to token tracker (#3443)

* [FeatFix] fix show icon contract (#3445)

* [FeatFix] fix search non fungible tokens erc721 (#3448)

* [FeatFix][595]  fix staking for evm , fix icon contract transaction c… (#3451)

* [FeatFix][595]  fix staking for evm , fix icon contract transaction component

* [FeatFix][595]  remove text

* [FeatFix] fix auto refresh transaction for contract detail page (#3454)

* [HotFix] fix search by address erc721 (#3462)

* [HotFix] fix search by address erc721

* [HotFix] fix detect and switch evm chain

* [HotFix] fix detect and switch evm chain

* [HotFix] fix detect and switch evm chain

* fix: highlight function [#613]

* feat: show fee_payer in cosmos transaction detail page

* [Feat][533] Display EVM address both upper case & normal case (#3465)

* [Feat][533] Display EVM address both upper case & normal case

* [Feat][533] remove console log

---------

Co-authored-by: tambui <tam2391@gmail.com>

* [HotFix] fix bug switch evm chain (#3470)

* [FeatFix][615] fix missing icon contract (#3474)

* change inter font to space mono font for input methor, event log in transaction page

* fix: update fee_payer field

* update: fee_payer field

* [FeatFix][582] - validate bool type for read/write contract (#3484)

[FeatFix][611] - fix switch chain

* [Feat][619] Warning for incompatible between cosmos address and evm address (#3482)

* resolved conflict

* resolved conflict 2

* remove trash code

* format code

* update query and logic for warning address

* update nested if else

* resolved conflict

* [Feat][602] add arrow icon (#3485)

* [feat][620] highlight chain support (#3488)

* [Chore] fix check evm token burnt (#3491)

* [Chore] fix query transfer evm token list (#3496)

* [Chore] fix show toast switch chain (#3499)

* Sere/fix/fix method name burn for ntf detail (#3502)

* Revert "[Chore] fix query transfer evm token list (#3496)"

This reverts commit 570ae02.

* [FeatFix] fix method name burn for nft detail

* [featfix][547] fix Display and Search uppercase EVM address (#3505)

* [featfix][622] wallet text align (#3508)

* [FeatFix] - fix bug no data in nft tranfer tab (#3512)

- fix missing token name in Token Tracker column of evm contract list
  - fix column event in nft detail

* [FeatFix] fix orderby queryEvmTransactionList (#3515)

* [FeatFix][573] fix query search non-fungible-tokens list (#3518)

* [feat][610] export csv (#3523)

* [fix][533] fix search evm contract nfts (#3529)

* [Chore] feature flags (#3530)

* [chore] add feature flag for future function (#3509)

* [chore] add feature flag for future function

* remove config, auto gen

* [chore] fix github action (#3520)

* [Chore] fix typo docker file (#3522)

* [Chore] fix typo docker file

* remove space

* [chore] fix feature flags scripts (#3524)

* []featfix][620] fix wallet connect responsive (#3533)

* [fix][533] fix search by token id (#3537)

* [fix][bug-erc721] [11] fix change wallet (#3544)

* [chore][setting] - update editorconfig (#3548)

* [sere][fix][29] - not show arrow icon in account detail page (#3549)

* [fix][17] - Text Owner and address are not align with each other (#3551)

- CW721: Token tracker page_Inventory page

* [Feat][619] Update query cosmos and evm (#3542)

* 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

* [fix][bug-erc721] [35] fix search address (#3553)

* [feat][598]: show token info (#3535)

* feat: show token info

* update: format-back style code

* update: remove utils func, move convert func to service layer

* remove call api, use current data

* [fix][9] - show disconnect link on write contract page (#3556)

* [fix][9] - show disconnect link on write contract page

* [fix][9] - responsive

* [fix][12] - missing word in holder tab (#3557)

* [fix][36] - show normal text for height block (#3559)

* [fix][28] - responsive value of method (#3561)

* [fix][654] - NFT transfer is missing transaction (#3564)

* [fix][26] - evm transactions responsive (#3565)

* [hotfix][662] add USDC token as default (#3567)

* [hotfix][662] add USDC as default

* move get usdc token to account service

* [hotfix][662] change usdc token type. (#3568)

* [hotfix][662] add USDC as default

* move get usdc token to account service

* fix: usdc token type

* [fix][622]: fix wrong usdc token url. (#3569)

* [hotfix][662] add USDC as default

* move get usdc token to account service

* fix: usdc token type

* fix: wrong usdc token url

* [Feat][655] Enhance event log (#3571)

* feat: Decode event log

* [Feat][655] enhance event log

* Apply decode ui

* update: data decoded

* [Feat][655]  enhance event log - fix index

* [Feat][655]  enhance event log - update

---------

Co-authored-by: tambui <tam2391@gmail.com>

* [fix][622] fix conflict between token-market api and evm-token-detail api (#3574)

* [hotfix][662] add USDC as default

* move get usdc token to account service

* fix: usdc token type

* fix: wrong usdc token url

* fix: conflict between token-market api and evm-token-detail api

* feat: update UI send method transaction (#3573)

* [feat][619] Update new design incompatible address (#3576)

* 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

* [feat] enhance event log (#3581)

* [fix][655] fix event log (#3584)

* feat: Decode event log

* [Feat][655] enhance event log

* Apply decode ui

* update: data decoded

* update: event log

* merged commit

* update: event log

* --amend

---------

Co-authored-by: tambui <tam2391@gmail.com>

* [fix][652] fix send method (#3587)

* feat: update UI send method transaction

* merged from sere

* remove unused code

* [feat][622] update wallet connect UI (#3592)

* [fix][652] check method name (#3588)

* feat: update UI send method transaction

* merged from sere

* remove unused code

* Update: check method name

* [fix][619] evm and cosmos warning, remove redundant character (#3590)

* 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

* [fix][610] fix export address file name (#3595)

* [fix][610] fix export address file name

* fix filter erc721_activities

* fix: disable decode when transaction is send with memo (#3597)

* feat: update UI send method transaction

* merged from sere

* remove unused code

* Update: check method name

* fix: disable decode when transaction is send with memo

* [Update] USDT information (#3600)

* [hotfix][662] add USDC as default

* move get usdc token to account service

* fix: usdc token type

* fix: wrong usdc token url

* fix: conflict between token-market api and evm-token-detail api

* update: usdt token infomation

* fix: compare big number fungible tokens table (#3602)

* [fix][619] logic check receive token firstly (#3605)

* 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][619] hard code base account (#3608)

* 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

* [fix][655]fix event log (#3611)

* feat: Decode event log

* [Feat][655] enhance event log

* Apply decode ui

* update: data decoded

* update: event log

* merged commit

* update: event log

* --amend

* [fix][655] fix event log (#3609)

* [fix][598] fix set token info

* feat: Decode event log

* [Feat][655] enhance event log

* Apply decode ui

* update: data decoded

* remove config.json change

* fix: enhance event log

* merged commit

* update: event log

* --amend

* fix: event log

* fix: event log

---------

Co-authored-by: tambui <tam2391@gmail.com>

---------

Co-authored-by: tambui <tam2391@gmail.com>

* [Fix][589] Fix set token info (#3603) (#3610)

* [fix][598] fix set token info

* fix: token info (10 -> 29)

* fix: default native image

* [update][619] update logic check wallet type (#3614)

* 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

* update: undefined wallet type if type or sequence empty

* [update][619] update logic check wallet type (#3613)

* feat: warning for cosmos and evm address is incompatible

* feat: warning for compatible between cosmos address and evm address

* remove trash code

* format code

* update query and logic for warning address

* update nested if else

* update

* resolved conflict

* update: query cosmos and evm

* update: new query account info

* update: rename variable

* update: new UI for warning address

* fix: remove redundant character

* fix: evm and cosmos warning

* update: logic check address type

* update: logic check receive token firstly

* update: hard code base account

* update: undefined wallet type if type or sequence empty

* update logic warning

* [fix][652] convert hex to string memo (#3616)

* feat: update UI send method transaction

* merged from sere

* remove unused code

* Update: check method name

* fix: disable decode when transaction is send with memo

* update: convert hex to string

* [Update][619] convert call data account info from horo to lcd (#3620)

* Update: convert call data account info from horo to lcd

* update function recursion to get value

* update function recursion to get value

* fix: Total Value (#3622)

* fix event log (#3624)

* update: default balance value to prevent NaN (#3626)

* [update][655] responsive for mobile (#3628)

* fix event log

* update responsive for mobile

* [fix] account detail error when address is cosmos contract (#3629)

* Revert "[feat][622] update wallet connect UI (#3592)"

This reverts commit f840bdd.

* revert feat 622

* add feature flag for enhance log and token info

---------

Co-authored-by: Huynh Van Son <hvson96@gmail.com>
Co-authored-by: Tran Trung Tien <trantrungtien9x@gmail.com>
Co-authored-by: TranTrungTien <71311738+TranTrungTien@users.noreply.github.com>
Co-authored-by: Nguyen Duong <duongynguyen0501@gmail.com>
  • Loading branch information
5 people authored Jul 15, 2024
1 parent 5a57b85 commit bfb5855
Show file tree
Hide file tree
Showing 73 changed files with 1,184 additions and 421 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ root = true
[*]
indent_style = space
indent_size = 2
end_of_line = crlf
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start:dev": "ng serve",
"build": "ng build --aot=true --output-hashing=all",
"build:production": "ng build --aot=true --output-hashing=all --configuration production",
"featureflags": "node scripts/encryptFeatureFlags.mjs dev",
"featureflags": "node scripts/encryptFeatureFlags.mjs euphoria",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/feature-flags/dev/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": true }
{ "devTest": true, "enhanceEventLog": true, "setTokenInfo": true }
2 changes: 1 addition & 1 deletion scripts/feature-flags/euphoria/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": false }
{ "devTest": false, "enhanceEventLog": false, "setTokenInfo": false }
2 changes: 1 addition & 1 deletion scripts/feature-flags/mainnet/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": false }
{ "devTest": false, "enhanceEventLog": false, "setTokenInfo": false }
2 changes: 1 addition & 1 deletion scripts/feature-flags/serenity/config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "devTest": false }
{ "devTest": false, "enhanceEventLog": true, "setTokenInfo": true }
2 changes: 2 additions & 0 deletions src/app/core/constants/feature-flags.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ const FEATURE_FLAGS_NAMESPACE = '32bf670d-a39e-46a7-8546-2a11d3c16b33';

export enum FeatureFlags {
DevTest = uuidv5('devTest', FEATURE_FLAGS_NAMESPACE),
EnhanceEventLog = uuidv5('enhanceEventLog', FEATURE_FLAGS_NAMESPACE),
SetTokenInfo = uuidv5('setTokenInfo', FEATURE_FLAGS_NAMESPACE),
}
39 changes: 39 additions & 0 deletions src/app/core/constants/token.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,45 @@ export enum ETokenNFTTypeBE {

export const TOKEN_EVM_BURNT = '0x0000000000000000000000000000000000000000';

export const SOCIAL_MEDIA = {
youtube: {
name: 'youtube',
icon: 'assets/icons/icons-svg/basic/youtube.svg',
},
twitter: {
name: 'twitter',
icon: 'assets/icons/icons-svg/basic/twitter.svg',
},
discord: {
name: 'discord',
icon: 'assets/icons/icons-svg/basic/discord.svg',
},
telegram: {
name: 'telegram',
icon: 'assets/icons/icons-svg/basic/telegram.svg',
},
linkedin: {
name: 'linkedin',
icon: 'assets/icons/icons-svg/basic/linkedIn.svg',
},
github: {
name: 'github',
icon: 'assets/icons/icons-svg/basic/github.svg',
},
facebook: {
name: 'facebook',
icon: 'assets/icons/icons-svg/basic/fb-circle.svg',
},
medium: {
name: 'medium',
icon: 'assets/icons/icons-svg/basic/medium.svg',
},
otherWebsite: {
name: 'otherWebsite',
icon: 'assets/icons/icons-svg/basic/global.svg',
},
};

export const USDC_ADDRESS = '0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd';
export const USDC_COIN_ID = 'tether';
export const USDC_TOKEN = {
Expand Down
35 changes: 23 additions & 12 deletions src/app/core/data-services/api-cw20-token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ export class ApiCw20TokenService {
BigNumber(token.balance).gt(0),
);

const usdcCoin = this.parseUSDCToken(USDCToken, coinsMarkets);

const idx = tokens?.findIndex((f) => f.contract_address?.toLowerCase() === USDC_ADDRESS);
if (idx >= 0) {
tokens[idx] = usdcCoin;
} else {
tokens.push(usdcCoin);
if (USDCToken) {
const usdcCoin = this.parseUSDCToken(USDCToken, coinsMarkets);

const idx = tokens?.findIndex((f) => f.contract_address?.toLowerCase() === USDC_ADDRESS);
if (idx >= 0) {
tokens[idx] = usdcCoin;
} else {
tokens.push(usdcCoin);
}
}

const allTokens = [nativeToken, ...tokens];
Expand Down Expand Up @@ -115,12 +117,14 @@ export class ApiCw20TokenService {
}

async getUSDCToken(address: string) {
if (!address) {
return null;
}
const contract = this.createContract();
const balance = await contract.balanceOf(address);
const name = await contract.name();
const symbol = await contract.symbol();
const decimals = await contract.decimals();

return {
...USDC_TOKEN,
tokenUrl: USDC_ADDRESS,
Expand All @@ -133,6 +137,8 @@ export class ApiCw20TokenService {

parseUSDCToken(token, coinsMarkets) {
const USDCMarket = coinsMarkets?.find((item) => item.coinId === USDC_COIN_ID);
const amount = getBalance(token?.balance || 0, token?.decimals);
const value = new BigNumber(amount).multipliedBy(Number(USDCMarket?.currentPrice || 0));

return {
...token,
Expand All @@ -141,9 +147,13 @@ export class ApiCw20TokenService {
type: COIN_TOKEN_TYPE.ERC20,
tokenUrl: USDC_ADDRESS,
denom: USDC_ADDRESS,
price: USDCMarket?.currentPrice,
priceChangePercentage24h: USDCMarket?.priceChangePercentage24h,
value: Number(USDCMarket?.currentPrice) * token?.balance,
price: USDCMarket?.currentPrice || 0,
priceChangePercentage24h: USDCMarket?.priceChangePercentage24h || 0,
value: value.toFixed(),
image: USDCMarket?.image,
max_total_supply: USDCMarket?.totalSupply,
verify_status: USDCMarket?.verifyStatus || '',
verify_text: USDCMarket?.verifyText || '',
};
}

Expand Down Expand Up @@ -212,12 +222,13 @@ export class ApiCw20TokenService {
parseNativeToken(account, coinsMarkets) {
const nativeId = this.env.coingecko.ids[0];
const coinMarket = coinsMarkets.find((coin) => coin.coinId === nativeId);

return {
name: this.env.chainName,
symbol: this.currencies.coinDenom,
decimals: this.currencies.coinDecimals,
denom: this.currencies.coinMinimalDenom,
image: this.currencies.coinImageUrl,
image: this.currencies.coinImageUrl || coinMarket?.image,
contract_address: '-',
balance: account.data.total,
price: coinMarket?.currentPrice || 0,
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/helpers/global-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ErrorHandler, Injectable } from '@angular/core';
@Injectable()
export class GlobalErrorHandler implements ErrorHandler {

handleError(error: any): void {
handleError(error: any): void {
const chunkFailedMessage = /Loading chunk [\d]+ failed/;

if (chunkFailedMessage.test(error?.message)) {
Expand Down
7 changes: 6 additions & 1 deletion src/app/core/pipes/custom-pipe.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { ImageURLPipe, ReplaceIpfsPipe } from './image.pipe';
import { JsonPipe } from './json.pipe';
import { IbcDenomPipe, MarketInfoPipe } from './market-info.pipe';
import { IsPrivateNameTagPipe, IsPublicNameTagPipe, NameTagPipe } from './name-tag.pipe';
import { BalancePipe, FormatDigitPipe, GtPipe, GtePipe, LtPipe, LtePipe } from './number.pipe';
import { BalancePipe, EqPipe, FormatDigitPipe, GtPipe, GtePipe, LtPipe, LtePipe } from './number.pipe';
import { ObjectKeysPipe } from './object-keys.pipe';
import { CombineTxsMsgPipe, EllipsisPipe } from './string.pipe';
import { NameTagTooltipPipe } from './tooltip.pipe';
import { HighlightFunctionPipe } from './highlight-function.pipe';
import { NewlinePipe } from './newline.pipe';

@NgModule({
imports: [CommonModule],
Expand All @@ -33,6 +34,7 @@ import { HighlightFunctionPipe } from './highlight-function.pipe';
LtePipe,
GtPipe,
LtPipe,
EqPipe,
IbcDenomPipe,
EllipsisPipe,
CustomTimeDatePipe,
Expand All @@ -42,6 +44,7 @@ import { HighlightFunctionPipe } from './highlight-function.pipe';
CapacityPipe,
EvmAddressPipe,
HighlightFunctionPipe,
NewlinePipe
],
exports: [
JsonPipe,
Expand All @@ -59,6 +62,7 @@ import { HighlightFunctionPipe } from './highlight-function.pipe';
LtePipe,
GtPipe,
LtPipe,
EqPipe,
IbcDenomPipe,
EllipsisPipe,
CustomTimeDatePipe,
Expand All @@ -68,6 +72,7 @@ import { HighlightFunctionPipe } from './highlight-function.pipe';
CapacityPipe,
EvmAddressPipe,
HighlightFunctionPipe,
NewlinePipe
],
providers: [],
})
Expand Down
14 changes: 14 additions & 0 deletions src/app/core/pipes/newline.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';

@Pipe({ name: 'newline' })
export class NewlinePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(value: string) {
if (!value) return null;
let replacedValue = value;
replacedValue = replacedValue?.replace(/\n/gi, '<br/>');
return this.sanitizer.bypassSecurityTrustHtml(replacedValue);
}
}

8 changes: 8 additions & 0 deletions src/app/core/pipes/number.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ export class LtPipe implements PipeTransform {
return BigNumber(amount).lt(BigNumber(val));
}
}

@Pipe({ name: 'eq' })
export class EqPipe implements PipeTransform {
constructor() {}
transform(amount: number | string, val: number | string): any {
return BigNumber(amount).eq(BigNumber(val));
}
}
3 changes: 2 additions & 1 deletion src/app/core/services/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ApiCw20TokenService } from '../data-services/api-cw20-token.service';
import { TYPE_CW4973 } from '../constants/contract.constant';
import { EnvironmentService } from '../data-services/environment.service';
import { CommonService } from './common.service';
import { isEvmAddress } from '../utils/common/validation';

@Injectable()
export class AccountService extends CommonService {
Expand Down Expand Up @@ -188,7 +189,7 @@ export class AccountService extends CommonService {
}

getAssetERC721ByOwner(payload): Observable<any> {
if (payload.keyword?.length >= LENGTH_CHARACTER.EVM_ADDRESS) {
if (payload.keyword?.length >= LENGTH_CHARACTER.EVM_ADDRESS && isEvmAddress(payload.keyword)) {
payload.contractAddress = payload.keyword;
} else if (payload.keyword?.length > 0) {
payload.token_id = payload.keyword;
Expand Down
27 changes: 27 additions & 0 deletions src/app/core/services/contract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,33 @@ export class ContractService extends CommonService {
.pipe(map((res) => (res?.data ? res?.data[this.envDB] : null)));
}


getListProxyAbi(addressList: string[]) {
const query = `query ListProxyContractDetail($address: [String] = null) {
${this.envDB} {
evm_smart_contract(where: {address: {_in: $address}}) {
address
evm_proxy_histories(order_by: {block_height: desc}, where: {implementation_contract: {_is_null: false}}) {
proxy_contract
implementation_contract
block_height
}
}
}
}
`;

return this.http
.post<any>(this.graphUrl, {
query: query,
variables: {
address: addressList,
},
operationName: 'ListProxyContractDetail',
})
.pipe(map((res) => (res?.data ? res?.data[this.envDB] : null)));
}

queryTokenByContractAddress(address: string) {
if (address.toLowerCase() == this.environmentService.coinMinimalDenom) {
return of({
Expand Down
23 changes: 21 additions & 2 deletions src/app/core/services/token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CW20_TRACKING } from '../constants/common.constant';
import { LCD_COSMOS } from '../constants/url.constant';
import { EnvironmentService } from '../data-services/environment.service';
import { CommonService } from './common.service';
import { TOKEN_EVM_BURNT } from '../constants/token.constant';
import { SOCIAL_MEDIA, TOKEN_EVM_BURNT } from '../constants/token.constant';

@Injectable({ providedIn: 'root' })
export class TokenService extends CommonService {
Expand Down Expand Up @@ -142,7 +142,9 @@ export class TokenService extends CommonService {
}

getListErc721Token(payload, textSearch: string = null, addressIn: string[] = []): Observable<any> {
let querySort = `order_by: [{erc721_stat: {${payload.sort_column}: ${payload.sort_order}_nulls_last}}, {id: desc}]`;
let querySort = `order_by: [{erc721_stat: {${payload.sort_column}: ${
payload.sort_order === 'asc' ? 'asc_nulls_first' : 'desc_nulls_last'
} }}, {id: desc}]`;
let queryWhere = `where: {_or: [{address: {_in: $addressIn}}, {name: {_ilike: "%${textSearch}%"}}]}`;
const operationsDoc = `
query queryListErc721($limit: Int = 10, $offset: Int = 0, $addressIn: [String!] = null) {
Expand Down Expand Up @@ -962,4 +964,21 @@ export class TokenService extends CommonService {
})
.pipe(map((res) => (res?.data ? res?.data[this.envDB] : null)));
}

mappingSocialProfiles(socialProfiles: { [key: string]: string }) {
if (!socialProfiles) return [];

const socialMapping = [];
Object.keys(SOCIAL_MEDIA).forEach((key) => {
if (socialProfiles[key]) {
const social = {
name: SOCIAL_MEDIA[key]?.name,
icon: SOCIAL_MEDIA[key]?.icon,
url: socialProfiles[key],
}
socialMapping.push(social);
}
})
return socialMapping;
}
}
28 changes: 28 additions & 0 deletions src/app/core/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,34 @@ export class TransactionService extends CommonService {
.pipe(map((res) => (res?.data ? res?.data[this.envDB] : null)));
}

getListAbiContract(addressList: string[]) {
const operationsDoc = `
query getListAbiContract($address: [String] = null) {
${this.envDB} {
evm_contract_verification(where: {contract_address: {_in: $address}, status: {_eq: "SUCCESS"}}, order_by: {id: desc}) {
contract_address
created_at
creator_tx_hash
id
status
updated_at
abi
}
}
}
`;

return this.http
.post<any>(this.graphUrl, {
query: operationsDoc,
variables: {
address: addressList,
},
operationName: 'getListAbiContract',
})
.pipe(map((res) => (res?.data ? res?.data[this.envDB] : null)));
}

getListMappingName(methodId: any): Observable<any> {
const operationsDoc = `
query queryListNameMethod($limit: Int = 100, $methodId: [String!] = null) {
Expand Down
Loading

0 comments on commit bfb5855

Please sign in to comment.