-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc1879f
commit 96ce700
Showing
9 changed files
with
213 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
apps/mobile/src/components/widgets/collectibles/collectibles-serializer.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { CollectibleCardProps } from '@leather.io/ui/native'; | ||
|
||
import { type Collectible } from './collectibles.mocks'; | ||
|
||
export function serializeCollectibles(collectibles: Collectible[]): CollectibleCardProps[] { | ||
return collectibles.map(collectible => { | ||
const isOrdinal = 'name' in collectible && 'mimeType' in collectible; | ||
if (isOrdinal) { | ||
return { | ||
type: 'inscription', | ||
name: collectible.title, | ||
src: collectible.src, | ||
mimeType: collectible.mimeType, | ||
}; | ||
} | ||
return { | ||
type: 'stacks', | ||
name: collectible.metadata.name, | ||
src: collectible.metadata.cached_image, | ||
mimeType: null, | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { CollectiblesWidget } from './collectibles-widget'; | ||
export { serializeCollectibles } from './collectibles-serializer'; | ||
export { mockCollectibles } from './collectibles.mocks'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { TokensWidget } from './tokens-widget'; | ||
export { getMockTokens, mockTotalBalance } from './tokens.mocks'; |
78 changes: 39 additions & 39 deletions
78
packages/ui/src/components/collectibles/collectibles.shared.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
export interface StacksNft { | ||
token_uri: string; | ||
metadata: { | ||
sip: number; | ||
name: string; | ||
description: string; | ||
image: string; | ||
cached_image: string; | ||
cached_thumbnail_image: string; | ||
attributes?: Array<{ | ||
trait_type: string; | ||
value: string; | ||
display_type?: string; | ||
}>; | ||
properties?: { | ||
collection?: string; | ||
collectionId?: string; | ||
[key: string]: any; | ||
}; | ||
}; | ||
} | ||
export interface Ordinal { | ||
id: string; | ||
number: number; | ||
output: string; | ||
txid: string; | ||
offset: string; | ||
address: string; | ||
preview: string; | ||
title: string; | ||
genesisBlockHeight: number; | ||
genesisBlockHash: string; | ||
genesisTimestamp: number; | ||
value: string; | ||
mimeType: string; | ||
name: string; | ||
src: string; | ||
} | ||
// export interface StacksNft { | ||
// token_uri: string; | ||
// metadata: { | ||
// sip: number; | ||
// name: string; | ||
// description: string; | ||
// image: string; | ||
// cached_image: string; | ||
// cached_thumbnail_image: string; | ||
// attributes?: Array<{ | ||
// trait_type: string; | ||
// value: string; | ||
// display_type?: string; | ||
// }>; | ||
// properties?: { | ||
// collection?: string; | ||
// collectionId?: string; | ||
// [key: string]: any; | ||
// }; | ||
// }; | ||
// } | ||
// export interface Ordinal { | ||
// id: string; | ||
// number: number; | ||
// output: string; | ||
// txid: string; | ||
// offset: string; | ||
// address: string; | ||
// preview: string; | ||
// title: string; | ||
// genesisBlockHeight: number; | ||
// genesisBlockHash: string; | ||
// genesisTimestamp: number; | ||
// value: string; | ||
// mimeType: string; | ||
// name: string; | ||
// src: string; | ||
// } | ||
|
||
export type Collectible = Ordinal | StacksNft; | ||
// export type Collectible = Ordinal | StacksNft; |
Oops, something went wrong.