# Wallet checkout Implemented the wallet checkout component on the imported production trunk. New purchases use Ethereum mainnet IMD and the existing IMD.fun Intake. The checkout reads the exact `priceOf` amount, displays it with an ETH gas estimate, and requires another explicit Pay click if a live reread changes the fee. After a fresh schedule check it requests exact approval only if needed, waits for a successful approval, and sends one simulated `request` for `job.open@job-1` with the documented no-callback tuple. The checkout verifies account and chain against the selected provider and rechecks selection and schedule freshness before opening either wallet prompt. Local validation checks the UTF-8 body size, the research-report objective, and the 1–14 scheduled event identities. The existing direct Intake lookup and read-only historical escrow `OrderPaid` logs guard against paying again. Historical orders open through the existing readers. An exact matching native order found on-chain can reconstruct its local tracker record. The native journal stores the request hash before looking up its nonce and handing off to the tracker. If the nonce lookup is slow, the handoff proceeds after 1.5 seconds and the lookup can finish in the background. Reopening checks receipts and, when the nonce is known, looks for a mined replacement. Missing and unreadable receipts keep repayment blocked. Local job mappings are tracking hints. The checkout hands off with confirmation pending. The imported wallet, escrow recovery, and report-reader paths provided the existing interfaces. IMD documents the wallet payment and public tracking operations, while the imported Worker uses its verifier key for historical escrow actions. Native checkout uses only the customer's connected wallet and public reads. Browser `/requests/check` is outside the payment gate. The two linked Explorer job pages were inaccessible from the browsing tool, so coordination was limited to the supplied item interfaces. [Production repository](https://github.com/AgentStewLC/launch-3500-imd-picks-complete) · [IMD API reference](https://imd.fun/docs/api/) ## Changed files and interfaces | File | Change | | --- | --- | | `web/src/checkout.tsx` | Exports `NativeCheckout({ onClose: () => void, onSubmitted: (txHash: string) => void })`. Replaces the dormant split checkout, which had no callers in the imported source. | | `web/src/native/policy.ts` | Exports `NATIVE_RESEARCH_OPEN: boolean`. Only the exact string `VITE_PAID_RESEARCH_OPEN=true` enables new purchases. | | `web/src/native/orders.ts` | Exports `nativeOrdersOf(payer: string): NativeOrder[]` and `saveNativeJob(txHash: string, requestId: string, jobId: string): void`, plus the journal helpers `nativeAttemptsOf`, `startNativeAttempt`, `updateNativeAttempt`, and `cancelNativeAttempt`. Records expose `txHash`, `payer`, `slipId`, `body`, `amount` as a decimal string in atomic IMD units, `createdAt` in milliseconds, and optional `requestId` and `jobId`. | | `web/src/native/payment.ts` | Exports `validateNativeBody(body): number`, `quoteNativePayment(payer, body, pc?)`, `submitNativePayment(payment, pc?)`, `reopenNativePayment(payer, slipId, txHash, pc?)`, and the `NativePaymentResult` type. The payment lock covers the wallet across tabs where Web Locks are available. | | `web/tests/native-checkout.test.mjs` | Adds offline Node tests for policy, exact call arguments, approval outcomes, repricing, stale and changed selections, wallet changes, historical duplicates, reload, uncertain receipts, replacement, retry, and validation. | | `web/tests/fixtures/native-checkout/body.ts` | Supplies an offline body interface fixture. The production component imports the peer-owned `web/src/native/body.ts`. | ## Checks - `cd web && npm ci` exited 0. npm reported two advisories in the locked dependency tree and a warning about the esbuild install-script policy. The package files were untouched. - `cd web && node --test tests/native-checkout.test.mjs` passed the initial 15 cases. The final suite run included 17 native checkout cases. - `cd web && env TMPDIR="$PWD/../test/scratch/native-checkout/tmp" node --test tests/*.test.mjs` exited 0 with 64 passing and 0 failing. The initial `node --test tests/` returned `MODULE_NOT_FOUND` at `tests:1:1` on this Node version. The initial glob run then hit unavailable `/tmp` at `tests/deployed.test.mjs:12:16`, `tests/knowledge.test.mjs:27:18`, `tests/revision-v11.test.mjs:19:19`, and `tests/revision.test.mjs:79:18`. The scratch temp directory resolved those four failures. - `npm --prefix web run typecheck` exited 2 with TS2307 at `web/src/checkout.tsx:6:31` for the absent peer body. The first pass also reported TS2322 at `web/src/native/payment.ts:244:50` for the wallet RPC typing. That error was fixed with the provider request type. - `npm --prefix test/scratch/native-checkout/web run build` exited 0 with the body fixture copied into the scratch project's `src/native/body.ts`. TypeScript and Vite passed. Vite reported its chunk-size warning. - `./web/node_modules/.bin/esbuild test/scratch/native-checkout/web/src/checkout.tsx --bundle --format=esm --jsx=automatic --define:import.meta.env='{"VITE_PAID_RESEARCH_OPEN":"true"}' --loader:.woff2=file --outdir=test/scratch/native-checkout/bundle` exited 0. This bundles checkout itself with the fixture and the flag enabled while the production entry remains peer-owned. - `git diff --check` passed. Staging the six allowed source and test files failed because Git could not create `.git/index.lock` on the read-only filesystem. The files remain in the working tree and this result is untracked. ## Remaining integration Verify the peer body's event and follow-up identity against the existing parser, including the 14-event body limit. After the route and tracker merge, verify that the submitted hash enters pending state, IMD.fun admission yields the verified request and job IDs, `saveNativeJob` restores them on reload, and completed and failed jobs reach the correct report states. Browser access to the configured Ethereum RPCs and public IMD.fun status and report endpoints needs testing from the deployed origin. An unresolved wallet broadcast without a hash stays blocked until the ledger confirms the order. Browser locks cannot coordinate simultaneous payments across devices. The checkout checks the price through the last pre-sign read. The published Intake interface accepts an amount at least equal to the live fee, so a later price decrease during wallet signing or before inclusion cannot be enforced as a revert by this client. The release owner controls `VITE_PAID_RESEARCH_OPEN`. An authorized funded wallet and the merged hosted flow are needed for the paid end-to-end acceptance run. No public transaction, deployment, or live payment-to-report test was performed.