# partner:create-test-source — Ammora SDK 0.3.9

Synthetic fixture only: prepare a source owned by your own controller, never a broadcast.

[Read in Docs](https://docs.ammora.org/examples?command=partner%3Acreate-test-source) · [Detailed guide](https://docs.ammora.org/guides/self-service) · [Local setup](https://docs.ammora.org/guides/example-setup) · [Approval and review boundaries](https://docs.ammora.org/guides/permissions)

## Context and execution

GIWA Sepolia 91342. Public SDK 0.3.9, Math 0.3.0. Source revision: `0f3a73158fa5d86ed9f24ae1b2320e351e0e91e6`.
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 partner:create-test-source -- <arguments from the source below>` (`tsx src/partner/self-service/test-source.ts`). Omit `--` and arguments when the source accepts none.

## Entry file: `src/partner/self-service/test-source.ts`

```typescript
/** Synthetic fixture only: prepare a source owned by your own controller, never a broadcast. */
import { readFileSync } from "node:fs";
import { encodeDeployData, encodeFunctionData, keccak256, type Abi, type Address, type Hex } from "viem";
import { cli, required, address, loadSelfServiceProfile, type SelfServiceProfile } from "./context.js";
const bundle = JSON.parse(readFileSync(new URL("../../../fixtures/self-service-test-artifacts.json", import.meta.url), "utf8"));
// The fixture bundle is data, not a remote plugin or SDK replacement.
const artifact = (name: string) => bundle.artifacts[name] as { abi: Abi; bytecode: Hex; runtimeBytecode: Hex };
/** New independent fixture addresses, still subject to the enabled standard's code hashes. */
export function prepareSelfServiceTestAssets(profile: SelfServiceProfile, controller: Address, family: 0 | 1 = 0) {
  if (!profile.testOnly || profile.chainId !== 91342 || (family !== 0 && family !== 1)) throw new Error("An isolated synthetic GIWA profile and family0 or1 are required");
  address(controller);
  return { testOnly: true, economicValue: false, automaticSend: false, deployments: ([["quote", "StandardTokenFixture"], ["base", "StandardTokenFixture"], ["market", "StandardMarketFixture"]] as const).map(([label, name]) => {
    const a = artifact(name);
    return { label, runtimeHashRequired: keccak256(a.runtimeBytecode), request: { account: controller, data: encodeDeployData({ abi: a.abi, bytecode: a.bytecode, args: label === "market" ? [family] : [] }), value: 0n } };
  }) };
}
export function prepareSelfServiceTestSource(profile: SelfServiceProfile, input: { controller: Address; partner: Address; quote: Address; base: Address; market: Address; family: 0 | 1 }) {
  if (!profile.testOnly || (input.family !== 0 && input.family !== 1)) throw new Error("An isolated synthetic GIWA test profile is required");
  for (const value of [input.controller, input.partner, input.quote, input.base, input.market]) address(value);
  if (input.quote.toLowerCase() === input.base.toLowerCase()) throw new Error("Distinct test assets required");
  const a = artifact("StandardSourceFixture");
  return { testOnly: true, economicValue: false, runtimeHash: keccak256(a.runtimeBytecode), request: { account: input.controller, data: encodeDeployData({ abi: a.abi, bytecode: a.bytecode, args: [input.controller, input.partner, input.quote, input.base, input.market, input.family] }), value: 0n }, automaticSend: false };
}
/** Only for the bundle's openly mintable test-token addresses, after checking their runtime pins. */
export function prepareSelfServiceTestFunding(profile: SelfServiceProfile, input: { controller: Address; source: Address; quote: Address; base: Address; amountRaw: bigint }) {
  if (!profile.testOnly || input.amountRaw <= 0n || input.amountRaw > 1_000_000_000n) throw new Error("Bounded synthetic funding only");
  for (const value of [input.controller, input.source, input.quote, input.base]) address(value);
  const a = artifact("StandardTokenFixture");
  return { testOnly: true, tokenRuntimeHashRequired: keccak256(a.runtimeBytecode), economicValue: false, automaticSend: false, requests: [input.quote, input.base].flatMap(token => [input.source, input.controller].map(recipient => ({ account: input.controller, to: token, data: encodeFunctionData({ abi: a.abi, functionName: "mint", args: [recipient, input.amountRaw] }), value: 0n }))) };
}
cli(import.meta.url, () => prepareSelfServiceTestSource(loadSelfServiceProfile(required(2, "profile.json")), JSON.parse(readFileSync(required(3, "test-source-input.json"), "utf8"))));
```

## 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.

- [fixtures/self-service-test-artifacts.json](https://docs.ammora.org/examples/source/fixtures/self-service-test-artifacts.json.txt)
- [src/partner/self-service/context.ts](https://docs.ammora.org/examples/source/src/partner/self-service/context.ts.txt)
- [src/partner/self-service/rpc.ts](https://docs.ammora.org/examples/source/src/partner/self-service/rpc.ts.txt)
- [fixtures/self-service-configuration-input.template.json](https://docs.ammora.org/examples/source/fixtures/self-service-configuration-input.template.json.txt)
- [fixtures/self-service-giwa.test.json](https://docs.ammora.org/examples/source/fixtures/self-service-giwa.test.json.txt)
- [fixtures/self-service-known-deployment.template.json](https://docs.ammora.org/examples/source/fixtures/self-service-known-deployment.template.json.txt)
- [fixtures/self-service-source-input.template.json](https://docs.ammora.org/examples/source/fixtures/self-service-source-input.template.json.txt)
- [fixtures/self-service-standard-terms.test.json](https://docs.ammora.org/examples/source/fixtures/self-service-standard-terms.test.json.txt)
- [fixtures/self-service-trade-input.template.json](https://docs.ammora.org/examples/source/fixtures/self-service-trade-input.template.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.
