diff --git a/packages/shared/package.json b/packages/shared/package.json index e2d2444..6fb9ce2 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -10,7 +10,8 @@ "./chain": "./src/chain/index.ts", "./cbor": "./src/cbor/index.ts", "./receipt": "./src/receipt/index.ts", - "./tx": "./src/tx/index.ts" + "./tx": "./src/tx/index.ts", + "./tx/server": "./src/tx/server.ts" }, "scripts": { "typecheck": "tsc --noEmit" diff --git a/packages/shared/src/tx/index.ts b/packages/shared/src/tx/index.ts index 8928b73..2e967a1 100644 --- a/packages/shared/src/tx/index.ts +++ b/packages/shared/src/tx/index.ts @@ -10,14 +10,11 @@ export type { Signer } from "./signer.js"; export { MockSigner } from "./signer.js"; export type { Blueprint } from "./blueprint.js"; export { loadBlueprint } from "./blueprint.js"; -// Script-bytes loaders (used by the publish-reference-scripts CLI). -export { loadEscrowScript, loadAdvertScript } from "./internal/liveCbor.js"; -export { pkhToEnterpriseAddress } from "./internal/pkhAddress.js"; -export type { - LivePublishRefScriptsParams, - PublishRefScriptsBuildResult, -} from "./internal/publishReferenceScripts.js"; -export { buildLiveTxForPublishReferenceScripts } from "./internal/publishReferenceScripts.js"; +// Note: live-CBOR helpers (loadEscrowScript, loadAdvertScript, +// buildLiveTxForPublishReferenceScripts, pkhToEnterpriseAddress) live in +// "./server.js" — kept OUT of this index so the buyer's vite bundle +// doesn't trace into lucid-evolution / CML WASM (sibling builders use +// /* @vite-ignore */ dynamic imports for the same reason). // Advert builders export type { PostAdvertParams } from "./advert/postAdvert.js"; diff --git a/packages/shared/src/tx/server.ts b/packages/shared/src/tx/server.ts new file mode 100644 index 0000000..9aeb349 --- /dev/null +++ b/packages/shared/src/tx/server.ts @@ -0,0 +1,18 @@ +/** + * tx/server.ts — server-only re-exports. + * + * These bind the lucid-evolution + CML WASM dep graph at import time, so + * they MUST NOT be imported from anything that gets bundled by Vite (i.e. + * the buyer UI). The buyer SDK uses /* @vite-ignore *\/ dynamic imports + * to reach the live-CBOR builders for the same reason. + * + * Consumers: supplier CLIs and Node-only tx tooling. + */ + +export { loadEscrowScript, loadAdvertScript } from "./internal/liveCbor.js"; +export { pkhToEnterpriseAddress } from "./internal/pkhAddress.js"; +export type { + LivePublishRefScriptsParams, + PublishRefScriptsBuildResult, +} from "./internal/publishReferenceScripts.js"; +export { buildLiveTxForPublishReferenceScripts } from "./internal/publishReferenceScripts.js"; diff --git a/supplier/src/cli/publish-reference-scripts.ts b/supplier/src/cli/publish-reference-scripts.ts index 84e8faf..82c190f 100644 --- a/supplier/src/cli/publish-reference-scripts.ts +++ b/supplier/src/cli/publish-reference-scripts.ts @@ -25,13 +25,13 @@ import * as ed from "@noble/ed25519"; import { blake2b } from "@noble/hashes/blake2b"; import { bech32 } from "bech32"; import { LiveOgmiosProvider } from "@marketplace/shared/chain"; +import type { WalletKey } from "@marketplace/shared/tx"; import { buildLiveTxForPublishReferenceScripts, loadEscrowScript, loadAdvertScript, pkhToEnterpriseAddress, -} from "@marketplace/shared/tx"; -import type { WalletKey } from "@marketplace/shared/tx"; +} from "@marketplace/shared/tx/server"; ed.etc.sha512Sync = (...messages: Uint8Array[]): Uint8Array => { const h = createHash("sha512");