From ee2c26cbcb60a744635cc091d81307a8f8b3c9f4 Mon Sep 17 00:00:00 2001 From: SehKeat <97232165+SehKeat@users.noreply.github.com> Date: Thu, 23 Mar 2023 17:03:58 +0800 Subject: [PATCH] release v1.2.1 (#188) * fix transaction namespace tab (#183) * Fix view asset crash (#185) * fix block detail switch network (#184) * Bump version * fix transaction data table (#187) --------- Co-authored-by: Kong Seh Len <85566370+Ghost-Slime@users.noreply.github.com> Co-authored-by: Kong --- package.json | 2 +- .../components/TransactionComponent.vue | 84 +++++++++++++++--- src/modules/asset/views/ViewAsset.vue | 7 +- .../transaction/views/ViewTransactionList.vue | 87 +++++++++++++++---- src/util/blockUtil.ts | 4 +- src/util/transactionUtils.ts | 36 ++------ 6 files changed, 158 insertions(+), 62 deletions(-) diff --git a/package.json b/package.json index dc727abe..3308fc93 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "explorer-vite", - "version": "1.2.0", + "version": "1.2.1", "private": true, "scripts": { "dev": "vite ", diff --git a/src/modules/account/components/TransactionComponent.vue b/src/modules/account/components/TransactionComponent.vue index c7f5c88b..da8dc37a 100644 --- a/src/modules/account/components/TransactionComponent.vue +++ b/src/modules/account/components/TransactionComponent.vue @@ -37,85 +37,85 @@
{ }; const transactions = ref([]); +const mixedTransactions = ref([]); +const transferTransactions = ref([]); +const accountTransactions = ref([]); +const aggregateTransactions = ref([]); +const aliasTransactions = ref([]); +const assetTransactions = ref([]); +const namespaceTransactions = ref([]); +const metadataTransactions = ref([]); +const exchangeTransactions = ref([]); +const lockTransactions = ref([]); +const linkTransactions = ref([]); +const restrictionTransactions = ref([]); +const secretTransactions = ref([]); +const chainTransactions = ref([]); let transactionGroupType = Helper.getTransactionGroupType(); let blockDescOrderSortingField = Helper.createTransactionFieldOrder( Helper.getTransactionSortField().BLOCK, @@ -404,6 +418,48 @@ let loadAccountTransactions = async () => { transactionSearchResult.transactions ); transactions.value = formattedTxns; + if(selectedTxnType.value == 'all'){ + mixedTransactions.value = formattedTxns; + } + if(selectedTxnType.value == TransactionFilterType.TRANSFER){ + transferTransactions.value = formattedTxns; + } + if(selectedTxnType.value == TransactionFilterType.ACCOUNT){ + accountTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.AGGREGATE){ + aggregateTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.ALIAS){ + aliasTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.ASSET){ + assetTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.NAMESPACE){ + namespaceTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.METADATA){ + metadataTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.EXCHANGE){ + exchangeTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.LOCK){ + lockTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.LINK){ + linkTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.RESTRICTION){ + restrictionTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.SECRET){ + secretTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.CHAIN){ + chainTransactions.value = formattedTxns + } totalPages.value = transactionSearchResult.pagination.totalPages; } else { transactions.value = []; diff --git a/src/modules/asset/views/ViewAsset.vue b/src/modules/asset/views/ViewAsset.vue index 5980a597..09ef8a0b 100644 --- a/src/modules/asset/views/ViewAsset.vue +++ b/src/modules/asset/views/ViewAsset.vue @@ -211,6 +211,7 @@ const networkName = computed(() => { }); const loadAsset = async () => { + try{ if (!AppState.isReady && !networkName.value) { setTimeout(loadAsset, 1000); return; @@ -250,12 +251,16 @@ const loadAsset = async () => { isShowInvalid.value = true; } } +} +catch(e){ + isShowInvalid.value = true; + console.log(e) +} }; loadAsset(); emitter.on("CHANGE_NETWORK", (payload: boolean) => { if (payload) { - assets.value = null; isShowInvalid.value = false; loadAsset(); } diff --git a/src/modules/transaction/views/ViewTransactionList.vue b/src/modules/transaction/views/ViewTransactionList.vue index 00672fa3..ee509bfe 100644 --- a/src/modules/transaction/views/ViewTransactionList.vue +++ b/src/modules/transaction/views/ViewTransactionList.vue @@ -35,82 +35,82 @@
{ loadRecentTransactions(); }; const transactions = ref([]); +const mixedTransactions = ref([]); +const transferTransactions = ref([]); +const accountTransactions = ref([]); +const aggregateTransactions = ref([]); +const aliasTransactions = ref([]); +const assetTransactions = ref([]); +const namespaceTransactions = ref([]); +const metadataTransactions = ref([]); +const exchangeTransactions = ref([]); +const lockTransactions = ref([]); +const linkTransactions = ref([]); +const restrictionTransactions = ref([]); +const secretTransactions = ref([]); +const chainTransactions = ref([]); const QueryParamsType = ref(undefined); let transactionGroupType = Helper.getTransactionGroupType(); let blockDescOrderSortingField = Helper.createTransactionFieldOrder( @@ -303,8 +317,7 @@ let loadRecentTransactions = async () => { txnQueryParams.pageNumber = currentPage.value; if ( selectedTxnType.value == undefined || - selectedTxnType.value == "all" || - selectedTxnType.value == TransactionFilterType.ASSET + selectedTxnType.value == "all" ) { txnQueryParams.embedded = false; } else { @@ -328,6 +341,48 @@ let loadRecentTransactions = async () => { transactionSearchResult.transactions ); transactions.value = formattedTxns; + if(selectedTxnType.value == 'all'){ + mixedTransactions.value = formattedTxns; + } + if(selectedTxnType.value == TransactionFilterType.TRANSFER){ + transferTransactions.value = formattedTxns; + } + if(selectedTxnType.value == TransactionFilterType.ACCOUNT){ + accountTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.AGGREGATE){ + aggregateTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.ALIAS){ + aliasTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.ASSET){ + assetTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.NAMESPACE){ + namespaceTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.METADATA){ + metadataTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.EXCHANGE){ + exchangeTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.LOCK){ + lockTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.LINK){ + linkTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.RESTRICTION){ + restrictionTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.SECRET){ + secretTransactions.value = formattedTxns + } + if(selectedTxnType.value == TransactionFilterType.CHAIN){ + chainTransactions.value = formattedTxns + } totalPages.value = transactionSearchResult.pagination.totalPages; } else { transactions.value = []; diff --git a/src/util/blockUtil.ts b/src/util/blockUtil.ts index 2ddd6dd5..589a6d71 100644 --- a/src/util/blockUtil.ts +++ b/src/util/blockUtil.ts @@ -13,7 +13,7 @@ export interface BlockObj { } export class BlockUtils { - static async getBlockByHeight(blockHeight: number): Promise { + static async getBlockByHeight(blockHeight: number): Promise { if (!AppState.chainAPI) { throw new Error("Service Unavailable"); } @@ -33,7 +33,7 @@ export class BlockUtils { }; return blockInfo; } catch (error) { - throw error; + return false; } } diff --git a/src/util/transactionUtils.ts b/src/util/transactionUtils.ts index 1afb51f8..cec7d2fa 100644 --- a/src/util/transactionUtils.ts +++ b/src/util/transactionUtils.ts @@ -7549,17 +7549,12 @@ export class TransactionUtils { const registerTxn = transaction as RegisterNamespaceTransaction; txn.namespaceName = registerTxn.namespaceName; txn.namespaceId = registerTxn.namespaceId.id.toHex(); - if (!registerTxn.duration) { - throw new Error("Service unavailable"); - } - if (registerTxn.namespaceType === NamespaceType.RootNamespace) { + if (registerTxn.namespaceType === NamespaceType.RootNamespace && registerTxn.duration) { txn.duration = registerTxn.duration.compact(); txn.registerType = NamespaceType.RootNamespace; txn.registerTypeName = "Root namespace"; } - if (!registerTxn.parentId) { - throw new Error("Service unavailable"); - } else { + if (registerTxn.parentId) { txn.registerType = NamespaceType.SubNamespace; txn.registerTypeName = "Sub namespace"; txn.parentId = registerTxn.parentId.toHex(); @@ -7591,17 +7586,12 @@ export class TransactionUtils { const registerTxn = txns[i] as RegisterNamespaceTransaction; txn.namespaceName = registerTxn.namespaceName; txn.namespaceId = registerTxn.namespaceId.id.toHex(); - if (!registerTxn.duration) { - throw new Error("Service unavailable"); - } - if (registerTxn.namespaceType === NamespaceType.RootNamespace) { + if (registerTxn.namespaceType === NamespaceType.RootNamespace && registerTxn.duration) { txn.duration = registerTxn.duration.compact(); txn.registerType = NamespaceType.RootNamespace; txn.registerTypeName = "Root namespace"; } - if (!registerTxn.parentId) { - throw new Error("Service unavailable"); - } else { + if (registerTxn.parentId) { txn.registerType = NamespaceType.SubNamespace; txn.registerTypeName = "Sub namespace"; txn.parentId = registerTxn.parentId.toHex(); @@ -7634,17 +7624,12 @@ export class TransactionUtils { const registerTxn = txns[i] as RegisterNamespaceTransaction; txn.namespaceName = registerTxn.namespaceName; txn.namespaceId = registerTxn.namespaceId.id.toHex(); - if (!registerTxn.duration) { - throw new Error("Service unavailable"); - } - if (registerTxn.namespaceType === NamespaceType.RootNamespace) { + if (registerTxn.namespaceType === NamespaceType.RootNamespace && registerTxn.duration) { txn.duration = registerTxn.duration.compact(); txn.registerType = NamespaceType.RootNamespace; txn.registerTypeName = "Root namespace"; } - if (!registerTxn.parentId) { - throw new Error("Service unavailable"); - } else { + if (registerTxn.parentId) { txn.registerType = NamespaceType.SubNamespace; txn.registerTypeName = "Sub namespace"; txn.parentId = registerTxn.parentId.toHex(); @@ -7678,17 +7663,12 @@ export class TransactionUtils { const registerTxn = txns[i] as RegisterNamespaceTransaction; txn.namespaceName = registerTxn.namespaceName; txn.namespaceId = registerTxn.namespaceId.id.toHex(); - if (!registerTxn.duration) { - throw new Error("Service unavailable"); - } - if (registerTxn.namespaceType === NamespaceType.RootNamespace) { + if (registerTxn.namespaceType === NamespaceType.RootNamespace && registerTxn.duration) { txn.duration = registerTxn.duration.compact(); txn.registerType = NamespaceType.RootNamespace; txn.registerTypeName = "Root namespace"; } - if (!registerTxn.parentId) { - throw new Error("Service unavailable"); - } else { + if (registerTxn.parentId) { txn.registerType = NamespaceType.SubNamespace; txn.registerTypeName = "Sub namespace"; txn.parentId = registerTxn.parentId.toHex();