@kamino-finance/klend-sdk
Version:
Typescript SDK for interacting with the Kamino Lending (klend) protocol
85 lines • 3.6 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VAULT_INITIAL_DEPOSIT = exports.MIN_VAULT_INITIAL_DEPOSIT = exports.MIN_INITIAL_DEPOSIT = exports.SOL_PADDING_FOR_INTEREST = exports.DEFAULT_MAX_COMPUTE_UNITS = exports.DEPOSITS_LIMIT = exports.BORROWS_LIMIT = exports.MAINNET_BETA_CHAIN_ID = exports.SOL_DECIMALS = 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.TOTAL_NUMBER_OF_IDS_TO_CHECK = exports.SECONDS_PER_YEAR = 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");
const bn_js_1 = __importDefault(require("bn.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);
exports.SECONDS_PER_YEAR = 365.242_199 * 24.0 * 60.0 * 60.0;
exports.TOTAL_NUMBER_OF_IDS_TO_CHECK = 25;
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_v3.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;
exports.SOL_DECIMALS = 9;
exports.MAINNET_BETA_CHAIN_ID = 101;
exports.BORROWS_LIMIT = 5;
exports.DEPOSITS_LIMIT = 8;
exports.DEFAULT_MAX_COMPUTE_UNITS = 1_400_000;
/**
* Padding for safe interest calculations
*/
exports.SOL_PADDING_FOR_INTEREST = new bn_js_1.default('1000000');
/**
* Minimum initial deposit required for the initialization of a reserve
*/
exports.MIN_INITIAL_DEPOSIT = 100_000;
exports.MIN_VAULT_INITIAL_DEPOSIT = 1_000_000_000;
exports.VAULT_INITIAL_DEPOSIT = 1000;
//# sourceMappingURL=constants.js.map
;