@kamino-finance/kliquidity-sdk
Version:
Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol
598 lines • 19.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InsufficientLiquidityForDirection = exports.MissingTickArrayBitmapExtensionAccount = exports.NotSupportMint = exports.UnInitializedRewardInfo = exports.NotApproveUpdateRewardEmissiones = exports.InvalidRewardPeriod = exports.InvalidRewardInputAccountNumber = exports.InvalidRewardDesiredAmount = exports.InvalidRewardInitParam = exports.ExceptPoolVaultMint = exports.RewardTokenAlreadyInUse = exports.FullRewardInfo = exports.InvalidRewardIndex = exports.InvalidFirstTickArrayAccount = exports.NotEnoughTickArrayAccount = exports.TooSmallInputOrOutputAmount = exports.InvalidInputPoolVault = exports.InvaildSwapAmountSpecified = exports.TooMuchInputPaid = exports.TooLittleOutputReceived = exports.PriceSlippageCheck = exports.TransactionTooOld = exports.LiquidityInsufficient = exports.ForbidBothZeroForSupplyLiquidity = exports.InvaildLiquidity = exports.LiquidityAddValueErr = exports.LiquiditySubValueErr = exports.SqrtPriceX64 = exports.SqrtPriceLimitOverflow = exports.InvalidTickArrayBoundary = exports.InvalidTickArray = exports.TickAndSpacingNotMatch = exports.TickUpperOverflow = exports.TickLowerOverflow = exports.TickInvaildOrder = exports.InvaildTickIndex = exports.ZeroMintAmount = exports.ClosePositionErr = exports.AccountLack = exports.InvalidUpdateConfigFlag = exports.NotApproved = exports.LOK = void 0;
exports.fromCode = fromCode;
class LOK extends Error {
logs;
static code = 6000;
code = 6000;
name = "LOK";
msg = "LOK";
constructor(logs) {
super("6000: LOK");
this.logs = logs;
}
}
exports.LOK = LOK;
class NotApproved extends Error {
logs;
static code = 6001;
code = 6001;
name = "NotApproved";
msg = "Not approved";
constructor(logs) {
super("6001: Not approved");
this.logs = logs;
}
}
exports.NotApproved = NotApproved;
class InvalidUpdateConfigFlag extends Error {
logs;
static code = 6002;
code = 6002;
name = "InvalidUpdateConfigFlag";
msg = "invalid update amm config flag";
constructor(logs) {
super("6002: invalid update amm config flag");
this.logs = logs;
}
}
exports.InvalidUpdateConfigFlag = InvalidUpdateConfigFlag;
class AccountLack extends Error {
logs;
static code = 6003;
code = 6003;
name = "AccountLack";
msg = "Account lack";
constructor(logs) {
super("6003: Account lack");
this.logs = logs;
}
}
exports.AccountLack = AccountLack;
class ClosePositionErr extends Error {
logs;
static code = 6004;
code = 6004;
name = "ClosePositionErr";
msg = "Remove liquitity, collect fees owed and reward then you can close position account";
constructor(logs) {
super("6004: Remove liquitity, collect fees owed and reward then you can close position account");
this.logs = logs;
}
}
exports.ClosePositionErr = ClosePositionErr;
class ZeroMintAmount extends Error {
logs;
static code = 6005;
code = 6005;
name = "ZeroMintAmount";
msg = "Minting amount should be greater than 0";
constructor(logs) {
super("6005: Minting amount should be greater than 0");
this.logs = logs;
}
}
exports.ZeroMintAmount = ZeroMintAmount;
class InvaildTickIndex extends Error {
logs;
static code = 6006;
code = 6006;
name = "InvaildTickIndex";
msg = "Tick out of range";
constructor(logs) {
super("6006: Tick out of range");
this.logs = logs;
}
}
exports.InvaildTickIndex = InvaildTickIndex;
class TickInvaildOrder extends Error {
logs;
static code = 6007;
code = 6007;
name = "TickInvaildOrder";
msg = "The lower tick must be below the upper tick";
constructor(logs) {
super("6007: The lower tick must be below the upper tick");
this.logs = logs;
}
}
exports.TickInvaildOrder = TickInvaildOrder;
class TickLowerOverflow extends Error {
logs;
static code = 6008;
code = 6008;
name = "TickLowerOverflow";
msg = "The tick must be greater, or equal to the minimum tick(-221818)";
constructor(logs) {
super("6008: The tick must be greater, or equal to the minimum tick(-221818)");
this.logs = logs;
}
}
exports.TickLowerOverflow = TickLowerOverflow;
class TickUpperOverflow extends Error {
logs;
static code = 6009;
code = 6009;
name = "TickUpperOverflow";
msg = "The tick must be lesser than, or equal to the maximum tick(221818)";
constructor(logs) {
super("6009: The tick must be lesser than, or equal to the maximum tick(221818)");
this.logs = logs;
}
}
exports.TickUpperOverflow = TickUpperOverflow;
class TickAndSpacingNotMatch extends Error {
logs;
static code = 6010;
code = 6010;
name = "TickAndSpacingNotMatch";
msg = "tick % tick_spacing must be zero";
constructor(logs) {
super("6010: tick % tick_spacing must be zero");
this.logs = logs;
}
}
exports.TickAndSpacingNotMatch = TickAndSpacingNotMatch;
class InvalidTickArray extends Error {
logs;
static code = 6011;
code = 6011;
name = "InvalidTickArray";
msg = "Invaild tick array account";
constructor(logs) {
super("6011: Invaild tick array account");
this.logs = logs;
}
}
exports.InvalidTickArray = InvalidTickArray;
class InvalidTickArrayBoundary extends Error {
logs;
static code = 6012;
code = 6012;
name = "InvalidTickArrayBoundary";
msg = "Invaild tick array boundary";
constructor(logs) {
super("6012: Invaild tick array boundary");
this.logs = logs;
}
}
exports.InvalidTickArrayBoundary = InvalidTickArrayBoundary;
class SqrtPriceLimitOverflow extends Error {
logs;
static code = 6013;
code = 6013;
name = "SqrtPriceLimitOverflow";
msg = "Square root price limit overflow";
constructor(logs) {
super("6013: Square root price limit overflow");
this.logs = logs;
}
}
exports.SqrtPriceLimitOverflow = SqrtPriceLimitOverflow;
class SqrtPriceX64 extends Error {
logs;
static code = 6014;
code = 6014;
name = "SqrtPriceX64";
msg = "sqrt_price_x64 out of range";
constructor(logs) {
super("6014: sqrt_price_x64 out of range");
this.logs = logs;
}
}
exports.SqrtPriceX64 = SqrtPriceX64;
class LiquiditySubValueErr extends Error {
logs;
static code = 6015;
code = 6015;
name = "LiquiditySubValueErr";
msg = "Liquidity sub delta L must be smaller than before";
constructor(logs) {
super("6015: Liquidity sub delta L must be smaller than before");
this.logs = logs;
}
}
exports.LiquiditySubValueErr = LiquiditySubValueErr;
class LiquidityAddValueErr extends Error {
logs;
static code = 6016;
code = 6016;
name = "LiquidityAddValueErr";
msg = "Liquidity add delta L must be greater, or equal to before";
constructor(logs) {
super("6016: Liquidity add delta L must be greater, or equal to before");
this.logs = logs;
}
}
exports.LiquidityAddValueErr = LiquidityAddValueErr;
class InvaildLiquidity extends Error {
logs;
static code = 6017;
code = 6017;
name = "InvaildLiquidity";
msg = "Invaild liquidity when update position";
constructor(logs) {
super("6017: Invaild liquidity when update position");
this.logs = logs;
}
}
exports.InvaildLiquidity = InvaildLiquidity;
class ForbidBothZeroForSupplyLiquidity extends Error {
logs;
static code = 6018;
code = 6018;
name = "ForbidBothZeroForSupplyLiquidity";
msg = "Both token amount must not be zero while supply liquidity";
constructor(logs) {
super("6018: Both token amount must not be zero while supply liquidity");
this.logs = logs;
}
}
exports.ForbidBothZeroForSupplyLiquidity = ForbidBothZeroForSupplyLiquidity;
class LiquidityInsufficient extends Error {
logs;
static code = 6019;
code = 6019;
name = "LiquidityInsufficient";
msg = "Liquidity insufficient";
constructor(logs) {
super("6019: Liquidity insufficient");
this.logs = logs;
}
}
exports.LiquidityInsufficient = LiquidityInsufficient;
class TransactionTooOld extends Error {
logs;
static code = 6020;
code = 6020;
name = "TransactionTooOld";
msg = "Transaction too old";
constructor(logs) {
super("6020: Transaction too old");
this.logs = logs;
}
}
exports.TransactionTooOld = TransactionTooOld;
class PriceSlippageCheck extends Error {
logs;
static code = 6021;
code = 6021;
name = "PriceSlippageCheck";
msg = "Price slippage check";
constructor(logs) {
super("6021: Price slippage check");
this.logs = logs;
}
}
exports.PriceSlippageCheck = PriceSlippageCheck;
class TooLittleOutputReceived extends Error {
logs;
static code = 6022;
code = 6022;
name = "TooLittleOutputReceived";
msg = "Too little output received";
constructor(logs) {
super("6022: Too little output received");
this.logs = logs;
}
}
exports.TooLittleOutputReceived = TooLittleOutputReceived;
class TooMuchInputPaid extends Error {
logs;
static code = 6023;
code = 6023;
name = "TooMuchInputPaid";
msg = "Too much input paid";
constructor(logs) {
super("6023: Too much input paid");
this.logs = logs;
}
}
exports.TooMuchInputPaid = TooMuchInputPaid;
class InvaildSwapAmountSpecified extends Error {
logs;
static code = 6024;
code = 6024;
name = "InvaildSwapAmountSpecified";
msg = "Swap special amount can not be zero";
constructor(logs) {
super("6024: Swap special amount can not be zero");
this.logs = logs;
}
}
exports.InvaildSwapAmountSpecified = InvaildSwapAmountSpecified;
class InvalidInputPoolVault extends Error {
logs;
static code = 6025;
code = 6025;
name = "InvalidInputPoolVault";
msg = "Input pool vault is invalid";
constructor(logs) {
super("6025: Input pool vault is invalid");
this.logs = logs;
}
}
exports.InvalidInputPoolVault = InvalidInputPoolVault;
class TooSmallInputOrOutputAmount extends Error {
logs;
static code = 6026;
code = 6026;
name = "TooSmallInputOrOutputAmount";
msg = "Swap input or output amount is too small";
constructor(logs) {
super("6026: Swap input or output amount is too small");
this.logs = logs;
}
}
exports.TooSmallInputOrOutputAmount = TooSmallInputOrOutputAmount;
class NotEnoughTickArrayAccount extends Error {
logs;
static code = 6027;
code = 6027;
name = "NotEnoughTickArrayAccount";
msg = "Not enought tick array account";
constructor(logs) {
super("6027: Not enought tick array account");
this.logs = logs;
}
}
exports.NotEnoughTickArrayAccount = NotEnoughTickArrayAccount;
class InvalidFirstTickArrayAccount extends Error {
logs;
static code = 6028;
code = 6028;
name = "InvalidFirstTickArrayAccount";
msg = "Invaild first tick array account";
constructor(logs) {
super("6028: Invaild first tick array account");
this.logs = logs;
}
}
exports.InvalidFirstTickArrayAccount = InvalidFirstTickArrayAccount;
class InvalidRewardIndex extends Error {
logs;
static code = 6029;
code = 6029;
name = "InvalidRewardIndex";
msg = "Invalid reward index";
constructor(logs) {
super("6029: Invalid reward index");
this.logs = logs;
}
}
exports.InvalidRewardIndex = InvalidRewardIndex;
class FullRewardInfo extends Error {
logs;
static code = 6030;
code = 6030;
name = "FullRewardInfo";
msg = "The init reward token reach to the max";
constructor(logs) {
super("6030: The init reward token reach to the max");
this.logs = logs;
}
}
exports.FullRewardInfo = FullRewardInfo;
class RewardTokenAlreadyInUse extends Error {
logs;
static code = 6031;
code = 6031;
name = "RewardTokenAlreadyInUse";
msg = "The init reward token already in use";
constructor(logs) {
super("6031: The init reward token already in use");
this.logs = logs;
}
}
exports.RewardTokenAlreadyInUse = RewardTokenAlreadyInUse;
class ExceptPoolVaultMint extends Error {
logs;
static code = 6032;
code = 6032;
name = "ExceptPoolVaultMint";
msg = "The reward tokens must contain one of pool vault mint except the last reward";
constructor(logs) {
super("6032: The reward tokens must contain one of pool vault mint except the last reward");
this.logs = logs;
}
}
exports.ExceptPoolVaultMint = ExceptPoolVaultMint;
class InvalidRewardInitParam extends Error {
logs;
static code = 6033;
code = 6033;
name = "InvalidRewardInitParam";
msg = "Invalid reward init param";
constructor(logs) {
super("6033: Invalid reward init param");
this.logs = logs;
}
}
exports.InvalidRewardInitParam = InvalidRewardInitParam;
class InvalidRewardDesiredAmount extends Error {
logs;
static code = 6034;
code = 6034;
name = "InvalidRewardDesiredAmount";
msg = "Invalid collect reward desired amount";
constructor(logs) {
super("6034: Invalid collect reward desired amount");
this.logs = logs;
}
}
exports.InvalidRewardDesiredAmount = InvalidRewardDesiredAmount;
class InvalidRewardInputAccountNumber extends Error {
logs;
static code = 6035;
code = 6035;
name = "InvalidRewardInputAccountNumber";
msg = "Invalid collect reward input account number";
constructor(logs) {
super("6035: Invalid collect reward input account number");
this.logs = logs;
}
}
exports.InvalidRewardInputAccountNumber = InvalidRewardInputAccountNumber;
class InvalidRewardPeriod extends Error {
logs;
static code = 6036;
code = 6036;
name = "InvalidRewardPeriod";
msg = "Invalid reward period";
constructor(logs) {
super("6036: Invalid reward period");
this.logs = logs;
}
}
exports.InvalidRewardPeriod = InvalidRewardPeriod;
class NotApproveUpdateRewardEmissiones extends Error {
logs;
static code = 6037;
code = 6037;
name = "NotApproveUpdateRewardEmissiones";
msg = "Modification of emissiones is allowed within 72 hours from the end of the previous cycle";
constructor(logs) {
super("6037: Modification of emissiones is allowed within 72 hours from the end of the previous cycle");
this.logs = logs;
}
}
exports.NotApproveUpdateRewardEmissiones = NotApproveUpdateRewardEmissiones;
class UnInitializedRewardInfo extends Error {
logs;
static code = 6038;
code = 6038;
name = "UnInitializedRewardInfo";
msg = "uninitialized reward info";
constructor(logs) {
super("6038: uninitialized reward info");
this.logs = logs;
}
}
exports.UnInitializedRewardInfo = UnInitializedRewardInfo;
class NotSupportMint extends Error {
logs;
static code = 6039;
code = 6039;
name = "NotSupportMint";
msg = "Not support token_2022 mint extension";
constructor(logs) {
super("6039: Not support token_2022 mint extension");
this.logs = logs;
}
}
exports.NotSupportMint = NotSupportMint;
class MissingTickArrayBitmapExtensionAccount extends Error {
logs;
static code = 6040;
code = 6040;
name = "MissingTickArrayBitmapExtensionAccount";
msg = "Missing tickarray bitmap extension account";
constructor(logs) {
super("6040: Missing tickarray bitmap extension account");
this.logs = logs;
}
}
exports.MissingTickArrayBitmapExtensionAccount = MissingTickArrayBitmapExtensionAccount;
class InsufficientLiquidityForDirection extends Error {
logs;
static code = 6041;
code = 6041;
name = "InsufficientLiquidityForDirection";
msg = "Insufficient liquidity for this direction";
constructor(logs) {
super("6041: Insufficient liquidity for this direction");
this.logs = logs;
}
}
exports.InsufficientLiquidityForDirection = InsufficientLiquidityForDirection;
function fromCode(code, logs) {
switch (code) {
case 6000:
return new LOK(logs);
case 6001:
return new NotApproved(logs);
case 6002:
return new InvalidUpdateConfigFlag(logs);
case 6003:
return new AccountLack(logs);
case 6004:
return new ClosePositionErr(logs);
case 6005:
return new ZeroMintAmount(logs);
case 6006:
return new InvaildTickIndex(logs);
case 6007:
return new TickInvaildOrder(logs);
case 6008:
return new TickLowerOverflow(logs);
case 6009:
return new TickUpperOverflow(logs);
case 6010:
return new TickAndSpacingNotMatch(logs);
case 6011:
return new InvalidTickArray(logs);
case 6012:
return new InvalidTickArrayBoundary(logs);
case 6013:
return new SqrtPriceLimitOverflow(logs);
case 6014:
return new SqrtPriceX64(logs);
case 6015:
return new LiquiditySubValueErr(logs);
case 6016:
return new LiquidityAddValueErr(logs);
case 6017:
return new InvaildLiquidity(logs);
case 6018:
return new ForbidBothZeroForSupplyLiquidity(logs);
case 6019:
return new LiquidityInsufficient(logs);
case 6020:
return new TransactionTooOld(logs);
case 6021:
return new PriceSlippageCheck(logs);
case 6022:
return new TooLittleOutputReceived(logs);
case 6023:
return new TooMuchInputPaid(logs);
case 6024:
return new InvaildSwapAmountSpecified(logs);
case 6025:
return new InvalidInputPoolVault(logs);
case 6026:
return new TooSmallInputOrOutputAmount(logs);
case 6027:
return new NotEnoughTickArrayAccount(logs);
case 6028:
return new InvalidFirstTickArrayAccount(logs);
case 6029:
return new InvalidRewardIndex(logs);
case 6030:
return new FullRewardInfo(logs);
case 6031:
return new RewardTokenAlreadyInUse(logs);
case 6032:
return new ExceptPoolVaultMint(logs);
case 6033:
return new InvalidRewardInitParam(logs);
case 6034:
return new InvalidRewardDesiredAmount(logs);
case 6035:
return new InvalidRewardInputAccountNumber(logs);
case 6036:
return new InvalidRewardPeriod(logs);
case 6037:
return new NotApproveUpdateRewardEmissiones(logs);
case 6038:
return new UnInitializedRewardInfo(logs);
case 6039:
return new NotSupportMint(logs);
case 6040:
return new MissingTickArrayBitmapExtensionAccount(logs);
case 6041:
return new InsufficientLiquidityForDirection(logs);
}
return null;
}
//# sourceMappingURL=custom.js.map