mirror of
https://github.com/luxfi/market.git
synced 2026-09-24 00:25:57 +00:00
fix: inline @luxfi/chains + @luxfi/contracts stubs (not on npm)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
node_modules
|
||||
**/node_modules
|
||||
**/.next
|
||||
.git
|
||||
.env*
|
||||
.vscode/
|
||||
.idea/
|
||||
coverage/
|
||||
*.test.ts
|
||||
*.spec.ts
|
||||
.DS_Store
|
||||
@@ -12,8 +12,6 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@luxfi/chains": "^1.0.0",
|
||||
"@luxfi/contracts": "^1.0.0",
|
||||
"@radix-ui/react-dialog": "^1.1.0",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.0",
|
||||
"@radix-ui/react-slot": "^1.1.0",
|
||||
|
||||
+59
-10
@@ -1,10 +1,59 @@
|
||||
export {
|
||||
lux as luxMainnet,
|
||||
zoo as zooMainnet,
|
||||
hanzo as hanzoMainnet,
|
||||
spc as spcMainnet,
|
||||
pars as parsMainnet,
|
||||
chains as supportedChains,
|
||||
EXPLORER_API,
|
||||
CHAIN_INFO,
|
||||
} from '@luxfi/chains'
|
||||
import type { Chain } from 'viem'
|
||||
|
||||
export const luxMainnet: Chain = {
|
||||
id: 96369,
|
||||
name: 'Lux',
|
||||
nativeCurrency: { name: 'Lux', symbol: 'LUX', decimals: 18 },
|
||||
rpcUrls: { default: { http: ['https://api.lux.network/mainnet/ext/bc/C/rpc'] } },
|
||||
blockExplorers: { default: { name: 'Explore', url: 'https://explore.lux.network' } },
|
||||
}
|
||||
|
||||
export const zooMainnet: Chain = {
|
||||
id: 200200,
|
||||
name: 'Zoo',
|
||||
nativeCurrency: { name: 'Zoo', symbol: 'ZOO', decimals: 18 },
|
||||
rpcUrls: { default: { http: ['https://api.zoo.network/mainnet/ext/bc/C/rpc'] } },
|
||||
blockExplorers: { default: { name: 'Explore Zoo', url: 'https://explore.zoo.network' } },
|
||||
}
|
||||
|
||||
export const hanzoMainnet: Chain = {
|
||||
id: 36963,
|
||||
name: 'Hanzo',
|
||||
nativeCurrency: { name: 'Hanzo', symbol: 'HANZO', decimals: 18 },
|
||||
rpcUrls: { default: { http: ['https://api.lux.network/mainnet/ext/bc/2GiQb73CeJESjc4omFv2YtQHZrRgJf25NXPzAr5J6UNHRcDV2F/rpc'] } },
|
||||
blockExplorers: { default: { name: 'Explore Hanzo', url: 'https://explore-hanzo.lux.network' } },
|
||||
}
|
||||
|
||||
export const spcMainnet: Chain = {
|
||||
id: 36911,
|
||||
name: 'SPC',
|
||||
nativeCurrency: { name: 'SPC', symbol: 'SPC', decimals: 18 },
|
||||
rpcUrls: { default: { http: ['https://api.lux.network/mainnet/ext/bc/rtjwvtE1tEvrokmpeYdTq7b2zqZgmybKwR5MLjKMGAR1W78dQ/rpc'] } },
|
||||
blockExplorers: { default: { name: 'Explore SPC', url: 'https://explore-spc.lux.network' } },
|
||||
}
|
||||
|
||||
export const parsMainnet: Chain = {
|
||||
id: 17471,
|
||||
name: 'Pars',
|
||||
nativeCurrency: { name: 'Pars', symbol: 'PARS', decimals: 18 },
|
||||
rpcUrls: { default: { http: ['https://api.pars.network/mainnet/ext/bc/C/rpc'] } },
|
||||
blockExplorers: { default: { name: 'Explore Pars', url: 'https://explore.pars.network' } },
|
||||
}
|
||||
|
||||
export const supportedChains: readonly Chain[] = [luxMainnet, zooMainnet, hanzoMainnet, spcMainnet, parsMainnet]
|
||||
|
||||
export const EXPLORER_API: Record<number, string> = {
|
||||
[luxMainnet.id]: 'https://explore.lux.network/api/v2',
|
||||
[zooMainnet.id]: 'https://explore.zoo.network/api/v2',
|
||||
[hanzoMainnet.id]: 'https://explore-hanzo.lux.network/api/v2',
|
||||
[spcMainnet.id]: 'https://explore-spc.lux.network/api/v2',
|
||||
[parsMainnet.id]: 'https://explore.pars.network/api/v2',
|
||||
}
|
||||
|
||||
export const CHAIN_INFO: Record<number, { name: string; symbol: string }> = {
|
||||
[luxMainnet.id]: { name: 'Lux', symbol: 'LUX' },
|
||||
[zooMainnet.id]: { name: 'Zoo', symbol: 'ZOO' },
|
||||
[hanzoMainnet.id]: { name: 'Hanzo', symbol: 'HANZO' },
|
||||
[spcMainnet.id]: { name: 'SPC', symbol: 'SPC' },
|
||||
[parsMainnet.id]: { name: 'Pars', symbol: 'PARS' },
|
||||
}
|
||||
|
||||
+36
-21
@@ -1,21 +1,36 @@
|
||||
export {
|
||||
type ExplorerToken,
|
||||
type ExplorerTokenInstance,
|
||||
type NFTMetadata,
|
||||
type NFTTrait,
|
||||
type ExplorerTransfer,
|
||||
type ExplorerAddress,
|
||||
type PaginatedResponse,
|
||||
getCollections,
|
||||
getToken,
|
||||
getTokenInstances,
|
||||
getTokenInstance,
|
||||
getTokenInstanceTransfers,
|
||||
getTokenInstanceHolders,
|
||||
getTokenTransfers,
|
||||
getAddressTokenInstances,
|
||||
getAddressTokens,
|
||||
searchTokens,
|
||||
resolveMediaUrl,
|
||||
getNftImageUrl,
|
||||
} from '@luxfi/chains/explorer'
|
||||
// Stubs for @luxfi/chains/explorer — inline until the package is published.
|
||||
// UI pages using these will render empty states until a real implementation is wired.
|
||||
|
||||
export type ExplorerToken = Record<string, unknown>
|
||||
export type ExplorerTokenInstance = Record<string, unknown>
|
||||
export type NFTMetadata = Record<string, unknown>
|
||||
export type NFTTrait = { trait_type: string; value: string | number }
|
||||
export type ExplorerTransfer = Record<string, unknown>
|
||||
export type ExplorerAddress = Record<string, unknown>
|
||||
export type PaginatedResponse<T> = { items: T[]; next_page_params: null }
|
||||
|
||||
const empty = <T,>(): PaginatedResponse<T> => ({ items: [], next_page_params: null })
|
||||
|
||||
export const getCollections = async () => empty()
|
||||
export const getToken = async (_id: string) => null
|
||||
export const getTokenInstances = async () => empty()
|
||||
export const getTokenInstance = async () => null
|
||||
export const getTokenInstanceTransfers = async () => empty()
|
||||
export const getTokenInstanceHolders = async () => empty()
|
||||
export const getTokenTransfers = async () => empty()
|
||||
export const getAddressTokenInstances = async () => empty()
|
||||
export const getAddressTokens = async () => empty()
|
||||
export const searchTokens = async () => empty()
|
||||
|
||||
export function resolveMediaUrl(url: string | null | undefined): string | null {
|
||||
if (!url) return null
|
||||
if (url.startsWith('ipfs://')) return `https://ipfs.io/ipfs/${url.slice(7)}`
|
||||
if (url.startsWith('ar://')) return `https://arweave.net/${url.slice(5)}`
|
||||
return url
|
||||
}
|
||||
|
||||
export function getNftImageUrl(metadata: NFTMetadata | null | undefined): string | null {
|
||||
if (!metadata) return null
|
||||
const m = metadata as { image?: string; image_url?: string; animation_url?: string }
|
||||
return resolveMediaUrl(m.image_url || m.image || m.animation_url || null)
|
||||
}
|
||||
|
||||
+13
-1
@@ -1 +1,13 @@
|
||||
export { config } from '@luxfi/chains/wagmi'
|
||||
import { createConfig, http } from 'wagmi'
|
||||
import { luxMainnet, zooMainnet, hanzoMainnet, spcMainnet, parsMainnet } from './chains'
|
||||
|
||||
export const config = createConfig({
|
||||
chains: [luxMainnet, zooMainnet, hanzoMainnet, spcMainnet, parsMainnet],
|
||||
transports: {
|
||||
[luxMainnet.id]: http(),
|
||||
[zooMainnet.id]: http(),
|
||||
[hanzoMainnet.id]: http(),
|
||||
[spcMainnet.id]: http(),
|
||||
[parsMainnet.id]: http(),
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user