For the complete documentation index, see llms.txt. This page is also available as Markdown.

TypeScript SDK

Trilobyte provides auto-generated TypeScript client bindings for all five contracts. These enable frontend applications, backend services, and keeper bots to interact with the protocol.

Packages

Package
Path
Description

@trilobyte/globals-client

contracts/globals/bindings/

Settings, roles, collateral, fees, asset whitelist, Factory/vault registry

@trilobyte/vault-client

contracts/vault/bindings/

Full vault lifecycle, payments, yield, debt tokens, SEP-41

@trilobyte/factory-client

contracts/factory/bindings/

Vault creation, registry queries (incl. pagination)

@trilobyte/timelock-client

contracts/timelock/bindings/

Schedule, execute, cancel operations, AccessControl

@trilobyte/collateral-escrow-client

contracts/collateral-escrow/bindings/

Borrower-collateral lock / release / seize, pledge queries

Generation

Bindings are generated using the Stellar CLI:

# Generate all bindings (build WASM + generate + compile)
./scripts/generate-bindings.sh

This runs stellar contract bindings typescript for each contract, generating fully typed TypeScript clients from the contract ABIs.

Usage

Installation

Add bindings as local path dependencies in your project's package.json:

Example: Query Vault Config

Example: Deposit into a Vault

Example: Create a Vault

create_vault takes the full 15-field VaultParams. For a manager-collateral-only loan, leave collateral_escrow (and the related fields) empty:

For a borrower-collateral-backed loan, set collateral_escrow to the escrow contract address, collateral_token to the pledged asset, collateral_recovery to the recovery party, and collateral_min to the on-chain floor — then have the borrower lock the pledge in the escrow and pass its pledge_id to approve_and_disburse.

Keeper / Cron Integration

The TypeScript bindings are consumed by the trilobyte-vault NestJS backend. The keeper cron module uses them to:

  1. apply_late_fee() — when a payment is overdue (manager-only)

  2. check_default() — when past the grace period (permissionless)

  3. check_funding_expiry() — for funding-deadline enforcement (permissionless)

  4. check_approval_expiry() — for approval-deadline enforcement (permissionless)

All except apply_late_fee are permissionless entry points callable by any address.

Last updated