Skip to content

Commit

Permalink
chore: Update nft type
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia committed Mar 18, 2022
1 parent 4115d71 commit a58f312
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
11 changes: 8 additions & 3 deletions src/client/BuilderClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,16 @@ beforeEach(async () => {
mockNFT = {
backgroundColor: 'background_color',
contract: {
address: 'address',
createdDate: 'created_date',
name: 'name',
nftVersion: 'nft_version',
schemaName: 'schema_name',
symbol: 'symbol',
totalSupply: 'total_supply',
description: 'description',
externalLink: 'external_link',
imageUrl: 'image_url',
name: 'name',
symbol: 'symbol'
imageUrl: 'image_url'
},
description: 'description',
externalLink: 'external_link',
Expand Down
35 changes: 19 additions & 16 deletions src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ export type ServerResponse<T> = {
error?: string
}

/**
* NFT types required by the client
* They have been copied from the builder server.
* TODO: Find a way to abstract these types someplace else to avoid this nasty repetition
*/
// START - Builder Server NFT
// TODO: Abstract these types someplace else to avoid repetition

// NFT Entity
export type NFT = {
tokenId: string
backgroundColor: string | null
imageUrl: string
imagePreviewUrl: string
imageThumbnailUrl: string
imagePreviewUrl: string | null
imageThumbnailUrl: string | null
imageOriginalUrl: string | null
name: string | null
description: string | null
Expand All @@ -30,46 +26,51 @@ export type NFT = {
topOwnerships: NFTOwnership[] | null
}

type NFTAccount = {
export type NFTAccount = {
user: { username: string } | null
profileImageUrl: string
address: string
config: string
}

type NFTContract = {
export type NFTContract = {
address: string
createdDate: string
name: string
nftVersion: string | null
schemaName: string
symbol: string
imageUrl: string | null
totalSupply: string | null
description: string
externalLink: string | null
imageUrl: string | null
}

type NFTTrait = {
export type NFTTrait = {
type: string
value: string | number
displayType: string | null
}

type NFTLastSale = {
export type NFTLastSale = {
eventType: string
totalPrice: string
quantity: string
paymentToken: NFTToken
}

type NFTOrder = {
export type NFTOrder = {
maker: NFTAccount
currentPrice: string
paymentTokenContract: NFTToken
}

type NFTOwnership = {
export type NFTOwnership = {
owner: NFTAccount
quantity: string
}

type NFTToken = {
export type NFTToken = {
symbol: string
}

Expand All @@ -91,3 +92,5 @@ export type GetNFTParams = {
contractAddress: string
tokenId: string
}

// END - Builder Server NFT

0 comments on commit a58f312

Please sign in to comment.