Skip to content

Commit

Permalink
feat: Migrate to v3 endpoints another part (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmichek authored Jul 15, 2024
1 parent 5b77b20 commit 34385b9
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/components/NftsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function loadNextNfts() {
}
if (process.client) {
await fetchNfts({ queryParameters: `/v2/aex141?limit=${limit.value}&direction=backward&by=creation` })
await fetchNfts({ queryParameters: `/v3/aex141?limit=${limit.value}&direction=backward&by=creation` })
}
</script>
2 changes: 1 addition & 1 deletion src/components/TokenDetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const props = defineProps({
})
const tokenMiddlewareUrl = computed(() =>
`${config.MIDDLEWARE_URL}/v2/aex9/${props.tokenDetails.contractId}`,
`${config.MIDDLEWARE_URL}/v3/aex9/${props.tokenDetails.contractId}`,
)
const tokenDexUrl = computed(() =>
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokensPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ await useAsyncData(async() => {
if (process.client) {
watch(selectedTokenName, async() => {
pageIndex.value = 1
await fetchTokens(`/v2/aex9?by=name&direction=forward&limit=${limit.value}`)
await fetchTokens(`/v3/aex9?by=name&direction=forward&limit=${limit.value}`)
}, {
immediate: true,
})
Expand Down
2 changes: 1 addition & 1 deletion src/pages/contracts/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if (error.value) {
if (process.client && !error.value) {
const limit = isDesktop() ? 10 : 3
await useAsyncData(() => fetchContractEvents({
queryParameters: `/v2/contracts/logs?contract_id=${route.params.id}&limit=${limit}&aexn-args=true`,
queryParameters: `/v3/contracts/logs?contract_id=${route.params.id}&limit=${limit}&aexn-args=true`,
}))
await fetchVerificationDetail(route.params.id)
}
Expand Down
6 changes: 3 additions & 3 deletions src/stores/contractDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const useContractDetailsStore = defineStore('contractDetails', () => {

async function fetchContractEvents({ queryParameters = null }) {
rawContractEvents.value = null
const defaultParameters = `/v2/contracts/logs?contract_id=${contractId.value}&aexn-args=true`
const defaultParameters = `/v3/contracts/logs?contract_id=${contractId.value}&aexn-args=true`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawContractEvents.value = data
}
Expand All @@ -117,12 +117,12 @@ export const useContractDetailsStore = defineStore('contractDetails', () => {
}

async function fetchIsContractAex9() {
tokenDetails.value = (await axios.get(`${MIDDLEWARE_URL}/v2/aex9/${contractId.value}`)).data
tokenDetails.value = (await axios.get(`${MIDDLEWARE_URL}/v3/aex9/${contractId.value}`)).data
contractType.value = 'AEX-9'
}

async function fetchIsContractAex141() {
tokenDetails.value = (await axios.get(`${MIDDLEWARE_URL}/v2/aex141/${contractId.value}`)).data
tokenDetails.value = (await axios.get(`${MIDDLEWARE_URL}/v3/aex141/${contractId.value}`)).data
contractType.value = 'AEX-141'
}

Expand Down
4 changes: 2 additions & 2 deletions src/stores/nfts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useNftsStore = defineStore('nfts', () => {

async function fetchNftsList({ queryParameters, limit } = {}) {
nfts.value = null
const defaultParameters = `/v2/aex141?limit=${limit || 10}&direction=backward&by=creation`
const defaultParameters = `/v3/aex141?limit=${limit || 10}&direction=backward&by=creation`
const { data } = await axios.get(
`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`,
)
Expand All @@ -27,7 +27,7 @@ export const useNftsStore = defineStore('nfts', () => {

async function fetchNftsCount() {
nftsCount.value = null
const { data } = await axios.get(`${MIDDLEWARE_URL}/v2/aex141/count`)
const { data } = await axios.get(`${MIDDLEWARE_URL}/v3/aex141/count`)
nftsCount.value = data.data
}

Expand Down
4 changes: 2 additions & 2 deletions src/stores/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const useSearchStore = defineStore('search', () => {

async function fetchTokenResults({ query, limit, queryParameters } = {}) {
tokensResults.value = null
const defaultParameters = `/v2/aex9?prefix=${query}&limit=${limit ?? 10}&direction=forward`
const defaultParameters = `/v3/aex9?prefix=${query}&limit=${limit ?? 10}&direction=forward`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
tokensResults.value = data
}

async function fetchNftsResults({ query, limit, queryParameters } = {}) {
nftsResults.value = null
const defaultParameters = `/v2/aex141?prefix=${query}&limit=${limit ?? 10}&direction=forward`
const defaultParameters = `/v3/aex141?prefix=${query}&limit=${limit ?? 10}&direction=forward`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
nftsResults.value = data
}
Expand Down
6 changes: 3 additions & 3 deletions src/stores/tokenDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const useTokenDetailsStore = defineStore('tokenDetails', () => {
}

async function fetchToken() {
const { data } = await axios.get(`${MIDDLEWARE_URL}/v2/aex9/${tokenId.value}`)
const { data } = await axios.get(`${MIDDLEWARE_URL}/v3/aex9/${tokenId.value}`)
rawToken.value = data
}

Expand All @@ -79,7 +79,7 @@ export const useTokenDetailsStore = defineStore('tokenDetails', () => {

async function fetchTokenEvents({ queryParameters, limit, contractId } = {}) {
rawTokenEvents.value = null
const defaultParameters = `/v2/contracts/logs?contract=${contractId}&aexn-args=true&limit=${limit ?? 10}`
const defaultParameters = `/v3/contracts/logs?contract=${contractId}&aexn-args=true&limit=${limit ?? 10}`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawTokenEvents.value = data
}
Expand All @@ -91,7 +91,7 @@ export const useTokenDetailsStore = defineStore('tokenDetails', () => {

async function fetchTokenHolders({ queryParameters, limit } = {}) {
rawTokenHolders.value = null
const defaultParameters = `/v2/aex9/${tokenId.value}/balances?by=amount&limit=${limit ?? 10}`
const defaultParameters = `/v3/aex9/${tokenId.value}/balances?by=amount&limit=${limit ?? 10}`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawTokenHolders.value = data
}
Expand Down
4 changes: 2 additions & 2 deletions src/stores/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const useTokensStore = defineStore('tokens', () => {

async function fetchAllTokens(queryParameters = null) {
allTokens.value = null
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || '/v2/aex9?by=name&direction=forward'}`)
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || '/v3/aex9?by=name&direction=forward'}`)
allTokens.value = data
}

Expand All @@ -45,7 +45,7 @@ export const useTokensStore = defineStore('tokens', () => {
}

async function fetchTokensCount() {
const { data } = await axios.get(`${MIDDLEWARE_URL}/v2/aex9/count`)
const { data } = await axios.get(`${MIDDLEWARE_URL}/v3/aex9/count`)
allTokensCount.value = data.data
}

Expand Down

0 comments on commit 34385b9

Please sign in to comment.