TypeScript SDK

Trilobyte provides auto-generated TypeScript client bindings for all four 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

@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

@trilobyte/timelock-client

contracts/timelock/bindings/

Schedule, execute, cancel operations, AccessControl

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:

{
  "dependencies": {
    "@trilobyte/globals-client": "file:../trilobyte-new/contracts/globals/bindings",
    "@trilobyte/vault-client": "file:../trilobyte-new/contracts/vault/bindings",
    "@trilobyte/factory-client": "file:../trilobyte-new/contracts/factory/bindings",
    "@trilobyte/timelock-client": "file:../trilobyte-new/contracts/timelock/bindings"
  }
}

Example: Query Vault Config

Example: Deposit into a Vault

Example: Create a Vault

Keeper / Cron Integration

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

  1. apply_late_fee() — When a payment is overdue

  2. check_default() — When past the grace period

  3. check_funding_expiry() — For funding deadline enforcement

  4. check_approval_expiry() — For approval deadline enforcement

All these functions are public entry points on the Vault contract, callable by any address.

Last updated