UNPKG

@kamino-finance/kliquidity-sdk

Version:

Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol

767 lines 25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RemainingAccountsInsufficient = exports.RemainingAccountsInvalidSlice = exports.UnsupportedTokenMint = exports.PositionBundleNotDeletable = exports.BundledPositionAlreadyClosed = exports.BundledPositionAlreadyOpened = exports.InvalidBundleIndex = exports.DuplicateTwoHopPool = exports.InvalidIntermediaryMint = exports.AmountRemainingOverflow = exports.AmountCalcOverflow = exports.TickArraySequenceInvalidIndex = exports.AmountInAboveMaximum = exports.AmountOutBelowMinimum = exports.ZeroTradableAmount = exports.InvalidSqrtPriceLimitDirection = exports.MultiplicationOverflow = exports.MulDivInvalidInput = exports.MulDivOverflow = exports.MultiplicationShiftRightOverflow = exports.ProtocolFeeRateMaxExceeded = exports.FeeRateMaxExceeded = exports.RewardVaultAmountInsufficient = exports.InvalidRewardIndex = exports.RewardNotInitialized = exports.InvalidTokenMintOrder = exports.InvalidTickArraySequence = exports.InvalidTimestamp = exports.InvalidTimestampConversion = exports.InvalidPositionTokenAmount = exports.MissingOrInvalidDelegate = exports.TokenMinSubceeded = exports.TokenMaxExceeded = exports.LiquidityNetError = exports.LiquidityUnderflow = exports.LiquidityOverflow = exports.LiquidityTooHigh = exports.LiquidityZero = exports.SqrtPriceOutOfBounds = exports.InvalidTickIndex = exports.TickNotFound = exports.NumberDownCastError = exports.NumberCastError = exports.DivideByZero = exports.ClosePositionNotEmpty = exports.InvalidTickSpacing = exports.TickArrayIndexOutofBounds = exports.TickArrayExistInPool = exports.InvalidStartTick = exports.InvalidEnum = void 0; exports.RemainingAccountsDuplicatedAccountsType = exports.TransferFeeCalculationError = exports.IntermediateTokenAmountMismatch = exports.NoExtraAccountsForTransferHook = void 0; exports.fromCode = fromCode; class InvalidEnum extends Error { logs; static code = 6000; code = 6000; name = "InvalidEnum"; msg = "Enum value could not be converted"; constructor(logs) { super("6000: Enum value could not be converted"); this.logs = logs; } } exports.InvalidEnum = InvalidEnum; class InvalidStartTick extends Error { logs; static code = 6001; code = 6001; name = "InvalidStartTick"; msg = "Invalid start tick index provided."; constructor(logs) { super("6001: Invalid start tick index provided."); this.logs = logs; } } exports.InvalidStartTick = InvalidStartTick; class TickArrayExistInPool extends Error { logs; static code = 6002; code = 6002; name = "TickArrayExistInPool"; msg = "Tick-array already exists in this whirlpool"; constructor(logs) { super("6002: Tick-array already exists in this whirlpool"); this.logs = logs; } } exports.TickArrayExistInPool = TickArrayExistInPool; class TickArrayIndexOutofBounds extends Error { logs; static code = 6003; code = 6003; name = "TickArrayIndexOutofBounds"; msg = "Attempt to search for a tick-array failed"; constructor(logs) { super("6003: Attempt to search for a tick-array failed"); this.logs = logs; } } exports.TickArrayIndexOutofBounds = TickArrayIndexOutofBounds; class InvalidTickSpacing extends Error { logs; static code = 6004; code = 6004; name = "InvalidTickSpacing"; msg = "Tick-spacing is not supported"; constructor(logs) { super("6004: Tick-spacing is not supported"); this.logs = logs; } } exports.InvalidTickSpacing = InvalidTickSpacing; class ClosePositionNotEmpty extends Error { logs; static code = 6005; code = 6005; name = "ClosePositionNotEmpty"; msg = "Position is not empty It cannot be closed"; constructor(logs) { super("6005: Position is not empty It cannot be closed"); this.logs = logs; } } exports.ClosePositionNotEmpty = ClosePositionNotEmpty; class DivideByZero extends Error { logs; static code = 6006; code = 6006; name = "DivideByZero"; msg = "Unable to divide by zero"; constructor(logs) { super("6006: Unable to divide by zero"); this.logs = logs; } } exports.DivideByZero = DivideByZero; class NumberCastError extends Error { logs; static code = 6007; code = 6007; name = "NumberCastError"; msg = "Unable to cast number into BigInt"; constructor(logs) { super("6007: Unable to cast number into BigInt"); this.logs = logs; } } exports.NumberCastError = NumberCastError; class NumberDownCastError extends Error { logs; static code = 6008; code = 6008; name = "NumberDownCastError"; msg = "Unable to down cast number"; constructor(logs) { super("6008: Unable to down cast number"); this.logs = logs; } } exports.NumberDownCastError = NumberDownCastError; class TickNotFound extends Error { logs; static code = 6009; code = 6009; name = "TickNotFound"; msg = "Tick not found within tick array"; constructor(logs) { super("6009: Tick not found within tick array"); this.logs = logs; } } exports.TickNotFound = TickNotFound; class InvalidTickIndex extends Error { logs; static code = 6010; code = 6010; name = "InvalidTickIndex"; msg = "Provided tick index is either out of bounds or uninitializable"; constructor(logs) { super("6010: Provided tick index is either out of bounds or uninitializable"); this.logs = logs; } } exports.InvalidTickIndex = InvalidTickIndex; class SqrtPriceOutOfBounds extends Error { logs; static code = 6011; code = 6011; name = "SqrtPriceOutOfBounds"; msg = "Provided sqrt price out of bounds"; constructor(logs) { super("6011: Provided sqrt price out of bounds"); this.logs = logs; } } exports.SqrtPriceOutOfBounds = SqrtPriceOutOfBounds; class LiquidityZero extends Error { logs; static code = 6012; code = 6012; name = "LiquidityZero"; msg = "Liquidity amount must be greater than zero"; constructor(logs) { super("6012: Liquidity amount must be greater than zero"); this.logs = logs; } } exports.LiquidityZero = LiquidityZero; class LiquidityTooHigh extends Error { logs; static code = 6013; code = 6013; name = "LiquidityTooHigh"; msg = "Liquidity amount must be less than i64::MAX"; constructor(logs) { super("6013: Liquidity amount must be less than i64::MAX"); this.logs = logs; } } exports.LiquidityTooHigh = LiquidityTooHigh; class LiquidityOverflow extends Error { logs; static code = 6014; code = 6014; name = "LiquidityOverflow"; msg = "Liquidity overflow"; constructor(logs) { super("6014: Liquidity overflow"); this.logs = logs; } } exports.LiquidityOverflow = LiquidityOverflow; class LiquidityUnderflow extends Error { logs; static code = 6015; code = 6015; name = "LiquidityUnderflow"; msg = "Liquidity underflow"; constructor(logs) { super("6015: Liquidity underflow"); this.logs = logs; } } exports.LiquidityUnderflow = LiquidityUnderflow; class LiquidityNetError extends Error { logs; static code = 6016; code = 6016; name = "LiquidityNetError"; msg = "Tick liquidity net underflowed or overflowed"; constructor(logs) { super("6016: Tick liquidity net underflowed or overflowed"); this.logs = logs; } } exports.LiquidityNetError = LiquidityNetError; class TokenMaxExceeded extends Error { logs; static code = 6017; code = 6017; name = "TokenMaxExceeded"; msg = "Exceeded token max"; constructor(logs) { super("6017: Exceeded token max"); this.logs = logs; } } exports.TokenMaxExceeded = TokenMaxExceeded; class TokenMinSubceeded extends Error { logs; static code = 6018; code = 6018; name = "TokenMinSubceeded"; msg = "Did not meet token min"; constructor(logs) { super("6018: Did not meet token min"); this.logs = logs; } } exports.TokenMinSubceeded = TokenMinSubceeded; class MissingOrInvalidDelegate extends Error { logs; static code = 6019; code = 6019; name = "MissingOrInvalidDelegate"; msg = "Position token account has a missing or invalid delegate"; constructor(logs) { super("6019: Position token account has a missing or invalid delegate"); this.logs = logs; } } exports.MissingOrInvalidDelegate = MissingOrInvalidDelegate; class InvalidPositionTokenAmount extends Error { logs; static code = 6020; code = 6020; name = "InvalidPositionTokenAmount"; msg = "Position token amount must be 1"; constructor(logs) { super("6020: Position token amount must be 1"); this.logs = logs; } } exports.InvalidPositionTokenAmount = InvalidPositionTokenAmount; class InvalidTimestampConversion extends Error { logs; static code = 6021; code = 6021; name = "InvalidTimestampConversion"; msg = "Timestamp should be convertible from i64 to u64"; constructor(logs) { super("6021: Timestamp should be convertible from i64 to u64"); this.logs = logs; } } exports.InvalidTimestampConversion = InvalidTimestampConversion; class InvalidTimestamp extends Error { logs; static code = 6022; code = 6022; name = "InvalidTimestamp"; msg = "Timestamp should be greater than the last updated timestamp"; constructor(logs) { super("6022: Timestamp should be greater than the last updated timestamp"); this.logs = logs; } } exports.InvalidTimestamp = InvalidTimestamp; class InvalidTickArraySequence extends Error { logs; static code = 6023; code = 6023; name = "InvalidTickArraySequence"; msg = "Invalid tick array sequence provided for instruction."; constructor(logs) { super("6023: Invalid tick array sequence provided for instruction."); this.logs = logs; } } exports.InvalidTickArraySequence = InvalidTickArraySequence; class InvalidTokenMintOrder extends Error { logs; static code = 6024; code = 6024; name = "InvalidTokenMintOrder"; msg = "Token Mint in wrong order"; constructor(logs) { super("6024: Token Mint in wrong order"); this.logs = logs; } } exports.InvalidTokenMintOrder = InvalidTokenMintOrder; class RewardNotInitialized extends Error { logs; static code = 6025; code = 6025; name = "RewardNotInitialized"; msg = "Reward not initialized"; constructor(logs) { super("6025: Reward not initialized"); this.logs = logs; } } exports.RewardNotInitialized = RewardNotInitialized; class InvalidRewardIndex extends Error { logs; static code = 6026; code = 6026; name = "InvalidRewardIndex"; msg = "Invalid reward index"; constructor(logs) { super("6026: Invalid reward index"); this.logs = logs; } } exports.InvalidRewardIndex = InvalidRewardIndex; class RewardVaultAmountInsufficient extends Error { logs; static code = 6027; code = 6027; name = "RewardVaultAmountInsufficient"; msg = "Reward vault requires amount to support emissions for at least one day"; constructor(logs) { super("6027: Reward vault requires amount to support emissions for at least one day"); this.logs = logs; } } exports.RewardVaultAmountInsufficient = RewardVaultAmountInsufficient; class FeeRateMaxExceeded extends Error { logs; static code = 6028; code = 6028; name = "FeeRateMaxExceeded"; msg = "Exceeded max fee rate"; constructor(logs) { super("6028: Exceeded max fee rate"); this.logs = logs; } } exports.FeeRateMaxExceeded = FeeRateMaxExceeded; class ProtocolFeeRateMaxExceeded extends Error { logs; static code = 6029; code = 6029; name = "ProtocolFeeRateMaxExceeded"; msg = "Exceeded max protocol fee rate"; constructor(logs) { super("6029: Exceeded max protocol fee rate"); this.logs = logs; } } exports.ProtocolFeeRateMaxExceeded = ProtocolFeeRateMaxExceeded; class MultiplicationShiftRightOverflow extends Error { logs; static code = 6030; code = 6030; name = "MultiplicationShiftRightOverflow"; msg = "Multiplication with shift right overflow"; constructor(logs) { super("6030: Multiplication with shift right overflow"); this.logs = logs; } } exports.MultiplicationShiftRightOverflow = MultiplicationShiftRightOverflow; class MulDivOverflow extends Error { logs; static code = 6031; code = 6031; name = "MulDivOverflow"; msg = "Muldiv overflow"; constructor(logs) { super("6031: Muldiv overflow"); this.logs = logs; } } exports.MulDivOverflow = MulDivOverflow; class MulDivInvalidInput extends Error { logs; static code = 6032; code = 6032; name = "MulDivInvalidInput"; msg = "Invalid div_u256 input"; constructor(logs) { super("6032: Invalid div_u256 input"); this.logs = logs; } } exports.MulDivInvalidInput = MulDivInvalidInput; class MultiplicationOverflow extends Error { logs; static code = 6033; code = 6033; name = "MultiplicationOverflow"; msg = "Multiplication overflow"; constructor(logs) { super("6033: Multiplication overflow"); this.logs = logs; } } exports.MultiplicationOverflow = MultiplicationOverflow; class InvalidSqrtPriceLimitDirection extends Error { logs; static code = 6034; code = 6034; name = "InvalidSqrtPriceLimitDirection"; msg = "Provided SqrtPriceLimit not in the same direction as the swap."; constructor(logs) { super("6034: Provided SqrtPriceLimit not in the same direction as the swap."); this.logs = logs; } } exports.InvalidSqrtPriceLimitDirection = InvalidSqrtPriceLimitDirection; class ZeroTradableAmount extends Error { logs; static code = 6035; code = 6035; name = "ZeroTradableAmount"; msg = "There are no tradable amount to swap."; constructor(logs) { super("6035: There are no tradable amount to swap."); this.logs = logs; } } exports.ZeroTradableAmount = ZeroTradableAmount; class AmountOutBelowMinimum extends Error { logs; static code = 6036; code = 6036; name = "AmountOutBelowMinimum"; msg = "Amount out below minimum threshold"; constructor(logs) { super("6036: Amount out below minimum threshold"); this.logs = logs; } } exports.AmountOutBelowMinimum = AmountOutBelowMinimum; class AmountInAboveMaximum extends Error { logs; static code = 6037; code = 6037; name = "AmountInAboveMaximum"; msg = "Amount in above maximum threshold"; constructor(logs) { super("6037: Amount in above maximum threshold"); this.logs = logs; } } exports.AmountInAboveMaximum = AmountInAboveMaximum; class TickArraySequenceInvalidIndex extends Error { logs; static code = 6038; code = 6038; name = "TickArraySequenceInvalidIndex"; msg = "Invalid index for tick array sequence"; constructor(logs) { super("6038: Invalid index for tick array sequence"); this.logs = logs; } } exports.TickArraySequenceInvalidIndex = TickArraySequenceInvalidIndex; class AmountCalcOverflow extends Error { logs; static code = 6039; code = 6039; name = "AmountCalcOverflow"; msg = "Amount calculated overflows"; constructor(logs) { super("6039: Amount calculated overflows"); this.logs = logs; } } exports.AmountCalcOverflow = AmountCalcOverflow; class AmountRemainingOverflow extends Error { logs; static code = 6040; code = 6040; name = "AmountRemainingOverflow"; msg = "Amount remaining overflows"; constructor(logs) { super("6040: Amount remaining overflows"); this.logs = logs; } } exports.AmountRemainingOverflow = AmountRemainingOverflow; class InvalidIntermediaryMint extends Error { logs; static code = 6041; code = 6041; name = "InvalidIntermediaryMint"; msg = "Invalid intermediary mint"; constructor(logs) { super("6041: Invalid intermediary mint"); this.logs = logs; } } exports.InvalidIntermediaryMint = InvalidIntermediaryMint; class DuplicateTwoHopPool extends Error { logs; static code = 6042; code = 6042; name = "DuplicateTwoHopPool"; msg = "Duplicate two hop pool"; constructor(logs) { super("6042: Duplicate two hop pool"); this.logs = logs; } } exports.DuplicateTwoHopPool = DuplicateTwoHopPool; class InvalidBundleIndex extends Error { logs; static code = 6043; code = 6043; name = "InvalidBundleIndex"; msg = "Bundle index is out of bounds"; constructor(logs) { super("6043: Bundle index is out of bounds"); this.logs = logs; } } exports.InvalidBundleIndex = InvalidBundleIndex; class BundledPositionAlreadyOpened extends Error { logs; static code = 6044; code = 6044; name = "BundledPositionAlreadyOpened"; msg = "Position has already been opened"; constructor(logs) { super("6044: Position has already been opened"); this.logs = logs; } } exports.BundledPositionAlreadyOpened = BundledPositionAlreadyOpened; class BundledPositionAlreadyClosed extends Error { logs; static code = 6045; code = 6045; name = "BundledPositionAlreadyClosed"; msg = "Position has already been closed"; constructor(logs) { super("6045: Position has already been closed"); this.logs = logs; } } exports.BundledPositionAlreadyClosed = BundledPositionAlreadyClosed; class PositionBundleNotDeletable extends Error { logs; static code = 6046; code = 6046; name = "PositionBundleNotDeletable"; msg = "Unable to delete PositionBundle with open positions"; constructor(logs) { super("6046: Unable to delete PositionBundle with open positions"); this.logs = logs; } } exports.PositionBundleNotDeletable = PositionBundleNotDeletable; class UnsupportedTokenMint extends Error { logs; static code = 6047; code = 6047; name = "UnsupportedTokenMint"; msg = "Token mint has unsupported attributes"; constructor(logs) { super("6047: Token mint has unsupported attributes"); this.logs = logs; } } exports.UnsupportedTokenMint = UnsupportedTokenMint; class RemainingAccountsInvalidSlice extends Error { logs; static code = 6048; code = 6048; name = "RemainingAccountsInvalidSlice"; msg = "Invalid remaining accounts"; constructor(logs) { super("6048: Invalid remaining accounts"); this.logs = logs; } } exports.RemainingAccountsInvalidSlice = RemainingAccountsInvalidSlice; class RemainingAccountsInsufficient extends Error { logs; static code = 6049; code = 6049; name = "RemainingAccountsInsufficient"; msg = "Insufficient remaining accounts"; constructor(logs) { super("6049: Insufficient remaining accounts"); this.logs = logs; } } exports.RemainingAccountsInsufficient = RemainingAccountsInsufficient; class NoExtraAccountsForTransferHook extends Error { logs; static code = 6050; code = 6050; name = "NoExtraAccountsForTransferHook"; msg = "Unable to call transfer hook without extra accounts"; constructor(logs) { super("6050: Unable to call transfer hook without extra accounts"); this.logs = logs; } } exports.NoExtraAccountsForTransferHook = NoExtraAccountsForTransferHook; class IntermediateTokenAmountMismatch extends Error { logs; static code = 6051; code = 6051; name = "IntermediateTokenAmountMismatch"; msg = "Output and input amount mismatch"; constructor(logs) { super("6051: Output and input amount mismatch"); this.logs = logs; } } exports.IntermediateTokenAmountMismatch = IntermediateTokenAmountMismatch; class TransferFeeCalculationError extends Error { logs; static code = 6052; code = 6052; name = "TransferFeeCalculationError"; msg = "Transfer fee calculation failed"; constructor(logs) { super("6052: Transfer fee calculation failed"); this.logs = logs; } } exports.TransferFeeCalculationError = TransferFeeCalculationError; class RemainingAccountsDuplicatedAccountsType extends Error { logs; static code = 6053; code = 6053; name = "RemainingAccountsDuplicatedAccountsType"; msg = "Same accounts type is provided more than once"; constructor(logs) { super("6053: Same accounts type is provided more than once"); this.logs = logs; } } exports.RemainingAccountsDuplicatedAccountsType = RemainingAccountsDuplicatedAccountsType; function fromCode(code, logs) { switch (code) { case 6000: return new InvalidEnum(logs); case 6001: return new InvalidStartTick(logs); case 6002: return new TickArrayExistInPool(logs); case 6003: return new TickArrayIndexOutofBounds(logs); case 6004: return new InvalidTickSpacing(logs); case 6005: return new ClosePositionNotEmpty(logs); case 6006: return new DivideByZero(logs); case 6007: return new NumberCastError(logs); case 6008: return new NumberDownCastError(logs); case 6009: return new TickNotFound(logs); case 6010: return new InvalidTickIndex(logs); case 6011: return new SqrtPriceOutOfBounds(logs); case 6012: return new LiquidityZero(logs); case 6013: return new LiquidityTooHigh(logs); case 6014: return new LiquidityOverflow(logs); case 6015: return new LiquidityUnderflow(logs); case 6016: return new LiquidityNetError(logs); case 6017: return new TokenMaxExceeded(logs); case 6018: return new TokenMinSubceeded(logs); case 6019: return new MissingOrInvalidDelegate(logs); case 6020: return new InvalidPositionTokenAmount(logs); case 6021: return new InvalidTimestampConversion(logs); case 6022: return new InvalidTimestamp(logs); case 6023: return new InvalidTickArraySequence(logs); case 6024: return new InvalidTokenMintOrder(logs); case 6025: return new RewardNotInitialized(logs); case 6026: return new InvalidRewardIndex(logs); case 6027: return new RewardVaultAmountInsufficient(logs); case 6028: return new FeeRateMaxExceeded(logs); case 6029: return new ProtocolFeeRateMaxExceeded(logs); case 6030: return new MultiplicationShiftRightOverflow(logs); case 6031: return new MulDivOverflow(logs); case 6032: return new MulDivInvalidInput(logs); case 6033: return new MultiplicationOverflow(logs); case 6034: return new InvalidSqrtPriceLimitDirection(logs); case 6035: return new ZeroTradableAmount(logs); case 6036: return new AmountOutBelowMinimum(logs); case 6037: return new AmountInAboveMaximum(logs); case 6038: return new TickArraySequenceInvalidIndex(logs); case 6039: return new AmountCalcOverflow(logs); case 6040: return new AmountRemainingOverflow(logs); case 6041: return new InvalidIntermediaryMint(logs); case 6042: return new DuplicateTwoHopPool(logs); case 6043: return new InvalidBundleIndex(logs); case 6044: return new BundledPositionAlreadyOpened(logs); case 6045: return new BundledPositionAlreadyClosed(logs); case 6046: return new PositionBundleNotDeletable(logs); case 6047: return new UnsupportedTokenMint(logs); case 6048: return new RemainingAccountsInvalidSlice(logs); case 6049: return new RemainingAccountsInsufficient(logs); case 6050: return new NoExtraAccountsForTransferHook(logs); case 6051: return new IntermediateTokenAmountMismatch(logs); case 6052: return new TransferFeeCalculationError(logs); case 6053: return new RemainingAccountsDuplicatedAccountsType(logs); } return null; } //# sourceMappingURL=custom.js.map