UNPKG

@kamino-finance/klend-sdk

Version:

Typescript SDK for interacting with the Kamino Lending (klend) protocol

458 lines 15.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WrongTicketPoolState = exports.CannotSplitZeroShares = exports.CollectingMoreThanUnstaking = exports.InvalidPendingAdmin = exports.WrongTicketAuthority = exports.CannotBurnBeforeTicketAllows = exports.UnsupportedFeeAccountExtension = exports.InvalidFeeAccount = exports.LessWsolThanExpected = exports.LessSharesThanExpected = exports.PoolFeeCannotBe100Percent = exports.NotEnoughStakedSolToDeposit = exports.NotEnoughSharesInTicket = exports.NotEnoughSharesIssued = exports.NotEnoughWsol = exports.CannotCollectZeroSol = exports.CannotBurnZeroShares = exports.CannotMintZeroShares = exports.CannotDepositZeroStakedSol = exports.InvalidStakedSolProgram = exports.UnexpectedSolToCollect = exports.UnexpectedSolToDestake = exports.InvalidStakeAccountCandidate = exports.InvalidStakeAccountSize = exports.InvalidStakeAccountProgram = exports.InvalidStakePoolSize = exports.InvalidStakePoolProgram = exports.StakePoolDeserializeError = exports.InvalidStakePoolAccounts = exports.StakePoolError = exports.ConversionFailed = exports.IntegerOverflow = void 0; exports.fromCode = fromCode; class IntegerOverflow extends Error { logs; static code = 8000; code = 8000; name = "IntegerOverflow"; msg = "IntegerOverflow"; constructor(logs) { super("8000: IntegerOverflow"); this.logs = logs; } } exports.IntegerOverflow = IntegerOverflow; class ConversionFailed extends Error { logs; static code = 8001; code = 8001; name = "ConversionFailed"; msg = "ConversionFailed"; constructor(logs) { super("8001: ConversionFailed"); this.logs = logs; } } exports.ConversionFailed = ConversionFailed; class StakePoolError extends Error { logs; static code = 8002; code = 8002; name = "StakePoolError"; msg = "Stake pool specific error"; constructor(logs) { super("8002: Stake pool specific error"); this.logs = logs; } } exports.StakePoolError = StakePoolError; class InvalidStakePoolAccounts extends Error { logs; static code = 8003; code = 8003; name = "InvalidStakePoolAccounts"; msg = "Passed stake pool accounts are not valid"; constructor(logs) { super("8003: Passed stake pool accounts are not valid"); this.logs = logs; } } exports.InvalidStakePoolAccounts = InvalidStakePoolAccounts; class StakePoolDeserializeError extends Error { logs; static code = 8004; code = 8004; name = "StakePoolDeserializeError"; msg = "Stake pool deserialization error"; constructor(logs) { super("8004: Stake pool deserialization error"); this.logs = logs; } } exports.StakePoolDeserializeError = StakePoolDeserializeError; class InvalidStakePoolProgram extends Error { logs; static code = 8005; code = 8005; name = "InvalidStakePoolProgram"; msg = "Stake pool invalid program"; constructor(logs) { super("8005: Stake pool invalid program"); this.logs = logs; } } exports.InvalidStakePoolProgram = InvalidStakePoolProgram; class InvalidStakePoolSize extends Error { logs; static code = 8006; code = 8006; name = "InvalidStakePoolSize"; msg = "Stake pool invalid size"; constructor(logs) { super("8006: Stake pool invalid size"); this.logs = logs; } } exports.InvalidStakePoolSize = InvalidStakePoolSize; class InvalidStakeAccountProgram extends Error { logs; static code = 8007; code = 8007; name = "InvalidStakeAccountProgram"; msg = "Stake account invalid program"; constructor(logs) { super("8007: Stake account invalid program"); this.logs = logs; } } exports.InvalidStakeAccountProgram = InvalidStakeAccountProgram; class InvalidStakeAccountSize extends Error { logs; static code = 8008; code = 8008; name = "InvalidStakeAccountSize"; msg = "Stake account invalid size"; constructor(logs) { super("8008: Stake account invalid size"); this.logs = logs; } } exports.InvalidStakeAccountSize = InvalidStakeAccountSize; class InvalidStakeAccountCandidate extends Error { logs; static code = 8009; code = 8009; name = "InvalidStakeAccountCandidate"; msg = "Stake account candidates should be uninitialized accounts"; constructor(logs) { super("8009: Stake account candidates should be uninitialized accounts"); this.logs = logs; } } exports.InvalidStakeAccountCandidate = InvalidStakeAccountCandidate; class UnexpectedSolToDestake extends Error { logs; static code = 8010; code = 8010; name = "UnexpectedSolToDestake"; msg = "Simulation and actual cpi call have different results for withdrawing sol from stake pool"; constructor(logs) { super("8010: Simulation and actual cpi call have different results for withdrawing sol from stake pool"); this.logs = logs; } } exports.UnexpectedSolToDestake = UnexpectedSolToDestake; class UnexpectedSolToCollect extends Error { logs; static code = 8011; code = 8011; name = "UnexpectedSolToCollect"; msg = "Simulation and actual cpi call have different results for collecting sol from stake account"; constructor(logs) { super("8011: Simulation and actual cpi call have different results for collecting sol from stake account"); this.logs = logs; } } exports.UnexpectedSolToCollect = UnexpectedSolToCollect; class InvalidStakedSolProgram extends Error { logs; static code = 8012; code = 8012; name = "InvalidStakedSolProgram"; msg = "Staked sol program not support"; constructor(logs) { super("8012: Staked sol program not support"); this.logs = logs; } } exports.InvalidStakedSolProgram = InvalidStakedSolProgram; class CannotDepositZeroStakedSol extends Error { logs; static code = 8013; code = 8013; name = "CannotDepositZeroStakedSol"; msg = "Cannot deposit 0 staked sol"; constructor(logs) { super("8013: Cannot deposit 0 staked sol"); this.logs = logs; } } exports.CannotDepositZeroStakedSol = CannotDepositZeroStakedSol; class CannotMintZeroShares extends Error { logs; static code = 8014; code = 8014; name = "CannotMintZeroShares"; msg = "Cannot mint 0 shares"; constructor(logs) { super("8014: Cannot mint 0 shares"); this.logs = logs; } } exports.CannotMintZeroShares = CannotMintZeroShares; class CannotBurnZeroShares extends Error { logs; static code = 8015; code = 8015; name = "CannotBurnZeroShares"; msg = "Cannot burn 0 shares"; constructor(logs) { super("8015: Cannot burn 0 shares"); this.logs = logs; } } exports.CannotBurnZeroShares = CannotBurnZeroShares; class CannotCollectZeroSol extends Error { logs; static code = 8016; code = 8016; name = "CannotCollectZeroSol"; msg = "Cannot collect 0"; constructor(logs) { super("8016: Cannot collect 0"); this.logs = logs; } } exports.CannotCollectZeroSol = CannotCollectZeroSol; class NotEnoughWsol extends Error { logs; static code = 8017; code = 8017; name = "NotEnoughWsol"; msg = "Not enough wsol in vault"; constructor(logs) { super("8017: Not enough wsol in vault"); this.logs = logs; } } exports.NotEnoughWsol = NotEnoughWsol; class NotEnoughSharesIssued extends Error { logs; static code = 8018; code = 8018; name = "NotEnoughSharesIssued"; msg = "Not enough shares issued"; constructor(logs) { super("8018: Not enough shares issued"); this.logs = logs; } } exports.NotEnoughSharesIssued = NotEnoughSharesIssued; class NotEnoughSharesInTicket extends Error { logs; static code = 8019; code = 8019; name = "NotEnoughSharesInTicket"; msg = "Not enough shares left for ticket"; constructor(logs) { super("8019: Not enough shares left for ticket"); this.logs = logs; } } exports.NotEnoughSharesInTicket = NotEnoughSharesInTicket; class NotEnoughStakedSolToDeposit extends Error { logs; static code = 8020; code = 8020; name = "NotEnoughStakedSolToDeposit"; msg = "Not enough staked sol to deposit (must be at least equivalent to minimum pool delegation)"; constructor(logs) { super("8020: Not enough staked sol to deposit (must be at least equivalent to minimum pool delegation)"); this.logs = logs; } } exports.NotEnoughStakedSolToDeposit = NotEnoughStakedSolToDeposit; class PoolFeeCannotBe100Percent extends Error { logs; static code = 8021; code = 8021; name = "PoolFeeCannotBe100Percent"; msg = "We cannot compute the inverse with fee when value is 100%"; constructor(logs) { super("8021: We cannot compute the inverse with fee when value is 100%"); this.logs = logs; } } exports.PoolFeeCannotBe100Percent = PoolFeeCannotBe100Percent; class LessSharesThanExpected extends Error { logs; static code = 8022; code = 8022; name = "LessSharesThanExpected"; msg = "Received less shares than minimum expected"; constructor(logs) { super("8022: Received less shares than minimum expected"); this.logs = logs; } } exports.LessSharesThanExpected = LessSharesThanExpected; class LessWsolThanExpected extends Error { logs; static code = 8023; code = 8023; name = "LessWsolThanExpected"; msg = "Received less wsol than minimum expected"; constructor(logs) { super("8023: Received less wsol than minimum expected"); this.logs = logs; } } exports.LessWsolThanExpected = LessWsolThanExpected; class InvalidFeeAccount extends Error { logs; static code = 8024; code = 8024; name = "InvalidFeeAccount"; msg = "Manager fee account passed is not valid (wrong token program / account not initialized / wrong mint)"; constructor(logs) { super("8024: Manager fee account passed is not valid (wrong token program / account not initialized / wrong mint)"); this.logs = logs; } } exports.InvalidFeeAccount = InvalidFeeAccount; class UnsupportedFeeAccountExtension extends Error { logs; static code = 8025; code = 8025; name = "UnsupportedFeeAccountExtension"; msg = "Manager fee account passed has unsupported extensions by standard stake pool"; constructor(logs) { super("8025: Manager fee account passed has unsupported extensions by standard stake pool"); this.logs = logs; } } exports.UnsupportedFeeAccountExtension = UnsupportedFeeAccountExtension; class CannotBurnBeforeTicketAllows extends Error { logs; static code = 8026; code = 8026; name = "CannotBurnBeforeTicketAllows"; msg = "Cannot burn shares before unstake ticket allows"; constructor(logs) { super("8026: Cannot burn shares before unstake ticket allows"); this.logs = logs; } } exports.CannotBurnBeforeTicketAllows = CannotBurnBeforeTicketAllows; class WrongTicketAuthority extends Error { logs; static code = 8027; code = 8027; name = "WrongTicketAuthority"; msg = "Cannot burn shares from a ticket if user is not the burn authority"; constructor(logs) { super("8027: Cannot burn shares from a ticket if user is not the burn authority"); this.logs = logs; } } exports.WrongTicketAuthority = WrongTicketAuthority; class InvalidPendingAdmin extends Error { logs; static code = 8028; code = 8028; name = "InvalidPendingAdmin"; msg = "Invalid pending admin"; constructor(logs) { super("8028: Invalid pending admin"); this.logs = logs; } } exports.InvalidPendingAdmin = InvalidPendingAdmin; class CollectingMoreThanUnstaking extends Error { logs; static code = 8029; code = 8029; name = "CollectingMoreThanUnstaking"; msg = "We are trying to collect more SOL than there is unstaking"; constructor(logs) { super("8029: We are trying to collect more SOL than there is unstaking"); this.logs = logs; } } exports.CollectingMoreThanUnstaking = CollectingMoreThanUnstaking; class CannotSplitZeroShares extends Error { logs; static code = 8030; code = 8030; name = "CannotSplitZeroShares"; msg = "Cannot split 0 shares"; constructor(logs) { super("8030: Cannot split 0 shares"); this.logs = logs; } } exports.CannotSplitZeroShares = CannotSplitZeroShares; class WrongTicketPoolState extends Error { logs; static code = 8031; code = 8031; name = "WrongTicketPoolState"; msg = "Cannot burn shares from a ticket if it's not linked to the pool"; constructor(logs) { super("8031: Cannot burn shares from a ticket if it's not linked to the pool"); this.logs = logs; } } exports.WrongTicketPoolState = WrongTicketPoolState; function fromCode(code, logs) { switch (code) { case 8000: return new IntegerOverflow(logs); case 8001: return new ConversionFailed(logs); case 8002: return new StakePoolError(logs); case 8003: return new InvalidStakePoolAccounts(logs); case 8004: return new StakePoolDeserializeError(logs); case 8005: return new InvalidStakePoolProgram(logs); case 8006: return new InvalidStakePoolSize(logs); case 8007: return new InvalidStakeAccountProgram(logs); case 8008: return new InvalidStakeAccountSize(logs); case 8009: return new InvalidStakeAccountCandidate(logs); case 8010: return new UnexpectedSolToDestake(logs); case 8011: return new UnexpectedSolToCollect(logs); case 8012: return new InvalidStakedSolProgram(logs); case 8013: return new CannotDepositZeroStakedSol(logs); case 8014: return new CannotMintZeroShares(logs); case 8015: return new CannotBurnZeroShares(logs); case 8016: return new CannotCollectZeroSol(logs); case 8017: return new NotEnoughWsol(logs); case 8018: return new NotEnoughSharesIssued(logs); case 8019: return new NotEnoughSharesInTicket(logs); case 8020: return new NotEnoughStakedSolToDeposit(logs); case 8021: return new PoolFeeCannotBe100Percent(logs); case 8022: return new LessSharesThanExpected(logs); case 8023: return new LessWsolThanExpected(logs); case 8024: return new InvalidFeeAccount(logs); case 8025: return new UnsupportedFeeAccountExtension(logs); case 8026: return new CannotBurnBeforeTicketAllows(logs); case 8027: return new WrongTicketAuthority(logs); case 8028: return new InvalidPendingAdmin(logs); case 8029: return new CollectingMoreThanUnstaking(logs); case 8030: return new CannotSplitZeroShares(logs); case 8031: return new WrongTicketPoolState(logs); } return null; } //# sourceMappingURL=custom.js.map