import { BorrowSDK } from '@satsterminal-sdk/borrow';
const sdk = new BorrowSDK({
// Required
apiKey: process.env.API_KEY!,
wallet: {
address: userBtcAddress,
publicKey: userPublicKey,
signMessage: async (msg) => wallet.signMessage(msg),
sendBitcoin: async (to, sats) => wallet.send(to, sats)
},
// Optional
workflowPollInterval: 2000,
sessionValiditySeconds: 259200,
autoTrackWorkflows: true,
quoteSelector: (quotes) => {
// Select quote with best APY
return quotes.sort((a, b) =>
parseFloat(a.borrowApy.variable) - parseFloat(b.borrowApy.variable)
)[0];
},
retryConfig: {
maxRetries: 3,
retryDelay: 1000
},
rpcUrl: process.env.RPC_URL,
bundlerUrl: process.env.BUNDLER_URL
});