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:| Export | Description |
|---|---|
@leviathan/sdk | Root entry point with shared types and utilities |
@leviathan/sdk/svm | Full Solana integration — accounts, instructions, transactions, PDA helpers |
@leviathan/sdk/svm/pda | PDA derivation helpers for all program accounts |
@leviathan/sdk/svm/accounts | Account types and deserialization for on-chain state |
@leviathan/sdk/svm/instructions | Low-level instruction builders for all program operations |
@leviathan/sdk/svm/transactions | High-level transaction builders that compose instructions with account lookups |
@leviathan/sdk/solana | Solana-specific utilities and connection helpers |
@leviathan/sdk/embedded | Embedded 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
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
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
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
Transactionobject
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:| Category | Operations |
|---|---|
| Pool operations | Deposit, withdraw, request withdrawal, claim withdrawal, query pool state |
| Loan management | Create loans, activate, monitor state, track repayment progress |
| Credit queries | Look up credit scores, check tier eligibility, query score history |
| Session management | Register session keys, check validity, revoke keys |
| Policy | Query policy parameters, check destination whitelists |
| Keeper integration | Register 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