pledra-sdk
v0.1.0
Published
Borrow SOL against your Pump.fun tokens from JavaScript/Node. Official SDK for Pledra Protocol on Solana.
Maintainers
Readme
pledra-sdk
Borrow SOL against your Pump.fun tokens from JavaScript/Node. Official SDK for Pledra Protocol on Solana.
Lock a Pump.fun token, instantly receive a SOL credit, repay later to unlock. No wallet-connect: the credit is paid to the wallet that sends the tokens.
npm install pledra-sdkRequires Node 18+ (uses the global fetch).
Borrow in one call
borrow() does everything: opens the loan, sends your tokens to the lock
address on-chain, and confirms. The SOL credit lands in your wallet.
import { PledraClient } from 'pledra-sdk';
import { Connection, Keypair } from '@solana/web3.js';
const pledra = new PledraClient();
const connection = new Connection('https://your-rpc.com', 'confirmed');
const wallet = Keypair.fromSecretKey(/* your secret key */);
const { loan, depositTxSig, confirm } = await pledra.borrow({
mint: 'So1aNa...PumpFunMint',
amount: 1_000_000, // token amount to lock
wallet,
connection,
});
console.log('Credit received:', confirm.creditSol, 'SOL');
console.log('Loan id:', loan.loanId);Repay in one call
const { repaySolSent, result } = await pledra.repay({
loanId: loan.loanId,
wallet,
connection,
});
console.log('Repaid', repaySolSent, 'SOL, status:', result.status);Preview before you borrow
const quote = await pledra.quote({ mint, lockTokenAmount: 1_000_000 } as any);
// → { ltv, creditSol, repaySol, liquidationPriceSol, capOk, treasuryOk, ... }(See quote({ address, lockTokenAmount }) for the exact shape.)
Low-level API
Every REST endpoint is also exposed directly, in case you want to manage the on-chain transfers yourself:
await pledra.lookupToken(mint); // live price + Smart Cap
await pledra.quote({ address: mint, lockTokenAmount }); // preview
await pledra.createLoan({ address: mint, lockTokenAmount }); // → { lockAddress, ... }
await pledra.confirmLoan(loanId); // after you send tokens
await pledra.repayLoan(loanId); // after you send repaySol
await pledra.getLoans(walletAddress); // your positions
await pledra.getStats(); // protocol statsThe manual flow is: createLoan → send depositTokenAmount of the token to
lockAddress from your own wallet → confirmLoan.
How it works
- Lock to value: you receive a share of the locked token value as a SOL credit (25%, or 35% with 10M $PLEDRA staked).
- Repay: pay back the credit plus 5% interest to unlock your tokens.
- Liquidation: if the token drops 50% from entry, the position is liquidated and the proceeds are kept by the protocol. You owe nothing more.
- Smart Cap: at most 10% of a token's pool liquidity can be locked protocol-wide, so loans stay solvent.
Only bonded Pump.fun tokens (with a tradable SOL pool) are supported.
Notes
- Use your own RPC (
new Connection(...)ornew PledraClient({ rpcUrl })). The public default is rate-limited. - Always send from your own wallet, not an exchange.
- High risk. Not financial advice.
Links
- Website: https://pledraprotocol.xyz
- API docs: https://pledraprotocol.xyz/api-docs
MIT License.
