Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use new nft spec instead of hardcoding everything #4573

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ jobs:
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
IRYS_PRIVATE_KEY: ${{ secrets.IRYS_PRIVATE_KEY }}
IMAGEKIT_URL: ${{ secrets.IMAGEKIT_URL }}
SOUND_API_KEY: ${{ secrets.SOUND_API_KEY }}
run: |
cd apps/api
{
Expand All @@ -109,7 +108,6 @@ jobs:
echo "GOOGLE_API_KEY=${GOOGLE_API_KEY}"
echo "IRYS_PRIVATE_KEY=${IRYS_PRIVATE_KEY}"
echo "IMAGEKIT_URL=${IMAGEKIT_URL}"
echo "SOUND_API_KEY=${SOUND_API_KEY}"
} > .env
cd ../..
pnpm test:e2e
1 change: 0 additions & 1 deletion apps/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ IRYS_PRIVATE_KEY=""
IMAGEKIT_URL=""
ZENDESK_API_KEY=""
RAILWAY_TOKEN=""
SOUND_API_KEY=""
84 changes: 0 additions & 84 deletions apps/api/src/routes/nfts/basepaint/canvas.ts

This file was deleted.

71 changes: 0 additions & 71 deletions apps/api/src/routes/nfts/sound/release.ts

This file was deleted.

57 changes: 0 additions & 57 deletions apps/api/src/routes/nfts/unlonely/channel.ts

This file was deleted.

62 changes: 0 additions & 62 deletions apps/api/src/routes/nfts/unlonely/nfc.ts

This file was deleted.

35 changes: 0 additions & 35 deletions apps/api/src/routes/nfts/zora/nft.ts

This file was deleted.

28 changes: 16 additions & 12 deletions apps/api/src/utils/oembed/meta/getNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const getNft = (document: Document, url: string): Nft | null => {
document.querySelector('meta[name="nft:chain"]') ||
document.querySelector('meta[property="nft:chain"]');
const mediaUrl =
document.querySelector('meta[name="eth:nft:media_url"]') ||
document.querySelector('meta[property="eth:nft:media_url"]') ||
document.querySelector('meta[name="og:image"]') ||
document.querySelector('meta[property="og:image"]');
document.querySelector('meta[property="og:image"]') ||
document.querySelector('meta[name="eth:nft:media_url"]') ||
document.querySelector('meta[property="eth:nft:media_url"]');
const mintCount =
document.querySelector('meta[name="eth:nft:mint_count"]') ||
document.querySelector('meta[property="eth:nft:mint_count"]');
Expand All @@ -38,27 +38,31 @@ const getNft = (document: Document, url: string): Nft | null => {
document.querySelector('meta[name="eth:nft:endtime"]') ||
document.querySelector('meta[property="eth:nft:endtime"]');

const processedCollectionName =
collectionName?.getAttribute('content') || null;
const processedContractAddress =
contractAddress?.getAttribute('content') || null;
const processedCreatorAddress =
creatorAddress?.getAttribute('content') || null;
const processedCollectionName = collectionName?.getAttribute(
'content'
) as string;
const processedContractAddress = contractAddress?.getAttribute(
'content'
) as `0x${string}`;
const processedCreatorAddress = creatorAddress?.getAttribute(
'content'
) as `0x${string}`;
const processedChain = chain?.getAttribute('content') || null;
const processedMediaUrl = mediaUrl?.getAttribute('content') || null;
const processedMediaUrl = mediaUrl?.getAttribute('content') as string;
const processedMintCount = mintCount?.getAttribute('content')
? Number(mintCount?.getAttribute('content'))
: null;
const processedMintStatus = mintStatus?.getAttribute('content') || null;
const processedMintUrl = mintUrl?.getAttribute('content') || null;
const processedSchema = schema?.getAttribute('content') || null;
const processedSchema = schema?.getAttribute('content') as string;
const processedEndTime = endTime?.getAttribute('content') || null;

if (
!processedCollectionName &&
!processedContractAddress &&
!processedCreatorAddress &&
!processedSchema
!processedSchema &&
!processedMediaUrl
) {
return null;
}
Expand Down