@toon-protocol/client 0.21.0 → 0.21.1
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/dist/{chunk-OM3MHJHC.js → chunk-7TDAU43L.js} +108 -14
- package/dist/chunk-7TDAU43L.js.map +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +37 -11
- package/dist/index.js.map +1 -1
- package/dist/{mina-channel-deploy-CO2LMPPB.js → mina-channel-deploy-5GPMFBGR.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-OM3MHJHC.js.map +0 -1
- /package/dist/{mina-channel-deploy-CO2LMPPB.js.map → mina-channel-deploy-5GPMFBGR.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deployMinaChannelZkApp,
|
|
3
3
|
ensureOwnedMinaZkApp
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7TDAU43L.js";
|
|
5
5
|
export {
|
|
6
6
|
deployMinaChannelZkApp,
|
|
7
7
|
ensureOwnedMinaZkApp
|
|
8
8
|
};
|
|
9
|
-
//# sourceMappingURL=mina-channel-deploy-
|
|
9
|
+
//# sourceMappingURL=mina-channel-deploy-5GPMFBGR.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/channel/mina-channel-deploy.ts","../src/channel/mina-channel-open.ts"],"sourcesContent":["/**\n * Per-pair Mina `PaymentChannel` zkApp deployment — the missing zero-config\n * piece of the Mina channel-open path.\n *\n * The `PaymentChannel` zkApp is SINGLE-PAIR: `initializeChannel` bakes\n * `channelHash = Poseidon([participantA.x, participantB.x, nonce])` into the\n * zkApp's on-chain state, and the zkApp address IS the channel id. One\n * deployment therefore serves exactly one client↔connector pair — a fresh\n * client cannot reuse the pair-bound zkApp another identity opened (its claim\n * would fail `mina_claim_verification_failed`: wrong on-chain channelHash).\n *\n * {@link ensureOwnedMinaZkApp} makes the open path self-sufficient:\n *\n * 1. Check the candidates (a previously recorded own deployment first, then\n * the announce/preset-resolved address) for a zkApp that is ALREADY OURS\n * — on-chain OPEN with channelHash == Poseidon([client.x, peer.x, 0]),\n * or our own recorded deployment still awaiting initialization.\n * 2. Otherwise deploy a FRESH zkApp (new random zkApp key) from the same\n * npm `@toon-protocol/mina-zkapp` + o1js build the claim verifier uses —\n * the deployed verification key is the locally compiled one BY\n * CONSTRUCTION, so the \"vk drift\" class of failure cannot occur.\n *\n * The connector accepts claims against ANY zkApp it can read on-chain (its\n * inbound verify resolves the claim's `zkAppAddress` on-chain and registers\n * unknown channels dynamically), so no connector-side registration step is\n * needed.\n *\n * Deploy and initialize are SEPARATE transactions (connector Issue #128:\n * `initializeChannel`'s `getAndRequireEquals` precondition fails while the\n * account does not exist yet) — this module only DEPLOYS; the normal\n * {@link openMinaChannelOnChain} initialize+deposit flow runs afterwards.\n *\n * Reuses the `createRequire`-anchored o1js loader from `mina-channel-open.ts`\n * (one shared CJS o1js instance — the ESM/CJS split instance bug) and stays\n * lazy so npm consumers who never touch Mina never load the WASM runtime.\n *\n * @module\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { hexToMinaBase58PrivateKey } from '@toon-protocol/core';\nimport {\n getCompiledPaymentChannel,\n getCompiledVerificationKeyHash,\n loadMinaRuntime,\n} from './mina-channel-open.js';\n\n/** PaymentChannel appState indices (see mina-channel-open.ts). */\nconst APPSTATE_CHANNEL_HASH = 0;\nconst APPSTATE_CHANNEL_STATE = 3;\n/** CHANNEL_STATE values. */\nconst STATE_UNINITIALIZED = 0n;\nconst STATE_OPEN = 1n;\n\n/** Everything worth persisting about an auto-deployed zkApp. */\nexport interface MinaZkAppDeployRecord {\n /** The deployed zkApp B62 address (== the channel id). */\n zkAppAddress: string;\n /** The zkApp's `EK…` base58 private key (needed to co-sign future txs). */\n zkAppPrivateKey: string;\n /** The fee payer (client Mina B62) that funded the deployment. */\n feePayer: string;\n /** Deploy tx hash, when the send surfaced one. */\n deployTxHash?: string;\n /** Verification-key hash of the compiled contract that was deployed. */\n vkHash?: string;\n}\n\nexport interface DeployMinaZkAppParams {\n /** Mina GraphQL endpoint to deploy through. */\n graphqlUrl: string;\n /** Fee payer private key (hex scalar or `EK…` base58 — same as the opener). */\n payerPrivateKey: string;\n /**\n * Deploy fee in nanomina. Default 100_000_000 (0.1 MINA); the new zkApp\n * account additionally costs the protocol's 1 MINA account-creation fee,\n * charged to the payer via `AccountUpdate.fundNewAccount`.\n */\n feeNanomina?: bigint;\n /** Progress lines (compile/deploy/inclusion phases take minutes). */\n onProgress?: (line: string) => void;\n /** Inclusion poll interval ms (default 15_000; tests shrink it). */\n pollIntervalMs?: number;\n /** Inclusion poll budget ms (default 540_000 ≈ 9 min). */\n pollTimeoutMs?: number;\n}\n\nexport interface EnsureOwnedMinaZkAppParams extends DeployMinaZkAppParams {\n /** The connector peer's Mina settlement B62 (participantB of the pair). */\n peerPublicKey: string;\n /** A previously recorded own deployment for this identity/pair, if any. */\n deployed?: { zkAppAddress: string; zkAppPrivateKey: string };\n /** The announce/preset-resolved zkApp address (checked after `deployed`). */\n candidateZkAppAddress?: string;\n /**\n * Called with the record IMMEDIATELY after a fresh deployment is confirmed\n * on-chain — BEFORE this function returns — so the zkApp key is persisted\n * even if the caller's subsequent initialize fails.\n */\n onDeployed?: (record: MinaZkAppDeployRecord) => void | Promise<void>;\n}\n\nexport interface EnsureOwnedMinaZkAppResult {\n /** The zkApp to open the channel on (ours — reused or freshly deployed). */\n zkAppAddress: string;\n /** True when this call deployed a fresh zkApp. */\n deployed: boolean;\n /** The deploy record (fresh deploys only). */\n record?: MinaZkAppDeployRecord;\n}\n\nconst sleep = (ms: number): Promise<void> =>\n new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Deploy a fresh `PaymentChannel` zkApp (BARE — no initialization) and wait\n * for the account to exist on-chain. Returns the full deploy record; the\n * caller persists it (losing the zkApp key would strand the ~1.1 MINA the\n * deployment cost).\n */\nexport async function deployMinaChannelZkApp(\n params: DeployMinaZkAppParams\n): Promise<MinaZkAppDeployRecord> {\n const { o1js } = await loadMinaRuntime();\n const { Mina, PrivateKey, AccountUpdate, fetchAccount } = o1js;\n const progress = params.onProgress ?? (() => {});\n\n const network = Mina.Network(params.graphqlUrl);\n Mina.setActiveInstance(network);\n\n const payerKeyBase58 = hexToMinaBase58PrivateKey(params.payerPrivateKey);\n const payerPrivateKey = PrivateKey.fromBase58(payerKeyBase58);\n const payerPublicKey = payerPrivateKey.toPublicKey();\n\n progress(\n 'compiling the PaymentChannel circuit (one-time, can take 1-3 minutes)…'\n );\n const PaymentChannel = await getCompiledPaymentChannel();\n\n const zkAppPrivateKey = PrivateKey.random();\n const zkAppPublicKey = zkAppPrivateKey.toPublicKey();\n const zkAppAddress: string = zkAppPublicKey.toBase58();\n const zkApp = new PaymentChannel(zkAppPublicKey);\n\n // The payer account must be in the active-instance cache for the fee/nonce.\n await fetchAccount({ publicKey: payerPublicKey });\n\n progress(\n `deploying a dedicated PaymentChannel zkApp ${zkAppAddress} ` +\n '(costs the 1 MINA account-creation fee + tx fee)…'\n );\n const fee = Number(params.feeNanomina ?? 100_000_000n);\n // Deploy ONLY — initialize is a separate tx (Issue #128: the initialize\n // precondition needs the account to already exist).\n const deployTx = await Mina.transaction(\n { sender: payerPublicKey, fee },\n async () => {\n AccountUpdate.fundNewAccount(payerPublicKey);\n await zkApp.deploy();\n }\n );\n await deployTx.prove();\n const sent = await deployTx.sign([payerPrivateKey, zkAppPrivateKey]).send();\n const deployTxHash: string | undefined = sent.hash ?? undefined;\n\n progress(\n `deploy tx sent${deployTxHash ? ` (${deployTxHash})` : ''} — waiting for ` +\n 'inclusion (devnet blocks are ~3 minutes)…'\n );\n // Poll fetchAccount rather than trusting `.wait()` alone: what the opener\n // needs is the ACCOUNT resolvable through this GraphQL endpoint.\n const interval = params.pollIntervalMs ?? 15_000;\n const budget = params.pollTimeoutMs ?? 540_000;\n const started = Date.now();\n // Best-effort `.wait()` first — on some o1js versions it returns promptly\n // after inclusion, which shortcuts the polling below.\n try {\n await sent.wait();\n } catch {\n // fall through to polling — some endpoints reject the wait subscription\n }\n for (;;) {\n const res = await fetchAccount({ publicKey: zkAppPublicKey });\n if (!res.error && res.account) break;\n if (Date.now() - started > budget) {\n throw new Error(\n `Mina zkApp ${zkAppAddress} did not appear on-chain within ` +\n `${Math.round(budget / 60_000)} minutes of the deploy tx` +\n `${deployTxHash ? ` (${deployTxHash})` : ''} — check the tx on ` +\n 'minascan before retrying (the zkApp key has been recorded)'\n );\n }\n await sleep(interval);\n }\n progress(`zkApp ${zkAppAddress} is on-chain (bare — initialize follows).`);\n\n return {\n zkAppAddress,\n zkAppPrivateKey: zkAppPrivateKey.toBase58(),\n feePayer: payerPublicKey.toBase58(),\n ...(deployTxHash !== undefined ? { deployTxHash } : {}),\n ...(getCompiledVerificationKeyHash() !== undefined\n ? { vkHash: getCompiledVerificationKeyHash() }\n : {}),\n };\n}\n\n/**\n * Resolve the zkApp this (client, peer) pair should open its channel on:\n * reuse one that is provably ours, else deploy fresh. See the module doc for\n * the decision table.\n */\nexport async function ensureOwnedMinaZkApp(\n params: EnsureOwnedMinaZkAppParams\n): Promise<EnsureOwnedMinaZkAppResult> {\n const { o1js } = await loadMinaRuntime();\n const { Mina, PrivateKey, PublicKey, Field, Poseidon, fetchAccount } = o1js;\n const progress = params.onProgress ?? (() => {});\n\n const network = Mina.Network(params.graphqlUrl);\n Mina.setActiveInstance(network);\n\n const payerKeyBase58 = hexToMinaBase58PrivateKey(params.payerPrivateKey);\n const clientPublicKey = PrivateKey.fromBase58(payerKeyBase58).toPublicKey();\n const peerPublicKey = PublicKey.fromBase58(params.peerPublicKey);\n\n // The participant-form pair hash `initializeChannel` bakes on-chain (and the\n // off-chain claim signer binds to): Poseidon([A.x, B.x, nonce=0]).\n if (!Poseidon) {\n throw new Error(\n 'the loaded o1js runtime does not expose Poseidon — cannot derive the pair hash'\n );\n }\n const expectedChannelHash: string = Poseidon.hash([\n clientPublicKey.x,\n peerPublicKey.x,\n Field(0),\n ]).toString();\n\n interface Candidate {\n address: string;\n ownRecord: boolean;\n }\n const candidates: Candidate[] = [];\n if (params.deployed?.zkAppAddress) {\n candidates.push({ address: params.deployed.zkAppAddress, ownRecord: true });\n }\n if (\n params.candidateZkAppAddress &&\n params.candidateZkAppAddress !== params.deployed?.zkAppAddress\n ) {\n candidates.push({\n address: params.candidateZkAppAddress,\n ownRecord: false,\n });\n }\n\n for (const candidate of candidates) {\n let appState: { toString(): string }[] | undefined;\n try {\n const res = await fetchAccount({\n publicKey: PublicKey.fromBase58(candidate.address),\n });\n if (res.error || !res.account) continue; // not on-chain → not usable\n appState = res.account.zkapp?.appState;\n } catch {\n continue;\n }\n const channelHash = appState?.[APPSTATE_CHANNEL_HASH]?.toString() ?? '';\n const channelState = BigInt(\n appState?.[APPSTATE_CHANNEL_STATE]?.toString() ?? '0'\n );\n if (channelState === STATE_OPEN && channelHash === expectedChannelHash) {\n // OPEN for exactly our pair — ours, reuse (open is idempotent on it).\n progress(`reusing our open Mina channel zkApp ${candidate.address}.`);\n return { zkAppAddress: candidate.address, deployed: false };\n }\n if (candidate.ownRecord && channelState === STATE_UNINITIALIZED) {\n // Our own recorded deployment that never got initialized (crash between\n // deploy and init) — reuse it; the normal open initializes it.\n progress(\n `reusing our recorded (uninitialized) Mina zkApp ${candidate.address}.`\n );\n return { zkAppAddress: candidate.address, deployed: false };\n }\n // Anything else — a foreign pair's channel, the shared announce zkApp\n // someone already initialized, CLOSING/SETTLED remnants — is not ours.\n }\n\n // No usable candidate: deploy a dedicated zkApp for this pair.\n const record = await deployMinaChannelZkApp(params);\n // Persist BEFORE returning: if the caller's initialize fails, the zkApp key\n // (and the ~1.1 MINA it cost) must not be lost.\n await params.onDeployed?.(record);\n return { zkAppAddress: record.zkAppAddress, deployed: true, record };\n}\n","/**\n * On-chain Mina payment-channel open — connector-parity.\n *\n * Opens (initializes) — and optionally deposits into — a REAL on-chain Mina\n * payment channel on the deployed `PaymentChannel` zkApp, so the connector's\n * `MinaPaymentChannelSDK.getChannelState(zkAppAddress)` finds a channel whose\n * on-chain `channelState == OPEN` (status `'opened'`) and the Mina claim\n * verifies + stores. This is the Mina analog of `openSolanaChannel`\n * (`solana-payment-channel.ts`, connector#105): the client opens its own\n * per-channel on-chain state rather than relying on a pre-initialized channel.\n *\n * ## Why this is separate from `mina-payment-channel.ts`\n *\n * `mina-payment-channel.ts` builds the OFF-chain balance-proof claim with\n * `mina-signer` (no o1js — keeps the client lightweight). But INITIALIZING a\n * zkApp channel requires producing a zkApp method proof, which is heavyweight\n * o1js WASM circuit work. So this module lazily imports `o1js` +\n * `@toon-protocol/mina-zkapp` ONLY when an on-chain open is actually requested\n * (the e2e client / Node settlement path), mirroring the connector's own\n * `getO1js()` lazy-require. Both are OPTIONAL dependencies and are kept out of\n * the bundle via `tsup` `external` so npm consumers that never open a Mina\n * channel don't pay the o1js cost.\n *\n * ## Contract call (must match the connector's `MinaPaymentChannelSDK.openChannel`)\n *\n * `PaymentChannel.initializeChannel(participantA, participantB, nonce, timeout, tokenId)`\n * sets `channelState = OPEN` (1). The deployed zkApp address IS the channel id\n * (`MinaClaimMessage.zkAppAddress`), identical to the claim's channel-hash\n * preimage in `mina-payment-channel.ts`. `deposit(amount, depositor)` then\n * bumps `depositTotal` (only valid while `channelState == OPEN`).\n *\n * The zkApp is deployed out-of-band (the operator/e2e harness deploys it\n * deterministically and advertises its B62 address); this module assumes the\n * account exists and only INITIALIZES the channel on it (idempotent — if the\n * channel is already `OPEN`, it returns without re-initializing).\n *\n * @module\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { hexToMinaBase58PrivateKey } from '@toon-protocol/core';\n\n/** Result shape of o1js `fetchAccount` (the bits we read). */\ninterface FetchAccountResult {\n error?: unknown;\n account?: {\n zkapp?: { appState?: { toString(): string }[] };\n };\n}\n\n/** Minimal o1js surface this module uses (lazy-loaded). */\nexport interface O1jsLike {\n Mina: any;\n PrivateKey: any;\n PublicKey: any;\n Field: any;\n AccountUpdate: any;\n /** Present on the real o1js; the deploy/ownership path uses it. */\n Poseidon?: any;\n fetchAccount: (args: { publicKey: any }) => Promise<FetchAccountResult>;\n}\n\nlet cachedO1js: O1jsLike | null = null;\nlet cachedPaymentChannel: any | null = null;\nlet compiledContract: any | null = null;\n\n/**\n * Test-only override for the o1js + contract loader. When set, `loadMinaRuntime`\n * returns this instead of doing the `createRequire` resolution — so unit tests\n * can inject fakes WITHOUT pulling the real o1js WASM runtime (vitest's\n * `vi.mock` cannot intercept the CJS `require` path the production loader uses).\n */\nlet runtimeOverride:\n | (() => Promise<{ o1js: O1jsLike; PaymentChannel: any }>)\n | null = null;\n\n/** Test hook: inject a fake o1js + PaymentChannel runtime. */\nexport function _setMinaRuntimeForTests(\n loader: (() => Promise<{ o1js: O1jsLike; PaymentChannel: any }>) | null\n): void {\n runtimeOverride = loader;\n}\n\n/**\n * Resolve `o1js` AND the `PaymentChannel` contract through ONE shared module\n * instance.\n *\n * ⚠️ o1js keeps its \"active Mina instance\" in a module-level closure\n * (`mina-instance.js`). `@toon-protocol/mina-zkapp` ships as CommonJS, so its\n * internal `import {Mina}` is emitted as `require('o1js')` → o1js's CJS build\n * (`dist/node/index.cjs`). A bare ESM `import('o1js')` from this module resolves\n * o1js's DIFFERENT ESM build (`dist/node/index.js`) — a SEPARATE module instance\n * with a SEPARATE `activeInstance` closure. Calling `setActiveInstance` on the\n * ESM instance while `PaymentChannel.initializeChannel` reads the CJS instance\n * throws `channelState.get() failed … Must call Mina.setActiveInstance first`\n * (observed in the local-HS Mina e2e on the FIRST publish). The connector's own\n * settlement path and `scripts/deploy-mina-zkapp.ts` both work around this by\n * requiring o1js through the same anchor the zkApp uses.\n *\n * Fix: anchor a `createRequire` at the `@toon-protocol/mina-zkapp` package and\n * `require('o1js')` + the contract from there, so both share the CJS o1js\n * instance and `setActiveInstance` is visible inside the contract method. Kept\n * lazy (and `external` in tsup) so the multi-hundred-MB WASM runtime is only\n * loaded when a Mina channel is actually opened.\n */\nexport async function loadMinaRuntime(): Promise<{\n o1js: O1jsLike;\n PaymentChannel: any;\n}> {\n if (cachedO1js && cachedPaymentChannel) {\n return { o1js: cachedO1js, PaymentChannel: cachedPaymentChannel };\n }\n if (runtimeOverride) {\n const injected = await runtimeOverride();\n cachedO1js = injected.o1js;\n cachedPaymentChannel = injected.PaymentChannel;\n return injected;\n }\n const { createRequire } = await import('node:module');\n const nodePath = await import('node:path');\n // Anchor resolution at this module so the consumer's node_modules graph (where\n // both o1js and @toon-protocol/mina-zkapp are installed) resolves them, then\n // re-anchor at the mina-zkapp package so its CJS `require('o1js')` and ours are\n // the SAME physical module instance (shared active-instance closure).\n const requireHere = createRequire(import.meta.url);\n const mzkPkgPath = requireHere.resolve(\n '@toon-protocol/mina-zkapp/package.json'\n );\n const requireFromMzk = createRequire(mzkPkgPath);\n // o1js resolved from the mina-zkapp anchor → the SAME (CJS) instance the\n // contract's `require('o1js')` uses.\n const o1js = requireFromMzk('o1js') as O1jsLike;\n // ⚠️ A pnpm workspace package has NO self-referential symlink, so\n // `requireFromMzk('@toon-protocol/mina-zkapp')` fails with MODULE_NOT_FOUND.\n // Load the contract by PATH from the package's own `main` entry instead (the\n // same approach scripts/deploy-mina-zkapp.ts uses). This works in both the\n // workspace (no self-symlink) and the flat consumer node_modules layouts.\n const mzkPkgJson: { main?: string } = requireFromMzk(mzkPkgPath);\n const mzkDir = nodePath.dirname(mzkPkgPath);\n const mzkEntry = nodePath.join(mzkDir, mzkPkgJson.main ?? 'dist/index.js');\n const mzk: any = requireFromMzk(mzkEntry);\n const PaymentChannel = mzk.PaymentChannel ?? mzk.default?.PaymentChannel;\n if (!PaymentChannel) {\n throw new Error(\n '@toon-protocol/mina-zkapp does not export PaymentChannel — cannot open a Mina channel'\n );\n }\n cachedO1js = o1js;\n cachedPaymentChannel = PaymentChannel;\n return { o1js, PaymentChannel };\n}\n\n/** Lazily resolve `o1js` (shared CJS instance with the contract). */\nasync function getO1js(): Promise<O1jsLike> {\n return (await loadMinaRuntime()).o1js;\n}\n\nlet compiledVerificationKeyHash: string | undefined;\n\n/**\n * Lazily resolve + compile the `PaymentChannel` contract. Compilation is the\n * expensive o1js step; cache the compiled artifact so repeated opens in the\n * same process don't recompile.\n */\nexport async function getCompiledPaymentChannel(): Promise<any> {\n const { PaymentChannel } = await loadMinaRuntime();\n if (!compiledContract) {\n const compiled = await PaymentChannel.compile();\n // Record the vk hash for the deploy path's provenance record (drift\n // debugging: the deployed vk IS this locally compiled one by\n // construction, but keeping the hash makes that checkable later).\n compiledVerificationKeyHash =\n compiled?.verificationKey?.hash?.toString() ?? undefined;\n compiledContract = PaymentChannel;\n }\n return compiledContract;\n}\n\n/** The vk hash of the last {@link getCompiledPaymentChannel} compile, if any. */\nexport function getCompiledVerificationKeyHash(): string | undefined {\n return compiledVerificationKeyHash;\n}\n\n/** Test hook: reset the cached o1js + compiled-contract state. */\nexport function _resetMinaChannelOpenCache(): void {\n cachedO1js = null;\n cachedPaymentChannel = null;\n compiledContract = null;\n compiledVerificationKeyHash = undefined;\n}\n\n/** CHANNEL_STATE.OPEN from `@toon-protocol/mina-zkapp` constants. */\nconst MINA_CHANNEL_STATE_OPEN = 1n;\n/** CHANNEL_STATE.UNINITIALIZED. */\nconst MINA_CHANNEL_STATE_UNINITIALIZED = 0n;\n\nexport interface OpenMinaChannelParams {\n /** Mina GraphQL endpoint of the network the zkApp is deployed on. */\n graphqlUrl: string;\n /** Deployed payment-channel zkApp B62 address (the channel id). */\n zkAppAddress: string;\n /**\n * Fee-payer / participantA `EK…` base58 private key — the client's Mina key\n * (same key the off-chain claim is signed with). Pays the Mina tx fee and\n * authorizes the `initializeChannel` (+ `deposit`) transaction.\n */\n payerPrivateKey: string;\n /**\n * participantB B62 public key — the apex's Mina settlement address. When\n * omitted, the payer is used for both participants (single-party dev channel).\n */\n peerPublicKey?: string;\n /** Channel settlement timeout in slots. Default 86400. */\n timeout?: bigint;\n /** Mina token id field (decimal string). Default '1' (native MINA). */\n tokenId?: string;\n /** Optional on-chain deposit amount (base units) after initialization. */\n deposit?: { amount: bigint };\n /** Per-call network id for the Schnorr/account prefix. Default 'devnet'. */\n networkId?: 'devnet' | 'mainnet';\n /**\n * Transaction fee in nanomina for the `initializeChannel` + `deposit` zkApp\n * method calls. Lightnet/devnet REJECTS fee-less zkApp commands with\n * \"Insufficient fee\", so a non-zero fee is REQUIRED. Default 100_000_000\n * (0.1 MINA), matching scripts/deploy-mina-zkapp.ts.\n */\n feeNanomina?: bigint;\n}\n\nexport interface OpenMinaChannelResult {\n /** The zkApp address (channel id) — echoed for parity with the Solana opener. */\n zkAppAddress: string;\n /** True when a fresh `initializeChannel` tx was submitted this call. */\n opened: boolean;\n /** `initializeChannel` tx hash (absent when the channel was already OPEN). */\n initTxHash?: string;\n /** `deposit` tx hash, when a deposit was requested + submitted. */\n depositTxHash?: string;\n /** On-chain channelState after the call (0=UNINIT,1=OPEN,2=CLOSING,3=SETTLED). */\n channelState: number;\n /**\n * On-chain `depositTotal` (base units), read from the zkApp appState after the\n * open/deposit settled. The Mina balance-proof signer needs this so it can bind\n * `balanceB = depositTotal − balanceA` (toon-protocol/connector#133). A channel\n * can be re-deposited, so this is the CURRENT on-chain value, not a config one.\n */\n depositTotal: bigint;\n}\n\n/**\n * Open (initialize) — and optionally deposit into — a real on-chain Mina\n * payment channel on the already-deployed `PaymentChannel` zkApp.\n *\n * Idempotent: if the on-chain `channelState` is already `OPEN`, returns without\n * re-initializing (mirrors `openSolanaChannel`'s \"channel already exists\" path).\n * Throws if the zkApp account does not exist on-chain.\n */\nexport async function openMinaChannelOnChain(\n params: OpenMinaChannelParams\n): Promise<OpenMinaChannelResult> {\n const { Mina, PrivateKey, PublicKey, Field, AccountUpdate, fetchAccount } =\n await getO1js();\n\n // Use the plain-string `Mina.Network(graphqlUrl)` form (matching the\n // connector's MinaPaymentChannelSDK._setNetwork). The object form\n // (`{ networkId, mina }`) behaves inconsistently across o1js versions and left\n // the active-instance ledger unable to resolve fetched accounts\n // (`channelState.get()` → \"we can't find this zkapp account\"). The Schnorr\n // network prefix is governed by the off-chain signer (`networkId`), not this\n // on-chain endpoint binding.\n const network = Mina.Network(params.graphqlUrl);\n Mina.setActiveInstance(network);\n\n // zkApp method txs MUST carry a fee on lightnet/devnet (\"Insufficient fee\"\n // otherwise). 0.1 MINA matches scripts/deploy-mina-zkapp.ts.\n const txFee = params.feeNanomina ?? 100_000_000n;\n\n // The client's mnemonic-derived Mina key is a big-endian hex scalar (the form\n // `deriveFullIdentity()` emits); o1js `PrivateKey.fromBase58` needs the Mina\n // `EK…` base58check form. Convert (idempotent — passes an already-`EK…` key\n // through unchanged), matching what the off-chain MinaSigner does.\n const payerKeyBase58 = hexToMinaBase58PrivateKey(params.payerPrivateKey);\n const payerPrivateKey = PrivateKey.fromBase58(payerKeyBase58);\n const payerPublicKey = payerPrivateKey.toPublicKey();\n const zkAppPublicKey = PublicKey.fromBase58(params.zkAppAddress);\n\n // Read channelState (appState index 3) straight from the `fetchAccount`\n // result rather than `zkApp.channelState.get()`. `.get()` outside a\n // transaction is fragile here (it can throw \"Must call Mina.setActiveInstance\n // first\" / \"can't find this zkapp account\" even right after a successful\n // fetch); the network-fetched appState array is the reliable source. A\n // missing account is a hard error — the zkApp must be deployed out-of-band.\n const readChannelState = async (): Promise<bigint> => {\n const res = await fetchAccount({ publicKey: zkAppPublicKey });\n if (res.error || !res.account) {\n throw new Error(\n `Mina zkApp account ${params.zkAppAddress} not found on-chain (${String(\n res.error\n )}) — deploy the PaymentChannel zkApp before opening a channel`\n );\n }\n // PaymentChannel state field order: [channelHash, balanceCommitment,\n // nonceField, channelState, depositTotal, ...] → channelState is index 3.\n const appState = res.account.zkapp?.appState;\n const raw = appState?.[3]?.toString() ?? '0';\n return BigInt(raw);\n };\n\n // Read the on-chain `depositTotal` (appState index 4). The signer must bind\n // `balanceB = depositTotal − balanceA` against this CURRENT on-chain value\n // (connector#133); a channel can be re-deposited, so a stale config value\n // would fail the signatureA verification on settle. A missing account is a\n // hard error (same as readChannelState).\n const readDepositTotal = async (): Promise<bigint> => {\n const res = await fetchAccount({ publicKey: zkAppPublicKey });\n if (res.error || !res.account) {\n throw new Error(\n `Mina zkApp account ${params.zkAppAddress} not found on-chain (${String(\n res.error\n )}) — deploy the PaymentChannel zkApp before opening a channel`\n );\n }\n const appState = res.account.zkapp?.appState;\n const raw = appState?.[4]?.toString() ?? '0';\n return BigInt(raw);\n };\n\n const currentState = await readChannelState();\n await fetchAccount({ publicKey: payerPublicKey });\n let opened = false;\n let initTxHash: string | undefined;\n let zkApp: any;\n const getZkApp = async () => {\n if (!zkApp) {\n const PaymentChannel = await getCompiledPaymentChannel();\n zkApp = new PaymentChannel(zkAppPublicKey);\n }\n return zkApp;\n };\n\n if (currentState === MINA_CHANNEL_STATE_UNINITIALIZED) {\n const channel = await getZkApp();\n const participantA = payerPublicKey;\n const participantB = params.peerPublicKey\n ? PublicKey.fromBase58(params.peerPublicKey)\n : payerPublicKey;\n const nonce = Field(0);\n const timeoutField = Field((params.timeout ?? 86400n).toString());\n const tokenIdField = Field(params.tokenId ?? '1');\n\n // `initializeChannel` reads `this.channelState.getAndRequireEquals()` as a\n // precondition, which needs the zkApp account in o1js's active-instance\n // cache. Re-fetch BOTH the zkApp and the fee-payer immediately before\n // building the transaction so the precondition read resolves (a stale or\n // missing cache surfaces as \"channelState.get() failed / Must call\n // setActiveInstance first\" — even though the network IS set).\n await fetchAccount({ publicKey: zkAppPublicKey });\n await fetchAccount({ publicKey: payerPublicKey });\n\n const initTx = await Mina.transaction(\n { sender: payerPublicKey, fee: Number(txFee) },\n async () => {\n await channel.initializeChannel(\n participantA,\n participantB,\n nonce,\n timeoutField,\n tokenIdField\n );\n }\n );\n await initTx.prove();\n const sentInit = await initTx.sign([payerPrivateKey]).send();\n initTxHash = sentInit.hash ?? undefined;\n opened = true;\n // ALWAYS wait for the init tx to be INCLUDED in a block (and re-fetch the\n // account) before returning — NOT only when a deposit follows.\n //\n // Why this matters (issue #158): the two-party `channelHash =\n // Poseidon([client.x, apex.x, 0])` is only written to the zkApp's on-chain\n // state once `initializeChannel` is included in a block. If we fire-and-forget\n // the init tx, the publish proceeds immediately and the connector reads the\n // STILL-BARE zkApp (channelState=0, channelHash empty → `participants:[\"\",\"\"]`)\n // before the init lands, so its participant-form balance-proof reconstruction\n // mismatches → `mina_claim_verification_failed: \"Invalid balance proof\n // signature\"`. The EVM (`waitForTransactionReceipt`) and Solana\n // (`waitForConfirmation`) openers both confirm their open tx before returning;\n // Mina must do the same for parity. `.wait()` blocks until inclusion (lightnet\n // block time can be a few minutes).\n await sentInit.wait();\n await fetchAccount({ publicKey: zkAppPublicKey });\n await fetchAccount({ publicKey: payerPublicKey });\n } else if (currentState !== MINA_CHANNEL_STATE_OPEN) {\n // CLOSING (2) or SETTLED (3): cannot (re)open. Surface clearly.\n throw new Error(\n `Mina channel ${params.zkAppAddress} is in state ${currentState} (not UNINITIALIZED/OPEN) — cannot open`\n );\n }\n\n // Optional deposit (only valid while OPEN — which it now is).\n let depositTxHash: string | undefined;\n if (params.deposit && params.deposit.amount > 0n) {\n const channel = await getZkApp();\n // Re-fetch so the deposit tx sees the post-init state.\n await fetchAccount({ publicKey: zkAppPublicKey });\n const amountField = Field(params.deposit.amount.toString());\n const depositTx = await Mina.transaction(\n { sender: payerPublicKey, fee: Number(txFee) },\n async () => {\n await channel.deposit(amountField, payerPublicKey);\n }\n );\n await depositTx.prove();\n const sentDeposit = await depositTx.sign([payerPrivateKey]).send();\n depositTxHash = sentDeposit.hash ?? undefined;\n // ALWAYS wait for the deposit tx to be INCLUDED before returning — same\n // confirmation discipline as initializeChannel above (issue #158). The\n // connector's claimFromChannel runs a #126 balance-conservation gate that\n // reads the on-chain `depositTotal`; if we fire-and-forget the deposit, the\n // publish + claim race ahead and the connector reads depositTotal=0 (deposit\n // not yet in a block) → `PROOF_GENERATION_FAILED: Claim violates balance\n // conservation` and the settle aborts non-retryably. Blocking on inclusion\n // (and re-fetching) guarantees the funded depositTotal is on-chain before any\n // claim settles against it.\n await sentDeposit.wait();\n await fetchAccount({ publicKey: zkAppPublicKey });\n await fetchAccount({ publicKey: payerPublicKey });\n }\n\n // Read the resulting state from the network-fetched appState (best-effort —\n // may still reflect the pre-confirmation value on a slow node; the connector\n // re-reads at verification time). If we just opened, optimistically report\n // OPEN even if the node hasn't surfaced the new state yet.\n let finalState: number;\n try {\n finalState = Number(await readChannelState());\n } catch {\n finalState = opened\n ? Number(MINA_CHANNEL_STATE_OPEN)\n : Number(currentState);\n }\n if (opened && finalState === Number(MINA_CHANNEL_STATE_UNINITIALIZED)) {\n finalState = Number(MINA_CHANNEL_STATE_OPEN);\n }\n\n // Touch AccountUpdate so the (lazy) import is retained even if a future\n // refactor stops referencing it directly above; harmless no-op.\n void AccountUpdate;\n\n // Read the resulting on-chain depositTotal (post init+deposit confirmation, so\n // a fresh re-deposit is reflected). Best-effort: fall back to 0n if the read\n // throws on a slow node — the connector re-reads at verification time.\n let depositTotal: bigint;\n try {\n depositTotal = await readDepositTotal();\n } catch {\n depositTotal = 0n;\n }\n\n return {\n zkAppAddress: params.zkAppAddress,\n opened,\n initTxHash,\n depositTxHash,\n channelState: finalState,\n depositTotal,\n };\n}\n"],"mappings":";AAyCA,SAAS,6BAAAA,kCAAiC;;;ACA1C,SAAS,iCAAiC;AAsB1C,IAAI,aAA8B;AAClC,IAAI,uBAAmC;AACvC,IAAI,mBAA+B;AAQnC,IAAI,kBAEO;AA+BX,eAAsB,kBAGnB;AACD,MAAI,cAAc,sBAAsB;AACtC,WAAO,EAAE,MAAM,YAAY,gBAAgB,qBAAqB;AAAA,EAClE;AACA,MAAI,iBAAiB;AACnB,UAAM,WAAW,MAAM,gBAAgB;AACvC,iBAAa,SAAS;AACtB,2BAAuB,SAAS;AAChC,WAAO;AAAA,EACT;AACA,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,QAAa;AACpD,QAAM,WAAW,MAAM,OAAO,MA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