Module orca_whirlpool.internal.anchor.errors
Expand source code
import typing
import re
from solders.transaction_status import (
InstructionErrorCustom,
TransactionErrorInstructionError,
)
from solana.rpc.core import RPCException
from solders.rpc.errors import SendTransactionPreflightFailureMessage
from anchorpy.error import extract_code_and_logs
from ..program_id import PROGRAM_ID
from . import anchor
from . import custom
def from_code(code: int) -> typing.Union[custom.CustomError, anchor.AnchorError, None]:
return custom.from_code(code) if code >= 6000 else anchor.from_code(code)
error_re = re.compile(r"Program (\w+) failed: custom program error: (\w+)")
def from_tx_error(
error: RPCException,
) -> typing.Union[anchor.AnchorError, custom.CustomError, None]:
err_info = error.args[0]
extracted = extract_code_and_logs(err_info, PROGRAM_ID)
if extracted is None:
return None
return from_code(extracted[0])
Sub-modules
orca_whirlpool.internal.anchor.errors.anchor
orca_whirlpool.internal.anchor.errors.custom
Functions
def from_code(code: int) ‑> Union[InvalidEnum, InvalidStartTick, TickArrayExistInPool, TickArrayIndexOutofBounds, InvalidTickSpacing, ClosePositionNotEmpty, DivideByZero, NumberCastError, NumberDownCastError, TickNotFound, InvalidTickIndex, SqrtPriceOutOfBounds, LiquidityZero, LiquidityTooHigh, LiquidityOverflow, LiquidityUnderflow, LiquidityNetError, TokenMaxExceeded, TokenMinSubceeded, MissingOrInvalidDelegate, InvalidPositionTokenAmount, InvalidTimestampConversion, InvalidTimestamp, InvalidTickArraySequence, InvalidTokenMintOrder, RewardNotInitialized, InvalidRewardIndex, RewardVaultAmountInsufficient, FeeRateMaxExceeded, ProtocolFeeRateMaxExceeded, MultiplicationShiftRightOverflow, MulDivOverflow, MulDivInvalidInput, MultiplicationOverflow, InvalidSqrtPriceLimitDirection, ZeroTradableAmount, AmountOutBelowMinimum, AmountInAboveMaximum, TickArraySequenceInvalidIndex, AmountCalcOverflow, AmountRemainingOverflow, InvalidIntermediaryMint, DuplicateTwoHopPool, InvalidBundleIndex, BundledPositionAlreadyOpened, BundledPositionAlreadyClosed, PositionBundleNotDeletable, UnsupportedTokenMint, RemainingAccountsInvalidSlice, RemainingAccountsInsufficient, NoExtraAccountsForTransferHook, IntermediateTokenAmountMismatch, TransferFeeCalculationError, RemainingAccountsDuplicatedAccountsType, FullRangeOnlyPool, TooManySupplementalTickArrays, DifferentWhirlpoolTickArrayAccount, PartialFillError, InstructionMissing, InstructionFallbackNotFound, InstructionDidNotDeserialize, InstructionDidNotSerialize, IdlInstructionStub, IdlInstructionInvalidProgram, ConstraintMut, ConstraintHasOne, ConstraintSigner, ConstraintRaw, ConstraintOwner, ConstraintRentExempt, ConstraintSeeds, ConstraintExecutable, ConstraintState, ConstraintAssociated, ConstraintAssociatedInit, ConstraintClose, ConstraintAddress, ConstraintZero, ConstraintTokenMint, ConstraintTokenOwner, ConstraintMintMintAuthority, ConstraintMintFreezeAuthority, ConstraintMintDecimals, ConstraintSpace, RequireViolated, RequireEqViolated, RequireKeysEqViolated, RequireNeqViolated, RequireKeysNeqViolated, RequireGtViolated, RequireGteViolated, AccountDiscriminatorAlreadySet, AccountDiscriminatorNotFound, AccountDiscriminatorMismatch, AccountDidNotDeserialize, AccountDidNotSerialize, AccountNotEnoughKeys, AccountNotMutable, AccountOwnedByWrongProgram, InvalidProgramId, InvalidProgramExecutable, AccountNotSigner, AccountNotSystemOwned, AccountNotInitialized, AccountNotProgramData, AccountNotAssociatedTokenAccount, AccountSysvarMismatch, StateInvalidAddress, Deprecated, ForwardRef(None)]
-
Expand source code
def from_code(code: int) -> typing.Union[custom.CustomError, anchor.AnchorError, None]: return custom.from_code(code) if code >= 6000 else anchor.from_code(code)
def from_tx_error(error: solana.rpc.core.RPCException) ‑> Union[InvalidEnum, InvalidStartTick, TickArrayExistInPool, TickArrayIndexOutofBounds, InvalidTickSpacing, ClosePositionNotEmpty, DivideByZero, NumberCastError, NumberDownCastError, TickNotFound, InvalidTickIndex, SqrtPriceOutOfBounds, LiquidityZero, LiquidityTooHigh, LiquidityOverflow, LiquidityUnderflow, LiquidityNetError, TokenMaxExceeded, TokenMinSubceeded, MissingOrInvalidDelegate, InvalidPositionTokenAmount, InvalidTimestampConversion, InvalidTimestamp, InvalidTickArraySequence, InvalidTokenMintOrder, RewardNotInitialized, InvalidRewardIndex, RewardVaultAmountInsufficient, FeeRateMaxExceeded, ProtocolFeeRateMaxExceeded, MultiplicationShiftRightOverflow, MulDivOverflow, MulDivInvalidInput, MultiplicationOverflow, InvalidSqrtPriceLimitDirection, ZeroTradableAmount, AmountOutBelowMinimum, AmountInAboveMaximum, TickArraySequenceInvalidIndex, AmountCalcOverflow, AmountRemainingOverflow, InvalidIntermediaryMint, DuplicateTwoHopPool, InvalidBundleIndex, BundledPositionAlreadyOpened, BundledPositionAlreadyClosed, PositionBundleNotDeletable, UnsupportedTokenMint, RemainingAccountsInvalidSlice, RemainingAccountsInsufficient, NoExtraAccountsForTransferHook, IntermediateTokenAmountMismatch, TransferFeeCalculationError, RemainingAccountsDuplicatedAccountsType, FullRangeOnlyPool, TooManySupplementalTickArrays, DifferentWhirlpoolTickArrayAccount, PartialFillError, InstructionMissing, InstructionFallbackNotFound, InstructionDidNotDeserialize, InstructionDidNotSerialize, IdlInstructionStub, IdlInstructionInvalidProgram, ConstraintMut, ConstraintHasOne, ConstraintSigner, ConstraintRaw, ConstraintOwner, ConstraintRentExempt, ConstraintSeeds, ConstraintExecutable, ConstraintState, ConstraintAssociated, ConstraintAssociatedInit, ConstraintClose, ConstraintAddress, ConstraintZero, ConstraintTokenMint, ConstraintTokenOwner, ConstraintMintMintAuthority, ConstraintMintFreezeAuthority, ConstraintMintDecimals, ConstraintSpace, RequireViolated, RequireEqViolated, RequireKeysEqViolated, RequireNeqViolated, RequireKeysNeqViolated, RequireGtViolated, RequireGteViolated, AccountDiscriminatorAlreadySet, AccountDiscriminatorNotFound, AccountDiscriminatorMismatch, AccountDidNotDeserialize, AccountDidNotSerialize, AccountNotEnoughKeys, AccountNotMutable, AccountOwnedByWrongProgram, InvalidProgramId, InvalidProgramExecutable, AccountNotSigner, AccountNotSystemOwned, AccountNotInitialized, AccountNotProgramData, AccountNotAssociatedTokenAccount, AccountSysvarMismatch, StateInvalidAddress, Deprecated, ForwardRef(None)]
-
Expand source code
def from_tx_error( error: RPCException, ) -> typing.Union[anchor.AnchorError, custom.CustomError, None]: err_info = error.args[0] extracted = extract_code_and_logs(err_info, PROGRAM_ID) if extracted is None: return None return from_code(extracted[0])