Skip to content
Termbook
App integrations

Define the integration

Separate immutable admission rules from runtime account reads and action plans.

On this page

The TypeScript shape

integration.ts · interface
import type { spot, PluginDefinition } from "@termbook/sdk";

export function create_exchange(definition: PluginDefinition,
  account: spot["account"],
  actions: spot["actions"],
  exit: spot["exit"],
): spot {
  return {
    name: definition.name,
    use_case: "spot",
    chain_id: definition.chain_id,
    markets: definition.markets,
    definition,
    account,
    actions,
    exit,
  };
}

This factory shows the public shape. Its callbacks must be real implementations; its definition must include approved reads and call policies. See Kuru for a complete implementation rather than placeholder functions.

Definition fields

FieldMeaning
format: 1The current definition schema version.
name, use_case, chain_idMetadata that must match the integration object.
settlement_assetNon-native ERC-20 asset used by the House for lending and repayment.
marketsMarket IDs, contract addresses, base and quote assets and their decimals.
actionsStandard capabilities mapped to exact calls, bounds and routing conditions.
contractsShared execution, reader, recovery and exit component addresses.
pinsTarget code hash and, for proxies, implementation identity and slot.
verified_sourcesSource identities for the pinned dependencies or an admitted runtime review.
assessment or atomic_spotShared verification and recovery configuration. Choose one.

Definitions are strict: unknown fields, duplicate markets, missing dependency pins and incomplete recovery rules are rejected. Markets, actions, sources and the runtime callbacks must agree.

Package & version identity

package.ts
import { package_integration } from "@termbook/sdk";
import { exchange } from "./integration";

const packaged = package_integration(exchange);
console.log(packaged.hash);
console.log(packaged.version_id);

The canonical definition hash identifies the reviewed package. The version ID includes that hash and the chain. Editing limits, actions, markets or dependencies creates a different version. package_integration checks structure; it does not replace lifecycle validation.

Documentation
8 results

Let’s talk

Tell us what you have in mind.

Supply liquidity