@parabolicfamily/mcp 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -36
- package/abi/ParabolicSessionModule.json +362 -0
- package/dist/abi.d.ts +0 -2
- package/dist/abi.js +0 -2
- package/dist/abi.js.map +1 -1
- package/dist/coins.d.ts +2 -1
- package/dist/coins.js +2 -1
- package/dist/coins.js.map +1 -1
- package/dist/docs.js +4 -3
- package/dist/docs.js.map +1 -1
- package/dist/format.d.ts +2 -1
- package/dist/format.js +3 -2
- package/dist/format.js.map +1 -1
- package/dist/parabolic.d.ts +50 -1
- package/dist/parabolic.js +72 -11
- package/dist/parabolic.js.map +1 -1
- package/dist/restapi.d.ts +66 -1
- package/dist/restapi.js +83 -3
- package/dist/restapi.js.map +1 -1
- package/dist/routed.d.ts +51 -3
- package/dist/routed.js +82 -18
- package/dist/routed.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +25 -3
- package/dist/server.js.map +1 -1
- package/dist/venue-history.d.ts +19 -0
- package/dist/venue-history.js +63 -0
- package/dist/venue-history.js.map +1 -0
- package/dist/venues.d.ts +49 -0
- package/dist/venues.js +28 -0
- package/dist/venues.js.map +1 -1
- package/package.json +2 -2
- package/src/abi.ts +0 -3
- package/src/coins.ts +4 -2
- package/src/docs.ts +4 -3
- package/src/format.ts +3 -2
- package/src/parabolic.ts +71 -12
- package/src/restapi.ts +76 -5
- package/src/routed.ts +76 -17
- package/src/server.ts +30 -3
- package/src/venue-history.ts +69 -0
- package/src/venues.ts +43 -0
package/src/venues.ts
CHANGED
|
@@ -91,3 +91,46 @@ export function venueSubgraphsFrom(env: Record<string, string | undefined>, chai
|
|
|
91
91
|
}
|
|
92
92
|
return out;
|
|
93
93
|
}
|
|
94
|
+
|
|
95
|
+
// ---- reading another launchpad's coin through the Parabolic site (docs/52 P-D) ----------------------------------
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A coin made on another launchpad, as the site writes its reference: `<chain>:<venue>:0x…` (`rhc:pons:0x…`,
|
|
99
|
+
* `arc:solonpad:0x…`), or `<venue>:0x…` on this server's chain. Undefined for anything else, so a plain address or a
|
|
100
|
+
* Parabolic ref (`rhc:0x…`) keeps the path it has always taken. The venue is any lowercase word the site might know
|
|
101
|
+
* (it knows more launchpads than this package routes); the site answers a 400 for one it does not read there.
|
|
102
|
+
*/
|
|
103
|
+
export type VenueRefInput = { chainPart?: string; venue: string; address: Address };
|
|
104
|
+
export function parseVenueRefInput(input: string): VenueRefInput | undefined {
|
|
105
|
+
const parts = String(input ?? "").trim().split(":");
|
|
106
|
+
if (parts.length < 2 || parts.length > 3) return undefined;
|
|
107
|
+
const address = parts[parts.length - 1];
|
|
108
|
+
const venue = parts[parts.length - 2].toLowerCase();
|
|
109
|
+
if (!/^0x[0-9a-fA-F]{40}$/.test(address) || !/^[a-z]{2,24}$/.test(venue) || venue === "parabolic") return undefined;
|
|
110
|
+
// `rhc:0x…` is a chain prefix, not a venue: a two-part ref whose first part names a chain is Parabolic's.
|
|
111
|
+
if (parts.length === 2 && ["arc", "rhc", "base", "eth", "bnb", "sol", "arct", "anvil"].includes(venue)) return undefined;
|
|
112
|
+
return { ...(parts.length === 3 ? { chainPart: parts[0].toLowerCase() } : {}), venue, address: address as Address };
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The coin as the site's public API answers it (web/lib/api/coins.ts `serializeCoin`), the fields this package reads. */
|
|
116
|
+
export type SiteVenueCoin = {
|
|
117
|
+
chain?: string; venue?: string; address: string; curve?: string | null; name: string; ticker: string; creator: string | null; logo?: string | null; description?: string | null;
|
|
118
|
+
pair: string; pairToken?: string | null; quoteDecimals?: number | null; quoteDollar?: boolean | null;
|
|
119
|
+
status: "climbing" | "graduated"; price: number; marketCap: number; raised: number; threshold: number; progressPct: number;
|
|
120
|
+
holders?: number | null; volume24h?: number | null; change24h?: number | null; tradeCount?: number | null;
|
|
121
|
+
createdAt?: number | null; lastTradeAt?: number | null; graduatedAt?: number | null; poolId?: string | null; url?: string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* One venue coin from the site (GET <api>/coins/{address}?chain=<key>&venue=<id>), which reads the launchpad's index or
|
|
126
|
+
* subgraph and, for a coin neither holds, the launchpad's own factory at the head. Undefined on a 404 (no such coin on
|
|
127
|
+
* that launchpad); any other failure throws a sentence naming the site's answer, never the URL's query.
|
|
128
|
+
*/
|
|
129
|
+
export async function fetchSiteVenueCoin(apiUrl: string, chainKey: string, venue: string, address: Address, fetchImpl: typeof fetch = fetch): Promise<SiteVenueCoin | undefined> {
|
|
130
|
+
const base = apiUrl.replace(/\/+$/, "");
|
|
131
|
+
const res = await fetchImpl(`${base}/coins/${address}?chain=${encodeURIComponent(chainKey)}&venue=${encodeURIComponent(venue)}`, { headers: { accept: "application/json" }, signal: AbortSignal.timeout(10_000) });
|
|
132
|
+
if (res.status === 404) return undefined;
|
|
133
|
+
const body = (await res.json().catch(() => ({}))) as { coin?: SiteVenueCoin; error?: string };
|
|
134
|
+
if (!res.ok || !body.coin) throw new Error(`The Parabolic site could not read that coin (HTTP ${res.status}${body.error ? `: ${body.error}` : ""}).`);
|
|
135
|
+
return body.coin;
|
|
136
|
+
}
|