mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +00:00
chore: add ordiscan
This commit is contained in:
parent
849a5b41be
commit
1dd4ca7304
19
package-lock.json
generated
19
package-lock.json
generated
@ -52,6 +52,7 @@
|
||||
"input-otp": "^1.2.4",
|
||||
"lucide-react": "^0.462.0",
|
||||
"next-themes": "^0.3.0",
|
||||
"ordiscan": "^1.3.0",
|
||||
"react": "^18.3.1",
|
||||
"react-day-picker": "^8.10.1",
|
||||
"react-dom": "^18.3.1",
|
||||
@ -12609,6 +12610,18 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ordiscan": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ordiscan/-/ordiscan-1.3.0.tgz",
|
||||
"integrity": "sha512-IV8yayKGIRtfkI3rQ1gu+aKQ6UmNHXB910qUuWrraCcuk6U/YkE+6X8Bh+jW2P8L8/lOfYA6DLVeKCVPkj8c6g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/ox": {
|
||||
"version": "0.6.9",
|
||||
"resolved": "https://registry.npmjs.org/ox/-/ox-0.6.9.tgz",
|
||||
@ -15898,9 +15911,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "3.23.8",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz",
|
||||
"integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==",
|
||||
"version": "3.25.76",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
|
||||
@ -59,6 +59,7 @@
|
||||
"input-otp": "^1.2.4",
|
||||
"lucide-react": "^0.462.0",
|
||||
"next-themes": "^0.3.0",
|
||||
"ordiscan": "^1.3.0",
|
||||
"react": "^18.3.1",
|
||||
"react-day-picker": "^8.10.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
import { OrdinalApiResponse } from './types';
|
||||
|
||||
const BASE_URL = 'https://dashboard.logos.co/api/operators/wallet';
|
||||
|
||||
export class OrdinalAPI {
|
||||
/**
|
||||
* Fetches Ordinal operator details for a given Bitcoin address.
|
||||
* @param address - The Bitcoin address to query.
|
||||
* @returns A promise that resolves with the API response.
|
||||
*/
|
||||
async getOperatorDetails(address: string): Promise<OrdinalApiResponse> {
|
||||
if (import.meta.env.VITE_OPCHAN_MOCK_ORDINAL_CHECK === 'true') {
|
||||
console.log(
|
||||
`[DEV] Bypassing ordinal verification for address: ${address}`
|
||||
);
|
||||
return {
|
||||
has_operators: true,
|
||||
error_message: '',
|
||||
data: [],
|
||||
};
|
||||
}
|
||||
|
||||
const url = `${BASE_URL}/${address}/detail/`;
|
||||
|
||||
try {
|
||||
const response = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: { Accept: 'application/json' },
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorBody = await response.text().catch(() => '');
|
||||
throw new Error(
|
||||
`HTTP error! status: ${response.status}, message: ${errorBody || response.statusText}`
|
||||
);
|
||||
}
|
||||
|
||||
const data: OrdinalApiResponse = await response.json();
|
||||
|
||||
if (data.error_message) {
|
||||
console.warn(
|
||||
`API returned an error message for address ${address}: ${data.error_message}`
|
||||
);
|
||||
}
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed to fetch ordinal details for address ${address}:`,
|
||||
error
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,25 +0,0 @@
|
||||
export interface OrdinalDetail {
|
||||
name: string;
|
||||
archetype_name: string;
|
||||
comp: string;
|
||||
background: string;
|
||||
skin: string;
|
||||
helmet: string;
|
||||
jacket: string;
|
||||
image_200_url: string;
|
||||
image_200_jpeg_url: string;
|
||||
image_400_url: string;
|
||||
image_400_jpeg_url: string;
|
||||
image_1024_url: string;
|
||||
image_1024_jpeg_url: string;
|
||||
image_2048_url: string;
|
||||
image_2048_jpeg_url: string;
|
||||
image_pixalated_url: string;
|
||||
mp4_url: string;
|
||||
}
|
||||
|
||||
export interface OrdinalApiResponse {
|
||||
has_operators: boolean;
|
||||
error_message: string;
|
||||
data: OrdinalDetail[];
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user