@kamino-finance/scope-sdk
Version:
Scope Oracle SDK
739 lines • 25.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PythLazerBestBidPriceNotPresent = exports.PythLazerPriceNotPresent = exports.PythLazerInvalidFeedId = exports.PythLazerInvalidFeedsLength = exports.PythLazerInvalidChannel = exports.PythLazerInvalidMessagePayload = exports.PythLazerInvalidConfidenceFactor = exports.PythLazerInvalidExponent = exports.PythLazerInvalidFeedID = exports.PythLazerVerifyIxFailed = exports.MostRecentOfMaxDivergenceBpsViolated = exports.MostRecentOfMaxAgeViolated = exports.MostRecentOfInvalidMaxAge = exports.MostRecentOfInvalidMaxDivergence = exports.MostRecentOfInvalidSourceIndices = exports.InvalidChainlinkReportData = exports.NoChainlinkReportData = exports.InvalidGenericData = exports.ConfidenceIntervalCheckFailed = exports.SwitchboardOnDemandError = exports.FixedPriceInvalid = exports.CannotResizeAccount = exports.KTokenHoldingsCalculationError = exports.KTokenUnderlyingPriceNotValid = exports.StakeFeeTooHigh = exports.EmptyTokenList = exports.TwapNotEnoughSamplesInPeriod = exports.UnexpectedJlpConfiguration = exports.TwapSampleTooFrequent = exports.TwapSourceIndexOutOfRange = exports.PriceAccountNotExpected = exports.BadSlot = exports.BadTimestamp = exports.UnableToDerivePDA = exports.InvalidTokenUpdateMode = exports.RefreshWithUnexpectedIxs = exports.RefreshInCPI = exports.BadScopeChainOrPrices = exports.UnableToDeserializeAccount = exports.InvalidAccountDiscriminator = exports.SwitchboardV2Error = exports.BadTokenType = exports.BadTokenNb = exports.AccountsAndTokenMismatch = exports.PriceNotValid = exports.UnexpectedAccount = exports.OutOfRangeIntegralConversion = exports.MathOverflow = exports.ConversionFailure = exports.IntegerOverflow = void 0;
exports.PythLazerInvalidAskBidPrices = exports.PythLazerBestAskPriceNotPresent = void 0;
exports.fromCode = fromCode;
class IntegerOverflow extends Error {
logs;
static code = 6000;
code = 6000;
name = "IntegerOverflow";
msg = "Integer overflow";
constructor(logs) {
super("6000: Integer overflow");
this.logs = logs;
}
}
exports.IntegerOverflow = IntegerOverflow;
class ConversionFailure extends Error {
logs;
static code = 6001;
code = 6001;
name = "ConversionFailure";
msg = "Conversion failure";
constructor(logs) {
super("6001: Conversion failure");
this.logs = logs;
}
}
exports.ConversionFailure = ConversionFailure;
class MathOverflow extends Error {
logs;
static code = 6002;
code = 6002;
name = "MathOverflow";
msg = "Mathematical operation with overflow";
constructor(logs) {
super("6002: Mathematical operation with overflow");
this.logs = logs;
}
}
exports.MathOverflow = MathOverflow;
class OutOfRangeIntegralConversion extends Error {
logs;
static code = 6003;
code = 6003;
name = "OutOfRangeIntegralConversion";
msg = "Out of range integral conversion attempted";
constructor(logs) {
super("6003: Out of range integral conversion attempted");
this.logs = logs;
}
}
exports.OutOfRangeIntegralConversion = OutOfRangeIntegralConversion;
class UnexpectedAccount extends Error {
logs;
static code = 6004;
code = 6004;
name = "UnexpectedAccount";
msg = "Unexpected account in instruction";
constructor(logs) {
super("6004: Unexpected account in instruction");
this.logs = logs;
}
}
exports.UnexpectedAccount = UnexpectedAccount;
class PriceNotValid extends Error {
logs;
static code = 6005;
code = 6005;
name = "PriceNotValid";
msg = "Price is not valid";
constructor(logs) {
super("6005: Price is not valid");
this.logs = logs;
}
}
exports.PriceNotValid = PriceNotValid;
class AccountsAndTokenMismatch extends Error {
logs;
static code = 6006;
code = 6006;
name = "AccountsAndTokenMismatch";
msg = "The number of tokens is different from the number of received accounts";
constructor(logs) {
super("6006: The number of tokens is different from the number of received accounts");
this.logs = logs;
}
}
exports.AccountsAndTokenMismatch = AccountsAndTokenMismatch;
class BadTokenNb extends Error {
logs;
static code = 6007;
code = 6007;
name = "BadTokenNb";
msg = "The token index received is out of range";
constructor(logs) {
super("6007: The token index received is out of range");
this.logs = logs;
}
}
exports.BadTokenNb = BadTokenNb;
class BadTokenType extends Error {
logs;
static code = 6008;
code = 6008;
name = "BadTokenType";
msg = "The token type received is invalid";
constructor(logs) {
super("6008: The token type received is invalid");
this.logs = logs;
}
}
exports.BadTokenType = BadTokenType;
class SwitchboardV2Error extends Error {
logs;
static code = 6009;
code = 6009;
name = "SwitchboardV2Error";
msg = "There was an error with the Switchboard V2 retrieval";
constructor(logs) {
super("6009: There was an error with the Switchboard V2 retrieval");
this.logs = logs;
}
}
exports.SwitchboardV2Error = SwitchboardV2Error;
class InvalidAccountDiscriminator extends Error {
logs;
static code = 6010;
code = 6010;
name = "InvalidAccountDiscriminator";
msg = "Invalid account discriminator";
constructor(logs) {
super("6010: Invalid account discriminator");
this.logs = logs;
}
}
exports.InvalidAccountDiscriminator = InvalidAccountDiscriminator;
class UnableToDeserializeAccount extends Error {
logs;
static code = 6011;
code = 6011;
name = "UnableToDeserializeAccount";
msg = "Unable to deserialize account";
constructor(logs) {
super("6011: Unable to deserialize account");
this.logs = logs;
}
}
exports.UnableToDeserializeAccount = UnableToDeserializeAccount;
class BadScopeChainOrPrices extends Error {
logs;
static code = 6012;
code = 6012;
name = "BadScopeChainOrPrices";
msg = "Error while computing price with ScopeChain";
constructor(logs) {
super("6012: Error while computing price with ScopeChain");
this.logs = logs;
}
}
exports.BadScopeChainOrPrices = BadScopeChainOrPrices;
class RefreshInCPI extends Error {
logs;
static code = 6013;
code = 6013;
name = "RefreshInCPI";
msg = "Refresh price instruction called in a CPI";
constructor(logs) {
super("6013: Refresh price instruction called in a CPI");
this.logs = logs;
}
}
exports.RefreshInCPI = RefreshInCPI;
class RefreshWithUnexpectedIxs extends Error {
logs;
static code = 6014;
code = 6014;
name = "RefreshWithUnexpectedIxs";
msg = "Refresh price instruction preceded by unexpected ixs";
constructor(logs) {
super("6014: Refresh price instruction preceded by unexpected ixs");
this.logs = logs;
}
}
exports.RefreshWithUnexpectedIxs = RefreshWithUnexpectedIxs;
class InvalidTokenUpdateMode extends Error {
logs;
static code = 6015;
code = 6015;
name = "InvalidTokenUpdateMode";
msg = "Invalid token metadata update mode";
constructor(logs) {
super("6015: Invalid token metadata update mode");
this.logs = logs;
}
}
exports.InvalidTokenUpdateMode = InvalidTokenUpdateMode;
class UnableToDerivePDA extends Error {
logs;
static code = 6016;
code = 6016;
name = "UnableToDerivePDA";
msg = "Unable to derive PDA address";
constructor(logs) {
super("6016: Unable to derive PDA address");
this.logs = logs;
}
}
exports.UnableToDerivePDA = UnableToDerivePDA;
class BadTimestamp extends Error {
logs;
static code = 6017;
code = 6017;
name = "BadTimestamp";
msg = "Invalid timestamp";
constructor(logs) {
super("6017: Invalid timestamp");
this.logs = logs;
}
}
exports.BadTimestamp = BadTimestamp;
class BadSlot extends Error {
logs;
static code = 6018;
code = 6018;
name = "BadSlot";
msg = "Invalid slot";
constructor(logs) {
super("6018: Invalid slot");
this.logs = logs;
}
}
exports.BadSlot = BadSlot;
class PriceAccountNotExpected extends Error {
logs;
static code = 6019;
code = 6019;
name = "PriceAccountNotExpected";
msg = "TWAP price account is different than Scope ID";
constructor(logs) {
super("6019: TWAP price account is different than Scope ID");
this.logs = logs;
}
}
exports.PriceAccountNotExpected = PriceAccountNotExpected;
class TwapSourceIndexOutOfRange extends Error {
logs;
static code = 6020;
code = 6020;
name = "TwapSourceIndexOutOfRange";
msg = "TWAP source index out of range";
constructor(logs) {
super("6020: TWAP source index out of range");
this.logs = logs;
}
}
exports.TwapSourceIndexOutOfRange = TwapSourceIndexOutOfRange;
class TwapSampleTooFrequent extends Error {
logs;
static code = 6021;
code = 6021;
name = "TwapSampleTooFrequent";
msg = "TWAP sample is too close to the previous one";
constructor(logs) {
super("6021: TWAP sample is too close to the previous one");
this.logs = logs;
}
}
exports.TwapSampleTooFrequent = TwapSampleTooFrequent;
class UnexpectedJlpConfiguration extends Error {
logs;
static code = 6022;
code = 6022;
name = "UnexpectedJlpConfiguration";
msg = "Unexpected JLP configuration";
constructor(logs) {
super("6022: Unexpected JLP configuration");
this.logs = logs;
}
}
exports.UnexpectedJlpConfiguration = UnexpectedJlpConfiguration;
class TwapNotEnoughSamplesInPeriod extends Error {
logs;
static code = 6023;
code = 6023;
name = "TwapNotEnoughSamplesInPeriod";
msg = "Not enough price samples in period to compute TWAP";
constructor(logs) {
super("6023: Not enough price samples in period to compute TWAP");
this.logs = logs;
}
}
exports.TwapNotEnoughSamplesInPeriod = TwapNotEnoughSamplesInPeriod;
class EmptyTokenList extends Error {
logs;
static code = 6024;
code = 6024;
name = "EmptyTokenList";
msg = "The provided token list to refresh is empty";
constructor(logs) {
super("6024: The provided token list to refresh is empty");
this.logs = logs;
}
}
exports.EmptyTokenList = EmptyTokenList;
class StakeFeeTooHigh extends Error {
logs;
static code = 6025;
code = 6025;
name = "StakeFeeTooHigh";
msg = "The stake pool fee is higher than the maximum allowed";
constructor(logs) {
super("6025: The stake pool fee is higher than the maximum allowed");
this.logs = logs;
}
}
exports.StakeFeeTooHigh = StakeFeeTooHigh;
class KTokenUnderlyingPriceNotValid extends Error {
logs;
static code = 6026;
code = 6026;
name = "KTokenUnderlyingPriceNotValid";
msg = "Cannot get a valid price for the tokens composing the Ktoken";
constructor(logs) {
super("6026: Cannot get a valid price for the tokens composing the Ktoken");
this.logs = logs;
}
}
exports.KTokenUnderlyingPriceNotValid = KTokenUnderlyingPriceNotValid;
class KTokenHoldingsCalculationError extends Error {
logs;
static code = 6027;
code = 6027;
name = "KTokenHoldingsCalculationError";
msg = "Error while computing the Ktoken pool holdings";
constructor(logs) {
super("6027: Error while computing the Ktoken pool holdings");
this.logs = logs;
}
}
exports.KTokenHoldingsCalculationError = KTokenHoldingsCalculationError;
class CannotResizeAccount extends Error {
logs;
static code = 6028;
code = 6028;
name = "CannotResizeAccount";
msg = "Cannot resize the account we only allow it to grow in size";
constructor(logs) {
super("6028: Cannot resize the account we only allow it to grow in size");
this.logs = logs;
}
}
exports.CannotResizeAccount = CannotResizeAccount;
class FixedPriceInvalid extends Error {
logs;
static code = 6029;
code = 6029;
name = "FixedPriceInvalid";
msg = "The provided fixed price is invalid";
constructor(logs) {
super("6029: The provided fixed price is invalid");
this.logs = logs;
}
}
exports.FixedPriceInvalid = FixedPriceInvalid;
class SwitchboardOnDemandError extends Error {
logs;
static code = 6030;
code = 6030;
name = "SwitchboardOnDemandError";
msg = "Switchboard On Demand price derive error";
constructor(logs) {
super("6030: Switchboard On Demand price derive error");
this.logs = logs;
}
}
exports.SwitchboardOnDemandError = SwitchboardOnDemandError;
class ConfidenceIntervalCheckFailed extends Error {
logs;
static code = 6031;
code = 6031;
name = "ConfidenceIntervalCheckFailed";
msg = "Confidence interval check failed";
constructor(logs) {
super("6031: Confidence interval check failed");
this.logs = logs;
}
}
exports.ConfidenceIntervalCheckFailed = ConfidenceIntervalCheckFailed;
class InvalidGenericData extends Error {
logs;
static code = 6032;
code = 6032;
name = "InvalidGenericData";
msg = "Invalid generic data";
constructor(logs) {
super("6032: Invalid generic data");
this.logs = logs;
}
}
exports.InvalidGenericData = InvalidGenericData;
class NoChainlinkReportData extends Error {
logs;
static code = 6033;
code = 6033;
name = "NoChainlinkReportData";
msg = "No valid Chainlink report data found";
constructor(logs) {
super("6033: No valid Chainlink report data found");
this.logs = logs;
}
}
exports.NoChainlinkReportData = NoChainlinkReportData;
class InvalidChainlinkReportData extends Error {
logs;
static code = 6034;
code = 6034;
name = "InvalidChainlinkReportData";
msg = "Invalid Chainlink report data format";
constructor(logs) {
super("6034: Invalid Chainlink report data format");
this.logs = logs;
}
}
exports.InvalidChainlinkReportData = InvalidChainlinkReportData;
class MostRecentOfInvalidSourceIndices extends Error {
logs;
static code = 6035;
code = 6035;
name = "MostRecentOfInvalidSourceIndices";
msg = "MostRecentOf config must contain at least one valid source index";
constructor(logs) {
super("6035: MostRecentOf config must contain at least one valid source index");
this.logs = logs;
}
}
exports.MostRecentOfInvalidSourceIndices = MostRecentOfInvalidSourceIndices;
class MostRecentOfInvalidMaxDivergence extends Error {
logs;
static code = 6036;
code = 6036;
name = "MostRecentOfInvalidMaxDivergence";
msg = "Invalid max divergence (bps) for MostRecentOf oracle";
constructor(logs) {
super("6036: Invalid max divergence (bps) for MostRecentOf oracle");
this.logs = logs;
}
}
exports.MostRecentOfInvalidMaxDivergence = MostRecentOfInvalidMaxDivergence;
class MostRecentOfInvalidMaxAge extends Error {
logs;
static code = 6037;
code = 6037;
name = "MostRecentOfInvalidMaxAge";
msg = "Invalid max age (s) for MostRecentOf oracle";
constructor(logs) {
super("6037: Invalid max age (s) for MostRecentOf oracle");
this.logs = logs;
}
}
exports.MostRecentOfInvalidMaxAge = MostRecentOfInvalidMaxAge;
class MostRecentOfMaxAgeViolated extends Error {
logs;
static code = 6038;
code = 6038;
name = "MostRecentOfMaxAgeViolated";
msg = "Max age diff constraint violated for MostRecentOf oracle";
constructor(logs) {
super("6038: Max age diff constraint violated for MostRecentOf oracle");
this.logs = logs;
}
}
exports.MostRecentOfMaxAgeViolated = MostRecentOfMaxAgeViolated;
class MostRecentOfMaxDivergenceBpsViolated extends Error {
logs;
static code = 6039;
code = 6039;
name = "MostRecentOfMaxDivergenceBpsViolated";
msg = "Max divergence bps constraint violated for MostRecentOf oracle";
constructor(logs) {
super("6039: Max divergence bps constraint violated for MostRecentOf oracle");
this.logs = logs;
}
}
exports.MostRecentOfMaxDivergenceBpsViolated = MostRecentOfMaxDivergenceBpsViolated;
class PythLazerVerifyIxFailed extends Error {
logs;
static code = 6040;
code = 6040;
name = "PythLazerVerifyIxFailed";
msg = "The invoked pyth lazer verify instruction failed";
constructor(logs) {
super("6040: The invoked pyth lazer verify instruction failed");
this.logs = logs;
}
}
exports.PythLazerVerifyIxFailed = PythLazerVerifyIxFailed;
class PythLazerInvalidFeedID extends Error {
logs;
static code = 6041;
code = 6041;
name = "PythLazerInvalidFeedID";
msg = "Invalid feed id passed in to PythLazer oracle";
constructor(logs) {
super("6041: Invalid feed id passed in to PythLazer oracle");
this.logs = logs;
}
}
exports.PythLazerInvalidFeedID = PythLazerInvalidFeedID;
class PythLazerInvalidExponent extends Error {
logs;
static code = 6042;
code = 6042;
name = "PythLazerInvalidExponent";
msg = "Invalid exponent passed in to PythLazer oracle";
constructor(logs) {
super("6042: Invalid exponent passed in to PythLazer oracle");
this.logs = logs;
}
}
exports.PythLazerInvalidExponent = PythLazerInvalidExponent;
class PythLazerInvalidConfidenceFactor extends Error {
logs;
static code = 6043;
code = 6043;
name = "PythLazerInvalidConfidenceFactor";
msg = "Invalid confidence factor passed in to PythLazer oracle";
constructor(logs) {
super("6043: Invalid confidence factor passed in to PythLazer oracle");
this.logs = logs;
}
}
exports.PythLazerInvalidConfidenceFactor = PythLazerInvalidConfidenceFactor;
class PythLazerInvalidMessagePayload extends Error {
logs;
static code = 6044;
code = 6044;
name = "PythLazerInvalidMessagePayload";
msg = "Received an invalid message payload in the PythLazer oracle when refreshing price";
constructor(logs) {
super("6044: Received an invalid message payload in the PythLazer oracle when refreshing price");
this.logs = logs;
}
}
exports.PythLazerInvalidMessagePayload = PythLazerInvalidMessagePayload;
class PythLazerInvalidChannel extends Error {
logs;
static code = 6045;
code = 6045;
name = "PythLazerInvalidChannel";
msg = "Received an invalid channel in the PythLazer payload when refreshing price";
constructor(logs) {
super("6045: Received an invalid channel in the PythLazer payload when refreshing price");
this.logs = logs;
}
}
exports.PythLazerInvalidChannel = PythLazerInvalidChannel;
class PythLazerInvalidFeedsLength extends Error {
logs;
static code = 6046;
code = 6046;
name = "PythLazerInvalidFeedsLength";
msg = "Payload should have a single feed in the PythLazer payload when refreshing price";
constructor(logs) {
super("6046: Payload should have a single feed in the PythLazer payload when refreshing price");
this.logs = logs;
}
}
exports.PythLazerInvalidFeedsLength = PythLazerInvalidFeedsLength;
class PythLazerInvalidFeedId extends Error {
logs;
static code = 6047;
code = 6047;
name = "PythLazerInvalidFeedId";
msg = "Invalid feed id in the PythLazer payload when refreshing price";
constructor(logs) {
super("6047: Invalid feed id in the PythLazer payload when refreshing price");
this.logs = logs;
}
}
exports.PythLazerInvalidFeedId = PythLazerInvalidFeedId;
class PythLazerPriceNotPresent extends Error {
logs;
static code = 6048;
code = 6048;
name = "PythLazerPriceNotPresent";
msg = "Property fields in the feed of the PythLazer payload do not contain a price";
constructor(logs) {
super("6048: Property fields in the feed of the PythLazer payload do not contain a price");
this.logs = logs;
}
}
exports.PythLazerPriceNotPresent = PythLazerPriceNotPresent;
class PythLazerBestBidPriceNotPresent extends Error {
logs;
static code = 6049;
code = 6049;
name = "PythLazerBestBidPriceNotPresent";
msg = "Property fields in the feed of the PythLazer payload do not contain a best bid price";
constructor(logs) {
super("6049: Property fields in the feed of the PythLazer payload do not contain a best bid price");
this.logs = logs;
}
}
exports.PythLazerBestBidPriceNotPresent = PythLazerBestBidPriceNotPresent;
class PythLazerBestAskPriceNotPresent extends Error {
logs;
static code = 6050;
code = 6050;
name = "PythLazerBestAskPriceNotPresent";
msg = "Property fields in the feed of the PythLazer payload do not contain a best ask price";
constructor(logs) {
super("6050: Property fields in the feed of the PythLazer payload do not contain a best ask price");
this.logs = logs;
}
}
exports.PythLazerBestAskPriceNotPresent = PythLazerBestAskPriceNotPresent;
class PythLazerInvalidAskBidPrices extends Error {
logs;
static code = 6051;
code = 6051;
name = "PythLazerInvalidAskBidPrices";
msg = "Invalid ask/bid prices provided in the feed of the PythLazer payload";
constructor(logs) {
super("6051: Invalid ask/bid prices provided in the feed of the PythLazer payload");
this.logs = logs;
}
}
exports.PythLazerInvalidAskBidPrices = PythLazerInvalidAskBidPrices;
function fromCode(code, logs) {
switch (code) {
case 6000:
return new IntegerOverflow(logs);
case 6001:
return new ConversionFailure(logs);
case 6002:
return new MathOverflow(logs);
case 6003:
return new OutOfRangeIntegralConversion(logs);
case 6004:
return new UnexpectedAccount(logs);
case 6005:
return new PriceNotValid(logs);
case 6006:
return new AccountsAndTokenMismatch(logs);
case 6007:
return new BadTokenNb(logs);
case 6008:
return new BadTokenType(logs);
case 6009:
return new SwitchboardV2Error(logs);
case 6010:
return new InvalidAccountDiscriminator(logs);
case 6011:
return new UnableToDeserializeAccount(logs);
case 6012:
return new BadScopeChainOrPrices(logs);
case 6013:
return new RefreshInCPI(logs);
case 6014:
return new RefreshWithUnexpectedIxs(logs);
case 6015:
return new InvalidTokenUpdateMode(logs);
case 6016:
return new UnableToDerivePDA(logs);
case 6017:
return new BadTimestamp(logs);
case 6018:
return new BadSlot(logs);
case 6019:
return new PriceAccountNotExpected(logs);
case 6020:
return new TwapSourceIndexOutOfRange(logs);
case 6021:
return new TwapSampleTooFrequent(logs);
case 6022:
return new UnexpectedJlpConfiguration(logs);
case 6023:
return new TwapNotEnoughSamplesInPeriod(logs);
case 6024:
return new EmptyTokenList(logs);
case 6025:
return new StakeFeeTooHigh(logs);
case 6026:
return new KTokenUnderlyingPriceNotValid(logs);
case 6027:
return new KTokenHoldingsCalculationError(logs);
case 6028:
return new CannotResizeAccount(logs);
case 6029:
return new FixedPriceInvalid(logs);
case 6030:
return new SwitchboardOnDemandError(logs);
case 6031:
return new ConfidenceIntervalCheckFailed(logs);
case 6032:
return new InvalidGenericData(logs);
case 6033:
return new NoChainlinkReportData(logs);
case 6034:
return new InvalidChainlinkReportData(logs);
case 6035:
return new MostRecentOfInvalidSourceIndices(logs);
case 6036:
return new MostRecentOfInvalidMaxDivergence(logs);
case 6037:
return new MostRecentOfInvalidMaxAge(logs);
case 6038:
return new MostRecentOfMaxAgeViolated(logs);
case 6039:
return new MostRecentOfMaxDivergenceBpsViolated(logs);
case 6040:
return new PythLazerVerifyIxFailed(logs);
case 6041:
return new PythLazerInvalidFeedID(logs);
case 6042:
return new PythLazerInvalidExponent(logs);
case 6043:
return new PythLazerInvalidConfidenceFactor(logs);
case 6044:
return new PythLazerInvalidMessagePayload(logs);
case 6045:
return new PythLazerInvalidChannel(logs);
case 6046:
return new PythLazerInvalidFeedsLength(logs);
case 6047:
return new PythLazerInvalidFeedId(logs);
case 6048:
return new PythLazerPriceNotPresent(logs);
case 6049:
return new PythLazerBestBidPriceNotPresent(logs);
case 6050:
return new PythLazerBestAskPriceNotPresent(logs);
case 6051:
return new PythLazerInvalidAskBidPrices(logs);
}
return null;
}
//# sourceMappingURL=custom.js.map