@kamino-finance/klend-sdk
Version:
Typescript SDK for interacting with the Kamino Lending (klend) protocol
682 lines • 23 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReserveHasNonZeroAllocationOrCTokens = exports.WrongAdminOrAllocationAdmin = exports.InvestTooSoon = exports.MinWithdrawAmountTooBig = exports.MissingReserveForBatchRefresh = exports.VaultAUMZero = exports.ManagementFeeGreaterThanMaxAllowed = exports.CannotWithdrawZeroShares = exports.WithdrawResultsInZeroShares = exports.DepositAmountsZeroShares = exports.AUMBelowPendingFees = exports.AUMDecreasedAfterInvest = exports.SharesMintedAmountDoesNotMatch = exports.DisinvestedLiquidityAmountDoesNotMatch = exports.SharesBurnedAmountDoesNotMatch = exports.UserReceivedAmountDoesNotMatch = exports.LiquidityToWithdrawDoesNotMatch = exports.AmountToWithdrawDoesNotMatch = exports.TokensDepositedAmountDoesNotMatch = exports.CannotWithdrawFromEmptyVault = exports.ReserveSpaceExhausted = exports.DepositAmountBelowMinimum = exports.BPSValueTooBig = exports.NotEnoughLiquidityDisinvestedToSendToUser = exports.ReserveIsStale = exports.InitialAccountingIncorrect = exports.SharesMintIncorrect = exports.SharesMintDecimalsIncorrect = exports.TokenVaultIncorrect = exports.TokenMintDecimalsIncorrect = exports.TokenMintIncorrect = exports.BaseVaultAuthorityBumpIncorrect = exports.BaseVaultAuthorityIncorrect = exports.AdminAuthorityIncorrect = exports.InvestAmountBelowMinimum = exports.CannotFindReserveInAllocations = exports.OutOfRangeOfReserveIndex = exports.ReserveAccountAndKeyMismatch = exports.ReserveNotProvidedInTheAccounts = exports.CouldNotDeserializeAccountAsReserve = exports.ReserveNotPartOfAllocations = exports.ReserveAlreadyExists = exports.TooMuchLiquidityToWithdraw = exports.WithdrawAmountBelowMinimum = exports.IntegerOverflow = exports.MathOverflow = exports.SharesIssuedAmountDoesNotMatch = exports.DepositAmountsZero = void 0;
exports.fromCode = fromCode;
class DepositAmountsZero extends Error {
logs;
static code = 7000;
code = 7000;
name = "DepositAmountsZero";
msg = "DepositAmountsZero";
constructor(logs) {
super("7000: DepositAmountsZero");
this.logs = logs;
}
}
exports.DepositAmountsZero = DepositAmountsZero;
class SharesIssuedAmountDoesNotMatch extends Error {
logs;
static code = 7001;
code = 7001;
name = "SharesIssuedAmountDoesNotMatch";
msg = "SharesIssuedAmountDoesNotMatch";
constructor(logs) {
super("7001: SharesIssuedAmountDoesNotMatch");
this.logs = logs;
}
}
exports.SharesIssuedAmountDoesNotMatch = SharesIssuedAmountDoesNotMatch;
class MathOverflow extends Error {
logs;
static code = 7002;
code = 7002;
name = "MathOverflow";
msg = "MathOverflow";
constructor(logs) {
super("7002: MathOverflow");
this.logs = logs;
}
}
exports.MathOverflow = MathOverflow;
class IntegerOverflow extends Error {
logs;
static code = 7003;
code = 7003;
name = "IntegerOverflow";
msg = "IntegerOverflow";
constructor(logs) {
super("7003: IntegerOverflow");
this.logs = logs;
}
}
exports.IntegerOverflow = IntegerOverflow;
class WithdrawAmountBelowMinimum extends Error {
logs;
static code = 7004;
code = 7004;
name = "WithdrawAmountBelowMinimum";
msg = "Withdrawn amount is below minimum";
constructor(logs) {
super("7004: Withdrawn amount is below minimum");
this.logs = logs;
}
}
exports.WithdrawAmountBelowMinimum = WithdrawAmountBelowMinimum;
class TooMuchLiquidityToWithdraw extends Error {
logs;
static code = 7005;
code = 7005;
name = "TooMuchLiquidityToWithdraw";
msg = "TooMuchLiquidityToWithdraw";
constructor(logs) {
super("7005: TooMuchLiquidityToWithdraw");
this.logs = logs;
}
}
exports.TooMuchLiquidityToWithdraw = TooMuchLiquidityToWithdraw;
class ReserveAlreadyExists extends Error {
logs;
static code = 7006;
code = 7006;
name = "ReserveAlreadyExists";
msg = "ReserveAlreadyExists";
constructor(logs) {
super("7006: ReserveAlreadyExists");
this.logs = logs;
}
}
exports.ReserveAlreadyExists = ReserveAlreadyExists;
class ReserveNotPartOfAllocations extends Error {
logs;
static code = 7007;
code = 7007;
name = "ReserveNotPartOfAllocations";
msg = "ReserveNotPartOfAllocations";
constructor(logs) {
super("7007: ReserveNotPartOfAllocations");
this.logs = logs;
}
}
exports.ReserveNotPartOfAllocations = ReserveNotPartOfAllocations;
class CouldNotDeserializeAccountAsReserve extends Error {
logs;
static code = 7008;
code = 7008;
name = "CouldNotDeserializeAccountAsReserve";
msg = "CouldNotDeserializeAccountAsReserve";
constructor(logs) {
super("7008: CouldNotDeserializeAccountAsReserve");
this.logs = logs;
}
}
exports.CouldNotDeserializeAccountAsReserve = CouldNotDeserializeAccountAsReserve;
class ReserveNotProvidedInTheAccounts extends Error {
logs;
static code = 7009;
code = 7009;
name = "ReserveNotProvidedInTheAccounts";
msg = "ReserveNotProvidedInTheAccounts";
constructor(logs) {
super("7009: ReserveNotProvidedInTheAccounts");
this.logs = logs;
}
}
exports.ReserveNotProvidedInTheAccounts = ReserveNotProvidedInTheAccounts;
class ReserveAccountAndKeyMismatch extends Error {
logs;
static code = 7010;
code = 7010;
name = "ReserveAccountAndKeyMismatch";
msg = "ReserveAccountAndKeyMismatch";
constructor(logs) {
super("7010: ReserveAccountAndKeyMismatch");
this.logs = logs;
}
}
exports.ReserveAccountAndKeyMismatch = ReserveAccountAndKeyMismatch;
class OutOfRangeOfReserveIndex extends Error {
logs;
static code = 7011;
code = 7011;
name = "OutOfRangeOfReserveIndex";
msg = "OutOfRangeOfReserveIndex";
constructor(logs) {
super("7011: OutOfRangeOfReserveIndex");
this.logs = logs;
}
}
exports.OutOfRangeOfReserveIndex = OutOfRangeOfReserveIndex;
class CannotFindReserveInAllocations extends Error {
logs;
static code = 7012;
code = 7012;
name = "CannotFindReserveInAllocations";
msg = "OutOfRangeOfReserveIndex";
constructor(logs) {
super("7012: OutOfRangeOfReserveIndex");
this.logs = logs;
}
}
exports.CannotFindReserveInAllocations = CannotFindReserveInAllocations;
class InvestAmountBelowMinimum extends Error {
logs;
static code = 7013;
code = 7013;
name = "InvestAmountBelowMinimum";
msg = "Invested amount is below minimum";
constructor(logs) {
super("7013: Invested amount is below minimum");
this.logs = logs;
}
}
exports.InvestAmountBelowMinimum = InvestAmountBelowMinimum;
class AdminAuthorityIncorrect extends Error {
logs;
static code = 7014;
code = 7014;
name = "AdminAuthorityIncorrect";
msg = "AdminAuthorityIncorrect";
constructor(logs) {
super("7014: AdminAuthorityIncorrect");
this.logs = logs;
}
}
exports.AdminAuthorityIncorrect = AdminAuthorityIncorrect;
class BaseVaultAuthorityIncorrect extends Error {
logs;
static code = 7015;
code = 7015;
name = "BaseVaultAuthorityIncorrect";
msg = "BaseVaultAuthorityIncorrect";
constructor(logs) {
super("7015: BaseVaultAuthorityIncorrect");
this.logs = logs;
}
}
exports.BaseVaultAuthorityIncorrect = BaseVaultAuthorityIncorrect;
class BaseVaultAuthorityBumpIncorrect extends Error {
logs;
static code = 7016;
code = 7016;
name = "BaseVaultAuthorityBumpIncorrect";
msg = "BaseVaultAuthorityBumpIncorrect";
constructor(logs) {
super("7016: BaseVaultAuthorityBumpIncorrect");
this.logs = logs;
}
}
exports.BaseVaultAuthorityBumpIncorrect = BaseVaultAuthorityBumpIncorrect;
class TokenMintIncorrect extends Error {
logs;
static code = 7017;
code = 7017;
name = "TokenMintIncorrect";
msg = "TokenMintIncorrect";
constructor(logs) {
super("7017: TokenMintIncorrect");
this.logs = logs;
}
}
exports.TokenMintIncorrect = TokenMintIncorrect;
class TokenMintDecimalsIncorrect extends Error {
logs;
static code = 7018;
code = 7018;
name = "TokenMintDecimalsIncorrect";
msg = "TokenMintDecimalsIncorrect";
constructor(logs) {
super("7018: TokenMintDecimalsIncorrect");
this.logs = logs;
}
}
exports.TokenMintDecimalsIncorrect = TokenMintDecimalsIncorrect;
class TokenVaultIncorrect extends Error {
logs;
static code = 7019;
code = 7019;
name = "TokenVaultIncorrect";
msg = "TokenVaultIncorrect";
constructor(logs) {
super("7019: TokenVaultIncorrect");
this.logs = logs;
}
}
exports.TokenVaultIncorrect = TokenVaultIncorrect;
class SharesMintDecimalsIncorrect extends Error {
logs;
static code = 7020;
code = 7020;
name = "SharesMintDecimalsIncorrect";
msg = "SharesMintDecimalsIncorrect";
constructor(logs) {
super("7020: SharesMintDecimalsIncorrect");
this.logs = logs;
}
}
exports.SharesMintDecimalsIncorrect = SharesMintDecimalsIncorrect;
class SharesMintIncorrect extends Error {
logs;
static code = 7021;
code = 7021;
name = "SharesMintIncorrect";
msg = "SharesMintIncorrect";
constructor(logs) {
super("7021: SharesMintIncorrect");
this.logs = logs;
}
}
exports.SharesMintIncorrect = SharesMintIncorrect;
class InitialAccountingIncorrect extends Error {
logs;
static code = 7022;
code = 7022;
name = "InitialAccountingIncorrect";
msg = "InitialAccountingIncorrect";
constructor(logs) {
super("7022: InitialAccountingIncorrect");
this.logs = logs;
}
}
exports.InitialAccountingIncorrect = InitialAccountingIncorrect;
class ReserveIsStale extends Error {
logs;
static code = 7023;
code = 7023;
name = "ReserveIsStale";
msg = "Reserve is stale and must be refreshed before any operation";
constructor(logs) {
super("7023: Reserve is stale and must be refreshed before any operation");
this.logs = logs;
}
}
exports.ReserveIsStale = ReserveIsStale;
class NotEnoughLiquidityDisinvestedToSendToUser extends Error {
logs;
static code = 7024;
code = 7024;
name = "NotEnoughLiquidityDisinvestedToSendToUser";
msg = "Not enough liquidity disinvested to send to user";
constructor(logs) {
super("7024: Not enough liquidity disinvested to send to user");
this.logs = logs;
}
}
exports.NotEnoughLiquidityDisinvestedToSendToUser = NotEnoughLiquidityDisinvestedToSendToUser;
class BPSValueTooBig extends Error {
logs;
static code = 7025;
code = 7025;
name = "BPSValueTooBig";
msg = "BPS value is greater than 10000";
constructor(logs) {
super("7025: BPS value is greater than 10000");
this.logs = logs;
}
}
exports.BPSValueTooBig = BPSValueTooBig;
class DepositAmountBelowMinimum extends Error {
logs;
static code = 7026;
code = 7026;
name = "DepositAmountBelowMinimum";
msg = "Deposited amount is below minimum";
constructor(logs) {
super("7026: Deposited amount is below minimum");
this.logs = logs;
}
}
exports.DepositAmountBelowMinimum = DepositAmountBelowMinimum;
class ReserveSpaceExhausted extends Error {
logs;
static code = 7027;
code = 7027;
name = "ReserveSpaceExhausted";
msg = "Vault have no space for new reserves";
constructor(logs) {
super("7027: Vault have no space for new reserves");
this.logs = logs;
}
}
exports.ReserveSpaceExhausted = ReserveSpaceExhausted;
class CannotWithdrawFromEmptyVault extends Error {
logs;
static code = 7028;
code = 7028;
name = "CannotWithdrawFromEmptyVault";
msg = "Cannot withdraw from empty vault";
constructor(logs) {
super("7028: Cannot withdraw from empty vault");
this.logs = logs;
}
}
exports.CannotWithdrawFromEmptyVault = CannotWithdrawFromEmptyVault;
class TokensDepositedAmountDoesNotMatch extends Error {
logs;
static code = 7029;
code = 7029;
name = "TokensDepositedAmountDoesNotMatch";
msg = "TokensDepositedAmountDoesNotMatch";
constructor(logs) {
super("7029: TokensDepositedAmountDoesNotMatch");
this.logs = logs;
}
}
exports.TokensDepositedAmountDoesNotMatch = TokensDepositedAmountDoesNotMatch;
class AmountToWithdrawDoesNotMatch extends Error {
logs;
static code = 7030;
code = 7030;
name = "AmountToWithdrawDoesNotMatch";
msg = "Amount to withdraw does not match";
constructor(logs) {
super("7030: Amount to withdraw does not match");
this.logs = logs;
}
}
exports.AmountToWithdrawDoesNotMatch = AmountToWithdrawDoesNotMatch;
class LiquidityToWithdrawDoesNotMatch extends Error {
logs;
static code = 7031;
code = 7031;
name = "LiquidityToWithdrawDoesNotMatch";
msg = "Liquidity to withdraw does not match";
constructor(logs) {
super("7031: Liquidity to withdraw does not match");
this.logs = logs;
}
}
exports.LiquidityToWithdrawDoesNotMatch = LiquidityToWithdrawDoesNotMatch;
class UserReceivedAmountDoesNotMatch extends Error {
logs;
static code = 7032;
code = 7032;
name = "UserReceivedAmountDoesNotMatch";
msg = "User received amount does not match";
constructor(logs) {
super("7032: User received amount does not match");
this.logs = logs;
}
}
exports.UserReceivedAmountDoesNotMatch = UserReceivedAmountDoesNotMatch;
class SharesBurnedAmountDoesNotMatch extends Error {
logs;
static code = 7033;
code = 7033;
name = "SharesBurnedAmountDoesNotMatch";
msg = "Shares burned amount does not match";
constructor(logs) {
super("7033: Shares burned amount does not match");
this.logs = logs;
}
}
exports.SharesBurnedAmountDoesNotMatch = SharesBurnedAmountDoesNotMatch;
class DisinvestedLiquidityAmountDoesNotMatch extends Error {
logs;
static code = 7034;
code = 7034;
name = "DisinvestedLiquidityAmountDoesNotMatch";
msg = "Disinvested liquidity amount does not match";
constructor(logs) {
super("7034: Disinvested liquidity amount does not match");
this.logs = logs;
}
}
exports.DisinvestedLiquidityAmountDoesNotMatch = DisinvestedLiquidityAmountDoesNotMatch;
class SharesMintedAmountDoesNotMatch extends Error {
logs;
static code = 7035;
code = 7035;
name = "SharesMintedAmountDoesNotMatch";
msg = "SharesMintedAmountDoesNotMatch";
constructor(logs) {
super("7035: SharesMintedAmountDoesNotMatch");
this.logs = logs;
}
}
exports.SharesMintedAmountDoesNotMatch = SharesMintedAmountDoesNotMatch;
class AUMDecreasedAfterInvest extends Error {
logs;
static code = 7036;
code = 7036;
name = "AUMDecreasedAfterInvest";
msg = "AUM decreased after invest";
constructor(logs) {
super("7036: AUM decreased after invest");
this.logs = logs;
}
}
exports.AUMDecreasedAfterInvest = AUMDecreasedAfterInvest;
class AUMBelowPendingFees extends Error {
logs;
static code = 7037;
code = 7037;
name = "AUMBelowPendingFees";
msg = "AUM is below pending fees";
constructor(logs) {
super("7037: AUM is below pending fees");
this.logs = logs;
}
}
exports.AUMBelowPendingFees = AUMBelowPendingFees;
class DepositAmountsZeroShares extends Error {
logs;
static code = 7038;
code = 7038;
name = "DepositAmountsZeroShares";
msg = "Deposit amount results in 0 shares";
constructor(logs) {
super("7038: Deposit amount results in 0 shares");
this.logs = logs;
}
}
exports.DepositAmountsZeroShares = DepositAmountsZeroShares;
class WithdrawResultsInZeroShares extends Error {
logs;
static code = 7039;
code = 7039;
name = "WithdrawResultsInZeroShares";
msg = "Withdraw amount results in 0 shares";
constructor(logs) {
super("7039: Withdraw amount results in 0 shares");
this.logs = logs;
}
}
exports.WithdrawResultsInZeroShares = WithdrawResultsInZeroShares;
class CannotWithdrawZeroShares extends Error {
logs;
static code = 7040;
code = 7040;
name = "CannotWithdrawZeroShares";
msg = "Cannot withdraw zero shares";
constructor(logs) {
super("7040: Cannot withdraw zero shares");
this.logs = logs;
}
}
exports.CannotWithdrawZeroShares = CannotWithdrawZeroShares;
class ManagementFeeGreaterThanMaxAllowed extends Error {
logs;
static code = 7041;
code = 7041;
name = "ManagementFeeGreaterThanMaxAllowed";
msg = "Management fee is greater than maximum allowed";
constructor(logs) {
super("7041: Management fee is greater than maximum allowed");
this.logs = logs;
}
}
exports.ManagementFeeGreaterThanMaxAllowed = ManagementFeeGreaterThanMaxAllowed;
class VaultAUMZero extends Error {
logs;
static code = 7042;
code = 7042;
name = "VaultAUMZero";
msg = "Vault assets under management are empty";
constructor(logs) {
super("7042: Vault assets under management are empty");
this.logs = logs;
}
}
exports.VaultAUMZero = VaultAUMZero;
class MissingReserveForBatchRefresh extends Error {
logs;
static code = 7043;
code = 7043;
name = "MissingReserveForBatchRefresh";
msg = "Missing reserve for batch refresh";
constructor(logs) {
super("7043: Missing reserve for batch refresh");
this.logs = logs;
}
}
exports.MissingReserveForBatchRefresh = MissingReserveForBatchRefresh;
class MinWithdrawAmountTooBig extends Error {
logs;
static code = 7044;
code = 7044;
name = "MinWithdrawAmountTooBig";
msg = "Min withdraw amount is too big";
constructor(logs) {
super("7044: Min withdraw amount is too big");
this.logs = logs;
}
}
exports.MinWithdrawAmountTooBig = MinWithdrawAmountTooBig;
class InvestTooSoon extends Error {
logs;
static code = 7045;
code = 7045;
name = "InvestTooSoon";
msg = "Invest is called too soon after last invest";
constructor(logs) {
super("7045: Invest is called too soon after last invest");
this.logs = logs;
}
}
exports.InvestTooSoon = InvestTooSoon;
class WrongAdminOrAllocationAdmin extends Error {
logs;
static code = 7046;
code = 7046;
name = "WrongAdminOrAllocationAdmin";
msg = "Wrong admin or allocation admin";
constructor(logs) {
super("7046: Wrong admin or allocation admin");
this.logs = logs;
}
}
exports.WrongAdminOrAllocationAdmin = WrongAdminOrAllocationAdmin;
class ReserveHasNonZeroAllocationOrCTokens extends Error {
logs;
static code = 7047;
code = 7047;
name = "ReserveHasNonZeroAllocationOrCTokens";
msg = "Reserve has non-zero allocation or ctokens so cannot be removed";
constructor(logs) {
super("7047: Reserve has non-zero allocation or ctokens so cannot be removed");
this.logs = logs;
}
}
exports.ReserveHasNonZeroAllocationOrCTokens = ReserveHasNonZeroAllocationOrCTokens;
function fromCode(code, logs) {
switch (code) {
case 7000:
return new DepositAmountsZero(logs);
case 7001:
return new SharesIssuedAmountDoesNotMatch(logs);
case 7002:
return new MathOverflow(logs);
case 7003:
return new IntegerOverflow(logs);
case 7004:
return new WithdrawAmountBelowMinimum(logs);
case 7005:
return new TooMuchLiquidityToWithdraw(logs);
case 7006:
return new ReserveAlreadyExists(logs);
case 7007:
return new ReserveNotPartOfAllocations(logs);
case 7008:
return new CouldNotDeserializeAccountAsReserve(logs);
case 7009:
return new ReserveNotProvidedInTheAccounts(logs);
case 7010:
return new ReserveAccountAndKeyMismatch(logs);
case 7011:
return new OutOfRangeOfReserveIndex(logs);
case 7012:
return new CannotFindReserveInAllocations(logs);
case 7013:
return new InvestAmountBelowMinimum(logs);
case 7014:
return new AdminAuthorityIncorrect(logs);
case 7015:
return new BaseVaultAuthorityIncorrect(logs);
case 7016:
return new BaseVaultAuthorityBumpIncorrect(logs);
case 7017:
return new TokenMintIncorrect(logs);
case 7018:
return new TokenMintDecimalsIncorrect(logs);
case 7019:
return new TokenVaultIncorrect(logs);
case 7020:
return new SharesMintDecimalsIncorrect(logs);
case 7021:
return new SharesMintIncorrect(logs);
case 7022:
return new InitialAccountingIncorrect(logs);
case 7023:
return new ReserveIsStale(logs);
case 7024:
return new NotEnoughLiquidityDisinvestedToSendToUser(logs);
case 7025:
return new BPSValueTooBig(logs);
case 7026:
return new DepositAmountBelowMinimum(logs);
case 7027:
return new ReserveSpaceExhausted(logs);
case 7028:
return new CannotWithdrawFromEmptyVault(logs);
case 7029:
return new TokensDepositedAmountDoesNotMatch(logs);
case 7030:
return new AmountToWithdrawDoesNotMatch(logs);
case 7031:
return new LiquidityToWithdrawDoesNotMatch(logs);
case 7032:
return new UserReceivedAmountDoesNotMatch(logs);
case 7033:
return new SharesBurnedAmountDoesNotMatch(logs);
case 7034:
return new DisinvestedLiquidityAmountDoesNotMatch(logs);
case 7035:
return new SharesMintedAmountDoesNotMatch(logs);
case 7036:
return new AUMDecreasedAfterInvest(logs);
case 7037:
return new AUMBelowPendingFees(logs);
case 7038:
return new DepositAmountsZeroShares(logs);
case 7039:
return new WithdrawResultsInZeroShares(logs);
case 7040:
return new CannotWithdrawZeroShares(logs);
case 7041:
return new ManagementFeeGreaterThanMaxAllowed(logs);
case 7042:
return new VaultAUMZero(logs);
case 7043:
return new MissingReserveForBatchRefresh(logs);
case 7044:
return new MinWithdrawAmountTooBig(logs);
case 7045:
return new InvestTooSoon(logs);
case 7046:
return new WrongAdminOrAllocationAdmin(logs);
case 7047:
return new ReserveHasNonZeroAllocationOrCTokens(logs);
}
return null;
}
//# sourceMappingURL=custom.js.map