⛽Fixed-Rate Lending SDK
Documentation for the Fixed-Rate Lending SDK
The Fixed-Rate Lending SDK is a comprehensive toolkit for developers to integrate and interact with the Secured Finance Fixed-Rate Lending protocol.
Overview
The Fixed-Rate Lending protocol provides a platform for fixed-rate lending and borrowing through an order book system. The SDK provides a programmatic interface to interact with the protocol, allowing developers to build applications that leverage Fixed-Rate Lending functionality.
How It Works
The Fixed-Rate Lending SDK is built on top of viem and provides a type-safe interface to interact with the Fixed-Rate Lending smart contracts. It abstracts away the complexity of direct contract interactions and provides a more developer-friendly API.
Installation
The Fixed-Rate Lending SDK packages are hosted on GitHub Packages registry, not the public NPM registry. You'll need to configure your .npmrc file to access them:
# Add this to your .npmrc file
@secured-finance:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
# Then install the individual packages
npm install @secured-finance/sf-client
npm install @secured-finance/sf-graph-client
npm install @secured-finance/sf-coreFor more details on setting up authentication for GitHub Packages, see the GitHub documentation.
Key Components
The Fixed-Rate Lending SDK consists of several packages:
sf-client
The core package for interacting with the Fixed-Rate Lending protocol.
sf-graph-client
Utilities for querying the Fixed-Rate Lending subgraph.
sf-core
Core components used across different Secured Finance projects.
Basic Usage
Connecting to the Protocol
Reading Protocol State
Order Operations
Collateral Management
Position Management
Advanced Usage
Using the Graph Client
Price Calculations
FAQ
How do I handle transaction errors?
The SDK throws descriptive error objects that contain information about the failure. Wrap your transactions in try-catch blocks to handle errors gracefully.
How do I convert between unit price and APR?
The conversion between Zero-Coupon Bond prices and APR varies depending on the maturity period. For detailed information, refer to the official documentation on ZC Bond Price to APR conversion.
The calculation is implemented in the Price Calculations section above.
What networks does the SDK support?
The SDK supports all networks where the Fixed-Rate Lending protocol is deployed, including Ethereum, Arbitrum, and Filecoin.
Related Resources
Last updated
Was this helpful?