Skip to content

Commit

Permalink
fix: zora api (#5942)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhanseng authored Mar 24, 2022
1 parent 22239f1 commit ff08fae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
14 changes: 5 additions & 9 deletions packages/mask/src/plugins/Collectible/SNSAdaptor/ArticleTab.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { makeStyles } from '@masknet/theme'
import { CollectibleTab } from './CollectibleTab'
import { CollectibleState } from '../hooks/useCollectibleState'
import { AssetPlayer } from '@masknet/shared'
import { NFTCardStyledAssetPlayer } from '@masknet/shared'
import { useMemo } from 'react'

const useStyles = makeStyles()((theme) => ({
Expand Down Expand Up @@ -43,6 +43,9 @@ const useStyles = makeStyles()((theme) => ({
minWidth: 300,
minHeight: 300,
},
imgWrapper: {
maxWidth: 300,
},
}))

export interface ArticleTabProps {}
Expand All @@ -57,14 +60,7 @@ export function ArticleTab(props: ArticleTabProps) {
return (
<CollectibleTab>
<div className={classes.body}>
<AssetPlayer
url={resourceUrl}
options={{
playsInline: true,
}}
classes={classes}
isFixedIframeSize={false}
/>
<NFTCardStyledAssetPlayer url={resourceUrl} classes={classes} />
</div>
</CollectibleTab>
)
Expand Down
15 changes: 12 additions & 3 deletions packages/web3-providers/src/zora/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
FungibleTokenDetailed,
ERC721TokenDetailed,
EthereumTokenType,
resolveIPFSLink,
} from '@masknet/web3-shared-evm'

import { NonFungibleTokenAPI } from '..'
Expand All @@ -17,8 +18,14 @@ function createNFTAsset(asset: ZoraToken): NonFungibleTokenAPI.Asset {
return {
is_verified: false,
is_auction: asset.currentAuction !== null,
image_url:
asset.metadata.json.animation_url ?? asset.metadata.json.image_url ?? asset.metadata.json.image ?? '',
image_url: resolveIPFSLink(
(
asset.metadata.json.image ??
asset.metadata.json.animation_url ??
asset.metadata.json.image_url ??
''
).replace('ipfs://', ''),
),
asset_contract: {
name: asset.tokenContract.name,
description: '',
Expand Down Expand Up @@ -49,7 +56,9 @@ function createNFTAsset(asset: ZoraToken): NonFungibleTokenAPI.Asset {
description: asset.metadata.json.description,
name: asset.name ?? asset.metadata.json.name,
collection_name: '',
animation_url: asset.metadata.json.animation_url,
animation_url: resolveIPFSLink(
(asset.metadata.json.image ?? asset.metadata.json.animation_url).replace('ipfs://', ''),
),
end_time: asset.currentAuction ? new Date(asset.currentAuction.expiresAt) : null,
order_payment_tokens: [] as FungibleTokenDetailed[],
offer_payment_tokens: [] as FungibleTokenDetailed[],
Expand Down

0 comments on commit ff08fae

Please sign in to comment.