# dfs:fund-source — Ammora SDK 0.3.8 dfs:fund-source -- . Preflight reports setup; never automatically grants it. [Read in Docs](https://docs.ammora.org/examples?command=dfs%3Afund-source) · [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:fund-source -- ` (`tsx src/dfs/fund-source.ts`). Omit `--` and arguments when the source accepts none. ## Entry file: `src/dfs/fund-source.ts` ```typescript /** dfs:fund-source -- . Preflight reports setup; never automatically grants it. */ import { dfs } from "./context.js"; import { sourcePolicy } from "./source-policy.js"; import { authenticateSource } from "./source-context.js"; import { document } from "../fees/policy.js"; import { tokenCredit } from "../fees/token-credit.js"; import { execute, validateAction } from "../shared/actions.js"; import { signer } from "../shared/env.js"; import { main, send } from "../shared/run.js"; import { printJson } from "../shared/input.js"; main(async () => { const c = await dfs(process.argv[2]), p = sourcePolicy(document(process.argv[3])); if (process.argv.length !== 4) throw new Error("usage: "); await authenticateSource(p); const before = await c.sdk.getState(); const plan = await c.sdk.planAtomicFundingWithPreflight({ ...p, caller: c.caller }); printJson({ ...plan, automaticSetup: false, sourceKind: p.kind, token: before.token }); if (!plan.ready || !plan.transaction || plan.setupTransactions.length) throw new Error("Source setup incomplete; each owner/beneficiary must separately review and send its permission"); if (process.env.AMMORA_SEND !== "1") return execute("fund DFS from authenticated source", c, plan.transaction); validateAction(plan.transaction, c.allowedTargets); const { wallet, account } = signer(); if (account.address.toLowerCase() !== c.caller.toLowerCase()) throw new Error("Caller/signer mismatch"); const hash = await send("fund DFS from authenticated source", plan.transaction, wallet, account, c.client); const credit = await tokenCredit(c.client, hash, before.token, c.vault); if (!credit.payoutVerified || credit.amount === 0n) throw new Error(`No positive source funding in ${hash}; do not resend`); const after = await c.sdk.getState(); printJson({ credit, totalFundedBefore: before.totalFunded, totalFundedAfter: after.totalFunded, note: "Vault funding is not a recipient payout; recipients separately call dfs:claim" }); }); ``` ## 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/context.ts](https://docs.ammora.org/examples/source/src/dfs/context.ts.txt) - [src/dfs/source-context.ts](https://docs.ammora.org/examples/source/src/dfs/source-context.ts.txt) - [src/dfs/source-policy.ts](https://docs.ammora.org/examples/source/src/dfs/source-policy.ts.txt) - [src/fees/context.ts](https://docs.ammora.org/examples/source/src/fees/context.ts.txt) - [src/fees/policy.ts](https://docs.ammora.org/examples/source/src/fees/policy.ts.txt) - [src/fees/token-credit.ts](https://docs.ammora.org/examples/source/src/fees/token-credit.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/fee-payment.ts](https://docs.ammora.org/examples/source/src/shared/fee-payment.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.