Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Remove factory
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbo committed Oct 31, 2023
1 parent f0705d5 commit c791971
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 1,009 deletions.
2 changes: 1 addition & 1 deletion components/AssetLinks.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { LinkMetadata } from '@lukso/lsp-factory.js'
import { LinkMetadata } from '@lukso/lsp-smart-contracts'
type Props = {
links: LinkMetadata[]
Expand Down
5 changes: 0 additions & 5 deletions composables/useErc725.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { ERC725, ERC725JSONSchema } from '@erc725/erc725.js'
import { LSP3Profile } from '@lukso/lsp-factory.js'
import Web3 from 'web3'

export interface LSP3ProfileJSON {
LSP3Profile: LSP3Profile
}

const getInstance = (address: string, schema: ERC725JSONSchema[]) => {
const { currentNetwork } = useAppStore()
const config = {
Expand Down
2 changes: 1 addition & 1 deletion models/asset.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Item, Model } from 'pinia-orm'
import { LinkMetadata } from '@lukso/lsp-factory.js'
import { LinkMetadata } from '@lukso/lsp-smart-contracts'

import { Profile } from '@/models/profile'
import { InterfaceId } from '@/types/assets'
Expand Down
4 changes: 2 additions & 2 deletions models/profile.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Item, Model } from 'pinia-orm'
import { LSP3Profile, LinkMetadata } from '@lukso/lsp-factory.js'
import { LSP3ProfileMetadata, LinkMetadata } from '@lukso/lsp-smart-contracts'

import { Image } from '@/models/image'

Expand Down Expand Up @@ -56,7 +56,7 @@ export type IndexedProfile = {
profileURL?: string
profileHash?: string
profileHashFunction?: string
LSP3Profile?: LSP3Profile
LSP3Profile?: LSP3ProfileMetadata
hasProfileName?: boolean
hasProfileDescription?: boolean
backgroundImageUrl?: string
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@erc725/erc725.js": "0.20.0",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@formatjs/intl": "^2.9.0",
"@lukso/lsp-factory.js": "3.1.1",
"@lukso/lsp-smart-contracts": "0.12.0-rc.0",
"@lukso/web-components": "1.47.1",
"@nuxt/devtools": "^0.7.4",
Expand Down
2 changes: 1 addition & 1 deletion pages/[profileAddress]/lyx-details.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { LinkMetadata } from '@lukso/lsp-factory.js'
import { LinkMetadata } from '@lukso/lsp-smart-contracts'
const { connectedProfile } = useConnectedProfile()
const { currentNetwork, isLoadingAssets } = storeToRefs(useAppStore())
Expand Down
3 changes: 1 addition & 2 deletions types/assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ImageMetadata } from '@lukso/lsp-factory.js'
import { INTERFACE_IDS } from '@lukso/lsp-smart-contracts'
import { INTERFACE_IDS, ImageMetadata } from '@lukso/lsp-smart-contracts'

export type InterfaceId = keyof typeof INTERFACE_IDS

Expand Down
4 changes: 2 additions & 2 deletions utils/fetchLsp4Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ERC725JSONSchema } from '@erc725/erc725.js'
import { LSP4DigitalAssetJSON } from '@lukso/lsp-factory.js/build/main/src/lib/interfaces/lsp4-digital-asset'
import { LSP4DigitalAssetMetadataJSON } from '@lukso/lsp-smart-contracts'
import LSP4DigitalAsset from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'
import { URLDataWithHash } from '@erc725/erc725.js/build/main/src/types'

export const fetchLsp4Metadata = async (
assetAddress: Address
): Promise<[string, string, LSP4DigitalAssetJSON]> => {
): Promise<[string, string, LSP4DigitalAssetMetadataJSON]> => {
const { getInstance } = useErc725()

const erc725 = getInstance(
Expand Down
6 changes: 3 additions & 3 deletions utils/fetchLsp8Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LSP4DigitalAssetJSON } from '@lukso/lsp-factory.js/build/main/src/lib/interfaces/lsp4-digital-asset'
import { LSP4DigitalAssetMetadataJSON } from '@lukso/lsp-smart-contracts'
import { ERC725JSONSchema } from '@erc725/erc725.js'

import { Lsp8TokenIdType } from '@/types/assets'
Expand All @@ -7,11 +7,11 @@ import LSP8IdentifiableDigitalAsset from '@/shared/schemas/LSP8IdentifiableDigit
export const fetchLsp8Metadata = async (
tokenId: string,
assetAddress: Address
): Promise<LSP4DigitalAssetJSON> => {
): Promise<LSP4DigitalAssetMetadataJSON> => {
const lsp8MetadataGetter = async (
tokenIdType: string,
tokenId: string
): Promise<LSP4DigitalAssetJSON> => {
): Promise<LSP4DigitalAssetMetadataJSON> => {
const lsp8Metadata = await erc725.fetchData([
{
keyName: `LSP8MetadataJSON:<${tokenIdType}>`,
Expand Down
2 changes: 1 addition & 1 deletion utils/getImages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ImageMetadata } from '@lukso/lsp-factory.js'
import { ImageMetadata } from '@lukso/lsp-smart-contracts'

import { ImageMetadataEncoded } from '@/types/assets'
import { formatUrl } from '@/utils/formatUrl'
Expand Down
4 changes: 2 additions & 2 deletions utils/validateLSP4Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LSP4DigitalAssetJSON } from '@lukso/lsp-factory.js/build/main/src/lib/interfaces/lsp4-digital-asset'
import { LSP4DigitalAssetMetadataJSON } from '@lukso/lsp-smart-contracts'

export const validateLsp4MetaData = (
LSP4MetadataJSON: any
): LSP4DigitalAssetJSON => {
): LSP4DigitalAssetMetadataJSON => {
let images = [[]]
let links = []
let assets = []
Expand Down
12 changes: 9 additions & 3 deletions utils/validateLsp3Metadata.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { ImageMetadata, LSP3Profile, LinkMetadata } from '@lukso/lsp-factory.js'
import {
ImageMetadata,
LSP3ProfileMetadata,
LinkMetadata,
} from '@lukso/lsp-smart-contracts'

export const validateLsp3Metadata = (LSP3Metadata: any): LSP3Profile => {
export const validateLsp3Metadata = (
LSP3Metadata: any
): LSP3ProfileMetadata => {
let profileImage: ImageMetadata[] = []
let backgroundImage: ImageMetadata[] = []

const lsp3Profile = LSP3Metadata?.value?.LSP3Profile as LSP3Profile
const lsp3Profile = LSP3Metadata?.value?.LSP3Profile as LSP3ProfileMetadata
const name = validateName(lsp3Profile.name)
const tags = validateTags(lsp3Profile.tags)
const links = validateLinks(lsp3Profile.links)
Expand Down
Loading

0 comments on commit c791971

Please sign in to comment.