Skip to main content
Coming soon – The Earn SDK is in development.

1) Install

npm install @satsterminal-sdk/earn @satsterminal-sdk/core

2) Initialize

import { EarnSDK, ChainType } from "@satsterminal-sdk/earn";

const earn = new EarnSDK({
  apiKey: process.env.API_KEY!,
  chain: ChainType.BASE,
  wallet: {
    address: "bc1q...",
    signMessage: async (msg) => myBtcWallet.signMessage(msg),
  },
});

3) Setup (derive smart account + session)

const { smartAccountAddress, userConfig } = await earn.setup();
console.log("Smart account:", smartAccountAddress);

4) List pools and deposit

const pools = await earn.getPools({ collateralToken: "USDC", chain: ChainType.BASE });
const pool = pools[0];

const tx = await earn.createDeposit({
  poolId: pool.id,
  depositAmount: "100",
  depositToken: "USDC",
  collateralToken: "USDC",
  userConfig,
});
console.log("Deposit tx:", tx._id);

5) Check status and withdraw

const status = await earn.getDepositStatus(tx._id);

// When ready to withdraw
const withdrawal = await earn.createWithdraw({
  earnTransactionId: tx._id,
  withdrawAmount: "50",
});

Pool ID format

{protocol}-{asset}-{chain} — e.g. morpho-usdc-base, steakhouse-wbtc-ethereum.

Next steps