Skip to content
Termbook
App integrations

Validate & register

Test the lifecycle of the exact deployment before issuing an app token.

On this page

Prepare the environment

The SDK owns validation. A ValidationEnvironment supplies the client, durable checkpoint options and prepare callback with concrete acceptance scenarios. It funds or binds the House, borrower and independent recovery actor. It is not a browser-only ABI smoke test.

create_validation_environment supports executable validation programs. create_evidence_environment binds recorded scenario evidence. Evidence must identify the chain, Core, integration version, dependencies and lifecycle transactions; isolated fixtures do not certify another deployment.

Required scenarios

  • Draw credit and execute every admitted action variant.
  • Verify actual account custody, balances, positions, liabilities and recoverable value.
  • Reject wrong recipients, excess spending, unsupported actions, stale authorizations and unsafe health.
  • Reconcile partial fills, cancellations and delayed requests when supported.
  • Repay the House and confirm accounting, then close and return collateral.
  • Recover through an independent keeper without the borrower.
  • Resume interrupted operations and prove replay or duplicate execution cannot reuse authorization.
  • Bind dependency upgrade behavior to the admitted guard or explicit monitoring policy.

Unsupported scenarios require valid use-case exclusions. Every applicable acceptance case must run. A passed result is bound to the exact package hash and version ID.

Run the Kuru suite

Terminal 1 · fork the deployment
anvil --fork-url "$RPC_URL" --chain-id 10143 --port 18548
Terminal 2 · from the repository root
node --env-file=.env --import tsx server/test/kuru/run-acceptance.ts http://127.0.0.1:18548 --deployment

The deployment mode binds tests to deployments/testnet.json and uses the configured independent RISK_KEEPER_KEY. It runs and replays acceptance scenarios against an isolated fork, with explicit exclusions for unsupported features. The runner writes its report to a temporary directory and prints that path.

A fork report needs the admission review and actual live lifecycle bindings before it can certify a deployed version. The SDK then verifies callbacks against recorded active and recovered Credits. Do not present an isolated fixture report as a live acceptance result.

Run SDK validation

validate.ts
const report = await sdk.integrations.validate({
  plugin: exchange,
  wallet: developer_wallet,
  amount: 100_000n,
});

// amount is in the House settlement asset’s smallest unit.
if (!report.passed) {
  throw new Error(report.failures.join("; "));
}

const result = await sdk.integrations.register({
  validation_id: report.id,
});
Validation resultMeaning
idValidation ID used for registration.
passed, failuresResult and concrete failed requirements.
version_id, package_hashThe definition and version tested.

Activation & token

Registration result
{
  integration_id: validation_id,
  version_id,
  status: "awaiting_approval",
}

// After authorized activation:
{
  integration_id: validation_id,
  version_id,
  status: "active",
  app_token: "tbk_…",
}

The validation ID is not an app token. Validation expires before activation under the configured window, currently 24 hours. register and status use the same ID so a retry does not create another integration. The authorized operator uses approve; an ordinary app author cannot activate its own risk rules.

Documentation
8 results

Let’s talk

Tell us what you have in mind.

Supply liquidity