@kamino-finance/kliquidity-sdk
Version:
Typescript SDK for interacting with the Kamino Liquidity (kliquidity) protocol
112 lines • 12.2 kB
JavaScript
"use strict";
/**
* This code was AUTOGENERATED using the Codama library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun Codama to update it.
*
* @see https://github.com/codama-idl/codama
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AMM_V3_ERROR__INSUFFICIENT_LIQUIDITY_FOR_DIRECTION = exports.AMM_V3_ERROR__MISSING_TICK_ARRAY_BITMAP_EXTENSION_ACCOUNT = exports.AMM_V3_ERROR__NOT_SUPPORT_MINT = exports.AMM_V3_ERROR__UN_INITIALIZED_REWARD_INFO = exports.AMM_V3_ERROR__NOT_APPROVE_UPDATE_REWARD_EMISSIONES = exports.AMM_V3_ERROR__INVALID_REWARD_PERIOD = exports.AMM_V3_ERROR__INVALID_REWARD_INPUT_ACCOUNT_NUMBER = exports.AMM_V3_ERROR__INVALID_REWARD_DESIRED_AMOUNT = exports.AMM_V3_ERROR__INVALID_REWARD_INIT_PARAM = exports.AMM_V3_ERROR__EXCEPT_POOL_VAULT_MINT = exports.AMM_V3_ERROR__REWARD_TOKEN_ALREADY_IN_USE = exports.AMM_V3_ERROR__FULL_REWARD_INFO = exports.AMM_V3_ERROR__INVALID_REWARD_INDEX = exports.AMM_V3_ERROR__INVALID_FIRST_TICK_ARRAY_ACCOUNT = exports.AMM_V3_ERROR__NOT_ENOUGH_TICK_ARRAY_ACCOUNT = exports.AMM_V3_ERROR__TOO_SMALL_INPUT_OR_OUTPUT_AMOUNT = exports.AMM_V3_ERROR__INVALID_INPUT_POOL_VAULT = exports.AMM_V3_ERROR__INVAILD_SWAP_AMOUNT_SPECIFIED = exports.AMM_V3_ERROR__TOO_MUCH_INPUT_PAID = exports.AMM_V3_ERROR__TOO_LITTLE_OUTPUT_RECEIVED = exports.AMM_V3_ERROR__PRICE_SLIPPAGE_CHECK = exports.AMM_V3_ERROR__TRANSACTION_TOO_OLD = exports.AMM_V3_ERROR__LIQUIDITY_INSUFFICIENT = exports.AMM_V3_ERROR__FORBID_BOTH_ZERO_FOR_SUPPLY_LIQUIDITY = exports.AMM_V3_ERROR__INVAILD_LIQUIDITY = exports.AMM_V3_ERROR__LIQUIDITY_ADD_VALUE_ERR = exports.AMM_V3_ERROR__LIQUIDITY_SUB_VALUE_ERR = exports.AMM_V3_ERROR__SQRT_PRICE_X64 = exports.AMM_V3_ERROR__SQRT_PRICE_LIMIT_OVERFLOW = exports.AMM_V3_ERROR__INVALID_TICK_ARRAY_BOUNDARY = exports.AMM_V3_ERROR__INVALID_TICK_ARRAY = exports.AMM_V3_ERROR__TICK_AND_SPACING_NOT_MATCH = exports.AMM_V3_ERROR__TICK_UPPER_OVERFLOW = exports.AMM_V3_ERROR__TICK_LOWER_OVERFLOW = exports.AMM_V3_ERROR__TICK_INVAILD_ORDER = exports.AMM_V3_ERROR__INVAILD_TICK_INDEX = exports.AMM_V3_ERROR__ZERO_MINT_AMOUNT = exports.AMM_V3_ERROR__CLOSE_POSITION_ERR = exports.AMM_V3_ERROR__ACCOUNT_LACK = exports.AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG = exports.AMM_V3_ERROR__NOT_APPROVED = exports.AMM_V3_ERROR__L_O_K = void 0;
exports.getAmmV3ErrorMessage = getAmmV3ErrorMessage;
exports.isAmmV3Error = isAmmV3Error;
const kit_1 = require("@solana/kit");
const programs_1 = require("../programs");
/** LOK: LOK */
exports.AMM_V3_ERROR__L_O_K = 0x1770; // 6000
/** NotApproved: Not approved */
exports.AMM_V3_ERROR__NOT_APPROVED = 0x1771; // 6001
/** InvalidUpdateConfigFlag: invalid update amm config flag */
exports.AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG = 0x1772; // 6002
/** AccountLack: Account lack */
exports.AMM_V3_ERROR__ACCOUNT_LACK = 0x1773; // 6003
/** ClosePositionErr: Remove liquitity, collect fees owed and reward then you can close position account */
exports.AMM_V3_ERROR__CLOSE_POSITION_ERR = 0x1774; // 6004
/** ZeroMintAmount: Minting amount should be greater than 0 */
exports.AMM_V3_ERROR__ZERO_MINT_AMOUNT = 0x1775; // 6005
/** InvaildTickIndex: Tick out of range */
exports.AMM_V3_ERROR__INVAILD_TICK_INDEX = 0x1776; // 6006
/** TickInvaildOrder: The lower tick must be below the upper tick */
exports.AMM_V3_ERROR__TICK_INVAILD_ORDER = 0x1777; // 6007
/** TickLowerOverflow: The tick must be greater, or equal to the minimum tick(-221818) */
exports.AMM_V3_ERROR__TICK_LOWER_OVERFLOW = 0x1778; // 6008
/** TickUpperOverflow: The tick must be lesser than, or equal to the maximum tick(221818) */
exports.AMM_V3_ERROR__TICK_UPPER_OVERFLOW = 0x1779; // 6009
/** TickAndSpacingNotMatch: tick % tick_spacing must be zero */
exports.AMM_V3_ERROR__TICK_AND_SPACING_NOT_MATCH = 0x177a; // 6010
/** InvalidTickArray: Invaild tick array account */
exports.AMM_V3_ERROR__INVALID_TICK_ARRAY = 0x177b; // 6011
/** InvalidTickArrayBoundary: Invaild tick array boundary */
exports.AMM_V3_ERROR__INVALID_TICK_ARRAY_BOUNDARY = 0x177c; // 6012
/** SqrtPriceLimitOverflow: Square root price limit overflow */
exports.AMM_V3_ERROR__SQRT_PRICE_LIMIT_OVERFLOW = 0x177d; // 6013
/** SqrtPriceX64: sqrt_price_x64 out of range */
exports.AMM_V3_ERROR__SQRT_PRICE_X64 = 0x177e; // 6014
/** LiquiditySubValueErr: Liquidity sub delta L must be smaller than before */
exports.AMM_V3_ERROR__LIQUIDITY_SUB_VALUE_ERR = 0x177f; // 6015
/** LiquidityAddValueErr: Liquidity add delta L must be greater, or equal to before */
exports.AMM_V3_ERROR__LIQUIDITY_ADD_VALUE_ERR = 0x1780; // 6016
/** InvaildLiquidity: Invaild liquidity when update position */
exports.AMM_V3_ERROR__INVAILD_LIQUIDITY = 0x1781; // 6017
/** ForbidBothZeroForSupplyLiquidity: Both token amount must not be zero while supply liquidity */
exports.AMM_V3_ERROR__FORBID_BOTH_ZERO_FOR_SUPPLY_LIQUIDITY = 0x1782; // 6018
/** LiquidityInsufficient: Liquidity insufficient */
exports.AMM_V3_ERROR__LIQUIDITY_INSUFFICIENT = 0x1783; // 6019
/** TransactionTooOld: Transaction too old */
exports.AMM_V3_ERROR__TRANSACTION_TOO_OLD = 0x1784; // 6020
/** PriceSlippageCheck: Price slippage check */
exports.AMM_V3_ERROR__PRICE_SLIPPAGE_CHECK = 0x1785; // 6021
/** TooLittleOutputReceived: Too little output received */
exports.AMM_V3_ERROR__TOO_LITTLE_OUTPUT_RECEIVED = 0x1786; // 6022
/** TooMuchInputPaid: Too much input paid */
exports.AMM_V3_ERROR__TOO_MUCH_INPUT_PAID = 0x1787; // 6023
/** InvaildSwapAmountSpecified: Swap special amount can not be zero */
exports.AMM_V3_ERROR__INVAILD_SWAP_AMOUNT_SPECIFIED = 0x1788; // 6024
/** InvalidInputPoolVault: Input pool vault is invalid */
exports.AMM_V3_ERROR__INVALID_INPUT_POOL_VAULT = 0x1789; // 6025
/** TooSmallInputOrOutputAmount: Swap input or output amount is too small */
exports.AMM_V3_ERROR__TOO_SMALL_INPUT_OR_OUTPUT_AMOUNT = 0x178a; // 6026
/** NotEnoughTickArrayAccount: Not enought tick array account */
exports.AMM_V3_ERROR__NOT_ENOUGH_TICK_ARRAY_ACCOUNT = 0x178b; // 6027
/** InvalidFirstTickArrayAccount: Invaild first tick array account */
exports.AMM_V3_ERROR__INVALID_FIRST_TICK_ARRAY_ACCOUNT = 0x178c; // 6028
/** InvalidRewardIndex: Invalid reward index */
exports.AMM_V3_ERROR__INVALID_REWARD_INDEX = 0x178d; // 6029
/** FullRewardInfo: The init reward token reach to the max */
exports.AMM_V3_ERROR__FULL_REWARD_INFO = 0x178e; // 6030
/** RewardTokenAlreadyInUse: The init reward token already in use */
exports.AMM_V3_ERROR__REWARD_TOKEN_ALREADY_IN_USE = 0x178f; // 6031
/** ExceptPoolVaultMint: The reward tokens must contain one of pool vault mint except the last reward */
exports.AMM_V3_ERROR__EXCEPT_POOL_VAULT_MINT = 0x1790; // 6032
/** InvalidRewardInitParam: Invalid reward init param */
exports.AMM_V3_ERROR__INVALID_REWARD_INIT_PARAM = 0x1791; // 6033
/** InvalidRewardDesiredAmount: Invalid collect reward desired amount */
exports.AMM_V3_ERROR__INVALID_REWARD_DESIRED_AMOUNT = 0x1792; // 6034
/** InvalidRewardInputAccountNumber: Invalid collect reward input account number */
exports.AMM_V3_ERROR__INVALID_REWARD_INPUT_ACCOUNT_NUMBER = 0x1793; // 6035
/** InvalidRewardPeriod: Invalid reward period */
exports.AMM_V3_ERROR__INVALID_REWARD_PERIOD = 0x1794; // 6036
/** NotApproveUpdateRewardEmissiones: Modification of emissiones is allowed within 72 hours from the end of the previous cycle */
exports.AMM_V3_ERROR__NOT_APPROVE_UPDATE_REWARD_EMISSIONES = 0x1795; // 6037
/** UnInitializedRewardInfo: uninitialized reward info */
exports.AMM_V3_ERROR__UN_INITIALIZED_REWARD_INFO = 0x1796; // 6038
/** NotSupportMint: Not support token_2022 mint extension */
exports.AMM_V3_ERROR__NOT_SUPPORT_MINT = 0x1797; // 6039
/** MissingTickArrayBitmapExtensionAccount: Missing tickarray bitmap extension account */
exports.AMM_V3_ERROR__MISSING_TICK_ARRAY_BITMAP_EXTENSION_ACCOUNT = 0x1798; // 6040
/** InsufficientLiquidityForDirection: Insufficient liquidity for this direction */
exports.AMM_V3_ERROR__INSUFFICIENT_LIQUIDITY_FOR_DIRECTION = 0x1799; // 6041
let ammV3ErrorMessages;
if (process.env.NODE_ENV !== 'production') {
ammV3ErrorMessages = { [exports.AMM_V3_ERROR__ACCOUNT_LACK]: `Account lack`, [exports.AMM_V3_ERROR__CLOSE_POSITION_ERR]: `Remove liquitity, collect fees owed and reward then you can close position account`, [exports.AMM_V3_ERROR__EXCEPT_POOL_VAULT_MINT]: `The reward tokens must contain one of pool vault mint except the last reward`, [exports.AMM_V3_ERROR__FORBID_BOTH_ZERO_FOR_SUPPLY_LIQUIDITY]: `Both token amount must not be zero while supply liquidity`, [exports.AMM_V3_ERROR__FULL_REWARD_INFO]: `The init reward token reach to the max`, [exports.AMM_V3_ERROR__INSUFFICIENT_LIQUIDITY_FOR_DIRECTION]: `Insufficient liquidity for this direction`, [exports.AMM_V3_ERROR__INVAILD_LIQUIDITY]: `Invaild liquidity when update position`, [exports.AMM_V3_ERROR__INVAILD_SWAP_AMOUNT_SPECIFIED]: `Swap special amount can not be zero`, [exports.AMM_V3_ERROR__INVAILD_TICK_INDEX]: `Tick out of range`, [exports.AMM_V3_ERROR__INVALID_FIRST_TICK_ARRAY_ACCOUNT]: `Invaild first tick array account`, [exports.AMM_V3_ERROR__INVALID_INPUT_POOL_VAULT]: `Input pool vault is invalid`, [exports.AMM_V3_ERROR__INVALID_REWARD_DESIRED_AMOUNT]: `Invalid collect reward desired amount`, [exports.AMM_V3_ERROR__INVALID_REWARD_INDEX]: `Invalid reward index`, [exports.AMM_V3_ERROR__INVALID_REWARD_INIT_PARAM]: `Invalid reward init param`, [exports.AMM_V3_ERROR__INVALID_REWARD_INPUT_ACCOUNT_NUMBER]: `Invalid collect reward input account number`, [exports.AMM_V3_ERROR__INVALID_REWARD_PERIOD]: `Invalid reward period`, [exports.AMM_V3_ERROR__INVALID_TICK_ARRAY]: `Invaild tick array account`, [exports.AMM_V3_ERROR__INVALID_TICK_ARRAY_BOUNDARY]: `Invaild tick array boundary`, [exports.AMM_V3_ERROR__INVALID_UPDATE_CONFIG_FLAG]: `invalid update amm config flag`, [exports.AMM_V3_ERROR__LIQUIDITY_ADD_VALUE_ERR]: `Liquidity add delta L must be greater, or equal to before`, [exports.AMM_V3_ERROR__LIQUIDITY_INSUFFICIENT]: `Liquidity insufficient`, [exports.AMM_V3_ERROR__LIQUIDITY_SUB_VALUE_ERR]: `Liquidity sub delta L must be smaller than before`, [exports.AMM_V3_ERROR__L_O_K]: `LOK`, [exports.AMM_V3_ERROR__MISSING_TICK_ARRAY_BITMAP_EXTENSION_ACCOUNT]: `Missing tickarray bitmap extension account`, [exports.AMM_V3_ERROR__NOT_APPROVED]: `Not approved`, [exports.AMM_V3_ERROR__NOT_APPROVE_UPDATE_REWARD_EMISSIONES]: `Modification of emissiones is allowed within 72 hours from the end of the previous cycle`, [exports.AMM_V3_ERROR__NOT_ENOUGH_TICK_ARRAY_ACCOUNT]: `Not enought tick array account`, [exports.AMM_V3_ERROR__NOT_SUPPORT_MINT]: `Not support token_2022 mint extension`, [exports.AMM_V3_ERROR__PRICE_SLIPPAGE_CHECK]: `Price slippage check`, [exports.AMM_V3_ERROR__REWARD_TOKEN_ALREADY_IN_USE]: `The init reward token already in use`, [exports.AMM_V3_ERROR__SQRT_PRICE_LIMIT_OVERFLOW]: `Square root price limit overflow`, [exports.AMM_V3_ERROR__SQRT_PRICE_X64]: `sqrt_price_x64 out of range`, [exports.AMM_V3_ERROR__TICK_AND_SPACING_NOT_MATCH]: `tick % tick_spacing must be zero`, [exports.AMM_V3_ERROR__TICK_INVAILD_ORDER]: `The lower tick must be below the upper tick`, [exports.AMM_V3_ERROR__TICK_LOWER_OVERFLOW]: `The tick must be greater, or equal to the minimum tick(-221818)`, [exports.AMM_V3_ERROR__TICK_UPPER_OVERFLOW]: `The tick must be lesser than, or equal to the maximum tick(221818)`, [exports.AMM_V3_ERROR__TOO_LITTLE_OUTPUT_RECEIVED]: `Too little output received`, [exports.AMM_V3_ERROR__TOO_MUCH_INPUT_PAID]: `Too much input paid`, [exports.AMM_V3_ERROR__TOO_SMALL_INPUT_OR_OUTPUT_AMOUNT]: `Swap input or output amount is too small`, [exports.AMM_V3_ERROR__TRANSACTION_TOO_OLD]: `Transaction too old`, [exports.AMM_V3_ERROR__UN_INITIALIZED_REWARD_INFO]: `uninitialized reward info`, [exports.AMM_V3_ERROR__ZERO_MINT_AMOUNT]: `Minting amount should be greater than 0` };
}
function getAmmV3ErrorMessage(code) {
if (process.env.NODE_ENV !== 'production') {
return ammV3ErrorMessages[code];
}
return 'Error message not available in production bundles.';
}
function isAmmV3Error(error, transactionMessage, code) {
return (0, kit_1.isProgramError)(error, transactionMessage, programs_1.AMM_V3_PROGRAM_ADDRESS, code);
}
//# sourceMappingURL=ammV3.js.map