-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update nft subvariant to support drawer and send to another wallet
- Loading branch information
Showing
36 changed files
with
511 additions
and
480 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
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
47 changes: 47 additions & 0 deletions
47
packages/widget-embedded/src/components/NFTOpenSea/NFTOpenSeaSecondary.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type { ChainId, TokenAmount } from '@lifi/sdk'; | ||
import { NFTBase } from '@lifi/widget'; | ||
import type { NFTNetwork, NFTOpenSeaProps } from './types'; | ||
import { ChainId as OpenSeaChainId } from './types'; | ||
import { useOpenSeaOrder } from './useOpenSeaOrder'; | ||
|
||
export const NFTOpenSeaSecondary: React.FC<NFTOpenSeaProps> = ({ | ||
network, | ||
contractAddress, | ||
tokenId, | ||
}) => { | ||
const { data: order, isLoading: isOrderLoading } = useOpenSeaOrder( | ||
network, | ||
contractAddress, | ||
tokenId, | ||
); | ||
|
||
const asset = order?.makerAssetBundle.assets[0]; | ||
const owner = { | ||
name: | ||
order?.maker.user?.username || | ||
order?.maker.address.substring(2, 8).toUpperCase(), | ||
url: `https://opensea.io/${ | ||
order?.maker.user?.username || order?.maker.address | ||
}`, | ||
}; | ||
const token: TokenAmount = { | ||
symbol: order?.takerAssetBundle.assets[0]?.assetContract?.tokenSymbol!, | ||
amount: order?.currentPrice!, | ||
decimals: order?.takerAssetBundle.assets[0].decimals!, | ||
address: order?.takerAssetBundle.assets[0].tokenAddress!, | ||
chainId: OpenSeaChainId[network as NFTNetwork] as number as ChainId, | ||
name: order?.takerAssetBundle.assets[0]?.assetContract.tokenSymbol!, | ||
priceUSD: '', | ||
}; | ||
|
||
return ( | ||
<NFTBase | ||
isLoading={isOrderLoading} | ||
imageUrl={asset?.imageUrl} | ||
collectionName={asset?.collection.name} | ||
assetName={asset?.name} | ||
owner={owner} | ||
token={token} | ||
/> | ||
); | ||
}; |
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,3 +1,3 @@ | ||
export * from './NFTOpenSea'; | ||
export * from './NFTOpenSeaSecondary'; | ||
export * from './types'; | ||
export * from './useNFTOpenSea'; |
135 changes: 0 additions & 135 deletions
135
packages/widget-embedded/src/components/NFTOpenSea/useNFTOpenSea.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.