Quick Start
Get your first Bitcoin-backed loan in under 5 minutes.Prerequisites
Before you begin, ensure you have:- Installed the SDK (
npm install @satsterminal-sdk/borrow) - An API key from SatsTerminal
- A Bitcoin wallet with signing capability
Step 1: Initialize the SDK
Step 2: Optional Account Setup
Usesetup() when you want to preload account state for dashboards. It is optional for borrowing because executeBorrow() derives the chain from the selected quote and prepares the required wallet/session state automatically:
setup()may prompt the user to sign with their Bitcoin wallet. If you skip setup, the firstexecuteBorrow()call may prompt for the required signatures instead.
Step 3: Preview Fees Before Borrowing
If your UI needs to show fees up front, fetch quotes first and then request the fee breakdown for the selected quote:Step 4: Execute and Track the Borrow
After the user selects a quote, execute that quote and track the resulting borrow workflow:Step 5: Deposit Bitcoin
WhenonDepositReady fires, send the required Bitcoin to the deposit address:
Deposit addresses are single-use and the quote remains locked for up to 6 hours. If the deposit is not received before that window ends, request a fresh quote and deposit address.
Step 6: Loan Complete
Once the deposit is confirmed and processed, the loan will be executed automatically. The borrowed stablecoins will be available in your smart account.Complete Example
What’s Next?
- Configuration - Customize SDK behavior
- Getting a Loan - Detailed loan guide
- API Reference - Full API documentation