@visualizevalue/mint-app-base 0.1.45 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,11 @@
18
18
  @click="() => login(connector)"
19
19
  class="choose-connector-button"
20
20
  >
21
- <img v-if="ICONS[connector.name]" :src="connector.icon || `/icons/wallets/${ICONS[connector.name]}`" alt="">
21
+ <img
22
+ v-if="ICONS[connector.name]"
23
+ :src="connector.icon || `${base}icons/wallets/${ICONS[connector.name]}`"
24
+ :alt="connector.name"
25
+ >
22
26
  {{ connector.name }}
23
27
  </Button>
24
28
  </div>
@@ -38,6 +42,7 @@ const ICONS = {
38
42
 
39
43
  const props = defineProps(['class'])
40
44
  const emit = defineEmits(['connected', 'disconnected'])
45
+ const base = useBaseURL()
41
46
 
42
47
  const chainId = useChainId()
43
48
  const { connectors, connect } = useConnect()
@@ -55,24 +55,6 @@ const mintedAtBlock = computed(() => token.untilBlock - MINT_BLOCKS)
55
55
  const backfillComplete = computed(() => token.mintsBackfilledUntilBlock <= mintedAtBlock.value)
56
56
 
57
57
  const loading = ref(true)
58
- onMounted(async () => {
59
- loading.value = true
60
- try {
61
- console.info(`Attempting to load + backfill token mints for #${token.tokenId}`)
62
- await state.fetchTokenMints(token)
63
- await state.backfillTokenMints(token)
64
- } catch (e) {
65
- console.error(e)
66
- }
67
- loading.value = false
68
- })
69
-
70
- watch(currentBlock, () => {
71
- if (loading.value) return
72
-
73
- state.fetchTokenMints(token)
74
- })
75
-
76
58
  const loadMore = ref()
77
59
  const loadMoreVisible = useElementVisibility(loadMore)
78
60
  const backfill = async () => {
@@ -81,9 +63,11 @@ const backfill = async () => {
81
63
  try {
82
64
  await state.backfillTokenMints(token)
83
65
 
84
- if (loadMoreVisible.value) {
85
- await delay(300)
86
- await backfill()
66
+ // If we're not fully backfilled and we have less than 20 mints loaded,
67
+ // continue backfilling events.
68
+ while (! backfillComplete.value && mints.value?.length < 20) {
69
+ await delay(250)
70
+ await state.backfillTokenMints(token)
87
71
  }
88
72
  } catch (e) {
89
73
  console.error(`Issue during backfill`, e)
@@ -91,12 +75,31 @@ const backfill = async () => {
91
75
 
92
76
  loading.value = false
93
77
  }
78
+
79
+ onMounted(async () => {
80
+ loading.value = true
81
+ try {
82
+ console.info(`Attempting to load + backfill token mints for #${token.tokenId}`)
83
+ await state.fetchTokenMints(token)
84
+ await backfill()
85
+ } catch (e) {
86
+ console.error(e)
87
+ }
88
+ loading.value = false
89
+ })
90
+
94
91
  watch(loadMoreVisible, () => {
95
92
  // Skip if we have enough mints for the viewport or we're already loading
96
93
  if (! loadMoreVisible.value || loading.value) return
97
94
 
98
95
  backfill()
99
96
  })
97
+
98
+ watch(currentBlock, () => {
99
+ if (loading.value) return
100
+
101
+ state.fetchTokenMints(token)
102
+ })
100
103
  </script>
101
104
 
102
105
  <style scoped>
@@ -0,0 +1,7 @@
1
+ export const useBaseURL = () => {
2
+ const config = useRuntimeConfig()
3
+
4
+ return config.app.baseURL.endsWith('/')
5
+ ? config.app.baseURL
6
+ : config.app.baseURL + '/'
7
+ }
@@ -4,7 +4,7 @@ import { parseAbiItem, type PublicClient } from 'viem'
4
4
  import type { MintEvent } from '~/utils/types'
5
5
 
6
6
  export const CURRENT_STATE_VERSION = 4
7
- export const MAX_BLOCK_RANGE = 1000n
7
+ export const MAX_BLOCK_RANGE = 1800n
8
8
  export const MINT_BLOCKS = BLOCKS_PER_DAY
9
9
 
10
10
  export const useOnchainStore = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visualizevalue/mint-app-base",
3
- "version": "0.1.45",
3
+ "version": "0.1.47",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "dependencies": {
@@ -53,7 +53,9 @@
53
53
  <div class="card">
54
54
  <div>
55
55
  <FormSelectFile @change="setImage" />
56
- <p v-if="! isSmall" class="muted"><small>Note: This should be a small file, prefferably a simple SVG like <a href="/example-contract-icon.svg" target="_blank">this one (273 bytes)</a>. Try to make it less than 10kb.</small></p>
56
+ <p v-if="! isSmall" class="muted">
57
+ <small>Note: This should be a small file, prefferably a simple SVG like <a :href="`${base}example-contract-icon.svg`" target="_blank">this one (273 bytes)</a>. Try to make it less than 10kb.</small>
58
+ </p>
57
59
  </div>
58
60
  <FormGroup>
59
61
  <FormInput v-model="title" placeholder="Title" required class="title" />
@@ -77,6 +79,7 @@
77
79
 
78
80
  <script setup>
79
81
  const config = useRuntimeConfig()
82
+ const base = useBaseURL()
80
83
  const store = useOnchainStore()
81
84
  const chainId = useMainChainId()
82
85