caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

57 lines
1.9 KiB
JavaScript

// Make the deploy-kit runnable without a separate install.
//
// The kit's FPMM factory step is plain Node + viem (Solidity ^0.5.1 can't share
// the ^0.8 forge-std Script the other two use, exactly as fpmm/deploy-fpmm.mjs).
// Rather than duplicate a full install we reuse the sibling predikt-relay's
// already-installed node_modules by symlinking the exact packages viem needs
// into this folder's node_modules. Idempotent — run it as often as you like.
import { existsSync, mkdirSync, symlinkSync, rmSync, lstatSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const __dirname = dirname(fileURLToPath(import.meta.url));
// deploy-kit/ -> predikt-contracts/ -> prediction/ -> predikt-relay
const RELAY_NM = resolve(__dirname, "../../predikt-relay/node_modules");
const LOCAL_NM = resolve(__dirname, "node_modules");
// viem's runtime dependency closure (viem 2.x).
const PKGS = ["viem", "abitype", "ox", "@noble", "@scure", "@adraffy"];
function safeLstat(p) {
try {
return lstatSync(p);
} catch {
return null;
}
}
function link(pkg) {
const src = resolve(RELAY_NM, pkg);
const dst = resolve(LOCAL_NM, pkg);
if (!existsSync(src)) {
console.error(
`[setup-deps] MISSING: ${src}\n` +
` Install the relay deps first: (cd ../../predikt-relay && npm install)`,
);
process.exitCode = 1;
return;
}
if (pkg.includes("/")) mkdirSync(dirname(dst), { recursive: true });
try {
if (existsSync(dst) || safeLstat(dst)) rmSync(dst, { recursive: true, force: true });
} catch {
/* ignore */
}
symlinkSync(src, dst, "dir");
}
mkdirSync(LOCAL_NM, { recursive: true });
for (const p of PKGS) link(p);
if (process.exitCode) {
console.error("[setup-deps] failed — see missing packages above.");
} else {
console.log("[setup-deps] viem + deps linked from predikt-relay/node_modules");
}