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

Add NFTs support for BSC #2716

Merged
merged 2 commits into from
Dec 6, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions background/lib/simple-hash_update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { HexString } from "../types"
import logger from "./logger"
import { sameEVMAddress } from "./utils"

type SupportedChain = "polygon" | "arbitrum" | "optimism" | "ethereum" | "bsc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯


type SimpleHashNFTModel = {
nft_id: string
token_id: string | null
name: string | null
description: string | null
contract_address: string
chain: "polygon" | "arbitrum" | "optimism" | "ethereum"
chain: SupportedChain
external_url: string | null
image_url: string | null
previews?: {
Expand Down Expand Up @@ -41,7 +43,7 @@ type SimpleHashCollectionModel = {
id: string
name: string | null
image_url: string | null
chain: "polygon" | "arbitrum" | "optimism" | "ethereum"
chain: SupportedChain
distinct_nfts_owned: number | null
distinct_owner_count: number | null
distinct_nft_count: number | null
Expand Down Expand Up @@ -71,6 +73,7 @@ const CHAIN_ID_TO_NAME = {
137: "polygon",
42161: "arbitrum",
43114: "avalanche",
56: "bsc",
}

const SIMPLE_HASH_CHAIN_TO_ID = {
Expand All @@ -79,6 +82,7 @@ const SIMPLE_HASH_CHAIN_TO_ID = {
polygon: 137,
arbitrum: 42161,
avalanche: 43114,
bsc: 56,
}

function isGalxeAchievement(url: string | null | undefined) {
Expand Down
3 changes: 3 additions & 0 deletions background/nfts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OPTIMISM,
ARBITRUM_ONE,
AVALANCHE,
BINANCE_SMART_CHAIN,
} from "./constants"
import { EVMNetwork } from "./networks"
// Networks that are not added to this struct will
Expand All @@ -16,6 +17,7 @@ export const CHAIN_ID_TO_NFT_METADATA_PROVIDER: {
[OPTIMISM.chainID]: ["simplehash"],
[ARBITRUM_ONE.chainID]: ["simplehash"],
[AVALANCHE.chainID]: ["simplehash"],
[BINANCE_SMART_CHAIN.chainID]: ["simplehash"],
}

export const NFT_PROVIDER_TO_CHAIN = {
Expand All @@ -26,6 +28,7 @@ export const NFT_PROVIDER_TO_CHAIN = {
OPTIMISM.chainID,
ARBITRUM_ONE.chainID,
AVALANCHE.chainID,
BINANCE_SMART_CHAIN.chainID,
],
}

Expand Down