The official TypeScript SDK for the YieldStream Protocol. This middleware library provides a seamless, precision-safe interface for integrating automated DeFi yield farming into Next.js, Node.js, or standard browser environments.
npm install @yieldstream/sdk bignumber.jsInitialize the client, check the exchange rate, and deposit funds.
import { YieldStreamClient } from '@yieldstream/sdk';
import { Networks, Keypair } from '@stellar/stellar-sdk';
const lpKeypair = Keypair.fromSecret('S_SECRET_KEY');
const client = new YieldStreamClient({
rpcUrl: '[https://soroban-testnet.stellar.org:443](https://soroban-testnet.stellar.org:443)',
networkPassphrase: Networks.TESTNET,
contractId: 'C_VAULT_CONTRACT_ID',
keypair: lpKeypair
});
async function runYieldCycle() {
try {
// 1. Fetch current exchange rate
const rate = await client.vault.getExchangeRate();
console.log(`Current Exchange Rate: 1 ysToken = ${rate} USDC`);
// 2. Deposit 100.50 USDC into the Vault
console.log("Depositing funds...");
const txHash = await client.vault.deposit("100.50");
console.log(`Deposit successful! TxHash: ${txHash}`);
} catch (error) {
console.error(error);
}
}
runYieldCycle();npm run testRead our CONTRIBUTING.md for guidelines on PRs, branch naming, and our strict testing rules for financial precision.