Skip to content

Commit

Permalink
feat: Migrate to v3 part (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
janmichek authored Sep 13, 2024
1 parent 1f6a363 commit 49fbb43
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/components/TokenEventsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import TokenEventsTable from '@/components/TokenEventsTable.vue'
import TokenEventsTableCondensed from '@/components/TokenEventsTableCondensed.vue'
const { tokenEvents, tokenEventsCount } = storeToRefs(useTokenDetailsStore())
const { fetchTokenEvents, fetchTokenEventsCount } = useTokenDetailsStore()
const { fetchTokenEvents } = useTokenDetailsStore()
const route = useRoute()
function loadPrevEvents() {
Expand All @@ -36,8 +36,6 @@ function loadNextEvents() {
fetchTokenEvents({ queryParameters: tokenEvents.value.next })
}
await fetchTokenEventsCount(route.params.id)
if (process.client) {
const limit = computed(() => isDesktop() ? 10 : 3)
await fetchTokenEvents({
Expand Down
2 changes: 1 addition & 1 deletion src/stores/accountDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const useAccountStore = defineStore('account', () => {

async function fetchAccountTokens({ accountId, queryParameters, limit } = {}) {
rawAccountTokens.value = null
const defaultParameters = `/v2/aex9/account-balances/${accountId}?limit=${limit ?? 10}`
const defaultParameters = `/v3/accounts/${accountId}/aex9/balances?limit=${limit ?? 10}`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawAccountTokens.value = data

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

async function fetchNftOwners({ queryParameters, limit } = {}) {
nftOwners.value = null
const defaultParameters = `/v2/aex141/${nftId.value}/owners?limit=${limit ?? 10}`
const defaultParameters = `/v3/aex141/${nftId.value}/tokens?limit=${limit ?? 10}`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
nftOwners.value = data
}

async function fetchNftTransfers({ queryParameters, limit } = {}) {
rawNftTransfers.value = null
const defaultParameters = `/v2/aex141/transfers/${nftId.value}?limit=${limit ?? 10}`
const defaultParameters = `/v3/aex141/${nftId.value}/transfers?limit=${limit ?? 10}`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawNftTransfers.value = data
}
Expand Down
10 changes: 2 additions & 8 deletions src/stores/tokenDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const useTokenDetailsStore = defineStore('tokenDetails', () => {
async function fetchToken() {
const { data } = await axios.get(`${MIDDLEWARE_URL}/v3/aex9/${tokenId.value}`)
rawToken.value = data
tokenEventsCount.value = data.logsCount
}

async function fetchTotalSupply() {
Expand All @@ -84,11 +85,6 @@ export const useTokenDetailsStore = defineStore('tokenDetails', () => {
rawTokenEvents.value = data
}

async function fetchTokenEventsCount(contractId) {
const { data } = await axios.get(`${MIDDLEWARE_URL}/v2/aex9/${contractId}/logs-count`)
tokenEventsCount.value = data.data
}

async function fetchTokenHolders({ queryParameters, limit } = {}) {
rawTokenHolders.value = null
const defaultParameters = `/v3/aex9/${tokenId.value}/balances?by=amount&limit=${limit ?? 10}`
Expand All @@ -100,11 +96,9 @@ export const useTokenDetailsStore = defineStore('tokenDetails', () => {
fetchTokenDetails,
fetchTokenHolders,
fetchTokenEvents,
fetchTokenEventsCount,
tokenDetails,
tokenHolders,
tokenEvents,
tokenEventsCount,
}
},
)
})

0 comments on commit 49fbb43

Please sign in to comment.