Skip to content

Commit

Permalink
feat: lexon token listing (#434)
Browse files Browse the repository at this point in the history
Co-authored-by: janmichek <jan@janmichek.cz>
  • Loading branch information
michele-franchi and janmichek committed Aug 8, 2023
1 parent 9dce670 commit a1f39df
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 4 deletions.
84 changes: 84 additions & 0 deletions src/assets/laex-token.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions src/components/TokenSymbolIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
<img
v-if="isAe"
alt="æ token"
src="@/assets/ae-token.svg"
class="token-symbol-icon">
src="@/assets/ae-token.svg">

<img
v-else-if="isLaex"
alt="LAEX token"
src="@/assets/laex-token.svg">

<app-identicon
v-else
:id="contractId"
class="token-symbol-icon"/>
:id="contractId"/>
</template>
<script setup>
import { useRuntimeConfig } from 'nuxt/app'
import { LAEX_CONTRACT_ID } from '@/utils/constants'
const config = useRuntimeConfig()
Expand All @@ -22,4 +27,6 @@ const props = defineProps({
})
const isAe = computed(() => props.contractId === config.public.AE_TOKEN_ID)
const isLaex = computed(() => props.contractId === LAEX_CONTRACT_ID)
</script>
12 changes: 12 additions & 0 deletions src/utils/adapters.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DateTime } from 'luxon'
import { useRuntimeConfig } from 'nuxt/app'
import { formatAettosToAe, formatBlockDiffAsDatetime, formatDecodeBase64 } from '@/utils/format'
import { MINUTES_PER_BLOCK, SPECIAL_POINTERS_PRESET_KEYS } from '@/utils/constants'

Expand Down Expand Up @@ -401,6 +402,17 @@ export function adaptListedTokens(tokens) {
}
})

const isMainnet = useRuntimeConfig().public.NETWORK_NAME.toLowerCase() === 'mainnet'

if (isMainnet && !formattedData.some(token => token.contractId === LAEX_CONTRACT_ID)) {
formattedData.unshift({
contractId: LAEX_CONTRACT_ID,
name: 'LÆXON',
symbol: 'LAEX',
isAe: false,
})
}

return {
next: null,
data: formattedData,
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const CACHE_KEY_PRICE_DATA = 'aeternity-price-data'
export const VISIBLE_KEYBLOCKS_LIMIT = 20
export const VISIBLE_MICROBLOCKS_LIMIT = 30
export const VISIBLE_TRANSACTIONS_LIMIT = 4
export const LAEX_CONTRACT_ID = 'ct_xtk8rSz9suPb6D6VLquyfVji25FcnFRDjn3dnn5mmvHsPiESt'

export const TOKEN_SUPPLY_ACI = [
{
Expand Down

0 comments on commit a1f39df

Please sign in to comment.