From df2e7f23dce38bcfcc7e18488bfba624b1abba15 Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Wed, 6 Dec 2023 18:54:05 -0600 Subject: [PATCH 01/11] fix: prepend eosio system accounts for search results --- src/components/HeaderSearch.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index 7d886a6e..1db23b8c 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -50,7 +50,7 @@ export default defineComponent({ // because the get table by scope for userres does not include eosio system or null accounts if (value.includes('eosio')) { - accounts.push(...[{ + accounts.unshift(...[{ payer: 'eosio', } as TableByScope, { payer: 'eosio.null', From 8a3018ac89506fc6b9dd5ef483eeeb614d9d67ac Mon Sep 17 00:00:00 2001 From: Karyne Mayer Date: Tue, 12 Dec 2023 08:46:29 -0800 Subject: [PATCH 02/11] Updates eos mainnet and testnet endpoints --- src/config/chains/eos/index.ts | 6 +++--- src/config/chains/jungle/index.ts | 6 +++--- src/config/chains/ux/index.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/config/chains/eos/index.ts b/src/config/chains/eos/index.ts index 756ea229..5f708dde 100644 --- a/src/config/chains/eos/index.ts +++ b/src/config/chains/eos/index.ts @@ -19,10 +19,10 @@ const TOKEN = { amount: 0, contract: 'eosio.token', } as Token; -const HYPERION_ENDPOINT = 'https://eos.hyperion.eosrio.io'; +const HYPERION_ENDPOINT = 'https://eos.eosusa.io'; const RPC_ENDPOINT = { protocol: 'https', - host: 'eos.hyperion.eosrio.io', + host: 'eos.eosusa.io', port: 443, }; const FUEL_RPC_ENDPOINT = { @@ -30,7 +30,7 @@ const FUEL_RPC_ENDPOINT = { host: 'eos.greymass.com', port: 443, }; -const API_ENDPOINT = 'https://example.com'; +const API_ENDPOINT = 'https://eos.greymass.com'; const S3_PRODUCER_BUCKET = 'https://telos-producer-validation.s3.amazonaws.com'; const DISPLAY_MAP = false; const THEME = { diff --git a/src/config/chains/jungle/index.ts b/src/config/chains/jungle/index.ts index 375f9465..060134c0 100644 --- a/src/config/chains/jungle/index.ts +++ b/src/config/chains/jungle/index.ts @@ -34,14 +34,14 @@ const TOKEN = { amount: 0, contract: 'eosio.token', } as Token; -const HYPERION_ENDPOINT = 'https://jungle4.cryptolions.io'; +const HYPERION_ENDPOINT = 'https://jungle.eosusa.io'; const S3_PRODUCER_BUCKET = 'https://telos-producer-validation.s3.amazonaws.com'; const RPC_ENDPOINT = { protocol: 'https', - host: 'jungle.eosusa.news', + host: 'jungle.eosusa.io', port: 443, }; -const API_ENDPOINT = 'https://jungle4.cryptolions.io'; +const API_ENDPOINT = 'https://jungle.eosusa.io'; const DISPLAY_MAP = false; const THEME = { primary: '#28417c', diff --git a/src/config/chains/ux/index.ts b/src/config/chains/ux/index.ts index dc5ee878..1fe88b41 100644 --- a/src/config/chains/ux/index.ts +++ b/src/config/chains/ux/index.ts @@ -22,7 +22,7 @@ const RPC_ENDPOINT = { host: 'ux.eosusa.io', port: 443, }; -const API_ENDPOINT = 'https://example.com'; +const API_ENDPOINT = 'https://ux.eosusa.io'; const S3_PRODUCER_BUCKET = 'https://telos-producer-validation.s3.amazonaws.com'; const DISPLAY_MAP = false; const THEME = {}; From 0d40d6e6649f36c98976ab9478c6cb8c52f73860 Mon Sep 17 00:00:00 2001 From: Kylan Hurt Date: Tue, 5 Dec 2023 18:39:12 -0300 Subject: [PATCH 03/11] Debounce header search input --- src/components/HeaderSearch.vue | 10 ++++++++-- src/utils/string-utils.ts | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index 1db23b8c..e518833e 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -5,6 +5,7 @@ import { OptionsObj, TableByScope } from 'src/types'; import { api } from 'src/api'; import { isValidTransactionHex } from 'src/utils/string-utils'; import { useQuasar } from 'quasar'; +import { debounce } from 'src/utils/string-utils'; export default defineComponent({ name: 'HeaderSearch', @@ -16,7 +17,8 @@ export default defineComponent({ const options = ref([]); const isLoading = ref(false); - watch(inputValue, async () => { + const fetchData = async () => { + console.log('watching input value change'); if (inputValue.value === '') { options.value = []; return; @@ -34,7 +36,11 @@ export default defineComponent({ }); isLoading.value = false; - }); + }; + + const onInput = debounce(fetchData, 400); + + watch(inputValue, onInput); async function searchAccounts(value: string): Promise { try { diff --git a/src/utils/string-utils.ts b/src/utils/string-utils.ts index 1b8874e2..43324c5a 100644 --- a/src/utils/string-utils.ts +++ b/src/utils/string-utils.ts @@ -110,3 +110,19 @@ export function getRexHistoryAsset(data: RexHistory): string { return data.amount; } } + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const debounce = ReturnType>( + callback: T, + timeout: number, +): ((...args: Parameters) => void) => { + console.log('debouncing'); + let timer: ReturnType; + + return (...args: Parameters) => { + clearTimeout(timer); + timer = setTimeout(() => { + callback(...args); + }, timeout); + }; +}; From da67e86686b1ed2d1f43b27d36b8873f56f141f9 Mon Sep 17 00:00:00 2001 From: Kylan Hurt Date: Tue, 5 Dec 2023 18:48:45 -0300 Subject: [PATCH 04/11] Rename sleep util file and move debounce into it --- src/components/HeaderSearch.vue | 2 +- src/pages/ProposalItem.vue | 2 +- src/utils/sleep.ts | 3 --- src/utils/string-utils.ts | 16 ---------------- src/utils/time.ts | 19 +++++++++++++++++++ 5 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 src/utils/sleep.ts create mode 100644 src/utils/time.ts diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index e518833e..74bd50e2 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -5,7 +5,7 @@ import { OptionsObj, TableByScope } from 'src/types'; import { api } from 'src/api'; import { isValidTransactionHex } from 'src/utils/string-utils'; import { useQuasar } from 'quasar'; -import { debounce } from 'src/utils/string-utils'; +import { debounce } from 'src/utils/time'; export default defineComponent({ name: 'HeaderSearch', diff --git a/src/pages/ProposalItem.vue b/src/pages/ProposalItem.vue index 0098f7ae..77c4c59c 100644 --- a/src/pages/ProposalItem.vue +++ b/src/pages/ProposalItem.vue @@ -10,7 +10,7 @@ import sha256 from 'fast-sha256'; import { ABI, ABIDef, Action, Serializer, Transaction } from '@greymass/eosio'; import { useStore } from 'src/store'; import { deserializeActionDataFromAbi } from 'src/api/eosio_core'; -import { sleep } from 'src/utils/sleep'; +import { sleep } from 'src/utils/time'; export default defineComponent({ name: 'ProposalItem', diff --git a/src/utils/sleep.ts b/src/utils/sleep.ts deleted file mode 100644 index ebca2ae9..00000000 --- a/src/utils/sleep.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function sleep(timeout = 1000): Promise { - return new Promise(r => setTimeout(r, timeout)); -} diff --git a/src/utils/string-utils.ts b/src/utils/string-utils.ts index 43324c5a..1b8874e2 100644 --- a/src/utils/string-utils.ts +++ b/src/utils/string-utils.ts @@ -110,19 +110,3 @@ export function getRexHistoryAsset(data: RexHistory): string { return data.amount; } } - -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const debounce = ReturnType>( - callback: T, - timeout: number, -): ((...args: Parameters) => void) => { - console.log('debouncing'); - let timer: ReturnType; - - return (...args: Parameters) => { - clearTimeout(timer); - timer = setTimeout(() => { - callback(...args); - }, timeout); - }; -}; diff --git a/src/utils/time.ts b/src/utils/time.ts new file mode 100644 index 00000000..9da940df --- /dev/null +++ b/src/utils/time.ts @@ -0,0 +1,19 @@ +export function sleep(timeout = 1000): Promise { + return new Promise(r => setTimeout(r, timeout)); +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const debounce = ReturnType>( + callback: T, + timeout: number, +): ((...args: Parameters) => void) => { + console.log('debouncing'); + let timer: ReturnType; + + return (...args: Parameters) => { + clearTimeout(timer); + timer = setTimeout(() => { + callback(...args); + }, timeout); + }; +}; From cb0f203f82cdca3aad5d9ce116438d33721a01f8 Mon Sep 17 00:00:00 2001 From: Kylan Hurt Date: Tue, 5 Dec 2023 18:52:51 -0300 Subject: [PATCH 05/11] Remove unnecessary console log --- src/components/HeaderSearch.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index 74bd50e2..350ec50a 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -18,7 +18,6 @@ export default defineComponent({ const isLoading = ref(false); const fetchData = async () => { - console.log('watching input value change'); if (inputValue.value === '') { options.value = []; return; From 8ec6da69418a08f258c796a4065d62025a136851 Mon Sep 17 00:00:00 2001 From: Don Date: Tue, 12 Dec 2023 17:11:11 -0600 Subject: [PATCH 06/11] Update src/utils/time.ts --- src/utils/time.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/time.ts b/src/utils/time.ts index 9da940df..8abb8d6a 100644 --- a/src/utils/time.ts +++ b/src/utils/time.ts @@ -7,7 +7,6 @@ export const debounce = ReturnType>( callback: T, timeout: number, ): ((...args: Parameters) => void) => { - console.log('debouncing'); let timer: ReturnType; return (...args: Parameters) => { From 7a0b02c831a1720ca0892ea7ed2a3750b1f041d4 Mon Sep 17 00:00:00 2001 From: Don Date: Tue, 12 Dec 2023 17:11:32 -0600 Subject: [PATCH 07/11] Update src/components/HeaderSearch.vue --- src/components/HeaderSearch.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index 350ec50a..7a2dcaa3 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -37,7 +37,7 @@ export default defineComponent({ isLoading.value = false; }; - const onInput = debounce(fetchData, 400); + const onInput = debounce(fetchData, 100); watch(inputValue, onInput); From 270ce4b447d2b5e5fb8cc93171f5e3766c58babb Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Thu, 14 Dec 2023 13:16:57 -0600 Subject: [PATCH 08/11] fix: abs value of resource result, remove null account from appending search results --- src/components/AccountCard.vue | 8 +++----- src/components/AccountSearch.vue | 8 +++----- src/components/HeaderSearch.vue | 8 +++----- src/components/ProposalAuthorization.vue | 2 +- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/components/AccountCard.vue b/src/components/AccountCard.vue index 4197d445..fcf2d72c 100644 --- a/src/components/AccountCard.vue +++ b/src/components/AccountCard.vue @@ -44,7 +44,6 @@ export default defineComponent({ const createTransaction = ref(''); const creatingAccount = ref(''); const system_account = ref('eosio'); - const system_null = ref('eosio.null'); const isLoading = ref(true); const tokensLoading = ref(true); @@ -178,7 +177,7 @@ export default defineComponent({ const loadResources = () => { let ramDenominator; - if (props.account !== system_account.value && props.account !== system_null.value) { + if (props.account !== system_account.value) { // display max resource unit value for readability const ramMaxNumber = Number(accountData.value.ram_quota); const ramUnitResult = determineUnit(ramMaxNumber); @@ -327,7 +326,7 @@ export default defineComponent({ return total; }; - const fixDec = (val: number): number => parseFloat(val.toFixed(3)); + const fixDec = (val: number): number => Math.abs(parseFloat(val.toFixed(3))); const loadSystemToken = (): void => { if (token.value.symbol === '') { @@ -445,7 +444,6 @@ export default defineComponent({ rexDeposits, none, system_account, - system_null, radius, availableTokens, createTime, @@ -519,7 +517,7 @@ export default defineComponent({ -
+
0) { diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index 7a2dcaa3..b9641e5a 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -53,13 +53,11 @@ export default defineComponent({ }; const accounts = await api.getTableByScope(request); - // because the get table by scope for userres does not include eosio system or null accounts + // get table by scope for userres does not include system account if (value.includes('eosio')) { - accounts.unshift(...[{ + accounts.unshift({ payer: 'eosio', - } as TableByScope, { - payer: 'eosio.null', - } as TableByScope]); + } as TableByScope); } if (accounts.length > 0) { diff --git a/src/components/ProposalAuthorization.vue b/src/components/ProposalAuthorization.vue index ecf798b4..b8c00a91 100644 --- a/src/components/ProposalAuthorization.vue +++ b/src/components/ProposalAuthorization.vue @@ -103,7 +103,7 @@ export default defineComponent({ }); if (accounts.length > 0) { - // because the get table by scope for userres does not include eosio account + // get table by scope for userres does not include system account if ('eosio'.includes(value)) { actorsOptions.value.push('eosio'); } From ca64058f71473fb8c315da5c9a5db8b1f15f7132 Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Thu, 14 Dec 2023 13:22:33 -0600 Subject: [PATCH 09/11] fix: abs val available resource --- src/components/PercentCircle.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PercentCircle.vue b/src/components/PercentCircle.vue index 2c0be842..866c075b 100644 --- a/src/components/PercentCircle.vue +++ b/src/components/PercentCircle.vue @@ -44,7 +44,7 @@ export default defineComponent({ const fractionUnits = computed( () => `${fraction.value}${unit.value}/${total.value}${unit.value}`, ); - const available = computed(() => (total.value - fraction.value).toFixed(3)); + const available = computed(() => Math.abs(total.value - fraction.value).toFixed(3)); const dashArray = computed(() => { if (Number.isNaN(formatResourcePercent.value)) { return '0'; From 020a0c49486b311b1cd3638cc66b89cde2b812d5 Mon Sep 17 00:00:00 2001 From: donnyquixotic Date: Thu, 14 Dec 2023 13:34:33 -0600 Subject: [PATCH 10/11] fix: adjust debounce for header --- src/components/HeaderSearch.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/HeaderSearch.vue b/src/components/HeaderSearch.vue index b9641e5a..c067ce47 100644 --- a/src/components/HeaderSearch.vue +++ b/src/components/HeaderSearch.vue @@ -37,7 +37,7 @@ export default defineComponent({ isLoading.value = false; }; - const onInput = debounce(fetchData, 100); + const onInput = debounce(fetchData, 200); watch(inputValue, onInput); From ed0b9bf32f35c78803b17a56a37754e2c2b07e36 Mon Sep 17 00:00:00 2001 From: Kylan Hurt Date: Wed, 13 Dec 2023 20:18:31 -0300 Subject: [PATCH 11/11] Implement localStorage saving of tx pagination batch size Remove unnecessary console log Remove unnecessary localStorage.removeItem Add useful comments for tx pagination localStorage routine Get transaction table rows per page to defer to url params --- src/components/TransactionsTable.vue | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/components/TransactionsTable.vue b/src/components/TransactionsTable.vue index 302fd245..a6b92163 100644 --- a/src/components/TransactionsTable.vue +++ b/src/components/TransactionsTable.vue @@ -30,6 +30,20 @@ const chain: Chain = getChain(); const TWO_SECONDS = 2000; +const pageSizeOptions = [10, 20, 50, 100, 200]; + +const getStoredRowSetting = () => { + const savedRowsPerPage = localStorage.getItem('txRowsPerPage'); + let rowsPerPageNum = parseInt(savedRowsPerPage); + // if saved value was NOT integer (valid) + if (isNaN(rowsPerPageNum)) { + // then use a valid value and replace invalid value in localStorage + rowsPerPageNum = pageSizeOptions[0]; + localStorage.setItem('txRowsPerPage', rowsPerPageNum.toString()); + } + return rowsPerPageNum; +}; + export default defineComponent({ name: 'TransactionsTable', components: { @@ -73,10 +87,6 @@ export default defineComponent({ setup(props) { const route = useRoute(); const router = useRouter(); - const pagination = computed( - () => (route.query['page'] as string) || '1,10', - ); - const pageSizeOptions = [10, 20, 50, 100, 200]; const { account, actions } = toRefs(props); const columns = [ { @@ -123,17 +133,22 @@ export default defineComponent({ paginationSettings.value.rowsPerPage = size; paginationSettings.value.page = 1; await onPaginationChange({ pagination: paginationSettings.value }); + localStorage.setItem('txRowsPerPage', size.toString()); }; const changePagination = async (page: number, size: number) => { paginationSettings.value.page = page; paginationSettings.value.rowsPerPage = size; await onPaginationChange({ pagination: paginationSettings.value }); }; + + const pagination = computed( + () => (route.query['page'] as string) || `1,${getStoredRowSetting()}`, + ); const paginationSettings = ref({ sortBy: 'timestamp', descending: true, page: 1, - rowsPerPage: pageSizeOptions[0], + rowsPerPage: getStoredRowSetting(), rowsNumber: 10000, }); @@ -454,7 +469,7 @@ export default defineComponent({ async () => { let pageValue = pagination.value; let page = 1; - let size = pageSizeOptions[0]; + let size = getStoredRowSetting(); // we also allow to pass a single number as the page number if (typeof pageValue === 'number') {