Get Started
Prerequisites
npm install satoshi-sdk
import { SatoshiClient } from 'satoshi-sdk';
Example: Calculate Minting Fee
Code
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 minting fee needs to be calculated
const amount = 123456789n; // Using a BigInt for large numbers
// Async function to perform the minting fee calculation
async function calculateMintingFee() {
const result = await getBorrowingFee(
{
publicClient,
protocolConfig,
troveManagerAddr: collateral.TROVE_MANAGER_BEACON_PROXY_ADDRESS,
},
amount
);
// Log the result to the console
console.log('Minting Fee:', result);
}
// Call the function to execute the operation
calculateMintingFee();Last updated