timefi-sdk
v0.1.0
Published
Core SDK for interacting with TimeFi Protocol on Stacks
Maintainers
Readme
timefi-sdk
The official JavaScript SDK for interacting with the TimeFi Protocol on the Stacks blockchain.
🚀 Features
- Protocol Client: Easy-to-use
TimeFiClientfor read and write interactions. - On-chain Data: Fetch TVL, vault status, and lock durations directly from smart contracts.
- Formatting Utilities: Standardized formatting for STX (microSTX to STX), addresses, and dates.
- Mainnet/Testnet Support: Unified interface for both networks.
📦 Installation
npm install timefi-sdk🛠️ Quick Start
Fetch Protocol Stats
import { TimeFiClient, formatSTX } from '@timefi/sdk';
// Initialize for Stacks Mainnet
const client = new TimeFiClient('mainnet');
// Get Total Value Locked
const tvl = await client.getTVL();
console.log(`Current TVL: ${formatSTX(tvl)} STX`);Format a Stacks Address
import { formatAddress } from '@timefi/sdk';
const shortAddress = formatAddress('SP3...XYZ123');
console.log(shortAddress); // SP3...Z123📖 Documentation
The SDK provides the following exports:
TimeFiClient: Core class for blockchain interactions.formatSTX(microStx): Converts microSTX to a human-readable STX string.formatAddress(address): Truncates addresses for UI display.CONTRACT_ADDRESS: The main TimeFi Protocol contract address on Stacks.
📄 License
MIT © AdekunleBamz
