From 99863dedbfc514aa83e48f1d0b1c2e72becb35f4 Mon Sep 17 00:00:00 2001 From: Jan Michek <15363559+janmichek@users.noreply.github.com> Date: Mon, 8 Apr 2024 09:38:10 +0200 Subject: [PATCH] feat: Migrate to v3 endpoints pt1 (#703) --- src/components/ContractDetailsPanel.vue | 2 +- src/components/ContractsPanel.vue | 2 +- src/components/KeyblockDetailsPanel.vue | 2 +- src/components/MicroblockDetailsPanel.vue | 2 +- src/components/MicroblockTransactionsPanel.vue | 2 +- src/components/NetworkSelect.vue | 16 ++++++++++------ src/components/OracleDetailsPanel.vue | 2 +- src/components/OracleEventsPanel.vue | 2 +- src/components/OraclesPanel.vue | 2 +- src/components/StateChannelDetailsPanel.vue | 2 +- src/components/TokenSymbolIcon.vue | 4 ++-- src/components/TransactionGeneralPanel.vue | 2 +- src/components/TransactionsPanel.vue | 2 +- src/pages/names/[name].vue | 2 +- src/plugins/sentry.js | 10 +++++----- src/stores/accountDetails.js | 4 ++-- src/stores/blockchainStats.js | 4 ++-- src/stores/contractDetails.js | 4 ++-- src/stores/contracts.js | 2 +- src/stores/dashboardStateChannels.js | 2 +- src/stores/keyblockDetails.js | 8 ++++---- src/stores/microblockDetails.js | 6 +++--- src/stores/nftDetails.js | 6 +++--- src/stores/oracleDetails.js | 6 +++--- src/stores/oracles.js | 4 ++-- src/stores/recentBlocks.js | 8 ++++---- src/stores/stateChannelDetails.js | 7 ++++--- src/stores/stateChannels.js | 2 +- src/stores/status.js | 2 +- src/stores/tokens.js | 7 ++++--- src/stores/transactionDetails.js | 4 ++-- src/stores/transactions.js | 4 ++-- 32 files changed, 70 insertions(+), 64 deletions(-) diff --git a/src/components/ContractDetailsPanel.vue b/src/components/ContractDetailsPanel.vue index 9bae16cad..4345b5c60 100644 --- a/src/components/ContractDetailsPanel.vue +++ b/src/components/ContractDetailsPanel.vue @@ -216,7 +216,7 @@ const contractNodeUrl = computed(() => `${NODE_URL}/v3/contracts/${props.contractDetails.id}`, ) const contractMiddlewareUrl = computed(() => - `${MIDDLEWARE_URL}/v2/contracts/${props.contractDetails.id}`, + `${MIDDLEWARE_URL}/v3/contracts/${props.contractDetails.id}`, ) diff --git a/src/components/ContractsPanel.vue b/src/components/ContractsPanel.vue index 1655401f8..337ab639b 100644 --- a/src/components/ContractsPanel.vue +++ b/src/components/ContractsPanel.vue @@ -43,7 +43,7 @@ const loadNextContracts = () => { } const loadContracts = () => { - fetchContracts(`/v2/txs?type=contract_create&limit=${limit.value}`) + fetchContracts(`/v3/transactions?type=contract_create&limit=${limit.value}`) fetchContractsCount() pageIndex.value = 1 } diff --git a/src/components/KeyblockDetailsPanel.vue b/src/components/KeyblockDetailsPanel.vue index 6ce58ced8..f939ef42f 100644 --- a/src/components/KeyblockDetailsPanel.vue +++ b/src/components/KeyblockDetailsPanel.vue @@ -194,7 +194,7 @@ const keyblockNodeUrl = computed(() => `${NODE_URL}/v3/key-blocks/hash/${props.keyblockDetails.hash}`, ) const keyblockMiddlewareUrl = computed(() => - `${MIDDLEWARE_URL}/v2/key-blocks/${props.keyblockDetails.hash}`, + `${MIDDLEWARE_URL}/v3/key-blocks/${props.keyblockDetails.hash}`, ) const isNextKeyblockMined = computed(() => props.keyblockDetails.height < latestBlockHeight.value, diff --git a/src/components/MicroblockDetailsPanel.vue b/src/components/MicroblockDetailsPanel.vue index ef162cf1b..2491d9f8b 100644 --- a/src/components/MicroblockDetailsPanel.vue +++ b/src/components/MicroblockDetailsPanel.vue @@ -122,7 +122,7 @@ const microblockNodeUrl = computed(() => `${NODE_URL}/v3/micro-blocks/hash/${props.microblockDetails.hash}/header`, ) const microblockMiddlewareUrl = computed(() => - `${MIDDLEWARE_URL}/v2/micro-blocks/${props.microblockDetails.hash}`, + `${MIDDLEWARE_URL}/v3/micro-blocks/${props.microblockDetails.hash}`, ) diff --git a/src/components/MicroblockTransactionsPanel.vue b/src/components/MicroblockTransactionsPanel.vue index a70f6cf95..334e473ab 100644 --- a/src/components/MicroblockTransactionsPanel.vue +++ b/src/components/MicroblockTransactionsPanel.vue @@ -48,7 +48,7 @@ async function loadTransactions() { const { txType } = route.query const txTypeOption = TX_TYPES_OPTIONS.find(option => option.typeQuery === txType) selectedTxType.value = txTypeOption || TX_TYPES_OPTIONS[0] - await fetchMicroblockTransactions({ queryParameters: `/v2/micro-blocks/${route.params.id}/txs/?limit=${limit.value}${selectedTxType.value.typeQuery ? '&type=' + selectedTxType.value.typeQuery : ''}` }) + await fetchMicroblockTransactions({ queryParameters: `/v3/micro-blocks/${route.params.id}/transactions/?limit=${limit.value}${selectedTxType.value.typeQuery ? '&type=' + selectedTxType.value.typeQuery : ''}` }) pageIndex.value = 1 } diff --git a/src/components/NetworkSelect.vue b/src/components/NetworkSelect.vue index d16af3312..5949ac7ad 100644 --- a/src/components/NetworkSelect.vue +++ b/src/components/NetworkSelect.vue @@ -16,23 +16,27 @@ import { computed, ref } from 'vue' import { useRuntimeConfig } from 'nuxt/app' import AppSelect from '@/components/AppSelect' -const config = useRuntimeConfig() +const { + NETWORK_NAME, + ALTERNATIVE_NETWORK_NAME, + ALTERNATIVE_NETWORK_URL, +} = useRuntimeConfig().public const selectedNetwork = ref({ - name: config.public.NETWORK_NAME, + name: NETWORK_NAME, }) const networks = ref([ { - name: config.public.NETWORK_NAME, + name: NETWORK_NAME, url: null, }, { - name: config.public.ALTERNATIVE_NETWORK_NAME, - url: config.public.ALTERNATIVE_NETWORK_URL, + name: ALTERNATIVE_NETWORK_NAME, + url: ALTERNATIVE_NETWORK_URL, }, ]) -const hasAlternativeNetwork = computed(() => !!config.public.ALTERNATIVE_NETWORK_URL) +const hasAlternativeNetwork = computed(() => !!ALTERNATIVE_NETWORK_URL) const navigate = selectedOption => window.location.replace(selectedOption.url) diff --git a/src/components/OracleDetailsPanel.vue b/src/components/OracleDetailsPanel.vue index 12183b453..631040154 100644 --- a/src/components/OracleDetailsPanel.vue +++ b/src/components/OracleDetailsPanel.vue @@ -199,7 +199,7 @@ const oracleNodeUrl = computed(() => ) const oracleMiddlewareUrl = computed(() => - `${MIDDLEWARE_URL}/v2/oracles/${props.oracleDetails.id}`, + `${MIDDLEWARE_URL}/v3/oracles/${props.oracleDetails.id}`, ) diff --git a/src/components/OracleEventsPanel.vue b/src/components/OracleEventsPanel.vue index e82be590d..77dc0ba65 100644 --- a/src/components/OracleEventsPanel.vue +++ b/src/components/OracleEventsPanel.vue @@ -40,7 +40,7 @@ function loadNextEvents() { if (process.client) { const limit = computed(() => isDesktop() ? 10 : 3) - fetchOracleEvents(`/v2/oracles/${route.params.id}/responses?limit=${limit.value}`) + fetchOracleEvents(`/v3/oracles/${route.params.id}/responses?limit=${limit.value}`) } diff --git a/src/components/OraclesPanel.vue b/src/components/OraclesPanel.vue index c8223d61f..3de56b349 100644 --- a/src/components/OraclesPanel.vue +++ b/src/components/OraclesPanel.vue @@ -48,7 +48,7 @@ async function loadOracles() { const { state } = route.query const oracleStateOption = ORACLE_STATES_OPTIONS.find(option => option.stateQuery === state) selectedOracleState.value = oracleStateOption || ORACLE_STATES_OPTIONS[0] - await fetchOracles(`/v2/oracles?limit=${limit.value}${selectedOracleState.value.stateQuery ? '&state=' + selectedOracleState.value.stateQuery : ''}`) + await fetchOracles(`/v3/oracles?limit=${limit.value}${selectedOracleState.value.stateQuery ? '&state=' + selectedOracleState.value.stateQuery : ''}`) await fetchOraclesCount() pageIndex.value = 1 } diff --git a/src/components/StateChannelDetailsPanel.vue b/src/components/StateChannelDetailsPanel.vue index 4e2db552c..92302b689 100644 --- a/src/components/StateChannelDetailsPanel.vue +++ b/src/components/StateChannelDetailsPanel.vue @@ -201,7 +201,7 @@ const props = defineProps({ }, }) -const stateChannelMiddlewareUrl = `${MIDDLEWARE_URL}/v2/channels/${props.stateChannelDetails.id}` +const stateChannelMiddlewareUrl = `${MIDDLEWARE_URL}/v3/channels/${props.stateChannelDetails.id}`