# dfs:create-json — Ammora SDK 0.3.8 dfs:create-json -- preview OR create [Read in Docs](https://docs.ammora.org/examples?command=dfs%3Acreate-json) · [Detailed guide](https://docs.ammora.org/guides/src-dfs-readme) · [Local setup](https://docs.ammora.org/guides/example-setup) ## Context and execution GIWA Sepolia 91342. Public SDK 0.3.8, Math 0.3.0. Source revision: `a9b3fd798fa51495e8defec99a25de59e4d70672`. Install the SDK in your app, or prepare the example project using the local setup guide for its npm commands. Review the entry source and guide for required arguments, roles and deployment selection. `AMMORA_SEND=0` does not turn send-only commands into previews. Never put CLI keys in a browser or resend an uncertain transaction. Command: `npm run dfs:create-json -- ` (`tsx src/dfs/create-json.ts`). Omit `--` and arguments when the source accepts none. ## Entry file: `src/dfs/create-json.ts` ```typescript /** dfs:create-json -- preview OR create */ import { readFile } from "node:fs/promises"; import { DFSFactoryClient } from "@ammora-protocol/sdk"; import { clientOptions, deployment, reader } from "../shared/env.js"; import { caller, execute } from "../shared/actions.js"; import { printJson } from "../shared/input.js"; import { main } from "../shared/run.js"; import { planSharingPolicy } from "./sharing-policy.js"; main(async () => { const [mode, path, review, ...extra] = process.argv.slice(2); if (!path || !["preview", "create"].includes(mode ?? "") || extra.length || (mode === "preview" ? !!review : !review)) throw new Error("usage: preview OR create "); const result = planSharingPolicy(JSON.parse(await readFile(path, "utf8"))); if (mode === "create" && review?.toLowerCase() !== result.reviewHash.toLowerCase()) throw new Error("reviewHash mismatch; preview the current sharing policy"); const account = caller(), client = await reader(), factory = deployment().contracts.feeSharing.factory; if (client.chain?.id !== result.policy.chainId || factory.toLowerCase() !== result.policy.factory.toLowerCase() || account.toLowerCase() !== result.policy.owner.toLowerCase()) throw new Error("chain/factory/caller differs from sharing policy"); const sdk = new DFSFactoryClient(client, factory, clientOptions()); const preflight = await sdk.planCreateVault(result.policy); printJson({ mode, ...result, preflight }); if (!preflight.ready || preflight.expectedSender.toLowerCase() !== account.toLowerCase() || preflight.transaction.to.toLowerCase() !== factory.toLowerCase() || preflight.transaction.data !== result.transaction.data) throw new Error("Vault creation preflight refused or differs from reviewed transaction"); if (mode === "preview") return; // No signer is loaded by preview, even when AMMORA_SEND=1 is inherited. await execute("create reviewed multi-recipient vault", { client, caller: account, allowedTargets: [factory] }, preflight.transaction); }); ``` ## Supporting files Keep relative paths intact. Local imports are listed recursively; JSON templates are choices to review, not approved inputs. Runtime-selected files and wallet/environment setup still follow the detailed guide. - [src/dfs/sharing-policy.ts](https://docs.ammora.org/examples/source/src/dfs/sharing-policy.ts.txt) - [src/shared/actions.ts](https://docs.ammora.org/examples/source/src/shared/actions.ts.txt) - [src/shared/env.ts](https://docs.ammora.org/examples/source/src/shared/env.ts.txt) - [src/shared/input.ts](https://docs.ammora.org/examples/source/src/shared/input.ts.txt) - [src/shared/retry.ts](https://docs.ammora.org/examples/source/src/shared/retry.ts.txt) - [src/shared/rpc.ts](https://docs.ammora.org/examples/source/src/shared/rpc.ts.txt) - [src/shared/run.ts](https://docs.ammora.org/examples/source/src/shared/run.ts.txt) - [src/dfs/sharing.example.json](https://docs.ammora.org/examples/source/src/dfs/sharing.example.json.txt) - [package.json](https://docs.ammora.org/examples/source/package.json.txt) - [package-lock.json](https://docs.ammora.org/examples/source/package-lock.json.txt) - [tsconfig.json](https://docs.ammora.org/examples/source/tsconfig.json.txt) - [.env.giwa.example](https://docs.ammora.org/examples/source/file.env.giwa.example.txt) - [.nvmrc](https://docs.ammora.org/examples/source/file.nvmrc.txt) ## AI implementation checklist Use the actual SDK exports and parameter types in the linked files. Start with reads and unsigned plans where supported. Use a connected wallet for browser signing. Preserve raw integer units, exact approvals, caller authority, deadlines and receipt reconciliation. Report local checks separately from live-chain verification.