Get Started


Before you begin, ensure you have the following installed:

  • Node.js (version 18 or higher)

  • npm / yarn / pnpm

  • Git (for cloning the repository)

  1. Install SDK

    • install the required npm packages:

    • npm install satoshi-sdk
  2. import package

    • In your TypeScript or JavaScript project, import the SDK:

    • import { SatoshiClient } from 'satoshi-sdk';

Example: Calculate Borrowing Fee

This example shows how to use the Satoshi Protocol SDK to calculate the borrowing fee for a given amount of SAT using a specific collateral type on the BEVM_MAINNET. It utilizes several functions and configurations provided by the SDK to accomplish this.


import { getPublicClientByConfig, ProtocolConfigMap } from 'satoshi-sdk';

// Define the protocol configuration for the BEVM_MAINNET
const protocolConfig = ProtocolConfigMap.BEVM_MAINNET;

// Select the first collateral type available in the configuration
const collateral = protocolConfig.COLLATERALS[0];

// Get a public client configured for the selected protocol configuration
const publicClient = getPublicClientByConfig(protocolConfig);

// Define the amount for which the borrowing fee needs to be calculated
const amount = 123456789n;  // Using a BigInt for large numbers

// Async function to perform the borrowing fee calculation
async function calculateBorrowingFee() {
  const result = await getBorrowingFee(
      troveManagerAddr: collateral.TROVE_MANAGER_BEACON_PROXY_ADDRESS,
  // Log the result to the console
  console.log('Borrowing Fee:', result);

// Call the function to execute the operation

Last updated