Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Yield tokenization and trading with Pendle
import { Pendle } from './Pendle.js'; const pendle = Pendle({ provider, router: PENDLE_ROUTER }); // Mint PT and YT from yield-bearing asset await pendle.mintPyFromToken({ receiver: userAddress, yt: YT_ADDRESS, tokenIn: STETH, amountIn: parseEther('10'), signer, });
// Buy PT (fixed yield) await pendle.swapExactTokenForPt({ receiver: userAddress, market: MARKET_ADDRESS, tokenIn: WETH, amountIn: parseEther('1'), slippage: 0.01, signer, }); // Sell YT await pendle.swapExactYtForToken({ receiver: userAddress, market: MARKET_ADDRESS, amountYtIn: ytBalance, tokenOut: WETH, slippage: 0.01, signer, });
// Redeem PT after maturity await pendle.redeemPyToToken({ receiver: userAddress, yt: YT_ADDRESS, amountPy: ptBalance, tokenOut: UNDERLYING, signer, });
Was this page helpful?