Coming soon – The Earn SDK is in development.
EarnSDK
Setup
| Method | Description |
|---|
setup() | Derive smart account, authorize session. Call before deposit/withdraw. |
useSmartAccount(userConfig) | Use existing smart account (e.g. from Borrow SDK). |
Pools
| Method | Description |
|---|
getPools(params?) | List pools. Optional: collateralToken, chain. |
getPoolById(poolId) | Get pool by ID. |
Estimation
| Method | Description |
|---|
getDepositEstimation(params) | Deposit cost. Returns DepositEstimation. Params: depositToken, collateralToken, collateralChain, amount?, depositChain?. |
getWithdrawEstimation(params) | Withdrawal estimate. Returns WithdrawEstimation. Params: amount, collateralToken, depositToken, protocol, transactionType?, collateralChain?. |
Deposits
| Method | Description |
|---|
createDeposit(params) | Create deposit. Requires poolId, depositAmount, depositToken, collateralToken, userConfig. |
getDepositStatus(transactionId) | Get deposit status and withdrawals. |
getDeposits(params?) | List deposits. Optional: page, limit. |
Withdrawals
| Method | Description |
|---|
createWithdraw(params) | Create withdrawal. Requires earnTransactionId, withdrawAmount. Optional: transactionType, userBitcoinAddress. |
getWithdrawStatus(transactionId) | Get withdrawal status. |
getWithdrawals(params?) | List withdrawals. Optional: page, limit. |
Types
import {
ChainType,
EarnWithdrawalType,
type EarnPool,
type EarnTransaction,
type DepositEstimation,
type WithdrawEstimation,
type CreateDepositParams,
type CreateWithdrawParams,
} from "@satsterminal-sdk/earn";
EarnWithdrawalType: INSTANT | STANDARD — Most protocols: instant is 0% fee. Everstake (HYSP): STANDARD = 0% fee, ~3 days; INSTANT = 0.5% fee.
ChainType: BASE, ETHEREUM, ARBITRUM, BITCOIN, POLYGON, OPTIMISM, BSC, etc.
DepositEstimation: totalCostUsd?, bridgeFeeUsd?, gasEstimateUsd?
WithdrawEstimation: withdrawAmount?, receiveAmount?, feeUsd?