@kamino-finance/klend-sdk
Version:
Typescript SDK for interacting with the Kamino Lending (klend) protocol
77 lines • 3.03 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MAINNET_BETA_CHAIN_ID = exports.USDC_MAINNET_MINT = exports.SOL_DECIMALS = exports.WRAPPED_SOL_MINT = exports.MIN_AUTODELEVERAGE_BONUS_BPS = exports.SLOTS_PER_YEAR = exports.SLOTS_PER_DAY = exports.SLOTS_PER_HOUR = exports.SLOTS_PER_MINUTE = exports.SLOTS_PER_SECOND = exports.ONE_HUNDRED_PCT_IN_BPS = exports.CDN_ENDPOINT = exports.INITIAL_COLLATERAL_RATE = exports.U64_MAX = exports.DEFAULT_KLEND_PROGRAM_ID = exports.STAGING_PROGRAM_ID = void 0;
exports.isENV = isENV;
exports.getApiEndpoint = getApiEndpoint;
exports.getProgramId = getProgramId;
const decimal_js_1 = __importDefault(require("decimal.js"));
const programId_1 = require("../idl_codegen/programId");
const web3_js_1 = require("@solana/web3.js");
exports.STAGING_PROGRAM_ID = new web3_js_1.PublicKey('SLendK7ySfcEzyaFqy93gDnD3RtrpXJcnRwb6zFHJSh');
exports.DEFAULT_KLEND_PROGRAM_ID = programId_1.PROGRAM_ID.toString();
exports.U64_MAX = '18446744073709551615';
const INITIAL_COLLATERAL_RATIO = 1;
exports.INITIAL_COLLATERAL_RATE = new decimal_js_1.default(INITIAL_COLLATERAL_RATIO);
function isENV(value) {
return value === 'mainnet-beta' || value === 'devnet' || value === 'localnet';
}
function getApiEndpoint(programId) {
if (programId.equals(programId_1.PROGRAM_ID)) {
return 'https://api.hubbleprotocol.io/v2/kamino-market';
}
else {
return `https://api.hubbleprotocol.io/v2/kamino-market/?programId=${programId.toString()}`;
}
}
exports.CDN_ENDPOINT = 'https://cdn.kamino.finance/kamino_lend_config_v2.json';
exports.ONE_HUNDRED_PCT_IN_BPS = 10_000;
function getProgramId(env = 'mainnet-beta') {
if (env === 'mainnet-beta') {
return programId_1.PROGRAM_ID;
}
else {
return exports.STAGING_PROGRAM_ID;
}
}
/**
* Number of slots per second
*/
exports.SLOTS_PER_SECOND = 2;
/**
* Number of slots per minute
* 2 (slots per second) * 60 = 120
*/
exports.SLOTS_PER_MINUTE = exports.SLOTS_PER_SECOND * 60;
/**
* Number of slots per hour
* 2 (slots per second) * 60 * 60 = 7200
*/
exports.SLOTS_PER_HOUR = exports.SLOTS_PER_MINUTE * 60;
/**
* Number of slots per day
* 2 (slots per second) * 60 * 60 * 24 = 172800
*/
exports.SLOTS_PER_DAY = exports.SLOTS_PER_HOUR * 24;
/**
* Number of slots per year
* 2 (slots per second) * 60 * 60 * 24 * 365 = 63072000
*/
exports.SLOTS_PER_YEAR = exports.SLOTS_PER_DAY * 365;
/**
* Minimum bonus for autodeleverage liquidations in bps
*/
exports.MIN_AUTODELEVERAGE_BONUS_BPS = 50;
/**
* WSOL Mint
*/
exports.WRAPPED_SOL_MINT = new web3_js_1.PublicKey('So11111111111111111111111111111111111111112');
exports.SOL_DECIMALS = 9;
/**
* USDC Mint
*/
exports.USDC_MAINNET_MINT = new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
exports.MAINNET_BETA_CHAIN_ID = 101;
//# sourceMappingURL=constants.js.map
;