Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: assets #31

Merged
merged 54 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
44e2a19
Upgrade for Testnet
dzbo Jul 26, 2023
25177e2
Bump up contracts package
dzbo Jul 26, 2023
985fae3
Fix lsp detection
dzbo Jul 26, 2023
7d853dc
Asset detection change and showing LSP8 metadata
dzbo Jul 26, 2023
665e434
Lint
dzbo Jul 26, 2023
ff29f99
Fix name
dzbo Jul 26, 2023
a36ea74
Cleanup
dzbo Jul 26, 2023
b476d67
Setup WIP
dzbo Jul 28, 2023
89ceb7c
Setup
dzbo Jul 28, 2023
a893540
Translations
dzbo Jul 28, 2023
4b04aff
Linters setup
dzbo Jul 28, 2023
d37f9f3
Config nuxt plugins, add web components
dzbo Jul 28, 2023
6dc108d
Merge branch 'up-wallet-beta-1.0' of github.com:lukso-network/wallet.…
dzbo Jul 28, 2023
e647d2b
Add CI and PR template
dzbo Jul 28, 2023
01e8ae9
Fix lint
dzbo Jul 28, 2023
4ad1d57
rename
dzbo Jul 28, 2023
12fcfad
Sample test
dzbo Jul 28, 2023
549da40
Downgrade nuxt to fix asset copy
dzbo Jul 29, 2023
2123d63
Fix ignores
dzbo Jul 29, 2023
39871ac
Add intl
dzbo Jul 29, 2023
962c54e
Upgrade nuxt
dzbo Jul 31, 2023
973c867
Add intl plugin
dzbo Jul 31, 2023
69c8115
Address check
dzbo Jul 31, 2023
0ea4ad7
Address check cd
dzbo Jul 31, 2023
d5e3c2a
Include unit tests
dzbo Jul 31, 2023
1d9dac7
Default layout
dzbo Jul 31, 2023
81d47be
Profile card
dzbo Jul 31, 2023
85e28fe
Routes and redirects
dzbo Jul 31, 2023
8a31836
Tabs
dzbo Jul 31, 2023
0ea8c05
Show dashboard
dzbo Aug 1, 2023
92e4fdd
Merge branch 'develop' of github.com:lukso-network/wallet.universalpr…
dzbo Aug 1, 2023
687c291
Bump up node
dzbo Aug 1, 2023
4c3daf5
change fixture
dzbo Aug 1, 2023
b1419a0
Fix routes
dzbo Aug 1, 2023
f89f8e8
Upgrade packages
dzbo Aug 1, 2023
df1deeb
Clean yarn cache
dzbo Aug 1, 2023
ff17496
Fetching profile data
dzbo Aug 3, 2023
5ce3394
Merge branch 'develop' of github.com:lukso-network/wallet.universalpr…
dzbo Aug 3, 2023
8e6f55d
Fix test issue with import web3-utils
dzbo Aug 3, 2023
a8c3bb9
PR remarks
dzbo Aug 3, 2023
252cac3
Downgrade utils too
dzbo Aug 3, 2023
0fda35d
Fix import
dzbo Aug 3, 2023
bd5a865
Profile connection
dzbo Aug 4, 2023
ce2d986
Merge branch 'develop' of github.com:lukso-network/wallet.universalpr…
dzbo Aug 4, 2023
92bf2aa
Fix lint
dzbo Aug 4, 2023
37cb37c
Open store when ext is not installed
dzbo Aug 7, 2023
e977f7e
Add connection expiry
dzbo Aug 7, 2023
f78c5eb
Assets
dzbo Aug 18, 2023
1f4b454
Merge branch 'develop' of github.com:lukso-network/wallet.universalpr…
dzbo Aug 18, 2023
f37a60a
Fix
dzbo Aug 18, 2023
3b6a4fe
Separate loaders
dzbo Aug 18, 2023
8e30626
Fix dep
dzbo Aug 18, 2023
8b55aed
Fixes
dzbo Aug 18, 2023
fa757ac
PR remarks
dzbo Aug 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (typeof window !== 'undefined') {
const web3Store = useWeb3Store()
const appStore = useAppStore()
const { providerEvents, disconnect } = useBrowserExtension()
const { setLoading, setAddress, setProfile, reloadProfile } = useProfileStore()
const { setStatus, setAddress, setProfile, reloadProfile } = useProfileStore()
const { setIsConnected, setConnectedAddress, setConnectedProfile } =
useConnectionStore()
const router = useRouter()
Expand Down Expand Up @@ -60,7 +60,7 @@ const setupWalletProfile = async () => {
try {
const profileAddress = useRouter().currentRoute.value.params?.profileAddress

setLoading(true)
setStatus('isProfileLoading', true)
assertAddress(profileAddress, 'wallet')
setAddress(profileAddress)
const profile = await fetchProfile(profileAddress)
Expand All @@ -69,7 +69,7 @@ const setupWalletProfile = async () => {
console.error(error)
// TODO redirect to 404 page once it's added
} finally {
setLoading(false)
setStatus('isProfileLoading', false)
}
}

Expand Down Expand Up @@ -125,8 +125,8 @@ onMounted(async () => {
setupTranslations()
setupWeb3Instances()
checkConnectionExpiry()
await setupConnectedProfile()
await setupWalletProfile()
await setupConnectedProfile()
await routerBackProfileLoad()
})
</script>
Expand Down
19 changes: 0 additions & 19 deletions components/lsp7AssetList.vue

This file was deleted.

33 changes: 23 additions & 10 deletions components/lsp8AssetCard.vue → components/nftCard.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { collectibleRoute } from '@/shared/routes'
import { Nft } from '@/types/assets'

type Props = {
asset: Lsp8AssetType
asset: Nft
hasAddress?: boolean
}

Expand All @@ -13,9 +14,11 @@ const { profile: viewedProfile } = useProfileStore()

const handleShowAsset = () => {
try {
assertAddress(profile.address, 'profile')
assertAddress(props.asset.collectionAddress, 'asset')
navigateTo(collectibleRoute(profile.address, props.asset.collectionAddress))
assertAddress(profile.address)
assertAddress(props.asset.data.collectionAddress)
navigateTo(
collectibleRoute(profile.address, props.asset.data.collectionAddress)
)
} catch (error) {
console.error(error)
}
Expand All @@ -25,19 +28,26 @@ const handleShowAsset = () => {
<template>
<lukso-card size="small" is-hoverable is-full-width @click="handleShowAsset"
><div slot="content">
<div class="min-h-[260px] bg-neutral-90 w-100 rounded-t-12"></div>
<div
class="min-h-[260px] bg-neutral-90 w-100 rounded-t-12 bg-center bg-cover"
:style="`background-image: url(${asset.data.image});`"
></div>
<div class="p-4">
<div
v-if="asset.data.creatorAddress"
class="shadow-neutral-drop-shadow p-2 pr-6 rounded-4 inline-flex -top-6 relative bg-neutral-100"
>
<lukso-profile size="x-small"></lukso-profile>
<lukso-profile
size="x-small"
:profile-url="asset.data.creatorProfileImage"
></lukso-profile>
<div class="pl-1">
<div class="text-neutral-60 paragraph-inter-10-semi-bold">
{{ $formatMessage('asset_created_by') }}
</div>
<lukso-username
name="John"
address="0x9671Db683406EE0817B1f5cB6A3b3BD111477457"
:name="asset.data.creatorName"
:address="asset.data.creatorAddress"
size="x-small"
class="flex"
name-color="neutral-20"
Expand All @@ -46,10 +56,13 @@ const handleShowAsset = () => {
</div>
<div>
<div class="paragraph-inter-14-semi-bold">
{{ asset.collectionName }}
{{ asset.data.collectionName }}
</div>
<div class="paragraph-inter-12-semi-bold pb-2">
1 <span class="text-neutral-60">{{ asset.collectionIcon }}</span>
1
<span class="text-neutral-60">{{
asset.data.collectionSymbol
}}</span>
</div>
<div class="flex justify-end w-full">
<lukso-button
Expand Down
8 changes: 5 additions & 3 deletions components/lsp8AssetList.vue → components/nftsList.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script setup lang="ts">
const { assets } = useProfileStore()
import { storeToRefs } from 'pinia'

const { nfts, assetFilter } = storeToRefs(useProfileStore())
</script>

<template>
Expand All @@ -8,8 +10,8 @@ const { assets } = useProfileStore()
{{ $formatMessage('collectibles_title') }}
</h3>
<div class="grid gap-6 grid-col grid-cols-1 sm:grid-cols-2 md:grid-cols-3">
<Lsp8AssetCard
v-for="(asset, index) in assets.lsp8Assets"
<NftCard
v-for="(asset, index) in nfts(assetFilter)"
:key="index"
:asset="asset"
:has-address="true"
Expand Down
12 changes: 9 additions & 3 deletions components/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { profile, status } = useProfileStore()
</script>

<template>
<div>
<div class="relative">
<lukso-card
variant="profile"
:background-url="profile.backgroundImageUrl"
Expand All @@ -12,8 +12,8 @@ const { profile, status } = useProfileStore()
is-full-width
custom-class="rounded-24 shadow-neutral-drop-shadow"
:class="{
'opacity-0': status.isLoading,
'opacity-100': !status.isLoading,
'opacity-0': status.isProfileLoading,
'opacity-100': !status.isProfileLoading,
}"
class="transition-opacity duration-300"
>
Expand All @@ -30,5 +30,11 @@ const { profile, status } = useProfileStore()
></lukso-username>
</div>
</lukso-card>
<lukso-icon
name="progress-indicator-alt"
size="x-large"
v-if="status.isProfileLoading"
class="absolute top-1/2 left-1/2 transform"
></lukso-icon>
</div>
</template>
27 changes: 19 additions & 8 deletions components/lsp7AssetCard.vue → components/tokenCard.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { fromWei } from 'web3-utils'

import { tokenRoute } from '@/shared/routes'
import { Token, StandardsAbbreviations } from '@/types/assets'

type Props = {
asset: Lsp7AssetType
asset: Token
hasAddress?: boolean
}

Expand All @@ -26,15 +29,20 @@ const handleShowAsset = () => {
<lukso-card size="small" is-hoverable is-full-width @click="handleShowAsset"
><div slot="content" class="p-4">
<div class="h-7 flex justify-end items-start">
<lukso-tag size="x-small" background-color="lukso-90">LSP7</lukso-tag>
<lukso-tag
v-if="asset.standard"
size="x-small"
background-color="lukso-90"
>{{ StandardsAbbreviations[asset.standard] }}</lukso-tag
>
</div>
<div class="flex gap-6">
<div class="pl-4 flex flex-col items-center">
<lukso-profile
profile-url=""
size="medium"
:profile-address="asset.address"
:has-identicon="hasAddress"
:profile-url="'icon' in asset.data ? asset.data.icon : undefined"
:has-identicon="hasAddress ? 'true' : undefined"
></lukso-profile>
<div
v-if="hasAddress"
Expand All @@ -44,11 +52,14 @@ const handleShowAsset = () => {
</div>
</div>
<div class="flex flex-col w-full">
<div class="heading-inter-14-bold pb-1">{{ asset.name }}</div>
<div class="heading-inter-14-bold pb-1">{{ asset.data.name }}</div>
<div class="heading-inter-21-semi-bold flex items-center pb-1">
{{ $formatNumber(asset.amount)
}}<span class="paragraph-inter-14-semi-bold text-neutral-60 ml-2">{{
asset.symbol
<span v-if="asset.data.amount">{{
$formatNumber(fromWei(asset.data.amount, 'ether'))
}}</span>
<span v-else>0</span>
<span class="paragraph-inter-14-semi-bold text-neutral-60 ml-2">{{
asset.data.symbol
}}</span>
</div>
<div class="paragraph-inter-12-regular pb-4">$ 123.24</div>
Expand Down
37 changes: 37 additions & 0 deletions components/tokensList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia'

import { AssetFilter, Token } from '@/types/assets'

const { profile } = useProfileStore()
const { tokens, assetFilter } = storeToRefs(useProfileStore())
const lyxAsset = computed<Token>(() => {
return {
address: '0x0',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 0x0 over undefined or null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When i try to use it from the preview URL i see this, might be related?

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah now my bad - i think it is a version issue,
image

But maybe still, the 0x0 default / init state should not log an error in the dev console imo

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address field is required here but since we don't really show it for LYX it's 0x0.

data: {
name: 'LUKSO',
symbol: 'LYX',
amount: profile.balance,
address: '0x0',
icon: '/images/lyx-token.jpg',
},
}
})
</script>

<template>
<div class="pt-8">
<h3 class="heading-inter-17-semi-bold pb-4">
{{ $formatMessage('tokens_title') }}
</h3>
<div class="grid gap-6 grid-col grid-cols-1 sm:grid-cols-2 md:grid-cols-3">
<TokenCard v-if="assetFilter === AssetFilter.owned" :asset="lyxAsset" />
<TokenCard
v-for="(asset, index) in tokens(assetFilter)"
:key="index"
:asset="asset"
:has-address="true"
/>
</div>
</div>
</template>
1 change: 1 addition & 0 deletions composables/useBrowserExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const connect = async () => {
console.error(error)
disconnect()

// known errors
if (error instanceof EoAError) {
return showModal({
title: formatMessage('web3_connect_error_title'),
Expand Down
Loading