SDK
The Tenor SDK is a TypeScript library for building and executing transactions on the Tenor protocol. It handles transaction bundling, token approvals, signature management, and wallet compatibility.
How It Works
All Tenor operations go through Morpho's Bundler3 multicall system. The SDK abstracts this into a simple flow.
You never call Morpho or adapter contracts directly. The SDK assembles the correct multicall bundle for you.
Three Ways to Use It
| Your situation | Use this |
|---|---|
| React app, standard operations | React hooks (useBorrow, useLend, useRepay, and more) |
| Non-React or custom flows | ActionsBuilder (high-level API) |
| Custom multicall bundles | TenorBundler (low-level builder) |
React hooks are the recommended approach for most integrations. Every hook follows the same build-simulate-approve-sign-execute pattern and returns consistent status, data, and error fields.
ActionsBuilder provides the same operations as the hooks but for use outside React, in backend services, scripts, or custom integrations.
TenorBundler gives you direct control over the multicall bundle for advanced use cases where the higher-level APIs do not fit.
Supported Operations
The SDK covers all core Tenor operations.
- Borrow and lend: Take offers at spot or place limit orders.
- Repay and withdraw: Close positions and reclaim funds.
- Collateral management: Add or remove collateral from existing positions.
- Auto-renewal: Enable or disable fixed-to-fixed and fixed-to-variable rolling.
Wallet Support
The SDK automatically detects whether you are using an EOA (MetaMask and similar) or a smart contract account (Safe, Argent, and similar), and adjusts its behavior.
- EOA wallets: Offchain Permit2 signatures, single bundled transaction.
- SCA wallets: Onchain approvals, batch proposed for multi-sig approval.
You do not need to handle this distinction yourself. The hooks and ActionsBuilder manage it automatically.
Installation
The SDK is part of the tenor-app package. Import from @/lib/tenor-sdk.
import { useBorrow, getContracts, ActionsBuilder } from "@/lib/tenor-sdk";