Skip to main content
CONFIDENTIAL & PROPRIETARY © 2025 Inkwell Finance, Inc. All Rights Reserved. This document is for informational purposes only and does not constitute legal, tax, or investment advice, nor an offer to sell or a solicitation to buy any security or other financial instrument. Any examples, structures, or flows described here are design intent only and may change.

What Is @leviathan/sdk?

@leviathan/sdk is the official TypeScript SDK for the Leviathan protocol. It provides a single package with unified bindings for interacting with Leviathan’s on-chain programs across both Solana and Sui, handling everything from PDA derivation to full transaction construction. The SDK is built from on-chain program IDLs, ensuring that TypeScript types and instruction builders always match the deployed programs.

Package Exports

The SDK is organized into focused subpath exports:
ExportDescription
@leviathan/sdkRoot entry point with shared types and utilities
@leviathan/sdk/svmFull Solana integration — accounts, instructions, transactions, PDA helpers
@leviathan/sdk/svm/pdaPDA derivation helpers for all program accounts
@leviathan/sdk/svm/accountsAccount types and deserialization for on-chain state
@leviathan/sdk/svm/instructionsLow-level instruction builders for all program operations
@leviathan/sdk/svm/transactionsHigh-level transaction builders that compose instructions with account lookups
@leviathan/sdk/solanaSolana-specific utilities and connection helpers
@leviathan/sdk/embeddedEmbedded lending flow components and helpers

Solana (SVM) Bindings

The ./svm subpath is the primary integration surface for Solana. It covers all four on-chain programs:

PDA Helpers (./svm/pda)

Derive program-derived addresses for any Leviathan account:
  • Core PDAs — loan accounts, policy accounts, session registries, executor configs, keeper registries, KYC attestations, InkPact records
  • Pool PDAs — pool accounts, LP mint authorities, interest model configs, withdrawal requests
  • Score PDAs — credit registry accounts, score entries, oracle configs
PDA helpers accept human-readable inputs and return the derived address along with the bump seed.

Account Types (./svm/accounts)

Typed interfaces for all on-chain account structures:
  • Loan state, policy parameters, session key records
  • Pool configuration, deposit records, interest model state
  • Credit scores, tier classifications, oracle attestations
Account types are generated from program IDLs, so they always match the on-chain layout.

Instructions (./svm/instructions)

Low-level instruction builders for every program instruction:
  • Core — create loan, activate loan, update policy, register session key, register keeper, submit KYC attestation
  • Pool — initialize pool, deposit, withdraw, request withdrawal, accrue interest, borrow from pool, repay to pool
  • Score — initialize registry, update score, configure oracle
Each builder returns a TransactionInstruction that can be composed into custom transaction flows.

Transactions (./svm/transactions)

High-level transaction builders that handle the common patterns:
  • Compose multiple instructions into a single transaction
  • Automatically look up required accounts and PDAs
  • Set fee payer and fetch recent blockhash
  • Return a ready-to-sign Transaction object
Transaction builders are the recommended entry point for most integrations — they handle the boilerplate so you can focus on business logic.

Sui Bindings

Sui bindings are available for policy enforcement and dWallet operations. These are generated from Move contract summaries and provide typed interfaces for:
  • Policy-gated dWallet capabilities
  • Destination registry queries
  • Cross-chain signing requests

What You Can Do with the SDK

The SDK supports all protocol interactions:
CategoryOperations
Pool operationsDeposit, withdraw, request withdrawal, claim withdrawal, query pool state
Loan managementCreate loans, activate, monitor state, track repayment progress
Credit queriesLook up credit scores, check tier eligibility, query score history
Session managementRegister session keys, check validity, revoke keys
PolicyQuery policy parameters, check destination whitelists
Keeper integrationRegister as keeper, submit health checks, execute drawdowns

Design Principles

  • IDL-driven — types and builders are generated from on-chain program IDLs, not manually maintained
  • Subpath exports — import only what you need; tree-shaking friendly
  • Composable — low-level instruction builders can be combined freely; high-level transaction builders handle common patterns
  • Type-safe — full TypeScript coverage with strict types for all accounts, instructions, and parameters