Prerequisites
Setup
Shared setup for both deposit and withdraw operations.Authorization keys: Generate a P-256 key pair via the Privy dashboard,
generateP256KeyPair() from @privy-io/node, or OpenSSL. The dashboard/API returns a key ID (AUTH_KEY_ID) used to identify the key when configuring wallet ownership. The private key (AUTH_KEY_PRIVATE) is used in the authorization_context when signing transactions. See the Privy authorization keys docs for details.Deposit
Withdraw
Build Withdraw Instructions
Withdraw full position
Withdraw full position
To withdraw the entire balance instead of a fixed amount, use the Read SDK to fetch the position:This requires
@jup-ag/lend-read: npm install @jup-ag/lend-read