Skip to content

Commit

Permalink
remove variable limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
janmichek committed Feb 11, 2025
1 parent cd668d8 commit 0877711
Show file tree
Hide file tree
Showing 32 changed files with 68 additions and 82 deletions.
2 changes: 0 additions & 2 deletions src/components/AccountTransactionsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<paginated-content
v-model:page-index="pageIndex"
:entities="accountTransactions"

pagination-style="history"
@prev-clicked="loadPrevTransactions"
@next-clicked="loadNextTransactions">
Expand All @@ -29,7 +28,6 @@ const pageIndex = ref(1)
watch(selectedTxType, () => {
fetchAccountTransactions({
accountId: route.params.id,
limit: 10,
type: selectedTxType.value.typeQuery,
})
pageIndex.value = 1
Expand Down
4 changes: 1 addition & 3 deletions src/components/ContractCallTransactionsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const loadNextTransactions = () => {
}
if (process.client) {
fetchContractCallTransactions({
limit: 10,
})
fetchContractCallTransactions()
}
</script>
4 changes: 1 addition & 3 deletions src/components/DexTradesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ function loadNextEvents() {
}
if (process.client) {
await fetchDexTrades({
limit: 10,
})
await fetchDexTrades()
}
</script>
2 changes: 1 addition & 1 deletion src/components/KeyblockMicroblocksPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const route = useRoute()
if (process.client) {
fetchKeyblockMicroblocks({
limit: 10,
keyblockHash: route.params.id,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/KeyblocksPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function loadNextKeyblocks() {
}
if (process.client) {
fetchKeyblocks({ limit: 10 })
fetchKeyblocks()
}
</script>
2 changes: 1 addition & 1 deletion src/components/NftInventoryPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function loadNextNftInventory() {
}
if (process.client) {
await fetchNftInventory({ limit: 10 })
await fetchNftInventory()
}
</script>

Expand Down
1 change: 1 addition & 0 deletions src/components/PaginatedContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const props = defineProps({
type: [Number, null],
default: null,
},
// todo adjust
limit: {
type: Number,
default: 10,
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchNamesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { fetchNamesResults } = useSearchStore()
const route = useRoute()
await fetchNamesResults({ query: route.params.id, limit: 10 })
await fetchNamesResults({ query: route.params.id })
async function loadPrevNames() {
await fetchNamesResults({ queryParameters: namesResults.value.prev })
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchNftsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const { fetchNftsResults } = useSearchStore()
const route = useRoute()
await fetchNftsResults({ query: route.params.id, limit: 10 })
await fetchNftsResults({ query: route.params.id })
async function loadPrevNfts() {
await fetchNftsResults({ queryParameters: nftsResults.value.prev })
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchTokensPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { fetchTokenResults } = useSearchStore()
const route = useRoute()
await fetchTokenResults({ query: route.params.id, limit: 10 })
await fetchTokenResults({ query: route.params.id })
async function loadPrevTokens() {
await fetchTokenResults({ queryParameters: tokensResults.value.prev })
Expand Down
4 changes: 1 addition & 3 deletions src/components/StateChannelTransactionsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ const loadNextTransactions = () => {
}
if (process.client) {
fetchStateChannelTransactions({
limit: 10,
})
fetchStateChannelTransactions()
}
</script>
2 changes: 1 addition & 1 deletion src/components/StateChannelsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function loadNextStateChannels() {
}
async function loadStateChannels() {
await fetchStateChannels({ limit: 10 })
await fetchStateChannels()
pageIndex.value = 1
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TheNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ onBeforeUnmount(() => {
const isDesktopResolution = ref(null)
function updateIsDesktopResolution() {
isDesktopResolution.value = isDesktop()
isDesktopResolution.value = window.innerWidth >= 1280
}
</script>

Expand Down
1 change: 0 additions & 1 deletion src/components/TokenEventsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ function loadNextEvents() {
if (process.client) {
await fetchTokenEvents({
limit: 10,
contractId: route.params.id,
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TokenHoldersPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function loadNextHolders() {
}
if (process.client) {
fetchTokenHolders({ limit: 10 })
fetchTokenHolders()
fetchTokenHoldersCount()
}
</script>
1 change: 0 additions & 1 deletion src/components/TokenTradesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function loadNextTrades() {
if (process.client) {
await fetchTokenTrades({
contractId: route.params.id,
limit: 10,
})
}
</script>
3 changes: 1 addition & 2 deletions src/components/WalletAccountPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const activeTabIndex = computed({
})
if (process.client) {
const limit = 10
watch(address, () => fetchAccount(address.value, { limit }), { immediate: true })
watch(address, () => fetchAccount(address.value), { immediate: true })
}
</script>
Expand Down
26 changes: 13 additions & 13 deletions src/composables/accountDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@ export const useAccountStore = defineStore('account', () => {
: null,
)

async function fetchAccount(accountId, { limit } = {}) {
async function fetchAccount(accountId = {}) {
await Promise.all([
fetchAccountDetails(accountId),

Promise.allSettled([
fetchAccountTokens({ accountId, limit }),
fetchAccountTransactions({ accountId, limit }),
fetchAccountTokens({ accountId }),
fetchAccountTransactions({ accountId }),
fetchTotalAccountTransactionsCount(accountId),
fetchAccountNames({ accountId, limit }),
fetchAccountActivities({ accountId, limit }),
fetchAccountNames({ accountId }),
fetchAccountActivities({ accountId }),
]),
])
return true
Expand Down Expand Up @@ -99,16 +99,16 @@ export const useAccountStore = defineStore('account', () => {
totalAccountTransactionsCount.value = data
}

async function fetchAccountNames({ accountId, queryParameters, limit } = {}) {
async function fetchAccountNames({ accountId, queryParameters } = {}) {
rawAccountNames.value = null
const defaultParameters = `/names?owned_by=${accountId}&by=name&direction=forward&state=active&limit=${limit ?? 10}`
const defaultParameters = `/names?owned_by=${accountId}&by=name&direction=forward&state=active&limit=10`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawAccountNames.value = data
}

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

Expand All @@ -133,14 +133,14 @@ export const useAccountStore = defineStore('account', () => {
)
}

async function fetchAccountActivities({ accountId, limit, queryParameters } = {}) {
async function fetchAccountActivities({ accountId, queryParameters } = {}) {
rawAccountActivities.value = null
const defaultParameters = `/accounts/${accountId}/activities?limit=${limit ?? 10}`
const defaultParameters = `/accounts/${accountId}/activities?limit=10`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawAccountActivities.value = data
}

async function fetchAccountTransactions({ accountId, type, limit, queryParameters } = {}) {
async function fetchAccountTransactions({ accountId, type, queryParameters } = {}) {
rawAccountTransactions.value = null

if (queryParameters) {
Expand All @@ -151,7 +151,7 @@ export const useAccountStore = defineStore('account', () => {

const transactionsUrl = new URL(`${MIDDLEWARE_URL}/transactions`)
transactionsUrl.searchParams.append('direction', 'backward')
transactionsUrl.searchParams.append('limit', limit ?? 10)
transactionsUrl.searchParams.append('limit', 10)

if (accountId) {
transactionsUrl.searchParams.append('sender_id', accountId)
Expand Down
4 changes: 2 additions & 2 deletions src/composables/contractDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const useContractDetailsStore = defineStore('contractDetails', () => {
rawContractEvents.value = data
}

async function fetchContractCallTransactions({ limit, queryParameters } = {}) {
async function fetchContractCallTransactions({ queryParameters } = {}) {
rawContractCallTransactions.value = null

if (queryParameters) {
Expand All @@ -105,7 +105,7 @@ export const useContractDetailsStore = defineStore('contractDetails', () => {

const transactionsUrl = new URL(`${MIDDLEWARE_URL}/transactions`)
transactionsUrl.searchParams.append('direction', 'backward')
transactionsUrl.searchParams.append('limit', limit ?? 10)
transactionsUrl.searchParams.append('limit', 10)
transactionsUrl.searchParams.append('type', 'contract_call')
transactionsUrl.searchParams.append('contract', contractId.value)

Expand Down
5 changes: 3 additions & 2 deletions src/composables/dexTrades.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export const useDexTradesStore = defineStore('dexTrades', () => {
: null,
)

async function fetchDexTrades({ queryParameters, limit } = {}) {
// todo simplify queryparams
async function fetchDexTrades({ queryParameters } = {}) {
rawTrades.value = null
const defaultParameters = `/dex/swaps?limit=${limit ?? 10}`
const defaultParameters = '/dex/swaps?limit=10'
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawTrades.value = data
}
Expand Down
4 changes: 2 additions & 2 deletions src/composables/keyblockDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ export const useKeyblockDetailsStore = defineStore('keyblockDetails', () => {
}
}

async function fetchKeyblockMicroblocks({ queryParameters, limit, keyblockHash } = {}) {
async function fetchKeyblockMicroblocks({ queryParameters, keyblockHash } = {}) {
rawKeyblockMicroblocks.value = null
const defaultParameters = `/key-blocks/${keyblockHash}/micro-blocks?limit=${limit ?? 10}`
const defaultParameters = `/key-blocks/${keyblockHash}/micro-blocks?limit=10`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawKeyblockMicroblocks.value = data
}
Expand Down
4 changes: 2 additions & 2 deletions src/composables/keyblocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const useKeyblockStore = defineStore('keyblocks', () => {
: null
})

async function fetchKeyblocks({ queryParameters, limit } = {}) {
async function fetchKeyblocks({ queryParameters } = {}) {
rawKeyblocks.value = null
const defaultParameters = `/key-blocks?limit=${limit ?? 10}`
const defaultParameters = '/key-blocks?limit=10'
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawKeyblocks.value = data
keyblocksCount.value = data.data[0].height
Expand Down
2 changes: 1 addition & 1 deletion src/composables/microblockDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useMicroblockDetailsStore = defineStore('microblockDetails', () =>

async function fetchMicroblockTransactions({ queryParameters, limit, microblockHash } = {}) {
rawMicroblockTransactions.value = null
const defaultParameters = `/micro-blocks/${microblockHash}/transactions?limit=${limit ?? 10}`
const defaultParameters = `/micro-blocks/${microblockHash}/transactions?limit=10`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawMicroblockTransactions.value = data
}
Expand Down
20 changes: 10 additions & 10 deletions src/composables/names.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,34 @@ export const useNamesStore = defineStore('names', () => {
: null
})

function fetchNamesDetails({ limit }) {
function fetchNamesDetails(limit) {
return Promise.all([
fetchActiveNames({ limit }),
fetchInAuctionNames({ limit }),
fetchExpiredNames({ limit }),
fetchActiveNames(),
fetchInAuctionNames(),
fetchExpiredNames(),
])
}

async function fetchActiveNames({ queryParameters, limit } = {}) {
async function fetchActiveNames({ queryParameters } = {}) {
rawActiveNames.value = null
const { data } = await axios.get(
`${MIDDLEWARE_URL}${queryParameters || `/names?state=active&by=deactivation&direction=forward&limit=${limit ?? 10}`}`,
`${MIDDLEWARE_URL}${queryParameters || '/names?state=active&by=deactivation&direction=forward&limit=10'}`,
)
rawActiveNames.value = data
}

async function fetchInAuctionNames({ queryParameters, limit } = {}) {
async function fetchInAuctionNames({ queryParameters } = {}) {
rawInAuctionNames.value = null
const { data } = await axios.get(
`${MIDDLEWARE_URL}${queryParameters || `/names/auctions?by=expiration&direction=forward&limit=${limit ?? 10}`}`,
`${MIDDLEWARE_URL}${queryParameters || '/names/auctions?by=expiration&direction=forward&limit=10'}`,
)
rawInAuctionNames.value = data
}

async function fetchExpiredNames({ queryParameters, limit } = {}) {
async function fetchExpiredNames({ queryParameters } = {}) {
rawExpiredNames.value = null
const { data } = await axios.get(
`${MIDDLEWARE_URL}${queryParameters || `/names?state=inactive&limit=${limit ?? 10}`}`,
`${MIDDLEWARE_URL}${queryParameters || '/names?state=inactive&limit=10'}`,
)
rawExpiredNames.value = data
}
Expand Down
12 changes: 6 additions & 6 deletions src/composables/nftDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ export const useNftDetailsStore = defineStore('nftDetails', () => {
rawNftDetails.value = data
}

async function fetchNftInventory({ queryParameters, limit } = {}) {
async function fetchNftInventory({ queryParameters } = {}) {
nftInventory.value = null
const defaultParameters = `/aex141/${nftId.value}/templates?limit=${limit ?? 10}`
const defaultParameters = `/aex141/${nftId.value}/templates?limit=10`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
nftInventory.value = data
}

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

async function fetchNftTransfers({ queryParameters, limit } = {}) {
async function fetchNftTransfers({ queryParameters } = {}) {
rawNftTransfers.value = null
const defaultParameters = `/aex141/${nftId.value}/transfers?limit=${limit ?? 10}`
const defaultParameters = `/aex141/${nftId.value}/transfers?limit=10`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
rawNftTransfers.value = data
}
Expand Down
8 changes: 4 additions & 4 deletions src/composables/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ export const useSearchStore = defineStore('search', () => {
const tokensResults = ref([])
const nftsResults = ref([])

async function fetchNamesResults({ query, limit, queryParameters } = {}) {
async function fetchNamesResults({ query, queryParameters } = {}) {
namesResults.value = null
const defaultParameters = `/names?prefix=${query}&limit=${limit ?? 10}&by=name`
const defaultParameters = `/names?prefix=${query}&limit=10&by=name`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
namesResults.value = data
}

async function fetchTokenResults({ query, limit, queryParameters } = {}) {
tokensResults.value = null
const defaultParameters = `/aex9?prefix=${query}&limit=${limit ?? 10}&direction=forward`
const defaultParameters = `/aex9?prefix=${query}&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 = `/aex141?prefix=${query}&limit=${limit ?? 10}&direction=forward`
const defaultParameters = `/aex141?prefix=${query}&limit=10&direction=forward`
const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || defaultParameters}`)
nftsResults.value = data
}
Expand Down
Loading

0 comments on commit 0877711

Please sign in to comment.